Wikipedia:Reference desk/Archives/Computing/2008 April 10
From Wikipedia, the free encyclopedia
Computing desk | ||
---|---|---|
< April 9 | << Mar | April | May >> | April 11 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
[edit] April 10
[edit] iTunes
Is there a way to get XP itunes to automagically run fullscreen / coverflow view when launched ? Boomshanka (talk) 01:48, 10 April 2008 (UTC)
[edit] Make file usage
I know this can be done many ways, but I'm wondering if there's some "proper" method that I've just never noticed... I hope I can explain this well. I have a project (libPurple). I am working on a plugin for it. In order to make my plugin, I had to alter the auto-generated Makefile to include source directories that aren't normally used by libPurple. It works fine for me, but it would be a pain to tell anyone else who wants to use this plugin that they have ./configure and then alter the Makefile before running make. I know that I could alter the configure script, but I don't want to alter libPurple. I want this plugin to be a single source file you can plop in your libpurple trunk and run make on. So, I wondered if I could pass extra -I options on the command line, but I know that -I for make is where the included Makefile(s) are located, not where the .h files are found. I am beginning to think that the proper method is to have a second Makefile for the plugin that adds the extra directories and then calls the main Makefile - but I'm not sure. So, that is why I'm asking here. -- kainaw™ 01:49, 10 April 2008 (UTC)
- If you're just trying to add some -I to CFLAGS, you could try setting a CFLAGS environment variable when you run configure. If it's autoconf or similar, it will copy the CFLAGS from the environment to the Makefile. --tcsetattr (talk / contribs) 02:42, 10 April 2008 (UTC)
[edit] resize pngs to specified filesize, rather than dimensions
(grr, firefox crashes) Well, since I don't want to retype what I wrote before, when I tried to upload some rather large pngs (think >100 megs), MediaWiki wouldn't let me, even though it's supposed to be able to resize them itself. I want to resize them myself, then, preferably by some sort of filesize goal, rather than dimensions, like this. If I have to do that, I'll play around with getting something that'll work, but I'd like to know if there's a better option. Xiong Chiamiov ::contact:: help! 04:09, 10 April 2008 (UTC)
- I've often wanted this functionality, too, so I went ahead and wrote it up for us. You give it a file name and maximum size, and it does a binary search to find the largest-dimensioned image that is less than or equal to that file size, putting it in "resized-FILENAME". You'll need Imagemagick and the Search::Binary Perl module. Enjoy! --Sean 17:16, 10 April 2008 (UTC)
#!/usr/bin/perl -w use Search::Binary; use strict; use Data::Dumper; sub resize_file { my ($fname, $dimension) = @_; my $resized = "resized-$fname"; system("convert", "-resize", $dimension, $fname, $resized) == 0 or die $!; my $new_size = -s $resized; return $new_size; } sub get_max_dimension { my $fname = shift; my $img_info = `identify '$fname'`; die $! if $?; my ($width, $height) = $img_info =~ / (\d+)x(\d+) / or die "Can't parse: $img_info"; return $width > $height ? $width : $height; } my $biggest_for_fsize = 0; my $prev_dim = 0; sub compare_fsize { my $fname = shift; my $max_fsize = shift; my $this_dim = shift; if (defined $this_dim) { $prev_dim = $this_dim; } else { $this_dim = ++$prev_dim; } my $this_fsize = resize_file($fname, $this_dim); my $comp = $max_fsize <=> $this_fsize; if ($comp >= 0 && $this_dim >= $biggest_for_fsize) { $biggest_for_fsize = $this_dim; } return $comp, $this_dim; } @ARGV == 2 or die "usage: $0 filename max_file_size"; my $fname = shift; my $max_file_size = shift; my $min_file_dimension = 1; my $max_file_dimension = get_max_dimension($fname); binary_search($min_file_dimension, $max_file_dimension, $max_file_size, \&compare_fsize, $fname, 1); die "Can't get it that small" unless $biggest_for_fsize; resize_file($fname, $biggest_for_fsize);
[edit] deleted emails
I accidently deleted 2 email files. I have windows vista. Is there any software out there that is effective in restoring deleted or lost emails with windows vista. —Preceding unsigned comment added by Gitule (talk • contribs) 04:33, 10 April 2008 (UTC)
[edit] Text replace
Hi, anyone know of a basic command line utility to replace text in text files? A Win32 port of some "basic" GNU utility would be super. I'll use it in a batch file to import a text file from a website using WGET, to replace the garbled versions I get for Norwegian characters (which are poorly handled by the site making the text file (Citeulike, to be specific), not by Wget) with proper characters. Thanks a lot! Jørgen (talk) 07:45, 10 April 2008 (UTC)
- I think you want either sed for windows or awk for win. The primer here should help you out on how to use them. Xiong Chiamiov ::contact:: help! 08:27, 10 April 2008 (UTC)
[edit] sql and python help
Hello,
I recently, transitioned from using an excel sheet to trying to use sql (specifically, sqlite) and python to manage some resources.
It used to be, each day was a row, the first column was which date it was and the next five columns would be the five resources, and I would change the color of the rows that were reserved for a given column, for example when I got an e-mail reserving resource 2, from 4/12 to 4/14 I would change those three cells and add the name of the person doing the reserving to the first cell.
WELL....
I've decided to transition to a real database, so I've made a sql layout, and now have to contend with "bookings" so the layout looks like this:
booking_id start-date end-date which_resource other_information
my problem is...how do I get back to the view I had before? I'd like to do a view by date, as below, even though this is only "derived" from the booking start and end times...
How would I go about doing this? Thank you!
date | resource 1 | resource 2 | resource 3 | resource 4 | resource 5 |
---|---|---|---|---|---|
2008-04-10 | (available) | (available) | (available) | Sales conference | (available) |
2008-04-11 | John | (available) | (available) | Sales conference | (available) |
2008-04-12 | John | (available) | (available) | Sales conference | (available) |
2008-04-13 | John | (available) | (available) | Sales conference | (available) |
2008-04-14 | Patrick | (available) | (available) | Sales conference | (available) |
- I assume the problem is that you have a relationship of one resource per booking_id and you are trying to turn it into 5 resources per booking_id. You can group your resources together by adding "group by booking_id" to the end of your query. Then, in your script, as long as the booking_id stays the same, it is another resource for that booking_id. If that is completely off, please explain what you are trying to do a little more. -- kainaw™ 12:18, 10 April 2008 (UTC)
I'm sorry, I'm very very new to SQL and what you said is gobledegook to me :(. It doesn't sound like what I'm trying to do.
I want to go from (simplified example)
Booking_ID / is_for_date: / is_for_resource_number:
1 / June11 / #1
2 / June11 / #2
3 / June12 / #1
4 / June12 / #2
, which is the structure of my database.
to:
Date / state of resource #1 / state of resource #2
June10 / free* / free*
June11 / Taken (by booking with ID 1) / Taken (by booking with ID 2)
June12 / Taken (by booking with ID 3) / Taken (by booking with ID 4)
June13 / free* / free*
June14 / free* / free*
June15 / free* / free*
* Free because in the table above, no booking has this date and resource combination!
, which is just a presentation based on the database.
(This presentation is useful to me because then, if I get an e-mail "are either resources available on June 13th?" I can tell at a glance whether either is, but if none are, I can look at the date above and below to suggest something better, since they are just rows).
Remember, I'm really dealing with 5 resources. So if someone says "is anything available May 17", I should be able to just jump to the row beginning May 17 in the visual layout and see all the bookings...
So...how do I do the inversion? Is my question clear now? —Preceding unsigned comment added by 79.122.13.205 (talk) 13:35, 10 April 2008 (UTC)
- There seem to be some problems with the way you have your single BOOKINGS table set up now:
- 1) It appears to allow double booking.
- 2) It doesn’t easily support periodic booking, like "every Friday".
- 3) It doesn’t support partial day bookings, like "afternoons".
- Instead, I propose you eliminate the bookings table, and instead create a RESERVATIONS table like so:
RSV Table ----------------------------- DATE \ HOUR > Unique primary key RESOURCE/ LAST_NAME FIRST_NAME INFO BOOKING_ID
- I’m not sure if you need to save the BOOKING_ID, although it might provide a quick way for people to look up a particular reservation, especially if they reserved the wrong date. Instead of LAST_NAME and FIRST_NAME, you might want to have something like EMPLOYEE_ID, provided you have an EMPLOYEE table which can be used to find their name given their ID.
- Another approach might be to just use an off-the shelf reservations system, which can handle all the basics. StuRat (talk) 14:18, 10 April 2008 (UTC)
Yeh, I check for conflicts before adding the booking. I think your thing is much more complicated than necessary, because it's not even by hour, it's only on a daily basis. given my current config (which has successfully avoided conflicts) is there a way for me to make the presentation I wanted to? —Preceding unsigned comment added by 79.122.13.205 (talk) 14:49, 10 April 2008 (UTC)
- Hello. It's a perfectly good question. So I suppose two of the ways to do this are:
- 1) figure out the SQL statement equivalent to the query and create a view based on it (I assume that was your original idea). I'm sure there'll be a SQL expert along in a minute who'll take up the challenge.
- 2) You mention Python in the question - if you're using Python to talk to the database and you're good at Python but bad at SQL (like me) then just be lazy and create another table in the form you want and then get Python to make sure the data still makes sense every time you add, update or remove records.
- Good luck --90.203.189.60 (talk) 17:26, 10 April 2008 (UTC)
- I suggest you separate your resources into a second table. Something like:
- CREATE TABLE resource (resource_id BIGINT PRIMARY KEY, ...);
- CREATE TABLE booking (booking_id BIGINT PRIMARY KEY, start_date DATE NOT NULL, end_date DATE NOT NULL, with_resource BIGINT NOT NULL FOREIGN KEY REFERENCES resource(resource_id), other_information VARCHAR(255) NULL);
- then you can use SELECTs and JOINs to perform all kinds of queries. Given the output format you describe I doubt you'll be able to (cleanly) accomplish what you want with a single query, but with a little iteration you can do a great deal. For example, the following could provide the kind of row data you want for a single date:
- SELECT resource.resource_id, booking.booking_id FROM resource LEFT JOIN booking ON resource.resource_id=booking.with_resource WHERE start_date <= ? AND end_date >= ? ORDER BY resource_id;
- where you'll replace the question marks (?) with the date you are interested in (you can either do this directly or with whatever kind of prepared statement support your SQL library provides). Note that you'll get back NULL for booking_id for any resources that don't have a booking for that date ("free"), and you'll get back multiple results for each resource that is somehow double-booked (or triple-booked, etc.) for that date
- If you want your database schema to help ensure you don't double-book, you might instead want a third table that relates a booking and a resource for a given date, with a suitable uniqueness constraint of some kind (you'd want the combination of resource ID and date to be unique). --Prestidigitator (talk) 18:43, 10 April 2008 (UTC)
[edit] How would I How do I make specific files password protected?
I own a PC and run WindowsXP, and I need to keep certain files under lock and key from my children in case I leave my PC on. They are clever little buggers and can find things I've tried to hide in folder after folder. Nusaince (talk) 12:30, 10 April 2008 (UTC)
- If you don't want the kids to use your computer at all, put a hard drive/BIOS password on it, with it set to lock the display after a short idle period and require a password to unlock. They could then only use it if you log them in. Another method is to keep the files on a flash drive you plug into the USB drive, then remove it and lock it in a safe when not in use. Unfortunately, many files leave a local copy when you use them. The safest approach would be to have a completely different computer for your use, which you keep locked up (a laptop would be best to keep it physically locked up, but you can also put a hard drive/BIOS password on it). StuRat (talk) 13:16, 10 April 2008 (UTC)
- You can also generally zip folders and make the zip password protected. I can't remember how to do this on a PC, but it's probably not too difficult. — Sam 17:50, 10 April 2008 (UTC) —Preceding unsigned comment added by 63.138.152.238 (talk)
-
- Why has there never been a way to lock individual folders? Surely loads of people would enjoy this functionality. Are there third-party apps for it? FreeMorpheme (talk) 17:53, 10 April 2008 (UTC)
-
-
-
- (ec) In XP you can lock an individual folder if you own it. Right-click, choose properties, and then the "Sharing" tab. Under "Local sharing and Security" you can check the "Make this folder private". Other users will get a "Access denied" message if they try to open that folder. Of course, it won't work if they can get into your account - so set yourself an account password. Astronaut (talk) 18:21, 10 April 2008 (UTC)
-
-
You could always try putting the files in a passworded Winrar file. I think there is even an option to scramble the file names till the password is put in, if needs be. TheGreatZorko (talk) 10:05, 11 April 2008 (UTC)
For your purpose use of Truecrypt is perfect. Unmount the Truecrypt Volume (you'll see what I mean when you try it) when your away and "good bye" little buggers. - 70.50.182.33 (talk) 15:46, 11 April 2008 (UTC)
[edit] YouTube.com
Why is it that I need a Flash player on YouTube.com, now? I mean I never needed one, then. Ericthebrainiac (talk) 13:06, 10 April 2008 (UTC)
- As far as I know, YouTube has always used Flash. If you've gotten a new computer or browser it might not have the player installed. --LarryMac | Talk 13:23, 10 April 2008 (UTC)
[edit] Zoom
am trying to find a Zoom UIB02 USB Interface Board for a zoom mrs 1608 multitrack recorder, does any one know where i can get one, how much they cost, and what program is used on ones computer. Thanks —Preceding unsigned comment added by 86.18.34.51 (talk) 20:27, 8 April 2008 (UTC)
- It would probably be best to ask the computer desk (here). They deal with most technological stuff in general, despite the name.--LaPianísta! 17:23, 9 April 2008 (UTC)
[edit] downloading an entire website
I'd like to download all files (including CSS, JS, images, etc. along with HTML) associated with a given website of the format http://www.thiswebsite.com/subdirectory/. I want to restrict it to all files either in the subdirectory or the files in directories held by the subdirectory (that is, even if a file in the subdirectory links to a file outside of it, it should ignore this). I want it to drill down as far as it can go. And I want it to save these files in the exact same relative paths as they were originally.
I know this must be possible with wget and curl but lord help me I can't figure it out. If there's a way to do this with curl that would be most helpful since I already have curl on my machine (it is shipped with OS X), where as wget would require me to locate it, install it, etc. which can be a pain.
If there's a Firefox extension that would be fine too. I tried using Scrapbook but while it saved everything just fine it didn't maintain the relative paths, it just dumped it into one big directory. That won't work for me. I've tried DownloadThemAll and FlashGot but neither of these seemed to drill down correctly. Bah.
Thoughts, recommendations? I did this once before with wget, I think, but that was on a different computer, and I don't really remember how I finally got it working. The site itself has some 1,700 total files on it so I can't do it by hand. Thanks a bunch. --140.247.133.130 (talk) 18:05, 10 April 2008 (UTC)
- How about trying out a web crawler? The one I used to have, had a setting to restrict how far off the original site it was allowed to go, and how deep it was to drill down. Astronaut (talk) 18:27, 10 April 2008 (UTC)
- From the wget Man page : "Create a five levels deep mirror image of the GNU web site, with the same directory structure the original has, with only one try per document, saving the log of the activities to gnulog:"
wget -r http://www.gnu.org/ -o gnulog
APL (talk) 19:21, 10 April 2008 (UTC)
[edit] Digital Canuckistan ?
Is Canada going to digital TV/HDTV/ATSC from analog/NTSC anytime soon ? Since the US is in the process of switching over (to be completed by February, 2009), won't US/Canadian border cities get cross interference if the two countries are using the same frequencies for different purposes ? StuRat (talk) 18:24, 10 April 2008 (UTC)
- List of digital television deployments by country#Canada. --LarryMac | Talk 19:51, 10 April 2008 (UTC)
OK, that says Canada switches over by August, 2011. That still leaves part 2 of my question: during the 2.5 year period between the US switchover and the Canadian switchover, won't there by cross interference in border cities ? StuRat (talk) 20:03, 10 April 2008 (UTC)
- Telcos need a license to use cell phone networks into other countries. I remember someone saying that when she drove from Northern Ireland into Ireland and the only reason she found out that she had crossed the border was the cell phone beeping that she was in a different network. I would say the cell phone operators will make sure that they do not interfere in Canadian lands... unless ... well we will not get into that. Kushal 20:19, 10 April 2008 (UTC)
- Why would there be interference? The only way that two television stations would interfere with each other is if they are both broadcasting on the same channel, and that has nothing to do with digital versus analog. --Carnildo (talk) 20:23, 10 April 2008 (UTC)
-
- I thought it was
digitalTV vs cell phones. Kushal 22:37, 10 April 2008 (UTC)
- I thought it was
I know the US frequencies used for analog TV will get some other use in 2009. I'm not sure what, though, is it cell phones ? So, will they interfere with Canadian TV and vice-versa ? StuRat (talk) 23:44, 10 April 2008 (UTC)
- MOST of it will be used for cell phones. Kushal 01:57, 11 April 2008 (UTC) The cell phone bases should be configured in such a way that there is very limited interfeence. i am guessing this but they probably need to use small base stations, at least near populaaated bititish c
-
-
- Sorry, I don't know what I was thinking when I pressed Control+S Kushal 15:30, 11 April 2008 (UTC)
-