instruction
stringlengths
0
30k
Make sure that the currentPage variable is correctly scoped in the code where it is being accessed. Could the variable be changed somewhere else in the code before you are accessing it? Tools like [Firebug][1] can help you to add a breakpoint at the point of execution and see the value of your variable. [1]: htt...
Regular expression matching, Parsing, Flow control in a complex system. Regular expressions are a simple form of state machine, specifically finite automata. They have a natural represenation as such, although it is possible to implement them using mutually recursive functions. State machines when implemented wel...
IntelliJ IDEA works as a Flex IDE, if you happen to also be a Java developer. It's free if you contribute to open source projects.
jQuery and Prototpye Selector Madness
|jquery|prototype|addclass|css-selectors|
Both the jQuery and Prototpye JavaScript libraries refuse to allow me to use a variable to select an list item element by index number although they accept a hard coded number. For example, in Prototype this works: $$('li')[5].addClassName('active'); But this will not work no matter how I try to cast the ...
jQuery and Prototype Selector Madness
|jquery|prototype|css-selectors|addclass|
Often, you can connect to the IPC$ "pseudo-share" on the machine to help establish the credentials before running commands like SC.EXE. Use a command like: C:\> net use \\xx.xx.xx.xx\ipc$ * /user:username The "*" tells it to prompt you for the password.
Effectively Converting dates between UTC and Local (ie. PST) time in SQL 2005
|sql-server|
What is the best way to convert a UTC datetime into local datetime. It isn't as simple as a getutcdate() and getdate() difference because the difference changes depending on what the date is. CLR integration isn't an option for me either.
What is the best way to convert a UTC datetime into local datetime. It isn't as simple as a getutcdate() and getdate() difference because the difference changes depending on what the date is. CLR integration isn't an option for me either. The solution that I had come up with for this problem a few months back was...
If either of these issues affects you, you should never store local times in the database: 1. With DST is that there is an "hour of uncertainty" around the falling back period where a local time cannot be unambiguously converted. If exact dates & times are required, then store in UTC. 1. If you want to show users t...
During an internship w/ a large company that had a lot of in house IT, I was paired w/ a mentor. The practice definitely aided my career development, both in terms of technical skills and business skills. Here are some of the reasons the mentoring worked out so well: - **Credible**: The mentor had 8+ years of exper...
TClientDataSet Aggregates specification aren't added automatically when creating an Aggregate field.
|delphi|
Is "safe_eval" really safe?
|python|security|
I'm looking for a "safe" eval function, to implement spreadsheet-like calculations (using numpy/scipy). The functionality to do this (the [rexec module][1]) has been removed from Python since 2.3 due to apparently unfixable security problems. There are several third-party hacks out there that purport to do this - th...
I'm looking for a "safe" eval function, to implement spreadsheet-like calculations (using numpy/scipy). The functionality to do this (the [rexec module][1]) has been removed from Python since 2.3 due to apparently unfixable security problems. There are several third-party hacks out there that purport to do this - th...
Validate email address in Javascript?
|javascript|email|validation|
What's the best way to validate an email address in Javascript? _Though this solution may be simple, I'm sure this is one of those useful things that people will be Googling for and deserves its own entry on the site_
|javascript|regex|email|validation|
[From Wikipedia][1]: > In computer programming, a branch > table (sometimes known as a jump > table) is a term used to describe an > efficient method of transferring > program control (branching) to another > part of a program (or a different > program that may have been dynamically > loaded) using a table of...
Given a string of JSON data, how can you safely turn that string into a JavaScript object? Obviously you can do this unsafely with something like... var obj = eval("(" + json + ')'); ...but that leaves us vulnerable to the json string containing other code, which it seems very dangerous to simply eval.
Have you tried View -> Zoom -> Reset on both sites?
I'm not sure about other ways to do it but here's how you do it in [Prototype (JSON tutorial)](http://www.prototypejs.org/learn/json). new Ajax.Request('/some_url', { method:'get', requestHeaders: {Accept: 'application/json'}, onSuccess: function(transport){ var json = transport.res...
[JSON.org](http://json.org/) has JSON parsers for many languages including 4 different ones for Javascript. I believe most people would consider [json2.js](http://www.json.org/js.html) their goto implementation.
Hm. OK, I'm still trying to break mine... so I went to the layouts directory and created a file foo.aspx. Here it is: <%@ Page Language="C#" Inherits="System.Web.UI.Page" MasterPageFile="~/_layouts/simple.master" %> <%@ Register Tagprefix="foo" Namespace="Foople" Assembly="Foople, Version=1.0.0.0, Culture=...
I am going out on a limb here to say that, don't get caught up in too many podcasts or blogs, but rather dive into technology/code and good tech books. although +1 to; - Thoughtworks - IT matters - Software Engineering Radio - Pragmatic podcasts - Alt.Net podcasts - Hanselminutes and while not...
Why javascrpit does not support multithreading?
|javascript|browser|
Is it a deliberate design decision or a problem with our current day browsers which will be rectified in the coming versions?
|javascript|browser|fix-title-typo|
Your best bet is to physically secure the hardware the key is on. Also, don't ever write it to disk - find some way to prevent that section of memory from being paged to disk. When encrypting/decrypting the key needs to be loaded into memory, and with unsecure hardware there's always this venue of attack. There are,...
How do I stop Visual Studio's 'Publish Web Site' from publishing my _ReSharper folder?
|asp.net|visual-studio|deployment|
It's really quite annoying as they are not part of the project.
Have you tried adding the autocomplete="off" attribute in the input tag? Not sure if it'll work, but it is worth a try.
From Mozilla's documentation <form name="form1" id="form1" method="post" autocomplete="off" action="http://www.example.com/form.cgi"> [...] </form> http://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion
are all your input boxes set to type=password? That would do it. One of the things you can do, and I'm not at all sure that this is the best answer is to leave input box as an input type and just use javascript and onkeydown event to place stars in the input box instead of having the browser render it. Firefox won't ...
We run log4net (and log4cxx) in highly multi-threaded environments without issue. You will want to be careful how you configure them though. The issue with log4net that Jeff describes pertains to the use of a certain appender. We stick with simple log file appenders on the whole to reduce the impact of logging on ...
IMO, The real answer to this question is whatever works best for you app. I would recommend you benchmark your app using both persistent and non-persistent connections. Maggie Nelson @ [Objectively Oriented][1] posted about this in August and [Robert Swarthout][2] made an accompanying post with some hard numbers. B...
The Visual Studio Web Deployment addin lets you exclude folders and more. [VS2005][1] [VS2008][2] Also a decent writeup on the [Web Deployment addin][3] [1]: http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx [2]: http://www.microsoft.com/downloads/details.aspx?FamilyId=0AA30AE8-C73B-4BDD-BB1B-FE69...
I'm thinking of using this one: [Marlon Grech Date Picker][1]. [1]: http://marlongrech.wordpress.com/2007/09/11/wpf-datepicker/
|opengl|c++|glut|
|c++|opengl|glut|
I'm trying to do a simple rotation in OpenGL but must be missing the point. I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally. At the moment I have code like this: glPushMatrix(); glRotatef(90.0, 0.0, 1.0, 0.0); glBegin(GL_TRI...
AFAIK, Safari doesn't have a Search plugin capability. You could try [Inquisitor][1]; just add the URL http://stackoverflow.com/search?s=%@ [1]: http://www.inquisitorx.com/safari/index_en.php
I have created an approximation of what I think you are looking for just using the Collections Framework in Java. Frankly, I think it is probably overkill as @Mike Deck points out. For such a small set of items to compare and process I think arrays would be a better choice from a procedural standpoint but here is my ps...
To make a long story short, java objects have some very peculiar properties. In general, java has primitive types (`int`, `bool`, `char`, `double`, etc) that are passed directly by value. Then java has objects (everything that derives from `java.lang.Object`). Objects are actually always handled through a reference ...
Check out [FlashDevelop][1] for Windows. I like it better than Flex Builder. [1]: http://www.flashdevelop.org
[@Jan][1] Checked versus unchecked is a central issue here. I question your supposition (#3) that the exception should be ignored in intervening frames. If I do that, I will end up with an implementation-specific dependency in my high-level code. If I replace Hibernate, catch blocks throughout my application will have ...
Just as a side note, you can implement state machines with proper tail calls like I explained in the [tail recursion][1] question. In that exemple each room in the game is considered one state. Also, Hardware design with VHDL (and other logic synthesis languages) uses state machines everywhere to describe hardw...
Absolutely. I've been a Flex developer since Flex 2 and until recently I've used my regular editor, TextMate, for coding and Ant for building. TextMate has some good extensions for ActionScript and Flex coding, but I think you could get that for any decent editor. What's been missing from my setup is a usable debugg...
1. Use "ldd" to list shared libraries for each executable. 2. Cleanup the output 3. Sort, compute counts, sort by count To find the answer for all executables in the "/bin" directory: find /bin -type f -perm /a+x -exec ldd {} \; \ | grep -P '\t.*so' \ | sed -e 's/\t//' \ | sed -e 's/.*=..//' ...
1. Use "ldd" to list shared libraries for each executable. 2. Cleanup the output 3. Sort, compute counts, sort by count To find the answer for all executables in the "/bin" directory: find /bin -type f -perm /a+x -exec ldd {} \; \ | grep so \ | sed -e '/^[^\t]/ d' \ | sed -e 's/\t//' \ |...
1. Use "ldd" to list shared libraries for each executable. 2. Cleanup the output 3. Sort, compute counts, sort by count To find the answer for all executables in the "/bin" directory: find /bin -type f -perm /a+x -exec ldd {} \; \ | grep -P '\t.*so' \ | sed -e 's/\t//' \ | sed -e 's/.*=..//' ...
A jump table is described [here][1], but briefly, it's an array of addresses the CPU should jump to based on certain conditions. As an example, a C switch statement is often implemented as a jump table where each jump entry will go to a particular "case" label. In embedded systems, where memory usage is at a premium...
[Wikipedia][1] sums it up pretty well: > In computer programming, a branch > table (sometimes known as a jump > table) is a term used to describe an > efficient method of transferring > program control (branching) to another > part of a program (or a different > program that may have been dynamically > loaded...
There's several reasons to avoid inline/internal Javascript: - HTML is for **structure**, not behavior or style. For the same reason you should not put CSS directly in HTML elements, you should not put JS. - If your client does not support JS you just pushed a lot of junk. Wasted bandwith. - External JS fil...
If you are specifically looking at how Google does it. If you look at the [PDF Properties][1] page, they use Prince 6.0 (see [princexml.com][2]) There are lots of other PDF generators out there. I've had great success with [PDFlib][3] for tricky jobs. ![alt text][4] [1]: http://docs.google.com/Doc?id=dd8xj...
Jump tables, more often known as a Branch table, are usually used only by the machine. The compiler creates a list of all labels in a assembly program and links all labels to a a memory location. A jump table pretty much is a reference card to where, a function or variable or what ever the label maybe, is stored in ...
Deleting messages from Exchange IMAP mailbox on iPhone
Why doesn't JavaScript support multithreading?
|javascript|browser|
|javascript|browser|duplicate|
|javascript|browser|multithreading|duplicate|
|javascript|browser|multithreading|
Would it be too much of an effort just to have the value hard-coded into the URL (I know it's not too nice) with a default value or true then just have `booleanVar = !booleanVar;` run on every page load? At least that would move away from the need of having nested ifs to manipulate the URL.
MySQL can import CSV files very quickly onto tables using the [`LOAD DATA INFILE`][1] command. It can also read from CSV files directly, bypassing any import procedures, by using the [CSV storage engine][2]. Importing it onto native tables with `LOAD DATA INFILE` has a start up cost, but after that you can `INSERT/U...
MySQL can import CSV files very quickly onto tables using the [`LOAD DATA INFILE`][1] command. It can also read from CSV files directly, bypassing any import procedures, by using the [CSV storage engine][2]. Importing it onto native tables with `LOAD DATA INFILE` has a start up cost, but after that you can `INSERT/U...
F# is part of the ML family of languages and is very close to OCaml. You may want to read this discussion on the [differences between Haskell and OCaml](http://www.oreillynet.com/mac/blog/2006/03/haskell_vs_ocamlwhich_do_you_p.html).
I am not sure based upon the question, but isn't this where [HTTPHandlers][1] come to the rescue? Shouldn't you be handling the variable alteration on the object prior to page rendering in this case then? [1]: http://msdn.microsoft.com/en-us/library/ms227675(VS.80).aspx
Just to elaborate on Toran's answer: Use: `<asp:HiddenField ID="ShowAll" Value="False" runat="server" />` To toggle your state: protected void ToggleState(object sender, EventArgs e) { //parse string as boolean, invert, and convert back to string ShowAll.Value = (!Boolean.Pars...
It's worth knowing that the date format you have given is not an arbitrary one. It is the output of the built-in Date.toString() method (at least in the UK and US locales). Not coincidentally, it is also the format of the unix 'date' command (at least on linux, and I believe in other implementations too) - though to be...
TreeView Drag & Drop help - _Invalid FORMATETC structure_ exception
|c#|.net|winforms|
I'm trying to implement Drag & Drop functionality with source being a TreeView control. When I initiate a drag on a node, I'm getting: _Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV\_E\_FORMATETC))_ The ItemDrag handler (where the exception takes place), looks like: private void tre...
This sounds more like a use case for a collaborative tool like [BaseCamp][1], [SpiceBird][2], or SharePoint than "source control." Those tools have the same aim as source control but are more geared toward Word Document type stuff and the corresponding users. It's one more item for the IT folks to maintain on the serve...
This sounds more like a use case for a collaborative tool like [BaseCamp][1],<strike> [SpiceBird][2]</strike>, or SharePoint than "source control." Those tools have the same aim as source control but are more geared toward Word Document type stuff and the corresponding users. It's one more item for the IT folks to main...
What happens when the uninstall of the previous version fails depends on the sequencing of the RemoveExistingProducts action. I have written a summary about the various options in the past: [http://jpassing.wordpress.com/2007/06/16/where-to-place-removeexistingproducts-in-a-major-msi-upgrade/][1]. Unfortunately, you...
Get CPU usage in shell script?
|linux|shell|scripting|
I'm running some [JMeter][1] tests against a Java process to determine how responsive a web application is under load (500+ users). JMeter will give the response time for each web request, and I've written a script to ping the Tomcat Manager every X seconds which will get me the current size of the JVM heap. I'd lik...
Named pipes. Create a series of fifos, using mkfifo i.e fifo0, fifo1 Then attach each process in term to the pipes you want: processn < fifo(n-1) > fifon
A named pipe might do it: $ mkfifo outside $ <outside calc | square >outside & $ echo "1" >outside ## Trigger the loop to start
If you need a simple stochastic process, you might use a Markov chain, which can be represented as a state machine (given the current state, at the next step the chain will be in state X with a certain probability).
[Mollom][1] is another [askimet][2] type service which may be of interest. From the guys who wrote drupal / run acquia. [1]: http://mollom.com "Mollom" [2]: http://akismet.com/development/
Short answer: Yes I'm working on a team of developers and designers. We code our .MXML and .AS in [FlashDevelop 3][1] and our designer creates .FLA with skins and widgets that get [Import()]ed in ActionScript. I wrote a little more about this subject here: http://stackoverflow.com/questions/25356/flash-designe...
Now you have provided us with some more clues about the nature of your question, namely mentioning COM, I think I understand what you mean. COM can marshal only a subset of the types Delphi knows between a COM server and client. You can define enums in the TLB editor, but these are all of the type TOleEnum which basica...
Check if a record exists in a VB6 collection?
|vb6|collections|
I've inherited a large VB6 app at my current workplace. I'm kinda learning VB6 on the job and there are a number of problems I'm having. The major issue at the moment is I can't figure out how to check if a key exists in a Collection object. Can anyone help?
Any workflow application, especially with asynchronous activities. You have an item in the workflow in a certain state, and the state machine knows how to react to external events by placing the item in a different state, at which point some other activity occurs.
There are a couple of really, really old tricks I'm surprised to not see here. atan(1) == PI/4, so an old chestnut when a trustworthy arc-tangent function is present is 4*atan(1). A very cute, fixed-ratio estimate that makes the old Western 22/7 look like dirt is 355/113, which is good to several decimal places...
|iphone|exchange-server|imap|
I have a secondary Exchange mailbox configured on my iPhone using IMAP. This all appears to work fine except when a message is deleted on the phone, it still shows normally in Outlook. It does not seem to matter what I set the "remove deleted messages" setting to on the phone. I understand this is due to a combinati...