instruction
stringlengths
0
30k
I'm going to answer my own question. To treat Dictionaries as sets, the simplest method seems to be to apply set operations to dict.Keys, then convert back to Dictionaries with Enumerable.ToDictionary(...).
How to list directory content of remote FTP, recursively
|ftp|
After downloading files from a remote UNIX FTP server, you want to verify that you have downloaded all the files correctly. Minimal you will get information similar to "dir /s" command in Windows command prompt. The FTP client runs on Windows.
I am setting up a project using Hibernate 3.3.1 GA and PostgreSQL 8.3. I've just created a database, the first table, added one row there and now configuring Hibernate. However, even the simplest query: Criteria criteria = session.createCriteria(Place.class); List result = criteria.list(); could not b...
I think the easiest way is to get a free SVN server through some free provider. I use [assembla](http://www.assembla.com/). Then, if you are in Windows, you should download [TortoiseSVN](http://tortoisesvn.tigris.org/). That is by far the easiest Subversion client to use. Start by importing a current project in...
What I would do is open up cursors on the following queries: SELECT * from table1 order by id SELECT * from table1 r, table2 t where t.table1_id = r.id order by r.id SELECT * from table1 r, table3 t where t.table1_id = r.id order by r.id And then I would walk those cursors in parallel, printing your...
IIS ASP Caching
|iis|asp|caching|
I'm trying to configure ASP caching in IIS, following the instructions of a software I purchased. This is supposed to make it run faster. http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/a5766228-828e-4e31-a92b-51da7d24d569.mspx?mfr=true The software instructions point to that article. ...
IE8 beta 2 has a nice debugger
I found that with the follwing definition of map-traversing, you don't need to unquote the functions: <pre>(define (map-traversing func data) (if (list? func) (map map-traversing func data) (apply (eval func (interaction-environment)) (list data))))</pre> Note: in my installed version of Guile, due...
I found that with the follwing definition of map-traversing, you don't need to unquote the functions: <pre>(define (map-traversing func data) (if (list? func) (map map-traversing func data) (apply (eval func (interaction-environment)) (list data))))</pre> Note: in my installed version of Guile, due...
I reccomend SVN to start off with, bit easier to get the hang of than some others. [Tortoise][1] is a good start. It's simple to install and integrates with the windows shell, meaning everything is fairly intuitive on Right-clicks on folders / files etc. Pretty good doc as well. You will also need a SVN server /...
I assume you simply check whether or not the name of the checkbox was posted to the server or not. Not being an ASP coder myself, I can't help, though this is how it would be done in PHP (of course, depending on how you map validations). <?php echo isset($_POST['checkbox_name']) ? 'checked' : 'not checked'; ?>
What might be going wrong is the selection is being changed inside the selection change message handler which result in another selection change message. One way to get around this *unwanted feedback loop* is to add a sentinel to the select change message handler as shown below: void onSelectChangeHandler(HWN...
What might be going wrong is the selection is being changed inside the selection change message handler, which result in another selection change message. One way to get around this *unwanted feedback loop* is to add a sentinel to the select change message handler as shown below: void onSelectChangeHandler(HW...
I use Jython for *interactive* testing of Java code. This is often much faster than writing Java test applications or even any scripting language. I can just play with the methods and see how it reacts. From there I can learn enough to go and write some real code or test cases.
Loads! JQuery, Prototype, ExtJS, Dojo, Mootools, YUI, Mochikit, the list goes on! JQuery is very popular, and an excellent choice, however some frameworks are better for some things, and others better for others. If you could give us a better idea of what you want to do, or how you will be using it (or even which...
And let's not forget about `<<` for example: string = "test" string << "ing" is the same as calling: string.<<("ing")
You could always start vim in a shell buffer and resize it so it filled the whole frame?
MIPS Assembly Pointer to a Pointer?
|assembly|pointers|
I think I know how to handle this case, but I just want to make sure I have it right. Say you have the following C code: int myInt = 3; int* myPointer = &myInt; int** mySecondPointer = myPointer; P contains an address that points to a place in memory which has another address. I'd like to modify the...
In most scripting langage (it's also true in Bash for instance), simple quotes are used to represent things as they are written, whereas double quotes are "analysed" (i don't think it's the appropriate word but i can't find better). $str = 'foo'; echo '$str'; // print “$str” to the screen echo "$str"; ...
There is a simple tool in TortoiseSVN named **SubWCRev.exe**. It takes revision from *path* and create file from your own template. You can use it as prebuild command.
- `ctrl+shift+K` deletes current line - `ctrl+shift+J` merges current line with the next line
The sample below shows how I do it - SavePreferences is called when closing the form and saves the form's size, and a flag indicating if it's maximized (in this version I don't save if it's minimized - it will come back up restored or maximized next time). - LoadPreferences is called from OnLoad. - First save ...
You can add and remove a special CSS class and modify the input value onfocus/onblur with JS: <input type="text" class="hint" value="Search..." onfocus="if (this.className=='hint') { this.className = ''; this.value = ''; }" onblur="if (this.value == '') { this.className = 'hint'; this.value = ...
MySQL Administrator Backups: "Compatibility Mode", What Exactly is this doing?
|mysql|backup|
In Mysql Administrator, when doing backups, what exactly is "Compatibility Mode"? I'm trying to bridge backups generated by [webmin][1] with the upload tool available inside [mysql administrator][2]. My data already has a couple of inconsistencies (ticks, commas, etc, I think) I just wont try to kink out (they migh...
In Mysql Administrator, when doing backups, what exactly is "Compatibility Mode"? I'm trying to bridge backups generated by [webmin][1] with the upload tool available inside [mysql administrator][2]. My data already has a couple of inconsistencies (ticks, commas, etc, I think) I just wont try to kink out (they migh...
In solutions with multiple projects, one thing I've found very helpful is to have all the AssemblyInfo files point to a single project that governs the versioning. So my AssemblyInfos have a line: [assembly: AssemblyVersion(Foo.StaticVersion.Bar)] I have a project with a single file that declares the string: ...
find_if appears to be the right choice here. The predicate isn't stateful in this situation.
[SyncToy is][1] also good at this stuff. [1]: http://www.microsoft.com/downloads/details.aspx?FamilyID=c26efa36-98e0-4ee9-a7c5-98d0592d8c52&DisplayLang=en
Is this web app set below any other apps in a website's directory tree? Check any parent web.config files for other settings, if any. Also, make your your directory is set as an application directory in IIS.
what is the difference between OLE DB and ODBC data sources?
|odbc|oledb|
I was reading a MS Excel help article about pivotcache and wonder what they mean by *OLE DB and ODBC sources* > ...You should use the CommandText > property instead of the SQL property, > which now exists primarily for > compatibility with earlier versions of > Microsoft Excel. If you use both > properties, the...
Of the options provided, I'd go with if (x) { print "x is true"; } simply by virtue of the braces being habit to type. Realistically, though, as a mostly-Perl programmer, I'm more likely to use print "x is true" if x; (Which always trips me up when I'm working in a language which ...
Throw away everything from the proof of concept except for the lessons learned, and, possibly, some minor code fragments such as calculations etc. Proof of concept applications should never be more than just the bare minimum to see if the technology in question will work and to start testing some of the boundary con...
Agreed with all the points above about the differences between JSPs and Servlets, but here are a couple additional considerations. You write: > I have an application that sends the > customer to another site to handle the > payments. The other site, outside of > the customer, calls a page on our > server to let ...
Since getFullYear doesn't work in older browsers, you can use something like this: Date.prototype.getRealYear = function() { if(this.getFullYear) return this.getFullYear(); else return this.getYear() + 1900; }; Javascript prototype can be used to extend...
mod_gzip compressed content on the fly as well. You can pre-compress the files by actually logging into your server, and doing it from shell. cd /var/www/.../data/ for file in *; do gzip $file; done;
mod_gzip compressed content on the fly as well. You can pre-compress the files by actually logging into your server, and doing it from shell. cd /var/www/.../data/ for file in *; do gzip -c $file > $file.gz; done;
I'm fairly surprised at how unanimous the sentiment is that getters and setters are fine and good. I suggest the incendiary article by Allen Holub "<a href="http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html">Getters And Setters Are Evil</a>". Granted, the title is for shock value, but the author makes ...
If you have ssh access, use rsync instead. It is a far better data transfer app. Grab fuse for your OS and load ftpfs. This will let you mount the remote ftp directory locally and you can use dir /s or any other application you want on it.
If you want VIM functionality, it makes more sense to just install VIM!
[Jinja2][1] syntax is pretty much the same as Django's and you get a much more robust template engine, witch compiles your template to bytecode (FAST!). I use it for templating, including in Django itself, and it is very good. You can also easily write extensions if some feature you want is missing. [1]: http...
I guess I'll repost my answer here. See also [your previous post][1]. If you're using gcc, or any compiler that uses glibc, you can use the backtrace() functions in execinfo.h to print a stacktrace and exit gracefully when you get a segmentation fault. Documentation is here: [http://www.gnu.org/software/libc/ma...
For Linux and I believe Mac OS X, if you're using gcc, or any compiler that uses glibc, you can use the backtrace() functions in execinfo.h to print a stacktrace and exit gracefully when you get a segmentation fault. Documentation is here: [http://www.gnu.org/software/libc/manual/html_node/Backtraces.html][2] He...
In my opinion if you already have Viual Source Safe and you are a single developer doing work with VS, it is perfectly fine. Its a simple system that works well enough for small single developer projects. I have used it for years without any trouble for small projects. Easy to manage and backup as well.
Enumerating Certificate Fields in C#
|c#|security|cryptography|certificate|
How do you enumerate the fields of a certificate help in a store. Specifically, I am trying to enumerate the fields of personal certificates issued to the logged on user.
Where can I find Microsoft assemblies that are not already in Visual Studio?
|.net|visual-studio|assembly|gac|adfs|
I figured someone can answer the question generally but if anyone wants to get specific I am trying to use: using System.Web.Security.SingleSignOn; using System.Web.Security.SingleSignOn.Authorization; I've googled my brains out and this is the closest answer I found: "We discussed this offline, but it looks ...
How do I set an Application's Icon Globally in Swing?
|java|swing|
I know I can specify one for each form, or for the root form and then it'll cascade through to all of the children forms, but I'd like to have a way of overriding the default Java Coffee Cup for all forms even those I might forget. Any suggestions?
Take a look at Venkman, the JavaScript debugger for Firefox: <http://www.mozilla.org/projects/venkman/> It's a real source-level javascript debugger where you can set breakpoints and step through code.
Best way to prevent duplicate use of credit cards
|hash|cryptography|credit-card|
We have a system where we want to prevent the same credit card number being registered for two different accounts. As we don't store the credit card number internally - just the last four digits and expiration date - we cannot simply compare credit card numbers and expiration dates. Our current idea is to store a ha...
I use [rsync][1] for some jobs, and [unison][2] for others. For your situation, I would strongly recommend using some version control solution such as [Subversion][3]. As for NIH? While I have written a large number of tools over the years, I **always** look for an existing tool before writing my own. It save...
Maybe I misunderstand, but the ArrayList will maintain its elements in the same order by which you added them. This means you can compare the two ArrayLists within one pass only - just increment the two scanning indices according to the comparison results.
One question I have is have you considered "out-sourcing" your comparison. There are plenty of good diff tools that you could just call out to. I'd be surprised if there wasn't one that let you specify two files and get only the differences. Just a thought.
From my search, I have not found any good multi-thread debuggers for *nix. GDB seems to be getting better, and the last time I had to debug a multi-threaded application on FreeBSD (7.0-RELEASE) it behaved fairly well, letting me find where the error was.
I once looked for a gdb alternative, but unfortunately every one I found was based on gdb. I think this is because gdb is intricately tied to gcc, and it's hard for third-party debuggers to keep up with every gcc change.
If you really want inheritance, don't forget that you can [implement the enum pattern yourself][1], like in the bad old Java 1.4 days. [1]: http://snipplr.com/view/1655/typesafe-enum-pattern
There might be an icon down in the tray, or it will prompt you during logon. I don't recall how long it will take to prompt you, or if it takes any time at all. Try rebooting and logging on.
fwrite() takes strings. Try chr(0x63) if you want to write a 0x63 byte to the file.
Is there an integrated Eclipse plugin to debug Jython?
|debugging|eclipse-plugin|jython|
[JyDT](http://www.redrobinsoftware.net/jydt/) is a good Jython Eclipse plugin. However, it doesn't allow Jython debugging in the Debug perspective. Jython provides a command-line debugger (Pdb) but it operates outside Eclipse.
System.Collections.Specialized.StringCollection allows you to add a range of values and, using the .IndexOf(string) method, allows you to retrieve the index of that item. That being said, you could likely just load up a couple of byte[] from a filestream and do byte comparison... don't even worry about loading that ...
Couple different perspectives from my experience. In the Oracle world, everything was managed by "create" DDL scripts. As ahockley mentioned, one script for each object. If the object needs to change, its DDL script is modified. There's one wrapper script that invokes all the object scripts so that you can deploy t...
[Jinja2][1] [syntax][2] is pretty much the same as Django's with very few differences, and you get a much more powerfull template engine, which also compiles your template to bytecode (FAST!). I use it for templating, including in Django itself, and it is very good. You can also easily write extensions if some featu...
According to this document, it looks like Load. [http://msdn.microsoft.com/en-us/library/ms366536.aspx][1] [1]: http://msdn.microsoft.com/en-us/library/ms366536.aspx
An excellent resource is Jeff Atwood's post on javascript libraries: http://www.codinghorror.com/blog/archives/001163.html He lists: 1. Prototype (http://www.prototypejs.org/) and Script.aculo.us (http://en.wikipedia.org/wiki/Script.aculo.us) 2. JQuery (http://en.wikipedia.org/wiki/JQuery) 3. Yahoo UI ...
What is the best way to handle sessions for a PHP site on multiple hosts?
|php|session|load-balancing|
PHP stores its session information on the file system of the host of the server establishing that session. In a multiple-host PHP environment, where load is unintelligently distributed amongst each host, PHP session variables are not available to each request (unless by chance the request is assigned to the same host ...
|php|mysql|session|load-balancing|memcached|
PHP stores its session information on the file system of the host of the server establishing that session. In a multiple-host PHP environment, where load is unintelligently distributed amongst each host, PHP session variables are not available to each request (unless by chance the request is assigned to the same host ...
I use SVN to check in changes to Asterisk VOIP Server config files. I have one repository with a folder corresponding to each of several servers. That folder contains the entire contents of /etc/asterisk.
PostQuitMessage([exit code]); MSN
Mixed C++/CLI TypeLoadException Internal limitation: too many fields.
|c++|compiler-construction|clr|
On a quest to migrate some new UI into Managed/C# land, I have recently turned on Common Language Runtime Support (/clr) on a large legacy project, which uses MFC in a Shared DLL and relies on about a dozen other projects within our overall solution. This project is the core of our application, and would drive any mana...
How do you convert the number you get from datepart to the name of the day?
|mssql|
Is there a quick one-liner to call datepart in Sql Server and get back the name of the day instead of just the number? select datepart(dw, getdate()); This will return 1-7, with Sunday being 1. I would like 'Sunday' instead of 1.
|sql-server|
Why do Sql Server 2005 maintenance plans use the wrong database for dbcc checkdb?
|mssql|
This is a problem I have seen other people besides myself having, and I haven't found a good explanation. Let's say you have a maintenance plan with a task to check the database, something like this: USE [MyDb] GO DBCC CHECKDB with no_infomsgs, all_errormsgs If you go look in your logs after the ...
Regular Expression to exclude set of Keywords