living (305)

algorithm - Graph serialization
I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compi…
language agnostic - How to parse relative time?
This question is the other side of the question asking, "How do I calculate relative time?". Given some human input for a relative time, how can you parse it? By default you would offset from DateTi…
ruby - How do I read only x number of bytes of the body using Net::HTTP?
It seems like the methods of Ruby's Net::HTTP are all or nothing when it comes to reading the body of a web page. How can I read, say, the just the first 100 bytes of the body? I am trying to read f…
javascript - How do I get flash to reload the parent HTML page it is embedded in?
I have a flash app(SWF) running Flash 8 embedded in an HTML page. How do I get flash to reload the parent HTML page it is embedded in? I've tried using ExternalInterface to call a JavaScript functio…
xml - Can XPath return only nodes that have a child of X?
Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting d…
Auto-format structured data(phone, date) using jQuery plugin(or failing that vanilla JavaScript)
I like jQuery and I was wondering if anyone have used a good plugin or(non-jQuery) JavaScript library that allows for auto-formatting of structured fields like phone numbers or dates. I know of the…
IE TextRange select method not working properly
I'm having an unusual problem with an IE document with contentEditable set to true. Calling select() on a range that is positioned at the end of a text node that immediately precedes a block element…
css - Strange float behaviour in IE7
I want to create a simple box with a header bar containing a title and some tool buttons. I have the following markup:<div style="float:left"><div style="background-color:blue; padding: 1px; he…
HTML encode user input when storing or when displaying
Simple question that keeps bugging me. Should I HTML encode user input right away and store the encoded contents in the database, or should I store the raw values and HTML encode when displaying? Sto…
How to get hex string from signed integer
Say I have the classic 4-byte signed integer, and I want something like print hex(-1) to give me something like>> 0xffffffff In reality, the above gives me-0x1. I'm dawdling about in some lower…