instruction
stringlengths
0
30k
I'm trying to figure out what a Java applet's Class file is doing under the hood. Opening it up w/ Notepad or Textpad just shows a bunch of gobbley-gook. Any way to wrangle it back into a somewhat readable format so's I can try to figure out what it's doing? * Environment == Windows w/ VS 2008 installed.
You need to escape the backslashes within the mapping. You can also include the substitution string within the mapping. :nmap <leader>w :s/\\(<c-r>=expand("<cword>")<cr>\\)/\\1\\1<cr>
"const" is a keyword, but you can't use it. int const = 1; // "not a statement" const int i = 1; // "illegal start of expression" I guess the compiler writers thought it might be used in the future and they'd better keep it reserved.
I would highly recommend both [Chicken][1] and [Gauche][2] for scheme. [1]: http://www.call-with-current-continuation.org/ [2]: http://practical-scheme.net/gauche/
<a href="http://developer.yahoo.com/yui/">YUI</a> and <a href="http://www.extjs.com/">ExtJs</a> both have very nice looking and flexible calendars.
I don't like the MS ASP.NET ajax, but their datepicker is superb. Otherwise, jQuery datepicker.
Flash designer/coder collaboration best practices
|flash|actionscript|
I've done several flash projects working as the actionscripter with a designer doing all the pretty things and animation. When starting out i found quite a lot of information about actionscript coding and flash design. Most of the information available seems to focus on one or the other. I didn't find any informatio...
|flash|actionscript|
Here's a simple example of something cool you can do with lambdas: List<int> myList = new List<int>{ 1, 2, 3, 4, 5, 6, 7, 8, 9 }; myList.RemoveAll(x => x > 5); //myList now == {1,2,3,4,5} The RemoveAll method takes a predicate(a delegate that takes argurments and returns a bool), any that match it g...
If you ever end up considering a JavaScript library/toolkit, [Dijit][1], a widget system which layers on top of [Dojo][2], has a [calendar][3] (Dijit calendar test page). I found it relatively simple to implement. //Disclaimer: I'm in the middle of a love-hate relationship w/ Dojo at the moment, as I am in the proc...
Lambdas bring functional programing to C#. They are anonymous functions that can be passed as values to certain other functions. Used most in LINQ.
Lambdas bring functional programing to C#. They are anonymous functions that can be passed as values to certain other functions. Used most in LINQ. Here is a contrived example: List<int> myInts = GetAll(); IEnumerable<int> evenNumbers = myInts.Where(x => x % 2 == 0); Now when you foreach through...
Lambdas bring functional programing to C#. They are anonymous functions that can be passed as values to certain other functions. Used most in LINQ. Here is a contrived example: List<int> myInts = GetAll(); IEnumerable<int> evenNumbers = myInts.Where(x => x % 2 == 0); Now when you foreach through...
Was wondering if there was a way to put a wildcard in the schema.ini for example [*.txt] FMT=TabDelimited I've got an app that is imported tab delimited files and the only place I can seem to get the FMT="TabDelimited" is in the schema.ini (doesn't work in the connection string for some reason), but I will have no...
Have you tried using the ActiveX control test container? Is it in the list of controls? How about using the register button in the test container? Also check the registry to see if it is registered. You should have an entry in HKEY-CLASSES-ROOT\controlName that has a CLSID element that points to a UUID. That UUI...
How do I send an SMTP Message from Java?
|java|smtp|
How do I send an SMTP Message from Java?
I would pick Delphi. Of course you ask any pascalholic and he is sure to answer just the same. ;) Qt again is fine, but the VCL just feels more polished. But then that could be my years of working with it so it just feels right. My experience with Qt was limited to a short lived project that ended up being rewri...
If you are in a form or control you can use the DesignMode property: if (DesignMode) { DesignMode Only stuff }
Windows Forms components (and controls) have a [DesignMode][1] property. Windows Presentation Foundation controls should use the [IsInDesignMode][2] attached property. [1]: http://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx [2]: http://msdn.microsoft.com/en-us/library/sys...
I assume that's a response from an FTP server? Usually, a message from an FTP server really means it. If it says the directory is not empty, there might be certain files you cannot see that exists in the directory which maybe one of: * Your PHP/JSP/ASP/whatever scripts may run under a different user account thus ...
<div> <%=MyProperty"%></div>
How about <a href="http://pear.php.net/package/MDB2">MDB2</a> from pear? > It provides a common API for all > supported RDBMS. The main difference > to most other DB abstraction packages > is that MDB2 goes much further to > ensure portability. Btw: @GaryF what are those strange title attributes your links ha...
> If you reference any types that inherits from SuperException (even if the type defined in another assembly), you need a reference to the assembly that SuperException is defined in. Seconded on that. You might not be referencing `SuperException`, but you might be referencing `SpecializedSuperException`, which is...
So the problem is that the business layer needs to expose more functionality to the data layer, and adding this functionality means exposing too much to the UI layer? If I'm understanding your problem correctly, it sounds like you're trying to satisfy too much with a single interface, and that's just causing it to bec...
Ahh, one of the Perforce classics :) Yes, it really sucks that there is STILL no easy way for this built into the default commands. The easiest way is to run a command to find all files under your clients root, and then attempt to add them to the depot. You'll end up with a changelist of all new files and existing f...
On linux, or if you have gnu-tools installed on windows: find . -type f -print0 | xargs -0 p4 fstat >/dev/null This will show an error message for every unaccounted file. If you want to capture that output: find . -type f -print0 | xargs -0 p4 fstat >/dev/null 2>mylogfile
As previously mentioned, Amazon S3 is definitely an option, but it may be cheaper in the long run to own the hardware you are backing up to. For example: Buy a basic server and and eSATA RAID5 setup with 2-3 times the capacity you currently need, then install it at a co-location center. Preferably one with high, bu...
Bash. The various UNIX and Linux implementations have various different source level implementations of ksh, some of which are real ksh, some of which are pdksh implementations and some of which are just symlinks to some other shell that has a "ksh" personality. This can lead to weird differences in execution behav...
Not nearly enough information here. It depends if your language even supports the construct "Thing.something" or equivalent (ie. it's an OO language). If so, it's far more appropriate because that's the OO paradigm (members should be associated with the object they act on). In a procedural style, of course, DoSomething...
The basics: 0. Don't try to host high-volume sites on Windows unless you are a *true* Windows guru. It can be done, but it's a time versus cost issue. 1. Use static content (i.e., no database queries) everywhere you can. 2. Learn about cache-control headers and use them properly for images and other static assets....
To be object-oriented, tell, don't ask : <http://www.pragmaticprogrammer.com/articles/tell-dont-ask>. So, Thing.DoSomething() rather than DoSomethingToThing(Thing n).
How can I prevent Java from creating hsperfdata files?
|java|hsperfdata|
I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps creating /tmp/hsperfdata_username directories, which I would like to prevent. Is there any way to stop java from creating these files?
|java|
Just select all the text from syscomments and count how many lines you have. The text column is text, which you can't really see in Management studio, so I would write a program or power shell script like this: $conn = new-object System.Data.SqlClient.SqlConnection("Server=server;Database=database;Integrated Sec...
Honestly I searched a while and there no decent JVM for windows mobile. The best bet I think is this : http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html but it's JDK 1.3 compliant the last time I checked.
Great question! Whatever you do, **don't** give into the temptation to [dig into the registry][1] to find this info! Also, we must resist the temptation to hard code some path, even partially. If we get the special AppData path, then simply append a string onto the end, this may break under non-US installs of th...
I have done this using [TortoiseSVN][1]. The built in merge utility allows you to show a diff between the reposotory version and your working copy. You can then pick to commit a selection of the changes, then commit again for the rest of the changes. [1]: http://tortoisesvn.tigris.org/ "TortoiseSVN"
I have done this using [TortoiseSVN][1]. The built in merge utility allows you to show a diff between the reposotory version and your working copy. Use the 'create backup' function of the diff utility Step 1. Go to commit your file as if you were going to commit all your changes. Step 2. In the commit w...
Easy expanation of setting up Openssl on Windows.
|php|openssl|google-calendar-api|gdata-api|
I really want to get the google Calendar Api up an running. I found a [great article](http://www.ibm.com/developerworks/library/x-googleclndr/) about how to get started. I downloaded the Zend GData classes. I have php 5 running on my dev box and all the exetensions should be loading. I cant get openssl running and...
In order to achieve this you could implement a single sign-on solution. This solution would have one server be your master authentication server. This server would be responsible for authentication and creating a cookie for the user. When you redirect to the other server (on the same domain) check to see if the ...
First off, here's your question, nicely formatted (surround it in < pre > tags to get this): <pre>kt@rails-ubuntu:~/rails/ledger/releases/20080820144914/.git/hooks$ ls -al ls: cannot access post-commit: No such file or directory ls: cannot access update: No such file or directory ls: cannot access post-update: No...
First off, here's your question, nicely formatted (surround it in < pre > tags to get this): <pre>kt@rails-ubuntu:~/rails/ledger/releases/20080820144914/.git/hooks$ ls -al ls: cannot access post-commit: No such file or directory ls: cannot access update: No such file or directory ls: cannot access post-update: No...
Regex.Replace("The string", "[^a-zA-Z ]",""); That's how you'd do it in C#, although that regular expression ([^a-zA-Z ]) should work in most languages. [Edited: forgot the space in the regex]
Use [CheckRadioButton](http://msdn.microsoft.com/en-us/library/102xeb09%28VS.71%29.aspx) to set select one button in a group and [GetCheckedRadioButton](http://msdn.microsoft.com/en-us/library/h0tw863c%28VS.71%29.aspx) to retrieve the ID of the selected button.
Other ways include exceptions (throw new Validation_Exception_SQLDuplicate("There's someone else, hun");), returning structures (return new Result($status, $stuff); if ($result->status == 0) { $stuff = $result->data; } else { die('Oh hell'); }. I would hate to be the person who came after you for using the code pat...
I have it using ldap and mysql and if it helps you my setting from openfire.xml are: <connectionProvider> <className>org.jivesoftware.database.DefaultConnectionProvider</className> </connectionProvider> <database> <defaultProvider> <driver>com.mysql.jdbc.Driver</dri...
You could always use version control, like SVN, so all you have to do is have the server run svn up on a folder every night. This runs into security issues if you are sharing your files publicly, but it works. If you are using Linux though, learn to use rsync. It's really not that difficult as you can test every co...
@Eric, You really have to assess the true value of your data. If you lost it tomorrow what impact would it have on your business? We use offsite backups, it isn't cheap, but if we were to lose our data the business would cease to trade withing 2-3 days. We considered on-site backups as a possible cost saver but ...
That's not what map does. You really want [Array.filter][1]. Or if you really want to remove the elements from the original list, you're going to need to do it imperatively with a for loop. [1]: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:filter
You should use the `filter` method rather than map unless you want to mutate the items in the array, in addition to filtering. eg. var filteredItems = items.filter(function(item) { return ...some condition...; }); [Edit: Of course you could always do `sourceArray.filter(...).map(...)` to...
I'd like to support [Will Dean's answer](http://stackoverflow.com/questions/8263/i-cant-get-my-debugger-to-stop-breaking-on-first-chance-exceptions#8304) An access violation sounds like an actual bug in your code. It's not something I'd expect the underlying C/++ Runtime to be throwing and catching internally. Th...
I'd like to support [Will Dean's answer](http://stackoverflow.com/questions/8263/i-cant-get-my-debugger-to-stop-breaking-on-first-chance-exceptions#8304) An access violation sounds like an actual bug in your code. It's not something I'd expect the underlying C/++ Runtime to be throwing and catching internally. Th...
Just select all the text from syscomments and count how many lines you have. The text column is text, which you can't really see in Management studio, so I would write a program or power shell script like this: $conn = new-object System.Data.SqlClient.SqlConnection("Server=server;Database=database;Integrated Sec...
DoSomethingToThing(Thing n) would be more of a functional approach whereas Thing.DoSomething() would be more of an object oriented approach.
That is the Object Oriented versus Procedural Programming choice :) I think the well documented OO advantages apply to the Thing.DoSomething()
Of course there is always PInvoke out there too if you packaged your code as DLLs with external entrypoints. None of the options are pain free. They depend on either a) your skill at writing COM or Managed C wrappers b) chancing your arm at PInvoke.
<ul> <li style="color:#ddd;"><span style="color:#000;">List Item</span></li> </ul> <ul> <li style="color:#ddd;"><span style="color:#000;">List Item</span></li> </ul>
<ul> <li style="color:#ddd;"><span style="color:#000;">List Item</span></li> </ul>
Share and know memory ownership rules across your project. Using the COM rules makes for the best consistency ([in] parameters are owned by the caller, callee must copy; [out] params are owned by the caller, callee must make a copy if keeping a reference; etc.)
I'll add my two cents: **Stored procedures** - Can be easily optimized - Abstract fundamental business rules, enhancing data integrity - Provide a good security model (no need to grant read or write permissions to a front facing db user) - Shine when you have many application accessing the same data ...
[SHA-1 and the rest of its family](http://en.wikipedia.org/wiki/SHA-1) have many public-domain were patented by the US government which "has released the patent under a royalty free license". Many public-domain implemntations [may be found through Google](http://www.google.ca/search?q=sha+c+implementation). `:)`
[SHA-1 and the rest of its family](http://en.wikipedia.org/wiki/SHA-1) were patented by the US government which "has released the patent under a royalty free license". Many public-domain implementations [may be found through Google](http://www.google.ca/search?q=sha+c+implementation). `:-)`
Please, take a look to the [Yahoo! UI Library Autocomplete Component][1]. I think it is just what you're looking for. The section "Using DataSources" explains how to use different kind of data sources, including server side based ones like yours. [1]: http://developer.yahoo.com/yui/autocomplete/
edit your hosts file located at `%SystemRoot%\system32\drivers\etc\`
In addition to calling os._exit() to avoid the registered exit handler you also need to catch the unhandled exception: import atexit import os def helloworld(): print "Hello World!" atexit.register(helloworld) try: raise Exception("Good bye cruel world!...
You may want to check out [Processing.js][1]. John Resig of jQuery fame wrote it. It supports pixel processing, unfortunately only Firefox 3 can handle it sufficiently. [1]: http://ejohn.org/blog/processingjs/
@Greg - A clarification, this is a laptop pc with integrated tablet and stylus built in. the device has no dedicated keyboard (it is a virtual one on the touchscreen) and is not a wacom input device. Sorry for the confusion. It appears that there is an [SDK][1] for the Microsoft Windows XP Tablet PC Edition that may...
I think you should look at the C standard functions qsort() and bsearch() for inspiration. These are general purpose code to sort arrays and to search for data in a pre-sorted array. They work on any type of data structure - but you pass them a pointer to a helper function that does the comparisons. The helper funct...
I have used the [Boehm collector](http://www.hpl.hp.com/personal/Hans_Boehm/gc/) in the past with good success. It's open source and can be used in commercial software. It's a conservative collector, and has a long history of development by one of the foremost researchers in garbage collection technology.
There is the [NumericUpDown][1] control which is made specifically for the input of numbers and can be used like a TextBox. [1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.numericupdown.aspx
No, because you're not using cookies for authentication in that scenario, so ScaleOvenStove's link won't help. Basic authentication sends the login information in the HTTP headers with every request, but it's the browser that does this, when it sees a new server, new password request. (Or indeed as suggested chan...
Using [Jad][1] to decompile it is probably your best option. Unless the code has been obfuscated, it will produce an okay result. [1]: http://www.kpdus.com/jad.html
To avoid the need to manually sanitise/anonymise data, you could use random text replacement - to replace every alphanumeric character in each text field with a random alphanumeric. This: - keeps the data similar in length, size etc. from the developer's point of view - does not cause problems with character se...
That's compiled code, you'll need to use a decompiler like JAD: http://www.kpdus.com/jad.html
Take a look at Go. - Simple enough for kid on very small boards. - Complexity scales infinitely. - Has a lot of available papers, algorithms and programs to use either as a scale or basis. Update: reversi was mentioned, which is a simplified variant of Go. Might be a better choice.
This is not possible in a system that might use reflection. That said, a static analysis tool could do a pretty good job if you don't use ANY reflection.
One game you may consider is [Connect Four][1]. Simple game with straightforward rules but more complicated that Tic-Tac-Toe. [1]: http://en.wikipedia.org/wiki/Connect_Four
[Four in a line][1] Hard enough, but easy enough to come up with an easy working evaluation function, for example, (distance to four from my longest line - distance to four from my opponent's longest line) [1]: http://en.wikipedia.org/wiki/Connect_Four
<p>My view of the world may be different, as I'm based in the UK, but for the past 20-odd years, I've worked primarily in the public sector on systems handling sensitive data. The rules are **completely** cut-and-dried. No production data is allowed on the development estate.</p> <p>As a fundamental principle, we do ...
To see some cool stuff you can do with Annotations, check out my JavaBean annotations and annotation processor at http://code.google.com/p/javadude/wiki/Annotations They're great for generating code, adding extra validations during your build, and I've also been using them for an error message framework (not y...
Make a background Thread that calls toFront on the Dialog every 2 seconds. Code that we use (I hope I got everything): protected void toFrontTimer(JFrame frame) { try { bringToFrontTimer = new java.util.Timer(); bringToFrontTask = new BringToFrontTask(frame); bringT...
Make a background Thread that calls toFront on the Dialog every 2 seconds. Code that we use (I hope I got everything): class TestClass { protected void toFrontTimer(JFrame frame) { try { bringToFrontTimer = new java.util.Timer(); bringToFrontTask = new BringToFrontTask(fr...
It depends on how the user leaves the page. If there is a 'logoff' button in your GUI, you can trigger an ajax request when the user clicks on this button. Otherwise I do not think it is a good idea to make a request in the onUnload. As said earlier you would have to make a synchronous request... An alternative to t...
Weird event behavior in IE7
|javascript|events|internet-explorer|
I'm having trouble with events in **Internet Explorer 7** When I have a **form** with **TWO+ input[type=text]** and I press **Enter key** the events occurs in this order: 1. submit button, onClick 1. form, onSubmit Sample code: <FORM onSubmit="{alert('form::onSubmit'); return false;}"> <INPUT TYPE="t...
The `rsync` solutions are really good, especially if you're only pushing changes one way. Another great tool is `unison` -- it attempts to syncronize changes in both directions. Read more at [the Unison homepage][1]. [1]: http://www.cis.upenn.edu/~bcpierce/unison/ "Unison Home Page"
How do you retrieve selected text using Regex in C#?
|c#|regex|perl|
How do you retrieve selected text using Regex in C#? I am looking for c# code that is equivalent to this perl code: $indexVal = 0; if($string =~ /Index: (\d*)/){$indexVal = $1;}
int indexVal = 0; Regex re = new Regex(@"Index: (\d*)") Match m = re.Match(s) if(m.Success) indexVal = int.TryParse(m.Groups[1].toString()); I might have the group number wrong, but you should be able to figure it out from here.
You'll want to utilize the matched groups, so something like... Regex MagicRegex = new Regex(RegexExpressionString); Match RegexMatch; string CapturedResults; RegexMatch = MagicRegex.Match(SourceDataString); CapturedResults = RegexMatch.Groups[1].Value;