instruction
stringlengths
0
30k
There's [Yahoo's Konfabulator][1] for the windows desktop. [1]: http://widgets.yahoo.com/tools/
My favorite convention for looping over a matrix-like set is to use x+y as they are used in cartesian coordinates: for x in width: for y in height: do_something_interesting(x,y)
How to sort a Map<Key, Value> on the values in Java?
|javai|
I am relatively new to Java, and often find that I need to sort a Map<Key, Value> on the values. Since the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key. Is there an easier way?...
|java|java.util|collections|
|java|collections|
Many great answers to this questions, thanks people. I'd like to put here an editable answer that brings things together. For those familiar with C# understanding -> being the same as => lamba expression is a good first step. This usage is :- fun x y -> x + y + 1 Can be understood as the equivalent to:- ...
|java|tutorials|swing|jtable|
Because if your type parameter is a wildcard, you can't use a generic remove method.
Because if your type parameter is a wildcard, you can't use a generic remove method. I seem to recall running into this question with Map's get(Object) method. The get method in this case isn't generic, though it should reasonably expect to be passed an object of the same type as the first type parameter. I realiz...
I've never used McAfee eBusiness Server specifically, but the entire point of GnuPG was to provide Free Software that implemented the OpenPGP spec. Unless McAfee is for some hideously obnoxious reason mandating specific ciphers, there shouldn't be a problem. Note that if some components are going to be checking a k...
Sharing binary folders in Visual Studio
|visual-studio|
For a long time i have tried to work out the best way to access certain site files which i don't wish to be apart of a project or to ease integration with multiple developers (and talents, e.g. designers) on a single project. A lot of sites i have created have had folders with large amounts of images and other binar...
GetDefaultPrinter [(MSDN)][1] ought to do the trick. That will get you the name to pass to CreateDC for printing. [1]: http://msdn.microsoft.com/en-us/library/ms535475(VS.85).aspx
What constitutes a good CI build-process? We use CI, but is deployment to production even a realistic CI goal when you have dependencies on several services that should be deployed too and other apps may depend on these too. Is a good good CI build process good enough when its automated to QA and manual from ther...
See: [Create a variable in .CSS file for use within that .CSS file][1] To summarize, you have three basic option: 1. Use a macro pre-processor to replace constant color names in your stylesheets. 2. Use client-side scripting to configure styles. 3. Use a single rule for every color, listing all selectors for...
What is the best option for running a Jabber/XMPP on Windows 2003?
|xmpp|instant-messaging|
Criteria for comment: <ul> <li>Performance</li> <li>Capacity (ie ~number of concurrent users)</li> <li>Stability</li> </ul>
|xmpp|instant-messaging|
I'm looking to run a Jabber server on a Windows 2003 server(web farm) and like some practical advice from anyone who has run a live environment with ~500 concurrent users. Criteria for comment: <ul> <li>Performance</li> <li>Capacity (ie ~number of concurrent users)</li> <li>Stability</li> </ul>
I am using Google Chrome, so far all the web apps I have work fine in it with no modifications.
It's not oracle that determines the display of the date, it's the tool you're using to run queries. What are you using to display results? Then we can point you to the correct settings hopefully.
select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') from dual; Give the time in 24 hour format. More options are described [here][1]. [1]: http://www.oradev.com/oracle_date_format.jsp
Just to add a little to Dave Webb's answers. I had tried ROWID in the select statement but was given a syntax error. ROWID only works if you specify the rest of the columns to select, you cannot use *. This does NOT work: SELECT ROWID, * FROM customer WHERE cust-num = 123 This does work: SELECT RO...
What is the best way to encrypt a very short string in PHP?
|php|encryption|
I would like to encrypt strings which could potentially only be about three or four characters but run to about twenty characters. A hashing function (md5, sha1, etc) is not suitable as I would like to be able to decrypt the information as well. The [mcrypt][1] extension has a thoroughly daunting array of possibilities...
Debounce clicks when submitting a web form
|javascript|html|prototype|
A poorly-written back-end system we interface with is having trouble with handling the load we're producing. While they fix their load problems, we're trying to reduce any additional load we're generating, one of which is that the back-end system continues to try and service a form submission even if another submission...
Try using [MessageBox.Show(Window owner, string message, string caption)][1] Setting the MDI application as owner so the MB is shown in the front Ah, you should also add some tags to your post. [1]: http://msdn.microsoft.com/en-us/library/ms598681.aspx
How to implement paging for asp:DataList in .NET 2.0?
|asp.net|.net-2.0|c#|paging|datalist|
I spent hours researching the problem, and just want to share a solution in case you ever need to implement paging for asp:DataList in .NET 2.0. **My specific requirement was to have "Previous" and "Next" links and page number links.** [PagedDataSource solution in this article](http://www.aspdotnetcodes.com/Data...
|c#|asp.net|.net-2.0|paging|datalist|
I spent hours researching the problem, and just want to share a solution in case you ever need to implement paging for asp:DataList in .NET 2.0. **My specific requirement was to have "Previous" and "Next" links and page number links.**
I'd use git. Git repos are really small and don't require a daemon. You can probably install cygwin or msysgit on your flashdrive.
I'd use [git][1]. Git repos are really small and don't require a daemon. You can probably install [cygwin][2] or [msysgit][3] on your flashdrive. [1]: http://git.or.cz [2]: http://www.cygwin.com/ [3]: http://code.google.com/p/msysgit/
I'd use [git][1]. Git repos are really small and don't require a daemon. You can probably install [cygwin][2] or [msysgit][3] on your flashdrive. Edit: [here are some instructions for installing cygwin on a flash drive][4] [1]: http://git.or.cz [2]: http://www.cygwin.com/ [3]: http://code.google.com/p/msy...
As some people have mentioned, use the InternalsVisibleTo attribute and mark everything as internal. This of course won't guard against reflection. One thing that hasnt been mentioned is to [ilmerge][1] your assemblies into your main .exe/.dll/whatever, this will up the barrier for entry a bit (people won't be able...
As some people have mentioned, use the InternalsVisibleTo attribute and mark everything as internal. This of course won't guard against reflection. One thing that hasnt been mentioned is to [ilmerge][1] your assemblies into your main .exe/.dll/whatever, this will up the barrier for entry a bit (people won't be able...
So here's the problem, resize is calling insert, which is doing a copy construction from a default constructed element for each of the newly added elements. To get this to 0 cost you need to write your own default constructor AND your own copy constructor as empty functions. Doing this to your copy constructor is a *...
Package naming conventions for domain object models
|c#|java|package|naming-guidelines|
What are some good package naming conventions for domain specific object models. For example, say you have a **Person.java** POJO, would you put it in a **mydomain.model** or **mydomain.entity** or **mydomain.om** (object model) package. The idea is to separate the MVC model objects from the domain object model. Ou...
I would avoid going into .NET 1.1 since Microsoft is ending support for v 1.1 of the .NET Framework on 10/14/2008. The extended support runs through 10/8/2013 but is typically expensive to purchase. Any bugs or security holes will not be addressed and are your problem. [http://support.microsoft.com/lifecycle/?LN=en-...
You could also look at using the [Netz][1] executable packer and compressor. This takes your assemblies and your .exe file and packs them into a single executable so they're not visible to the outside world without a bit of digging around. My guess is that this is sufficient to prevent access for most .net prog...
excess use of anything degrades performance; using AJAX where necessary will improve performance, especially if the alternative is a complete full-page round-trip to the server [a 'postback' in asp.net terminology]
There is a presupposition here, that the most efficient way to do a lot of "Does the array contain X?" checks is to convert the array to a hash. Efficiency depends on the scarce resource, often time but sometimes space and sometimes programmer effort. You are at least doubling the memory consumed by keeping a list and ...
Ajax is just an ordinary HTTP request, so as long as your server can handle those requests it won't be a problem. The upside to Ajax is faster perceived performance by the user, since the page doesn't have to reload and redraw itself for every user action. If scalability is a concern, I'm sure you are also looking a...
What is a good PHP library to handle file uploads?
|php|file-upload|
I am looking to use a PHP library for uploading pictures to a web server so that I can use something that has been tested and hopefully not have to design one myself. Does anyone know of such a library?
|php|file-upload|
I am looking to use a PHP library for uploading pictures to a web server so that I can use something that has been tested and hopefully not have to design one myself. Does anyone know of such a library? Edit: I am aware that file uploads are built into PHP, I am looking for a library that may make the process simpl...
[Microsoft.Win32.Registry][1] [1]: http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx
I think you are a bit confused as to what curl does. It does exactly what you explained, it acts sort of like a browser and makes the call to the site and returns the content of that post. I don't know of any way you can actually redirect the browser server side and represent a post. I would actually create a Javasc...
To redirect a user to another page in PHP you can send a `header("Location: http://example.com/newpage");`. However, unfortunately for your program redirection cause all POST variables to be removed (for security reasons). If you want to cause the user's browser to send a POST request to a different URL, you would have...
I say just pick a facet of the development landscape that fascinates you and delve into that. For example, if you enjoy dealing with distributed systems, start reading up on WCF and becoming an expert on it. I don't think it's possible to be familiar with *everything* aside from a casual understanding of the techn...
Look in the "Microsoft.Win32" namespace. There you'll find functions for creating and reading registry entries. Registry.CurrentUser.OpenSubKey() Registry.CurrentUser.CreateSubKey() etc..
I'd much rather use something behind the scenes like cURL, as I can't guarantee my users will have JS enabled, and displaying a form causes some other problems I'd rather avoid. It's my plan B though ;-)
Unmanaged C++ doesn't exist (and managed C++ is now C++/CLI), if you are referring to C++, using unmanaged as a tag is just sad...
Having seen a lot of posters suggest email, all I can suggest is **DONT** use email as your line of defense. Compromising somebodys email account can be relatively easy. Many web based email services **DONT** provide any real security either, and even if they offer SSL, its often not *default* and you are still re...
I think the component model is the key thing and ease to use parts of other web pages as components (via User Controls) are the key advantages.
If found a one-line solution from good old Apache Commons Lang library. <a href="http://commons.apache.org/lang/api-release/org/apache/commons/lang/ArrayUtils.html"> ArrayUtils.addAll(Object[], Object[]).</a> Code: String[] both = ArrayUtils.addAll(first, second);
I found a one-line solution from the good old Apache Commons Lang library. <a href="http://commons.apache.org/lang/api-release/org/apache/commons/lang/ArrayUtils.html"> ArrayUtils.addAll(Object[], Object[]).</a> Code: String[] both = ArrayUtils.addAll(first, second);
If your Map values implement Comparable (e.g. String), this should work Map<Object, String> map = new HashMap<Object, String(); // Populate the Map List<String> mapValues = new ArrayList<String>(map.values()); Collections.sort(mapValues); If the map values themselves don't implement Comparable,...
If your Map values implement Comparable (e.g. String), this should work Map<Object, String> map = new HashMap<Object, String>(); // Populate the Map List<String> mapValues = new ArrayList<String>(map.values()); Collections.sort(mapValues); If the map values themselves don't implement Comparable...
Ease of use to get something simple done
The key strengths of ASP.Net are: 1. Compiled code - performance 2. Multiple language development 3. XCopy Deployment 4. Visual Studio Design-time Integration and Expression Web 5. Many 3rd party controls, both open-sourced and commercial 6. Easy to learn for beginners
- State Management - Low learning curve to get started on something simple (However becomes complicated quickly as soon as you have a page with dynamically added elements). - Huge library of mature controls - Huge amount of documentation and resources - Great performance Despite what other people may have s...
One key strength (to some) is a drag-and-drop development environment integrated into Visual Studio. This allows you to get simple things up and running quickly, but can also be a liability when the time comes that you actually need to understand the underlying code.
Best way is to not store the password at all! For instance, if you're on a Windows system, and connecting to SQL Server, you can use Integrated Authentication to connect to the database without a password, using the current process's identity. If you do need to connect with a password, first **encrypt** it, using...
Is conditional compilation a valid mock/stub strategy for unit testing?
|unit-testing|stub|conditional-compilation|
In a recent question on stubbing, many answers suggested C# interfaces or delegates for implementing stubs, but [one answer][1] suggested using conditional compilation, retaining static binding in the production code. This answer was modded -2 at the time of reading, so at least 2 people really thought this was a *wro...
In a recent question on stubbing, many answers suggested C# interfaces or delegates for implementing stubs, but [one answer][1] suggested using conditional compilation, retaining static binding in the production code. This answer was modded -2 at the time of reading, so at least 2 people really thought this was a *wro...
I moved this from the question, so it doesn't appear as "Not Answered" [PagedDataSource solution in this article](http://www.aspdotnetcodes.com/DataList_Dynamic_Paging_PagedDataSource.aspx#) was the most elegant and simple solution for the problem. If you have a better solution - post it here. **p.s. I'm not a...
You probably got a corrupted file from the download. I would try download again and reinstall the help.
If it's one line of if (and optionally one line of else) I prefer to not use the brackets. It's more readable and concise. I say that I prefer it because it is purely a matter of preference. Though I think that trying to enforce a standard that you must always use the braces is kind of silly. If you have to worry ab...
If the site is busy then it will, eventually, kill the server, unless your in a farm. As to the site itself it **shouldn't**.
I find it somewhat unlikely that your ray would fall exactly between the triangles in a way that the floating point precision would take effect. Are you absolutely positive that this is indeed the problem? At any rate, a possible solution is instead of shooting just one ray to shoot three that are very close to each...
There is no speed difference between virtual calls at different levels since they all get flattened out into the vtable (pointing to the most derived versions of the overridden methods). So, calling ((A*)inst)-&gt;Method() when _inst_ is an instance of _B_ is the same overhead as when _inst_ is an instance of _D_. N...
Funnily enough I just spent two weeks overhauling (read implementing from scratch) our nightly build process. Great fun (no, really). I toyed with the idea of installing Team Foundation Server, but we use Perforce for source control and I didn't think it was worth the hassle. Our process is now a set of Powershell s...
[CruiseControl][1] for automated builds. Works great. [1]: http://cruisecontrol.sourceforge.net/
Usually when you call a virtual function through a dangling pointer--most likely the instance has already been destroyed. There can be more "creative" reasons, too: maybe you've managed to slice off the part of your object where the virtual function was implemented. But usually it's just that the instance has alread...
D generally has all the C stdlib available (Tango or Phobos) so answers to this question for GNU C should work in D as well. If tango doesn't have the needed function, generating the bindings is easy. (Take a look at CPP to cut through any macro junk.)
[hudson][1] for automated builds. It's manageable and configurable via the web interface. Very low learning curve. [1]: https://hudson.dev.java.net/
[Hudson][1] for automated builds. I chose it because it was the easiest to setup and demo. A system that's too complex and isn't slick-looking won't impress management enough to get them on-board for automated builds. Especially in a project that has a lot of inertia. [1]: https://hudson.dev.java.net/
gcc will emit warnings when you violate exception specifications. What I do is to use macros to use the exception specifications only in a "lint" mode compile expressly for checking to make sure the exceptions agree with my documentation.
Can I display the list of all the system objects (semaphores, queues...) in VxWorks?
|vxworks|
I would like to know what semaphores, messageQueues, etc... are active in my vxWorks 6.x system. I have access to this information via the debugger, but I would like access to it from the shell. Is there a way?
You can't resize an image without losing some quality, simply because you are reducing the number of pixels. Don't reduce the size client size, because browsers don't do a good job of resizing images. What you can do it programatically change it before you render it, or as a user uploads it. Here is an artic...
You can't resize an image without losing some quality, simply because you are reducing the number of pixels. Don't reduce the size client side, because browsers don't do a good job of resizing images. What you can do is programatically change the size before you render it, or as a user uploads it. Here is an...
### Limited Scope is Best ### Use your second option: for ( ... ) { String s = ...; } ### Scope Doesn't Affect Performance ### If you disassemble code the compiled from each (with the JDK's `javap` tool), you will see that the loop compiles to the exact same JVM instructions in both cases. N...
Getting Started with an IDE?