instruction
stringlengths
0
30k
|schema|normalizing|microformats|hcard|vcf-vcard|
I need to store contact information for users. I want to present this data on the page as an [hCard][1] and downloadable as a [vCard][2]. I'd also like to be able to search the database by phone number, email, etc. What do you think is the best way to store this data? Since users could have multiple addresses, etc ...
Best version control system for managing home directories
|linux|version-control|
I have 3 Linux machines, and want some way to keep the dotfiles in their home directories in sync. Some files, like .vimrc, are the same across all 3 machines, and some are unique to each machine. I've used SVN before, but all the buzz about DVCSs makes me think I should try one - is there a particular one that woul...
The [List::MoreUtils][1] module has a zip/mesh function that should do the trick. Here is the source of the mesh function: sub mesh (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@) { my $max = -1; $max < $#$_ && ($max = $#$_) for @_; map { my $ix = $_; ma...
Just to clarify: You are looking for names of fonts that will make your website-design look similar to Windows and Mac OS X when viewed under Linux, you are not looking to design new fonts, correct? (I read your question in the same way that Jason Navarrete did, so at least two people misunderstood your question.) ...
The most important thing is to always be consistent in when you escape. Accidental double sanitizing is lame and not sanitizing is dangerous. For SQL, just make sure your database access library supports bind variables which automatically escapes values. Anyone who manually concatenates user input onto SQL strings s...
The result of `M-x describe function RET frame-parameter` is > frame-parameter is a built-in > function. > > (frame-parameter FRAME PARAMETER) > > Return FRAME's value for parameter > PARAMETER. If FRAME is nil, describe > the currently selected frame. Also, have a look in the Elisp info manual for ...
>Without her input, I started the Scrum practices (daily scrums, burndown charts and other things I've found that worked for me and my previous teams (ala H. Kniberg's cool wall chart). During out daily stand up she slinks by and ignores us as if we actually weren't standing right outside her door (we are actually). It...
How about **covariant return types** which have been in place since JDK 1.5? They are pretty poorly publicised, as it is a rather unsexy addition, but as I understand it were absolutely necessary for generics to work. Essentially, the compiler now allows a subclass to narrow the return type of an overridden metho...
How about **covariant return types** which have been in place since JDK 1.5? It is pretty poorly publicised, as it is an unsexy addition, but as I understand it, is absolutely necessary for generics to work. Essentially, the compiler now allows a subclass to narrow the return type of an overridden method to be a ...
Use... System.IO.Path.GetDirectoryName(saveDialog.FileName) (and the corresponding System.IO.Path.GetFileName). The Path class is really rather useful.
You can only make DNS name pont to a different IP address, so if You you are using virtual hosts redirecting with DNS won't work. When you enter subdomain.hostone.com in your browser it will use DNS to get it's IP address (if it's a CNAME it will continue trying until it gets IP from A record) then it will connect t...
You can do this a number of non-DNS ways. The landing page at subdomain.hostone.com can have an [HTTP redirect](http://www.activejump.com/o-6.shtml). The webserver at hostone.com can be configured to redirect (easy in Apache, not sure about IIS), etc.
There is a book called *Code*. I can't remember who wrote it, but it goes through the basics of a lot of stuff that we (programmers) know and take for granted that people we talk to know also. Everything from how do you count binary to how processors work. It doesn't have anything dealing with programming languages ...
Another interesting find is the presence of assemblies here: > C:\Program Files\Reference > Assemblies\Microsoft\Framework\v3.5 You'd think Microsoft would build a check for "latest version" into the framework.
Another good resource I found: <http://www.walkernews.net/2008/05/16/how-to-check-net-framework-version-installed/>
A good resource I found: <http://www.walkernews.net/2008/05/16/how-to-check-net-framework-version-installed/>
Burn it to a DVD and install it from there. Also remove any development software that you don't need from Visual Studio, such as C++, VB.NET, Crystal Reports, etc.
I find Geany ([http://geany.uvena.de/][1]) quite good. [1]: http://geany.uvena.de/
Plugin Capability
|plugins|extensibility|
Is there a general procedure for programming extensibility capability into your code? I am wondering what the general procedure is for adding extension-type capability to a system you are writing so that functionality can be extended through some kind of plugin API rather than having to modify the core code of a sys...
Adding Plugin Capability?
Where I work we use [RedGate Data Generator][1] to generate test data. Since we work in the banking domain. When we have to work with nominative data (Credit card numbers, personnal ID, phone numbers) we developped an application who can *mask* these database fields so we can work with them as real data. I can sa...
This morning, I was reading [Steve Yegge's: When Polymorphism Fails][1], when I came across a question that a co-worker of his used to ask potential employees when they came for their interview at Amazon. > As an example of polymorphism in > action, let's look at the classic > "eval" interview question, which (as...
This morning, I was reading [Steve Yegge's: When Polymorphism Fails][1], when I came across a question that a co-worker of his used to ask potential employees when they came for their interview at Amazon. > As an example of polymorphism in > action, let's look at the classic > "eval" interview question, which (as...
It looks like you can't embed `<object>` tags in a richtext field. I'm getting nothing when I do it. But thanks anyway Jason. Any other ideas?
One workaround might be, throw a new list of KeyValuePair from the Dictionary to keep the original unmodified. var dict = new Dictionary<string, string>(); dict.Add("Hello", "World"); dict.Add("The", "Quick"); dict.Add("Brown", "Fox"); var dictCopy = dict.Select( item => new KeyV...
How do I store information in my executable in .Net
|c#|.net|
I'd like to bind a configuration file to my executable. I'd like to do this by storing an MD5 hash of the file inside the executable. This should keep anyone but the executable from modifying the file. Essentially if someone modifies this file outside of the program the program should fail to load it again.
I'd like to bind a configuration file to my executable. I'd like to do this by storing an MD5 hash of the file inside the executable. This should keep anyone but the executable from modifying the file. Essentially if someone modifies this file outside of the program the program should fail to load it again. EDIT:...
Make sure you have the following set on the UpdatePanel: ChildrenAsTriggers=false and UpdateMode=Conditional
Is there a built in way in .Net AJAX to manually serialize an object to a JSON string?
|.net-2.0|asp.net|json|serialization|vb.net|
I've found [`ScriptingJsonSerializationSection`][1] but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since .Net can do it on the fly with the `<System.Web.Services.WebMethod()>` and `<System.Web.Script.Services.ScriptMethod()>` attributes so there must be a b...
I've found [`ScriptingJsonSerializationSection`][1] but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since .Net can do it on the fly with the `<System.Web.Services.WebMethod()>` and `<System.Web.Script.Services.ScriptMethod()>` attributes so there must be a b...
"The system cannot find the file specified" when invoking subprocess.Popen in python
|python|svnmerge|
I'm trying to use svnmerge.py to merge some files. Under the hood it uses python, and when I use it I get an error - "The system cannot find the file specified". Colleagues at work are running the same version of svnmerge.py, and of python (2.5.2, specifically r252:60911) without an issue. I found [this link][1], ...
The svnbook has a section on how Subversion allows you to revert the changes from a particular revision without affecting the changes that occured in subsequent revisions: [http://svnbook.red-bean.com/en/1.4/svn.branchmerge.commonuses.html#svn.branchmerge.commonuses.undo][1] I don't use Eclipse much, but in Torto...
How can I store user-tweakable configuration in app.config?
|c#|.net|app-config|
I know it is a good idea to store configuration data in app.config (e.g. database connection strings) instead of hardcoing it, even if I am writing an application just for myself. But is there a way to update the configuration data stored in app.config from the program that is using it?
This morning, I was reading [Steve Yegge's: When Polymorphism Fails][1], when I came across a question that a co-worker of his used to ask potential employees when they came for their interview at Amazon. > As an example of polymorphism in > action, let's look at the classic > "eval" interview question, which (as...
This [Introduction to Oracle Advanced Queuing](http://www.stanford.edu/dept/itss/docs/oracle/9i/appdev.920/a96587/qintro.htm#65422) states that you can interface to it through "Internet access using HTTP, HTTPS, and SMTP" so it should be straightforward to do that using a Perl script.
I have not done it against database yet, your question is kinda open. If you want to search an db, and can choose to use Lucene, I also guess that you can control when data is inserted to the database. If so, there is little reason to poll the db to find out if you need to reindex, just index as you insert, or crea...
There's a good set of slides on Ruby Blocks as part of the "Rails with Passion" course: [Ruby_Blocks.pdf][1] This covers representing a block, how they get passed arguments and executed, and even further into things like Proc objects. It's very clearly explained. It might then be of interest to look at how th...
That's an interesting problem because I suppose it depends on the quantity of each length you're producing. If they are all the same quantity and you can get Each different length onto one 5m extrusion then you have the optimum soloution. However if they don't all fit onto one extrusion then you have a greater probl...
From [Wikipedia on UTF-8][1]: <blockquote> UTF-8 (8-bit UCS/Unicode Transformation Format) is a <strong>variable-length character encoding for Unicode. It is able to represent any character in the Unicode standard</strong>, yet the initial encoding of byte codes and character assignments for UTF-8 is backwards compa...
Unfortunately your question is a little like "Should I use a sandwich or a cement mixer". HttpHandlers and User controls are completely different things. HttpHandlers are used to process HTTP requests. For example, if you wanted to dynamically create an RSS feed, you could write an HTTP handler that handles all re...
This is a classic, difficult problem to solve efficiently. The algorithm you describe sounds like a [Greedy Algorithm][1]. Take a look at this Wikipedia article for more information: [The Cutting Stock Problem][2] [1]: http://en.wikipedia.org/wiki/Greedy_algorithm [2]: http://en.wikipedia.org/wiki/Cutting_sto...
Even an Asp.Net page is an HttpHandler. public class Page : TemplateControl, IHttpHandler A user control actually resides within the asp.net aspx page.
I haven't found a _simple_ way to do this yet, but I found [this site][1] helpful a few months back. O'Reilly also published a book called Network Security Hacks (available on Safari) that has a section starting at Hack #45 on creating your own certificate authority. [1]: http://www.herongyang.com/crypto/open...
where is silverlight executed? Is there any reason at all to send an complete picture to the client to make the client crop it? Do it on the server... (if you are not creating an image editor that is..)
Having a `favicon.*` in your root directory is automatically detected by most browsers. You can ensure it's detected by using: <link rel="icon" type="image/png" href="/path/image.png" /> Personally I use .png images but most formats should work.
[Wikipedia to the rescue][1] [1]: http://en.wikipedia.org/wiki/Favicon
If you need the numeric values, here's the quickest way: (dog,cat,rabbit) = range(0,3)
[pgfouine][1] works fairly well for me. And it looks like there's a [FreeBSD port][2] for it. [1]: http://pgfouine.projects.postgresql.org/ [2]: http://portsmon.freebsd.org/portoverview.py?category=databases&portname=pgfouine
You are optimizing the wrong thing, both of those should be so fast that you'll have to run them billions of times just to get any measurable difference. And just about anything will have much greater effect on your performance, for example, if the values you are swapping are close in memory to the last value you to...
With Appliance, we normally think about something like this: http://www.garghouti.co.uk/vmTrac/ There is not much info about versions and such though. But as others have pointed out, it is dead easy to install svn and svndeamon on an server that already exists, Svn takes very little resources, and can easily be ...
Well, the first thing to do is try all your queries from psql using "explain" and see if there are sequential scans that can be converted to index scans by adding indexes or rewriting the query. Other than that, I'm as interested in the answers to this question as you are.
For me, VisualSVN is pretty, but useless. AnkhSvn on the other hand, after it came in v2 as an scc provider, it works very good. VisualSVN tries to think for you, which is not an good thing, the user should be the controller, not the software.
If you're using multiple threads, the operating system will automatically take care of using multiple cores.
I use .ico format and put the following two lines within the `<head>` element: <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
Non-Temporal SSE instructions (MOVNTI, MOVNTQ, etc.), don't follow the normal cache-coherency rules. Therefore non-temporal stores must be followed by an SFENCE instruction in order for their results to be seen by other processors in a timely fashion. When data is produced and not (immediately) consumed again, the f...
Any DVCS would likely work fine. My favorite is [Bazaar](http://bazaar-vcs.org/). It would be easiest to keep your config files in .config, version that, and then symlink as appropriate. A benefit of DVCS is that you can version the per-machine config files as well, without interfering with versioning global configs...
This would be an interesting project (has anyone done it already?) I presume you'd give the tool your jar(s) as a starting point, and the library jar to clean up. It could use reflection to determine which classes your jar(s) reference directly, and which are used indirectly down the call tree (this is not trivial ...
I like vmware. One nice feature is that it runs on multiple host OS's, so you can move your guest OS onto a linux server or a windows desktop as you like.
Version control software isn't really great for home directories. Worse, some software doesn't really like the .svn folders or starts to interpret their contents. You could of course try to fix this with some very complex mirroring setup, but that's hard.
You <i>can</i>, but probably don't want to, set the document root on a per-file basis in the <tt>head</tt> of your file: <pre> &lt;base href="my-root"&gt; </pre>
Hmm.. in Opera at least you can register your own protocol handlers.. i.e. I can map 'smb' to 'nautalis' which means clicking smb://computer/share actually works. [Summary of how it works in Firefox][1]. [1]: http://kb.mozillazine.org/Register_protocol
Hmm.. in Opera at least you can register your own protocol handlers.. i.e. I can map 'smb' to 'nautalis' which means clicking smb://computer/share actually works. [Summary of how it works in Firefox][1] (although it looks like it may be a bit of fail as they have a whitelist of allowed protocols. Would not be surpri...
Hmm, protocol handlers look interesting. As [Mark][1] said, in Windows protocol handlers can be dealt with at the OS level Protocol handlers can also be done at the browser level (which is preferred, as it is cross platform and doesn't involve installing anything). [Summary of how it works in Firefox][2] [S...
Seems odd to me why you'd want to store the same object both server side and client side - especially if you're comparing them on each trip. I'd guess that deserializing the cookie and comparing it to the server side object would be equivalent in performance to just serializing the object again. But, if you wante...
If you use the Settings for the project, you can mark each setting as either application or user. If they're set as user, they will be stored per-user and when you call the Save method it will be updated in the config for that user. Code project has a really detailed article on saving all types of settings: http:...
app.config isn't what you want to use for user-tweakable data, as it'll be stored somewhere in Program Files (which the user shouldn't have write permissions to). Instead, settings marked with `a UserScopedSettingAttribute` will end up in a user-scoped .config file somewhere in %LocalAppData%. I found the best way t...
It's a bug, see the [documentation of `subprocess.Popen`][1]. There either needs to be a `"shell=True`" option, or the first argument needs to be a sequence `['svn', '--version']`. As it is now, `Popen` is looking for an executable named, literally, "svn --version" which it doesn't find. [1]: http://docs.python....
It's a bug, see the [documentation of `subprocess.Popen`][1]. There either needs to be a `"shell=True`" option, or the first argument needs to be a sequence `['svn', '--version']`. As it is now, `Popen` is looking for an executable named, literally, "svn --version" which it doesn't find. I don't know why it would wo...
Check out the [F# Developer Center][1]. There is also [hubFS][2], a forum dedicated to F#. [1]: http://msdn.microsoft.com/en-gb/fsharp/default.aspx [2]: http://cs.hubfs.net/forums/default.aspx
It's open source - use the source, Luke. Look in wp-admin/js/theme-preview.js
Currying is a transformation that can be applied to functions to allow them to take one less argument than previously. For example, in F# you can define a function thus:- let f x y z = x + y + z Here function f takes parameters x, y and z and sums them together so:- f 1 2 3 Returns 6. From our...
Expect a better answer (probably before I finish typing this) but as a quick summary. A user control is something that can be added to a page. A HttpHandler can be used instead of a page.
The GoF Command Pattern supports undoable operations. I think the same pattern can be used for sequential operations (sequential commands).
Basically a user control is a piece of server logic and UI. An HTTP Handler is only a piece of logic that is executed when a resource on your server is requested. For example you may decide to handle requests for images sent to your server through your own handler and serve images from a database instead of the file sy...
ADO.NET Mapping From SQLDataReader to Domain Object?
|ado.net|
I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping as is, I get the "System.IndexOutOfRangeException" exception and wanted ...
How do I declare a list of fixed length in specman?
|specman|
In E (specman) I want to declare variables that are lists, and I want to fix their lengths. It's easy to do for a member of a struct: thread[2] : list of thread_t; while for a "regular" variable in a function the above doesn't work, and I have to do something like: var warned : list of bool; ...
|asp.net|vb.net|.net-2.0|serialization|json|
I've found [`ScriptingJsonSerializationSection`][1] but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since .Net can do it on the fly with the `<System.Web.Services.WebMethod()>` and `<System.Web.Script.Services.ScriptMethod()>` attributes so there must be a b...
I'm a java developer but i think this is the same for c#. I never expose a private collection property because other parts of the program can change it without parent noticing, so that in the getter method i return an array whith the objects of the collection and in the setter method i call a clearAll() over the col...
Out of pure curiosity, what's your reasoning for never wanting to load the file if it's been changed? Why not just keep all of the configuration information compiled in the executable? Why bother with an external file at all?
Out of pure curiosity, what's your reasoning for never wanting to load the file if it's been changed? Why not just keep all of the configuration information compiled in the executable? Why bother with an external file at all? ***Edit*** I just read your edit about this being a credit card info program. That ...
It looks like using the Profiler is going to work. Once I've let it run for a while, I should have a good list of used tables. Anyone who doesn't use their tables every day can probably wait for them to be restored from backup. Thanks, folks.
First, we have check-in (smoke) tests that must run before code can be checked in. It's done automatically by running a job that runs the tests and then makes the check-in to source control upon successful test completion. Second, cruise control kicks off build and regression tests. The product is built then several se...