how-stuff-works

How is mime type of an uploaded file determined by browser?

I have a web app where the user needs to upload a .zip file. On the server-side, I am checking the mime type of the uploaded file, to make sure it is application/x-zip-compressed or application/zip. This worked fine for me on Firefox and IE. However, when a coworker tested it, it failed for him on Firefox (sent mime type was something...

Is there a good reason I see VARCHAR(255) used so often (as opposed to another length)?

In multiple courses, books, and jobs, I have seen text fields defined as VARCHAR(255) as kind of the default for "shortish" text. Is there any good reason that a length of 255 is chosen so often, other than being a nice round number? Is it a holdout from some time in the past when there was a good reason (whether or not it applies toda...

How does Google Analytics authenticate a website?

Just looking for some general information on how the Google Analytics javascript code placed on the bottom of each page authenicates a website. Obviously there is a tracking code which is paired to the domain name but is there more to it than that? Is it checking anything else to make sure its secure and not open to misuse? ...

How does virtualization software work?

Hi, I wonder how virtualization software such as VirtualBox or VMWare Workstation works? How can they create a virtual environment that is taken as a separate computer by operating systems? I'm almost sure the answer to this question is very deep, but I'd be well satisfied with basic theory =) Thanks in advance! ...

How does it know where my value is in memory?

When I write a program and tell it int c=5, it puts the value 5 into a little bit of it's memory, but how does it remember which one? The only way I could think of would be to have another bit of memory to tell it, but then it would have to remember where it kept that as well, so how does it remember where everything is? ...

How do Download Managers download huge files on HTTP without multiple requests?

I was downloading a 200MB file yesterday with FlashGet in the statistics it showed that it was using the HTTP1.1 protocol. I was under the impression that HTTP is a request-response protocol and most generally used for web pages weighing a few KiB...I don't quite understand how it can download MB's or GB's of data and that too simultaneo...

is this a valid xpath and if so what does it mean ?

/html/body/input[@id='query' and @name='query' and @value='Search Text'] ...

Null pointer exception error

When I run my program I get this error nullPointerException: null. import model.*; import java.awt.*; import java.awt.event.*; import java.text.*; import javax.swing.*; public class ButtonPanel extends JPanel implements View { private Prison prison; private LeftInputPanel leftInput; private DaysPanel days; private MonthsPanel months; ...

How does Wikipedia's "What links here" work?

I recently used Wikipedia's function "What links here" (which is found under the "Toolbox" element in any entry's left menu) and it got me started wondering how this function actually works. I'm guessing that searching through all the article entries after links isn't very effective, so are all the links stored in a separate database? If...

Why does ReSharper's "Rename" only sometimes display a prompt?

When I rename a variable using ReSharper 4.5 (VS2008), the rename is performed inline (I specify the new variable name in the editor itself) or via a prompt (a popup window where I specify the new variable name). I'm hoping someone can tell me what determines which approach is used? ...

How are self-extracting executables made?

There are many programs out there that will allow you to pack a few files together and generate an executable that has the necessary code to extract them. Somehow, those files are residing inside the executable. I am interested in doing the same thing; how is this done? FYI, I'm interested primarily in Windows .exe files, if it makes a ...

How the Swing Hello World application works?

I am trying to figure out how the Swing based Hello World application works. This is the code I have: import java.awt.*; import javax.swing.*; public class HelloWorldSwing extends JFrame { JTextArea m_resultArea = new JTextArea(6, 30); //====================================================== constructor publi...

Getting confused in with == and = in "if" statement

I know that we cant use assignment operator in if statements in java as we use in any other few languages. that is int a; if(a = 1) { } will give a compilation error. but the following code works fine, how? boolean b; if(b = true) { } EDIT : Is this the exception to rule that a...

How does PHP work - literature

I'm interested in literature (articles on internet, in magazines, books, podcasts - I don't really mind anything) that describes how PHP works internally, about its gotchas and perhaps some advanced functions. Is there anything like this out there? I tried to search on Google, but majority of articles were about starting with PHP and its...

How exactly is a PHP script executed?

I was just thinking to myself "How exactly is a PHP script executed?" I thought it was parsed first for syntax errors etc, and then interpreted and executed. However, I don't know why I believe that is correct. I'm probably wrong. So, how exactly is a PHP file interpreted and executed? What stages does this involve? How do included fil...

Verizon SongID - How is it programmed?

For anyone not familiar with Verizon's SongID program, it is a free application downloadable through Verizon's VCast network. It listens to a song for 10 seconds at any point during the song and then sends this data to some all-knowing algorithmic beast that chews it up and sends you back all the ID3 tags (artist, album, song, etc...) ...

How to explain the answer to this java enum question ?

Given public enum Title { MR("Mr."), MRS("Mrs."), MS("Ms."); private final String title; private Title(String t) { title = t; } public String format(String last, String first) { return title + "" + first + "" + last; } } public static void main(String[] args){ System.out.println(Title.MR.format("Doe","John")); } Doe...

Question : how does this parents control apps do web filtering and site blocking

Hello i just wander how does the parents control sites do problematically the web filtering and the url blocking in there applications ? the question is because i need to build something similar ...

How Firebug works internally?

I have debugged through JavaScript using Firebug more than hundred times without worrying about whats happening there. I want to know how exactly a Firebug handles JavaScript/DOM debugging. Say I set a break point on some statement inside a method and start debugging. I want to know what's going on in there? ...

Where can I start looking to better understand how computers work?

Hey everyone, I've been trying to figure out what computer field I want to go into later on in life. College is just around the corner for me and I've considered looking into Computer Engineering, Software Engineering, etc. Lately, I've been looking into computer security systems and exploitations of such (purely for educational purpos...