instruction stringlengths 0 30k ⌀ |
|---|
You don't want to use a Webforms button in ASP.NET MVC. MVC is a completely different way of working, and you no longer have the WebForms abstraction.
You have 2 different options you can either replace your asp:Button with an input tag or use a standard hyperlink instead. If you use the input option then you will ... |
I have recently started having problems with TortoiseCVS, or more specifically with plink, the SSH application that comes with it. The IP address it tries to connect to can not be changed and is stuck with the old CVS repository's IP. Downloading plink from it's home site and calling from the command line still has thi... |
It might be worth trying Tunnelier from [www.bitvise.com][1]
[1]: http://www.bitvise.com |
For benchmarking, like in your example, I use the [pear Benchmark][1] package. You set markers for measuring. The class also provides a few presentation helpers, or you can process the data as you see fit.
I actually have it wrapped in another class with a __destruct method. When a script exits, the output is logged... |
There can be, but that's a conscious choice you make as the developer. You can use new Vista stuff, like UAC and CommandLinks and Aero and so forth. But you don't have to (even UAC can be programmed around -- just don't do anything that needs admin privileges). If you choose to ignore all of the Vista stuff, then there... |
[XDebug][1] is essential for development. I install it before any other extension. It gives you stack traces on any error and you can enable profiling easily.
For a quick look at a data structure use [var_dump()][2]. Don't use print_r() because you'll have to surround it with <pre> and only prints one var at a time.... |
Putty is probably the best SSH client out there:
http://www.chiark.greenend.org.uk/~sgtatham/putty/
|
You have two options:
- Store the adjusted time for the mail action into the database for each user. Then just compare server time with stored time. To avoid confusion and portability issues, I would store all times in UTC. So, send mail when SERVER_UTC_TIME() == storedUtcTime.
- Store the local time for each mail ... |
Use `EnclosingClass.this` |
Believe me, I know _exactly_ where you are coming from.. I am currently migrating a large app from ASP classic to .NET.. And I am still learning ASP.NET! :S (yes, I am terrified!).
The main things I have kept in my mind is this:
* I dont stray _too_ far from the current design (i.e. no massive "lets rip ALL of th... |
> : are lambda expressions useful for anything other than querying
Lamba expressions are nothing much other than a convenient way of writing a function 'in-line'.
So they're useful any place you wanted a bit of code which can be called as though it's a separate function but which is actually written inside its ca... |
> : are lambda expressions useful for anything other than querying
Lamba expressions are nothing much other than a convenient way of writing a function 'in-line'.
So they're useful any place you wanted a bit of code which can be called as though it's a separate function but which is actually written inside its ca... |
Response.Redirect using ~ Path |
|c#|asp.net|response.redirect| |
There's the non-standard element <wbr /> that is supported by at least
Firefox, http://developer.mozilla.org/En/HTML/Element
Internet Explorer, http://msdn.microsoft.com/en-us/library/ms535917(VS.85).aspx
and Opera. |
There's the non-standard element wbr that is supported by at least
Firefox, http://developer.mozilla.org/En/HTML/Element
Internet Explorer, http://msdn.microsoft.com/en-us/library/ms535917(VS.85).aspx
and Opera. |
Regardless of the number of CPUs available, if you require preemptive multitasking and/or applications with asynchronous components (i.e. pretty much anything that combines a responsive GUI with a non-trivial amount of computation or continuous I/O processing), multithreading performs much better than the alternative, ... |
I would suggest using compression at the transport layer, and eliminating whitespace from the HTML, but not sacrificing the semantics of your markup in the interest of speed. In fact, the better you "compress" your markup, the less effective the transport layer compression will be. Or, to put it a better way, let the g... |
>In PHP, you can send POST data with cURL. Is there something comparable for .NET?
Yes, HttpWebRequest, see my post below. |
What platform are you attempting this on? Most debuggers allow you to attach to a running process by using the process id.
You can either output the process id via logging or using something like Task Manager.
Once that is achieved it will be possible to inspect individual threads and their call stacks. |
What platform are you attempting this on? Most debuggers allow you to attach to a running process by using the process id.
You can either output the process id via logging or using something like Task Manager.
Once that is achieved it will be possible to inspect individual threads and their call stacks.
EDIT: I do... |
Have you seen [VCDiff][1]? It is part of a Misc library that appears to be fairly active (last release r259, April 23rd 2008). I haven't used it, but thought it was worth mentioning.
[1]: http://www.yoda.arachsys.com/csharp/miscutil/usage/vcdiff.html |
Getting the base element from a jQuery object |
|jquery| |
I'm struggling to find the right terminology here, but if you have jQuery object...
$('#MyObject')
...is it possible to extract the base element? Meaning, the equivalent of this:
document.getElementById('MyObject') |
Ok, per Sparks' and Dave's answers it looks like there are two ways to do this:
----------
**Make an Alias:**
(my personal preferred method)
1. Starting ~line 200, copy everything between <Directory "C:/xampp/htdocs"> and </Directory> (~line 232) and paste it immediately below with C:/xampp/htdocs repla... |
Ok, per [Sparks][1]' and [Dave][2]'s answers it looks like there are two ways to do this:
----------
**Make an Alias:**
(my personal preferred method)
1. Starting ~line 200, copy everything between <Directory "C:/xampp/htdocs"> and </Directory> (~line 232) and paste it immediately below with C:/xampp/ht... |
Ok, per [pix0r][1]'s, [Sparks][2]' and [Dave][3]'s answers it looks like there are three ways to do this:
----------
[Virtual Hosts][1]
-------------
1. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf
2. Un-comment line 19 (NameVirtualHost *:80)
3. Add your virtual host (~line 36):
> <VirtualHost ... |
Komodo IDE works well with xdebug, even for the remore debugging. It needs minimum amount of configuration. All you need is a version of php that Komodo can use locally to step through the code on a breakpoint. If you have the script imported into komodo project, then you can set breakpoints with a mouse-click just how... |
Are you sure this is a problem with plink? It sounds to me like you have CVS/Root files lying around that still point to the old cvs ip address. In general, CVS doesn't make changing repositories into a fun process. Since you are using Windows, if you install WinCVS with macros support (Python module loaded) it has ... |
For what it's worth, [plink](http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe) is just a command-line version of putty written by the same guy.
I think [jsight](http://stackoverflow.com/questions/22687/alternative-ssh-application-to-plink#22700) probably has the right idea. |
Sometimes I see the `ItemAdded` or `ItemUpdated` firing twice for a single operation.
You can try to put a breakpoint in the `ItemAdded()` method to confirm that.
The solution in my case was to single thread the `ItemAdded()` method:
private static object myLock = new object();
public override void Ite... |
- Yes. Unless there's a feature we really need in a beta version.
- There's no point using a beta version in dev if you aren't certain you'll use it in production. That just seems like a wasted exercise
- I'll use the patch. Why write code for something you've paid for? |
If you need to store lots of images on the file system a couple of things to think about include:
* Backup and restore. How do you keep the images in sync.
* Filesystem performance. Depends on what you are doing and the filesystem, but you may want to implement a hashing mechanism so that you don't have a single di... |
The way to preserve the stack trace is through the use of the throw; This is valid as well
try {
// something that boms here
} catch (Exception ex)
{
throw;
}
throw ex; is basically like throwing an exception from that point, so the stack trace would only go to where you are ... |
The way to preserve the stack trace is through the use of the throw; This is valid as well
try {
// something that boms here
} catch (Exception ex)
{
throw;
}
throw ex; is basically like throwing an exception from that point, so the stack trace would only go to where you are ... |
Check out <http://hotwire-shell.org/> |
It usually arrives within the first hour. BUt the fact that it reads me@mycompany.com could either because you put it there to protect your privacy (in which case forget about this) or that the system didn't catch your email and they sent it to me@mycompany.com.
If the email address was ok and you didn't get it, som... |
PowerShell V2 is developing a graphical command shell, but I don't think that is what you are looking for.
PowerShell as a command shell is very forgiving for new users and is easy to learn. There is an add-on product (it is a commercial product) called PowerGadgets that would let you pipe file sizes into a pie cha... |
Might be overkill for your project, but [Dean Edwards' IE7 javascript adds support for fixed positioning to IE6][1].
[1]: http://dean.edwards.name/IE7/ |
Is this for Python in particular, or are you just interested in *any* command shell that has a GUI interface?
If the idea of piping file sizes into a pie chart interests you, you might try [PowerGUI][1], a GUI layer on Microsoft's PowerShell command shell. PowerShell also lets you pipe data from commands into XML, ... |
@[Mark](#30531)
Well that's just plain wierd! What's your `include_path` - that could be messing thigns around. I've personally ditched it in favour of contants as it's just so temperamental (or I've never learned how to do it justice). |
You could set the visibility of a paragraph|div to 'hidden'.
Then in the 'onload' function, you could set the visibility to 'visible'.
Something like:
<body onload="javascript:document.getElementById(rec).style.visibility=visible">
<p style="visibility: visible" id="rec">This text to be hidden u... |
@LKM AJAX is the clear winner here. This will also allow you to follow the [DRY][1] principle. Why would you want to write your parsing code in Javascript **and** PHP?
[1]: http://en.wikipedia.org/wiki/Don%27t_repeat_yourself |
Took about a day for me when I requested one so I suspect some sort of manual/semi-automated process has to complete before you get the e-mail.
Give it a day before you start bugging them ;) |
There are both zip and unzip executables (as well as a boat load of other useful applications) in the UnxUtils package available on SourceForge ([http://sourceforge.net/projects/unxutils][1]). Copy them to a location in your PATH, such as 'c:\windows', and you will be able to include them in your scripts.
This is no... |
I have a method that where I want to redirect the user back to a login page located at the root of my web application.
I'm using the following code:
Response.Redirect("~/Login.aspx?ReturnPath=" + Request.Url.ToString());
This doesn't work though. My assumption was that ASP.NET would automatically resolve ... |
No.
You might consider a flag field (enum for readability) and then have the constructor use htat to determine what you meant. |
Only thing I can think of to handle what you're wanting to do is to have to params, one that describes the param type (an enum with LogonName, BadgeNumer, etc) and the second is the param value. |
distutils really isn't all that difficult once you get the hang of it. It's really just a matter of putting in some meta-information (program name, author, version, etc) and then selecting what files you want to include. For example, here's a sample distutils setup.py module from a decently complex python library:
... |
That won't work. You might consider making a class called BadgeNumber that wraps a string in order to avoid this ambiguity. |
You could perhaps use factory methods instead?
public static Person fromId(int id) {
Person p = new Person();
p.Load(id);
return p;
}
public static Person fromLogonName(string logonName) {
Person p = new Person();
p.Load(logonName);
return p;
}... |
You cannot have two different constructors/methods with the same signature, otherwise, how can the compiler determine which method to run.
As [Zack said](http://stackoverflow.com/questions/31215/constructors-with-the-same-argument-type#31220), I would consider creating an "options" class where you could actually pas... |
I'd suggest to also monitor how often pagefaults happen. A pagefault happens when you try to access some data that have been moved from physical memory to swap file and system has to read page from disk before you can access this data. |
You could use a static factory method:
public static Person fromLogon(String logon) { return new Person(logon, null); }
public static Person fromBadge(String badge) { return new Person(null, badge); }
|
Ok, per [pix0r][1]'s, [Sparks][2]' and [Dave][3]'s answers it looks like there are three ways to do this:
----------
[Virtual Hosts][1]
-------------
1. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf
2. Un-comment line 19 (NameVirtualHost *:80)
3. Add your virtual host (~line 36):
> <VirtualHost ... |
Thanks a lot. Also, the following also made it work:
host_name = Socket.getaddrinfo(current_ip,nil)
append_to_file("#{host_name[0][2]} - #{current_ip} - #{mac_addr}\n")
I'm not sure why gethostbyaddr didn't also work. |
This should work reasonably well:
public static class HumanFriendlyInteger
{
static string[] ones = new string[] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
static string[] teens = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fi... |
It seems like the answer is in the question - the method you suggested seems to be the right direction to go, except that if you have a big number of those shared members you might want to gather them into a struct or class and past that as the argument to the constructor of the base class.
If you insist on having t... |
Database: What is Multiversion Concurrency Control (MVCC) and which databases support it? |
|database|deadlock| |
Recently Jeff has [posted][1] regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it?
[1]: http://www.codinghorror.com/blog/archives/001166 |
Database: What is Multiversion Concurrency Control (MVCC) and who supports it? |
|database|deadlock|glossary| |
Recently Jeff has [posted][1] regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it?
[1]: http://www.codinghorror.com/blog/archives/001166.html |
Recently Jeff has [posted][1] regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it?
update: fixed link
[1]: http://www.codinghorror.com/blog/archives/001166.html |
Recently Jeff has [posted][1] regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it?
updated: these support it (which others?)
- oracle
- postgresql
[1]: http://www.codinghorror.com/blog/... |
|database|glossary|deadlock| |
Recently Jeff has [posted][1] regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it?
updated: these support it (which others?)
- oracle
- postgresql
[1]: http://www.codinghorror.com/blog... |
Recently Jeff has [posted][1] regarding his trouble with database deadlocks related to reading. Multiversion Concurrency Control claims to solve this problem. What is it, and what databases support it?
updated: these support it (which others?)
- oracle
- postgresql
[1]: http://www.codinghorror.com/blo... |
I use the [GeSHi Syntax Highlighter Plugin][1] in [my blog][2] and I find it works well. Which highlighter you use tends to depend on which languages you use most frequently and how good the support is for them.
[1]: http://qbnz.com/highlighter/index.php
[2]: http://blog.cdleary.com |
I use the [GeSHi Syntax Highlighter Plugin][1] in [my blog][2] and I find it works well. Which highlighter you use tends to depend on which languages you use most frequently and how good the support is for them.
[Edit] I forgot that GeSHi is the highlighter associated with the [Wordpress SyntaxHighlighter plugin][3]... |
YUI Reset CSS Makes strong and em not work |
|css| |
This line in YUI's Reset CSS is causing trouble for me:
address,caption,cite,code,dfn,em,strong,th,var {
font-style:normal;
font-weight:normal;
}
It makes my <code>em</code> not italic and my <code>strong</code> not bold. Which is okay. I know how to override that in my own stylesheet.
... |
YUI Reset CSS Makes <strong><em>this not work</em></strong> |
This line in YUI's Reset CSS is causing trouble for me:
address,caption,cite,code,dfn,em,strong,th,var {
font-style:normal;
font-weight:normal;
}
It makes my <code>em</code> not italic and my <code>strong</code> not bold. Which is okay. I know how to override that in my own stylesheet.
... |
If you don't want an event interfering, you can set up the Validation Rule property for the textbox to be
NOT LIKE "*"+Chr(10)+"*" OR "*"+Chr(13)+"*"
You will probably also want to set the Validation Text to explain specifically why Access is throwing up an error box.
|
I've used beta libraries in commercial projects before but mostly during development and when the vendor is likely to release a final version before I finish the product.
For example, I developed a small desktop application using Visual Studio 2005 Beta 2 because I knew that the RTM version would be available before... |
import urllib2
response = urllib2.urlopen('http://www.example.com/')
html = response.read() |
Use urllib2 which comes with the standard library.
import urllib2
response = urllib2.urlopen('http://www.example.com/')
html = response.read()
This is the most basic way to use the library. You can also do more complex stuff such as changing headers. The documentation can be found [here.][1]
... |
Use urllib2 which comes with the standard library.
import urllib2
response = urllib2.urlopen('http://www.example.com/')
html = response.read()
This is the most basic way to use the library, minus any error handling. You can also do more complex stuff such as changing headers. The documentation can... |
You could switch to a factory style pattern.
public class Person {
private Person() {}
public static PersonFromID(int personId)
{
Person p = new Person().
person.Load(personID);
return p;
this.Load(personId);
}
public static PersonFro... |
XML is an *external* format, not *internal*.
What's wrong with [XHTML](http://www.w3.org/TR/xhtml1/)? It's simple and it's ubiquitous (at least HTML is). Your implementation would be easy to debug, and your users will be eternally greatful. |
This is probably not always faster but more optimistic about that you find a big prime divisor:
1. `N` is your number
2. If it is prime then `return(N)`
3. Calculate primes up until `Sqrt(N)`
4. Go through the primes in descending order (largest first)
* If `N is divisible by Prime` then `Return(Prime)`
... |
Sounds like you have a pretty good handle on things. I've seen a lot of people try to do a straight-line transliteration, includes and all, and it just doesn't work. You need to have a good understanding of how ASP.Net wants to work, because it's _much_ different from Classic ASP, and it sounds like maybe you have th... |
C#: instantiating classes from XML |
|c#|xml| |
What I have is a collection of classes that all implement the same interface but can be pretty wildly different under the hood. I want to have a config file control which of the classes go into the collection upon starting the program, taking something that looks like
<class1 prop1="foo" prop2="bar"/>
and turn... |
As has been suggested, custom types is the way to go in this case. |
You might consider using custom types.
For example, create LogonName and BadgeNumber classes.
Then your function declarations look like...
public Person(LogonName ln)
{
//load logic here...
}
public Person(BadgeNumber bn)
{
//load logic here...
}
|
This should work reasonably well:
public static class HumanFriendlyInteger
{
static string[] ones = new string[] { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
static string[] teens = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fiftee... |
You could try <http://selenium.openqa.org/> it is more for GUI testing rather than a data layer testing application but does record your actions which then can be played back to automate tests across different platforms. |
You'd be looking to static link (as opposed to dynamically link)
I'm not sure how many of the MS redistributables statically link in. |
It's a tricky question. Since lisp is already structurally so close to a parse tree the difference between a large number of macros and implementing your own mini-language in a parser generator isn't very clear. But, except for the opening and closing paren, you could very easily end up with something that looks noth... |
The Array.zip function does an elementwise combination of arrays. It's not quite as clean as the Python syntax, but here's one approach you could use:
weights = [1, 2, 3]
data = [4, 5, 6]
result = Array.new
a.zip(b) { |x, y| result << x * y } # For just the one operation
sum = 0
a.zip(... |
As the compiler is telling you, you need to change your return type to IEnumerable<TextBox>. That is how the yield return syntax works. |
Ruby has a <code>map</code> method (a.k.a. the <code>collect</code> method), which can be applied to any <code>Enumerable</code> object. If <code>numbers</code> is an array of numbers, the following line in Ruby:
numbers.map{|x| x + 5}
is the equivalent of the following line in Python:
map(lambda x: x ... |
Justification for Reflection in C# |
|c#|.net|reflection| |