instruction
stringlengths
0
30k
How to Pass Command Line Parameters in batch file
|ms-dos|cmd|batch-file|command-line|
I needed to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file. Here's how I do it. echo off fake-command /u %1 /p %2 Here's what the command line looks like: test.cmd admin P@55w0rd > test-log.txt The %1 applies to the first paramete...
How can you (reliably) dynamically load a javascript file? (Like C's #include)
|javascript|
How can you reliably and dynamically load a javascript file? Basically what I want to accomplish is implement a module or component that when you 'initialize' the component it will dynamically load all needed javascript library scripts on demand. So the client that uses the component isn't required to load all the ...
How can you reliably and dynamically load a javascript file? Basically what I want to accomplish is implement a module or component that when you 'initialize' the component it will dynamically load all needed javascript library scripts on demand. So the client that uses the component isn't required to load all the ...
How can you reliably and dynamically load a javascript file? Basically what I want to accomplish is implement a module or component that when you 'initialize' the component it will dynamically load all needed javascript library scripts on demand. So the client that uses the component isn't required to load all the ...
How do you dynamically load a javascript file? (Think C's #include)
How can you reliably and dynamically load a javascript file? This will can be used to implement a module or component that when 'initialized' the component will dynamically load all needed javascript library scripts on demand. The client that uses the component isn't required to load all the library script files (a...
You might want to look into using [Mono][1]. This is a open source version of .NET that runs on many plateforms...Linux,Mac, Solaris, Windows, etc.. Now about coding your expensive stuff in C/C++. Here's an article that does a very good job explaining the differences between [C/C++ & C# performance][2]. [1]:...
Putting your resume up online somewhere helps, I get a lot of recruitment emails from people who happened on my resume via googling. However I agree with ColinYounger in that you'll probably get more bang for your buck from LinkedIn. My advice is this - if you want to take the time out to LEARN a CMS or something, t...
If you're running it on a 2k3 box, you need to install all updates for Sql Server and the 2003 server. Check the event logs after you start the Sql Server. It logs everything well, telling you if its being blocked, and where it is listening for connections. From a remote machine, you can use telnet to see if a...
It really depends on: a) what services you provide b) what your skill level is when it comes to web design/development If you are primarily a web applications developer then running an off the shelf product or using blatantly using DreamWeaver to develop it may not be so smart -- or maybe your clients aren't a...
This was the fastest I could come up with after some fiddling: private function castMethod4(dateString:String):Date { if ( dateString == null ) return null; if ( dateString.length != 10 && dateString.length != 19) return null; dateString = dateStri...
> What specifically does that question mean? Good question. If reversing the "ON" bits means reversing only the bits that are "ON", then you will always get 0, no matter what the input is. If it means reversing *all* the bits, i.e. changing all 1s to 0s and all 0s to 1s, which is how I initially read it, then that...
Yes they are one and the same
How do you find what debug switches are available? Or given a switch find out what is being disabled?
|.net|app-config|
In this [question][1] the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user generated and does not list any switches. <configuration> <system.diagnostics> <switches> ...
Visual Studio Hosting Process and "The operation could not be completed"
|visual-studio|
When trying to execute from within Visual Studio 2008 your application and you get the (uninformative) message "The operation could not be completed". The solution to this is to turn off the "Visual Studio Hosting Process". The problem with turning off this "hosting process" is that all the "run and rewrite" func...
A quick google reveals that this should get rid of it, get them to add it to the web.config or app.config for their application. <configuration> <system.diagnostics> <switches> <add name="Remote.Disable" value="1" /> </switches> </system.diagnostics> </configurat...
A quick google reveals that this should get rid of it, get them to add it to the web.config or app.config for their application. <configuration> <system.diagnostics> <switches> <add name="Remote.Disable" value="1" /> </switches> </system.diagnostics> </configurat...
I wrote up a PHP class that lets you choose to use a certain class of Captcha Question (math, naming, opposites, completion), or to randomize which type is used. These are questions that most english-speaking children could answer. **For example:** 1. Math: 2+5 = _ 2. Naming: The animal in this picture is a __...
Boundary Tests For a Networked App
|testing|networking|wireless|
Besides "no connection", what other failure modes should I test for? How do I simulate a high-latency link, an unreliable link, or all the other sorts of crazy stuff that will undoubtedly happen "in the wild"? How about wireless applications--how do I test the performance in a less-than-ideal WL environment?
[OWASP][1] keeps a list of the [Top 10][2] web attacks to watch our for, in addition to a ton of other useful security information for web development. [1]: http://www.owasp.org/index.php/Main_Page [2]: http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project
Javascript doesn't really have namespace or packages like other languages. Instead it has closures. If you have an application that consists of multiple functions, variables and objects, then you should put them inside a single global object. This will have the same effect as a namespace. For example: <pre><code> v...
Downside? It's fairly limited - you trigger a "GET" request and get back some script that's executed. You don't get error handling if your server throws an error, so you need to wrap all errors in JSON as well. You can't really cancel or retry the request. You're at the mercy of the various browser author opinions of "...
C++ linker unresolved external symbols
|c++|
I'm building an application against some legacy, third party libraries, and having problems with the linking stage. I'm trying to compile with Visual Studio 9. My compile command is: > cl -DNT40 -DPOMDLL -DCRTAPI1=_cdecl > -DCRTAPI2=cdecl -D_WIN32 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWNT -DBYPASS_FLEX -D_INTEL=1 -DIPL...
Instead of using a DOMParser, use a SAXParser. This reads from an input stream or reader so you can keep the XML on disk instead of loading it all into memory.
Instead of using a DOMParser, use a SAXParser. This reads from an input stream or reader so you can keep the XML on disk instead of loading it all into memory. SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); SAXParser pars...
I'm not entirely sure I understand your question, especially the bit about displaying two SPField collections. Sorry if this turns out to be the answer to a completely different question! Anyway here's a quick demo walkthrough of using the MultipleLookupField in a web part. Create a team site. Add a few tasks to ...
Actually, because of leap years, your code would be off. Since the timespan object has no TotalYears property the best way to get it would be this Pardon the VB.Net Dim myAge AS Integer = DateTime.Now.year - BirthDate.year If Birthdate.month < DateTime.Now.Month _ OrElse BirthDate.Month = DateTime....
I think you have your answer right here: [Reflector sold to Red Gate][1] [1]: http://blog.lutzroeder.com/2008/08/future-of-net-reflector.html
A more complete discussion of the pitfalls of using a regex to find matching tags can be found at: <http://faq.perl.org/perlfaq4.html#How_do_I_find_matchi>. In particular, be aware that nesting tags really need a full-fledged parser in order to be interpreted correctly. Note that case sensitivity will need to be tu...
MVC .Net - The best way to write a form?
|asp.net-mvc|forms|
What is the the best way to write a form to submit some data in asp.net MVC? Is it as Scott Gu demonstrates here? Are there better approches? Perhaps with less using of strings? ![alt text][1] [1]: http://www.scottgu.com/blogposts/mvc4/step33.png
I layer out the application and at least unit test from the presenter/controller (whichever is your preference, mvc/mvp) to the data layer. That way I have good test coverage over most of the code that is written. I have looked at FitNesse, Watin and Selenium as options to automate the UI testing but I haven't got a...
How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?
|tomcat|
How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?
As of PHP 5.1.0 you can use [date__default__timezone_set()][1] function to set the default timezone used by all date/time functions in a script. For MySql (quoted from [MySQL Server Time Zone Support][2] page) > Before MySQL 4.1.3, the server operates only in the system time zone set at startup. Beginning with MyS...
Ah, if only C supported closures... Antonio is right; if you need to pass extra parameters, you'll need to redefine your function pointer to accept the additional arguments. If you don't know exactly what parameters you'll need, then you have at least three choices: 1. Have the last argument in your prototype be...
If you are trying to use xslt you can add the namespace in to the stylesheet delcaration. If you do that, you must make sure that there is a prefix or it will not work. If the source XML does not have a prefix, that is still fine, you add your own prefix in the stylesheet. _Stylesheet_ <xsl:stylesheet ...
If I'm reading this right, what I'd suggest is to make your function take a pointer to a struct as an argument. Then, your struct can have can have "game" and "depth" when it needs them, and just leave them set to 0 or Null when you don't need them. What is going on in that function? Do you have a conditional that ...
Making human readable representations of an Integer
|practice|
Here's a coding problem for those that like this kind of thing. Let's see your implementations (in your language of choice, of course) of a function which returns a human readable String representation of a specified Integer. For example: <ul> <li>humanReadable(1) returns "one". <li>humanReadable(53) returns "fifty-...
Getting Java and Twain to play together nicely
|java|twain|scanner|
I'm working on building an app to scan directly from TWAIN scanner to a Java applet. I'm already aware of [Morena][1] and [JTwain][2], but they cost money. I need free. I could re-invent the wheel with JNI, but it seems like someone has probably already done this as a FOSS tool. Is anyone familiar with a **free**...
PyGame works much better when it can manage its own window, or even better, use the whole screen. GTK has flexible enough widgets to allow creation of a drawing area. [This page][1] may help, though, if you want to try it. [1]: http://faq.pygtk.org/index.py?req=show&file=faq23.042.htp
What are the best practices for JSF?
|jsf|
I have done Java and JSP programming in the past, but I am new to Java Server Faces and want to know if there's a set of best practices for JSF development.
|java|jsf|
I recommend using <a href="http://commons.apache.org/logging/">Apache Commmons Logging</a> as your logging interface. That way you have the flexibility to switch logging implementations anytime you want.
I recommend using <a href="http://commons.apache.org/logging/">Apache Commmons Logging</a> as your logging interface. That way you have the flexibility to switch logging implementations anytime you want without requiring any code changes on your end.
The traditional way is to use setjmp and longjmp, though there are caveats. Here's a [reasonably good explanation][1] [1]: http://homepage.mac.com/sigfpe/Computing/continuations.html
You can configure eclipse to show warnings for things that lack javadoc, or have javadoc that does not have all the information, or has wrong information. It can also insert templates for you to fill out. Not quite the tool you asked for, but probably better because you won't end up with empty skeletons on methods t...
I've used [this](http://www.objectmentor.com/resources/articles/acv.pdf) ("acyclic visitor") to good effect; it makes adding new classes to the hierarchy possible without changing existing ones, to some extent.
How about using the C++ language itself? bool b = true; std::cout << std::noboolalpha << b << " == " << std::boolalpha << b << std::endl;
How about using the C++ language itself? bool t = true; bool f = false; std::cout << std::noboolalpha << t << " == " << std::boolalpha << t << std::endl; std::cout << std::noboolalpha << f << " == " << std::boolalpha << f << std::endl;
Note that Zend Optimizer and MMCache (or similar applications) are totally different things. While Zend Optimizer tries to optimize the program opcode MMCache will cache the scripts in memory and reuse the precompiled code. I did some benchmarks some time ago and you can find the [results][1] in my blog (in German t...
When do Request.Params and Request.Form differ?
|asp.net|mvc|c#|
I recently encountered a problem where a value was null if accessed with Request.Form but fine if retrieved with Request.Form.
|c#|asp.net|mvc|
I recently encountered a problem where a value was null if accessed with Request.Form but fine if retrieved with Request.Params. What are the differences between these methods that could cause this?
|c#|asp.net|
In ASP.NET MVC I encounter an incorrect type error when rendering a user control with the correct typed object
|asp.net-mvc|
I encounter an error of the form: "The model item passed into the dictionary is of type FooViewData but this dictionary requires a model item of type bar" even though I am passing in an object of the correct type (bar) for the typed user control.
|asp.net|mvc|
|asp.net|asp.net-mvc|mvc|
Use the routing engine for form submissions in ASP.NET MVC Preview 4
|asp.net|mvc|forms|routing|
I'm using ASP.NET MVC Preview 4 and would like to know how to use the routing engine for form submissions. For example, I have a route like this: routes.MapRoute( "TestController-TestAction", "TestController.mvc/TestAction/{paramName}", new { controller = "Te...
I'm using ASP.NET MVC Preview 4 and would like to know how to use the routing engine for form submissions. For example, I have a route like this: routes.MapRoute( "TestController-TestAction", "TestController.mvc/TestAction/{paramName}", new { controller = "Te...
The right thing to is to access the database via an abstraction layer in a way such if you change your RDBMS or how you implemented that access, you only have to modify this layer while all the rest of your application remains untouched. To do this, to free your application from knowing how to deal with the databas...
My favorite method is a photoshop plugin to "Save as .ICO". [http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html][1] [1]: http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html Fast, works offline, etc.
My favorite method is a photoshop plugin to "Save as .ICO". [http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html][1] [1]: http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html Fast, works offline, you're already in Photoshop, etc.
There probably isn't a definitive "right" answer - it's going to depend on how you like to develop. However, it's interesting to note that most of the "name" Rails folk seem to use Textmate on their Macs. So a fairly powerful editor rather than an IDE. I suspect this is at least in part because of the fairly strong ...
I'm not 100% sure about VS2008, but I know that the Unit Testing framework that microsoft shipped in VS2005 as part of their Team Suite was only for .NET, not C++ I've used CppUnit also and it was alright. Much the same as NUnit/JUnit/so on. If you've used boost, they [also have a unit testing library](http://www...
I've been arounda while, so most books that I have found influential don't necessarily apply today. I do believe it is universally important to understand the platform that you are developing for (both hardware and OS). I also think it's important to learn from other peoples mistakes. So two books I would recommend ...
To do arithmetic with dates on UNIX you get the date as the number seconds since the UNIX epoch, do some calculation, then convert back to your printable date format. The date command should be able to both give you the seconds since the epoch and convert from that number back to a printable date. My local date command...
I think you should benchmark and take a look at what you are doing to determine if stat() is the slowest part of your code. Stating 1 file on each request on a server that gets about 100 hits/day is not a problem. Stating every file could be a problem when you have to eek out a few more requests a second. You can av...
How about developing your own text editor? You can own your own editor with priceless experience.
Is it possible to share a transaction between a .Net application and a COM+ object?
|.net|com|
I did some tests a while ago and never figured out how to make this work. The ingredients: - COM+ transactional object (developed in VB6) - .Net web application (with transaction) that... makes a call to the COM+ component updates a row in a SQL database Testing: Run the .Net application and fo...
|.net|com|database|transaction|
|.net|com+|database|transaction|