instruction
stringlengths
0
30k
In Flex, I have an xml document such as the following: var xml:XML = <root><node>value1</node><node>value2</node><node>value3</node></root> At runtime, I want to create a TextInput control for each node under root, and have the values bound to the values in the XML. As far as I can tell I can't use BindingUti...
I'm not certain, but I believe you can put it in a config file and encrypt the config file. Update: See Jon Galloway's post [here.][1] [1]: http://weblogs.asp.net/jgalloway/archive/2008/04/13/encrypting-passwords-in-a-net-app-config-file.aspx
I was going to recommend some complicated token matching algorithm but it's really tricky to get right and if you're data does not have a lot of correlation (typos, etc) then it's not going to give very good results. I would recommend you submit a job to the [Amazon Mechanical Turk][1] and let a human sort it out. ...
How do you handle huge if-conditions?
|language-agnostic|if|
It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life. Are there any other methods that you've found that might be of...
Ideally, you'd probably want a separate table named Company and then a company_id column in this "Location" table that is a foreign key to the Company table's primary key, likely called id. That would avoid a fair bit of text duplication in this table (over 18,000 rows, an integer foreign key would save quite a bit of ...
First, I'd remove all the '= true' parts, that would make it 50% shorter ;) When I have big condition I search for the reasons. Sometimes I see I should use polymorphism, sometimes I need to add some state object. Basically, it implies a refactoring is needed (a code smell). Sometimes I use [De-Morgan's laws][1]...
null
What do you use to capture webpages, diagram/pictures and code snippets for later reference?
|productivity|
High availability and scalable platform for Java/C++ on Solaris
|java|c++|scalability|solaris|high-availability|
I have an application that's a mix of Java and C++ on Solaris. The Java aspects of the code run the web UI and establish state on the devices that we're talking to, and the C++ code does the real-time crunching of data coming back from the devices. Shared memory is used to pass device state and context information from...
|java|c++|solaris|scalability|high-availability|
I have an application that's a mix of Java and C++ on Solaris. The Java aspects of the code run the web UI and establish state on the devices that we're talking to, and the C++ code does the real-time crunching of data coming back from the devices. Shared memory is used to pass device state and context information from...
You can keep a separate watchdog process running. Its only task is watching the current process space to spot situations like you describe. It could even re-launch the original application after a crash or provide different options to the user, collect debug information, etc. Just try to keep it simple enough so that y...
I would use the total squared differences between the two paths against a cut-off to determine whether the two paths are "the same." You need to normalize the paths to the same length and, using interpolation, create a comparison set of points along the path from which to calculate the total squared differences. You...
I would use the total squared differences between the two paths against a cut-off to determine whether the two paths are "the same." You need to normalize the paths to the same length and, using interpolation, create a comparison set of points along the path from which to calculate the total squared differences. You...
To determine "same route," create the minimal set of normalized path vectors, calculate the total power differences and compare the total to a quality measure. 1. Normalize the GPS waypoints on total path length, 2. walk the vectors of the paths together, creating a new set of path vectors for each path based upo...
To determine "same route," create the minimal set of normalized path vectors, calculate the total power differences and compare the total to a quality measure. 1. Normalize the GPS waypoints on total path length, 2. walk the vectors of the paths together, creating a new set of path vectors for each path based upo...
@Lars, good call on the passing around of Form references, seen it as well myself. Nasty. Never seen them passed them down to the BLL layer though! That doesn't even make sense! That could have seriously impacted performance right? If somewhere in the BLL the reference was kept, the form would stay in memory right? ...
Check NetworkChange class. It raises an event when a network address changes.
I'm a huge fan of organized sources, so I always create the following directory structure: /src - for your packages & classes /test - for unit tests /docs - for documentation, generated and manually edited /lib - 3rd party libraries /etc - unrelated stuff /bin (or /classes) - compiled cl...
I'd absolutely go for the server that's located under my roof, as long as I don't need it to be connected to the internet with a static IP. Why: * It's a target for hackers, as soon as it is reachable from the net * Any problems with the machine? I'd rather walk to the closet instead of calling a hotline - and p...
Maybe you should take a look at [IzPack][1]. I created a very nice installer some years ago and I'd bet that they are still improving it. It allows the installation of docs, binaries and a clickable link to start the application *IIRC*. [1]: http://izpack.org/
@Derek Park He only said harder, not impossible. PGP would make it harder, not impossible.
Do your child forms really need to be Forms? Could they be user controls instead? This way, they could easily raise events for the main form to handle and you could better encapsulate their logic into a single class (at least, logically, they are after all classes already).
Do your child forms really need to be Forms? Could they be user controls instead? This way, they could easily raise events for the main form to handle and you could better encapsulate their logic into a single class (at least, logically, they are after all classes already). @Lars: You are right here. This was so...
when you don't want it in your solution, or have potential to split your solution, send all library output to a common, bin directory and reference there. I have done this in order to allow developers to open a tight solution that only has the Domain, tests and Web projects. Our win services, and silverlight stuff, ...
There are two areas that I would look at - 1) Are you running in the dbo schema and was your scripted database using dbo? 2) Are you using an objectqualifier in either your dev or your production environment? (look at your sqldataprovider configuration settings)
@Jake, Thanks for the info. Now, it looks like only the commercial version has backup features. Isn't there ANYTHING built into MySQL to do decent backups? The official MySQL page even recommends things like "well, you can copy the files, AS LONG AS THEY'RE NOT BEING UPDATED"...
I don't use it, but I hear [Splunk][1] is a really good log aggregation and reporting tool. It comes recommended by my sysadmin buddys, I just haven't had a need for it, since we use, IndexTools for our usage stats. [1]: http://www.splunk.com/
I believe your question is actually about when projects go together in the same solution; the reason being that projects in the same solution should have project references to each other, and projects in different solutions should have binary references to each other. I tend to think solutions should contain project...
I would suggest that your unlikely to find an appserver agnostic way. And while I don't pretend to know your reqs, I might question a design that requires the application to restart itself, other than an installer that is deploying a new version. Finally, I would suggest that for any nontrivial purpose "any" appserve...
Monitoring GDI calls
|windows|monitoring|gdi|
Is there a tool that allows one to monitor GDI calls?
HttpWebRequest is used for this. On postback, create a HttpWebRequest to your third party and post the form data, then once that is done, you can Response.Redirect wherever you want. You get the added advantage that you don't have to name all of your server controls to make the 3rd parties form, you can do this t...
To determine "same route," create the minimal set of normalized path vectors, calculate the total power differences and compare the total to a quality measure. 1. Normalize the GPS waypoints on total path length, 2. walk the vectors of the paths together, creating a new set of path vectors for each path based upo...
POST to dedicated server, server stores image and calls back to web server through a web service or other to give it any info required.
If you need to control the structure of the XML, the XStream is a good choice. You can use annotations to define precisely the structure/mapping of the XML and your objects.
In Eclipse Ganymede (Subclipse) Select project/file that contains bad change, and from pop-up menu choose: **Team -> Show History** Revisions related to that project/file will be shown in History tab. Find revision where "bad changes" were committed and from pop-up menu choose: **Revert Changes from Revi...
|.net|io|
Is there a .net variable that returns the "All Users" directory?
[The Little Schemer](http://www.ccs.neu.edu/home/matthias/BTLS/) teaches recursion really well, and it's fun and simple to read. I also liked [The Scheme Programming Language](http://www.scheme.com/tspl3/) for a broader introduction into the language.
As T.O. says, try Aptana. There's a very good free version, and they really push the AJAX. They even have Jaxer, an "AJAX Server" that they're working on. If nothing else, the plugins are great, and, other than a few quirks, I really like working in it.
First off, make sure you understand the basics of the HTTP protocol. Then learn how the javascript httpXmlRequest function works. Once you've covered those, pick an Ajax library - prototype is good. Then look at a few examples, and follow the API. Job done. I seriously have no idea how they manage to write ent...
Rolling your own AJAX has become somewhat outdated in the presence of Javascript libraries like Prototype and JQuery. I would recommend looking into one of those libraries (Jeff used JQuery for SO and he's been really impressed with it from what I understand). As far as a development environment goes, I don't know ...
I found [The Little Schemer][1] a great, great introduction to functional programming. It's entirely based on simple, bite sized examples which are built up upon as the book goes on. [1]: http://www.amazon.com/gp/product/0262560992?ie=UTF8&tag=joeshaw-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=026256099...
Haskell is a very good functional programming language for beginners. Someone had asked about good resources for Haskell, so I will point you [there](http://stackoverflow.com/questions/16918/beginners-guide-to-haskell#16951). If you are looking for a good book on Functional Programming, I would recommend "Functional...
[Aptana][1] is supposedly a decent IDE for Javascript development. I myself just use Eclipse and a decent javascript framework like [jQuery][2] that has an easy syntax. [1]: http://www.aptana.com/ [2]: http://jquery.com/
If you have experience with .NET, [Expert #F][1] is good. [1]: http://www.apress.com/book/view/9781590598504 F# is derived from OCaml. Lisp is more pure as functional languages go.
[Sajax](http://www.modernmethod.com/sajax/) is another good toolkit with PHP support. Mostly though I prefer to use a Javascript framework like [Jquery](http://jquery.com/) or [Prototype](http://www.prototypejs.org/)
One option that I, as a user, would like to see more often is dynamically changing the level of detail (in the broad sense, not just the technical sense) when framerates vary outside of a certian envelope. If you are rendering at 5FPS, then turn off bump-mapping. If you are rendering at 90FPS, increase the bells and ...
One somewhat hackish solution would be for the parent process to attach to each child as a debugger (use [DebugActiveProcess][1]). When a debugger terminates all its debuggee processes are terminated as well. A better solution (assuming you wrote the child processes as well) would be to have the child processes mon...
One way to move data from one server to another is to backup the database using the dbexport command. Then after copying the backup files to the destination server run the dbimport command. To create a new database you need to create the DBSpace for the new database using the onmonitor tool, at this point you c...
Is there an ASP.NET pagination control (Not MVC)?
|asp.net|pagination|
I've got a search results page that basically consists of a repeater with content in it. What I need is a way to paginate the results. Getting paginated results isn't the problem, what I'm after is a web control that will display a list of the available paged data, preferably by providing the number of results and a ...
If you need to store arbitrary graphs, not just hierarchies, you could push Postgres to the side and try a graph database such as [AllegroGraph][1]: Everything in the graph database is stored as a triple (source node, edge, target node) and it gives you first class support for manipulating the graph structure and qu...
How do you check whether a python method is bound or not?
You can use Java's [StringBuilder][1] type for this. There's also StringBuffer, but it contains extra thread safety logic that is often unnecessary. HTH, Kent [1]: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html
If you are iterating through any kind of a result set, and performing operations on said results, for e.g within a for each, and if one particular result caused a problem, its rather useful in capturing an expected error (via try-catch), logging it, and moving on to the next result via continue. Continue is especially ...
Just a few reasons for maintaining surrogate keys: 1) Stability: Changing a key because of a business or natural need will negatively affect related tables. Surrogate keys rarely, if ever, need to be changed because there is nothing tied to the value. 2) Convention: Allows you to have a standardized Primary Key ...
You could do this with a proxy (for example [Proxomitron][1]). [1]: http://proxomitron.info/index.html
Why not write your own join() method? It would take as parameters collection of Strings and a delimiter String. Within the method iterate over the collection and build up your result in a StringBuffer.
I you don't mind using the MFC libraries you should try the [link text]Visual C++ 2008 Feature Pack[1] [1]: http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&displaylang=en
This depends on the application of your program. When programming an application to control a fast industrial process, optimize for speed would make sense. When programming an application that only needs to react to a user's input, optimization for size could make sense. That is, if you are concerned about the size of ...
It's possible to write a pre-processor which takes randomly-indented code with pseudo-python keywords like "endif" and "endwhile" and properly indents things. I had to do this when using python as an "ASP-like" language, because the whole notion of "indentation" gets a bit fuzzy in such an environment. Of course, ev...
[Stingray][1] [CodeJock][2] [1]: http://www.roguewave.com/products/stingray.php [2]: http://www.codejock.com/
One option, that may be a simpler solution, is to create a new database on your destination server and then RESTORE over that database with your backup. Your backup will be in the right place and you will not have to fuss with "MOVING" the backup file when you restore it. SQL expects backups to be restored to exactly...
I don't know that it's a dot net nuke issue as much as it is ie6. Anyways, here's a site that shows you how to work around IE6's png issues. Hope it helps. http://24ways.org/2007/supersleight-transparent-png-in-ie6?PHPSESSID=d078d09d0985ded5d13a0ddb9959e699
I don't know that it's a dot net nuke issue as much as it is ie6. Anyways, here's a site that shows you how to work around IE6's png issues. Hope it helps. http://24ways.org/2007/supersleight-transparent-png-in-ie6
Just had a similar problem, except i needed a NodeList and not an Document, here's what I came up with. its mostly the same solution as before, augmented to get the root element down as a node list and using erickson's suggestion of using an input source instead for character encoding issues. private String DOC...
Just had a similar problem, except i needed a NodeList and not a Document, here's what I came up with. It's mostly the same solution as before, augmented to get the root element down as a NodeList and using erickson's suggestion of using an InputSource instead for character encoding issues. private String DOC_R...
I think the database included with OpenOffice.org has the form designer in it. I've never tried writing code for it though. A forum post I saw had a link to a tutorial they said had some code in it. I started to set up a database for my wife and the interface was coming out pretty good as far as I could tell. [...
Passing untampered data from Flash app to server?
|security|flash|encryption|
I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the server. What are some good methods of getting this done? One simple...
Do your child forms really need to be Forms? Could they be user controls instead? This way, they could easily raise events for the main form to handle and you could better encapsulate their logic into a single class (at least, logically, they are after all classes already). @Lars: You are right here. This was so...
Do your child forms really need to be Forms? Could they be user controls instead? This way, they could easily raise events for the main form to handle and you could better encapsulate their logic into a single class (at least, logically, they are after all classes already). @Lars: You are right here. This was so...
I would handle this in the parent form. You can notify the other form that it needs to modify itself through an event. You can also pass a reference to the main form in your constructor if you need to modify that: Public class MyClass() { private form pform; Public MyClass(F...
I would handle this in the parent form. You can notify the other form that it needs to modify itself through an event.
Based on NilObject's code: #include <sys/stat.h> off_t fsize(const char *filename) { struct stat st; if (stat(filename, &st) == 0) return st.st_size; return -1; } Changes: * Made the filename argument a "const char". * Corrected the "st...
Based on NilObject's code: #include <sys/stat.h> off_t fsize(const char *filename) { struct stat st; if (stat(filename, &st) == 0) return st.st_size; return -1; } Changes: * Made the filename argument a "const char". * Corrected the "st...
You can use [Privoxy][1] to filter about anything. [1]:http://www.privoxy.org/
If you used an iframe, you could submit the upload form to the dedicated image server, and in the case of a successful result, have it in turn load a page from the original server with the info (eg. image path) "passed along" as a GET parameter.
A popular way to do asynchronous programming in a plain C programs is to use an "event loop". There are numerous libraries that you could use. I suggest to take a look at [glib][1]. Another alternative is to use multiple pre-emptive threads (one for each concurrent operation) and synchronize them with mutexes an...
[The Code Project][1] has lots of UI controls for C/C++ Most of them are focussed on MFC or WTL but there are some that are pure [Win32][2]. As an aside if you're not using a framework, you really should consider WTL over pure Win32. It's low overhead and about a million times more productive. [1]: http:/...
I would recommend writing multiple tests for your Authenticate and Save methods. In addition to the success case (where all parameters are provided, everything is correctly spelled, etc), it's good to have tests for various failure cases (incorrect or missing parameters, unavailable database connections if applicable,...
I haven't used it yet, but i bookmarked [PlotKit](http://www.liquidx.net/plotkit/) some time ago because it's a javascript framework that generates svg
I agree with justin and others -- pick a good editor and use spaces rather than tabs for indentation and the whitespace thing becomes a non-issue. I only recently started using Python, and while I thought the whitespace issue would be a real annoyance it turns out to not be the case. For the record I'm using emacs tho...
You can try something like this: StringBuilder sb = new StringBuilder(); if (condition) { sb.append("elementName").append(","); } if (anotherCondition) { sb.append("anotherElementName").append(","); } String parameterString = sb.toString();
Actually, by colllapsing the colums you already summed them, so the dimension doesn't matter at all for your example. Did I miss something or did you?
I have heard good things about [Haskell Functional Programming][1], but I also found this [list][2] of functional programming books at amazon that might be helpful to you. [1]: http://www.amazon.com/Haskell-Functional-Programming-International-Computer/dp/0201342758/ref=cm_lmf_tit_1 [2]: http://www.amazon.com...
[YUI Connection Manager][1] allows you to introduce slowdown in your Javascript to test AJAX against latency. [1]: http://developer.yahoo.com/yui/connection/
We don't do TDD here (though some have advocated it), but our rule is that you're supposed to check your unit tests in with your changes. It doesn't always happen, but it's easy to go back and look at a specific changeset and see whether or not tests were written.
Or, Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) You can then pass this result to System.IO.Directory.GetParent() to get the root "All Users" folder.
How do I stop the Windows RDP client grabbing focus after a reconnect