question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
34,328
34,418
How do I make Windows aware of a service I have written in Python?
In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window in "administrative tools"). I. e. what is the Windows equivalent of putt...
As with most "aware" things in Windows, the answer is "Registry". Take a look at this Microsoft Knowledge Base article: http://support.microsoft.com/kb/103000 Search for "A Win32 program that can be started by the Service Controller and that obeys the service control protocol." This is the kind of service you're intere...
How do I make Windows aware of a service I have written in Python? In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window in "a...
TITLE: How do I make Windows aware of a service I have written in Python? QUESTION: In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("serv...
[ "python", "windows", "cross-platform" ]
11
3
8,535
4
0
2008-08-29T10:18:21.167000
2008-08-29T15:00:52.333000
34,345
34,966
Finding your own number in a box
100 (or some even number 2N:-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the boxes ...
This puzzle is explained at http://www.math.princeton.edu/~wwong/blog/blog200608191813.shtml and that person does a much better job of explaining the problem. The "all prisoners are killed" statement is wrong. The "you can save 30+ on average" is also wrong, the article says that 30% of the time you can save 100% of th...
Finding your own number in a box 100 (or some even number 2N:-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 1...
TITLE: Finding your own number in a box QUESTION: 100 (or some even number 2N:-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are n...
[ "algorithm", "puzzle" ]
8
7
1,554
10
0
2008-08-29T10:39:13.537000
2008-08-29T18:35:28.947000
34,365
34,375
Updating/Intercepting HttpContext.Current.Request.QueryString
Here's a wierd one. I'm reusing a code base that unfortunately must not be updated. This code makes a call to HttpContext.Current.Request.QueryString. Ideally, I need to push a value into this collection with every request that is made. Is this possible - perhaps in an HTTP Module?
Without using reflection, the simplest way to do it would be to use the RewritePath function on the current HttpContext object in order to modify the querystring. Using an IHttpModule, it might look something like: context.RewritePath(context.Request.Path, context.Request.PathInfo, newQueryStringHere!); Hope this helps...
Updating/Intercepting HttpContext.Current.Request.QueryString Here's a wierd one. I'm reusing a code base that unfortunately must not be updated. This code makes a call to HttpContext.Current.Request.QueryString. Ideally, I need to push a value into this collection with every request that is made. Is this possible - pe...
TITLE: Updating/Intercepting HttpContext.Current.Request.QueryString QUESTION: Here's a wierd one. I'm reusing a code base that unfortunately must not be updated. This code makes a call to HttpContext.Current.Request.QueryString. Ideally, I need to push a value into this collection with every request that is made. Is ...
[ "asp.net", ".net-3.5", "query-string" ]
3
6
3,546
2
0
2008-08-29T11:03:19.763000
2008-08-29T11:20:34.420000
34,390
34,502
How to make user controls know about css classes in ASP.NET
Since there are no header sections for user controls in asp.net, user controls have no way of knowing about stylesheet files. So css classes in the user controls are not recognized by visual studio and produces warnings. How can I make a user control know that it will relate to a css class, so if it is warning me about...
Here's what I did: It fools Visual Studio into thinking you've added a stylesheet to the page but it doesn't get rendered. Here's an even more concise way to do this with multiple references; <% if (false) { %> <% } %> As seen in this blog post from Phil Haack.
How to make user controls know about css classes in ASP.NET Since there are no header sections for user controls in asp.net, user controls have no way of knowing about stylesheet files. So css classes in the user controls are not recognized by visual studio and produces warnings. How can I make a user control know that...
TITLE: How to make user controls know about css classes in ASP.NET QUESTION: Since there are no header sections for user controls in asp.net, user controls have no way of knowing about stylesheet files. So css classes in the user controls are not recognized by visual studio and produces warnings. How can I make a user...
[ "asp.net", "css", "visual-studio-2008", "user-controls" ]
52
65
59,611
4
0
2008-08-29T11:37:54.783000
2008-08-29T15:52:43.770000
34,394
34,412
How would you abbriviate XHTML to an arbitrary number of words?
How would you programmacially abbreviate XHTML to an arbitrary number of words without leaving unclosed or corrupted tags? i.e. Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. Proin semper, orci at mattis blandit, augue justo blandit nulla. Quisque ante congue justo, ultrices aliquet, mat...
Recurse through the DOM tree, keeping a word count variable up to date. When the word count exceeds your maximum word count, insert "..." and remove all following siblings of the current node, then, as you go back up through the recursion, remove all the following siblings of each of its ancestors.
How would you abbriviate XHTML to an arbitrary number of words? How would you programmacially abbreviate XHTML to an arbitrary number of words without leaving unclosed or corrupted tags? i.e. Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. Proin semper, orci at mattis blandit, augue justo...
TITLE: How would you abbriviate XHTML to an arbitrary number of words? QUESTION: How would you programmacially abbreviate XHTML to an arbitrary number of words without leaving unclosed or corrupted tags? i.e. Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. Proin semper, orci at mattis bl...
[ "html", "regex", "dom", "xhtml", "dom-traversal" ]
2
1
171
2
0
2008-08-29T14:51:10.953000
2008-08-29T14:59:06.783000
34,395
34,431
How do I truncate a string while converting to bytes in C#?
I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit?
In order to truncate a string to a UTF8 byte array without splitting in the middle of a character I use this: static string Truncate(string s, int maxLength) { if (Encoding.UTF8.GetByteCount(s) <= maxLength) return s; var cs = s.ToCharArray(); int length = 0; int i = 0; while (i < cs.Length){ int charSize = 1; if (i < ...
How do I truncate a string while converting to bytes in C#? I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit?
TITLE: How do I truncate a string while converting to bytes in C#? QUESTION: I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many chara...
[ "c#", ".net", "arrays", "string", "truncate" ]
10
7
4,067
4
0
2008-08-29T14:51:24.727000
2008-08-29T15:03:27.040000
34,398
34,480
How should I model a field that can contain both numeric and string values in SQL Server 2005?
I have a new database table I need to create... It logically contains an ID, a name, and a "value". That value field could be either numeric or a character string in nature. I don't think I want to just make the field a varchar, because I also want to be able to query with filters like WHERE value > 0.5 and such. What'...
Your issue with mixing data may be how Sql 2005 sorts text data. It's not a 'natural' sort. If you have a varchar field and you do: where value > '20.5' Values like "5" will be in your result (as in a character based sort "5" comes after "20.5") You're going to be better off with separate columns for storage. Use Coale...
How should I model a field that can contain both numeric and string values in SQL Server 2005? I have a new database table I need to create... It logically contains an ID, a name, and a "value". That value field could be either numeric or a character string in nature. I don't think I want to just make the field a varch...
TITLE: How should I model a field that can contain both numeric and string values in SQL Server 2005? QUESTION: I have a new database table I need to create... It logically contains an ID, a name, and a "value". That value field could be either numeric or a character string in nature. I don't think I want to just make...
[ "sql-server", "database-design" ]
4
2
3,931
9
0
2008-08-29T14:53:55.487000
2008-08-29T15:44:36.673000
34,399
34,656
How to dispay unordered list inline with bullets?
I have an html file with an unordered list. I want to show the list items horizontally but still keep the bullets. No matter what I try, whenever I set the style to inline to meet the horizontal requirement I can't get the bullets to display.
The best option I saw in other answers was to use float:left;. Unfortunately, it doesn't work in IE7 which is a requirement here * — you still lose the bullet. I'm not really keen on using a background image either. What I'm gonna do instead (that no one else suggested, hence the self-answer) is go with manually adding...
How to dispay unordered list inline with bullets? I have an html file with an unordered list. I want to show the list items horizontally but still keep the bullets. No matter what I try, whenever I set the style to inline to meet the horizontal requirement I can't get the bullets to display.
TITLE: How to dispay unordered list inline with bullets? QUESTION: I have an html file with an unordered list. I want to show the list items horizontally but still keep the bullets. No matter what I try, whenever I set the style to inline to meet the horizontal requirement I can't get the bullets to display. ANSWER: ...
[ "html", "css" ]
53
40
86,308
13
0
2008-08-29T14:55:05.170000
2008-08-29T16:34:13.280000
34,401
34,435
Send email from Elmah?
Is anyone using Elmah to send exceptions via email? I've got Elmah logging set up via SQL Server, and can view the errors page via the Elmah.axd page, but I am unable to get the email component working. The idea here is to get the email notification so we can react more quickly to exceptions. Here is my web.config (unn...
You need the ErrorMail httpModule. add this line inside the section If you're using a remote SMTP server (which it looks like you are) you don't need SMTP on the server.
Send email from Elmah? Is anyone using Elmah to send exceptions via email? I've got Elmah logging set up via SQL Server, and can view the errors page via the Elmah.axd page, but I am unable to get the email component working. The idea here is to get the email notification so we can react more quickly to exceptions. Her...
TITLE: Send email from Elmah? QUESTION: Is anyone using Elmah to send exceptions via email? I've got Elmah logging set up via SQL Server, and can view the errors page via the Elmah.axd page, but I am unable to get the email component working. The idea here is to get the email notification so we can react more quickly ...
[ ".net", "asp.net", "elmah" ]
90
79
34,880
3
0
2008-08-29T14:56:47.680000
2008-08-29T15:04:44.617000
34,411
36,026
How do I generate a friendly URL in Symfony PHP?
I always tend to forget these built-in Symfony functions for making links.
If your goal is to have user-friendly URLs throughout your application, use the following approach: 1) Create a routing rule for your module/action in the application's routing.yml file. The following example is a routing rule for an action that shows the most recent questions in an application, defaulting to page 1 (u...
How do I generate a friendly URL in Symfony PHP? I always tend to forget these built-in Symfony functions for making links.
TITLE: How do I generate a friendly URL in Symfony PHP? QUESTION: I always tend to forget these built-in Symfony functions for making links. ANSWER: If your goal is to have user-friendly URLs throughout your application, use the following approach: 1) Create a routing rule for your module/action in the application's ...
[ "php", "url", "seo", "symfony1" ]
7
9
8,449
4
0
2008-08-29T14:58:58.873000
2008-08-30T15:08:25.020000
34,413
34,419
Why am I getting a NoClassDefFoundError in Java?
I am getting a NoClassDefFoundError when I run my Java application. What is typically the cause of this?
This is caused when there is a class file that your code depends on and it is present at compile time but not found at runtime. Look for differences in your build time and runtime classpaths.
Why am I getting a NoClassDefFoundError in Java? I am getting a NoClassDefFoundError when I run my Java application. What is typically the cause of this?
TITLE: Why am I getting a NoClassDefFoundError in Java? QUESTION: I am getting a NoClassDefFoundError when I run my Java application. What is typically the cause of this? ANSWER: This is caused when there is a class file that your code depends on and it is present at compile time but not found at runtime. Look for di...
[ "java", "noclassdeffounderror" ]
671
308
1,126,387
32
0
2008-08-29T14:59:30.747000
2008-08-29T15:01:07.607000
34,428
35,405
How to Format Numbers in WinForms 1.1 DataGrid?
Is there a simple way to format numbers in a Winforms 1.1 datagrid? The Format property of the DataGridTextBoxColumn seems to be completely ignored. I know there is a solution that involves subclassing a Column control, and it's fairly simple, but was hoping there might be some trick to making the Format property just ...
My personal opinion is that a datagridcolumnstyle is the way to go. Without seeing the code that you have, I can't say for certain why your formatting isn't taking hold when no style is defined - but mixing in formatting with data calculations and other parts of the code can get very messy very quickly. Creating a new ...
How to Format Numbers in WinForms 1.1 DataGrid? Is there a simple way to format numbers in a Winforms 1.1 datagrid? The Format property of the DataGridTextBoxColumn seems to be completely ignored. I know there is a solution that involves subclassing a Column control, and it's fairly simple, but was hoping there might b...
TITLE: How to Format Numbers in WinForms 1.1 DataGrid? QUESTION: Is there a simple way to format numbers in a Winforms 1.1 datagrid? The Format property of the DataGridTextBoxColumn seems to be completely ignored. I know there is a solution that involves subclassing a Column control, and it's fairly simple, but was ho...
[ "winforms" ]
1
1
407
2
0
2008-08-29T15:02:41.953000
2008-08-29T22:15:07.360000
34,439
34,452
Finding what methods a Python object has
Given a Python object of any kind, is there an easy way to get the list of all methods that this object has? Or if this is not possible, is there at least an easy way to check if it has a particular method, other than checking if an error occurs when the method is called?
For many objects, you can use this code, replacing 'object' with the object you're interested in: object_methods = [method_name for method_name in dir(object) if callable(getattr(object, method_name))] I discovered it at diveintopython.net (now archived), that should provide some further details! If you get an Attribut...
Finding what methods a Python object has Given a Python object of any kind, is there an easy way to get the list of all methods that this object has? Or if this is not possible, is there at least an easy way to check if it has a particular method, other than checking if an error occurs when the method is called?
TITLE: Finding what methods a Python object has QUESTION: Given a Python object of any kind, is there an easy way to get the list of all methods that this object has? Or if this is not possible, is there at least an easy way to check if it has a particular method, other than checking if an error occurs when the method...
[ "python", "introspection" ]
693
758
722,838
22
0
2008-08-29T15:05:17.237000
2008-08-29T15:09:05.667000
34,463
34,547
Technical Hurdles for Win32 rsync port
Despite primarily being a windows user, I am a huge fan of rsync. Now, I don't want to argue the virtues of rsync vs any other tool...this is not my point. The only way I've ever found of running rsync on windows is via a version that is built to run on top of Cygwin, and as Cygwin has issues with Unicode, so does rsyn...
The way that windows locks open files might cause an issue requiring you to hook into the Volume Shadowcopy Service. About two years ago this fellow ported the algorithm to C#. I haven't taken a look at the code (or the provided binary), but it might be a place to start looking or someone to try contacting. http://www....
Technical Hurdles for Win32 rsync port Despite primarily being a windows user, I am a huge fan of rsync. Now, I don't want to argue the virtues of rsync vs any other tool...this is not my point. The only way I've ever found of running rsync on windows is via a version that is built to run on top of Cygwin, and as Cygwi...
TITLE: Technical Hurdles for Win32 rsync port QUESTION: Despite primarily being a windows user, I am a huge fan of rsync. Now, I don't want to argue the virtues of rsync vs any other tool...this is not my point. The only way I've ever found of running rsync on windows is via a version that is built to run on top of Cy...
[ "winapi", "rsync", "porting" ]
9
5
4,955
5
0
2008-08-29T15:33:06.687000
2008-08-29T16:04:44.177000
34,476
34,504
What is in your JavaScript development toolbox?
I have to do some JavaScript in the future, so it is time to update my toolbox. Right now I use Firefox with some addons: JavaScript Shell from https://www.squarefree.com/bookmarklets/webdevel.html Firefox Dom Inspector Firebug Greasemonkey Stylish I plan to use Venkman Javascript debugger as well as jsunit and js-lint...
I use both Firefox and IE for Web Development and a few add-ons in each: Firefox: Firebug Web Developer Toolbar Internet Explorer: IE Developer Toolbar Fiddler Visual Studio for JS Debugging
What is in your JavaScript development toolbox? I have to do some JavaScript in the future, so it is time to update my toolbox. Right now I use Firefox with some addons: JavaScript Shell from https://www.squarefree.com/bookmarklets/webdevel.html Firefox Dom Inspector Firebug Greasemonkey Stylish I plan to use Venkman J...
TITLE: What is in your JavaScript development toolbox? QUESTION: I have to do some JavaScript in the future, so it is time to update my toolbox. Right now I use Firefox with some addons: JavaScript Shell from https://www.squarefree.com/bookmarklets/webdevel.html Firefox Dom Inspector Firebug Greasemonkey Stylish I pla...
[ "javascript", "debugging" ]
12
8
701
7
0
2008-08-29T15:41:45.060000
2008-08-29T15:54:11.580000
34,486
34,538
What more is needed for Ajax than this function
I have a small JS function that does Ajax for me and another like it that adds in POST data to the request. With Ajax being such a big topic with so many libraries about it, what am I missing from my function, is it insecure or something else worrying? function loadPage(pagePath, displayElement) { var xmlHttp; try { /...
I strongly recommend you not roll your own Ajax code. Instead, use a framework such as Prototype, Dojo, or any of the others. They've taken care of handling all the ReadyStates you're not handling (2 means it's been sent, 3 means it's in process, etc.), and they should escape the reponse you're getting so you don't ins...
What more is needed for Ajax than this function I have a small JS function that does Ajax for me and another like it that adds in POST data to the request. With Ajax being such a big topic with so many libraries about it, what am I missing from my function, is it insecure or something else worrying? function loadPage(p...
TITLE: What more is needed for Ajax than this function QUESTION: I have a small JS function that does Ajax for me and another like it that adds in POST data to the request. With Ajax being such a big topic with so many libraries about it, what am I missing from my function, is it insecure or something else worrying? f...
[ "javascript", "ajax" ]
5
13
354
6
0
2008-08-29T15:48:16.307000
2008-08-29T16:03:11.933000
34,488
34,500
Does limiting a query to one record improve performance
Will limiting a query to one result record, improve performance in a large(ish) MySQL table if the table only has one matching result? for example select * from people where name = "Re0sless" limit 1 if there is only one record with that name? and what about if name was the primary key/ set to unique? and is it worth u...
If the column has a unique index: no, it's no faster a non-unique index: maybe, because it will prevent sending any additional rows beyond the first matched, if any exist no index: sometimes if 1 or more rows match the query, yes, because the full table scan will be halted after the first row is matched. if no rows mat...
Does limiting a query to one record improve performance Will limiting a query to one result record, improve performance in a large(ish) MySQL table if the table only has one matching result? for example select * from people where name = "Re0sless" limit 1 if there is only one record with that name? and what about if na...
TITLE: Does limiting a query to one record improve performance QUESTION: Will limiting a query to one result record, improve performance in a large(ish) MySQL table if the table only has one matching result? for example select * from people where name = "Re0sless" limit 1 if there is only one record with that name? an...
[ "sql", "mysql", "database" ]
35
50
14,711
6
0
2008-08-29T15:48:23.390000
2008-08-29T15:51:55.847000
34,493
34,719
Excel: list ranges targeted by INDIRECT formulas
We have a few very large Excel workbooks (dozens of tabs, over a MB each, very complex calculations) with many dozens, perhaps hundreds of formulas that use the dreaded INDIRECT function. These formulas are spread out throughout the workbook, and target several tables of data to look-up for values. Now I need to move t...
You could iterate over the entire Workbook using vba (i've included the code from @PabloG and @euro-micelli ): Sub iterateOverWorkbook() For Each i In ThisWorkbook.Worksheets Set rRng = i.UsedRange For Each j In rRng If (Not IsEmpty(j)) Then If (j.HasFormula) Then If InStr(oCell.Formula, "INDIRECT") Then j.Value = Repl...
Excel: list ranges targeted by INDIRECT formulas We have a few very large Excel workbooks (dozens of tabs, over a MB each, very complex calculations) with many dozens, perhaps hundreds of formulas that use the dreaded INDIRECT function. These formulas are spread out throughout the workbook, and target several tables of...
TITLE: Excel: list ranges targeted by INDIRECT formulas QUESTION: We have a few very large Excel workbooks (dozens of tabs, over a MB each, very complex calculations) with many dozens, perhaps hundreds of formulas that use the dreaded INDIRECT function. These formulas are spread out throughout the workbook, and target...
[ "excel", "vba" ]
5
5
2,527
5
0
2008-08-29T15:49:25.307000
2008-08-29T16:53:09.723000
34,505
34,541
Is Object.GetHashCode() unique to a reference or a value?
The MSDN documentation on Object.GetHashCode() describes 3 contradicting rules for how the method should work. If two objects of the same type represent the same value, the hash function must return the same constant value for either object. For the best performance, a hash function must generate a random distribution ...
Rules 1 & 3 are contradictory to me. To a certain extent, they are. The reason is: if an object is stored in a hash table and, by changing its value, you change its hash then the hash table has lost the value and you can't find it again by querying the hash table. — It is therefore important that while objects are stor...
Is Object.GetHashCode() unique to a reference or a value? The MSDN documentation on Object.GetHashCode() describes 3 contradicting rules for how the method should work. If two objects of the same type represent the same value, the hash function must return the same constant value for either object. For the best perform...
TITLE: Is Object.GetHashCode() unique to a reference or a value? QUESTION: The MSDN documentation on Object.GetHashCode() describes 3 contradicting rules for how the method should work. If two objects of the same type represent the same value, the hash function must return the same constant value for either object. Fo...
[ "c#", ".net" ]
26
30
9,723
6
0
2008-08-29T15:54:15.870000
2008-08-29T16:03:42.247000
34,506
35,201
Simulating a virtual static member of a class in c++?
Is there anyway to have a sort of virtual static member in C++? For example: class BaseClass { public: BaseClass(const string& name): _name(name) {} string GetName() const { return _name; } virtual void UseClass() = 0; private: const string _name; }; class DerivedClass: public BaseClass { public: DerivedClass(): BaseC...
Here is one solution: struct BaseData { const string my_word; const int my_number; }; class Base { public: Base(const BaseData* apBaseData) { mpBaseData = apBaseData; } const string getMyWord() { return mpBaseData->my_word; } int getMyNumber() { return mpBaseData->my_number; } private: const BaseData* mpBaseData; }; ...
Simulating a virtual static member of a class in c++? Is there anyway to have a sort of virtual static member in C++? For example: class BaseClass { public: BaseClass(const string& name): _name(name) {} string GetName() const { return _name; } virtual void UseClass() = 0; private: const string _name; }; class DerivedC...
TITLE: Simulating a virtual static member of a class in c++? QUESTION: Is there anyway to have a sort of virtual static member in C++? For example: class BaseClass { public: BaseClass(const string& name): _name(name) {} string GetName() const { return _name; } virtual void UseClass() = 0; private: const string _name; ...
[ "c++", "virtual-functions" ]
12
9
6,886
5
0
2008-08-29T15:54:46.167000
2008-08-29T20:11:52.930000
34,509
2,060,952
Natural (human alpha-numeric) sort in Microsoft SQL 2005
We have a large database on which we have DB side pagination. This is quick, returning a page of 50 rows from millions of records in a small fraction of a second. Users can define their own sort, basically choosing what column to sort by. Columns are dynamic - some have numeric values, some dates and some text. While m...
Most of the SQL-based solutions I have seen break when the data gets complex enough (e.g. more than one or two numbers in it). Initially I tried implementing a NaturalSort function in T-SQL that met my requirements (among other things, handles an arbitrary number of numbers within the string), but the performance was w...
Natural (human alpha-numeric) sort in Microsoft SQL 2005 We have a large database on which we have DB side pagination. This is quick, returning a page of 50 rows from millions of records in a small fraction of a second. Users can define their own sort, basically choosing what column to sort by. Columns are dynamic - so...
TITLE: Natural (human alpha-numeric) sort in Microsoft SQL 2005 QUESTION: We have a large database on which we have DB side pagination. This is quick, returning a page of 50 rows from millions of records in a small fraction of a second. Users can define their own sort, basically choosing what column to sort by. Column...
[ "sql-server", "sql-server-2005", "sorting", "natural-sort" ]
49
31
39,608
14
0
2008-08-29T15:55:10.223000
2010-01-13T22:59:22.020000
34,510
34,550
What is a race condition?
When writing multithreaded applications, one of the most common problems experienced is race conditions. My questions to the community are: What is the race condition? How do you detect them? How do you handle them? Finally, how do you prevent them from occurring?
A race condition occurs when two or more threads can access shared data and they try to change it at the same time. Because the thread scheduling algorithm can swap between threads at any time, you don't know the order in which the threads will attempt to access the shared data. Therefore, the result of the change in d...
What is a race condition? When writing multithreaded applications, one of the most common problems experienced is race conditions. My questions to the community are: What is the race condition? How do you detect them? How do you handle them? Finally, how do you prevent them from occurring?
TITLE: What is a race condition? QUESTION: When writing multithreaded applications, one of the most common problems experienced is race conditions. My questions to the community are: What is the race condition? How do you detect them? How do you handle them? Finally, how do you prevent them from occurring? ANSWER: A ...
[ "multithreading", "concurrency", "terminology", "race-condition" ]
1,324
1,657
876,000
19
0
2008-08-29T15:55:10.457000
2008-08-29T16:05:23.100000
34,512
34,520
What is a deadlock?
When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My questions to the community are: What is a deadlock? How do you detect them? Do you handle them? And finally, how do you prevent them from occurring?
A lock occurs when multiple processes try to access the same resource at the same time. One process loses out and must wait for the other to finish. A deadlock occurs when the waiting process is still holding on to another resource that the first needs before it can finish. So, an example: Resource A and resource B are...
What is a deadlock? When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My questions to the community are: What is a deadlock? How do you detect them? Do you handle them? And finally, how do you prevent them from occurring?
TITLE: What is a deadlock? QUESTION: When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My questions to the community are: What is a deadlock? How do you detect them? Do you handle them? And finally, how do you prevent them from occurring? ANSWER: A lock occurs when m...
[ "multithreading", "concurrency", "locking", "deadlock" ]
203
258
163,588
18
0
2008-08-29T15:56:27.020000
2008-08-29T15:58:34.957000
34,516
34,533
Is there a standard (like phpdoc or python's docstring) for commenting C# code?
Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code?
You can use XML style comments, and use tools to pull those comments out into API documentation. Here is an example of the comment style: /// /// Authenticates a user based on a username and password. /// /// The username. /// The password. /// /// True, if authentication is successful, otherwise False. /// /// /// For...
Is there a standard (like phpdoc or python's docstring) for commenting C# code? Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code?
TITLE: Is there a standard (like phpdoc or python's docstring) for commenting C# code? QUESTION: Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code? ANSWER: You can use XML style comments, and use to...
[ "c#", "comments" ]
41
43
25,195
6
0
2008-08-29T15:57:44.537000
2008-08-29T16:02:39.923000
34,536
34,710
How do you swap DIVs on mouseover (jQuery)?
This most be the second most simple rollover effect, still I don't find any simple solution. Wanted: I have a list of items and a corresponding list of slides (DIVs). After loading, the first list item should be selected (bold) and the first slide should be visible. When the user hovers over another list item, that lis...
Rather than displaying all slides when JS is off (which would likely break the page layout) I would place inside the switch LIs real A links to server-side code which returns the page with the "active" class pre-set on the proper switch/slide. $(document).ready(function() { switches = $('#switches > li'); slides = $(...
How do you swap DIVs on mouseover (jQuery)? This most be the second most simple rollover effect, still I don't find any simple solution. Wanted: I have a list of items and a corresponding list of slides (DIVs). After loading, the first list item should be selected (bold) and the first slide should be visible. When the ...
TITLE: How do you swap DIVs on mouseover (jQuery)? QUESTION: This most be the second most simple rollover effect, still I don't find any simple solution. Wanted: I have a list of items and a corresponding list of slides (DIVs). After loading, the first list item should be selected (bold) and the first slide should be ...
[ "javascript", "jquery", "html", "css" ]
21
19
42,724
5
0
2008-08-29T16:02:59.050000
2008-08-29T16:49:56.673000
34,571
34,658
How do I test a class that has private methods, fields or inner classes?
How do I use JUnit to test a class that has internal private methods, fields or nested classes? It seems bad to change the access modifier for a method just to be able to run a test.
If you have somewhat of a legacy Java application, and you're not allowed to change the visibility of your methods, the best way to test private methods is to use reflection. Internally we're using helpers to get/set private and private static variables as well as invoke private and private static methods. The followin...
How do I test a class that has private methods, fields or inner classes? How do I use JUnit to test a class that has internal private methods, fields or nested classes? It seems bad to change the access modifier for a method just to be able to run a test.
TITLE: How do I test a class that has private methods, fields or inner classes? QUESTION: How do I use JUnit to test a class that has internal private methods, fields or nested classes? It seems bad to change the access modifier for a method just to be able to run a test. ANSWER: If you have somewhat of a legacy Java...
[ "java", "unit-testing", "junit", "tdd" ]
3,220
1,844
1,257,561
59
0
2008-08-29T16:11:09.933000
2008-08-29T16:35:11.560000
34,581
34,587
inline-block on span
I expected the two span tags in the following sample to display next to each other, instead they display one below the other. If I set the width of the class span.right to 49% they display next to each other. I am not able to figure out why the right span is pushed down like the right span has some invisible padding/ma...
float: left; Try adding that to span.left It will cause it to float to the left (as suggested by the syntax). I am not a CSS expert by any means so please don't take this as unarguable fact but I find that when something is floated, it makes no difference to the vertical position of things below it. If you float the sp...
inline-block on span I expected the two span tags in the following sample to display next to each other, instead they display one below the other. If I set the width of the class span.right to 49% they display next to each other. I am not able to figure out why the right span is pushed down like the right span has some...
TITLE: inline-block on span QUESTION: I expected the two span tags in the following sample to display next to each other, instead they display one below the other. If I set the width of the class span.right to 49% they display next to each other. I am not able to figure out why the right span is pushed down like the r...
[ "html", "css", "css-float", "internet-explorer-6" ]
7
3
22,327
3
0
2008-08-29T16:13:11.880000
2008-08-29T16:14:25.247000
34,588
34,645
How do I change the number of open files limit in Linux?
When running my application I sometimes get an error about too many files open. Running ulimit -a reports that the limit is 1024. How do I increase the limit above 1024? Edit ulimit -n 2048 results in a permission error.
You could always try doing a ulimit -n 2048. This will only reset the limit for your current shell and the number you specify must not exceed the hard limit Each operating system has a different hard limit setup in a configuration file. For instance, the hard open file limit on Solaris can be set on boot from /etc/syst...
How do I change the number of open files limit in Linux? When running my application I sometimes get an error about too many files open. Running ulimit -a reports that the limit is 1024. How do I increase the limit above 1024? Edit ulimit -n 2048 results in a permission error.
TITLE: How do I change the number of open files limit in Linux? QUESTION: When running my application I sometimes get an error about too many files open. Running ulimit -a reports that the limit is 1024. How do I increase the limit above 1024? Edit ulimit -n 2048 results in a permission error. ANSWER: You could alway...
[ "linux" ]
220
171
574,001
4
0
2008-08-29T16:14:25.417000
2008-08-29T16:30:04.443000
34,611
35,741
Toolkit Options for 2D Python Game Programming
What are some toolkits for developing 2D games in Python? An option that I have heard of is Pygame, but is there anything that has more range to do more things? What are the good and bad parts about the modules?
I use pygame myself and it is very good. It has good documentation and tutorials, and is quite well designed. I've also heard wonderful reviews of pyglet.
Toolkit Options for 2D Python Game Programming What are some toolkits for developing 2D games in Python? An option that I have heard of is Pygame, but is there anything that has more range to do more things? What are the good and bad parts about the modules?
TITLE: Toolkit Options for 2D Python Game Programming QUESTION: What are some toolkits for developing 2D games in Python? An option that I have heard of is Pygame, but is there anything that has more range to do more things? What are the good and bad parts about the modules? ANSWER: I use pygame myself and it is very...
[ "python-3.x", "pygame", "libraries", "toolkit", "2d-games" ]
13
11
6,154
7
0
2008-08-29T16:20:43.467000
2008-08-30T06:39:35.977000
34,623
85,788
Why is HTML form redirection used in OpenID 2?
Why would you do an automatic HTML post rather than a simple redirect? Is this so developers can automatically generate a login form that posts directory to the remote server when the OpenID is known? eg. User is not logged in and visits your login page. You detect the user's openID from a cookie. Form is generated tha...
The primary motivation was, as Mark Brackett says, the limits on payload size imposed by using redirects and GET. Some implementations are smart enough to only use POST when the message goes over a certain size, as there are certainly disadvantages to the POST technique. (Chief among them being the fact that your Back ...
Why is HTML form redirection used in OpenID 2? Why would you do an automatic HTML post rather than a simple redirect? Is this so developers can automatically generate a login form that posts directory to the remote server when the OpenID is known? eg. User is not logged in and visits your login page. You detect the use...
TITLE: Why is HTML form redirection used in OpenID 2? QUESTION: Why would you do an automatic HTML post rather than a simple redirect? Is this so developers can automatically generate a login form that posts directory to the remote server when the OpenID is known? eg. User is not logged in and visits your login page. ...
[ "openid", "redirect", "openid2" ]
10
6
2,221
3
0
2008-08-29T16:21:47.600000
2008-09-17T17:48:25.357000
34,635
34,651
How do I get the assembler output from a C file in VS2005
I think the file that is produced is an.asm file, any idea how to produce this in Visual Studio when you do a build?
Open the Properties page for a project Select the Configuration Properties -> C/C++ -> Output Files branch Change the Assembler Output option to something other than No Listing Make sure ASM List Location is set to a valid path or sub-path Build.
How do I get the assembler output from a C file in VS2005 I think the file that is produced is an.asm file, any idea how to produce this in Visual Studio when you do a build?
TITLE: How do I get the assembler output from a C file in VS2005 QUESTION: I think the file that is produced is an.asm file, any idea how to produce this in Visual Studio when you do a build? ANSWER: Open the Properties page for a project Select the Configuration Properties -> C/C++ -> Output Files branch Change the ...
[ "c", "visual-studio", "assembly" ]
8
5
6,199
3
0
2008-08-29T16:25:58.633000
2008-08-29T16:31:32.117000
34,638
34,917
data 'security' with java and hibernate
The system I am currently working on requires some role-based security, which is well catered for in the Java EE stack. The system intends to be a framework for business domain experts to write their code on top of. However, there is also a requirement for data security. That is, what information is visible to an end u...
Hibernate has a filter mechanism that may work for you. The filters will rewrite the queries hibernate generates to include an additional clause to limit the rows returned. I'm not aware of anything in hibernate to mask/hide columns. Your database may also have support for this functionality. Oracle, for example, has t...
data 'security' with java and hibernate The system I am currently working on requires some role-based security, which is well catered for in the Java EE stack. The system intends to be a framework for business domain experts to write their code on top of. However, there is also a requirement for data security. That is,...
TITLE: data 'security' with java and hibernate QUESTION: The system I am currently working on requires some role-based security, which is well catered for in the Java EE stack. The system intends to be a framework for business domain experts to write their code on top of. However, there is also a requirement for data ...
[ "java", "security", "hibernate", "jakarta-ee" ]
6
6
5,382
2
0
2008-08-29T16:27:43
2008-08-29T18:12:36.350000
34,655
34,686
Making an iframe take vertical space
I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible? Are there any workarounds?
This should set the IFRAME height to its content's height: You may want to add scrolling="no" to your IFRAME to turn off the scrollbars. edit: Oops, forgot to declare the_height.
Making an iframe take vertical space I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible? Are there any workarounds?
TITLE: Making an iframe take vertical space QUESTION: I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible? Are there any workarounds? ANSWER: This should set the IFRAME height to its content's height: You may want to add scro...
[ "javascript", "html", "css", "iframe" ]
9
11
5,057
5
0
2008-08-29T16:34:05.027000
2008-08-29T16:43:18.030000
34,661
34,693
Automate test of web service communication
I have an application that sends messages to an external web service. I build and deploy this application using MSBuild and Cruisecontrol.NET. As CCNET build and deploys the app it also runs a set of test using NUnit. I'd now like to test the web service communication as well. My idea is that as part of the build proce...
I just started looking into http://www.soapui.org/ and it seems like it will work nicely for testing web services. Also, maybe look at adding an abstraction layer in your web service, each service call would directly call a testable method (outside of the web scope)? I just did this with a bigger project I'm working on...
Automate test of web service communication I have an application that sends messages to an external web service. I build and deploy this application using MSBuild and Cruisecontrol.NET. As CCNET build and deploys the app it also runs a set of test using NUnit. I'd now like to test the web service communication as well....
TITLE: Automate test of web service communication QUESTION: I have an application that sends messages to an external web service. I build and deploy this application using MSBuild and Cruisecontrol.NET. As CCNET build and deploys the app it also runs a set of test using NUnit. I'd now like to test the web service comm...
[ "web-services", "msbuild", "build-process", "nunit", "cruisecontrol.net" ]
5
3
1,526
5
0
2008-08-29T16:35:53.790000
2008-08-29T16:45:58.120000
34,664
708,594
DesignMode with nested Controls
Has anyone found a useful solution to the DesignMode problem when developing controls? The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE. The standard hack has been to look at the name of the process that is running and...
Revisiting this question, I have now 'discovered' 5 different ways of doing this, which are as follows: System.ComponentModel.DesignMode property System.ComponentModel.LicenseManager.UsageMode property private string ServiceString() { if (GetService(typeof(System.ComponentModel.Design.IDesignerHost))!= null) return "...
DesignMode with nested Controls Has anyone found a useful solution to the DesignMode problem when developing controls? The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE. The standard hack has been to look at the name of...
TITLE: DesignMode with nested Controls QUESTION: Has anyone found a useful solution to the DesignMode problem when developing controls? The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE. The standard hack has been to l...
[ ".net", "user-controls" ]
93
86
22,976
14
0
2008-08-29T16:37:10.323000
2009-04-02T07:02:22.477000
34,669
34,716
How to keep a "things done" count in a recursive algorithm in Java?
I have a recursive algorithm which steps through a string, character by character, and parses it to create a tree-like structure. I want to be able to keep track of the character index the parser is currently at (for error messages as much as anything else) but am not keen on implementing something like a tuple to hand...
Since you've already discovered the pseudo-mutable integer "hack," how about this option: Does it make sense for you to make a separate Parser class? If you do this, you can store the current state in a member variable. You probably need to think about how you're going to handle any thread safety issues, and it might b...
How to keep a "things done" count in a recursive algorithm in Java? I have a recursive algorithm which steps through a string, character by character, and parses it to create a tree-like structure. I want to be able to keep track of the character index the parser is currently at (for error messages as much as anything ...
TITLE: How to keep a "things done" count in a recursive algorithm in Java? QUESTION: I have a recursive algorithm which steps through a string, character by character, and parses it to create a tree-like structure. I want to be able to keep track of the character index the parser is currently at (for error messages as...
[ "java", "recursion", "coding-style", "integer", "final" ]
4
2
6,310
8
0
2008-08-29T16:38:09.637000
2008-08-29T16:52:37.917000
34,674
35,636
Performance difference between dot notation versus method call in Objective-C
You can use a standard dot notation or a method call in Objective-C to access a property of an object in Objective-C. myObject.property = YES; or [myObject setProperty:YES]; Is there a difference in performance (in terms of accessing the property)? Is it just a matter of preference in terms of coding style?
Dot notation for property access in Objective-C is a message send, just as bracket notation. That is, given this: @interface Foo: NSObject @property BOOL bar; @end Foo *foo = [[Foo alloc] init]; foo.bar = YES; [foo setBar:YES]; The last two lines will compile exactly the same. The only thing that changes this is if a ...
Performance difference between dot notation versus method call in Objective-C You can use a standard dot notation or a method call in Objective-C to access a property of an object in Objective-C. myObject.property = YES; or [myObject setProperty:YES]; Is there a difference in performance (in terms of accessing the prop...
TITLE: Performance difference between dot notation versus method call in Objective-C QUESTION: You can use a standard dot notation or a method call in Objective-C to access a property of an object in Objective-C. myObject.property = YES; or [myObject setProperty:YES]; Is there a difference in performance (in terms of ...
[ "objective-c", "performance" ]
13
21
5,403
5
0
2008-08-29T16:39:51.737000
2008-08-30T03:06:31.170000
34,687
38,386
Subversion ignoring "--password" and "--username" options
When I try to do any svn command and supply the --username and/or --password options, it prompts me for my password anyways, and always will attempt to use my current user instead of the one specified by --username. Neither --no-auth-cache nor --non-interactive have any effect on this. This is a problem because I'm try...
The prompt you're getting doesn't look like Subversion asking you for a password, it looks like ssh asking for a password. So my guess is that you have checked out an svn+ssh:// checkout, not an svn:// or http:// or https:// checkout. IIRC all the options you're trying only work for the svn/http/https checkouts. Can yo...
Subversion ignoring "--password" and "--username" options When I try to do any svn command and supply the --username and/or --password options, it prompts me for my password anyways, and always will attempt to use my current user instead of the one specified by --username. Neither --no-auth-cache nor --non-interactive ...
TITLE: Subversion ignoring "--password" and "--username" options QUESTION: When I try to do any svn command and supply the --username and/or --password options, it prompts me for my password anyways, and always will attempt to use my current user instead of the one specified by --username. Neither --no-auth-cache nor ...
[ "svn", "version-control" ]
57
33
185,876
7
0
2008-08-29T16:43:21.150000
2008-09-01T20:29:02.970000
34,698
34,702
How to turn off sounds in TortoiseSVN?
I do not want TortoiseSVN to alert me with sounds - e.g. when it fails to update. How do I turn off sounds in TortoiseSVN?
Right click > TortoiseSVN > Settings > System Sounds.. Scroll down to the bottom.
How to turn off sounds in TortoiseSVN? I do not want TortoiseSVN to alert me with sounds - e.g. when it fails to update. How do I turn off sounds in TortoiseSVN?
TITLE: How to turn off sounds in TortoiseSVN? QUESTION: I do not want TortoiseSVN to alert me with sounds - e.g. when it fails to update. How do I turn off sounds in TortoiseSVN? ANSWER: Right click > TortoiseSVN > Settings > System Sounds.. Scroll down to the bottom.
[ "tortoisesvn", "system-sounds" ]
2
3
374
2
0
2008-08-29T16:47:45.977000
2008-08-29T16:48:31.170000
34,705
34,753
Best practices with jQuery form binding code in an application
We have an application with a good amount of jQuery JSON calls to server side code. Because of this, we have a large amount of binding code to parse responses and bind the appropriate values to the form. This is a two part question. What is the reccomended approach for dealing with a large number of forms that all have...
Not 100% sure example what you are asking, but personally, and I use MochiKit, I create JavaScript "classes" (or widgets, if you prefer) for every significant client-side UI structure. These know, of course, how to populate themselves with data. I don't know what more there is to say - writing UI code for the browser i...
Best practices with jQuery form binding code in an application We have an application with a good amount of jQuery JSON calls to server side code. Because of this, we have a large amount of binding code to parse responses and bind the appropriate values to the form. This is a two part question. What is the reccomended ...
TITLE: Best practices with jQuery form binding code in an application QUESTION: We have an application with a good amount of jQuery JSON calls to server side code. Because of this, we have a large amount of binding code to parse responses and bind the appropriate values to the form. This is a two part question. What i...
[ "javascript", "jquery", "ooad" ]
6
3
2,044
3
0
2008-08-29T16:48:58.890000
2008-08-29T17:05:14.733000
34,711
35,502
Google Talk's Graphics Toolkit?
What graphics toolkit is used for the Window's Google Talk application?
There isn't much information on this out there but it seems to be their own customized controls plus an IE component (and not Qt like Google Earth). This forum thread has a little bit of information.
Google Talk's Graphics Toolkit? What graphics toolkit is used for the Window's Google Talk application?
TITLE: Google Talk's Graphics Toolkit? QUESTION: What graphics toolkit is used for the Window's Google Talk application? ANSWER: There isn't much information on this out there but it seems to be their own customized controls plus an IE component (and not Qt like Google Earth). This forum thread has a little bit of in...
[ "windows", "user-interface", "toolkit" ]
2
1
888
2
0
2008-08-29T16:50:20.743000
2008-08-30T00:16:34.743000
34,712
34,729
.Net - Detecting the Appearance Setting (Classic or XP?)
I have some UI in VB 2005 that looks great in XP Style, but goes hideous in Classic Style. Any ideas about how to detect which mode the user is in and re-format the forms on the fly? Post Answer Edit: Thanks Daniel, looks like this will work. I'm using the first solution you posted with the GetCurrentThemeName() functi...
Try using a combination of GetCurrentThemeName ( MSDN Page ) and DwmIsCompositionEnabled I linked the first to PInvoke so you can just drop it in your code, and for the second one you can use the code provided in the MSDN comment: [DllImport("dwmapi.dll", PreserveSig = false)] public static extern bool DwmIsComposition...
.Net - Detecting the Appearance Setting (Classic or XP?) I have some UI in VB 2005 that looks great in XP Style, but goes hideous in Classic Style. Any ideas about how to detect which mode the user is in and re-format the forms on the fly? Post Answer Edit: Thanks Daniel, looks like this will work. I'm using the first ...
TITLE: .Net - Detecting the Appearance Setting (Classic or XP?) QUESTION: I have some UI in VB 2005 that looks great in XP Style, but goes hideous in Classic Style. Any ideas about how to detect which mode the user is in and re-format the forms on the fly? Post Answer Edit: Thanks Daniel, looks like this will work. I'...
[ "vb.net", "windows-xp", "appearance" ]
3
2
1,309
3
0
2008-08-29T16:50:22.990000
2008-08-29T16:56:40.620000
34,717
35,143
Can an audio object be embedded in an InfoPath form?
Is it possible to embed an audio object (mp3, wma, whatever) in a web-enabled InfoPath form? If it is, how do you do it?
It looks like you can't embed tags in a richtext field. I'm getting nothing when I do it.
Can an audio object be embedded in an InfoPath form? Is it possible to embed an audio object (mp3, wma, whatever) in a web-enabled InfoPath form? If it is, how do you do it?
TITLE: Can an audio object be embedded in an InfoPath form? QUESTION: Is it possible to embed an audio object (mp3, wma, whatever) in a web-enabled InfoPath form? If it is, how do you do it? ANSWER: It looks like you can't embed tags in a richtext field. I'm getting nothing when I do it.
[ "sharepoint", "audio", "moss", "infopath" ]
1
1
987
4
0
2008-08-29T16:52:41.503000
2008-08-29T19:44:42.120000
34,728
67,355
SharePoint List Scalability
I am particularly interested in Document Libraries, but in terms of general SharePoint lists, can anyone answer the following...? What is the maximum number of items that a SharePoint list can contain? What is the maximum number of lists that a single SharePoint server can host? When the number of items in the list app...
In SharePoint v.2: Max # list items: 2000 (per folder level) Max lists per site: 2000 is a "reasonable" number Effect when we reach the limit: Exponential degradation of performance. More info: http://technet.microsoft.com/en-us/library/cc287743.aspx In SharePoint v.3: Max # list items: 2000 (per view, you can have mil...
SharePoint List Scalability I am particularly interested in Document Libraries, but in terms of general SharePoint lists, can anyone answer the following...? What is the maximum number of items that a SharePoint list can contain? What is the maximum number of lists that a single SharePoint server can host? When the num...
TITLE: SharePoint List Scalability QUESTION: I am particularly interested in Document Libraries, but in terms of general SharePoint lists, can anyone answer the following...? What is the maximum number of items that a SharePoint list can contain? What is the maximum number of lists that a single SharePoint server can ...
[ "sharepoint", "scalability" ]
16
18
26,145
9
0
2008-08-29T16:56:39.637000
2008-09-15T21:50:00.053000
34,732
34,796
How do I list the symbols in a .so file
How do I list the symbols being exported from a.so file? If possible, I'd also like to know their source (e.g. if they are pulled in from a static library). I'm using gcc 4.0.2, if that makes a difference.
The standard tool for listing symbols is nm, you can use it simply like this: nm -gD yourLib.so If you want to see symbols of a C++ library, add the "-C" option which demangle the symbols (it's far more readable demangled). nm -gDC yourLib.so If your.so file is in elf format, you have two options: Either objdump ( -C i...
How do I list the symbols in a .so file How do I list the symbols being exported from a.so file? If possible, I'd also like to know their source (e.g. if they are pulled in from a static library). I'm using gcc 4.0.2, if that makes a difference.
TITLE: How do I list the symbols in a .so file QUESTION: How do I list the symbols being exported from a.so file? If possible, I'd also like to know their source (e.g. if they are pulled in from a static library). I'm using gcc 4.0.2, if that makes a difference. ANSWER: The standard tool for listing symbols is nm, yo...
[ "c++", "c", "gcc", "symbols", "name-mangling" ]
617
775
568,618
11
0
2008-08-29T16:57:47.920000
2008-08-29T17:21:08.550000
34,734
34,747
Best Way to Reuse Code When Using Visual Studio?
I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of two ways: I have tried bringing the projects I need from this ...
In short, what you are doing is right, you want to move the common code into a class library (DLL) and then reference that in any projects that require its logic. Where you are going wrong is that you are not maintaining it. If you need to make little "tweaks", subclass your existing code and extend it, dont change it....
Best Way to Reuse Code When Using Visual Studio? I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of two ways: I h...
TITLE: Best Way to Reuse Code When Using Visual Studio? QUESTION: I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in on...
[ ".net", "visual-studio" ]
5
8
5,946
8
0
2008-08-29T16:58:01.617000
2008-08-29T17:02:11.480000
34,735
35,126
Using a rotary encoder with AVR Micro controller
I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168. Clarification I have tried using an External Interrupt to listen to the pins, but it seems like it is too slow. When Pin A goes high, the interrupt procedure starts...
I have a webpage about rotary encoders and how to use them, which you might find useful. Unfortunately without more information I can't troubleshoot your particular problem. Which microcontroller pins are connected to the encoder, and what is the code you're currently using to decode the pulses? Ok, you're dealing with...
Using a rotary encoder with AVR Micro controller I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168. Clarification I have tried using an External Interrupt to listen to the pins, but it seems like it is too slow. Whe...
TITLE: Using a rotary encoder with AVR Micro controller QUESTION: I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168. Clarification I have tried using an External Interrupt to listen to the pins, but it seems like i...
[ "microcontroller", "avr", "encoder", "atmega" ]
5
10
32,156
5
0
2008-08-29T16:58:02.083000
2008-08-29T19:37:37.503000
34,768
34,810
Setting a form's action in .net 3.5 SP1 causes errors when compiled
I have recently installed.net 3.5 SP1. When I deployed a compiled web site that contained a form with its action set: I received this error. Method not found: 'Void System.Web.UI.HtmlControls.HtmlForm.set_Action(System.String)'. If a fellow developer who has not installed SP1 deploys the compiled site it works fine. Do...
.NET 3.5 SP1 tries to use the action="" attribute (.NET 3.5 RTM did not). So, when you deploy, your code is attempting to set the HtmlForm.Action property and failing, as the System.Web.dll on the deploy target is RTM and does not have a setter on the property.
Setting a form's action in .net 3.5 SP1 causes errors when compiled I have recently installed.net 3.5 SP1. When I deployed a compiled web site that contained a form with its action set: I received this error. Method not found: 'Void System.Web.UI.HtmlControls.HtmlForm.set_Action(System.String)'. If a fellow developer w...
TITLE: Setting a form's action in .net 3.5 SP1 causes errors when compiled QUESTION: I have recently installed.net 3.5 SP1. When I deployed a compiled web site that contained a form with its action set: I received this error. Method not found: 'Void System.Web.UI.HtmlControls.HtmlForm.set_Action(System.String)'. If a ...
[ "asp.net", ".net-3.5" ]
8
6
3,902
6
0
2008-08-29T17:11:40.007000
2008-08-29T17:30:23.690000
34,781
34,792
How do you build a ratings implementation?
We have need for a "rating" system in a project we are working on, similar to the one in SO. However, in ours there are multiple entities that need to be "tagged" with a vote up (only up, never down, like an increment). Sometimes we will need to show all of the entities in order of what is rated highest, regardless of ...
Since reddit's ranking algorithm rocks, it makes very much sense to have a look at it, if not copy it: Given the time the entry was posted A and the time of 7:46:43 a.m. December 8, 2005 B we have t s as their difference in seconds: t s = A - B and x as the difference between the number of up votes U and the number of ...
How do you build a ratings implementation? We have need for a "rating" system in a project we are working on, similar to the one in SO. However, in ours there are multiple entities that need to be "tagged" with a vote up (only up, never down, like an increment). Sometimes we will need to show all of the entities in ord...
TITLE: How do you build a ratings implementation? QUESTION: We have need for a "rating" system in a project we are working on, similar to the one in SO. However, in ours there are multiple entities that need to be "tagged" with a vote up (only up, never down, like an increment). Sometimes we will need to show all of t...
[ "algorithm", "database-design", "architecture", "data-structures" ]
6
6
408
1
0
2008-08-29T17:16:59.667000
2008-08-29T17:20:34.947000
34,784
744,333
Mercurial .hgignore for Visual Studio 2008 projects
What is a good setup for.hgignore file when working with Visual Studio 2008? I mostly develop on my own, only occasionly I clone the repository for somebody else to work on it. I'm thinking about obj folders,.suo,.sln,.user files etc.. Can they just be included or are there file I shouldn't include? Thanks! p.s.: at th...
Here's my standard.hgignore file for use with VS2008 that was originally modified from a Git ignore file: # Ignore file for Visual Studio 2008 # use glob syntax syntax: glob # Ignore Visual Studio 2008 files *.obj *.exe *.pdb *.user *.aps *.pch *.vspscc *_i.c *_p.c *.ncb *.suo *.tlb *.tlh *.bak *.cache *.ilk *.log *....
Mercurial .hgignore for Visual Studio 2008 projects What is a good setup for.hgignore file when working with Visual Studio 2008? I mostly develop on my own, only occasionly I clone the repository for somebody else to work on it. I'm thinking about obj folders,.suo,.sln,.user files etc.. Can they just be included or are...
TITLE: Mercurial .hgignore for Visual Studio 2008 projects QUESTION: What is a good setup for.hgignore file when working with Visual Studio 2008? I mostly develop on my own, only occasionly I clone the repository for somebody else to work on it. I'm thinking about obj folders,.suo,.sln,.user files etc.. Can they just ...
[ "visual-studio", "visual-studio-2008", "mercurial", "hgignore" ]
166
209
25,421
7
0
2008-08-29T17:17:40.507000
2009-04-13T15:54:11.263000
34,790
34,855
duplicating jQuery datepicker
The datepicker function only works on the first input box that is created. I'm trying to duplicate a datepicker by cloning the div that is containing it. click input-text date time picker To initialize the datepicker, according to the jQuery UI documentation I only have to do $('#example').datepicker(); and it does wor...
I'd recommend just using a common class name as well. However, if you're against this for some reason, you could also write a function to create date pickers for all text boxes in your template div (to be called after each duplication). Something like: function makeDatePickers() { $("#template input[type=text]").datepi...
duplicating jQuery datepicker The datepicker function only works on the first input box that is created. I'm trying to duplicate a datepicker by cloning the div that is containing it. click input-text date time picker To initialize the datepicker, according to the jQuery UI documentation I only have to do $('#example')...
TITLE: duplicating jQuery datepicker QUESTION: The datepicker function only works on the first input box that is created. I'm trying to duplicate a datepicker by cloning the div that is containing it. click input-text date time picker To initialize the datepicker, according to the jQuery UI documentation I only have t...
[ "javascript", "jquery" ]
15
7
9,568
4
0
2008-08-29T17:19:25.823000
2008-08-29T17:51:03.890000
34,798
403,473
Entire Page refreshes even though gridview is in an update panel
I have a gridview that is within an updatepanel for a modal popup I have on a page. The issue is that the entire page refreshes every time I click an imagebutton that is within my gridview. This causes my entire page to load and since I have grayed out the rest of the page so that the user cannot click on it this is ve...
Several months later this problem was fixed. The project I was working in was a previous v1.1 which was converted with 2.0. However, in the web.config this line remained: When it was commented out all of the bugs that we seemed to have with the ajax control toolkit disappeared
Entire Page refreshes even though gridview is in an update panel I have a gridview that is within an updatepanel for a modal popup I have on a page. The issue is that the entire page refreshes every time I click an imagebutton that is within my gridview. This causes my entire page to load and since I have grayed out th...
TITLE: Entire Page refreshes even though gridview is in an update panel QUESTION: I have a gridview that is within an updatepanel for a modal popup I have on a page. The issue is that the entire page refreshes every time I click an imagebutton that is within my gridview. This causes my entire page to load and since I ...
[ "asp.net", "gridview", "asp.net-ajax", "updatepanel" ]
2
1
6,809
11
0
2008-08-29T17:21:32.153000
2008-12-31T16:58:15.890000
34,802
34,885
ValidationRule To Enforce Unique Name
I'm trying to write a custom WPF ValidationRule to enforce that a certain property is unique within the context of a given collection. For example: I am editing a collection of custom objects bound to a ListView and I need to ensure that the Name property of each object in the collection is unique. Does anyone know how...
First, I'd create a simple DependencyObject class to hold your collection: class YourCollectionType: DependencyObject { [PROPERTY DEPENDENCY OF ObservableCollection NAMED: BoundList] } Then, on your ValidationRule-derived class, create a property: YourCollectionType ListToCheck { get; set; } Then, in the XAML, do thi...
ValidationRule To Enforce Unique Name I'm trying to write a custom WPF ValidationRule to enforce that a certain property is unique within the context of a given collection. For example: I am editing a collection of custom objects bound to a ListView and I need to ensure that the Name property of each object in the coll...
TITLE: ValidationRule To Enforce Unique Name QUESTION: I'm trying to write a custom WPF ValidationRule to enforce that a certain property is unique within the context of a given collection. For example: I am editing a collection of custom objects bound to a ListView and I need to ensure that the Name property of each ...
[ "wpf", "validation", "data-binding" ]
1
2
1,983
2
0
2008-08-29T17:22:59.747000
2008-08-29T18:03:51.427000
34,806
34,832
Class design decision
I have a little dilemma that maybe you can help me sort out. I've been working today in modifying ASP.NET's Membership to add a level of indirection. Basically, ASP.NET's Membership supports Users and Roles, leaving all authorization rules to be based on whether a user belongs to a Role or not. What I need to do is add...
I feel the best combination of DRYness and forcing the contract is as follows (in pseudocode): class Base { public final constructor(name) { constructor(name, null) end public abstract constructor(name, description); } or, alternatively: class Base { public abstract constructor(name); public final constructor(name, d...
Class design decision I have a little dilemma that maybe you can help me sort out. I've been working today in modifying ASP.NET's Membership to add a level of indirection. Basically, ASP.NET's Membership supports Users and Roles, leaving all authorization rules to be based on whether a user belongs to a Role or not. Wh...
TITLE: Class design decision QUESTION: I have a little dilemma that maybe you can help me sort out. I've been working today in modifying ASP.NET's Membership to add a level of indirection. Basically, ASP.NET's Membership supports Users and Roles, leaving all authorization rules to be based on whether a user belongs to...
[ "inheritance", "asp.net-membership", "oop" ]
1
1
248
2
0
2008-08-29T17:29:38.060000
2008-08-29T17:41:16.940000
34,809
34,882
What is the best way to tell if an object is modified?
I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is pulled from the cookie/initialized and compare the original hash code to ...
At the end of the object's constructor you could serialize the object to a base 64 string just like the cookie stores it, and store this in a member variable. When you want to check if the cookie needs recreating, re - serialize the object and compare this new base 64 string against the one stored in a member variable....
What is the best way to tell if an object is modified? I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is pulled from the co...
TITLE: What is the best way to tell if an object is modified? QUESTION: I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is ...
[ "c#", ".net" ]
6
1
2,750
4
0
2008-08-29T17:30:15.407000
2008-08-29T18:02:04.160000
34,848
35,894
Zend Framework: setting a Zend_Form_Element form field to be required, how do I change the validator used to ensure that the element is not blank
When using a Zend_Form, the only way to validate that an input is not left blank is to do $element->setRequired(true); If this is not set and the element is blank, it appears to me that validation is not run on the element. If I do use setRequired(), the element is automatically given the standard NotEmpty validator. T...
I did it this way (ZF 1.5): $name = new Zend_Form_Element_Text('name'); $name->setLabel('Full Name: ') ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator($MyNotEmpty); so, the addValidator() is the interesting part. The Message is set in an "Errormessage File" (to bundle all custom me...
Zend Framework: setting a Zend_Form_Element form field to be required, how do I change the validator used to ensure that the element is not blank When using a Zend_Form, the only way to validate that an input is not left blank is to do $element->setRequired(true); If this is not set and the element is blank, it appears...
TITLE: Zend Framework: setting a Zend_Form_Element form field to be required, how do I change the validator used to ensure that the element is not blank QUESTION: When using a Zend_Form, the only way to validate that an input is not left blank is to do $element->setRequired(true); If this is not set and the element is...
[ "php", "zend-framework", "validation" ]
4
4
8,168
5
0
2008-08-29T17:47:46.893000
2008-08-30T11:26:57.207000
34,852
34,965
NHibernate Session.Flush() Sending Update Queries When No Update Has Occurred
I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list: public IList GetCustomerByFirstName(string customerFirstName) { return _session.CreateCriteria(typeof(Customer)).Add(new NHibernate.Expression.EqExpression("FirstName", customerFirstName)).List (...
I have seen this once before when one of my models was not mapped correctly (wasn't using nullable types correctly). May you please paste your model and mapping?
NHibernate Session.Flush() Sending Update Queries When No Update Has Occurred I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list: public IList GetCustomerByFirstName(string customerFirstName) { return _session.CreateCriteria(typeof(Customer)).Add(...
TITLE: NHibernate Session.Flush() Sending Update Queries When No Update Has Occurred QUESTION: I have an NHibernate session. In this session, I am performing exactly 1 operation, which is to run this code to get a list: public IList GetCustomerByFirstName(string customerFirstName) { return _session.CreateCriteria(type...
[ "c#", ".net", "nhibernate" ]
35
16
10,491
3
0
2008-08-29T17:49:31.197000
2008-08-29T18:35:23.207000
34,858
34,865
How to benchmark a SQL Server Query?
I'd like to know the standard way to benchmark a SQL Sever Query, preferably I'd like to know about the tools that come with SQL Server rather than 3rd Party tools.
set showplan_text on will show you the execution plan (to see it graphically use CTRL + K (sql 2000) or CTRL + M (sql 2005 +) set statistics IO on will show you the reads set statistics time on will show you the elapsed time
How to benchmark a SQL Server Query? I'd like to know the standard way to benchmark a SQL Sever Query, preferably I'd like to know about the tools that come with SQL Server rather than 3rd Party tools.
TITLE: How to benchmark a SQL Server Query? QUESTION: I'd like to know the standard way to benchmark a SQL Sever Query, preferably I'd like to know about the tools that come with SQL Server rather than 3rd Party tools. ANSWER: set showplan_text on will show you the execution plan (to see it graphically use CTRL + K (...
[ "sql-server", "database", "benchmarking" ]
8
11
7,458
3
0
2008-08-29T17:52:23.060000
2008-08-29T17:55:25.860000
34,868
34,869
How do you create optional arguments in php?
In the PHP manual, to show the syntax for functions with optional parameters, they use brackets around each set of dependent optional parameter. For example, for the date() function, the manual reads: string date ( string $format [, int $timestamp = time() ] ) Where $timestamp is an optional parameter, and when left bl...
Much like the manual, use an equals ( = ) sign in your definition of the parameters: function dosomething($var1, $var2, $var3 = 'somevalue'){ // Rest of function here... }
How do you create optional arguments in php? In the PHP manual, to show the syntax for functions with optional parameters, they use brackets around each set of dependent optional parameter. For example, for the date() function, the manual reads: string date ( string $format [, int $timestamp = time() ] ) Where $timesta...
TITLE: How do you create optional arguments in php? QUESTION: In the PHP manual, to show the syntax for functions with optional parameters, they use brackets around each set of dependent optional parameter. For example, for the date() function, the manual reads: string date ( string $format [, int $timestamp = time() ...
[ "php" ]
216
287
200,516
7
0
2008-08-29T17:57:50.847000
2008-08-29T17:58:50.113000
34,879
34,884
Print out the keys and Data of a Hashtable in C# .NET 1.1
I need debug some old code that uses a Hashtable to store response from various threads. I need a way to go through the entire Hashtable and print out both keys and the data in the Hastable. How can this be done?
foreach(string key in hashTable.Keys) { Console.WriteLine(String.Format("{0}: {1}", key, hashTable[key])); }
Print out the keys and Data of a Hashtable in C# .NET 1.1 I need debug some old code that uses a Hashtable to store response from various threads. I need a way to go through the entire Hashtable and print out both keys and the data in the Hastable. How can this be done?
TITLE: Print out the keys and Data of a Hashtable in C# .NET 1.1 QUESTION: I need debug some old code that uses a Hashtable to store response from various threads. I need a way to go through the entire Hashtable and print out both keys and the data in the Hastable. How can this be done? ANSWER: foreach(string key in ...
[ "c#", "hashtable", ".net-1.1" ]
11
23
39,571
5
0
2008-08-29T18:01:15.240000
2008-08-29T18:03:37.120000
34,896
34,902
When is it best to sanitize user input?
User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the input immediately and then store this "cleaned" version? ...
I like to sanitize it as early as possible, which means the sanitizing happens when the user tries to enter in invalid data. If there's a TextBox for their age, and they type in anything other that a number, I don't let the keypress for the letter go through. Then, whatever is reading the data (often a server) I do a s...
When is it best to sanitize user input? User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the input immediately...
TITLE: When is it best to sanitize user input? QUESTION: User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the...
[ "xss", "sql-injection", "user-input", "sanitization" ]
68
13
27,579
14
0
2008-08-29T18:07:04.960000
2008-08-29T18:09:27.140000
34,913
36,678
C# Linq Grouping
I'm experimenting with Linq and am having trouble figuring out grouping. I've gone through several tutorials but for some reason can't figure this out. As an example, say I have a table (SiteStats) with multiple website IDs that stores a count of how many visitors by type have accessed each site in total and for the pa...
Actually, although Thomas' code will work, it is more succint to use a lambda expression: var totals = from s in sites group s by s.SiteID into grouped select new { SiteID = grouped.Key, Last30Sum = grouped.Sum( s => s.Last30 ) }; which uses the Sum extension method without the need for a nested LINQ operation. as per ...
C# Linq Grouping I'm experimenting with Linq and am having trouble figuring out grouping. I've gone through several tutorials but for some reason can't figure this out. As an example, say I have a table (SiteStats) with multiple website IDs that stores a count of how many visitors by type have accessed each site in tot...
TITLE: C# Linq Grouping QUESTION: I'm experimenting with Linq and am having trouble figuring out grouping. I've gone through several tutorials but for some reason can't figure this out. As an example, say I have a table (SiteStats) with multiple website IDs that stores a count of how many visitors by type have accesse...
[ "c#", "linq" ]
19
35
18,811
2
0
2008-08-29T18:11:45.400000
2008-08-31T07:40:23.437000
34,914
35,467
How do you use XML::Parser with Style => 'Objects'
The manual page for XML::Parser::Style::Objects is horrible. A simple hello world style program would really be helpful. I really wanted to do something like this: (not real code of course) use XML::Parser; my $p = XML::Parser->new(Style => 'Objects', Pkg => 'MyNode'); my $tree = $p->parsefile('foo.xml'); $tree->doSome...
In all cases here is actual code that runs... doesn't mean much but produces output and hopefully can get you started... use XML::Parser; package MyNode::inner; sub doSomething { my $self = shift; print "This is an inner node containing: "; print $self->{Kids}->[0]->{Text}; print "\n"; } package MyNode::Characters; su...
How do you use XML::Parser with Style => 'Objects' The manual page for XML::Parser::Style::Objects is horrible. A simple hello world style program would really be helpful. I really wanted to do something like this: (not real code of course) use XML::Parser; my $p = XML::Parser->new(Style => 'Objects', Pkg => 'MyNode');...
TITLE: How do you use XML::Parser with Style => 'Objects' QUESTION: The manual page for XML::Parser::Style::Objects is horrible. A simple hello world style program would really be helpful. I really wanted to do something like this: (not real code of course) use XML::Parser; my $p = XML::Parser->new(Style => 'Objects',...
[ "xml", "perl" ]
3
1
3,621
2
0
2008-08-29T18:12:01.453000
2008-08-29T23:29:17.917000
34,916
1,056,092
Scaffolding in pylons
Is there anything similar to rails' scaffolding for pylons? I've been poking around google, but only found this thing called dbsprockets, which is fine, although probably way too much for my needs. What I really need is a basic CRUD that is based on the SQLAlchemy model.
The question is super old, but hell: http://code.google.com/p/formalchemy/ Gives you basic crud out of the box, customizable to do even relatively complex things easily, and gives you a drop-in Pylons admin app too (written and customizable with the same api, no magic).
Scaffolding in pylons Is there anything similar to rails' scaffolding for pylons? I've been poking around google, but only found this thing called dbsprockets, which is fine, although probably way too much for my needs. What I really need is a basic CRUD that is based on the SQLAlchemy model.
TITLE: Scaffolding in pylons QUESTION: Is there anything similar to rails' scaffolding for pylons? I've been poking around google, but only found this thing called dbsprockets, which is fine, although probably way too much for my needs. What I really need is a basic CRUD that is based on the SQLAlchemy model. ANSWER:...
[ "python", "pylons" ]
10
7
1,802
3
0
2008-08-29T18:12:30.517000
2009-06-29T00:02:20.330000
34,920
34,933
How do I lock a file in Perl?
What is the best way to create a lock on a file in Perl? Is it best to flock on the file or to create a lock file to place a lock on and check for a lock on the lock file?
If you end up using flock, here's some code to do it: use Fcntl ':flock'; # Import LOCK_* constants # We will use this file path in error messages and function calls. # Don't type it out more than once in your code. Use a variable. my $file = '/path/to/some/file'; # Open the file for appending. Note the file path is ...
How do I lock a file in Perl? What is the best way to create a lock on a file in Perl? Is it best to flock on the file or to create a lock file to place a lock on and check for a lock on the lock file?
TITLE: How do I lock a file in Perl? QUESTION: What is the best way to create a lock on a file in Perl? Is it best to flock on the file or to create a lock file to place a lock on and check for a lock on the lock file? ANSWER: If you end up using flock, here's some code to do it: use Fcntl ':flock'; # Import LOCK_* c...
[ "perl", "file", "locking" ]
29
32
31,301
14
0
2008-08-29T18:13:21.420000
2008-08-29T18:18:40.487000
34,924
34,971
3.1 or 5.1 audio in Flash
Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature). I haven't done any high-tech audio stuff using Flash, so I was wonde...
A quick google search gave me this forum http://board.flashkit.com/board/showthread.php?t=715062 where they state that Flash is unable to handle 5.1 audio and the alternative is to use another application that can communicate with Flash to handle the audio side of things. I also found this blog entry from Summit Projec...
3.1 or 5.1 audio in Flash Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature). I haven't done any high-tech audio stuff u...
TITLE: 3.1 or 5.1 audio in Flash QUESTION: Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature). I haven't done any high-...
[ "flash", "audio" ]
2
2
2,172
3
0
2008-08-29T18:14:44.740000
2008-08-29T18:36:45.530000
34,925
35,223
XmlSerializer changes in .NET 3.5 SP1
I've seen quite a few posts on changes in.NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running.NET 3.5 RTM). [XmlRoot("foo")] public class Foo { static void M...
In SP1 does the foo.Bar property get properly deserialized? In pre SP1 you wouldn't be able to deserialize the object because the set method of the Bar property is private so the XmlSerializer doesn't have a way to set that value. I'm not sure how SP1 is pulling it off. You could try adding this to your web.config/app....
XmlSerializer changes in .NET 3.5 SP1 I've seen quite a few posts on changes in.NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running.NET 3.5 RTM). [XmlRoot("f...
TITLE: XmlSerializer changes in .NET 3.5 SP1 QUESTION: I've seen quite a few posts on changes in.NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running.NET 3.5...
[ "xml", "serialization", ".net-3.5" ]
5
4
4,832
2
0
2008-08-29T18:15:04.567000
2008-08-29T20:20:59.180000
34,926
35,012
Strip HTML from string in SSRS 2005 (VB.NET)
my SSRS DataSet returns a field with HTML, e.g. blah blah blah. how do i strip all the HTML tags? has to be done with inline VB.NET Changing the data in the table is not an option. Solution found... = System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]+>","")
Thanx to Daniel, but I needed it to be done inline... here's the solution: = System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]+>","") Here are the links: http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx http://msdn.microsoft.com/en-us/library/ms157328.aspx
Strip HTML from string in SSRS 2005 (VB.NET) my SSRS DataSet returns a field with HTML, e.g. blah blah blah. how do i strip all the HTML tags? has to be done with inline VB.NET Changing the data in the table is not an option. Solution found... = System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]...
TITLE: Strip HTML from string in SSRS 2005 (VB.NET) QUESTION: my SSRS DataSet returns a field with HTML, e.g. blah blah blah. how do i strip all the HTML tags? has to be done with inline VB.NET Changing the data in the table is not an option. Solution found... = System.Text.RegularExpressions.Regex.Replace(StringWithH...
[ "vb.net", "reporting-services" ]
11
14
11,335
5
0
2008-08-29T18:16:14.250000
2008-08-29T18:50:57.727000
34,938
34,954
if statement condition optimisation
I have an if statement with two conditions (separated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed I only want the second condition to be processed if the first condition evaluates to false. if I or...
For C, C++, C#, Java and other.NET languages boolean expressions are optimised so that as soon as enough is known nothing else is evaluated. An old trick for doing obfuscated code was to use this to create if statements, such as: a || b(); if "a" is true, "b()" would never be evaluated, so we can rewrite it into: if(!a...
if statement condition optimisation I have an if statement with two conditions (separated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed I only want the second condition to be processed if the first c...
TITLE: if statement condition optimisation QUESTION: I have an if statement with two conditions (separated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed I only want the second condition to be proces...
[ "php", "language-agnostic", "conditional-statements" ]
5
9
9,550
11
0
2008-08-29T18:21:17.593000
2008-08-29T18:27:35.003000
34,955
41,043
Best practices for debugging linking errors
When building projects in C++, I've found debugging linking errors to be tricky, especially when picking up other people's code. What strategies do people use for debugging and fixing linking errors?
Not sure what your level of expertise is, but here are the basics. Below is a linker error from VS 2005 - yes, it's a giant mess if you're not familiar with it. ByteComparator.obj: error LNK2019: unresolved external symbol "int __cdecl does_not_exist(void)" (?does_not_exist@@YAHXZ) referenced in function "void __cdecl ...
Best practices for debugging linking errors When building projects in C++, I've found debugging linking errors to be tricky, especially when picking up other people's code. What strategies do people use for debugging and fixing linking errors?
TITLE: Best practices for debugging linking errors QUESTION: When building projects in C++, I've found debugging linking errors to be tricky, especially when picking up other people's code. What strategies do people use for debugging and fixing linking errors? ANSWER: Not sure what your level of expertise is, but her...
[ "c++", "visual-studio", "gcc", "linker", "compilation" ]
51
25
29,209
3
0
2008-08-29T18:27:44.147000
2008-09-03T02:06:30.437000
34,973
35,176
Tools for finding memory corruption in managed C++ code
I have a.NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding an error on a call to free() when cleaning up after compression. Are there ...
In native code, if the corruption always occurs in the same place in memory, you can use a data breakpoint to break the debugger when that memory is changed. Unfortunately, you cannot set a data breakpoint in the managed C++ environment, presumably because the GC could move the object in memory. Not sure if this helps,...
Tools for finding memory corruption in managed C++ code I have a.NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding an error on a call ...
TITLE: Tools for finding memory corruption in managed C++ code QUESTION: I have a.NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding a...
[ ".net", "managed-c++" ]
2
1
1,632
3
0
2008-08-29T18:37:02.080000
2008-08-29T19:58:37.720000
34,977
41,051
Byte level length description
I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet. The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understandable. The problem is that the code will only g...
Really you're only doing four calculations, so readability seems way more important here than efficiency. My approach to make something like this more readable is to Extract common code to a function Put similar calculations together to make the patterns more obvious Get rid of the intermediate variable print_zeroes an...
Byte level length description I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet. The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understandable. The proble...
TITLE: Byte level length description QUESTION: I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet. The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understa...
[ "c", "protocols" ]
2
0
752
4
0
2008-08-29T18:38:42.357000
2008-09-03T02:14:08.080000
34,981
34,998
Scrum: Resistance is (not) futile
I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company.;) Since I've been here (a few months now), I've brought on board my boss, my product manager and several other k...
While Scrum other agile methodologies like it embody a lot of good practices, sometimes giving it a name and making it (as many bloggers have commented on) a "religion" that must be adopted in the workplace is rather offputting to a lot of people, including myself. It depends on what your options and commitments are, b...
Scrum: Resistance is (not) futile I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company.;) Since I've been here (a few months now), I've brought on board my boss, my p...
TITLE: Scrum: Resistance is (not) futile QUESTION: I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company.;) Since I've been here (a few months now), I've brought on b...
[ "agile", "scrum" ]
7
14
1,749
7
0
2008-08-29T18:39:24.320000
2008-08-29T18:46:28.297000
34,988
219,897
How to transform a WebService call that is using behaviours?
We have some really old code that calls WebServices using behaviours (webservice.htc), and we are having some strange problems... since they've been deprecated a long time ago, I want to change the call. What's the correct way of doing it? It's ASP.NET 1.1
You should be able to generate a proxy class using wsdl.exe. Then just use the web service as you normally would.
How to transform a WebService call that is using behaviours? We have some really old code that calls WebServices using behaviours (webservice.htc), and we are having some strange problems... since they've been deprecated a long time ago, I want to change the call. What's the correct way of doing it? It's ASP.NET 1.1
TITLE: How to transform a WebService call that is using behaviours? QUESTION: We have some really old code that calls WebServices using behaviours (webservice.htc), and we are having some strange problems... since they've been deprecated a long time ago, I want to change the call. What's the correct way of doing it? I...
[ "c#", "javascript", "web-services", "asp.net-1.1", "behavior" ]
6
3
260
2
0
2008-08-29T18:41:42.630000
2008-10-20T21:02:05.013000
35,002
35,666
Does C# have a way of giving me an immutable Dictionary?
Is there anything built into the core C# libraries that can give me an immutable Dictionary? Something along the lines of Java's: Collections.unmodifiableMap(myMap); And just to clarify, I am not looking to stop the keys / values themselves from being changed, just the structure of the Dictionary. I want something that...
No, but a wrapper is rather trivial: public class ReadOnlyDictionary: IDictionary { IDictionary _dict; public ReadOnlyDictionary(IDictionary backingDict) { _dict = backingDict; } public void Add(TKey key, TValue value) { throw new InvalidOperationException(); } public bool ContainsKey(TKey key) { return _dict.Contai...
Does C# have a way of giving me an immutable Dictionary? Is there anything built into the core C# libraries that can give me an immutable Dictionary? Something along the lines of Java's: Collections.unmodifiableMap(myMap); And just to clarify, I am not looking to stop the keys / values themselves from being changed, ju...
TITLE: Does C# have a way of giving me an immutable Dictionary? QUESTION: Is there anything built into the core C# libraries that can give me an immutable Dictionary? Something along the lines of Java's: Collections.unmodifiableMap(myMap); And just to clarify, I am not looking to stop the keys / values themselves from...
[ "c#", "java", ".net", "collections", "dictionary" ]
75
52
26,641
14
0
2008-08-29T18:47:23.117000
2008-08-30T03:56:02.440000
35,007
38,410
How to expose a collection property?
Every time I create an object that has a collection property I go back and forth on the best way to do it? public property with a getter that returns a reference to private variable explicit get_ObjList and set_ObjList methods that return and create new or cloned objects every time explicit get_ObjList that returns an ...
How you expose a collection depends entirely on how users are intended to interact with it. 1) If users will be adding and removing items from an object's collection, then a simple get-only collection property is best (option #1 from the original question): private readonly Collection myCollection_ = new...; public Col...
How to expose a collection property? Every time I create an object that has a collection property I go back and forth on the best way to do it? public property with a getter that returns a reference to private variable explicit get_ObjList and set_ObjList methods that return and create new or cloned objects every time ...
TITLE: How to expose a collection property? QUESTION: Every time I create an object that has a collection property I go back and forth on the best way to do it? public property with a getter that returns a reference to private variable explicit get_ObjList and set_ObjList methods that return and create new or cloned o...
[ "c#", ".net", "architecture" ]
49
57
24,917
7
0
2008-08-29T18:48:17.390000
2008-09-01T20:46:35.923000
35,011
35,057
Register Multiple Assemblies to the GAC in Vista
I've got a whole directory of dll's I need to register to the GAC. I'd like to avoid registering each file explicitly- but it appears that gacutil has no "register directory" option. Anyone have a fast/simple solution?
GACUTIL doesn't register DLLs -- not in the "COM" sense. Unlike in COM, GACUTIL copies the file to an opaque directory under %SYSTEMROOT%\assembly and that's where they run from. It wouldn't make sense to ask GACUTIL "register a folder" (not that you can do that with RegSvr32 either). You can use a batch FOR command su...
Register Multiple Assemblies to the GAC in Vista I've got a whole directory of dll's I need to register to the GAC. I'd like to avoid registering each file explicitly- but it appears that gacutil has no "register directory" option. Anyone have a fast/simple solution?
TITLE: Register Multiple Assemblies to the GAC in Vista QUESTION: I've got a whole directory of dll's I need to register to the GAC. I'd like to avoid registering each file explicitly- but it appears that gacutil has no "register directory" option. Anyone have a fast/simple solution? ANSWER: GACUTIL doesn't register ...
[ ".net", "gac", "gacutil" ]
21
38
13,143
4
0
2008-08-29T18:50:51.360000
2008-08-29T19:05:44.880000
35,017
35,051
File database suggestion with support for multiple concurrent users
I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software. I'm considering MS Access or Berkeley DB. Can you share your experience with file databases? Which one did you use, did you have any problems with it?
I would suggest SQLite because the entire database is stored in a single file, and it quite safely handles multiple users accessing it at the same time. There are several different libraries that you can use for your client application and there is no server software needed. One of the strengths is that it mimics SQL s...
File database suggestion with support for multiple concurrent users I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software. I'm considering MS Access or Berkeley DB. Can you share your experience with file databases? Which one did you use, di...
TITLE: File database suggestion with support for multiple concurrent users QUESTION: I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software. I'm considering MS Access or Berkeley DB. Can you share your experience with file databases? Which o...
[ "database", "ms-access", "concurrency", "berkeley-db" ]
2
5
2,351
9
0
2008-08-29T18:52:54.397000
2008-08-29T19:03:04.717000
35,026
35,038
SQL Server, convert a named instance to default instance?
I need to convert a named instance of SQL server 2005, to a default instance. Is there a way to do this without a reinstall? The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the other 4 of us. I am looking for the path of least resista...
As far as I know, no. One reason is the folder structure on the hard drive; they will have a name like MSSQL10.[instancename]
SQL Server, convert a named instance to default instance? I need to convert a named instance of SQL server 2005, to a default instance. Is there a way to do this without a reinstall? The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the...
TITLE: SQL Server, convert a named instance to default instance? QUESTION: I need to convert a named instance of SQL server 2005, to a default instance. Is there a way to do this without a reinstall? The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connecti...
[ "sql-server", "sql-server-2005", "named-instance" ]
154
21
118,650
7
0
2008-08-29T18:55:35.123000
2008-08-29T18:59:18.953000
35,037
35,052
How to convert complex filename into HTML link?
I have a directory with PDF files that I need to create an index for. It is a PHP page with a list of links: filename The filenames can be complicated: LVD 2-1133 - Ändring av dumpningslina (1984-11-20).pdf What is the correct way to link to this file on a Linux/Apache server? Is there a PHP function to do this convers...
You can use rawurlencode() to convert a string according to the RFC 1738 spec. This function replaces all non-alphanumeric characters by their associated code. The difference with urlencode() is that spaces are encoded as plus signs. You'll probably want to use the last one. This technique is called Percent or URL enco...
How to convert complex filename into HTML link? I have a directory with PDF files that I need to create an index for. It is a PHP page with a list of links: filename The filenames can be complicated: LVD 2-1133 - Ändring av dumpningslina (1984-11-20).pdf What is the correct way to link to this file on a Linux/Apache se...
TITLE: How to convert complex filename into HTML link? QUESTION: I have a directory with PDF files that I need to create an index for. It is a PHP page with a list of links: filename The filenames can be complicated: LVD 2-1133 - Ändring av dumpningslina (1984-11-20).pdf What is the correct way to link to this file on...
[ "php", "html" ]
1
3
2,447
5
0
2008-08-29T18:58:55.583000
2008-08-29T19:03:17.617000
35,050
35,054
Comparison of Javascript libraries
After the suggestion to use a library for my ajax needs I am going to use one, the problem is that there are so many and I've no idea how to even begin telling them apart. Thus, can anybody A) Give a rundown of the differences or B) Point me (and others like me) somewhere that has such a list. Failing that plan C is to...
To answer B: Comparison of JavaScript frameworks EDIT: Although everyone and their mom is apparently riding the jQuery bandwagon (I use MochiKit ), there are many libraries which provide the same functionality - the problem set which most libraries solve (async client-server communication, DOM manipulation, etc.) is th...
Comparison of Javascript libraries After the suggestion to use a library for my ajax needs I am going to use one, the problem is that there are so many and I've no idea how to even begin telling them apart. Thus, can anybody A) Give a rundown of the differences or B) Point me (and others like me) somewhere that has suc...
TITLE: Comparison of Javascript libraries QUESTION: After the suggestion to use a library for my ajax needs I am going to use one, the problem is that there are so many and I've no idea how to even begin telling them apart. Thus, can anybody A) Give a rundown of the differences or B) Point me (and others like me) some...
[ "javascript", "comparison" ]
4
10
5,613
11
0
2008-08-29T19:03:01.347000
2008-08-29T19:04:05.667000
35,070
35,162
programmatically merge .reg file into win32 registry
What's the best way to programmatically merge a.reg file into the registry? This is for unit testing; the.reg file is a test artifact which will be added then removed at the start and end of testing. Or, if there's a better way to unit test against the registry...
It is possible to remove registry keys using a.reg file, although I'm not sure how well it's documented. Here's how: REGEDIT4 [-HKEY_CURRENT_USER\Software\ ] The - in front of the key name tells Regedit that you want to remove the key. To run this silently, type: regedit /s "myfile.reg"
programmatically merge .reg file into win32 registry What's the best way to programmatically merge a.reg file into the registry? This is for unit testing; the.reg file is a test artifact which will be added then removed at the start and end of testing. Or, if there's a better way to unit test against the registry...
TITLE: programmatically merge .reg file into win32 registry QUESTION: What's the best way to programmatically merge a.reg file into the registry? This is for unit testing; the.reg file is a test artifact which will be added then removed at the start and end of testing. Or, if there's a better way to unit test against ...
[ "unit-testing", "registry" ]
6
9
4,602
5
0
2008-08-29T19:09:47.353000
2008-08-29T19:53:11.507000
35,076
35,100
Strategy for identifying unused tables in SQL Server 2000?
I'm working with a SQL Server 2000 database that likely has a few dozen tables that are no longer accessed. I'd like to clear out the data that we no longer need to be maintaining, but I'm not sure how to identify which tables to remove. The database is shared by several different applications, so I can't be 100% confi...
MSSQL2000 won't give you that kind of information. But a way you can identify what tables ARE used (and then deduce which ones are not) is to use the SQL Profiler, to save all the queries that go to a certain database. Configure the profiler to record the results to a new table, and then check the queries saved there t...
Strategy for identifying unused tables in SQL Server 2000? I'm working with a SQL Server 2000 database that likely has a few dozen tables that are no longer accessed. I'd like to clear out the data that we no longer need to be maintaining, but I'm not sure how to identify which tables to remove. The database is shared ...
TITLE: Strategy for identifying unused tables in SQL Server 2000? QUESTION: I'm working with a SQL Server 2000 database that likely has a few dozen tables that are no longer accessed. I'd like to clear out the data that we no longer need to be maintaining, but I'm not sure how to identify which tables to remove. The d...
[ "sql", "database", "sql-server-2000" ]
2
5
1,526
6
0
2008-08-29T19:13:14.350000
2008-08-29T19:25:05.553000
35,102
35,139
What is the role of the buried-buffer-list frame parameter in Emacs
In emacs, I've read the following code snippet in simple.el: (frame-parameter frame 'buried-buffer-list) What is the exact meaning of the 'buried-buffer-list parameter? What it is used for?
The result of M-x describe function RET frame-parameter is: frame-parameter is a built-in function. (frame-parameter FRAME PARAMETER) Return FRAME's value for parameter PARAMETER. If FRAME is nil, describe the currently selected frame. Also, have a look in the Elisp info manual for the node called "Frame/Frame Paramete...
What is the role of the buried-buffer-list frame parameter in Emacs In emacs, I've read the following code snippet in simple.el: (frame-parameter frame 'buried-buffer-list) What is the exact meaning of the 'buried-buffer-list parameter? What it is used for?
TITLE: What is the role of the buried-buffer-list frame parameter in Emacs QUESTION: In emacs, I've read the following code snippet in simple.el: (frame-parameter frame 'buried-buffer-list) What is the exact meaning of the 'buried-buffer-list parameter? What it is used for? ANSWER: The result of M-x describe function...
[ "emacs", "elisp" ]
5
1
408
2
0
2008-08-29T19:27:17.980000
2008-08-29T19:42:56.773000
35,103
35,116
How do I store information in my executable in .Net
I'd like to bind a configuration file to my executable. I'd like to do this by storing an MD5 hash of the file inside the executable. This should keep anyone but the executable from modifying the file. Essentially if someone modifies this file outside of the program the program should fail to load it again. EDIT: The p...
A better solution is to store the MD5 in the configuration file. But instead of the MD5 being just of the configuration file, also include some secret "key" value, like a fixed guid, in the MD5. write(MD5(SecretKey + ConfigFileText)); Then you simply remove that MD5 and rehash the file (including your secret key). If t...
How do I store information in my executable in .Net I'd like to bind a configuration file to my executable. I'd like to do this by storing an MD5 hash of the file inside the executable. This should keep anyone but the executable from modifying the file. Essentially if someone modifies this file outside of the program t...
TITLE: How do I store information in my executable in .Net QUESTION: I'd like to bind a configuration file to my executable. I'd like to do this by storing an MD5 hash of the file inside the executable. This should keep anyone but the executable from modifying the file. Essentially if someone modifies this file outsid...
[ "c#", ".net" ]
10
12
1,404
4
0
2008-08-29T19:27:18.667000
2008-08-29T19:34:07.573000
35,106
35,125
Is there a built in way in .Net AJAX to manually serialize an object to a JSON string?
I've found ScriptingJsonSerializationSection but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since.Net can do it on the fly with the and attributes so there must be a built-in way that I'm missing. PS: using Asp.Net 2.0 and VB.Net - I put this in the tags bu...
This should do the trick Dim jsonSerialiser As New System.Web.Script.Serialization.JavaScriptSerializer Dim jsonString as String = jsonSerialiser.Serialize(yourObject)
Is there a built in way in .Net AJAX to manually serialize an object to a JSON string? I've found ScriptingJsonSerializationSection but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since.Net can do it on the fly with the and attributes so there must be a buil...
TITLE: Is there a built in way in .Net AJAX to manually serialize an object to a JSON string? QUESTION: I've found ScriptingJsonSerializationSection but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since.Net can do it on the fly with the and attributes so th...
[ "asp.net", "vb.net", "json", "serialization", ".net-2.0" ]
11
11
1,958
6
0
2008-08-29T19:28:50.583000
2008-08-29T19:37:28.363000
35,120
35,705
Image processing in Silverlight 2
Is it possible to do image processing in silverlight 2.0? What I want to do is take an image, crop it, and then send the new cropped image up to the server. I know I can fake it by clipping the image, but that only effects the rendering of the image. I want to create a new image. After further research I have answered ...
Well, you can actually do local image processing in Silverlight 2... But there are no built in classes to help you. But you can load any image into a byte array, and start manipulating it, or implement your own image encoder. Joe Stegman got lots of great information about "editable images" in Silverlight over at http:...
Image processing in Silverlight 2 Is it possible to do image processing in silverlight 2.0? What I want to do is take an image, crop it, and then send the new cropped image up to the server. I know I can fake it by clipping the image, but that only effects the rendering of the image. I want to create a new image. After...
TITLE: Image processing in Silverlight 2 QUESTION: Is it possible to do image processing in silverlight 2.0? What I want to do is take an image, crop it, and then send the new cropped image up to the server. I know I can fake it by clipping the image, but that only effects the rendering of the image. I want to create ...
[ "silverlight" ]
4
3
4,493
3
0
2008-08-29T19:35:44.327000
2008-08-30T05:38:50.477000
35,123
159,454
Prevent SWT ScrolledComposite from eating part of it's children
What did I do wrong? Here is an excerpt from my code: public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHorizontal(true); mParent = new Composite(scrollBox, SWT.NONE); scrollBox.setContent(m...
This is a common hurdle when using ScrolledComposite. When it gets so small that the scroll bar must be shown, the client control has to shrink horizontally to make room for the scroll bar. This has the side effect of making some labels wrap lines, which moved the following controls farther down, which increased the mi...
Prevent SWT ScrolledComposite from eating part of it's children What did I do wrong? Here is an excerpt from my code: public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHorizontal(true); mPar...
TITLE: Prevent SWT ScrolledComposite from eating part of it's children QUESTION: What did I do wrong? Here is an excerpt from my code: public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHori...
[ "java", "eclipse", "swt", "rcp" ]
13
13
11,969
4
0
2008-08-29T19:36:33.920000
2008-10-01T20:03:37.207000
35,167
35,172
Is there a way to perform a circular bit shift in C#?
I know that the following is true int i = 17; //binary 10001 int j = i << 1; //decimal 34, binary 100010 But, if you shift too far, the bits fall off the end. Where this happens is a matter of the size of integer you are working with. Is there a way to perform a shift so that the bits rotate around to the other side? I...
If you know the size of type, you could do something like: uint i = 17; uint j = i << 1 | i >> 31;... which would perform a circular shift of a 32 bit value. As a generalization to circular shift left n bits, on a b bit variable: /*some unsigned numeric type*/ input = 17; var result = input << n | input >> (b - n); @Th...
Is there a way to perform a circular bit shift in C#? I know that the following is true int i = 17; //binary 10001 int j = i << 1; //decimal 34, binary 100010 But, if you shift too far, the bits fall off the end. Where this happens is a matter of the size of integer you are working with. Is there a way to perform a shi...
TITLE: Is there a way to perform a circular bit shift in C#? QUESTION: I know that the following is true int i = 17; //binary 10001 int j = i << 1; //decimal 34, binary 100010 But, if you shift too far, the bits fall off the end. Where this happens is a matter of the size of integer you are working with. Is there a wa...
[ "c#", "bit-manipulation" ]
43
56
27,272
5
0
2008-08-29T19:54:43.047000
2008-08-29T19:57:17.847000
35,170
35,193
Verilog automatic task
What does it mean if a task is declared with the automatic keyword in Verilog? task automatic do_things; input [31:0] number_of_things; reg [31:0] tmp_thing; begin //... end endtask; Note: This question is mostly because I'm curious if there are any hardware programmers on the site.:)
It means that the task is re-entrant - items declared within the task are dynamically allocated rather than shared between different invocations of the task. You see - some of us do Verilog... (ugh)
Verilog automatic task What does it mean if a task is declared with the automatic keyword in Verilog? task automatic do_things; input [31:0] number_of_things; reg [31:0] tmp_thing; begin //... end endtask; Note: This question is mostly because I'm curious if there are any hardware programmers on the site.:)
TITLE: Verilog automatic task QUESTION: What does it mean if a task is declared with the automatic keyword in Verilog? task automatic do_things; input [31:0] number_of_things; reg [31:0] tmp_thing; begin //... end endtask; Note: This question is mostly because I'm curious if there are any hardware programmers on the s...
[ "verilog" ]
21
22
46,590
6
0
2008-08-29T19:56:47.427000
2008-08-29T20:07:49.990000
35,185
35,271
Finding a single number in a list
What would be the best algorithm for finding a number that occurs only once in a list which has all other numbers occurring exactly twice. So, in the list of integers (lets take it as an array) each integer repeats exactly twice, except one. To find that one, what is the best algorithm.
The fastest (O(n)) and most memory efficient (O(1)) way is with the XOR operation. In C: int arr[] = {3, 2, 5, 2, 1, 5, 3}; int num = 0, i; for (i=0; i < 7; i++) num ^= arr[i]; printf("%i\n", num); This prints "1", which is the only one that occurs once. This works because the first time you hit a number it marks th...
Finding a single number in a list What would be the best algorithm for finding a number that occurs only once in a list which has all other numbers occurring exactly twice. So, in the list of integers (lets take it as an array) each integer repeats exactly twice, except one. To find that one, what is the best algorithm...
TITLE: Finding a single number in a list QUESTION: What would be the best algorithm for finding a number that occurs only once in a list which has all other numbers occurring exactly twice. So, in the list of integers (lets take it as an array) each integer repeats exactly twice, except one. To find that one, what is ...
[ "algorithm", "puzzle" ]
40
140
24,236
11
0
2008-08-29T20:03:58.063000
2008-08-29T20:43:57.017000
35,186
35,210
How do I fix a NoSuchMethodError?
I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?
Without any more information it is difficult to pinpoint the problem, but the root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it. Look at the stack trace... If the exception appears when calling a method ...
How do I fix a NoSuchMethodError? I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?
TITLE: How do I fix a NoSuchMethodError? QUESTION: I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it? ANSWER: Without any more information it is difficult to pinpoint the problem, but the root cause is that you most likely have compiled a class against a different ve...
[ "java", "nosuchmethoderror" ]
235
283
566,753
33
0
2008-08-29T20:04:27.643000
2008-08-29T20:14:56.353000
35,191
36,771
Error using Team Foundation Server merge function
When merging two code branches in Team Foundation Server I get the following error: The given key was not present in the dictionary. Some files are checked out and show up in "Pending Changes", but no changes are actually made. I have a workaround: Attempt to merge (fails with error) Get latest from trunk Undo all pend...
Sounds like a bug. If you can replicate this, I recommend you contact Microsoft Support or use the Microsoft Connect bug reporting web site. I did not find any mention of this in a preliminary search.
Error using Team Foundation Server merge function When merging two code branches in Team Foundation Server I get the following error: The given key was not present in the dictionary. Some files are checked out and show up in "Pending Changes", but no changes are actually made. I have a workaround: Attempt to merge (fai...
TITLE: Error using Team Foundation Server merge function QUESTION: When merging two code branches in Team Foundation Server I get the following error: The given key was not present in the dictionary. Some files are checked out and show up in "Pending Changes", but no changes are actually made. I have a workaround: Att...
[ "tfs", "merge" ]
0
1
764
1
0
2008-08-29T20:07:31.300000
2008-08-31T11:10:29.563000
35,194
35,221
Working in Visual Studio (2005 or 2008) on a networked drive
Have you guys had any experiences (positive or negative) by placing your source code/solution on a network drive for Visual Studio 2005 or 2008? Please note I am not referring to placing your actual source control system on that drive, but rather your working folder. Thanks
It works just fine. I have worked with source code from my "home" folder on many different systems (NFS, Samba, AD) and never had any problems. The only drawback is that you might experience somewhat longer compile times if your network is slow or there is much traffic on the network. Under normal circumstances this is...
Working in Visual Studio (2005 or 2008) on a networked drive Have you guys had any experiences (positive or negative) by placing your source code/solution on a network drive for Visual Studio 2005 or 2008? Please note I am not referring to placing your actual source control system on that drive, but rather your working...
TITLE: Working in Visual Studio (2005 or 2008) on a networked drive QUESTION: Have you guys had any experiences (positive or negative) by placing your source code/solution on a network drive for Visual Studio 2005 or 2008? Please note I am not referring to placing your actual source control system on that drive, but r...
[ "visual-studio-2008", "visual-studio-2005" ]
0
1
303
2
0
2008-08-29T20:08:23.373000
2008-08-29T20:20:44.093000
35,208
35,226
requiredfield validator is preventing another form from submitting
I have a page with many forms in panels and usercontrols, and a requiredfield validator I just added to one form is preventing all of my other forms from submitting. what's the rule that I'm not following?
Are you using ValidationGroups? Try assigning each control with a validation group as well as the validator that you want to use. Something like: Note, if a button doesn't specify a validation group it will validate all controls that aren't assigned to a validation group.
requiredfield validator is preventing another form from submitting I have a page with many forms in panels and usercontrols, and a requiredfield validator I just added to one form is preventing all of my other forms from submitting. what's the rule that I'm not following?
TITLE: requiredfield validator is preventing another form from submitting QUESTION: I have a page with many forms in panels and usercontrols, and a requiredfield validator I just added to one form is preventing all of my other forms from submitting. what's the rule that I'm not following? ANSWER: Are you using Valida...
[ "asp.net" ]
1
5
460
2
0
2008-08-29T20:14:19.210000
2008-08-29T20:21:58.707000
35,211
37,315
Identify an event via a Linq Expression tree
The compiler usually chokes when an event doesn't appear beside a += or a -=, so I'm not sure if this is possible. I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax would look something like this: using(var foo = new EventWatcher(target, x => x.M...
Edit: As Curt has pointed out, my implementation is rather flawed in that it can only be used from within the class that declares the event:) Instead of " x => x.MyEvent " returning the event, it was returning the backing field, which is only accessble by the class. Since expressions cannot contain assignment statement...
Identify an event via a Linq Expression tree The compiler usually chokes when an event doesn't appear beside a += or a -=, so I'm not sure if this is possible. I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax would look something like this: usin...
TITLE: Identify an event via a Linq Expression tree QUESTION: The compiler usually chokes when an event doesn't appear beside a += or a -=, so I'm not sure if this is possible. I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax would look somethi...
[ "c#", "linq", "expression-trees" ]
9
4
3,577
4
0
2008-08-29T20:15:50.580000
2008-09-01T00:47:10.193000
35,219
38,231
Optimizing/Customizing Sharepoint Search Crawling
With SharePoint Server 2007, there is also a Search Feature and a Crawler. However, the Crawler is somewhat limited in that it only supports Basic Auth when crawling external sites and that there is no way to tell it to ignore no-index,no-follow attributes. Now, there is a site i'd like to index, unfortunately this sit...
The limitation of MOSS crawling sites with different forms authentication should have been addressed in MOSS SP1.: http://www.microsoft.com/downloads/details.aspx?FamilyID=ad59175c-ad6a-4027-8c2f-db25322f791b&displaylang=en Here's a link to a post which describes how to get the hotfix for pre-SP1 MOSS to enable the cra...
Optimizing/Customizing Sharepoint Search Crawling With SharePoint Server 2007, there is also a Search Feature and a Crawler. However, the Crawler is somewhat limited in that it only supports Basic Auth when crawling external sites and that there is no way to tell it to ignore no-index,no-follow attributes. Now, there i...
TITLE: Optimizing/Customizing Sharepoint Search Crawling QUESTION: With SharePoint Server 2007, there is also a Search Feature and a Crawler. However, the Crawler is somewhat limited in that it only supports Basic Auth when crawling external sites and that there is no way to tell it to ignore no-index,no-follow attrib...
[ "c#", ".net", "sharepoint" ]
6
3
1,034
1
0
2008-08-29T20:19:31.677000
2008-09-01T18:09:03.400000
35,224
35,883
Flex ComboBox, default value and dataproviders
I have a Flex ComboBox that gets populated by a dataprovider all is well... I would now like to add a default " -- select a item --" option at the 0 index, how can I do this and still use a dataprovider? I have not seen any examples of such, but I can't imagine this being hard...
If you don't need the default item to be selectable you can use the prompt property of ComboBox and set the selectedIndex to -1. That will show the string you set propmt to as the selected value until the user chooses another. It will not appear in the list of options, however.
Flex ComboBox, default value and dataproviders I have a Flex ComboBox that gets populated by a dataprovider all is well... I would now like to add a default " -- select a item --" option at the 0 index, how can I do this and still use a dataprovider? I have not seen any examples of such, but I can't imagine this being ...
TITLE: Flex ComboBox, default value and dataproviders QUESTION: I have a Flex ComboBox that gets populated by a dataprovider all is well... I would now like to add a default " -- select a item --" option at the 0 index, how can I do this and still use a dataprovider? I have not seen any examples of such, but I can't i...
[ "apache-flex", "data-binding", "combobox" ]
14
36
31,009
4
0
2008-08-29T20:21:13.827000
2008-08-30T11:07:33.947000
35,232
1,157,405
Would building an application using a Sql Server Database File (mdf) be a terrible idea?
I'm working on a side project that would be a simple web application to maintain a list of classes and their upcoming schedules. I would really like to use Linq to SQL for this project, but unfortunately the server environment I'm developing for only has MySql available. I've dabbled briefly with Subsonic but it just d...
I've long since completed the project which prompted this question, but recently I've had another project come along with very minor data requirements, so I spent some more time experimenting with this. I had assumed that Sql Server Express required licensing fees to deploy, but this is not in fact the case. According ...
Would building an application using a Sql Server Database File (mdf) be a terrible idea? I'm working on a side project that would be a simple web application to maintain a list of classes and their upcoming schedules. I would really like to use Linq to SQL for this project, but unfortunately the server environment I'm ...
TITLE: Would building an application using a Sql Server Database File (mdf) be a terrible idea? QUESTION: I'm working on a side project that would be a simple web application to maintain a list of classes and their upcoming schedules. I would really like to use Linq to SQL for this project, but unfortunately the serve...
[ "asp.net", "sql", "mysql", "sql-server" ]
2
2
1,914
10
0
2008-08-29T20:26:39.743000
2009-07-21T05:12:15.687000
35,233
35,262
Rewrite or repair?
I'm sure you have all been there, you take on a project where there is a creaky old code base which is barely fit for purpose and you have to make the decision to either re-write it from scratch or repair what already exists. Conventional wisdom tends to suggest that you should never attempt a re-write from scratch as ...
It really depends on how bad it is. If it's a small system, and you fully understand it, then a rewrite is not crazy. On the other hand, if it's a giant legacy monster with ten million lines of undocumented mystery code, then you're really going to have a hard time with a full rewrite. Points to consider: If it looks g...
Rewrite or repair? I'm sure you have all been there, you take on a project where there is a creaky old code base which is barely fit for purpose and you have to make the decision to either re-write it from scratch or repair what already exists. Conventional wisdom tends to suggest that you should never attempt a re-wri...
TITLE: Rewrite or repair? QUESTION: I'm sure you have all been there, you take on a project where there is a creaky old code base which is barely fit for purpose and you have to make the decision to either re-write it from scratch or repair what already exists. Conventional wisdom tends to suggest that you should neve...
[ "refactoring", "url-rewriting" ]
13
11
1,646
11
0
2008-08-29T20:27:11.160000
2008-08-29T20:39:23.800000