instruction stringlengths 0 30k ⌀ |
|---|
|git| |
How do you remove untracked files from your git working copy? |
IIS Integrated Request Processing Pipeline -- Modify Request |
|c#|asp.net|iis-7| |
I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode.
The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. (for ex: HTTP\_EAUTH\_ID)
And later in the page lifecyc... |
|c#|asp.net|iis-7|http-module| |
|asp.net|iis-7|http-module| |
"git-clean" is what you are looking for. It is used to remove untracked files from the working tree:
<http://www.kernel.org/pub/software/scm/git/docs/git-clean.html> |
git-clean - Remove untracked files from the working tree
http://www.kernel.org/pub/software/scm/git/docs/git-clean.html |
git-clean - Remove untracked files from the working tree
http://www.kernel.org/pub/software/scm/git/docs/git-clean.html |
When I run into this problem, I usually do the same thing you describe, except I make the static method protected so I can invoke it manually. On top of this, I make sure that the method can be invoked multiple times without problems (otherwise it is no better than the static initializer as far as the tests go).
Th... |
In C#, integers are neither reference types nor do they have to be boxed in order for *ToString()* to be called. They **are** considered objects in the Framework (as a ValueType, so they have value semantics), however. In the CLR, methods on primitives are called by "indirectly" loading them onto the stack (ldind). |
I thought it was neat when I dumped a xmlDocument() into a label and it displayed using it's xsl transforms. |
[Dust](http://github.com/kevinclark/dust/tree/master) looks like it can help you find unused and useless code, which seems like it sort-of fits what you're after.
I'm not aware of any other such tools.
This problem is vastly harder to address in ruby than it is in java - you'll note that all those java tools bran... |
Does the php process appear in the taskmanager?<br />I wonder what happens if you kill it there. Will the IIS start another one to handle the next request? |
First my favorite advice of this week: do not treat your Web Service like it if was a local object or you are going to pay a very hefty performance price. Essentially, don't do things like this in your web application:
MyDataService ws = new MyDataWebService();
foreach(DataItem item in myData)
{
... |
Can I set a data breakpoint in runtime in System C? |
|debugging|linux| |
I have a class in system-C with some data members as such:
long double x[8];
I'm initializing it in the construction like this:
for (i = 0; i < 8; ++i) {
x = 0;
}
But the first time I use it in my code I have garbage there.
Because of the way the system is built I can't connect ... |
|linux|debugging| |
I have a class in system-C with some data members as such:
long double x[8];
I'm initializing it in the construction like this:
for (i = 0; i < 8; ++i) {
x[i] = 0;
}
But the first time I use it in my code I have garbage there.
Because of the way the system is built I can't conne... |
Can I set a data breakpoint in runtime in System C (or in Plain Vanilla C++)? |
|c++|linux|debugging| |
Just store your lower bound in a const offset integer, and subtract that value from whatever your source returns as the index.
Also: this is an old VB6 feature. I think there might be an attribute to help support it. |
Set your column type to DataGridViewComboBoxColumn and:
DataGridViewComboBoxColumn col = (DataGridViewComboBoxColumn)dataGridView1.Columns[columnIndex];
col.DataSource = Enum.GetValues(typeof(MyEnum));
|
I do not know if that would work with a ComboBoxColumn but it works with ComboBoxes:
comboBox1.DataSource = Enum.GetValues(typeof(MyEnum));
and:
MyEnum value = (MyEnum)comboBox1.SelectedValue;
|
I do not know if that would work with a DataGridView column but it works with ComboBoxes:
comboBox1.DataSource = Enum.GetValues(typeof(MyEnum));
and:
MyEnum value = (MyEnum)comboBox1.SelectedValue;
UPDATE: It works with DataGridView columns too:
DataGridViewComboBoxColumn col = new Data... |
I do not know if that would work with a DataGridView column but it works with ComboBoxes:
comboBox1.DataSource = Enum.GetValues(typeof(MyEnum));
and:
MyEnum value = (MyEnum)comboBox1.SelectedValue;
UPDATE: It works with DataGridView columns too, just remember to set the value type.
Data... |
How do I stop an effect in jQuery |
|javascript|jquery| |
I have a page that uses
$(id).show("highlight", {}, 2000);
to highlight an element when I start a ajax request, that might fail so that I want to use something like
$(id).show("highlight", {color: "#FF0000"}, 2000);
in the error handler. The problem is that if the first highlight haven't finished, ... |
I have used some script (I can't remember which one) to assist in a VSS to SVN conversion. It was a bit painful and finicky but ended up working, and kept all history. I had to keep all the history for political reasons at the time; if I had my way I probably would have thrown away the history and imported all the code... |
This question is slightly different that the other referenced. In the referenced question, it was asked what the difference was when using count(*) and count(SomeColumnName), and [SQLMenace's answer][1] was spot on.
To address this question, essentially there is no difference in the result. Both count(*) and count... |
This question is slightly different that the other referenced. In the referenced question, it was asked what the difference was when using count(*) and count(SomeColumnName), and [SQLMenace's answer][1] was spot on.
To address this question, essentially there is no difference in the result. Both count(*) and count... |
Frome the jQuery docs:
http://docs.jquery.com/Effects/stop |
@AlexDuggleby: you don't need to copy the worksheets, you can save them directly. e.g.:
Public Sub SaveWorksheetsAsCsv()
Dim WS As Excel.Worksheet
Dim SaveToDirectory As String
SaveToDirectory = "C:\"
For Each WS In ThisWorkbook.Worksheets
WS.SaveAs SaveToDire... |
You could call the reset() method of the forms object from the body load event of your html document to clear the forms.
h1. References
- MSDN reset Method - <http://msdn.microsoft.com/en-us/library/ms536721(VS.85).aspx> |
You could call the reset() method of the forms object from the body load event of your html document to clear the forms.
h1. References
- MSDN reset Method - <http://msdn.microsoft.com/en-us/library/ms536721(VS.85).aspx>
- [Mozilla developer center form.reset](http://developer.mozilla.org/en/DOM/form.reset) |
[Math for Programmers][1]. A good read.
[1]: http://steve-yegge.blogspot.com/2006/03/math-for-programmers.html |
Would you be able to use a USB->RS232 adapter? I have a few, and they just use the FTDI driver. Then, you should be able to rename /dev/ttyUSB0 (or whatever gets created) as /dev/ttyS2 . |
[Big O notation][1] in general algorithm analysis, and in relation to standard collections (sorting, retrieval insertion and deletion)
[1]: http://en.wikipedia.org/wiki/Big_O_notation |
Creating a Patch with TFS |
|open-source|version-control|tfs|patchgeneration| |
Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select Create Patch. But for the life of me, I can't find this functionality in TFS. Is this possible?
If not, what's the standard way to submit patches in open source TFS hosted projects (a la CodePlex)? |
How can I highlight a table row using Prototype? |
|javascript|ajax|prototype| |
How can I use the Prototype library and create unobtrusive javascript to inject the onmouseover and onmouseout events to each row, rather than putting the javascript in each table row tag?
An answer utilizing the Prototype library (instead of mootools, jQuery, etc) would be most helpful. |
Oracle lost sysdba password |
|linux|oracle-database|passwords| |
We are working with an oracle database in which the person that set it up is "long gone" and thus do not know the sysdba password, but need it. We have root access to the box (its on linux). Is there any way to recover or change the sys passwords? |
Why is AppDomain.CurrentDomain.BaseDirectory different between Windows Forms and Library... |
|.net| |
In my winforms application, AppDomain.CurrentDomain.BaseDirectory is set to "C:\Projects\TestProject\bin\Debug\"
In my unit tests it is "C:\Projects\TestProject\bin\Debug" (no final slash). Why is this?
|
In my winforms application, AppDomain.CurrentDomain.BaseDirectory is set to "C:\Projects\TestProject\bin\Debug\"
In my unit tests it is "C:\Projects\TestProject\bin\Debug" (no final slash). Why is this?
[Edit] @Will : I am asking why the test project's directory doesn't have a trailing slash? |
First my favorite advice of this week: do not treat your Web Service like it if was a local object or you are going to pay a very hefty performance price. Essentially, don't do things like this in your web application:
MyDataWebService ws = new MyDataWebService();
foreach(DataItem item in myData)
{
... |
How can I get Emacs' key bindings in Python's IDLE? |
|python|ide|emacs|keyboard| |
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs? |
Everyone's going to say "SQL Injection", because it's the scariest-sounding vulnerability and the easiest one to get your head around. Cross-Site Scripting (XSS) is going to come in second place, because it's also easy to understand. "Poor input validation" isn't a vulnerability, but rather an evaluation of a security ... |
* **Versioning.** *Subversion* is the popular choice. If you can afford it, *Team Foundation Server* offers some benefits. If you want to be super-modern, consider a distributed versioning system, such as *git*, *bazaar* or *Mercurial*. Whatever you do, don't use SourceSafe or other lock-based tools, but rather merge-b... |
Debug.Assert vs. Specific Thrown Exceptions |
|c#|exception|assert| |
I've just started skimming 'Debugging MS .Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...).
He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.:
Debug.Assert(i > 3, "i > 3", "This means I got a bad parameter"... |
Well does opening the page in a brower with "Login.aspx?UserName=&Password=" normaly work?
Some pages may not allow login using data provided in the url, and that it must be entered in the login form on the page and then submitted. |
Honestly it sounds like bad CLASSPATH. One thing I suggest to start debugging this problem is copying the jtds package to same path as your main packages/classes and see if it works. This way you can assure the Classpath manifest is or isn't the problem. The Spring/Hibernate relies on the lib directory, so it will alwa... |
I prefer to use SP's when it makes sense to use them. In SQL Server anyway there is no performance advantage to SP's over a parametrized query.
However, at my current job my boss mentioned that we are forced to use SP's because our customer's require them. They feel that they are more secure. I have not been here... |
The #1 rule for me is: Don't try to show too much.
It's easy to live with a chunk of code for a couple of weeks and think, "Damn, when I show 'em this they are gonna freak out!" Even during your private rehearsals you feel good about things. But once in front of an audience, the complexity of your code is multiplie... |
<p>It's a debate that rages on and on (for instance, <a href="http://stackoverflow.com/questions/22907/which-is-better-ad-hoc-queries-or-stored-procedures">here</a>).</p>
<p>It's as easy to write bad stored procedures as it is to write bad data access logic in your app.</p>
<p>My preference is for Stored Procs, but t... |
<p>It's a debate that rages on and on (for instance, <a href="http://stackoverflow.com/questions/22907/which-is-better-ad-hoc-queries-or-stored-procedures">here</a>).</p>
<p>It's as easy to write bad stored procedures as it is to write bad data access logic in your app.</p>
<p>My preference is for Stored Procs, but t... |
Use `dirname`:
#!/bin/bash
echo "The script you are running has basename `basename $0`, dirname `dirname $0`"
echo "The present working directory is `pwd`"
using `pwd` alone will not work if you are not running the script from the directory it is contained in.
[matt@server1 ~]$ pwd
/home... |
You seems to be looking for a PHP cache framework.
I recommend you the template system TinyButStrong that comes with a very good CacheSystem plugin.
It's simple, light, customizable (you can cache whatever part of the html file you want), very powerful ^^ |
If you do go for creating several projects, make sure everyone who adds code to the solution is fully aware of the intention of them and do everything you can to get them to understand the dependencies between the projects. If you have ever tried to sort out the mess when someone has gone and added references that sh... |
Folders or Projects in a Visual Studio Solution? |
|visual-studio| |
When spliting a solution in to logical layers, when is it best to use a separate project over just grouping by a folder? |
|visual-studio|projects-and-solutions| |
You should use whatever is cheapest and best known for your platform and call it a day. Obfuscation of high-level languages is a hard problem, because VM opcode streams don't suffer from the two biggest problems native opcode streams do: function/method identification and register aliasing.
What you should know abo... |
add values to enum |
|c#|.net|java| |
I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum.
I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# ... |
Be aware that HttpOnly doesn't stop cross-site scripting; instead, it neutralizes one possible attack, and currently does that only on IE (FireFox exposes HttpOnly cookies in XmlHttpRequest, and Safari doesn't honor it at all). By all means, turn HttpOnly on, but don't drop even an hour of output filtering and fuzz tes... |
You won't be able to modify either the `HttpRequest.Headers` or the `HttpRequest.ServerVariables` collection. You will however be able to tack on your information to any of:
HttpContext.Current.Items
HttpContext.Current.Response.Headers
Unfortunately, `Request.Params, Request.QueryString, Request.Cooki... |
Assertions are not for parameter checking. Parameter checking should always be done (and precisely according to what pre-conditions are specified in your documentation and/or specification), and the `ArgumentOutOfRangeException` thrown as necessary.
Assertions are for testing for "impossible" situations, i.e., thing... |
@Fire Lancer: I asked myself that same question during my tests, so I checked, and it does work from a browser. |
C variable and constant value comparison not matching |
|c| |
if i have a
signed char * p;
and i do a comparison
if( *p == 0xFF ) break;
it will never catch 0XFF, but if i replace to -1 it will...
if( *p == (signed char)0xFF ) break;
will catch ...
how come ? is it something with sign flag ?
i though that 0xFF == -1 == 255
|
IMO it's a loss of development time only. Properly implemented exception gives you a clear picture of what happened. |
IMO it's a loss of development time only. Properly implemented exception gives you a clear picture of what happened. I saw *too much* applications showing obscure "Assertion failed: i < 10" errors. I see assertion as a temporary solution. In my opinion no assertions should be in a final version of a program. In my prac... |
It casts to an int for the first comparison since 0xFF is still considered an int, meaning your char is -128 to 127, but the 0xFF is still 255.
In the second case your telling it that 0xFF is really an signed char, not an int |
I haven't found a simple solution either. There are examples using CreateObject and the WinNT ADSI provider. But eventually they all bump into <a href="http://support.microsoft.com/kb/218497">
User authentication issues with the Active Directory Service Interfaces WinNT provider</a>. I'm not 100% sure but I <i>guess</... |
Peruse this document and it will give you the options:
MSDN: [XML Options in Microsoft SQL Server 2005][1]
[1]: http://msdn.microsoft.com/en-us/library/ms345110(SQL.90).aspx |
I use MVP, and on my tests I try to apply most of the refactoring I would in standard code. It normally doesn't work quite as well on the tests, due to the slight variations needed to test different scenarios, but within parts there can be commonality, and when possible I do consolidate. This does ease the needed chang... |
You can use $BASH_SOURCE
#!/bin/bash
scriptdir=`dirname $BASH_SOURCE`
Note that you need to use #!/bin/bash and not #!/bin/sh since its a bash extension |
Obviously, actual performance ought to be measured in individual cases, not assumed. But even in cases where performance is _hampered_ by a stored procedure, there are good reasons to use them:
1. Application developers aren't always the best SQL coders. Stored procedures hides SQL from the application.
2. Stor... |
As a non-programmer myself, I found the book "How to Program" from Pragmatic Programmers very helpful from a rudimentary standpoint. It's approachable and easy to read for a beginner. It won't take you from beginner to expert, but it will prepare you for what to do once you pick a language and pick up your first "Learn... |
Difference between pointer variable and reference variable in C++ |
|c++|pointers|reference| |
I know references are syntactic sugar, so easier code to read and write :)
But what are the differences? |
|c++|pointers|reference|interview-questions| |