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
27,983
30,503
SQL Group By with an Order By
I have a table of tags and want to get the highest count tags from the list. Sample data looks like this id (1) tag ('night') id (2) tag ('awesome') id (3) tag ('night') using SELECT COUNT(*), `Tag` from `images-tags` GROUP BY `Tag` gets me back the data I'm looking for perfectly. However, I would like to organize it, ...
In all versions of MySQL, simply alias the aggregate in the SELECT list, and order by the alias: SELECT COUNT(id) AS theCount, `Tag` from `images-tags` GROUP BY `Tag` ORDER BY theCount DESC LIMIT 20
SQL Group By with an Order By I have a table of tags and want to get the highest count tags from the list. Sample data looks like this id (1) tag ('night') id (2) tag ('awesome') id (3) tag ('night') using SELECT COUNT(*), `Tag` from `images-tags` GROUP BY `Tag` gets me back the data I'm looking for perfectly. However,...
TITLE: SQL Group By with an Order By QUESTION: I have a table of tags and want to get the highest count tags from the list. Sample data looks like this id (1) tag ('night') id (2) tag ('awesome') id (3) tag ('night') using SELECT COUNT(*), `Tag` from `images-tags` GROUP BY `Tag` gets me back the data I'm looking for p...
[ "mysql", "sql", "mysql-error-1111" ]
164
243
713,427
5
0
2008-08-26T13:09:15.883000
2008-08-27T15:46:41.113000
27,998
28,289
Exporting a C++ class from a DLL
Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever, so usually when I need to make a DLL with accessible functions I just export them using the standard __declspec(dllexport) directive. Then access them either dynamically via LoadLibrary() or at compile time with a header...
What about late-binding? As in loading it with LoadLibrary() and GetProcAddress()? I'm used being able to load the library at run time and it would be great if you could do that here. So there are two ways to load the DLL. The first is to reference one or more symbols from the DLL (your classname, for example), supply ...
Exporting a C++ class from a DLL Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever, so usually when I need to make a DLL with accessible functions I just export them using the standard __declspec(dllexport) directive. Then access them either dynamically via LoadLibrary()...
TITLE: Exporting a C++ class from a DLL QUESTION: Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever, so usually when I need to make a DLL with accessible functions I just export them using the standard __declspec(dllexport) directive. Then access them either dynamically...
[ "c++", "windows", "dll" ]
29
17
43,818
6
0
2008-08-26T13:18:30.480000
2008-08-26T15:07:29.330000
28,002
1,255,015
Regular cast vs. static_cast vs. dynamic_cast
I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e. MyClass *m = (MyClass *)ptr; all over the place, but there seem to be two other types of casts, and I don't know the difference. What's the differ...
static_cast static_cast is used for cases where you basically want to reverse an implicit conversion, with a few restrictions and additions. static_cast performs no runtime checks. This should be used if you know that you refer to an object of a specific type, and thus a check would be unnecessary. Example: void func(v...
Regular cast vs. static_cast vs. dynamic_cast I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e. MyClass *m = (MyClass *)ptr; all over the place, but there seem to be two other types of casts, and ...
TITLE: Regular cast vs. static_cast vs. dynamic_cast QUESTION: I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e. MyClass *m = (MyClass *)ptr; all over the place, but there seem to be two other ty...
[ "c++", "pointers", "casting" ]
2,043
1,849
909,200
8
0
2008-08-26T13:20:55.357000
2009-08-10T13:50:45.557000
28,003
28,008
Use table metadata for select statement in SQL Server?
I have a large database and would like to select table names that have a certain column name. I have done something like this in MySQL, but can't find any info on SQL Server. I want to do something like: select [table] from [db] where table [has column 'classtypeid'] How can I do something like this?
Use the ANSI information_schema views, this will also work in MySQL select table_name from information_schema.columns where column_name = 'classtypeid'
Use table metadata for select statement in SQL Server? I have a large database and would like to select table names that have a certain column name. I have done something like this in MySQL, but can't find any info on SQL Server. I want to do something like: select [table] from [db] where table [has column 'classtypeid...
TITLE: Use table metadata for select statement in SQL Server? QUESTION: I have a large database and would like to select table names that have a certain column name. I have done something like this in MySQL, but can't find any info on SQL Server. I want to do something like: select [table] from [db] where table [has c...
[ "sql", "sql-server" ]
3
5
2,952
2
0
2008-08-26T13:20:57.087000
2008-08-26T13:23:08.580000
28,011
28,148
Ruby / Rails pre-epoch dates on windows
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch dates (before 1970) throwing out of range exceptions. I tried using both Time and DateTime objects, but still have the same problems.
If you only need dates (no times), the Date class in ruby should handle dates before 1970. But it has only a resolution of days. I don't know if there are solutions, if you also need times before 1970 (source)
Ruby / Rails pre-epoch dates on windows Working with dates in ruby and rails on windows, I'm having problems with pre-epoch dates (before 1970) throwing out of range exceptions. I tried using both Time and DateTime objects, but still have the same problems.
TITLE: Ruby / Rails pre-epoch dates on windows QUESTION: Working with dates in ruby and rails on windows, I'm having problems with pre-epoch dates (before 1970) throwing out of range exceptions. I tried using both Time and DateTime objects, but still have the same problems. ANSWER: If you only need dates (no times), ...
[ "ruby-on-rails", "ruby", "date" ]
2
1
717
3
0
2008-08-26T13:23:50.543000
2008-08-26T14:14:26.943000
28,051
28,055
Best way to share ASP.NET .ascx controls across different website applications?
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX controls that you want to share across these 2 applications. What's the best way to create a "user control library", so that you can use the same control implementation in the 2 applications, withuot having to duplicate code? Controls ha...
You would need to create composite controls instead of.ASCX controls if you wanted to be able to use them in separate projects.
Best way to share ASP.NET .ascx controls across different website applications? Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX controls that you want to share across these 2 applications. What's the best way to create a "user control library", so that you can use the same control imp...
TITLE: Best way to share ASP.NET .ascx controls across different website applications? QUESTION: Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX controls that you want to share across these 2 applications. What's the best way to create a "user control library", so that you can use th...
[ "asp.net" ]
15
6
12,493
10
0
2008-08-26T13:38:04.160000
2008-08-26T13:39:47.870000
28,092
28,252
WPF Listbox style with a button
I have a ListBox that has a style defined for ListBoxItems. Inside this style, I have some labels and a button. One that button, I want to define a click event that can be handled on my page (or any page that uses that style). How do I create an event handler on my WPF page to handle the event from my ListBoxItems styl...
Take a look at RoutedCommand s. Define your command in myclass somewhere as follows: public static readonly RoutedCommand Login = new RoutedCommand(); Now define your button with this command: You can use CommandParameter for extra information.. Now last but not least, start listening to your command: In the constructo...
WPF Listbox style with a button I have a ListBox that has a style defined for ListBoxItems. Inside this style, I have some labels and a button. One that button, I want to define a click event that can be handled on my page (or any page that uses that style). How do I create an event handler on my WPF page to handle the...
TITLE: WPF Listbox style with a button QUESTION: I have a ListBox that has a style defined for ListBoxItems. Inside this style, I have some labels and a button. One that button, I want to define a click event that can be handled on my page (or any page that uses that style). How do I create an event handler on my WPF ...
[ "c#", "wpf" ]
7
10
8,329
3
0
2008-08-26T13:54:45.167000
2008-08-26T14:51:05.203000
28,098
28,111
PHP equivalent of .NET/Java's toString()
How do I convert the value of a PHP variable to string? I was looking for something better than concatenating with an empty string: $myText = $myVar. ''; Like the ToString() method in Java or.NET.
You can use the casting operators: $myText = (string)$myVar; There are more details for string casting and conversion in the Strings section of the PHP manual, including special handling for booleans and nulls.
PHP equivalent of .NET/Java's toString() How do I convert the value of a PHP variable to string? I was looking for something better than concatenating with an empty string: $myText = $myVar. ''; Like the ToString() method in Java or.NET.
TITLE: PHP equivalent of .NET/Java's toString() QUESTION: How do I convert the value of a PHP variable to string? I was looking for something better than concatenating with an empty string: $myText = $myVar. ''; Like the ToString() method in Java or.NET. ANSWER: You can use the casting operators: $myText = (string)$m...
[ "php", "string" ]
567
789
1,517,211
26
0
2008-08-26T13:56:49.873000
2008-08-26T14:01:50.047000
28,110
28,184
SQL Server DateTime conversion failure
I have a large table with 1 million+ records. Unfortunately, the person who created the table decided to put dates in a varchar(50) field. I need to do a simple date comparison - datediff(dd, convert(datetime, lastUpdate, 100), getDate()) < 31 But it fails on the convert(): Conversion failed when converting datetime fr...
Place the CASE and ISDATE inside the CONVERT() function. SELECT COUNT(*) FROM MyTable WHERE DATEDIFF(dd, CONVERT(DATETIME, CASE IsDate(lastUpdate) WHEN 1 THEN lastUpdate ELSE '12-30-1899' END), GetDate()) < 31 Replace '12-30-1899' with the default date of your choice.
SQL Server DateTime conversion failure I have a large table with 1 million+ records. Unfortunately, the person who created the table decided to put dates in a varchar(50) field. I need to do a simple date comparison - datediff(dd, convert(datetime, lastUpdate, 100), getDate()) < 31 But it fails on the convert(): Conver...
TITLE: SQL Server DateTime conversion failure QUESTION: I have a large table with 1 million+ records. Unfortunately, the person who created the table decided to put dates in a varchar(50) field. I need to do a simple date comparison - datediff(dd, convert(datetime, lastUpdate, 100), getDate()) < 31 But it fails on the...
[ "sql-server", "datetime" ]
3
9
14,003
10
0
2008-08-26T14:01:43.090000
2008-08-26T14:27:08.053000
28,124
28,130
calculating user defined formulas (with c++)
We would like to have user defined formulas in our c++ program. e.g. The value v = x + ( y - (z - 2)) / 2. Later in the program the user would define x,y and z -> the program should return the result of the calculation. Somewhen later the formula may get changed, so the next time the program should parse the formula an...
If it will be used frequently and if it will be extended in the future, I would almost recommend adding either Python or Lua into your code. Lua is a very lightweight scripting language which you can hook into and provide new functions, operators etc. If you want to do more robust and complicated things, use Python ins...
calculating user defined formulas (with c++) We would like to have user defined formulas in our c++ program. e.g. The value v = x + ( y - (z - 2)) / 2. Later in the program the user would define x,y and z -> the program should return the result of the calculation. Somewhen later the formula may get changed, so the next...
TITLE: calculating user defined formulas (with c++) QUESTION: We would like to have user defined formulas in our c++ program. e.g. The value v = x + ( y - (z - 2)) / 2. Later in the program the user would define x,y and z -> the program should return the result of the calculation. Somewhen later the formula may get ch...
[ "c++" ]
11
2
3,688
8
0
2008-08-26T14:07:18.897000
2008-08-26T14:10:53.130000
28,147
28,170
Feasibility of GPU as a CPU?
What do you think the future of GPU as a CPU initiatives like CUDA are? Do you think they are going to become mainstream and be the next adopted fad in the industry? Apple is building a new framework for using the GPU to do CPU tasks and there has been alot of success in the Nvidias CUDA project in the sciences. Would ...
First of all I don't think this questions really belongs on SO. In my opinion the GPU is a very interesting alternative whenever you do vector-based float mathematics. However this translates to: It will not become mainstream. Most mainstream (Desktop) applications do very few floating-point calculations. It has alread...
Feasibility of GPU as a CPU? What do you think the future of GPU as a CPU initiatives like CUDA are? Do you think they are going to become mainstream and be the next adopted fad in the industry? Apple is building a new framework for using the GPU to do CPU tasks and there has been alot of success in the Nvidias CUDA pr...
TITLE: Feasibility of GPU as a CPU? QUESTION: What do you think the future of GPU as a CPU initiatives like CUDA are? Do you think they are going to become mainstream and be the next adopted fad in the industry? Apple is building a new framework for using the GPU to do CPU tasks and there has been alot of success in t...
[ "cuda", "cpu", "gpu", "gpgpu" ]
13
5
2,696
8
0
2008-08-26T14:14:10.893000
2008-08-26T14:22:02.963000
28,150
28,220
Create an Attribute to Break the Build
OK, this kind of follows on from my previous question. What I would really like to do is create some sort of attribute which allows me to decorate a method that will break the build. Much like the Obsolete("reason", true) attribute, but without falsely identifying obsolete code. To clarify: I dont want it to break the ...
If this is for XML serialization and NHibernate, where you want the parameterless constructor to be accessible (as is the case in the example you referenced), then use a private or protected parameterless constructor for serialization, or a protected constructor for NHibernate. With the protected version, you are openi...
Create an Attribute to Break the Build OK, this kind of follows on from my previous question. What I would really like to do is create some sort of attribute which allows me to decorate a method that will break the build. Much like the Obsolete("reason", true) attribute, but without falsely identifying obsolete code. T...
TITLE: Create an Attribute to Break the Build QUESTION: OK, this kind of follows on from my previous question. What I would really like to do is create some sort of attribute which allows me to decorate a method that will break the build. Much like the Obsolete("reason", true) attribute, but without falsely identifyin...
[ ".net", "attributes" ]
9
4
3,921
11
0
2008-08-26T14:15:08.393000
2008-08-26T14:36:30.933000
28,160
28,215
Multiple classes in a header file vs. a single header file per class
For whatever reason, our company has a coding guideline that states: Each class shall have it's own header and implementation file. So if we wrote a class called MyString we would need an associated MyStringh.h and MyString.cxx. Does anyone else do this? Has anyone seen any compiling performance repercussions as a resu...
The term here is translation unit and you really want to (if possible) have one class per translation unit ie, one class implementation per.cpp file, with a corresponding.h file of the same name. It's usually more efficient (from a compile/link) standpoint to do things this way, especially if you're doing things like i...
Multiple classes in a header file vs. a single header file per class For whatever reason, our company has a coding guideline that states: Each class shall have it's own header and implementation file. So if we wrote a class called MyString we would need an associated MyStringh.h and MyString.cxx. Does anyone else do th...
TITLE: Multiple classes in a header file vs. a single header file per class QUESTION: For whatever reason, our company has a coding guideline that states: Each class shall have it's own header and implementation file. So if we wrote a class called MyString we would need an associated MyStringh.h and MyString.cxx. Does...
[ "c++", "performance", "file-organization" ]
91
95
102,242
13
0
2008-08-26T14:19:34.967000
2008-08-26T14:34:39.797000
28,165
28,247
Does PHP have an equivalent to this type of Python string substitution?
Python has this wonderful way of handling string substitutions using dictionaries: >>> 'The %(site)s site %(adj)s because it %(adj)s' % {'site':'Stackoverflow', 'adj':'rocks'} 'The Stackoverflow site rocks because it rocks' I love this because you can specify a value once in the dictionary and then replace it all over ...
function subst($str, $dict){ return preg_replace(array_map(create_function('$a', 'return "/%\\($a\\)s/";'), array_keys($dict)), array_values($dict), $str); } You call it like so: echo subst('The %(site)s site %(adj)s because it %(adj)s', array('site'=>'Stackoverflow', 'adj'=>'rocks'));
Does PHP have an equivalent to this type of Python string substitution? Python has this wonderful way of handling string substitutions using dictionaries: >>> 'The %(site)s site %(adj)s because it %(adj)s' % {'site':'Stackoverflow', 'adj':'rocks'} 'The Stackoverflow site rocks because it rocks' I love this because you ...
TITLE: Does PHP have an equivalent to this type of Python string substitution? QUESTION: Python has this wonderful way of handling string substitutions using dictionaries: >>> 'The %(site)s site %(adj)s because it %(adj)s' % {'site':'Stackoverflow', 'adj':'rocks'} 'The Stackoverflow site rocks because it rocks' I love...
[ "php", "python", "string" ]
13
5
2,814
3
0
2008-08-26T14:20:48.910000
2008-08-26T14:49:54.707000
28,171
28,193
Why does Visual Studio create a new .vsmdi file?
If I open a solution in Visual Studio 2008 and run a unit test then VS creates a new.vsmdi file in the Solution Items folder and gives it the next number available e.g. My Solution2.vsmdi. Any idea why VS is doing this and how I can get it to stop doing this?
It appears that the VSMDI problem is a known bug and has been around since VS2005 Team System but it has no clear fix as yet. Another reason to NOT use MS Test. An MSDN blog details how to run unit tests without VSMDI files.
Why does Visual Studio create a new .vsmdi file? If I open a solution in Visual Studio 2008 and run a unit test then VS creates a new.vsmdi file in the Solution Items folder and gives it the next number available e.g. My Solution2.vsmdi. Any idea why VS is doing this and how I can get it to stop doing this?
TITLE: Why does Visual Studio create a new .vsmdi file? QUESTION: If I open a solution in Visual Studio 2008 and run a unit test then VS creates a new.vsmdi file in the Solution Items folder and gives it the next number available e.g. My Solution2.vsmdi. Any idea why VS is doing this and how I can get it to stop doing...
[ "visual-studio-2010", "visual-studio", "visual-studio-2008", "mstest" ]
63
30
32,134
4
0
2008-08-26T14:22:42.713000
2008-08-26T14:28:15.537000
28,196
30,733
How to select posts with specific tags/categories in WordPress
This is a very specific question regarding MySQL as implemented in WordPress. I'm trying to develop a plugin that will show (select) posts that have specific ' tags ' and belong to specific ' categories ' (both multiple) I was told it's impossible because of the way categories and tags are stored: wp_posts contains a l...
I misunderstood you. I thought you wanted Nuclear or Deals. The below should give you only Nuclear and Deals. select p.* from wp_posts p, wp_terms t, wp_term_taxonomy tt, wp_term_relationship tr, wp_terms t2, wp_term_taxonomy tt2, wp_term_relationship tr2 wp_terms t2, wp_term_taxonomy tt2, wp_term_relationship tr2 whe...
How to select posts with specific tags/categories in WordPress This is a very specific question regarding MySQL as implemented in WordPress. I'm trying to develop a plugin that will show (select) posts that have specific ' tags ' and belong to specific ' categories ' (both multiple) I was told it's impossible because o...
TITLE: How to select posts with specific tags/categories in WordPress QUESTION: This is a very specific question regarding MySQL as implemented in WordPress. I'm trying to develop a plugin that will show (select) posts that have specific ' tags ' and belong to specific ' categories ' (both multiple) I was told it's im...
[ "php", "mysql", "sql", "wordpress", "plugins" ]
10
5
7,949
6
0
2008-08-26T14:29:38.093000
2008-08-27T17:57:29.053000
28,197
106,682
Do you follow the Personal Software Process? Does your organization/team follow the Team Software Process?
For more information - Personal Software Process on Wikipedia and Team Software Process on Wikipedia. I have two questions: What benefits have you seen from these processes? What tools and/or methods do you use to follow these processes?
I went through the training and then my company paid for me to go to Carnegie Mellon and go through the PSP instructor training course to get certified as an instructor. I think the goal was to use this as part of our company's CMM/CMMI effort. I met Watts Humphrey and found him to be a kind, gentle soul with some deep...
Do you follow the Personal Software Process? Does your organization/team follow the Team Software Process? For more information - Personal Software Process on Wikipedia and Team Software Process on Wikipedia. I have two questions: What benefits have you seen from these processes? What tools and/or methods do you use to...
TITLE: Do you follow the Personal Software Process? Does your organization/team follow the Team Software Process? QUESTION: For more information - Personal Software Process on Wikipedia and Team Software Process on Wikipedia. I have two questions: What benefits have you seen from these processes? What tools and/or met...
[ "process", "personal-software-process" ]
15
14
4,322
10
0
2008-08-26T14:29:56.143000
2008-09-20T01:15:38.300000
28,202
28,448
Best Apache Ant Template
Every time I create a new project I copy the last project's ant file to the new one and make the appropriate changes (trying at the same time to make it more flexible for the next project). But since I didn't really thought about it at the beginning, the file started to look really ugly. Do you have an Ant template tha...
An alternative to making a template is to evolve one by gradually generalising your current project's Ant script so that there are fewer changes to make the next time you copy it for use on a new project. There are several things you can do. Use ${ant.project.name} in file names, so you only have to mention your applic...
Best Apache Ant Template Every time I create a new project I copy the last project's ant file to the new one and make the appropriate changes (trying at the same time to make it more flexible for the next project). But since I didn't really thought about it at the beginning, the file started to look really ugly. Do you...
TITLE: Best Apache Ant Template QUESTION: Every time I create a new project I copy the last project's ant file to the new one and make the appropriate changes (trying at the same time to make it more flexible for the next project). But since I didn't really thought about it at the beginning, the file started to look r...
[ "java", "ant" ]
7
9
7,078
7
0
2008-08-26T14:31:28.777000
2008-08-26T15:48:52.647000
28,212
28,244
How can I convert types in C++?
I'm using two different libraries in my project, and both of them supply a basic rectangle struct. The problem with this is that there seems to be no way to insert a conversion between the types, so I can't call a function in one library with the result from a function in the other. If I was the author of either of the...
If you can't modify the structures then you have no alternative to writing a manual conversion function because overloading conversion operators only works within the class body. There's no other way.
How can I convert types in C++? I'm using two different libraries in my project, and both of them supply a basic rectangle struct. The problem with this is that there seems to be no way to insert a conversion between the types, so I can't call a function in one library with the result from a function in the other. If I...
TITLE: How can I convert types in C++? QUESTION: I'm using two different libraries in my project, and both of them supply a basic rectangle struct. The problem with this is that there seems to be no way to insert a conversion between the types, so I can't call a function in one library with the result from a function ...
[ "c++", "oop", "types" ]
0
2
1,342
7
0
2008-08-26T14:33:17.663000
2008-08-26T14:48:00.420000
28,219
28,225
In ASP.NET, what are the different ways to inline code in the .aspx?
Can I get a 'when to use' for these and others? <% %> <%# EVAL() %> Thanks
Check out the Web Forms Syntax Reference on MSDN. For basics, <% %> is used for pure code blocks. I generally only use this for if statements is used to add text into your markup; that is, it equates to <%# Expression %> is very similar to the above, but it is evaluated in a DataBinding scenario. One thing that this me...
In ASP.NET, what are the different ways to inline code in the .aspx? Can I get a 'when to use' for these and others? <% %> <%# EVAL() %> Thanks
TITLE: In ASP.NET, what are the different ways to inline code in the .aspx? QUESTION: Can I get a 'when to use' for these and others? <% %> <%# EVAL() %> Thanks ANSWER: Check out the Web Forms Syntax Reference on MSDN. For basics, <% %> is used for pure code blocks. I generally only use this for if statements is used...
[ ".net", "asp.net", "syntax" ]
4
15
1,093
4
0
2008-08-26T14:35:45.753000
2008-08-26T14:38:11.363000
28,224
113,250
Bash reg-exp substitution
Is there a way to run a regexp-string replace on the current line in the bash? I find myself rather often in the situation, where I have typed a long commandline and then realize, that I would like to change a word somewhere in the line. My current approach is to finish the line, press Ctrl + A (to get to the start of ...
Unfortunately, no, there's not really a better way. If you're just tired of making the keystrokes, you can use macros to trim them down. Add the following to your ~/.inputrc: "\C-x6": "\C-a#\C-m^" "\C-x7": "\C-m\C-P\C-a\C-d\C-m" Now, in a new bash instance (or after reloading.inputrc in your current shell by pressing C...
Bash reg-exp substitution Is there a way to run a regexp-string replace on the current line in the bash? I find myself rather often in the situation, where I have typed a long commandline and then realize, that I would like to change a word somewhere in the line. My current approach is to finish the line, press Ctrl + ...
TITLE: Bash reg-exp substitution QUESTION: Is there a way to run a regexp-string replace on the current line in the bash? I find myself rather often in the situation, where I have typed a long commandline and then realize, that I would like to change a word somewhere in the line. My current approach is to finish the l...
[ "regex", "bash" ]
4
1
2,051
3
0
2008-08-26T14:37:31.773000
2008-09-22T05:02:38.877000
28,235
28,472
Should I be doing JSPX instead of JSP?
Using JDeveloper, I started developing a set of web pages for a project at work. Since I didn't know much about JDev at the time, I ran over to Oracle to follow some tutorials. The JDev tutorials recommended doing JSPX instead of JSP, but didn't really explain why. Are you developing JSPX pages? Why did you decide to d...
The main difference is that a JSPX file (officially called a 'JSP document') may be easier to work with because the requirement for well-formed XML may allow your editor to identify more typos and syntax errors as you type. However, there are also disadvantages. For example, well-formed XML must escape things like less...
Should I be doing JSPX instead of JSP? Using JDeveloper, I started developing a set of web pages for a project at work. Since I didn't know much about JDev at the time, I ran over to Oracle to follow some tutorials. The JDev tutorials recommended doing JSPX instead of JSP, but didn't really explain why. Are you develop...
TITLE: Should I be doing JSPX instead of JSP? QUESTION: Using JDeveloper, I started developing a set of web pages for a project at work. Since I didn't know much about JDev at the time, I ran over to Oracle to follow some tutorials. The JDev tutorials recommended doing JSPX instead of JSP, but didn't really explain wh...
[ "jsp", "jspx" ]
52
55
65,953
8
0
2008-08-26T14:41:55.757000
2008-08-26T15:59:40.030000
28,241
28,255
Java Singleton vs static - is there a real performance benefit?
I am merging a CVS branch and one of the larger changes is the replacement wherever it occurs of a Singleton pattern with abstract classes that have a static initialisation block and all static methods. Is this something that's worth keeping since it will require merging a lot of conflicts, what sort of situation would...
From a strict runtime performance point of view, the difference is really negligible. The main difference between the two lies down in the fact that the "static" lifecycle is linked to the classloader, whereas for the singleton it's a regular instance lifecycle. Usually it's better to stay away from the ClassLoader bus...
Java Singleton vs static - is there a real performance benefit? I am merging a CVS branch and one of the larger changes is the replacement wherever it occurs of a Singleton pattern with abstract classes that have a static initialisation block and all static methods. Is this something that's worth keeping since it will ...
TITLE: Java Singleton vs static - is there a real performance benefit? QUESTION: I am merging a CVS branch and one of the larger changes is the replacement wherever it occurs of a Singleton pattern with abstract classes that have a static initialisation block and all static methods. Is this something that's worth keep...
[ "java", "design-patterns", "singleton" ]
15
16
26,824
7
0
2008-08-26T14:45:48.617000
2008-08-26T14:52:01.783000
28,243
109,708
cannot install ruby gems - zlib error
I'm trying to install some Ruby Gems so I can use Ruby to notify me when I get twitter messages. However, after doing a gem update --system, I now get a zlib error every time I try and do a gem install of anything. below is the console output I get when trying to install ruby gems. (along with the output from gem envir...
I just started getting this tonight as well. Googling turned up a bunch of suggestions that didn't deliver results gem update --system and some paste in code from jamis that is supposed to replace a function in package.rb but the original it is supposed to replace is nowhere to be found. Reinstalling rubygems didn't he...
cannot install ruby gems - zlib error I'm trying to install some Ruby Gems so I can use Ruby to notify me when I get twitter messages. However, after doing a gem update --system, I now get a zlib error every time I try and do a gem install of anything. below is the console output I get when trying to install ruby gems....
TITLE: cannot install ruby gems - zlib error QUESTION: I'm trying to install some Ruby Gems so I can use Ruby to notify me when I get twitter messages. However, after doing a gem update --system, I now get a zlib error every time I try and do a gem install of anything. below is the console output I get when trying to ...
[ "ruby", "rubygems" ]
9
3
30,010
9
0
2008-08-26T14:47:52.357000
2008-09-20T23:03:25.863000
28,256
29,124
Equation (expression) parser with precedence?
I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis. Using this method, however, leaves me with everything having the same precedence - it's evaluated left to right regardless of operator, although precedence ca...
The hard way You want a recursive descent parser. To get precedence you need to think recursively, for example, using your sample string, 1+11*5 to do this manually, you would have to read the 1, then see the plus and start a whole new recursive parse "session" starting with 11... and make sure to parse the 11 * 5 into...
Equation (expression) parser with precedence? I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis. Using this method, however, leaves me with everything having the same precedence - it's evaluated left to right ...
TITLE: Equation (expression) parser with precedence? QUESTION: I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis. Using this method, however, leaves me with everything having the same precedence - it's evalua...
[ "algorithm", "parsing", "equation" ]
122
71
102,013
16
0
2008-08-26T14:52:05.060000
2008-08-26T22:39:39.693000
28,268
28,277
Any pitfalls developing C#/.NET code in a VM running on a Mac?
I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET code in a virtual machine running on a Mac? Also, is it better to run Vista or XP Pro for this purpose?
I can't tell you any specific experiences since I don't have a Mac, but I did want to point out that there was an awesome episode of the DeepFriedBytes podcast that discussed this very topic. It made me want to give it a try. They discuss the pros and cons of going this route - well worth the listen IMO if this is some...
Any pitfalls developing C#/.NET code in a VM running on a Mac? I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET code in a virtual machine running on a Mac? Also, is it better to run Vista or XP Pro for this purpose?
TITLE: Any pitfalls developing C#/.NET code in a VM running on a Mac? QUESTION: I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET code in a virtual machine running on a Mac? Also, is it better to run Vista or XP Pro for this purpose? ANSWER: I can't tell you any specific experien...
[ ".net", "macos", "vmware" ]
5
13
2,215
16
0
2008-08-26T14:57:47.090000
2008-08-26T15:00:54.947000
28,280
29,660
Can I maintain state between calls to a SQL Server UDF?
I have a SQL script that inserts data (via INSERT statements currently numbering in the thousands) One of the columns contains a unique identifier (though not an IDENTITY type, just a plain ol' int) that's actually unique across a few different tables. I'd like to add a scalar function to my script that gets the next a...
I'm starting to think it can't be done that way since there doesn't seem to be a way to maintain the offset counter between calls. Is that right, or is there something I'm missing. You aren't missing anything; SQL Server does not support global variables, and it doesn't support data modification within UDFs. And even i...
Can I maintain state between calls to a SQL Server UDF? I have a SQL script that inserts data (via INSERT statements currently numbering in the thousands) One of the columns contains a unique identifier (though not an IDENTITY type, just a plain ol' int) that's actually unique across a few different tables. I'd like to...
TITLE: Can I maintain state between calls to a SQL Server UDF? QUESTION: I have a SQL script that inserts data (via INSERT statements currently numbering in the thousands) One of the columns contains a unique identifier (though not an IDENTITY type, just a plain ol' int) that's actually unique across a few different t...
[ "sql", "sql-server", "sql-server-2005" ]
1
2
452
3
0
2008-08-26T15:01:50.620000
2008-08-27T07:14:44.853000
28,293
28,562
Generating an object model in Ruby from an XML DTD
I have an XML document with a DTD, and would love to be able to access the XML model, something like this: title = Thing.Items[0].Title Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML? Thanks!
You can use the ruby version of xml-simple. You shouldn't need to install the gem as I believe it's already installed with rails. http://xml-simple.rubyforge.org/
Generating an object model in Ruby from an XML DTD I have an XML document with a DTD, and would love to be able to access the XML model, something like this: title = Thing.Items[0].Title Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML? Thanks!
TITLE: Generating an object model in Ruby from an XML DTD QUESTION: I have an XML document with a DTD, and would love to be able to access the XML model, something like this: title = Thing.Items[0].Title Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML? Thanks! ...
[ "xml", "ruby", "dtd" ]
0
0
1,464
3
0
2008-08-26T15:08:39.420000
2008-08-26T16:42:06.027000
28,301
28,494
Impose a total ordering on all instances of *any* class in Java
I'm unsure whether the following code would ensure all conditions given in Comparator's Javadoc. class TotalOrder implements Comparator { public boolean compare(T o1, T o2) { if (o1 == o2 || equal(o1, o2)) return 0; int h1 = System.identityHashCode(o1); int h2 = System.identityHashCode(o2); if (h1!= h2) { return h1 ...
Hey, look at what I found! http://gafter.blogspot.com/2007/03/compact-object-comparator.html Oh yes, I forgot about the IdentityHashMap (Java 6 and above only). Just have to pay attention at releasing your comparator.
Impose a total ordering on all instances of *any* class in Java I'm unsure whether the following code would ensure all conditions given in Comparator's Javadoc. class TotalOrder implements Comparator { public boolean compare(T o1, T o2) { if (o1 == o2 || equal(o1, o2)) return 0; int h1 = System.identityHashCode(o1); ...
TITLE: Impose a total ordering on all instances of *any* class in Java QUESTION: I'm unsure whether the following code would ensure all conditions given in Comparator's Javadoc. class TotalOrder implements Comparator { public boolean compare(T o1, T o2) { if (o1 == o2 || equal(o1, o2)) return 0; int h1 = System.iden...
[ "java", "algorithm" ]
3
2
948
7
0
2008-08-26T15:11:27.383000
2008-08-26T16:08:54.250000
28,302
29,860
Free Network Monitor
I am having trouble integrating two products, one of which is mine and they appear not to be talking. So I want to make sure they are communicating correctly. I had a look around for network monitor and found TCP Spy. This works but only shows 1 side of the conversation at a time (it has to run locally) I would ideally...
I tried Wireshark and Microsoft Network Monitor, but neither detected my (and the program I am trying to communicate with) transfer. If I had a day to sit and configure it I probably could get it working but I just wanted the bytes sent and, more specifically, bytes received. In the end I found HHD Software's Accurate ...
Free Network Monitor I am having trouble integrating two products, one of which is mine and they appear not to be talking. So I want to make sure they are communicating correctly. I had a look around for network monitor and found TCP Spy. This works but only shows 1 side of the conversation at a time (it has to run loc...
TITLE: Free Network Monitor QUESTION: I am having trouble integrating two products, one of which is mine and they appear not to be talking. So I want to make sure they are communicating correctly. I had a look around for network monitor and found TCP Spy. This works but only shows 1 side of the conversation at a time ...
[ "windows", "sockets", "network-monitoring" ]
9
0
1,706
10
0
2008-08-26T15:12:18.833000
2008-08-27T10:28:24.797000
28,303
28,328
Web 2.0 Color Combinations
What are the most user-friendly color combinations for Web 2.0 websites, such as background, button colors, etc.?
ColorSchemer will suggest good schemes for you. If you want to try something out on your own, try Color Combinations.
Web 2.0 Color Combinations What are the most user-friendly color combinations for Web 2.0 websites, such as background, button colors, etc.?
TITLE: Web 2.0 Color Combinations QUESTION: What are the most user-friendly color combinations for Web 2.0 websites, such as background, button colors, etc.? ANSWER: ColorSchemer will suggest good schemes for you. If you want to try something out on your own, try Color Combinations.
[ "colors", "color-scheme" ]
15
11
16,392
10
0
2008-08-26T15:13:03.043000
2008-08-26T15:16:53.067000
28,353
37,116
How can I get notification when a mirrored SQL Server database has failed over
We have a couple of mirrored SQL Server databases. My first problem - the key problem - is to get a notification when the db fails over. I don't need to know because, erm, its mirrored and so it (almost) all carries on working automagically but it would useful to be advised and I'm currently getting failovers when I do...
Right, The two answers and a little thought got me to something approaching an answer. First a little more clarification: The app is written in C# (2.0+) and uses ADO.NET to talk to SQL Server 2005. The mirror setup is two W2k3 servers hosting the Principal and the Mirror plus a third server hosting an express instance...
How can I get notification when a mirrored SQL Server database has failed over We have a couple of mirrored SQL Server databases. My first problem - the key problem - is to get a notification when the db fails over. I don't need to know because, erm, its mirrored and so it (almost) all carries on working automagically ...
TITLE: How can I get notification when a mirrored SQL Server database has failed over QUESTION: We have a couple of mirrored SQL Server databases. My first problem - the key problem - is to get a notification when the db fails over. I don't need to know because, erm, its mirrored and so it (almost) all carries on work...
[ "sql-server" ]
2
2
5,048
3
0
2008-08-26T15:22:38.373000
2008-08-31T21:18:40.210000
28,363
101,026
Database compare tools
My company has a number of relatively small Access databases (2-5MB) that control our user assisted design tools. Naturally these databases evolve over time as data bugs are found and fixed and as the schema changes to support new features in the tools. Can anyone recommend a database diff tool to compare both the data...
I use Red Gate Sql Compare for comparing schemas. It also has an interesting feature that allows you to save a snapshot of the schema which you can then use in later diffs. for example compare the schema of today with the schema of a month ago.
Database compare tools My company has a number of relatively small Access databases (2-5MB) that control our user assisted design tools. Naturally these databases evolve over time as data bugs are found and fixed and as the schema changes to support new features in the tools. Can anyone recommend a database diff tool t...
TITLE: Database compare tools QUESTION: My company has a number of relatively small Access databases (2-5MB) that control our user assisted design tools. Naturally these databases evolve over time as data bugs are found and fixed and as the schema changes to support new features in the tools. Can anyone recommend a da...
[ "database", "diff" ]
3
5
3,579
7
0
2008-08-26T15:25:16.713000
2008-09-19T10:43:47.077000
28,369
32,028
Is "safe_eval" really safe?
I'm looking for a "safe" eval function, to implement spreadsheet-like calculations (using numpy/scipy). The functionality to do this (the rexec module ) has been removed from Python since 2.3 due to apparently unfixable security problems. There are several third-party hacks out there that purport to do this - the most ...
Depends on your definition of safe I suppose. A lot of the security depends on what you pass in and what you are allowed to pass in the context. For instance, if a file is passed in, I can open arbitrary files: >>> names['f'] = open('foo', 'w+') >>> safe_eval.safe_eval("baz = type(f)('baz', 'w+')", names) >>> names['ba...
Is "safe_eval" really safe? I'm looking for a "safe" eval function, to implement spreadsheet-like calculations (using numpy/scipy). The functionality to do this (the rexec module ) has been removed from Python since 2.3 due to apparently unfixable security problems. There are several third-party hacks out there that pu...
TITLE: Is "safe_eval" really safe? QUESTION: I'm looking for a "safe" eval function, to implement spreadsheet-like calculations (using numpy/scipy). The functionality to do this (the rexec module ) has been removed from Python since 2.3 due to apparently unfixable security problems. There are several third-party hacks...
[ "python", "security" ]
5
3
4,543
6
0
2008-08-26T15:27:03.587000
2008-08-28T11:35:19.353000
28,377
28,452
Performance difference between IIf() and If
In Visual Basic, is there a performance difference when using the IIf function instead of the If statement?
VB has the following If statement which the question refers to, I think: ' Usage 1 Dim result = If(a > 5, "World", "Hello") ' Usage 2 Dim foo = If(result, "Alternative") The first is basically C#'s ternary conditional operator and the second is its coalesce operator (return result unless it’s Nothing, in which case ret...
Performance difference between IIf() and If In Visual Basic, is there a performance difference when using the IIf function instead of the If statement?
TITLE: Performance difference between IIf() and If QUESTION: In Visual Basic, is there a performance difference when using the IIf function instead of the If statement? ANSWER: VB has the following If statement which the question refers to, I think: ' Usage 1 Dim result = If(a > 5, "World", "Hello") ' Usage 2 Dim foo...
[ "vb.net", "if-statement", "iif-function" ]
102
144
66,662
9
0
2008-08-26T15:29:45.907000
2008-08-26T15:51:53.013000
28,380
3,869,611
Proxy which requires authentication with Android Emulator
Has anybody managed to get the Android Emulator working behind a proxy that requires authentication? I've tried setting the -http-proxy argument to http://DOMAIN/USERNAME:PASSWORD@IP:PORT but am having no success. I've tried following the docs to no avail. I've also tried the -verbose-proxy setting but this no longer s...
I Managed to do it in the Adndroid 2.2 Emulator. Go to "Settings" -> "Wireless & Networks" -> "Mobile Networks" -> "Access Point Names" -> "Telkila" Over there set the proxy host name in the property "Proxy" and the Proxy port in the property "Port"
Proxy which requires authentication with Android Emulator Has anybody managed to get the Android Emulator working behind a proxy that requires authentication? I've tried setting the -http-proxy argument to http://DOMAIN/USERNAME:PASSWORD@IP:PORT but am having no success. I've tried following the docs to no avail. I've ...
TITLE: Proxy which requires authentication with Android Emulator QUESTION: Has anybody managed to get the Android Emulator working behind a proxy that requires authentication? I've tried setting the -http-proxy argument to http://DOMAIN/USERNAME:PASSWORD@IP:PORT but am having no success. I've tried following the docs ...
[ "android", "authentication", "proxy", "android-emulator" ]
56
46
77,058
16
0
2008-08-26T15:30:38.367000
2010-10-06T05:06:17.610000
28,387
28,444
SQL Server 2k5 memory consumption?
I have a development vm which is running sql server as well as some other apps for my stack, and I found that the other apps are performing awfully. After doing some digging, SQL Server was hogging the memory. After a quick web search I discovered that by default, it will consume as much memory as it can in order to ca...
Since this is a development environment, I agree with Greg, just use trial and error. It's not that crucial to get it perfectly right. But if you do a lot of work in the VM, why not give it at least half of the 2GB?
SQL Server 2k5 memory consumption? I have a development vm which is running sql server as well as some other apps for my stack, and I found that the other apps are performing awfully. After doing some digging, SQL Server was hogging the memory. After a quick web search I discovered that by default, it will consume as m...
TITLE: SQL Server 2k5 memory consumption? QUESTION: I have a development vm which is running sql server as well as some other apps for my stack, and I found that the other apps are performing awfully. After doing some digging, SQL Server was hogging the memory. After a quick web search I discovered that by default, it...
[ "sql-server", "performance" ]
3
1
703
4
0
2008-08-26T15:33:05.647000
2008-08-26T15:47:39.763000
28,395
28,411
Passing $_POST values with cURL
How do you pass $_POST values to a page using cURL?
Should work fine. $data = array('name' => 'Ross', 'php_master' => true); // You can POST a file by prefixing with an @ (for fields) $data['file'] = '@/home/user/world.jpg'; $handle = curl_init($url); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); curl_exec($handle); curl_cl...
Passing $_POST values with cURL How do you pass $_POST values to a page using cURL?
TITLE: Passing $_POST values with cURL QUESTION: How do you pass $_POST values to a page using cURL? ANSWER: Should work fine. $data = array('name' => 'Ross', 'php_master' => true); // You can POST a file by prefixing with an @ (for fields) $data['file'] = '@/home/user/world.jpg'; $handle = curl_init($url); curl_se...
[ "php", "post", "curl" ]
99
173
196,703
6
0
2008-08-26T15:35:07.857000
2008-08-26T15:38:34.557000
28,428
28,454
How do I get the path where the user installed my Java application?
I want to bring up a file dialog in Java that defaults to the application installation directory. What's the best way to get that information programmatically?
System.getProperty("user.dir") gets the directory the Java VM was started from.
How do I get the path where the user installed my Java application? I want to bring up a file dialog in Java that defaults to the application installation directory. What's the best way to get that information programmatically?
TITLE: How do I get the path where the user installed my Java application? QUESTION: I want to bring up a file dialog in Java that defaults to the application installation directory. What's the best way to get that information programmatically? ANSWER: System.getProperty("user.dir") gets the directory the Java VM was...
[ "java", "environment-variables" ]
4
8
4,581
2
0
2008-08-26T15:43:09.743000
2008-08-26T15:52:17.927000
28,433
28,442
Comparing two XML Schemas
Are there any tools to effectively compare two XML schema's? I have seen some generic XML diff tools, but I was wondering if there is anything that knows more about schemas.
I would look into DeltaXML. It seems to have the features you're looking for. They even have a guide on how to compare schemas.
Comparing two XML Schemas Are there any tools to effectively compare two XML schema's? I have seen some generic XML diff tools, but I was wondering if there is anything that knows more about schemas.
TITLE: Comparing two XML Schemas QUESTION: Are there any tools to effectively compare two XML schema's? I have seen some generic XML diff tools, but I was wondering if there is anything that knows more about schemas. ANSWER: I would look into DeltaXML. It seems to have the features you're looking for. They even have ...
[ "xml", "comparison", "xsd" ]
8
6
7,612
1
0
2008-08-26T15:43:54.843000
2008-08-26T15:46:00.110000
28,464
28,479
When do you use dependency injection?
I've been using StructureMap recently and have enjoyed the experience thoroughly. However, I can see how one can easily get carried away with interfacing everything out and end up with classes that take in a boatload of interfaces into their constructors. Even though that really isn't a huge problem when you're using a...
Think about your design. DI allows you to change how your code functions via configuration changes. It also allows you to break dependencies between classes so that you can isolate and test objects easier. You have to determine where this makes sense and where it doesn't. There's no pat answer. A good rule of thumb is ...
When do you use dependency injection? I've been using StructureMap recently and have enjoyed the experience thoroughly. However, I can see how one can easily get carried away with interfacing everything out and end up with classes that take in a boatload of interfaces into their constructors. Even though that really is...
TITLE: When do you use dependency injection? QUESTION: I've been using StructureMap recently and have enjoyed the experience thoroughly. However, I can see how one can easily get carried away with interfacing everything out and end up with classes that take in a boatload of interfaces into their constructors. Even tho...
[ "dependency-injection" ]
16
9
1,579
9
0
2008-08-26T15:55:44.237000
2008-08-26T16:03:59.240000
28,478
28,498
If, IIf() and If()
I recently asked a question about IIf vs. If and found out that there is another function in VB called If which basically does the same thing as IIf but is a short-circuit. Does this If function perform better than the IIf function? Does the If statement trump the If and IIf functions?
Damn, I really thought you were talking about the operator all along.;-) Anyway … Does this If function perform better than the IIf function? Definitely. Remember, it's built into the language. Only one of the two conditional arguments has to be evaluated, potentially saving a costly operation. Does the If statement tr...
If, IIf() and If() I recently asked a question about IIf vs. If and found out that there is another function in VB called If which basically does the same thing as IIf but is a short-circuit. Does this If function perform better than the IIf function? Does the If statement trump the If and IIf functions?
TITLE: If, IIf() and If() QUESTION: I recently asked a question about IIf vs. If and found out that there is another function in VB called If which basically does the same thing as IIf but is a short-circuit. Does this If function perform better than the IIf function? Does the If statement trump the If and IIf functio...
[ ".net", "vb.net", "if-statement", "iif-function" ]
11
15
4,786
2
0
2008-08-26T16:03:37.260000
2008-08-26T16:10:32.827000
28,481
28,490
What is the purpose of the designer files in Visual Studio 2008 Web application projects?
There is a conversion process that is needed when migrating Visual Studio 2005 web site to Visual Studio 2008 web application projects. It looks like VS2008 is creating a.designer. file for every aspx when you right click on a file or the project itself in Solution Explorer and select 'Convert to Web Application.' What...
They hold all the form designer stuff that used to go in the #Region " Web Form Designer Generated Code " section of the code. instead of putting it in the.aspx.vb file where people might edit it (mistakenly or not), it's been moved to a separate file, so that you don't have ever look at it.
What is the purpose of the designer files in Visual Studio 2008 Web application projects? There is a conversion process that is needed when migrating Visual Studio 2005 web site to Visual Studio 2008 web application projects. It looks like VS2008 is creating a.designer. file for every aspx when you right click on a fil...
TITLE: What is the purpose of the designer files in Visual Studio 2008 Web application projects? QUESTION: There is a conversion process that is needed when migrating Visual Studio 2005 web site to Visual Studio 2008 web application projects. It looks like VS2008 is creating a.designer. file for every aspx when you ri...
[ "visual-studio-2008", "web-applications" ]
2
5
1,128
2
0
2008-08-26T16:04:53.450000
2008-08-26T16:07:34.613000
28,529
28,537
How would you handle errors when using jQuery.ajax()?
When using jQuery 's ajax method to submit form data, what is the best way to handle errors? This is an example of what a call might look like: $.ajax({ url: "userCreation.ashx", data: { u:userName, p:password, e:email }, type: "POST", beforeSend: function(){disableSubmitButton();}, complete: function(){enableSubmitBut...
Should I be throwing the errors in the ashx, or should I be returning a status code as part of the data returned by the call to userCreation.ashx, then using this to decide what action to take? How do you handle these situations? Personally, if possible, I would prefer to handle this on the server side and work up a me...
How would you handle errors when using jQuery.ajax()? When using jQuery 's ajax method to submit form data, what is the best way to handle errors? This is an example of what a call might look like: $.ajax({ url: "userCreation.ashx", data: { u:userName, p:password, e:email }, type: "POST", beforeSend: function(){disable...
TITLE: How would you handle errors when using jQuery.ajax()? QUESTION: When using jQuery 's ajax method to submit form data, what is the best way to handle errors? This is an example of what a call might look like: $.ajax({ url: "userCreation.ashx", data: { u:userName, p:password, e:email }, type: "POST", beforeSend: ...
[ "asp.net", "jquery", "ajax" ]
33
16
6,710
3
0
2008-08-26T16:26:45.347000
2008-08-26T16:29:46.977000
28,530
38,903
Corporate-Friendly Open Source Licenses
What open source licenses are more corporate-friendly, i.e., they can be used in commercial products without the need to open source the commercial product?
I recommend the Apache License (specifically, version 2). It is not a “copy left” license and it addresses several matters that are important to established companies and their lawyers. “Copy left” is the philosophy of the free software foundation requiring anything incorporating the licensed opens source code to also ...
Corporate-Friendly Open Source Licenses What open source licenses are more corporate-friendly, i.e., they can be used in commercial products without the need to open source the commercial product?
TITLE: Corporate-Friendly Open Source Licenses QUESTION: What open source licenses are more corporate-friendly, i.e., they can be used in commercial products without the need to open source the commercial product? ANSWER: I recommend the Apache License (specifically, version 2). It is not a “copy left” license and it...
[ "open-source" ]
36
30
11,677
10
0
2008-08-26T16:26:51.417000
2008-09-02T05:45:35.067000
28,538
28,594
Java import/export dependencies
I'm trying to find a way to list the (static) dependency requirements of a jar file, in terms of which symbols are required at run time. I can see that the methods exported by classes can be listed using "javap", but there doesn't seem to be an opposite facility to list the 'imports'. Is it possible to do this? This wo...
You could use the Outbound dependencies feature of DependencyFinder. You can do that entirely in the GUI, or in command line exporting XML.
Java import/export dependencies I'm trying to find a way to list the (static) dependency requirements of a jar file, in terms of which symbols are required at run time. I can see that the methods exported by classes can be listed using "javap", but there doesn't seem to be an opposite facility to list the 'imports'. Is...
TITLE: Java import/export dependencies QUESTION: I'm trying to find a way to list the (static) dependency requirements of a jar file, in terms of which symbols are required at run time. I can see that the methods exported by classes can be listed using "javap", but there doesn't seem to be an opposite facility to list...
[ "java", "import", "export" ]
6
3
4,871
4
0
2008-08-26T16:30:07.960000
2008-08-26T16:54:45.170000
28,559
28,714
Most Pythonic way equivalent for: while ((x = next()) != END)
What's the best Python idiom for this C construct? while ((x = next())!= END) {.... } I don't have the ability to recode next(). update: and the answer from seems to be: for x in iter(next, END):....
Short answer: there's no way to do inline variable assignment in a while loop in Python. Meaning that I cannot say: while x=next(): // do something here! Since that's not possible, there are a number of "idiomatically correct" ways of doing this: while 1: x = next() if x!= END: // Blah else: break Obviously, this is ki...
Most Pythonic way equivalent for: while ((x = next()) != END) What's the best Python idiom for this C construct? while ((x = next())!= END) {.... } I don't have the ability to recode next(). update: and the answer from seems to be: for x in iter(next, END):....
TITLE: Most Pythonic way equivalent for: while ((x = next()) != END) QUESTION: What's the best Python idiom for this C construct? while ((x = next())!= END) {.... } I don't have the ability to recode next(). update: and the answer from seems to be: for x in iter(next, END):.... ANSWER: Short answer: there's no way to...
[ "c", "python" ]
12
4
945
7
0
2008-08-26T16:37:52.263000
2008-08-26T17:50:30.357000
28,560
28,790
Is it possible to use nHibernate with Paradox database?
Is it possible to configure nHibernate to connect to Paradox database ( *.db files)?
Yes, sort of. There is no support included in the trunk, you need to write your own dialect. Or you can port the Paradox dialect created for Hibernate.
Is it possible to use nHibernate with Paradox database? Is it possible to configure nHibernate to connect to Paradox database ( *.db files)?
TITLE: Is it possible to use nHibernate with Paradox database? QUESTION: Is it possible to configure nHibernate to connect to Paradox database ( *.db files)? ANSWER: Yes, sort of. There is no support included in the trunk, you need to write your own dialect. Or you can port the Paradox dialect created for Hibernate.
[ "database", "nhibernate", "paradox" ]
2
1
425
1
0
2008-08-26T16:38:05.570000
2008-08-26T18:24:39.947000
28,577
28,871
Globalization architecture
I need to store products for an e-commerce solution in a database. Each product should have descriptive information, such as name, description etc. I need any product to be localized to x number of languages. What I've done so far, is to make any column that should be localized and nvarchar(MAX) and then i store an XML...
You should store the current language somewhere (in a singleton, for instance) and in the product.Name property use the language setting to get the correct string. This way you only have to write the language specific code once for each field rather than thinking about languages everywhere the field is used. For exampl...
Globalization architecture I need to store products for an e-commerce solution in a database. Each product should have descriptive information, such as name, description etc. I need any product to be localized to x number of languages. What I've done so far, is to make any column that should be localized and nvarchar(M...
TITLE: Globalization architecture QUESTION: I need to store products for an e-commerce solution in a database. Each product should have descriptive information, such as name, description etc. I need any product to be localized to x number of languages. What I've done so far, is to make any column that should be locali...
[ "c#", "architecture", "localization", "globalization" ]
4
2
674
4
0
2008-08-26T16:48:46.963000
2008-08-26T19:08:53.837000
28,578
28,583
How can I merge my files when the folder structure has changed using Borland StarTeam?
I'm in the process of refactoring some code which includes moving folders around, and I would like to regularly merge to keep things current. What is the best way to merge after I've moved folders around in my working copy?
You can move the files around in StarTeam also. Then merge after that. Whatever you do, make sure you don't delete the files and re-add in StarTeam. You'll lose the file history if you do that.
How can I merge my files when the folder structure has changed using Borland StarTeam? I'm in the process of refactoring some code which includes moving folders around, and I would like to regularly merge to keep things current. What is the best way to merge after I've moved folders around in my working copy?
TITLE: How can I merge my files when the folder structure has changed using Borland StarTeam? QUESTION: I'm in the process of refactoring some code which includes moving folders around, and I would like to regularly merge to keep things current. What is the best way to merge after I've moved folders around in my worki...
[ "version-control", "refactoring", "merge", "starteam" ]
2
3
917
5
0
2008-08-26T16:48:51.113000
2008-08-26T16:51:30.157000
28,588
28,604
How do you set up an OpenID provider (server) in Ubuntu?
I want to log onto Stack Overflow using OpenID, but I thought I'd set up my own OpenID provider, just because it's harder:) How do you do this in Ubuntu? Edit: Replacing 'server' with the correct term OpenID provider (Identity provider would also be correct according to wikipedia ).
I personnally used phpMyID just for StackOverflow. It's a simple two-files PHP script to put somewhere on a subdomain. Of course, it's not as easy as installing a.deb, but since OpenID relies completely on HTTP, I'm not sure it's advisable to install a self-contained server...
How do you set up an OpenID provider (server) in Ubuntu? I want to log onto Stack Overflow using OpenID, but I thought I'd set up my own OpenID provider, just because it's harder:) How do you do this in Ubuntu? Edit: Replacing 'server' with the correct term OpenID provider (Identity provider would also be correct accor...
TITLE: How do you set up an OpenID provider (server) in Ubuntu? QUESTION: I want to log onto Stack Overflow using OpenID, but I thought I'd set up my own OpenID provider, just because it's harder:) How do you do this in Ubuntu? Edit: Replacing 'server' with the correct term OpenID provider (Identity provider would als...
[ "linux", "ubuntu", "openid" ]
15
5
12,841
6
0
2008-08-26T16:53:12.740000
2008-08-26T16:58:58.233000
28,590
28,614
Why is it bad practice to make multiple database connections in one request?
A discussion about Singletons in PHP has me thinking about this issue more and more. Most people instruct that you shouldn't make a bunch of DB connections in one request, and I'm just curious as to what your reasoning is. My first thought is the expense to your script of making that many requests to the DB, but then I...
Database connections are a limited resource. Some DBs have a very low connection limit, and wasting connections is a major problem. By consuming many connections, you may be blocking others for using the database. Additionally, throwing a ton of extra connections at the DB doesn't help anything unless there are resourc...
Why is it bad practice to make multiple database connections in one request? A discussion about Singletons in PHP has me thinking about this issue more and more. Most people instruct that you shouldn't make a bunch of DB connections in one request, and I'm just curious as to what your reasoning is. My first thought is ...
TITLE: Why is it bad practice to make multiple database connections in one request? QUESTION: A discussion about Singletons in PHP has me thinking about this issue more and more. Most people instruct that you shouldn't make a bunch of DB connections in one request, and I'm just curious as to what your reasoning is. My...
[ "database", "resources", "database-connection" ]
5
10
13,253
5
0
2008-08-26T16:53:53.567000
2008-08-26T17:03:06.273000
28,599
28,717
How do I support SSL Client Certificate authentication?
I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use its stored certificate for authentication so you don't ever need a password....
These are usually referred to as client side certificates. I've not actually used it but a modified version of restful-authentication can be found here here that looks like what your after. I found this via Dr. Nic's post
How do I support SSL Client Certificate authentication? I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use its stored certifica...
TITLE: How do I support SSL Client Certificate authentication? QUESTION: I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use it...
[ "ruby-on-rails", "apache", "ssl" ]
12
8
14,950
5
0
2008-08-26T16:57:52.293000
2008-08-26T17:51:06.487000
28,605
28,618
C on Visual Studio
I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either: learn the ins and out of C in Visual Studio recommend a better...
Answering the purely subject question "recommend me a better C IDE and compiler" I find Ming32w and Code::blocks (now with combined installer) very useful on windows but YMMV as you are obviously used to the MS IDE and are just struggling with C. May I suggest you concentrate on console applications to get a feel for t...
C on Visual Studio I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either: learn the ins and out of C in Visual Studio...
TITLE: C on Visual Studio QUESTION: I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either: learn the ins and out of ...
[ "c++", "c", "ide", "compiler-construction" ]
23
11
61,960
15
0
2008-08-26T16:59:00.107000
2008-08-26T17:03:41.390000
28,637
28,648
Is DateTime.Now the best way to measure a function's performance?
I need to find a bottleneck and need to accurately as possible measure time. Is the following code snippet the best way to measure the performance? DateTime startTime = DateTime.Now; // Some execution process DateTime endTime = DateTime.Now; TimeSpan totalTimeTaken = endTime.Subtract(startTime);
No, it's not. Use the Stopwatch (in System.Diagnostics ) Stopwatch sw = Stopwatch.StartNew(); PerformWork(); sw.Stop(); Console.WriteLine("Time taken: {0}ms", sw.Elapsed.TotalMilliseconds); Stopwatch automatically checks for the existence of high-precision timers. It is worth mentioning that DateTime.Now often is quit...
Is DateTime.Now the best way to measure a function's performance? I need to find a bottleneck and need to accurately as possible measure time. Is the following code snippet the best way to measure the performance? DateTime startTime = DateTime.Now; // Some execution process DateTime endTime = DateTime.Now; TimeSpan t...
TITLE: Is DateTime.Now the best way to measure a function's performance? QUESTION: I need to find a bottleneck and need to accurately as possible measure time. Is the following code snippet the best way to measure the performance? DateTime startTime = DateTime.Now; // Some execution process DateTime endTime = DateTi...
[ "c#", ".net", "performance", "datetime", "timer" ]
494
674
76,037
16
0
2008-08-26T17:09:45.417000
2008-08-26T17:13:32.240000
28,642
28,715
Finding controls that use a certain interface in ASP.NET
Having a heckuva time with this one, though I feel I'm missing something obvious. I have a control that inherits from System.Web.UI.WebControls.Button, and then implements an interface that I have set up. So think... public class Button: System.Web.UI.WebControls.Button, IMyButtonInterface {... } In the codebehind of a...
Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use ctrl is IInterfaceToFind instead of ctrl.GetType() == aTypeVariable The reason why is that if you use.GetType() you will get the true type of an object, not necessarily what it can also be cast to in its inheritance/Interfac...
Finding controls that use a certain interface in ASP.NET Having a heckuva time with this one, though I feel I'm missing something obvious. I have a control that inherits from System.Web.UI.WebControls.Button, and then implements an interface that I have set up. So think... public class Button: System.Web.UI.WebControls...
TITLE: Finding controls that use a certain interface in ASP.NET QUESTION: Having a heckuva time with this one, though I feel I'm missing something obvious. I have a control that inherits from System.Web.UI.WebControls.Button, and then implements an interface that I have set up. So think... public class Button: System....
[ "c#", "asp.net" ]
7
7
2,545
7
0
2008-08-26T17:11:41.603000
2008-08-26T17:50:51.637000
28,654
28,667
Debugging Web Service with SOAP Packet
I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. Using TCPTrace I was able to get the soap packet passed to the web se...
A somewhat manual process would be to use the Poster add-in for Firefox. There is also a java utility called SoapUI that has some discovery based automated templates that you can then modify and run against your service.
Debugging Web Service with SOAP Packet I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. Using TCPTrace I was able to g...
TITLE: Debugging Web Service with SOAP Packet QUESTION: I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. Using TCPTra...
[ "c#", "web-services", "soap", "tcptrace-pocketsoap" ]
2
2
2,203
4
0
2008-08-26T17:14:55.467000
2008-08-26T17:19:44.830000
28,664
28,687
What is the best/a very good meta-data reader library?
Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?), but the more it can do (eg EXIF from images?) the better without compromising the ID3 tag reading abilities. I'm interested in making a script that goes through my media (right now, my music files) and makes sure the file name and di...
There is a great post on using PowerShell and TagLibSharp on Joel "Jaykul" Bennet's site. You could use TagLibSharp to read the metatdata with any.NET based language, but PowerShell is quite appropriate for what you are trying to do.
What is the best/a very good meta-data reader library? Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?), but the more it can do (eg EXIF from images?) the better without compromising the ID3 tag reading abilities. I'm interested in making a script that goes through my media (right n...
TITLE: What is the best/a very good meta-data reader library? QUESTION: Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?), but the more it can do (eg EXIF from images?) the better without compromising the ID3 tag reading abilities. I'm interested in making a script that goes through...
[ "metadata" ]
5
1
1,421
5
0
2008-08-26T17:18:21.433000
2008-08-26T17:35:11.440000
28,668
28,692
Best way to extract data from a FileMaker Pro database in a script?
My job would be easier, or at least less tedious if I could come up with an automated way (preferably in a Python script) to extract useful information from a FileMaker Pro database. I am working on Linux machine and the FileMaker database is on the same LAN running on an OS X machine. I can log into the webby interfac...
It has been a really long time since I did anything with FileMaker Pro, but I know that it does have capabilities for an ODBC (and JDBC) connection to be made to it (however, I don't know how, or if, that translates to the linux/perl/python world though). This article shows how to share/expose your FileMaker data via O...
Best way to extract data from a FileMaker Pro database in a script? My job would be easier, or at least less tedious if I could come up with an automated way (preferably in a Python script) to extract useful information from a FileMaker Pro database. I am working on Linux machine and the FileMaker database is on the sa...
TITLE: Best way to extract data from a FileMaker Pro database in a script? QUESTION: My job would be easier, or at least less tedious if I could come up with an automated way (preferably in a Python script) to extract useful information from a FileMaker Pro database. I am working on Linux machine and the FileMaker dat...
[ "python", "linux", "perl", "scripting", "filemaker" ]
10
6
11,109
3
0
2008-08-26T17:20:47.557000
2008-08-26T17:36:19.533000
28,675
28,684
How to avoid OutOfMemoryError when using Bytebuffers and NIO?
I'm using ByteBuffers and FileChannels to write binary data to a file. When doing that for big files or successively for multiple files, I get an OutOfMemoryError exception. I've read elsewhere that using Bytebuffers with NIO is broken and should be avoided. Does any of you already faced this kind of problem and found ...
I would say don't create a huge ByteBuffer that contains ALL of the data at once. Create a much smaller ByteBuffer, fill it with data, then write this data to the FileChannel. Then reset the ByteBuffer and continue until all the data is written.
How to avoid OutOfMemoryError when using Bytebuffers and NIO? I'm using ByteBuffers and FileChannels to write binary data to a file. When doing that for big files or successively for multiple files, I get an OutOfMemoryError exception. I've read elsewhere that using Bytebuffers with NIO is broken and should be avoided....
TITLE: How to avoid OutOfMemoryError when using Bytebuffers and NIO? QUESTION: I'm using ByteBuffers and FileChannels to write binary data to a file. When doing that for big files or successively for multiple files, I get an OutOfMemoryError exception. I've read elsewhere that using Bytebuffers with NIO is broken and ...
[ "java", "nio", "bytebuffer", "filechannel" ]
3
7
9,284
6
0
2008-08-26T17:23:01.267000
2008-08-26T17:26:45.953000
28,709
549,032
Eclipse 3.2.2 content assist not finding classes in the project
In Eclipse 3.2.2 on Linux content assist is not finding classes within the same project. Upgrading above 3.2 is not an option as SWT is not available above 3.2 for Solaris. I have seen suggestions to clean the workspace, reopen the workspace, run eclipse with the -clean command, none of which has worked.
Thanks for your last comment it worked partially. If there is any kind of errors, the content assist wont work. Once fixed, it partially works. I say partially because, there appear to be a bug, when I do Perl EPIC inheritance ex: package FG::CatalogueFichier; use FG::Catalogue; our @ISA = qw(FG::Catalogue); use strict...
Eclipse 3.2.2 content assist not finding classes in the project In Eclipse 3.2.2 on Linux content assist is not finding classes within the same project. Upgrading above 3.2 is not an option as SWT is not available above 3.2 for Solaris. I have seen suggestions to clean the workspace, reopen the workspace, run eclipse w...
TITLE: Eclipse 3.2.2 content assist not finding classes in the project QUESTION: In Eclipse 3.2.2 on Linux content assist is not finding classes within the same project. Upgrading above 3.2 is not an option as SWT is not available above 3.2 for Solaris. I have seen suggestions to clean the workspace, reopen the worksp...
[ "linux", "eclipse", "eclipse-3.2" ]
1
1
2,797
4
0
2008-08-26T17:48:04.560000
2009-02-14T12:20:23.330000
28,716
28,735
Which PHP opcode cacher should I use to improve performance?
I'm trying to improve performance under high load and would like to implement opcode caching. Which of the following should I use? APC - Installation Guide eAccelerator - Installation Guide XCache - Installation Guide I'm also open to any other alternatives that have slipped under my radar. Currently running on a stock...
I think the answer might depend on the type of web applications you are running. I had to make this decision myself two years ago and couldn't decide between Zend Optimizer and eAccelerator. In order to make my decision, I used ab (apache bench) to test the server, and tested the three combinations (zend, eaccelerator,...
Which PHP opcode cacher should I use to improve performance? I'm trying to improve performance under high load and would like to implement opcode caching. Which of the following should I use? APC - Installation Guide eAccelerator - Installation Guide XCache - Installation Guide I'm also open to any other alternatives t...
TITLE: Which PHP opcode cacher should I use to improve performance? QUESTION: I'm trying to improve performance under high load and would like to implement opcode caching. Which of the following should I use? APC - Installation Guide eAccelerator - Installation Guide XCache - Installation Guide I'm also open to any ot...
[ "php", "performance", "caching" ]
59
18
10,942
7
0
2008-08-26T17:50:53.303000
2008-08-26T17:58:05.783000
28,723
35,299
Best way to unit test ASP.NET MVC action methods that use BindingHelperExtensions.UpdateFrom?
In handling a form post I have something like public ActionResult Insert() { Order order = new Order(); BindingHelperExtensions.UpdateFrom(order, this.Request.Form); this.orderService.Save(order); return this.RedirectToAction("Details", new { id = order.ID }); } I am not using explicit parameters in the method as I a...
I'm now using ModelBinder so that my action method can look (basically) like: public ActionResult Insert(Contact contact) { if (this.ViewData.ModelState.IsValid) { this.contactService.SaveContact(contact); return this.RedirectToAction("Details", new { id = contact.ID }); } else { return this.RedirectToAction("Create"...
Best way to unit test ASP.NET MVC action methods that use BindingHelperExtensions.UpdateFrom? In handling a form post I have something like public ActionResult Insert() { Order order = new Order(); BindingHelperExtensions.UpdateFrom(order, this.Request.Form); this.orderService.Save(order); return this.RedirectToActio...
TITLE: Best way to unit test ASP.NET MVC action methods that use BindingHelperExtensions.UpdateFrom? QUESTION: In handling a form post I have something like public ActionResult Insert() { Order order = new Order(); BindingHelperExtensions.UpdateFrom(order, this.Request.Form); this.orderService.Save(order); return th...
[ "asp.net-mvc", "unit-testing" ]
1
1
762
3
0
2008-08-26T17:53:56.887000
2008-08-29T21:09:42.947000
28,739
28,828
Get `df` to show updated information on FreeBSD
I recently ran out of disk space on a drive on a FreeBSD server. I truncated the file that was causing problems but I'm not seeing the change reflected when running df. When I run du -d0 on the partition it shows the correct value. Is there any way to force this information to be updated? What is causing the output her...
This probably centres on how you truncated the file. du and df report different things as this post on unix.com explains. Just because space is not used does not necessarily mean that it's free...
Get `df` to show updated information on FreeBSD I recently ran out of disk space on a drive on a FreeBSD server. I truncated the file that was causing problems but I'm not seeing the change reflected when running df. When I run du -d0 on the partition it shows the correct value. Is there any way to force this informati...
TITLE: Get `df` to show updated information on FreeBSD QUESTION: I recently ran out of disk space on a drive on a FreeBSD server. I truncated the file that was causing problems but I'm not seeing the change reflected when running df. When I run du -d0 on the partition it shows the correct value. Is there any way to fo...
[ "filesystems", "system-administration", "freebsd" ]
0
2
8,537
3
0
2008-08-26T18:00:52.423000
2008-08-26T18:50:47.233000
28,756
28,763
The best way to get a count of IEnumerable<T>
Whats the best/easiest way to obtain a count of items within an IEnumerable collection without enumerating over all of the items in the collection? Possible with LINQ or Lambda?
You will have to enumerate to get a count. Other constructs like the List keep a running count.
The best way to get a count of IEnumerable<T> Whats the best/easiest way to obtain a count of items within an IEnumerable collection without enumerating over all of the items in the collection? Possible with LINQ or Lambda?
TITLE: The best way to get a count of IEnumerable<T> QUESTION: Whats the best/easiest way to obtain a count of items within an IEnumerable collection without enumerating over all of the items in the collection? Possible with LINQ or Lambda? ANSWER: You will have to enumerate to get a count. Other constructs like the ...
[ "c#", "linq" ]
35
16
60,614
11
0
2008-08-26T18:09:30.903000
2008-08-26T18:12:23.893000
28,757
28,821
Any good Subversion virtual appliance recommendations?
I'm looking for a quick-and-dirty solution to this, I have to set up a Subversion server really quickly, like by the end of the day tomorrow. My initial thought was to just download a virtual appliance that we could load onto our host machine. The problem I am having however is that all the appliances I have found so f...
I would simply go with installing SVN, and using the SVN Daemon, and completely ignoring Apache. There should be no appliance needed. Very simple to install, very easy to configure. Just take a vanilla windows/linux box and install the subversion server. It'll probably take all of 1/2 and hour to set up.
Any good Subversion virtual appliance recommendations? I'm looking for a quick-and-dirty solution to this, I have to set up a Subversion server really quickly, like by the end of the day tomorrow. My initial thought was to just download a virtual appliance that we could load onto our host machine. The problem I am havi...
TITLE: Any good Subversion virtual appliance recommendations? QUESTION: I'm looking for a quick-and-dirty solution to this, I have to set up a Subversion server really quickly, like by the end of the day tomorrow. My initial thought was to just download a virtual appliance that we could load onto our host machine. The...
[ "svn", "version-control" ]
7
5
6,083
11
0
2008-08-26T18:09:36.693000
2008-08-26T18:42:57.283000
28,765
28,822
Using Visual Studio 2008 Web Deployment projects - getting an error finding aspnet_merge.exe
I recently upgraded a VS2005 web deployment project to VS2008 - and now I get the following error when building: The specified task executable location "bin\aspnet_merge.exe" is invalid. Here is the source of the error (from the web deployment targets file): What is the solution to this problem? Note - I also created a...
Apparently aspnet_merge.exe (and all the other SDK tools) are NOT packaged in Visual Studio 2008. Visual Studio 2005 packaged these tools as part of its installation. The place to get this is an installation of the Windows 2008 SDK ( latest download ). Windows 7/Windows 2008 R2 SDK: here The solution is to install the ...
Using Visual Studio 2008 Web Deployment projects - getting an error finding aspnet_merge.exe I recently upgraded a VS2005 web deployment project to VS2008 - and now I get the following error when building: The specified task executable location "bin\aspnet_merge.exe" is invalid. Here is the source of the error (from th...
TITLE: Using Visual Studio 2008 Web Deployment projects - getting an error finding aspnet_merge.exe QUESTION: I recently upgraded a VS2005 web deployment project to VS2008 - and now I get the following error when building: The specified task executable location "bin\aspnet_merge.exe" is invalid. Here is the source of ...
[ "asp.net", "visual-studio-2008" ]
4
8
4,799
2
0
2008-08-26T18:13:13.687000
2008-08-26T18:43:11.183000
28,768
28,868
Simple Object to Database Product
I've been taking a look at some different products for.NET which propose to speed up development time by providing a way for business objects to map seamlessly to an automatically generated database. I've never had a problem writing a data access layer, but I'm wondering if this type of product will really save the tim...
I have used SubSonic and EntitySpaces. Once you get the hang of them, I beleive they can save you time, but as complexity of your app and volume of data grow, you may outgrow these tools. You start to lose time trying to figure out if something like a performance issue is related to the ORM or to your code. So, to answ...
Simple Object to Database Product I've been taking a look at some different products for.NET which propose to speed up development time by providing a way for business objects to map seamlessly to an automatically generated database. I've never had a problem writing a data access layer, but I'm wondering if this type o...
TITLE: Simple Object to Database Product QUESTION: I've been taking a look at some different products for.NET which propose to speed up development time by providing a way for business objects to map seamlessly to an automatically generated database. I've never had a problem writing a data access layer, but I'm wonder...
[ "c#", ".net", "database", "orm" ]
0
3
524
5
0
2008-08-26T18:14:42.733000
2008-08-26T19:05:45.590000
28,793
677,830
vim commands in Eclipse
I have been doing some java development lately and have started using Eclipse. For the most part, I think it is great, but being a C/C++ guy used to doing all of his editing in vim, I find myself needlessly hitting the Esc key over and over. It would be really nice if I got all the nice features of Eclipse, but still c...
Vrapper: an Eclipse plugin which acts as a wrapper for Eclipse text editors to provide a Vim-like input scheme for moving around and editing text. Unlike other plugins which embed Vim in Eclipse, Vrapper imitates the behaviour of Vim while still using whatever editor you have opened in the workbench. The goal is to hav...
vim commands in Eclipse I have been doing some java development lately and have started using Eclipse. For the most part, I think it is great, but being a C/C++ guy used to doing all of his editing in vim, I find myself needlessly hitting the Esc key over and over. It would be really nice if I got all the nice features...
TITLE: vim commands in Eclipse QUESTION: I have been doing some java development lately and have started using Eclipse. For the most part, I think it is great, but being a C/C++ guy used to doing all of his editing in vim, I find myself needlessly hitting the Esc key over and over. It would be really nice if I got all...
[ "eclipse", "vim" ]
58
69
21,217
3
0
2008-08-26T18:26:07.400000
2009-03-24T15:09:39.273000
28,796
29,770
What refactoring tools do you use for Python?
I have a bunch of classes I want to rename. Some of them have names that are small and that name is reused in other class names, where I don't want that name changed. Most of this lives in Python code, but we also have some XML code that references class names. Simple search and replace only gets me so far. In my case,...
In the meantime, I've tried it two tools that have some sort of integration with vim. The first is Rope, a python refactoring library that comes with a Vim (and emacs) plug-in. I tried it for a few renames, and that definitely worked as expected. It allowed me to preview the refactoring as a diff, which is nice. It is ...
What refactoring tools do you use for Python? I have a bunch of classes I want to rename. Some of them have names that are small and that name is reused in other class names, where I don't want that name changed. Most of this lives in Python code, but we also have some XML code that references class names. Simple searc...
TITLE: What refactoring tools do you use for Python? QUESTION: I have a bunch of classes I want to rename. Some of them have names that are small and that name is reused in other class names, where I don't want that name changed. Most of this lives in Python code, but we also have some XML code that references class n...
[ "python", "refactoring" ]
75
59
43,121
7
0
2008-08-26T18:26:51.517000
2008-08-27T09:15:42.863000
28,808
157,505
PAD (Portable Application Description) files for shareware / freeware
I've been told that I should include PAD files with the freeware applications I distribute so hosting sites can list the information correctly and check for updates, etc. Can you give me some info on using PAD files? Here are general questions which come to mind: Is it worth the effort? Do you use PADGen or an online t...
I do use padgen, it does not take too long to make a pad file, but what takes time is submitting it... just copy+paste stuff from your marketing material into it. keep storing all your pad files on your webserver and new version updates are listed in 1000+ small shareware/software sites automatically. however, download...
PAD (Portable Application Description) files for shareware / freeware I've been told that I should include PAD files with the freeware applications I distribute so hosting sites can list the information correctly and check for updates, etc. Can you give me some info on using PAD files? Here are general questions which ...
TITLE: PAD (Portable Application Description) files for shareware / freeware QUESTION: I've been told that I should include PAD files with the freeware applications I distribute so hosting sites can list the information correctly and check for updates, etc. Can you give me some info on using PAD files? Here are genera...
[ "open-source", "software-distribution" ]
2
1
679
1
0
2008-08-26T18:32:35.217000
2008-10-01T13:11:03.033000
28,817
34,953
How to find out which CVS tags cover which files and paths?
There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find out, which branch / tag covers, which files and paths? CVS log already provide...
To determine what tags apply to a particular file use: cvs log This will output all the versions of the file and what tags have been applied to the version. To determine what files are included in a single tag, the only thing I can think of is to check out using the tag and see what files come back. The command for tha...
How to find out which CVS tags cover which files and paths? There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find out, which branch ...
TITLE: How to find out which CVS tags cover which files and paths? QUESTION: There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find ...
[ "cvs" ]
8
7
28,192
6
0
2008-08-26T18:40:27.133000
2008-08-29T18:27:33.553000
28,820
33,251
Windows Mobile - What scripting platforms are available?
We have a number of users with Windows Mobile 6 and need to apply minor changes. eg. update a registry setting. One option is push and execute an executable file using our device management software. I'd like this to be a little more friendly for the admins who are familiar with scripting in VBScript/JScript etc. What ...
Once option that the devs over at xda-developers seem to enjoy is Mortscript I have never bothered to use it, but I have used many cab installers that distribute mortscript so that they can do various tasks
Windows Mobile - What scripting platforms are available? We have a number of users with Windows Mobile 6 and need to apply minor changes. eg. update a registry setting. One option is push and execute an executable file using our device management software. I'd like this to be a little more friendly for the admins who a...
TITLE: Windows Mobile - What scripting platforms are available? QUESTION: We have a number of users with Windows Mobile 6 and need to apply minor changes. eg. update a registry setting. One option is push and execute an executable file using our device management software. I'd like this to be a little more friendly fo...
[ "windows-mobile", "scripting", "system-administration", "administration" ]
6
2
7,440
5
0
2008-08-26T18:42:14.257000
2008-08-28T19:58:21
28,823
29,500
XML => HTML with Hpricot and Rails
I have never worked with web services and rails, and obviously this is something I need to learn. I have chosen to use hpricot because it looks great. Anyway, _why's been nice enough to provide the following example on the hpricot website: #!ruby require 'hpricot' require 'open-uri' # load the RedHanded home page doc =...
Model, model, model, model, model. Skinny controllers, simple views. The RedHandedHomePage model does the parsing on initialization, then call 'def render' in the controller, set output to an instance variable, and print that in a view.
XML => HTML with Hpricot and Rails I have never worked with web services and rails, and obviously this is something I need to learn. I have chosen to use hpricot because it looks great. Anyway, _why's been nice enough to provide the following example on the hpricot website: #!ruby require 'hpricot' require 'open-uri' #...
TITLE: XML => HTML with Hpricot and Rails QUESTION: I have never worked with web services and rails, and obviously this is something I need to learn. I have chosen to use hpricot because it looks great. Anyway, _why's been nice enough to provide the following example on the hpricot website: #!ruby require 'hpricot' re...
[ "ruby-on-rails", "xml", "ruby", "hpricot", "open-uri" ]
1
2
1,979
2
0
2008-08-26T18:44:40.540000
2008-08-27T04:12:04.077000
28,826
28,844
What exactly is Microsoft Expression Studio and how does it integrate with Visual Studio?
My university is part of MSDNAA, so I downloaded it a while back, but I just got around to installing it. I guess part of it replaces FrontPage for web editing, and there appears to be a video editor and a vector graphics editor, but I don't think I've even scratched the surface of what it is and what it can do. Could ...
Expression Studio is basically a design studio. It consists of a bunch of design software that Microsoft has bought for the most part. The audience is designers, not developers. The gist of the software is that Expression Blend enables designers and programmers to work seamlessly together in letting the designer create...
What exactly is Microsoft Expression Studio and how does it integrate with Visual Studio? My university is part of MSDNAA, so I downloaded it a while back, but I just got around to installing it. I guess part of it replaces FrontPage for web editing, and there appears to be a video editor and a vector graphics editor, ...
TITLE: What exactly is Microsoft Expression Studio and how does it integrate with Visual Studio? QUESTION: My university is part of MSDNAA, so I downloaded it a while back, but I just got around to installing it. I guess part of it replaces FrontPage for web editing, and there appears to be a video editor and a vector...
[ "visual-studio", "integration", "expression-studio" ]
11
18
12,065
7
0
2008-08-26T18:49:25.630000
2008-08-26T18:54:56.520000
28,832
28,906
Java and manually executing finalize
If I call finalize() on an object from my program code, will the JVM still run the method again when the garbage collector processes this object? This would be an approximate example: MyObject m = new MyObject(); m.finalize(); m = null; System.gc() Would the explicit call to finalize() make the JVM 's garbage collec...
According to this simple test program, the JVM will still make its call to finalize() even if you explicitly called it: private static class Blah { public void finalize() { System.out.println("finalizing!"); } } private static void f() throws Throwable { Blah blah = new Blah(); blah.finalize(); } public static void m...
Java and manually executing finalize If I call finalize() on an object from my program code, will the JVM still run the method again when the garbage collector processes this object? This would be an approximate example: MyObject m = new MyObject(); m.finalize(); m = null; System.gc() Would the explicit call to fina...
TITLE: Java and manually executing finalize QUESTION: If I call finalize() on an object from my program code, will the JVM still run the method again when the garbage collector processes this object? This would be an approximate example: MyObject m = new MyObject(); m.finalize(); m = null; System.gc() Would the exp...
[ "java", "garbage-collection", "finalize" ]
18
30
20,587
3
0
2008-08-26T18:51:41.520000
2008-08-26T19:23:06.483000
28,839
28,873
What causes Visual Studio to fail to load an assembly incorrectly?
I had been happily coding along on a decent sized solution (just over 13k LOC, 5 projects) which utilizes Linq to Sql for it's data access. All of sudden I performed a normal build and I received a sweet, sweet ambiguous message: Error 1 Build failed due to validation errors in C:\xxx\xxx.dbml. Open the file and resolv...
TBH, I have had a couple of instances like this where files "seemed to go crazy".. However, upon investigation it has appeared that the files have changed in some way, shape or form.. (e.g. sometimes changes can be made to the file by inadvertantly changing a property somewhere that seems unrelated). I think there are ...
What causes Visual Studio to fail to load an assembly incorrectly? I had been happily coding along on a decent sized solution (just over 13k LOC, 5 projects) which utilizes Linq to Sql for it's data access. All of sudden I performed a normal build and I received a sweet, sweet ambiguous message: Error 1 Build failed du...
TITLE: What causes Visual Studio to fail to load an assembly incorrectly? QUESTION: I had been happily coding along on a decent sized solution (just over 13k LOC, 5 projects) which utilizes Linq to Sql for it's data access. All of sudden I performed a normal build and I received a sweet, sweet ambiguous message: Error...
[ "visual-studio", "visual-studio-2008", "linq-to-sql" ]
4
1
2,612
4
0
2008-08-26T18:53:57.117000
2008-08-26T19:11:59.350000
28,843
33,738
Can SlickEdit automatically update its tag files?
I prefer SlickEdit for my IDE but the only way I can get it to update the tag files to incorporate code changes is to recreate the project and/or run start a re-tag manually. Is there a way to setup Slick Edit so that it automatically incorporates changes in the code base that happen after project creation. This proble...
Okay, I asked a question on the SlickEdit forums. http://community.slickedit.com/index.php?topic=3854.0 EDIT: Winnar! Options->Editing->Background Tagging of Other Files
Can SlickEdit automatically update its tag files? I prefer SlickEdit for my IDE but the only way I can get it to update the tag files to incorporate code changes is to recreate the project and/or run start a re-tag manually. Is there a way to setup Slick Edit so that it automatically incorporates changes in the code ba...
TITLE: Can SlickEdit automatically update its tag files? QUESTION: I prefer SlickEdit for my IDE but the only way I can get it to update the tag files to incorporate code changes is to recreate the project and/or run start a re-tag manually. Is there a way to setup Slick Edit so that it automatically incorporates chan...
[ "ide", "slickedit" ]
6
6
2,619
1
0
2008-08-26T18:54:48.860000
2008-08-29T01:08:16.107000
28,881
28,903
Why doesn't **sort** sort the same on every machine?
Using the same sort command with the same input produces different results on different machines. How do I fix that?
The man-page on OS X says: ******* WARNING ******* The locale specified by the environment affects sort order. Set LC_ALL=C to get the traditional sort order that uses native byte values. which might explain things. If some of your systems have no locale support, they would default to that locale (C), so you wouldn't h...
Why doesn't **sort** sort the same on every machine? Using the same sort command with the same input produces different results on different machines. How do I fix that?
TITLE: Why doesn't **sort** sort the same on every machine? QUESTION: Using the same sort command with the same input produces different results on different machines. How do I fix that? ANSWER: The man-page on OS X says: ******* WARNING ******* The locale specified by the environment affects sort order. Set LC_ALL=C...
[ "bash", "unix", "sorting", "ksh" ]
17
25
8,172
4
0
2008-08-26T19:15:47.267000
2008-08-26T19:21:56.177000
28,894
28,947
.NET Compiler -- DEBUG vs. RELEASE
For years I have been using the DEBUG compiler constant in VB.NET to write messages to the console. I've also been using System.Diagnostics.Debug.Write in similar fashion. It was always my understanding that when RELEASE was used as the build option, that all of these statements were left out by the compiler, freeing y...
The preferred method is to actually use the conditional attribute to wrap your debug calls, not use the compiler directives. #ifs can get tricky and can lead to weird build problems. An example of using a conditional attribute is as follows (in C#, but works in VB.NET too): [ Conditional("Debug") ] private void WriteDe...
.NET Compiler -- DEBUG vs. RELEASE For years I have been using the DEBUG compiler constant in VB.NET to write messages to the console. I've also been using System.Diagnostics.Debug.Write in similar fashion. It was always my understanding that when RELEASE was used as the build option, that all of these statements were ...
TITLE: .NET Compiler -- DEBUG vs. RELEASE QUESTION: For years I have been using the DEBUG compiler constant in VB.NET to write messages to the console. I've also been using System.Diagnostics.Debug.Write in similar fashion. It was always my understanding that when RELEASE was used as the build option, that all of thes...
[ ".net", "compiler-construction", "debugging" ]
19
22
11,941
7
0
2008-08-26T19:20:09.470000
2008-08-26T19:45:54.900000
28,896
28,917
Datatypes for physics
I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other) What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#? Also, what's the smallest ammount of time I can get between t and t+1? One tick? EDIT: Clar...
In.Net a decimal will be the most precise datatype that you could use for position. I would just write a class for the position: public class Position { decimal x; decimal y; decimal z; } As for time, your processor can't give you anything smaller than one tick. Sounds like an fun project! Good luck!
Datatypes for physics I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other) What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#? Also, what's the smallest ammount of time I can get between t and t+1...
TITLE: Datatypes for physics QUESTION: I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other) What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#? Also, what's the smallest ammount of time I can get...
[ "c#", "types", "physics" ]
10
9
843
8
0
2008-08-26T19:20:35.493000
2008-08-26T19:27:49.203000
28,922
28,924
SQLServer Get Results Where Value Is Null
I have an SQL server database that I am querying and I only want to get the information when a specific row is null. I used a where statement such as: WHERE database.foobar = NULL and it does not return anything. However, I know that there is at least one result because I created an instance in the database where 'foob...
Correct syntax is WHERE database.foobar IS NULL. See http://msdn.microsoft.com/en-us/library/ms188795.aspx for more info
SQLServer Get Results Where Value Is Null I have an SQL server database that I am querying and I only want to get the information when a specific row is null. I used a where statement such as: WHERE database.foobar = NULL and it does not return anything. However, I know that there is at least one result because I creat...
TITLE: SQLServer Get Results Where Value Is Null QUESTION: I have an SQL server database that I am querying and I only want to get the information when a specific row is null. I used a where statement such as: WHERE database.foobar = NULL and it does not return anything. However, I know that there is at least one resu...
[ "sql", "sql-server", "oracle" ]
3
6
226
4
0
2008-08-26T19:32:20.783000
2008-08-26T19:33:04.277000
28,932
3,541,878
Best JavaScript compressor
What is the the best JavaScript compressor available? I'm looking for a tool that: is easy to use has a high compression rate Produce reliable end results (doesn't mess up the code)
I recently released UglifyJS, a JavaScript compressor which is written in JavaScript (runs on the NodeJS Node.js platform, but it can be easily modified to run on any JavaScript engine, since it doesn't need any Node.js internals). It's a lot faster than both YUI Compressor and Google Closure, it compresses better than...
Best JavaScript compressor What is the the best JavaScript compressor available? I'm looking for a tool that: is easy to use has a high compression rate Produce reliable end results (doesn't mess up the code)
TITLE: Best JavaScript compressor QUESTION: What is the the best JavaScript compressor available? I'm looking for a tool that: is easy to use has a high compression rate Produce reliable end results (doesn't mess up the code) ANSWER: I recently released UglifyJS, a JavaScript compressor which is written in JavaScript...
[ "javascript", "compression" ]
174
150
116,108
13
0
2008-08-26T19:36:20.273000
2010-08-22T14:50:31.130000
28,941
28,955
Best architecture for handling file system changes?
Here is the scenario: I'm writing an app that will watch for any changes in a specific directory. This directory will be flooded with thousands of files a minute each with an "almost" unique GUID. The file format is this: GUID.dat where GUID == xxxxxxxxxxxxxxxxxxxxxxxxxxxxx (the internal contents aren't relevant, but i...
A couple of things that I have in my head: If the guid is not unique, would it not overwrite the file with the same name, or is the check based on a lookup which does some external action (e.g. check the archive)? (i.e. is this a YAGNI moment?) I've used FileSystemWatcher before with pretty good success, can you give u...
Best architecture for handling file system changes? Here is the scenario: I'm writing an app that will watch for any changes in a specific directory. This directory will be flooded with thousands of files a minute each with an "almost" unique GUID. The file format is this: GUID.dat where GUID == xxxxxxxxxxxxxxxxxxxxxxx...
TITLE: Best architecture for handling file system changes? QUESTION: Here is the scenario: I'm writing an app that will watch for any changes in a specific directory. This directory will be flooded with thousands of files a minute each with an "almost" unique GUID. The file format is this: GUID.dat where GUID == xxxxx...
[ ".net", "architecture", "concurrency", "filesystemwatcher" ]
2
3
554
2
0
2008-08-26T19:42:47.483000
2008-08-26T19:48:48.107000
28,949
29,038
Why do you not explicitly call finalize() or start the garbage collector?
After reading this question, I was reminded of when I was taught Java and told never to call finalize() or run the garbage collector because "it's a big black box that you never need to worry about". Can someone boil the reasoning for this down to a few sentences? I'm sure I could read a technical report from Sun on th...
The short answer: Java garbage collection is a very finely tuned tool. System.gc() is a sledge-hammer. Java's heap is divided into different generations, each of which is collected using a different strategy. If you attach a profiler to a healthy app, you'll see that it very rarely has to run the most expensive kinds o...
Why do you not explicitly call finalize() or start the garbage collector? After reading this question, I was reminded of when I was taught Java and told never to call finalize() or run the garbage collector because "it's a big black box that you never need to worry about". Can someone boil the reasoning for this down t...
TITLE: Why do you not explicitly call finalize() or start the garbage collector? QUESTION: After reading this question, I was reminded of when I was taught Java and told never to call finalize() or run the garbage collector because "it's a big black box that you never need to worry about". Can someone boil the reasoni...
[ "java", "garbage-collection" ]
28
44
15,452
7
0
2008-08-26T19:46:46.367000
2008-08-26T21:54:39.990000
28,950
28,970
Guide to choosing between REST vs SOAP services?
Does anyone have links to documentation or guides on making the decision between REST vs. SOAP? I understand both of these but am looking for some references on the key decision points, eg, security, which may make you lean towards one or the other.
Google first hit seems pretty comprehensive. I think the problem here is there are too many advocates of one or the other, may be better of googling and getting more of a handle of the pro's/con's yourself and making your own decision. I know that sounds kinda lame, but ultimately these sort of design decisions fall do...
Guide to choosing between REST vs SOAP services? Does anyone have links to documentation or guides on making the decision between REST vs. SOAP? I understand both of these but am looking for some references on the key decision points, eg, security, which may make you lean towards one or the other.
TITLE: Guide to choosing between REST vs SOAP services? QUESTION: Does anyone have links to documentation or guides on making the decision between REST vs. SOAP? I understand both of these but am looking for some references on the key decision points, eg, security, which may make you lean towards one or the other. AN...
[ "architecture", "rest", "soap" ]
10
6
9,771
4
0
2008-08-26T19:46:56.553000
2008-08-26T19:53:04.103000
28,952
488,509
CPU utilization by database?
Is it possible to get a breakdown of CPU utilization by database? I'm ideally looking for a Task Manager type interface for SQL server, but instead of looking at the CPU utilization of each PID (like taskmgr ) or each SPID (like spwho2k5 ), I want to view the total CPU utilization of each database. Assume a single SQL ...
Sort of. Check this query out: SELECT total_worker_time/execution_count AS AvgCPU, total_worker_time AS TotalCPU, total_elapsed_time/execution_count AS AvgDuration, total_elapsed_time AS TotalDuration, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads, (total_logical_reads+total_physical_reads) AS ...
CPU utilization by database? Is it possible to get a breakdown of CPU utilization by database? I'm ideally looking for a Task Manager type interface for SQL server, but instead of looking at the CPU utilization of each PID (like taskmgr ) or each SPID (like spwho2k5 ), I want to view the total CPU utilization of each d...
TITLE: CPU utilization by database? QUESTION: Is it possible to get a breakdown of CPU utilization by database? I'm ideally looking for a Task Manager type interface for SQL server, but instead of looking at the CPU utilization of each PID (like taskmgr ) or each SPID (like spwho2k5 ), I want to view the total CPU uti...
[ "sql-server", "monitoring" ]
31
91
76,839
8
0
2008-08-26T19:48:09.437000
2009-01-28T17:20:34.043000
28,961
322,393
What's the best way to use web services in python?
I have a medium sized application that runs as a.net web-service which I do not control, and I want to create a loose pythonic API above it to enable easy scripting. I wanted to know what is the best/most practical solution for using web-services in python. Edit: I need to consume a complex soap WS and I have no contro...
Jython and IronPython give access to great Java &.NET SOAP libraries. If you need CPython, ZSI has been flaky for me, but it could be possible to use a tool like Robin to wrap a good C++ SOAP library such as gSOAP or Apache Axis C++
What's the best way to use web services in python? I have a medium sized application that runs as a.net web-service which I do not control, and I want to create a loose pythonic API above it to enable easy scripting. I wanted to know what is the best/most practical solution for using web-services in python. Edit: I nee...
TITLE: What's the best way to use web services in python? QUESTION: I have a medium sized application that runs as a.net web-service which I do not control, and I want to create a loose pythonic API above it to enable easy scripting. I wanted to know what is the best/most practical solution for using web-services in p...
[ "python", "web-services", "soap" ]
8
1
1,137
3
0
2008-08-26T19:49:54.517000
2008-11-26T22:34:53.517000
28,965
29,084
Checklist for Web Site Programming Vulnerabilities
Watching SO come online has been quite an education for me. I'd like to make a checklist of various vunerabilities and exploits used against web sites, and what programming techniques can be used to defend against them. What categories of vunerabilities? crashing site breaking into server breaking into other people's l...
From the Open Web Application Security Project: The OWASP Top Ten vulnerabilities (pdf) For a more painfully exhaustive list: Category:Vulnerability The top ten are: Cross-site scripting (XSS) Injection flaws (SQL injection, script injection) Malicious file execution Insecure direct object reference Cross-site request ...
Checklist for Web Site Programming Vulnerabilities Watching SO come online has been quite an education for me. I'd like to make a checklist of various vunerabilities and exploits used against web sites, and what programming techniques can be used to defend against them. What categories of vunerabilities? crashing site ...
TITLE: Checklist for Web Site Programming Vulnerabilities QUESTION: Watching SO come online has been quite an education for me. I'd like to make a checklist of various vunerabilities and exploits used against web sites, and what programming techniques can be used to defend against them. What categories of vunerabiliti...
[ "security", "defensive-programming" ]
17
12
1,960
9
0
2008-08-26T19:51:32.187000
2008-08-26T22:20:09.163000
29,004
29,032
Parsing XML using unix terminal
Sometimes I need to quickly extract some arbitrary data from XML files to put into a CSV format. What's your best practices for doing this in the Unix terminal? I would love some code examples, so for instance how can I get the following problem solved? Example XML input: My desired CSV output: Foo, Bar,
If you just want the name attributes of any element, here is a quick but incomplete solution. (Your example text is in the file example ) grep "name" example | cut -d"\"" -f2,2 | xargs -I{} echo "{},"
Parsing XML using unix terminal Sometimes I need to quickly extract some arbitrary data from XML files to put into a CSV format. What's your best practices for doing this in the Unix terminal? I would love some code examples, so for instance how can I get the following problem solved? Example XML input: My desired CSV ...
TITLE: Parsing XML using unix terminal QUESTION: Sometimes I need to quickly extract some arbitrary data from XML files to put into a CSV format. What's your best practices for doing this in the Unix terminal? I would love some code examples, so for instance how can I get the following problem solved? Example XML inpu...
[ "xml", "unix", "parsing", "shell", "csv" ]
15
7
50,656
9
0
2008-08-26T20:09:40.303000
2008-08-26T21:47:42.753000
29,011
30,719
Is there a way to combine named scopes into a new named scope?
I have class Foo < ActiveRecord::Base named_scope:a, lambda { |a|:conditions => {:a => a } } named_scope:b, lambda { |b|:conditions => {:b => b } } end I'd like class Foo < ActiveRecord::Base named_scope:ab, lambda { |a,b|:conditions => {:a => a,:b => b } } end but I'd prefer to do it in a DRY fashion. I can get the sa...
Well I'm still new to rails and I'm not sure exactly what you're going for here, but if you're just going for code reuse why not use a regular class method? def self.ab(a, b) a(a).b(b) end You could make that more flexible by taking *args instead of a and b, and then possibly make one or the other optional. If you're s...
Is there a way to combine named scopes into a new named scope? I have class Foo < ActiveRecord::Base named_scope:a, lambda { |a|:conditions => {:a => a } } named_scope:b, lambda { |b|:conditions => {:b => b } } end I'd like class Foo < ActiveRecord::Base named_scope:ab, lambda { |a,b|:conditions => {:a => a,:b => b } }...
TITLE: Is there a way to combine named scopes into a new named scope? QUESTION: I have class Foo < ActiveRecord::Base named_scope:a, lambda { |a|:conditions => {:a => a } } named_scope:b, lambda { |b|:conditions => {:b => b } } end I'd like class Foo < ActiveRecord::Base named_scope:ab, lambda { |a,b|:conditions => {:...
[ "ruby-on-rails", "rails-activerecord", "named-scope" ]
10
2
14,209
6
0
2008-08-26T20:13:46.020000
2008-08-27T17:50:49.600000
29,030
30,691
SharePoint SPContext.List in a custom application page
I have a custom SharePoint application page deployed to the _layouts folder. It's a custom "new form" for a custom content type. During my interactions with this page, I will need to add an item to my list. When the page first loads, I can use SPContext.Current.List to see the current list I'm working with. But after I...
Generally speaking I try and copy whatever approach the product group has taken when looking to add functionality of my own. In this case they add their own edit/view/add pages via the list definition itself. I built a solution that also needed its own custom "New" form, not open source unfortunately, though if you are...
SharePoint SPContext.List in a custom application page I have a custom SharePoint application page deployed to the _layouts folder. It's a custom "new form" for a custom content type. During my interactions with this page, I will need to add an item to my list. When the page first loads, I can use SPContext.Current.Lis...
TITLE: SharePoint SPContext.List in a custom application page QUESTION: I have a custom SharePoint application page deployed to the _layouts folder. It's a custom "new form" for a custom content type. During my interactions with this page, I will need to add an item to my list. When the page first loads, I can use SPC...
[ "sharepoint", "spcontext", "applicationpage" ]
1
2
3,779
4
0
2008-08-26T21:47:22.817000
2008-08-27T17:30:42.720000
29,040
425,518
Linq To SQL: Can I eager load only one field in a joined table?
I have one table "orders" with a foreing key "ProductID". I want to show the orders in a grid with the product name, without LazyLoad for better performance, but I if use DataLoadOptions it retrieves all Product fields, which seams like a overkill. Is there a way to retrieve only the Product name in the first query? Ca...
I get the solution in this other question Which.net ORM can deal with this scenario, that is related to the liammclennan answer but more clear (maybe the question was more clear too)
Linq To SQL: Can I eager load only one field in a joined table? I have one table "orders" with a foreing key "ProductID". I want to show the orders in a grid with the product name, without LazyLoad for better performance, but I if use DataLoadOptions it retrieves all Product fields, which seams like a overkill. Is ther...
TITLE: Linq To SQL: Can I eager load only one field in a joined table? QUESTION: I have one table "orders" with a foreing key "ProductID". I want to show the orders in a grid with the product name, without LazyLoad for better performance, but I if use DataLoadOptions it retrieves all Product fields, which seams like a...
[ ".net", "sql", "performance", "linq-to-sql" ]
1
0
1,182
3
0
2008-08-26T21:55:09.333000
2009-01-08T19:21:07.053000
29,044
29,046
Good Free Alternative To MS Access
Consider the need to develop a lightweight desktop DB application on the Microsoft platforms. It could be done fairly easily with MS Access but I'd like to be able to distribute it to others and I don't want to pay for a runtime license. Requirements: easy distribution to others no runtime licensing issues Consideratio...
One thing to keep in mind here is the MS Access product is much more than just the raw database engine. It provides a full application development platform, including form and menu designer, client application language and environment (VBA), and report designer. When you take all those things together, MS Access really...
Good Free Alternative To MS Access Consider the need to develop a lightweight desktop DB application on the Microsoft platforms. It could be done fairly easily with MS Access but I'd like to be able to distribute it to others and I don't want to pay for a runtime license. Requirements: easy distribution to others no ru...
TITLE: Good Free Alternative To MS Access QUESTION: Consider the need to develop a lightweight desktop DB application on the Microsoft platforms. It could be done fairly easily with MS Access but I'd like to be able to distribute it to others and I don't want to pay for a runtime license. Requirements: easy distributi...
[ "database", "ms-access", "desktop" ]
105
65
153,452
28
0
2008-08-26T21:57:21.340000
2008-08-26T21:59:10.120000
29,053
29,073
Javascript Browser Quirks - array.Length
Code: Unusual Array Lengths! Notice the extra comma in the array declaration. The code above gives different outputs for various browsers: Safari: 5 Firefox: 5 IE: 6 The extra comma in the array is being ignored by Safari and FF while IE treats it as another object in the array. On some search, I have found mixed opini...
It seems to me that the Firefox behavior is correct. What is the value of the 6th value in IE (sorry I don't have it handy to test). Since there is no actual value provided, I imagine it's filling it with something like 'null' which certainly doesn't seem to be what you intended to have happen when you created the arra...
Javascript Browser Quirks - array.Length Code: Unusual Array Lengths! Notice the extra comma in the array declaration. The code above gives different outputs for various browsers: Safari: 5 Firefox: 5 IE: 6 The extra comma in the array is being ignored by Safari and FF while IE treats it as another object in the array....
TITLE: Javascript Browser Quirks - array.Length QUESTION: Code: Unusual Array Lengths! Notice the extra comma in the array declaration. The code above gives different outputs for various browsers: Safari: 5 Firefox: 5 IE: 6 The extra comma in the array is being ignored by Safari and FF while IE treats it as another ob...
[ "javascript" ]
27
9
7,757
7
0
2008-08-26T22:00:38.773000
2008-08-26T22:13:41.083000
29,061
29,083
How do you use ssh in a shell script?
When I try to use an ssh command in a shell script, the command just sits there. Do you have an example of how to use ssh in a shell script?
Depends on what you want to do, and how you use it. If you just want to execute a command remotely and safely on another machine, just use ssh user@host command for example ssh user@host ls In order to do this safely you need to either ask the user for the password during runtime, or set up keys on the remote host.
How do you use ssh in a shell script? When I try to use an ssh command in a shell script, the command just sits there. Do you have an example of how to use ssh in a shell script?
TITLE: How do you use ssh in a shell script? QUESTION: When I try to use an ssh command in a shell script, the command just sits there. Do you have an example of how to use ssh in a shell script? ANSWER: Depends on what you want to do, and how you use it. If you just want to execute a command remotely and safely on a...
[ "bash", "shell", "ssh", "ksh", "rsh" ]
19
39
40,543
5
0
2008-08-26T22:05:37.310000
2008-08-26T22:19:48.573000
29,088
29,108
What is the difference between a group and match in .NET's RegEx?
What is the difference between a Group and a Match in.NET's RegEx?
A Match is an object that indicates a particular regular expression matched (a portion of) the target text. A Group indicates a portion of a match, if the original regular expression contained group markers (basically a pattern in parentheses). For example, with the following code: string text = "One car red car blue c...
What is the difference between a group and match in .NET's RegEx? What is the difference between a Group and a Match in.NET's RegEx?
TITLE: What is the difference between a group and match in .NET's RegEx? QUESTION: What is the difference between a Group and a Match in.NET's RegEx? ANSWER: A Match is an object that indicates a particular regular expression matched (a portion of) the target text. A Group indicates a portion of a match, if the origi...
[ ".net", "regex" ]
6
8
3,125
2
0
2008-08-26T22:23:25.757000
2008-08-26T22:33:04
29,099
29,274
What makes a language Object-Oriented?
Since debate without meaningful terms is meaningless, I figured I would point at the elephant in the room and ask: What exactly makes a language "object-oriented"? I'm not looking for a textbook answer here, but one based on your experiences with OO languages that work well in your domain, whatever it may be. A related...
Definitions for Object-Orientation are of course a huge can of worms, but here are my 2 cents: To me, Object-Orientation is all about objects that collaborate by sending messages. That is, to me, the single most important trait of an object-oriented language. If I had to put up an ordered list of all the features that ...
What makes a language Object-Oriented? Since debate without meaningful terms is meaningless, I figured I would point at the elephant in the room and ask: What exactly makes a language "object-oriented"? I'm not looking for a textbook answer here, but one based on your experiences with OO languages that work well in you...
TITLE: What makes a language Object-Oriented? QUESTION: Since debate without meaningful terms is meaningless, I figured I would point at the elephant in the room and ask: What exactly makes a language "object-oriented"? I'm not looking for a textbook answer here, but one based on your experiences with OO languages tha...
[ "language-agnostic", "oop", "programming-languages", "glossary" ]
37
32
26,250
16
0
2008-08-26T22:28:19.237000
2008-08-27T00:51:49.703000
29,100
109,932
How are you generating tests from specifications?
I came across a printed article by Bertrand Meyer where he states that tests can be generated from specifications. My development team does nothing like this, but it sounds like a good technique to consider. How are you generating tests from specifications? How would you describe the success your having in discovering ...
There are all sorts of ways to do it, ranging from what I'd consider an 'art form' (and not necessarily good art) all the way to mathematically derived tests from formal specifications. At the end of the day, your development team needs to decided on what they can do based on the schedule they are working with. That be...
How are you generating tests from specifications? I came across a printed article by Bertrand Meyer where he states that tests can be generated from specifications. My development team does nothing like this, but it sounds like a good technique to consider. How are you generating tests from specifications? How would yo...
TITLE: How are you generating tests from specifications? QUESTION: I came across a printed article by Bertrand Meyer where he states that tests can be generated from specifications. My development team does nothing like this, but it sounds like a good technique to consider. How are you generating tests from specificat...
[ "testing", "automated-tests", "specifications", "faults" ]
5
0
298
4
0
2008-08-26T22:28:22.530000
2008-09-21T01:24:22.607000
29,104
29,118
Requirements Gathering
How do you go about the requirements gathering phase? Does anyone have a good set of guidelines or tips to follow? What are some good questions to ask the stakeholders? I am currently working on a new project and there are a lot of unknowns. I am in the process of coming up with a list of questions to ask the stakehold...
You're almost certainly missing something. A lot of things, probably. Don't worry, it's ok. Even if you remembered everything and covered all the bases stakeholders aren't going to be able to give you very good, clear requirements without any point of reference. The best way to do this sort of thing is to get what you ...
Requirements Gathering How do you go about the requirements gathering phase? Does anyone have a good set of guidelines or tips to follow? What are some good questions to ask the stakeholders? I am currently working on a new project and there are a lot of unknowns. I am in the process of coming up with a list of questio...
TITLE: Requirements Gathering QUESTION: How do you go about the requirements gathering phase? Does anyone have a good set of guidelines or tips to follow? What are some good questions to ask the stakeholders? I am currently working on a new project and there are a lot of unknowns. I am in the process of coming up with...
[ "requirements-management" ]
29
20
23,156
20
0
2008-08-26T22:31:13.007000
2008-08-26T22:36:16.053000