instruction
stringlengths
0
30k
For non-sorted the best choice, more than nine times out of ten, will be: ArrayList, HashMap, HashSet. Vector and Hashtable are synchronised and therefore might be a bit slower. It's rare that you would want synchronised implementations, and when you do their interfaces are not sufficiently rich for thier synchronis...
How can you databind a single object in .NET ?
|.net|data-binding|
I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ? The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to the que...
In ASP.NET2.0 you can use the generic collections to make this single object a list of only one object in it that you can databind to any server control using the objectdatasource, e.g. List<clsScannedDriverLicense> DriverLicenses = new List<clsScannedDriverLicense>(); //this creates a generic collec...
I believe I understand the problem. The exception is being caught, the issue is confusion over the debugger's behavior and differences in the debugger settings among each person trying to repro it. In the 3rd case from your repro I believe you are getting the following message: "NoViableAltException was unhandled by...
Why is .NET exception not caught by try/catch block?
|c#|.net|exception|
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
What kind of technologies are available for sending text messages?
|c#|mobile|messaging|
I'm looking into sending regular automated text-messages to a list of subscribed users. Having played with Windows Mobile devices, I could easily implement this using the compact .Net framework + a device hooked up to usb and send the messages through this. I would like to explore other solutions like having a server o...
How can I modify a Work Item type to include additional information in TFS?
|teamfoundationserver|workitem|
TFS2008. I'd like to track task points on a Task work item, but there isn't anywhere (other than the description) to record this. I'd like to add a dropdown with 0, 1, 2, 3, 5, 8, etc, so these task points can be exported in reports.
|workitem|tfs|
|tfs|visual-studio-team-system|workitem|
[Chaco](http://code.enthought.com/chaco/) from [enthought](http://www.enthought.com/) is another option
agree with all the above, but also: when you decide that you want to optimize: 1. Fix algorithmic aspects before syntax (for example don't do lookups in large arrays) 2. Make sure that you prove that your change really did improve things, measure everything 3. Comment your optimization so the next guy seeing t...
You can usually get an account with an sms service provider and send messages using an API (SOAP, resful http, smpp ....) A google search for sms service provider yeilds many results with varying costs. Here is an informative article [How to Choose an SMS Service Provider](http://www.developershome.com/sms/howToCho...
You could always try a third-party gateway service for this. Somebody like [clickatell](http://www.clickatell.com) provide a number of services and APIs to make this work in a variety of countries. This isn't an ad! I only used their services for a technology pilot. There are quite a few of these around.
How Did You Decide Between WISA and LAMP?
|architecture|web-application|lamp|platform|wisa|
Did you ever have to choose between WISA or LAMP at the beginning of a web project? While pros and cons are littered around the net, it would be helpful to know about your real experience in coming up w/ criteria, evaluating, deciding, and reflecting upon your decision to go w/ either platform.
|architecture|web-applications|lamp|platform|wisa|
The switch statement is not the same thing as a big if-else statement. Each case must be unique and evaluated statically. The switch statement does a constant time branch regardless of how many cases you have. The if-else statement evaluates each condition until it finds one that is true.
> The switch statement is not the same > thing as a big if-else statement. > Each case must be unique and evaluated > statically. The switch statement does > a constant time branch regardless of > how many cases you have. The if-else > statement evaluates each condition > until it finds one that is true. E...
Theoretically there are useful [Big-Oh][1] tradeoffs, but in practice these almost never matter. In real-world benchmarks, `ArrayList` out-performs `LinkedList` even with big lists and with operations like "lots of insertions near the front." Academics ignore the fact that real algorithms have constant factors that...
@[Brian Ensink][1] Brian, You're confusing the C# switch statement with the CIL switch instruction. The CIL switch is a jump table, that requires an index into a set of jump addresses. This is only useful if the C# switch's cases are adjacement: case 3: blah; break; case 4: blah; break; ...
@[Brian Ensink][1] Brian, You're confusing the C# switch statement with the CIL switch instruction. The CIL switch is a jump table, that requires an index into a set of jump addresses. This is only useful if the C# switch's cases are adjacent: case 3: blah; break; case 4: blah; break; ca...
Call Visitors web stat program from PHP
|statistics|cgi|analytics|visitors|php-safe-mode|
I've been looking into different web statistics programs for my site, and one promising one is [Visitors][1]. Unfortunately, it's a C program and I don't know how to call it from the web server. I've tried using PHP's [shell_exec][2], but my web host ([NFSN][3]) has PHP's [safe mode][4] on and it's giving me an error m...
Visitors looks like a log analyzer and report generator. Its probably best setup as a chron job to create static HTML pages once a day or so. If you don't have shell access to your hosting account, or some sort of control panel that lets you setup up chron jobs, you'll be out of luck.
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
Take a look here [http://windowsclient.net/][1] and here [Windows Presentation Foundation (WPF)][2] Basically WPF is created to make windows form easier to design because of the use of XAML, designers can work on the design and programmers on the underlying code [1]: http://windowsclient.net/ [2]: http://m...
WPF is the Windows Presentation Foundation. It is Microsoft's newest API for building applications with User Interfaces (UIs), working for both standalone and web-based applications. Unsurprisingly, there is a very detailed but not all that helpful [Windows Presentation Foundation page at Wikipedia][1]. The [WPF...
There are a large number of ways to store data - even "relational databse" covers a range of alternatives from a simple library of code that manipulates a local file (or files) as if it were a relational database on a single user basis, through file based systems than can handle multiple-users to a generous selection o...
Try Prevayler: [http://www.prevayler.org/wiki/][1] [1]: http://www.prevayler.org/wiki/
Try Prevayler: [http://www.prevayler.org/wiki/][1] [1]: http://www.prevayler.org/wiki/ Prevayler is alternative to RDBMS. In the site have more info.
WPF is the next frontier with Windows UIs. - Built on top of DirectX, it opens up hardware acceleration support for your .Net 3.0+ user-interfaces. - Emphasis on Vector Graphics - UIs scale and render better - Composable UIs. You could nest animated buttons in combo boxes.. the world's your oyster. ...
Error 1012 is rather generically ERROR_CANT_READ. See this [Microsoft list][1], but it also implies it refers to the registry. You could try running SysInternals [Process Monitor][2] to look for failing file/registry operations by the process. [1]: http://msdn.microsoft.com/en-us/library/ms681383(VS.85).aspx ...
That explains the problem I had with my app--it was a Rails app, which also has 404 pages with red applied to some of the styles. Makes a whole lot more sense now than it did back then. Too bad you can't accept your own answer!
Why don't you do something like 1stChar + (10 x 2ndChar) + 100 x (3rdChar) ...., where you use the simple integer value of each character, i.e. a = 1, b = 2 etc, or just the integer value if it's not a letter. This will give a unique value for each string, even for 2 strings that are just the same letters in a differen...
How long are the strings? If they are very short, then a unique ID can be generated by considering the characters as digits in base 36 (26 + 10) that form a *n*-digits number where *n* is the length of the string. On the other hand, if the strings are short enough to allow this, direct comparison won't be an issue anyw...
Perhaps: String y = "oiu291981u39u192u3198u389u28u389u"; BigInteger bi = new BigInteger(y, 36); System.out.println(bi);
I'm not sure if this is exactly what you're looking for, but there is a method in NSString that will sanitize a URL: [stringByAddingPercentEscapesUsingEncoding:][1] [1]: http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/doc/uid/20000...
Routing does not distinguish between URLs ending with a / and URLs that don't end in /.
A few questions in the beginning: 1. Did you test that simple string comparison is too slow? 1. How the comparison looks like ('ABC' == 'abc' or 'ABC' != 'abc')? 1. How many string do you have to compare? 1. How many comparison do you have to do? 1. How your strings look like (the length, letter case)? ...
If I get it right, you (should) have 2 models. A Route model, and a Stop model. Here's how I would define these models: class Route < ActiveRecord::Base has_and_belongs_to_many :stops belongs_to :stop, :foreign_key => 'destination_id' end class Stop < ActiveRecorde::Base h...
Inline CSS only for clarity here. Use a real stylesheet. <!-- First, your background image is a DIV with a background image style applied, not a IMG tag. --> <div style="background-image:(url=YourBackgroundImage);"> <!-- Second, create a placeholder div to assist in positioning ...
(this is what finally got everything to work for me) Make sure EVERY socket that the socket in A connects to has socket.SetSocketOption(SocketOptionLevel.Socket(/IP),SocketOptionName.ReuseAddress, true); set upon being initiated.
(this is what finally got everything to work for me) Make sure EVERY socket that the socket in A connects to has socket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.ReuseAddress, true); set upon being initiated.
@buti-oxa: Not to be pedantic, but your code is invalid. The HTML `width` and `height` attributes do not allow for units; you're likely thinking of the CSS `width:` and `height:` properties. You should also provide a content-type (`text/css`; see Espo's code) with the `<style>` tag. <style type="text/css"> ...
I'll second the vote for SQLite. I'm not sure what you're trying to accomplish but if you're doing any sort of local storage with syncing SQLite is a good choice. It has very widespread adoption and a lot of community support.
We use [jtcron][1] for our scheduled background tasks. It works well, and if you understand cron it should make sense to you. [1]: http://www.jarretttaylor.com/java/jt-cron.html
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
I'm working on a project using the [ANTLR][1] parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it an...
The question is how to generate a temporary file **name**. Neither mkstemp nor tmpfile provide the caller with a name, they return a file descriptor or file handle, respectively.
WebForms can live with MVC controllers in the same app. By default, routing does not route requests for files that exist on disk. So you could start rewriting small parts of your site at a time to use the MVC pattern, and leave the rest of it using WebForms.
I wouldn't do it myself, because to me it muddies what a particular method does, and the method-chaining is of limited use to me over doing it longhand. It isn't going to send me into a quivering ball of rage and psychosis, though, which is always a good thing. :') I wouldn't be concerned about performance; just ask...
ASP.Net MVC route mapping
|asp.net-mvc|
I'm new to MVC (and ASP.Net routing). I'm trying to map *.aspx to a controller called "PageController". routes.MapRoute( "Page", "{name}.aspx", new { controller = "Page", action = "Index", id = "" } ); Wouldn't the code above map *.aspx to "PageController"? When I run this and...
|asp.net|asp.net-mvc|routes|
Where can I find a good ASP.NET MVC sample?
|c#|asp.net-mvc|
I have been using Castle MonoRail for the last two years, but in a new job I am going to be the one to bring in ASP.NET MVC with me. I understand the basics of views, actions and the like. I just need a good sample for someone with MVC experience. Any good links besides Scott's Northwind traders sample?
|c#|asp.net|asp.net-mvc|
A delegate is a named type that defines a particular kind of method. Just as a class definition lays out all the members for the give kind of object it defines, so does the delegate lay out the method signature for the kind of method it defines. Based on this statement, a delegate is a function pointer and it defines ...
>A delegate is a named type that defines a particular kind of method. Just as a class definition lays out all the members for the given kind of object it defines, the delegate lays out the method signature for the kind of method it defines. Based on this statement, a delegate is a function pointer and it defines wha...
PHP preg functions needs your regex to be wrapped with a delimiter character, which can be any character. You can't use this delimiter character without escaping inside the regex. This should work (here the delimiter character is /): preg_match('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\d{2}/', '2008-09-01 12:35:45'); ...
Is the new Windows Gui system. I don't believe its aim is to make development easier per se but more to address fundamental issues with WinForm, such as transparency and scaling, neither of which WinForm can effectively address. Furthermore it seeks to address the "one resolution only" paradigm of WinForm by mapping si...
It's strange to need to layout one control within another. You might be solving an upstream problem wrong. Are you able to split the label into two labels with the updown between and maybe rely on a Windows Forms TableLayout panel? If it's essential to try to position based on font sizes, you could use [Graphics....
It's strange to need to layout one control within another. You might be solving an upstream problem wrong. Are you able to split the label into two labels with the updown between and maybe rely on a Windows Forms TableLayout panel? If it's essential to try to position based on font sizes, you could use [Graphics....
It's strange to need to layout one control within another. You might be solving an upstream problem wrong. Are you able to split the label into two labels with the updown between and maybe rely on a Windows Forms TableLayout panel? If it's essential to try to position based on font sizes, you could use [Graphics....
Check out [GigaSpaces][1]. It's a quite successful Jini/Javaspaces implementation. I think that despit the great Jini model, it is stuck with Java. Web-services is more appealing because it's works with standarized protocols. [1]: http://www.gigaspaces.com
Check out [GigaSpaces][1]. It's a quite successful Jini/Javaspaces implementation. I think Jini has a great model, but it is stuck with Java. Web-services is more appealing because it works with standarized protocols, even though Jini service discovery is more natural. [1]: http://www.gigaspaces.com
You probably want to set an isolation level for the entire transaction rather than using _with (rowlock)_ on specific tables. Look at this page: [http://msdn.microsoft.com/en-us/library/ms173763.aspx][1] Specifically, search within it for 'row lock', and I think you'll find that READ COMMITTED or REPEATABLE ...
You probably want to set an isolation level for the entire transaction rather than using _with (rowlock)_ on specific tables. Look at this page: [http://msdn.microsoft.com/en-us/library/ms173763.aspx][1] Specifically, search within it for 'row lock', and I think you'll find that READ COMMITTED or REPEATABLE ...
Are all of the resources that you're linking to in the <head> present at the locations where your page is seeking them (verify this by actually checking it). I've also had an issue when checking an app in Safari where I was attempting to pull a file that wasn't there and I had very similar output to yours (red links). ...
Are all of the resources that you're linking to in the <head> present at the locations where your page is seeking them (verify this by actually checking it). I've also had an issue when checking an app in Safari where I was attempting to pull a file that wasn't there and I had very similar output to yours (red links). ...
`require` will load a file. If that file contains any class/module definitions, then your other code will now be able to use them. If the file just contains code which is not in any modules, it will get run as if it were in the same place as your 'require' call (like PHP include) `include` is to do with modules. ...
In Linux, you can accomplish this by printing \b and/or \r to stderr. You might need to experiment to find the right combination of things in Windows.
(In this example, I am assuming port 2222 will go to your internal host. $externalip and $internalip are the ip addresses or hostnames of the visible and internal machine, respectively.) You have a couple of options, depending on how permanent you want the proxying to be: - Some sort of TCP proxy. On Linux, th...
|sharepoint|transaction|design0patterns|
|sharepoint|design-patterns|transactions|
Do you know any patterns for GUI programming? (Not patterns on designing GUIs)
|user-interface|designpatterns|
I'm looking for patterns that concern coding parts of a GUI. **Not** as global as **MVC**, that I'm quite familiar with, but patterns and good ideas and best practices concerning single controls and inputs. Let say I want to make a control that display some objects that may overlap. Now if I click on an object, I ne...
|user-interface|design-patterns|
Can you really build a fast word processor with GoF Design Patterns?
|java|performance|ide|designpatterns|text-processing|
The Gang of Four's [Design Patterns](http://en.wikipedia.org/wiki/Design_Patterns) uses a word processor as an example for at least a few of their patterns, particularly Composite and Flyweight. Other than by using C or C++, could you really use those patterns and the object-oriented overhead they entail to write a ...
|java|performance|ide|design-patterns|text-processing|
Singletons: good design or a crutch?
|language-agnostic|designpatterns|singleton|