instruction
stringlengths
0
30k
[Nmap][1] is good for this - use the -O option for OS fingerprinting and -oX "filename.xml" for output as xml that you can then parse from c# [1]: http://nmap.org/
[Nmap][1] is good for this - use the -O option for OS fingerprinting and -oX "filename.xml" for [output][2] as xml that you can then parse from c# [1]: http://nmap.org/ [2]: http://nmap.org/book/man-output.html
[Nmap][1] is good for this - use the -O option for OS fingerprinting and -oX "filename.xml" for [output][2] as xml that you can then parse from c#. A suitable commandline would be (where 192.168.0.0/24 is the subnet to scan): nmap -O -oX "filename.xml" 192.168.0.0/24 leave out the -O if you aren't interest...
From the Javadocs for the [marshalSendAndReceive method](http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/client/core/WebServiceOperations.html#marshalSendAndReceive%28java.lang.String,%20java.lang.Object%29) it looks like the SoapFaultClientException in the catch block will never h...
Two good links to start with: [CSS-Based Forms: Modern Solutions](http://www.smashingmagazine.com/2006/11/11/css-based-forms-modern-solutions/) [Label Placement in Forms](http://www.uxmatters.com/MT/archives/000107.php)
If a document is moved to a different URL, the server should be configured to return a HTTP status code of 301 (Moved Permanently) for the old URL to tell the client where the document has been moved to. With Apache, this is done using mod_rewrite and RewriteRule.
I would recommend [Sqlite](http://www.sqlite.org/). It's completely self-contained, and *public domain* so there are no license issues at all.
PHP webpage doesn't launch unix command even after updated sudoers
|php|sudo|exec|
Basically I am trying to restart a service from a php web page. Here is the code: <?php exec ('/usr/bin/sudo /etc/init.d/portmap restart'); ?> But, in `/var/log/httpd/error_log`, I get >unable to change to sudoers gid: Operation not permitted and in /var/log/messages, I get >Sep 22 15:01:56...
SQLite may be what you are looking for. http://www.sqlite.org/
How do I run a script when ip-address changes (most likely using a dhclient hook) on a (Ubuntu) Linux machine?
|linux|unix|hook|dhcp|
I have a script which contacts a few sources and tell them "the IP-address XXX.XXX.XXX.XXX is my current one". My test web server has a dynamic IP-address through DHCP and amongst other things it needs to update a DDNS entry when its IP-address changes. However it's not the only thing it does, so I will need to run my ...
CruiseControl.NET post-build actions
|cruisecontrol.net|
A semaphore is suited cleanly to a producer-consumer model, although it has other uses. Your program logic is responsible for ensuring that the right number of posts are made for the number of waits. If you post a semaphore and nobody is waiting on it yet, then when they do wait they continue immediately. If your probl...
A semaphore is suited cleanly to a producer-consumer model, although it has other uses. Your program logic is responsible for ensuring that the right number of posts are made for the number of waits. If you post a semaphore and nobody is waiting on it yet, then when they do wait they continue immediately. If your probl...
I've long used Excentric's World UI tools: http://www.eworldui.net/
Yes it does. One of the reasons the GPL came into being in the first place was to prevent the situation where somebody had a binary, but no source to go with it. IANAL, so I can't speak to whether the consultancy-client relationship would constitute a loophole which you could use to avoid passing on source code, bu...
Word 2007 will produce a block of placeholder text when you type in =rand() and this hit the return/enter key. If you're looking for simple placeholder text, I'd go ahead and generate a bunch ahead of time and stick it in a text file.
Django includes the `{% lorem %}` tag as part of <a href="http://docs.djangoproject.com/en/dev/ref/contrib/webdesign/#ref-contrib-webdesign">the contrib addons</a>. It shouldn't be too hard to make a command-line version. <a href="http://code.djangoproject.com/browser/django/trunk/django/contrib/webdesign/lorem_ipsum...
Examining the headers is a good idea, but I imagine all you will learn from them is that the server didn't respond to a request every once in a while. I see this happen all the time on the net. Images won't load until you refresh, css is messed up, etc. All of the situations are solved by a refresh. I imagine o...
We do this in our projects at work, using the classpath* resource loader in Spring. For a certain app, all appcontext files containing the application id will be loaded: classpath*:springconfig/spring-appname-*.xml
What is the content-type of the Json feed. Sounds like it may be some sort of application instead of text. Change the content type of the feed to something that is text based and FireFox will no longer try to open it in another program.
Using Vim for Lisp development
|vim|lisp|
I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are all welcome. Please don't say "use emacs" as I...
Starting off, Joomla is fun and easy, from both an administrative and user view, but once the site needs to be customised (naturally), it becomes a pain. In my opinion, Drupal is opposite. It has a steep learning curve (the pain part), but becomes easier not harder over time. This is from both the admin and user par...
I've encountered this before, and the `AttachmentFu` plugin was to blame. I believe in my case it was due to `AttachmentFu` expecting a different image processor than what was available, or non-supported versions were also installed. The problem was solved when I explicitly added `:with => :rmagick` (or similar -- I ...
This will set the caret position to the start: <br />maskedTextBox1.Select(0 ,0); Hope it helps.
This should do the trick:<br> private void maskedTextBox1_Enter(object sender, EventArgs e) <br />{ <br />&nbsp;this.BeginInvoke((MethodInvoker)delegate() { maskedTextBox1.Select(0, 0); }); }
ok, From what I can tell, the best option seems to be to save it into the Session data
How would you unittest a memory allocator?
|c++|c|unit-testing|testing|
There's a lot of people today who sell unittesting as bread-and-butter of development. That might even work for strongly algorithmically-oriented routines. However, how would you unit-test, for example, a memory allocator (think malloc()/realloc()/free()). It's not hard to produce a working (but absolutely useless) m...
**sp_depends 'StoredProcName'** will return the object name and object type that the stored proc depends on.
**sp_depends 'StoredProcName'** will return the object name and object type that the stored proc depends on. **EDIT:** I like @KG's answer better. More flexible IMHO.
I used to use underscores all the time, now I only use them for parts of a web site that I don't want anyone to directly link, js files, css, ... etc. From an SEO point of view, dashes seem to be the preferred way of handling it, for a detailed explanation, from the horses mouth <http://www.mattcutts.com/blog/das...
TextFX > TextFX Settings > Uncheck +Autoclose {([Brace
My favorite policy is "No subversion commits that do not reference tickets + Auto Trac comments for each commit": http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook
RESTful URLs, hidden fields, and session cookies are your friends.
In C or C++ I'd use the preprocessor instead of the if statements for the conditional logging.
Did lots of work in the past with EJB 2.1, glad to leave it behind. EJB value proposition remains true for 3.0, and carries a nice lightweight programming model. Transaction management, concurrency, data versioning, state management, these are non-trivial problems to solve correctly and Java EE frameworks continue t...
The best thing to help Google in this instance is to return a permanent redirect on the old URL to the new one. I'm not an ASP.NET hacker - so I can't recommend the best way to implement this - but [Googling the topic][1] looks fairly productive :-) [1]: http://www.google.co.uk/search?q=ASP.NET%20MVC%20pe...
OpenOffice has a vector drawing tool, and Inkscape is a another good one. Otherwise, you can use Graphviz (dot language) to generate such diagram out of a textual description. There are also some tools to generate such diagram out of an existing database (I first thought it was what you were asking).
Running an MVC application through IIS results in "Directory listing denied"
|visual-studio|iis|model-view-controller|webproject|
I have an .Net MVC application which runs fine if I use the build in Visual Studio Webserver. If I use the projects property pages to switch to IIS as the webserver and create a virtual directory for my project, any request I send to the server results in a "Directory listing denied" failure. Does anyone know a solu...
A "real-world" problem solved by recursion would be nesting dolls. Your function is OpenDoll() given a stack of them, you would recursilvey open the dolls, calling OpenDoll() if you will, until you've reached the inner-most doll.
Gsoap Error in C++
|gsoap|soap|c++|java|
I am using gsoap to create a soap server in C++. Messages are routed through a bus written in java. Both the server and the bus are multithreaded. Everything works well sending one message at a time through the system. If i start 3 clients each sending messages as fast as possible everything is fine for about 3500 mess...
It is technically costly to throw new exceptions, however I won't make a big debate out of that since "costly" is relative - if you're throwing 100 such exceptions a minute, you will likely not see the cost; if you're throwing 1000 such exceptions a second, you very well may see a performance hit (hence, not really wor...
The bigger the codebase the bigger the need for hierarchical namespaces. As your project gets bigger and bigger you find you need to break it out in ways to make it easier to find stuff. For instance we currently use a 2 level hierarchy. However some of the bigger portions we are now talking about breaking them ou...
For security reasons, don't provide internal system information that the user does not need. Trivial example: when failing to login, don't tell the user if the username is wrong or the password is wrong; this will only help the attacker to brute force the system. Instead, just say "Username/Password combination is i...
First upon program termination, you can assume that memory used by the process will be eliminated with the process itself. While using dispose or destructor in.net, one must understand that the time of when the dispose function is called by the GC is non-deterministic. That why it is recommended to use the using or ...
Adding and deleting files are common operations in source management. You should not have to disable it. Anyway, subversion (and any VCS actually) allows you to retrieve accidentally deleted files by doing copies or merging.
Adding and deleting files are common operations in source management. You should not have to protect you against that. Anyway, subversion (and any VCS actually) allows you to retrieve accidentally deleted files by doing copies or merging. This page from the Subversion documentation explains [how to recover deleted f...
BringToFront affects the z-order not the x/y position, I suspect you want to sort the FlowLayoutPanel.Controls collection when someone adds or deletes controls in the panel. Probably use SuspendLayout and ResumeLayout around the sorting code.
Rewrite the code. Try to find sets of statements which logically depend on each other, so that if one fails then the next ones make no sense, and hive them off into their own functions and put try-catches round them, if you want to ignore the result of that and continue.
You can set up a [pre-commit hook](http://svnbook.red-bean.com/en/1.5/svn.ref.reposhooks.pre-commit.html) on your repository to control what users can add or delete files.
The garbage collector does not only free up at program termination, otherwise it would not be really useful (on any decent/recent OS, when the process exits, all its memory is cleaned up automatically by the OS anyway). One of the big advantage of C# compared to C/C++ is that you don't have to care about freeing all...
We have CC.NET setup on our ASP.NET app. When we build the project, the ASP.NET app is pre-compiled and copied to a network share, from which a server runs the application. The server is a bit different from development box'es, and the next server in our staging environment differs even more. The difference is speci...
Single user or multi user? For single user, the answer would be [SQLite][1] For multi user (or multithread), try [MySQL][2] or [PostgreSQL][3]. [1]: http://www.sqlite.org/ [2]: http://www.mysql.com/ [3]: http://www.postgresql.org/
How do I use PowerShell to stop and start a clustered "Generic Service"?
|powershell|
How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software?
I don't know which languages you are speaking about but most of languages can use external dynamic libraries dlls/shared objects and export common functionality from this library. For example you implement function get file name in simple c lib and use acrros rest of languages. Another option will be to create co...
We hit an issue with a semi-old Sun C++ compiler and visibility of nested classes which behavior changed in the standard. This is not a reason to not do your nested class, of course, just something to be aware of if you plan on compiling your software on lots of platforms including old compilers. /Allan
Class identification is often a symptom of not well understood Polymorphism. The clients of ChildClass1 and ChildClass2 shouldn't need to distinguish between them. There's no place where any class should ask about `someObject.whoAmI()`. Whenever you have the urge to write `if someObject.whoAmI() == 'ChildCla...
I've been developing Pork.dbObject on my own. (a simple PHP orm / Active Record implementation) The main reason is that i find most orms's too heavy. The main thought of Pork.dbObejct is to be light-weight and simple to set up. No bunch of xml file, just one function call in the constructor to bind it, and an addR...
If your header files generally start with #ifndef __SOMEHEADER_H__ #define __SOMEHEADER_H__ // header contents #endif (as opposed to using #pragma once) you could change that to: #ifndef __SOMEHEADER_H__ #define __SOMEHEADER_H__ // header contents #else #pragma messa...
Availability is nice, but even cheap solutions are usually sufficient. Thing I've wanted most since I started having sites hosted: Shell access. It is a PAIN to do everything through FTP and web interfaces. Oh, and if your app has PHP/MySQL/Apache/IIS/.Net/JSP/etc version requirements, you'll want to check tho...
Use of the Exception class in c#
|.net|exception|
Errors that occur deep down in a data access layer or even higher up, (say within ADO.net operations for example) rarely make much sense to an end user. Simply bubbling these errors up to a UI and displaying them will generally achieve nothing except frustration for an end user. I have recently employed a basic tech...
I'd do it this way in SQL 2005 (uncomment the "AND" line if you only want it for a particular proc): SELECT [Proc] = SCHEMA_NAME(p.schema_id) + '.' + p.name, [Table] = SCHEMA_NAME(t.schema_id) + '.' + t.name, [Column] = c.name, d.is_selected, d.is_updated FROM sys.procedures p...
mail -r from@from.from
mail -r from@from.from -R from@from.com -r = from-addr -R = reply-to addr The author has indicated his version of mail doesn't support this flag. But if you have a version that does this works fine.
First, you can get a (free) licenses to redistribute the AIR runtime installed: See: <http://www.mikechambers.com/blog/2008/04/07/redistributing-the-adobe-air-runtime-installer/> and <http://www.adobe.com/products/air/runtime_distribution1.html#license> As far as launching an AIR application, you can lau...
If you have a finite list of possible random numbers (i.e. 1 to 100), then Kent's solution is good. Otherwise there is no other good way to do it without looping. The problem is you MUST do a loop if you get a duplicate. My solution should be efficient and the looping should not be too much more than the size of you...
I have been using *Informative*-*name*-*M*.*m*.*b*.jar Where: *M* = major version number (changed when backward compatibility is not necessarily maintained) *m* = minor version number (feature additions etc) *b* = build number (for releases containing bug fixes)
Both things have their place. Use unit tests to check the interfaces behave as expected and assertions to check that the contract is respected.
In Office 2007 apps, you can type in =lorem(n) with `n` equaling the number of paragraphs of lorem ipsum you would like generated.
If you have python available, google code has a CLI generator. [http://code.google.com/p/lorem/][1] [1]: http://code.google.com/p/lorem/
Offline lorem ipsum generator
|html|testing|lipsum|
What would be a good offline alternative of the online [Lipsum generator][1]? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs. [1]: www.lipsum.com/feed/html
What would be a good offline alternative of the online [Lipsum generator][1]? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs. [1]: http://www.lipsum.com/feed/html
[jQuery UI Datepicker][1] [ASP.NET AJAX has a good one too][2] [1]: http://marcgrabanski.com/pages/code/jquery-ui-datepicker [2]: http://www.asp.net/ajax/ajaxcontroltoolkit/samples/Calendar/Calendar.aspx
First question: Is this a planned database or a already functional one. If it already has data inside then the answer by bmdhacks is correct. If it a planned database here is the second question: Does your primary key really need to be random? If the answer is yes then use a function to create a random id from with a...
First question: Is this a planned database or a already functional one. If it already has data inside then the answer by bmdhacks is correct. If it is a planned database here is the second question: Does your primary key really **need** to be random? If the answer is yes then use a function to create a random id fro...
Textmate has a built in snippet to print this > Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehender...
I don't think the JVM does a lot of garbage collection unless it has to (i.e. it's getting to its limits). Therefore it grabs all the memory it can get, probably up to the limit set in the eclipse.ini (the -Xmx argument, set to 512MiB here). You can get a visual representation of the current heap status by checking ...
What about this: select A.pkid, B.otherId, count(A.value), count(B.value) from @a A, @b B where A.value = B.value group by A.pkid, B.otherId having count(A.value) = (select count(*) from @a AA where A.pkid = AA.pkid) and count(B.value) = (select count(*) from @b BB where B.otherId = BB.o...
The following query gives you the requested results: select A.pkid, B.otherId from @a A, @b B where A.value = B.value group by A.pkid, B.otherId having count(B.value) = ( select count(*) from @b BB where B.otherId = BB.otherId)
I really think you will benefit from establishing the following function calling coding guidelines: 1. As in all other places, be `const`-correct. 2. Only pass a value by pointer if the value 0/NULL is a valid input in the current context. - Rationale 1: As **a caller**, you see that whatever you pass in *mus...
I really think you will benefit from establishing the following function calling coding guidelines: 1. As in all other places, always be `const`-correct. 2. Only pass a value by pointer if the value 0/NULL is a valid input in the current context. - Rationale 1: As **a caller**, you see that whatever you pass ...
I really think you will benefit from establishing the following function calling coding guidelines: 1. As in all other places, always be `const`-correct. - Note: This means, among other things, that only out-values (see item 3) and values passed by value (see item 4) can lack the `const` specifier. 2. Only pa...