instruction
stringlengths
0
30k
We have an ASP.NET application that manages it's own User, Roles and Permission database and we have recently added a field to the User table to hold the Windows domain account. I would like to make it so that the user doesn't have to **physically** log in to our application, but rather would be automatically log...
I think the line you need to add to your .emacs is is (setq default-directory "C:/Documents and Settings/USER NAME/Desktop/" ) Emacs will start in your desktop that way, unless you have a file open. It will usually start in the same directory as the file in your current buffer otherwise.
JavaScript uses a simple object literal: var x = { intValue: 5, strValue: "foo" }; This constructs a full-fledged object. JavaScript uses prototype-based object orientation and provides the ability to extend types at runtime: String.prototype.doubleLength = function() { return this.length *...
Agile is the next CMM and both are fragile. The field of process and quality consulting is a good business in any industry and like the engineering folks everyone needs new buzzwords to keep the money flowing. CMM when it first came out of the SEI was a good concept based on solid academic work but it was soon picke...
If you need to do this on Win32 pre-Vista or Server 2008, look at the `GetMappedFileName(...)` function, which is one of the best kept secrets in Win32. WIth a little `C/C++-`*fu*, you can memory map a small portion of the file in question, and then pass that handle to this function. Also, on Win32, you cannot real...
> Online storage is subject to the whim of some data storage center, the security or lack of security there, and the possibility that the company folds, etc. Plus it's expensive, Not necessarily expensive (see [rsync.net][1] for example), nor insecure. You can certainly encrypt your stuff too. > and you can't gu...
How do I tell Subversion to treat a file as a binary file?
|svn|
How do I tell Subversion (svn) to treat a file as a binary file?
I'm using D in research about compile time code translation. The advanced templating combined with tuples and mixins makes code translation much easier and allows for code translation to be done during compile time without requiring a separate tool. There are some examples of physicists using D to enhance their prog...
You can still use onclick. The JSF [render kit specification](http://java.sun.com/javaee/javaserverfaces/1.2/docs/renderkitdocs/HTML_BASIC/javax.faces.Commandjavax.faces.Link.html) (see Encode Behavior) describes how the link should handle it. Here is the important part (what it renders for onclick): var a=funct...
You haven't been very specific with your question so nobody is able to give you a definitive answer, but here's an attempt to do so without demeaning you: It's quite common for graphics designers (using tools like photoshop, gimp, etc.) to participate alongside developers for both desktop and web based applications....
We once had a bug which eluded all of the regular techniques, valgrind, purify etc. The crash only ever happened on machines with lots of memory and only on large input data sets. Eventually we tracked it down using debugger watch points. I'll try to describe the procedure here: 1) Find the cause of the failu...
#include will replace its line with the literal contents of the file. If the file does not end with a newline, the line containing the #include that pulled it in will merge with the next line.
Use an std::set. Define a type for the 3d coordinate (or use a boost::tuple) that has operator< defined. When adding elements, you can add it to the set, and if it was added, do your processing. If it was not added (because it already exists in there), do not do your processing. However, if you are using doubles, be...
it depends on "recursion depth". it depends on how much the function call overhead will influence the total execution time. For example, calculating the classical factorial in a recursive way is very inefficient due to: - risk of data overflowing - risk of stack overflowing - function call overhead occupy 80% of...
IMHO The biggest misconception about TDD is that: **time spent writing and refactoring tests would be time lost.** The thinking goes like "yeah, a test suite is nice, but the feature would be complete much faster if we just coded it". When done properly, time spend writing and maintaining tests is saved multiple tim...
As noted by others, it would be useful to be more specific. I don't think you can expect there to be a library that will generate ranges according to any arbitrary order on string you can come up with. If you can simply define what the successor of any given string is, then the solutions is quite easy. That is, if y...
As noted by others, it would be useful to be more specific. I don't think you can expect there to be a library that will generate ranges according to any arbitrary order on string you can come up with. If you can simply define what the successor of any given string is, then the solutions is quite easy. That is, if y...
I can't say for sure why this is happening. But you might want to consider only having the Delete(string username) action and removing the parameter-less overload. Because string is nullable my understanding is that simply calling Account/Delete will invoke the action with a null username parameter which you can the...
I think that the new AcceptVerbsAttribute in preview 5 should be capable of directing any type of request to a designated action. Marking a method like below in theory allows handling of all verbs but I haven't explicitly tested put or delete. [AcceptVerbs("delete")] public object DoDeleteAction()
General Development Notes
|notetaking|
During a typical day programming, I implement functions in a way that I would like to remember. For instance, say I tuned a DB insert function that, when I come across the situation again, I want to find what I did to resuse. I need a place to keep the solution(what I did), and I need to find it somehow, which may be ...
|code-snippets|knowledge-management|notetaking|
To remove all columns after the one you want, this little function should work. It will remove at index 10 (remember Columns are 0 based), until the Column count is 10 or less. DataTable dt; int desiredSize = 10; while (dt.Columns.Count > desiredSize) { ...
another alternative is to bypass mencoder and use ffmpeg directly
Use Imagemagick, or better yet, Ghostscript. <http://www.ibm.com/developerworks/library/l-graf2/#N10284> has an example for imagemagick, <http://www.asmail.be/msg0055376363.html> has an example for ghostscript. I would install ghostscript and read the man page for gs to see what exact options are needed and experimen...
Without messing around with firewall rules, you can set up a ~/.ssh/config file. Assume 10.1.1.1 is the 'gateway' system and 10.1.1.2 is the 'client' system. Host gateway Hostname 10.1.1.1 LocalForward 8022 10.1.1.2:22 Host client Hostname localhost Port 8022 You ca...
I've done exactly this before and its no trivial implementation. You're going to want to look at the SecurityPermission class. [http://msdn.microsoft.com/en-us/library/system.security.permissions.securitypermission.aspx][1] I have done this before by utilizing XML (which I'm not sure I'd do again) and storing th...
Parameterized inline SQL or parameterized stored procedures is the best way to protect yourself. As others have pointed out, simply stripping/escaping the single quote character is not enough. You will notice that I specifically talk about "parameterized" stored procedures. Simply using a stored procedure is not eno...
As pilif already mentions, make sure to turn off the server-side gzip compression. For me this has caused problems with PDF files (among other types) and for maybe-not-so-obscure reasons also with .zip files both under Internet Explorer and FireFox. As far as I could tell, the last bit of the zip footer would get st...
the is operator indicates whether or not it would be 'safe' to cast one object as another obeject (often a super class). if(obj is type) if obj is of type 'type' or a subclass thereof, then the if statement will succeede as it is 'safe' to cast obj as (type)obj. see: <http://msdn.microsoft.com/en-us/librar...
Storing content in multiple languages? E.g. English, French, German
|multilingual|international|
How should I store (and present) the text on a website intended for worldwide use, with several languages? The content is mostly in the form of 500+ word articles, although I will need to translate tiny snippets of text on each page too (such as "print this article" or "back to menu"). I know there are several CMS p...
I would create a date object for the first day of the NEXT month, and then just subtract a single day from the date object.
Content served over a HTTPS connection **never gets cached** in the browser. You cannot do much about it. Usually, images in your web site are not very sensitive and are served over HTTP for this very reason.
Its been a long time since I've thought about MacOS resource forks. Are you using the classic MacOS (i.e. before MacOS X)? As I recall, <A HREF="http://developer.apple.com/documentation/macos8/DevTools/ResEditReference/reseditreference.html">ResEdit</A> was the application most often used to manipulate the resource ...
The DUAL table is a special one-row table present by default in all Oracle database installations. It is suitable for use in selecting a pseudocolumn such as SYSDATE or USER The table has a single VARCHAR2(1) column called DUMMY that has a value of "X" You can read all about it in http://en.wikipedia.org/wiki/DUA...
The real benefit of using TFS compared to a separate set of OS tool is the integration of the various flow of informations available. <br/><br/> * Create a requirement and insert into TFS<br/> * Create a set of task linking them to the requirement and assign them to the various developers<br/> * Each developer work...
LINQ to SQL actually presents some alarming performance problems in the database. Basically, it creates multiple execution plans based on the length of the parameter you are using. I posted about it a while back on my blog [LINQ to SQL may cause performance problems][1]. Now, is that to say that LINQ doesn't hav...
This needs to be clarified with a language of choice, etc. In general, most languages (WinForms, Java AWT/SWT, etc) have an image or background image property that allows you to use images for buttons. There are even skinning frameworks that will let you use images for all controls in an easy-to-define manner. If ...
This needs to be clarified with a language of choice, etc. In general, most languages (WinForms, Java AWT/SWT, etc) have an image or background image property that allows you to use images for buttons. There are even skinning frameworks that will let you use images for all controls in an easy-to-define manner. If ...
Of course, it depends. It depends upon the work that the particular stored procedure performs and, perhaps, not so much the "read/write ratio" that you suggest. In general, you should consider enclosing a unit of work within a transaction if it is query that could be impacted by some other, simultaneously running q...
Ruby on Rails uses both prototype and Scriptaculous by default, as there is little overlap between the two. I've also used yui snippets in addition to that and have never had a problem. Load times are an issue, but the libraries are usually cached, so it's only on the first page loaded.
<H2>Python CE</H2> Python port for Windows CE (Pocket PC) devices. Intended to be as close to desktop version as possible (console, current directory support, testsuite passed). [![Python CE][1]](http://pythonce.sourceforge.net/) ![alt text][2] [1]: http://pythonce.sourceforge.net/images/python-logo.jp...
Try something like this (e.g. to hide the `<li>`): function unCheckEl(id, ref) { (...) $(ref).parent().parent().hide(); // this should be your <li> } And your link: <a href="javascript:uncheckEl('tagVO-$id', \$(this))"> `$(this)` is not present inside your function, because ho...
There's also a [code metrics plugin][1] for [reflector][2], in case you are using .NET. [1]: http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=CodeMetrics&referringTitle=Home [2]: http://www.red-gate.com/products/reflector/
The benefit of making OpenID mandatory is simply that login code for the website does not need to be written (beyond the OpenID integration), and no precautions need to be taken around storing user passwords etc. Not having your own login code also means not having to deal with a lot of support issues like resetting...
Best way is to fire up profiler, start a trace, save the trace and then rerun the statements
Seeing how you use the Management Studio Express, I will assume you don't have access to the MSSQL 2005 client tools. If you do, install those, because it includes the SQL profiler which does exactly what you want (and more!). For more info about that one, see [msdn][1]. I found [this][2] a while ago, because I was ...
Best practices re: LINQ To SQL as a data access layer
|linq-to-sql|asp.net|linq|
Best practices re: LINQ To SQL for data access
|asp.net|linq|linq-to-sql|
Part of the web application I'm working on is an area displaying messages from management to 1...n users. I have a DataAccess project that contains the LINQ to SQL classes, and a website project that is the UI. My database looks like this: User -> MessageDetail <- Message <- MessageCategory MessageDetail is a joi...
If you want something truly tabular, Mr. Haren's answer is a good one. The DataGridView will give you a very Excel spreadsheet type of look. If you just want a two column layout (similar to HTML's table), then try out the TableLayoutPanel. It'll give you the layout you desire with the ability to use standard contr...
Just an update on this: I decided to go with the [Decorator pattern][1]. That is, I have one 'generic' table class that implements an IValidateableTable interface (that contains a <code>Validate()</code> method. I then created several validation decorators (that also implement IValidateableTable) that I can wrap arou...
[Paradigms of Artificial Intelligence Programming][1]: Case Studies in Common Lisp by Peter Norvig [1]: http://norvig.com/paip.html
Get the number of days for this month: <pre><code> Calendar cal = Calendar.getInstance(); cal.setTime(sampleDay.getTime()); int noOfLastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH); </pre></code> Set the Calendar to the last day of this month: <pre><code> Calendar cal = Calendar.getInstance(); cal....
How to play a standard windows sound?
|audio|winapi|
How do I find out which sound files the user has configured in the control panel? Example: I want to play the sound for "Device connected". Which API can be used to query the control panel sound settings? I see that there are some custom entries made by third party programs in the control panel dialog, so ther...
|winapi|audio|
How do I find out which sound files the user has configured in the control panel? Example: I want to play the sound for "Device connected". Which API can be used to query the control panel sound settings? I see that there are some custom entries made by third party programs in the control panel dialog, so ther...
It's not strictly a development book and I believe that I've mentioned it in another answer somewhere but it's a book I really believe all developers should read, from php to Java to assembly developers. <a href="http://www.amazon.co.uk/Code-Language-DV-Undefined-Charles-Petzold/dp/0735611319/ref=sr_1_1?ie=UTF8&s=bo...
It's quite common to just use the sendmail command from Python using os.popen Personally, for scripts i didn't write myself, I thin just using the smtp protocol is better, since it wouldn't require installing say an sendmail clone to run on windows. http://docs.python.org/lib/module-smtplib.html
The best home-usable solution I've seen was printing out the backups using a 2D barcode - the data density was fairly high, it could be re-scanned fairly easily (presuming a sheet-feeding scanner), and it moved the problem from the digital domain back into the physical one - which is fairly easily met by something like...
The easiest answer is the smtplib, you can find docs on it <a href="http://docs.python.org/lib/SMTP-example.html">here</a>. All you need to do is configure your local sendmail to accept connection from localhost, which it probably already does by default. Sure, you're still using SMTP for the transfer, but it's th...
var whatever = from x in something select new { yourString = Char.ToString(x.theChar); }
Because your expectations are wrong. IEEE requires that positive and negative zero be represented seperately. That is what you're seeing here.
cout prints "-0" instead of "0"
|c++|
#include <iostream> using namespace std; int main() { double u = 0; double w = -u; cout << w << endl; return 0; } Why does this great piece of code outputs "-0" and not "0", as one would expect?
|c++|floating-point|
For my projects, I use a combination of 1, 2, & 4. If it's really important data, you need to have multiple copies in multiple places. My important data is replicated to 3-4 locations every night. If you want a simpler solution, I recommend you get an online storage account from a well known provider which has an in...
From Wikipedia **History** The DUAL table was created by Chuck Weiss of Oracle corporation to provide a table for joining in internal views: *I created the DUAL table as an underlying object in the Oracle Data Dictionary. It was never meant to be seen itself, but instead used inside a view that was expected to...
Regardless of LINQ, I think that mixing presentation code with database-relaed code is not a good idea. I would create a simple DB abstraction layer on top of LINQ queries. In my opinion LINQ is just a convenient tool, that doesn't have a serious impact on application design.
Regardless of LINQ, I think that mixing presentation code with database-relaed code is not a good idea. I would create a simple DB abstraction layer on top of LINQ queries. In my opinion LINQ is just a convenient tool, that doesn't have a serious impact on traditional application design.
Microsoft T-SQL to Oracle PL/SQL translation
|oracle-database|plsql|t-sql|sql|
I've worked with T-SQL for years but i've just moved to an organisation that is going to require writing some Oracle stuff, probably just simple CRUD operations at least until I find my feet. Is there are tool or utility avialable to easily translate T-SQL into PL/SQL, a keyword mapper is the sort of thing I'm looking ...
|sql|oracle-database|t-sql|plsql|
I've worked with T-SQL for years but i've just moved to an organisation that is going to require writing some Oracle stuff, probably just simple CRUD operations at least until I find my feet. I'm not going to be migrating databases from one to the other simply interacting with existing Oracle databases from an Applicat...
I've worked with T-SQL for years but i've just moved to an organisation that is going to require writing some Oracle stuff, probably just simple CRUD operations at least until I find my feet. I'm not going to be migrating databases from one to the other simply interacting with existing Oracle databases from an Applicat...
There is various tools out there that you can use, I haven't used any of them myself though so I've got no comments to make about them, but another "trick" that you can use is to create a trigger on DDL events, so you can basically capture (to a table, or log file or whatver) any changes done between deployments. [D...
Setting Up MySQL Triggers
|mysql|triggers|
I've been hearing about triggers, and I have a few questions.<br /> What are triggers?<br /> How do I set them up?<br /> Are there any precautions, aside from typical SQL stuff, that should be taken?
A lot of the time you can merely append the lowercase namespace reference to the domain: http://msdn.microsoft.com/en-us/library/**system.windows.application_events.aspx** Moreover, for say the .Net 2.0 version (or any specific version) you can add "(VS.80)": http://msdn.microsoft.com/en-us/library/system.wind...
A lot of the time you can merely append the lowercase namespace reference to the domain: http://msdn.microsoft.com/en-us/library/system.windows.application_events.aspx Moreover, for say the .Net 2.0 version (or any specific version) you can add "(VS.80)": http://msdn.microsoft.com/en-us/library/system....
It depends on the type of information you meant. The answers above contain most of the tools. But if you use ms office you shall explore Office OneNote.
I'm not sure about hidden, but there are some [interesting][1] ['tricks'][2] that probably aren't obvious from just reading the spec. [1]: http://en.wikipedia.org/wiki/Duff%27s_device [2]: http://en.wikipedia.org/wiki/Template_metaprogramming
A little known trick is to add these attributes to your usercontrol or window: xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="600" T...
For Blend, a little known trick is to add these attributes to your usercontrol or window: xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="...
Microsoft has a research project called [Volta][1] which, amongst other things, compiles msil to JavaScript. > a developer toolset for building > multi-tier web applications using > existing and familiar tools, > techniques and patterns. Volta’s > declarative tier-splitting enables > developers to postpone arch...
On my last project I used [SourceMonitor][1]. It' very nice free tool for code metrics analysis. For .NET beside NDepend which is a simply best tool, I can recommend [vil][2] Following tools can perform trend analysis: - [CAST][3] - [Klocwork Insight][4] [1]: http://www.campwoodsw.com/sm20.html ...
On my last project I used [SourceMonitor][1]. It' very nice free tool for code metrics analysis. For .NET beside NDepend which is simply the best tool, I can recommend [vil][2] Following tools can perform trend analysis: - [CAST][3] - [Klocwork Insight][4] [1]: http://www.campwoodsw.com/sm20.html ...
On my latest project I used [SourceMonitor][1]. It' very nice free tool for code metrics analysis. For .NET beside [NDepend][2] which is simply the best tool, I can recommend [vil][3] Following tools can perform trend analysis: - [CAST][4] - [Klocwork Insight][5] [1]: http://www.campwoodsw.com/sm20...