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
88,775
88,958
Disable (Politely) a website when the sql server is offline
I work at a college and have been developing an ASP.NET site with many, many reports about students, attendance stats... The basis for the data is an MSSQL server DB which is the back end to our student management system. This has a regular maintenance period on Thursday mornings for an unknown length of time (dependen...
I would suggest doing it in Application_PreRequestHandlerExecute instead of after an error occurs. Generally, it'd be best not to enter normal processing if you know your database isn't available. I typically use something like below void Application_PreRequestHandlerExecute(Object sender, EventArgs e) { string sPage =...
Disable (Politely) a website when the sql server is offline I work at a college and have been developing an ASP.NET site with many, many reports about students, attendance stats... The basis for the data is an MSSQL server DB which is the back end to our student management system. This has a regular maintenance period ...
TITLE: Disable (Politely) a website when the sql server is offline QUESTION: I work at a college and have been developing an ASP.NET site with many, many reports about students, attendance stats... The basis for the data is an MSSQL server DB which is the back end to our student management system. This has a regular m...
[ "sql", "asp.net", "maintenance-mode" ]
3
1
1,303
8
0
2008-09-17T23:52:01.053000
2008-09-18T00:39:18.880000
88,791
88,807
What do you think of using properties as object initializers in C#;
I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for. An example... public class Person { string firstName; string lastName; public string FirstName { get { return firstName; } set { firstName = value;...
What you see here is some syntatic sugar provided by the compiler. Under the hood what it really does is something like: Person p = new Person( FirstName = "Joe", LastName = "Smith" ); Person _p$1 = new Person(); _p$1.FirstName = "Joe"; _p$1.LastName = "Smith"; Person p = _p$1; So IMHO you are not really breaking any c...
What do you think of using properties as object initializers in C#; I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for. An example... public class Person { string firstName; string lastName; public s...
TITLE: What do you think of using properties as object initializers in C#; QUESTION: I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for. An example... public class Person { string firstName; string l...
[ "c#" ]
3
10
474
12
0
2008-09-17T23:57:35.643000
2008-09-18T00:01:33.277000
88,797
88,964
VS2008 Crashing on Project Load
I am unable to load any existing projects after starting VS2008. When I try to open an existing project VS2008 will crash. It looks like it is crashing when trying to load a floating window in VS but I cant tell which one. When I launch the debugger on the crashed instance I get the following message which is not very ...
You can also try running devenv.exe with the /ResetSettings argument (which will reset any custom settings you have) or with the /SafeMode flag. /SafeMode won't help you fix your problem but it will at least narrow down the issue to the things that are different between safe and regular mode.
VS2008 Crashing on Project Load I am unable to load any existing projects after starting VS2008. When I try to open an existing project VS2008 will crash. It looks like it is crashing when trying to load a floating window in VS but I cant tell which one. When I launch the debugger on the crashed instance I get the foll...
TITLE: VS2008 Crashing on Project Load QUESTION: I am unable to load any existing projects after starting VS2008. When I try to open an existing project VS2008 will crash. It looks like it is crashing when trying to load a floating window in VS but I cant tell which one. When I launch the debugger on the crashed insta...
[ "visual-studio-2008" ]
3
3
1,743
2
0
2008-09-17T23:59:12.393000
2008-09-18T00:40:23.073000
88,800
88,856
How do I restore from a drop database command using a mysql binary log?
How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.
Documentation Sucks. It alludes to DROP DATABASE being recoverable, but only in odd conditions i'm not familiar with http://dev.mysql.com/doc/refman/5.0/en/binary-log.html According to Docs, binlogs are just a sequence of commands executed based on a given reference point. So that when you did "DROP DATABASE", instead ...
How do I restore from a drop database command using a mysql binary log? How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.
TITLE: How do I restore from a drop database command using a mysql binary log? QUESTION: How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible. ANSWER: Documentation Sucks. It alludes to DROP DATABASE being re...
[ "mysql", "database", "recovery" ]
9
10
42,574
5
0
2008-09-17T23:59:56.667000
2008-09-18T00:15:01.200000
88,833
88,851
What are the advantages and disadvantages of the Session Façade Core J2EE Pattern?
What are the advantages and disadvantages of the Session Façade Core J2EE Pattern? What are the assumptions behind it? Are these assumptions valid in a particular environment?
Session Facade is a fantastic pattern - it is really a specific version of the Business Facade pattern. The idea is to tie up business functionality into discrete bundles - such as TransferMoney(), Withdraw(), Deposit()... So that your UI code is accessing things in terms of business operations instead of low level dat...
What are the advantages and disadvantages of the Session Façade Core J2EE Pattern? What are the advantages and disadvantages of the Session Façade Core J2EE Pattern? What are the assumptions behind it? Are these assumptions valid in a particular environment?
TITLE: What are the advantages and disadvantages of the Session Façade Core J2EE Pattern? QUESTION: What are the advantages and disadvantages of the Session Façade Core J2EE Pattern? What are the assumptions behind it? Are these assumptions valid in a particular environment? ANSWER: Session Facade is a fantastic patt...
[ "session", "jakarta-ee", "design-patterns", "facade" ]
8
6
16,826
4
0
2008-09-18T00:10:13.100000
2008-09-18T00:13:43.530000
88,838
88,863
How to convert Strings to and from UTF8 byte arrays in Java
In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?
Convert from String to byte[]: String s = "some text here"; byte[] b = s.getBytes(StandardCharsets.UTF_8); Convert from byte[] to String: byte[] b = {(byte) 99, (byte)97, (byte)116}; String s = new String(b, StandardCharsets.US_ASCII); You should, of course, use the correct encoding name. My examples used US-ASCII and ...
How to convert Strings to and from UTF8 byte arrays in Java In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?
TITLE: How to convert Strings to and from UTF8 byte arrays in Java QUESTION: In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions? ANSWER:...
[ "java", "string", "encoding", "character-encoding" ]
295
452
806,918
13
0
2008-09-18T00:11:21.117000
2008-09-18T00:16:39.560000
88,850
88,868
Polynomial time algorithm for finding a Hamiltonian walk in a graph
Is there a polynomial time algorithm for finding a Hamiltonian walk in a graph? My algorithm is N factorial and is really slow.
You just asked the million dollar question. Finding a Hamilton path is an NP-complete problem. Some NP-hard problems can be solved in polynomial time using dynamic programming, but (to my knowledge) this is not one of them.
Polynomial time algorithm for finding a Hamiltonian walk in a graph Is there a polynomial time algorithm for finding a Hamiltonian walk in a graph? My algorithm is N factorial and is really slow.
TITLE: Polynomial time algorithm for finding a Hamiltonian walk in a graph QUESTION: Is there a polynomial time algorithm for finding a Hamiltonian walk in a graph? My algorithm is N factorial and is really slow. ANSWER: You just asked the million dollar question. Finding a Hamilton path is an NP-complete problem. So...
[ "algorithm", "np-complete" ]
5
17
9,285
7
0
2008-09-18T00:13:29.893000
2008-09-18T00:18:30.380000
88,852
89,265
Does the Java VM move objects in memory, and if so - how?
Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object? I ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but I need the ability to move objects between servers for efficiency reasons. ...
In reference to the comment above about walking the heap. Different GC's do it different ways. Typically copying collectors when they walk the heap, they don't walk all of the objects in the heap. Rather they walk the LIVE objects in the heap. The implication is that if it's reachable from the "root" object, the object...
Does the Java VM move objects in memory, and if so - how? Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object? I ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but I need the abilit...
TITLE: Does the Java VM move objects in memory, and if so - how? QUESTION: Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object? I ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but...
[ "java", "memory-management", "garbage-collection", "jvm" ]
15
11
3,470
6
0
2008-09-18T00:13:57.990000
2008-09-18T01:43:45.467000
88,883
1,336,258
YUI Autocomplete renders under other page elements in IE7
I'm working now on a page that has a column of boxes styled with sexy shadows and corners and whatnot using the example here. I have to admit, I don't fully understand how that CSS works, but it looks great. Inside the topmost box is a text-type input used for searching. That search box is wired up to a YUI autocomplet...
The working solution I finally implemented was based on reading this explanation over and over again. In the underlying HTML, all of the blue rounded corner elements are DIVs, and they're all siblings (all children of the same DIV). The z-index of the autocomplete div itself (which is the great-great-grandchild of the ...
YUI Autocomplete renders under other page elements in IE7 I'm working now on a page that has a column of boxes styled with sexy shadows and corners and whatnot using the example here. I have to admit, I don't fully understand how that CSS works, but it looks great. Inside the topmost box is a text-type input used for s...
TITLE: YUI Autocomplete renders under other page elements in IE7 QUESTION: I'm working now on a page that has a column of boxes styled with sexy shadows and corners and whatnot using the example here. I have to admit, I don't fully understand how that CSS works, but it looks great. Inside the topmost box is a text-typ...
[ "css", "internet-explorer-7", "yui", "z-index" ]
1
4
6,657
5
0
2008-09-18T00:20:49.847000
2009-08-26T17:13:22.157000
88,918
89,550
Zend Framework - ErrorHandler does not seem to be working as expected
This is my first experience using the Zend Framework. I am attempting to follow the Quick Start tutorial. Everything was working as expected until I reached the section on the Error Controller and View. When I navigate to a page that does not exist, instead of receiving the error page I get the Fatal Error screen dump ...
You have ErrorHandler.php. It should be ErrorController.php. Controllers all need to be named following the format of NameController.php. Since you don't have it named properly the dispatcher cannot find it.
Zend Framework - ErrorHandler does not seem to be working as expected This is my first experience using the Zend Framework. I am attempting to follow the Quick Start tutorial. Everything was working as expected until I reached the section on the Error Controller and View. When I navigate to a page that does not exist, ...
TITLE: Zend Framework - ErrorHandler does not seem to be working as expected QUESTION: This is my first experience using the Zend Framework. I am attempting to follow the Quick Start tutorial. Everything was working as expected until I reached the section on the Error Controller and View. When I navigate to a page tha...
[ "php", "zend-framework" ]
4
4
4,649
2
0
2008-09-18T00:30:04.550000
2008-09-18T02:44:37.143000
88,923
88,945
What is a heuristic fencepost?
And why does gdb seem to "hit" it?
According to this page, GDB is searching backward in the object code to find the beginning of a function, and it is hitting an imposed limit. If you can set the fence post limit to 0 or increase it, you might avoid the error, but it will take longer to run.
What is a heuristic fencepost? And why does gdb seem to "hit" it?
TITLE: What is a heuristic fencepost? QUESTION: And why does gdb seem to "hit" it? ANSWER: According to this page, GDB is searching backward in the object code to find the beginning of a function, and it is hitting an imposed limit. If you can set the fence post limit to 0 or increase it, you might avoid the error, b...
[ "gdb" ]
5
3
2,445
1
0
2008-09-18T00:31:54.873000
2008-09-18T00:36:50.650000
88,929
89,008
Using git to grep through a file's previous versions?
Is there a command that would allow me to check if the string "xyz" was ever in file foo.c in the repository and print which revisions they were found in?
This will print any commits where the diff contains xyz git log -Sxyz foo.c Same thing but more readable: git log -S "xyz" foo.c
Using git to grep through a file's previous versions? Is there a command that would allow me to check if the string "xyz" was ever in file foo.c in the repository and print which revisions they were found in?
TITLE: Using git to grep through a file's previous versions? QUESTION: Is there a command that would allow me to check if the string "xyz" was ever in file foo.c in the repository and print which revisions they were found in? ANSWER: This will print any commits where the diff contains xyz git log -Sxyz foo.c Same thi...
[ "git" ]
33
43
4,786
2
0
2008-09-18T00:34:23.963000
2008-09-18T00:46:52.013000
88,942
2,793,525
Why does PEP-8 specify a maximum line length of 79 characters?
Why in this millennium should Python PEP-8 specify a maximum line length of 79 characters? Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the choice of the content consumer, not the responsibility of the content creator. Are there any (legitimately) good reasons ...
Much of the value of PEP-8 is to stop people arguing about inconsequential formatting rules, and get on with writing good, consistently formatted code. Sure, no one really thinks that 79 is optimal, but there's no obvious gain in changing it to 99 or 119 or whatever your preferred line length is. I think the choices ar...
Why does PEP-8 specify a maximum line length of 79 characters? Why in this millennium should Python PEP-8 specify a maximum line length of 79 characters? Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the choice of the content consumer, not the responsibility of ...
TITLE: Why does PEP-8 specify a maximum line length of 79 characters? QUESTION: Why in this millennium should Python PEP-8 specify a maximum line length of 79 characters? Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the choice of the content consumer, not the ...
[ "python", "coding-style", "pep8" ]
321
180
207,076
9
0
2008-09-18T00:36:24.520000
2010-05-08T09:29:40.410000
88,957
88,960
What does {0} mean when initializing an object?
When {0} is used to initialize an object, what does it mean? I can't find any references to {0} anywhere, and because of the curly braces Google searches are not helpful. Example code: SHELLEXECUTEINFO sexi = {0}; // what does this do? sexi.cbSize = sizeof(SHELLEXECUTEINFO); sexi.hwnd = NULL; sexi.fMask = SEE_MASK_NOCL...
What's happening here is called aggregate initialization. Here is the (abbreviated) definition of an aggregate from section 8.5.1 of the ISO spec: An aggregate is an array or a class with no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions. Now, usin...
What does {0} mean when initializing an object? When {0} is used to initialize an object, what does it mean? I can't find any references to {0} anywhere, and because of the curly braces Google searches are not helpful. Example code: SHELLEXECUTEINFO sexi = {0}; // what does this do? sexi.cbSize = sizeof(SHELLEXECUTEINF...
TITLE: What does {0} mean when initializing an object? QUESTION: When {0} is used to initialize an object, what does it mean? I can't find any references to {0} anywhere, and because of the curly braces Google searches are not helpful. Example code: SHELLEXECUTEINFO sexi = {0}; // what does this do? sexi.cbSize = size...
[ "c++", "c" ]
262
315
67,187
10
0
2008-09-18T00:38:36.153000
2008-09-18T00:39:34.043000
88,962
89,069
Preventing bad data input
Is it good practice to delegate data validation entirely to the database engine constraints? Validating data from the application doesn't prevent invalid insertion from another software (possibly written in another language by another team). Using database constraints you reduce the points where you need to worry about...
It's best to, where possible, have your validation rules specified in your database and use or write a framework that makes those rules bubble up into your front end. ASP.NET Dynamic Data helps with this and there are some commercial libraries out there that make it even easier. This can be done both for simple input v...
Preventing bad data input Is it good practice to delegate data validation entirely to the database engine constraints? Validating data from the application doesn't prevent invalid insertion from another software (possibly written in another language by another team). Using database constraints you reduce the points whe...
TITLE: Preventing bad data input QUESTION: Is it good practice to delegate data validation entirely to the database engine constraints? Validating data from the application doesn't prevent invalid insertion from another software (possibly written in another language by another team). Using database constraints you red...
[ "database", "postgresql", "web-applications" ]
4
5
2,074
10
0
2008-09-18T00:39:52.047000
2008-09-18T01:00:37.863000
88,971
89,191
Asynchronous file IO in .Net
I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology. I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in.NET. Here are some options and the problems I've com...
What we did was to write a small layer around I/O completion ports, ReadFile, and GetQueuedCompletion status in C++/CLI, and then call back into C# when the operation completed. We chose this route over BeginRead and the c# async operation pattern to provide more control over the buffers used to read from the file (or ...
Asynchronous file IO in .Net I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology. I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in.NET. Here are some opti...
TITLE: Asynchronous file IO in .Net QUESTION: I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology. I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in.NET. ...
[ ".net", "windows", "winapi", "file-io", "asynchronous" ]
7
3
2,560
4
0
2008-09-18T00:41:05.803000
2008-09-18T01:27:41.480000
88,991
90,563
Produce conditional compile time error in Java
I do not mean the compile errors because I made a syntax mistake or whatever. In C++ we can create compile time errors based on conditions as in the following example: template struct CompileTimeError; template<> struct CompileTimeError {}; #define STATIC_CHECK(expr, msg) { CompileTimeError<((expr)!= 0)> ERROR_##msg; ...
There is no way to do this in Java, not in the same way it works for you in C++. You could perhaps use annotations, and run apt before or after compilation to check your annotations. For example: @MyStaticCheck(false, "Compile Time Error, kind-of") public static void main(String[] args) { return; } And then write your ...
Produce conditional compile time error in Java I do not mean the compile errors because I made a syntax mistake or whatever. In C++ we can create compile time errors based on conditions as in the following example: template struct CompileTimeError; template<> struct CompileTimeError {}; #define STATIC_CHECK(expr, msg)...
TITLE: Produce conditional compile time error in Java QUESTION: I do not mean the compile errors because I made a syntax mistake or whatever. In C++ we can create compile time errors based on conditions as in the following example: template struct CompileTimeError; template<> struct CompileTimeError {}; #define STATI...
[ "java", "c++", "compiler-construction", "templates" ]
0
2
863
4
0
2008-09-18T00:44:01.380000
2008-09-18T06:45:29.093000
89,043
89,088
Place To get EULA and Other Legalese For Software?
I was curious if anyone out there has experience getting the necessary legal documents (user agreements, privacy policies, disclaimers, etc.) for a small software business. For example if you just want to have a software 'company' that sells a few piece of software that you have written, are there cheap solutions for s...
In Micro-ISV: From Vision to Reality, Bob suggests MegaDox.com and Soft14.com
Place To get EULA and Other Legalese For Software? I was curious if anyone out there has experience getting the necessary legal documents (user agreements, privacy policies, disclaimers, etc.) for a small software business. For example if you just want to have a software 'company' that sells a few piece of software tha...
TITLE: Place To get EULA and Other Legalese For Software? QUESTION: I was curious if anyone out there has experience getting the necessary legal documents (user agreements, privacy policies, disclaimers, etc.) for a small software business. For example if you just want to have a software 'company' that sells a few pie...
[ "language-agnostic" ]
15
5
5,030
5
0
2008-09-18T00:53:42.823000
2008-09-18T01:05:00.487000
89,051
89,076
Queuing actions (not effects) to execute after an amount of time.
What I'd like to know is if there is a nice way to queue jQuery functions to execute after a set amount of time. This wouldn't pause the execution of other functions, just the ones following in the chain. Perhaps an example of what I'd envisage it would look like would illustrate: $('#alert').show().wait(5000) // <-- t...
You can't do that, and you probably don't want to. While it certainly looks pretty, there is no mechanism in Javascript that will allow you do to that without just looping in "wait" until the time has passed. You could certainly do that but you risk seriously degrading the browser performance and if your timeout is lon...
Queuing actions (not effects) to execute after an amount of time. What I'd like to know is if there is a nice way to queue jQuery functions to execute after a set amount of time. This wouldn't pause the execution of other functions, just the ones following in the chain. Perhaps an example of what I'd envisage it would ...
TITLE: Queuing actions (not effects) to execute after an amount of time. QUESTION: What I'd like to know is if there is a nice way to queue jQuery functions to execute after a set amount of time. This wouldn't pause the execution of other functions, just the ones following in the chain. Perhaps an example of what I'd ...
[ "javascript", "jquery" ]
4
8
1,099
2
0
2008-09-18T00:55:27.093000
2008-09-18T01:02:23.460000
89,071
89,117
What happens to your time slice if you get pre-empted in vxWorks?
If you have round robin enabled in Vxworks and your task gets preempted by a higher priority task, what happens to the remaining time slice?
Your task will resume execution and finish the remainder of the time slice. Note that you will have some jitter that occurs for one time tick, since time slicing has a granularity of 1 clock tick. For example: You have round robin enabled with a 10 clock tick time slice. One clock tick is 10 ms. You expect 100 ms per t...
What happens to your time slice if you get pre-empted in vxWorks? If you have round robin enabled in Vxworks and your task gets preempted by a higher priority task, what happens to the remaining time slice?
TITLE: What happens to your time slice if you get pre-empted in vxWorks? QUESTION: If you have round robin enabled in Vxworks and your task gets preempted by a higher priority task, what happens to the remaining time slice? ANSWER: Your task will resume execution and finish the remainder of the time slice. Note that ...
[ "vxworks" ]
2
3
971
1
0
2008-09-18T01:01:30.217000
2008-09-18T01:11:53.530000
89,112
89,133
Diagnosing Deadlocks in Win32 Program
What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished?
This post should get you started on the various options..Check the posts tagged with Debugging.. Another useful article on debugging deadlocks..
Diagnosing Deadlocks in Win32 Program What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished?
TITLE: Diagnosing Deadlocks in Win32 Program QUESTION: What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished? ANSWER: This post should get yo...
[ "winapi", "windbg", "deadlock", "production" ]
5
8
2,605
6
0
2008-09-18T01:10:32.393000
2008-09-18T01:15:25.300000
89,149
89,187
C#: Why does Settings PropertyValues have 0 items?
Assuming there are 5 items in the settings file ( MySetting1 to MySetting5 ), why does PropertyValues have 0 items while Properties has the correct number? Console.WriteLine( Properties.Settings.Default.PropertyValues.Count); // Displays 0 Console.WriteLine( Properties.Settings.Default.Properties.Count); // Displays 5
It appears that PropertyValues refers to the number of PropertyValues that have been set. The default values you specify aren't considered set and won't be stored to the user config if you sall Save(). Console.WriteLine(Settings.Default.PropertyValues.Count.ToString()); Console.ReadLine(); Settings.Default.Setting = "a...
C#: Why does Settings PropertyValues have 0 items? Assuming there are 5 items in the settings file ( MySetting1 to MySetting5 ), why does PropertyValues have 0 items while Properties has the correct number? Console.WriteLine( Properties.Settings.Default.PropertyValues.Count); // Displays 0 Console.WriteLine( Properties...
TITLE: C#: Why does Settings PropertyValues have 0 items? QUESTION: Assuming there are 5 items in the settings file ( MySetting1 to MySetting5 ), why does PropertyValues have 0 items while Properties has the correct number? Console.WriteLine( Properties.Settings.Default.PropertyValues.Count); // Displays 0 Console.Wri...
[ "c#", "visual-studio", "visual-studio-2005" ]
5
6
1,801
1
0
2008-09-18T01:18:45.073000
2008-09-18T01:27:19.187000
89,154
89,313
Benefits of using short-circuit evaluation
boolean a = false, b = true; if ( a && b ) {... }; In most languages, b will not get evaluated because a is false so a && b cannot be true. My question is, wouldn't short circuiting be slower in terms of architecture? In a pipeline, do you just stall while waiting to get the result of a to determine if b should be eval...
Short-circuiting boolean expressions are exactly equivalent to some set of nested ifs, so are as efficient as that would be. If b doesn't have side-effects, it can still be executed in parallel with a (for any value of "in parallel", including pipelining). If b has side effects which the CPU architecture can't cancel w...
Benefits of using short-circuit evaluation boolean a = false, b = true; if ( a && b ) {... }; In most languages, b will not get evaluated because a is false so a && b cannot be true. My question is, wouldn't short circuiting be slower in terms of architecture? In a pipeline, do you just stall while waiting to get the r...
TITLE: Benefits of using short-circuit evaluation QUESTION: boolean a = false, b = true; if ( a && b ) {... }; In most languages, b will not get evaluated because a is false so a && b cannot be true. My question is, wouldn't short circuiting be slower in terms of architecture? In a pipeline, do you just stall while wa...
[ "architecture", "pipeline" ]
10
11
8,940
15
0
2008-09-18T01:19:51.420000
2008-09-18T01:55:13.143000
89,181
89,269
CVS Checkout to a directory
How do i check out a specific directory from CVS and omit the tree leading up to that directory? EX. Id like to checkout to this directory C:/WebHost/MyWebApp/www My CVS Project directory structure is MyWebApp/Trunk/www How do i omit the Trunk and MyWebApp directories?
Use cvs -d/cvsroot checkout -d directory project/path/directory. The first -d can be omitted if you set the root with the environment. This is called "shortening the path" and can be avoided with the -N option to checkout.
CVS Checkout to a directory How do i check out a specific directory from CVS and omit the tree leading up to that directory? EX. Id like to checkout to this directory C:/WebHost/MyWebApp/www My CVS Project directory structure is MyWebApp/Trunk/www How do i omit the Trunk and MyWebApp directories?
TITLE: CVS Checkout to a directory QUESTION: How do i check out a specific directory from CVS and omit the tree leading up to that directory? EX. Id like to checkout to this directory C:/WebHost/MyWebApp/www My CVS Project directory structure is MyWebApp/Trunk/www How do i omit the Trunk and MyWebApp directories? ANS...
[ "cvs", "vcs-checkout", "tortoisecvs" ]
18
28
36,289
3
0
2008-09-18T01:25:50.173000
2008-09-18T01:44:10.143000
89,188
91,732
Get Flex app's position on a web page?
Is it possible to get the x,y coordinates of a Flex app within an HTML page? I know you can use ExternalInterface.ObjecID to get the "id attribute of the object tag in Internet Explorer, or the name attribute of the embed tag in Netscape" but I can't seem to get past that step. It seems like it should be possible to ge...
I think the easiest thing to do is to include some kind of JavaScript library on the HTML page, say jQuery, and use it's functions for determining the position and size of DOM nodes. I would do it more or less like this: var jsCode: String = "function( id ) { return $('#' + id).offset(); }"; var offset: Object = Exter...
Get Flex app's position on a web page? Is it possible to get the x,y coordinates of a Flex app within an HTML page? I know you can use ExternalInterface.ObjecID to get the "id attribute of the object tag in Internet Explorer, or the name attribute of the embed tag in Netscape" but I can't seem to get past that step. It...
TITLE: Get Flex app's position on a web page? QUESTION: Is it possible to get the x,y coordinates of a Flex app within an HTML page? I know you can use ExternalInterface.ObjecID to get the "id attribute of the object tag in Internet Explorer, or the name attribute of the embed tag in Netscape" but I can't seem to get ...
[ "html", "apache-flex" ]
0
4
796
2
0
2008-09-18T01:27:19.560000
2008-09-18T11:21:17.323000
89,193
89,223
Does LINQ-to-SQL Support Composable Queries?
Speaking as a non-C# savvy programmer, I'm curious as to the evaluation semantics of LINQ queries like the following: var people = from p in Person where p.age < 18 select p var otherPeople = from p in people where p.firstName equals "Daniel" select p Assuming that Person is an ADO entity which defines the age and fir...
They are composable. This is possible because LINQ queries are actually expressions (code as data), which LINQ providers like LINQ-to-SQL can evaluate and generate corresponding SQL. Because LINQ queries are lazily evaluated (e.g. won't get executed until you iterate over the elements), the code you showed won't actual...
Does LINQ-to-SQL Support Composable Queries? Speaking as a non-C# savvy programmer, I'm curious as to the evaluation semantics of LINQ queries like the following: var people = from p in Person where p.age < 18 select p var otherPeople = from p in people where p.firstName equals "Daniel" select p Assuming that Person i...
TITLE: Does LINQ-to-SQL Support Composable Queries? QUESTION: Speaking as a non-C# savvy programmer, I'm curious as to the evaluation semantics of LINQ queries like the following: var people = from p in Person where p.age < 18 select p var otherPeople = from p in people where p.firstName equals "Daniel" select p Assu...
[ "sql", "linq", "linq-to-sql", "code-reuse" ]
5
12
1,242
5
0
2008-09-18T01:28:06.360000
2008-09-18T01:34:46.627000
89,203
89,214
Difference between Convert.ToDecimal(string) & Decimal.Parse(string)
What is the difference in C# between Convert.ToDecimal(string) and Decimal.Parse(string)? In what scenarios would you use one over the other? What impact does it have on performance? What other factors should I be taking into consideration when choosing between the two?
From bytes.com: The Convert class is designed to convert a wide range of Types, so you can convert more types to Decimal than you can with Decimal.Parse, which can only deal with String. On the other hand Decimal.Parse allows you to specify a NumberStyle. Decimal and decimal are aliases and are equal. For Convert.ToDec...
Difference between Convert.ToDecimal(string) & Decimal.Parse(string) What is the difference in C# between Convert.ToDecimal(string) and Decimal.Parse(string)? In what scenarios would you use one over the other? What impact does it have on performance? What other factors should I be taking into consideration when choosi...
TITLE: Difference between Convert.ToDecimal(string) & Decimal.Parse(string) QUESTION: What is the difference in C# between Convert.ToDecimal(string) and Decimal.Parse(string)? In what scenarios would you use one over the other? What impact does it have on performance? What other factors should I be taking into conside...
[ "c#", ".net" ]
40
47
65,796
7
0
2008-09-18T01:31:07.803000
2008-09-18T01:33:18.063000
89,212
98,112
Functional Programming Architecture
I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but is there anything characteristic about a software architecture for a system written in a functional programming...
The common thread in the "architecture" of projects that use functional languages is that they tend to be separated into layers of algebras rather than subsystems in the traditional systems architecture sense. For great examples of such projects, check out XMonad, Yi, and HappS. If you examine how they are structured, ...
Functional Programming Architecture I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but is there anything characteristic about a software architecture for a system...
TITLE: Functional Programming Architecture QUESTION: I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but is there anything characteristic about a software archite...
[ "architecture", "functional-programming" ]
43
24
15,965
7
0
2008-09-18T01:33:11.997000
2008-09-18T23:49:52.937000
89,221
92,498
Working with .qr2 reports in .NET?
We use an ERP that has a bunch of reports in QuickReport format (.qr2). From what I could search, Quickreports has an interface for Delphi but not for.NET. Anyone know if there's a (preferably free/OSS) solution for converting.qr2 reports to something I could work with in C#? Or a component for reading these reports di...
There is a.NET version of QuickReports supported in Delphi 2005 and Delphi 2006. You have to get the (non-free) "professional" version of QuickReports to get the.NET support, however. It's not included in the "standard" edition. Delphi 2005 and Delphi 2006 both support C#, but I have never tried the.NET version of Quic...
Working with .qr2 reports in .NET? We use an ERP that has a bunch of reports in QuickReport format (.qr2). From what I could search, Quickreports has an interface for Delphi but not for.NET. Anyone know if there's a (preferably free/OSS) solution for converting.qr2 reports to something I could work with in C#? Or a com...
TITLE: Working with .qr2 reports in .NET? QUESTION: We use an ERP that has a bunch of reports in QuickReport format (.qr2). From what I could search, Quickreports has an interface for Delphi but not for.NET. Anyone know if there's a (preferably free/OSS) solution for converting.qr2 reports to something I could work wi...
[ ".net", "reporting", "quickreports" ]
3
2
755
1
0
2008-09-18T01:34:02.617000
2008-09-18T13:24:23.720000
89,228
89,243
How do I execute a program or call a system command?
How do I call an external command within Python as if I had typed it in a shell or command prompt?
Use subprocess.run: import subprocess subprocess.run(["ls", "-l"]) Another common way is os.system but you shouldn't use it because it is unsafe if any parts of the command come from outside your program or can contain spaces or other special characters, also subprocess.run is generally more flexible (you can get the ...
How do I execute a program or call a system command? How do I call an external command within Python as if I had typed it in a shell or command prompt?
TITLE: How do I execute a program or call a system command? QUESTION: How do I call an external command within Python as if I had typed it in a shell or command prompt? ANSWER: Use subprocess.run: import subprocess subprocess.run(["ls", "-l"]) Another common way is os.system but you shouldn't use it because it is un...
[ "python", "shell", "terminal", "subprocess", "command" ]
6,118
5,811
4,697,381
66
0
2008-09-18T01:35:30.273000
2008-09-18T01:39:35.257000
89,233
89,280
How to hide complete volume?
Using Windows Server 2003 in a multi-user environment (via Remote Desktop, using it as an application server), how to mount a (preferably encrypted) volume in a way, that won't show up on any other user's desktop? Tried, and failed approaches: tweaking user rights -display of mounted volume can not be changed. Bestcryp...
You're going to be hard-pressed to find a solution for your exact problem. Drive mount points aren't stored on the user level (afaik). There are a couple of workarounds that you can use that aren't guaranteed to be secure: hide access to certain drive letters based on group policy. Not very secure, easy to workaround. ...
How to hide complete volume? Using Windows Server 2003 in a multi-user environment (via Remote Desktop, using it as an application server), how to mount a (preferably encrypted) volume in a way, that won't show up on any other user's desktop? Tried, and failed approaches: tweaking user rights -display of mounted volume...
TITLE: How to hide complete volume? QUESTION: Using Windows Server 2003 in a multi-user environment (via Remote Desktop, using it as an application server), how to mount a (preferably encrypted) volume in a way, that won't show up on any other user's desktop? Tried, and failed approaches: tweaking user rights -display...
[ "windows", "windows-server-2003", "system-administration" ]
2
1
964
4
0
2008-09-18T01:36:43.860000
2008-09-18T01:47:36.500000
89,245
89,261
How do you manage .NET app.config files for large applications?
Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblies has settings or configuration information. Our team tends to like the VS setting...
You use one master config file that points to other config files. Here's an example of how to do this. In case the link rots, what you do is specify the configSource for a particular configuration section. This allows you to define that particular section within a separate file. which implies that there is a file calle...
How do you manage .NET app.config files for large applications? Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblies has settings or ...
TITLE: How do you manage .NET app.config files for large applications? QUESTION: Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblie...
[ "c#", ".net", "configuration" ]
21
20
18,279
5
0
2008-09-18T01:40:40.247000
2008-09-18T01:43:15.903000
89,257
314,987
Perl: variable scope issue with CGI & DBI modules
I've run into what appears to be a variable scope issue I haven't encountered before. I'm using Perl's CGI module and a call to DBI's do() method. Here's the code structure, simplified a bit: use DBI; use CGI qw(:cgi-lib); &ReadParse my $dbh = DBI->connect(...............); my $test = $in{test}; $dbh->do(qq{INSERT INTO...
Per the DBI documentation: Binding a tied variable doesn't work, currently. DBI is pretty complicated under the hood, and unfortunately goes through some gyrations to be efficient that are causing your problem. I agree with everyone else who says to get rid of the ugly old cgi-lib style code. It's unpleasant enough to ...
Perl: variable scope issue with CGI & DBI modules I've run into what appears to be a variable scope issue I haven't encountered before. I'm using Perl's CGI module and a call to DBI's do() method. Here's the code structure, simplified a bit: use DBI; use CGI qw(:cgi-lib); &ReadParse my $dbh = DBI->connect(................
TITLE: Perl: variable scope issue with CGI & DBI modules QUESTION: I've run into what appears to be a variable scope issue I haven't encountered before. I'm using Perl's CGI module and a call to DBI's do() method. Here's the code structure, simplified a bit: use DBI; use CGI qw(:cgi-lib); &ReadParse my $dbh = DBI->con...
[ "perl", "module", "variables", "scope", "cgi" ]
3
1
1,763
12
0
2008-09-18T01:42:44.610000
2008-11-24T18:31:57.780000
89,275
89,284
Best C++ IDE or Editor for Windows
What is the best C++ IDE or editor for using on Windows? I use Notepad++, but am missing IntelliSense from Visual Studio.
I've found the latest release of NetBeans, which includes C/C++ support, to be excellent. http://www.netbeans.org/features/cpp/index.html
Best C++ IDE or Editor for Windows What is the best C++ IDE or editor for using on Windows? I use Notepad++, but am missing IntelliSense from Visual Studio.
TITLE: Best C++ IDE or Editor for Windows QUESTION: What is the best C++ IDE or editor for using on Windows? I use Notepad++, but am missing IntelliSense from Visual Studio. ANSWER: I've found the latest release of NetBeans, which includes C/C++ support, to be excellent. http://www.netbeans.org/features/cpp/index.htm...
[ "c++", "windows" ]
74
41
1,207,337
44
0
2008-09-18T01:46:47.033000
2008-09-18T01:48:21.087000
89,320
89,442
Two Phase Commit/Shared Transaction
The scenario is this We have two applications A and B, both which are running in separate database (Oracle 9i ) transactions Application A - inserts some data into the database, then calls Application B Application B - inserts some data into the database, related (via foreign keys) to A's data. Returns an "ID" to Appli...
You have three options: Redesign the application so that you don't have two different processes (both with database connections) writing to the database and roll it into a single app. Create application C that handles all the database transactions for A and B. Roll your own two phase commit. Application C acts as the c...
Two Phase Commit/Shared Transaction The scenario is this We have two applications A and B, both which are running in separate database (Oracle 9i ) transactions Application A - inserts some data into the database, then calls Application B Application B - inserts some data into the database, related (via foreign keys) t...
TITLE: Two Phase Commit/Shared Transaction QUESTION: The scenario is this We have two applications A and B, both which are running in separate database (Oracle 9i ) transactions Application A - inserts some data into the database, then calls Application B Application B - inserts some data into the database, related (v...
[ "oracle" ]
4
11
5,139
5
0
2008-09-18T01:56:28.180000
2008-09-18T02:20:26.593000
89,332
91,795
How do I recover a dropped stash in Git?
I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterday's stashed changes, but git stash pop appears to remove al...
Once you know the hash of the stash commit you dropped, you can apply it as a stash: git stash apply $stash_hash Or, you can create a separate branch for it with git branch recovered $stash_hash After that, you can do whatever you want with all the normal tools. When you’re done, just blow the branch away. Finding the ...
How do I recover a dropped stash in Git? I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterday's stashed change...
TITLE: How do I recover a dropped stash in Git? QUESTION: I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterda...
[ "git", "recovery", "git-stash" ]
2,509
4,074
561,711
25
0
2008-09-18T01:59:06.160000
2008-09-18T11:38:25.550000
89,372
127,620
How to import variable record length CSV file using SSIS?
Has anyone been able to get a variable record length text file (CSV) into SQL Server via SSIS? I have tried time and again to get a CSV file into a SQL Server table, using SSIS, where the input file has varying record lengths. For this question, the two different record lengths are 63 and 326 bytes. All record lengths ...
I had a similar problem, and used custom code (Script Task), and a Script Component under the Data Flow tab. I have a Flat File Source feeding into a Script Component. Inside there I use code to manipulate the incomming data and fix it up for the destination. My issue was the provider was using '000000' as no date avai...
How to import variable record length CSV file using SSIS? Has anyone been able to get a variable record length text file (CSV) into SQL Server via SSIS? I have tried time and again to get a CSV file into a SQL Server table, using SSIS, where the input file has varying record lengths. For this question, the two differen...
TITLE: How to import variable record length CSV file using SSIS? QUESTION: Has anyone been able to get a variable record length text file (CSV) into SQL Server via SSIS? I have tried time and again to get a CSV file into a SQL Server table, using SSIS, where the input file has varying record lengths. For this question...
[ "sql-server", "sql-server-2005", "ssis", "csv", "import" ]
5
4
11,186
5
0
2008-09-18T02:06:32.057000
2008-09-24T14:47:51.213000
89,387
91,096
Using Merb for Facebook Application
Since Rails is not multithreaded (yet), it seems like a threaded web framework would be a better choice for a Facebook application. (reason being is cuz each Rails process can only handle one request at a time, and facebook actions tend to be slow, because there is a lot of network communication between your app and fa...
We've used merb_facebooker in one of our projects ( Rock the Vote ), and it worked out pretty well. Testing Facebook apps is quite annoying, as you don't have control of the middleware, so watch out for your expectations of the FB API and make sure you validate as much of them as possible early in the development stage...
Using Merb for Facebook Application Since Rails is not multithreaded (yet), it seems like a threaded web framework would be a better choice for a Facebook application. (reason being is cuz each Rails process can only handle one request at a time, and facebook actions tend to be slow, because there is a lot of network c...
TITLE: Using Merb for Facebook Application QUESTION: Since Rails is not multithreaded (yet), it seems like a threaded web framework would be a better choice for a Facebook application. (reason being is cuz each Rails process can only handle one request at a time, and facebook actions tend to be slow, because there is ...
[ "ruby-on-rails", "facebook", "merb" ]
0
3
701
4
0
2008-09-18T02:08:15.080000
2008-09-18T09:08:49.997000
89,439
89,720
Bypass GeneratedValue in Hibernate
Is it possible to bypass @GeneratedValue for an ID in Hibernate, we have a case where, most of the time we want the ID to be set using GeneratedValue, but in certain cases would like to set the ID manually. Is this possible to do?
I know you can do this in the JPA spec, so you should be able to in Hibernate (using JPA+ annotations). If you just fill in the ID field of the new persistent model you're creating, then when you "Merge" that model into the EntityManager, it will use the ID you've set. This does have ramifications, though. You've just ...
Bypass GeneratedValue in Hibernate Is it possible to bypass @GeneratedValue for an ID in Hibernate, we have a case where, most of the time we want the ID to be set using GeneratedValue, but in certain cases would like to set the ID manually. Is this possible to do?
TITLE: Bypass GeneratedValue in Hibernate QUESTION: Is it possible to bypass @GeneratedValue for an ID in Hibernate, we have a case where, most of the time we want the ID to be set using GeneratedValue, but in certain cases would like to set the ID manually. Is this possible to do? ANSWER: I know you can do this in t...
[ "java", "hibernate", "jboss" ]
11
5
8,078
1
0
2008-09-18T02:20:17.890000
2008-09-18T03:23:16.990000
89,441
89,492
How do I get my Visual Studio Test Suite web test to iterate over my data source?
I have Visual Studio web test attached nicely to a data source, but I need to be able to iterate over each entry in the data source. How should I do this?
This article seems to Discuss something quite like what you're talking about. Good luck. Ola EDIT: From the linked article, your DataSource is exposed to your test via an attribute. [DataSource("System.Data.SqlClient", "Data Source=VSTS;Initial Catalog=ContactManagerWebTest; Integrated Security=True", "ValidContactInfo...
How do I get my Visual Studio Test Suite web test to iterate over my data source? I have Visual Studio web test attached nicely to a data source, but I need to be able to iterate over each entry in the data source. How should I do this?
TITLE: How do I get my Visual Studio Test Suite web test to iterate over my data source? QUESTION: I have Visual Studio web test attached nicely to a data source, but I need to be able to iterate over each entry in the data source. How should I do this? ANSWER: This article seems to Discuss something quite like what ...
[ "visual-studio", "testing", "automated-tests", "load-testing" ]
2
1
2,706
3
0
2008-09-18T02:20:26.140000
2008-09-18T02:30:44.370000
89,444
89,671
Free or open source IBM 3151 or aixterm emulators?
Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transferring licenses of Hummingbird HostExplorer to Indi...
I doubt you'll find an open source or free emulator for this terminal type. While IBM has contributed to open source communities, they are also very interested in protecting their intellectual property. Hummingbird licenses are certainly expensive. We ran into issues with that when I worked for IBM! That said, I never ...
Free or open source IBM 3151 or aixterm emulators? Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transf...
TITLE: Free or open source IBM 3151 or aixterm emulators? QUESTION: Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are ha...
[ "aix", "terminal-emulator" ]
1
0
2,765
1
0
2008-09-18T02:20:55.283000
2008-09-18T03:08:50.050000
89,465
207,756
CScript/WScript Prevent an error from being blocking
Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box. What I'd like is for the error message to be dumped to STDOUT, and execution to return the calling process. Popping as a MSGBox just han...
This is how you should be running Script batch jobs: cscript //b scriptname.vbs
CScript/WScript Prevent an error from being blocking Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box. What I'd like is for the error message to be dumped to STDOUT, and execution to ret...
TITLE: CScript/WScript Prevent an error from being blocking QUESTION: Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box. What I'd like is for the error message to be dumped to STDOUT, an...
[ "vbscript", "automation", "wsh" ]
6
4
10,470
6
0
2008-09-18T02:26:07.687000
2008-10-16T08:15:00.010000
89,480
89,495
How can I ban a whole company from my web site?
For reasons I won't go into, I wish to ban an entire company from accessing my web site. Checking the remote hostname in php using gethostbyaddr() works, but this slows down the page load too much. Large organizations (eg. hp.com or microsoft.com) often have blocks of IP addresses. Is there anyway I get the full list, ...
How about an.htaccess: Deny from x.x.x.x if you need to deny a range say: 192.168.0.x then you would use Deny from 192.168.0 and the same applies for hostnames: Deny from sub.domain.tld or if you want a PHP solution $ips = array('1.1.1.1', '2.2.2.2', '3.3.3.3'); if(in_array($_SERVER['REMOTE_ADDR'])){die();} For more in...
How can I ban a whole company from my web site? For reasons I won't go into, I wish to ban an entire company from accessing my web site. Checking the remote hostname in php using gethostbyaddr() works, but this slows down the page load too much. Large organizations (eg. hp.com or microsoft.com) often have blocks of IP ...
TITLE: How can I ban a whole company from my web site? QUESTION: For reasons I won't go into, I wish to ban an entire company from accessing my web site. Checking the remote hostname in php using gethostbyaddr() works, but this slows down the page load too much. Large organizations (eg. hp.com or microsoft.com) often ...
[ ".net", "php", "apache" ]
2
11
887
11
0
2008-09-18T02:28:21.800000
2008-09-18T02:30:56.880000
89,487
91,750
Why isn't the git stash unique per branch?
I suppose it allows for moving changes from one branch to the next but that's what cherry picking is for and if you're not making a commit of your changes, perhaps you shouldn't be moving them around? I have on occasion applied the wrong stash at the wrong branch, which left me wondering about this question.
As mentioned, if you want a “per-branch stash,” you really want a new branch forking off from the existing branch. Also, besides the already mentioned fact that the stash allows you to pull into a branch that you’re working on, it also allows you to switch branches before you have committed everything. This is useful n...
Why isn't the git stash unique per branch? I suppose it allows for moving changes from one branch to the next but that's what cherry picking is for and if you're not making a commit of your changes, perhaps you shouldn't be moving them around? I have on occasion applied the wrong stash at the wrong branch, which left m...
TITLE: Why isn't the git stash unique per branch? QUESTION: I suppose it allows for moving changes from one branch to the next but that's what cherry picking is for and if you're not making a commit of your changes, perhaps you shouldn't be moving them around? I have on occasion applied the wrong stash at the wrong br...
[ "git", "git-stash" ]
85
69
19,296
4
0
2008-09-18T02:29:32.873000
2008-09-18T11:26:17.093000
89,489
90,952
Renaming controllers in Rails and cleaning out generated content
I was following along with the railscast regarding the restful_authentication plugin. He recommended running the command: script/generate authenticated user session Which I did, and everything generated "fine", but then sessions wouldn't work. Checking the site again, he mentions a naming standard and listed updated co...
Actually, script/destroy works for any generator - generators work by reading a script of sorts on what files to create; script/destroy just reads that script in reverse and removes all the files created, as long as you give it the same arguments you passed to script/generate. To sum up: script/destroy authenticated us...
Renaming controllers in Rails and cleaning out generated content I was following along with the railscast regarding the restful_authentication plugin. He recommended running the command: script/generate authenticated user session Which I did, and everything generated "fine", but then sessions wouldn't work. Checking th...
TITLE: Renaming controllers in Rails and cleaning out generated content QUESTION: I was following along with the railscast regarding the restful_authentication plugin. He recommended running the command: script/generate authenticated user session Which I did, and everything generated "fine", but then sessions wouldn't...
[ "ruby-on-rails", "ruby" ]
12
14
4,586
4
0
2008-09-18T02:29:55.713000
2008-09-18T08:29:12.137000
89,490
89,537
Annuity or Angle Operation Symbol in LaTeX
How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-v s )/i.
For a very comprehensive list of LaTeX symbols, see The Comprehensive LaTeX Symbol List. Worth printing out and keeping under your pillow. Page 95 has some code that may do what you want.
Annuity or Angle Operation Symbol in LaTeX How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-v s )/i.
TITLE: Annuity or Angle Operation Symbol in LaTeX QUESTION: How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-v s )/i. ANSWER: For a very comprehensive list of LaTeX symbols, see The Comprehensive LaTeX Symbol List. Worth printing out and keeping u...
[ "math", "latex", "symbols", "angle" ]
5
4
12,690
5
0
2008-09-18T02:30:01.190000
2008-09-18T02:40:11.883000
89,504
90,896
What's the best way to run Wordpress on the same domain as a Rails application?
I've got a standard Rails app with Nginx and Mongrel running at http://mydomain. I need to run a Wordpress blog at http://mydomain.com/blog. My preference would be to host the blog in Apache running on either the same server or a separate box but I don't want the user to see a different server in the URL. Is that possi...
I think joelhardi's solution is superior to the following. However, in my own application, I like to keep the blog on a separate VPS than the Rails site (separation of memory issues). To make the user see the same URL, you use the same proxy trick that you normally use for proxying to a mongrel cluster, except you prox...
What's the best way to run Wordpress on the same domain as a Rails application? I've got a standard Rails app with Nginx and Mongrel running at http://mydomain. I need to run a Wordpress blog at http://mydomain.com/blog. My preference would be to host the blog in Apache running on either the same server or a separate b...
TITLE: What's the best way to run Wordpress on the same domain as a Rails application? QUESTION: I've got a standard Rails app with Nginx and Mongrel running at http://mydomain. I need to run a Wordpress blog at http://mydomain.com/blog. My preference would be to host the blog in Apache running on either the same serv...
[ "php", "ruby-on-rails", "apache", "wordpress", "nginx" ]
18
6
3,681
5
0
2008-09-18T02:33:14.177000
2008-09-18T08:19:15.110000
89,543
90,149
How to Implement a Redirect on All Requests (on certain conditions)?
I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message. I've set this up in my ApplicationController: class ApplicationController < ActionController::Base before_filter:check_account def check_account redirect_to:controller => "main",:ac...
You could also use a skip_before_filter for the one controller/method you don't want to have the filter apply to.
How to Implement a Redirect on All Requests (on certain conditions)? I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message. I've set this up in my ApplicationController: class ApplicationController < ActionController::Base before_filter:...
TITLE: How to Implement a Redirect on All Requests (on certain conditions)? QUESTION: I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message. I've set this up in my ApplicationController: class ApplicationController < ActionController::B...
[ "ruby-on-rails", "ruby", "redirect" ]
4
3
2,461
4
0
2008-09-18T02:42:09.053000
2008-09-18T04:56:33.380000
89,575
89,585
What happens to the time slice if you disable preemption in vxWorks?
If you have round robin scheduling enabled in VxWorks, and you use taskLock() to disable preemption, what happens when your timeslice expires?
When preemption is disabled via taskLock, the timeslice counter will not increment. Your timeslice will never expire until preemption is re-enabled.
What happens to the time slice if you disable preemption in vxWorks? If you have round robin scheduling enabled in VxWorks, and you use taskLock() to disable preemption, what happens when your timeslice expires?
TITLE: What happens to the time slice if you disable preemption in vxWorks? QUESTION: If you have round robin scheduling enabled in VxWorks, and you use taskLock() to disable preemption, what happens when your timeslice expires? ANSWER: When preemption is disabled via taskLock, the timeslice counter will not incremen...
[ "vxworks" ]
1
1
660
1
0
2008-09-18T02:50:22.200000
2008-09-18T02:51:41.213000
89,579
89,632
Can you reliably set or delete a cookie during the server side processing of an Ajax (XHR) call?
I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes against much that I have read on Ajax best practices and how browsers interpret the response from an XmlHttpRequest. Not...
XMLHttpRequest always uses the Web Browser's connection framework. This is a requirement for AJAX programs to work correctly as the user would get logged out if the XHR object lacked access to the browser's cookie pool. It's theoretically possible for a web browser to simply share session cookies without using the brow...
Can you reliably set or delete a cookie during the server side processing of an Ajax (XHR) call? I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes against much that I hav...
TITLE: Can you reliably set or delete a cookie during the server side processing of an Ajax (XHR) call? QUESTION: I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes again...
[ "ajax", "xmlhttprequest", "cookies", "server-side", "dwr" ]
7
9
2,981
3
0
2008-09-18T02:50:56.350000
2008-09-18T03:00:35.750000
89,588
89,589
AssignProcessToJobObject fails with "Access Denied" error when running under the debugger
You do AssignProcessToJobObject and it fails with "access denied" but only when you are running in the debugger. Why is this?
This one puzzled me for for about 30 minutes. First off, you probably need a UAC manifest embedded in your app ( as suggested here ). Something like this: Secondly (and this is the bit I got stuck on), when you are running your app under the debugger, it creates your process in a job object. Which your child process ne...
AssignProcessToJobObject fails with "Access Denied" error when running under the debugger You do AssignProcessToJobObject and it fails with "access denied" but only when you are running in the debugger. Why is this?
TITLE: AssignProcessToJobObject fails with "Access Denied" error when running under the debugger QUESTION: You do AssignProcessToJobObject and it fails with "access denied" but only when you are running in the debugger. Why is this? ANSWER: This one puzzled me for for about 30 minutes. First off, you probably need a ...
[ "c++", "c", "winapi", "createprocess" ]
20
22
8,424
2
0
2008-09-18T02:52:31.557000
2008-09-18T02:52:38.640000
89,603
89,619
How Does The Debugging Option -g Change the Binary Executable?
When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? What additional data is stored in the file that allows the debugger to function as ...
-g tells the compiler to store symbol table information in the executable. Among other things, this includes: symbol names type info for symbols files and line numbers where the symbols came from Debuggers use this information to output meaningful names for symbols and to associate instructions with particular lines in...
How Does The Debugging Option -g Change the Binary Executable? When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? What additional data...
TITLE: How Does The Debugging Option -g Change the Binary Executable? QUESTION: When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? Wh...
[ "gcc", "gdb", "debugging" ]
93
95
76,238
7
0
2008-09-18T02:55:41.347000
2008-09-18T02:57:56.847000
89,606
89,639
In sql server 2005, how do I change the "schema" of a table without losing any data?
I have a table that got into the "db_owner" schema, and I need it in the "dbo" schema. Is there a script or command to run to switch it over?
In SQL Server Management Studio: Right click the table and select modify (it's called "Design" now) On the properties panel choose the correct owning schema.
In sql server 2005, how do I change the "schema" of a table without losing any data? I have a table that got into the "db_owner" schema, and I need it in the "dbo" schema. Is there a script or command to run to switch it over?
TITLE: In sql server 2005, how do I change the "schema" of a table without losing any data? QUESTION: I have a table that got into the "db_owner" schema, and I need it in the "dbo" schema. Is there a script or command to run to switch it over? ANSWER: In SQL Server Management Studio: Right click the table and select ...
[ "sql-server", "database" ]
75
86
72,201
8
0
2008-09-18T02:56:06.773000
2008-09-18T03:01:29.240000
89,607
89,716
What is a privileged instruction?
I have added some code which compiles cleanly and have just received this Windows error: --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location 0x00486752. I am abo...
To answer the question, a privileged instruction is a processor op-code (assembler instruction) which can only be executed in "supervisor" (or Ring-0) mode. These types of instructions tend to be used to access I/O devices and protected data structures from the windows kernel. Regular programs execute in "user mode" (R...
What is a privileged instruction? I have added some code which compiles cleanly and have just received this Windows error: --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the applicatio...
TITLE: What is a privileged instruction? QUESTION: I have added some code which compiles cleanly and have just received this Windows error: --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred...
[ "c", "winapi", "debugging", "odbc" ]
30
39
87,833
9
0
2008-09-18T02:56:25.713000
2008-09-18T03:23:03.027000
89,609
94,500
In a bash script, how do I sanitize user input?
I'm looking for the best way to take a simple input: echo -n "Enter a string here: " read -e STRING and clean it up by removing non-alphanumeric characters, lower(case), and replacing spaces with underscores. Does order matter? Is tr the best / only way to go about this?
As dj_segfault points out, the shell can do most of this for you. Looks like you'll have to fall back on something external for lower-casing the string, though. For this you have many options, like the perl one-liners above, etc., but I think tr is probably the simplest. # first, strip underscores CLEAN=${STRING//_/} #...
In a bash script, how do I sanitize user input? I'm looking for the best way to take a simple input: echo -n "Enter a string here: " read -e STRING and clean it up by removing non-alphanumeric characters, lower(case), and replacing spaces with underscores. Does order matter? Is tr the best / only way to go about this?
TITLE: In a bash script, how do I sanitize user input? QUESTION: I'm looking for the best way to take a simple input: echo -n "Enter a string here: " read -e STRING and clean it up by removing non-alphanumeric characters, lower(case), and replacing spaces with underscores. Does order matter? Is tr the best / only way ...
[ "bash", "shell", "user-input", "sanitization" ]
54
56
49,007
5
0
2008-09-18T02:56:27.897000
2008-09-18T17:04:57.623000
89,650
89,661
How do you pass arguments to define_method?
I would like to pass an argument(s) to a method being defined using define_method, how would I do that?
The block that you pass to define_method can include some parameters. That's how your defined method accepts arguments. When you define a method you're really just nicknaming the block and keeping a reference to it in the class. The parameters come with the block. So: define_method(:say_hi) { |other| puts "Hi, " + othe...
How do you pass arguments to define_method? I would like to pass an argument(s) to a method being defined using define_method, how would I do that?
TITLE: How do you pass arguments to define_method? QUESTION: I would like to pass an argument(s) to a method being defined using define_method, how would I do that? ANSWER: The block that you pass to define_method can include some parameters. That's how your defined method accepts arguments. When you define a method ...
[ "ruby", "metaprogramming" ]
166
213
65,586
4
0
2008-09-18T03:03:13.730000
2008-09-18T03:06:02.257000
89,663
272,066
Approve USB device after insertion
On Windows, is there any way to programatically approve a USB device after insertion, if it is of a certain type (say Removable Drive) allow its use, otherwise not? Also not to allow running of drivers, only allow usage of the device in an approved way? I.E. We want to allow the insertion of USB drives, but not have to...
If it's your own kiosk application, make sure your kiosk has drive letters A-Z assigned. To access the USB drive, you'll need a path of the form \??\Volume{GUID}\Filename. But by keeping it out of the normal file system, you're safe against most attacks. You're never entirely safe. As Raymond Chen would point out, it d...
Approve USB device after insertion On Windows, is there any way to programatically approve a USB device after insertion, if it is of a certain type (say Removable Drive) allow its use, otherwise not? Also not to allow running of drivers, only allow usage of the device in an approved way? I.E. We want to allow the inser...
TITLE: Approve USB device after insertion QUESTION: On Windows, is there any way to programatically approve a USB device after insertion, if it is of a certain type (say Removable Drive) allow its use, otherwise not? Also not to allow running of drivers, only allow usage of the device in an approved way? I.E. We want ...
[ "windows", "usb", "virus", "kiosk" ]
4
2
952
4
0
2008-09-18T03:06:19.730000
2008-11-07T13:35:26.427000
89,672
90,373
How do you remove the default title and body fields in a CCK generated Drupal content-type?
When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them?
If you're not a developer (or you want to shortcut the development process), another possible solution is to utilize the auto_nodetitle module. Auto nodetitle will let you create rules for generating the title of the node. These can be programmatic rules, tokens that are replaced, or simply static text. Worth a look if...
How do you remove the default title and body fields in a CCK generated Drupal content-type? When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them?
TITLE: How do you remove the default title and body fields in a CCK generated Drupal content-type? QUESTION: When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them? ANSWER: If you're not a developer ...
[ "drupal", "cck" ]
7
5
15,034
5
0
2008-09-18T03:09:47.833000
2008-09-18T05:51:42.077000
89,696
89,707
How do you connect to a MySQL database using Oracle SQL Developer?
I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases. Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL databases.
Under Tools > Preferences > Databases there is a third party JDBC driver path that must be setup. Once the driver path is setup a separate 'MySQL' tab should appear on the New Connections dialog. Note: This is the same jdbc connector that is available as a JAR download from the MySQL website.
How do you connect to a MySQL database using Oracle SQL Developer? I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases. Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL databases.
TITLE: How do you connect to a MySQL database using Oracle SQL Developer? QUESTION: I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases. Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL ...
[ "mysql", "oracle", "oracle-sqldeveloper" ]
64
88
176,441
6
0
2008-09-18T03:16:48.470000
2008-09-18T03:20:10.693000
89,705
113,878
Concurrent Prime Generator
I'm going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the primes below 2 million, in less than a minute. Using the sequential style, I have already written three types of generators, including the Sieve of...
The 'badarity' error means that you're trying to call a 'fun' with the wrong number of arguments. In this case... %%L = for(1,N, fun() -> spawn(fun(I) -> wait(I,N) end) end), The for/3 function expects a fun of arity 1, and the spawn/1 function expects a fun of arity 0. Try this instead: L = for(1, N, fun(I) -> spawn(f...
Concurrent Prime Generator I'm going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the primes below 2 million, in less than a minute. Using the sequential style, I have already written three types of generat...
TITLE: Concurrent Prime Generator QUESTION: I'm going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the primes below 2 million, in less than a minute. Using the sequential style, I have already written thre...
[ "concurrency", "erlang", "primes" ]
6
3
4,957
10
0
2008-09-18T03:19:20.837000
2008-09-22T08:54:14.920000
89,708
90,496
How to retrieve a resource from within a tWebModule
I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code: LOGO_GIF RCDATA logo.gif Using resource explorer I verified it is in the DLL properly. using the following code always throws an exception, "resou...
RCDATA is a pre-defined resource type with an integer ID of RT_RCDATA (declared in Types unit). Try accessing it this way: rc:= tResourceStream.Create(hInstance,'LOGO_GIF', MakeIntResource(RT_RCDATA));
How to retrieve a resource from within a tWebModule I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code: LOGO_GIF RCDATA logo.gif Using resource explorer I verified it is in the DLL properly. using t...
TITLE: How to retrieve a resource from within a tWebModule QUESTION: I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code: LOGO_GIF RCDATA logo.gif Using resource explorer I verified it is in the DLL...
[ "delphi" ]
2
3
826
4
0
2008-09-18T03:20:14.983000
2008-09-18T06:26:00.980000
89,740
89,759
Can I display the list of all the system objects (semaphores, queues...) in VxWorks?
I would like to know what semaphores, messageQueues, etc... are active in my vxWorks 6.x system. I have access to this information via the debugger, but I would like access to it from the shell. Is there a way?
VxWorks 6.x provides a function called classShow() which will list all the objects of a specific class (e.g. semaphores, message queues, tasks,...). The following call will give you a list of objects for a given class: classShow(objClassIdGet(classId), 1) The classId types are: 1 windSemClass, /* Wind native semaphore...
Can I display the list of all the system objects (semaphores, queues...) in VxWorks? I would like to know what semaphores, messageQueues, etc... are active in my vxWorks 6.x system. I have access to this information via the debugger, but I would like access to it from the shell. Is there a way?
TITLE: Can I display the list of all the system objects (semaphores, queues...) in VxWorks? QUESTION: I would like to know what semaphores, messageQueues, etc... are active in my vxWorks 6.x system. I have access to this information via the debugger, but I would like access to it from the shell. Is there a way? ANSWE...
[ "vxworks" ]
2
6
3,139
1
0
2008-09-18T03:27:30.817000
2008-09-18T03:32:07.187000
89,741
89,811
Can I see the currently checked out revision number in Tortoise SVN?
I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows?
Right-click on the working directory in windows explorer, and select "Properties" (Not TortoiseSVN->Properties). You will see the Properties dialog, which will have a tab called "Subversion". Click on it, and you will see the version number, and other info.
Can I see the currently checked out revision number in Tortoise SVN? I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows?
TITLE: Can I see the currently checked out revision number in Tortoise SVN? QUESTION: I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows? ANSWER: Right-click on the working directory in windows explorer, and select "Propertie...
[ "svn", "version-control", "tortoisesvn" ]
80
145
45,552
7
0
2008-09-18T03:27:50.613000
2008-09-18T03:43:40.420000
89,745
89,802
Unix Proc Directory
I am trying to find the virtual file that contains the current users id. I was told that I could find it in the proc directory, but not quite sure which file.
You actually want /proc/self/status, which will give you information about the currently executed process. Here is an example: $ cat /proc/self/status Name: cat State: R (running) Tgid: 17618 Pid: 17618 PPid: 3083 TracerPid: 0 Uid: 500 500 500 500 Gid: 500 500 500 500 FDSize: 32 Groups: 10 488 500 VmPeak: 4792 kB VmSiz...
Unix Proc Directory I am trying to find the virtual file that contains the current users id. I was told that I could find it in the proc directory, but not quite sure which file.
TITLE: Unix Proc Directory QUESTION: I am trying to find the virtual file that contains the current users id. I was told that I could find it in the proc directory, but not quite sure which file. ANSWER: You actually want /proc/self/status, which will give you information about the currently executed process. Here is...
[ "linux", "unix", "procfs" ]
5
8
4,496
7
0
2008-09-18T03:28:51.500000
2008-09-18T03:41:03.047000
89,767
90,106
Help on Porting a SIP library to PSP
I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues). Does anyone know a good text, book or something to get some insight on porting libraries? The only document...
Look at other libraries that were ported over to the PSP. Doing diffs between a linux version of a library, and a PSP version should show you. Also, try to get to know how POSIX compatible the PSP is, that will tell you how big the job of porting the library over is.
Help on Porting a SIP library to PSP I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues). Does anyone know a good text, book or something to get some insight on...
TITLE: Help on Porting a SIP library to PSP QUESTION: I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues). Does anyone know a good text, book or something to g...
[ "c++", "porting", "sip", "playstation-portable", "pspsdk" ]
2
2
848
4
0
2008-09-18T03:33:58.600000
2008-09-18T04:44:51.800000
89,777
89,787
Nightly importable or attachable copies of production database
We would like to be able to nightly make a copy/backup/snapshot of a production database so that we can import it in the dev environment. We don't want to log ship to the dev environment because it needs to be something we can reset whenever we like to the last taken copy of the production database. We need to be able ...
MSDN I'd say use those procedures inside a SQL Agent job (use master.xp_cmdshell to perform the copy).
Nightly importable or attachable copies of production database We would like to be able to nightly make a copy/backup/snapshot of a production database so that we can import it in the dev environment. We don't want to log ship to the dev environment because it needs to be something we can reset whenever we like to the ...
TITLE: Nightly importable or attachable copies of production database QUESTION: We would like to be able to nightly make a copy/backup/snapshot of a production database so that we can import it in the dev environment. We don't want to log ship to the dev environment because it needs to be something we can reset whenev...
[ "sql-server", "snapshot" ]
1
1
275
3
0
2008-09-18T03:35:57.350000
2008-09-18T03:38:17.797000
89,796
90,006
Is the YUI Loader Utility reliable?
I've been using the YUI Components and want to begin using the Loader Utility to specify my dependencies on my page. From your experience, is the YUI Loader Utility a reliable way to load Javascript dependencies in web pages?
Yes, YUI Loader is reliable on all A-grade browsers. For a list of which browsers Yahoo! considers A-grade, check out the Graded Browser Support Chart.
Is the YUI Loader Utility reliable? I've been using the YUI Components and want to begin using the Loader Utility to specify my dependencies on my page. From your experience, is the YUI Loader Utility a reliable way to load Javascript dependencies in web pages?
TITLE: Is the YUI Loader Utility reliable? QUESTION: I've been using the YUI Components and want to begin using the Loader Utility to specify my dependencies on my page. From your experience, is the YUI Loader Utility a reliable way to load Javascript dependencies in web pages? ANSWER: Yes, YUI Loader is reliable on ...
[ "javascript", "yui" ]
3
8
546
3
0
2008-09-18T03:40:01.473000
2008-09-18T04:26:08.540000
89,859
89,997
What are the best Java example sites?
What are the best Java example sites? I'm looking for places that you go when you have a specific question and you want a little Java code snippet to solve it with.
java2s is the best according to me. because - 1) Like mrlinx said "almost always has a sample on common stuff" 2) Stuffs are nicely organized by category, so, you can easily find out what you are looking for. 3) You can find codes for latest version of JDK
What are the best Java example sites? What are the best Java example sites? I'm looking for places that you go when you have a specific question and you want a little Java code snippet to solve it with.
TITLE: What are the best Java example sites? QUESTION: What are the best Java example sites? I'm looking for places that you go when you have a specific question and you want a little Java code snippet to solve it with. ANSWER: java2s is the best according to me. because - 1) Like mrlinx said "almost always has a sam...
[ "java" ]
1
9
11,330
8
0
2008-09-18T03:55:33.370000
2008-09-18T04:24:34.970000
89,866
89,911
How can I specify the maximum amount of heap an RTP can use in VxWorks?
We are creating a Real-Time Process in VxWorks 6.x, and we would like to limit the amount of memory which can be allocated to the heap. How do we do this?
When creating a RTP via rtpSpawn(), you can specify an environment variable which controls how the heap behaves. There are 3 environment variables: HEAP_INITIAL_SIZE - How much heap to allocate initially (defaults to 64K) HEAP_MAX_SIZE - Maximum heap to allocate (defaults to no limit) HEAP_INCR_SIZE - memory increment ...
How can I specify the maximum amount of heap an RTP can use in VxWorks? We are creating a Real-Time Process in VxWorks 6.x, and we would like to limit the amount of memory which can be allocated to the heap. How do we do this?
TITLE: How can I specify the maximum amount of heap an RTP can use in VxWorks? QUESTION: We are creating a Real-Time Process in VxWorks 6.x, and we would like to limit the amount of memory which can be allocated to the heap. How do we do this? ANSWER: When creating a RTP via rtpSpawn(), you can specify an environment...
[ "vxworks" ]
2
3
4,268
2
0
2008-09-18T03:57:44.830000
2008-09-18T04:05:21.693000
89,873
89,899
Date Component Manipulation
Is it possible to manipulate the components, such as year, month, day of a date in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.
DateSerial(YEAR, MONTH, DAY) would be what you are looking for. DateSerial(2008, 8, 19) returns 8/19/2008
Date Component Manipulation Is it possible to manipulate the components, such as year, month, day of a date in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.
TITLE: Date Component Manipulation QUESTION: Is it possible to manipulate the components, such as year, month, day of a date in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date. ANSWER: DateSerial(YEAR, MONTH, DAY) would be what you are looking for. DateSerial(2008, ...
[ "date", "datetime", "excel", "vba" ]
3
6
1,631
3
0
2008-09-18T03:59:03.800000
2008-09-18T04:02:27.503000
89,891
90,180
What are the benefits of the Iterator interface in Java?
I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, Iterators are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why are the methods hasNext(), next() and remove() not directly coded to the dat...
Why is this interface used? Because it supports the basic operations that would allow a client programmer to iterate over any kind of collection (note: not necessarily a Collection in the Object sense). Why are the methods... not directly coded to the data structure implementation itself? They are, they're just marked ...
What are the benefits of the Iterator interface in Java? I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, Iterators are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why are the methods has...
TITLE: What are the benefits of the Iterator interface in Java? QUESTION: I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, Iterators are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why a...
[ "java", "oop", "collections", "interface", "iterator" ]
36
18
25,457
16
0
2008-09-18T04:01:53.840000
2008-09-18T05:06:50.500000
89,897
90,466
Best way to find out if an (upcast) instance doesn't implement a particular interface
Maybe the need to do this is a 'design smell' but thinking about another question, I was wondering what the cleanest way to implement the inverse of this: foreach(ISomethingable somethingableClass in collectionOfRelatedObjects) { somethingableClass.DoSomething(); } i.e. How to get/iterate through all the objects that d...
this should do the trick: collectionOfRelatedObjects.Where(o =>!(o is ISomethingable))
Best way to find out if an (upcast) instance doesn't implement a particular interface Maybe the need to do this is a 'design smell' but thinking about another question, I was wondering what the cleanest way to implement the inverse of this: foreach(ISomethingable somethingableClass in collectionOfRelatedObjects) { some...
TITLE: Best way to find out if an (upcast) instance doesn't implement a particular interface QUESTION: Maybe the need to do this is a 'design smell' but thinking about another question, I was wondering what the cleanest way to implement the inverse of this: foreach(ISomethingable somethingableClass in collectionOfRela...
[ "c#", ".net", "interface" ]
1
3
279
5
0
2008-09-18T04:02:20.610000
2008-09-18T06:16:43.763000
89,908
90,003
How does has_one :through work?
I have three models: class ReleaseItem < ActiveRecord::Base has_many:pack_release_items has_one:pack,:through =>:pack_release_items end class Pack < ActiveRecord::Base has_many:pack_release_items has_many:release_items,:through=>:pack_release_items end class PackReleaseItem < ActiveRecord::Base belongs_to:pack belong...
It appears that your usage of has_one:through is correct. The problem you're seeing has to do with saving objects. For an association to work, the object that is being referenced needs to have an id to populate the model_id field for the object. In this case, PackReleaseItems have a pack_id and a release_item_id field ...
How does has_one :through work? I have three models: class ReleaseItem < ActiveRecord::Base has_many:pack_release_items has_one:pack,:through =>:pack_release_items end class Pack < ActiveRecord::Base has_many:pack_release_items has_many:release_items,:through=>:pack_release_items end class PackReleaseItem < ActiveRec...
TITLE: How does has_one :through work? QUESTION: I have three models: class ReleaseItem < ActiveRecord::Base has_many:pack_release_items has_one:pack,:through =>:pack_release_items end class Pack < ActiveRecord::Base has_many:pack_release_items has_many:release_items,:through=>:pack_release_items end class PackRelea...
[ "ruby-on-rails", "ruby", "activerecord" ]
5
6
1,628
3
0
2008-09-18T04:04:19.653000
2008-09-18T04:25:41.847000
89,909
89,919
How do I verify that a string only contains letters, numbers, underscores and dashes?
I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method.
A regular expression will do the trick with very little code: import re... if re.match("^[A-Za-z0-9_-]*$", my_little_string): # do something here
How do I verify that a string only contains letters, numbers, underscores and dashes? I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method.
TITLE: How do I verify that a string only contains letters, numbers, underscores and dashes? QUESTION: I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method. ANSWER: A regular expression will do the trick with very little code: import re... if re.ma...
[ "python", "regex", "string" ]
98
152
173,406
11
0
2008-09-18T04:04:58.170000
2008-09-18T04:08:19.550000
89,920
89,930
What time should I build to production?
My users use the site pretty equally 24/7. Is there a meme for build timing? International audience, single cluster of servers on eastern time, but gets hit well into the morning, by international clients. 1 db, several web servers, so if no db, simple, whenever. But when the site has to come down, when would you, as a...
If there's truly no good time from the users' perspective, then I'd suggest doing it when your team has the most time to recover from any build-related disaster.
What time should I build to production? My users use the site pretty equally 24/7. Is there a meme for build timing? International audience, single cluster of servers on eastern time, but gets hit well into the morning, by international clients. 1 db, several web servers, so if no db, simple, whenever. But when the sit...
TITLE: What time should I build to production? QUESTION: My users use the site pretty equally 24/7. Is there a meme for build timing? International audience, single cluster of servers on eastern time, but gets hit well into the morning, by international clients. 1 db, several web servers, so if no db, simple, whenever...
[ "deployment", "timing" ]
0
9
314
11
0
2008-09-18T04:08:56.753000
2008-09-18T04:11:04.783000
89,959
90,304
Dependency Injection and Circular reference
I am just starting out with DI & unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs: I have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Studio) I have created a repository interface with all the methods...
Are you using an Inversion of Control Container? If so, the answer is simple. Assembly A contains: MessageManager IRepository ContainerA (add MessageManager) Assembly B contains (and ref's AssemblyA): Repository implements IRepository ContainerB extends ContainerA (add Repository) Assembly C (or B) would start the app/...
Dependency Injection and Circular reference I am just starting out with DI & unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs: I have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Studio) I have created...
TITLE: Dependency Injection and Circular reference QUESTION: I am just starting out with DI & unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs: I have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Stud...
[ "oop", "tdd" ]
3
1
2,616
7
0
2008-09-18T04:14:43.450000
2008-09-18T05:32:53.013000
89,989
2,327,058
Is there a curl/wget option that prevents saving files in case of http errors?
I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors. As far as I can tell from the man pages, neither curl or wget provide such functionality. Does anyone know about another downloader who does?
One liner I just setup for this very purpose: (works only with a single file, might be useful for others) A=$$; ( wget -q "http://foo.com/pipo.txt" -O $A.d && mv $A.d pipo.txt ) || (rm $A.d; echo "Removing temp file") This will attempt to download the file from the remote Host. If there is an Error, the file is not kep...
Is there a curl/wget option that prevents saving files in case of http errors? I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors. As far as I can tell from the man pages, neither curl or wget provide such functionality. Does anyone know about another downloader who...
TITLE: Is there a curl/wget option that prevents saving files in case of http errors? QUESTION: I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors. As far as I can tell from the man pages, neither curl or wget provide such functionality. Does anyone know about anot...
[ "scripting", "curl", "wget" ]
29
15
35,584
7
0
2008-09-18T04:23:11.463000
2010-02-24T15:19:01.897000
89,994
90,525
How to compile a DLL that does not require an external manifest file?
I would like to compile a DLL under Visual Studio 2008 that depends on msvcr90.dll as a private assembly (basically I'll dump this DLL into the same directory as my application) without needing an external manifest file. I followed the steps outlined in http://msdn.microsoft.com/en-us/library/ms235291.aspx section "Dep...
Add the following to the preprocessor definitions: _CRT_NOFORCE_MANIFEST
How to compile a DLL that does not require an external manifest file? I would like to compile a DLL under Visual Studio 2008 that depends on msvcr90.dll as a private assembly (basically I'll dump this DLL into the same directory as my application) without needing an external manifest file. I followed the steps outlined...
TITLE: How to compile a DLL that does not require an external manifest file? QUESTION: I would like to compile a DLL under Visual Studio 2008 that depends on msvcr90.dll as a private assembly (basically I'll dump this DLL into the same directory as my application) without needing an external manifest file. I followed ...
[ "visual-studio-2008" ]
1
1
1,676
1
0
2008-09-18T04:24:24.033000
2008-09-18T06:36:22.720000
90,002
90,021
What is a reasonable code coverage % for unit tests (and why)?
If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be? Please explain how you arrived at your answer (since if all you did was pick a number, then I could have done that all by myself;)
This prose by Alberto Savoia answers precisely that question (in a nicely entertaining manner at that!): http://www.artima.com/forums/flat.jsp?forum=106&thread=204677 Testivus On Test Coverage Early one morning, a programmer asked the great master: “I am ready to write some unit tests. What code coverage should I aim f...
What is a reasonable code coverage % for unit tests (and why)? If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be? Please explain how you arrived at your answer (since if all you did was pick a number, then I could hav...
TITLE: What is a reasonable code coverage % for unit tests (and why)? QUESTION: If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be? Please explain how you arrived at your answer (since if all you did was pick a number...
[ "unit-testing", "code-coverage", "code-metrics" ]
715
1,617
306,810
30
0
2008-09-18T04:25:40.303000
2008-09-18T04:30:10.230000
90,023
90,795
Using SQL Server 2005's XQuery select all nodes with a specific attribute value, or with that attribute missing
Update: giving a much more thorough example. The first two solutions offered were right along the lines of what I was trying to say not to do. I can't know location, it needs to be able to look at the whole document tree. So a solution along these lines, with /Books/ specified as the context will not work: SELECT x.que...
It's not clear for me from your example what you're actually trying to achieve. Do you want to return a new XML with all the nodes stripped out except those that fulfill the condition? If yes, then this looks like the job for an XSLT transform which I don't think it's built-in in MSSQL 2005 (can be added as a UDF: http...
Using SQL Server 2005's XQuery select all nodes with a specific attribute value, or with that attribute missing Update: giving a much more thorough example. The first two solutions offered were right along the lines of what I was trying to say not to do. I can't know location, it needs to be able to look at the whole d...
TITLE: Using SQL Server 2005's XQuery select all nodes with a specific attribute value, or with that attribute missing QUESTION: Update: giving a much more thorough example. The first two solutions offered were right along the lines of what I was trying to say not to do. I can't know location, it needs to be able to l...
[ "sql-server", "xpath", "xquery", "axes" ]
7
4
15,935
2
0
2008-09-18T04:30:26.873000
2008-09-18T07:50:42.680000
90,049
90,109
How to stretch an HTML table to 100% of the browser window height?
I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using: html, body { height: 100%; margin: 0; padding: 0; } #container { min-height: 100%; width: 100%; } And I place something like this in the page code:... This works f...
Just use the height property instead of the min-height property when setting #container. Once the data gets too big, the table will automatically grow.
How to stretch an HTML table to 100% of the browser window height? I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using: html, body { height: 100%; margin: 0; padding: 0; } #container { min-height: 100%; width: 100%; ...
TITLE: How to stretch an HTML table to 100% of the browser window height? QUESTION: I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using: html, body { height: 100%; margin: 0; padding: 0; } #container { min-height: 1...
[ "html", "css", "layout", "html-table" ]
11
8
47,688
3
0
2008-09-18T04:35:34.210000
2008-09-18T04:45:23.343000
90,067
90,169
Google's hosted dojox.gfx
I'm using the following html to load dojo from Google's hosting.
Differently from when you reference the.js files directly from the
Google's hosted dojox.gfx I'm using the following html to load dojo from Google's hosting.
TITLE: Google's hosted dojox.gfx QUESTION: I'm using the following html to load dojo from Google's hosting. ANSWER: Differently from when you reference the.js files directly from the
[ "dojo" ]
4
4
1,277
4
0
2008-09-18T04:39:30.287000
2008-09-18T05:03:43.940000
90,078
90,197
Has anyone migrated from Struts 1 to another web framework?
On my current project, we've been using Struts 1 for the last few years, and... ahem... Struts is showing its age. We're slowly migrating our front-end code to an Ajax client that consumes XML from the servers. I'm wondering if any of you have migrated a legacy Struts application to a different framework, and what chal...
Sure. Moving from Struts to an AJAX framework is a very liberating experience. (Though we used JSON rather than XML. Much easier to parse.) However, you need to be aware that it's effectively a full rewrite of your application. Instead of the classic Database/JSP/Actions scheme for MVC, you'll find yourself moving to a...
Has anyone migrated from Struts 1 to another web framework? On my current project, we've been using Struts 1 for the last few years, and... ahem... Struts is showing its age. We're slowly migrating our front-end code to an Ajax client that consumes XML from the servers. I'm wondering if any of you have migrated a legac...
TITLE: Has anyone migrated from Struts 1 to another web framework? QUESTION: On my current project, we've been using Struts 1 for the last few years, and... ahem... Struts is showing its age. We're slowly migrating our front-end code to an Ajax client that consumes XML from the servers. I'm wondering if any of you hav...
[ "java", "ajax", "struts" ]
8
7
2,224
2
0
2008-09-18T04:40:43.637000
2008-09-18T05:08:46.173000
90,092
90,116
Enforce unique rows in MySQL
I have a table in MySQL that has 3 fields and I want to enforce uniqueness among two of the fields. Here is the table DDL: CREATE TABLE `CLIENT_NAMES` ( `ID` int(11) NOT NULL auto_increment, `CLIENT_NAME` varchar(500) NOT NULL, `OWNER_ID` int(11) NOT NULL, PRIMARY KEY (`ID`), ) ENGINE=InnoDB DEFAULT CHARSET=utf8; The I...
MySQL cannot enforce uniqueness on keys that are longer than 765 bytes (and apparently 500 UTF8 characters can surpass this limit). Does CLIENT_NAME really need to be 500 characters long? Seems a bit excessive. Add a new (shorter) column that is hash(CLIENT_NAME). Get MySQL to enforce uniqueness on that hash instead.
Enforce unique rows in MySQL I have a table in MySQL that has 3 fields and I want to enforce uniqueness among two of the fields. Here is the table DDL: CREATE TABLE `CLIENT_NAMES` ( `ID` int(11) NOT NULL auto_increment, `CLIENT_NAME` varchar(500) NOT NULL, `OWNER_ID` int(11) NOT NULL, PRIMARY KEY (`ID`), ) ENGINE=InnoD...
TITLE: Enforce unique rows in MySQL QUESTION: I have a table in MySQL that has 3 fields and I want to enforce uniqueness among two of the fields. Here is the table DDL: CREATE TABLE `CLIENT_NAMES` ( `ID` int(11) NOT NULL auto_increment, `CLIENT_NAME` varchar(500) NOT NULL, `OWNER_ID` int(11) NOT NULL, PRIMARY KEY (`ID...
[ "mysql", "indexing", "mysql-error-1071" ]
2
9
1,557
4
0
2008-09-18T04:42:33.053000
2008-09-18T04:46:34.620000
90,100
137,983
In Classic asp, can I store a database connection in the Session object?
Can I store a database connection in the Session object?
From this link http://support.microsoft.com/default.aspx/kb/243543 You shouldnt store database connection in Session. From what I understand, if you do then subsequent ASP requests for the same user must use the same thread. Therefore if you have a busy site its likely that 'your' thread will already be being used by s...
In Classic asp, can I store a database connection in the Session object? Can I store a database connection in the Session object?
TITLE: In Classic asp, can I store a database connection in the Session object? QUESTION: Can I store a database connection in the Session object? ANSWER: From this link http://support.microsoft.com/default.aspx/kb/243543 You shouldnt store database connection in Session. From what I understand, if you do then subseq...
[ "session", "asp-classic", "database-connection" ]
3
1
3,956
5
0
2008-09-18T04:43:31.633000
2008-09-26T06:04:53.123000
90,112
93,844
IIS URL Rewriting vs URL Routing
I was planning to use url routing for a Web Forms application. But, after reading some posts, I am not sure if it is an easy approach. Is it better to use the URL Rewrite module for web forms? But, it is only for IIS7. Initially, there was some buzz that URL routing is totally decoupled from Asp.Net MVC and it could be...
There's a great post here about the differences between the two from a member of the IIS team. One caveat I would advise is that for WebForms, you need to be careful when using Routing. I've written a sample implementation of how you'd use routing with WebForms that addresses these concerns and hopefully helps answer y...
IIS URL Rewriting vs URL Routing I was planning to use url routing for a Web Forms application. But, after reading some posts, I am not sure if it is an easy approach. Is it better to use the URL Rewrite module for web forms? But, it is only for IIS7. Initially, there was some buzz that URL routing is totally decoupled...
TITLE: IIS URL Rewriting vs URL Routing QUESTION: I was planning to use url routing for a Web Forms application. But, after reading some posts, I am not sure if it is an easy approach. Is it better to use the URL Rewrite module for web forms? But, it is only for IIS7. Initially, there was some buzz that URL routing is...
[ "asp.net", "asp.net-mvc", "iis", "routes", "url-rewriting" ]
50
26
36,638
7
0
2008-09-18T04:45:55.153000
2008-09-18T15:55:04.623000
90,117
90,131
How do I use .Net Generics to inherit a template parameter?
I want to be able to do this. MyInterface interface = new ServiceProxyHelper (); Here's the object structure MyTypeThatImplementsMyInterface: MyInterface Will this work? public class ProxyType: MyInterface {} public class ServiceProxyHelper: IDisposable, MyInterface {}
I think this is what you're trying to do: public class ServiceProxyHelper where T: MyInterface {... }
How do I use .Net Generics to inherit a template parameter? I want to be able to do this. MyInterface interface = new ServiceProxyHelper (); Here's the object structure MyTypeThatImplementsMyInterface: MyInterface Will this work? public class ProxyType: MyInterface {} public class ServiceProxyHelper: IDisposable, MyIn...
TITLE: How do I use .Net Generics to inherit a template parameter? QUESTION: I want to be able to do this. MyInterface interface = new ServiceProxyHelper (); Here's the object structure MyTypeThatImplementsMyInterface: MyInterface Will this work? public class ProxyType: MyInterface {} public class ServiceProxyHelper:...
[ "c#", ".net", "generics" ]
1
3
503
1
0
2008-09-18T04:46:39.207000
2008-09-18T04:50:15.220000
90,164
90,994
Is there a way to compile C++ code to Microsoft .Net CIL (bytecode)?
I.e., a web browser client would be written in C++!!!
There are a two choices. Managed C++ (/clr:oldSyntax, no longer maintained) or C++/CLI (definitely maintained). You'll want to use /clr:safe for in-browser software, because you wnat the browser to be able to verify it.
Is there a way to compile C++ code to Microsoft .Net CIL (bytecode)? I.e., a web browser client would be written in C++!!!
TITLE: Is there a way to compile C++ code to Microsoft .Net CIL (bytecode)? QUESTION: I.e., a web browser client would be written in C++!!! ANSWER: There are a two choices. Managed C++ (/clr:oldSyntax, no longer maintained) or C++/CLI (definitely maintained). You'll want to use /clr:safe for in-browser software, beca...
[ ".net", "c++", "browser", "cil" ]
2
6
1,889
4
0
2008-09-18T05:01:58.327000
2008-09-18T08:44:03.833000
90,176
90,186
Java: How can I see what parts of my code are running the most? (profiling)
I am writing a simple checkers game in Java. When I mouse over the board my processor ramps up to 50% (100% on a core). I would like to find out what part of my code(assuming its my fault) is executing during this. I have tried debugging, but step-through debugging doesn't work very well in this case. Is there any tool...
This is called "profiling". Your IDE probably comes with one: see Open Source Profilers in Java.
Java: How can I see what parts of my code are running the most? (profiling) I am writing a simple checkers game in Java. When I mouse over the board my processor ramps up to 50% (100% on a core). I would like to find out what part of my code(assuming its my fault) is executing during this. I have tried debugging, but s...
TITLE: Java: How can I see what parts of my code are running the most? (profiling) QUESTION: I am writing a simple checkers game in Java. When I mouse over the board my processor ramps up to 50% (100% on a core). I would like to find out what part of my code(assuming its my fault) is executing during this. I have trie...
[ "java", "debugging", "user-interface", "profiling" ]
10
12
1,577
12
0
2008-09-18T05:05:38.617000
2008-09-18T05:07:50.123000
90,181
103,756
Width issue with Ext.Panel bbar in IE 6
I've just run into a display glitch in IE6 with the ExtJS framework. - Hopefully someone can point me in the right direction. In the following example, the bbar for the panel is displayed 2ems narrower than the panel it is attached to (it's left aligned) in IE6, where as in Firefox it is displayed as the same width as ...
The problem comes from the custom bodyStyle padding. It makes the panel content larger, but not the toolbar. One possible solution is to further nest an Ext panel, like: var main = new Ext.Panel({ renderTo: 'content', width: 500, items: { bodyStyle: 'padding: 1em;', border: false, html: "Now alignment is fine." }, bbar...
Width issue with Ext.Panel bbar in IE 6 I've just run into a display glitch in IE6 with the ExtJS framework. - Hopefully someone can point me in the right direction. In the following example, the bbar for the panel is displayed 2ems narrower than the panel it is attached to (it's left aligned) in IE6, where as in Firef...
TITLE: Width issue with Ext.Panel bbar in IE 6 QUESTION: I've just run into a display glitch in IE6 with the ExtJS framework. - Hopefully someone can point me in the right direction. In the following example, the bbar for the panel is displayed 2ems narrower than the panel it is attached to (it's left aligned) in IE6,...
[ "javascript", "internet-explorer", "extjs" ]
1
1
3,331
2
0
2008-09-18T05:06:52.670000
2008-09-19T17:09:05.240000
90,184
90,213
Pseudorandom generator in Assembly Language
I need a pseudorandom number generator algorithm for a assembler program assigned in a course, and I would prefer a simple algorithm. However, I cannot use an external library. What is a good, simple pseudorandom number generator algorithm for assembly?
Easy one is to just choose two big relative primes a and b, then keep multiplying your random number by a and adding b. Use the modulo operator to keep the low bits as your random number and keep the full value for the next iteration. This algorithm is known as the linear congruential generator.
Pseudorandom generator in Assembly Language I need a pseudorandom number generator algorithm for a assembler program assigned in a course, and I would prefer a simple algorithm. However, I cannot use an external library. What is a good, simple pseudorandom number generator algorithm for assembly?
TITLE: Pseudorandom generator in Assembly Language QUESTION: I need a pseudorandom number generator algorithm for a assembler program assigned in a course, and I would prefer a simple algorithm. However, I cannot use an external library. What is a good, simple pseudorandom number generator algorithm for assembly? ANS...
[ "algorithm", "assembly", "prng" ]
6
8
15,896
9
0
2008-09-18T05:07:49.937000
2008-09-18T05:12:15.543000
90,203
90,252
What is the difference between gcc optimization levels?
What is the difference between different optimization levels in GCC? Assuming I don't care to have any debug hooks, why wouldn't I just use the highest level of optimization available to me? does a higher level of optimization necessarily (i.e. provably) generate a faster program?
Yes, a higher level can sometimes mean a better performing program. However, it can cause problems depending on your code. For example, branch prediction (enabled in -O1 and up) can break poorly written multi threading programs by causing a race condition. Optimization will actually decide something that's better than ...
What is the difference between gcc optimization levels? What is the difference between different optimization levels in GCC? Assuming I don't care to have any debug hooks, why wouldn't I just use the highest level of optimization available to me? does a higher level of optimization necessarily (i.e. provably) generate ...
TITLE: What is the difference between gcc optimization levels? QUESTION: What is the difference between different optimization levels in GCC? Assuming I don't care to have any debug hooks, why wouldn't I just use the highest level of optimization available to me? does a higher level of optimization necessarily (i.e. p...
[ "linux", "gcc" ]
24
14
9,062
4
0
2008-09-18T05:10:12.910000
2008-09-18T05:20:34.757000
90,204
93,480
Why would a region of memory be marked non-cached?
In an embedded application, we have a table describing the various address ranges that are valid on our target board. This table is used to set up the MMU. The RAM address range is marked as cacheable, but other regions are not. Why is that?
If a memory region is accessed by both hardware and software simultaneously (EX: hardware configuration register or scatter-gather list for DMA), this region must be defined as non-cached. For actual DMA, the memory buffer can be defined as cached, and in most cases, it is advisable for the buffer to be cached to allow...
Why would a region of memory be marked non-cached? In an embedded application, we have a table describing the various address ranges that are valid on our target board. This table is used to set up the MMU. The RAM address range is marked as cacheable, but other regions are not. Why is that?
TITLE: Why would a region of memory be marked non-cached? QUESTION: In an embedded application, we have a table describing the various address ranges that are valid on our target board. This table is used to set up the MMU. The RAM address range is marked as cacheable, but other regions are not. Why is that? ANSWER: ...
[ "memory", "caching", "embedded" ]
16
6
19,273
7
0
2008-09-18T05:10:19.667000
2008-09-18T15:16:18.490000
90,238
90,247
What's the syntax for mod in java
As an example in pseudocode: if ((a mod 2) == 0) { isEven = true; } else { isEven = false; }
Instead of the modulo operator, which has slightly different semantics, for non-negative integers, you can use the remainder operator %. For your exact example: if ((a % 2) == 0) { isEven = true; } else { isEven = false; } This can be simplified to a one-liner: isEven = (a % 2) == 0;
What's the syntax for mod in java As an example in pseudocode: if ((a mod 2) == 0) { isEven = true; } else { isEven = false; }
TITLE: What's the syntax for mod in java QUESTION: As an example in pseudocode: if ((a mod 2) == 0) { isEven = true; } else { isEven = false; } ANSWER: Instead of the modulo operator, which has slightly different semantics, for non-negative integers, you can use the remainder operator %. For your exact example: if ((...
[ "java", "modulo" ]
251
387
1,048,732
17
0
2008-09-18T05:17:15.797000
2008-09-18T05:18:58.177000
90,246
90,311
How would I store a date that can be partial (i.e. just the year, maybe the month too) and output it later with the same specifity?
I want to let users specify a date that may or may not include a day and month (but will have at least the year.) The problem is when it is stored as a datetime in the DB; the missing day/month will be saved as default values and I'll lose the original format and meaning of the date. My idea was to store the real forma...
As proposed by Jhenzie, create a bitmask to show which parts of the date have been specified. 1 = Year, 2 = Month, 4 = Day, 8 = Hour (if you decide to get more specific) and then store that into another field. The only way that I could think of doing it without requiring extra columns in your table would be to use jhen...
How would I store a date that can be partial (i.e. just the year, maybe the month too) and output it later with the same specifity? I want to let users specify a date that may or may not include a day and month (but will have at least the year.) The problem is when it is stored as a datetime in the DB; the missing day/...
TITLE: How would I store a date that can be partial (i.e. just the year, maybe the month too) and output it later with the same specifity? QUESTION: I want to let users specify a date that may or may not include a day and month (but will have at least the year.) The problem is when it is stored as a datetime in the DB...
[ "ruby-on-rails", "database-design", "datetime" ]
4
9
3,382
11
0
2008-09-18T05:18:54.760000
2008-09-18T05:34:55.143000
90,288
231,231
How can I segment my Palm OS 68K application?
If you have an 68K application written using CodeWarrior for Palm OS, how do you assign individual functions to different segments without manually moving files around in the segment tab in the IDE?
I use #pragma segment. Much easier than CodeWarrior's segment tab. #pragma segment Foo some code #pragma segment Bar some code Now your code gets put in two different segments automagically.
How can I segment my Palm OS 68K application? If you have an 68K application written using CodeWarrior for Palm OS, how do you assign individual functions to different segments without manually moving files around in the segment tab in the IDE?
TITLE: How can I segment my Palm OS 68K application? QUESTION: If you have an 68K application written using CodeWarrior for Palm OS, how do you assign individual functions to different segments without manually moving files around in the segment tab in the IDE? ANSWER: I use #pragma segment. Much easier than CodeWarr...
[ "palm-os", "68000", "garnet-os", "codewarrior" ]
4
3
389
2
0
2008-09-18T05:29:25.517000
2008-10-23T19:56:42.103000
90,350
90,512
What's the easiest way to merge (server-side) a collection of PDF documents into one big PDF document in JAVA
I have 3 PDF documents that are generated on the fly by a legacy library that we use, and written to disk. What's the easiest way for my JAVA server code to grab these 3 documents and turn them into one long PDF document where it's just all the pages from document #1, followed by all the pages from document #2, etc. Id...
@J D OConal, thanks for the tip, the article you sent me was very outdated, but it did point me towards iText. I found this page that explains how to do exactly what I need: http://java-x.blogspot.com/2006/11/merge-pdf-files-with-itext.html Thanks for the other answers, but I don't really want to have to spawn other pr...
What's the easiest way to merge (server-side) a collection of PDF documents into one big PDF document in JAVA I have 3 PDF documents that are generated on the fly by a legacy library that we use, and written to disk. What's the easiest way for my JAVA server code to grab these 3 documents and turn them into one long PD...
TITLE: What's the easiest way to merge (server-side) a collection of PDF documents into one big PDF document in JAVA QUESTION: I have 3 PDF documents that are generated on the fly by a legacy library that we use, and written to disk. What's the easiest way for my JAVA server code to grab these 3 documents and turn the...
[ "java", "pdf", "pdf-generation" ]
4
4
5,659
6
0
2008-09-18T05:45:12.903000
2008-09-18T06:31:43.837000
90,363
90,397
Getting PHP to read .doc files on Linux
I'm trying to read a.doc file into a database so that I can index it's contents. Is there an easy way for PHP on Linux to read.doc files? Failing that is it possible to convert.doc files to rtf, pdf or some other 'open' format that is easy to read? Note, I am not interested in.docx files.
There seems to be a library for accessing Word documents but not sure how to access it from PHP. I think the best solution would be to call their wv command from PHP.
Getting PHP to read .doc files on Linux I'm trying to read a.doc file into a database so that I can index it's contents. Is there an easy way for PHP on Linux to read.doc files? Failing that is it possible to convert.doc files to rtf, pdf or some other 'open' format that is easy to read? Note, I am not interested in.do...
TITLE: Getting PHP to read .doc files on Linux QUESTION: I'm trying to read a.doc file into a database so that I can index it's contents. Is there an easy way for PHP on Linux to read.doc files? Failing that is it possible to convert.doc files to rtf, pdf or some other 'open' format that is easy to read? Note, I am no...
[ "php", "database" ]
5
3
10,326
8
0
2008-09-18T05:48:45.003000
2008-09-18T05:57:37.553000
90,365
105,247
Is it possible to increase the 256 character limit in excel validation drop down boxes?
I am creating the validation dynamically and have hit a 256 character limit. My validation looks something like this: Level 1, Level 2, Level 3, Level 4..... Is there any way to get around the character limit other then pointing at a range? The validation is already being produced in VBA. Increasing the limit is the ea...
I'm pretty sure there is no way around the 256 character limit, Joel Spolsky explains why here: http://www.joelonsoftware.com/printerFriendly/articles/fog0000000319.html. You could however use VBA to get close to replicating the functionality of the built in validation by coding the Worksheet_Change event. Here's a moc...
Is it possible to increase the 256 character limit in excel validation drop down boxes? I am creating the validation dynamically and have hit a 256 character limit. My validation looks something like this: Level 1, Level 2, Level 3, Level 4..... Is there any way to get around the character limit other then pointing at ...
TITLE: Is it possible to increase the 256 character limit in excel validation drop down boxes? QUESTION: I am creating the validation dynamically and have hit a 256 character limit. My validation looks something like this: Level 1, Level 2, Level 3, Level 4..... Is there any way to get around the character limit other...
[ "excel", "vba" ]
4
6
7,996
1
0
2008-09-18T05:50:14.420000
2008-09-19T20:23:03.667000
90,401
90,653
How to Create PCL file from MS word
How to create new PCL file similar to existing MS doc. I have MS doc template and replacing it with actual data. I need to achieve same for PCL format (Create PCL file as template and replacing it with actual value from database and send it to fax).
install a new printer when asked for a port, create a new port of type "Local Port" as name of the port, enter some file name, e.g. c:\temp\print.pcl select some PCL-compatible printer, e.g. HP LaserJet 4, or whatever your fax is comptaible with When you print to this printer, Windows will write the output to that file...
How to Create PCL file from MS word How to create new PCL file similar to existing MS doc. I have MS doc template and replacing it with actual data. I need to achieve same for PCL format (Create PCL file as template and replacing it with actual value from database and send it to fax).
TITLE: How to Create PCL file from MS word QUESTION: How to create new PCL file similar to existing MS doc. I have MS doc template and replacing it with actual data. I need to achieve same for PCL format (Create PCL file as template and replacing it with actual value from database and send it to fax). ANSWER: install...
[ "file", "ms-word", "printer-control-language" ]
4
9
37,502
5
0
2008-09-18T05:58:45.710000
2008-09-18T07:11:39.623000