instruction
stringlengths
0
30k
This is a very decent article on EF http://www.codeguru.com/csharp/.net/net_general/netframeworkclasses/article.php/c15489/
VARCHAR(255). It won't use all 255 characters of storage, just the storage you need. It's 255 and not 256 because then you have space for 255 plus the null-terminator (or size byte). The "N" is for Unicode. Use if you expect non-ASCII characters.
IIRC, 255 is the max size of a varchar in MySQL before you had to switch to the text datatype, or was at some point (actually, I think it's higher now). So keeping it to 255 might buy you some compatibility there. You'll want to look this up before acting on it, though. varchar vs nvarchar is kinda like ascii vs u...
There seem to be two types of BDD. The first is the original style that Dan North discusses and which caused the creation of the xBehave style frameworks. To me this style is primarily applicable for acceptance testing or specifications against domain objects. The second style is what Dave Astels popularised and ...
Printing data into a preprinted form in C# .Net 3.5 SP1
|c#|.net|printing|
I need to print out data into a pre-printed A6 form (1/4 the size of a landsacpe A4). I do not need to print paragraphs of text, just short lines scattered about on the page. All the stuff on MSDN is about priting paragraphs of text. Thanks for any help you can give, Roberto
|math|maps|mapping|latitude|longitude|
Mapping latitude/longitude to a distorted map
|map|latitude|longitude|math|mapping|
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map. Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this? At first I decided to create a system of linear equations for the three ne...
|math|map|mapping|latitude|longitude|
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map. Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this? At first I decided to create a system of linear equations for the three ne...
|math|maps|mapping|latitude|longitude|
What is the best way to create a sparse array?
|c++|c|data|datastructure|tree|linkedlist|
I am working on a project that requires the manipulation of enourmous matrices, particularly pyramidal summation for a copula calculation. In short, I need to keep track of a relatively small number of values (usually a value of 1, and in rare cases more than 1) in a sea of zeros in the matrix (multidimensional array)...
I am working on a project that requires the manipulation of enourmous matrices, particularly pyramidal summation for a copula calculation. In short, I need to keep track of a relatively small number of values (usually a value of 1, and in rare cases more than 1) in a sea of zeros in the matrix (multidimensional array)...
Apart from what Eli Courtwright said: - I find iterators in Python more concise. You can use *for i in something*, and it works with pretty much everything. Yeah, Java has gotten better since 1.5, but for example you can iterate through a string in python with this same construct. - Introspection: In python you...
Based on a slection in a DropDownList, when the SelectedIndexChanged event fires, the XPath for an XMLDataSource object is updated: protected void ddl_SelectedIndexChanged(object sender, EventArgs e) { XMLds.XPath = "/controls/control[@id='AuthorityType']/item[@text='" + ddl.SelectedValue + "']/lin...
Crash reporting in C for Linux
|c|linux|crashrpt|
Following this question: <a href="http://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">Good crash reporting library in c#</a> Is there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notif...
Following this question: <a href="http://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">Good crash reporting library in c#</a> Is there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notif...
Following this question: <a href="http://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">Good crash reporting library in c#</a> Is there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notif...
Jeff wrote about this [here][1] and [here][2]. That should help you get started. [1]: http://www.codinghorror.com/blog/archives/001114.html [2]: http://www.codinghorror.com/blog/archives/001139.html
I don't know exactly what you mean by transparent, but if you use WPF you can set AllowTransparency=true on your form and then remove the form's style/border and then set the background to a color that has a zero alpha channel. Then, you can draw on the form all you want and the background will be see-through and the o...
cx_Oracle - what is the best way to iterate over a result set?
|python|oracle-database|sql|database|cx_oracle|
There are several ways, what is the best one?
|sql|database|python|oracle-database|cx_oracle|
|sql|database|python|oracle-database|cx-oracle|
|database|sql|python|oracle-database|cx-oracle|
|python|sql|database|oracle-database|cx-oracle|
IE 6 CSS Hover non Anchor Tag
|css|internet-explorer-6|
What is the simplest and most elegant way to simulate the hover pseudo-class for non-Anchor tags in IE6? I am specifically trying to change the cursor in this instance to that of a pointer.
How can I count the number of records that have a unique value in a particular field in ROR?
|ruby|ruby-on-rails|activerecord|
I have a record set that includes a date field, and want to determine how many unique dates are represented in the record set. Something like: Record.find(:all).date.unique.count but of course, that doesn't seem to work.
Viewing DirectX application remotely
|remote|directx|
We're working on an application that displays information through a Direct3D visualisation. A late client request is the ability to view this application via some Remote Desktop solution. Has anyone done anything similar? What options are available / unavailable? I'm thinking RDC, VNC, Citrix... Any advice?
|directx|remote-desktop|
I think the simplest way is to use the [hover.htc][1] approach. You add the hover.htc file to your site, then reference it in your stylesheet: body { behavior:url("csshover.htc"); } If you want to keep things as clean as possible, you can use IE conditional comments so that line is only rendered users with IE...
Another approach, depending on what the item is, is to add a non link anchor <a name="whatever"></a> and set its display to block. Either put the anchor within or surrounding the item you want the pseudo hover behavior on.
How do I find if my particular computer is going to have problems when I install linux?
|linux|installation|drivers|
The IT lady just gave me a laptop to keep! I've always wanted to have Linux install to play with so the first thing I did is search stackoverflow for Linux Distro suggestions and found it [here][1]. However they also mention that you should search around to see if anyone's had any problems with your drivers an...
AJAX Partial Page Load?
|asp.net|ajax|
I have a page results page (you get there after submitting your search query elsewhere) whit a whole bunch of gridviews for different type of data objects. Obviously, some of the queries take longer than the others. How can I make each gridview render as soon as it has the data it needs? This has been tricky for ...
I would look in (at least) these two places: http://www.linuxcompatible.org/compatibility.html http://www.linux-drivers.org/
Yeah it's not the best solution but what we use is something like this function ReplaceNull(s) if IsNull(s) or s = "" then ReplaceNull = "&nbsp;" else ReplaceNull = s end if end function
Didn't know if you had a Users table, so I get the list via the User_ID's stored in the Group_Member table... SELECT GroupUsers.User_ID, ( SELECT STUFF((SELECT ',' + Cast(Group_ID As Varchar(10)) FROM Group_Member Member (nolock) WHERE Member.User_ID=GroupUs...
Another interesting use of references is to supply a default argument of a user-defined type: class UDT { public: UDT() : val_d(33) {}; UDT(int val) : val_d(val) {}; virtual ~UDT() {}; private: int val_d; }; class UDT_Derived : public UDT { ...
Indeed, the .Net environment allows you to throw your code at the IDE/filesystem like spaghetti against a wall. That doesn't mean that mean this approach is sane, however. Its generally a good idea to stick with the project.foldername.Class approach that was mentioned earlier. Its also a really good idea to keep a...
Projects have default namespaces. Normally, if you add a folder withing the project, all the classes in it will be named as follows: >> DefaultNamespace.FolderName.ClassName As far as when/how to break stuff into projects, that's a matter of experience and/or preference. However, you should absolutely break stuff...
A VS solution normally contains one or more projects. Thse projects have default namespaces (usually the namespace is just the name of the project). Normally, if you add a folder within the project, all the classes in it will be named as follows: >> DefaultNamespace.FolderName.ClassName Of course, you can change ...
I've always considered source file organization and assigning identifiers to classes and objects to be two separate problems. I tend to keep related classes in groups, but not every group should be a namespace. Namespaces exist (more or less) to solve the problem of name conflicts—in flat-namespace languages like C, yo...
Default button size?
|winapi|
How do I create a button control (with `CreateWindow` of a `BUTTON` window class) that has a standard system-wide size (especially height) that's consistent with the rest of Windows applications? I should of course take DPI into account and probably other settings. >**Remark:** Using `USE_CW_DEFAULT` for width and ...
If I understood you correctly you want to check that the interface is called at least once on any of three specified methods. Looking through [the quick reference][1] I don't think you can do that in Rhino Mocks. Intuitively I think you're trying to write a test that is brittle, which is **a bad thing**. This impli...
I think you could do that with Projections, something like Criteria.forClass(bob.class.getName()) .add(Restrictions.gt("id", 10)) .setProjection(Projections.property("id")) );
You should be able to use Multicast UDP for the same purpose. The only difference will be to join the multicast group from every client. http://en.wikipedia.org/wiki/IP_Multicast http://en.wikipedia.org/wiki/Internet_Group_Management_Protocol **Edit:** Just to clarify, multicast let you join a given "group" as...
You can try using `strace` to see the `open` and `close` calls the program makes.
You can try using `strace` to see the `open`, `socket` and `close` calls the program makes. Edit: I don't think you can get the information from the core; at most it will have the file descriptors somewhere, but this still doesn't give you the actual file/socket. (Assuming you can distinguish open from closed file d...
You've probably already seen this but there are a collection of papers on this issue at Microsoft research: [Type Checking papers][1]. The first one describes the decidable algorithm actually used in the Glasgow Haskell compiler. [1]: http://research.microsoft.com/~simonpj/papers/assoc-types/
How to make only certain parts of a site beta?
|beta|
Most sites are either fully released, or in beta. But what happens if you have a large site, and some of the parts are still in Beta, and other parts aren't. How do you effectively communicate this to the customer?
How to get an absolute file name in Python?
|python|file|path|
Given a path such as "mydir/myfile.txt" How do I find the absolute filename relative to the current working directory in Python? E.g. on Windows, I might end up with: "C:/example/cwd/mydir/myfile.txt"
You're demands are a bit impossible.. You want something close to XML, but reject probably the closest equivalent that doesn't have angle-bracket (YAML). As much as I dislike it, why not just use XML? You shouldn't ever have to actually read XML (aside from debugging, I suppose), there are an absurd amount of tools ...
Although i am still a student, when i did work experience 12 months ago, the all IT departments from within the corporation (I was 'working' for large corporation which own several mines in the area) would have a daily telephone conference, where each employee would say what they had been doing etc, and then talk about...
If there's a certain way you enter the part of the beta site, maybe you can have a modal that pops up that they have to agree to every time. I wouldn't have it on every page since it gets annoying, so I would only use this approach if there is a definitive way to get into that part of the site (e.g. people won't be co...
One way I've used for non-web software is a change to background. So for example if your normal site tended to have a plain white background, you could have the beta site have a repeating beta text in a background image. You want to make it fairly faint so it is present but doesn't detract from the overall experience....
you have to make sure you take care of file names with more then one dot. example: "c:\\.directoryname\\file.name.with.too.many.dots.ext" would not be handled correctly by strchr or find. My favorite would be the [boost](http://www.boost.org) filesystem library that have an extension(path) function [(library re...
the only way I know is to delete the designer file, and do a convert to web app. However when you do this, it usually pops up with the error, as to why it didn't auto-regen in the first place, its usually a control ref that isn't declared in the head of the page.
Lightbox style dialogs in MFC App
|c++|user-interface|mfc|
Has anyone implemented Lightbox style background dimming on a modal dialog box in a MFC/non .net app. I think the procedure would have to be something like: steps: 1. Get dialog parent HWND or CWnd* 2. Get the rect of the parent window and draw an overlay with a translucency over that window 3. a...
Has anyone implemented Lightbox style background dimming on a modal dialog box in a MFC/non .net app. I think the procedure would have to be something like: steps: 1. Get dialog parent HWND or CWnd* 2. Get the rect of the parent window and draw an overlay with a translucency over that window 3. a...
Yes, to elaborate on @zigdon's answer, you could do something like this: svn checkout --non-recursive http://svnserver/trunk/ svn update trunk/foo svn update trunk/bar
Yes, to elaborate on @zigdon's answer, you could do something like this: svn checkout --non-recursive http://svnserver/trunk/ svn update trunk/foo svn update trunk/bar svn update trunk/baz
Yes, to elaborate on @zigdon's answer, you could do something like this: svn checkout --non-recursive http://svnserver/trunk/ proj svn update trunk/foo svn update trunk/bar svn update trunk/baz Indeed, thanks to the comments to my post here, it looks like sparse directories are the way to go. ...
Streaming large files in a java servlet
|java|java-io|
I am building a java server that needs to scale. One of the servlets will be serving images stored in Amazon S3. Recently under load, I ran out of memory in my VM and it was after I added the code to serve the images so I'm pretty sure that streaming larger servlet responses is causing my troubles. My question is...
Options for distribution of an offline Ruby on Rails application
|ruby|ruby-on-rails|desktop-application|software-distribution|offline|
I am developing an application in using Ruby on Rails, mostly as an excuse to learn the language. This is not intended to be a web-based application - and perhaps I have chosen the wrong language, but... My understanding is, that in order to run an instance of this application on somebody else's computer, they wo...
I've recently started looking for something like this for Ruby. What I've run across so far: - [Saikuro][1] - [Roodi][2] - [Flog][3] These might be places to start. Unfortunately I haven't used any of the three enough yet to offer a good opinion. [1]: http://saikuro.rubyforge.org/ [2]: http://...
PHP: How do I check if all public methods of two classes return the same values?
|php|oop|
In effect, if I have a class c and instances of $c1 and $c2 which might have different private variable amounts but all their public methods return the same values I would like to be able to check that $c1 == $c2? Does anyone know an easy way to do this?
[Gears on Rails][1] maybe? [1]: http://code.google.com/p/gearsonrails/
I've been using django-evolution. Caveats include: * Its automatic suggestions have been uniformly rotten; and * Its fingerprint function returns different values for the same database on different platforms. That said, I find the custom `schema_evolution.py` approach handy. To work around the fingerprint prob...