instruction stringlengths 0 30k ⌀ |
|---|
|php|html|xml|parsing| |
There are several methods to accomplish this, each of which has advantages and disadvantages; First and foremost, you're going to need to have an instance of a Worksheet object, Application.ActiveSheet works if you just want the one the user is looking at.
The Worksheet object has three properties that can be used t... |
I believe it gets that info from Tools -> Options -> Environment Options -> Environment Variables.
Try to play with those (Add override). |
Combine PDFs c# |
|c#|pdf-generation| |
How can I combine multiple PDFs into one PDF without a 3rd party component?
|
For regulatory mandated archival of electronic data, we keep the data on a RAID and on backup tapes in two separate locations (one of which is Iron Mountain). We also replace the tapes and RAID every few years. |
[http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/23ea6f24-4b44-4fa0-a275-a1b907e1afb6.mspx?mfr=true][1]
Explains the different methods of caching data in IIS.
[1]: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/23ea6f24-4b44-4fa0-a275-a1b907e1afb6.mspx?mfr=... |
String vs StringBuilder |
|c#|.net| |
I understand the difference between the String and StringBuilder (StringBuilder being mutable) but is there a large performance difference between the two? The program I’m working on has alot of case driven string appends (500+), and I’m wondering if using StringBuilder would be a better choice. |
|c#|.net|performance| |
Change IP address via shellscript on Slackware |
|linux|ip|shell| |
In a shellscript, I'd like to set the IP of my box, run a command, then move to the next IP. The IPs are an entire C block.
The question is how do I set the IP of the box without editing a file? What command sets the IP on Slackware?
Thanks |
Get a foot pedal! (I have a kinesis.) After you do, unmap control and capslock so you force yourself to use your feet.
(FYI, remapping capslock will help, but after enough emacsing in one day, will not be a total solution.) |
I don't know of any .NET specific way of doing this right now... Well, there's still JScript.NET, but that probably won't be compatible with whatever JS you need to execute :)
Obviously the future would be the .NET JScript implementation for the DLR which is coming... someday (hopefully).
So that probably leaves ... |
How about using the Flush() method.
ns.Flush()
That should ensure the data is written before continuing. |
Running tests can be really slow because the whole rails environment has to load (try script/console) and only then can all tests run. You should use [autotest][1] which keeps the environment loaded and will check which files you edit. When you edit and save a file, only the tests that depend on these will run automati... |
Where can I find an example burn-down / planning game template? |
|project-management|templates|project-planning| |
I'd like to experiment with burn-down and planning game with the team I'm on. People on my team are interested in making it happen, however I'm sure someone has done this before and has learned some lessons we hopefully don't have to repeat. Does anyone know of an example Excel (or other tool) template available for ... |
You should look at this post from Ayende: [WCF, Mocking and IoC: Oh MY!][1]. Somewhere near the bottom is a method called GetCreationDelegate which should help. It basically does this:
string typeName = ...;
Type proxyType = Type.GetType(typeName);
Type type = typeof (ChannelFactory<>).MakeGene... |
The code should be pretty self explanitory, so I'll just post that.
<add assembly="Microsoft.Vsa, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
using Microsoft.JScript;
public class MyClass {
public static Microsoft.JS... |
I think this is a fairly subjective decision and different prospects would react differently if you told them.
I think an idea might be to let them know after they have given business to someone else.
At least this way, the ex-prospect will not think that you are trying to pressure them into giving you the busin... |
Dim Files() As String
Files = System.IO.Directory.GetFiles("C:\")
Array.Sort(Files) |
I would say that surprising people by suddenly penetration-testing their software may bother people if simply for the fact that they didn't know ahead of time. I would say if you're going to do this (and I believe it's a good thing to do), inform your clients ahead of time that you're going to do this. If they seem a l... |
From [msdn][1]:
> The order of the returned file names is not guaranteed; use the Sort() method if a specific sort order is required.
The [Sort()][2] method is the standard Array.Sort(), which takes in IComparables (among other overloads), so if you sort by creation date, it will handle localization based on the ... |
**Win+1..9** -- Start quick launch shortcut at that index (Vista).
**Ctrl+Scroll Lock,Scroll Lock** -- Crash your computer: <http://support.microsoft.com/kb/244139>
@gabr -- Win+D is show desktop, Win+M minimizes all windows. Hiting Win+D twice brings everything back as it has only shown the desktop window in ... |
The [MSDN Documentation](http://msdn.microsoft.com/en-us/library/wz42302f.aspx) states that there is no guarantee of any order on the return values. You have to use the Sort() method. |
You may want to revisit your branching strategy. How do you get production branches? Are you merging all code from development branches, regression testing and then creating a production branch for fixes? Or are you developing on the trunk and then creating production branches to stabilize and release from? The sec... |
You are correct, the default is my name asc. The only way I have found to change the sort order it to create a datatable from the FileInfo collection.
You can then used the DefaultView from the datatable and sort the directory with the .Sort method.
This is quite involve and fairly slow but I'm hoping someone wil... |
Is there a way to infer what image format a file is, without reading the entire file? |
Don't go down the dark path Master Luke. :) Don't mock everything. You could but you shouldn't... here's why.
- If you continue to test each method in isolation, you have surprises and work cut out for you when you bring them all together ala the **BIG BANG**. We build objects so that they can work together to solv... |
You want [ComboBox_SetCurSel][1]:
ComboBox_SetCurSel(hWndCombo, n);
or if it's an MFC CComboBox control you can probably do:
m_combo.SetCurSel(2);
I would imagine if you're doing it manually you would also want SendMessage rather than PostMessage. CBN_SELCHANGE is the notification that the control s... |
One example is when you have dependencies between entities... ie: Document -> DocumentItems (when you delete Document, DocumentItems don't have a reason to exist) |
There is a 'cheat sheet' for code smells here: [http://industriallogic.com/papers/][1]
[1]: http://industriallogic.com/papers/ |
_watch_ only breaks on write, _rwatch_ let you break on read, and _awatch_ let you break on read/write.
You can set read watchpoints on memory locations:
gdb$ rwatch *0xfeedface
Hardware read watchpoint 2: *0xfeedface
but one limitation applies to the rwatch and awatch commands; you can't use gdb vari... |
the [`last`][1] command will give you the reboot times of the system. You could take the difference between each successive reboot and that should give the uptime of the machine.
**update**
[1800 INFORMATION][2] answer is a better solution.
[1]:http://linux.about.com/library/cmd/blcmdl1_last.htm
[2]:http://st... |
linux uptime history |
|linux| |
How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots. |
How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots.
Update:
Not sure if it is based on a lengt... |
How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots.
Update:
Not sure if it is based on a lengt... |
Not answering the question but hopefully providing some insight...
It's features like this that teach people that it is ok to enter their username and password for site A on a form from site B. This is most definitely not ok. Please do not make people think it is.
But maybe the Facebook API allows you to circumve... |
We're manually mapping our internal data elements to external vendors' xml schema. there's gotta be a better way... |
|c#|xml|xslt|mapping|coldfusion| |
I'm considering Altova MapForce (or something similar) to produce either XSLT and/or a Java or C# class to do the translation. Today, we pull data right out of the database and manually build an XML string that we post to a webservice.
Should it be db -> (internal)XML -> XSLT -> (External)XML? What do you folks do ... |
You might try injecting your exe into a suspended process and then awakening the hijacked process, but this seems like a recipe for disaster. |
I just want to add that the system that I think was easiest to set up and work with was [Mercurial][1]. If you work alone and not in a team you just initialize it in your normal work folder and then go on from there. The normal flow is to edit any file using your favourite editor and then to a checkin (commit).
I havn... |
Backup/Restore database for oracle 10g testing |
|sql|oracle-database|backup|10g|rman| |
Using Oracle 10g with our testing server what is the most efficient/easy way to backup and restore a database to a static point, assuming that you always want to go back to the given point once a backup has been created.
A sample use case would be the following
1. install and configure all software
2. Modify dat... |
Using Oracle 10g with our testing server what is the most efficient/easy way to backup and restore a database to a static point, assuming that you always want to go back to the given point once a backup has been created.
A sample use case would be the following
1. install and configure all software
2. Modify dat... |
Backup/Restore database for oracle 10g testing using sqlplus or rman |
Using Oracle 10g with our testing server what is the most efficient/easy way to backup and restore a database to a static point, assuming that you always want to go back to the given point once a backup has been created.
A sample use case would be the following
1. install and configure all software
2. Modify dat... |
Perhaps "Term Frequency - Inverse Document Frequency" [TF-IDF][1] would be useful...
[1]: http://en.wikipedia.org/wiki/Tf-idf |
In text classification, this problem is known as dimensionality reduction. There are many useful algorithms in the literature on this subject. |
Multiline C# Regex to match after a blank line |
|regex| |
I'm looking for a multiline regex that will match occurrences after a blank line. For example, given a sample email below, I'd like to match "From: Alex". `^From:\s*(.*)$` works to match any From line, but I want it to be restricted to lines in the body (anything after the first blank line).
<pre>
Received: from ... |
_watch_ only breaks on write, _rwatch_ let you break on read, and _awatch_ let you break on read/write.
You can set read watchpoints on memory locations:
gdb$ rwatch *0xfeedface
Hardware read watchpoint 2: *0xfeedface
but one limitation applies to the rwatch and awatch commands; you can't use gdb vari... |
In SQL, what’s the difference between count(*) and count('x')? |
|sql| |
I have the following code:
SELECT <column>, count(*)
FROM <table>
GROUP BY <column> HAVING COUNT(*) > 1;
Is there any difference to the results or performance if I replace the COUNT(*) with COUNT('x')?
(This question is related to a [previous one][1])
[1]: http://stackoverflow.com/question... |
I try to avoid deletes or updates that I didn't explicitly request in SQL server.
Either through cascading or through the use of triggers. They tend to bite you in the ass some time down the line, either when trying to track down a bug or when diagnosing performance problems.
Where I would use them is in guarant... |
maxElementsOnDisk from EHCache to TreeCache |
|hibernate|caching|java| |
I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache.
I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activated.
Thanks |
Hibernate - maxElementsOnDisk from EHCache to TreeCache |
|java|hibernate|caching| |
I don't see a link, I see this:
javascript:__doPostBack('btn','');
But, if you are trying to hide the DoPostBackCall, the only way to do that is to directly manipulate window.status with javascript. The downside is most browsers don't allow this anymore.
To do that, in your page_load add:
btnFind.A... |
I don't see a link, I see this:
javascript:__doPostBack('btn','');
**EDIT**: Sorry, was looking at a LinkButton, not an ASP:Button. The ASP:Button shows the forms ACTION element like stated.
But, if you are trying to hide the DoPostBackCall, the only way to do that is to directly manipulate window.status... |
|image|tiff| |
Is there a good way to see what format an image is, without having to read the entire file into memory?
Obviously this would vary from format to format (I'm particularly interested in TIFF files) but what sort of procedure would be useful to determine what kind of image format a file is without having to read throu... |
Is there a good way to see what format an image is, without having to read the entire file into memory?
Obviously this would vary from format to format (I'm particularly interested in TIFF files) but what sort of procedure would be useful to determine what kind of image format a file is without having to read throu... |
It turns out that we had a DataBind() call in the Page_Load of the master page of the aspx file that was probably causing the state of the GridView to get tossed out on every page load.
As a note - update parameters for a LINQ query are not required unless you want to set them some non-null default. |
You could write a custom IComparer interface to sort by creation date, and then pass it to Array.Sort. You probably also want to look at StrCmpLogical, which is what is used to do the sorting Explorer uses (sorting numbers correctly with text).
|
If you want to sort by something like creation date you probably need to use DirectoryInfo.GetFiles and then sort the resulting array using a suitable Predicate. |
You can implement custom iComparer to do sorting. Read the file info for files and compare as you like.
IComparer comparer = new YourCustomComparer();
Array.Sort(System.IO.Directory.GetFiles(), comparer);
[msdn info IComparer interface][1]
[1]: http://msdn.microsoft.com/en-us/library/system.colle... |
Sorting Directory.GetFiles() |
|.net|.net-2.0| |
System.IO.Directory.GetFiles() returns a string[]. What is the default sort order for the returned values? I'm assuming by name, but if so how much does the current culture effect it? Can you change it to something like creation date?
**Update:** while MSDN points out that the sort order is not guaranteed for .N... |
System.IO.Directory.GetFiles() returns a string[]. What is the default sort order for the returned values? I'm assuming by name, but if so how much does the current culture effect it? Can you change it to something like creation date?
**Update:** while MSDN points out that the sort order is not guaranteed for .N... |
[ISAPI Rewrite][1] is suitable for IIS 5 or 6. There's a Lite version available for free, or you can pay for the full version to get more features, such as proxying capabilities. It's been a while since I've used it, but it worked fine at the time.
[1]: http://www.isapirewrite.com/ |
public static string ToRelativeDate(DateTime input)
{
TimeSpan oSpan = DateTime.Now.Subtract(input);
double TotalMinutes = oSpan.TotalMinutes;
string Suffix = " ago";
if (TotalMinutes < 0.0)
{
TotalMinutes = Math.Abs(TotalMinutes);
Su... |
How do I get started processing email related to website activity? |
|python|email| |
I am writing a web application that requires user interaction via email. I'm curious if there is a best practice or recommended source for learning about processing email. I am writing my application in Python, but I'm not sure what mail server to use or how to format the message or subject line to account for automa... |
In episode 11 of the SO podcast Jeff and Joel discussed full text searching of SQL Server, Joel's recommendation was [Lucene.NET][1]. You can see their discussion in that episode's [transcript][2], it is about a quarter of the way down the page.
[1]: http://incubator.apache.org/lucene.net/
[2]: https://stack... |
Testing GUI code: should I use a mocking library? |
|python|unit-testing|user-interface| |
|python|unit-testing|user-interface|tdd| |
|python|unit-testing|user-interface|tdd| |
Recently I've been experimenting with TDD while developing a GUI application in Python. I find it very reassuring to have tests that verify the functionality of my code, but it's been tricky to follow some of the recommened practices of TDD. Namely, writing tests first has been hard. And I'm finding it difficult to mak... |
I believe you *could* do this by using this.Master.FindControl or something similar, but you probably shouldn't - it requires the content page to know too much about the structure of the master page.
I would suggest another method, such as firing an event in the content area that the master could listen for and re-b... |
Assuming your master page was named MyMaster:
(Master as MyMaster).PeopleListView.DataBind(); |
Assuming your master page was named MyMaster:
(Master as MyMaster).PeopleListView.DataBind();
**Edit:** since PeopleListView will be declared protected by default, you will either need to change this to public, or create a public property wrapper so that you can access it from your page. |
break would stop the foreach loop completely, continue would skip to the next DataRow |
In my first Comp Sci class, we did the following exercise. Granted, this was a lecture hall with roughly 200 students in it...
Professor writes on the board: "int john;"
John stands up
Professor writes: "int *sally = &john;"
Sally stands up, points at john
Professor: "int *bill = sally;"
Bill stands u... |