instruction
stringlengths
0
30k
I'm not overly familiar with the blame command, but I assume that you are looking for who changes a particular line of code. The easiest way is to use Perforce's 'time lapse view' available from both p4win and p4v. This tool uses annotate and some other commands to give you a view of the code line over time. You c...
|javascript|oop|
Unicode in C++
|c++|unicode|
What's the best practice of unicode processing in C++?
Static typing is about contracts, not source code. The idea there is a need to have the static information on a single line of what "should" be a small method. Common guidelines recommend rarely exceeding 25 lines per method. If a method is large enough that you can't keep track of a single variable within that me...
How do I keep a mySQL database secure?
|php|mysql|security|aes|
I'm going to be implementing a PHP/mySQL setup to store credit card information. It seems like AES_ENCRYPT/AES_DECRYPT is the way to go, but I'm still confused on one point: how do I keep the encryption key secure? Hardwiring it into my PHP scripts (which will live on the same server as the db) seems like a major secur...
Here is a checklist for Windows programming: - All strings enclosed in _T("my string") - strlen() etc. functions replaced with _tcslen() etc. - Use LPTSTR and LPCTSTR instead of char * and const char * - When starting new projects in Dev Studio, religiously make sure the Unicode option is selected in your...
The Chromium.org team listed several options for [accelerating the build][1] (at this point about half-way down the page): > In decreasing order of speedup: > > - Install Microsoft hotfix [935225][2]. > - Install Microsoft hotfix [947315][3]. > - Use a true multicore processor (ie. an Intel Core Duo 2; not a P...
If you're already programming in the .NET idiom, it's pretty easy to pick up on a lot of what's going on in the MVC Framework. Rails, on the other hand, can be pretty easy to pick up (granted, at a basic level) if you've never set eyes on Ruby before you start. It seems like you're talking about quality-as-MVC, thou...
@DrPizza I will be more specific. We have three tables in a database USER PROJECT TASK USER to TASK 1:n PROJECT to TASK 1:n I have a query that returns a list of all projects but showing also some grouped information (all tasks, open tasks, closed tasks). When returned, the query looks ...
There is perltidy for most stylistic standards. perlcritic can be easily configured using a [.perlcritic file][1]. I personally use the it at level one, but I've disabled a few policies. [1]: http://search.cpan.org/~thaljef/Perl-Critic-1.092/lib/Perl/Critic.pm#CONFIGURATION
There is [perltidy][1] for most stylistic standards. perlcritic can be easily configured using a [.perlcritic file][2]. I personally use the it at level one, but I've disabled a few policies. [1]: http://perltidy.sourceforge.net/ [2]: http://search.cpan.org/~thaljef/Perl-Critic-1.092/lib/Perl/Critic.pm#CONFIG...
@Grzenio, Why don't you use your object type directly? You can set type of your setting on Project Properties->Settings tab. You can select your type by clicking on Browse in drop down for Type column. Citation from MSDN: > Application settings can be stored as > any data type that is XML serializable > or...
I actually had a question that was similar to this awhile back - [Check for hung Office process when using Office Automation][1] - some of the responses to that question might be useful for you. Also, I have to agree with what everyone else is saying in regards to keeping any Office products off of a server; however...
have you used the export tool ? There used to be a way if you first put the db's into quiescent mode and then you could actually copy the DBSpaces across (dbspaces tool I think... its been a few years now). Because with informix you used to be able to specify the DBSpaces(s) to used for the table (maybe even in the...
Capturing network traffic would be one of the best ways to tackle this issue. If you can't do that, could you dump the client process and debug with WinDBG or Visual Studio? Perhaps compare a dump when operating normally versus in the error state?
![alt text][1] [1]: http://stuffthathappens.com/blog/wp-content/uploads/2008/03/simplicity.png
RCP has a bigger learning curve, but once you learn the basics the Eclipse IDE itself supports building RCP applications very well. I have only built a plugin for NetBeans (not build a full-fledged application), and the learning curve was lesser than for the RCP application. The book <a href="http://www.amazon.com/Ecli...
If the HTML is *really* simple, you can display it in a normal label or textarea component, If it is more complex, I'll quote what I answered [in this question][1]. The discussion there also has a little more info. > If it is complex HTML and Javascript, one possible way is [HTMLComponent][2], a method that uses an ...
If you are working on several projects with similar directory structures and want to stick with Ant instead of going to Maven use the [Import task](http://ant.apache.org/manual/CoreTasks/import.html). It allows you to have the project build files just import the template and define any variables (classpath, dependenci...
Why dont you just have something like this in your vhost (of httpd) file? ServerName: www.example.com ServerAlias: example.com Of course that wont re-direct, that will just carry on as normal
Enjoy: forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path" See **forfiles /?** for details For more goodies see [An A-Z Index of the Windows XP command line][1] [1]: http://www.ss64.com/nt/
Enjoy: forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path" See **forfiles /?** for details For more goodies see [An A-Z Index of the Windows XP command line][1] If you don't have forfiles installed by default on your machine, get it from Microsoft [FTP server][2]. Place it to ...
Reflection is what you're looking for. You could look up the type using something like this public IYourInterface GetClass(string className) { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Type type in asm.GetTypes()) ...
Reflection or XML-serialization is what you're looking for. Using reflection you could look up the type using something like this public IYourInterface GetClass(string className) { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Typ...
Reflection or XML-serialization is what you're looking for. Using reflection you could look up the type using something like this public IYourInterface GetClass(string className) { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Typ...
If you stick to pure managed code obfuscation, you can shave off quite a bit of an assembly size, and obfuscated classes/function names (collapsed to single letters) mean smaller memory footprint. This is almost always negligible, but does have an impact (and is used) on some mobile/embedded devices (though mostly in j...
I'm not overly familiar with the blame command, but I assume that you are looking for who changes a particular line of code. The easiest way is to use Perforce's 'time lapse view' available from both p4win and p4v. This tool uses annotate and some other commands to give you a view of the code line over time. You c...
There is a very long MSDN forums discussion of this error [here][1]. In most cases the error is apparently associated with either: 1. An underlying OutOfMemory problem, which manifests as the BufferedGraphicsContext exception, possibly due to a framework bug. 2. A GDI object leak (creating GDI objects and not dis...
I would recommend [BeautifulSoup][1] for HTML scraping. You also need to tell it to convert HTML entities to the corresponding Unicode characters, like so: >>> from BeautifulSoup import BeautifulSoup >>> html = "<html>&#196;&#196;RITALO!</html>" >>> soup = BeautifulSoup(html, convertEntities=Beau...
I would recommend [BeautifulSoup][1] for HTML scraping. You also need to tell it to convert HTML entities to the corresponding Unicode characters, like so: >>> from BeautifulSoup import BeautifulSoup >>> html = "<html>&#196;&#196;RITALO!</html>" >>> soup = BeautifulSoup(html, convertEntities=Beau...
I would recommend [BeautifulSoup][1] for HTML scraping. You also need to tell it to convert HTML entities to the corresponding Unicode characters, like so: >>> from BeautifulSoup import BeautifulSoup >>> html = "<html>&#196;&#196;RITALO!</html>" >>> soup = BeautifulSoup(html, convertEntities=Beau...
- Use [ICU][1] for dealing with your data (or a similar library) - In your own data store, make sure everything is stored in the same encoding - Make sure you are always using your unicode library for mundane tasks like string length, capitalization status, etc. Never use standard library builtins like `is...
In an HttpHandler or HttpModule implementation, you cannot always access session from the BeginRequest event. There is another event you can handle, called OnAcquireRequestState. If you write your code in that event, then HttpContext.Current.Session will not be null.
Use IBM's [International Components for Unicode][1] [1]: http://www.icu-project.org/
Use Twisted Manhole. Docs are a bit lacking, but it's easy enough to set up a telnet-based remote server and it comes with a GTK-based GUI. * [Main Twisted site](http://twistedmatrix.com/) * [twisted.manhole API docs](http://twistedmatrix.com/documents/8.1.0/api/twisted.manhole.html)
Look at http://stackoverflow.com/questions/11635/case-insensitive-string-comparison-in-c That question has a link to the Microsoft documentation on Unicode: http://msdn.microsoft.com/en-us/library/cc194799.aspx If you look on the left-hand navigation side on MSDN next to that article, you should find a lot of in...
Unless there is a need to use session directly, you could always store whatever information about the logged-in user's identity in a singleton dictionary or cache and reference it via the SessionID stored in a hidden field. I personally see security issues in this but won't go into those. I would consider issuing sin...
You should think long and hard about whether you REALLY need to keep the CC#. If you don't have a great reason, DON'T! Every other week you hear about some company being compromised and CC#'s being stolen. All these companies made a fatal flaw - they kept too much information. Keep the CC# until the transaction clears....
You should think long and hard about whether you REALLY need to keep the CC#. If you don't have a great reason, DON'T! Every other week you hear about some company being compromised and CC#'s being stolen. All these companies made a fatal flaw - they kept too much information. Keep the CC# until the transaction clears....
The best way to validate XML in a unit test?
|language-agnostic|xml|unit-testing|dtd|
I have a class with a `ToString` method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. **Should I include the DTD as a string within the unit test to avoid a dependency** on it, or is there a smarter way to do this?
Check out the following Microsoft Knowledge base article: [http://support.microsoft.com/kb/216493][1] If you're using IIS4 or IIS5 this may be the problem. [1]: http://support.microsoft.com/kb/216493
@aib the open(), close(), lseek(), read(), write() all make use of file descriptors. I hardly ever use streams for I/O. @Kyle it matters because of statements like select(). Knowing the highest descriptor can improve performance.
Scenario1: -- This can occur regardless off the OTS nature of the component. Agile does not mean near-sighted.. you'd need to know the big chunks.. the framework bits and spend thinking time on it beforehand. That said, you can only build to what you know .. Delay only till the last responsible moment.Then you need ...
These are my observations rather than a full answer: My guess (without trying to re-produce it myself) is that a couple of things may be happening as the DataSet tries to 'flatten' a hierarchical structure to a relational data structure. 1) thinking about the data from a relational database perspective; there is ...
One potential engineering benefit is that in some cases obfuscation can create smaller executables or other artifacts -- e.g. obfuscating javascript results in smaller files (because all of the variables are named "a" and "b" instead of "descriptiveNameOne" and all the whitespace is stripped, etc). This results in fas...
XSLT only handles the five basic entities by default: `lt`, `gt`, `apos`, `quot`, and `amp`. All others need to be defined as [@Aku](http://stackoverflow.com/questions/31870/using-a-html-entity-in-xslt-eg-nbsp#31873) mentions.
If a big team of programmers really want to get at your source code and that had the time, money and effort, then they would be successful. Obfuscation, therefore, should stop people who don't have the time, money or effort to get your source, passers by you might call them.
ConfigurationManager
|.net|c#|
In .net frameworks 1.1, I use `System.Configuration.ConfigurationSettings.AppSettings["name"];` for application settings. But in Frameworks 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this `System.Configuration.ConfigurationManager.AppSetti...
|.net|
Help accessing application settings using ConfigurationManager
|c#|.net|.net-2.0|
In .net frameworks 1.1, I use System.Configuration.ConfigurationSettings.AppSettings["name"]; for application settings. But in .Net 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this: System.Configuration.ConfigurationManager.AppSetti...
.NET 3.5 SP1 and aspnet_client Crystal Reports
|asp.net|crystalreports11|
I recently (a few days ago) installed .NET 3.5 SP1 and subsequently an aspnet_client folder with a bunch of Crystal Reports support code has been injected into my .net web apps. Anybody else experienced this? Am I correct in saying that this is a side effect of SP1? What is this?
|asp.net|.net-3.5|crystalreports11|
Zigdon has the right idea except his regex isn't quite right. Use `^example\.com$` instead of his suggestion of: `^example\.com(.*)` Otherwise you won't just be matching example.com, you'll be matching things like example.comcast.net, example.com.au, etc.
The main reason is to achieve consistent interpretation of headers that are shared between C and C++. In C: void foo() means "a function foo taking an unspecified number of arguments of unspecified type" void foo(void) means "a function foo taking no arguments" In C++: void foo() means "a function foo ta...
You could try using the sp_who2 command to see what process in question is doing. This will show you if it's blocked by another process, or using up an excessive amount of cpu and/or io time.
Automated testing is such a time saver and confidence booster when you are developing a product that you'll ship multiple versions of. With automated tests, you know that you haven't broken anything between versions. This especially helpful when your product is something that people can write add-ons for - you don't wa...
Write some code to measure the performance. The answer is going to be dependent on the JVM(Sun's JDK might perform differently than JRockit) and the VM flags your application uses.
Batch file to delete files older than N days
|date|batch-file|command|cmd.exe|delete|
I am looking for a way to delete all files older than 7 days in an MS-DOS batch file. I've search around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task. Similar things can be [done in BASH][1] in just a couple l...
|windows|date|batch-file|delete|cmd.exe|
I have used [Sass][1] and think it's great. [1]: http://haml.hamptoncatlin.com/
SQL: aggregate function and group by
|sql|oracle-database|aggregate|
Consider the Oracle "emp" table. I'd like to get the employees with the top salary with department = 20 and job = clerk. Also assume that there is no "empno" column, and that the primary key involves a number of columns. You can do this with: select * from scott.emp where deptno = 20 and job = 'CL...
|c++|c|arrays|pointers|
|c++|c|arrays|pointers|reference|
Process Memory Size - Different Counters
|memory|process|.net|
I'm trying to find out how much memory my own .Net server process is using (for monitoring and logging purposes). I'm using: Process.GetCurrentProcess().PrivateMemorySize64 However, the Process object has several different properties that let me read the memory space used: Paged, NonPaged, PagedSystem, No...
|.net|memory|process|diagnostics|
|.net|memory|processes|diagnostics|
How does Google Chrome control/contain multiple processes?
|google|chrome|process|
How does Google Chrome command and control multiple cross platform processes and provide a shared window / rendering area? Any insights?
|google-chrome|process|
|process|google-chrome|
Rotate Windows XP Desktop
|productivity|desktop|monitor|windows-xp|
My LCD rotates. The software that comes with my ATI card to rotate the desktop just crashes. Is there any other way to rotate a Windows XP Desktop by 90 degree increments? I am looking for either software or code (any language is fine.) I know I have seen this before, but I can't find it now. I realize this may ...
My LCD rotates. The software that comes with my ATI card to rotate the desktop just crashes (*I've uninstalled, reinstalled and rolled them back, still crashes*). Is there any other way to rotate a Windows XP Desktop by 90 degree increments? I am looking for either software or code (any language is fine.) I know I ...
Still debugging, but came across this link: http://social.msdn.microsoft.com/forums/en-US/asmxandxml/thread/4476f044-bab9-492d-bb94-4e0960bd2d26 A quick summary: When serializing, the object makes a dictionary out of all environment variables, but appears to run a ToLower() on all entries. So, if you have two envi...
Found this link, which explains the issue: http://social.msdn.microsoft.com/forums/en-US/asmxandxml/thread/4476f044-bab9-492d-bb94-4e0960bd2d26 A quick summary: When serializing, the object makes a dictionary out of all environment variables, but appears to run a ToLower() on all entries. So, if you have two envir...
You're looking for HttpContext.Handler. Since Page is a handler, you'll obtain a reference to the currently executing page. HttpContext.Current simply returns the singleton instance of HttpContext. Therefore, it is not and can never be, a page.
You're looking for HttpContext.Handler. Since Page implements IHttpHandler, you'll obtain a reference to the currently executing page.You'll have to cast it, or at least try to cast it to the particular type you're looking for. HttpContext.Current simply returns the singleton instance of HttpContext. Therefore, it ...
Well, `re.compile` certainly may: >>> import re >>> re.compile('he(lo') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python25\lib\re.py", line 180, in compile return _compile(pattern, flags) File "C:\Python25\lib\re.py", line 233, in _com...
Well, `re.compile` certainly may: >>> import re >>> re.compile('he(lo') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python25\lib\re.py", line 180, in compile return _compile(pattern, flags) File "C:\Python25\lib\re.py", line 233, in _com...
SP1 changes the HtmlForm control so that it honors the action attribute, where previous versions ignored it. It sounds like you have something like this on the broken pages: <form runat="server" action="#"> Remove the action, and it should be fine: <form runat="server"> More info here: [http://for...