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
60,360
61,887
What are the best strategies for using multiple AJAX libraries?
What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed is there a p...
You could use all those libraries, but I highly recommend against it. Downloading and executing that much JavaScript will most likely choke the browser and slow down your user's experience. It would be much better from a user's perspective and a developer's to pick one. Less context/architecture switching and less code...
What are the best strategies for using multiple AJAX libraries? What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely to...
TITLE: What are the best strategies for using multiple AJAX libraries? QUESTION: What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally ...
[ "jquery", "ajax", "yui", "prototypejs", "scriptaculous" ]
7
9
958
7
0
2008-09-13T06:14:52.237000
2008-09-15T05:14:40.053000
60,368
60,381
continuous integration web service
I am in a position where I could become a team leader of a team distributed over two countries. This team would be the tech. team for a start up company that we plan to bootstrap on limited funds. So I am trying to find out ways to minimize upfront expenses. Right now we are planning to use Java and will have a lot of ...
Note: This is an outdated answer from 2008. There are now plenty of such services thanks to things like Amazon's Elastic Cloud Compute service (for example, travis-ci ) I rather doubt you'll find a service to build stuff for you. Building requires a lot of CPU power, and if you're having to rebuild every time someone c...
continuous integration web service I am in a position where I could become a team leader of a team distributed over two countries. This team would be the tech. team for a start up company that we plan to bootstrap on limited funds. So I am trying to find out ways to minimize upfront expenses. Right now we are planning ...
TITLE: continuous integration web service QUESTION: I am in a position where I could become a team leader of a team distributed over two countries. This team would be the tech. team for a start up company that we plan to bootstrap on limited funds. So I am trying to find out ways to minimize upfront expenses. Right no...
[ "continuous-integration" ]
1
0
1,369
2
0
2008-09-13T06:42:46.740000
2008-09-13T07:27:09.347000
60,369
60,372
Alternative to PHP QuickForm?
I'm currently playing around with HTML_QuickForm for generating forms in PHP. It seems kind of limited in that it's hard to insert my own javascript or customizing the display and grouping of certain elements. Are there any alternatives to QuickForm that might provide more flexibility?
If you find it hard to insert Javascript into the form elements, consider using a JavaScript framework such as Prototype or jQuery. There, you can centralize the task of injecting event handling into form controls. By that, I mean that you won't need to insert event handlers into the HTML form code. Instead, you regist...
Alternative to PHP QuickForm? I'm currently playing around with HTML_QuickForm for generating forms in PHP. It seems kind of limited in that it's hard to insert my own javascript or customizing the display and grouping of certain elements. Are there any alternatives to QuickForm that might provide more flexibility?
TITLE: Alternative to PHP QuickForm? QUESTION: I'm currently playing around with HTML_QuickForm for generating forms in PHP. It seems kind of limited in that it's hard to insert my own javascript or customizing the display and grouping of certain elements. Are there any alternatives to QuickForm that might provide mor...
[ "php" ]
5
5
4,320
6
0
2008-09-13T06:47:53.310000
2008-09-13T06:53:20.333000
60,394
60,400
Calculate code metrics
Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?
On my latest project I used SourceMonitor. It's a nice free tool for code metrics analysis. Here is an excerpt from SourceMonitor official site: Collects metrics in a fast, single pass through source files. Measures metrics for source code written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML. Include...
Calculate code metrics Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?
TITLE: Calculate code metrics QUESTION: Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends? ANSWER: On my latest project I used SourceMonitor. It's a nice free to...
[ "metrics" ]
87
67
70,131
19
0
2008-09-13T07:53:06.010000
2008-09-13T08:01:47.190000
60,409
60,420
In PHP is it possible to use a function inside a variable
I know in php you can embed variables inside variables, like: But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write: But what if I have a long variable for output, and I don't want to do this every time, or I want to use multiple functions: AAAHHHHH There is ...
Function calls within strings are supported since PHP5 by having a variable containing the name of the function to call: {$stuff} "; return $output; } $somefunc='somefunc'; echo "foo {$somefunc("bar")} baz";?> will output " foo bar baz ". I find it easier however (and this works in PHP4) to either just call the functio...
In PHP is it possible to use a function inside a variable I know in php you can embed variables inside variables, like: But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write: But what if I have a long variable for output, and I don't want to do this every tim...
TITLE: In PHP is it possible to use a function inside a variable QUESTION: I know in php you can embed variables inside variables, like: But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write: But what if I have a long variable for output, and I don't want to...
[ "php", "html", "variables", "function" ]
10
25
12,357
3
0
2008-09-13T08:26:34.913000
2008-09-13T08:45:42.483000
60,419
60,423
Do I really need to use transactions in stored procedures? [MSSQL 2005]
I'm writing a pretty straightforward e-commerce app in asp.net, do I need to use transactions in my stored procedures? Read/Write ratio is about 9:1
Many people ask - do I need transactions? Why do I need them? When to use them? The answer is simple: use them all the time, unless you have a very good reason not to (for instance, don't use atomic transactions for "long running activities" between businesses). The default should always be yes. You are in doubt? - use...
Do I really need to use transactions in stored procedures? [MSSQL 2005] I'm writing a pretty straightforward e-commerce app in asp.net, do I need to use transactions in my stored procedures? Read/Write ratio is about 9:1
TITLE: Do I really need to use transactions in stored procedures? [MSSQL 2005] QUESTION: I'm writing a pretty straightforward e-commerce app in asp.net, do I need to use transactions in my stored procedures? Read/Write ratio is about 9:1 ANSWER: Many people ask - do I need transactions? Why do I need them? When to us...
[ "sql", "asp.net", "sql-server", "e-commerce" ]
7
7
1,016
5
0
2008-09-13T08:45:16.087000
2008-09-13T08:52:26.303000
60,422
930,781
IDebugProgramProvider2.GetProviderProcessData on Vista
As part of a JavaScript Profiler for IE 6/7 I needed to load a custom debugger that I created into IE. I got this working fine on XP, but couldn't get it working on Vista (full story here: http://damianblog.com/2008/09/09/tracejs-v2-rip/ ). The call to GetProviderProcessData is failing on Vista. Anyone have any suggest...
It would help to know what the error result was. Possible problems I can think of: If your getting permission denied, your most likely missing some requried Privilege in your ACL. New ones are sometimes not doceumented well, check the latest Platform SDK headers to see if any new ones that still out. It may be that und...
IDebugProgramProvider2.GetProviderProcessData on Vista As part of a JavaScript Profiler for IE 6/7 I needed to load a custom debugger that I created into IE. I got this working fine on XP, but couldn't get it working on Vista (full story here: http://damianblog.com/2008/09/09/tracejs-v2-rip/ ). The call to GetProviderP...
TITLE: IDebugProgramProvider2.GetProviderProcessData on Vista QUESTION: As part of a JavaScript Profiler for IE 6/7 I needed to load a custom debugger that I created into IE. I got this working fine on XP, but couldn't get it working on Vista (full story here: http://damianblog.com/2008/09/09/tracejs-v2-rip/ ). The ca...
[ "c++", "debugging", "internet-explorer", "windows-vista" ]
0
1
282
2
0
2008-09-13T08:49:41.707000
2009-05-30T22:34:12.373000
60,436
173,467
What is the benefit of using ONLY OpenID authentication on a site?
From my experience with OpenID, I see a number of significant downsides: Adds a Single Point of Failure to the site It is not a failure that can be fixed by the site even if detected. If the OpenID provider is down for three days, what recourse does the site have to allow its users to login and access the information t...
The list of downsides misses the most obvious one: it is a phisher's dream. OpenID is incredibly insecure and stealing the person's ID as they log in is trivially easy. Matt Sheppard hits the nail on the head as to the answer though:the benefit of only using OpenID is that it involves less hassle for the site creator a...
What is the benefit of using ONLY OpenID authentication on a site? From my experience with OpenID, I see a number of significant downsides: Adds a Single Point of Failure to the site It is not a failure that can be fixed by the site even if detected. If the OpenID provider is down for three days, what recourse does the...
TITLE: What is the benefit of using ONLY OpenID authentication on a site? QUESTION: From my experience with OpenID, I see a number of significant downsides: Adds a Single Point of Failure to the site It is not a failure that can be fixed by the site even if detected. If the OpenID provider is down for three days, what...
[ "openid" ]
51
3
3,800
15
0
2008-09-13T09:35:37.183000
2008-10-06T07:31:29.337000
60,438
60,449
access $(this) with href="javascript:..." in jQuery
I am using jQuery. I call a JavaScript function with next html: $tagname I would like to remove the li element and I thought this would be easy with the $(this) object. This is my JavaScript function: function uncheckEl(id) { $("#"+id+"").attr("checked",""); $("#"+id+"").parent("li").css("color","black"); $(this).paren...
Try something like this (e.g. to hide the ): function unCheckEl(id, ref) { (...) $(ref).parent().parent().hide(); // this should be your } And your link: $(this) is not present inside your function, because how is it supposed to know where the action is called from? You pass no reference in it, so $(this) could refer t...
access $(this) with href="javascript:..." in jQuery I am using jQuery. I call a JavaScript function with next html: $tagname I would like to remove the li element and I thought this would be easy with the $(this) object. This is my JavaScript function: function uncheckEl(id) { $("#"+id+"").attr("checked",""); $("#"+id+...
TITLE: access $(this) with href="javascript:..." in jQuery QUESTION: I am using jQuery. I call a JavaScript function with next html: $tagname I would like to remove the li element and I thought this would be easy with the $(this) object. This is my JavaScript function: function uncheckEl(id) { $("#"+id+"").attr("check...
[ "jquery" ]
2
3
7,538
2
0
2008-09-13T09:37:02.157000
2008-09-13T10:04:41.137000
60,446
60,460
Windows Mobile development in Python
What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?
If the IronPython and.Net Compact Framework teams work together, Visual Studio may one day support Python for Windows Mobile development out-of-the-box. Unfortunately, this feature request has been sitting on their issue tracker for ages...
Windows Mobile development in Python What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?
TITLE: Windows Mobile development in Python QUESTION: What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance? ANSWER: If the Ir...
[ "python", "windows-mobile" ]
4
1
8,136
4
0
2008-09-13T09:56:04.653000
2008-09-13T10:29:26.010000
60,455
63,506
Take a screenshot of a webpage with JavaScript?
Is it possible to to take a screenshot of a webpage with JavaScript and then submit that back to the server? I'm not so concerned with browser security issues. etc. as the implementation would be for HTA. But is it possible?
I have done this for an HTA by using an ActiveX control. It was pretty easy to build the control in VB6 to take the screenshot. I had to use the keybd_event API call because SendKeys can't do PrintScreen. Here's the code for that: Declare Sub keybd_event Lib "user32" _ (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwF...
Take a screenshot of a webpage with JavaScript? Is it possible to to take a screenshot of a webpage with JavaScript and then submit that back to the server? I'm not so concerned with browser security issues. etc. as the implementation would be for HTA. But is it possible?
TITLE: Take a screenshot of a webpage with JavaScript? QUESTION: Is it possible to to take a screenshot of a webpage with JavaScript and then submit that back to the server? I'm not so concerned with browser security issues. etc. as the implementation would be for HTA. But is it possible? ANSWER: I have done this for...
[ "javascript", "hta", "webpage-screenshot" ]
153
44
135,831
15
0
2008-09-13T10:21:08.993000
2008-09-15T14:40:44.407000
60,461
93,735
Programmatically get own phone number in Symbian
How to get the phone number of the device in Symbian?
According to the GSM specs, only the IMSI is required to be available on the SIM card. The actual phone number MSISDN is stored on the HLR database in the operator's network and does not need to be available on the SIM card or transmitted to the phone. So no matter what technology you are using (Symbina, Java...) you c...
Programmatically get own phone number in Symbian How to get the phone number of the device in Symbian?
TITLE: Programmatically get own phone number in Symbian QUESTION: How to get the phone number of the device in Symbian? ANSWER: According to the GSM specs, only the IMSI is required to be available on the SIM card. The actual phone number MSISDN is stored on the HLR database in the operator's network and does not nee...
[ "symbian", "telephony" ]
6
5
3,424
5
0
2008-09-13T10:30:33.103000
2008-09-18T15:45:11.730000
60,464
60,482
Changing the default folder in Emacs
I am fairly new to Emacs and I have been trying to figure out how to change the default folder for C-x C-f on start-up. For instance when I first load Emacs and hit C-x C-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some way to customize the.emacs file to do ...
You didn't say so, but it sounds like you're starting Emacs from a Windows shortcut. The directory that you see with c-x c-f is the cwd, in Emacs terms, the default-directory (a variable). When you start Emacs using an MS Windows shortcut, the default-directory is initially the folder (directory) specified in the "Star...
Changing the default folder in Emacs I am fairly new to Emacs and I have been trying to figure out how to change the default folder for C-x C-f on start-up. For instance when I first load Emacs and hit C-x C-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some w...
TITLE: Changing the default folder in Emacs QUESTION: I am fairly new to Emacs and I have been trying to figure out how to change the default folder for C-x C-f on start-up. For instance when I first load Emacs and hit C-x C-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I belie...
[ "emacs", "customization", "directory" ]
121
97
84,269
12
0
2008-09-13T10:34:52.080000
2008-09-13T11:22:44.727000
60,470
60,615
Loading Java classes from a signed applet
If I'm running a signed Java applet. Can I load additional classes from remote sources, in the same domain or maybe even the same host, and run them? I'd like to do this without changing pages or even stopping the current applet. Of course, the total size of all classes is too large to load them all at once. Is there a...
I think classes are lazy loaded in applets. being loaded on demand. Anyway, if the classes are outside of a jar you can simply use the applet classloader and load them by name. Ex: ClassLoader loader = this.getClass().getClassLoader(); Class clazz = loader.loadClass("acme.AppletAddon"); If you want to load classes from...
Loading Java classes from a signed applet If I'm running a signed Java applet. Can I load additional classes from remote sources, in the same domain or maybe even the same host, and run them? I'd like to do this without changing pages or even stopping the current applet. Of course, the total size of all classes is too ...
TITLE: Loading Java classes from a signed applet QUESTION: If I'm running a signed Java applet. Can I load additional classes from remote sources, in the same domain or maybe even the same host, and run them? I'd like to do this without changing pages or even stopping the current applet. Of course, the total size of a...
[ "java", "applet", "signed", "download" ]
6
6
1,269
3
0
2008-09-13T10:51:22.010000
2008-09-13T15:28:18.350000
60,474
60,535
Using the DLR for (primarily) static language compilation
I'm building a compiler that targets.NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of the code is completely static. So now that that's been ex...
I'm not aware of anyone using the DLR in quite this fashion yet, though this is definitely one of its intended use cases. One interesting thing to consider is that the DLR's expression trees have been merged with LINQ expression trees, so the IL being produced for LINQ in some as-yet-unannounced future version of Visua...
Using the DLR for (primarily) static language compilation I'm building a compiler that targets.NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of...
TITLE: Using the DLR for (primarily) static language compilation QUESTION: I'm building a compiler that targets.NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but th...
[ ".net", "compiler-construction", "cil", "dynamic-language-runtime" ]
8
7
620
1
0
2008-09-13T10:58:27.390000
2008-09-13T13:30:49.893000
60,477
60,491
Getting started with REST
I am looking for some good links with best practices and sample code on creating REST ful web services using.NET. Also, any other input you might have regarding REST would be greatly appreciated.
ADO.Net Data Servcies makes it really easy to build and consume RESTful web services in the.Net world but nevertheless understanding the concepts is important. Compared to WCF (which added REST support later), ADO.Net Data Services was built primarily for REST. Guidelines for Building RESTful Web Services has all the i...
Getting started with REST I am looking for some good links with best practices and sample code on creating REST ful web services using.NET. Also, any other input you might have regarding REST would be greatly appreciated.
TITLE: Getting started with REST QUESTION: I am looking for some good links with best practices and sample code on creating REST ful web services using.NET. Also, any other input you might have regarding REST would be greatly appreciated. ANSWER: ADO.Net Data Servcies makes it really easy to build and consume RESTful...
[ ".net", "web-services", "rest" ]
33
23
7,313
6
0
2008-09-13T11:09:32.557000
2008-09-13T12:19:30.610000
60,478
60,752
Self Testing Systems
I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently. The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically. Here is the scenario: * So we hash out a system quickly to a specified set of interfaces, it has zero optimizat...
I believe this idea to be an interesting theoretical debate, but not very practical for the following reasons: To make sure the new version of the code works well, you need to have superb automatic tests, which is a goal that is very hard to achieve and one that many companies fail to develop. You can only go on with i...
Self Testing Systems I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently. The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically. Here is the scenario: * So we hash out a system quickly to a specified set of interfaces, ...
TITLE: Self Testing Systems QUESTION: I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently. The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically. Here is the scenario: * So we hash out a system quickly to a specified s...
[ "unit-testing", "language-agnostic" ]
3
3
298
6
0
2008-09-13T11:09:53.587000
2008-09-13T18:21:40.973000
60,507
60,513
C++ function pointers and classes
Say I have: void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or a static member function: Render(MainMenuRender); Render(MainMenu::Render); However, I really want to be able to u...
There are a lot of ways to skin this cat, including templates. My favorite is Boost.function as I've found it to be the most flexible in the long run. Also read up on Boost.bind for binding to member functions as well as many other tricks. It would look like this: #include #include void Render(boost::function0 Call) { ...
C++ function pointers and classes Say I have: void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or a static member function: Render(MainMenuRender); Render(MainMenu::Render); Howe...
TITLE: C++ function pointers and classes QUESTION: Say I have: void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or a static member function: Render(MainMenuRender); Render(MainM...
[ "c++", "oop", "class", "function-pointers" ]
12
14
1,926
6
0
2008-09-13T12:53:06.473000
2008-09-13T13:02:16.110000
60,516
60,561
Where to put master page's code in an MVC application?
I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc. So my question was, where should I put these master-page database calling code? Normally, these should goes into its own controll...
One way to do this is to put in the masterpage view the hook for the ViewData and then you define a BaseController: Controller (or multiple base classes) where you do all the db calls you need. What you wanna do is quite the same thing described in this articles. I hope this helps! Regards
Where to put master page's code in an MVC application? I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc. So my question was, where should I put these master-page database calling ...
TITLE: Where to put master page's code in an MVC application? QUESTION: I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc. So my question was, where should I put these master-page...
[ "asp.net-mvc", "master-pages" ]
8
5
2,471
3
0
2008-09-13T13:05:04.217000
2008-09-13T14:19:14.600000
60,518
256,843
What are the problems of using transactions in a database?
From this post. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If yes, how would you define them? EDIT: Deadlock is another problem, but data i...
It depends a lot on the transactional implementation inside your database and may also depend on the transaction isolation level you use. I'm assuming "repeatable read" or higher here. Holding transactions open for a long time (even ones which haven't modified anything) forces the database to hold on to deleted or upda...
What are the problems of using transactions in a database? From this post. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If yes, how would you...
TITLE: What are the problems of using transactions in a database? QUESTION: From this post. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If ...
[ "sql", "transactions", "deadlock" ]
1
2
3,509
4
0
2008-09-13T13:07:39.123000
2008-11-02T12:25:14.713000
60,542
1,161,631
Smoothing Zedgraph linegraphs without 'bumps'
When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles. While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little 'dive' or 'bump' before going upwards or down...
No simple answer for this. Keeping the tension near zero will be your simplest solution. ZedGraph uses GDI's DrawCurve tension parameter to apply smoothness, which is probably Hermite Interpolation. You can try to implement your own Cosine Interpolation, which will keep local extremes because of its nature. You can loo...
Smoothing Zedgraph linegraphs without 'bumps' When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles. While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little...
TITLE: Smoothing Zedgraph linegraphs without 'bumps' QUESTION: When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles. While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the ...
[ "zedgraph", "smoothing", "linegraph" ]
1
3
2,936
2
0
2008-09-13T13:38:39.830000
2009-07-21T20:41:36.160000
60,547
60,738
C (or any) compilers deterministic performance
Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and that the compiler is fully deterministic? To this ...
For safety critical embedded application certifying agencies require to satisfy the "proven-in-use" requirement for the compiler. There are typically certain requirements (kind of like "hours of operation") that need to be met and proven by detailed documentation. However, most people either cannot or don't want to mee...
C (or any) compilers deterministic performance Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and tha...
TITLE: C (or any) compilers deterministic performance QUESTION: Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: How do you know that the compiler you are using generates machine code that matches the c code's functionali...
[ "c", "compiler-construction", "deterministic", "embedded" ]
18
11
2,146
22
0
2008-09-13T13:47:04.350000
2008-09-13T18:05:12.857000
60,565
60,703
How to run executable at end of Setup Project?
I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to...
I believe this is one of the real limitations of the Visual Studio installation project. You need to be able to modify the last page of the installation UI but VS.NET does not give you a way to do this. You could modify the tables in the.MSI after it has been built but VS.NET would probably overwrite these changes each...
How to run executable at end of Setup Project? I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers ...
TITLE: How to run executable at end of Setup Project? QUESTION: I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen...
[ "winforms", "installation" ]
21
7
26,316
7
0
2008-09-13T14:25:30.370000
2008-09-13T17:17:39.927000
60,570
60,605
Why should the "PIMPL" idiom be used?
Backgrounder: The PIMPL Idiom (Pointer to IMPLementation) is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of. This hides internal implementation details and data from the user of the library. When implementing t...
Because you want Purr() to be able to use private members of CatImpl. Cat::Purr() would not be allowed such an access without a friend declaration. Because you then don't mix responsibilities: one class implements, one class forwards.
Why should the "PIMPL" idiom be used? Backgrounder: The PIMPL Idiom (Pointer to IMPLementation) is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of. This hides internal implementation details and data from the us...
TITLE: Why should the "PIMPL" idiom be used? QUESTION: Backgrounder: The PIMPL Idiom (Pointer to IMPLementation) is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of. This hides internal implementation details an...
[ "c++", "oop", "information-hiding", "pimpl-idiom" ]
152
42
126,378
11
0
2008-09-13T14:30:29.657000
2008-09-13T15:16:18.597000
60,573
60,581
XmlSerializer - There was an error reflecting type
Using C#.NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: There was an error reflecting type. Inside the...
Look at the inner exception that you are getting. It will tell you which field/property it is having trouble serializing. You can exclude fields/properties from xml serialization by decorating them with the [XmlIgnore] attribute. XmlSerializer does not use the [Serializable] attribute, so I doubt that is the problem.
XmlSerializer - There was an error reflecting type Using C#.NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception say...
TITLE: XmlSerializer - There was an error reflecting type QUESTION: Using C#.NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am gettin...
[ "c#", ".net", "xml", "serialization", ".net-2.0" ]
370
446
280,945
19
0
2008-09-13T14:40:21.507000
2008-09-13T14:53:09.820000
60,585
61,220
PHP Forms-Based Authentication on Windows using Local User Accounts
I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM). I know that if Active Directory is setup, you can use the PHP LDAP module to connect and authenticate in your...
I haven't found a simple solution either. There are examples using CreateObject and the WinNT ADSI provider. But eventually they all bump into User authentication issues with the Active Directory Service Interfaces WinNT provider. I'm not 100% sure but I guess the WSH/network connect approach has the same problem. Acco...
PHP Forms-Based Authentication on Windows using Local User Accounts I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM). I know that if Active Directory is setup,...
TITLE: PHP Forms-Based Authentication on Windows using Local User Accounts QUESTION: I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM). I know that if Active D...
[ "php", "windows", "apache", "authentication", "sam" ]
5
3
5,058
3
0
2008-09-13T14:57:45.613000
2008-09-14T09:22:01.387000
60,590
60,606
Best way to initiate a download?
On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment." A couple of possible approaches I know about, and browser compatibility (based on a quick ...
You can also do a meta refresh, which most browsers support. Download.com places one in a noscript tag.
Best way to initiate a download? On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment." A couple of possible approaches I know about, and browser...
TITLE: Best way to initiate a download? QUESTION: On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment." A couple of possible approaches I know ...
[ "php", "javascript", "download" ]
12
17
9,237
11
0
2008-09-13T15:00:28.947000
2008-09-13T15:18:14.707000
60,620
60,628
Getting started with Silverlight development
How does one start development in Silverlight? Does one need a new IDE? or Visual studio will support?
Yes there is tooling support for Visual Studio. It is still in Beta though. Get Started Building Silverlight 2 Applications 1) Install Visual Studio 2008 then Install Silverlight Tools Beta 2 for Visual Studio 2008 This add-on to Visual Studio 2008 allows you to use.NET to create Silverlight 2 Beta 2 Web sites. The Sil...
Getting started with Silverlight development How does one start development in Silverlight? Does one need a new IDE? or Visual studio will support?
TITLE: Getting started with Silverlight development QUESTION: How does one start development in Silverlight? Does one need a new IDE? or Visual studio will support? ANSWER: Yes there is tooling support for Visual Studio. It is still in Beta though. Get Started Building Silverlight 2 Applications 1) Install Visual Stu...
[ ".net", "visual-studio", "visual-studio-2008", "silverlight" ]
6
16
1,302
7
0
2008-09-13T15:38:01.650000
2008-09-13T15:46:29.990000
60,641
60,691
How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parameters set are the same)?
I need to replace all WinAPI calls of the CreateFile, ReadFile, SetFilePointer, CloseHandle with my own implementation (which use low-level file reading via Bluetooth). The code, where functions will be replaced, is Video File Player and it already works with the regular hdd files. It is also needed, that Video Player ...
I suggest that you follow these steps: Write a set of wrapper functions, e.g MyCreateFile, MyReadFile, etc, that initially just call the corresponding API and pass the same arguments along, unmodified. Use your text editor to search for all calls to the original APIs, and replace these with calls to your new wrapper fu...
How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parameters set are the same)? I need to replace all WinAPI calls of the CreateFile, ReadFile, SetFilePointer, CloseHandle with my own implementation (which use low-level file reading via Bluetooth). The code, where functio...
TITLE: How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parameters set are the same)? QUESTION: I need to replace all WinAPI calls of the CreateFile, ReadFile, SetFilePointer, CloseHandle with my own implementation (which use low-level file reading via Bluetooth). The c...
[ "c++", "winapi", "visual-c++" ]
1
5
1,883
6
0
2008-09-13T16:02:07.940000
2008-09-13T17:03:28.447000
60,645
419,736
Overlapped I/O on anonymous pipe
Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure.
Here is an implementation for an anonymous pipe function with the possibility to specify FILE_FLAG_OVERLAPPED: /******************************************************************************\ * This is a part of the Microsoft Source Code Samples. * Copyright 1995 - 1997 Microsoft Corporation. * All rights reserved. * T...
Overlapped I/O on anonymous pipe Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure.
TITLE: Overlapped I/O on anonymous pipe QUESTION: Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure. ANSWER: Here is an implementation for an anonymous pipe fun...
[ "winapi", "pipe" ]
20
33
12,552
3
0
2008-09-13T16:04:51.960000
2009-01-07T09:38:12.957000
60,649
65,924
Cross platform IPC
I'm looking for suggestions on possible IPC mechanisms that are: Cross platform (Win32 and Linux at least) Simple to implement in C++ as well as the most common scripting languages (perl, ruby, python, etc). Finally, simple to use from a programming point of view! What my options are? I'm programming under Linux, but I...
In terms of speed, the best cross-platform IPC mechanism will be pipes. That assumes, however, that you want cross-platform IPC on the same machine. If you want to be able to talk to processes on remote machines, you'll want to look at using sockets instead. Luckily, if you're talking about TCP at least, sockets and pi...
Cross platform IPC I'm looking for suggestions on possible IPC mechanisms that are: Cross platform (Win32 and Linux at least) Simple to implement in C++ as well as the most common scripting languages (perl, ruby, python, etc). Finally, simple to use from a programming point of view! What my options are? I'm programming...
TITLE: Cross platform IPC QUESTION: I'm looking for suggestions on possible IPC mechanisms that are: Cross platform (Win32 and Linux at least) Simple to implement in C++ as well as the most common scripting languages (perl, ruby, python, etc). Finally, simple to use from a programming point of view! What my options ar...
[ "cross-platform", "ipc" ]
78
57
53,358
15
0
2008-09-13T16:10:34.003000
2008-09-15T19:22:37.350000
60,650
60,667
ASP.NET - Is it possible to trigger a postback from server code?
Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code ( i.e. without using javascript trickery to submit a form)?
Asp.net Postbacks are initiated from the client (typically form submission). I am not sure what you are trying to achieve. Some of the server side page lifecyle events are already executed and what you are trying to do is raise the previous event handlers again.
ASP.NET - Is it possible to trigger a postback from server code? Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code (...
TITLE: ASP.NET - Is it possible to trigger a postback from server code? QUESTION: Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same pag...
[ "asp.net", "postback" ]
11
10
38,276
5
0
2008-09-13T16:11:02.583000
2008-09-13T16:25:26.853000
60,652
60,693
Common memory optimization
What are the most common memory optimizations in csharp, dotnet 2.0. Wanted to see if there common things that people may not be doing by default in winform app
use structs for small wrapper objects to avoid heap fragmentation think carefully about object lifetimes, especially for large objects so they do not end up on the LOH unless you intend them to think about allocations inside of a loop make sure dynamically sized array will be of reasonable size, otherwise partition the...
Common memory optimization What are the most common memory optimizations in csharp, dotnet 2.0. Wanted to see if there common things that people may not be doing by default in winform app
TITLE: Common memory optimization QUESTION: What are the most common memory optimizations in csharp, dotnet 2.0. Wanted to see if there common things that people may not be doing by default in winform app ANSWER: use structs for small wrapper objects to avoid heap fragmentation think carefully about object lifetimes,...
[ "c#", "optimization", "memory-management" ]
4
9
1,497
3
0
2008-09-13T16:11:31.910000
2008-09-13T17:04:32.877000
60,653
60,655
Is global memory initialized in C++?
Is global memory initialized in C++? And if so, how? (Second) clarification: When a program starts up, what is in the memory space which will become global memory, prior to primitives being initialized? I'm trying to understand if it is zeroed out, or garbage for example. The situation is: can a singleton reference be ...
Yes global primitives are initialized to NULL. Example: int x; int main(int argc, char**argv) { assert(x == 0); int y; //assert(y == 0); <-- wrong can't assume this. } You cannot make any assumptions about classes, structs, arrays, blocks of memory on the heap... It's safest just to always initialize everything.
Is global memory initialized in C++? Is global memory initialized in C++? And if so, how? (Second) clarification: When a program starts up, what is in the memory space which will become global memory, prior to primitives being initialized? I'm trying to understand if it is zeroed out, or garbage for example. The situat...
TITLE: Is global memory initialized in C++? QUESTION: Is global memory initialized in C++? And if so, how? (Second) clarification: When a program starts up, what is in the memory space which will become global memory, prior to primitives being initialized? I'm trying to understand if it is zeroed out, or garbage for e...
[ "c++", "memory", "memory-management" ]
15
9
7,892
4
0
2008-09-13T16:13:29.520000
2008-09-13T16:15:28.360000
60,658
60,806
Rails Model, View, Controller, and Helper: what goes where?
In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic. Please answer in the affirmative - With Do put this here, rather than Don't put that there.
MVC Controller: Put code here that has to do with working out what a user wants, and deciding what to give them, working out whether they are logged in, whether they should see certain data, etc. In the end, the controller looks at requests and works out what data (Models) to show and what Views to render. If you are i...
Rails Model, View, Controller, and Helper: what goes where? In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic. Please answer in the affirmative - With Do put this here, rather than Don't put that there.
TITLE: Rails Model, View, Controller, and Helper: what goes where? QUESTION: In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic. Please answer in the affirmative - With Do put this here, rather than Don't put that there. ANSWER: MVC Controller: Put code here tha...
[ "ruby-on-rails", "ruby", "model-view-controller" ]
155
173
45,467
10
0
2008-09-13T16:18:01.023000
2008-09-13T19:59:14.953000
60,664
60,679
Is it possible to display the entity &#8659; in IE6
is it possible to display ⇓ entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: ⇓
According to this page, that symbol doesn't show in IE6 at all. Symbol Character Numeric Description ⇓ ⇓ ⇓ Down double arrow - - * Doesn't show with MS IE6 If you really need that particular symbol, you may just have to go for a small graphic of the arrow - not an ideal solution, but if you need it to display in IE6 th...
Is it possible to display the entity &#8659; in IE6 is it possible to display ⇓ entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: ⇓
TITLE: Is it possible to display the entity &#8659; in IE6 QUESTION: is it possible to display ⇓ entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: ⇓ ANSWER: According to this page, that symbol doesn't show in IE6 at all. Symbol Character Numeric Description ⇓ ⇓ ⇓ Down doubl...
[ "internet-explorer-6" ]
2
5
242
2
0
2008-09-13T16:22:43.443000
2008-09-13T16:40:49.343000
60,672
60,728
IIS Integrated Request Processing Pipeline -- Modify Request
I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode. The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. (for ex: HTTP\_EAUTH\_ID) And later in the page lifecycle of ...
HttpRequest.ServerVariables Property is a read-only collection. So, you cannot directly modify that. I would suggest storing your custom data in httpcontext (or global application object or your database) from your httpmodule and then reading that shared value in the aspx page. If you still want to modify server variab...
IIS Integrated Request Processing Pipeline -- Modify Request I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode. The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. ...
TITLE: IIS Integrated Request Processing Pipeline -- Modify Request QUESTION: I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode. The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders ...
[ "asp.net", "iis-7", "httpmodule" ]
0
3
1,801
3
0
2008-09-13T16:30:26.950000
2008-09-13T17:52:30.547000
60,673
60,712
Guidelines to improve your code
What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people insist that every if statement is followed by a brace block ( {...} ). I'm interested in what guidelines other people follow, ...
A few of my personal favorites: Strive to write code that is const correct. You will enlist the compiler to help weed out easy to fix but sometimes painful bugs. Your code will also tell a story of what you had in mind at the time you wrote it -- valuable for newcomers or maintainers once you're gone. Get out of the me...
Guidelines to improve your code What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people insist that every if statement is followed by a brace block ( {...} ). I'm interested in what ...
TITLE: Guidelines to improve your code QUESTION: What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people insist that every if statement is followed by a brace block ( {...} ). I'm i...
[ "c++", "coding-style" ]
10
9
1,728
21
0
2008-09-13T16:30:50.883000
2008-09-13T17:28:03.663000
60,680
60,753
How do I write a python HTTP server to listen on multiple ports?
I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port? What I'm doing now: class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def doGET [...] class ThreadingHTTPServer(Threading...
Sure; just start two different servers on two different ports in two different threads that each use the same handler. Here's a complete, working example that I just wrote and tested. If you run this code then you'll be able to get a Hello World webpage at both http://localhost:1111/ and http://localhost:2222/ from thr...
How do I write a python HTTP server to listen on multiple ports? I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port? What I'm doing now: class MyRequestHandler(BaseHTTPServer.BaseHTTPRequ...
TITLE: How do I write a python HTTP server to listen on multiple ports? QUESTION: I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port? What I'm doing now: class MyRequestHandler(BaseHTTPS...
[ "python", "webserver" ]
21
42
38,183
3
0
2008-09-13T16:42:38.153000
2008-09-13T18:22:06.573000
60,683
60,695
Checkbox in listview control
Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated. I am using visual studio 2005
Allan Anderson created a custom control to let you do this. You can find it here: http://www.codeproject.com/KB/list/aa_listview.aspx Here's some example code for that control: GlacialList mylist = new GlacialList(); mylist.Columns.Add( "Column1", 100 ); // this can also be added // through the design time support m...
Checkbox in listview control Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated. I am using visual studio 2005
TITLE: Checkbox in listview control QUESTION: Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated. I am using visual studio 2005 ANSWER: Allan Anderson created a custom control to let you do this. You can find it here: http://www.codep...
[ "c#", "user-interface", "visual-studio-2005", "checkbox" ]
18
8
101,451
8
0
2008-09-13T16:51:31.143000
2008-09-13T17:07:11.467000
60,685
60,723
python regex to match multi-line preprocessor macro
What follows is a regular expression I have written to match multi-line pre-processor macros in C / C++ code. I'm by no means a regular expressions guru, so I'd welcome any advice on how I can make this better. Here's the regex: \s*#define(.*\\\n)+[\S]+(?!\\) It should match all of this: #define foo(x) if(x) \ doSometh...
This is a simple test program I knocked up: #!/usr/bin/env python TEST1=""" #include "Foo.h" #define bar foo\\ x #include "Bar.h" """ TEST2=""" #define bar foo #define x 1 \\ 12 \\ 2 \\\\ 3 Foobar """ TEST3=""" #define foo(x) if(x) \\ doSomething(x) """ TEST4=""" #define foo(x) if(x) \\ doSomething(x) normalCode();...
python regex to match multi-line preprocessor macro What follows is a regular expression I have written to match multi-line pre-processor macros in C / C++ code. I'm by no means a regular expressions guru, so I'd welcome any advice on how I can make this better. Here's the regex: \s*#define(.*\\\n)+[\S]+(?!\\) It shoul...
TITLE: python regex to match multi-line preprocessor macro QUESTION: What follows is a regular expression I have written to match multi-line pre-processor macros in C / C++ code. I'm by no means a regular expressions guru, so I'd welcome any advice on how I can make this better. Here's the regex: \s*#define(.*\\\n)+[\...
[ "python", "regex" ]
5
6
1,648
2
0
2008-09-13T16:53:57.113000
2008-09-13T17:46:14.867000
60,720
60,731
How to determine the value of a controller variable during execution in Ruby on Rails?
What is the best way for me to determine a controller variable's value during execution? For example, is there a way I can insert a break in the code, and cause the value of the variable to be output to the screen (or the log)?
Yes. The easiest way is to raise the value as a string. Like so: raise @foo.to_s Or, you can install the debugger ( gem install ruby-debug ), and then start the development server with the --debugger flag. Then, in your code, call the debugger instruction. Inside the debugger prompt, you have many commands, including p...
How to determine the value of a controller variable during execution in Ruby on Rails? What is the best way for me to determine a controller variable's value during execution? For example, is there a way I can insert a break in the code, and cause the value of the variable to be output to the screen (or the log)?
TITLE: How to determine the value of a controller variable during execution in Ruby on Rails? QUESTION: What is the best way for me to determine a controller variable's value during execution? For example, is there a way I can insert a break in the code, and cause the value of the variable to be output to the screen (...
[ "ruby-on-rails", "ruby", "debugging", "variables" ]
8
11
8,993
7
0
2008-09-13T17:44:00.457000
2008-09-13T17:56:16.683000
60,736
60,792
How to set up a Subversion (SVN) server on GNU/Linux - Ubuntu
I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to: Get and configure Apache, and necessary modules (I know there are other ways to create a SVN server, bu...
Steps I've taken to make my laptop a Subversion server. Credit must go to AlephZarro for his directions here. I now have a working SVN server (which has currently only been tested locally). Specific setup: Kubuntu 8.04 Hardy Heron Requirements to follow this guide: apt-get package manager program text editor (I use kat...
How to set up a Subversion (SVN) server on GNU/Linux - Ubuntu I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to: Get and configure Apache, and necessary m...
TITLE: How to set up a Subversion (SVN) server on GNU/Linux - Ubuntu QUESTION: I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to: Get and configure Apach...
[ "linux", "svn", "ubuntu", "debian" ]
96
146
215,916
5
0
2008-09-13T18:00:42.210000
2008-09-13T19:37:23.803000
60,740
60,756
Which jQuery plugin should be used to fix the IE6 PNG transparency issue?
Is there an IE6/PNG fix that is officially developed by the jQuery team? If not which of the available plugins should I use?
I'm using jquery.pngFix.js. I don't know if it's officially sanctioned or not, I do know that it works. I chose it because it was the plugin included with FancyBox, no other reason.
Which jQuery plugin should be used to fix the IE6 PNG transparency issue? Is there an IE6/PNG fix that is officially developed by the jQuery team? If not which of the available plugins should I use?
TITLE: Which jQuery plugin should be used to fix the IE6 PNG transparency issue? QUESTION: Is there an IE6/PNG fix that is officially developed by the jQuery team? If not which of the available plugins should I use? ANSWER: I'm using jquery.pngFix.js. I don't know if it's officially sanctioned or not, I do know that ...
[ "jquery", "internet-explorer-6", "png" ]
11
4
23,555
5
0
2008-09-13T18:08:22.567000
2008-09-13T18:33:06.080000
60,751
60,790
c++ Having multiple graphics options
Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function &Call) { D3dDevice->BeginScene(); Call(); D3dDevice->End...
Define an interface that is sufficient for your application's graphic output demands. Then implement this interface for every renderer you want to support. class IRenderer { public: virtual ~IRenderer() {} virtual void RenderModel(CModel* model) = 0; virtual void DrawScreenQuad(int x1, int y1, int x2, int y2) = 0; //.....
c++ Having multiple graphics options Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function &Call) { D3dDevice-...
TITLE: c++ Having multiple graphics options QUESTION: Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function &...
[ "c++", "opengl", "graphics", "direct3d" ]
4
6
1,091
2
0
2008-09-13T18:20:36.250000
2008-09-13T19:33:55.107000
60,757
74,605
Best way to handle user account authentication and passwords
What is the best way to handle user account management in a system, without having your employees who have access to a database, to have access to the accounts. Examples: Storing username/password in the database. This is a bad idea because anyone that has access to a database can see the username and password. And hen...
This was a common issue in UNIX many years ago, and was resolved by separating the user identity components (username, UID, shell, full name, etc.) from the authentication components (password hash, password hash salt). The identity components can be globally readable (and in fact must be, if UIDs are to be mapped to u...
Best way to handle user account authentication and passwords What is the best way to handle user account management in a system, without having your employees who have access to a database, to have access to the accounts. Examples: Storing username/password in the database. This is a bad idea because anyone that has ac...
TITLE: Best way to handle user account authentication and passwords QUESTION: What is the best way to handle user account management in a system, without having your employees who have access to a database, to have access to the accounts. Examples: Storing username/password in the database. This is a bad idea because ...
[ "security", "database-design", "authentication", "authorization" ]
5
4
3,165
11
0
2008-09-13T18:34:58.510000
2008-09-16T17:06:52.610000
60,763
174,559
Learning kernel hacking and embedded development at home?
I was always attracted to the world of kernel hacking and embedded systems. Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff? Something like kits for writing drivers etc, which come with good documentation and are affordable? Thanks!
If you are completely new to kernel development, i would suggest not starting with hardware development and going to some "software-only" kernel modules like proc file / sysfs or for more complex examples filesystem / network development, developing on a uml/vmware/virtualbox/... machine so crashing your machine won't ...
Learning kernel hacking and embedded development at home? I was always attracted to the world of kernel hacking and embedded systems. Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff? Something like kits for writing drivers etc, which come with good documentation and are af...
TITLE: Learning kernel hacking and embedded development at home? QUESTION: I was always attracted to the world of kernel hacking and embedded systems. Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff? Something like kits for writing drivers etc, which come with good docume...
[ "linux", "kernel", "embedded" ]
37
33
8,491
6
0
2008-09-13T18:48:13.877000
2008-10-06T14:38:26.727000
60,764
60,775
How to load JAR files dynamically at Runtime?
Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load JAR files dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a JAR fi...
The reason it's hard is security. Classloaders are meant to be immutable; you shouldn't be able to willy-nilly add classes to it at runtime. I'm actually very surprised that works with the system classloader. Here's how you do it making your own child classloader: URLClassLoader child = new URLClassLoader( new URL[] {m...
How to load JAR files dynamically at Runtime? Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load JAR files dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least...
TITLE: How to load JAR files dynamically at Runtime? QUESTION: Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load JAR files dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (i...
[ "java", "jar", "classloader" ]
383
312
392,651
21
0
2008-09-13T18:48:19.570000
2008-09-13T19:04:16.613000
60,768
60,781
Unable to load System.Data.Linq.dll for CodeDom
I am trying to dynamicaly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error: Metadata file 'System.Data.Linq.dll' could not be found My code looks like: CompilerParameters compilerParams = new CompilerParameters(); compilerParams.CompilerOptions = "/target:l...
That may be because this assembly is stored in a different location than mscorlib is. It should work if you provide a full path to the assembly. The most convenient way to get the full path is to let the.NET loader do the work for you. I would try something like this: compilerParams.ReferencedAssemblies.Add(typeof(Data...
Unable to load System.Data.Linq.dll for CodeDom I am trying to dynamicaly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error: Metadata file 'System.Data.Linq.dll' could not be found My code looks like: CompilerParameters compilerParams = new CompilerParameter...
TITLE: Unable to load System.Data.Linq.dll for CodeDom QUESTION: I am trying to dynamicaly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error: Metadata file 'System.Data.Linq.dll' could not be found My code looks like: CompilerParameters compilerParams = new...
[ "c#", "codedom" ]
1
3
2,449
2
0
2008-09-13T18:53:25.250000
2008-09-13T19:18:03.490000
60,772
60,777
Is help file (or user manual) dead?
Back in the days of Unix, you couldn't even close a software without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single operation possible in the app. After th...
Have I failed if user could not find out what to do from the UI? If not, what degree of help should I provide? (both for desktop and web app) They should be able to use your your app to do basic things from the UI. eg say for an image editor, they should be able to create a new image, and draw some lines then save it j...
Is help file (or user manual) dead? Back in the days of Unix, you couldn't even close a software without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single ope...
TITLE: Is help file (or user manual) dead? QUESTION: Back in the days of Unix, you couldn't even close a software without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each an...
[ "user-interface", "language-agnostic", "documentation" ]
23
1
769
5
0
2008-09-13T18:56:49.877000
2008-09-13T19:06:27.483000
60,779
60,782
How do you do fuzzy searches using bound parameters in PDO?
Trying to do this sort of thing... WHERE username LIKE '%$str%'...but using bound parameters to prepared statements in PDO. e.g.: $query = $db->prepare("select * from comments where comment like:search"); $query->bindParam(':search', $str); $query->execute(); I've tried numerous permutations of single quotes and % sign...
Ah. Found a comment on php.net that reminded me of the answer; you need to wildcard your value before the bindParam is evaluated, and not worry about quoting it. So for example this works fine: $str = "%$str%"; $query = $db->prepare("select * from comments where comment like:search"); $query->bindParam(':search', $str)...
How do you do fuzzy searches using bound parameters in PDO? Trying to do this sort of thing... WHERE username LIKE '%$str%'...but using bound parameters to prepared statements in PDO. e.g.: $query = $db->prepare("select * from comments where comment like:search"); $query->bindParam(':search', $str); $query->execute(); ...
TITLE: How do you do fuzzy searches using bound parameters in PDO? QUESTION: Trying to do this sort of thing... WHERE username LIKE '%$str%'...but using bound parameters to prepared statements in PDO. e.g.: $query = $db->prepare("select * from comments where comment like:search"); $query->bindParam(':search', $str); $...
[ "php", "sql", "pdo" ]
11
15
2,790
2
0
2008-09-13T19:09:01.953000
2008-09-13T19:21:09.240000
60,785
61,017
How can I show a grey transparent overlay in C#?
How can I show a grey transparent overlay in C#? It should overlay other process which are not owned by the application doing the overlay.
Create a transparent window the size of the whole screen, mark it always-on-top, calculate the regions of your other application windows, and make the non-window regions of the top window grey. I suppose you could just position your own application windows on top of the transparent grey one, with it being above all the...
How can I show a grey transparent overlay in C#? How can I show a grey transparent overlay in C#? It should overlay other process which are not owned by the application doing the overlay.
TITLE: How can I show a grey transparent overlay in C#? QUESTION: How can I show a grey transparent overlay in C#? It should overlay other process which are not owned by the application doing the overlay. ANSWER: Create a transparent window the size of the whole screen, mark it always-on-top, calculate the regions of...
[ "c#" ]
0
1
2,942
2
0
2008-09-13T19:24:13.820000
2008-09-14T00:24:28.217000
60,788
60,798
How can I listen in on shortcuts when the app is the task bar in C#
An example of an app that does this is Enso, it pops up when you press the caps lock.
You can act on global hotkeys by calling the winapi function RegisterHotKey. Also see https://www.codeproject.com/Articles/4345/NET-system-wide-hotkey-component and https://www.codeproject.com/Articles/3055/System-Hotkey-Component for example. You can not use all key combination as hotkeys. For those that don't work yo...
How can I listen in on shortcuts when the app is the task bar in C# An example of an app that does this is Enso, it pops up when you press the caps lock.
TITLE: How can I listen in on shortcuts when the app is the task bar in C# QUESTION: An example of an app that does this is Enso, it pops up when you press the caps lock. ANSWER: You can act on global hotkeys by calling the winapi function RegisterHotKey. Also see https://www.codeproject.com/Articles/4345/NET-system-...
[ "c#", "keyboard-shortcuts" ]
2
3
343
2
0
2008-09-13T19:31:15.783000
2008-09-13T19:47:08.837000
60,794
61,070
Scriptaculous Ajax.Autocompleter extra functionality in LI
I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions to a 'stop words' table, which means that if they occur in the table, they w...
Scriptaculous Autocompleter monitors the onclick event on the 'li'. When you stick an image inside an 'li', both the 'img' and the 'li' will get the click event, as this demonstrates. That's why Autocompleter is just doing its normal thing when the button is clicked: What I'd try is to have your 'onclick' set some sort...
Scriptaculous Ajax.Autocompleter extra functionality in LI I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions to a 'stop words'...
TITLE: Scriptaculous Ajax.Autocompleter extra functionality in LI QUESTION: I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions...
[ "javascript", "prototypejs", "scriptaculous", "autocomplete" ]
1
0
2,320
1
0
2008-09-13T19:43:26.380000
2008-09-14T02:25:57.957000
60,802
86,686
Linq to NHibernate multiple OrderBy calls
I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around? Code: IQueryable items = _agendaRepository.GetAgendaItems(location).Where(item => item.Minutes.Contains(query) || item.Description.Contains(query)); int total = i...
This looks to me like a bug with Linq to NHybernate. One possible workaround is to convert to an array before sorting. A potentially big downside is that you can't limit the results using Skip() and Take() before enumerating, so this may not be sufficient for you. var results = items.ToArray().OrderBy(item => item.Agen...
Linq to NHibernate multiple OrderBy calls I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around? Code: IQueryable items = _agendaRepository.GetAgendaItems(location).Where(item => item.Minutes.Contains(query) || item.De...
TITLE: Linq to NHibernate multiple OrderBy calls QUESTION: I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around? Code: IQueryable items = _agendaRepository.GetAgendaItems(location).Where(item => item.Minutes.Contains...
[ "linq", "nhibernate", "linq-to-nhibernate" ]
6
7
8,076
3
0
2008-09-13T19:55:00.547000
2008-09-17T19:27:40.423000
60,805
60,815
Getting random row through SQLAlchemy
How do I select one or more random rows from a table using SQLAlchemy?
This is very much a database-specific issue. I know that PostgreSQL, SQLite, MySQL, and Oracle have the ability to order by a random function, so you can use this in SQLAlchemy: from sqlalchemy.sql.expression import func, select select.order_by(func.random()) # for PostgreSQL, SQLite select.order_by(func.rand()) # fo...
Getting random row through SQLAlchemy How do I select one or more random rows from a table using SQLAlchemy?
TITLE: Getting random row through SQLAlchemy QUESTION: How do I select one or more random rows from a table using SQLAlchemy? ANSWER: This is very much a database-specific issue. I know that PostgreSQL, SQLite, MySQL, and Oracle have the ability to order by a random function, so you can use this in SQLAlchemy: from s...
[ "python", "sql", "database", "random", "sqlalchemy" ]
103
164
55,812
9
0
2008-09-13T19:58:02.897000
2008-09-13T20:09:28.533000
60,823
60,838
Any tool similar to Hyperterminal application?
HyperTerminal is a program that you can use to connect to other computers, Telnet sites, bulletin board systems (BBSs), online services, and host computers, using either your modem, a null modem cable or Ethernet connection. But My main usage of Hyperterminal is to communicate with hardware through local (virtual )COM ...
Here are two: Tera Term Tera Term (Pro) is a free software terminal emulator (communication program) for MS-Windows. It supports VT100 emulation, telnet connection, serial port connection, and so on. Kermit 95 Kermit 95: Internet and serial communications for Microsoft Windows® 95, Windows 98, Windows ME, Windows NT (4...
Any tool similar to Hyperterminal application? HyperTerminal is a program that you can use to connect to other computers, Telnet sites, bulletin board systems (BBSs), online services, and host computers, using either your modem, a null modem cable or Ethernet connection. But My main usage of Hyperterminal is to communi...
TITLE: Any tool similar to Hyperterminal application? QUESTION: HyperTerminal is a program that you can use to connect to other computers, Telnet sites, bulletin board systems (BBSs), online services, and host computers, using either your modem, a null modem cable or Ethernet connection. But My main usage of Hyperterm...
[ "windows", "windows-vista", "hyperterminal", "virtual-serial-port" ]
8
3
12,997
4
0
2008-09-13T20:18:20.883000
2008-09-13T20:32:03.533000
60,825
60,851
international characters in Javascript
I am working on a web application, where I transfer data from the server to the browser in XML. Since I'm danish, I quickly run into problems with the characters æøå. I know that in html, I use the "&aelig;&oslash;&aring;" for æøå. however, as soon as the chars pass through JavaScript, I get black boxes with "?" in the...
Just specifying UTF-8 in the header is not enough. I'd bet you haven't saved your file as UTF-8. Any reasonably advanced text editor will have this option. Try that and I'm sure it'll work!
international characters in Javascript I am working on a web application, where I transfer data from the server to the browser in XML. Since I'm danish, I quickly run into problems with the characters æøå. I know that in html, I use the "&aelig;&oslash;&aring;" for æøå. however, as soon as the chars pass through JavaSc...
TITLE: international characters in Javascript QUESTION: I am working on a web application, where I transfer data from the server to the browser in XML. Since I'm danish, I quickly run into problems with the characters æøå. I know that in html, I use the "&aelig;&oslash;&aring;" for æøå. however, as soon as the chars p...
[ "javascript", "unicode", "internationalization", "character-encoding" ]
15
12
46,573
7
0
2008-09-13T20:19:38.773000
2008-09-13T20:39:25.840000
60,830
60,850
What is wrong with using inline functions?
While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions? Conclusion: Apparently, There is nothing wrong with using inline functions. But it is worth noting the following points! Overuse of inlining can actually make programs slower. Depending on a func...
It worth pointing out that the inline keyword is actually just a hint to the compiler. The compiler may ignore the inline and simply generate code for the function someplace. The main drawback to inline functions is that it can increase the size of your executable (depending on the number of instantiations). This can b...
What is wrong with using inline functions? While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions? Conclusion: Apparently, There is nothing wrong with using inline functions. But it is worth noting the following points! Overuse of inlining can actuall...
TITLE: What is wrong with using inline functions? QUESTION: While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions? Conclusion: Apparently, There is nothing wrong with using inline functions. But it is worth noting the following points! Overuse of in...
[ "c++", "inline-functions" ]
39
22
15,527
13
0
2008-09-13T20:25:07.450000
2008-09-13T20:38:49.460000
60,848
60,862
How do you retrieve items from a dictionary in the order that they're inserted?
Is it possible to retrieve items from a Python dictionary in the order that they were inserted?
The standard Python dict does this by default if you're using CPython 3.6+ (or Python 3.7+ for any other implementation of Python). On older versions of Python you can use collections.OrderedDict.
How do you retrieve items from a dictionary in the order that they're inserted? Is it possible to retrieve items from a Python dictionary in the order that they were inserted?
TITLE: How do you retrieve items from a dictionary in the order that they're inserted? QUESTION: Is it possible to retrieve items from a Python dictionary in the order that they were inserted? ANSWER: The standard Python dict does this by default if you're using CPython 3.6+ (or Python 3.7+ for any other implementati...
[ "python", "dictionary" ]
68
71
53,506
11
0
2008-09-13T20:38:05.467000
2008-09-13T20:48:36.003000
60,857
60,875
mod_rewrite equivalent for IIS 7.0
Is there a mod_rewrite equivalent for IIS 7.0 that's a) more or less complete b) suitable for a production environment, i.e. battle-tested/dependable/secure Do you have an experience-based recommendation?
Check out the URL Rewrite Module for IIS 7 created by Microsoft
mod_rewrite equivalent for IIS 7.0 Is there a mod_rewrite equivalent for IIS 7.0 that's a) more or less complete b) suitable for a production environment, i.e. battle-tested/dependable/secure Do you have an experience-based recommendation?
TITLE: mod_rewrite equivalent for IIS 7.0 QUESTION: Is there a mod_rewrite equivalent for IIS 7.0 that's a) more or less complete b) suitable for a production environment, i.e. battle-tested/dependable/secure Do you have an experience-based recommendation? ANSWER: Check out the URL Rewrite Module for IIS 7 created by...
[ "iis", "mod-rewrite" ]
25
33
48,453
10
0
2008-09-13T20:43:19.853000
2008-09-13T21:09:45.347000
60,871
61,061
How to solve Memory Fragmentation
We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we've been looking at some alternative memory allocation...
First, I agree with the other posters who suggested a resource leak. You really want to rule that out first. Hopefully, the heap manager you are currently using has a way to dump out the actual total free space available in the heap (across all free blocks) and also the total number of blocks that it is divided over. I...
How to solve Memory Fragmentation We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we've been looking at ...
TITLE: How to solve Memory Fragmentation QUESTION: We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we'v...
[ "c++", "windows", "memory" ]
51
38
52,961
10
0
2008-09-13T21:04:08.043000
2008-09-14T02:12:23.013000
60,874
60,887
Advanced directory switching in bash
I know a few advanced ways, to change directories. pushd and popd (directory stack) or cd - (change to last directory). But I am looking for quick way to achieve the following: Say, I am in a rather deep dir: /this/is/a/very/deep/directory/structure/with\ lot\ of\ nasty/names and I want to switch to /this/is/another/ve...
Do you mean that the path names are the same, and only one directory name changes ("a" becomes "another")? In that case: cd ${PWD/a/another} will switch to the other directory. $PWD holds your current directory, and ${var/foo/bar} gives you $var with the string 'foo' replaced by 'bar'.
Advanced directory switching in bash I know a few advanced ways, to change directories. pushd and popd (directory stack) or cd - (change to last directory). But I am looking for quick way to achieve the following: Say, I am in a rather deep dir: /this/is/a/very/deep/directory/structure/with\ lot\ of\ nasty/names and I ...
TITLE: Advanced directory switching in bash QUESTION: I know a few advanced ways, to change directories. pushd and popd (directory stack) or cd - (change to last directory). But I am looking for quick way to achieve the following: Say, I am in a rather deep dir: /this/is/a/very/deep/directory/structure/with\ lot\ of\ ...
[ "bash" ]
9
10
470
3
0
2008-09-13T21:08:33.133000
2008-09-13T21:24:39.943000
60,877
60,882
SQL Select Bottom Records
I have a query where I wish to retrieve the oldest X records. At present my query is something like the following: SELECT Id, Title, Comments, CreatedDate FROM MyTable WHERE CreatedDate > @OlderThanDate ORDER BY CreatedDate DESC I know that normally I would remove the 'DESC' keyword to switch the order of the records, ...
Why not just use a subquery? SELECT T1.* FROM (SELECT TOP X Id, Title, Comments, CreatedDate FROM MyTable WHERE CreatedDate > @OlderThanDate ORDER BY CreatedDate) T1 ORDER BY CreatedDate DESC
SQL Select Bottom Records I have a query where I wish to retrieve the oldest X records. At present my query is something like the following: SELECT Id, Title, Comments, CreatedDate FROM MyTable WHERE CreatedDate > @OlderThanDate ORDER BY CreatedDate DESC I know that normally I would remove the 'DESC' keyword to switch ...
TITLE: SQL Select Bottom Records QUESTION: I have a query where I wish to retrieve the oldest X records. At present my query is something like the following: SELECT Id, Title, Comments, CreatedDate FROM MyTable WHERE CreatedDate > @OlderThanDate ORDER BY CreatedDate DESC I know that normally I would remove the 'DESC' ...
[ "sql", "sql-server", "t-sql" ]
10
22
19,174
2
0
2008-09-13T21:11:18.307000
2008-09-13T21:17:08.387000
60,878
65,439
Priority of a query in MS SQL
Is there a way to tell MS SQL that a query is not too important and that it can (and should) take its time? Likewise is there a way to tell MS SQL that it should give higher priority to a query?
Not in versions below SQL 2008. In SQL Server 2008 there's the resource governor. Using that you can assign logins to groups based on properties of the login (login name, application name, etc). The groups can then be assigned to resource pools and limitations or restrictions i.t.o. resources can be applied to those re...
Priority of a query in MS SQL Is there a way to tell MS SQL that a query is not too important and that it can (and should) take its time? Likewise is there a way to tell MS SQL that it should give higher priority to a query?
TITLE: Priority of a query in MS SQL QUESTION: Is there a way to tell MS SQL that a query is not too important and that it can (and should) take its time? Likewise is there a way to tell MS SQL that it should give higher priority to a query? ANSWER: Not in versions below SQL 2008. In SQL Server 2008 there's the resou...
[ "sql", "sql-server", "database" ]
24
18
27,046
3
0
2008-09-13T21:11:30.100000
2008-09-15T18:29:31.813000
60,893
60,901
ASP.NET Convert Invalid String to Null
In my application I have TextBox in a FormView bound to a LinqDataSource like so: protected void MyTextBox_TextChanged(object sender, EventArgs e) { MyFormView.UpdateItem(false); } This is inside an UpdatePanel so any change to the field is immediately persisted. Also, the value of MyValue is decimal?. This works fine ...
I think you should handle the Updating event of the LinqDataSource on your page. Do your check for invalid strings (use a TryParse method or something) and then continue with the base class update. (Edit: My intuition lines up with what's recommended here )
ASP.NET Convert Invalid String to Null In my application I have TextBox in a FormView bound to a LinqDataSource like so: protected void MyTextBox_TextChanged(object sender, EventArgs e) { MyFormView.UpdateItem(false); } This is inside an UpdatePanel so any change to the field is immediately persisted. Also, the value o...
TITLE: ASP.NET Convert Invalid String to Null QUESTION: In my application I have TextBox in a FormView bound to a LinqDataSource like so: protected void MyTextBox_TextChanged(object sender, EventArgs e) { MyFormView.UpdateItem(false); } This is inside an UpdatePanel so any change to the field is immediately persisted....
[ "asp.net", "linq", "linq-to-sql", "validation", "data-binding" ]
0
1
1,858
2
0
2008-09-13T21:35:16.953000
2008-09-13T21:46:57.300000
60,904
60,905
How can I open a cmd window in a specific location?
How can I open a cmd window in a specific location without having to navigate all the way to the directory I want?
Try out this "PowerToy" from Microsoft: Open Command Window Here This PowerToy adds an "Open Command Window Here" context menu option on file system folders, giving you a quick way to open a command window (cmd.exe) pointing at the selected folder. EDIT: This software will not work on any version of Windows apart from ...
How can I open a cmd window in a specific location? How can I open a cmd window in a specific location without having to navigate all the way to the directory I want?
TITLE: How can I open a cmd window in a specific location? QUESTION: How can I open a cmd window in a specific location without having to navigate all the way to the directory I want? ANSWER: Try out this "PowerToy" from Microsoft: Open Command Window Here This PowerToy adds an "Open Command Window Here" context menu...
[ "windows", "cmd" ]
444
65
1,057,519
41
0
2008-09-13T21:51:07.960000
2008-09-13T21:53:35.223000
60,910
60,948
Changing the font in Aquamacs?
I've recently had a need to do a bit of lisp editing and I found the nifty Ready Lisp package for OS X, which is great, except Aquamacs automatically uses a proportional font (which is idiotic, IMHO) and I want to change it to a monospace font. However, I'm not really much of an EMACS user, and the preferences menu in ...
This is what I have in my.emacs for OS X: (set-default-font "-apple-bitstream vera sans mono-medium-r-normal--0-0-0-0-m-0-mac-roman") Now, I'm not sure Bitstream Vera comes standard on OS X, so you may have to either download it or choose a different font. You can search the X font names by running (x-list-fonts "searc...
Changing the font in Aquamacs? I've recently had a need to do a bit of lisp editing and I found the nifty Ready Lisp package for OS X, which is great, except Aquamacs automatically uses a proportional font (which is idiotic, IMHO) and I want to change it to a monospace font. However, I'm not really much of an EMACS use...
TITLE: Changing the font in Aquamacs? QUESTION: I've recently had a need to do a bit of lisp editing and I found the nifty Ready Lisp package for OS X, which is great, except Aquamacs automatically uses a proportional font (which is idiotic, IMHO) and I want to change it to a monospace font. However, I'm not really mu...
[ "macos", "emacs", "lisp", "aquamacs" ]
11
7
8,056
5
0
2008-09-13T21:55:20.120000
2008-09-13T22:31:21.623000
60,919
60,934
Does SqlCommand.Dispose close the connection?
Can I use this approach efficiently? using(SqlCommand cmd = new SqlCommand("GetSomething", new SqlConnection(Config.ConnectionString)) { cmd.Connection.Open(); // set up parameters and CommandType to StoredProcedure etc. etc. cmd.ExecuteNonQuery(); } My concern is: Will the Dispose method of the SqlCommand (which is ca...
No, Disposing of the SqlCommand will not effect the Connection. A better approach would be to also wrap the SqlConnection in a using block as well: using (SqlConnection conn = new SqlConnection(connstring)) { conn.Open(); using (SqlCommand cmd = new SqlCommand(cmdstring, conn)) { cmd.ExecuteNonQuery(); } } Otherwise, t...
Does SqlCommand.Dispose close the connection? Can I use this approach efficiently? using(SqlCommand cmd = new SqlCommand("GetSomething", new SqlConnection(Config.ConnectionString)) { cmd.Connection.Open(); // set up parameters and CommandType to StoredProcedure etc. etc. cmd.ExecuteNonQuery(); } My concern is: Will the...
TITLE: Does SqlCommand.Dispose close the connection? QUESTION: Can I use this approach efficiently? using(SqlCommand cmd = new SqlCommand("GetSomething", new SqlConnection(Config.ConnectionString)) { cmd.Connection.Open(); // set up parameters and CommandType to StoredProcedure etc. etc. cmd.ExecuteNonQuery(); } My co...
[ ".net", "garbage-collection", "dispose", "sqlconnection", "sqlcommand" ]
61
124
46,958
4
0
2008-09-13T22:10:29.537000
2008-09-13T22:20:59.667000
60,920
60,924
What is the best implementation for DB Audit Trail?
A DB Audit Trail captures the User Last Modified, Modified Date, and Created Date. There are several possible implementations: SQL Server Triggers Add UserModified, ModifiedDate, CreatedDate columns to the database and include logic in Stored Procedures or Insert, Update statements accordingly. It would be nice if you ...
Depending on what you're doing, you might want to move the audit out of the data layer into the data access layer. It give you more control. I asked a similar question wrt NHibernate and SqlServer here.
What is the best implementation for DB Audit Trail? A DB Audit Trail captures the User Last Modified, Modified Date, and Created Date. There are several possible implementations: SQL Server Triggers Add UserModified, ModifiedDate, CreatedDate columns to the database and include logic in Stored Procedures or Insert, Upd...
TITLE: What is the best implementation for DB Audit Trail? QUESTION: A DB Audit Trail captures the User Last Modified, Modified Date, and Created Date. There are several possible implementations: SQL Server Triggers Add UserModified, ModifiedDate, CreatedDate columns to the database and include logic in Stored Procedu...
[ "sql-server", "audit" ]
3
6
3,863
4
0
2008-09-13T22:10:40.037000
2008-09-13T22:14:19.840000
60,939
60,965
The best way to start a project
When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the project. When you are starting, what is your firs...
The only thing that works for me: Create the smallest possible implementation of it that's somehow usable and then use it.
The best way to start a project When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the project. When you...
TITLE: The best way to start a project QUESTION: When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the...
[ "project-management", "projects", "project-planning" ]
24
16
4,238
14
0
2008-09-13T22:27:38.247000
2008-09-13T22:52:26.457000
60,942
60,955
How can I send the stdout of one process to multiple processes using (preferably unnamed) pipes in Unix (or Windows)?
I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3: proc2 -> stdout / proc1 \ proc3 -> stdout I tried proc1 | (proc2 & proc3) but it doesn't seem to work, i.e. echo 123 | (tr 1 a & tr 1 b) writes b23 to stdout instead of a23 b23
Editor's note: - >(…) is a process substitution that is a nonstandard shell feature of some POSIX-compatible shells: bash, ksh, zsh. - This answer accidentally sends the output process substitution's output through the pipeline too: echo 123 | tee >(tr 1 a) | tr 1 b. - Output from the process substitutions will be unpr...
How can I send the stdout of one process to multiple processes using (preferably unnamed) pipes in Unix (or Windows)? I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3: proc2 -> stdout / proc1 \ proc3 -> stdout I tried proc1 | (proc2 & proc3) but it doesn't seem to work, i.e. echo 123 | ...
TITLE: How can I send the stdout of one process to multiple processes using (preferably unnamed) pipes in Unix (or Windows)? QUESTION: I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3: proc2 -> stdout / proc1 \ proc3 -> stdout I tried proc1 | (proc2 & proc3) but it doesn't seem to work...
[ "windows", "bash", "unix", "shell", "pipe" ]
88
139
33,739
6
0
2008-09-13T22:28:36.590000
2008-09-13T22:37:53.527000
60,944
61,029
What are the CSS secrets to a flexible/fluid HTML form?
The below HTML/CSS/Javascript (jQuery) code displays the #makes select box. Selecting an option displays the #models select box with relevant options. The #makes select box sits off-center and the #models select box fills the empty space when it is displayed. How do you style the form so that the #makes select box is c...
It's not entirely clear from your question what layout you're trying to achieve, but judging by that fact that you have applied "float:left" to the select elements, it looks like you want the select elements to appear side by side. If this is the case, you can achieve this by doing the following: To centrally align ele...
What are the CSS secrets to a flexible/fluid HTML form? The below HTML/CSS/Javascript (jQuery) code displays the #makes select box. Selecting an option displays the #models select box with relevant options. The #makes select box sits off-center and the #models select box fills the empty space when it is displayed. How ...
TITLE: What are the CSS secrets to a flexible/fluid HTML form? QUESTION: The below HTML/CSS/Javascript (jQuery) code displays the #makes select box. Selecting an option displays the #models select box with relevant options. The #makes select box sits off-center and the #models select box fills the empty space when it ...
[ "javascript", "jquery", "html", "css" ]
0
1
2,265
2
0
2008-09-13T22:29:57.213000
2008-09-14T00:46:57.990000
60,967
61,144
How do I keep track of related windows in X11?
Unfortunately, my question is not as simple as keeping track of two windows created by the same process. Here is what I have: Two users, Jack and Jim are remotely logged in to the same Unix system and run X servers Jack runs an application, 'AwesomeApp', that opens a GUI in a X window Jim runs another instance of this ...
You can use pgrep to get the process ID of Jack's instance of AwesomeApp: pgrep -u Jack AwesomeApp So if you launch the supervisor application from a shell script, you could do something like the following: AWESOME_ID=`pgrep -u $USER AwesomeApp 2>/dev/null` # run the supervisor application and pass the process id as t...
How do I keep track of related windows in X11? Unfortunately, my question is not as simple as keeping track of two windows created by the same process. Here is what I have: Two users, Jack and Jim are remotely logged in to the same Unix system and run X servers Jack runs an application, 'AwesomeApp', that opens a GUI i...
TITLE: How do I keep track of related windows in X11? QUESTION: Unfortunately, my question is not as simple as keeping track of two windows created by the same process. Here is what I have: Two users, Jack and Jim are remotely logged in to the same Unix system and run X servers Jack runs an application, 'AwesomeApp', ...
[ "x11" ]
1
1
369
1
0
2008-09-13T22:59:54.300000
2008-09-14T05:19:11.613000
60,972
61,304
How do you create a database from an EDM?
How do you create a database from an Entity Data Model. So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server.
From what I understand you are not just supposed to use EDM as a "pretty" database designer, in fact EDM does not depend on a specific storage layer. It tries to abstract that part for the developer. There are design schemas (CSDL) and storage schemas (SSDL). Anyway, don't mean to lecture you.;) There is EDM Generator,...
How do you create a database from an EDM? How do you create a database from an Entity Data Model. So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server.
TITLE: How do you create a database from an EDM? QUESTION: How do you create a database from an Entity Data Model. So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server. ANSWER: From what I understand you are not just supp...
[ "sql", "entity-framework", "ado.net" ]
2
1
5,717
5
0
2008-09-13T23:14:51.380000
2008-09-14T12:43:59.733000
60,977
61,105
Resetting detection of source file changes
Sometimes I have to work on code that moves the computer clock forward. In this case some.cpp or.h files get their latest modification date set to the future time. Later on, when my clock is fixed, and I compile my sources, system rebuilds most of the project because some of the latest modification dates are in the fut...
If this was my problem, I'd look for ways to avoid mucking with the system time. Isolating the code under unit tests, or a virtual machine, or something. However, because I love PowerShell: Get-ChildItem -r. |? { $_.LastWriteTime -gt ([DateTime]::Now) } | Set-ItemProperty -Name "LastWriteTime" -Value ([DateTime]::Now)
Resetting detection of source file changes Sometimes I have to work on code that moves the computer clock forward. In this case some.cpp or.h files get their latest modification date set to the future time. Later on, when my clock is fixed, and I compile my sources, system rebuilds most of the project because some of t...
TITLE: Resetting detection of source file changes QUESTION: Sometimes I have to work on code that moves the computer clock forward. In this case some.cpp or.h files get their latest modification date set to the future time. Later on, when my clock is fixed, and I compile my sources, system rebuilds most of the project...
[ "c++", "visual-studio", "svn", "time", "timezone" ]
0
1
330
6
0
2008-09-13T23:19:40.510000
2008-09-14T03:35:23.920000
61,000
4,540,307
Development directory Structure
I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc. I recently used a Maven structure for a java project, but I am not sure it's the best structure for a non-maven driven project. So, I have two questions: When you guy...
After a couple years working with different structures I recently found a structure that hols most variations for me: /project_name (everything goes here) /web (htdocs) /img /css /app (usually some framework or sensitive code) /lib (externa libs) /vendor_1 /vendor_2 /tmp /cache /sql (sql scripts usually with maybe diag...
Development directory Structure I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc. I recently used a Maven structure for a java project, but I am not sure it's the best structure for a non-maven driven project. So, I ...
TITLE: Development directory Structure QUESTION: I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc. I recently used a Maven structure for a java project, but I am not sure it's the best structure for a non-maven driv...
[ "directory-structure" ]
6
5
8,341
4
0
2008-09-14T00:01:15.510000
2010-12-27T16:57:01.597000
61,002
62,303
How can I generate a git diff of what's changed since the last time I pulled?
I'd like to script, preferably in rake, the following actions into a single command: Get the version of my local git repository. Git pull the latest code. Git diff from the version I extracted in step #1 to what is now in my local repository. In other words, I want to get the latest code form the central repository and...
You could do this fairly simply with refspecs. git pull origin git diff @{1}.. That will give you a diff of the current branch as it existed before and after the pull. Note that if the pull doesn't actually update the current branch, the diff will give you the wrong results. Another option is to explicitly record the c...
How can I generate a git diff of what's changed since the last time I pulled? I'd like to script, preferably in rake, the following actions into a single command: Get the version of my local git repository. Git pull the latest code. Git diff from the version I extracted in step #1 to what is now in my local repository....
TITLE: How can I generate a git diff of what's changed since the last time I pulled? QUESTION: I'd like to script, preferably in rake, the following actions into a single command: Get the version of my local git repository. Git pull the latest code. Git diff from the version I extracted in step #1 to what is now in my...
[ "git", "diff", "rake", "pull" ]
84
102
53,025
4
0
2008-09-14T00:02:41.420000
2008-09-15T12:21:01.310000
61,005
61,044
How do I determine the permission settings for PHP scripts?
What are the best file permission settings for PHP scripts? Any suggestions on ways to figure out the minimum required permissions?
WalloWizard is correct that you should only use the minimum permissions necessary for the script to function. However, let me be more specific, assuming that you're running on a Unix-based system such as Linux or BSD or Mac OSX. Your web server usually runs as an unprivileged user such as "nobody" and your scripts need...
How do I determine the permission settings for PHP scripts? What are the best file permission settings for PHP scripts? Any suggestions on ways to figure out the minimum required permissions?
TITLE: How do I determine the permission settings for PHP scripts? QUESTION: What are the best file permission settings for PHP scripts? Any suggestions on ways to figure out the minimum required permissions? ANSWER: WalloWizard is correct that you should only use the minimum permissions necessary for the script to f...
[ "php" ]
2
5
415
2
0
2008-09-14T00:09:05.727000
2008-09-14T01:30:59.023000
61,008
61,019
What steps should be necessary to optimize a poorly performing query?
I know this is a broad question, but I've inherited several poor performers and need to optimize them badly. I was wondering what are the most common steps involved to optimize. So, what steps do some of you guys take when faced with the same situation? Related Question: What generic techniques can be applied to optimi...
Look at the execution plan in query analyzer See what step costs the most Optimize the step! Return to step 1 [thx to Vinko ]
What steps should be necessary to optimize a poorly performing query? I know this is a broad question, but I've inherited several poor performers and need to optimize them badly. I was wondering what are the most common steps involved to optimize. So, what steps do some of you guys take when faced with the same situati...
TITLE: What steps should be necessary to optimize a poorly performing query? QUESTION: I know this is a broad question, but I've inherited several poor performers and need to optimize them badly. I was wondering what are the most common steps involved to optimize. So, what steps do some of you guys take when faced wit...
[ "sql-server", "optimization" ]
10
15
5,945
7
0
2008-09-14T00:13:07.073000
2008-09-14T00:24:56.030000
61,033
61,039
How to check if a value already exists to avoid duplicates?
I've got a table of URLs and I don't want any duplicate URLs. How do I check to see if a given URL is already in the table using PHP/MySQL?
If you don't want to have duplicates you can do following: add uniqueness constraint use " REPLACE " or " INSERT... ON DUPLICATE KEY UPDATE " syntax If multiple users can insert data to DB, method suggested by @Jeremy Ruten, can lead to an error: after you performed a check someone can insert similar data to the table.
How to check if a value already exists to avoid duplicates? I've got a table of URLs and I don't want any duplicate URLs. How do I check to see if a given URL is already in the table using PHP/MySQL?
TITLE: How to check if a value already exists to avoid duplicates? QUESTION: I've got a table of URLs and I don't want any duplicate URLs. How do I check to see if a given URL is already in the table using PHP/MySQL? ANSWER: If you don't want to have duplicates you can do following: add uniqueness constraint use " RE...
[ "php", "sql", "mysql" ]
32
39
93,552
17
0
2008-09-14T01:02:10.107000
2008-09-14T01:20:55.240000
61,051
61,414
When did browsers start supporting multiple classes per tag?
You can use more than one css class in an HTML tag in current web browsers, e.g.: foo bar This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature?
@Wayne Kao - IE6 has no problem reading more than one class name on an element, and applying styles that belong to each class. What the article is referring to is creating new styles based on the combination of class names. content.bold { font-weight: 800; }.italic { font-style: italic; { IE6 would apply both bold and ...
When did browsers start supporting multiple classes per tag? You can use more than one css class in an HTML tag in current web browsers, e.g.: foo bar This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature?
TITLE: When did browsers start supporting multiple classes per tag? QUESTION: You can use more than one css class in an HTML tag in current web browsers, e.g.: foo bar This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature? ANSWER: @Wayne Kao - IE6 has no problem...
[ "html", "css", "browser" ]
4
9
4,243
4
0
2008-09-14T01:48:50.650000
2008-09-14T15:37:48.833000
61,057
71,514
Loading Assemblies from the Network
This is related to the this question and the answer maybe the same but I'll ask anyways. I understand that we can start managed executables from the network from.NET 3.5 SP1 but what about assemblies loaded from inside the executable? Does the same thing apply?
You have been able to load Assemblies from the network at leasst from.NET 2.0. I have used this on a previous project. The only thing to watch is the size of the assembly and the number and size of the dependancies that it is loading. If you are using a seperate AppDomain, then you will need to take special considerati...
Loading Assemblies from the Network This is related to the this question and the answer maybe the same but I'll ask anyways. I understand that we can start managed executables from the network from.NET 3.5 SP1 but what about assemblies loaded from inside the executable? Does the same thing apply?
TITLE: Loading Assemblies from the Network QUESTION: This is related to the this question and the answer maybe the same but I'll ask anyways. I understand that we can start managed executables from the network from.NET 3.5 SP1 but what about assemblies loaded from inside the executable? Does the same thing apply? ANS...
[ "security", ".net-3.5", "dll", "assemblies", "networking" ]
1
2
216
2
0
2008-09-14T02:02:12.990000
2008-09-16T11:54:33.360000
61,071
61,148
How do I disassemble a VC++ application?
I believe the application has some parts that target.NET, and some that don't. I'm particularly interested in looking at the resource files, if there are any.
To add to aku's excellent answer, for English speakers, IDA Pro is available at http://www.hex-rays.com/.
How do I disassemble a VC++ application? I believe the application has some parts that target.NET, and some that don't. I'm particularly interested in looking at the resource files, if there are any.
TITLE: How do I disassemble a VC++ application? QUESTION: I believe the application has some parts that target.NET, and some that don't. I'm particularly interested in looking at the resource files, if there are any. ANSWER: To add to aku's excellent answer, for English speakers, IDA Pro is available at http://www.he...
[ "c++", "resources", "reverse-engineering" ]
4
1
3,284
6
0
2008-09-14T02:29:06.200000
2008-09-14T05:24:28.247000
61,073
354,156
How can I make my VS2008 x86 installer install x64 assemblies on x64?
I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my.NET product. I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers were getting crashes on startup with errors about the assembly not bei...
If I understand you correctly, you want to do a copy of one file if you're installing on x86 and different file (with the same name) if you're installing on a x64 platform. First of all, you cannot create one MSI for 2 different platforms, since a x64 MSI simply will not run on a x86 platform and a x86 MSI will be inst...
How can I make my VS2008 x86 installer install x64 assemblies on x64? I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my.NET product. I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers ...
TITLE: How can I make my VS2008 x86 installer install x64 assemblies on x64? QUESTION: I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my.NET product. I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); th...
[ "visual-studio-2008", "installation", "windows-installer", "x86", "64-bit" ]
5
3
3,228
3
0
2008-09-14T02:31:05.993000
2008-12-09T20:40:06.177000
61,084
61,141
Empty namespace using Linq Xml
I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g. XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new XElement(ns + "urlset", new XElement("url", ...
The "more correct way" would be: XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new XElement(ns + "urlset", new XElement(ns + "url", new XElement(ns + "loc", "http://www.example.com/page"), new XElement(ns + "lastmod", "2008-09-14")))); Same as your code, but with the "ns +" before every eleme...
Empty namespace using Linq Xml I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g. XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new XElement(ns + ...
TITLE: Empty namespace using Linq Xml QUESTION: I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g. XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), ...
[ "xml", "linq" ]
34
44
5,909
3
0
2008-09-14T03:03:48.800000
2008-09-14T05:00:22.063000
61,085
61,243
SQLite/PHP read-only?
I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culp...
Kyle, in order for PDO/Sqlite to work you need write permission to directory where your database resides. Also, I see you perform multiple selects in loop. This may be ok if you are building something small and not heavy loaded. Otherwise I'd suggest building single query that returns multiple rows and process them in ...
SQLite/PHP read-only? I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file p...
TITLE: SQLite/PHP read-only? QUESTION: I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. ...
[ "php", "sqlite", "permissions", "pdo" ]
9
12
10,050
6
0
2008-09-14T03:04:29.907000
2008-09-14T10:04:25.077000
61,092
61,171
Close and Dispose - which to call?
Having read the threads Is SqlCommand.Dispose enough? and Closing and Disposing a WCF Service I am wondering for classes such as SqlConnection or one of the several classes inheriting from the Stream class does it matter if I close Dispose rather than Close?
I want to clarify this situation. According to Microsoft guidelines, it's a good practice to provide Close method where suitable. Here is a citation from Framework design guidelines Consider providing method Close(), in addition to the Dispose(), if close is standard terminology in the area. When doing so, it is import...
Close and Dispose - which to call? Having read the threads Is SqlCommand.Dispose enough? and Closing and Disposing a WCF Service I am wondering for classes such as SqlConnection or one of the several classes inheriting from the Stream class does it matter if I close Dispose rather than Close?
TITLE: Close and Dispose - which to call? QUESTION: Having read the threads Is SqlCommand.Dispose enough? and Closing and Disposing a WCF Service I am wondering for classes such as SqlConnection or one of the several classes inheriting from the Stream class does it matter if I close Dispose rather than Close? ANSWER:...
[ ".net" ]
191
232
159,037
8
0
2008-09-14T03:17:31.607000
2008-09-14T06:48:45.157000
61,110
61,134
How to save the output of a console application
I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program execution. The workaround I use while I don't find ...
The perfect solution for this is to use log4net with a console appender and a file appender. There are many other appenders available as well. It also allows you to turn the different appenders off and on at runtime.
How to save the output of a console application I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program exe...
TITLE: How to save the output of a console application QUESTION: I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the ...
[ "c#", ".net", "console", "stdout" ]
11
6
8,097
6
0
2008-09-14T03:50:10.687000
2008-09-14T04:45:42.800000
61,143
61,257
Recursive lambda expression to traverse a tree in C#
Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#.
Ok, I found some free time finally. Here we go: class TreeNode { public string Value { get; set;} public List Nodes { get; set;} public TreeNode() { Nodes = new List (); } } Action traverse = null; traverse = (n) => { Console.WriteLine(n.Value); n.Nodes.ForEach(traverse);}; var root = new TreeNode { Value = "Root" ...
Recursive lambda expression to traverse a tree in C# Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#.
TITLE: Recursive lambda expression to traverse a tree in C# QUESTION: Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#. ANSWER: Ok, I found some free time finally. Here we go: class TreeNode { public string Value { get; set;} public List Nodes { get; set;} public ...
[ "c#", "recursion", "lambda" ]
66
82
36,175
4
0
2008-09-14T05:17:44.017000
2008-09-14T10:44:56.853000
61,150
61,215
Mocking Static Blocks in Java
My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make use of Static Blocks and these a...
When I run into this problem, I usually do the same thing you describe, except I make the static method protected so I can invoke it manually. On top of this, I make sure that the method can be invoked multiple times without problems (otherwise it is no better than the static initializer as far as the tests go). This w...
Mocking Static Blocks in Java My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make us...
TITLE: Mocking Static Blocks in Java QUESTION: My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy...
[ "java", "unit-testing", "mocking", "jmockit", "static-block" ]
53
6
60,605
10
0
2008-09-14T05:31:57.430000
2008-09-14T09:17:33.067000
61,155
61,200
What is the best way to position a div in CSS?
I'm trying to place this menu on the left hand side of the page: Categories Weapons Armor Manuals Sustenance Test The problem is that if I use absolute or fixed values, different screen sizes will render the navigation bar differently. I also have a second div that contains all the main content which also needs to be m...
float is indeed the right property to achieve this. However, the example given by bmatthews68 can be improved. The most important thing about floating boxes is that they must specify an explicit width. This can be rather inconvenient but this is the way CSS works. However, notice that px is a unit of measure that has n...
What is the best way to position a div in CSS? I'm trying to place this menu on the left hand side of the page: Categories Weapons Armor Manuals Sustenance Test The problem is that if I use absolute or fixed values, different screen sizes will render the navigation bar differently. I also have a second div that contain...
TITLE: What is the best way to position a div in CSS? QUESTION: I'm trying to place this menu on the left hand side of the page: Categories Weapons Armor Manuals Sustenance Test The problem is that if I use absolute or fixed values, different screen sizes will render the navigation bar differently. I also have a secon...
[ "css", "layout" ]
1
5
9,801
5
0
2008-09-14T06:01:37.050000
2008-09-14T08:29:26.413000
61,180
61,183
Web in a desktop application: Good web browser controls?
I've been utlising a "web browser control" in desktop based applications (in my case Windows Forms.NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet where required. I'm really tired of the IE browser control because of the p...
hmm..Interestingly Mozilla seems to provide ActiveX control K-Melon is another Gecko based browser control
Web in a desktop application: Good web browser controls? I've been utlising a "web browser control" in desktop based applications (in my case Windows Forms.NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet where required. I'...
TITLE: Web in a desktop application: Good web browser controls? QUESTION: I've been utlising a "web browser control" in desktop based applications (in my case Windows Forms.NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet ...
[ "browser", "controls", "desktop-application" ]
0
1
626
2
0
2008-09-14T07:23:37.897000
2008-09-14T07:27:22.037000
61,211
61,218
Tools to create maximum velocity in a .NET dev team
If you were to self-fund a software project which tools, frameworks, components would you employ to ensure maximum productivity for the dev team and that the "real" problem is being worked on. What I'm looking for are low friction tools which get the job done with a minimum of fuss. Tools I'd characterize as such are S...
Versioning. Subversion is the popular choice. If you can afford it, Team Foundation Server offers some benefits. If you want to be super-modern, consider a distributed versioning system, such as git, bazaar or Mercurial. Whatever you do, don't use SourceSafe or other lock-based tools, but rather merge-baseed ones. Cons...
Tools to create maximum velocity in a .NET dev team If you were to self-fund a software project which tools, frameworks, components would you employ to ensure maximum productivity for the dev team and that the "real" problem is being worked on. What I'm looking for are low friction tools which get the job done with a m...
TITLE: Tools to create maximum velocity in a .NET dev team QUESTION: If you were to self-fund a software project which tools, frameworks, components would you employ to ensure maximum productivity for the dev team and that the "real" problem is being worked on. What I'm looking for are low friction tools which get the...
[ ".net" ]
10
22
705
10
0
2008-09-14T09:04:41.693000
2008-09-14T09:19:42.500000
61,212
64,966
How do I remove local (untracked) files from the current Git working tree?
How do I delete untracked local files from the current working tree?
git-clean - Remove untracked files from the working tree Synopsis git clean [-d] [-f] [-i] [-n] [-q] [-e ] [-x | -X] [--] …​ Description Cleans the working tree by recursively removing files that are not under version control, starting from the current directory. Normally, only files unknown to Git are removed, but if ...
How do I remove local (untracked) files from the current Git working tree? How do I delete untracked local files from the current working tree?
TITLE: How do I remove local (untracked) files from the current Git working tree? QUESTION: How do I delete untracked local files from the current working tree? ANSWER: git-clean - Remove untracked files from the working tree Synopsis git clean [-d] [-f] [-i] [-n] [-q] [-e ] [-x | -X] [--] …​ Description Cleans the w...
[ "git", "branch", "git-branch" ]
8,116
9,799
3,185,902
42
0
2008-09-14T09:06:10.647000
2008-09-15T17:32:55.957000
61,217
66,448
Getting HTML from a page behind a login
This question is a follow up to my previous question about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" using the webclient object: WebClient ww = new WebClient(); ww.DownloadString("...
Just pass valid login parameters to a given URI. Should help you out. If you don't have login information you shouldn't be trying to circumvent it. public static string HttpPost( string URI, string Parameters ) { System.Net.WebRequest req = System.Net.WebRequest.Create( URI ); req.ContentType = "application/x-www-form-...
Getting HTML from a page behind a login This question is a follow up to my previous question about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" using the webclient object: WebClient ww...
TITLE: Getting HTML from a page behind a login QUESTION: This question is a follow up to my previous question about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" using the webclient ob...
[ "asp.net", "html", "screen-scraping" ]
1
1
1,269
8
0
2008-09-14T09:19:09.257000
2008-09-15T20:09:53.193000
61,219
61,225
Debug.Assert vs. Specific Thrown Exceptions
I've just started skimming 'Debugging MS.Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...). He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.: Debug.Assert(i > 3, "i > 3", "This means I got a bad parameter"); Now, per...
Assertions are not for parameter checking. Parameter checking should always be done (and precisely according to what pre-conditions are specified in your documentation and/or specification), and the ArgumentOutOfRangeException thrown as necessary. Assertions are for testing for "impossible" situations, i.e., things tha...
Debug.Assert vs. Specific Thrown Exceptions I've just started skimming 'Debugging MS.Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...). He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.: Debug.Assert(i > 3, "i > 3", "...
TITLE: Debug.Assert vs. Specific Thrown Exceptions QUESTION: I've just started skimming 'Debugging MS.Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...). He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.: Debug.Assert...
[ "c#", "exception", "assert" ]
33
51
10,264
8
0
2008-09-14T09:19:44.310000
2008-09-14T09:26:56.133000
61,227
61,229
C variable and constant value comparison not matching
If I have: signed char * p; and I do a comparison: if ( *p == 0xFF ) break; it will never catch 0XFF, but if I replace it with -1 it will: if ( *p == (signed char)0xFF ) break; How can this happen? Is it something with the sign flag? I though that 0xFF == -1 == 255.
The value 0xFF is a signed int value. C will promote the *p to an int when doing the comparison, so the first if statement is equivalent to: if( -1 == 255 ) break; which is of course false. By using (signed char)0xFF the statement is equivalent to: if( -1 == -1 ) break; which works as you expect. The key point here is ...
C variable and constant value comparison not matching If I have: signed char * p; and I do a comparison: if ( *p == 0xFF ) break; it will never catch 0XFF, but if I replace it with -1 it will: if ( *p == (signed char)0xFF ) break; How can this happen? Is it something with the sign flag? I though that 0xFF == -1 == 255.
TITLE: C variable and constant value comparison not matching QUESTION: If I have: signed char * p; and I do a comparison: if ( *p == 0xFF ) break; it will never catch 0XFF, but if I replace it with -1 it will: if ( *p == (signed char)0xFF ) break; How can this happen? Is it something with the sign flag? I though that ...
[ "c" ]
8
29
2,613
4
0
2008-09-14T09:29:39.780000
2008-09-14T09:33:39.723000
61,233
4,671,129
The Best Way to shred XML data into SQL Server database columns
What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so: INSERT INTO some_table (column1, column2, column3) SELECT Rows.n.value('(@column1)[1]', 'varchar(20)'), Rows.n.value('(@column2)[1]', 'nvarchar(100)'), Rows.n.value('(@column3)[1]...
Stumbled across this question whilst having a very similar problem, I'd been running a query processing a 7.5MB XML file (~approx 10,000 nodes) for around 3.5~4 hours before finally giving up. However, after a little more research I found that having typed the XML using a schema and created an XML Index (I'd bulk inser...
The Best Way to shred XML data into SQL Server database columns What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so: INSERT INTO some_table (column1, column2, column3) SELECT Rows.n.value('(@column1)[1]', 'varchar(20)'), Rows.n.valu...
TITLE: The Best Way to shred XML data into SQL Server database columns QUESTION: What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so: INSERT INTO some_table (column1, column2, column3) SELECT Rows.n.value('(@column1)[1]', 'varchar(...
[ "sql-server", "xml" ]
28
57
73,859
8
0
2008-09-14T09:39:29.613000
2011-01-12T16:21:04.707000
61,253
61,283
How to be notified of file/directory change in C/C++, ideally using POSIX
The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Windows and Linux, but I use mac, so I thought posix may help?)
Linux users can use inotify inotify is a Linux kernel subsystem that provides file system event notification. Some goodies for Windows fellows: File Change Notification on MSDN " When Folders Change " article File System Notification on Change
How to be notified of file/directory change in C/C++, ideally using POSIX The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Windows and Linux, but I...
TITLE: How to be notified of file/directory change in C/C++, ideally using POSIX QUESTION: The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Window...
[ "c++", "c", "posix" ]
29
30
22,100
7
0
2008-09-14T10:37:55.683000
2008-09-14T11:32:43.070000