instruction
stringlengths
0
30k
System.Net.WebClient webClient = new System.Net.WebClient(); string result = webClient.DownloadString("http://www.example.org/"); Have not tested it myself, yet, but according to the classes description, this could do it. I know that this is C#, but translating it shall be possible.
In VB.NET: Dim webClient As System.Net.WebClient = New System.Net.WebClient() Dim result As String = webClient.DownloadString("http://api.hostip.info/?ip=68.180.206.184") In C#: System.Net.WebClient webClient = new System.Net.WebClient(); string result = webClient.DownloadString("http://api.h...
The only representation that I have seen in use (though, admittedly, my experience is limited to [DOJO](http://dojoframework.com/)) is [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601), which works nicely, and represents just about anything you could possibly think of. For examples, you can visit the link above. ...
You can debug any ODBC driver by activating the logging for it via the Control Panel. Just go to driver's properties, activate the logging and set the target log file - and then set up another program to read from it interactively, so you can see what's going on.
There's also [Scruffy][1]. I took a look at the code recently and it seemed easy to modify/extend. It produces svg and (by conversion) png. [1]: http://scruffy.rubyforge.org/
Ruby on Rails Migration - Create Schema
|ruby|ruby-on-rails|migration|postgresql|schema|
I have a migration that runs an SQL script to create a new Postgres schema which seems to work fine. The problem is that after the migration has run, when it tries to update the 'schema_info' table it says that it does not exist, as if it is looking for it in the new schema and not the default public schema where the t...
Ruby on Rails Migration - Create New Database Schema
|ruby|ruby-on-rails|postgresql|migration|schema|
I have a migration that runs an SQL script to create a new Postgres schema. When creating a new database in Postgres by default it creates a schema called 'public', which is the main schema we use. The migration to create the new database schema seems to be working fine, however the problem occurs after the migration h...
[http://weblogs.asp.net/mikebosch/archive/2008/05/05/gallery-of-live-asp-net-mvc-sites.aspx][1] [1]: http://weblogs.asp.net/mikebosch/archive/2008/05/05/gallery-of-live-asp-net-mvc-sites.aspx
AFAIK, UAC is apolicy setting on the local user or group. So you can read this property from within .Net. Sorry for not having more details but I hope this helps
It's not quite as spiffy (IMO) as jQuery, but here's a [yazaar validation framework](http://yazaar.org/examples/extras/jc21/validate.html).
Retrieving HTTP status code from loaded iframe with Javascript
|ajax|iframe|http|forms|
I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe's contents. The problem is that I can't figure out how to find what HTTP status code was returned by the server. For example, if the server returns ...
|ajax|iframe|http|forms|jquery|
|ajax|jquery|http|forms|iframe|
|ajax|jquery|https|forms|iframe|
|ajax|jquery|http|forms|iframe|
|jquery|ajax|http|forms|iframe|
I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe's contents. The problem is that I can't figure out how to find what HTTP status code was returned by the server. For example, if the server returns ...
Should I catch exceptions only to log them?
|c#|logging|exception|
Should I catch exceptions for logging purposes? <pre> public foo(..) { try { ... } catch (Exception ex) { Logger.Error(ex); throw; } } </pre> If I have this in place in each of my layers (DataAccess, Business and WebService) it means the exception is logged several times. ...
> range creates a list, so if you do range(1, 10000000) it creates a list in memory with 10000000 elements. xrange is a generator, so it evaluates lazily. This brings you two advantages: 1. You can iterate longer lists without getting a stackoverflow error. 2. As it resolves each number lazily, if you skip th...
The error "Row not found or changed" also will appear sometimes when the columns or types in the O/R-Designer do not match the columns in the SQL database, especially if one column is NULLable in SQL but not nullable in the O/R-Designer. So check if your table mapping in the O/R-Designer matches your SQL database!
The answer to your question is broader than just GUIs. Feature/Scope creep will always happen, when someone isn't paying attention to what the contract has stipulated and when there isn't a formal process for handling change requests. If you lack the ability to implement the formal process or influence its creation...
There are good reasons to use an instance logger. One very good use case is so you can declare the logger in a super-class and use it in all sub-classes (the only downside is that logs from the super-class are attributed to the sub-class but it is usually easy to see that). (Like others have mentioned use static or...
Assuming a unix type OS and that you properly installed it using an account named oracle... find / -user oracle -exec rm -fr {} \; That having been said, this must be done as root and you had better not mind loss of any and all files that belong to oracle. There will be no... NO recovery from this method.
Use a separate iframe for the content, then use Javascript to `delay()` a period of time and set the iframe's `location` property.
I usualy send all mine to /dev/null that way I don't ever have to worry about it. I have known some people who set it to /bin/logout so that when someone logged in they were logged back out.
Depending on the types of warnings it is not possible if I recall correctly. For example, warning messages for XHTML compliance are ONLY displayed when the file is open. You might check the tolerance settings inside VS to see if you can change it.
In order to work around the performance cost of reporting via db4o, I'd suggest maintaining a highly denormalized (sqlite ?) database in parallel to your db4o container. Run reports against the db and normal app logic against db4o. Yes it's more work, but this way you'll have high performance reporting while keeping...
SSRS 2005 - Looping Through Report Parameters
|reporting-services|sql-server-2005|parameters|
I would like to be able to loop through all of the defined parameters on my reports and build a display string of the parameter name and value. I'd then display the results on the report so the user knows which parameters were used for that specific execution. The only problem is that I cannot loop through the Parame...
How do you measure the time a function takes to execute?
|embedded|profiling|time|
How can you measure the amount of time a function will take to execute? This is a relatively short function and the execution time would probably be in the millisecond range. This particular question relates to an embedded system.
|embedded|time|profiling|
How can you measure the amount of time a function will take to execute? This is a relatively short function and the execution time would probably be in the millisecond range. This particular question relates to an embedded system, programmed in C or C++.
Visual Studio basicHttpBinding and endpoint problems
|asp.net|visual-studio|web-services|wpf|
I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings. Unfortunately, this means that when I update the service references in the proje...
Try one of these: 1) http://www.getdropbox.com 2) https://www.foldershare.com/welcome.aspx 3) Microsoft Office Groove I personally use SVN.
It's not .NET, but have you looked at Alice? (http://www.alice.org/)
Using a Window's batch file named "s.bat": call s
For JSPs, you can have your cake and eat it too, with the c:out tag, which escapes XML by default. This means you can bind to your properties as raw elements: <input name="someName.someProperty" value="<c:out value='${someName.someProperty}' />" /> When bound to a string, someName.someProperty will contain t...
I think you're missing a fundamental key of the SOAP protocol. One of the things I really like about the SOAP protocol is that you can define arbitrary objects (along with methods) in your WSDL file and pass these objects around from one end to the other using the SOAP protocol. You don't have to serialize the data...
It depends on how 'close to the metal' you want to be. Choose .Net/C#/Windows Forms/WPF if you want to quickly write Windows-only applications. Choose C++/MFC if you are determined to learn a platform that is not easy to use and has wards from 15 years of legacy code, but gives you infinite control over every little de...
It depends on how 'close to the metal' you want to be. Choose .Net/C#/Windows Forms/WPF if you want to quickly write Windows-only applications. Choose C++/MFC if you are determined to learn a platform that is not easy to use and has wards from 15 years of legacy code, but gives you infinite control over every little de...
The static declaration at this level of code means that the variabel is only visible in the current compilation unit. This means that only code within that module will see that variable. if you have a header file that declares a variable static and that header is included in multiple C/CPP files, then that variab...
Wikipedia: "A SOA is a software architecture that uses loosely coupled software services to support the requirements of business processes and software users. Resources on a network in an SOA enviroment are made available as independent services that can be accessed without knowledge of their underlying platform implem...
In case you're using Perl for parsing. The Perl equivalent of YACC would be [the Parse::Yapp][1] module. When I translated a yacc grammar for use with my Perl code, the translation was mostly mechanic. There's also a recursive descent parser generator, which is slow but powerful: [Parse::RecDescent][2]. [1]: htt...
TestDriven.Net doesn't find tests
|mbunit|unit-testing|testdriven.net|.net|testing|
I have a test project using MbUnit and TestDriven.Net. If I right-click on an individual test method and say "Run Tests" the test runs successfully. Same thing if I click on a file name in the solution explorer. However, if I right click and say run tests on the project or the solution, TestDriven.Net report...
|.net|unit-testing|testing|mbunit|testdriven.net|
I have a test project using MbUnit and TestDriven.Net. If I right-click on an individual test method and say "Run Tests" the test runs successfully. Same thing if I click on a file name in the solution explorer. However, if I right click and say run tests on the project or the solution, TestDriven.Net report...
Add DESC to the group by clause, e.g. GROUP BY myDate DESC Sorry - I was coming from a SQL Server background - apparently that doesn't work in MySQL - I'm looking it up now...!
Add DESC to the group by clause, e.g. GROUP BY myDate DESC
I use [GPGme](http://www.gnupg.org/related_software/gpgme/index.en.html) which has a [Python interface](http://pyme.sourceforge.net/). Warning: it is a low-level interface, not very Pythonic. If you read French, [see examples](http://www.bortzmeyer.org/gpgme.html). Here is one, to check a signature: signed...
I use [GPGme](http://www.gnupg.org/related_software/gpgme/index.en.html) The main strength of GPGme is that it read and writes files at the OpenPGP standard ([RFC 4880](http://www.ietf.org/rfc/rfc4880.txt)) which can be important if you want to interoperate with other PGP programs. It has a [Python interface](http:...
Is there a specific name for the node that coresponds to a subtree?
|data-structures|class-design|naming|tree|class-naming|
You can use either a separate table for each (my preferred), or a common picklist table that has a type column you can use to filter on from your application. I'm not sure that one has a great benefit over the other generally speaking. If you have more than 25 or so, organizationally it might be easier to use the...
Could you define a method missing that allows you to do: @bar = el.bar? That would get rid of some boilerplate. If Bat is always going to be defined that way, you could push the XPath into the initialize method, class Bar def initialize(el) self.from_xml(XPath.first(el, "./bat")) en...
Use Snort, stripped down, if this is a long-term thing. It's built to watch for particular packets flying by, examining payload where needed, recording data and launching alerts. It's intended for intrusion detection, but it makes a surprisingly good network monitor for particular things over long term use.
Setting the default ssh key location
|ssh|
ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location. The workaround I'm using is to add the keys from the non-standard location to the agent: ssh-agent ssh-add /path/to/where/keys/really/are/id_rsa (Linux, MingW32 shell)
ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location. The workaround I'm using is to add the keys from the non-standard location to the agent: ssh-agent ssh-add /path/to/where/keys/really/are/id_rsa (on Linux and MingW32 shell on Windows)
How do you define best? Best for the browser, or best for the developer? (Plus ECMAScript is different than Javascript, but that is a technicality.) I find that JavaScript can be powerful and elegant at the same time. Unfortunately most developers I have met treat it like a necessary evil instead of a real programmi...
I'm with Guy Starbuck here, but would add that Rebuild Solution is supposed to do a Clean Solution followed by Build Solution, which should, then, have solved your issue to begin with. But VS 2005 can be terrible in this regard. Sometimes it just starts working after several rebuilds. If upgrading to 2008 isn't an opti...
When you are taken to another site (e.g. Google) control passes to that site, so in order for your script to keep running, you'd need to load the new site in a frame, and keep your script (which I'd imagine could most readily be implemented using Javascript) in another frame (which could be made very small so you can't...
This sounds strange - Rebuild should build everything regardless of changes and Build should only build things that have changed. The behaviour you've described should only happen if you have modified something that is referenced by the unchanged file so that it is now incorrect.
CL, I've seen your citations before, and agree they're totally relevant, but even after having read them I wasn't sure whether the code is defined. > 6.3.1.1.2 says regarding integer promotions: Yes, but integer promotion rules only apply if a promotion is in fact carried out. I do not think that my example requi...
Perhaps you could generate the data as XML and render it using XSLT? I'm not sure PHP or Ruby are the answer if Java isn't fast enough for you!
It looks like your GET argument is itself an array. It would be helpful to have the input as well as the output.
This way fits in better with the rest of the language. The convention in python is that you add `__foo__` special methods to objects to make them have certain capabilities (rather than e.g. deriving from a specific base class). For example, an object is * callable if it has a `__call__` method * iterable if it h...
We're using [Stripes][1]. It gives you more structure than straight servlets, but it lets you control your urls through a @UrlBinding annotation. We use it to stream xml and json back to the browser for ajax stuff. You could easily consume it with another technology if you wanted to go that route, but you may actua...
Check out <a href="http://restlet.org">Restlet</a> for a good framework for exposing your domain model as REST services (including JSON and trivial XML output). For rendering your info, maybe you can use GWT on the client side and consume your data services? If GWT doesn't float your boat, then maybe JQuery would?
If you're just interested in writing graphical windows applications, just stick with "Windows Form Application". It will start you out with a blank windows form and a class that contains your main() method. The "Console Application" project is probably the simplest, it just creates one class file for you with a main...
This issue was resolved after reviewing MSDN and the source code involved. Previously the application was only implementing the [DownloadProgressChangedEventHandler][1] to track how much of a download remained. This turned out to be the root cause of the issue as [AsyncCompletedEventHandler][2] is what is invoked when ...
How do I reserve caret position in CEdit control?
|c++|mfc|user-interface|
I'm programming an application in MFC (don't ask) and I have a CEdit box that holds a number. When that number is edited, I would like to act on the change, and then replace the caret where it was before I acted on the change - if the user was just before the "." in "35.40", I would like it to still be placed before t...
Tidy Converting <Span Style="Font-Style:Bold"> to <Class="C1">.
|php5|tidy|
I am using the PHP 5 Tidy class to format html. Everything is fine except when it gets passed a style attribute, when it changes it into a class attribute. As I am only formatting the body of a document, not the head, there is no class defined in the head for the attribute to read. I have looked through all the T...
Why easyphp stop all apache processes on severals PC?
|easyphp|apache|process|windows|
on some Windows PC, when I have both easyPHP and a standalone apache service configured on another network port and with a specific service name, I have a problem : when I stop easyphp, the other apache is stopped too. The problem do not occur on all PC I have, but seems very strange to me. Any idea? Thanks Cé...
|windows|apache|process|easyphp|
Remember to *program into* the language rather than program in it. Just because you're using a limited tool-set doesn't mean you have to program like it's 1999. I agree with JasonS about classes. It's true you can't do things like inheritance but you can easily fake it Class Dog Private Parent ...
Matt Berseth has something that may be the kinda thing you're looking for: [http://mattberseth.com/blog/2007/12/debugging_aspnet_ajax_applicat.html][1] It's based on the yahoo YUI logger at: [http://developer.yahoo.com/yui/logger/][2] [1]: http://mattberseth.com/blog/2007/12/debugging_aspnet_ajax_applic...
Yeah we recently finished a site with MonoRail and have our own proprietary MVC framework for content generation too.
There will be a two-step dance here. See [Python 3000 and You][1]. Step 1 is to get running under 3.0. Step 2 is to rethink your API's to, perhaps, do something more sensible. The most likely course is that the libraries will switch to unicode strings to remain as compatible as possible with how they used to ...