instruction
stringlengths
0
30k
Maybe you forgot to associate the tooltip with the control using [SetToolTip][1]. [1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.settooltip.aspx
It depends on the size of the project. The throughput is low and the latency is high, so you're going to get hit every which way, but due to the latency you'll be hit harder if you have a lot of little files rather than a few large ones. Have you considered simply carrying around a GIT or other distributed reposito...
Not only is `System.Collections.ObjectModel.Collection<T>` a good bet, but in the help docs there's [an example][1] of how to override its various protected methods in order to get notification. (Scroll down to Example 2.) [1]: http://msdn.microsoft.com/en-us/library/ms132397.aspx
It depends mostly on how much the respository is used. With one user checking in once a day and a branch/marge/etc operation once a week you probably don't need to run it more than once a year. With several dozen developers working on several dozen projects each checking in 2-3 times a day, you might want to run it...
It depends mostly on how much the respository is used. With one user checking in once a day and a branch/marge/etc operation once a week you probably don't need to run it more than once a year. With several dozen developers working on several dozen projects each checking in 2-3 times a day, you might want to run it...
If you are creating your menu items using the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.aspx" title="MenuItem Members">System.Windows.Forms.MenuItem</a> class you won't have a "ToolTipText" property. You should use the <a href="http://msdn.microsoft.com/en-us/library/system.windo...
My guess here is that because the data was able to import that the field is actually a varchar or some character field, because importing to a numeric field might have failed. Here was a test case I ran purely a MySQL, SQL solution. 1. The table is just a single column (alpha) that is a varchar. mysql> ...
My guess here is that because the data was able to import that the field is actually a varchar or some character field, because importing to a numeric field might have failed. Here was a test case I ran purely a MySQL, SQL solution. 1. The table is just a single column (alpha) that is a varchar. mysql> ...
You might also try: sys.stdout.write("\r%2d%%" % percent) sys.stdout.flush() Using a single carriage return at the beginning of your string rather than several backspaces. Your cursor will still blink, but it'll blink after the percent sign rather than under the first digit, and with one control characte...
Seperating concerns with Linq To SQL and DTO's
|c#|dto-mapping|
I recently started a new webforms project and decided to seperate the business classes from any DBML references. My business layer classes instead access discrete Data layer methods and are returned collections of DTO's. So the data layer might project DTO's like the following: (from c in dataContext.Customers ...
|c#|linq|dto-mapping|
You could use a service like www.unfuddle.com to set up a free SVN or GIT repository. We use Unfuddle and it's really great. There are free and paid versions (depending on your needs). Or, you could of course set up a local copy. There are plenty of tutorials to be found via Google for that: http://www.google.com...
Two concerns to keep in mind: 1. Your example involved placing a password on a command line. That cleartext representation of a secret could be a security vulnerability. 2. When enumerating processes, ask yourself which processes you really want to enumerate. All users, or just t...
As specified in [this thread][1], distributed VCSs (git, Mercurial) are a better model than centralized ones, due to branch creation ease, branch merging ease, no need to setup a special server, no need to have network access to work and some other advantages. If you'll work alone the DVCS allows you to incorporate peo...
Usefulness of SQL Server "with encryption" statement
|sql-server|
Recently a friend and I were talking about securing stored procedure code in a SQL server database. From distant memory, I'm pretty certain that "with encryption" is incredibly easily broken in all versions of SQL Server, however he said it has been greatly improved in SQL 2005. As a result I have not seriously c...
# Shuffle card deck evenly in C++ #include <algorithm> class Deck { // each card is 8-bit: 4-bit for suit, 4-bit for value // suits and values are extracted using bit-magic char cards[52]; public: // ... void shuffle() { std::random_shuffle(cards, cards + 5...
# Shuffle card deck evenly in C++ #include <algorithm> class Deck { // each card is 8-bit: 4-bit for suit, 4-bit for value // suits and values are extracted using bit-magic char cards[52]; public: // ... void shuffle() { std::random_shuffle(cards, cards + 5...
Since you mentioned fork() I assume you're on a Unix-like system, in which case <a href="http://en.wikipedia.org/wiki/POSIX_Threads">POSIX threads</a> (usually referred to as pthreads) are what you want to use. Specifically, pthread_create() is the function you need to create a new thread. Its arguments are: ...
I think the screencasts and short books from [Peepcode][1] are really good. They have screencasts to get you started and have some as you get more advanced. [1]: http://peepcode.com/
Why do we need entity objects?
|sql|database|orm|entities|
Ok, I realize I might be downvoted into oblivion for this question, especially given my stance on the matter, but I really need to see some honest, thoughtful debate on the merits of the currently accepted ***enterprise application*** design paradigm. I am not convinced that entity objects should exist. By entity...
Ok, I realize I might be downvoted into oblivion for this question, especially given my stance on the matter, but I really need to see some honest, thoughtful debate on the merits of the currently accepted enterprise application design paradigm. I am not convinced that entity objects should exist. By entity objec...
Visual studio is being built on top of the [MSBuild][1] configurations files. You can consider *proj and *sln files as makefiles. They allow you to fully customize build process. [1]: http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx
You can use nant to build the projects individually thus replacing the solution and have 1 coding solution and no build solutions. 1 thing to keep in mind, is that the solution and csproj files from vs 2005 and up are msbuild scripts. So if you get acquainted with msbuild you might be able to wield the existing file...
This method uses the actual file modification date, to figure out which one is the latest file: @echo off for /F %%i in ('dir /B /O:-D *.txt') do ( call :open "%%i" exit /B 0 ) :open start "dummy" "%~1" exit /B 0 This method, however, chooses the last file in alp...
In VS menu you have Build -&gt; Rebuild Solution
my #1 way to do this, add white space to the top of the web config file, after the xml declaration tag. It forces the node to re-cache and recompile. We even have a page deep in the admin called Flush.aspx that does it for us.
While it's technically possible, it's not a very friendly solution within Visual Studio. It will be fighting you the entire time. I recommend you take a look at [NAnt][1]. It's a very robust build system where you can do basically anything you need to. Our NAnt script does this on every build: 1. Migrate th...
It's always best to just actually run a build after making .cs changes. Where are you running it? Is this for debugging or production?
Operating System Overheads while profiling?
|profile|
I am doing profiling of a C code in Microsoft VS 2005 on a Intel Core-2Duo platform. I measure the time(secs:millisecs) counsumed by my function. But i have some doubts about the accuracy of this measurement as the operating system will not continuously run my application, but instead schedule others apps/services in...
How do you determine the size of a file in C?
|c|io|
How can I figure out the size of a file, in bytes? unsigned int fsize(char* file){ //what goes here? }
|c|file|io|
How can I figure out the size of a file, in bytes? #include <stdio.h> unsigned int fsize(char* file){ //what goes here? }
I have not yet developed using WPF.. But I would assume that its the same as most other applications in that you want to keep the UI code as light as possible.. A number of design patterns may be used in this such as the obvious [MVC](http://en.wikipedia.org/wiki/Model-view-controller) and [Façade](http://en.wikipedia....
If you're fine with using the std c library: #include <sys/stat.h> off_t fsize(char *file) { struct stat; if (stat(file, &stat) == 0) { return stat.st_size; } return 0; }
Matt's solution should work, except that it's C++ instead of C, and the initial tell shouldn't be necessary. unsigned int fsize(char* file { FILE * f = fopen(file, "r"); fseek(f, 0, SEEK_END); return (unsigned int)ftell(f); } Fixed your brace for you, too. ;)
Here is how I was able to accomplish this. With help from [Chris Hays][1] Size the image to be as big as you would want it on the report, change "Sizing" property to "Clip". Dynamically set the image's left padding using an expression: =CStr(Round((4.625-System.Drawing.Image.FromStream(System.Net.WebReques...
Here is how I was able to accomplish this. With help from [Chris Hays][1] Size the image to be as big as you would want it on the report, change "Sizing" property to **"Clip"**. Dynamically set the image's left padding using an expression: =CStr(Round((4.625-System.Drawing.Image.FromStream(System.Net.WebRe...
It always comes down to the right tool for the job, so it really depends on what you are trying to accomplish. However, as a general rule, you're right that CLR procs have a greater overhead and will never perform on set operations like T-SQL. My guideline is do it all in T-SQL unless what you need becomes overly ...
Yes, I have written a Windows Forms control that wraps DirectX 9.0 and provides direct pixel level manipulation of the video surface. I actually wrote another post on StackOverflow asking if there are other better approaches, search on "Unsafe C# and pointers for 2d rendering, good or bad?" While it is relative...
Yes, I have written a Windows Forms control that wraps DirectX 9.0 and provides direct pixel level manipulation of the video surface. I actually wrote another post on StackOverflow asking if there are other better approaches, search on "Unsafe C# and pointers for 2d rendering, good or bad?" While it is relative...
You could try looking into WPF, using Visual Studio and/or Expression Blend. I'm not sure how sophisticated you're trying to get, but it should be able to handle a simple editor. Check out this [MSDN Article](http://msdn.microsoft.com/en-us/library/ms742562.aspx) for more info.
Having a menu strip and a menu item (this is done in the code behind designer file for you automatically) MenuStrip menuStrip1; ToolStripMenuItem testToolStripMenuItem; testToolStripMenuItem.DropDownItems.Add(testToolStripMenuItem) Tooltip is set manually by: testToolStripMenuItem.ToolTipText...
AFAIK, ANSI C doesn't define threading, but there are various libraries available. If you are running on Windows, link to msvcrt and use _beginthread or _beginthreadex. If you are running on other platforms, check out the pthreads library (I'm sure there are others as well).
round(n,1)+epsilon
can't help the way it's stored, but at least formatting works correctly: '%.1f' % round(n, 1) gives you '5.6'
Have a looke at the Ekiga project at [http://www.Ekiga.org][1]. This provides audio and or video chat between users using the standard SIP (Session Initiation Protocol) over the Internet. Like most SIP clients, it can also be used to make calls to and receive calls from the telephone network, but this requires an acc...
How can I make an exact copy of a xml node's children with XSLT?
|xml|xslt|xhtml|
My problem is that my XML document contains snippets of XHTML within it and while passing it through an XSLT I would like it to render those snippets without mangling them. I've tried wrapping the snippet in a CDATA but it doesn't work since less than and greater than are translated to &lt; and &gt; as opposed to be...
[nProf][1] is a good tool if you're looking for something free. It's kind of finicky at points, and a little buggy, but if you're on a tight budget, it'll do the job. [1]: http://nprof.sourceforge.net/Site/Description.html
You can switch the data type to a integer: >>> n = 5.59 >>> int(n * 10) / 10.0 5.5 >>> int(n * 10 + 0.5) 56 And then display the number by inserting the locale's decimal separator. However, [Jimmy's answer](http://stackoverflow.com/questions/56820/round-in-python-doesnt-seem-to-be-roun...
You can use the string format operator `%`, similar to sprintf. mystring = "%.2f" % 5.5999
[Leon Timmermans][1] got exactly what I was looking for. I would add one small improvement for those who come here later: /(?<!\\)(?:\\\\)*\\q/ The additional `?:` at the beginning of the `(\\\\)` group makes it not saved into any match-data. I can't imagine a scenario where I'd want the text of that saved....
You get '5.6' if you do `str(round(n, 1))` instead of just `round(n, 1)`.
Floating point math is vulnerable to slight, but annoying, precision inaccuracies. If you can work with integer or fixed point, you will be guaranteed precision.
|sql-server|encryption|
ASP.NET 3.5 Without Microsoft SQL Server - What do I lose?
|asp.net|mysql|
I was just assigned to do a CMS using ASP.net 3.5 and MySQL. I am kind of new to ASP.NET development (quite sufficient with C#) and **I am wondering what major ASP.NET and general .NET features I am losing when I don't have the option to use Microsoft SQL Server.** I know already from quick Googling that I lose LINQ...
|asp.net|mysql|.net-3.5|
Spartan Programming
|language-agnostic|style|spartan|
I really enjoyed [Jeff's post][1] on [Spartan Programming][2]. I agree that code like that is a joy to read. Unfortunately, I'm not so sure it would necessarily be a joy to work with. For years I have read about and adhered to the "one-expression-per-line" practice. I have fought the good fight and held my ground wh...
I really enjoyed [Jeff's post][1] on [Spartan Programming][2]. I agree that code like that is a joy to read. Unfortunately, I'm not so sure it would necessarily be a joy to work with. For years I have read about and adhered to the "one-expression-per-line" practice. I have fought the good fight and held my ground wh...
Tooltip is set manually by: testToolStripMenuItem2.ToolTipText = "My tooltip text"; For completeness. Having a menu strip and a menu item (this is done in the code behind designer file for you automatically) MenuStrip menuStrip1; ToolStripMenuItem testToolStripMenuItem; menuStrip1.Items.A...
Tooltip is set manually by: testToolStripMenuItem2.ToolTipText = "My tooltip text"; The MenuItem can for example be part of this menu constellation: a menu strip with a menu item and a sub menu item. (This plumbing code is generated automatically for you in the code behind designer file if you use visual stud...
@Chris Karcher, May be I misunderstood you problem, but why do you need to use Tooltip class? You can assign your text to MenuItem.[ToolTipText][1] property and it will be shown to user. [1]: http://msdn.microsoft.com/en-us/library/aa978609%28VS.71%29.aspx
@Chris Karcher, May be I misunderstood you problem, but why do you need to use Tooltip class? You can assign your text to [ToolTipText][1] property and it will be shown to user. [1]: http://msdn.microsoft.com/en-us/library/aa978609%28VS.71%29.aspx
Namespaces are a logical grouping, while projects are a physical grouping. Why is this important? Think about .NET 2.0, 3.0, and 3.5. .NET 3.0 is basically .NET 2.0 with some extra assemblies, and 3.5 adds a few more assemblies. So for instance, .NET 3.5 adds the `DataPager` control, which is a web control and sh...
One word of warning: Safari on Windows does not support XSLT.
Took me a while but I finally [found it][1]. If you want to use scaffolding and still have this kind of control what you have to do is execute the command from within your app directory: grails install-templates then you'll find the directory: "src/templates/scaffolding" and in that folder you'll find the ....
Try StarPrint's [VSNETcodePrint][1] [1]: http://starprint2000.com/
Here you go... (hope no-one beat me to it...) (You'll need to save the file as lasttext.bat or something) This will open up / run the oldest .txt file dir *.txt /b /od > systext.bak FOR /F %%i in (systext.bak) do set sysRunCommand=%%i call %sysRunCommand% del systext.bak Probably XP only. ...
Here you go... (hope no-one beat me to it...) (You'll need to save the file as lasttext.bat or something) This will open up / run the oldest .txt file dir *.txt /b /od > systext.bak FOR /F %%i in (systext.bak) do set sysRunCommand=%%i call %sysRunCommand% del systext.bak /Y Probably XP onl...
I am a committer on the BIRT project, so I am biased. BIRT provides a very well thought out report object model (ROM) and appropriate API for the various design and deploy function that is needed. In addition, BIRT provides the best multi-language support and the ability to separate development from design through th...
**Suggestion** Try run on multi CPU systems.
I agree that a memory profiler is the easiest way to get the information you are looking for. In addition to the two previously mentioned, I recommend JetBrains [dotTrace][1], which is both a performance profiler and a memory profiler. If you want to do it yourself, and are willing to get pretty deep into the guts o...
In my humble opinion: When using PHP for web development, most of your connection will only "live" for the life of the page executing. A persistant connection is going to cost you a lot of overhead as you'll have to put it in the session or some such thing. 99% of the time a single non-persistant connection that ...
I've used [bqbackup.com][1] for 1-2 years no problem. You can do a sync using rsync nightly. [1]: http://bqbackup.com
I've used [bqbackup.com][1] for 1-2 years no problem. You can do a sync using rsync nightly. Wanted to add that their prices are dirt cheap, and I now have close to 1TB with them. [1]: http://bqbackup.com
what client(s) should be targeted in implementing an iCalendar export for events?
|outlook|icalendar|gmail|recurrence|
[http://en.wikipedia.org/wiki/ICalendar][1] I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft's Outlook, and Google's Gmail. I'm starting to get the feeling that each of th...
what client(s) should be targeted in implementing an ICalendar export for events?
|outlook|gmail|icalendar|recurrence|
[http://en.wikipedia.org/wiki/ICalendar][1] I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft's Outlook, and Google's Gmail. I'm starting to get the feeling that each of th...
Ctrl+Alt+E (or Debug\Exceptions) From there you can select which exceptions break.
Printing from a service is a bad idea. Network printers are connected "per-user". You can mark the service to be run as a particular user, but I'd consider that a bad security practice. You might be able to connect to a local printer, but I'd still hesitate before going this route. The best option is to have the ser...
You could investigate DoubleCommand, it may do what you need. There's an experimental version that allows for different properties for different keyboards.
Object initialization in C# (.Net)