instruction
stringlengths
0
30k
Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I want to do what a SoapExtension can do if you provide a custom SoapExtensionAttribute... but to do it for every SOAP call without having to add the extension attribute to dozens of WebMethods. What I'm looking for is any extension point that lets ...
I'd do this with a macro as well, but only because executing code from within a replacement string for a regular expression is very unintuitive to me. If you're writing a batch script or something that needs to go very fast, \, is certainly the way to go.
Maybe just host the images on a web server and send a URL in the web service reply rather than the serialised image. This will also allow the client to cache the image locally when it can.
My favorite is '^string^string2' which takes the last command, replaces string1 with string2 and executes it $ ehco foo bar baz bash: ehco: command not found $ ^ehco^echo^ foo bar baz [Bash command line history guide][1] [1]: http://www.catonmat.net/blog/the-definitive-guide-to-bash-co...
What's the best way to represent a hierachy in a SQL database? A generic, portable technique? Let's assume the hierachy is mostly read, but isn't completely static. Let's say it's a family tree. Here's how not to do it: create table person ( person_id integer autoincrement primary key, name ...
What's the best way to represent a hierachy in a SQL database? A generic, portable technique? Let's assume the hierachy is mostly read, but isn't completely static. Let's say it's a family tree. Here's how not to do it: create table person ( person_id integer autoincrement primary key, name ...
Sounds like you need [Amazon SimpleDB][1]... It's not free, but pricing looks pretty good. I've not used it myself, but when I've got a bit of spare time I might use it for a project I'm working on. Maybe you've found an unserviced niche?! [1]: http://www.amazon.com/SimpleDB-AWS-Service-Pricing/b?ie=UTF8&n...
I found that learning a new language, always influences your programming style in languages you already know. For me it always made me think in different ways to solve a problem in my primary language, which is Java. I think in general, it just widens your horizon in term of programming.
Looking for best practice for doing a "Net Use" in C#
|c#|.net-1.1|
I'd rather not have to resort to calling the command line. I'm looking for code that can map/disconnect a drive, while also having exception handling. Any ideas?
Are you in place upgrading your current version or have you uninstalled VS 2008 Gold? By default, the installer won't let you change the directory if any existing versions of VS are installed. To move the installation, you will need to uninstall all editions of 2008 you have installed (including any Express Editions...
The [Visual Studio 2008 and .NET 3.5 Framework Service Pack 1][1] has gone out of beta, maybe you can see if this bug still occurs? [1]: http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx
You have to use two distinct groups of rewrite rules, one for .php, the other for .chm and make them mutually exclusives with RewriteCond %{REQUEST_FILENAME}. And make use of the flag [L] as suggested by jj33. You can keep your rules in .htaccess.
Copy any applicable preferences files in ~/Library/Preferences from a machine that you have checked "Don't show again" on.
VMWare Server Under Linux Secondary NIC connection
|linux|vmware|system-administration|nic|
With VMWare Server running under Linux (Debain), I would like to have the following setup: - 1st NIC being used by many of the images running under VMWare, as well as being used by the Linux OS - 2nd NIC being used by only 1 image and to be unused by the Linux OS (as its part of a DMZ) Although th...
Use P/Invoke" and <a href="http://msdn.microsoft.com/en-us/library/aa385413.aspx">WNetAddConnection2</a> There should also be some <a href="http://www.aejw.com/default.aspx?page=codeviewer&file=cNetworkDrive.cs&ret=dev/cnetworkdrive">wrappers</a> out there to do some of the grunt work for you. Google is your frie...
Use P/Invoke and <a href="http://msdn.microsoft.com/en-us/library/aa385413.aspx">WNetAddConnection2</a> There should also be some <a href="http://www.aejw.com/default.aspx?page=codeviewer&file=cNetworkDrive.cs&ret=dev/cnetworkdrive">wrappers</a> out there to do some of the grunt work for you. Google is your frien...
As @Brian R. Bondy pointed it depends on implementation of **g[0]["MyUntypedDateField"]**. Safe practice is to use **DateTime.TryParse** and **as** operator.
You can have a custom template for that node (node-needsjs.tpl.php) which calls the javascript. That's a little cleaner than using PHP right in the node body, and makes changes to content easier in the future. **EDIT:** I don't think I was very clear above. You want to name the template file node-(nodeid).tpl.php....
We use both Buildbot and Hudson for Jython development. Both are useful, but have different strengths and weaknesses. Buildbot's configuration is pure Python and quite simple once you get the hang of it (look at the epydoc-generated API docs for the most current info). Buildbot makes it easier to define non-testin...
Installing PDO-drivers for PostgreSQL on Mac (using Zend for eclipse)
|eclipse|macos|postgresql|zend|pdo|
How can I get PDO to work on my mac (os x 10.5)? I'm using the built in php and php in Zend/Eclipse. Can't seem to find useful drivers for it at all.
They both have pretty heinous warts, but I couldn't get Subversive to work with a project I had checked out from the command-line, and that was a show-stopper for me.
Note that you don't actually need to call GetCurrentProcess, you can use the constant kCurrentProcess. (But getpid is a lot less work if you're not trying to access another process's PID, anyway.)
SubSonic can do this for you if you if you can tolerate Open Source... http://subsonicproject.com/querying/webcast-using-paging/ Other than that I know NHib does as well
How to implement database engine independent paging?
|database|paging|
Task: implement paging of database records suitable for different RDBMS. Method should work for mainstream engines - MSSQL2000+, Oracle, MySql, etc. Please don't post RDBMS specific solutions, I know how to implement this for most of the modern database engines. I'm looking for the universal solution. Only temporary...
> 1. Generate a random key on the server (I'm using php). > 2. Save the key in a session and also output the key in a javascript variable. > 3. On form submit, use Triple DES in javascript with the key to encrypt the password. This avoids sending the password in the clear over the wire, but it requires you to send...
The correct answer is ... "it depends". It depends on which wiki you're using or planning to use. I've used various over the years [MoinMoin][1] was ok, used files rather than database, [Ubuntu][2] seem to like it. [MediaWiki][3], everyone knows about and [JAMWiki][4] is a java clone(ish) of MediaWiki with the aim ...
Ask yourself the following: * Do you want to model an Employee _IS_ a User? If so, chose inheritance. * Do you want to model an Employee _HAS_ a User information? If so, use composition. * Are virtual functions involved between the User (info) and the Employee? If so, use inheritance. * Can an Employee hav...
The way this is customarily done is to generate a single symmetric key to encrypt the data. Then you encrypt the symmetric key with each recipient's key or password to that they can decrypt it on their own. S/MIME (actually the Cryptographic Message Syntax on which S/MIME is based) uses this technique. This way, you...
So how is this any more secure? Even though you might have secured browser<>your server, what about the rest of the Internet (your server<>twitter)? IMHO, it's unacceptable to ask for a username and password of another service and expect people to enter that. And if you care that much - don't integrate them until th...
I think it's a lot easier than you're making it out to be. First of all, integrated authentication has nothing to do with the Windows SID. When integrate authentication is enabled, [HttpContext.Current.User.Identity.Name](http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user.aspx) will be "DOMAIN\User"...
You might be able to do something like that using a (detached) criteria query, and setting the fetch mode. E.g., Session s = ((HibernateEntityManager) em).getSession().getSessionFactory().openSession(); DetachedCriteria dc = DetachedCriteria.forClass(MyEntity.class).add(Expression.idEq(id)); dc.setFet...
Try setting your ScriptManager to this. <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
Either run them both in the same statement (separate the separate commands by a semi-colon) or a use a transaction so you can rollback the first statement if the 2nd fails.
In [1]: class test(object): ...: pass ...: In [2]: test.__name__ Out[2]: 'test'
You can tell Eclipse to refresh the workspace (or parts of it) after an external tool has been run. This should force Eclipse to detect any new/deleted classes.
You don't really need a stored proc for this. The question really boils down to whether or not you have control over all the inserts. If in fact you have access to all the inserts, you can simply wrap an insert into datatable, and a insert into historytable in a single transasction. This will ensure that both are co...
[SmartPaster][1] - (FREE) Copy/Paste code generator for strings [AnkhSvn][2] - (FREE) SVN Source Control Integration for VS.NET [VisualSVN Server][3] - (FREE) Source Control [CodeRush][4] - Code gen macros on steroids [Refactor][5] - Code refactoring aid [CodeSmith][6] - Code Generator [GhostDoc][7] -...
I recommend NDesk.Options. It makes use of Lambda functions / .NET 3.5 and it's very nice: [http://www.ndesk.org/Options][1] [1]: http://www.ndesk.org/Options What you basically do is: var p = new OptionSet () { { "file=", v => data = v },<br> { "v|verbose", v => { ++verbose } },<...
This may not be possible. GHC, at least, seems to require a Handle to have an OS file descriptor that is used for all read/write/seek operations. See <code>/libraries/base/IOBase.lhs</code> from the GHC sources. You may be able to get the same effect by enlisting the OS's help: create a temporary file, connect th...
Your event listener function, gets passed an Event object. That has a lot of useful information on it, including the properties "altKey", "ctrlKey", "shiftKey" and "metaKey". If any of the modifier keys are being held down when that event fires, the corresponding property is set to true. This applies to keyboard as ...
There is a common myth that TRUNCATE somehow skips transaction log. This is misunderstanding, and is clearly mentioned in MSDN. This myth is invoked in several comments here. Let's eradicate it together ;)
I actually side with the person (Aaron F) who said that you might be interested in the Levenshtein distance problem (and cited [this][1]). His answer seems to me to be the best so far. More specifically, Levenshtein distance (also called edit distance), does not measure strictly the character-by-character distance, ...
var foos = Foo.Where<br> ( f => FooBar.Where(fb.BarId == 1000).Select(fb => fb.FooId).Contains(f.FooId));
That's actually true in any language...finally will always execute before a return statement, no matter where that return is in the method body. If that wasn't the case, the finally block wouldn't have much meaning.
Need a little REGEX help... [PHP]
|regex|php|regularexpression|
Hey so what I want to do is snag the content for the first paragraph. The string $blog_post contains a lot of paragraphs in the format: <p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p> The problem I'm running into is that I am writing a regex to grab everything between the first P tag and the first clo...
|php|regex|
It would probably be easier and faster to use [strpos()][1] to find the position of the first <p> and first </p> then use [substr()][2] to extract the paragraph. $paragraph_start = strpos($blog_post, '<p>'); $paragraph_end = strpos($blog_post, '</p>', $paragraph_start); $paragra...
It would probably be easier and faster to use [strpos()][1] to find the position of the first <p> and first </p> then use [substr()][2] to extract the paragraph. $paragraph_start = strpos($blog_post, '<p>'); $paragraph_end = strpos($blog_post, '</p>', $paragraph_start); $par...
There is a way to securely send information over an unsecure medium so long as the information is not capable of being modified in transit known as the [Diffie-Hellman algorithm][1]. Basically two parties are able to compute the shared key used to encrypt the data based on their conversations - yet an observer does not...
Your method has a flaw - if someone were to intercept the transmission of the key to the user and the user's encrypted reply they could decrypt the reply and obtain the username/password of the user. However, there is a way to securely send information over an unsecure medium so long as the information is not capabl...
How do I get a result from a modal dialog in JQuery
|javascript|jquery|jquery-ui|simplemodal|
I would like to use an add-in like simplemodal or the dialog add-in in the UI kit. However, how do I use these or any other and get a result back. Basically I want the modal to do some ajaxy interaction with the server and return the result for the calling code to do some stuff with. Thanks.
You can script it with a tool like [expect][1] (there are handy bindings too, like [Pexpect][2] for Python). [1]: http://expect.nist.gov/ [2]: http://www.noah.org/wiki/Pexpect
Since the modal dialog is on the page, you're free to set any document variable you want. However all of the modal dialog scripts I've seen included a demo using the return value, so it's likely on that page. (the site is blocked for me otherwise I'd look)
- [Local classes][1]. - [Instantiating Java inner-classes from outside of the containing class][2]. [1]: http://www.unix.com.ua/orelly/java-ent/jnut/ch03_11.htm [2]: http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/
If you just need to know it for 3D graphics development purposes, you may want to look into something like [gDEBugger][1] or, if you only care about NVIDIA cards, you can try [NVIDIA PerfHUD][2]. I have not used them myself, but I would expect them to track such information. [1]: http://www.gremedy.com/ [2]: h...
Here is an example of how you do it with expect: sub copyover { $scp=Expect->spawn("/usr/bin/scp ${srcpath}/$file $who:${destpath} +/$file"); $scp->expect(30,"ssword: ") || die "Never got password prompt from + $dest:$!\n"; print $scp 'password' . "\n"; $scp->expect(...
Using shadowbox disables keyboard shortcuts?
|javascript|keyboard-shortcuts|mootools|
So my site uses shadowbox (http://mjijackson.com/shadowbox/) to do display some dynamic text. Problem is I need the user to be able to copy and paste that text. Right-clicking and selecting copy works but ctrl+c doesn't (no keyboard shortcuts do) and most people use Ctrl+c right? You can see an example of what I'm t...
We reused the file load and save serialization code for “objects” for a convenient form to save and restore the entire state of an object. We push those serialized objects on the undo stack – along with some information about what operation was performed and hints on undo-ing that operation if there isn’t enough info ...
Task: implement paging of database records suitable for different RDBMS. Method should work for mainstream engines - MSSQL2000+, Oracle, MySql, etc. Please don't post RDBMS specific solutions, I know how to implement this for most of the modern database engines. I'm looking for the universal solution. Only temporary...
JPA lets you do it with the Query class: Query q = ...; q.setFirstResult (0); q.setMaxResults (10); gives you the first 10 results in the result set. If you want a DBMS independent raw SQL solution, I'm afraid you're out of luck. All the vendors do it differently.
Subclipse, because at least it works. Subversive has been a bucket of fail for me so far, wouldn't play nice with all of my old projects I had checked out with Subclipse.
Browser WYSIWYG best practices.
|asp.net|javascript|wysiwyg|
I am using a rich text editor on a web page. .NET has feature that prevent one from posting HTML tags, so I added a JavaScript snippet to change the angle brackets to and alias pair of characters before the post. The alias is replaced on the server with the necessary angle bracket and then stored in the database. Wit...
Also run the tests at different times, so that they do not impact the performance or validity of each other.
Best way to migrate from VSS to Subversion?
|svn|visual-sourcesafe|version-control|
I'm a single developer looking to get off of Visual Source Safe and move to svn. A quick search brings up several tools, but I don't see a clear winner and I can't afford to spend a lot of time testing different tools. Has anyone done this successfully before and can recommend a method?
I'm a single developer looking to get off of Visual Source Safe and move to svn. A quick search brings up several tools, but I don't see a clear winner and I can't afford to spend a lot of time testing different tools. Has anyone done this successfully, and can recommend a method?
Parse requires a string for input, casting requires an object, so in the second example you provide above, then you are required to perform two casts: one from an object to a string, then from a string to a DateTime. The first does not. However, if there is a risk of an exception when you perform the cast, then yo...
This how I did it just recently. Add an interface that implements IDispatch and a coclass for that interface to your IDL: [ object, uuid(6EDA5438-0915-4183-841D-D3F0AEDFA466), nonextensible, oleautomation, pointer_default(unique) ] interface IServerEvents :...
Navision's application logic is written using a proprietary language called C/AL, which is loosely based on Pascal. It currently offers both a native database option as well as MS SQL Server. The next version (NAV 2009) will use .NET assemblies served via IIS. C/AL logic will be translated to C# code and deployed ...
From [aspdev.org][1]: Add the following line on top of the Page_Load event handler and your ASP.NET page will not be cached in the users browsers: Response.Cache.SetCacheability(HttpCacheability.NoCache) [1]: http://www.aspdev.org/asp.net/asp.net-disable-caching/
From [aspdev.org][1]: Add the following line on top of the Page_Load event handler and your ASP.NET page will not be cached in the users browsers: Response.Cache.SetCacheability(HttpCacheability.NoCache) Settings this property ensures that if the user hits the back-button the content will be gone, and if ...
Well, nobody's mentioned Coldfusion yet, so... <cfinclude template="#ListLast(CGI.SCRIPT_NAME, "/\")#"> That oughta do it.
http://svn.async.com.br/cgi-bin/viewvc.cgi/libglade/glade-2.0.dtd?view=markup (The main version @ http://glade.gnome.org/glade-2.0.dtd doesn't seem to be working)
Configuration *is* code, and you should version it. We base our configuration files on usernames; in both UNIX/Mac and Windows you can access the user's login name, and as long as these are unique to the project, you are fine. You can even override this in the environment, but you **should** version control everythin...
If you cannot use TRUNCATE TABLE because of foreign keys and/or triggers, you can consider to: * drop all indexes; * do the usual DELETE; * re-create all indexes. This may speed up DELETE somewhat.
I've used pgtop a little. It is quite crude, but at least I can see which query is running for each process ID. I tried pgfouine, but if I remember, it's an offline tool. I also tail the psql.log file and set the logging criteria down to a level where I can see the problem queries. #log_min_duration_statem...
I've used pgtop a little. It is quite crude, but at least I can see which query is running for each process ID. I tried pgfouine, but if I remember, it's an offline tool. I also tail the psql.log file and set the logging criteria down to a level where I can see the problem queries. #log_min_duration_statem...
[SmartPaster][1] - (FREE) Copy/Paste code generator for strings [AnkhSvn][2] - (FREE) SVN Source Control Integration for VS.NET [VisualSVN Server][3] - (FREE) Source Control [CodeRush][4] - Code gen macros on steroids [Refactor][5] - Code refactoring aid [CodeSmith][6] - Code Generator [GhostDoc][7] -...
You can make ruby work that way: class Null def self.==(other);false;end end n=Null print "Null equals nothing" if n!=NULL
a possibly fruitful area of investigation would be to look into the quote method. <br> **my $quotedString = $dbh->quote( $string );** <br>
My answer would be to change the problem. I would add an operatorNumber field to the table if that is possible. Change the update/insert routines to extract the number and store it. That way the string conversion hit is only once per record. The ordering logic would require the string conversion every time the qu...
You can click the "Gather Windows" button in the Displays preference pane.
Detecting a chroot jail from within