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
104,009
104,449
How can I get full string value of variable in VC6 watch window?
I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there is a better way??
For large strings, you're pretty much stuck with the memory window - the tooltip would truncate eventually. Fortunately, the memory window is easy to get data from - I tend to show it in 8-byte chunks so its easy to manage, find your string data and cut&paste the lot into a blank window, then use alt+drag to select col...
How can I get full string value of variable in VC6 watch window? I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there is a better way??
TITLE: How can I get full string value of variable in VC6 watch window? QUESTION: I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there ...
[ "c++", "debugging", "visual-c++-6" ]
6
4
4,015
6
0
2008-09-19T17:44:49.427000
2008-09-19T18:46:07.767000
104,055
107,520
How to list the contents of a package using YUM?
I know how to use rpm to list the contents of a package ( rpm -qpil package.rpm ). However, this requires knowing the location of the.rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?
There is a package called yum-utils that builds on YUM and contains a tool called repoquery that can do this. $ repoquery --help | grep -E "list\ files" -l, --list list files in this package/group Combined into one example: $ repoquery -l time /usr/bin/time /usr/share/doc/time-1.7 /usr/share/doc/time-1.7/COPYING /usr/s...
How to list the contents of a package using YUM? I know how to use rpm to list the contents of a package ( rpm -qpil package.rpm ). However, this requires knowing the location of the.rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to ...
TITLE: How to list the contents of a package using YUM? QUESTION: I know how to use rpm to list the contents of a package ( rpm -qpil package.rpm ). However, this requires knowing the location of the.rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How c...
[ "linux", "fedora", "rpm", "yum", "package-managers" ]
355
462
406,450
7
0
2008-09-19T17:49:27.733000
2008-09-20T07:31:24.900000
104,057
104,109
SQL Server 2005 - clicking on job->Properties yields "New Job" window
Recently, I've started having a problem with my SQL Server 2005 client running on Windows XP where right-clicking on any job and selecting Properties instead brings me to the New Job window. Also, if I select "View History", I get the history for all jobs, instead of the one I right-clicked on. This happened to me once...
I would suggest the following path: Make sure that you have current backups for the server Try to get a clean install of the XP service pack Try reinstalling the client tools on the machine If that fails, try to install (or reinstall) SP2 for SQL Server
SQL Server 2005 - clicking on job->Properties yields "New Job" window Recently, I've started having a problem with my SQL Server 2005 client running on Windows XP where right-clicking on any job and selecting Properties instead brings me to the New Job window. Also, if I select "View History", I get the history for all...
TITLE: SQL Server 2005 - clicking on job->Properties yields "New Job" window QUESTION: Recently, I've started having a problem with my SQL Server 2005 client running on Windows XP where right-clicking on any job and selecting Properties instead brings me to the New Job window. Also, if I select "View History", I get t...
[ "sql-server-2005" ]
1
0
1,306
1
0
2008-09-19T17:49:44.067000
2008-09-19T17:57:38.210000
104,063
104,387
System.Convert.ToInt vs (int)
I noticed in another post, someone had done something like: double d = 3.1415; int i = Convert.ToInt32(Math.Floor(d)); Why did they use the convert function, rather than: double d = 3.1415; int i = (int)d; which has an implicit floor and convert. Also, more concerning, I noticed in some production code I was reading: d...
Casting to int is implicit truncation, not implicit flooring: double d = -3.14; int i = (int)d; // i == -3 I choose Math.Floor or Math.Round to make my intentions more explicit.
System.Convert.ToInt vs (int) I noticed in another post, someone had done something like: double d = 3.1415; int i = Convert.ToInt32(Math.Floor(d)); Why did they use the convert function, rather than: double d = 3.1415; int i = (int)d; which has an implicit floor and convert. Also, more concerning, I noticed in some pr...
TITLE: System.Convert.ToInt vs (int) QUESTION: I noticed in another post, someone had done something like: double d = 3.1415; int i = Convert.ToInt32(Math.Floor(d)); Why did they use the convert function, rather than: double d = 3.1415; int i = (int)d; which has an implicit floor and convert. Also, more concerning, I ...
[ "c#", "types" ]
12
12
7,973
4
0
2008-09-19T17:50:35.483000
2008-09-19T18:36:58.820000
104,068
104,174
How Do VB.NET Optional Parameters work 'Under the hood'? Are they CLS-Compliant?
Let's say we have the following method declaration: Public Function MyMethod(ByVal param1 As Integer, _ Optional ByVal param2 As Integer = 0, _ Optional ByVal param3 As Integer = 1) As Integer Return param1 + param2 + param3 End Function How does VB.NET make the optional parameters work within the confines of the CLR?...
Interestingly, this is the decompiled C# code, obtained via reflector. public int MyMethod(int param1, [Optional, DefaultParameterValue(0)] int param2, [Optional, DefaultParameterValue(1)] int param3) { return ((param1 + param2) + param3); } Notice the Optional and DefaultParameterValue attributes. Try putting them in ...
How Do VB.NET Optional Parameters work 'Under the hood'? Are they CLS-Compliant? Let's say we have the following method declaration: Public Function MyMethod(ByVal param1 As Integer, _ Optional ByVal param2 As Integer = 0, _ Optional ByVal param3 As Integer = 1) As Integer Return param1 + param2 + param3 End Function...
TITLE: How Do VB.NET Optional Parameters work 'Under the hood'? Are they CLS-Compliant? QUESTION: Let's say we have the following method declaration: Public Function MyMethod(ByVal param1 As Integer, _ Optional ByVal param2 As Integer = 0, _ Optional ByVal param3 As Integer = 1) As Integer Return param1 + param2 + p...
[ ".net", "vb.net", "clr", "cil" ]
5
7
4,742
2
0
2008-09-19T17:51:26.400000
2008-09-19T18:10:05.357000
104,076
104,098
Is it possible to tell if a user has viewed a portion of the page?
As the title says on a website is it possible to tell if a user has viewed a portion of the page?
Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image file..forgot the name of the technique.. Update: It is called Web Bug..A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows checking tha...
Is it possible to tell if a user has viewed a portion of the page? As the title says on a website is it possible to tell if a user has viewed a portion of the page?
TITLE: Is it possible to tell if a user has viewed a portion of the page? QUESTION: As the title says on a website is it possible to tell if a user has viewed a portion of the page? ANSWER: Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image fil...
[ "pageviews" ]
0
3
1,098
6
0
2008-09-19T17:52:38.973000
2008-09-19T17:55:57.077000
104,099
111,304
When to use Windows Workflow Foundation?
Some things are easier to implement just by hand (code), but some are easier through WF. It looks like WF can be used to create (almost) any kind of algorithm. So (theoretically) I can do all my logic in WF, but it's probably a bad idea to do it for all projects. In what situations is it a good idea to use WF and when ...
You may need WF only if any of the following are true: You have a long-running process. You have a process that changes frequently. You want a visual model of the process. For more details, see Paul Andrew's post: What to use Windows Workflow Foundation for? Please do not confuse or relate WF with visual programming of...
When to use Windows Workflow Foundation? Some things are easier to implement just by hand (code), but some are easier through WF. It looks like WF can be used to create (almost) any kind of algorithm. So (theoretically) I can do all my logic in WF, but it's probably a bad idea to do it for all projects. In what situati...
TITLE: When to use Windows Workflow Foundation? QUESTION: Some things are easier to implement just by hand (code), but some are easier through WF. It looks like WF can be used to create (almost) any kind of algorithm. So (theoretically) I can do all my logic in WF, but it's probably a bad idea to do it for all project...
[ ".net", "workflow", "workflow-foundation" ]
156
128
72,387
11
0
2008-09-19T17:56:02.117000
2008-09-21T16:05:10.367000
104,106
104,134
Lowest cost Windows VPS hosting?
For a while, I thought I'd host stuff at home because I can do whatever I want. However, hurricane Ike knocked out my power for a week, and I've finally realized this situation won't work. I have extremely low traffice websites (20 visitors/day), so I don't need tons of CPU or bandwidth. What cheap options are there fo...
RapidVPS offers windows hosting. $29,99/month https://www.rapidvps.com/index.php?page=Hosting.Windows.Specs I am a customer of their linux vps hosting and have had zero problems.
Lowest cost Windows VPS hosting? For a while, I thought I'd host stuff at home because I can do whatever I want. However, hurricane Ike knocked out my power for a week, and I've finally realized this situation won't work. I have extremely low traffice websites (20 visitors/day), so I don't need tons of CPU or bandwidth...
TITLE: Lowest cost Windows VPS hosting? QUESTION: For a while, I thought I'd host stuff at home because I can do whatever I want. However, hurricane Ike knocked out my power for a week, and I've finally realized this situation won't work. I have extremely low traffice websites (20 visitors/day), so I don't need tons o...
[ "windows", "hosting", "vps" ]
4
2
3,602
4
0
2008-09-19T17:57:21.410000
2008-09-19T18:02:09.370000
104,115
1,372,958
How do you increase the maximum heap size for the javac process in Borland JBuilder 2005/2006
In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac. Please keep t...
did you find a good solution for that problem? I have the same problem and the only solution I found is the following: The environment variable JAVA_TOOL_OPTIONS can be used to provide parameters for the JVM. http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#tooloptions I have created a batch file "JBuilderw....
How do you increase the maximum heap size for the javac process in Borland JBuilder 2005/2006 In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and...
TITLE: How do you increase the maximum heap size for the javac process in Borland JBuilder 2005/2006 QUESTION: In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuil...
[ "javac", "heap-memory", "jbuilder" ]
2
7
9,789
6
0
2008-09-19T17:58:16.337000
2009-09-03T11:51:46.567000
104,121
112,921
Maximum # of Results in a Sitecore Droplink field?
In Sitecore 6, one of my templates contains a "Droplink" field bound to the results of a particular sitecore query. This query currently returns approximately 200 items. When I look at an item that implements this template in the content editor, I can only see the first 50 items in the field's dropdown list. How do I d...
There is a setting in the web.config that controls the max number of items that can be returned by a query: By default, it's set to 100 so I'm not quite sure why your query is only returning 50, perhaps someone else changed the setting? Also, be wary of a performance hit when returning more than 100 items. Depending on...
Maximum # of Results in a Sitecore Droplink field? In Sitecore 6, one of my templates contains a "Droplink" field bound to the results of a particular sitecore query. This query currently returns approximately 200 items. When I look at an item that implements this template in the content editor, I can only see the firs...
TITLE: Maximum # of Results in a Sitecore Droplink field? QUESTION: In Sitecore 6, one of my templates contains a "Droplink" field bound to the results of a particular sitecore query. This query currently returns approximately 200 items. When I look at an item that implements this template in the content editor, I can...
[ "asp.net", "sitecore" ]
4
8
2,671
1
0
2008-09-19T18:00:10.983000
2008-09-22T02:47:14.957000
104,122
104,150
Finding GDI/User resource usage from a crash dump
I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is not supported on XP or Vista. Does anyone have any pointers for fin...
There was a MSDN Magazine article from several years ago that talked about GDI leaks. This points to several different places with good information. In WinDbg, you may also try the!poolused command for some information. Finding resource leaks in from a crash dump (post-mortem) can be difficult -- if it was always the s...
Finding GDI/User resource usage from a crash dump I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is not supported on ...
TITLE: Finding GDI/User resource usage from a crash dump QUESTION: I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is...
[ "windows", "resources", "gdi", "windbg" ]
6
4
3,389
3
0
2008-09-19T18:00:40.967000
2008-09-19T18:05:33.030000
104,158
104,197
What is "Best Practice" For Comparing Two Instances of a Reference Type?
I came across this recently, up until now I have been happily overriding the equality operator ( == ) and/or Equals method in order to see if two references types actually contained the same data (i.e. two different instances that look the same). I have been using this even more since I have been getting more in to aut...
It looks like you're coding in C#, which has a method called Equals that your class should implement, should you want to compare two objects using some other metric than "are these two pointers (because object handles are just that, pointers) to the same memory address?". I grabbed some sample code from here: class Two...
What is "Best Practice" For Comparing Two Instances of a Reference Type? I came across this recently, up until now I have been happily overriding the equality operator ( == ) and/or Equals method in order to see if two references types actually contained the same data (i.e. two different instances that look the same). ...
TITLE: What is "Best Practice" For Comparing Two Instances of a Reference Type? QUESTION: I came across this recently, up until now I have been happily overriding the equality operator ( == ) and/or Equals method in order to see if two references types actually contained the same data (i.e. two different instances tha...
[ "c#", ".net", "comparison", "operator-overloading", "equality" ]
48
23
34,893
10
0
2008-09-19T18:07:02.760000
2008-09-19T18:13:21.217000
104,177
104,222
How do I embed an image in a .NET HTML Mail Message?
I have an HTML Mail template, with a place holder for the image. I am getting the image I need to send out of a database and saving it into a photo directory. I need to embed the image in the HTML Message. I have explored using an AlternateView: AlternateView htmlView = AlternateView.CreateAlternateViewFromString(" ");...
Try this: LinkedResource objLinkedRes = new LinkedResource( Server.MapPath(".") + "\\fuzzydev-logo.jpg", "image/jpeg"); objLinkedRes.ContentId = "fuzzydev-logo"; AlternateView objHTLMAltView = AlternateView.CreateAlternateViewFromString( " ", new System.Net.Mime.ContentType("text/html")); objHTLMAltView.LinkedResources...
How do I embed an image in a .NET HTML Mail Message? I have an HTML Mail template, with a place holder for the image. I am getting the image I need to send out of a database and saving it into a photo directory. I need to embed the image in the HTML Message. I have explored using an AlternateView: AlternateView htmlVie...
TITLE: How do I embed an image in a .NET HTML Mail Message? QUESTION: I have an HTML Mail template, with a place holder for the image. I am getting the image I need to send out of a database and saving it into a photo directory. I need to embed the image in the HTML Message. I have explored using an AlternateView: Alt...
[ "c#", ".net", "html" ]
23
22
12,776
1
0
2008-09-19T18:10:26.917000
2008-09-19T18:17:01.707000
104,188
104,652
How to remove published wmi schema?
I've published schema, and no longer have the dll's that contained the wmi provider that the schema was published from. How can I remove the schema?
If you are talking about the assembly from your other question, you can simply use wbemtest.exe: Connect to Root namespace Enum instances... button (Superclass name: __Namespace) Delete instance named Test or MyTest That will delete the entire namespace including all the classes you created. If you want to delete a cla...
How to remove published wmi schema? I've published schema, and no longer have the dll's that contained the wmi provider that the schema was published from. How can I remove the schema?
TITLE: How to remove published wmi schema? QUESTION: I've published schema, and no longer have the dll's that contained the wmi provider that the schema was published from. How can I remove the schema? ANSWER: If you are talking about the assembly from your other question, you can simply use wbemtest.exe: Connect to ...
[ "wmi" ]
2
4
2,319
1
0
2008-09-19T18:12:08.817000
2008-09-19T19:11:28.627000
104,196
104,241
Benefits of static code analysis
What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards.
There are all kinds of benefits: If there are anti-patterns in your code, you can be warned about it. There are certain metrics (such as McCabe's Cyclomatic Complexity) that tell useful things about source code. You can also get great stuff like call-graphs, and class diagrams from static analysis. Those are wonderful ...
Benefits of static code analysis What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards.
TITLE: Benefits of static code analysis QUESTION: What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards. ANSWER: There are all kinds of benefits: If there are anti-pat...
[ "code-analysis" ]
11
11
11,717
10
0
2008-09-19T18:12:55.960000
2008-09-19T18:18:30.253000
104,223
106,120
cURL in PHP returns different data in _FILE and _RETURNTRANSFER
I have noticed that cURL in PHP returns different data when told to output to a file via CURLOPT_FILE as it does when told to send the output to a string via CURLOPT_RETURNTRANSFER. _RETURNTRANSFER seems to strip newlines and extra white space as if parsing it for display as standard HTML code. _FILE on the other hand ...
Turns out, the error is not in what was being returned, but in the way I was going about parsing it. \r\n is not parsed the way I expected when put in single quotes, switching to double quotes solved my problem. I was not aware that this made a difference inside function calls like that. This works just fine: $cresult ...
cURL in PHP returns different data in _FILE and _RETURNTRANSFER I have noticed that cURL in PHP returns different data when told to output to a file via CURLOPT_FILE as it does when told to send the output to a string via CURLOPT_RETURNTRANSFER. _RETURNTRANSFER seems to strip newlines and extra white space as if parsin...
TITLE: cURL in PHP returns different data in _FILE and _RETURNTRANSFER QUESTION: I have noticed that cURL in PHP returns different data when told to output to a file via CURLOPT_FILE as it does when told to send the output to a string via CURLOPT_RETURNTRANSFER. _RETURNTRANSFER seems to strip newlines and extra white ...
[ "php", "curl" ]
1
1
1,094
3
0
2008-09-19T18:17:02.457000
2008-09-19T22:23:49.290000
104,224
104,272
How do you troubleshoot WPF UI problems?
I'm working on a WPF application that sometimes exhibits odd problems and appears to hang in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below. My first thought was that the animations of some b...
Try removing the borderless behavior of your window and see if that helps. Also, are you BeginInvoke()'ing or Invoke()'ing any long running operations? Another thing to look at: When you break into your code, try looking at threads other than your main thread. One of them may be blocking the UI thread.
How do you troubleshoot WPF UI problems? I'm working on a WPF application that sometimes exhibits odd problems and appears to hang in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below. My first ...
TITLE: How do you troubleshoot WPF UI problems? QUESTION: I'm working on a WPF application that sometimes exhibits odd problems and appears to hang in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as describe...
[ "wpf", "debugging", "user-interface", "xaml" ]
11
6
6,699
5
0
2008-09-19T18:17:20.753000
2008-09-19T18:21:30.417000
104,225
104,325
Has TRUE always had a non-zero value?
I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I've worked with, if you could even get a value for a boolean, that the value for FALSE is 0. Did TRUE used to be 0? If so, when did we switch?
The 0 / non-0 thing your coworker is confused about is probably referring to when people use numeric values as return value indicating success, not truth (i.e. in bash scripts and some styles of C/C++). Using 0 = success allows for a much greater precision in specifying causes of failure (e.g. 1 = missing file, 2 = mis...
Has TRUE always had a non-zero value? I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I've worked with, if you could even get a value for a boolean, that the value for FALSE is 0. Did TRUE used to be 0? If so, when did we switch?
TITLE: Has TRUE always had a non-zero value? QUESTION: I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I've worked with, if you could even get a value for a boolean, that the value for FALSE is 0. Did TRUE used to be 0? If so, when ...
[ "language-agnostic", "boolean" ]
22
31
15,887
22
0
2008-09-19T18:17:22.423000
2008-09-19T18:28:37.280000
104,230
104,515
how do I query multiple SQL tables for a specific key-value pair?
Situation: A PHP application with multiple installable modules creates a new table in database for each, in the style of mod_A, mod_B, mod_C etc. Each has the column section_id. Now, I am looking for all entries for a specific section_id, and I'm hoping there's another way besides "Select * from mod_a, mod_b, mod_c... ...
If the tables are changing over time, you can inline code gen your solution in an SP (pseudo code - you'll have to fill in): SET @sql = '' DECLARE CURSOR FOR SELECT t.[name] AS TABLE_NAME FROM sys.tables t WHERE t.[name] LIKE 'SOME_PATTERN_TO_IDENTIFY_THE_TABLES' -- or this DECLARE CURSOR FOR SELECT t.[name] AS TABLE_...
how do I query multiple SQL tables for a specific key-value pair? Situation: A PHP application with multiple installable modules creates a new table in database for each, in the style of mod_A, mod_B, mod_C etc. Each has the column section_id. Now, I am looking for all entries for a specific section_id, and I'm hoping ...
TITLE: how do I query multiple SQL tables for a specific key-value pair? QUESTION: Situation: A PHP application with multiple installable modules creates a new table in database for each, in the style of mod_A, mod_B, mod_C etc. Each has the column section_id. Now, I am looking for all entries for a specific section_i...
[ "sql", "lazy-evaluation" ]
1
1
2,585
8
0
2008-09-19T18:17:47.367000
2008-09-19T18:54:01.837000
104,238
104,295
How do I match one letter or many in a PHP preg_split style regex
I'm having an issue with my regex. I want to capture <% some stuff %> and i need what's inside the <% and the %> This regex works quite well for that. $matches = preg_split("/<%[\s]*(.*?)[\s]*%>/i",$markup,-1,(PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)); I also want to catch &% some stuff %&gt; so I need to captur...
In your case, it's better to use preg_match with its additional parameter and parenthesis: preg_match("#((?:<|<)%)([\s]*(?:[^ø]*)[\s]*?)(%(?:>|>))#i",$markup, $out); print_r($out); Array ( [0] => <% your stuff %> [1] => <% [2] => your stuff [3] => %> ) By the way, check this online tool to debug PHP regexp, it's so us...
How do I match one letter or many in a PHP preg_split style regex I'm having an issue with my regex. I want to capture <% some stuff %> and i need what's inside the <% and the %> This regex works quite well for that. $matches = preg_split("/<%[\s]*(.*?)[\s]*%>/i",$markup,-1,(PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTU...
TITLE: How do I match one letter or many in a PHP preg_split style regex QUESTION: I'm having an issue with my regex. I want to capture <% some stuff %> and i need what's inside the <% and the %> This regex works quite well for that. $matches = preg_split("/<%[\s]*(.*?)[\s]*%>/i",$markup,-1,(PREG_SPLIT_NO_EMPTY | PREG...
[ "php", "regex" ]
2
9
1,280
5
0
2008-09-19T18:18:13.730000
2008-09-19T18:25:04.073000
104,248
104,627
Is it possible in W3C's XML Schema language (XSD) to allow a series of elements to be in any order but still limit occurrences?
I know about all and choice, but they don't account for a case where I do want some elements to be able to occur more than once, such as: I could use sequence, but I'd prefer to allow these children to be in any order. I could use any, but then I couldn't have more than one ThingC. I could use choice, but then I couldn...
That's right: you can't do what you want to do in XML Schema, but you can in RELAX NG with: Your options in XML Schema are: add a preprocessing step that normalises your input XML into a particular order, and then use use, and add extra validation (for example using Schematron) to check that there's not more than one o...
Is it possible in W3C's XML Schema language (XSD) to allow a series of elements to be in any order but still limit occurrences? I know about all and choice, but they don't account for a case where I do want some elements to be able to occur more than once, such as: I could use sequence, but I'd prefer to allow these ch...
TITLE: Is it possible in W3C's XML Schema language (XSD) to allow a series of elements to be in any order but still limit occurrences? QUESTION: I know about all and choice, but they don't account for a case where I do want some elements to be able to occur more than once, such as: I could use sequence, but I'd prefer...
[ "xml", "schema", "xsd" ]
2
6
782
1
0
2008-09-19T18:19:12.637000
2008-09-19T19:08:58.057000
104,254
105,403
java.io.Console support in Eclipse IDE
I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the java.io.Console class to manage output and, more importantly, user input. The problem is that System.console() returns null when an application is run "through" Eclipse. Eclipse run the program on a background process, rat...
I assume you want to be able to use step-through debugging from Eclipse. You can just run the classes externally by setting the built classes in the bin directories on the JRE classpath. java -cp workspace\p1\bin;workspace\p2\bin foo.Main You can debug using the remote debugger and taking advantage of the class files b...
java.io.Console support in Eclipse IDE I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the java.io.Console class to manage output and, more importantly, user input. The problem is that System.console() returns null when an application is run "through" Eclipse. Eclipse run t...
TITLE: java.io.Console support in Eclipse IDE QUESTION: I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the java.io.Console class to manage output and, more importantly, user input. The problem is that System.console() returns null when an application is run "through" Ecli...
[ "java", "eclipse", "console", "java-io" ]
107
49
97,910
10
0
2008-09-19T18:19:31.153000
2008-09-19T20:37:36.253000
104,267
104,950
xul: open a local html file relative to "myapp.xul" in xul browser
in short: is there any way to find the current directory full path of a xul application? long explanation: I would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul application. The html files reside outside the folder of my xul application...
I found a workaround: http://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO i cannot exactly open a file using a relative path "../../index.html" but i can get the app directory and work with that. var DIR_SERVICE = new Components.Constructor("@mozilla.org/file/directory_service;1", "nsIProperties"); var path = (...
xul: open a local html file relative to "myapp.xul" in xul browser in short: is there any way to find the current directory full path of a xul application? long explanation: I would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul applicat...
TITLE: xul: open a local html file relative to "myapp.xul" in xul browser QUESTION: in short: is there any way to find the current directory full path of a xul application? long explanation: I would like to open some html files in a xul browser application. The path to the html files should be set programmatically fro...
[ "javascript", "file-io", "xul" ]
3
3
3,469
3
0
2008-09-19T18:20:53.803000
2008-09-19T19:48:13.173000
104,270
104,326
Flash vs. Silverlight
We are building a training website where we need to track viewers watching videos and store detailed info about the viewing (when they paused, if they watched the whole video etc) What should we consider when deciding between the two technologies? I forgot to add. This is for an in house app. We have complete control o...
having had to make the call between silverlight and flash recently for a very intense interactive component, i had to go with flash. and for one reason: online support. If i have a problem building something in flash, chances are pretty good that I'll find help somewhere online from someone thats overcome the same issu...
Flash vs. Silverlight We are building a training website where we need to track viewers watching videos and store detailed info about the viewing (when they paused, if they watched the whole video etc) What should we consider when deciding between the two technologies? I forgot to add. This is for an in house app. We h...
TITLE: Flash vs. Silverlight QUESTION: We are building a training website where we need to track viewers watching videos and store detailed info about the viewing (when they paused, if they watched the whole video etc) What should we consider when deciding between the two technologies? I forgot to add. This is for an ...
[ "flash", "silverlight" ]
4
8
2,762
17
0
2008-09-19T18:21:22.133000
2008-09-19T18:28:38.417000
104,291
104,441
Trialware/licensing strategies
I wrote a utility for photographers that I plan to sell online pretty cheap ($10). I'd like to allow the user to try the software out for a week or so before asking for a license. Since this is a personal project and the software is not very expensive, I don't think that purchasing the services of professional licensin...
EDIT: You can make your current licensing scheme considerable more difficult to crack by storing the registry information in the Local Security Authority (LSA). Most users will not be able to remove your key information from there. A search for LSA on MSDN should give you the information you need. Opinions on licensing...
Trialware/licensing strategies I wrote a utility for photographers that I plan to sell online pretty cheap ($10). I'd like to allow the user to try the software out for a week or so before asking for a license. Since this is a personal project and the software is not very expensive, I don't think that purchasing the se...
TITLE: Trialware/licensing strategies QUESTION: I wrote a utility for photographers that I plan to sell online pretty cheap ($10). I'd like to allow the user to try the software out for a week or so before asking for a license. Since this is a personal project and the software is not very expensive, I don't think that...
[ "licensing", "trialware" ]
13
15
4,943
10
0
2008-09-19T18:24:27.897000
2008-09-19T18:43:44.810000
104,292
104,506
How do I change the build directory that MSBuild uses under Team Foundation Build?
I'm getting the following error when trying to build my app using Team Foundation Build: C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: Cannot write to the output file "obj\Release\Company.Redacted.BlahBlah.Localization.Subsystems. Startup_Shutdown_Processing.StartupShutdownPro...
You need to edit the build working directory of your Build Agent so that the begging path is a little smaller. To edit the build agent, right click on the "Builds" node and select "Manage Build Agents..." I personally use something like c:\bw\$(BuildDefinitionId). $(BuildDefinitionId) translates into the id of the buil...
How do I change the build directory that MSBuild uses under Team Foundation Build? I'm getting the following error when trying to build my app using Team Foundation Build: C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: Cannot write to the output file "obj\Release\Company.Redact...
TITLE: How do I change the build directory that MSBuild uses under Team Foundation Build? QUESTION: I'm getting the following error when trying to build my app using Team Foundation Build: C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: Cannot write to the output file "obj\Rele...
[ "tfs", "msbuild", "tfsbuild" ]
8
16
15,244
2
0
2008-09-19T18:24:29.737000
2008-09-19T18:53:16.033000
104,293
104,410
How do I run another web site or web service side by side with Sharepoint?
I'm getting a 404 error when trying to run another web service on an IIS 6 server which is also running Sharepoint 2003. I'm pretty sure this is an issue with sharepoint taking over IIS configuration. Is there a way to make a certain web service or web site be ignored by whatever Sharepoint is doing?
I found the command line solution. STSADM.EXE -o addpath -url http://localhost/ -type exclusion
How do I run another web site or web service side by side with Sharepoint? I'm getting a 404 error when trying to run another web service on an IIS 6 server which is also running Sharepoint 2003. I'm pretty sure this is an issue with sharepoint taking over IIS configuration. Is there a way to make a certain web service...
TITLE: How do I run another web site or web service side by side with Sharepoint? QUESTION: I'm getting a 404 error when trying to run another web service on an IIS 6 server which is also running Sharepoint 2003. I'm pretty sure this is an issue with sharepoint taking over IIS configuration. Is there a way to make a c...
[ "sharepoint", "iis" ]
1
2
729
4
0
2008-09-19T18:24:58.363000
2008-09-19T18:39:43.477000
104,322
104,389
How do you install Boost on MacOS?
How do you install Boost on MacOS? Right now I can't find bjam for the Mac.
Download MacPorts, and run the following command: sudo port install boost
How do you install Boost on MacOS? How do you install Boost on MacOS? Right now I can't find bjam for the Mac.
TITLE: How do you install Boost on MacOS? QUESTION: How do you install Boost on MacOS? Right now I can't find bjam for the Mac. ANSWER: Download MacPorts, and run the following command: sudo port install boost
[ "c++", "macos", "boost" ]
213
164
268,384
11
0
2008-09-19T18:28:16.017000
2008-09-19T18:37:27.117000
104,329
104,546
Performance of try-catch in php
What kind of performance implications are there to consider when using try-catch statements in php 5? I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks many of the niceties of php 5. So, I don't...
One thing to consider is that the cost of a try block where no exception is thrown is a different question from the cost of actually throwing and catching an exception. If exceptions are only thrown in failure cases, you almost certainly don't care about performance, since you won't fail very many times per execution o...
Performance of try-catch in php What kind of performance implications are there to consider when using try-catch statements in php 5? I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks many of th...
TITLE: Performance of try-catch in php QUESTION: What kind of performance implications are there to consider when using try-catch statements in php 5? I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 an...
[ "php", "performance", "exception", "try-catch" ]
67
74
32,996
9
0
2008-09-19T18:29:00.977000
2008-09-19T18:58:02.090000
104,330
104,386
SQL Query Help: Transforming Dates In A Non-Trivial Way
I have a table with a "Date" column, and I would like to do a query that does the following: If the date is a Monday, Tuesday, Wednesday, or Thursday, the displayed date should be shifted up by 1 day, as in DATEADD(day, 1, [Date]) On the other hand, if it is a Friday, the displayed date should be incremented by 3 days ...
Here is how I would do it. I do recommend a function like above if you will be using this in other places. CASE WHEN DATEPART(dw, [Date]) IN (2,3,4,5) THEN DATEADD(d, 1, [Date]) WHEN DATEPART(dw, [Date]) = 6 THEN DATEADD(d, 3, [Date]) ELSE [Date] END AS [ConvertedDate]
SQL Query Help: Transforming Dates In A Non-Trivial Way I have a table with a "Date" column, and I would like to do a query that does the following: If the date is a Monday, Tuesday, Wednesday, or Thursday, the displayed date should be shifted up by 1 day, as in DATEADD(day, 1, [Date]) On the other hand, if it is a Fri...
TITLE: SQL Query Help: Transforming Dates In A Non-Trivial Way QUESTION: I have a table with a "Date" column, and I would like to do a query that does the following: If the date is a Monday, Tuesday, Wednesday, or Thursday, the displayed date should be shifted up by 1 day, as in DATEADD(day, 1, [Date]) On the other ha...
[ "sql", "sql-server", "date", "sql-server-2000", "dateadd" ]
3
5
1,871
12
0
2008-09-19T18:29:01.053000
2008-09-19T18:36:54.653000
104,339
138,452
Objective-C switch using objects?
I'm doing some Objective-C programming that involves parsing an NSXmlDocument and populating an objects properties from the result. First version looked like this: if([elementName compare:@"companyName"] == 0) [character setCorporationName:currentElementText]; else if([elementName compare:@"corporationID"] == 0) [chara...
I hope you'll all forgive me for going out on a limb here, but I would like to address the more general question of parsing XML documents in Cocoa without the need of if-else statements. The question as originally stated assigns the current element text to an instance variable of the character object. As jmah pointed o...
Objective-C switch using objects? I'm doing some Objective-C programming that involves parsing an NSXmlDocument and populating an objects properties from the result. First version looked like this: if([elementName compare:@"companyName"] == 0) [character setCorporationName:currentElementText]; else if([elementName comp...
TITLE: Objective-C switch using objects? QUESTION: I'm doing some Objective-C programming that involves parsing an NSXmlDocument and populating an objects properties from the result. First version looked like this: if([elementName compare:@"companyName"] == 0) [character setCorporationName:currentElementText]; else if...
[ "objective-c", "design-patterns", "switch-statement" ]
14
12
31,153
14
0
2008-09-19T18:29:45.187000
2008-09-26T09:26:59.737000
104,380
104,431
Tips on refactoring an outdated database schema
Being stuck with a legacy database schema that no longer reflects your data model is every developer's nightmare. Yet with all the talk of refactoring code for maintainability I have not heard much of refactoring outdated database schemas. What are some tips on how to transition to a better schema without breaking all ...
Here's a whole catalogue of database refactorings: http://databaserefactoring.com/
Tips on refactoring an outdated database schema Being stuck with a legacy database schema that no longer reflects your data model is every developer's nightmare. Yet with all the talk of refactoring code for maintainability I have not heard much of refactoring outdated database schemas. What are some tips on how to tra...
TITLE: Tips on refactoring an outdated database schema QUESTION: Being stuck with a legacy database schema that no longer reflects your data model is every developer's nightmare. Yet with all the talk of refactoring code for maintainability I have not heard much of refactoring outdated database schemas. What are some ...
[ "database", "refactoring", "schema" ]
14
5
3,049
8
0
2008-09-19T18:36:14.390000
2008-09-19T18:42:46.153000
104,395
104,401
Information on how to use margins
I need some info on how to use margins and how exactly padding works. For example: Should I put a line to occupy the whole width of the page (no matter what resolution is used to display the web page) letting just a small border on each side, how could I achieve this?
Have a look at this: http://redmelon.net/tstme/box_model/ Basically, an element consists of content, surrounded by its padding, then the border, then the margin. Background images only extend as far as the border. Margins are best described as 'the whitespace around this element'. But have a look at the URL above, and ...
Information on how to use margins I need some info on how to use margins and how exactly padding works. For example: Should I put a line to occupy the whole width of the page (no matter what resolution is used to display the web page) letting just a small border on each side, how could I achieve this?
TITLE: Information on how to use margins QUESTION: I need some info on how to use margins and how exactly padding works. For example: Should I put a line to occupy the whole width of the page (no matter what resolution is used to display the web page) letting just a small border on each side, how could I achieve this?...
[ "html", "css", "layout", "padding", "margins" ]
2
9
458
3
0
2008-09-19T18:38:00.890000
2008-09-19T18:38:32.933000
104,420
104,436
How do I generate all permutations of a list?
How do I generate all the permutations of a list? For example: permutations([]) [] permutations([1]) [1] permutations([1, 2]) [1, 2] [2, 1] permutations([1, 2, 3]) [1, 2, 3] [1, 3, 2] [2, 1, 3] [2, 3, 1] [3, 1, 2] [3, 2, 1]
Use itertools.permutations from the standard library: import itertools list(itertools.permutations([1, 2, 3])) Adapted from here is a demonstration of how itertools.permutations might be implemented: def permutations(elements): if len(elements) <= 1: yield elements return for perm in permutations(elements[1:]): for i i...
How do I generate all permutations of a list? How do I generate all the permutations of a list? For example: permutations([]) [] permutations([1]) [1] permutations([1, 2]) [1, 2] [2, 1] permutations([1, 2, 3]) [1, 2, 3] [1, 3, 2] [2, 1, 3] [2, 3, 1] [3, 1, 2] [3, 2, 1]
TITLE: How do I generate all permutations of a list? QUESTION: How do I generate all the permutations of a list? For example: permutations([]) [] permutations([1]) [1] permutations([1, 2]) [1, 2] [2, 1] permutations([1, 2, 3]) [1, 2, 3] [1, 3, 2] [2, 1, 3] [2, 3, 1] [3, 1, 2] [3, 2, 1] ANSWER: Use itertools.permut...
[ "python", "algorithm", "permutation", "combinatorics" ]
854
757
1,094,232
41
0
2008-09-19T18:41:03.397000
2008-09-19T18:43:09.380000
104,439
104,447
How do I download the source for BIRT?
The Eclipse projects are all stored in the Eclipse Foundation CVS servers. Using the source is a great way to debug your code and to figure out how to do new things. Unfortunately in a large software project like BIRT, it can be difficult to know which projects and versions are required for a particular build. So what ...
Okay, I know the answer to this one... Eclipse has a feature named Team Project Sets which allows you to define a collection of projects, stored in various version control systems that can be downloaded as a package. I have published a collection of team project set files that can be used to get the BIRT source. The fi...
How do I download the source for BIRT? The Eclipse projects are all stored in the Eclipse Foundation CVS servers. Using the source is a great way to debug your code and to figure out how to do new things. Unfortunately in a large software project like BIRT, it can be difficult to know which projects and versions are re...
TITLE: How do I download the source for BIRT? QUESTION: The Eclipse projects are all stored in the Eclipse Foundation CVS servers. Using the source is a great way to debug your code and to figure out how to do new things. Unfortunately in a large software project like BIRT, it can be difficult to know which projects a...
[ "eclipse", "cvs", "birt" ]
5
1
3,474
2
0
2008-09-19T18:43:20.987000
2008-09-19T18:45:38.767000
104,448
104,852
Flash - Drag Two Movieclips at Once?
I'm trying to create a map application similar to this. Click the SWF Preview tab on the left of the image. Specifically, noticed how you can pan around, and the clickable buttons on the map move with it. Basically, how do they do that? My application has a map that you can click and pan around using a startDrag() func...
Simple. Put your map and the clickable buttons into a new MovieClip, you could call it interactiveMapContainer or something similar, then call your startDrag method on interactiveMapContainer and you'll still be able to click the buttons once you've dragged it about. Jakub Kotrla's method will also work very well, alth...
Flash - Drag Two Movieclips at Once? I'm trying to create a map application similar to this. Click the SWF Preview tab on the left of the image. Specifically, noticed how you can pan around, and the clickable buttons on the map move with it. Basically, how do they do that? My application has a map that you can click an...
TITLE: Flash - Drag Two Movieclips at Once? QUESTION: I'm trying to create a map application similar to this. Click the SWF Preview tab on the left of the image. Specifically, noticed how you can pan around, and the clickable buttons on the map move with it. Basically, how do they do that? My application has a map tha...
[ "flash", "actionscript-3" ]
0
3
4,835
6
0
2008-09-19T18:46:02.027000
2008-09-19T19:35:48.193000
104,458
104,589
Applying Styles To ListItems in CheckBoxList
How can styles be applied to CheckBoxList ListItems. Unlike other controls, such as the Repeater where you can specify, you can't seem to specify a style for each individual control. Is there some sort of work around?
You can add Attributes to ListItems programmatically as follows. Say you've got a CheckBoxList and you are adding ListItems. You can add Attributes along the way. ListItem li = new ListItem("Richard Byrd", "11"); li.Selected = false; li.Attributes.Add("Style", "color: red;"); CheckBoxList1.Items.Add(li); This will make...
Applying Styles To ListItems in CheckBoxList How can styles be applied to CheckBoxList ListItems. Unlike other controls, such as the Repeater where you can specify, you can't seem to specify a style for each individual control. Is there some sort of work around?
TITLE: Applying Styles To ListItems in CheckBoxList QUESTION: How can styles be applied to CheckBoxList ListItems. Unlike other controls, such as the Repeater where you can specify, you can't seem to specify a style for each individual control. Is there some sort of work around? ANSWER: You can add Attributes to List...
[ "asp.net", "html", "controls", "coding-style" ]
27
27
61,012
6
0
2008-09-19T18:47:18.873000
2008-09-19T19:03:40.423000
104,483
104,530
For std::map, how will insert behave if it has to resize the container and the memory is not available?
For std::map, how will insert behave if it has to resize the container and the memory is not available?
STL map does not have to "resize" container. map (just like list) is a node based container; each insert allocates memory. That said, out of memory situation is handled just like any other out-of-memory situation in C++: it throws a std::bad_alloc. STL containers with default allocators don't do anything fancy, they al...
For std::map, how will insert behave if it has to resize the container and the memory is not available? For std::map, how will insert behave if it has to resize the container and the memory is not available?
TITLE: For std::map, how will insert behave if it has to resize the container and the memory is not available? QUESTION: For std::map, how will insert behave if it has to resize the container and the memory is not available? ANSWER: STL map does not have to "resize" container. map (just like list) is a node based con...
[ "insert", "stdmap" ]
4
6
2,896
3
0
2008-09-19T18:50:32.203000
2008-09-19T18:56:11.957000
104,485
104,499
Is there a way to force a style to a div element which already has a style="" attribute
I'm trying to skin HTML output which I don't have control over. One of the elements is a div with a style="overflow: auto" attribute. Is there a way in CSS to force that div to use overflow: hidden;?
You can add!important to the end of your style, like this: element { overflow: hidden!important; } This is something you should not rely on normally, but in your case that's the best option. Changing the value in Javascript strays from the best practice of separating markup, presentation, and behavior (html/css/javascr...
Is there a way to force a style to a div element which already has a style="" attribute I'm trying to skin HTML output which I don't have control over. One of the elements is a div with a style="overflow: auto" attribute. Is there a way in CSS to force that div to use overflow: hidden;?
TITLE: Is there a way to force a style to a div element which already has a style="" attribute QUESTION: I'm trying to skin HTML output which I don't have control over. One of the elements is a div with a style="overflow: auto" attribute. Is there a way in CSS to force that div to use overflow: hidden;? ANSWER: You c...
[ "html", "css" ]
36
94
116,476
6
0
2008-09-19T18:50:48.443000
2008-09-19T18:52:21.123000
104,487
104,573
Mod-rewrites on apache: change all URLs
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file. Also, I like to match things like '/config/new' to 'config_n...
Try: RewriteRule ^/?(\w+)/?$ $1.php the $1 is the content of the first captured string in brackets. The brackets around the 2nd slash are not needed. edit: For the other match, try this: RewriteRule ^/?(\w+)/(\w+)/?$ $1_$2.php
Mod-rewrites on apache: change all URLs Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file. Also, I like to matc...
TITLE: Mod-rewrites on apache: change all URLs QUESTION: Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file. Al...
[ "regex", "apache", "mod-rewrite" ]
1
2
823
3
0
2008-09-19T18:51:08.317000
2008-09-19T19:01:50.193000
104,494
105,116
Cannot store load test results in a TFS 2005 results store
I've setup a results store and when I publish results of a load test, I can't view the published test details. From the test run section of the build report I click on the published build and when I choose View Test Results Details from the Test Runs shortcut menu I get an error that the test results details cannot be ...
The reports aren't going to be available until after the data has been copied to the data warehouse. This can typically take up to one hour to do. See http://msdn.microsoft.com/en-us/library/ms404692(VS.80).aspx
Cannot store load test results in a TFS 2005 results store I've setup a results store and when I publish results of a load test, I can't view the published test details. From the test run section of the build report I click on the published build and when I choose View Test Results Details from the Test Runs shortcut m...
TITLE: Cannot store load test results in a TFS 2005 results store QUESTION: I've setup a results store and when I publish results of a load test, I can't view the published test details. From the test run section of the build report I click on the published build and when I choose View Test Results Details from the Te...
[ "visual-studio-2005", "tfs", "load-testing" ]
1
0
293
1
0
2008-09-19T18:51:45.803000
2008-09-19T20:10:09.173000
104,505
134,614
What's the best freely available C# wrapper for BITS?
BITS, the Windows background intelligent transfer service. Looks like there are a few C# wrappers around that manage the interop to BITS, does anybody have any opinions on the best one?
I found problems with using the Managed_BITS codeproject article and I found an even better wrapper: http://www.codeplex.com/sharpbits http://nuget.org/packages/SharpBITS Less code, a lot cleaner and unlike the codeproject, it did not hide away those parts of the BITS interface that I actually need to use.
What's the best freely available C# wrapper for BITS? BITS, the Windows background intelligent transfer service. Looks like there are a few C# wrappers around that manage the interop to BITS, does anybody have any opinions on the best one?
TITLE: What's the best freely available C# wrapper for BITS? QUESTION: BITS, the Windows background intelligent transfer service. Looks like there are a few C# wrappers around that manage the interop to BITS, does anybody have any opinions on the best one? ANSWER: I found problems with using the Managed_BITS codeproj...
[ "c#", "windows", "interop", "microsoft-bits" ]
8
6
2,259
2
0
2008-09-19T18:53:01.620000
2008-09-25T17:12:53.620000
104,516
104,645
Calling PHP functions within HEREDOC strings
In PHP, the HEREDOC string declarations are really useful for outputting a block of html. You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you have to put your expression inside {} braces. In PHP 5, it is possible to actually make function calls within...
I would not use HEREDOC at all for this, personally. It just doesn't make for a good "template building" system. All your HTML is locked down in a string which has several disadvantages No option for WYSIWYG No code completion for HTML from IDEs Output (HTML) locked to logic files You end up having to use hacks like wh...
Calling PHP functions within HEREDOC strings In PHP, the HEREDOC string declarations are really useful for outputting a block of html. You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you have to put your expression inside {} braces. In PHP 5, it is po...
TITLE: Calling PHP functions within HEREDOC strings QUESTION: In PHP, the HEREDOC string declarations are really useful for outputting a block of html. You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you have to put your expression inside {} braces. ...
[ "php", "string", "heredoc" ]
106
57
93,850
18
0
2008-09-19T18:54:02.397000
2008-09-19T19:10:54.043000
104,520
182,330
WPF Validation for the whole form
I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WPF!! I can do this using my own Val...
A WPF application should disable the button to submit a form iff the entered data is not valid. You can achieve this by implementing the IDataErrorInfo interface on your business object, using Bindings with ValidatesOnDataErrors =true. For customizing the look of individual controls in the case of errors, set a Validat...
WPF Validation for the whole form I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WP...
TITLE: WPF Validation for the whole form QUESTION: I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 l...
[ "wpf", "validation" ]
17
28
30,379
5
0
2008-09-19T18:54:18.467000
2008-10-08T11:50:38.813000
104,525
104,762
Warm SQL Backup
We have a warm sql backup. full backup nightly, txn logs shipped every so often during the day and restored. I need to move the data files to another disk. These DB's are in a "warm backup" state (such that I can't unmark them as read-only - "Error 5063: Database ' ' is in warm standby. A warm-standby database is read-...
The only solution I know is to create a complete backup of your active database and restore this backup to a copy of the database in a 'warm backup' state. First create a backup from the active db: backup database activedb to disk='somefile' Then restore the backup on another sql server. If needed you can use the WITH ...
Warm SQL Backup We have a warm sql backup. full backup nightly, txn logs shipped every so often during the day and restored. I need to move the data files to another disk. These DB's are in a "warm backup" state (such that I can't unmark them as read-only - "Error 5063: Database ' ' is in warm standby. A warm-standby d...
TITLE: Warm SQL Backup QUESTION: We have a warm sql backup. full backup nightly, txn logs shipped every so often during the day and restored. I need to move the data files to another disk. These DB's are in a "warm backup" state (such that I can't unmark them as read-only - "Error 5063: Database ' ' is in warm standby...
[ "sql-server", "sql-server-2000", "backup" ]
1
2
1,748
2
0
2008-09-19T18:55:16.827000
2008-09-19T19:23:07.600000
104,550
104,576
Do I have always use .css files?
Are.css files always needed? Or may I have a.css "basic" file and define other style items inside the HTML page? Does padding, borders and so on always have to be defined in a.css file that is stored separately, or may I embed then into an HTML page?
It is technically possible to use inline CSS formatting exclusively and have no external stylesheet. You can also embed the stylesheet within the HTML document. The best practice in web design is to separate out the CSS into a separate stylesheet. The reason for this is that the CSS stylesheet exists for the purpose of...
Do I have always use .css files? Are.css files always needed? Or may I have a.css "basic" file and define other style items inside the HTML page? Does padding, borders and so on always have to be defined in a.css file that is stored separately, or may I embed then into an HTML page?
TITLE: Do I have always use .css files? QUESTION: Are.css files always needed? Or may I have a.css "basic" file and define other style items inside the HTML page? Does padding, borders and so on always have to be defined in a.css file that is stored separately, or may I embed then into an HTML page? ANSWER: It is tec...
[ "html", "css" ]
4
18
1,897
13
0
2008-09-19T18:58:58.627000
2008-09-19T19:02:06.717000
104,554
106,291
What's the best source to learn about database replication mechanisms?
What's the widest overview and where are the deepest analysis of different replication methods and problems?
I would start here: wikipedia's replication article, then read a couple of related papers on general replication techniques such as the replicated distributed state machine approach ( Paxos (pdf)) and epidemic replication ( Google 'Epidemic Algorithms for Replicated Database Maintenance' ). For a practical overview, pe...
What's the best source to learn about database replication mechanisms? What's the widest overview and where are the deepest analysis of different replication methods and problems?
TITLE: What's the best source to learn about database replication mechanisms? QUESTION: What's the widest overview and where are the deepest analysis of different replication methods and problems? ANSWER: I would start here: wikipedia's replication article, then read a couple of related papers on general replication ...
[ "database", "computer-science", "replication" ]
1
2
692
4
0
2008-09-19T18:59:30.777000
2008-09-19T23:04:47.130000
104,568
104,814
Accessing Greasemonkey metadata from within your script?
Is there any way that my script can retrieve metadata values that are declared in its own header? I don't see anything promising in the API, except perhaps GM_getValue(). That would of course involve a special name syntax. I have tried, for example: GM_getValue("@name"). The motivation here is to avoid redundant specif...
This answer is out of date: As of Greasemonkey 0.9.16 (Feb 2012) please see Brock's answer regarding GM_info Yes. A very simple example is: var metadata=<> // ==UserScript== // @name Reading metadata // @namespace http://www.afunamatata.com/greasemonkey/ // @description Read in metadata from the header // @version 0.9 ...
Accessing Greasemonkey metadata from within your script? Is there any way that my script can retrieve metadata values that are declared in its own header? I don't see anything promising in the API, except perhaps GM_getValue(). That would of course involve a special name syntax. I have tried, for example: GM_getValue("...
TITLE: Accessing Greasemonkey metadata from within your script? QUESTION: Is there any way that my script can retrieve metadata values that are declared in its own header? I don't see anything promising in the API, except perhaps GM_getValue(). That would of course involve a special name syntax. I have tried, for exam...
[ "javascript", "metadata", "greasemonkey" ]
12
7
3,043
3
0
2008-09-19T19:01:05.767000
2008-09-19T19:28:40.303000
104,579
281,337
CVS and Visual Studio 2008 - integration options
I'd like to increase developers' "comfort level" in our team a bit. We are using Visual Studio 2008 and TortoiseCVS + WinCVS, but no integration as of yet. In your CVS/Visual Studio experience, what is the best integration tool in terms of "supports basic CVS functionality add/diff/update/commit/annotate/etc", "works o...
You might be stuck with one of those MSSCCI bridges you mentioned. As it is, not too many people still use CVS, especially those using Visual Studio (most of them seem to use Team System's revision control, or Subversion). There's always the possibility of hacking together your own macros to take care of CVS operations...
CVS and Visual Studio 2008 - integration options I'd like to increase developers' "comfort level" in our team a bit. We are using Visual Studio 2008 and TortoiseCVS + WinCVS, but no integration as of yet. In your CVS/Visual Studio experience, what is the best integration tool in terms of "supports basic CVS functionali...
TITLE: CVS and Visual Studio 2008 - integration options QUESTION: I'd like to increase developers' "comfort level" in our team a bit. We are using Visual Studio 2008 and TortoiseCVS + WinCVS, but no integration as of yet. In your CVS/Visual Studio experience, what is the best integration tool in terms of "supports bas...
[ "visual-studio", "cvs", "integration" ]
3
2
5,722
3
0
2008-09-19T19:02:31.237000
2008-11-11T16:13:27.167000
104,583
718,000
Does the iPhone SDK allow hardware access to the dock connector?
I haven't been able to find any documentation on hardware access via the iPhone SDK so far. I'd like to be able to send signals via the dock connector to an external hardware device but haven't seen any evidence that this is accessible via the SDK (not interested in possibilities on jailbroken iPhones). Anyone have any...
To get the Hardware specs for the Doc connector you need to be part of the made for ipod/iphone program. But if you just want to talk to an already existing piece of hardware that supports it, the 3.0 SDK will let you access it. I have tried applying to the made for ipod/iphone program as a individual/hobbyist, but hav...
Does the iPhone SDK allow hardware access to the dock connector? I haven't been able to find any documentation on hardware access via the iPhone SDK so far. I'd like to be able to send signals via the dock connector to an external hardware device but haven't seen any evidence that this is accessible via the SDK (not in...
TITLE: Does the iPhone SDK allow hardware access to the dock connector? QUESTION: I haven't been able to find any documentation on hardware access via the iPhone SDK so far. I'd like to be able to send signals via the dock connector to an external hardware device but haven't seen any evidence that this is accessible v...
[ "iphone", "hardware" ]
7
3
9,103
4
0
2008-09-19T19:02:59.473000
2009-04-04T23:05:32.593000
104,587
105,481
How to configure ResourceBundleViewResolver in Spring Framework 2.0
Everywhere I look always the same explanation pop ups. Configure the view resolver. And then put a file in the classpath named view.properties with some key-value pairs (don't mind the names). logout.class=org.springframework.web.servlet.view.JstlView logout.url=WEB-INF/jsp/logout.jsp What does logout.class and logout....
ResourceBundleViewResolver uses the key/vals in views.properties to create view beans (actually created in an internal application context). The name of the view bean in your example will be "logout" and it will be a bean of type JstlView. JstlView has an attribute called URL which will be set to "WEB-INF/jsp/logout.js...
How to configure ResourceBundleViewResolver in Spring Framework 2.0 Everywhere I look always the same explanation pop ups. Configure the view resolver. And then put a file in the classpath named view.properties with some key-value pairs (don't mind the names). logout.class=org.springframework.web.servlet.view.JstlView ...
TITLE: How to configure ResourceBundleViewResolver in Spring Framework 2.0 QUESTION: Everywhere I look always the same explanation pop ups. Configure the view resolver. And then put a file in the classpath named view.properties with some key-value pairs (don't mind the names). logout.class=org.springframework.web.serv...
[ "java", "spring", "frameworks" ]
4
5
13,204
2
0
2008-09-19T19:03:12.673000
2008-09-19T20:45:16.593000
104,592
109,228
What's a good alternative to security questions?
From Wired magazine:...the Palin hack didn't require any real skill. Instead, the hacker simply reset Palin's password using her birthdate, ZIP code and information about where she met her spouse -- the security question on her Yahoo account, which was answered (Wasilla High) by a simple Google search. We cannot trust ...
Out-of-band communication is the way to go. For instance, sending a temporary password in SMS may be acceptable (depending on the system). I've seen this implemented often by telecoms, where SMS is cheap/free/part of business, and the user's cellphone number is pre-registered... Banks often require a phone call to/from...
What's a good alternative to security questions? From Wired magazine:...the Palin hack didn't require any real skill. Instead, the hacker simply reset Palin's password using her birthdate, ZIP code and information about where she met her spouse -- the security question on her Yahoo account, which was answered (Wasilla ...
TITLE: What's a good alternative to security questions? QUESTION: From Wired magazine:...the Palin hack didn't require any real skill. Instead, the hacker simply reset Palin's password using her birthdate, ZIP code and information about where she met her spouse -- the security question on her Yahoo account, which was ...
[ "security", "authentication", "passwords" ]
18
17
7,672
21
0
2008-09-19T19:03:50.987000
2008-09-20T20:15:38.590000
104,599
104,709
Sort on a string that may contain a number
I need to write a Java Comparator class that compares Strings, however with one twist. If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on the numeric values of those integers. For example, I want the ...
The Alphanum Algorithm From the website "People sort strings with numbers differently than software. Most sorting algorithms compare ASCII values, which produces an ordering that is inconsistent with human logic. Here's how to fix it." Edit: Here's a link to the Java Comparator Implementation from that site.
Sort on a string that may contain a number I need to write a Java Comparator class that compares Strings, however with one twist. If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on the numeric values ...
TITLE: Sort on a string that may contain a number QUESTION: I need to write a Java Comparator class that compares Strings, however with one twist. If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on t...
[ "java", "algorithm", "string", "sorting", "comparison" ]
88
110
96,666
25
0
2008-09-19T19:05:21.060000
2008-09-19T19:17:14.230000
104,603
104,664
Accessing a Collection Through Reflection
Is there a way to iterate (through foreach preferably) over a collection using reflection? I'm iterating over the properties in an object using reflection, and when the program gets to a type that is a collection, I'd like it to iterate over the contents of the collection and be able to access the objects in the collec...
I had this issue, but instead of using reflection, i ended up just checking if it was IEnumerable. All collections implement that. if (item is IEnumerable) { foreach (object o in (item as IEnumerable)) { } } else { // reflect over item }
Accessing a Collection Through Reflection Is there a way to iterate (through foreach preferably) over a collection using reflection? I'm iterating over the properties in an object using reflection, and when the program gets to a type that is a collection, I'd like it to iterate over the contents of the collection and b...
TITLE: Accessing a Collection Through Reflection QUESTION: Is there a way to iterate (through foreach preferably) over a collection using reflection? I'm iterating over the properties in an object using reflection, and when the program gets to a type that is a collection, I'd like it to iterate over the contents of th...
[ "c#", "reflection", "collections" ]
32
38
35,632
9
0
2008-09-19T19:06:01.837000
2008-09-19T19:12:19.263000
104,612
104,628
Run MySQLDump without Locking Tables
I want to copy a live production database into my local development database. Is there a way to do this without locking the production database? I'm currently using: mysqldump -u root --password=xxx -h xxx my_db1 | mysql -u root --password=xxx -h localhost my_db1 But it's locking each table as it runs.
Does the --lock-tables=false option work? According to the man page, if you are dumping InnoDB tables you can use the --single-transaction option: --lock-tables, -l Lock all tables before dumping them. The tables are locked with READ LOCAL to allow concurrent inserts in the case of MyISAM tables. For transactional tab...
Run MySQLDump without Locking Tables I want to copy a live production database into my local development database. Is there a way to do this without locking the production database? I'm currently using: mysqldump -u root --password=xxx -h xxx my_db1 | mysql -u root --password=xxx -h localhost my_db1 But it's locking ea...
TITLE: Run MySQLDump without Locking Tables QUESTION: I want to copy a live production database into my local development database. Is there a way to do this without locking the production database? I'm currently using: mysqldump -u root --password=xxx -h xxx my_db1 | mysql -u root --password=xxx -h localhost my_db1 B...
[ "mysql" ]
519
742
484,402
14
0
2008-09-19T19:07:09.293000
2008-09-19T19:09:05.623000
104,617
104,860
What is a good tutorial/howto on .net / c# socket programming
I'm porting old VB6 code that uses the Winsock control to C#. I haven't done any socket programming and I wonder if anyone has a good reference/tutorial/howto that I can use to start getting up to speed. I'm appealing to the hive mind while I proceed with my generally unproductive googling. I'm using UDP, not TCP at th...
The August 2005 MSDN Magazine had an article about System.Net.Sockets and WinSock: http://msdn.microsoft.com/en-us/magazine/cc300760.aspx
What is a good tutorial/howto on .net / c# socket programming I'm porting old VB6 code that uses the Winsock control to C#. I haven't done any socket programming and I wonder if anyone has a good reference/tutorial/howto that I can use to start getting up to speed. I'm appealing to the hive mind while I proceed with my...
TITLE: What is a good tutorial/howto on .net / c# socket programming QUESTION: I'm porting old VB6 code that uses the Winsock control to C#. I haven't done any socket programming and I wonder if anyone has a good reference/tutorial/howto that I can use to start getting up to speed. I'm appealing to the hive mind while...
[ "c#", "sockets", "network-programming", "winsock" ]
8
4
20,911
4
0
2008-09-19T19:07:38.263000
2008-09-19T19:36:31.140000
104,618
105,559
What does -> mean in F#?
I've been trying to get into F# on and off for a while but I keep getting put off. Why? Because no matter which 'beginners' resource I try to look at I see very simple examples that start using the operator ->. However, nowhere have I found as yet that provides a clear simple explanation of what this operator means. It...
'->' is not an operator. It appears in the F# syntax in a number of places, and its meaning depends on how it is used as part of a larger construct. Inside a type, '->' describes function types as people have described above. For example let f: int -> int =... says that 'f' is a function that takes an int and returns a...
What does -> mean in F#? I've been trying to get into F# on and off for a while but I keep getting put off. Why? Because no matter which 'beginners' resource I try to look at I see very simple examples that start using the operator ->. However, nowhere have I found as yet that provides a clear simple explanation of wha...
TITLE: What does -> mean in F#? QUESTION: I've been trying to get into F# on and off for a while but I keep getting put off. Why? Because no matter which 'beginners' resource I try to look at I see very simple examples that start using the operator ->. However, nowhere have I found as yet that provides a clear simple ...
[ "f#", "functional-programming" ]
28
51
6,912
9
0
2008-09-19T19:07:50.307000
2008-09-19T20:56:26.237000
104,620
347,630
Any good SQL Anywhere database schema comparison tools?
Are there any good database schema comparison tools out there that support Sybase SQL Anywhere version 10? I've seen a litany of them for SQL Server, a few for MySQL and Oracle, but nothing that supports SQL Anywhere correctly. I tried using DB Solo, but it turned all my non-unique indexes into unique ones, and I didn'...
If you are willing to download SQL Anywhere Version 11, and Compare It!, check out the comparison technique shown here: http://sqlanywhere.blogspot.com/2008/08/comparing-database-schemas.html You don't have to upgrade your SQL Anywhere Version 10 database.
Any good SQL Anywhere database schema comparison tools? Are there any good database schema comparison tools out there that support Sybase SQL Anywhere version 10? I've seen a litany of them for SQL Server, a few for MySQL and Oracle, but nothing that supports SQL Anywhere correctly. I tried using DB Solo, but it turned...
TITLE: Any good SQL Anywhere database schema comparison tools? QUESTION: Are there any good database schema comparison tools out there that support Sybase SQL Anywhere version 10? I've seen a litany of them for SQL Server, a few for MySQL and Oracle, but nothing that supports SQL Anywhere correctly. I tried using DB S...
[ "sql", "comparison", "schema", "sqlanywhere" ]
7
4
6,681
9
0
2008-09-19T19:07:54.923000
2008-12-07T14:23:50.430000
104,640
177,213
How can I disable the eclipse server startup timeout?
By default when using a webapp server in Eclipse Web Tools, the server startup will fail after a timeout of 45 seconds. I can increase this timeout in the server instance properties, but I don't see a way to disable the timeout entirely (useful when debugging application startup). Is there a way to do this?
In Eclipse Indigo, you can edit the default timeout by double-clicking on the server in the "servers" view and changing the timeout for start (see graphic). Save your changes, and you're good to go!
How can I disable the eclipse server startup timeout? By default when using a webapp server in Eclipse Web Tools, the server startup will fail after a timeout of 45 seconds. I can increase this timeout in the server instance properties, but I don't see a way to disable the timeout entirely (useful when debugging applic...
TITLE: How can I disable the eclipse server startup timeout? QUESTION: By default when using a webapp server in Eclipse Web Tools, the server startup will fail after a timeout of 45 seconds. I can increase this timeout in the server instance properties, but I don't see a way to disable the timeout entirely (useful whe...
[ "eclipse", "eclipse-wtp" ]
62
99
61,558
8
0
2008-09-19T19:10:41.267000
2008-10-07T04:08:30.633000
104,661
104,689
What was the first version of MS Office to officially support Unicode?
I am doing some research on Unicode for a white-paper I am writing. Does anyone remember the first version of MS Office on the Windows platform that was fully Unicode compliant? Not having much luck Googling this answer out of the net.
office 97: "The universal character set provided by Unicode overcomes this problem. Office 97 was the first version of Office to support Unicode in all applications except Microsoft Access and Microsoft Outlook®. In Office 2000, Access and Microsoft Publisher gain Unicode support. Microsoft FrontPage® 2000 also support...
What was the first version of MS Office to officially support Unicode? I am doing some research on Unicode for a white-paper I am writing. Does anyone remember the first version of MS Office on the Windows platform that was fully Unicode compliant? Not having much luck Googling this answer out of the net.
TITLE: What was the first version of MS Office to officially support Unicode? QUESTION: I am doing some research on Unicode for a white-paper I am writing. Does anyone remember the first version of MS Office on the Windows platform that was fully Unicode compliant? Not having much luck Googling this answer out of the ...
[ "unicode", "ms-office" ]
0
2
714
2
0
2008-09-19T19:12:11.247000
2008-09-19T19:14:53.783000
104,674
104,702
Why should events in C# take (sender, EventArgs)?
It's known that you should declare events that take as parameters (object sender, EventArgs args). Why?
This allows the consuming developer the ability to write a single event handler for multiple events, regardless of sender or event. Edit: Why would you need a different pattern? You can inherit EventArgs to provide any amount of data, and changing the pattern is only going to serve to confuse and frustrate any develope...
Why should events in C# take (sender, EventArgs)? It's known that you should declare events that take as parameters (object sender, EventArgs args). Why?
TITLE: Why should events in C# take (sender, EventArgs)? QUESTION: It's known that you should declare events that take as parameters (object sender, EventArgs args). Why? ANSWER: This allows the consuming developer the ability to write a single event handler for multiple events, regardless of sender or event. Edit: W...
[ "c#", ".net", "events" ]
42
22
19,428
10
0
2008-09-19T19:13:14.787000
2008-09-19T19:16:27.913000
104,733
104,766
Web application to user instant messaging
What options are available for receiving instant alerts from web applications? I have a time sensitive web application I need to tend to (approving expediated purchase order requests). I have thought of being notified by e-mail and SMS. Are there any programs to let my website send a popup window directly to my screen?...
If you have your application open and you want a popup to appear, you could have a javascript timer that does an ajax style poll of your server every so often to see if there is a notification it needs to post. You could then throw up a pop up with the notification?
Web application to user instant messaging What options are available for receiving instant alerts from web applications? I have a time sensitive web application I need to tend to (approving expediated purchase order requests). I have thought of being notified by e-mail and SMS. Are there any programs to let my website ...
TITLE: Web application to user instant messaging QUESTION: What options are available for receiving instant alerts from web applications? I have a time sensitive web application I need to tend to (approving expediated purchase order requests). I have thought of being notified by e-mail and SMS. Are there any programs ...
[ "messaging" ]
1
1
1,255
5
0
2008-09-19T19:19:55.020000
2008-09-19T19:23:23.527000
104,747
104,961
How to determine order for new item?
I have a members table in MySQL CREATE TABLE `members` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(65) collate utf8_unicode_ci NOT NULL, `order` tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB; And I would like to let users order the members how they like. I'm storing th...
You can do the SELECT as part of the INSERT, such as: INSERT INTO members SELECT 0, "new member", max(`order`)+1 FROM members; Keep in mind that you are going to want to have an index on the order column to make the SELECT part optimized. In addition, you might want to reconsider the tinyint for order, unless you only ...
How to determine order for new item? I have a members table in MySQL CREATE TABLE `members` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(65) collate utf8_unicode_ci NOT NULL, `order` tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB; And I would like to let users order the ...
TITLE: How to determine order for new item? QUESTION: I have a members table in MySQL CREATE TABLE `members` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(65) collate utf8_unicode_ci NOT NULL, `order` tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB; And I would like to le...
[ "php", "mysql" ]
0
4
278
6
0
2008-09-19T19:21:16.403000
2008-09-19T19:50:13.697000
104,764
104,876
Asp.net c# and logging ip access on every page and frequency
Are there any prebuilt modules for this? Is there an event thats called everytime a page is loaded? I'm just trying to secure one of my more important admin sections.
As blowdart said, simple IP Address logging is handled by IIS already. Simply right-click on the Website in Internet Information Services (IIS) Manager tool, go to the Web Site tab, and check the Enable Logging box. You can customize what information is logged also. If you want to restrict the site or even a folder of ...
Asp.net c# and logging ip access on every page and frequency Are there any prebuilt modules for this? Is there an event thats called everytime a page is loaded? I'm just trying to secure one of my more important admin sections.
TITLE: Asp.net c# and logging ip access on every page and frequency QUESTION: Are there any prebuilt modules for this? Is there an event thats called everytime a page is loaded? I'm just trying to secure one of my more important admin sections. ANSWER: As blowdart said, simple IP Address logging is handled by IIS alr...
[ "c#", "logging", "ip-address" ]
0
3
3,792
4
0
2008-09-19T19:23:10.893000
2008-09-19T19:38:44.817000
104,791
105,501
Direct Path Load of TimeStamp Data With SQL*LDR
The SQL-LDR documentation states that you need to do a convetional Path Load: When you want to apply SQL functions to data fields. SQL functions are not available during a direct path load I have TimeStamp data stored in a CSV file that I'm loading with SQL-LDR by describing the fields as such: STARTTIME "To_TimeStamp(...
Here is an example of someone successfully direct loading timestamp data: Loading Data (Part 4): sqlldr (direct, skip_index_maintainance)
Direct Path Load of TimeStamp Data With SQL*LDR The SQL-LDR documentation states that you need to do a convetional Path Load: When you want to apply SQL functions to data fields. SQL functions are not available during a direct path load I have TimeStamp data stored in a CSV file that I'm loading with SQL-LDR by describ...
TITLE: Direct Path Load of TimeStamp Data With SQL*LDR QUESTION: The SQL-LDR documentation states that you need to do a convetional Path Load: When you want to apply SQL functions to data fields. SQL functions are not available during a direct path load I have TimeStamp data stored in a CSV file that I'm loading with ...
[ "oracle", "sql-loader" ]
1
0
4,126
3
0
2008-09-19T19:25:44.023000
2008-09-19T20:47:43.077000
104,797
104,902
WCF service for receiving image
What is the best way to create a webservice for accepting an image. The image might be quite big and I do not want to change the default receive size for the web application. I have written one that accepts a binary image but that I feel that there has to be a better alternative.
Where does this image "live?" Is it accessible in the local file system or on the web? If so, I would suggest having your WebService accepting a URI (can be a URL or a local file) and opening it as a Stream, then using a StreamReader to read the contents of it. Example (but wrap the exceptions in FaultExceptions, and a...
WCF service for receiving image What is the best way to create a webservice for accepting an image. The image might be quite big and I do not want to change the default receive size for the web application. I have written one that accepts a binary image but that I feel that there has to be a better alternative.
TITLE: WCF service for receiving image QUESTION: What is the best way to create a webservice for accepting an image. The image might be quite big and I do not want to change the default receive size for the web application. I have written one that accepts a binary image but that I feel that there has to be a better al...
[ ".net", "wcf", "web-services", "image" ]
1
4
3,002
2
0
2008-09-19T19:26:43.753000
2008-09-19T19:41:55.683000
104,799
105,812
Why aren't Java Collections remove methods generic?
Why isn't Collection.remove(Object o) generic? Seems like Collection could have boolean remove(E o); Then, when you accidentally try to remove (for example) Set instead of each individual String from a Collection, it would be a compile time error instead of a debugging problem later.
Josh Bloch and Bill Pugh refer to this issue in Java Puzzlers IV: The Phantom Reference Menace, Attack of the Clone, and Revenge of The Shift. Josh Bloch says (6:41) that they attempted to generify the get method of Map, remove method and some other, but "it simply didn't work". There are too many reasonable programs t...
Why aren't Java Collections remove methods generic? Why isn't Collection.remove(Object o) generic? Seems like Collection could have boolean remove(E o); Then, when you accidentally try to remove (for example) Set instead of each individual String from a Collection, it would be a compile time error instead of a debuggin...
TITLE: Why aren't Java Collections remove methods generic? QUESTION: Why isn't Collection.remove(Object o) generic? Seems like Collection could have boolean remove(E o); Then, when you accidentally try to remove (for example) Set instead of each individual String from a Collection, it would be a compile time error ins...
[ "java", "generics", "collections" ]
153
78
20,346
10
0
2008-09-19T19:26:55.330000
2008-09-19T21:32:37.757000
104,803
105,259
How do you create automated tests of a Maven plugin using JUnit?
I've got a (mostly) working plugin developed, but since its function is directly related to the project it processes, how do you develop unit and integration tests for the plugin. The best idea I've had is to create an integration test project for the plugin that uses the plugin during its lifecycle and has tests that ...
You need to use the maven-plugin-testing-harness, org.apache.maven.shared maven-plugin-testing-harness 1.1 test You derive your unit test classes from AbstractMojoTestCase. You need to create a bare bones POM, usually in the src/test/resources folder. com.mydomain,mytools mytool-maven-plugin mygoal Use the AbstractMojo...
How do you create automated tests of a Maven plugin using JUnit? I've got a (mostly) working plugin developed, but since its function is directly related to the project it processes, how do you develop unit and integration tests for the plugin. The best idea I've had is to create an integration test project for the plu...
TITLE: How do you create automated tests of a Maven plugin using JUnit? QUESTION: I've got a (mostly) working plugin developed, but since its function is directly related to the project it processes, how do you develop unit and integration tests for the plugin. The best idea I've had is to create an integration test p...
[ "java", "maven-2", "automated-tests" ]
4
6
2,598
2
0
2008-09-19T19:27:09.510000
2008-09-19T20:24:07.547000
104,815
104,841
Reduce startup time of .NET windows form app running off of a networked drive
I have a simple.NET 2.0 windows form app that runs off of a networked drive (e.g. \MyServer\MyShare\app.exe). It's very basic, and only loads the bare minimum.NET libraries. However, it still takes ~6-10 seconds to load. People think something must be wrong that app so small takes so long to load. Are there any suggest...
Try out Sysinternals Process Explorer. It has an column of "% time in JIT". If that number is large you could run ngen on your application. If it's not it's likely to be a slow network connection. CodeGuru has a tutorial on usage of ngen.
Reduce startup time of .NET windows form app running off of a networked drive I have a simple.NET 2.0 windows form app that runs off of a networked drive (e.g. \MyServer\MyShare\app.exe). It's very basic, and only loads the bare minimum.NET libraries. However, it still takes ~6-10 seconds to load. People think somethin...
TITLE: Reduce startup time of .NET windows form app running off of a networked drive QUESTION: I have a simple.NET 2.0 windows form app that runs off of a networked drive (e.g. \MyServer\MyShare\app.exe). It's very basic, and only loads the bare minimum.NET libraries. However, it still takes ~6-10 seconds to load. Peo...
[ ".net", "performance", "startup" ]
4
6
4,143
5
0
2008-09-19T19:28:51.987000
2008-09-19T19:34:17.027000
104,831
104,945
Winform application profiling CPU usage / spikes .
I have a winforms application that normally is at about 2-4% CPU. We are seeing some spikes up to 27% of CPU for limited number of times. What is the best profiling tool to determine what is actually causing this spike. We use dottrace but i dont see how to map that to exactly the CPU spikes? Appreciate the help
I've used 2 profiling tools before - RedGate's ANTS profiler, and the built in profiler found in Visual Studio Team System. It's been some time since I used RedGate's ( http://www.red-gate.com/products/ants_profiler/index.htm ) profiler, though I used the built in in Visual Studio 2008 fairly recently. That being said,...
Winform application profiling CPU usage / spikes . I have a winforms application that normally is at about 2-4% CPU. We are seeing some spikes up to 27% of CPU for limited number of times. What is the best profiling tool to determine what is actually causing this spike. We use dottrace but i dont see how to map that to...
TITLE: Winform application profiling CPU usage / spikes . QUESTION: I have a winforms application that normally is at about 2-4% CPU. We are seeing some spikes up to 27% of CPU for limited number of times. What is the best profiling tool to determine what is actually causing this spike. We use dottrace but i dont see ...
[ "c#", "winforms", "performance", "optimization", "cpu" ]
1
2
3,715
6
0
2008-09-19T19:32:04.787000
2008-09-19T19:47:56.480000
104,837
104,880
Rails Sessions over servers
I'd like to have some rails apps over different servers sharing the same session. I can do it within the same server but don't know if it is possible to share over different servers. Anyone already did or knows how to do it? Thanks
Depending on how your app is set up, you can easily share cookies from sites in the same domain (foo.domain, bar.domain, domain) by setting your apps up to use the same secret: http://www.russellquinn.com/2008/01/30/multiple-rails-applications/ Now, if you have disparate sites, such as sdfsf.com, dsfsadfsdafdsaf.com, e...
Rails Sessions over servers I'd like to have some rails apps over different servers sharing the same session. I can do it within the same server but don't know if it is possible to share over different servers. Anyone already did or knows how to do it? Thanks
TITLE: Rails Sessions over servers QUESTION: I'd like to have some rails apps over different servers sharing the same session. I can do it within the same server but don't know if it is possible to share over different servers. Anyone already did or knows how to do it? Thanks ANSWER: Depending on how your app is set ...
[ "ruby-on-rails", "session", "cross-server" ]
6
3
2,792
4
0
2008-09-19T19:32:51.727000
2008-09-19T19:39:06.127000
104,844
104,882
Default Printer in Unmanaged C++
I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of.NET examples, but no success unmanaged). Thanks.
The following works great for printing with the win32api from C++ char szPrinterName[255]; unsigned long lPrinterNameLength; GetDefaultPrinter( szPrinterName, &lPrinterNameLength ); HDC hPrinterDC; hPrinterDC = CreateDC("WINSPOOL\0", szPrinterName, NULL, NULL); In the future instead of googling "unmanaged" try googling...
Default Printer in Unmanaged C++ I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of.NET examples, but no success unmanaged). Thanks.
TITLE: Default Printer in Unmanaged C++ QUESTION: I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of.NET examples, but no success unmanaged). Thanks. ANSWER: The following works great for printing with the win32api from C++ char szPrinterName[255]; unsigned long...
[ "c++", "windows", "unmanaged", "default", "printing" ]
2
3
8,726
5
0
2008-09-19T19:34:43.347000
2008-09-19T19:39:36.953000
104,850
287,877
Test if string is a guid without throwing exceptions?
I want to try to convert a string to a Guid, but I don't want to rely on catching exceptions ( for performance reasons - exceptions are expensive for usability reasons - the debugger pops up for design reasons - the expected is not exceptional In other words the code: public static Boolean TryStrToGuid(String s, out Gu...
Performance Benchmarks Catch exception: 10,000 good: 63,668 ticks 10,000 bad: 6,435,609 ticks Regex Pre-Screen: 10,000 good: 637,633 ticks 10,000 bad: 717,894 ticks COM Interop CLSIDFromString 10,000 good: 126,120 ticks 10,000 bad: 23,134 ticks COM Intertop (Fastest) Answer: /// /// Attempts to convert a string to a ...
Test if string is a guid without throwing exceptions? I want to try to convert a string to a Guid, but I don't want to rely on catching exceptions ( for performance reasons - exceptions are expensive for usability reasons - the debugger pops up for design reasons - the expected is not exceptional In other words the cod...
TITLE: Test if string is a guid without throwing exceptions? QUESTION: I want to try to convert a string to a Guid, but I don't want to rely on catching exceptions ( for performance reasons - exceptions are expensive for usability reasons - the debugger pops up for design reasons - the expected is not exceptional In o...
[ "c#", "string", "parsing", "guid" ]
189
113
81,994
19
0
2008-09-19T19:35:34.123000
2008-11-13T19:00:03.017000
104,854
744,872
"SetPropertiesRule" warning message when starting Tomcat from Eclipse
When I start Tomcat (6.0.18) from Eclipse (3.4), I receive this message (first in the log): WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server: (project name)' did not find a matching property. Seems this message does not have any severe impact, how...
The solution to this problem is very simple. Double click on your tomcat server. It will open the server configuration. Under server options check ‘Publish module contents to separate XML files’ checkbox. Restart your server. This time your page will come without any issues.
"SetPropertiesRule" warning message when starting Tomcat from Eclipse When I start Tomcat (6.0.18) from Eclipse (3.4), I receive this message (first in the log): WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server: (project name)' did not find a matc...
TITLE: "SetPropertiesRule" warning message when starting Tomcat from Eclipse QUESTION: When I start Tomcat (6.0.18) from Eclipse (3.4), I receive this message (first in the log): WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server: (project name)' d...
[ "java", "eclipse", "tomcat", "eclipse-3.4" ]
111
151
186,107
12
0
2008-09-19T19:36:00.707000
2009-04-13T18:19:43.223000
104,872
104,887
PHP :: Emulate <form method="post">, forwarding user to page
I'm working on a PHP application that links into the Protx VSP Direct payment gateway. To handle "3D Secure" requests from the credit card processing company, I need to forward the user to a different website, mimicking a form that has been posted. I'm trying to use the cURL libraries, but seem to have hit a problem. M...
The 3D Secure API doesn't allow you to do the request in the background. You need to forward the user to the 3D secure site. Use javascript to automatically submit your form. Here's what our provider suggests: Processing your request... Processing your 3-D Secure Transaction JavaScript is currently disabled or is not s...
PHP :: Emulate <form method="post">, forwarding user to page I'm working on a PHP application that links into the Protx VSP Direct payment gateway. To handle "3D Secure" requests from the credit card processing company, I need to forward the user to a different website, mimicking a form that has been posted. I'm trying...
TITLE: PHP :: Emulate <form method="post">, forwarding user to page QUESTION: I'm working on a PHP application that links into the Protx VSP Direct payment gateway. To handle "3D Secure" requests from the credit card processing company, I need to forward the user to a different website, mimicking a form that has been ...
[ "php", "curl", "protx" ]
5
2
6,942
10
0
2008-09-19T19:38:04.397000
2008-09-19T19:40:25.140000
104,890
105,041
Dealing with the rate of change in software development
I am primarily a.NET developer, and in that sphere alone there are at any given time probably close to a dozen fascinating emerging technologies, some of them real game-changers, that I would love to delve into. Sadly, this appears to be beyond the limits of human capacity. I read an article by Rocky Lhotka (.NET legen...
I have been in IT for 30 years now, so perhaps I can offer some perspective. Yes, there is an increasing amount of material to keep abreast of. But the rate of change (as in "progress") is not increasing - if anything, it is decreasing. What we are seeing is a widening of the field. Take a simple example: Once upon a t...
Dealing with the rate of change in software development I am primarily a.NET developer, and in that sphere alone there are at any given time probably close to a dozen fascinating emerging technologies, some of them real game-changers, that I would love to delve into. Sadly, this appears to be beyond the limits of human...
TITLE: Dealing with the rate of change in software development QUESTION: I am primarily a.NET developer, and in that sphere alone there are at any given time probably close to a dozen fascinating emerging technologies, some of them real game-changers, that I would love to delve into. Sadly, this appears to be beyond t...
[ "language-agnostic" ]
4
9
748
6
0
2008-09-19T19:40:45.017000
2008-09-19T20:02:02.797000
104,901
193,778
Sharing binary folders in Visual Studio
For a long time i have tried to work out the best way to access certain site files which i don't wish to be apart of a project or to ease integration with multiple developers (and talents, e.g. designers) on a single project. A lot of sites i have created have had folders with large amounts of images and other binary f...
They should really be source controlled like everything else. If you use Subversion you could have them stored in a different repository and included as an svn-external on your main project repository if you didn't want them cluttering up your main repo. I'm sure other source control solutions offer similar functionali...
Sharing binary folders in Visual Studio For a long time i have tried to work out the best way to access certain site files which i don't wish to be apart of a project or to ease integration with multiple developers (and talents, e.g. designers) on a single project. A lot of sites i have created have had folders with la...
TITLE: Sharing binary folders in Visual Studio QUESTION: For a long time i have tried to work out the best way to access certain site files which i don't wish to be apart of a project or to ease integration with multiple developers (and talents, e.g. designers) on a single project. A lot of sites i have created have h...
[ "visual-studio" ]
1
2
738
3
0
2008-09-19T19:41:54.373000
2008-10-11T07:01:51.923000
104,918
104,948
Command Pattern : How to pass parameters to a command?
My question is related to the command pattern, where we have the following abstraction (C# code): public interface ICommand { void Execute(); } Let's take a simple concrete command, which aims to delete an entity from our application. A Person instance, for example. I'll have a DeletePersonCommand, which implements ICo...
You'll need to associate the parameters with the command object, either by constructor or setter injection (or equivalent). Perhaps something like this: public class DeletePersonCommand: ICommand { private Person personToDelete; public DeletePersonCommand(Person personToDelete) { this.personToDelete = personToDelete; }...
Command Pattern : How to pass parameters to a command? My question is related to the command pattern, where we have the following abstraction (C# code): public interface ICommand { void Execute(); } Let's take a simple concrete command, which aims to delete an entity from our application. A Person instance, for example...
TITLE: Command Pattern : How to pass parameters to a command? QUESTION: My question is related to the command pattern, where we have the following abstraction (C# code): public interface ICommand { void Execute(); } Let's take a simple concrete command, which aims to delete an entity from our application. A Person ins...
[ "c#", "design-patterns", "command-pattern" ]
71
73
55,360
13
0
2008-09-19T19:44:20.123000
2008-09-19T19:48:06.793000
104,920
105,011
Is there a .NET performance counter to show the rate of p/invoke calls being made?
Is there a.NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended implementation was for a p/invoke call to be made once and then cached. I'm wondering if I could have no...
Try the ".NET CLR Interop" for "# of marshalling" performance counter. See this article for more http://msdn.microsoft.com/en-us/library/ms998551.aspx.
Is there a .NET performance counter to show the rate of p/invoke calls being made? Is there a.NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended implementation was fo...
TITLE: Is there a .NET performance counter to show the rate of p/invoke calls being made? QUESTION: Is there a.NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended imp...
[ ".net", "performance", "interop", "pinvoke", "analysis" ]
2
2
639
1
0
2008-09-19T19:44:41.277000
2008-09-19T19:57:57.190000
104,951
105,723
Web designer for VS.NET ReportViewer
Is there any designer for rdl files (visual studio.net reports) that can be used on a web browser?
The best that I've seen is RsInteract: http://www.rsinteract.com/
Web designer for VS.NET ReportViewer Is there any designer for rdl files (visual studio.net reports) that can be used on a web browser?
TITLE: Web designer for VS.NET ReportViewer QUESTION: Is there any designer for rdl files (visual studio.net reports) that can be used on a web browser? ANSWER: The best that I've seen is RsInteract: http://www.rsinteract.com/
[ "report", "reportviewer", "designer", "rdl" ]
2
1
337
1
0
2008-09-19T19:48:16.183000
2008-09-19T21:19:52.220000
104,953
105,035
Position an element relative to its container
I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using DIVs with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the graph. In my experimentation, I've already go...
You are right that CSS positioning is the way to go. Here's a quick run down: position: relative will layout an element relative to itself. In other words, the elements is laid out in normal flow, then it is removed from normal flow and offset by whatever values you have specified (top, right, bottom, left). It's impor...
Position an element relative to its container I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using DIVs with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the...
TITLE: Position an element relative to its container QUESTION: I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using DIVs with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary ...
[ "html", "css", "positioning" ]
201
405
262,837
5
0
2008-09-19T19:48:22.937000
2008-09-19T20:01:06.260000
104,958
104,986
Testing Abstract Class Concrete Methods
How would I design and organize tests for the concrete methods of an abstract class? Specifically in.NET.
You have to create a subclass that implements the abstract methods (with empty methods), but none of the concrete ones. This subclass should be for testing only (it should never go into your production code). Just ignore the overridden abstract methods in your unit tests and concentrate on the concrete methods.
Testing Abstract Class Concrete Methods How would I design and organize tests for the concrete methods of an abstract class? Specifically in.NET.
TITLE: Testing Abstract Class Concrete Methods QUESTION: How would I design and organize tests for the concrete methods of an abstract class? Specifically in.NET. ANSWER: You have to create a subclass that implements the abstract methods (with empty methods), but none of the concrete ones. This subclass should be for...
[ "c#", ".net", "unit-testing" ]
8
9
3,110
6
0
2008-09-19T19:49:47.647000
2008-09-19T19:53:24.143000
104,959
105,032
Inspecting STL containers in Visual Studio debugging
If I have a std::vector or std::map variable, and I want to see the contents, it's a big pain to see the nth element while debugging. Is there a plugin, or some trick to making it easier to watch STL container variables while debugging (VS2003/2005/2008)?
For vectors, this thread on the msdn forums has a code snippet for setting a watch on a vector index that might help.
Inspecting STL containers in Visual Studio debugging If I have a std::vector or std::map variable, and I want to see the contents, it's a big pain to see the nth element while debugging. Is there a plugin, or some trick to making it easier to watch STL container variables while debugging (VS2003/2005/2008)?
TITLE: Inspecting STL containers in Visual Studio debugging QUESTION: If I have a std::vector or std::map variable, and I want to see the contents, it's a big pain to see the nth element while debugging. Is there a plugin, or some trick to making it easier to watch STL container variables while debugging (VS2003/2005/...
[ "c++", "visual-studio", "debugging", "stl" ]
35
14
36,635
11
0
2008-09-19T19:49:50.190000
2008-09-19T20:00:46.027000
104,960
106,236
Are there any ORM tools for Haskell?
What is the best way to interact with a database using Haskell? I'm accustomed to using some sort of ORM (Django's ORM, hibernate, etc.) and something similar would be nice when creating apps with HAppS. Edit: I'd like to be free to choose from Postgresql MySql and SQLite as far as the actual databases go.
The library I have in mind is not an ORM, but it may still do what you want. If you want something that makes your database accesses safe while integrating things into your program nicely then try out HaskellDB. It basically looks at your schema, generates some data structures, and then gives you type safe ways to quer...
Are there any ORM tools for Haskell? What is the best way to interact with a database using Haskell? I'm accustomed to using some sort of ORM (Django's ORM, hibernate, etc.) and something similar would be nice when creating apps with HAppS. Edit: I'd like to be free to choose from Postgresql MySql and SQLite as far as ...
TITLE: Are there any ORM tools for Haskell? QUESTION: What is the best way to interact with a database using Haskell? I'm accustomed to using some sort of ORM (Django's ORM, hibernate, etc.) and something similar would be nice when creating apps with HAppS. Edit: I'd like to be free to choose from Postgresql MySql and...
[ "database", "orm", "haskell" ]
39
16
14,781
7
0
2008-09-19T19:50:12.793000
2008-09-19T22:48:34.580000
104,967
111,218
How do I implement a two-pass scanner using Flex?
As a pet-project, I'd like to attempt to implement a basic language of my own design that can be used as a web-scripting language. It's trivial to run a C++ program as an Apache CGI, so the real work lies in how to parse an input file containing non-code (HTML/CSS markup) and server-side code. In my undergrad compiler ...
You want to look at start conditions. For example: " [a-zA-Z]* { return PHP_TOKEN; } ">?" { BEGIN (0); } [a-zA-Z]* { return HTML_TOKEN; } You start off in state 0, use the BEGIN macro to change states. To match a RE only while in a particular state, prefix the RE with the state name surrounded by angle-brackets. In the...
How do I implement a two-pass scanner using Flex? As a pet-project, I'd like to attempt to implement a basic language of my own design that can be used as a web-scripting language. It's trivial to run a C++ program as an Apache CGI, so the real work lies in how to parse an input file containing non-code (HTML/CSS marku...
TITLE: How do I implement a two-pass scanner using Flex? QUESTION: As a pet-project, I'd like to attempt to implement a basic language of my own design that can be used as a web-scripting language. It's trivial to run a C++ program as an Apache CGI, so the real work lies in how to parse an input file containing non-co...
[ "parsing", "bison", "flex-lexer", "lexical-analysis" ]
8
7
1,973
2
0
2008-09-19T19:51:22.620000
2008-09-21T15:23:08.113000
104,971
104,999
SQL Query Help: Selecting Rows That Appear A Certain Number Of Times
I have a table with a "Date" column. Each Date may appear multiple times. How do I select only the dates that appear < k number of times?
select dates from table t group by dates having count(dates) < k; Hopefully, it works for ORACLE. HTH
SQL Query Help: Selecting Rows That Appear A Certain Number Of Times I have a table with a "Date" column. Each Date may appear multiple times. How do I select only the dates that appear < k number of times?
TITLE: SQL Query Help: Selecting Rows That Appear A Certain Number Of Times QUESTION: I have a table with a "Date" column. Each Date may appear multiple times. How do I select only the dates that appear < k number of times? ANSWER: select dates from table t group by dates having count(dates) < k; Hopefully, it works ...
[ "sql", "date", "select" ]
5
6
5,689
8
0
2008-09-19T19:51:56.847000
2008-09-19T19:55:45.057000
104,978
105,449
ReSharper giving C# 3.0 Code Inspection Warnings to .NET 2.0 Projects
When I am working in.NET 2.0 projects with the newest version of ReSharper (4.1) I am getting warnings about using the var keyword and lambadas etc.. Any idea how I can disable this only for.NET 2.0 projects?
Indeed, you can use C# 3.0 compiler features when targeting.NET 2.0, except extension methods and default LINQ implementations, which are located in newer assemblies. But if you need to co-operate with VS2005 users, you can open Properties view for a given project (not Project Properties, but Edit \ Properties Window, ...
ReSharper giving C# 3.0 Code Inspection Warnings to .NET 2.0 Projects When I am working in.NET 2.0 projects with the newest version of ReSharper (4.1) I am getting warnings about using the var keyword and lambadas etc.. Any idea how I can disable this only for.NET 2.0 projects?
TITLE: ReSharper giving C# 3.0 Code Inspection Warnings to .NET 2.0 Projects QUESTION: When I am working in.NET 2.0 projects with the newest version of ReSharper (4.1) I am getting warnings about using the var keyword and lambadas etc.. Any idea how I can disable this only for.NET 2.0 projects? ANSWER: Indeed, you ca...
[ "c#", ".net", "visual-studio", "asp.net-2.0", "resharper" ]
6
4
785
3
0
2008-09-19T19:52:42.740000
2008-09-19T20:41:54.853000
104,983
105,025
What is "thread local storage" in Python, and why do I need it?
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to a...
In Python, everything is shared, except for function-local variables (because each function call gets its own set of locals, and threads are always separate function calls.) And even then, only the variables themselves (the names that refer to objects) are local to the function; objects themselves are always global, an...
What is "thread local storage" in Python, and why do I need it? In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among ...
TITLE: What is "thread local storage" in Python, and why do I need it? QUESTION: In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the child...
[ "python", "multithreading", "thread-local" ]
132
118
81,300
6
0
2008-09-19T19:53:19.447000
2008-09-19T19:59:40.587000
105,007
105,021
Should I test private methods or only public ones?
I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?
I do not unit test private methods. A private method is an implementation detail that should be hidden to the users of the class. Testing private methods breaks encapsulation. If I find that the private method is huge or complex or important enough to require its own tests, I just put it in another class and make it pu...
Should I test private methods or only public ones? I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?
TITLE: Should I test private methods or only public ones? QUESTION: I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them? ...
[ "unit-testing", "testing", "language-agnostic" ]
412
396
159,024
31
0
2008-09-19T19:56:20.517000
2008-09-19T19:59:01.697000
105,014
105,061
Does the 'mutable' keyword have any purpose other than allowing a data member to be modified by a const member function?
A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const -qualified member method: class Foo { private: mutable bool done_; public: void doSomething() const {...; done_ = true; } }; Is this the only use of ...
It allows the differentiation of bitwise const and logical const. Logical const is when an object doesn't change in a way that is visible through the public interface, like your locking example. Another example would be a class that computes a value the first time it is requested, and caches the result. Since c++11 mut...
Does the 'mutable' keyword have any purpose other than allowing a data member to be modified by a const member function? A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const -qualified member method: cl...
TITLE: Does the 'mutable' keyword have any purpose other than allowing a data member to be modified by a const member function? QUESTION: A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const -qualified...
[ "c++", "class", "keyword", "mutable", "datamember" ]
632
438
289,975
18
0
2008-09-19T19:58:05.613000
2008-09-19T20:04:14.100000
105,031
105,109
How do you get total amount of RAM the computer has?
Using C#, I want to get the total amount of RAM that my computer has. With the PerformanceCounter I can get the amount of Available ram, by setting: counter.CategoryName = "Memory"; counter.Countername = "Available MBytes"; But I can't seem to find a way to get the total amount of memory. How would I go about doing thi...
The Windows API function GlobalMemoryStatusEx can be called with p/invoke: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private class MEMORYSTATUSEX { public uint dwLength; public uint dwMemoryLoad; public ulong ullTotalPhys; public ulong ullAvailPhys; public ulong ullTotalPageFile; public ulong ullAva...
How do you get total amount of RAM the computer has? Using C#, I want to get the total amount of RAM that my computer has. With the PerformanceCounter I can get the amount of Available ram, by setting: counter.CategoryName = "Memory"; counter.Countername = "Available MBytes"; But I can't seem to find a way to get the t...
TITLE: How do you get total amount of RAM the computer has? QUESTION: Using C#, I want to get the total amount of RAM that my computer has. With the PerformanceCounter I can get the amount of Available ram, by setting: counter.CategoryName = "Memory"; counter.Countername = "Available MBytes"; But I can't seem to find ...
[ "c#", "memory", "performancecounter" ]
97
67
167,228
18
0
2008-09-19T20:00:40.053000
2008-09-19T20:09:00.313000
105,034
105,074
How do I create a GUID / UUID?
How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around. I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random number generator is, etc...
UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier), according to RFC 4122, are identifiers designed to provide certain uniqueness guarantees. While it is possible to implement RFC-compliant UUIDs in a few lines of JavaScript code (e.g., see @broofa's answer, below) there are several...
How do I create a GUID / UUID? How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around. I'm not sure what routines are available on all browsers, how "random" and seeded the built-in ...
TITLE: How do I create a GUID / UUID? QUESTION: How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around. I'm not sure what routines are available on all browsers, how "random" and se...
[ "javascript", "guid", "uuid" ]
5,377
2,632
3,057,327
75
0
2008-09-19T20:01:00.147000
2008-09-19T20:05:25.003000
105,075
106,325
How can I associate .sh files with Cygwin?
I'd like to run a long rsync command in Cygwin by double clicking on a.sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work? Note: I've just found here, a Cygwin package that manages Windows context menus (Bash Prompt He...
Ok, I've found something that works. Associating a batch file as Vladimir suggested didn't work, but the bash arguments were key. Short and sweet: associate with this command: "C:\cygwin\bin\bash.exe" -li "%1" %* Long version if you don't know how: In Explorer, go to Tools/Folder Options/File Types. I already had an SH...
How can I associate .sh files with Cygwin? I'd like to run a long rsync command in Cygwin by double clicking on a.sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work? Note: I've just found here, a Cygwin package that ma...
TITLE: How can I associate .sh files with Cygwin? QUESTION: I'd like to run a long rsync command in Cygwin by double clicking on a.sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work? Note: I've just found here, a Cygw...
[ "windows", "bash", "cygwin" ]
49
42
34,443
13
0
2008-09-19T20:05:31.850000
2008-09-19T23:14:59.713000
105,087
208,334
What are some good techniques to convert an Ms Access application to a .Net Application?
We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the "logic", forms and reports are in Access. After experiencing the massive amounts of maintenance sludge it took to turn inventory transactions from non-temp...
As you already have asp.net with some business logic you could open this up to access as a web service (asmx files). Google for the Microsoft Office Web Services Toolkit for your version of access (xp/2003 etc.) and this will write vba proxy classes for you to call the web service. You can bind web service data to the ...
What are some good techniques to convert an Ms Access application to a .Net Application? We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the "logic", forms and reports are in Access. After experiencing the m...
TITLE: What are some good techniques to convert an Ms Access application to a .Net Application? QUESTION: We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the "logic", forms and reports are in Access. After ...
[ "ms-access", "legacy" ]
7
5
10,090
5
0
2008-09-19T20:07:16.137000
2008-10-16T12:26:38.787000
105,095
105,369
Are locks unnecessary in multi-threaded Python code because of the GIL?
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect? sorry if this is a dumb question...
You will still need locks if you share state between threads. The GIL only protects the interpreter internally. You can still have inconsistent updates in your own code. For example: #!/usr/bin/env python import threading shared_balance = 0 class Deposit(threading.Thread): def run(self): for _ in xrange(1000000): glo...
Are locks unnecessary in multi-threaded Python code because of the GIL? If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't...
TITLE: Are locks unnecessary in multi-threaded Python code because of the GIL? QUESTION: If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in ...
[ "python", "multithreading", "locking" ]
83
76
11,462
9
0
2008-09-19T20:07:37.540000
2008-09-19T20:34:40.610000
105,100
105,115
CSS: Display Properties differences
What is the difference between display:block and display:inline
Block elements will typically stack vertically whereas inline elements will line up horizontally. Two Divs will stack on top of each other, but if you set them to display:inline, they will be next to each other horizontally. Vise-versa with Span tags.
CSS: Display Properties differences What is the difference between display:block and display:inline
TITLE: CSS: Display Properties differences QUESTION: What is the difference between display:block and display:inline ANSWER: Block elements will typically stack vertically whereas inline elements will line up horizontally. Two Divs will stack on top of each other, but if you set them to display:inline, they will be n...
[ "css" ]
7
7
10,383
11
0
2008-09-19T20:08:28.397000
2008-09-19T20:10:09.047000
105,113
106,729
What is the most interesting design pattern you've ever met?
Most of us have already used the casual patterns such as MVC, strategy, etc. But there must be some unusual solutions to unusual problems, and I'd like to hear about it.
Crash Only Software: http://www.usenix.org/events/hotos03/tech/full_papers/candea/candea_html/ Abstract Crash-only programs crash safely and recover quickly. There is only one way to stop such software -- by crashing it -- and only one way to bring it up -- by initiating recovery. Crash-only systems are built from cras...
What is the most interesting design pattern you've ever met? Most of us have already used the casual patterns such as MVC, strategy, etc. But there must be some unusual solutions to unusual problems, and I'd like to hear about it.
TITLE: What is the most interesting design pattern you've ever met? QUESTION: Most of us have already used the casual patterns such as MVC, strategy, etc. But there must be some unusual solutions to unusual problems, and I'd like to hear about it. ANSWER: Crash Only Software: http://www.usenix.org/events/hotos03/tech...
[ "design-patterns" ]
6
16
2,705
10
0
2008-09-19T20:09:46.303000
2008-09-20T01:40:59.987000
105,121
105,611
Production Logging in Flex
Is there any way to capture the trace statements of your Flex app while not running in debug mode? Or is there any other way to output logging information when not running a debugger? Currently I'm trying to fix a bug that only presents itself in very specific deployment scenario, but I could see this being useful in s...
I suppose you're talking about Adobe Flex, targeting the Flash Player? If so, you can write your own logging wrapper class that propagates log messages sent to it to several targets (like the trace stack and internal memory so that you can access the log from within the app and e.g. send it to a server when the user ag...
Production Logging in Flex Is there any way to capture the trace statements of your Flex app while not running in debug mode? Or is there any other way to output logging information when not running a debugger? Currently I'm trying to fix a bug that only presents itself in very specific deployment scenario, but I could...
TITLE: Production Logging in Flex QUESTION: Is there any way to capture the trace statements of your Flex app while not running in debug mode? Or is there any other way to output logging information when not running a debugger? Currently I'm trying to fix a bug that only presents itself in very specific deployment sce...
[ "apache-flex", "logging" ]
6
3
5,120
4
0
2008-09-19T20:11:01.183000
2008-09-19T21:04:01.850000
105,130
105,378
Why use WinDbg vs the Visual Studio (VS) debugger?
What are the major reasons for using WinDbg vs the Visual Studio debugger? And is it commonly used as a complete replacement for the Visual Studio debugger, or more for when the need arises.
If you are wondering why you should use windbg over Visual Studio, then you need to read Advanced Windows Debugging. Any time you need to debug a truly ugly problem windbg has better technology to do it with than Visual Studio. Windbg has a more powerful scripting language and allows you to write DLLs to automate diffi...
Why use WinDbg vs the Visual Studio (VS) debugger? What are the major reasons for using WinDbg vs the Visual Studio debugger? And is it commonly used as a complete replacement for the Visual Studio debugger, or more for when the need arises.
TITLE: Why use WinDbg vs the Visual Studio (VS) debugger? QUESTION: What are the major reasons for using WinDbg vs the Visual Studio debugger? And is it commonly used as a complete replacement for the Visual Studio debugger, or more for when the need arises. ANSWER: If you are wondering why you should use windbg over...
[ "visual-studio", "windbg" ]
63
72
20,742
8
0
2008-09-19T20:11:56.173000
2008-09-19T20:35:21.670000
105,147
110,256
How can I check to make sure a window is being actively used, and if not alert the end user that they are about to be logged out?
Working on a new back end system for my company, and one of their requests is for a window to become locked down and for the user to be sent to the login screen if they leave it idle for to long. I figure I'd do this with JavaScript by attaching listeners to clicks, mouse moves and key-ups but I worry about messing wit...
Firstly, for this to be effective, you have to make sure users are logged out on the server at the end of this idle time. Otherwise, nothing you do on the client side is effective. If you send them to a login page, they can just click the back button. Second, the conventional way to do this is to use a "meta refresh" t...
How can I check to make sure a window is being actively used, and if not alert the end user that they are about to be logged out? Working on a new back end system for my company, and one of their requests is for a window to become locked down and for the user to be sent to the login screen if they leave it idle for to ...
TITLE: How can I check to make sure a window is being actively used, and if not alert the end user that they are about to be logged out? QUESTION: Working on a new back end system for my company, and one of their requests is for a window to become locked down and for the user to be sent to the login screen if they lea...
[ "javascript", "session" ]
0
1
340
4
0
2008-09-19T20:13:57.463000
2008-09-21T04:38:51.640000