instruction
stringlengths
0
30k
|efficiency|battery|
Consider using the network interfaces the least you can. You might want to gather information and send it out in bursts instead of constantly send it.
You could always download the site and scrap it. I think everything inside `<div id="bodyContent">` is the content of the article - sans navigation, header, footer, etc.. Don't forget to credit. ;)
I found this article to be a pretty cool description of using svn to backup your home directory, and more: >I use Subversion to backup my Linux boxes. With some minor creativity, it easily covers: > * Daily snapshots and offsite backup. > * Easy addition and removal of files and folders. > * Detailed t...
I found this article to be a pretty cool description of using svn to backup your home directory, and more: >I use Subversion to backup my Linux boxes. With some minor creativity, it easily covers: > * Daily snapshots and offsite backup. > * Easy addition and removal of files and folders. > * Detailed t...
|svn|dvcs|vcs|bazaar|
I am curious whether it is OK to copy a directory that is under version control and start working on both copies. I know it can be different from one VCS to another, but I intentionally don't specify any VCS since I am curious about different cases. I was talking to a coworker recently about doing it in SVN. I th...
DateTime has a constructor that takes Ticks (which are 100nanoseconds). So take your prTime multiply it by 10 and add it to the number of ticks representing the Epoch time and you have your conversion. private static DateTime epoch = new DateTime(1970, 1, 1); private static DateTime ConvertPrTime(long ti...
I use a combination of [PEAR Benchmark][1] and [log4php][2]. At the top of scripts I want to profile I create an object that wraps around a [Benchmark_Timer][3] object. Throughout the code, I add in `$object->setMarker("name"); `calls, especially around suspect code. The wrapper class has a destroy method that t...
How do you profile your code?
|productivity|code-profiling|c|
I hope not everyone is using Rational Purify. So what do you do when you want to measure - time taken by a function - peak memory usage - code coverage At the moment, we do manually [using log statements with timestamps and another script to parse the log and output to excel. phew...) What would y...
I hope not everyone is using Rational Purify. So what do you do when you want to measure - time taken by a function - peak memory usage - code coverage At the moment, we do manually [using log statements with timestamps and another script to parse the log and output to excel. phew...) What would y...
It is really hard to provide you exact answers because critical information about the client side installer is not explicit. Do you install client side files into Program Files? Then you may meet problems when users are restricted. You don't think Local Application Data is a folder to deploy application, but Google ...
How to switch between modes (i to enter insert mode (one of many ways), esc to exit insert mode, colon for command mode) and how to save and exit. (:wq)
I use vi very lightly, and I only use the following commands:<br> a - switch to insert mode<br> esc - return to command mode<br> :wq - save and quit<br> :q - quit (no save)<br> x - delete one character<br> dd - delete the whole line<br> <br> I know there are many many more, but those are enough to get you by.
Another useful command is to search something: /<SEARCHTERM> e.g. /Mon will search (and in case of vim highlight) any occurences of Mon in your file.
Google's Chrome uses the [**WebKit rendering engine**][1], which is what Safari uses. So, I would guess it renders most closely to Safari. [1]: http://webkit.org/
Since it's based on WebKit, its rendering will most closely resemble Safari and Konqueror.
I read the w3 specs which just say that there are 3 parts to a document. The sequence is assumed and there is no explicit statement forbidding, for example, a little js snippit up front. I understand that it is possible to configure TAM to add the js at the end of the dicument but it beats me why they put it up top...
Continuations are a good alternative to thread-per-request in server programming (including web application frontends. In this model, instead of launching a new (heavy) thread every time a request comes in, you just start some work in a function. Then, when you are ready to block on I/O (i.e. reading from the databa...
A couple of other starting platforms: - A good programmable calculator (that's what I learnt on back in the 70s), and HP25 then HP41, now TI69, etc. - Interactive Fiction platforms, like "Inform 7" provide another angle on the whole thing - Flash/ActionScript All of these are different and engaging, and a...
Why can't you / don't want to use the LD_PRELOAD trick? Example code here: /* * File: soft_atimes.c * Author: D.J. Capelis * * Compile: * gcc -fPIC -c -o soft_atimes.o soft_atimes.c * gcc -shared -o soft_atimes.so soft_atimes.o -ldl * * Use: * LD_PRELOAD="...
Bluetooth Signal Strength
|c#|wmi|bluetooth|
Does anyone have any idea how to track the signal strength of a bluetooth connection perferably in C#? I was thinking using a WMI query but couldn't track down the WMI class encapsulating the connection. The idea is when I leave my machine with my cellphone in pocket the bluetooth signal weakens and my machine lo...
Can a servlet determine if the data posted to it is enctype="multipart/form-data"?
|java|servlets|front-controller|multipartform-data|
I have a servlet that is used for many different actions, used in the [Front Controller pattern][1]. Does anyone know if it is possible to tell if the data posted back to it is enctype="multipart/form-data"? I can't read the request parameters until I decide this, so I can't dispatch the request to the proper control...
One thing to keep in mind is that you write code to be readable to future coders, including your future self. Even if you can find a built-in delegate with the correct signature in the framework, it's not always correct to use that delegate if it obscures the purpose of the code. Six months down the road, the use of...
Take a look at **[jmate][1]** project. It contains really helpful methods for strings, collections and IO operations (for now). Look some [examples here][2]. [1]: http://code.google.com/p/jmate/ [2]: http://javaadami.blogspot.com/2008/08/whenever-scripting-language-wants-to.html
Java and Spring -- Use quartz. Very nice and reliable -- http://static.springframework.org/spring/docs/1.2.x/reference/scheduling.html
Not sure about this, but have you tried adding this to your source: debugger; Works in most, if not all browsers.
PHP has a built in function --> shuffle() . I would say that should do what you like, but it mostly likely will be anything but totally 'random'. Check http://computer.howstuffworks.com/question697.htm for a little description of why its very, very difficult to get complete randomness form a computer.
Alt-` (also under the Page > Developer > Debug JavaScript menu item)
You'd want to wrap whatever loop's calling `Math.exp()` in C as well. Otherwise, the overhead of marshalling between Java and C will overwhelm any performance advantage.
No offiense to those who provided clear answers, but many people seem to be answering your question instead of addressing your problem. You want multiple IDs, so you think you could this this: http://example.com/mypage.aspx?IDs=1234,4321,6789 The problem is that this is a non-robust solution. In the future, if...
I had good luck with just keeping the DateTime data type and always storing it as GMT. In each layer, I'd adjust the GMT value to the local value for the layer.
There are many MVC frameworks. There are many JavaScript frameworks that have different functionalities. If you want a meaningful answer, you should choose an MVC and a JavaScript framework and ask concerning those two. Please be as detailed as possible in your questions. As an example, the validation handling on Ac...
How extremely easy is to find PHP related things Examples, Applications, Classes, Documentation, Frameworks, etc... All over the web, it's the easiest language to learn when going commando(by yourself), and also the one with more value for your time. After learning PHP might put CMS with joomla, a blog with word...
How to check if page is postback within reserved function pageLoad on asp.net ajax
|asp.net|javascript|ajax|postback|lifecycle|
I'm looking for a way to check within pageLoad() if this method is raised during load event because of a postback/async postback or because of being loaded and access the first time. This is similar to Page.IsPostback property within code behind page. TIA, Ricky
How to check if page is postback within reserved function pageLoad on ASP.NET AJAX
|javascript|asp.net-ajax|postback|lifecycle|
Can you pre-compile regular expressions in python?
|python|regex|caching|
Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory. a = re.compile("a.*b") b = re.compile("c.*d") ... Question: Is it possible to store these regular expressio...
Caching compiled regex objects in Python?
While OpenGL is by far easy to start with and as some people already wrote - getting a triangle to show on screen and from there move to textures, particles and more can be done within a day. I do however think that a good question to ask is what is your final goal. If it is a simple game, no skeletal animation,...
I'd say given it's going to hang off of 'System' namespace in the .NET 4.0 Framework that you couldn't go too far wrong. It will be interesting to see how MEF evolves and what influence Hamilton Verissimo (Castle) has on the MEF's direction. *If it quacks like a duck, it just might be part of the current flock of I...
Inter-convertability of asymmetric key containers (eg: X.509, PGP, OpenSSH)
|security|ssh|cryptography|gnupg|x509|
Are asymmetrical cryptographic keys fundamentally inter-convertible between the major key container formats? For example, can I convert an X.509 key file into a PGP or OpenGPG key file? And--assuming the answer is yes--is it "security neutral" to keep one key pair in whatever format and convert into whichever conta...
Const Struct&
|c++|
I'm having a little trouble figuring out exactly how const applies in a specific case. Here's the code I have: struct Widget { Widget():x(0), y(0), z(0){} int x, y, z; }; struct WidgetHolder //Just a simple struct to hold four Widgets. { WidgetHolder(Wi...
|c++|constants|
I think your best bet would be to just do: throw; And then extract the innerexception later.
Even more reflection... catch (TargetInvocationException tiex) { // Get the _remoteStackTraceString of the Exception class FieldInfo remoteStackTraceString = typeof(Exception) .GetField("_remoteStackTraceString", ...
I worked on the Helios product in [this setup][1]. WPF on top of lots of other stuff, including C++. WPF is what I would recommend if you were developing in .NET and wanted a smart client application with a heavily customized UI. If you were thinking about using a simple Windows-y UI, go with Windows Forms. [1]...
Zeroith, use a fully static machine that can stop when idle. You can't beat zero Hz. First up, switch to a tickless operating system scheduler. Waking up every millisecend or so wastes power. If you can't, consider slowing the scheduler interrupt instead. Secondly, ensure your idle thread is a power save, wait f...
- Like `1800 INFORMATION` said, avoid polling, subscribe to events and wait for them to happen - Update window content only when necessary - let the system decide when to redraw it - When updating window content, ensure your code recreates as little of the invalid region as possible - With quick code the CPU...
The only time you'll see a performance difference is if you do not mark a property as "nonatomic". Then @synthesize will automatically add synchronization code around the setting of your property, keeping it thread safe - but slower to set and access. Thus mostly you probably want to define a property like: @pro...
|c|productivity|profiling|
Keyboard Shortcut in Access 2003
|ms-access|
Is there a keyboard shortcut in Access 2003 that will run a query while in design or sql mode?
From the double post someone mentioned: WMI Event Sink Still looking for a better answer though.
Best dotnet memory and performance profiler . .
|c#|dotnet|code-profiling|
We are using Jetbrains dottrace. Anyone recommend any other profiling tools that you think are better for profiling C# winforms apps.
|c#|.net|code-profiling|
|c#|.net|profiling|
Is it really viable to use GCJ to publish server-side applications? Webapps? My boss is convinced that compiling our (***my***) webapp into a binary executable is a brilliant idea. (Then again, he likes nice, small simple things with blinky lights that he can understand.) He instinctively sees no issues with th...
Is it really viable to use GCJ to publish server-side applications? Webapps? My boss is convinced that compiling our (***my***) webapp into a binary executable is a brilliant idea. (Then again, he likes nice, small simple things with blinky lights that he can understand.) He instinctively sees no issues with th...
Regular Expression to match valid dates
|regex|date|
I'm trying to write a regular expression that validates a date. The regex needs to match the following - M/D/YYYY - MM/DD/YYYY - Single digit months can start with a leading zero (eg: 03/12/2008) - Single digit days can start with a leading zero (eg: 3/02/2008) - CANNOT include February 30 or February...
I'm trying to write a regular expression that validates a date. The regex needs to match the following - M/D/YYYY - MM/DD/YYYY - Single digit months can start with a leading zero (eg: 03/12/2008) - Single digit days can start with a leading zero (eg: 3/02/2008) - CANNOT include February 30 or February...
|regex|date|duplicate|
|regex|date|
ListView_GetSubItemRect (LVM_GETSUBITEMTECT) http://msdn.microsoft.com/en-us/library/ms930172.aspx Despite what the documentation says I suspect LVIR_LABEL returns just the returns the bounding rectangle of the item text, as per ListView_GetItemRect. (This just kept niggling me as I though I had actually seen...
ListView_GetSubItemRect (LVM_GETSUBITEMTECT) http://msdn.microsoft.com/en-us/library/ms930172.aspx Despite what the documentation says I suspect LVIR_LABEL returns just the returns the bounding rectangle of the item text, as per ListView_GetItemRect. (This just kept niggling me as I though I had actually seen...
I've found the [Zend_Form][1] package of the [Zend Framework][2] to be particulary flexible. This component can also be used with [Zend_Dojo][3] to rapidly implement common javascript form helpers. However, the component is agnostic when it comes to the library that you use, but supports Dojo naitively. The compon...
[len() is an O(1) operation](http://books.google.com/books?id=vpTAq4dnmuAC&pg=RA1-PA479&lpg=RA1-PA479&dq=Python+len+big+O&source=web&ots=AOM6A1K9Fy&sig=iQo8mV6Xf9KdzuNSa-Jkr8wDEuw&hl=en&sa=X&oi=book_result&resnum=4&ct=result) for Python lists, strings, dicts, and sets. Python internally keeps track of the number of ele...
I think you just need to use a normal form (set the form type to Tool) and use the docking property to dock to to the left or right. You can set the width if you like and use the resize event to stop the user from making it too big or small.
With the introduction of properties I see no need for prefixing "\_" to class instance variables. You can set a simple rule (described in your header file) that any variables to be accessed external to the class must be accessed via the property, or by using custom methods on the class to affect values. This to me se...
I see two options, but both depend on your web control implementing some sort of collection for your values. The first option is to just use the control's collection instead of your private variable. The other option is to copy the control's collection to your private variable at run-time (maybe in the Page_Load even...
You can do LINQ to Objects and the use LINQ to calculate the totals: int sumLineTotal = (from od in orderdetailscollection select od.LineTotal).Sum(); You can also use lambda-expressions to do this, which is a bit "cleaner". int sumLineTotal = orderdetailscollection.Sum(od => od.LineTotal);
You can do LINQ to Objects and the use LINQ to calculate the totals: decimal sumLineTotal = (from od in orderdetailscollection select od.LineTotal).Sum(); You can also use lambda-expressions to do this, which is a bit "cleaner". decimal sumLineTotal = orderdetailscollection.Sum(od => od.LineTotal)...
The key part of the code at that link is the systemManager.stage.addEventListener(Event.DEACTIVATE,deactivate); The Flash player send outs activate and deactivate events when the focus enters and leaves the player. All you need to do is create a listenr for them and react appropriately. A more clear examp...
Internationalized page properties in Tapestry 4.1.2
|java|tapestry|internationalization|
|java|internationalization|intermediate|tapestry|
|java|internationalization|tapestry|tomcat|
|java|internationalization|tapestry|
The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as: áéíóú ...the getPassword() abstract method for the corresponding property r...
The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as: áéíóú ...an inspection of the return value of getPassword() (the abstract m...
Stored procedures are usually a win for security. Simplifying the relationship between your application and the database reduces the number of places where you can have errors; errors in code that interfaces business logic to the database tend to be security problems. So, your DBA isn't wrong about locking things down ...