instruction
stringlengths
0
30k
|render|
I've started to add the time taken to render a page to the footer of our internal web applications. Currently it appears like this > Rendered in 0.062 seconds Occasionally I get rendered times like this > Rendered in 0.000 seconds Currently it's only meant to be a guide for users to judge whether a page is ...
Rather than relying on your users to look at the page footer and to let you know if the value exceeds some patience threshold, it might be a better idea to log the page render times in a log file on the server. Once you have all that raw data, you can look for particular pages that tend to take longer than normal to re...
Just simple things - move messages to appropriate folders, forward some stuff to an email2sms address, move spam to spam folder. One thing I'm kind of proud of is how to mark your spam as "read" (this is for Courier IMAP and Maildir, where "read" means "move to different folder and change the filename"): :0 ...
"Rendered instantly" sounds way better than "Rendered in less than a second".
Not sure whether I understood correctly your intentions but let's see if this one helps. public class TypedProperty<T> : Property { public T TypedValue { get { return (T)Convert.ChangeType(base.Value, typeof(T)); } set { base.Value = value.ToString();} } }
A good way to get started is to concentrate on the "Springframework". The Spring portfolio has grown to a big pile of projects around various aspects of Enterprise Software. Stick to the core at the beginning and try to grasp the concepts. [Download][1] the latest binaries and check out Spring's petclinic example once ...
If you are accessing this from an API based client (I'm guessing that is the case because of the '?'s in the query) you can do this from your program rather than through SQL. Note: The rest is for JDBC syntax, other APIs/languages will be different syntax, but should be conceptually the same. On the insert side...
I like to use rectangle for 2 main purposes, inserting the same text on every line, or killing a column of text (similar to Dave Webb's answer). There are 2 useful shortcuts for these, "C-x r k" will kill a rectangle, and "C-x r t" to insert (there are other rectangle commands with a "C-x r" prefix, but these are th...
I like to use rectangle for 2 main purposes, inserting the same text on every line, or killing a column of text (similar to Dave Webb's answer). There are 2 useful shortcuts for these, "C-x r k" will kill a rectangle, and "C-x r t" to insert (there are other rectangle commands with a "C-x r" prefix, but these are th...
Is there a way to make WatiN click a link before the page finishes loading
|unit-testing|automated-tests|watin|
We're using WatiN for testing our UI, but one page (which is unfortunately not under our teams control) takes forever to finish loading. Is there a way to get WatiN to click a link on the page before the page finishes rendering completely?
You can create a volatile registry entry. It will only exist untill the computer is restarted. This solution is very much "hackable", but it is simple and may suffice for what you want to do. Take a look at the REG_OPTION_VOLATILE [here][1]. [1]: http://msdn.microsoft.com/en-us/library/ms724844(VS.85).aspx
Linking combo box (JQuery preferrably)
|javascript|html|jquery|combobox|
I am wondering if anyone has any experience using a JQuery plugin that converts a html <select> <option> Blah </option> </select> combo box into something (probably a div) where selecting an item acts the same as clicking a link. I guess you could probably use javascript to handle a selection event (my ja...
Getting DIV id based on x & y position
|javascript|
The problem I'm trying to solve is "What's at this position?" It's fairly trivial to get the x/y position (offset) of a DIV, but what about the reverse? How do I get the id of a DIV (or any element) given an x/y position?
Use a JQuery selector to filter the list of all DIVs for one that matches your position criteria?
Prefer composition over inheritance?
|oop|inheritance|
Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?
If you have control of the query that is returning the results, you can use ISNULL() to return non-null values like this: SELECT ISNULL(name,'') AS name ,ISNULL(age, 0) AS age FROM names If your situation can tolerate these magic values to substitute for NULL, taking this approach ...
Create a mouse event listener, then trigger a mouse event at that location. This should give you the entire stack of elements at that location. Or, look at the source of Firebug.
REST how to handle query parameters when put to resource?
|html|rest|
I have a REST data service where I want to allow the users to create new items with HTTP PUT using different formats like json,xml,csv. Now I'm a little unsure how to best handle the format specification in the url: PUT -> /ressource/ID/json PUT -> /ressource/ID/xml or PUT -> /ressource/ID?f...
Why limit yourself to .NET 2.0. .NET 3.0 (or 3.5) contains WCF and is a solid, performant communications subsystem with good security. .NET 3.0 is just .NET 2.0 with additional libraries (WCF, WF, WPF).
There are a couple of thinks to keep in mind if you are starting with OSGi. As mentioned elsewhere in this thread, knowing about classloading is really important. In my experience everybody sooner or later runs into problems with it. Another important thing to remember is: never hold references! Have a look at t...
Try adding SMS messages into the mix.
Best bet is to create an HttpHandler that would return the image. Then bind the ImageUrl property on the asp:Image to the url of the HttpHandler.
Best bet is to create an HttpHandler that would return the image. Then bind the ImageUrl property on the asp:Image to the url of the HttpHandler. Here is some code. First create the HttpHandler: <%@ WebHandler Language="C#" Class="ImageHandler" %> using System.Drawing; using System.Drawing...
I think I'd go whole hog one direction or another. You could write a mini-language that does any sort of conversion like **units** does: $ units 'tempF(-40)' tempC -40 Or use individual functions like the recent [Convert::Temperature](http://search.cpan.org/~mopy/Convert-Temperature-0.03/) Perl modu...
SyncML is a standard for data synchronization of things normally associated with someone's personal organizer. Nokia and Motorola were both using it heavily a few years ago, but I don't know its current state. iCalendar is a calendar synchronization format specification, and CalDAV is an implementation of iCalendar ...
How do I make custom MenuHeaders in WPF with accelerators?
|wpf|xaml|style|template|menu|
I'd like to make some custom MenuHeaders in WPF so I can have (for example), an icon and text in a menu item. Normally using MenuItems, if you populate the Header field with straight text, you can add an accelerator by using an underscore. eg, _File However, if I wanted to put in a UserControl, I believe this fun...
|wpf|templates|xaml|menu|styles|
What's a good program to record video or screencast being played on screen?
|record|video|
What's a good program to record videos or screencasts being played on screen?
|video|records|
If you're using Vista the latest version of [Fraps][1] might also do what you need. I haven't tried it for that, though, just games [1]: http://www.fraps.com/
so.c in 15 characters: main(){main();} Result: antti@blah:~$ gcc so.c -o so antti@blah:~$ ./so Segmentation fault (core dumped)
so.c in **15 characters**: main(){main();} Result: antti@blah:~$ gcc so.c -o so antti@blah:~$ ./so Segmentation fault (core dumped) **Edit**: Okay, it gives warnings with -Wall and does not cause a stack overflow with -O2. But it works!
MVC **Controller**: Put code here, that has to do with working out what a user wants, and deciding what to give them, working out if they are logged in, whether they should see certain data etc. In the end the controller looks at requests and works out what data (Models) to show and what Views to render. If you are ...
MVC **Controller**: Put code here that has to do with working out what a user wants, and deciding what to give them, working out whether they are logged in, whether they should see certain data, etc. In the end, the controller looks at requests and works out what data (Models) to show and what Views to render. If yo...
The way it determines zone between IE6 and IE7 did change. There were bugs in how IE6 did it. Unfortunately I know of no documentation on exactaly how it does it. If you posted the URLs that are giving you trouble, or gave some indication as to the problem you're trying to solve that you think this information would ...
For many types (integer, double, DateTime etc), there is a static Parse method. You can invoke it using reflection: MethodInfo m = typeof(T).GetMethod("Parse", new Type[] { typeof(string) } ); if (m != null) { return m.Invoke(null, new object[] { base.Value }); }
You could possibly use a construct such as a [traits class][1]. In this way, you would have a parameterised helper class that knows how to convert a string to a value of its own type. Then your getter might look like this: get { return StringConverter<DataType>.FromString(); } Now, I must point out that my ex...
You could possibly use a construct such as a [traits class][1]. In this way, you would have a parameterised helper class that knows how to convert a string to a value of its own type. Then your getter might look like this: get { return StringConverter<DataType>.FromString(base.Value); } Now, I must point out ...
Spring is also very much about unit testing and therefore testability of your classes. That basically means thinking about modularization, separation of concerns, referencing a class through interfaces etc.
I would look at the crash in more detail - if it's crashing in a test case, then it sounds pretty easily reproducible, which is usually most of the challenge.
Can you add the debug symbols to the release build and run it in the debugger to see where and why it crashed?
What kind of data are you planning to use? I would say, that if the server is also done in Java, easiest way for small footprint is to send/receive binary data in predefined format. Just write everything in known order into DataOutputStream. But it would really depend, what what kind of data are you working and can ...
What kind of data are you planning to use? I would say, that if the server is also done in Java, easiest way for small footprint is to send/receive binary data in predefined format. Just write everything in known order into DataOutputStream. But it would really depend, what what kind of data are you working on and c...
How can I empty the recycle bin for all users from a Windows service application in c#
|c#|recycle-bin|
I'm looking for a c# snippet which I can insert in a Windows service. The code must empty the recycle bin for all users on the computer. I have previously tried using SHEmptyRecycleBin (ref http://www.codeproject.com/KB/cs/Empty_Recycle_Bin.aspx) however the code doesn't work when ran from a windows service as the s...
Best bet is to create an HttpHandler that would return the image. Then bind the ImageUrl property on the asp:Image to the url of the HttpHandler. Here is some code. First create the HttpHandler: <%@ WebHandler Language="C#" Class="ImageHandler" %> using System.Drawing; using System.Drawing...
Best bet is to create an HttpHandler that would return the image. Then bind the ImageUrl property on the asp:Image to the url of the HttpHandler. Here is some code. First create the HttpHandler: <%@ WebHandler Language="C#" Class="ImageHandler" %> using System.Drawing; using System.Drawing...
Answers: 1. (position item sequence &key from-end (start 0) end key test test-not) http://lispdoc.com/?q=position&search=Basic+search 2. (setf (elt sequence index) value) 3. (elt sequence index) http://lispdoc.com/?q=elt&search=Basic+search NOTE: elt is preferable to nth because elt work...
Unless you need to do something Nokia-specific, I suggest avoiding the Nokia device definitions altogether. Develop for a generic device, then download your application to real, physical devices for final testing. The steps I suggest: 1. Download and install Sun's Wireless Toolkit. 2. Install EclipseME, using the...
You could also just add the below line in the .htaccess file Redirect permanent /oldpage.html http://www.example.com/newpage.html
List<int> convertIDs = new List<int>; string[] splitIds = ids.split(','); foreach(string s in splitIds) { convertIDs.Add(int.Parse(s)); } For completeness you will want to put try/catches around the for loop (or around the int.Parse() call) and handle the error based on your requirem...
You can programatically open the configuration with using the System.configuration namespace: `Configuration myConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);` Then you can access the connection strings collection at: `myConfig.ConnectionStrings.ConnectionStrings` You can m...
What if you turn your problem around? Instead of trying to get names from variables, get the variables from the names: ["foo", "goo", "bar"].each { |param_name| param = eval(param_name) if param.class != Array puts "#{param_name} wasn't an Array. It was a/an #{param.class}" return...
What if you turn your problem around? Instead of trying to get names from variables, get the variables from the names: ["foo", "goo", "bar"].each { |param_name| param = eval(param_name) if param.class != Array puts "#{param_name} wasn't an Array. It was a/an #{param.class}" return...
That is because %llu doesn't work properly under Windows. I suggest using PRIu64 instead and you'll find it's portable to Linux as well. Try this instead: #include <stdio.h> #include <inttypes.h> int main() { unsigned long long int num = 285212672; //FYI: fits in 29 bits int ...
That is because %llu doesn't work properly under Windows and %d can't handle 64 bit integers. I suggest using PRIu64 instead and you'll find it's portable to Linux as well. Try this instead: #include <stdio.h> #include <inttypes.h> int main() { unsigned long long int num = 285212672; ...
The former BEA Workshop is now [Oracle Workshop][1]. It is the best JSP editor with WYSIWYG support and it is free. It is not specific to WebLogic. Basic JSP editing is server neutral anyway. However, it supports launching and debugging on many servers. You can read my [blog post][2] about it. [1]: http://www...
You should encourage people about things that you want them to do. You should "feed the animal". Look at stackoverflow; what do you think about badges? Why do you think this wonderful things exist? Thanks to **ego**, there is nothing you can't get it done. Give them badges, real badges, wearable badges. They will wear ...
Service to make an audio podcast from a video one?
|video|audio|podcast|
1. Video podcast 2. ??? 3. Audio only mp3 player I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast. I would most like a website which would suck in the RSS and spit out an RSS (I'm thinking of something like Feedburner), though would se...
|video|audio|podcast|lazyweb|
1. Video podcast 2. ??? 3. Audio only mp3 player I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast. I would most like a website which would suck in the RSS and spit out an RSS (I'm thinking of something like Feedburner), though would se...
A handler can accept a url parameter like any other request. So instead of linking your &lt;asp:image to "image.ashx" you'd set it to "image.ashx?ImageID=" + [Your image ID here]
Is opening the browser window full screen an option? You could possibly also check for the window losing focus and start a timer that stops the test after some small period of time.
You can use the IFilter interface built into Windows to extract text and properties (author, title, etc.) from any supported file type. It's a COM interface so you would have use the .NET interop facilities. You'd also have to download the free PDF IFilter driver from Adobe.
C# Game Network Library
|c#|network-programming|
I am developing an online strategy game using .Net v2. Although the game is primarily strategic, it does have some tactical elements that require reasonable network performance. I plan to use TCP packets for strategic data and UDP packets for tactical data. I am looking for network library recommendations. I have...
|c#|network-programming|
I am developing an online strategy game using .Net v2. Although the game is primarily strategic, it does have some tactical elements that require reasonable network performance. I plan to use TCP packets for strategic data and UDP packets for tactical data. {EDIT} I forgot to mention that I am leaning away from WCF...
Iterate Over Map
|java|
If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map? Will the ordering of elements depend on the specific map implementation that I have for the interface?
At first glance, the solution is to use reference modification to STRING together the two strings, including the space. The problem is that you must know how many trailing spaces are present in FIRST-NAME, otherwise you'll produce something like 'JOHNbbbbbbbbbbbbDOE', where b is a space. There's no intrinsic COBOL f...
Getting hibernate to log clob parameters
|hibernate|oracle-database|java|
*(see [here][1] for the problem I'm trying to solve)* How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc. I have the following in my log4j config: log4j.logger.net.sf.hibernate.SQL=DEBUG log4j.logger.org.hibernate.SQL=DEBUG log4j...
|java|oracle-database|hibernate|
*(see [here][1] for the problem I'm trying to solve)* How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc. I have the following in my log4j config: log4j.logger.net.sf.hibernate.SQL=DEBUG log4j.logger.org.hibernate.SQL=DEBUG log4j...
You can get many different AJAX loading animations in any colour you want here: [ajaxload.info][1] [1]: http://www.ajaxload.info/
I believe the animation came from the Mac OS X loading screen. Here's a similar one with a transparent background: ![alt text][1] [1]: http://homepage.mac.com/xraydoc/.Pictures/spinner.gif
Some corporate environments won't allow Javascript, by policy or by firewall. It closes the door to one avenue of virus infection. Whether you think this is a good idea or not, realize that not everyone has full control over their browser and it might not be their choice.
To continue on previous answer, quite simply iterating through the array returned by Split and converting to a new array of ints. This sample below in C#: string[] splitIds = stringIds.Split(','); int[] ids = new int[splitIds.Length]; for (int i = 0; i < ids.Length; i++) { ...