Wikipedia:Reference desk/Archives/Computing/2009 November 13

From Wikipedia, the free encyclopedia
Computing desk
< November 12 << Oct | November | Dec >> November 14 >
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 13[edit]

Question about web searching[edit]

How can I do a web search where I can search for one term over multiple web sites? For example, how would I search for Wikipedia at cnn.com, ask.com, cbs.com...all in one search? 63.231.178.198 (talk) 02:24, 13 November 2009 (UTC)[reply]

Well using Google you can specify multiple sites in the advanced search http://www.google.co.uk/advanced_search?q=example&hl=en . The advanced search is right beside the search button. Or you can use, for example, site:en.wikipedia.org reference desk. Lanfear's Bane | t 10:38, 13 November 2009 (UTC)[reply]
The Google Advanced Search page didn't correctly search multiple sites for me. But you can form your own Google search for multiple sites by using something like site:cnn.com OR site:ask.com OR site:cbs.com Wikipedia --Bavi H (talk) 02:37, 14 November 2009 (UTC)[reply]
Are you asking for a metasearch engine? 69.228.171.150 (talk) 07:27, 14 November 2009 (UTC)[reply]

mobile phones for businesses and multiple people[edit]

many businesses use landline phones so a call would be received throughout the business's building. is it possible for businesses to go completely landline free and use multiple mobile phones that are connected to a single number? so if a customer calls a number, five staff mobile phones would ring and the first to answer would take the call. if this is not possible, why? wouldn't this completely eliminate the need for landline phones in most areas? (pricing aside) Bonusbox (talk) 02:42, 13 November 2009 (UTC)[reply]

It might be possible, but seems totally nuts for the following reasons:
1) Cell phone reception is often worse than land lines.
2) Cell phones are less reliable.
3) Cell phones can get lost.
4) Unlike land lines, most cell phone plans make you pay for incoming calls.
5) Cell phones don't last as long, needing to be replaced every few years.
So, considering that for these reasons just about nobody would want to do this, there may not be any cell phone company that actually offers this service.
Cell phones instead of land lines can make sense for businesses where there is no office or people are often out of the office, but not for a business where people all stay in the office. In that case, you might consider land lines with cordless phones, so people can still move around the office (but be aware than many cordless phones are not secure, so a cord phone should be used when security is needed). StuRat (talk) 11:54, 13 November 2009 (UTC)[reply]
Note that paying for incoming calls using cell phones is, AFAIK, a US-only feature. --Phil Holmes (talk) 14:27, 13 November 2009 (UTC)[reply]
I'd say that was a good thing, but there may actually be an advantage to being charged for incoming calls, in that most telemarketers don't even try to call you on a cell phone, knowing that they will be greeted with even more than the usual hostility if they do. StuRat (talk) 14:40, 13 November 2009 (UTC)[reply]
It seems to me the cost telemarkets pay is likely to be a bigger disincentive then callee 'hostility'. I've definitely never heard of telemarkerters calling people here in NZ Nil Einne (talk) 06:44, 14 November 2009 (UTC)[reply]
If this hostility means you won't buy whatever crap they're selling, that's the biggest disincentive of all. StuRat (talk) 13:43, 14 November 2009 (UTC)[reply]
Yes, it's perfectly possible, and it's a service offered to businesses by most major developed-world telcos, and by third party providers too. In essence one outsources the company PABX into the telco cloud, which then reroutes calls (generally back over the PSTN) to individual phones, or to daughter PBXs at fixed sites (generally over ISDN). Such systems can thus reach branch offices, cellphones, employee's home phones, or to fixed phones that are directly connected to PBX equipment in a company's site. All modern PBX equipment either runs directly off an internal IP switch, or has a simple IP bridge card, so this enables enhanced service VoIP. Such systems make a lot of sense for companies that have a lot of motile people (sales-heavy companies, event organisers) or that have no premises (where everyone is either on-the-road or working from home). Typically an employee registers a given device as their current location, be that their home phone or their laptop-voip or their cell or the normal extension in their office, and the PBX makes calls to that extension ring at that location. Digital PBXs are very capable and feature laden, with support for any number of complex ringer groups, fallback ring groups, night service ring groups, and ring groups discriminated by calling and called phone number. You get all the same automated attendant, VPS, and voicemail capabilities whether the PBX is hosted or sitting in your office. D-PABX systems are beginning to migrate to running over IP rather than the POTS/ISDN PSTN, as IP affords enhanced services like directory and a unified messaging system (where texts, emails, and voice mails are all presented by the same system, over a range of interfaces from web to voice); in practice VoIP on mobile phones is still a bit crufty to be relied on for serious business use (and D-PABXs will fallback to PSTN). -- Finlay McWalterTalk 00:57, 14 November 2009 (UTC)[reply]
Not quite what you were asking, but for a long while I had my desk phone forwarded to my mobile. It worked well for me, without disrupting others and made me more "available". However, it often annoyed my manager who was never quite sure if I was at my desk, in my car, or out at lunch :-) Astronaut (talk) 02:14, 14 November 2009 (UTC)[reply]

Java Screenshot program[edit]

Resolved

Hello! I'm working on a Java program that sends periodic screenshots from one computer to another over the Internet. The problem I'm running into is the first screenshot comes through fine, but subsequent screenshots do not come through (that is, they are not displayed in the server-side GUI). Here's part of my code:

Server side:

while(true) {
            BufferedImage bi = ImageIO.read(in); //in == the socket's input stream
            if(bi != null) {
                label.setIcon(new ImageIcon(bi)); //label == a JLabel in a JFrame that displays the image
            }
        }

Client side:

final OutputStream o = s.getOutputStream(); //s == the socket
        Timer timer = new Timer();
        TimerTask task = new TimerTask() {
            public void run() {
                try {
                    ImageIO.write(rob.createScreenCapture(new Rectangle(800, 600)), "jpg", o); //rob == java.awt.Robot
                }
                catch(Exception ex) {
                    ex.printStackTrace();
                    System.exit(-1);
                }
            }
        };
        timer.schedule(task, 0, 1000);

I started without the Timer, and that didn't work. The Timer doesn't help, but obviously I only need it to update every 500-1000 ms or so. It still has some work (specifically changing the capture size for all displays). I think my problem is with the stream, which I don't really understand completely. Removing the "if != null" block results in a NullPointerException. I would greatly appreciate any advice. Thank you!--el Aprel (facta-facienda) 04:36, 13 November 2009 (UTC)[reply]

First of all, I hope this little program of yours isn't anything nefarious. It's not nice to spy on people's desktops, you know! I'm going to give you the benefit of the doubt and assume everything is kosher, but don't you try anything naughty, young man!
I was curious to what your problem was, so I created a similar program myself. I think the issue here is indeed the stream, and sending multiple images over the same stream. I noticed that while my client said it had sent something like five or six images, my server only reported having recieved one or two. This tells me that ImageIO can't properly tell when one image ends and another one starts, with the result that the formats gets all screwed up and nothing works. I fixed this by simply shutting down the socket after sending one image, and then starting a new one up to send the next one, and that fixed it good and proper.
By the way, why is the client sending stuff to the server? Usually it's the other way around, no? Or is it that you want to set up a server at home, and then you can put the client on temporary pcs to document what you're doing? Anyway, here's my source-code for the server (very, very quickly hacked together, don't expect a masterpiece of code):
ServerTest.java
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;

public class ServerTest {
    public static void main(String[] args) {
        try {
            ServerSocket server = new ServerSocket(4242); //Starting the server
            System.out.println("Listening");
            while(true) {
                Socket socket = server.accept();
                System.out.println("Found connection");
                new Thread(new Talker(socket)).run(); //Sending the the socket to a thread (this is a very primitive server)
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

class Talker implements Runnable {
    
    Socket socket;
    static int n = 0;
    
    public Talker(Socket socket) {
        this.socket = socket;
    }
    
    public void run() {
        try {
            InputStream in = socket.getInputStream();
            BufferedImage image = ImageIO.read(in);
                
            if(image!=null) {
                System.out.println("Got image " + n);
                ImageIO.write(image, "jpg", new File("screenshot_" + n++ + ".jpg")); //Writing image to a file instead of GUI
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
}
And here's the client (same caveats apply):
ClientTest.java
import java.awt.Rectangle;
import java.awt.Robot;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;

public class ClientTest {
    public static void main(String[] args) {
        try {
     
            while(true) {
                //notice how new sockets are created and closed for each image
                //didn't have to computers in front of me, so I just did it using "localhost", but it shouldn't make a difference
                Socket socket = new Socket("localhost", 4242); 
                OutputStream out = socket.getOutputStream();
                Robot r = new Robot();
            
                System.out.println("Sending image");
                ImageIO.write(r.createScreenCapture(new Rectangle(800,600)), "jpg", out);
                socket.close();
                Thread.sleep(5000); //for apps this simple, I just use Thread.sleep() instead of Timer, no reason to get fancy
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}
Creating and shutting down sockets all the time creates a little bit more overhead, but not much. Nothing today's fine modern machines and internet can't handle. Belisarius (talk) 22:10, 13 November 2009 (UTC)[reply]
BTW, just to emphasize that I made this very quickly, obviously you shouldn't put the "Robot r = new Robot()" inside the loop in the client. That's just stupid, and I realize that, but I couldn't be bothered to care all that much. Belisarius (talk) 22:12, 13 November 2009 (UTC)[reply]
Thank you, Belisarius! Don't worry; I was creating this program as a way to give help to my computer-challenged parents when they need it. I was getting tired of "well, there's this window over here..." conversations, and Microsoft Remote Assistance wasn't working. My computer's the server (and I view the images) because I don't want to bother them with the port-opening/looking-up-their-IP stuff.--el Aprel (facta-facienda) 22:59, 13 November 2009 (UTC)[reply]
Aha, ok then :) If the built-in windows stuff isn't working, you may want to check out either some of the open souce VNC servers (which can a pain to set up) or something like GoToMyPC, which I hear is excellent. Good luck! Belisarius (talk) 23:13, 13 November 2009 (UTC)[reply]
Small problem Looks like I've run into another problem. If I create a new socket for every image, the socket is bound to a different local port, and I can't force the new socket to use the same port again or I get a BindException since the TCP port is in a TIME_WAIT state. I tried enabling the SO_REUSEADDR option, but that didn't help. The TCP ports stay in TIME_WAIT too long to just reuse a group or ten ports or so (maybe if I used 1000, but that's too many ports to have waiting to timeout). Is there anyway I can remedy this?--el Aprel (facta-facienda) 00:47, 14 November 2009 (UTC)[reply]
TIME_WAIT is an inevitable consequence of closing a TCP socket, and creating (and destroying) a new socket once every second is a very bad idea - doing so is a common denial-of-service attack (making a server run out of socket slots, because they're all sitting in TIME_WAIT). You should certainly open the socket once at the beginning, send all your comms over it until it's done, and then kill it. -- Finlay McWalterTalk 01:21, 14 November 2009 (UTC)[reply]
Okay, then how do I stream the BufferedImages of the screenshots from the client to the server reliably?--el Aprel (facta-facienda) 01:48, 14 November 2009 (UTC)[reply]

All right, fine, I fixed it so you only need one Socket. Stupid TIME_WAIT! The idea here is to not just send image after image, but instead, to first send a four byte integer that says how many bytes the image will be, and then send the image. On the other end, first we read the four byte integer to find out how big the image will be, then read that many bytes. That way we can know how long the images are and they don't "smush" together. It's trivial to convert between streams and byte arrays using java.io.ByteArrayOutputStream and java.io.ByteArrayInputStream. The code is slightly more complicated, but I've commented it as best I can. Here's my modified server (tested and it works great):

ServerTest.java
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;

public class ServerTest {
    public static void main(String[] args) {
        try {
            //Everything here is the same
            ServerSocket server = new ServerSocket(4242);
            System.out.println("Listening");
            while(true) {
                Socket socket = server.accept();
                System.out.println("Found connection");
                new Thread(new Talker(socket)).run();
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

class Talker implements Runnable {
    
    Socket socket;
    static int n = 0;
    
    public Talker(Socket socket) {
        this.socket = socket;
    }
    
    public void run() {
        try {
            InputStream in = socket.getInputStream();
            
            while(true) {
                //Here, we first read the integer with the lenght that was sent first
                byte[] l = new byte[4]; //This array will store the integer in byte form
                int read = 0; //How many bytes that have been read from the stream
                
                //This kinda looks tricky, but it's not. It uses the InputStream function read(array, offset, length)
                //That function tries to read [length] bytes and store them in the array, starting at array[offset]
                //However, it doesn't guarantee that it will read [length] bytes, so this while-loop forces it to do that
                //The function returns the actual number of bytes read
                while(read < 4)
                    read += in.read(l, read, 4 - read);
                
                //And now we have the length
                int size = byteArrayToInt(l);
                
                System.out.println("Getting image " + n + ", length = " + size);
                
                //Array to store the image in
                byte[] image_array = new byte[size];
                read = 0;
                
                //Same idea here, only we're not reading 4 bytes, we're reading [size] bytes
                while(read < size) 
                    read += in.read(image_array, read, size-read);
                
                //And, tada! We have our image.
                BufferedImage image = ImageIO.read(new ByteArrayInputStream(image_array));
                
                //Which we can do whatever we want with, like write it to a file.
                ImageIO.write(image, "png", new File("screenshot_" + n++ + ".png"));
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public static int byteArrayToInt(byte [] b) {
        return (b[0] << 24)
                + ((b[1] & 0xFF) << 16)
                + ((b[2] & 0xFF) << 8)
                + (b[3] & 0xFF);
    }
}

And here's our client:

ClientTest.java
import java.awt.Rectangle;
import java.awt.Robot;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;

public class ClientTest {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("localhost", 4242);
            OutputStream out = socket.getOutputStream();
            Robot r = new Robot();
                    
            while(true) {
                //First we make sure that ImageIO outputs the image into a byte array
                ByteArrayOutputStream b = new ByteArrayOutputStream(); 
                ImageIO.write(r.createScreenCapture(new Rectangle(800,600)), "png", b);
                byte[] ba = b.toByteArray(); //This byte-array now stores the image
                
                System.out.println("Sending image of length: " + ba.length);
                
                //First we send the length of the image, so the server knows how many bytes to read
                out.write(intToByteArray(ba.length)); 
                //Then we send the image itself
                out.write(ba);
                
                //And then we sleep (will work regardless of how long we sleep, i tested 500 ms too)
                Thread.sleep(5000);
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public static byte[] intToByteArray(int value) {
        return new byte[] {
                (byte)(value >>> 24),
                (byte)(value >>> 16),
                (byte)(value >>> 8),
                (byte)value};
    }
}

And that, as they say, is that. Belisarius (talk) 17:15, 14 November 2009 (UTC)[reply]

Thank you very much, Belisarius. This works great! Plus, it has taught me a lot about how streams work, which was pretty fuzzy for me before.--el Aprel (facta-facienda) 02:53, 15 November 2009 (UTC)[reply]

Java websites[edit]

I'm looking for some examples of websites developed using Java (the source codes etc). A google search brings up a lot of Javascript stuff, but that's not what I'm looking for. I'd be very grateful if someone could provide a link to a website with examples/tutorials. 202.124.190.197 (talk) 05:25, 13 November 2009 (UTC)[reply]

Apache Tomcat is a Java Servlet container (basically, a web server) which executes Java classes that extend on the Servlet base class definitions. Tomcat websites are written in Java, but they show up as HTML in the browser naturally. There is an extensive list of PoweredBy websites available at Tomcat's website. Some of those might even provide access to the site's Java source code. You can also try searching Google for terms like "tomcat tutorial", "tomcat java example", "tomcat example" for an idea of what is going on inside a Tomcat Java servlet. --hydrox (talk) 06:32, 13 November 2009 (UTC)[reply]

Java with MYSQL or ORACLE[edit]

Hi, I am in need to access databases through Java.... Please tell me whether SQL will be best to be integrated with Java or else MySQL will be best to be integrated with Java.... —Preceding unsigned comment added by Atchays (talkcontribs) 05:54, 13 November 2009 (UTC)[reply]

Definitely Oracle. It supports JDBC. You can also execute Java statements directly inside the DBMS along with PL/SQL. Oracle databases have their own Java virtual machine (the Oracle JVM). Oracle also makes a Java IDE (JDeveloper) that is free to download and that you can use to integrate Java with the database.--Drknkn (talk) 12:29, 13 November 2009 (UTC)[reply]
All the major databases support JDBC - MySQL [1], PostgreSQL [2], DB2 [3], Microsoft SQL Server [4], and even Cloudscape (or Derby) [5].... I can't think of any reason why Oracle would be "best" for somebody who is still learning basics of database programming; it is complicated and expensive. After the OP has great familiarity with database technologies, they can evaluate whether Oracle's commercial tools are worth their cost. I think the OP might want to read about SQL and database programming before going very far forward. SQL is the language for interacting and requesting data transactions from any database. MySQL is a specific database - it happens to be a common, free, open-source program that is fairly straightforward to set up. JDBC is a specific technology, including an API and a driver to connect to the database. It is not the only way that Java programs can access data out of a database. The official JDBC Database Access trail is a great tutorial for the novice Java database programmer. Nimur (talk) 14:45, 13 November 2009 (UTC)[reply]
He didn't ask what would be easiest. He asked what would work the best with Java. Read his question again. Oracle works better with Java than any of the other DBMSs for the reasons I gave. There are developer and trial versions of Oracle he can try, as well. He's a Java database developer, so I'd imagine that he doesn't mind actually learning something instead of using some childish, buggy DBMS like MySQL. Have you ever used either Oracle or MySQL, or did you look it up just now?--Drknkn (talk) 10:48, 14 November 2009 (UTC)[reply]
Yes, I have. I would never recommend Oracle to anybody, let alone a novice. Nimur (talk) 14:42, 14 November 2009 (UTC)[reply]
This tutorial using netbeans might help the OP if they are a novice with Java and MySQL. BigDunc 17:22, 13 November 2009 (UTC)[reply]

USB device[edit]

I recently plugged in a 2 GB Kingston pendrive and a Seagate FreeAgent Go 320 GB portable hard disk (which belong to a friend) into my laptop's USB port. My laptop works on Windows Vista Home. The problem is that whenever I insert any of these two portable devices, the computer searches for the preconfigured driver folders for the driver software and then gives me a prompt that I do not have the driver software in my computer and that I have to use the installation cd that came along with the device to install the driver. I don't have any such installation cd and the same devices are working perfectly in my friend's laptop i.e. his laptop automatically installs the driver when I plug in the devices. The strange part is MY LAPTOP SUCCESSFULLY DETECTS A 40 GB PORTABLE DISK THAT I HAVE AND ALSO A KINGSTON 1 GB PENDRIVE THAT ALSO BELONGS TO ME. I have 1 GB RAM (I don't think this problem is realted to RAM since my 40GB and 1GB portable devices are working perfectly on it). Why is my laptop not installing the driver automatically for the 320 GB and the 2GB? What is the solution? Please help me with this problem...... Should I download the driver and install it? That may not be possible since I have only a dialup connection whose download speed does not go more than 2kbps and it's very frustrating to download anything more than 5 MB..... If it is small in size, please send me the link..... Should I be downloading USB 2.0 device driver? Please suggest me a solution...... —Preceding unsigned comment added by 61.246.57.2 (talk) 06:02, 13 November 2009 (UTC)[reply]

Yes, you should download the drivers when prompted and install them. While logged into an account that has admin rights. The two hard disks and the two pendrives may have different manufacturers (even though both pendrives are from Kingston), by the way, hence the differing reactions of your computer. Comet Tuttle (talk) 06:28, 13 November 2009 (UTC)[reply]
If you're using Vista, it should already have the USB 2.0 drivers. One suggestion is to make sure your laptop's chipset drivers are up to date. If you check the laptop manufacturer's support website, they should have those available. But to me it sounds like you might be having an issue with your USB driver stack. Try rebooting into Safe mode, open the Device manager, make sure "Show hidden devices" is checked, and right-click on every "USB Root Hub" and uninstall it. You can also delete anything that looks like it might be the driver for your pendrive and portable hard disk. When you reboot, Windows should automatically detect and reinstall these drivers, along with any other USB devices it finds. Indeterminate (talk) 08:19, 13 November 2009 (UTC)[reply]

WP Essay about not calling wikipedia "wiki"[edit]

I read a great essay regarding the use of the word "wiki" to mean "wikipedia" that someone here wrote. I can't seem to find it though, can you help? Thanks! Chris M. (talk) 13:57, 13 November 2009 (UTC)[reply]

Not sure why you're asking here, but it's at WP:NOTWIKI. Algebraist 13:58, 13 November 2009 (UTC)[reply]
Not sure why asking here is a problem, this is a reference desk after all. —Preceding unsigned comment added by 82.43.89.85 (talk) 14:40, 13 November 2009 (UTC)[reply]
Well, it didn't really fit in at the help desk, and I figured this would get more responses then the Misc. desk. Thanks a lot though! Chris M. (talk) 14:04, 13 November 2009 (UTC)[reply]
If it's about Wikipedia, it goes on the Help desk - what makes you think it wouldn't? (just curious.) Vimescarrot (talk) 14:31, 14 November 2009 (UTC)[reply]
This question works both ways. He's looking for a specific reference. APL (talk) 00:06, 15 November 2009 (UTC)[reply]
I think this is better here. On the help desk people answering questions expect them to be things they know the answer to. We expect to have to go off and find references, so are ready and prepared to do so. This isn't a question that someone is likely to know the answer to off the top of their head, so it is better here. --Tango (talk) 02:59, 15 November 2009 (UTC)[reply]

Xubuntu 9.10 hosed - can't get past login screen[edit]

Afternoon, folks.

I've been having a lot of trouble with my Xubuntu partition after I upgraded to 9.10 a couple of weeks ago. First, my touchpad stopped working (fixed with some odd command). Second, X soiled itself and died after I tried to install the nvidia drivers via the official Hardware Drivers wizard (fixed by sudo apt-get purging the nvidia packages, then deleting xorg.conf so it'd be replaced), but in the last couple of days, just when I thought I'd got it stable, it developed a new problem where I can't get past the login screen.

It was a bit temperamental after the nvidia drivers fix, but this suddenly started a couple of days ago for no apparent reason (I haven't changed anything anything for over a week). When I start my Xubuntu partition, it goes through the pretty sparkly lights effect, then gives me the user select box. I choose my name, then enter my password. It goes back to the sparkly lights for a second, but then Xfce seems to crash - I see a black screen with garbled text for a quarter second before Xfce restarts and puts me back at the user select screen. The cycle repeats until I give up and boot Windows (which is a pain in lectures since it takes about a thousand years to start up). I've googled around, and I found a forum thread or two and an Xfce bugzilla report about a similar issue, but no surefire solutions. One person suggested deleting ~/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml. I don't have this exact file, but I do have one that seems to have the same content, but temporarily renaming it (by Ctrl+Alt+Fx-ing into another terminal screen) didn't make any difference.

Does anyone know how I might fix this?

Cheers, CaptainVindaloo t c e 14:00, 13 November 2009 (UTC)[reply]

I've seen similar trouble when using the Nvidia proprietary binary driver. The only solution I know of is to put up with periodic crashes, or to remove the proprietary driver (and use the less powerful, more stable open-source driver for Nvidia cards); and accept a performance/stability tradeoff. Nvidia has better support for CentOS, so if you're willing to switch out of Ubuntu/Debian, you might get better stability. The official line from Nvidia is: "Note that many Linux distributions provide their own packages of the NVIDIA Linux Graphics Driver in the distribution's native package management format. This may interact better with the rest of your distribution's framework, and you may want to use this rather than NVIDIA's official package." Unfortunate. Nimur (talk) 14:35, 13 November 2009 (UTC)[reply]
I guess when CaptainVindaloo says "the official Hardware Drivers wizard" he means the Canonical packaged versions, and you're right that these should be the most stable available (personally I've had no instability using their nvidia-nonfree on the last four or five iterations of Ubuntu). -- Finlay McWalterTalk 01:42, 14 November 2009 (UTC)[reply]
Looking at /var/log/* is a good start. --194.197.235.240 (talk) 16:22, 13 November 2009 (UTC)[reply]
CaptainVindaloo, it seems from your question that at some point you installed the nvidia-nonfree driver from some other source (I guess direct from nvidia) then purged it, and then installed the canonical packaging of nvidia-nonfree instead. If that's the case I'd guess that somehow you may still have fragments of the old thing that apt/dpgk should have removed but hasn't. Clearly your system is mostly servicable, as clearly the X server is starting and running okay to run gdm, but the X server you run for your session is dying (perhaps when the it starts to use the desktop effects features). First I'd check /var/log/Xorg.*.log and /var/log/gdm/*.log If all else fails, login at the (text) console, kill the root gdm, and then manually start X (either as "X" or with "startx") and then xfce; if nothing else you'll see error messages in real time, and you'll be some way to knowing which stage of startup is triggering the barf. -- Finlay McWalterTalk 01:42, 14 November 2009 (UTC)[reply]

Thanks for the help, guys. Okay, a check of a the most recent log files brought up some interesting stuff: Xorg.0.log and a few others are still talking about nvidia drivers; :0-greeter.log (or whatever it's called - I ended up having to more *greeter.log to read it) is also showing a few interesting looking errors: "GLib-CRITICAL **: g_propagate_error: assertion 'src != NULL' failed", "WARNING **: You can only run one xsettings manager at a time; exiting", "WARNING **: Unable to start xsettings manager: Could not initialize xsettings manager", "Window manager warning: Failed to read saved session file [...]: No such file or directory." I also just tried Finlay's suggestion of stopping gdm, then starting X again. I used 'startxfce4'. When I ran it as root (sudo startxfce4), it seemed to work okay, even if it did use bits of GNOME in places, but when I ran it as myself (after stopping gdm again), it crashed again. There isn't much printed to the terminal, but it ends with:

[starts here, with timestamps etc]
(EE) open /dev/fb0: No such file or directory
xrdb: "Xft.hinting" on line 9 overrides entry on line 6
xrdb: "Xft.hintstyle" on line 11 overrides entry on line 7
xfce4-session: Unable to access file /home/[my username]/.ICEauthority: Permission denied

waiting for X server to shut down .error setting MTRR (base = 0xd0000000, size = 0x0ff00000, type = 1) Invalid argument (22)
ddxSigGiveUp: Closing log

To answer a few questions: I tried to install the nvidia drivers via the Hardware Drivers program in Applications -> System. I called it "the official Hardware Drivers wizard" because I couldn't remember exactly what it was called at the time. It seemed to run correctly at first, but next time I rebooted, it broke with the flickery screen problem that quite a few other people got (that is: stuck in text mode, but the screen was madly flickering, and half of the keys I pressed didn't register - as if X was repeatedly starting and crashing). Fixed by purging the nvidia drivers and nuking xorg.conf. I only tried it once.

Thanks for the help again. Suppose this all serves me right for early adopting and then messing about with drivers. CaptainVindaloo t c e 17:22, 14 November 2009 (UTC)[reply]

HAHA! I am a genius! Well, no, I feel slightly thick for not thinking of trying this earlier; that file it complained about 'permission denied' when starting Xfce - .ICEauthority. It must have been messed up somehow - it wouldn't work even when I changed it's permissions. So, I tried renaming it to see if a fresh copy would be recreated. It worked - I'm typing this from the newly-fixed Xubuntu right now. Comparing the old copy with the new one, I can see there's quite a few garbage characters (showing up as <?> in more) in the old copy that aren't there in the new copy. I'll keep an eye on things, and come back if everything goes wrong again. Cheers for the help guys, I wouldn't have thought of this otherwise. CaptainVindaloo t c e 11:59, 16 November 2009 (UTC)[reply]

What is wrong with this mIRC script please?[edit]

What is wrong with my script?

http://pastebin.com/m18cdc629

I type "!ID 9515" and it attempts the socket open, but the "on sockopen" never gets executed. why?!?

Thanks! 137.81.112.176 (talk) 16:04, 13 November 2009 (UTC)[reply]

I don't mean to be rude, but maybe whatever you're doing, mIRC isn't the right tool for the job. You're essentially making a primitive implementation of the HTTP protocol in there, and that's something that should be relegated to the experts. If it isn't directly chat-related, maybe you should go with another language that has built-in implementations of HTTP to make stuff like this a little easier. Belisarius (talk) 22:27, 13 November 2009 (UTC)[reply]

It is directly chat related. With all due respect, in this case coding in a different language is not suitable for the task. 137.81.112.176 (talk) 21:13, 14 November 2009 (UTC)[reply]

Additionally, there are many mIRC scripts which use sockets to retrieve information, so the use of this script is not out of the ordinary. 137.81.112.176 (talk) 21:18, 14 November 2009 (UTC)[reply]

Noisy monitor[edit]

I have a Proview EM-170TFT all very nice except... every few (5, 10?) minutes it makes a sort of hissing sound - the sound is not connected and the volume is on zero. Kinda unimportant but also kinda driving me up the wall. Any solutions? Apart from taking it apart and de-soldering the speakers. Rich Farmbrough, 16:52, 13 November 2009 (UTC).[reply]

I assume this is a monitor with built-in speakers. Are you sure the noise comes from the speakers ? I can imagine a build-up of static electricity making a little hiss every so often, even in a monitor with no speakers. I had a TV with a different problem, the speakers would go to full volume all on their own. In that case, I did exactly what you said, I took it apart and disconnected the speaker wires, then used external speakers instead. StuRat (talk) 16:57, 13 November 2009 (UTC)[reply]
Yes it's a definate "turn on turn off". Happens in screen saver mode too. Rich Farmbrough, 21:50, 13 November 2009 (UTC).[reply]
An electronics expert could tell us whether TFT monitors have a flyback transformer, which used to be a frequent culprit of whining and other extraneous noise, back in the CRT days. (The flyback transformer article just talks about CRTs and not TFTs & LCDs, so that's probably the answer right there.) Comet Tuttle (talk) 21:55, 13 November 2009 (UTC)[reply]
(ec) CRTs used to make all kinds of clicking noises (from high voltage relays closing) and buzzing from the transformer; especially if they were aging or if there was a borderline hardware failure. But, I have not ever seen any of that hardware on an LCD monitor; usually, the transformers and relays are not needed for anything except CRT tubes. It's possible that a power-save mode is using something similar to this. Alternatively, the backlight may be on its way out - those can sometimes hum (like a fluorescent bulb), due to introduced capacitances that can create resonances at audible frequencies. Nimur (talk) 22:28, 13 November 2009 (UTC)[reply]
Yes, it's like it does something which un-mutes teh speakers and plays this buzz-click over it. Always the same sound, about 1 1/2 seconds I estimate. Rich Farmbrough 12:51 14 November 2009 (UTC).
Is there a mobile phone near your monitor? Mobile phones periodically transmit powerful signals to re-synchronize with the base towers; these are often strong enough to couple in to speaker pre-amplifiers, which mix down the noise to audible frequencies and amplify them over the speaker. Nimur (talk) 14:51, 14 November 2009 (UTC)[reply]

Simple ways of *measuring* the CPU frequency in ASM[edit]

I am interested in different ways of measuring the CPU frequency using only a very simple assembly routine. A few months ago I tryed the following code:

  push 100
  rdtsc
  mov ebx, eax
  call sleep
  rdtsc
  sub eax, ebx
  mov @Result, eax

It returns 1/10 (because we measure the number of cycles in 100 ms = 1/10 s) of the CPU frequency in Hz. However, it only works on some of my computers (all with Intel CPUs). Are there any better ways? --Andreas Rejbrand (talk) 18:32, 13 November 2009 (UTC)[reply]

The Time Stamp Counter, the instruction you're using, notes the significant limitations and increasing uselessness of that feature given the implementation of modern x86 microprocessors. Worse, depending on what that sleep function does, you're affecting the results while measuring them - because many modern CPUs will put themselves onto low-power (low clock frequency) rates when they think there's nothing going on. -- Finlay McWalterTalk 20:50, 13 November 2009 (UTC)[reply]
Yes, I have read that. What other methods are there? --Andreas Rejbrand (talk) 20:54, 13 November 2009 (UTC)[reply]
This Intel app-note contains an example "frequency detection procedure" which uses the MPERF register (which is available on some machines). A use of this is also discussed at this Stack Overflow topic. -- Finlay McWalterTalk 21:29, 13 November 2009 (UTC)[reply]
Is there no more naïve way that works on "all" CPUs? How did you do this ten-twenty (?) years ago, when these instructions were not available? Would it not be possible to write a simple loop that you know use a certain amount of clock cycles, and then use, e.g., Win32 API's GetTickCount before and after the loop? (Yes, I realize that you do need to loop for quite a while, perhaps a second, to get a good value.) --Andreas Rejbrand (talk) 13:38, 14 November 2009 (UTC)[reply]
Keep in mind that if there is any operating system present (even a trivial scheduler), your counter loop can be pre-empted without warning. You can't really know what results a preemptive scheduler will have on your naive algorithm - so your results can be orders of magnitude off from the true value. With today's linuxes and windowses and so forth, your naive algorithm will categorically fail. You might want to consider a different operating system such as QNX or eCos, if you need real-time information. Nimur (talk) 15:02, 14 November 2009 (UTC)[reply]
I see. Thank you very much for your replies! I will investigate the MPERF approach further. --Andreas Rejbrand (talk) 15:14, 14 November 2009 (UTC)[reply]

but what Nimur misses is that even the best of schedulers can't give you the next ten minutes of idle time to go ahead and use in the next half of a second. In other words, it will only slow down execution, never speed it up beyond the metal. This means that by trying different spurts at random times, you can have a potentially good idea of the "maximum" speed of the CPU, assuming it is not under constant heavy load (so that you never get a true slice of it). Of course, your maximum could turn out to be of a much smaller window than the metal, deep inside a VM, etc. But you will never get a HIGHER maximum than the truth. Unless of course the VM lies about how time passes, and you rely on the "system" (ie VM) clock, which is slowed down artificially compared to the truth. But that's another story. The point is, if you are not inside of a VM, you will never "clock" the CPU faster than it is physically, only slower. By trying a few different attempts, you can figure out that over millisecond bursts at random times over 5 minutes, you have never gotten more work from the CPU than about a 500 MhZ Pentium III performs. Either the hardware is that slow, or you are getting that little of it. The one thing that's for sure, is that if those are your results, you are not on an idling 2.5 GhZ core2 duo. dig? 85.181.150.6 (talk) 18:31, 14 November 2009 (UTC)[reply]

The first google result for "measure frequency asm", btw, was [6], which covers everything you guys mentioned. The last post on there also mentions lmbench (from 1998), which apparently "runs some different loops and the processor's clock speed is the greatest common divisor of the execution frequencies of the various loops." Neat stuff. Indeterminate (talk) 09:03, 15 November 2009 (UTC)[reply]

Viewing old Outlook Express files on new computer[edit]

My previous computer broke down and I have its HD as an external HD on my new computeer. There are some Outlook Express email files on the old HD that I want to look at. When I start Outlook Express (which I no longer use) on my new computer, there seems to be no obvious way to view the email files on the old HD. How can I view the email files on the old HD? I only want to view them, it does not matter about importing them etc. Thanks 78.147.22.100 (talk) 20:56, 13 November 2009 (UTC)[reply]

Can you send yourself an e-mail and make the old Outlook Express e-mails an attachment ? I believe you can do that with Gmail. StuRat (talk) 22:37, 13 November 2009 (UTC)[reply]
What format are the files you're trying to read? And what email client/system are you using now? Between them Outlook and (its abjectly incompatible little brother) Outlook Express deal with DBX, OST, MSG, ELM, MBX, and PST file formats. Some of these can be read by other mail programs, some by converter programs, and some seemingly not even by the same program that allegedly created them. In the past, when all else has failed, I've used aid4mail - it's pretty cheap if you need it a lot, but rather expensive if you've just got this one job for it. I've had poor results using free/OS tools on several of these formats (PST being the worst). -- Finlay McWalterTalk 01:09, 14 November 2009 (UTC)[reply]
Importing the old mail files is the way to go. If you used Outlook Express on the old computer, the HD should have some files on it with the .dbx extention (somewhere like <drive-letter>:\Documents and Settings\<username>\Application Data\Identities\{<several-strings-of-hex>}\ with filenames inbox.dbx, drafts.dbx, outbox.dbx, etc.) Your new email client should be able to import these files. One exception I am aware of is that you cannot import directly into Microsoft Outlook - I had to go through Windows Mail first and then import into Outlook when I started using Vista. Astronaut (talk) 02:00, 14 November 2009 (UTC)[reply]
By default e-mails are stored in "C:\Documents and Settings\username\Local Settings\Application Data\Identities\{random_uuid}\Microsoft\Outlook Express". This folder can be changed via Tools, Option, Maintenance, Store Folder to something under My Documents, for easier backup. After changing, the original folder can be deleted. See also: Microsoft knowledge base article 270670: How to back up and to restore Outlook Express data. One way to transfer the files to a new computer is to start Outlook Express on the new computer, which will cause it to create the directories etc, then copy all the files from the old computer to the above-mentioned location on the new computer. (I've recently transferred my data across to a new computer (in both cases using XP and Outlook Express so I know it is possible.) Mitch Ames (talk) 02:03, 14 November 2009 (UTC)[reply]
Quite right Mitch. I now remember there there are two "identities" folders for each user. Only one of them has the .dbx files (the one under "Local Settings", IIRC). Astronaut (talk) 02:54, 14 November 2009 (UTC)[reply]

I've found the dbx files by searching the whole disk. I've copied then from the old HD to the current HD. I shall do as Mitch Ames suggested. I altered the size of unreadable text above. 78.147.25.95 (talk) 21:31, 14 November 2009 (UTC)[reply]

external hard drive enclosure failure[edit]

How often do the enclosures fail? The hard drive itself is perfectly fine, and works like a dream in a new enclosure. —Preceding unsigned comment added by 82.43.89.85 (talk) 21:27, 13 November 2009 (UTC)[reply]

You're gone, and I shed no tears.
I don't have a reference for you, but anecdotally, I've probably seen 20 hard disk crashes at work and home over the years, but never an enclosure failure; the closest to a failure I have seen was an old SCSI external hard disk enclosure where one of the two 50-pin connectors (remember those?) got shoved inward to one side, so it was difficult to secure to the big SCSI cable. There's not a lot going on with an enclosure; no spinning parts or really moving parts at all. Comet Tuttle (talk) 21:52, 13 November 2009 (UTC)[reply]
hmmm, that's really odd. I've had my second external hard drive fail today, and just like the one before the actual hard drive works fine in a new enclosure. Perhaps I'm somehow doing something to break them, although I can't think of what. Anyway, thanks. —Preceding unsigned comment added by 82.43.89.85 (talk) 22:08, 13 November 2009 (UTC)[reply]
Could it be they just weren't connected properly ? Some of those cables are damned near impossible to get connected properly. StuRat (talk) 22:35, 13 November 2009 (UTC)[reply]

Call of Duty: Modern Warfare 2[edit]

When I am about to load the very last mission in Modern Warfare 2, when the progress bar has reached some 80 %, the program crashes and displays the following message:

create2DTexture(seal_soccom_lower_body_a_nml, 1024, 512, 0, 894720068) failed: 8007000e = Ran out of memory

Google tells me that this is a very common problem. But is there any known solution? --81.227.64.180 (talk) 22:13, 13 November 2009 (UTC)[reply]

I may be going out on a limb here, but, um, maybe get more memory ? StuRat (talk) 22:30, 13 November 2009 (UTC)[reply]
Another option is to free up all the memory you can. I first reboot, then use the task manager and kill every other process (except the critical ones). I do that all the time. StuRat (talk) 22:32, 13 November 2009 (UTC)[reply]
The system requirements, on the box of the game, says that you should have at least 1 GB of RAM on Vista, which is my OS. I have 3 GB of RAM, so that should not be a problem. --81.227.64.180 (talk) 22:52, 13 November 2009 (UTC)[reply]
You really should contact Activision technical support. I don't know anything about the error here, but when it's talking about running out of memory, it may be talking about the memory on the video card. Is the video card to spec? Comet Tuttle (talk) 23:48, 13 November 2009 (UTC)[reply]
Yes, it is. In fact, I am able to run the game in the (big) LCD screen's native resolution with the best (i.e., most demanding) graphics settings, with no lag at all. --81.227.64.180 (talk) 00:18, 14 November 2009 (UTC)[reply]
Nice. Try running the game again but change your settings to some lower resolution and lower texture quality settings, and then load the problematic mission again and see if it'll play. Also, what did Activision tech support suggest? Comet Tuttle (talk) 01:46, 14 November 2009 (UTC)[reply]
Smacks of a memory leak issue. If tech support is beating about the bush, the best you can hope for is a patch. Running it in safe mode could help until you get past the bug, then load the game in normal mode again. Sandman30s (talk) 11:50, 14 November 2009 (UTC)[reply]
With a new game there is some expectation that things will occasionally break... I would bug tech support, and if it is truly common, I am sure they are working on a patch. In the meantime, I would try scaling back the graphics settings and loading that mission in particular. --Mr.98 (talk) 21:17, 15 November 2009 (UTC)[reply]