Wikipedia:Reference desk/Archives/Computing/2008 November 30

= November 30 =

Now whenever I want Google I get iGoogle - annoyed!
A few minutes ago out of curiosity I clicked on iGoogle at the top right of the Google screen, as I wondered what it was. Now whenever I a) click on my desktop shortcut to Google, or b) type google.co.uk or c) type google.com I get redirected to http://www.google.co.uk/ig?hl=en where I am invited to "Create your own homepage in under 30 seconds". I am not interested in doing this! How can I stop getting redirected to this unwanted page and instead just get plain google.co.uk as before please? I have used CCleaner to delete all cookies, but it still does it. I am using WinXP and IE7. Thanks. 78.144.244.16 (talk) 00:28, 30 November 2008 (UTC)


 * Try typing the "www" in front, and even the "HTTP://", if that helps. If neither of those work, try following this link: .  Once you get to the proper Google, create a bookmark/favorite. StuRat (talk) 03:06, 30 November 2008 (UTC)


 * Click the "Classic Home" link in the top-right. §hep   •   ¡Talk to me!  05:07, 30 November 2008 (UTC)
 * http://www.google.com/ncr might do it as well. &mdash; neuroIT'S MY BIRTHDAY! 15:19, 1 December 2008 (UTC)

trouble with slowdowns
Hello all. Over the last little while, I've been running into issues that may or may not be related. When I click on video files, they don't open and if I try opening the same file again (sometimes I don't double-click quite fast enough, you know?), I find that WE is not responding. I heard the fans running pretty hard, opened Task Manager and saw WE was chewing up 50% of my CPU resources. I restarted the computer and was asked to click on a user name to start Windows, which I've never had to do. I shut the box down completely, gave it a good dusting (just in case the fans were really fuming due to gunk build-up) and re-started. Again with this "Click on User Name" thing and vids still don't open. I've been running Avast! for quite some time and never found anything on board. The only software I've installed recently was Roxio Easy Media Creator 9, but it's a full, legit, program and actually apparently working as of the last time I checked. The internet also seems to really be dragging, but obviously that could just be traffic. Any of this making sense? If I heard someone else having these problems I would assume some kind of malware, but Avast! says no and I haven't been doing any high-risk behaviour. Could it be the hardware? Any help would be appreciated. I'm running Windows XP sp3. Matt Deres (talk) 00:48, 30 November 2008 (UTC)

mysql query question, merging SELECT results
I have two or more SELECT statments of the form: mysql> select dayofweek(date), count(*) from games where tag="GOOD" group by dayofweek(date);

++--+ ++--+ ++--+
 * dayofweek(date)   | count(*) |
 * 2 |     120 |
 * 3 |     127 |
 * 4 |     109 |
 * 5 |     152 |
 * 6 |     133 |

and

mysql> select dayofweek(date), count(*) from games where tag="BAD" group by dayofweek(date);

++--+ ++--+ ++--+
 * dayofweek(date)   | count(*) |
 * 2 |      58 |
 * 3 |      69 |
 * 4 |      57 |
 * 5 |      62 |
 * 6 |      61 |

What does my query have to look like to get output like this: The column headings aren't as big a deal. I mostly just want to get the results all together. Thanks.

++--+-+ ++--+-+ ++--+-+
 * dayofweek(date)   |count BAD|count GOOD|
 * 2 |      58 |   120   |
 * 3 |      69 |   127   |
 * 4 |      57 |   109   |
 * 5 |      62 |   152   |
 * 6 |      61 |   133   |

Thanks in advance. --Rajah (talk) 00:51, 30 November 2008 (UTC)


 * Just join the results. For example: select dayofweek, badcount, goodcount from (select dayofweek, count(*) as badcount from games where tag='bad') b join (select dayofweek, count(*) as goodcount from games where tag='good') g on b.dayofweek=g.dayofweek; --  k a i n a w &trade; 01:03, 30 November 2008 (UTC)
 * thanks, but i get:  when I do that. can you recommend a tutorial where I can read how to build up a join like that? --Rajah (talk) 01:23, 30 November 2008 (UTC)


 * Correct. Using count(*) requires a group by clause - which you had in your queries.  I was just typing quickly and skipped over it.  There is nothing special or weird about the query I wrote.  First, do you know what a join is?  It joins two tables on a specified field.  Second, you do not need to type a table name every time.  You can type in a query that will temporarily become a table.  That is what I did.  Just use YOUR queries that you typed above as your tables.  Put the query in parenthesis and give it a name after the closing parenthesis.  I just used b and g as the table names. --  k a i n a w &trade; 01:36, 30 November 2008 (UTC)
 * I got it. Thanks for your explanation! --Rajah (talk) 02:02, 30 November 2008 (UTC)


 * A word of caution if you use the above join syntax: If either of the counts (good or bad) is zero, you will loose the entire row in the results.  A solution would be to select ... from (select distinct dayofweek(date) from games) ... and then left join each of the good and bad sub-selects.  However, I think the syntax below is simpler and more efficient.  -- Tcncv (talk) 02:25, 30 November 2008 (UTC)

You might also try something like:

select dayofweek(date), count(case when tag='GOOD' then 1 else null end) as countGood, count(case when tag='BAD' then 1 else null end) as countBad, from games group by dayofweek(date)

This works in Microsoft SQL server. I'm not sure about mysql, but looking at its documentation, it looks like it should support the above syntax. The value 1 is arbitrary. The count will count any non-null value. Also, the "else null" part is technically not needed, since null is the default value for the case expression. -- Tcncv (talk) 02:10, 30 November 2008 (UTC)
 * Thanks, Tcncv, that works as well and is a bit easier to do. --Rajah (talk) 04:07, 30 November 2008 (UTC)


 * For MySQL, a simpler way to write the same thing is


 * This works because, when used as a number,  becomes 1 and   becomes 0.  —Ilmari Karonen (talk) 21:37, 30 November 2008 (UTC)

Firegestures
I recently made the switch from Opera to Firefox. One of the features I loved in Opera was Speed Dial and its ease of use; a simple gesture of the mouse made it magically appear. Browsing around the add-ons for Firefox, I saw Firegestures and Speed Dial and had to try them out. They work quite well, but the only thing is that I can't get Firegestures (I have no scripting knowledge) to open Speed Dial in the current tab, emulating Opera. I can get it to open Speed Dial in a different tab, but not the current one. Can anyone with scripting knowledge help me? I searched around google but couldn't find anything that worked. Thanks! --71.117.47.180 (talk) 03:50, 30 November 2008 (UTC)

Program for determining primes
Here's the source:

  #ifdef HAVE_CONFIG_H   #include    #endif 

<tt> #include </tt> <tt> #include </tt>

<tt> using namespace std; </tt>

<tt> int main </tt> <tt> { </tt> long long int m = 2; long long int c; cout << "Enter a number to check for primality." << endl; cin >> c; if ( cin.fail ) {   return 0; } loop: while ( m < c) { if ( c % m == 0) {      cout << c << " is divisible by " << m << endl; return 0; }   else {     m++; goto loop; } }  if ( m >= c)  { cout << m << " is prime." << endl; return 0; } return 0; } </tt>

(Written in and for Linux) I have several large composite numbers (16 digit pseudoprimes) and the program compiled from this code will tell me that they are divisible and what will divide them very quickly. However, I have several large probable primes (such as 7237443274373237) and the program hangs indefinitely and will not say if they are prime or not. However, for small primes (such as 61) it will very quickly tell that they are prime. So, how can I make this program stop hanging up? Thanks, Ζρς ι'β' ¡hábleme! 05:21, 30 November 2008 (UTC)


 * The first step is to only check numbers up to the square root of the value you are checking. That will help dramatically, but with huge numbers like you have, it may not be enough.  You can also only check for 2 and odd numbers starting with 3; this should cut the time by a further factor of 2.  The ultimate goal, though, would be to only attempt to divide by prime numbers up to the square root of the value in question.  Since around 4% of all numbers are primes 6% of all numbers in this range are primes, this reduces the number of checks by 25 times (or 12 times if comparing with 2 and odds only) further.  However, this requires that you have access to a massive list of prime numbers, so may not be possible for you.  One more hint, don't put taking the square root in the loop, only calculate it once, for best performance. StuRat (talk) 07:04, 30 November 2008 (UTC)


 * Here's a chart for comparison:

Number of checks 7237443274373235 Checking every number from 2 up to the target-1 85073164 Checking all numbers to the square root of the target 42536532 Checking 2 and odd numbers to the square root (estimate) 5000000 Checking primes to the square root


 * StuRat (talk) 07:15, 30 November 2008 (UTC)


 * 'Around 4% of all numbers are primes'? I hope you mean 'around 4% of numbers less than about 100 billion are primes'. See prime number theorem for the real result. See also primality test for some less crude approaches to testing for primes. Algebraist 12:52, 30 November 2008 (UTC)


 * Yes, that's a good clarification. In the range of the square root of that big-ass number the original poster gave, it may be more like 6%, so I've corrected my estimate accordingly. StuRat (talk) 15:30, 30 November 2008 (UTC)

Remote thread injection, weird failures
I've made a remote thread injector at which can either get the command line of a process (1) or force the process to start any program I want (2). However, both functions only seem to completely work when I'm either debugging it using Visual C++ or OllyDbg. Using the Release build crashes the injector for both (1) and (2). Using the Debug build works for (1) but crashes the target process when trying (2). Additionally, when using IDA Pro, the injector crashes for both functions at wprintf.

I think this may have something to do with me running COMODO Firewall - in a Windows XP VM without any security software, (1) always works with the Release build but (2) crashes the target process. I'm running Windows Vista. Any ideas? Thanks in advance. --wj32 t/c 05:56, 30 November 2008 (UTC)


 * I've narrowed it down to GetWinStaDesktop, but I still don't know why it screws up the program... --wj32 t/c 07:18, 30 November 2008 (UTC)
 * Possibly the security software (virus scanners, too!) detect your injection attempts and deny them.HardDisk (talk) 13:26, 30 November 2008 (UTC)

Untitled
Hi!currently i am some troubles, i downloaded a game from (Nokiasymbianthemes.com)which is Star War,the force unleashed.it is in .rar format and i have Nokia N82 Mobile. I posted the a query on the same website but nobody answeres yet.please any tell how can i extract the .sis file from this.Any idea please, Thank you.


 * You have to use a program like WinRAR or 7-Zip to extract the RAR archive. --wj32 t/c 07:20, 30 November 2008 (UTC)

Yes Wj32, I know that but when i extract the file through winrar it comes with a .zip file and yes this too a compressed file again by extracting the .zip file it gives me .ro1 etc like file format, so what next i do?


 * In that case the RAR archive is split into multiple files. Extract all the  files and open the one named  . --wj32 t/c 05:41, 1 December 2008 (UTC)

binary packages on Linux: what am I missing?
I have a Mac, but I'm curious about Linux. When I want a new version of software (like OpenOffice.org 3.0, for example), I can just download the latest binary and install it. And on the download page, there are Linux binaries right next to the Mac and Windows binaries. Yet, apparently, Ubuntu users are frustrated because Ubuntu 8.10 only includes OOo 2.4. According to our reference, they can get OOo 3.0 from a PPA or from the Backports repository (neither of which I know anything about). But why can't they just download the .DEB file sitting on the OOo download page?

Again, these are just examples... if I were interested in OOo 3.0 or Ubuntu in particular I'd be asking on their forums. But I think I'm missing something basic about how software distribution works on Linux. Thanks for any help! --Allen (talk) 07:38, 30 November 2008 (UTC)
 * You can download their .deb-file and install it using . But it may be that dpkg warns about unmet dependencies, in this case you need the Backports repo. Backports is a repo where new packages get compiled using older libs, so systems using these older libs can run the new package w/o problems. HardDisk (talk) 13:55, 30 November 2008 (UTC)


 * The main difference between downloading the software from its maintainer and having a package "in" the distribution is that most modern Linux distributions include complex package management systems which allow the software to be cleanly integrated with the OS. They will generally handle issues such as the dependencies of the new software on new or updated libraries, and managing configuration, help files, and menu entries in a consistent way across all applications.
 * Another point is that different distributions will generally place different constraints on the stability of a piece of software (and its dependencies). So software considered ready for release by its creators may not be considered ready for installation on stable systems by the maintainers of a distribution, until certain defects have been resolved. (Or unless it can be "back-ported" to use older, stable versions of its dependencies.)
 * By downloading a standalone <tt>.deb</tt> file, a user is "opting out" of all these benefits, and taking on the complexities which the maintainers of a distribution spend their time working on. - IMSoP (talk) 15:52, 30 November 2008 (UTC)


 * This is a rather general problem. It's to do with how software is distributed.  When (essentially) all of the software for the entire system is free - there are generally two ways to get the software you need:


 * You can download it from the author's web site (www.openoffice.org for example)...OR...
 * You can get it with (or upgrade it from) your Linux 'distro' (ubuntu for example).


 * Both ways work - and if you are happy to do this the first way on your Mac or Windows machine - then you can do the exact same thing under Linux and be happy.


 * However, under Linux, it's generally more convenient to upgrade your distro because the software is 'packaged' in the right form - all of the associated libraries are managed to be the correct versions - any other packages that depend on those libraries will be carefully checked...and so on.  It's generally a very smooth operation.  However, there is a time lag between the author of the software pushing out a new version and the distribution folks 'noticing' and updating and testing their package system...so it's very often the case that the version you can grab via 'apt-get' or 'yast' or 'rpm' whatever is several versions behind the cutting edge release.


 * Hence, you may be tempted to download directly from the author's website - that way you have the hottest release. Typically, you'll have to compile it yourself (although you may get lucky and find that there is a pre-built binary suitable for you) - and sometimes you'll find that some of the libraries it depends on are either not there or need to be updated.  Now you get into a messy situation - if you don't pull the latest library version from your distro's packaging system, everything gets out of step and other packages that rely on that library may possibly stop working because they need to be upgraded too.  Alternatively, the new software may install itself in someplace like /usr/local or /usr/share instead of in /bin or /usr/bin - now you have two versions of the software installed.


 * Basically, it's a little harder to get the latest version of a package like OpenOffice by grabbing it off their web site. Hence, when new versions of popular packages appear - users of systems like Ubuntu get really anxious for the Ubuntu packaging folks to include that new version in their packaging system so that it can easily, cleanly and smoothly be updated.


 * SteveBaker (talk) 16:09, 30 November 2008 (UTC)


 * Thanks for the answers! It makes me wonder why things are so easy on a Mac, then... is it that mac binaries made for, say, OS 10.4 and later, are already effectively backported by using libraries that are that old?  (And on the compiling-from-source end, I take it that useful systems like MacPorts are uncommon in Linux?)  --Allen (talk) 18:30, 30 November 2008 (UTC)


 * Not a definitive answer, but one difference is that MacOS X is a very distinct and clearly defined target: whereas Linux comes in dozens of distributions, each with dozens of flavours and supported versions, and huge scope for customisation, a lot of information can be summed up simply by saying "requires MacOS X 10.4". So in a sense they're "already backported", but more importantly, such packages can have a fairly decent picture of what the target system will look like.
 * As for things like MacPorts, that is exactly the role played by the package repositories of distributions like Ubuntu - with all the trade-offs that we've been discussing. Compiling from source is less common (although portage, used by Gentoo, does exactly that) but doesn't necessarily solve the problems anyway (recompiling against an older version of a library might make something run on your system, but it might make it not run at all, because the software actually needs features from a newer version). - IMSoP (talk) 19:58, 30 November 2008 (UTC)

Coding in VB6 for Windows CE 2
Hi all,

what plugin for VB6.0 do I need to be able to create applications for a Windows CE 2.0 device?

Thanks, HardDisk (talk) 13:23, 30 November 2008 (UTC)

Coding Today screen applets in VB.NET
Hi all,

again a coding question, this time on WM6-based devices...how do I create Today screen plugins within VB.NET? The only things I found in Google are for eVC and C.net :(

HardDisk (talk) 13:37, 30 November 2008 (UTC)

router rebooting
When my broadband connection goes down I'm told to unplug the router from the mains electritity for 20 seconds, then plug it in again. This usually works, but what is happening during those 20 seconds? Why, given the high speed of electricity along a copper wire, does it take so long?--Shantavira|feed me 17:33, 30 November 2008 (UTC)


 * The usual reason, for purely electrical devices with no mechanical components (unlike disk drives, for example) is that a capacitor must discharge in order to "start the system from scratch". StuRat (talk) 18:21, 30 November 2008 (UTC)


 * I've wondered this too, and people have told me that it takes a while to make sure nothing is still stored in RAM. (Perhaps because of the capacitor Stu mentions?)  But why wouldn't a device re-initialize its RAM or something when it boots up?  It seems strange to me that a device would look for, and use, the ghosts of some previous state in its RAM.  (And perhaps something about these questions should be added to our article on power cycling.)  --Allen (talk) 18:57, 30 November 2008 (UTC)


 * The reason is that it's incredibly annoying to have your equipment reboot on you when there's a short power glitch. These are quite common in many areas (I lived in one), and I appreciated those devices which used this capacitor system.  If your lights ever flicker, then likely you live in such an area, too.  They don't have to "search for ghosts", either.  As long as there is power to volatile memory, whether from the outlet or capacitor, it still contains the same data.  They could physically disconnect the capacitor during a reboot to save you the 20 sends wait, but that would involve extra moving parts and a potentially harmful spark.  StuRat (talk) 19:48, 30 November 2008 (UTC)


 * Or maybe is it possible that if your modem goes down for long enough the broadband company decides to drop the connection and when you turn it on again it gives you a new one? I dunno. --71.106.183.17 (talk) 19:55, 30 November 2008 (UTC)


 * The time required before turning the router back on can vary depending on who you ask. From my experience in tech support, I'd say any specific time frame is likely a common rumor among tech support staff. Tech support reps often pass along bogus information to their peers that doesn't really help, but doesn't really hurt, either.


 * I usually ask people to turn off their routers for a few seconds, or to check that the power light actually goes off then turn it back on. I find it a waste of time to leave it off longer. However, I can't say with certainty there's no valid technical reason for waiting a certain time before turning the router back on. Here's what some various ISPs tech support help pages say:


 * AT&T DSL - DSL modem direct to PC: after all devices are fully powered off
 * AT&T DSL - DSL modem and router: about 30 seconds
 * Verizon DSL - DSL modem: 15 seconds
 * Comcast cable internet - cable modem: 2 minutes
 * Road Runner cable internet - cable modem: 30 seconds or 1 to 2 minutes
 * Verizon FiOS internet - router: 1 minute
 * --Bavi H (talk) 05:05, 1 December 2008 (UTC)
 * If you turn it back on right after you turn it off, you might increase the chance of damaging the device. 121.72.170.238 (talk) 08:25, 1 December 2008 (UTC)

Java Exception Handling - logic error?
Hello all - Am writing a simple Java program to display an <tt>i*j</tt> character matrix but have been having a big headache with handling non-integer input. I'm trying to get a <tt>catch</tt> block to restart a <tt>do</tt> loop in the following way, on testing given a deliberate input mismatch exception it just ends the whole program rather than restarting the <tt>do</tt>:

I'm having real trouble finding the error in the logic here - could anyone point me in the right direction? Any help gratefully received. Psymun (talk) 18:40, 30 November 2008 (UTC)

Hmm, first of all, I don't get what the i and j in the loop's condition are. They can't be ints declared earlier because that would make the (int i, j;) line illegal - also they can't be the very same i and j because the ones declared inside the loop are local to the loop. Also note that the "continue" will make the thing check the loop's condition before restarting it (not just restart it blindly). I'd advise separating the "checking user input" bit (fiddly and annoying and not very interesting) from whatever you're trying to do with the numbers entered. -ie write your own MyScanner with a safe int nextInt method.
 * i, j were declared outside the do, excuse me. Have updated code extract to reflect that. Psymun (talk) 19:35, 30 November 2008 (UTC)


 * So  goes to the end of the current iteration of the loop, evaluates the condition, and then if true, goes on to the next iteration. The problem is that the condition evaluates to false.   and   are initialized to 0 (the default value for ints), so if at least one of the inputs fail, then at least one of them will still be 0, and   will be 0, and the condition will fail. --71.106.183.17 (talk) 19:52, 30 November 2008 (UTC)
 * Ahh, fantastic! Thank you! Yes, I initialized,   to 0, so necessarily the   was ending. Implemented the following:


 * Thanks for help!Psymun (talk) 19:58, 30 November 2008 (UTC)

Compaq ports
Hi - I'm installing a printer driver, and have got to the point where it's asking me what port I've plugged it into - I have to choose from a list of about 15. I've plugged it into one on the left side of my compaq laptop - what does that correspond to in the list?

Thanks, and please forgive my ignorance.

Adambrowne666 (talk) 21:49, 30 November 2008 (UTC)


 * What sort of printer is it? If it uses a "printer port", it will probably be LPT1. If it uses an RS232 port, it will be COM1 or COM2. If it uses a USB port then the PC ought to locate it itself - especially if you follow the instructions that came with the prionter on how to install its software. My printer is connected to port USB001. -- SGBailey (talk) 22:31, 30 November 2008 (UTC)
 * In many cases, if your OS already has a driver, it'll auto-install even with LPT1/parallel ports. My DeskJet 952C does this on Windows XP. Of course, it came out around Windows 98 and it was fairly popular too. Washii (talk) 05:29, 1 December 2008 (UTC)

Thanks all - I tried it again, and this time the Install Wizard kicked in and did it for me. Adambrowne666 (talk) 10:56, 1 December 2008 (UTC)