instruction
stringlengths
0
30k
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)...
|c++|c|datastructure|data|map|hash|
What is the best way to create a sparse array in C++
|c++|datastructure|hash|map|
|c++|data-structures|hash|map|
|c++|data-structures|hash|maps|
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)...
I guess I'm not the only one having this kind of problem. I found out that Sun Java System Directory Server had a limit of opened ssl connection which only reached 1020 (FD_SETSIZE=1024). It was hardcoded though so you could obviously see the cause of the problem. In my case however, I couldn't seem to find the culpri...
I highly recommend the Nothin’ but .NET Developer Boot Camp more information http://www.jpboodhoo.com/training.oo
"Quoted-printable line longer than 76 chars" warning when sending HTML E-Mail
|.net|html|email|
I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder). When I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is because of the following problem: <pre>MIME_QP_LONG_LINE RAW: Quoted-printable line longer t...
If you want an MD5 digest and have the Indy components installed, you can do this: uses SysUtils, IdGlobal, IdHash, IdHashMessageDigest; with TIdHashMessageDigest5.Create do try Result := TIdHash128.AsHex(HashValue('Hello, world')); finally Free; end; Most popular algor...
If you want an MD5 digest and have the [Indy][1] components installed, you can do this: uses SysUtils, IdGlobal, IdHash, IdHashMessageDigest; with TIdHashMessageDigest5.Create do try Result := TIdHash128.AsHex(HashValue('Hello, world')); finally Free; end; Most popular ...
How do I keep RecipientTime when executing MailItem.Move in an Outlook macro?
|vba|outlook|macros|
In an Outlook 2003 macro; Is there a way to move a message between folders without changing the ReceivedTime-header? I currently use the method `MailItem.Move`. But that automatically sets the `ReceivedTime` property to the current time, which isn't really what I want.
Microsoft has a [free checksum tool](http://www.microsoft.com/downloads/details.aspx?FamilyID=B3C93558-31B7-47E2-A663-7365C1686C08&displaylang=en) you could run with PSExec above.
The simple answer is that the standard protocols available in Delphi (and other tools) don't allow for notification in reverse. I looked into this for a project where I wanted to use SOAP. They all assume client asks server, server responds and that's it. For me, the solution was the RemObjects SDK. This allows you...
Conditional Number Formatting In Java
|java|
How can I format Floats in Java so that the float component is displayed only if it's not zero? For example: <pre> 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 </pre>
How can I format Floats in Java so that the float component is displayed only if it's not zero? For example: <pre> 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 </pre> Edit: I forgot to mention - I'm still on Java 1.4 - sorry!
@[Jason](#54486) and [Darren](#54490) IE6 treats anything with a query string as uncacheable. You should find another way to get the version number into the url, such as a fake directory: <script src="/js/version/MyScript.js"/> and just remove that first directory level after js on the server side before f...
@[Jason](#54486) and [Darren](#54490) <strike>IE6</strike> treats anything with a query string as uncacheable. You should find another way to get the version number into the url, such as a fake directory: <script src="/js/version/MyScript.js"/> and just remove that first directory level after js on the ser...
With every release, we simply prepend a monotonically increasing integer to the root path of all our static assets, which forces the client to reload (we've seen the query string method break in IE6 before). For example: <ul> <li>Release 1: http://www.foo.com/1/js/foo.js</li> <li>Release 2: http://www.foo.com/2/j...
To record macros in Vim, in the command mode, hit the 'q' key and another key you want to assign the macro to. For quick throw away macros I usually just hit qq and assign the macro to the q key. Once you are in recording mode, run through your key strokes. When you are done make sure you are back in command mode and h...
Perhaps the best thing would be to turn on "show whitespace" in your editor. Then you would have a visual indication of how far in each line is tabbed (usually a bunch of dots), and it will be more apparent when that changes.
Good explanation. I think this is version of the general [Divide and Conquer][1] mentality. [1]: http://en.wikipedia.org/wiki/Divide_and_conquer_algorithm
There are a few ways. 1) Provide access to the site via two domains (e.g. www.domain.com and beta.domain.com) and only allow access to beta parts of the site when going in via beta.domain.com. People will be accessing the same code base, but will only get access to the beta sections if they've specified the bet...
Maybe take a look at how Facebook, Bloglines, Gmail did it? Like "We have this beta thing going on, come on over and see the same site with new stuff, but if it doesnt work, use the old parts" Maybe gmail labs where you can sign up for "beta features"
MyList[1] = new MyStruct("bob"); structs in C# should almost always be designed to be immutable (that is, have no way to change their internal state once they have been created). In your case, what you want to do is to replace the entire struct in specified array index, not to try to change just a single property...
Data you want to save is saved in a database. The only exception that is justified is large binary data (images, videos). Who cares how large the table gets? If the mails are automated and template-based, you just have to save the variable parts anyway. The size will be about the same wherever you save it, but you prob...
Determine how much memory a class uses?
|.net|memory|
I am trying to find a way to determine at run-time how much memory a given class is using in .NET. Using Marshal.SizeOf() is out, as it only works on value types. Is there a way to check exactly how much memory a class uses?
Lots of assumptions: 1. You're running windows / would like an archive in windows 2. The ability to search in the mails is important. Since you are sending mails to your customers there isn't any reason you can't bcc a mail account of your own. Assuming you have a suitable account on your own server then I'd look ...
It depends on the content of your email. If it contains large images. I would plump for the file system. Otherwise if your Mail table table is getting very large very quickly I would go for the separate table, archiving off dead customers.
Many distros, Ubuntu included, have a "live" mode. You download the .iso image, burn the CD, and then boot from the CD. The OS will run directly off the CD without installing anything. It will run slowly, because it's reading from the CD, but it should give you the opportunity to test your hardware. -- bmb
Personally, I wouldn't worry about it... if you do dual boot (which I recommend), then you can easily fall back to Windows (or whatever is installed). I have set up 3 laptops with linux, 2 Ubuntu and 1 Fedora 8. 2 of them had issues with the wireless network card, and 2 had issues with the video card (1 was easier ...
You can start an executable with System.Diagnostics.Process.Start(). This returns a Process object with a Responding property that you can use to check periodically if the process is still active. You'll need two separate applications to do this though. And the application you're monitoring needs to have a main win...
I like [Linux on Laptops][1] you pick a notebook, and they recommend the best distro for it. The data is sometimes slightly dated, so I recommend getting the newest distro of the brand they recommend. For [your notebook][2] they recommend [Ubuntu][3]. The other option is just to try a live CD. Many distros have them, i...
You can try [Linux-On-Laptops][1]. A quick search shows this [Tecra A5][2]. You can also download a LiveCD version, that will tell you if you can get most of your hardware working easily. If the LiveCD works, you're good. If it doesn't, you can just pop it out of the cd-rom drive. No harm done, and you can look at o...
Most Linux distros have Live CDs that let you run the OS before actually installing it. That is how I found the Linux distribution that would run on my laptop (Ubuntu). If your laptop is older and your afraid it won't be able to handle a modern Linux desktop, look to distro's like Xubuntu, Slax, Damn Small Linux, Puppy...
Not to mention if it's inside a frequently-called method it may affect the overall behavior of the application. <br> For example, I consider the use of Int32.Parse as a bad practice in most cases since it throws exceptions for something that can be caught easily otherwise. So to conclude everything written here:...
How to keep Stored Procedures and other scripts in SVN/Other repository?
|sql-server|svn|tortoisesvn|repository|
Can anyone provide some real examples as to how best to keep script files for views, stored procedures and functions in a SVN (or other) repository. Obviously one solution is to have the script files for all the different components in a directory or more somewhere and simply using TortoiseSVN or the like to keep th...
|sql-server|svn|tortoisesvn|repository|
How Do I Find a File in a Subversion Repository History?
|subversion|repository|administration|
Is it possible to look back through the history of a subversion repository for files of a certain name (even better would be for them to have a wildcard search). I want to see if a .bat file has been committed to the repository at some point in the past but has since been removed in later updates. Even a dump of the...
|svn|administration|repository|
|svn|administration|repository|
How do you choose an open-source license?
|open-source|licensing|
I'm a software engineer, not a lawyer, and my university doesn't offer any courses geared toward licensing software. In fact, their law-related courses are lacking (but slowly growing in number). Where can I go to learn about open-source licenses and how to choose them?
|open-source|licensing|
How do I figure out what I need to know?
|c#|syntax|repository|
I am a novice programmer who is trying to teach myself to code, specifically in C#. I've taken on a project from a friend of mine and I am not sure what I need to know to get the project done. I suppose the issue is I don't know what I need to know to even get the project started. I do have many of the basics of obj...
Yep. It's slightly more convoluted than deleting the "old" text first, but: I start of with.. line1 line2 line3 line4 old1 old2 old3 old4 I shift+v select the line1, line 2, 3 and 4, and delete them with the `dd` command Then I delete the old1-4 lines the same wa...
I do not know any good tools but as last resort you could include some code in your application to check it, similar to the following: __thread void* stack_start; __thread long stack_max_size; void check_stack_size() { // address of 'nowhere' approximates end of stack char nowhere; ...
I do not know any good tools but as last resort you could include some code in your application to check it, similar to the following: __thread void* stack_start; __thread long stack_max_size = 0L; void check_stack_size() { // address of 'nowhere' approximates end of stack char nowh...
Is AnkhSVN any good?
|sourcecontrol|ankhsvn|
I asked a couple of coworkers about AnkhSVN and neither one of them was happy with it. One of them went as far as saying that AnkhSVN has messed up his devenv several times. What's your experience with AnkhSVN? I really miss having an IDE integrated source control tool.
|version-control|ankhsvn|
|version-control|ankhsvn|
If you use DecimalFormat and specify # in the pattern it only displays the value if it is not zero. See my question [How do I format a number in java?][1] Sample Code DecimalFormat format = new DecimalFormat("###.##"); double[] doubles = {123.45, 99.0, 23.2, 45.0}; f...
If you use [DecimalFormat][1] and specify # in the pattern it only displays the value if it is not zero. See my question [How do I format a number in java?][2] Sample Code DecimalFormat format = new DecimalFormat("###.##"); double[] doubles = {123.45, 99.0, 23.2, 45.0}; ...
Both varchar and nvarchar auto-size to the content, but the number you define when declaring the column type is a maximum. Values in "nvarchar" take up twice the disk/memory space as "varchar" because unicode is two-byte, but when you declare the column type you are declaring the number of characters, not bytes. ...
you'll have to create a PrintDocument object, handle the at least the PrintPage event and apply the appropriate changes to the PrinterSettings property. In your PrintPage event handler, do whatever you need to do with the PringPageEventArgs.Graphics object; like drawing lines, drawing images, etc.
Because there are **8-bits in 1 byte** and so in 1 byte you can store up to 256 distinct values which is 0 1 2 3 4 5 ... 255 Note the first number is 0 so that's a total of **256** numbers. So if you use nvarchar(255) It'll use 1 byte to store the length of the string but if you tip over by 1 and use nvarc...
- Other If you work at a place with that kind of inflexible (and ridiculous) policy, the best solution is to find another job!
win32 GUI app that writes usage text to stdout when invoked as "app.exe --help"
|windows|
How do I create a windows application that does the following: * it's a regular GUI app when invoked with no command line arguments * specifying the optional "--help" command line argument causes the app to write usage text to stdout then terminate * it must be a single executable. No cheating by making a console...
Not nearly as slick as the Ruby version, but how about something like this: from Boots import App, Para, Button, alert def Shoeless(App): t = Para(text = 'Not Clicked') b = Button(label = 'The label') def on_b_clicked(self): alert('You clicked the button!') ...
Not nearly as slick as the Ruby version, but how about something like this: from Boots import App, Para, Button, alert def Shoeless(App): t = Para(text = 'Not Clicked') b = Button(label = 'The label') def on_b_clicked(self): alert('You clicked the button!') ...
Maybe not as slick as the Ruby version, but how about something like this: from Boots import App, Para, Button, alert def Shoeless(App): t = Para(text = 'Not Clicked') b = Button(label = 'The label') def on_b_clicked(self): alert('You clicked the button!') ...
I have personally never needed to do this. But, I have ran across this tutorial <http://www.erikveen.dds.nl/distributingrubyapplications/rails.html> that I think will be helpful. The tutorial covers how to actually convert a rails app into a standalone exe file.
Find out where your PHP code is slowing down (Performance Issue)
|php|mysql|performance|
Here's my first question at SO. I have a internal application for my company which I've been recently ask to maintain. The applications is built in PHP and its fairly well coded (OO, DB Abstraction, Smarty) nothing WTF-ish. The problem is the applications is **very slow**. How do I go about finding out what's...
|php|mysql|performance|profiling|
Hey, this is in dojo, just cause it's what I had the code in already for a project. It should be fairly Obvious how to convert it back to non dojo vanilla JavaScript. function onMouseClick(e) { var x = e.clientX; var y = e.clientY; } var canvas = dojo.byId(canvasId); ...
I can't claim that it's a best practice, but I often see files organized in a directory hierarchy that mirrors the namespace. If it fits your mental model of the code better, then do so - I can't think of any harm. Just because the .NET model doesn't enforce relationships between namespaces, projects, and directory str...
I can't claim that it's a best practice, but I often see files organized in a directory hierarchy that mirrors the namespace. If it fits your mental model of the code better, then do so - I can't think of any harm. Just because the .NET model doesn't enforce relationships between namespaces, projects, and directory str...
I can't claim that it's a best practice, but I often see files organized in a directory hierarchy that mirrors the namespace. If it fits your mental model of the code better, then do so - I can't think of any harm. Just because the .NET model doesn't enforce relationships between namespaces, projects, and directory str...
I had no problems with v1, but I was warned not to use it. I've been using v2 for a while, and I've had no problems with it. I still keep a backup of the repository though...
I've used GDAL (<a>http://www.gdal.org</a>) to do this. It supports bindings for many different languages as well.
Just in case anyone should stumble upon this with the same question for NHibernate: ICriteria c = session.CreateCriteria(typeof (Whatever)) .Add(Expression.Disjunction() .Add(Expression.Eq("name", searchString)) .Add(Expression.Eq("address", searchString)) .Add(Exp...
Assuming you're talking about Winforms, not WPF since the WPF layer for CAB does expose this option. In winforms there is no option in the WindowSmartPartInfo to do this. However, you could extend it and extend WindowWorkspace to use your new SmartPartInfo (override the OnApplySmartPartInfo method). Before you do th...
This is what MSDN has to say: [Design Specifications and Guidelines - Visual Design: Layout][1]. The default size of a button is 50x14 DLUs, which can be calculated to pixels using the examples shown for [GetDialogBaseUnits][2]. [1]: http://msdn.microsoft.com/en-us/library/ms997619.aspx [2]: http://msdn.mi...
This is what MSDN has to say: [Design Specifications and Guidelines - Visual Design: Layout][1]. The default size of a button is 50x14 DLUs, which can be calculated to pixels using the examples shown for [GetDialogBaseUnits][2]. The [MapDialogRect][3] function seems to do the calculation for you. [1]: http...
How to get the EXIF data from a file using C#
|c#|exif|photography|
I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...). Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programatically? Thanks!