instruction
stringlengths
0
30k
|regex|asp.net|
I want an expression that will fail when it encounters words such as "boon.ini" and "http". The goal would be to take this expression and be able to construct for any set of keywords.
|regex|
What about something like this: $result = mysql_query("SELECT COUNT(id) AS total_things from table"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $num_results = $row["total_things"];
The aforementioned algorithms are cryptographically secure hashing algorithms (but MD5 isn't considered to be secure today). However there are algorithms, that specifically created to derive keys from passwords. These are the <a href="http://en.wikipedia.org/wiki/Key_derivation_function">key derivation functions</a>...
in Eclipse i use CTRL + D to delete a single line (or a couple) for many lines i'll select them with the mouse or with SHIFT + ARROW then press the delete key.
On Mac OS X you can use Ctrl + L to clear the IRB screen.
On Mac OS X or Linux you can use Ctrl + L to clear the IRB screen.
Regular expression tp convert mark down to HTML
|regular-expressions|markdown|html|
How would you write a regular expression to convert mark down into HTML? For example, you would type in the following: This would be *italicized* text and this would be **bold** text This would then need to be converted to: This would be <em>italicized</em> text and this would be <strong>bold</strong>...
Regular expression to convert mark down to HTML
|c#|html|markdown|regular-expressions|
How would you write a regular expression to convert mark down into HTML? For example, you would type in the following: This would be *italicized* text and this would be **bold** text This would then need to be converted to: This would be <em>italicized</em> text and this would be <strong>bold</strong>...
|c#|html|regex|markdown|
Rather than negating the result within the expression, you should do it in your code. That way, the expression becomes pretty simple. \b(boon\.ini|http)\b Would return `true` if boon.ini or http was anywhere in your string. It won't match words like httpd or httpxyzzy because of the `\b`, or word boundaries. ...
Where does this image "live?" Is it accessible in the local file system or on the web? If so, would suggest having your WebService accepting a URI (can be a URL or a local file) and opening it as a Stream, then using a StreamReader to read the contents of it. Example: [OperationContract] public static vo...
Where does this image "live?" Is it accessible in the local file system or on the web? If so, I would suggest having your WebService accepting a URI (can be a URL or a local file) and opening it as a Stream, then using a StreamReader to read the contents of it. Example: [OperationContract] public static ...
Where does this image "live?" Is it accessible in the local file system or on the web? If so, I would suggest having your WebService accepting a URI (can be a URL or a local file) and opening it as a Stream, then using a StreamReader to read the contents of it. Example: using System.Drawing; using System...
def sortedDict(dictobj): return (value for key, value in sorted(dictobj.iteritems())) This will create a single intermediate list, the 'sorted()' method returns a real list. But at least it's only one.
A nice scripting language is always a good tool to have on you belt. See [Ruby](http://www.ruby-lang.org/en/), or [Python](http://www.python.org/).
I believe that strating point is with Distributed version control system (like mercurial or git). There are some advandtages of using it : 1. You don't need to setup central repository (it rquires tedious server setup) 2. You can share changesets (revisions) with your friends by using email or other method, and i...
You might be able to use the xsd.exe tool to generate a class, otherwise you probably have to implement a custom solution against your XML [XML Schema Definition Tool][1] [XML Serialization][2] [1]: http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.80).aspx [2]: http://msdn.microsoft.com/en-us/library...
Opera has [Dragonfly][1], though I still prefer Firebug. Before Firebug there was [Venkman][2], though it's future is uncertain at this point. [1]: http://www.opera.com/products/dragonfly/ [2]: http://www.mozilla.org/projects/venkman/
run checkdb to find out why it's been marked as suspect and see if it can be recovered without any data loss (win)
I will recommend Subversion or Visual Studio Team Foundation Systems depending on how much money you are willing to shell out. Check out Visual SVN (Subversion for die-hard VS fans) - it integrates nicely with Visual Studio: http://www.visualsvn.com/
Is there a Macro Recorder for Eclipse?
|java|eclipse|ide|editor|macros|
Anybody know of a good eclipse plugin for recording and playing back macros? I've tried <a href="http://www.bdaum.de/eclipse/">this one</a>, but it didn't do me any good- seemed like it wasn't ready for primetime. I know about editor templates, but I'm looking for something that I can use to record my keystrokes and...
dsm: there are a couple of odd things about your code [here][1]. Note that (loop for x from 1 to 100000 for y from 1 to 100000 do collect `(,x . ,y)) is equivalent to: (loop for x from 1 to 100 collecting (cons x x)) which probably isn't quite what you intended. Note three t...
The compiler might not be evaluating the arguments in the order you'd expect.
It's a Y2K thing, only the years since 1900 are counted. There are potential compatibility issues now that getYear() has been deprecated in favour of getFullYear() - from [quirksmode](http://www.quirksmode.org/js/introdate.html): >To make the matter even more complex, date.getYear() is deprecated nowadays and you s...
It's a [Y2K](http://en.wikipedia.org/wiki/Y2K) thing, only the years since 1900 are counted. There are potential compatibility issues now that getYear() has been deprecated in favour of getFullYear() - from [quirksmode](http://www.quirksmode.org/js/introdate.html): >To make the matter even more complex, date.getYea...
It's a [Y2K](http://en.wikipedia.org/wiki/Y2K) thing, only the years since 1900 are counted. There are potential compatibility issues now that <code>getYear()</code> has been deprecated in favour of <code>getFullYear()</code> - from [quirksmode](http://www.quirksmode.org/js/introdate.html): >To make the matter even...
The user name you've indicated in your post is what the Network Service account on one machine looks like to other machines, ie "DOMAIN\MACHINENAME$". If you are connecting from IIS6 on one machine to SQL Server on another machine and you are using Network Service for the application pool's process identity then ...
Is the issuer's certificate present in the X509Store? A certificate is only valid if it's signed by someone you trust. Is this a certificate from a real CA, or one that you signed yourself? Certificate signing tools often used by developers, like OpenSSL, don't add some important extensions by default.
That is a tricky one. What generally works for me is to run "script/console production" on the production server, and type in: `Announcement` That will usually give you a better error message. But you said you already tried that?
As others have pointed out, every string concatenation in VB will alocate a new string and then copy the data over and then deallocate the original once it can. In a loop this can cause issues. To workz around this you can create a simple StringBuilder class like this one: Option Explicit Private da...
As others have pointed out, every string concatenation in VB will allocate a new string and then copy the data over and then de-allocate the original once it can. In a loop this can cause issues. To work around this you can create a simple StringBuilder class like this one: Option Explicit Private d...
How to get a Flex project to load a plugin at runtime?
|apache-flex|plugins|ria|
I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runtime? Ideally I'd like to be able to load a plugin from ...
Where does this image "live?" Is it accessible in the local file system or on the web? If so, I would suggest having your WebService accepting a URI (can be a URL or a local file) and opening it as a Stream, then using a StreamReader to read the contents of it. Example (but wrap the exceptions in FaultExceptions, an...
Basically it depends on the pattern you need to use. If you have several threads writing and reading the same place you can use the same data structure that you would have used with a single thread (hastable, array, etc.) with a lock/monitor or a ReaderWriterLock to prevent race conditions. In case you need to pass d...
Add a reference to Microsoft.VisualBasic and a using Microsoft.VisualBasic.Devices. The ComputerInfo class has all the information that you need.
Well, yeah, that's what it does. I use it for members that are modified by methods that do not *logically* change the state of a class - for instance, to speed up lookups by implementing a cache: class CIniWrapper { public: CIniWrapper(LPCTSTR szIniFile); // non-const: logically m...
Extract the data from the header using some sort of substring or regular expression. Parse the date with a SimpleDateFormatter to create a Date object.
You could easily have a box read "Search" then when the focus is changed to it have the text be removed. Something like this: ` <input onfocus="this.value=''" type="text" value="Search" /> ` Of course if you do that the user's own text will disappear when they click. So you probably want to use something more...
The best way is to wire up your javascript events using some kind of javascript-library like jQuery or YUI and put your code in an external .js-file. But if you want a quick-and-dirty solution this is your inline HTML-solution: <input type="text" id="textbox" value="Search" onclick="if(this.value=='S...
Use a background image to render the text : input.foo { } input.fooempty { background-image: url("blah.png"); } then all you have to do is detect value == 0 and apply the right class <input class="foo fooempty" value="" type="text" name="bar" /> and the jQuery javascript looks likethis ...
This will depend on the database but for SQL Server, this could be achieved as follows: alter table Example add NewColumn int identity(1,1)
You will need to use one of the HTTP bindings. The TCP binding requires WCF to be on both sides.
you want to assign something like this to onfocus: if (this.value == this.defaultValue) this.value = '' this.className = '' and this to onblur: if (this.value == '') this.value = this.defaultValue this.className = 'placeholder' (you can use something a bit cleverer, like a framework functi...
That is known as a textbox watermark, and it is done via JavaScript. - [http://naspinski.net/post/Text-Input-Watermarks-using-Javascript-(IE-Compatible).aspx][1] or if you use jQuery, a much better approach: - [http://jiles.fairweatherhonesty.com/?page_id=8][2] [1]: http://naspinski.net/post/Text-Inpu...
Just using an ALTER TABLE should work. Add the column with the proper type and an IDENTITY flag and it should do the trick Check out this MSDN article <http://msdn.microsoft.com/en-us/library/aa275462(SQL.80).aspx> on the ALTER TABLE syntax
Based on a similar post loacated at at [Egg Head Cafe][1], it looks like the Management Studio will thrown an exception if there are too many columns included explicitly in the query. Select * returns them implicitly, so there doesn't seem to be an issue. I have over 800 columns in this table, so I'm sure this is th...
NIH is not necessarily a bad thing. It can be good when the application has some very personal traits and you want it to be as convenient for you as possible, screw the generality. I've also rolled my own utility (a Perl script) for this purpose a few years ago, and I'm using it both and home and at work for backup...
You can call a method to get the content type. http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#getContentType()
You can call a method to get the content type. http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#getContentType() Inside your servlet just make this check: if (request.getContentType().equals("multipart/form-data") << code block >>
You can call a method to get the content type. http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#getContentType() According to http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2, the content type will be "multipart/form-data". So, inside your servlet just make this check...
We are all on the same OS here for this, I am investigating the possibility that some update sent out in the last maintenance window has caused this, as it wasn't a problem before this and there have been no new releases of the software in that time period. Tried in on lot's of machines, same issue on them all. ...
It's not possible unless you store the keys in a separate list for referencing later.
I have no Dabo experience at all but this question is on the top of the list fo such a long time that I decided to give it a shot: Framework selection ------------------- Assumptions: ---------------------------------------- 1. medium-to-big project: we're talking about a team of more than 20 people working...
Get a Kinesis Essential keyboard. Keys are laid out better for faster typing.
The simplest option would be creating a table with a row per list item, a column for the item position, and columns for other data in the item. Then you can use ORDER BY on the position column to retrieve in the desired order. If you want to manipulate the list while it's in the database, eg insert, delete, reorder ite...
The simplest option would be creating a table with a row per list item, a column for the item position, and columns for other data in the item. Then you can use ORDER BY on the position column to retrieve in the desired order. create table linked_list ( list_id integer not null , position integ...
What are some good techniques to convert an Ms Access application to a .Net Application?
|ms-access|legacy|
We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the "logic", forms and reports are in Access. After experiencing the massive amounts of maintenance sludge it took to turn inventory transactions from non-temp...
I work in a large J2EE web environment. We have several databases that may be connected to in a single request. We began getting logical deadlocks in some of our applications. The issue was that as follows: 1. User would request page 2. Server connects to DB 1 3. Server Selects on DB 1 4. Server "closes" c...
I think in this case you need to use a form. The card payment companies web site needs to be visited by the user's browser, not your server-side code. Yes, 3dsecure etc, are quite annoying to integrate with, but they do provide a real security boost - use it as it's intended.
For documentation on Perl builtins and standard modules, [perldoc.perl.org][1] is an web version of the Perl docs with pretty colors and such. I use a keyword bookmark, `pd` for this. For finding modules, [search.cpan.org][2] is the place to go; for this I use the keyword `pm`. When you have a question that requ...
Are locks unnecessary in multi-threaded Python code because of the GIL?
|python|multithreading|locking|
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect? sorry if this is a dumb qu...
Regular expression to match only the first file in a RAR file set
|regexp|rar|unrar|ruby|
To see what file to invoke the unrar command on, one needs to determine which file is the first in the file set. Here are some sample file names, of which - naturally - only the first group should be matched: yes.rar yes.part1.rar yes.part01.rar yes.part001.rar no.part2.rar no.p...
|regexp|rar|ruby|
|ruby|regular-expressions|rar|
|ruby|regex|rar|
as an addition to Steve's answer: Span to any host—‘-H’ The ‘-H’ option turns on host spanning, thus allowing Wget's recursive run to visit any host referenced by a link. Unless sufficient recursion-limiting criteria are applied depth, these foreign hosts will typically link to yet more hosts, and so on until Wge...
^(?:(?!boon.ini|http).)*$\r?\n? (taken from RegexBuddy's library) will match any line that does not contain boon.ini and/or http. Is that what you wanted?
What’s the current state of closures in Java?
|java|closures|
Does anybody know, if closures will be in Java 7?
According to the [MySQL documentation][1] this is most efficient if you're using a MyISAM table (which is the most usual type of tables used): $result = mysql_query("SELECT COUNT(*) FROM table"); Otherwise you should do as Wayne stated and be sure that the counted column is indexed. [1]: http://dev.mysql.com...
Some would call this a matter of taste, but: foo && bar && bar(foo); // same as: if (foo && bar) { bar(foo) } aWizz = wizz || "default"; // same as: if (wizz) { aWizz = wizz; } else { aWizz = "default"; } The trinary operator can be chained to act like Scheme's (cond ...): (cond (predicate (...
|sql-server|
Best way to connect To Sql Server with MFC
|mssql|mfc|
Soooo, I am starting this new job soon where most of the code is legacy MFC. The end goal is to convert/rewrite to C#. I'm a little rusty with MFC so writing some code so I can try and spark my memory. Anyway, was wondering the best way to connect to a SS2005 database with MFC. Back in the day CDatabase via ODBC wa...
|sql-server|mfc|
Automatically measure all SQL queries
|mssql|optimization|
In [Maybe Normalizing Isn't Normal](http://www.codinghorror.com/blog/archives/001152.html) Jeff Atwood says, "You're automatically measuring all the queries that flow through your software, right?" I'm not but I'd like to. What's the best way to do this with an ASP.NET + MS SQL Server application?
In [Maybe Normalizing Isn't Normal](http://www.codinghorror.com/blog/archives/001152.html) Jeff Atwood says, "You're automatically measuring all the queries that flow through your software, right?" I'm not but I'd like to. Some features of the application in question: * ASP.NET * a data access layer which dep...
|sql-server|optimization|
Query times out from web app but runs fine from management studio
|sql|mssql|