instruction
stringlengths
0
30k
HAdes is correct. However, as long as your app can _start_ without the new prerequisite, you have the option of checking for it in code. I had the exact same situation with Crystal Reports and ended up writing code to check if it was installed, download the installation files, and run it in the background. Definit...
You could try this registry hack [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] "DeadGWDetectDefault"=dword:00000001 "KeepAliveTime"=dword:00120000 If it works just keep increasing the KeepAliveTime. It is currently set for 2 minutes. Ken
How to encode the filename parameter of Content-Disposition header in HTTP?
|browser|specifications|http-headers|
Web applications that want to force a resource to be _downloaded_ rather than directly _rendered_ in a Web browser issue a `Content-Disposition` header in the HTTP response of the form: <code>Content-Disposition: attachment; filename=<em>FILENAME</em></code> The `filename` parameter can be used to suggest a name ...
|browser|http-headers|specifications|
Web applications that want to force a resource to be _downloaded_ rather than directly _rendered_ in a Web browser issue a `Content-Disposition` header in the HTTP response of the form: <code>Content-Disposition: attachment; filename=<em>FILENAME</em></code> The `filename` parameter can be used to suggest a name ...
Maybe this can help you: [How can we kill the running thread in java?][1] > u can kill the partictular thread by > setting external class varaiable. Class Outer { public static flag=true; Outer() { new Test().start(); } class Test extends ...
The main difference between the two patterns is this: - In the ActiveRecord you have one domain object that both knows all the business logic and how to save/update itself in the database, user.getLinkToProfile() and User::find(1), User::save(user) - In the DataMapper pattern you have one domain object that h...
If vi/vim editing is your thang: [ViEmu for Visual Studio][1] If you want color-coded control-flow syntax-highlighting and graphical outlines: [Codekana][2] I'm the developer of these commercial tools. [1]: http://www.viemu.com [2]: http://www.codekana.com
http://www.poweradmin.com/sourcecode/vssmigrate.aspx
Slow wget speeds when connecting to https pages
|wget|
I'm using wget to connect to a secure site like this: <code>wget -nc -i inputFile</code> where inputeFile consists of URLs like this: <code>https://clientWebsite.com/TheirPageName.asp?orderValue=1.00&merchantID=36&programmeID=92&ref=foo&Ofaz=0</code> This page returns a small gif file. For some reason, thi...
Yes, 3.5 XPathNavigator supports XSLT 2.0. <http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathnavigator.aspx> "The XPathNavigator class in the System.Xml.XPath namespace is an abstract class which defines a cursor model for navigating and editing XML information items as instances of the XQuery 1.0 an...
Using Linq, you could write your query like: query.OrderBy(column => column.MyField.Length);
Any of the online services mentioned and their competitors offer "reverse geocoding" which does what you ask--convert lon/lat coordinates into a street address of some-sort. If you only need the zip codes and/or cities, then I would obtain the Zip Code database and urban area database from the US Census Bureau which...
AFAIK, not via your scripts. You might try: window.opener.location = '#'; It should circumvent the browser reposting. And, you can adjust the hash name as needed.
WinForm - draw resizing frame using a single-pixel border
|c#|winforms|resize|border|
In a Windows Form with a Resizing Frame, the frame border draws with a raised 3-D look. I'd like it to draw with a flat single pixel border in a color of my choosing. Is this possible without having to owner draw the whole form?
[SQL Compare][1] by Red Gate is a great tool for this. [1]: http://www.red-gate.com/products/SQL_Compare/index.htm
I'd wait for TraceMonkey, the next evolution of SpiderMonkey to come out. Faster and better designed. ( Uses code donated from Adobe Flash ). Tracemonkey prides itself in making repetitious actions much faster by aggressively optimizing the structure at runtime based on actual usage, which aught to be handy for ga...
Do you have tried to define a width for the column? Like `<td width="123px">` or `<td style="width:123px">`. And maybe also for the div ?
Unless I'm misunderstanding you, you just need to include the JDT JAR files on your classpath; they're all available in your Eclipse plugins directory. So for your project, right-click on the project's name in the Package Explorer, go to the Build Path... submenu, and choose Configure Build Path. Then in the Librarie...
.NET Framework method to quickly build directories
|.net|powershell|
Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in .NET, or do I need to handle this myself?
I can recommend some possibilities: first, try log-scaling the interactions or running them through a sigmoidal function to squash the range. This will give you a smoother visual distribution of spacing. Independent of this scaling issue: look at some of the rendering strategies in graphviz, particularly the prog...
About a year ago, we had the same problem. I spent sometimes considering which move was better, and eventually we realized that TestNG has no 'kill features'. It's nice, and has some features JUnit 4 doesn't have, but we don't need them. We didn't want people to feel uncomfortable writing tests while getting to know...
My general rule of thumb is that objects that I need to mock should have a common interface too. I think this is right design-wise and makes tests a lot easier (and is usually what you get if you do TDD). More about this can be read in the Google Testing Blog [latest post][1] (See point 9). Also, I've been working m...
Drop the first marble from the 3rd floor. If it breaks, you know it's floor 1 or 2, so drop the other marble from floor 2. If it doesn't break you've found that floor 2 is the highest. If it does break, you've found that floor 1 is the highest. 2 drops. If dropping from the 3rd floor does not break the marble, d...
Drop the first marble from the 3rd floor. If it breaks, you know it's floor 1 or 2, so drop the other marble from floor 2. If it doesn't break you've found that floor 2 is the highest. If it does break, you've found that floor 1 is the highest. 2 drops. If dropping from the 3rd floor does not break the marble, d...
Drop the first marble from the 3rd floor. If it breaks, you know it's floor 1 or 2, so drop the other marble from floor 2. If it doesn't break you've found that floor 2 is the highest. If it does break, you've found that floor 1 is the highest. 2 drops. If dropping from the 3rd floor does not break the marble, d...
In C# you can use capturing groups private void RegexTest() { String input = "foo[]=1&foo[]=5&foo[]=2"; String pattern = @"foo\[\]=(\d+)"; Regex regex = new Regex(pattern); foreach (Match match in regex.Matches(input)) { ...
The best thing you could do is a clean export of all the files in the repository. Blow away anything that is VSS. Once you've done that then just do a subversion import and you'll be ready to go. If you write a script you'll just have one more maintenance & failure point. Thus my preference for just doing a clean...
Although I'm not familiar with afxext.h, I am wondering what about it makes it incompatible with Windows NT4.... However, to answer the original question: "My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++, in this case) 2005." T...
We use properties files specific to the environments and have the ant build select the correct set when building the jars/wars. Environment specific things can also be handled through the directory service (JNDI), depending on your app server. We use tomcat and our DataSource is defined in Tomcat's read only JNDI...
Couple of minor issues with PostSharp... One issue I've had with PostSharp is that whilst using asp.net, line numbers for exception messages are 'out' by the number of IL instructions injected into asssemblies by PostSharp as the PDBs aren't injected as well :-). Also, without the PostSharp assemblies available a...
You need to turn off autopostback on the dropdown - then, you need to hook up some javascript code that will take over that role - in the event handler code for the onchange event for the dropdown, you would create a URL based on the currently-selected value from the dropdown and use javascript to then request that pag...
Best way to unit test ASP.NET MVC action methods that use BindingHelperExtensions.UpdateFrom?
|asp.net-mvc|
In handling a form post I have something like public ActionResult Insert() { Order order = new Order(); BindingHelperExtensions.UpdateFrom(order, this.Request.Form); this.orderService.Save(order); return this.RedirectToAction("Details", new { i...
|unit-testing|asp.net-mvc|
There are lots of choices of ORMs. Linq to Sql, nHibernate. For pure object databases there is db4o. It depends on the application, but for a high volume enterprise application, I would not go this route. You need more control of your data.
I was discussing this with a friend over the weekend and it seems like the gains you make on ease of storage are lost if you need to be able to query the database outside of the application. My understanding is that these databases work by storing your object data in a de-normalized fashion. This makes it fast to retri...
Yes, sort of. There is no support included in the trunk, you need to write your own dialect. Or you can port the [Paradox dialect created for Hibernate](http://www.hxtt.com/hibernate.html).
Number of Classes in a Visual Studio Solution
|visual-studio|
Is there an easy way to find the number of classes contained within a visual studio solution? Other than writing a funky find script, I couldn't find a way to do it within the code metrics piece of VS. I am running Visual Studio 2008 and this is a VB.Net project through and through. thanks!
No, just encoding common HTML tokens DOES NOT completely protect your site from XSS attacks. See, for example, this XSS vulnerability found in google.com: http://www.securiteam.com/securitynews/6Z00L0AEUE.html The important thing about this type of vulnerability is that the attacker is able to encode his XSS payl...
This is tricky to answer without a discussion about what you want to achieve. But, I'd say, go with getting GUI to hand the pointer to aManager and bManager as you say. If you're trying to create a GUI and wondering how to get data in and out of it, then I can recommend this: http://codebetter.com/blogs/jeremy.mill...
A thread will exit once it's `run()` method is complete, so you need some check which will make it finish the method. You can interrupt the thread, and then have some check which would periodically check `isInterrupted()` and return out of the `run()` method. You could also use a boolean which gets periodically c...
What does your XAML look like? It could be something along the lines of the size set on the usercontrol in XAML, doesn't match the size set on the plugin on the aspx page. In that case, your button might be there but just not in the viewable area... Try checking the size of things, make sure they match. A quick ...
Assuming that you are appending data in a loop, ensure that it's not being appended to itself, which will eat memory extremely quickly. Example and description of error meaning: http://msdn.microsoft.com/en-us/library/aa264524.aspx
In a more general sense of not having to explicitly set variables in each view, it sounds like you want to look at writing your own [context processor][1]. From the docs: > A context processor has a very simple interface: It's just a Python function that takes one argument, an HttpRequest object, and returns a di...
What are effective options for embedding video in an ASP.NET web site?
|asp.net|flash|video|embedded|streaming|
A quick glance at the present-day internet would seem to indicate that Adobe Flash is the obvious choice for embedding video in a web page. Is this accurate, or are they other effective choices? Does the choice of ASP.NET as a platform influence this decision?
|asp.net|flash|video|streaming|
|asp.net|flash|video|embed|
Here is the code that I use to make sure a file is not locked by another process. It's not 100% foolproof, but it gets the job done most of the time: /// <summary> /// Blocks until the file is not locked any more. /// </summary> /// <param name="fullPath"></param> bool Wa...
@Dave To use {{user.username}} in my templates, I will then have to use requestcontext rather than just a normal map/hash: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext So I guess there are no globals that the template engine checks. But the RequestContext has ...
I've done several one-off's of code generation using Castor to create Java source code based on XSD's. The latest use was to create Java classes for an Open Travel Association implementation. The OTA Schema is pretty hairy and would have been a bear to do by hand. Castor did a pretty good job given the complexity of...
You need to write: field = new ComboBox({plugins: view_plugin}); in your case and define my code of view_pligin somewhere before. Or you can even incorporate it inline: field = new ComboBox({plugins: { code of plugin }); Inside plugin all private properties and methods are accessible/changeable. You also...
>...but is it possible to get a bit more fine-grained error messages. Yes. Go ahead and catch `IOException`, and use the `Exception.ToString()` method to get a relatively relevant error message to display. Note that the exceptions generated by the .NET Framework will supply these useful strings, but if you are going...
>...but is it possible to get a bit more fine-grained error messages. Yes. Go ahead and catch `IOException`, and use the `Exception.ToString()` method to get a relatively relevant error message to display. Note that the exceptions generated by the .NET Framework will supply these useful strings, but if you are going...
Infragistics WebTextEdit - Setting value in Javascript function
|infragistics|webtextedit|c#|.net|2.0|
I'm currently using the Infragistics component set for .Net 2.0, Visual Studio 2005 and C#. I have the following chunk of javascript code (text and other variables are declared elsewhere): > ***alert(box[select].value); > text.value(box[select].value); > alert(text.value);*** 'text' is an Infragistics we...
|c#|asp.net|javascript|infragistics|
One thing you could do is add the username as a value to the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList Use the username (As a REG_DWORD) and a value of 1 to show the user and 0 to hide.
For legacy fixes/cleanup, there are tools, like [SQLCompare][1], that can generate scripts to sync databases. For .NET shops running SQL Server, there is also the [Visual Studio Database Edition][2], which can create change scripts for schema changes that can be checked into source control, and automatically built u...
jmockit can do this. See my answer in http://stackoverflow.com/questions/22697#93675
I've played with PRADO some, but I felt that if I'm going to be forced into post-back-hell i might as well do it on the platform that it was built for in the beginning - .NET, other then that PRADO is relatively "untalked" about in the blogs, etc. I don't know why really though.
How should I move queued messages from IIS to Exchange on different servers?
|iis|email|smtp|exchange-server|
We currently have a company email server with Exchange, and a bulk email processing server that is using IIS STMP. We are upgrading to a 3rd party MTA (zrinity xms) for bulk sending. I need to be able to keep sending the messages already queued for IIS when we switch to the 3rd party sofware. Can I simply move the IIS ...
Wrong 'Local Path' in DCOM Config entry
|dcom|dcomcnfg|
I have a component in DCOM Config whose 'Local Path' (on the General tab of the Properties page for that component in dcomcnfg) is pointing to the wrong place. However when I go to that directory and unregister the component using "componentname.exe /unregserver", the Local Path for that component remains unchanged. ...
>...but is it possible to get a bit more fine-grained error messages. Yes. Go ahead and catch `IOException`, and use the `Exception.ToString()` method to get a relatively relevant error message to display. Note that the exceptions generated by the .NET Framework will supply these useful strings, but if you are going...
Visual Assist: you cannot live without it!
Active record is very heavy, data mapper and domain object are separating those concerns out so you have a more defined set of code doing various aspects for you "domain" or "entity" objects. I personally prefer, not that you asked, going with the separation into domain object, data mapper, probably use an assembly ...
1. Try forging your UserAgent -U "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-GB; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1" 2. Disable Ceritificate Checking ( slow ) --no-check-certificate 3. Debug whats happening by enabling verbostity -v 4. Eliminate need f...
Hmm, sound a bit odd, a quick google gave me [this top result][1] which talks about using an Iframe and Silverlight on the same page, without problems. Also a quick test with the following code: <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Register Assembly="System.Web.Silverlight" Namespac...
Drop the first marble from the 3rd floor. If it breaks, you know it's floor 1 or 2, so drop the other marble from floor 2. If it doesn't break you've found that floor 2 is the highest. If it does break, you've found that floor 1 is the highest. 2 drops. If dropping from the 3rd floor does not break the marble, d...
Drop the first marble from the 3rd floor. If it breaks, you know it's floor 1 or 2, so drop the other marble from floor 2. If it doesn't break you've found that floor 2 is the highest. If it does break, you've found that floor 1 is the highest. 2 drops. If dropping from the 3rd floor does not break the marble, d...
Drop the first marble from the 3rd floor. If it breaks, you know it's floor 1 or 2, so drop the other marble from floor 2. If it doesn't break you've found that floor 2 is the highest. If it does break, you've found that floor 1 is the highest. 2 drops. If dropping from the 3rd floor does not break the marble, d...
Hmm, sound a bit odd, a quick google gave me [this top result][1] which talks about using an Iframe and Silverlight on the same page, without problems. Also a quick test with the following code: <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Register Assembly="System.Web.Silverlight" Namespac...
Hmm, sound a bit odd, a quick google gave me [this top result][1] which talks about using an Iframe and Silverlight on the same page, without problems. Also a quick test with the following code: <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Register Assembly="System.Web.Silverlight" Namespac...
You could give [shared-mime][1] a try (gem install shared-mime-info). Requires the use ofthe Freedesktop shared-mime-info library, but does both filename/extension checks as well as "magic" checks... tried giving it a whirl myself just now but I don't have the freedesktop shared-mime-info database installed and have t...
Hmmm. Had some time to test. I was able to get **SortExpression="Description.Length"** to work. Is this 1.1, 2.0 or 3.5?
XML namespaces and attributes
|xml|namespaces|xsd|
I'm trying to understand how namespaces work in XML. When I have an element like foo:bar, the attributes will often not have namespaces on them. But sometimes they will. Are the attribute in the namespace of the element, even when the default namespace has been declared? Looking over the xsd for xhtml it seems the attr...
How do I do monkeypatching in python?
|python|monkeypatching|
I've had to do some introspection in python and it wasn't pretty: name = sys._getframe(1).f_code name = "%s:%d %s()" %(os.path.split(name.co_filename)[1],name.co_firstlineno,name.co_name) To get something like foo.py:22 bar() blah blah In our debugging output. I'd ideally like to pre...
@Joel (re: complex queries, joins, etc) The NHibernate and Castle ActiveRecord tool can handle very complex queries and joins via class relationships and a thorough 'Expression' class (which you can add to the query methods) or the use of the 'Hibernate Query Language' (HQL). You can Google any of these details, ...