Wikipedia:Reference desk/Archives/Computing/2009 January 26

Computing desk
< January 25 << Dec | January | Feb >> January 27 >
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.


January 26

edit

Kubuntu: Compile options for a package

edit

In Kubuntu, what's the simplest way to download a package from source (ideally using apt-get), compile it with specific options, and ensure that it continues to be automatically updated with the same options applied each time? Would this be easier on another distro that uses KDE? NeonMerlin 00:06, 26 January 2009 (UTC)[reply]

Analog Electronics

edit

Query:

This is a take home test I am having trouble with and need it for work.

First question, The instrument used to measure resistance is A) DVM digital volt meter B)Ohmeter C) Megger D) VOM Volt Ohm Meter

There is no option for all of the above, I think Megger, but could be VOM. Any assistance would be greatly appreciated.


-- 216.142.142.105 (talk) 00:08, 26 January 2009 (UTC)[reply]

We don't answer homework questions, but instead I suggest you do some transcendental meditation, and I'm sure the answer will come to you. And if, for some strange reason, that approach fails you, try looking those words up here or in a dictionary. One hint, they likely means "which device is used to measure resistance OMLY". :-) StuRat (talk) 02:10, 26 January 2009 (UTC)[reply]
But we can suggest that you look though our Electrical resistance article. You may find your answer there. -- Tcncv (talk) 02:22, 26 January 2009 (UTC)[reply]
Hmm: depends on what the resistance and test voltage is doest it? Most DVMs have a resistance range. Ohmmeter measures ohms. Megger measures insulation Resistance at high voltage, and VOM measures volts and ohms. I would look at your course notes to choose the answer the teacher wants.--GreenSpigot (talk) 01:48, 28 January 2009 (UTC)[reply]
Alternatively you could put down all four of the above with your reasoning and expect bonus marks. (or get none for being a clever sod)--GreenSpigot (talk) 02:01, 28 January 2009 (UTC)[reply]

Gaming Rigs: Be All, End All?

edit

When I go into a store and buy computer, the store sales person will ask me what I will be using the computer for: email, word processing, games, etc... If I buy a gaming computer, say an Alienware or a Dell XPS, will it be able to do everything else (within reason)? Like word processing, graphic design, etc...? The Ayatollah (talk) 05:53, 26 January 2009 (UTC)[reply]

Pretty much, yes. Gaming comps need a good graphic card, big RAM, a good processor, and a reasonable sound card. A graphic design/video editing comp will need a high-end graphics card and some big RAM, which you have from your gaming comp. A music editing/recording comp will need a high-end sound card, which might come with a gaming comp, but it might not. A gaming comp will do everything a regular comp will do (i.e. word processing, email, web browsing, etc.), but it'll do it better. So, I say again: Pretty much, yes. flaminglawyer 06:21, 26 January 2009 (UTC)[reply]
Gaming has traditionally driven many of the computer improvements of the last decade. There are, however, a few specialized tasks that a gaming rig might be less than perfectly equipped to handle. Specifically, extensive video editing would benefit from RAID striping (increased disk throughput) and increased disk space, while servers would benefit from RAID redundancy and more CPU cores. Meanwhile, graphic designers like high-end (not low-refresh) monitors and tablet input devices, and developers prefer multiple monitors. But, to be fair, you'll likely not find a computer for any of these niches at a major retailer, and a "gaming rig" would likely prove satisfactory even if these examples aren't excluded by your "within reason" clause. -- 74.137.108.115 (talk) 08:29, 26 January 2009 (UTC)[reply]
Even for high definition video editing a high spec standard PC will be fine nowadays. The only thing you might find lacking is RAM. Many gaming machines will only come with 2GB of ram, whereas with graphic design on high resolution images 4GB or more is useful, but if you do this you will need to install a 64 bit Operating System such as Vista x64, as a 32bit OSes (as XP and the majority of shop bought machines version of Vista are) can only address 4GB maximum, including graphics card memory. Oh as above if you wish to record or edit music (or if you have a decent set of your own speakers) you might wish to get a dedicated sound card as most shopbought machines rely on onboard sound.
If you know the specifications of the machine feel free to post them! 212.219.8.231 (talk) 09:01, 26 January 2009 (UTC)[reply]

Liquid Helium Cooled Computers

edit

I read somewhere that computer speed is limited by CPU heat. If the CPU is too fast, the computer will be too hot and burn. If I was somehow able to use liquid helium to cool my computer as to render the heat-issue non-existent, would I be able to clock a Core 2 to, say, 8 ghz? The Ayatollah (talk) 05:54, 26 January 2009 (UTC)[reply]

Many people have tried this, but with liquid nitrogen (example). It considerably lessens the heat-issue, but it'll always be there. I honestly have no idea of actual speed improvements with liquid nitrogen/helium cooling, but I will say that it's a huge difference. So it might be possible to clock one up to 8Ghz. flaminglawyer 06:14, 26 January 2009 (UTC)[reply]
Temperature isn't the only limit on CPU speed. As you increase the speed of the processor, propagation delays (the time it takes for a signal to move through the chip) can exceed the clock speed. This necessitates some type of hardware modification, from chip layout (reduced signal lengths) to buffering signals (the transfer takes multiple clocks), to just shrinking thr die size (everything gets smaller). With reasonable tolerances on the chip and appropriate cooling, a (semi-stable) overclock of 2x is reasonable. That said, computer parts were not designed for exposure to liquid nitrogen/helium, and extreme temperature fluctuations can cause fractures in circuits that will take your computer out of commission. -- 74.137.108.115 (talk) 08:14, 26 January 2009 (UTC)[reply]
To continue with the previous comments, yes, cooling with liquid nitrogen could make for a faster computer, provided the computer was designed to be cooled in that way. You can't just pour liquid nitrogen, much less cooler and more expensive liquid helium, into a computer designed to be air-cooled and expect it to survive. A liquid nitrogen cooled home computer seems possible, although it would be quite expensive, for home use. I would imagine a design where a cooling unit produces the liquid nitrogen, then delivers it to the computer, automatically, so no handling is required.
Then there is also another stage, using either liquid helium or liquid hydrogen, where you get superconductivity; meaning no resistance, and therefore no heat, is generated. Supercomputers could possibly use this method. It seems quite unsuitable for home computing, as dealing with temps close to absolute zero is very dangerous, and hydrogen also becomes flammable when it heats up, becomes a gas, and mixes with air. StuRat (talk) 17:31, 26 January 2009 (UTC)[reply]
Also see computer cooling. StuRat (talk) 17:44, 26 January 2009 (UTC)[reply]

XP probs

edit

Hello dears! i have a problem in windows XP sp3.when i try to open drive C it returns an error saying that(windows cant find resycled/boot.com Make sure you type the name correctly)i dont know what is this and what it means.how i repair this error.and the drive is renamed to Yama Ramin.Any help please —Preceding unsigned comment added by 119.154.16.107 (talk) 06:06, 26 January 2009 (UTC)[reply]

(Added section title) flaminglawyer 06:10, 26 January 2009 (UTC)[reply]
Very virus-like. Take a look around. This, that and the other [talk] 06:50, 26 January 2009 (UTC)[reply]
Yep. A virus that copies itself to the RECYCLED folder so that people without "show system files/folders" on can't see it. Try deleting it from Run... - "del C:\RECYCLED\boot.com" or whatever the DOS command is --wj32 t/c 08:04, 26 January 2009 (UTC)[reply]

macintosh OS X: navigating forms with the keyboard compared to Windows XP

edit

Macintosh is asserts that it favors accessibility, but it seems a lot less flexible when I try to navigate user input forms using only the keyboard and no mouse. For example, when I logged into wikipedia, there is the username and password dialog box. On windows I can navigate to both of these input boxes using only the tabkey. I can also navigate to the checkbox for "remember me" with the tab key, and toggle it on and off using the space key.

In comparison, on the Mac OS X, I cannot seem to get the tab key to bring focus to the checkbox.

Also, in comparison, if I am on a web page using firefox on winxp, I can navigate to all the links on a webpage by repeatedly pressing the tab key.

Yet on the Mac, pressing tab only seems to navigate over the chrome and doesn't go into the links.

I checked the article on Table_of_keyboard_shortcuts "Widget navigation" and there does not seem to be a way to do this simple thing on a Mac. Does anyone know how to navigate all the widgets on an input form using only the keyboard? NoClutter (talk) 06:23, 26 January 2009 (UTC)[reply]

I'm not in front of my Mac right now but I think what you're looking for is the "full keyboard access" or something similar setting in the Keyboard Control Panel. Also try, I think it's... option-tab to move between links on a page. I personally hate the way XP tabs from one link to the next when I just want to go to text fields. Dismas|(talk) 09:10, 26 January 2009 (UTC)[reply]
It's in System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts tab. However, if you're using Safari, that overrides the general system setting -- look in Safari's Preferences -> Advanced tab for "Press Tab to highlight each item on a webpage". Or as Dismas mentioned, you can use option-tab to toggle its behavior. -- Speaker to Lampposts (talk) 06:38, 27 January 2009 (UTC)[reply]

Where did all the info on AgesaCode go???

edit

Hi!

I remember bumping into the term AgesaCode previously, and searching Wikipedia (English) for it. The search gave some results, I read the general stuff and was happy with the info I got. After all, I just wanted to know what the term meant. Now it occurred to me that maybe the same articles would answer to some additional questions I had. Now it seems that the whole term has disappeared from Wikipedia. No search results whatsoever. And I'm positive it was here before. What happened? AgesaCode, by the way, is a method of keeping the AMD (64) based computers' bioses up-to-date with a minimum effort. The job of adding new CPU's is done just once resulting a new version of AgesaCode and the motherboard manufacturers are able to use the versions of the common AgesaCode to implement support for the new CPU's.88.114.54.245 (talk) 11:03, 26 January 2009 (UTC)[reply]

You must be mistaken; there is no history (including deletion history) for any article titled "AgesaCode". But since you didn't say what additional questions you have, and it seems that you have a slight misunderstanding of what it is, I have created the article AGESA. Enjoy. -- Fullstop (talk) 12:48, 26 January 2009 (UTC)[reply]

How to select an exit node in Tor

edit
  Resolved

Hey, could someone familiar with the Tor network help me out here. I'm trying to access a uk based website that only allows users from the United Kingdom to view. I'm using the Tor network but most of the exit nodes it connects to are from Germany or the US, and I have no way of selecting uk exit nodes from the vadalia control panel. So is there a way to specify which exit node I want my traffic to be sent from? It's for a text website, not bbci player or other high bandwidth sites so Tor would be perfect for this. Thanks. 65.49.2.26 (talk) 13:12, 26 January 2009 (UTC)[reply]

Don't know about Tor, but when I googled for "UK proxies" I found a website with a list of proxy servers in the UK. 4th or 5th one in the list. –Capricorn42 (talk) 13:16, 26 January 2009 (UTC)[reply]
Thanks but I really need this for Tor as proxy websites are blocked where I am. 65.49.2.26 (talk) 15:37, 26 January 2009 (UTC)[reply]
I think you can by editing the TOR configuration file: http://www.nntpnews.net/f1009/manually-selecting-tor-exit-node-714968/ .--K;;m5m k;;m5m (talk) 16:49, 26 January 2009 (UTC)[reply]

Thanks everyone. I eventually found an unblocked proxy site

Internet over Power lines

edit

hi

i was wondering if there was any way to send broadband signals over the power lines in my home because i do not feel like running Cat6 cable all over my house. i would use wireless, but the only routers i saw had huge ranges, and i don't want my neighbors stealing my internets. i saw something for internet over the power lines (i think it was called homepny or something) a few years ago. is this tech still available, or alternately, is there a better version?  Buffered Input Output 14:05, 26 January 2009 (UTC)[reply]

Have a read here. BigDuncTalk 14:07, 26 January 2009 (UTC)[reply]
Your neighbors aren't very likely to get their filthy hands on your internets if you just have a wireless router with a decent degree of wireless security on it -- that is to say, WPA rather than WEP. As for huge ranges, how huge are we talking about here? I think your average wireless router today tends to have a range of about 40 to 50 meters, or around 130 to 165 feet, if you prefer, although heavier walls, certain electronics and the like will cut down on that. Is that huge enough to reach your neighbors' houses? I believe some models have an option to reduce the signal's power, which will cut down on the range, but honestly, a good password will probably be your best bet. Or, if you like, you could just use MAC addresses, which would mean that only specific computers would be allowed to connect to the network, regardless of passwords. -- Captain Disdain (talk) 15:13, 26 January 2009 (UTC)[reply]
I would recommend that you try using a Wifi router and set it's encryption. That way since only you know the password only you can access the internet. E smith2000 (talk) 17:14, 26 January 2009 (UTC)[reply]
Well I'm using my neighbors internet right now and they have it secured. Simply a matter of collecting enough packets to get the pass. —Preceding unsigned comment added by 82.43.88.87 (talk) 21:44, 26 January 2009 (UTC)[reply]

How would i use the MAC addresses? that sounds like a good option (when combined with WPA or something else)  Buffered Input Output 17:17, 26 January 2009 (UTC)[reply]

That depends on the router, the settings are different depending on the company/deviceE smith2000 (talk) 17:47, 26 January 2009 (UTC)[reply]
No no no no no no no! Don't use MAC address filtering, it's crap! It's trivial to break, it takes literally 5 minutes. And it's way complicated!
Using WPA is much simpler and much more secure. All you do is set a password at the router (preferably long and hard to crack), and then you just enter the password at every computer that you wish to be on the network. It's super-easy, and if you have a good password, incredibly hard to break. Don't bother with MAC address filtering, it's just a big hassle and does no one any good. Belisarius (talk) 18:57, 26 January 2009 (UTC)[reply]
I would tend to agree with FlavusBelisarius MAC address filtering can be a bit of a pain also it is not infalable as some wireless clients allow their MAC address to be impersonated or spoofed and a hacker could break into your WLAN by configuring their client to spoof one of your MAC addresses. But saying that everything can be hacked if someone is determined enough. BigDuncTalk 19:10, 26 January 2009 (UTC)[reply]
returning to the original question... Powerline adapters are an excellent alternative to running cat5. The advantages/disadvantages of powerline are the same as wire; i.e. good resistance to interference and cannot be snooped on, but not extensible without more hardware. There are also Powerline/WLAN combos (e.g. the Netgear WGX102/XE102), so you can start with powerline, and still have the option to get on the WLAN bandwagon later. -- Fullstop (talk) 19:36, 26 January 2009 (UTC)[reply]

OpenDNS

edit

Hello, Something called OpenDNS has installed intself on my computer and is now ruining the wordrous experience of using Firefox. Anyone know how it got there and how to get rid of it? (Ideally, i'd like to keep my cookies..)81.142.143.17 (talk) 14:58, 26 January 2009 (UTC)[reply]

OpenDNS isn't software; someone changed your DNS settings. Go to the Internet settings on your computer. In Windows, Control Panel -> Network Connections -> right click the connection you use -> Properties -> select Internet Protocol (TCP/IP) -> hit the Properties button -> select Obtain DNS server address automatically. The DNS server address boxes should have the OpenDNS addresses of 208.67.220.220 and 208.67.222.222 - remove those for good measure. If it is already set to obtain automatically and the boxes are blank, talk to your ISP (unless you have a home network, in which case talk to the person who has access to the router settings). Xenon54 (talk) 16:36, 26 January 2009 (UTC)[reply]
edit

Hello WIkipedia, I'm trying to build a website in Flash and have been trying to create basic hyperlinks. (i.e. you click on a button saying 'services' and go the 'services' page). I've done some google searches and cyberspace seems to be confused.... ANy thought? P.s. i'm no expert so please assume no knowledge!81.142.143.17 (talk) 16:19, 26 January 2009 (UTC)[reply]

I have not played around much with AS 3 but i do know that in AS 2 you can place the following code on a button to open an internet site in a new window:
on (release) (GetURL("http://www.google.com")
);
In AS2 you could do (to correct yours slightly:
on (release) {
getURL("http://www.google.com")
}
If I want to shamelessly self-plug, I would direct you straight to my site which explains AS3's way of doing things. Instead, I'll helpfully extract the code to here:
myButton.addEventListener(MouseEvent.CLICK,goThere);
function goThere(e:MouseEvent){
var request:URLRequest = new URLRequest("http://www.foundation-flash.com/");
navigateToURL(request);
}
Or you could view the link below, it looks fine also. - Jarry1250 (t, c) 17:23, 26 January 2009 (UTC)[reply]
Here, read this: http://scriptplayground.com/tutorials/as/getURL-in-Actionscript-3/ --98.217.14.211 (talk) 17:17, 26 January 2009 (UTC)[reply]


Jarry1250, your website is great! (a little pointer, the volume is very quiet...) but thanks for shameless plug!86.6.101.208 (talk) 21:43, 26 January 2009 (UTC)[reply]

Usb to PCI adaptor

edit

I was just wondering of there existed a device that would allow me to plug in my PCI devices and then plug said device in to a laptop, enabling me to use a desktop's PCI cards on a laptop. Thank you E smith2000 (talk) 16:26, 26 January 2009 (UTC)[reply]

A quick google brought up this site http://www.arstech.com/ --TrogWoolley (talk) 17:27, 26 January 2009 (UTC)[reply]
As you'll see from List of device bandwidths, the fastest USB currently sold has only half the bandwidth of the slowest PCI. So while someone may sell you a box that translates one to the other, there's not enough bandwidth for many uses. You could probably run a PCI modem card or PCI sound card in such an unfortunate arrangement, but a video card or RAID adapter will be too much for it. Mimetic Polyalloy (talk) 22:31, 26 January 2009 (UTC)[reply]

Problems with flash video in Firefox

edit

When I run firefox (v.3.0.5), I can't watch flash videos at veoh.com, perezhilton.com (yes, I'm classy like that), or theonion.com. In IE, these work fine. I have the latest flash installed for both firefox and IE (which I just reinstalled after manually uninstalling with the adobe-provided uninstaller). Other websites with flash videos (like youtube) work fine. Does anyone know what could be causing this? Obviously I can just switch over to IE when necessary, but it's kind of a pain. Calliopejen1 (talk) 17:06, 26 January 2009 (UTC)[reply]

Check your firewall. i know this may seem silly but i just ran in to this problem the otherday and it turned out that my firewall was blocking the loading of scripts and flash videos in my default browser(which is FireFox). try disabling your firewall and then try and load a video. (remember to re-enable your firewall)E smith2000 (talk) 17:11, 26 January 2009 (UTC)[reply]
Just figured out the problem! Stupid adblock acting up. Now off to figure out the rule that is causing this problem... Calliopejen1 (talk) 19:51, 26 January 2009 (UTC)[reply]

what is the largest IDE hard drive that was made?

edit

what is the IDE hard drive that was manufactuered (before they switched to SATA)? Thanks! —Preceding unsigned comment added by 82.120.111.130 (talk) 17:20, 26 January 2009 (UTC)[reply]

I think it is 1TB made by Total Micro —Preceding unsigned comment added by E smith2000 (talkcontribs) 17:25, 26 January 2009 (UTC)[reply]
Fry's sells a IDE to Sata converter, if you are looking for a large hard drive but lack sata ports. E smith2000 (talk) 17:30, 26 January 2009 (UTC)[reply]

PSP Capabilities

edit

Other than playing games, what can the PSP do? Looking on the PSP page here, it says that you can remotely play your PS3 stuff, but websites I check say that it can't watch movies or play PS3 games. I've also noticed sites stating that you can't watch YouTube, you can't check email (except some capabilities with AOL mail and GMail in classic mode). So, I'm left wondering is the PSP is useful if you have no intention of playing games on it? My current opinion is that a PDA is better for non-gaming. -- kainaw 20:08, 26 January 2009 (UTC)[reply]

A PSP can not view youtube videos. A PSP can view emails regardless. A PSP can play movies and videos. I suggest converting them though using a program called SUPER. Rgoodermote  22:11, 26 January 2009 (UTC)[reply]
I'd say that if you wanted to play games the PSP is a fantastic choice, but from your post i think that you dont want to play games. A Smart phone or a PDA would be a better choice (a smart phone with a data package means that you can get your email anywhere that you can make calls)

E smith2000 (talk) 22:51, 26 January 2009 (UTC)[reply]

If I play games, it will be on my PS3. If I could play my PS3 games remotely on the PSP, it would be useful. From what I've seen, that is not possible. If I could watch blu-ray movies remotely on the PSP, that would be useful. From what I've seen, that is not possible. So, I would only be interested in using the PSP for checking my email using a client (not web-based email). I don't see any hint of Thunderbird for PSP coming soon. So, I think a PDA is best for me. -- kainaw 23:37, 26 January 2009 (UTC)[reply]

If I have a large array (stored in a file) that is essential to a web application written in PHP, how would I cache the array in memory and not have to read it every time a page is requested? I don't see why this should even be called caching - programs should store everything in memory anyway! Why was PHP designed like this? ASP.NET has global variables that persist across page loads, for example. --wj32 t/c 23:02, 26 January 2009 (UTC)[reply]

Look into sessions. Once a session is started, data can be stored in memory across page loads. Or - are you looking to store stuff in memory across page loads from completely different users? -- kainaw 23:34, 26 January 2009 (UTC)[reply]
Each time you load a PHP page it basically starts fresh in terms of the system state. I don't know why ASP.NET does it another way, but anyway, that's how PHP works, it is part of the overarching programming paradigm of it and that's just how it is. As noted above you can use sessions and other means to share variables between pageloads but if you're talking about a lot of data you probably don't want to do it that way.
If you look in the PHP manual, there is a section on "shared memory". That's probably the only way to deal with it. I suspect it would be easier on the machine, though, to just dump the array into a file that PHP can read quickly (e.g. dump it as a PHP array into a new PHP file and then just "include" that each time it runs—obviously you have to be careful here to keep it safe to run). I have a function that can do that if that would be useful for you. It's probably a lot easier than messing with the shared memory stuff. As to how ASP.NET does things, again, I don't know, but somehow I doubt it really uses shared memory.
But again, if you're really butting your head against this a lot, you might really want to re-think your program design, as you are apparently trying to do something that is very, very non-standard for PHP and there is probably a better, PHP-like way to do it that will be a lot easier for you to work out and maintain. But again, I don't really know what specifically it is you are trying to do here. --98.217.14.211 (talk) 00:00, 27 January 2009 (UTC)[reply]
PHP is a Hypertext Preprocessor, not a stateful server environment. Which essentially means it behaves exactly how you think it shouldn't. Perhaps the simplest way to accomplish what you asked is to create a RAM disk and copy the file in question to it. Then every open/read will be a memory transaction, but your still paying for PHP to process the entire thing, especially wasteful if you only want a specific part. Another option is to store this array in a database (which, conveniently, *is* a stateful server environment which is easily optimized for cached access). With a database you also get the ability to retrieve arbitrary portions of the array instead of loading the entire thing. -- 74.137.108.115 (talk) 03:32, 27 January 2009 (UTC)[reply]
No, I'm just wondering why PHP was designed like that. Thanks for the replies. --wj32 t/c 06:41, 27 January 2009 (UTC)[reply]
If it was designed as a stateful server environment, there would be people asking, "Why isn't PHP stateless so I can start each page request from scratch?" In 30+ years of programming, I've found that any time you give a program to the general public, half the people will say, "Your program sucks because it doesn't do exactly what I want it to do." PHP is no exception. There are Ruby people who hate that it isn't like Ruby. There are ASP people who hate that it isn't like ASP. There are Perl people who hate the entire world because they have to use Perl all the time. All in all, PHP was designed to meet the needs of the programmers in the way that the programmers wanted. Nothing special. -- kainaw 13:46, 27 January 2009 (UTC)[reply]

How to make your desktop background a slideshow (while you work)?

edit

I am pretty sure I could do this once but I forgot. I work on a Windows XP. Any advice would be appreciated. Thanks! --PST 23:20, 26 January 2009 (UTC)[reply]

I'm sure it is possible with the "active desktop" thing. I haven't used Windows XP for any length of time, but I remember seeing an option for active desktop being a slideshow of photos from a specified directory. -- kainaw 23:35, 26 January 2009 (UTC)[reply]
I know for certain this is possible but I just can't remember how. There is also Winwall which apparently does something similar. —Preceding unsigned comment added by 82.43.88.87 (talk) 23:39, 26 January 2009 (UTC)[reply]
Creating a simple active desktop is a trivial affair. You right-click on the desktop, choose "Properties," then "Desktop," then "Customize desktop," then "Web" then "New." Then, you pick a web page to use. Now comes the hard part: making the slide show. It's probably going to be either JavaScript/CSS embedded in the .html file or a Flash movie embedded in the HTML. If you don't know either Javascript, CSS, or Flash, then you might want to pick up a slideshow template or hire a coder...--K;;m5m k;;m5m (talk) 00:18, 27 January 2009 (UTC)[reply]
One thing I miss about Linux (I went back to Apple) is that I could have xearth as my background. —Tamfang (talk) 06:00, 27 January 2009 (UTC)[reply]
Slideshow? You could try John's Background Switcher... [1] --wj32 t/c 09:37, 27 January 2009 (UTC)[reply]

Sorting dates in PHP

edit

Here's something that I'm sure will sound like homework but is really just something I've been struggling with in PHP.

Let's say I have a list of dates in an array in any arbitrary string format (say, "MM/DD/YYYY"). For the sake of simplicity, let's say that I have them already sorted in order by date.

I want a function that, with that array as its input, return the date soonest from now in the future, with the cutoff point being the day after the date in question.

So, practically speaking, let's say the array had three dates in it: 01/25/2009, 01/26/2009, 01/29/2009. If today is 01/26/2009, I would want it to return "01/26/2009" as the next future date. If today was 01/27/2009, I would want it to return "01/29/2009". And, while we're at it, if today was "02/03/2009", I would want it to return the last date in the list, "01/29/2009".

Does that make sense? I've had a hell of a time getting the PHP date functions to get this to work for me, so if anyone had any suggestions, that would be great. Here's the function I currently use, if that is of any help, and it doesn't quite work correctly:

function get_soonest() { global $schedule; foreach($schedule as $key=>$val) { $event_date = date("Ymd",strtotime($val["date"])); if(date("Ymd",time())<=$event_date) { return $key; } } return count($schedule)-1; }

As you can see, I have the date fields kept in a bigger array ("schedule"), but otherwise it should be pretty easy to read. This is a pretty primitive approach as you can well appreciate. Any suggestions as to how to make this work better? --98.217.14.211 (talk) 23:27, 26 January 2009 (UTC)[reply]

When working with dates after Jan 1, 1970, it is usually easiest to use a timestamp. Instead of using 1/27/2009 as your index, use strtotime("1/27/2009") as your index. It is a big number (the number of seconds since Jan 1 1970). It is very easy to sort and work with numbers. Then, when you want to print the date back out, use date("m/d/Y", $index) where $index is the index you were using. -- kainaw 23:32, 26 January 2009 (UTC)[reply]
Well, yes, I know that, in theory, but my troubles come from wanting to get it to know when to change the time. I actually have a lot of trouble dealing with the timestamps because, as you note, they are in seconds, which is far too precise a level of detail for these purposes (where everything is a matter of days)...--98.217.14.211 (talk) 00:13, 27 January 2009 (UTC)[reply]
OK, nevermind. I rethought what it is what I was trying to do and it was simpler than I had thought. I really just want to know what is the next date in the future, so:

function get_soonest() { global $schedule; $now = time(); foreach($schedule as $key=>$val) { $event_date = strtotime($val["date"]) + (1*24*60*60); //day after event date if($event_date > $now) { //is in the future return $key; } } return count($schedule); //nothing in the future so return the last one }

Should work fine.... --98.217.14.211 (talk) 00:23, 27 January 2009 (UTC)[reply]