Jump to content

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

From Wikipedia, the free encyclopedia
Computing desk
< November 29 << Oct | November | Dec >> December 1 >
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.


November 30

[edit]

Now whenever I want Google I get iGoogle - annoyed!

[edit]

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)[reply]

Try typing the "www" in front, and even the "HTTP://", if that helps. If neither of those work, try following this link: [1]. Once you get to the proper Google, create a bookmark/favorite. StuRat (talk) 03:06, 30 November 2008 (UTC)[reply]
Click the "Classic Home" link in the top-right. §hep¡Talk to me! 05:07, 30 November 2008 (UTC)[reply]
http://www.google.com/ncr might do it as well. neuroIT'S MY BIRTHDAY! 15:19, 1 December 2008 (UTC)[reply]

trouble with slowdowns

[edit]

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)[reply]

mysql query question, merging SELECT results

[edit]

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)[reply]

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; -- kainaw 01:03, 30 November 2008 (UTC)[reply]
thanks, but i get: ERROR 1140 (42000): Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause 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)[reply]
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. -- kainaw 01:36, 30 November 2008 (UTC)[reply]
I got it. Thanks for your explanation! --Rajah (talk) 02:02, 30 November 2008 (UTC)[reply]
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)[reply]

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)[reply]

Thanks, Tcncv, that works as well and is a bit easier to do. --Rajah (talk) 04:07, 30 November 2008 (UTC)[reply]
For MySQL, a simpler way to write the same thing is
select
  dayofweek(date),
  sum(tag = 'GOOD') as countGood,
  sum(tag = 'BAD') as countBad
from games
group by dayofweek(date)
This works because, when used as a number, true becomes 1 and false becomes 0. —Ilmari Karonen (talk) 21:37, 30 November 2008 (UTC)[reply]

Firegestures

[edit]

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)[reply]

Program for determining primes

[edit]

Here's the source:

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{

 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;
}

(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)[reply]

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)[reply]
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)[reply]
'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#Fast deterministic tests for some less crude approaches to testing for primes. Algebraist 12:52, 30 November 2008 (UTC)[reply]
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)[reply]

Remote thread injection, weird failures

[edit]

I've made a remote thread injector at [2] 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)[reply]

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)[reply]
Possibly the security software (virus scanners, too!) detect your injection attempts and deny them.HardDisk (talk) 13:26, 30 November 2008 (UTC)[reply]

Untitled

[edit]

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 [3] to extract the RAR archive. --wj32 t/c 07:20, 30 November 2008 (UTC)[reply]

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 .r* files and open the one named *.rar. --wj32 t/c 05:41, 1 December 2008 (UTC)[reply]

binary packages on Linux: what am I missing?

[edit]

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)[reply]

You can download their .deb-file and install it using dpkg -i openoffice.deb. 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)[reply]
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 .deb 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)[reply]


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:
  1. You can download it from the author's web site (www.openoffice.org for example)...OR...
  2. 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)[reply]


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)[reply]
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)[reply]

Coding in VB6 for Windows CE 2

[edit]

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)[reply]

Coding Today screen applets in VB.NET

[edit]

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)[reply]

router rebooting

[edit]

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)[reply]

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)[reply]
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)[reply]
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)[reply]
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)[reply]
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:
--Bavi H (talk) 05:05, 1 December 2008 (UTC)[reply]
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)[reply]

Java Exception Handling - logic error?

[edit]

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

import java.util.*;
//...
int i, j;
do
{
   //... 
   //...prompt to enter ints...
   try
   {
      i = sc.nextInt(); j = sc.nextInt();
   }
   catch(InputMismatchException io)
   {
      System.out.println("I/O error: please enter integer values.");
      continue; //was expecting this to restart do loop
   }
   //...
}while(i*j !=0); // data terminator
//...

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)[reply]

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)[reply]
So continue 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. i and j 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 i*j will be 0, and the condition will fail. --71.106.183.17 (talk) 19:52, 30 November 2008 (UTC)[reply]
Ahh, fantastic! Thank you! Yes, I initialized i, j to 0, so necessarily the do was ending. Implemented the following:
import java.util.*;
//...
   catch(InputMismatchException io)
   {
      System.out.println("I/O error: please enter integer values.");
      i = j = 1; //while now evaluates to true
      continue; 
   }
   //...
}while(i*j !=0);
//...
Thanks for help!Psymun (talk) 19:58, 30 November 2008 (UTC)[reply]

Compaq ports

[edit]

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)[reply]

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)[reply]
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)[reply]

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)[reply]