instruction
stringlengths
0
30k
|javascript|prototype|scriptaculous|autocomplete|
I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions to a 'stop words' table, which means that if they occur in the table, the...
Turn on all the warnings you can stand in your compiler (gcc: `-Wall` is a good start but doesn't include everything so check the docs), and make them errors so you have to fix them (gcc: `-Werror`).
You need to install a hook in user32.dll. Lookup the Win32-API call SetWindowsHookEx. You can call it from C# via the stuff in System.Runtime.InteropServices. [This article][1] discusses the topic nicely. [1]: http://www.codeproject.com/KB/system/CSLLKeyboard.aspx **Edit**: Lars Truijens answer looks like ...
You can act on global hotkeys by calling the winapi function [RegisterHotKey][1]. Also see http://www.codeproject.com/KB/vb/mclhotkeynet.aspx and http://www.codeproject.com/KB/miscctrl/systemhotkey.aspx for example. You can not use all key combination as hotkeys. For those that don't work you might try a global keyboar...
I solved this problem for my dad a couple months ago...extend for your use. These tend to be one time problems so I didn't go for the most reusable... a+b+c+d = sum i = number of combinations for (a=0;a<=sum;a++) { for (b = 0; b <= (sum - a); b++) { ...
getting java exception: java.net.MalformedURLException: no protocol
|java|url|
I am currently calling the following line of code: java.net.URL connection_url = new java.net.URL("http://<ip address>:<port>/path"); and when it executes I get the above exception. Any ideas as to why this is happening?
Free/Cheap ASP.NET Component Libraries
|asp.net|components|
earlier today someone asked about free/cheap component libraries for winforms. I'm interested in the same thing, but for asp.net. There are some great commercial libraries like Telerik and DevExpress, but are there any great free/cheap alternatives?
Try setting AutoEventWireup="false" in the page.
ColdFusion: Is it safe to leave out the variables keyword in a CFC?
|coldfusion|cfc|
In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables? Am I going to get myself into trouble if I change this: <cfcomponent> <cfset variables.foo = "a private instance variable"> <cffunction name = "doSomething"> <cfset var bar =...
In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables? Am I going to get myself into trouble if I change this: <cfcomponent> <cfset variables.foo = "a private instance variable"> <cffunction name = "doSomething"> <cfset var bar =...
From [Bukys Software][1] > Approximately 1 in 256 bytes is known > to be corrupted, and the corruption is > known to occur only in bytes with the > value '\012'. So the byte error rate > is 1/256 (0.39% of input), and 2/256 > bytes (0.78% of input) are suspect. > But since only three bits per smashed > byte a...
It all depends in your case it is probably better not to go the SP route and do everything the DDD way (make a Domain model in code and use that). However, if you have a database that is not only used by your application but by many then you should probably consider webservices. In anyway the database should only b...
In that case: //list of predicate functions to check var conditions = new List<Predicate<MyClass>> { x => string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) || x.FileName.Contains(ddlFileName.SelectedValue), x => !chkFileName.Checked || string.IsNullOrEmp...
Single exit point - all other things equal - makes code significantly more readable. But there's a catch: popular construction resulttype res; if if if... return res; is a fake, "res=" is not much better than "return". It has single return statement, but multiple points where function actually end...
Install XPerf and xperfview as available here: [http://msdn.microsoft.com/en-us/library/cc305218.aspx][1] 1. Startup your sample 2. xperf -on base 3. wait for a bit 4. xperf –d myprofile.etl 5. when this is done, set your symbol path: set _NT_SYMBOL_PATH= srv*C:\symbols*h...
Install XPerf and xperfview as available here: [http://msdn.microsoft.com/en-us/library/cc305218.aspx][1] (1) Startup your sample (2) xperf -on base (3) wait for a bit (4) xperf –d myprofile.etl (5) when this is done, set your symbol path: <pre> set _NT_SYMBOL_PATH= srv*C:\symbol...
Precompiled headers with GCC
|c++|gcc|
Anyone had any success getting precompiled headers working with GCC? I have had no luck in my attempts and I haven't seen many good examples for how to set it up. I've tried on cygwin gcc 3.4.4 and using 4.0 on Ubuntu.
Two suggested best practices from experience: (1) **Declare const functions whenever possible**. At first, I found this to be just extra work, but then I started passing my objects to functions with signatures like f(const Object& o), and suddenly the compiler barfed on a line in f such as o.GetAValue(), because I ...
[A.vim](http://www.vim.org/scripts/script.php?script_id=31) is a great little plugin. It allows you to quickly switch between header and source files with a single command. The default is `:A`, but I remapped it to `F2` reduce keystrokes.
Not an exact answer I'm afraid, but this information might help. [Eclipse Help - Running Eclipse][1] [Fireclipse: Debug from FF straight into Eclipse][2] [1]: http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm [2]: http://ajaxian.com/archives/fireclipse...
Try using <ComboBox ItemsSource="{Binding Source={StaticResource ExampleEnumValues}}" SelectedValue="{Binding Path=ExampleProperty}" />
Try using <ComboBox ItemsSource="{Binding Source={StaticResource ExampleEnumValues}}" SelectedValue="{Binding Path=ExampleProperty}" />
Ctrl+Alt+h on a method to get the call hierarchy for it. Fast way to see where it is called from.
[Tomas Restrapo][1] posted on some [great Vim scripts/plugins][2]. He has also pointed out some nice color themes on his blog, too. Check out his [Vim category][3]. [1]: http://www.winterdom.com/weblog/default.aspx [2]: http://www.winterdom.com/weblog/2008/05/01/VimScripts.aspx [3]: http://www.winterdom.co...
I've got round this problem by having 2 sets of settings. I use the one that Visual Studio adds by default for the current settings, i.e. `Properties.Settings.Default`. But I also add another settings file to my project "Project -> Add New Item -> General -> Settings File" and store the actual default values in there, ...
Also check out Scott Hanselman's BabySmash (www.codeplex.com/babysmash). He used a more "brute force" method of hiding the windows cursor and showing his new cursor on a canvas and then moving the cursor to were the "real" cursor would have been Read more here: http://www.hanselman.com/blog/DeveloperDesigner.aspx
I'm one of many who has [blogged](http://blog.functionalfun.net/2008/04/project-euler-problem-4.html) about a ruby-esque *To* extension method that you can write if you're using C#3.0: <pre><code> public static class IntegerExtensions { public static IEnumerable&lt;int&gt; To(this int first, int last)...
You can use [HTMLTidy][1] to convert the HTML to well-formed XML so you can use [XML Diff][2], as Gulzar suggested. tidy -asxml index.html [1]: http://tidy.sourceforge.net/ [2]: http://msdn.microsoft.com/en-us/library/aa302294.aspx
@TK If you look at the value of `FormClosingEventArgs e.CloseReason`, it will tell you why the form is being closed. You can then decide what to do, the possible values are: **Member name** - Description ---------- **None** - The cause of the closure was not defined or could not be determined. **Wi...
how to make cruisecontrol only build one project at a time
|cruisecontrol.net|build-automation|
I have just set up cruise control.net on our build server, and I am unable to find a setting to tell it to only build one project at a time. Any ideas?
Problem with Oracle Application Server SSL Certificates
|oracle-database|apache|ssl|
I'm not sure whether "best practice for parsing xml" exists. There are numerous technologies suited for different situations. Which way to use depends on concrete scenario. You can go with XLinq, XmlReader, XPathNavigator or event regular expressions. If you elaborate your needs I can try to give some suggestions.
I'm not sure whether "best practice for parsing xml" exists. There are numerous technologies suited for different situations. Which way to use depends on concrete scenario. You can go with XLinq, XmlReader, XPathNavigator or even regular expressions. If you elaborate your needs I can try to give some suggestions.
Unsafe C# and pointers for 2d rendering, good or bad?
|c#|graphics|pointers|
I am writing a c# control that wraps DirectX 9 and provides a simplified interface to perform 2d pixel level drawing. .NET requires that I wrap this code in an unsafe code block and compile with the allow unsafe code option. I'm locking the entire surface which then returns a pointer to the locked area of memory. I...
Make wix installation set upgrade to same folder
|msi|windows-installer|wix|
How can I make a major upgrade to an installation set (MSI) built with Wix install into the same folder as the original installation? The installation is correctly detected as an upgrade, but the directory selection screen is still shown and with the default value (not necessarily the current installation folder). D...
If you're processing a large amount of data (many megabytes) then you want to be using XmlReader to stream parse the XML. Anything else (XPathNavigator, XElement, XmlDocument and even XmlSerializer if you keep the full generated object graph) will result in high memory usage and also a very slow load time. Of course, i...
My usual policy is to have only one return statement at the end of a function unless the complexity of the code is greatly reduced by adding more. In fact, I'm rather a fan of Eiffel, which enforces the only one return rule by having no return statement (there's just a auto-created 'result' variable to put your result ...
Is there a MySQLAdmin or SQL Server Management Studio equivalent for SQLite databases on Windows?
|windows|sql|sqlite|
Passing a function just works like passing any other value in F#. let foo x = x ** 3.0 //val foo : float -> float Now you can pass the named value (function) foo around, just like any other named value. List.map foo [1.0;2.0;3.0] //float list = [1.0; 8.0; 27.0]
Passing a lambda function to another function works like this. Suppose we have a trivial function of our own as follows: let functionThatTakesaFunctionAndAList f l = List.map f l Now you can pass a lambda function and a list to it: functionThatTakesaFunctionAndAList (fun x -> x ** 3.0) [1.0;2.0;3.0] Insi...
Passing a lambda function to another function works like this. Suppose we have a trivial function of our own as follows: let functionThatTakesaFunctionAndAList f l = List.map f l Now you can pass a lambda function and a list to it: functionThatTakesaFunctionAndAList (fun x -> x ** 3.0) [1.0;2.0;3.0] Insi...
Passing a lambda function to another function works like this: Suppose we have a trivial function of our own as follows: let functionThatTakesaFunctionAndAList f l = List.map f l Now you can pass a lambda function and a list to it: functionThatTakesaFunctionAndAList (fun x -> x ** 3.0) [1.0;2.0;3.0]...
Installing Curl IDE/RTE on AMD processors
|ide|curl|amd|
Trying to move my development environment to Linux. And new to Curl. Can't get it to install the IDE & RTE packages on an AMD HP PC running Ubuntu x64. I tried to install the Debian package via the package installer and get "Error: Wrong architecture - i386". Tried using the --force-architecture switch but it errors o...
G'day, I've already mentioned it a few times but Scott Meyers books [Effective C++][1] and [Effective STL][2] are really worth their weight in gold for helping with C++. Come to think of it Steven Dewhurst's [C++ Gotchas][3] is also an excellent "from the trenches" resource. His item on rolling your own except...
There are two issues to address here: readability and understandability The "readability" solution is a style issue and as such is open to interpretation. My preference is this: if (var1 == true && // Explanation of the check var2 == true && // Explanation of the check var3 == true && // Exp...
If you do this: if (var1 == true) { if (var2 == true) { if (var3 == true) { ... } } } Then you can also respond to cases where something isn't true. For example, if you're validating input, you could give the user a tip for how to properly form...
Please update the question, do you have a list of CompanyNames available to you? I ask because you maybe able to use Levenshtein algo to find a relationship between your list of CompanyNames and LocationNames.
Please update the question, do you have a list of CompanyNames available to you? I ask because you maybe able to use Levenshtein algo to find a relationship between your list of CompanyNames and LocationNames. ---------- **Update** > There is not a list of Company Names, I will have to generate the company n...
G'day, I've already mentioned it a few times but Scott Meyers books [Effective C++][1] and [Effective STL][2] are really worth their weight in gold for helping with C++. Come to think of it Steven Dewhurst's [C++ Gotchas][3] is also an excellent "from the trenches" resource. His item on rolling your own except...
The answer to this question should actually depend on the domain the solution is implemented for. If you happen to simulate a physical search in a physical haystack, you might have the classes - Space - Straw - Needle - Seeker **Space** knows which objects are located at which coordinates ...
We've got an Apache instance deployed through Oracle Application Server. It's currently installed with the default wallet, and, the self-signed certificate. We've got a GEOTRUST certificiate, imported the Trusted Roots and imported the new Cert to the Wallet Manager. We've then updated the SSL properties of the VHOST a...
I'm curious on what it is you which to accomplish with that. Why use a link at all? Is it just for the formatting? In that case, just use a &lt;span&gt; in HTML and use stylesheets to make the format match the links. Or you use the link and attach an onClick-Event where you "return false;" which will make the bro...
You can set the CSS for your "a" tags to not have underlines: a: link, visited, hover, active { text-decoration: none } Though I would advise against including "hover" here because there will be no other way to know that it's a link.
If you merely want to modify the appearance of the link so as not to look like a link, you can set the CSS for your "a" tags to not have underlines: a: link, visited, hover, active { text-decoration: none; } Though I would advise against including "hover" here because there will be no other way ...
If you mean to stop the link from activating, the usual way is to link to "javascript:void(0);", i.e.: &lt;a href="javascript:void(0);"&gt;foo&lt;/a&gt;
I believe you can store the connection information in an app.config file and retrieve it from there. [Here][1] is a post about doing that with LINQ to SQL. Once you deploy it to a production server, you can just edit the XML to change the data source. [1]: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=...
Releases is the same as tags... Have you got multiple projects inside your trunk? In that case, I would copy the same folders inside tags So trunk fooapp stuff... barapp stuff... tags fooapp 1.0.0 1.0.1 barapp...
This should work: onclick="return false;" if not, you could change href to "#" also. Making it appear as a rest of text is css...
This should work: onclick="return false;" if not, you could change href to "#" also. Making it appear as a rest of text is css, e.g. displaying arrow instead of hand is: a.dummy { cursor:default; }
Getting random row through SQLAlchemy
|python|sql|database|sqlalchemy|
How do I select a(or some) random row(s) from a table using SQLAlchemy?
Before killing sessions, if possible do ALTER SYSTEM ENABLE RESTRICTED SESSION; to stop new sessions from connecting.
Theres a couple of ways through SQL, depending on which data base is being used. (I think SQLAlchemy can use all these anyways) mysql: SELECT colum FROM table ORDER BY RAND() LIMIT 1 PostgreSQL: SELECT column FROM table ORDER BY RANDOM() LIMIT 1 MSSQL: SELECT TOP 1 c...
For embedded Linux hacking, simple Linksys WRT54G router that you can buy everywhere is a development platform on its own <http://en.wikipedia.org/wiki/Linksys_WRT54G_series>: >The WRT54G is notable for being the first consumer-level network device that had its firmware source code released to satisfy the obligation...
I love the idea of using exceptions, but I often have third party libraries involved, and then if they don't use exceptions you end up with 3-4 different approaches to the problem! Zend uses exceptions. CakePHP uses a custom error handler, and most PEAR libraries use the PEAR::Error object. I which there WAS one tr...
This is very much database specifc issue. I know that PostgreSQL and MySQL has abbility to order by random function, so You can use this in SQLAlchemy: select.order_by(func.random()) # for PostgreSQL select.order_by(func.rand()) # for MySQL Next You need to limit query to amout of records You need (...
Find out how much memory is being used by an object in C#?
|asp.net|controls|
Storing third-party libraries in source control
|version-control|
Should libraries that the application relies on be stored in source control? One part of me says it should and another part say's no. It feels wrong to add a 20mb library that dwarfs the entire app just because you rely on a couple of functions from it (albeit rather heavily). Should you just store the jar/dll or maybe...
|version-control|
How do I strip the fluff out of a third party library?
|java|optimization|size|
It may not be best practice but are there ways of removing unsused classes from a third party's jar files. Something that looks at the way in which my classes are using the library and does some kind of coverage analysis, then spits out another jar with all of the untouched classes removed. Obviously there are issu...
|java|optimization|size|
What libraries do I need to link my mixed-mode application to?
|linker|c++cli|mixed-mode|
I'm integrating .NET support into our C++ application. It's an old-school MFC application, with 1 extra file compiled with the "/clr" option that references a CWinFormsControl. I'm not allowed to remove the linker flag "/NODEFAULTLIB". (We have our own build management system, not Visual Studio's.) This means I h...
|c++|linker|cli|mixed-mode|