instruction
stringlengths
0
30k
I have a very brute-force technique of moving the mouse 1 point in the x direction and then back every 3 minutes. There may me a more elegant solution but it's a quick fix.
Where `superHappyFunDiv` is the ID of the container DIV and rows is a 0-based row index: function scrollTo(row) { var container = document.getElementById("superHappyFunDiv"); var rows = container.getElementsByTagName("tr"); row = Math.min(Math.max(row, 0), rows.length-1); ...
If you are quite happy with WebForms today, then maybe ASP.NET MVC isn't for you. I have been frustrated with WebForms for a really long time. I'm definitely not alone here. The smart-client, stateful abstraction over the web breaks down severely in complex scenarios. I happen to love HTML, Javascript, and CSS. ...
Ah... Many times I have wanted to do this and I always wind up back on [this article][1]. If there is a better method I haven't found it yet. [1]: http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
Ah... Many times I have wanted to do this and I always wind up back on [this article][1]. If there is a better method I haven't found it yet. It does require you add a little non-semantic markup, but there are many cases when an extra div or className is required to get a specific styling effect and the only other m...
I would write a thin wrapper class around your third party COM object, which has the ability to load a mock object rather than the actual COM object in the unit testing situation. I normally do this by having a second constructor that I call passing in the mock object. The normal constructor would have just loaded the ...
Quicksort has a better average case complexity but in some applications it is the wrong choice. Quicksort is vulnerable to denial of service attacks. If an attacker can choose the input to be sorted, he can easily construct a set that takes the worst case time complexity of o(n^2). Mergesort's average case complexit...
Quicksort has a better average case complexity but in some applications it is the wrong choice. Quicksort is vulnerable to denial of service attacks. If an attacker can choose the input to be sorted, he can easily construct a set that takes the worst case time complexity of o(n^2). Mergesort's average case complexit...
Use of composition instead of inheritance tends to be the way around this. This actually also helps a lot with testability, so it's good practice in general. If you just want your type to "behave" like several other types, you can inherit from as many interfaces as you like, though; you can't "borrow" implementatio...
How do I compare phrases for similarity?
ya, I think you're heading down the right path with MapForce. If you don't want to write code to preform the actual transformation, MapForce can do that for you also. THis may be better long term b/c it's less code to maintain. Steer clear of more expensive options (e.g. BizTalk) unless you really need to B2B integ...
Have you considered using an EXE maker? For example, you can code in Python and use [py2exe](http://www.py2exe.org) to create a standalone EXE that runs anywhere (it actually packages Python into the exe, so you don't have to install the runtime).
Have you tried [wget?][1] [1]: http://linuxreviews.org/quicktips/wget/
> Sharepoint: Best way to display lists > of non-Sharepoint content with > “compatible” UI? Take a look at the built in sharepoint web controls: [Microsoft.SharePoint.WebControls Namespace][1] It contains all the controls used in sharepoint. I'd tell you more, but the documentation is very thorough. ...
A scripting language is, almost by definition, not compiled into a standalone executable. So maybe you need to restate your intentions or give some indication about what kind of program you want to create. C# is a powerful language that compiles to .EXE and allows you to interface with pretty much anything (through ...
What database are you using? Oracle has some nice XML mapping tools. There are some Java binding tools (one is http://java.sun.com/developer/technicalArticles/WebServices/jaxb). However, if you have the luxory consider using Ruby which has nice built-in "to_xml" methods.
I see Hungarian Notation as a way to circumvent the capacity of our short term memories. According to psychologists, we can store approximately **[7 plus-or-minus 2 chunks][1]** of information. The extra information added by including a prefix helps us by providing more details about the meaning of an identifier even w...
[Deviation][1] may be what you're after. Deviation is the distance between a data point and the mean. [1]: http://en.wikipedia.org/wiki/Deviation_(statistics)
The following function should do the trick: Function SetLandscape() Application.Printer.Orientation = acPRORLandscape End Function Should be able to call this from the autoexec function to ensure it always runs.
I suggest learning database design and a query language such as SQL. You can start with a desktop tool like Microsoft Access or use the free SQL Server Express or Postgre or MySQL.
AFAIK C# has no built-in support for handling PDF so what you are asking can not be done without using a 3rd party component or a COTS library. Regarding libraries there is a myriad of possibilities. Just to point a few: http://csharp-source.net/open-source/pdf-libraries http://www.codeproject.com/KB/graphics/...
Press CTRL+SHIFT+V twice.
Formats will defintely change, as vendors will add features to their components. Serialization simply loops over all published properties and saves them to a stream. When they are read back, each of the properties that is read from the stream will be set back to the component. If the property does not exist anymore, yo...
I have used both SVN and TFS. Main advantage of using TFS is its tight integration with Visual Studio. Bug Tracking, Task Tracking will all go in one place. And the reports generated for these items will help the stake holders keep informed of the project status.
I tend to prefer Spring over EJB3 but my recommendation would be whichever approach you take, try to stick to writing POJOs and use the standard annotations where possible, like the JSR annotations such as @PostConstruct, @PreDestroy and @Resource which work with both EJB3 or Spring so you can pick whichever framework ...
*Google Maps Hacks* has a hack, ["Hack 69. Cluster Markers at High Zoom Levels"][1], on that. Also, see [Wikipedia on clustering algorithms][2]. [1]: http://safari.oreilly.com/0596101619/googlemapshks-CHP-7-SECT-9 [2]: http://en.wikipedia.org/wiki/Data_clustering
Here is a variation and correction to TK's solution which might be clearer than the solutions by sundar. It takes single bits from t and pushes them into return_val: typedef unsigned long TYPE; #define TYPE_BITS sizeof(TYPE)*8 TYPE reverser(TYPE t) { unsigned int i; TYPE retur...
It's not copying an empty block, it's copying the blank line. You can change this setting in Tools > Options > Text Editor > All Languages > 'Apply Cut or Copy Commands to blank lines when there is no selection'
|algorithm|full-text-search|
When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this myself. Now I'm curious to know what sort of ...
If it's an old CRT iMac then you can't switch off the screen without switching the computer off - the convection from the CRT is used to cool the processor!
It's not like you absolutly can't get around privateness of members in any language (pointer arithmetics in C++, Reflections in .NET/Java). The point is that you get an error if you try to call the private method by accident. But if you want to shoot yourself in the foot, go ahead and do it. Edit: You don't try t...
No, we can't. Read Joel's excellent article [The Laws of Leaky Abstraction](http://www.joelonsoftware.com/articles/LeakyAbstractions.html), it is an eye-opener for many people. However, this isn't necessarily a *bad* thing, it just is. Leaky abstractions offer great opportunity because they make the underlying platform...
alias vi nedit :)
alias vi nedit :) all humor aside.. for vi WHEN NOT using nedit.. - i (switch to insert mode) - a (append - = move to end of line and switch to insert mode) esc (exit insert mode) - dd delete a line - x delete a character - :wq (save and quit) - / start a search - n find Next ...
alias vi nedit :) all humor aside.. for vi WHEN NOT using nedit.. - `i` (switch to insert mode) - `a` (append - `=` move to end of line and switch to insert mode) esc (exit insert mode) - `dd` delete a line - `x` delete a character - `:wq` (save and quit) - `/` start a search - ...
One way of going about doing this would be to use NSTask in conjuction with the 'screencapture' command line command. For example: NSTask *theProcess; theProcess = [[NSTask alloc] init]; [theProcess setLaunchPath:@"/usr/sbin/screencapture"]; // use arguments to set save location [the...
Deleting a file in VBA
|vba|
Using VBA, how can I (a) test whether a file exists, and if so, (b) delete it?
I'm a little rusty on c, but try using a void* pointer as the variable type in the function parameter. Then pass the address of the structure to the function, and then use it he way that you would. void foo(void* obj); void main() { struct bla obj; ... foo(&obj); ... ...
Writing complicated regular expressions for such jobs is a bad idea IMO. It's better to combine several simple queries. For example, first search for "\r\n\r\n" to find the start of the body, then run the simple regex over the body.
I'm not sure of the syntax of C# regular expressions but you should have a way to anchor to the beginning of the string (not the beginning of the line such as ^). I'll call that "\A" in my example: \A.*?\r?\n\r?\n.*?^From:\s*([^\r\n]+)$ Make sure you turn the multiline matching option on, however that works, ...
I'm sorry Ben Collins lost his sliding windows mmap source code. That'd be nice to have in Boost. Yes, mapping the file is much faster. You're essentially using the the OS virtual memory subsystem to associate memory-to-disk and vice versa. Think about it this way: if the OS kernel developers could make it faster th...
[This MSDN Blog article][1] Has quite a good review of using burndowns in combination with Cumulative Flow Diagrams which fleshes out the diagrams even more. In the resources links at the bottom of the article there is a [link to the Microsoft Scrum kit][2] which has a pre-built excel file. [1]: http://blogs.msd...
Yes, you can do a baseless merge, but only from the command line (tf.exe).
This behavior is caused by the different interpretations of the box model. The correct box model states that the width applies only to the content and padding and margin add on to it. So therefore your are getting 100% plus a 20px right and left padding equaling 100%+40px as the total width. The original IE box mode...
The brackets can be used when column names are reserved words. If you are programatically generating the SQL statement from a collection of column names you don't control, then you can avoid problems by always using the brackets.
Column names can contain characters and reserved words that will confuse the query execution engine, so placing brackets around them at all times prevents this from happening. Easier than checking for an issue and then dealing with it, I guess.
You can also define search groups with ld: ld -r foo.o -( a.a b.a c.a -) Will iterate through a.a, b.a, and c.a until no new unresolved symbols can be satisfied by any object in the group. If you're using gnu ld, you can also do: ld -r -o foo.o --whole-archive bar.a Which is slightly stronger, in...
I believe it adds them there for consistency... they're only required when you have a space or special character in the column name, but it's cleaner to just include them all the time when the IDE generates SQL.
On Windows, use the [SystemParametersInfo][1] function. It's a Swiss army-style function that lets you get/set all sorts of system settings. To disable the screen shutting off, for instance: SystemParametersInfo( SPI_SETPOWEROFFACTIVE, 0, NULL, 0 ); Just be sure to set it back when you're done... [...
TFS will allow you to merge with a branch that is not a parent/child - these are called baseless merges. See these links: [From MSDN][1] [From the TFS Team via CodePlex][2] We typically do major or destabilizing changes on a development branch. If close to a major release of one of our products nearly all chan...
I agree with Harpeet that you may want to revisit how you you have setup you branching structure. However you if you really want to perform this type of merge you can through something called a baseless merge. It runs from the tfs command prompt, Tf merge /baseless <<source path>> <<target path>> /recursi...
alias vi nedit :) all humor aside.. for vi WHEN NOT using nedit.. - `i` (switch to insert mode) - `a` (append = move to end of line and switch to insert mode) - `esc` (exit insert mode) - `dd` delete a line - `x` delete a character - `:wq` (save and quit) - `/` start a search -...
Use `interface`s. You can implement as many as you'd like. You can usually use some variant on the [Composite Pattern (GoF)](http://c2.com/cgi/wiki?CompositePattern) to be able to reuse implementation code if that's desirable.
I believe that the fundamental reason that Java doesn't support multiple inheritance is the same as C#; all objects are ultimately derived from Object and it's having multiple paths to the same base class is ambiguous for the compiler. Ambiguous == Bad, so the compiler doesn't allow it. Instead, you can simulate mul...
I'd say Python - it has a very high readability, it is simple( no curly brackets, key words as close to english as possible etc.) and you can do almost everything in it, from simple to very complex things. It is also popular and fun to code.
If you are on a Windows environment then there is probably little you can do as Rails seems to startup really slowly under Windows. I had the same experience on Windows and had to move my setup to a Linux VM to make it really zippy (I was also using autotest).
I think the best is CMS Made Simple. Seems like drupal takes awhile to customize. http://www.cmsmadesimple.org/
This may sound a little odd, I had been using bash for over 10 years. I have started using PHP5 and it was difficult at first, but now I have a much better reusable code base. I wouldn't recommend it as a starting point though!
I don't have a simple answer for your question regarding Class::MethodMaker performance. As a previous answer mentioned, you can use the debugger to find out what's going on under the hood. However, I know that Class::MethodMaker generates *huge* amounts of code at install time. This would indicate three separate thing...
report generation on php?
|php|reporting|
one of the most frequent requests i get is to create XY report for YZ App. This apps are normally built on php, so far i have manually created most of this reports, and while I enjoy the freedom of building it like i want, it usually becomes pretty tedious to calculate subtotals,averages, exporting to different formats...
one of the most frequent requests i get is to create XY report for YZ App. This apps are normally built on php, so far i have manually created most of this reports, and while I enjoy the freedom of building it like i want, it usually becomes pretty tedious to calculate subtotals,averages, exporting to different formats...
one of the most frequent requests i get is to create XY report for YZ App. This apps are normally built on php, so far i have manually created most of this reports, and while I enjoy the freedom of building it like i want, it usually becomes pretty tedious to calculate subtotals,averages, exporting to different formats...
Actually the Android API is much more powerful than the J2ME. It is much easy to create an application for the Android. Using the J2ME you are limited to simple forms due to the absent of swing-like libraries (though now there exists a library called LWUIT, avoiding the need to recreate from scratch a swing-like ...
[Teleport Pro][1] is great for this sort of thing. You can point it at complete websites and it will download a copy locally maintaining directory structure, and replacing absolute links with relative ones as necessary. You can also specify whether you want content from other third-party websites linked to from the ori...
See [Website Mirroring With wget][1] wget --mirror –w 2 –p --HTML-extension –-convert-links http://www.yourdomain.com [1]: http://www.devarticles.com/c/a/Web-Services/Website-Mirroring-With-wget/1/
You basically can loop over a Range Get a sheet myWs = (Worksheet)MyWb.Worksheets[1]; Get the Range you're interested in If you really want to check every cell use Excel's limits > The Excel 2007 "Big Grid" increases > the maximum number of rows per > worksheet from 65,536 to over 1 > million, and t...
This class does the trick. You can add new prefixes to the **_prefixes** static string array. public static class StringExtensions { public static string ToProperCase( this string original ) { if( String.IsNullOrEmpty( original ) ) return orig...
you can consider something like that: 1. define a style for textblock, or any other control you want to use to display your enum: <Style x:Key="enumStyle" TargetType="{x:Type TextBlock}"> <Setter Property="Text" Value="&lt;NULL&gt;"/> <Style.Triggers> ...
I have never tried this in 2005. But a company I used to work for tried this on 7.0 and it failed miserably. With 2000 things got a lot better but querying across databases was still painfully slow and took too many system resources. I can only imagine things improved again in 2005. Are you querying across the da...
I think ADO.Net Data Services (formerly called Astoria) has a huge role to play. It fits nicely with the REST style architecture of the web. Since web is scalable, I guess anything which follows its architecure is scalable too.. Also, you might want to keep a lookout for SQL Server Data Services..
In VB its normally Dir to find the directoy of the file. If its not blank then it exists and then use Kill to get rid of the file. test = Dir(filename) If not test="" then Kill(Filename) end if
Use whatever works for you. These are all easiest to set up if you already have a fairly normalized database (ie, good definition of primary keys and foreign keys). However, if you've got data that doesn't easily normalize, the Entity Framework is more flexible than LINQ to SQL, but it does take more work to configure.
Perhaps try setting `tcp.NoDelay = true`
The following can be used to test for the existence of a file, and then to delete it. Dim aFile As String aFile = "c:\file_to_delete.txt" If Len(Dir$(aFile)) > 0 Then Kill aFile End If
You can set a reference to the Scripting.Runtime library and then use the FileSystemObject. It has a DeleteFile method and a FileExists method. See the MSDN article [here][1]. [1]: http://msdn.microsoft.com/en-us/library/aa164509(office.10).aspx
This is using a look-behind assertion. Group 1 will give you the "From" line, and group 2 will give you the actual value ("Alex", in your example). (?<=\n\n).*(From:\s*(.*?))$
I believe web services is actually more complicated and more restrictive. You cannot create stateful web services, data exchange is fairly slow due to verboseness of XML. Developing with WebORB is not that hard. It basically boils down to developing an assembly and deploying it into the /bin folder of a weborb-enabled ...
They're handy if your columns have the same names as SQL keywords, or have spaces in them. Example: create table test ( id int, user varchar(20) ) Oh no! Incorrect syntax near the keyword 'user'. But this: create table test ( id int, [user] varchar(20) ) Works fine.
tf.exe merge /recursive /baseless $/TeamProject/SourceBranch $/TeamProject/TargetBranch
tf.exe merge /recursive /baseless $/TeamProject/SourceBranch $/TeamProject/TargetBranch * MSDN: [How To: Perform a Baseless Merge in Visual Studio Team Foundation Server](http://msdn.microsoft.com/en-us/library/bb668976.aspx)
Heh, I was just about to come back with essentially the same answer (using Cake's Model::find): $this->loadModel('Comment'); $this->Comment->find( 'all', array( 'fields' => array('Comment.*, COUNT(Comment.id) AS popularCount'), 'conditions' => array( 'Comment.created >' => s...
Heh, I was just about to come back with essentially the same answer (using Cake's Model::find): $this->loadModel('Comment'); $this->Comment->find( 'all', array( 'fields' => array('COUNT(Comment.id) AS popularCount'), 'conditions' => array( 'Comment.created >' => strtotime('-...
They are useful if you are (for some reason) using column names with certain characters for example. Select First Name From People would not work, but putting square brackets around the column name would work Select [First Name] From People In short, it's a way of explicitly declaring a object name;...
I'd just do a function (or download a freebie app) that moves the mouse around. Inelegant, but easy.
Allowing methods and constructors in enums surprised me. For example: enum Cats { FELIX(2), SHEEBA(3), RUFUS(7); private int mAge; Cats(int age) { mAge = age; } public int getAge() { return mAge; } } You can even have a "constant specific...
What factors could cause the following SqlException: A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 1 - I/O Error detected in read/write operation)
Separately, I'd mention [The Third Manifesto][1] by Hugh Darwen and CJ Date. If you're interested in understanding *data* (which seems uncommon among programmers) this book is a must-read. It will also make you sad when you realize just how badly broken SQL is, but it'll also help you cope with that brokenness. Knowing...
Personally, I agree with the kDevelop crowd as well. Eclipse felt a bit bulky and mildly unstable. Something about kDeveloper just always feel right.
Ruby is my scripting language of choice. Try [RubyScript2Exe](http://www.erikveen.dds.nl/rubyscript2exe/).
<code>wget -r</code> does what you want, and if not, there are plenty of flags to configure it. See <code>man wget</code>. Another option is <code>curl</code>, which is even more powerful. See <http://curl.haxx.se/>.
React on global hotkey in a Java program on Windows/Linux/Mac?
|java|windows|linux|macos|hotkeys|
A Java6 application sits in the system tray. It needs to be activated using a hotkey (e.g. Super-G or Ctrl-Shift-L etc) and do something (e.g. showing an input box). How do I do that on: - - Windows (XP or Vista) - OS/X - Linux (Gnome or KDE)
A good reference on a development process that keeps trunk stable and does all work in branches is Divmod's [Ultimate Quality Development System][1]. A quick summary: - All work done must have a ticket associated with it - A new branch is created for each ticket where the work for that ticket is done - Chan...
Perhaps it is indirect to gdb (because it's an IDE), but my recommendations would be [KDevelop][1]. Being quite spoiled with Visual Studio's debugger (professionally at work for many years), I've so far felt the most comfortable debugging in KDevelop (as hobby at home, because I could not afford Visual Studio for pers...