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 can see who modified what code, when it was inserted or removed from the codeline, etc.
It's not command line though. I checked briefly in the help and there doesnt' seem to be a way to launch the time lapse view directly from a p4win or p4v invocation. There might be though...I'll be checking further...
HTH. |
|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 method, you are doing something else wrong that would make any criticism of var pale in comparison.
Actually, one of the great arguments for var is that it can make refactoring simpler because you no longer have to worry that you made your declaration overly restrictive (i.e. you used List<> when you should have used IList<>, or IEnumerable<>). You still want to think about the new methods signature, but at least you won't have to go back and change your declarations to match. |
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 security hole. What's the "best practice" solution here? |
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 project properties.
- For C++ strings, use std::wstring instead of std::string |
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 Pentium 4 HT).
> - Use 3 parallel builds. In Visual Studio 2005, you will find the option in **Tools > Options... > Projects and Solutions > Build and Run > maximum number of parallel project builds**.
> - Disable your anti-virus software for .ilk, .pdb, .cc, .h files and only check for viruses on **modify**. Disable scanning the directory where your sources reside. Don't do anything stupid.
> - Store and build the Chromium code on a second hard drive. It won't really speed up the build but at least your computer will stay responsive when you do gclient sync or a build.
> - Defragment your hard drive regularly.
> - Disable virtual memory.
[1]: http://dev.chromium.org/developers/how-tos/build-instructions-windows
[2]: http://support.microsoft.com/kb/935225
[3]: http://support.microsoft.com/kb/947315 |
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, though, and it looks to me like both frameworks (can't speak for Zend) do a very good job of separating the concerns. |
@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 like this
PROJECTID: 1
NAME: New Web Site
ALLTASK: 10
OPENTASK: 7
CLOSEDTASK: 3
I don´t have any domain class that could represent this information and I don´t want to create specific methods in Project class (like getAllTasks, getOpenTasks) because each of these methods would trigger a new query.
So the question is:
I create a new class (somenthing like ProjectTasksQuery) just to hold that information?
I return information within array or map?
Something else? |
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#CONFIGURATION |
@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 has a TypeConverter that implements
> ToString/FromString
That way you can have strongly typed settings, i.e. (ValuationInput) Settings.Default.Properties["ValuationInput"].DefaultValue; will return an object instead of string. |
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, since you are doing Excel, it might be feasible for you to generate [Excel XML documents][2]. You can do this without having to do any Office automation and the process is fairly straightforward. For simple grid based spreadsheets I have found it to be a bit easier than trying to automate it using Excel. The [Office Open XML][3] is quite powerful and allows for more complex reports are possible as well some more effort.
[1]: http://stackoverflow.com/questions/9905/check-for-hung-office-process-when-using-office-automation
[2]: http://office.microsoft.com/en-us/excel/HA102063961033.aspx
[3]: http://en.wikipedia.org/wiki/Office_Open_XML |
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 alter table ?).
Check - dbaccess tool - there is an export command.
Put the DB's into quiesent mode or shut down, copy the dbspaces and then attach table telling it to point to the new dbspaces file. (the dbspaces tool could be worth while looking at.. I have manuals around here. they are 9.2, but it shouldn't have changed too much). |
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/Eclipse-Rich-Client-Platform-Applications/dp/0321334612">Eclipse Rich Client Platform: Designing, Coding, and Packaging Java(TM) Applications</a> provides a detailed introduction to building RCP applications.
|
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 iframe over your flash to make it appear like the HTML is in your app. There are a few downsides to this method however - most of them described in detail [at Deitte.com][3].
> If this can move offline, you could use Air (it has an mx:HTML component built in). [Deitte.com][4] has a detail of this technique as well.
[1]: http://stackoverflow.com/questions/22909/is-there-some-way-to-show-html-content-inside-flash
[2]: http://drumbeatinsight.com/htmlcomponent
[3]: http://www.deitte.com/archives/2008/07/dont_use_iframe.htm
[4]: http://www.deitte.com/archives/2008/07/an_air_version.htm |
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, dependencies, ...) and have all the *real* build script off in the imported template. It even allows overriding of the tasks in the template which allows you to put in project specific pre or post target hooks. |
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 C:\WINDOWS\system32\forfiles.exe
[1]: http://www.ss64.com/nt/
[2]: ftp://ftp.microsoft.com/ResKit/y2kfix/x86/ |
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())
{
if (type.Name == className)
o = Activator.CreateInstance(type) as IYourInterface;
}
}
return null;
}
Note that this will go through all assemblies. You might want to reduce it to only include the currently executing assembly.
For assigning property values you also use reflection. Something along the lines of
IYourInterface o = GetClass("class1");
o.GetType().GetProperty("prop1").SetValue(o, "foo", null); |
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 (Type type in asm.GetTypes())
{
if (type.Name == className)
o = Activator.CreateInstance(type) as IYourInterface;
}
}
return null;
}
Note that this will go through all assemblies. You might want to reduce it to only include the currently executing assembly.
For assigning property values you also use reflection. Something along the lines of
IYourInterface o = GetClass("class1");
o.GetType().GetProperty("prop1").SetValue(o, "foo", null);
While reflection might be the most flexible solution you should also take a look at [XML-serialization][1] in order to skip doing the heavy lifting yourself.
[1]: http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=236 |
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 (Type type in asm.GetTypes())
{
if (type.Name == className)
return Activator.CreateInstance(type) as IYourInterface;
}
}
return null;
}
Note that this will go through all assemblies. You might want to reduce it to only include the currently executing assembly.
For assigning property values you also use reflection. Something along the lines of
IYourInterface o = GetClass("class1");
o.GetType().GetProperty("prop1").SetValue(o, "foo", null);
While reflection might be the most flexible solution you should also take a look at [XML-serialization][1] in order to skip doing the heavy lifting yourself.
[1]: http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=236 |
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 java). |
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 can see who modified what code, when it was inserted or removed from the codeline, etc.
It's not command line though. I checked briefly in the help and there doesnt' seem to be a way to launch the time lapse view directly from a p4win or p4v invocation. There might be though...I'll be checking further...
Edit: I checked with support, and you can launch the timelapse view through p4v as follows:
p4v.exe annotate //<path/to/file>
HTH. |
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 disposing them).
I recall seeing this error myself a year or so ago, and it was definitely associated with a memory problem that made our app fill up all available VM after a long run, so #1 agrees with what I have observed.
[1]: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=200483&SiteID=1 |
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>ÄÄRITALO!</html>"
>>> soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
>>> print soup.contents[0].string
ÄÄRITALO!
[1]: http://www.crummy.com/software/BeautifulSoup/ |
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>ÄÄRITALO!</html>"
>>> soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
>>> print soup.contents[0].string
ÄÄRITALO!
(It would be nice if the standard [codecs][2] module included a codec for this, such that you could do `"some_string".decode('html_entities')` but unfortunately it doesn't!)
[1]: http://www.crummy.com/software/BeautifulSoup/
[2]: http://docs.python.org/lib/module-codecs.html |
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>ÄÄRITALO!</html>"
>>> soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
>>> print soup.contents[0].string
ÄÄRITALO!
(It would be nice if the standard [codecs][2] module included a codec for this, such that you could do `"some_string".decode('html_entities')` but unfortunately it doesn't!)
**EDIT:**
Another solution:
Python developer Fredrik Lundh (author of elementtree, among other things) has [a function to unsecape HTML entities][2] on his website, which works with decimal, hex and named entities (BeautifulSoup will not work with the hex ones).
[2]: http://effbot.org/zone/re-sub.htm#unescape-html
[1]: http://www.crummy.com/software/BeautifulSoup/
[2]: http://docs.python.org/lib/module-codecs.html |
- 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`_`alpha` unless that is the definition you want.
- I can't say it enough: _**never iterate over the indices of a `string` if you care about correctness, always use your unicode library for this.**_
[1]: http://www.icu-project.org/ |
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 information pertaining to Unicode functions. It is part of a chapter on "Encoding Characters" (http://msdn.microsoft.com/en-us/library/cc194786.aspx)
It has the following subsections:
- The Code-Page Model
- Double-Byte Character Sets in Windows
- Unicode
- Compatibility Issues in Mixed Environments
- Unicode Data Conversion
- Migrating Windows-Based Programs to Unicode
- Summary |
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 single use identities for this type of implementation. |
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. After that, delete it.
As far as securing the server, the best course of action is to secure the hardware and use the internal system socket to MySQL, and make sure to block any network access to the MySQL server. Unfortunately, there's no magic encryption bullet for what you need to do. |
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. After that, delete it.
As far as securing the server, the best course of action is to secure the hardware and use the internal system socket to MySQL, and make sure to block any network access to the MySQL server. Make sure you're using both your system permissions and the MySQL permissions to allow as little access as needed. For some scripts, you might consider write-only authentication. There's really no encryption method that will be foolproof (as you will always need to decrypt, and thus must store the key). This is not to say you shouldn't - you can store your key in one location and if you detect system compromise you can destroy the file and render the data useless. |
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 to pick one of the alternatives and start on it. (I'd Avoid third party application unless the cost of developing it in-house is infeasible.. but that's just me). Prototype multiple solutions to check feasibility with list of known requirements. Keep things loosely coupled (replacable), easy to change and full tested. If you reach the fork of keep hacking or rewrite, you'd need to think of which has better value for the business and pick that option. It's comes down 'Now that we're here, what's the best we can do now?'
Scenario2:
---
This can happen although the chances are slim compared to the team spending 2-3 months trying to get the requirements 'finalized' only to find that the market needs or customer minds have changed and 'Now we want it this way'. Once again, its a question of what is the point of time till which you are prepared to investigate and explore before committing on a path of action. Decide wisely with whatever information you have upto that point.. Hindsight is always 20-20 but the customers wont wait forever. You can't wait till the point of time where the requirements coalesce to fit a known OTS component :)
**Agile says Do whatever makes sense and strip out the non-value-adding activities :) Agile is no magic bullet.** just my 2 agile cents :) |
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 no obvious primary key field for identifying each of the Foo elements in the collection so the DataSet has automatically used the ordinal position in the file as an auto-generated field called Foo-Id.
2) There are actually two elements called 'Foo' so that probably explains the generation of a strange name for the column 'Foo-Id-0' (it has auto-generated a unique name for the column - I guess you could think of this as a fault-tolerant behaviour in the DataSet). |
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 faster load times for the web pages that use obfuscated javascript. Obviously this doesn't apply (as much) in the .NET world, but it's an example of a situation in which there is an direct engineering benefit.
|
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.AppSettings["name"];`
The problem is, ConfigurationManager was not found in the System.Configuration namespace. I've been banging my head against the wall trying to figure out what I'm doing wrong. Anybody got any ideas? |
|.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.AppSettings["name"];
The problem is, ConfigurationManager was not found in the System.Configuration namespace. I've been banging my head against the wall trying to figure out what I'm doing wrong. Anybody got any ideas? |
.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 taking no arguments"
void foo(void) means "a function foo taking no arguments"
By writing foo(void), therefore, we achieve the same interpretation across both languages and make our headers multilingual (though we usually need to do some more things to the headers to make them truly cross-language; namely, wrap them in an extern "C" if we're compiling C++).
|
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 want to break their add-ons between versions.
With TDD, you get a good suite of tests as you develop. Without TDD writing those tests is much more difficult. |
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 lines of code. It seems that something at least remotely easy could be done for batch files windows. I'm looking for a solution that works in a standard windows command prompt, without any extra utilities. Please no PowersHell or Cygwin either.
[1]: http://stackoverflow.com/questions/25785/delete-all-but-the-most-recent-x-files-in-bash |
|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 = 'CLERK'
and sal = (
select max(sal) from scott.emp
where deptno = 20 and job = 'CLERK')
This works, but I have to duplicate the test deptno = 20 and job = 'CLERK', which I would like to avoid. Is there a more elegant way to write this, maybe using a group by? BTW, if this matters, I am using Oracle. |
|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, NonPagedSystem, Private, Virtual, WorkingSet
and then the "peaks": which i'm guessing just store the maximum values these last ones ever took.
Reading through the MSDN definition of each property hasn't proved too helpful for me. I have to admit my knowledge regarding how memory is managed (as far as paging and virtual goes) is very limited.
So my question is obviously "which one should I use?", and I know the answer is "it depends".
This process will basically hold a bunch of lists in memory of things that are going on, while other processes communicate with it and query it for stuff. I'm expecting the server where this will run on to require lots of RAM, and so i'm querying this data over time to be able to estimate RAM requirements when compared to the sizes of the lists it keeps inside.
So... Which one should I use and why? |
|.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 not be a strictly software development related question, but it is programmer productivity related. If I can get an answer that involves how to write a program to do this, even better!
Thanks! |
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 have seen 3rd party support for this before, but I can't find it now.
I realize this may not be a strictly software development related question, but it is programmer productivity related. If I can get an answer that involves how to write a program to do this, even better!
Thanks! |
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 environment variables that are the same except for casing, you'll get a crash.
I'll update this answer once I've had a chance to play with this on my own system. |
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 environment variables that are the same except for casing, you'll get a crash.
This is only going to be a problem when running from inside a system like cygwin which enforces case sensitivity for variables. In our case, we're using make.
There are a couple solutions, but they all revolve around making sure that your environment doesn't have any duplicated variables when your c# app runs. |
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 is not and can never be, a page. |
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 _compile
raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis
[The documentation][1] does support this, in a roundabout way.
Unfortunately, I don't have any answer to the general question. I suppose the documentation for the various modules varies in quality and thoroughness. If there were particular modules you were interested in, you might be able to [decompile][2] them (if written in Python) or even [look at the source][3], if they're in the standard library.
[1]: http://docs.python.org/lib/node46.html
[2]: http://www.depython.net/
[3]: http://www.python.org/download/ |
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 _compile
raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis
[The documentation][1] does support this, in a roundabout way - check the bottom of the "Module Contents" page for (brief) description of the `error` exception.
Unfortunately, I don't have any answer to the general question. I suppose the documentation for the various modules varies in quality and thoroughness. If there were particular modules you were interested in, you might be able to [decompile][2] them (if written in Python) or even [look at the source][3], if they're in the standard library.
[1]: http://docs.python.org/lib/node46.html#l2h-408
[2]: http://www.depython.net/
[3]: http://www.python.org/download/ |
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://forums.asp.net/t/1305800.aspx][1]
[1]: http://forums.asp.net/t/1305800.aspx |