instruction stringlengths 0 30k ⌀ |
|---|
All the objects in the serialization graph have to serializable.
Check these links if you want to debug further..
[Changing where XmlSerializer Outputs Temporary Assemblies][1]
[HOW TO: Debug into a .NET XmlSerializer Generated Assembly][2]
[1]: http://www.hanselman.com/blog/CategoryView.aspx?category... |
All the objects in the serialization graph have to serializable.
Since XMLSerializer is a blackbox, check these links if you want to debug further into the serialization process..
[Changing where XmlSerializer Outputs Temporary Assemblies][1]
[HOW TO: Debug into a .NET XmlSerializer Generated Assembly][2]
... |
All the objects in the serialization graph have to be serializable.
Since XMLSerializer is a blackbox, check these links if you want to debug further into the serialization process..
[Changing where XmlSerializer Outputs Temporary Assemblies][1]
[HOW TO: Debug into a .NET XmlSerializer Generated Assembly][2] ... |
Using compression does not hurt your page ranking. Matt Cutts talks about this in his article on [Crawl Caching Proxy][1]
Your page load time can also be greatly improved by [resizing your images][2]. While you can use the height and width attributes in the img tag, this does not change the size of the images that i... |
If this was my problem, I'd look for ways to avoid mucking with the system time. Isolating the code under unit tests, or a virtual machine, or something.
However, because I love [PowerShell][1]:
Get-ChildItem -r . |
? { $_.LastWriteTime -gt ([DateTime]::Now) } |
Set-ItemProperty -Name "La... |
If one element uses a namespace, they all must use one. In case you don't define one on your own the framework will add a empty namespace as you have noticed. And, sadly, there is no switch or something similiar to suppress this "feature".
So, there seems to be no better method as to strip it out. Using *Replace(" x... |
System.IO.Path.Combine will work great for many different types of paths:
<http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx>
Examples:
string path1 = "c:\\temp";
string path2 = "subdir\\file.txt";
string path3 = "c:\\temp.txt";
string path4 = "c:^*&)(_=@#'\\^.*(.txt";
... |
System.IO.Path.Combine will work great for many different types of paths:
<http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx>
System.IO.Path.Combine uses the current platform standard separators to combine paths. That means on Windows it uses "\" and on unix/linux (mono) it uses "/". Can you giv... |
I have used Excel's own status bar (in bottom left of window) to display progress information for a similar application I developed in the past.
It works out very well if you just want to display textual updates on progress, and avoids the need for an updating dialog at all. |
I have used Excel's own status bar (in bottom left of window) to display progress information for a similar application I developed in the past.
It works out very well if you just want to display textual updates on progress, and avoids the need for an updating dialog at all.
Ok, here's an example of the kind of t... |
I have used Excel's own status bar (in bottom left of window) to display progress information for a similar application I developed in the past.
It works out very well if you just want to display textual updates on progress, and avoids the need for an updating dialog at all.
Ok @JonnyGold, here's an example of th... |
Look the indexes on the tables that make the query. An indexes may be needed on particular fields that participate in the where clause. Also look at the fields used in the joins in the query (if joins exist). If indexes already exist, look at the type of index.
Failing that (because there are negatives to using... |
Look at the indexes on the tables that make the query. An indexes may be needed on particular fields that participate in the where clause. Also look at the fields used in the joins in the query (if joins exist). If indexes already exist, look at the type of index.
Failing that (because there are negatives to us... |
How to save the output of a console application |
|c#|.net|console|stdout| |
I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program execution.
The workaround I use while I don't fi... |
If you're comfortable with C++ syntax and style, you might find [D](http://www.digitalmars.com/d/) to be an interesting language. Or if you want to branch out, any of Python, C#, Java, Ruby would be excellent choices. |
C# if you're in the Microsoft ecosystem.
Python and Ruby seem to have the most traction in the Linux/Unix/etc space.
ObjectiveC is dominant on the Macintosh and iPhone. The most recent MacOS implements garbage collection for a subset of the frameworks, but to use the rest you'd have to do resource management your... |
Just want to add, there's also the resources expression
<%$ Resources:resource, welcome%>
and asp.net would look for localized version of "welcome" in satellite assemblies automatically. |
Take a look at [RoutedCommand][1]s.
Define your command in myclass somewhere as follows:
public static readonly RoutedCommand Login = new RoutedCommand();
Now define your button with this command:
<Button Command="{x:Static myclass.Login}" />
You can use CommandParameter for extra infor... |
Take a look at [RoutedCommand][1]s.
Define your command in myclass somewhere as follows:
public static readonly RoutedCommand Login = new RoutedCommand();
Now define your button with this command:
<Button Command="{x:Static myclass.Login}" />
You can use CommandParameter for extra infor... |
check out the <a href="http://en.wikibooks.org/wiki/Wikibooks:Programming_languages_bookshelf">programming section of wikibooks</a>
Many of them are fully formed, and quite a few have more advanced sections (which are in varying states of completion) on specific functionality.
also, <a href="http://www.w3schools.... |
I don't think it has any purpose. But because RegEx is almost impossible to understand/decompose, people rarely point out errors. That is probably why no one else pointed it out. |
Using LIKE will cause a number of problems as it will require a table scan every single time when the LIKE comparator starts with a %. This forces SQL to check every single row and work it's way, byte by byte, through the string you are using for comparison. While this may be fine when you start, it quickly causes scal... |
With regard to using non-generic collections for storing heterogeneous collections of stuff, you can always use List<object> to accomplish the same thing. For this reason alone, I'd say there's almost no reason at all to touch the non-generic collections ever again.
The exception to this would be to maintain ... |
Don't forget Ctrl+Shift+L, which displays a list of all the keyboard shortcut combinations (just in case you forget any of those listed here). |
If your website is compiled as updatable, you'll see a bunch of .ASPX files in your virtual directory. These must be compiled on startup. That's so you can come in and alter the web UI itself. This is default for both websites and web applications. |
Iterators are only equivalent to pointers in the trivial case of iterating over the contents of an array in sequence. An iterator could be supplying objects from any number of other sources: from a database, from a file, from the network, from some other calculation, etc. |
I wouldn't jump and say that are obsolete or are going to be removed anytime soon.
It's true that you should avoid using non-generic collections unless you have a reason **not** not use a generic version. Thousands of lines of legacy (not so legacy) code is still floating around (and will be for years) that support n... |
Your best bet is RegEx because it provides a much greater degree of flexibility than any of the other options.
While you could use `IndexOf` to handle somethings, you may quickly find yourself writing code that looks like:
> `if(s.IndexOf("search1")>-1 || s.IndexOf("search2")>-1 ||...`
That can be handled in ... |
Looking at the resource files isn't really "disassembling" (not really) and if that's all you want to do you can just open the .exe or .dll inside Visual Studio or a similar tool and it will give you a resources view. |
SQLite/PHP read-only? |
|php|sqlite|permissions|pdo| |
I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culp... |
I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culp... |
I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culp... |
How do I inserting text into textbox after popping up another window to request information? |
|javascript|c#|asp.net| |
I have an asp.net web page written in C#. Using some javascript I popup another .aspx page which has a few controls that are filled in and from which I create a small snippet of text. When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "popped up" the d... |
How do I insert text into a textbox after popping up another window to request information? |
|c#|asp.net|javascript| |
Self-bound generics:
class SelfBounded<T extends SelfBounded<T>> {
}
<http://www.artima.com/weblogs/viewpost.jsp?thread=136394> |
What you could do is create an ajax modal pop-up instead of a new window. The semantic and aesthetic value is greater not to mention the data-passing is much easier.
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx |
Without writing the code, my logic would be:
Generate a random string from whatever acceptable characters you like.
Then add half the date stamp (partial seconds and all) to the front and the other half to the end (or somewhere in the middle if you prefer).
Stay JOLLY!
H |
How do you set up a python wsgi server under IIS with fastcgi? |
|python|iis|fastcgi| |
I work in a windows environment and would prefer to deploy code to IIS. At the same time I would like to code in python. Having read that IIS can run fastCGI application, I went to the IIS site where it describes in detail how to get PHP up and running but not much about anything else. Does anyone have experience gett... |
How do you set up a python wsgi server under IIS? |
|python|iis| |
PowerShell provides great command line parsing options for free. When you create a cmdlet, you define properties and use attributes to determine command line options. The PowerShell runtime then handles the parsing of input for you.
Also, since PowerShell works with .NET objects, the result of your commands can be... |
If you use your original method, but add the username or emailaddress in front of the password, it will always be unique if each user only can have 1 password. |
You may be interested in this article which deals with the same issue: [GUIDs are globally unique, but substrings of GUIDs aren't](http://blogs.msdn.com/oldnewthing/archive/2008/06/27/8659071.aspx).
>> The goal of this algorithm is to use the combination of time and location ("space-time coordinates" for the relativ... |
Does anyone know the shortcut to open a file within your solution |
|visual-studio|resharper|keyboard-shortcuts| |
In visual studio 2008 + Resharper?
Thanks! |
You do not lose LINQ, you lose LINQtoSQL. LINQ itself is more generic as it can be used on anything that implements iQueryable.
You lose the SqlDataSource, not a big deal.
You lose some of the integration the server explorer does for you with sql server, again not a big deal.
As far as im concerned you dont lo... |
I would look in to understanding more details about Python syntax. Often times if a piece of code looks odd, there usually is a better way to write it. For example, in the above example:
bar = foo if baz else None
while bar not biz:
bar = i_am_going_to_find_you_biz_i_swear_on_my_life()
d... |
Extracting SVN data with Java |
|java|svn| |
Does anyone know a good Java lib that will hook into SVN so I can extract the data? I want the SVN comments, author, path, etc... Hopefully with this data I can build a better time management tracking system. |
You want [SVNKit][1]. It's dual-licensed, so you have to pay only if you're doing commercial work with it.
[1]: http://svnkit.com/ |
I believe directionals are only captured on `KeyDown` and `KeyUp`, not on `KeyPress`.
Alternatively to using a ComboBox, you could use several RadioButtons if the numer of ListItems is static and relatively small. |
You're describing regular expressions! Use that as the underpinning for what you need to do. |
Another one from Delphi, which I think is a little more rigorous than the other Delphi example submitted. This can easily turn into a golfing match, but I've tried to make mine readable.
function TForm1.IsPalindrome(txt: string): boolean;
var
i, halfway, len : integer;
begin
Result := ... |
@ckarras: I would rather not use an external tool, because I want the HTML pages to be created programmatically and not manually.
@jttraino: I don't have a time interval in which the site needs to be outputted- the uotput has to occur when a user creates a new site.
@Frank Krueger: I don't really understand how t... |
I'd like to second the suggestion from [epatel](#31783) - I voted up, but can't comment yet.
SCTP has many great features and flexibility. You can sub-divide your connection into multiple streams, and choose the reliablity of each. Alternatively, with the [Partially Reliability](www.ietf.org/rfc/rfc3758.txt) ext... |
@[epatel](#31783):- I second the SCTP suggestion (I voted up, but can't comment yet).
SCTP has many great features and flexibility. You can sub-divide your connection into multiple streams, and choose the reliablity of each. Alternatively, with the [Partially Reliability](www.ietf.org/rfc/rfc3758.txt) extension,... |
@[epatel](#31783):- I second the SCTP suggestion (I voted up, but can't comment yet so additional stuff here).
SCTP has many great features and flexibility. You can sub-divide your connection into multiple streams, and choose the reliablity of each and whether it is ordered or not. Alternatively, with the [Parti... |
@epatel - I second the SCTP suggestion (I voted up, but can't comment yet so additional stuff here).
SCTP has many great features and flexibility. You can sub-divide your connection into multiple streams, and choose the reliablity of each and whether it is ordered or not. Alternatively, with the [Partially Relia... |
A pointer to an array element is indeed an iterator into the array.
As you say, in Java, an iterator has more knowledge of the underlying container than in C++. C++ iterators are general, and a *pair* of iterators can denote any range: this can be a sub-range of a container, a range over multiple containers (see <ht... |
Aligning text in SVG |
Well if you're looking for a very high level of abstraction and memory management then I'd say lisp would be an ideal candidate. I'm <a href="http://gigamonkeys.com/book/">learning</a> it now, slowly, and it's the most fun I've had with a new language.
Having said that Python or Ruby may be a better compromise betw... |
I don't think there's anything wrong with your approach.
If you wanted reusable code, consider implementing a class called `MultiWriter` or somesuch that takes as input two (or N?) `TextWriter` streams and distributes all writs, flushes, etc. to those streams. Then you can do this file/console thing, but just as ea... |
Probably not what you want, but just in case... Apparently, [PowerShell implements][1] a version of the venerable `tee` command. Which is pretty much intended for exactly this purpose. So... smoke 'em if you got 'em.
[1]: http://en.wikipedia.org/wiki/Tee_(command)#Windows_PowerShell |
Some things to be prepared for:
+ you'll be cross-compiling. The embedded device will use a MIPS, PowerPC, or ARM CPU but won't have enough CPU power, memory, or storage to compile its own kernel in a reasonable amount of time.
+ An embedded system often uses a serial port as the console, and to lower the cost th... |
Here's one that can save your bacon from time to time:
obj = {a:"test"};
var a = obj.a;
var b = obj["a"];
a == b;
Some people don't know this and end up with code like this:
var str = "a";
var a = eval("obj." + str);
Not only is the above easier to read, it's also a lot safer and... |
This is actually a harder problem than it sounds like, mainly because many mathematically-correct solutions will fail to actually allow you to hit all the possibilities (more on this below).
First, here are some easy-to-implement, correct-if-you-have-a-truly-random-number generator:
(1) Generate a list of n pairs... |
GWT context.xml in shell mode |
|google|gwt|java| |
I'm trying to get the **GWTShell** mode to load my *context.xml* file in which my database is described.
The only usable info can be found [here][1], but this doesn't seem to work for the *context.xml* part.
[1]: http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit-plugin/configure_tomcatlite.html |
|java|gwt| |
It won't matter to specify "variables" when you create the variable, because foo will be placed in the variables scope by default; but it will matter when you access the variable.
<cfcomponent>
<cfset foo = "a private instance variable">
<cffunction name="doSomething">
<cfargument... |
It won't matter to specify "variables" when you create the variable, because foo will be placed in the variables scope by default; but it will matter when you access the variable.
<cfcomponent>
<cfset foo = "a private instance variable">
<cffunction name="doSomething">
<cfargument... |
It won't matter to specify "variables" when you create the variable, because foo will be placed in the variables scope by default; but it will matter when you access the variable.
<cfcomponent>
<cfset foo = "a private instance variable">
<cffunction name="doSomething">
<cfargument... |
throw new HttpException(404, "Article not found");
This will be caught by ASP.NET which will return the customErrors page. Learned about this one in a [recent .NET Tip of the Day Post][1]
[1]: http://dotnettipoftheday.org/tips/how-to-respond-with-code-404-not-found-in-aspnet.aspx?discussion=1 |
I usually do it like this:
$this->password = '';
for($i=0; $i<10; $i++)
{
if($i%2 == 0)
$this->password .= chr(rand(65,90));
if($i%3 == 0)
$this->password .= chr(rand(97,122));
if($i%4 == 0)
$this->password .= chr(rand(48,57));
... |
Off the top of my head, the solution that makes the most sense would be to pick a letter out of the input string randomly and filter the dictionary based on words that start with that. Then pick another, filter on the second letter, etc. In addition, filter out words that can't be made with the remaining text. Then ... |
The best way to go is to use a proxy cache (Squid, Varnish) and serve appropriate Cache-Control/Expires headers, along with ETags : see <a href="http://www.mnot.net/cache_docs/">Mark Nottingham's Caching Tutorial</a> for a full description of how caches work and how you can get the most performance out of a caching pro... |
I usually do a random substring (randomize how many chars between 8 an 32, or less for user convenience) or the MD5 of some value I have gotten in, or the time, or some combination. For more randomness I do MD5 of come value (say last name) concatenate that with the time, MD5 it again, then take the random substring. Y... |
You will have to do something like:
parent.opener.document.getElemenyById('ParentTextBox').value = "New Text"; |
I would run a *svn st* in the web folder (to find any files that are changed since the checkout) and compare that to the repository. |
**Any algorithm will result in duplicates**.
Therefore, might I suggest that you use your existing algorithm* and simply check for duplicates?
*Slight addition: If `uniqid()` can be non-unique based on time, also include a global counter that you increment after every invocation. That way something is different ... |
Actually the downtime at the LSE had absolutely nothing to do with it's .NET trading platform:
>The LSE said the system had been hit by a "connectivity issue" and insisted that the problem did not lie with its flagship TradElect trading platform.
[http://www.itworld.com/networking/54760/london-stock-exchange-trad... |
|xml|svg| |
I am trying to SVG XML documents with a mixture of lines and brief text snippets (two or three words typically). The major problem I'm having is getting the text aligning with line segments.
For horizontal alignment I can use `text-anchor` with `left`, `middle` or `right`. I can't find a equivalent for vertical ali... |
The simplest way to make this happen is to fire an HTTP request using a library like [libcurl][1] and make it download an ini or xml file which contains the online version and where a new version would be available online.
After parsing the xml file you can determine if a new version is needed and download the new v... |
Just put an (XML) file on your server with the version number of the latest version, and a URL to the download the new version from. Your application can then request the XML file, look if the version differs from its own, and take action accordingly. |
I think that simple XML file on the server would be sufficient for version checking only purposes.
You would need then only an ftp account on your server and build system that is able to send a file via ftp after it has built a new version. That build system could even put installation files/zip on your website dire... |
On the server you could just have a simple file "latestversion.txt" which contains the version number (and maybe download URL) of the latest version. The client then just needs to read this file using a simple HTTP request (yes, to port 80) to retrieve http://your.web.site/latestversion.txt, which you can then parse to... |
If you want to keep it really basic, simply upload a version.txt to a webserver, that contains an integer version number. Download that check against the latest version.txt you downloaded and then just download the msi or setup package and run it.
More advanced versions would be to use rss, xml or similar. It would ... |