instruction stringlengths 0 30k ⌀ |
|---|
CultureInfo.CurrentCulture.TextInfo.ToTitleCase ("my name");
returns ~ My Name
But the problem still exists with names like McFly as stated earlier.
|
If you can reproduce the leak in a deterministic way, a simple technique I often used is to number all your smart pointers in their order of construction (use a static counter in the constructor), and report this ID together with the leak. Then run the program again, and trigger a DebugBreak() when the smart pointer wi... |
Despite a lot of anecdote to the contrary, "PERL" was never really an acronym -- it's a "backronym". The name Perl was chosen first, then some people jokingly applied expansions to it, which caught on.
The [PerlMonks community](http://perlmonks.org) (highly recommended!) has pretty well established the convention, ... |
Despite a lot of anecdote to the contrary, "PERL" was never really an acronym -- it's a "backronym". The name Perl was chosen first, then some people jokingly applied expansions to it, which caught on.
The [PerlMonks community](http://perlmonks.org) (highly recommended!) taught me the convention, and it's similar t... |
It's a toss up between Head First Design Patterns, for many of the reasons cited above, and Perl Testing: A Developer's Notebook, which should be one of the bibles for any Perl programmer wanting to write maintainable code. |
For runtime try [Eurekalog][1]. I do not know whether a tool exists for design time. You will have more dificoulties even when you have third party code without source. There is no need in Delphi to catch exceptions, so you do not have to declare them like in Java.
[1]: http://www.eurekalog.com/ |
Consider not migrating dead and inactive projects. Simply put their repositories in read-only mode. The data will still be available if needed and you save the time effort of migrating them. Just migrate the 10% that are in use. Document the process thoroughly.
If one of the un-migrated projects gets resurrected so... |
You can send it as UTC Time
dateTime1.ToUniversalTime() |
Here's a fix for LoaderException errors you're likely to find if one of the types sublasses a type in another assembly:
// Setup event handler to resolve assemblies
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve);
Ass... |
We have these definitions from CommCtrl.h:
#define TreeView_SetItemState(hwndTV, hti, data, _mask) \
{ TVITEM _ms_TVi;\
_ms_TVi.mask = TVIF_STATE; \
_ms_TVi.hItem = (hti); \
_ms_TVi.stateMask = (_mask);\
_ms_TVi.state = (data);\
SNDMSG((hwndTV), TVM_SETITEM, 0, (LPARAM)(TV_ITEM *)&_ms_TVi);\
... |
1 - Major Revision (new UI, lots of new features, conceptual change, etc.)
9 - Minor Revision (maybe a change to a search box, 1 feature added, collection of bug fixes)
0 - Bug Fixes
1 - Build number (if used) - That's why you see the .NET framework using something like 2.0.4.2709
You won't find a lot of ap... |
If you are just interested in where the exception came from, you could just write a simple macro like
#define throwException(message) { std::ostringstream oss; oss << __FILE __ << " " << __LINE__ << " " << __FUNC__ << " " << message; throw std::exception(oss.str().c_str(); }
which will add the file name, line... |
If you are just interested in where the exception came from, you could just write a simple macro like
#define throwException(message) { std::ostringstream oss; oss << __FILE __ << " " << __LINE__ << " " << __FUNC__ << " " << message; throw std::exception(oss.str().c_str()); }
which will add the file name, lin... |
Usually its:
MajorVersion.MinorVersion.Revision.Build
|
A combination of major, minor, patch, build, security patch, etc.
The first two are major & minor-- the rest will depend on the project, company and sometimes community. In OS's like FreeBSD, you will have 1.9.0.1_number to represent a security patch. |
As said, the String object is ummutable, meaning once it is created (see below) it cannot be changed.
> String x = new String("something"); // or
>
> String x = "something";
So when you attempt to concanate String objects, the value of those objects are taken and put into a new String object.
If you instead us... |
You need to modify PHP's include_path so that it knows where to find MyClass.php when you <code>include()</code> it in your unit test.
You could have something like this at the top of your test file (preceding your include):
<pre>
<code>
set_include_path(get_include_path() . PATH_SEPARATOR . "../src");
</code>
... |
Python has its own threading module that comes standard, if it helps. You can create thread objects using the threading module.
[threading Documentation][1]
[thread Documentation][2]
[1]: http://docs.python.org/lib/module-threading.html
[2]: http://docs.python.org/lib/module-thread.html
The thread ... |
For runtime try [Eurekalog][1]. I do not know whether a tool exists for design time. You will have more dificoulties even when you have third party code without source. There is no need in Delphi to catch exceptions, so you do not have to declare them like in Java.
What I wanted to say is that Delphi does not requir... |
I usually pass the payload as (not const) reference and the error code as a return value.
I'm a game developer, we banish exceptions |
The node label editing is performed with a text box and when that text box loses focus the change in name will be committed as the new label for the node. So if the 'Save' button you are clicking on takes the focus then it will cause the update automatically because the text box will lose focus.
If the 'Save' butto... |
I agree with Chris, checking the extension is not validation of the type of file any way you look at it. [Telerik's radUpload][1] is probably your best option, it provides a ContentType property of the file being uploaded, which you can compare to known mime types. You should check for:
application/vnd.ms-excel,
... |
If your using vS2k8, you can use an extension method to add it to the String class:
public static string FirstLetterToUpper(this String input)
{
return input = input.Substring(0, 1).ToUpper() +
input.Substring(1, input.Length - 1);
}
|
Is it safe to manipulate objects that i created outside my thread if i don't explicitly access them on the thread which created them? |
|macos|cocoa|multithreading|core-data|nsthread| |
I am working on a cocoa software and in order to keep the GUI responsive during a massive data import ( CoreData ) i need to run the import outside the main thread.
Is it safe to access those objects even if I created them in the main thread without using locks **if** I don't explicitly access those objects while th... |
|macos|cocoa|multithreading|core-data| |
|python|data-structures|performance|graph| |
|python|data-structures|graph|performance| |
What is the best way to create a wizard in C# 2.0? |
|c#|user-interface|wizard|visual-studio| |
I have an application where users will be creating stock items, and a time of creation there are a number of different things that need to happen.
I think the UI for this should probably be a wizard of some kind, but I'm unsure as to the best way to achieve this. I have seen a couple of 3rd party Wizard controls, an... |
|c#|user-interface|wizard|visual-studio|winforms| |
I have an application where users will be creating stock items, and a time of creation there are a number of different things that need to happen.
I think the UI for this should probably be a wizard of some kind, but I'm unsure as to the best way to achieve this. I have seen a couple of 3rd party Wizard controls, an... |
|c#|visual-studio|winforms|user-interface|wizard| |
I have a winforms application where users will be creating stock items, and a time of creation there are a number of different things that need to happen.
I think the UI for this should probably be a wizard of some kind, but I'm unsure as to the best way to achieve this. I have seen a couple of 3rd party Wizard cont... |
|c#|visual-studio|winforms|user-interface|wizard| |
How to change the icon of .bat file programatically? |
|windows|batch-file|icon| |
I'd like to know what's the way to actually set the icon of a `.bat` file to an arbitrary icon.
How would I go about doing that programmatically, independently of the language I may be using. |
|windows|icons|batch-file| |
Avoid traffic shaping by using ssh on port 443 |
|linux|http|ssh|isp|trafficshaping| |
I heard that if you use port 443 (the port usually used for https) for ssh, the encrypted packets look the same to your isp.
Could this be a way to avoid traffic shaping/throttling? |
SystemTimeToTzSpecificLocalTime is the right function for this, but you need a way to populate a complete database of TIMEZONE_INFO structures.
For that, you need GetDynamicTimeZoneInformation and GetTimeZoneInformationForYear to let you query the registry database for information other than your own timezone. S... |
SystemTimeToTzSpecificLocalTime is the right function for this, but you need a way to populate a complete database of TIMEZONE_INFO structures.
For details on how you can build a set of TIMEZONE_INFO structures out of the registry itself, see this thread on egghead cafe:
http://www.eggheadcafe.com/software/aspn... |
I'm a fan of using capistrano for pushes. Refer to [here](http://stackoverflow.com/questions/18224/whats-the-best-way-to-securely-publish-a-site-post-build#18231).
You could use the [SVN $Rev$ property](http://svnbook.red-bean.com/en/1.4/svn.advanced.props.html) to get the revision number into your footer. |
Older versions of DirectX, I belive 9a, but not 9b had a "debug mode" for dshow. It would output logs of debug info into the debug console.
So download an older version, set it to debug. then open up debugview or load graphedt.exe in visual studio to see the debug info.
|
If you find yourself doing this, then you might have a problem with your design. The idea of a "finally" block is that you want something done regardless of how the method exits. Seems to me like you don't need a finally block at all, and should just use the try-catch blocks:
try {
doSomethingDangerous... |
A really simple way to manage this is to setup your app in the following way:
Simply make your deployment app a working copy of your trunk (`svn co` the project to your /www root) and you run an `svn up` through an ssh console (`ssh user@host.com svn up /path/to/project`) when you need to update. You can also rollba... |
Do you use double buffering? If the device itself does not support double buffering you should define a off screen buffer (Image) and paint to it first and then paint the end result to the real screen. Do this for each of your canvases. Here is an example:
public class MyScreen extends Canvas {
private I... |
Something like this should probably work.
#include <algorithm>
#define NDEBUG
#define CUT_CHECK_ERROR(errorMessage) do { \
cudaThreadSynchronize(); \
cudaError_t err = cudaGetLastError(); ... |
Choosing whether to give the column objects or the row objects the dial method doesn't change how the program will scale.
The dial method is just going to be itself a sequence of row and column methods. You have to ask what those methods depend on.
If the sequence of row methods doesn't depend on knowing exactly... |
According to the DirectX 9.0 SDK (summer 2004) documentation, see the GetDXVer SDK sample at \Samples\Multimedia\DXMisc\GetDXVer. |
You can accomplish this using the StandardError, StandardOutput, and StandardInput properties on the System.Diagnostics.Process class.
MSDN has a nice [example of redirecting standard in and out][1] of a process.
Note that you can only redirect the output of processes that you started. External processes that you... |
What is the role of the username you are logging in with? Have you permitted this role to access Default.aspx?
I experienced this once (a long time ago) and went "doh!" when I realized that not even admin roles can access the main folder! |
According to [this page][1] you need to:
"Depending on your preference, you can either add the variables required for compilation direct to your environment, or use the vcvars32.bat script to set them for you. Note you have to compile from a cygwin bash shell, to use vcvars32, first run a DOS shell, then run vcvars3... |
Rails model validators break earlier migrations |
|ruby-on-rails|migration|validation| |
I have a sequence of migrations in a rails app which includes the following steps:
1. Create basic version of the 'user' model
2. Create an instance of this model - there needs to be at least one initial user in my system so that you can log in and start using it
3. Update the 'user' model to add a new field / ... |
Have you checked that the redirect path is being sent to the login form? Off my head I think it is **ReturnURL**? |
A nice combination is perlcritic with EPIC for Eclipse - hit CTRL-SHIFT-C (or your preferred configured shortcut) and your code is marked up with warning indicators wherever perlcritic has found something to complain about. Much nicer than remembering to run it before checkin. And as normal with perlcritic, it will pic... |
I like the answer by [cmcculloh][1], but it seems like the most correct is the answer by [Greg Hurlman][2]. Use getter/setters all the time if you started using them from the getgo and/or are used to working with them.
As an aside, I personally find that using getter/setters makes the code easier to read and to debu... |
I am working on a cocoa software and in order to keep the GUI responsive during a massive data import (Core Data) I need to run the import outside the main thread.
Is it safe to access those objects even if I created them in the main thread without using locks **if** I don't explicitly access those objects while the... |
Is it safe to manipulate objects that I created outside my thread if I don't explicitly access them on the thread which created them? |
|macos|multithreading|cocoa|core-data| |
Most concise AFAIK:
(defun bigger-elements (x xs) (remove x xs :test #'<))
returning a fresh list, it removes all elements y from xs for which
(< y x)
or using the famous LOOP:
(defun bigger-elements-2 (x xs)
(loop for e in xs
unless (< e x)
collect e))
|
Perhaps your boss just needs a demo as to how easy it is to distribute and deploy a war file for your customers on their own app servers. Every file is "binary", so you might be too-literal in thinking he means an executable on the command-line. |
$firstItem = current(returnsArray()); |
What is the best way to process all versions of MS Excel spreadsheets with php on a non-Windows machine. |
|excel|php| |
I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007.
I am having trouble finding a technique to read ALL versions. |
|php|excel| |
I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007.
The trouble is finding a technique to read ALL versions.
More info:
- I am currently using
php-ExcelReader. ... |
Just think about changing a columns name - now change the (n)SPs and (x)Views.
Do everything that is expensive on the database (like searches , sorting etc..) and you won't notice a problem.
Also, if you want to display a large grid without paging ... then use a dataset - that one is faster.
StackOverflow also... |
I'd agree that this isn't specifically an antipattern. It might be a smell depending upon the usage. There are reasons why one would actually not want to use exceptions (e.g. the errors being returned are not 'exceptional', for starters).
There are instances where you want to have a service return a common model f... |
> First, I want to allow users to
> publish pages and give them each a
> subdomain of their choice (ex:
> user.mysite.com). From what I can
> gather, the best way to do this is to
> map user.mysite.com to mysite.com/user
> with mod_rewrite and .htaccess - is
> that correct?
You may be better off using [virtua... |
def local_to_utc(t):
"""Make sure that the dst flag is -1 -- this tells mktime to take daylight
savings into account"""
secs = time.mktime(t)
return time.gmtime(secs)
def utc_to_local(t):
secs = calendar.timegm(t)
return time.localtime(secs)
Source... |
I think sending as a timestamp string would be the quickest / easiest way although you could look at forcing a locale to stop the time conversion from occuring. |
Perhaps:
l.books.map {|b| b.libraries} |
Perhaps:
l.books.map {|b| b.libraries}
or
l.books.map {|b| b.libraries}.flatten
if you want it all in a flat array.
Of course, you should really define this as a method on Library, so as to uphold the noble cause of encapsulation. |
Perhaps:
l.books.map {|b| b.libraries}
or
l.books.map {|b| b.libraries}.flatten.uniq
if you want it all in a flat array.
Of course, you should really define this as a method on Library, so as to uphold the noble cause of encapsulation. |
You can retrieve the name/value pairs by searching for newline newline or more specifically \r\n\r\n (after this, the body of the message will start).
Then you can simply split the list by the &, and then split each of those returned strings between the = for name/value pairs.
See the [HTTP 1.1 RFC][1].
... |
If you want something beyond the ID column that's there in all lists, you're probably going to have to resort to an Event Receiver on the list that "calculates" what the value of your unique identified should be or using a custom field type that has the required logic embedded in this. Unfortunately, both of these opt... |
It all depends on what you're doing: animation, video, calculation, etc? There are [some tests that show Silverlight being faster for raw computation][1], while Flash's graphics engine is farther along (GPU utilization, 3D, etc.).
If you're talking about load time, there are definitely things you can do in Silverlig... |
In this case, it's more of a manager's dashboard: how much work was put into support today, is there anything pressing in the log right now, and for when we first arrive in the morning as a measure of what went wrong with batch jobs overnight. |
Version numbers don't usually represent separate components. For some people/software the numbers are fairly arbitrary. For others, different parts of the version number string do represent different things. For example, some systems increase parts of the version number when a file format changes. So V 1.2.1 is file ... |
Yup. Major releases add big, new features, may break compatibility or have significantly different dependencies, etc.
Minor releases also add features, but they're smaller, sometimes stripped-down ported versions from beta major release.
If there is a third version number component, it's usually for important bug... |
The more points, the more minor the release. There's no real solid standard beyond that - can mean different things based on what the project maintainers decide on.
WordPress, for example, goes along these lines:
1.6 -> 2.0 -> 2.0.1 -> 2.0.2 -> 2.1 -> 2.1.1 -> 2.2 ...
1.6 to 2.0 would be a big release - featu... |
It depends, but the typical representation is that of *major.minor.release.build*.
Where:
* *major* is the major release version of your software, think .NET 3.x
* *minor* is the minor release version of your software, think .NET x.5
* *release* is the release of that version, typically bugfixes will increment ... |
There is no easy answer, but bear in mind that the Delphi.net variant of the language targets the .net runtime, and that different languages on .net can interoperate closely.
You could try getting it to compile in Delphi.Net, factoring into different assemblies and then converting the assemblies by hand one by one. ... |
**Silverlight 1 Vs Silverlight 2:**
Silverlight 2 is expected to be out in the next few months (they used to say in August 2008 until ... August ended), so MS will probably be promoting Silverlight 2.1 (or whatever upgrade to Silerlight 2) in a year's time, and Silverlight 1.0 will likely have no developer share at ... |
**Silverlight 1 Vs Silverlight 2:**
Silverlight 2 is expected to be out in the next few months (they used to say in August 2008 until ... August ended. In September they say October.), so MS will probably be promoting Silverlight 2.1 (or whatever upgrade to Silerlight 2) in a year's time, and Silverlight 1.0 will li... |
@Jon: I'm not using roles yet. If I check the Web Admin Tool, it says: Roles are not enabled .
@Rob: Yes, it is there.
I also checked the events in order: LoggingIn, Authenticate, LoggedIn, so it is following the correct path, but no redirect and it does not see that it was authenticated. |
It is possible to hide much of the extra code behind a custom message inspector & behavior so you don't need to take care of tinkering with the OperationContextScope yourself.
I'll try to mock something later and send it to you.
--larsw |
You normally have a initial folder with the generally accessable forms and a seperate folder with all the login protected items. In the initial folder you have a webconfig with:
<!--Deny all users -->
<authorization>
<deny users="*" />
</authorization>
In the other folder you can ... |
Mapping from one doc to another nearly always involves making a number of assumptions that are only _probably_ true, and probably isn't usually good enough when you're talking about moving money around. |
You could use the google maps api...they allow for you to use it with custom images. And you can choose if the controls show up or not. |
You could use the google maps api...they allow for you to use it with custom images. And you can choose if the controls show up or not.
EDIT: Found a decent tutorial on how to do this.
http://mapki.com/wiki/Add_Your_Own_Custom_Map |
I would say no in this case. I assume that the compiler can figure out that it uses the `p.Ingredients` variable 3 times and will keep the variable closeby on the stack or the registers or whatever it uses. |