I am creating some suspended connections to an HTTP server (comet, reverse AJAX, etc). It works ok, but I see the browser only allows two suspended connections to a given domain simultaneously. So if a user is looking at my website in Tab1 of their browser, then also tries loading it in Tab2, they've used up the two allowed connections to my site. I think I can do some wildcard domain thing, where I have my HTTP server resolve any address to my site like: *.example.com/webapp -> 192.0.2.1 (the actual ip of my server) so: a.example.com/webapp b.example.com/webapp c.example.com/webapp all still
I want to migrate my iPhone app to a new database version. Since I don't have some version saved, I need to check if certain column names exist. This answer suggests: SELECT sql FROM sqlite_master WHERE tbl_name = 'table_name' AND type = 'table' And to parse the result. Is that the common way? Alternatives?
I wish to get a list of all strings that are used in a .NET assembly including the “static” values that local variables are set to, parameters passed to methods, fields at set to, etc. I recall from something I read a long time ago that a .NET assembly contains a tables of all strings it uses (or they can be "interned")– or am I just dreaming? Using .NET Reflector is a good ideal (thanks thijs), I will also have a look at its API if no one comes up with an already written tool. (This is so I can write a tool to check we have not missed any strings that should be translated. I could process the
(Not to be confused with Xunit, a popular .Net unit testing library.) Today in a fit of boredom I started inspecting Gmails DOM (yes, I was very bored). Everything looked pretty straightforward until I noticed an interesting specification on the widths of certain elements. The illustrious Googlites had specified a number of table cols using the rare 'ex' unit. width: 22ex; At first I was stumped ("what's an 'ex'?"), then it came back to me: I seem to remember something from years ago when first I was learning about CSS. From the CSS3 spec: [The ex unit is] equal to the used x-height of the fir
In my particular case: callback instanceof Function or typeof callback == "function" does it even matter, what's the difference? Additional Resource: JavaScript-Garden typeof vs instanceof
What are eigenvalues, vectors and expansions and as an algorithm designer, how can I use them? I want to know how you have used it in your program, so that I get an idea.
What are eigen values, vectors and expansions and as an algorithm designer how can I use them? EDIT: I want to know how YOU have used it in your program so that I get an idea. Thanks.
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I st
I want to bind the columns of my WPF DataGrid to some objects in a Dictionary like this: Binding Path=Objects[i] where Objects is my Dictionary of objects, so that each cell will represent an Object element. How can I do that? I suppose that I need to create a template for my cell, which I did, but how to get the result of column binding in my template? I know that by default the content of a DataGridCell is a TextBlock and it's Text property is set through column binding result, but if that result is an object I guess that I have to create a ContentTemplate. How do I do that, as the stuff I t
I searched the web for examples of draggable Swing components, but I found either incomplete or non-working examples. What I need is a Swing component that can be dragged by the mouse inside an other component. While being dragged, it should already change its position, not just 'jump' to its destination. I would appreciate examples which work without non-standard APIs. Thank you.
I know a little bit about how floating-point numbers are represented, but not enough, I'm afraid. The general question is: For a given precision (for my purposes, the number of accurate decimal places in base 10), what range of numbers can be represented for 16-, 32-, and 64-bit IEEE-754 systems? Specifically, I'm only interested in the range of 16-bit and 32-bit numbers accurate to +/-0.5 (the ones place) or +/- 0.0005 (the thousandths place).
I'm very fond of vim and really would like to enhance my bash experience with vi-mode. However one thing I'm so accustomed to the emacs behavior in that, when browsing the shell history with cursor up/down, the cursor is positioned at the end of the line. In vi-mode it's the other way around; the cursor is always positioned at the beginning of the line. It's really burned in the brain to expect the cursor at the end, having used bash in emacs mode for ... way too long. Any chance to get the cursor position by default at the end of the line in bash vi-mode when browsing through the shell histor
In an ASP.NET MVC view I have the following code: <% Page.Title = ViewData.Model.MyPageTitle; %> and when I step through it I see the Page.Title value changing to the title that I want but when you look at the page's title shown in the browser it has not been modified. It appears that this value is overwritten by something later on. Any ideas how the page title should be set if you want to do it dynamically?
I'm sure many people have already seen demos of using genetic algorithms (GAs) to generate an image that matches a sample image. You start off with noise, and gradually it comes to resemble the target image more and more closely, until you have a more or less exact duplicate. All of the examples I've seen, however, use a fairly straightforward pixel-by-pixel comparison, resulting in a fairly predictable 'fade in' of the final image. I'm looking for something more novel: A fitness measure that comes closer to what we see as 'similar' than the naive approach. I don't have a specific result in mi
Are there any known false positives with Valgrind? I get a 'Conditional jump or move depends on uninitialised value(s)' with the fmemopen function, writing in C and compiling with GCC. Can I be sure it's real? EDIT: Are there known issues that are not in the suppression files? Are there some things one can do in a program, that are not really errors but Valgrind will say they are? If there are known issues, a list would be nice.
How does Google News and Techmeme cluster news items that are similar? Are there any well know algorithm that is used to achieve this? Appreciate your help. Thanks in advance.
A Git project has within it a second project whose content is being worked on independently. Submodules cannot be used for the smaller, as even the subproject must be included when users attempt to clone or download the 'parent'. Subtree-merging cannot be used, as the subproject is being actively developed, and subtree merging makes it very difficult to merge those updates back into the original project. I have been informed that the solution is known in the SVN world as "Vendor Branches", and that it is so simply done in Git so as to not even need addressing. Half-baked tutorials abound on th
Here is a python script that loads a url and captures response time: import urllib2 import time opener = urllib2.build_opener() request = urllib2.Request('http://example.com') start = time.time() resp = opener.open(request) resp.read() ttlb = time.time() - start Since my timer is wrapped around the whole request/response (including read()), this will give me the TTLB (time to last byte). I would also like to get the TTFB (time to first byte), but am not sure where to start/stop my timing. Is urllib2 granular enough for me to add TTFB timers? If so, where would they go?
I can't use boost:hash because I have to stick with C and can't use C++. But, I need to hash a large number (10K to 100k) of tokens strings (5 to 40 bytes length) so that search within those are fastest. MD5, SHA1 or any long hash function seems too heavy for a simple task, I am not doing cryptography. Plus there is the storage and computing cost. Therefore my question: What might be the simplest hash algorithm that will ensure collision prevention in most practical cases. How many bit to use for the hash value? I am developing for 32 bit systems. Does hash algorithm in Perl/Python use 32 bit
I'm a bit confused with JavaScript's delete operator. Take the following piece of code: var obj = { helloText: "Hello World!" }; var foo = obj; delete obj; After this piece of code has been executed, obj is null, but foo still refers to an object exactly like obj. I'm guessing this object is the same object that foo pointed to. This confuses me, because I expected that writing delete obj deleted the object that obj was pointing to in memory—not just the variable obj. Is this because JavaScript's Garbage Collector is working on a retain/release basis, so that if I didn't have any other variable
I’m trying to convert XML data into PDF files from a web page and I was hoping I could do this entirely within JavaScript. I need to be able to draw text, images and simple shapes. I would love to be able to do this entirely in the browser.
Whenever the bootloader loads the operating system there is presumably only ONE program flow active, right? This would mean, one processor holds the instruction pointer and executes the commands it founds at the position the EIP register points to. At which point and how does the system start to exploit more processes and/or threads (no userland threads, but cpu threads)?
A problem I was working on recently got me to wishing that I could lop off the front of a file. Kind of like a “truncate at front,” if you will. Truncating a file at the back end is a common operation–something we do without even thinking much about it. But lopping off the front of a file? Sounds ridiculous at first, but only because we’ve been trained to think that it’s impossible. But a lop operation could be useful in some situations. A simple example (certainly not the only or necessarily the best example) is a FIFO queue. You’re adding new items to the end of the file and pulling items ou
I want to find low-level C/C++ APIs, equivalent with "write" in linux systems, that don't have a buffer. Is there one? The buffered I/O such as fread, fwrite are not what I wanted.
In different assembly languages MUL (x86) or MULT (mips) refer to multiplication. It is a black box to the programmer. I am interested in how actually a CPU accomplishes a multiplication regardless of the architecture. Let's say I am the CPU and I have two 16-bit values in my registers. So now I have to implement MUL using some of my bit-fiddling instructions (and, or, xor, not, shl, shr, etc). What shall I do?