instruction stringlengths 0 30k ⌀ |
|---|
I would have a look at the Parallel extensions to the .net framework. It is still in ctp, however it supposed to make the best use of multi core processors. The easiest place to get started for .net is on the [parallel teams blog][1]
As for java i have no idea.
[1]: http://blogs.msdn.com/pfxteam/ |
How popular is WPF as a technology? |
|wpf| |
I had a discussion with some colleagues mentioning that there are not too many projects that we do which make use of WPF for creating UI for a windows application (we almost always use Windows Forms instead).
* Are your experiences the same - i.e. there is not too much adoption of this technology?
* Why do you thin... |
|wpf| |
Gitty is under development right now, basically I am working on it and it is in turn working off of BazaarX which is under heavy restructuring right now. Gitty will essentially be BazzarX with the Bazaar backend ripped out and a GIT backend put in instead and any UI tweaks made for GIT Differences from Bazaar (ie hashe... |
Try this:
var matches = dict.Values.Where(rec => rec.Name == "foo").ToList();
Be aware that that will essentially be creating a new list from the original Values collection, and so any changes to your dictionary won't automatically be reflected in your bound control. |
How can I convert IEnumerable<T> to List<T> in C#? |
|listview|linq|c#| |
I am using LINQ to query a generic dictionary and then use the result as the datasource for my ListView (WebForms).
Simplified code:
Dictionary<Guid, Record> dict = GetAllRecords();
myListView.DataSource = dict.Values.Where(rec => rec.Name == "foo");
myListView.DataBind();
I thought that would wo... |
|c#|linq|generics|listview| |
How to plot a long path with Virtual Earth |
|javascript|virtual-earth| |
The obvious way to plot a path with virtual earth (VEMap.GetDirections) is limited to 25 points. When trying to plot a vehicle's journey this is extremely limiting.
How can I plot a by-road journey of more than 25 points on a virtual earth map? |
You might also try:
var matches = new List<Record>(dict.Values.Where(rec => rec.Name == "foo"));
Basically generic collections are very difficult to cast directly, so you really have little choice but to create a new object. |
Yes - I've got experience with that - unfortunately it was no different from your own. I've generally avoided scrolling forms and used paging wherever possible on .Net CF. If this is an option for you, I'd recommend it.
I'd assume the scroll bar issue is to do with the form size being fixed to the width of the avail... |
C++ templates are actually much more powerful than their C# and Java counterparts as they are evaluated at compile time and support specialization. This allows for Template Meta-Programming and makes the C++ compiler equivalent to a Turing machine (i.e. during the compilation process you can compute anything that is co... |
myListView.DataSource = new List<Record>(dict.Values.Where(rec => rec.Name == "foo"));
or you could cast it
myListView.DataSource = (List<Record>) dict.Values.Where(rec => rec.Name == "foo"); |
|.net|vb.net|cast| |
Use a '*' wildcard in the AssemblyVersion attribute. Documentation is [here][1]. Note that if the application is built from multiple assemblies, the version you care most about is the one for the .exe.
[1]: http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx |
In one of the project files, probably AssemblyInfo.cs, the assembly version attribute is set to `[assembly: AssemblyVersion("3.5.*")]` or something similar. The * basically means it lets Visual Studio automatically set the build and revision number.
You can change this to a hard coded value in the format `<major ve... |
Incidentally, I think that the Turing completeness of templates shows that halting is overrated. Most languages guarantee that their compilers will halt; not so C++. Does this diminish C++ as a language? I don't think so; it has many flaws, but compiles that don't always halt aren't one of them. |
<a href="http://msdn.microsoft.com/en-us/library/s2dy91zy%28VS.80%29.aspx">MSDN</a> seems to indicate that the Cxxx casts for specific types can improve performance in VB .NET because they are converted to inline code. For some reason, it also suggests <a href="http://msdn.microsoft.com/en-us/library/7k6y2h6x.aspx">Di... |
It looks like I just needed to be more specific in my element selector although it is weird that a hard coded number would work.
jQuery('#pagination-digg li').eq(currentPage).addClass("active"); |
How are you doing the cross-platform calls? Is it all called from Java?
http://java.sun.com/docs/books/tutorial/i18n/text/string.html might be useful.
I'm a bit confused about exactly what you are trying to do. Is the database essentially interface between all the code? Then it should be easy - just make the DB ... |
My company recently started using Mojo Helpdesk: www.mojohelpdesk.com. It's a hosted service, not FOSS, but it's pretty cheap and the interface is slick. |
|security|command-line|hacks|injection| |
How do I specify "the word under the cursor" on VIM's commandline? |
|vim|commandline| |
I want to write a command that specifies "the word under the cursor" in VIM. For instance, let's say I have the cursor on a word and I make it appear twice. For instance, if the word is "abc" and I want "abcabc" then I could type:
:s/\(abc\)/\1\1/
But then I'd like to be able to move the cursor to "def" a... |
|command-line|vim| |
All that plus there's the fact that on the Win machine most probably an antivirus software will kick in during the CreateProcess... That's usually the biggest slowdown. |
About your first question, the effective maximum size for the *database* is usually determined by operating system, specifically the file size MySQL Server will be able to create, not by MySQL Server itself. Those limits play a big role in *table* size limits. And MyISAM works differently from InnoDB. So any tables wil... |
It definitely improves your code. Your tentatively formulated claim, that it's obscure and that code would merit from a `catch` block is simply not true in C++ because RAII is an established idiom. Resource handling in C++ *is* done by resource acquisition and garbage collection is done by implicit destructor calls.
... |
I haven't used this particular template but I've used something similar before. Yes, it does lead to clearer code when compared to equally robust code implemented in different ways. |
I would recommend <a href="http://www.ektron.com">Ektron CMS400.net</a> -- it's an excellent CMS with great built-in translation. |
You already implicitly have multiple implicit return statements, caused by error handling, so deal with it.
As is typical with programming, though, there are examples both for and against the multiple return practice. If it makes the code clearer, do it one way or the other. Use of many control structures can help... |
|build-process|ant| |
May be worth checking out this article on [F# "101"](http://www.code-magazine.com/Article.aspx?quickid=0809051) on CoDe Mag recently posted.
Also, [Dustin Campbell has a great blog](http://diditwith.net/) where he has posted many articles on his adventures on getting up to speed with F#..
I hope you find these us... |
Using MSTest with CruseControl.NET |
|cruisecontrol.net|buildprocess|msbuild| |
We have been using CrusiseControl for quite a while with NUnit and NAnt. For a recent project we decided to use the testing framework that comes with Visual Studio, which so far has been adequate.
I'm attempting to get the solution running in Cruise Control. I've finally got the build itself to work; however, I ha... |
|build-process|msbuild|cruisecontrol.net| |
Making a production build of a PHP project with Subversion |
|toroisesvn|svn|buildprocess| |
If you are working in PHP (or I guess any programming language...) and using subversion as your source control, is there a way to take your project (for example):
> C:\Projects\test\\.svn
> C:\Projects\test\docs\
> C:\Projects\test\faq.php
> C:\Projects\test\guestbook.php
> C:\Projects\test\index.php
... |
|svn|tortoisesvn|buildprocess| |
|svn|build-process|tortoisesvn| |
@Sean
> However, factoring out common finctionality into a base class, then reusing that in other descendant classes is a deeply elegant thing, IMHO!
But "procedural" developers have been doing that for decades anyway. The syntax and terminology might differ, but the effect is identical. There is more to OOP than... |
How do you prevent leading zeros from being stripped when importing an excel doc using c# |
|c#|asp.net|excel|ado.net| |
I'm able to connect to and read an excel file no problem. But when importing data such as zipcodes that have leading zeros, how do you prevent excel from guessing the datatype and in the process stripping out leading zeros? |
To reduce the risk you can also associate the originating IP with the session. That way an attacker has to be within the same private network to be able to use the session.
Checking referer headers can also be an option but those are more easily spoofed. |
Prefix with ' |
Every application has it's own performance profile for using a database, and chances are it will change over time.
The best thing you can do is to test your options. Switching between MyISAM and InnoDB is trivial, so load some test data and fire jmeter against your site and see what happens. |
This is the idiom I've always used to get a modified copy of a string without changing the original:
($new = $original) =~ s/foo/bar/; |
Prefixing the contents of the cell with ' forces Excel to see it as text instead of a number. The ' won't be displayed in Excel. |
Hmm, none that I know of. You can always retrieve the definitions as SQL and then run a diff tool on them, but it's a bit of a pain in the rear.
Probably the best solution for this is using some kind of "Migrations" tool, so you can keep your database definitions together with your code, and version them, etc. |
I think the way to do this would be to format the source excel file such that the column is formatted as Text instead of General. Select the entire column and right click and select format cells, select text from the list of options.
I think that would explicitly define that the column content is text and should be ... |
What is the best way to communicate with a SQL server? |
|c++|sql|database|c|mysql| |
I am going to be using c/c++, and would like to know the best way to talk to a MySQL server. Should I use the library that comes with the server installation? Are they any good libraries I should consider other than the official one? |
@Thomas Owens: (re source control) Yes, but that's not source control in the same sense that I can check in a .cs file (or .cpp file or whatever) and go and pick out any revision I want. To do that with database code requires a potentially-significant amount of effort to either retrieve the procedure from the database ... |
myListView.DataSource = (List<Record>) dict.Values.Where(rec => rec.Name == "foo"); |
Not an expert with this stuff but it looks like the first 3 parts of the address are being masked out. Is it possible that the mobile device is being given a network mask of:
255.255.255.0
As to reach beyond the range of the first 3 parts you need the mask to be:
255.255.0.0
This may be an oversimplificatio... |
For linux:
$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'open.*tnsnames.ora'
shows something like this:
open("/opt/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora", O_RDONLY) = 7
Changing to
$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'tnsnames.ora'
will show all the fi... |
For linux:
$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'open.*tnsnames.ora'
shows something like this:
open("/opt/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora",O_RDONLY)=7
Changing to
$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'tnsnames.ora'
will show all the file ... |
`disable-output-escaping` isn't evil in itself, but there are only few cases where you should use it and this isn't one of them. In XSLT you work with trees, not markup string. Here's an XSTL 1.0 solution:
<xsl:template match="/STORIES/STORY">
<component>
<xsl:if test="ARTICLEBODY">
<x... |
The ViewData.Eval("DisplayMessage") method should work for you. |
I believe a good way to do this is to [render the HTML to an image](http://weblogs.mozillazine.org/roc/archives/2005/05/rendering_web_p.html) and then use some [diff tool that can compare images](http://www.scootersoftware.com/) to spot the differences. |
Neep Alt 13/17 is very good. |
[RT - Request Tracker][1] handles inbound mail. I'm working to add inbound mail support to [TicketDesk][2], but that might be a little while before that makes it into a release.
[1]: http://bestpractical.com/rt/
[2]: http://codeplex.com/ticketdesk |
I don't know how hard people think it is, so I can't say if it is easier. However, you are right in your observation that undecidability of a problem (in general) does not mean that all instances of that problem are undecidable. For instance, I can easily tell you that a program like `while false do something` terminat... |
Styling Html Helpers MVC.Net |
|css|asp.net-mvc|html-helper| |
If i have a html helper like so:
Name:<br />
<%=Html.TextBox("txtName",20) %><br />
How do i apply a css class to it? Do i have to wrap it in a span? Or do i need to somehow utilize the HtmlAttributes property of the helper?
|
We use FogBugz...er, "fooogzeeebugzo"...and while it may be a bit expensive for your needs, it works very well. |
You can try and cut stuff out with vLite, but unless you cut out a real lot it's not going to save a ton of drive space. Here's your best bets:
- Disable Hibernate and run disk cleanup to remove any hibernation file.
- Disable System restore entirely and use disk cleanup to remove all restore points... this wil... |
I also faced the same problem, and I could not find any other way but splitting the single SQL operation in separate files, then executing all of them in sequence.
Obviously the problem is not with lists of DML commands, they can be executed without GO in between; different story with DDL (create, alter, drop...)
... |
<a href="http://bugzilla.org>bugzilla</a> is more of an issue tracker than a request tracker, but it can be configured to handle email-based status tracking. That said, I think Steven has it- RT is the standard recommendation for this that I've seen. |
How to get your network support team behind click-once? |
|smart-client| |
I'm trying to make the case for click-once and smart client development but my network support team wants to keep with web development for everything.
What is the best way to convince them that click-once and smart client development have a place in the business? |
You could try.
[Brian the build bunny][1]
:-)
[1]: http://www.woodwardweb.com/gadgets/000434.html |
How can you easily reorder columns in LINQ to SQL designer? |
|c#|linq-to-sql|linq| |
When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste properties about, or delete them and re-... |
|c#|linq|linq-to-sql| |
When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste properties about, or delete them and re-... |
How to use LINQ To SQL in an N-Tier Solution? |
|linq-to-sql|n-tier-architecture| |
Now that LINQ to SQL is a *little* more mature, I'd like to know of any techniques people are using to create an n-tiered solution using the technology, because it does not seem that obvious to me. |
They have a place in the Windows environment but not in any other environment and so if you intend on writing applications for external clients, then your probably best sticking with Web based development.
I heard this "Write Once, Run Many" before from Microsoft when Asp.net 1.1 was released, it never happened in p... |
Different solutions/project files for Local vs Build environments |
|buildprocess| |
As part of improvements to our build process, we are currently debating whether we should have separate project/solution files on our CI production environment from our local development environments.
The reason this has come about is because of reference problems we experienced in our previous project. On a freque... |
|build-process| |
best .net build tool |
|.net|buildprocess|nant| |
What is the best build tool for .net. I currently use [nant][1] but only because I have experience with [ant][2]. Do people prefer msbuild ?
[1]: http://nant.sourceforge.net/
[2]: http://ant.apache.org/ |