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
184,643
184,660
What is the best way to copy a list?
What is the best way to copy a list? I know the following ways, which one is better? Or is there another way? lst = ['one', 2, 3] lst1 = list(lst) lst2 = lst[:] import copy lst3 = copy.copy(lst)
If you want a shallow copy (elements aren't copied) use: lst2=lst1[:] If you want to make a deep copy then use the copy module: import copy lst2=copy.deepcopy(lst1)
What is the best way to copy a list? What is the best way to copy a list? I know the following ways, which one is better? Or is there another way? lst = ['one', 2, 3] lst1 = list(lst) lst2 = lst[:] import copy lst3 = copy.copy(lst)
TITLE: What is the best way to copy a list? QUESTION: What is the best way to copy a list? I know the following ways, which one is better? Or is there another way? lst = ['one', 2, 3] lst1 = list(lst) lst2 = lst[:] import copy lst3 = copy.copy(lst) ANSWER: If you want a shallow copy (elements aren't copied) use: l...
[ "python" ]
68
111
82,689
7
0
2008-10-08T20:11:22.280000
2008-10-08T20:14:50.340000
184,652
190,924
What is the best way to handle change management?
My organization's main project went live on Monday. That was my third day here. Now that I've been here almost a week, I'm tasked with creating a change management plan for the maintenance of the application and preparation for phase 2, which will commence "someday." We're a Microsoft shop but open-minded. I'm looking ...
Establish a review board, with senior representatives from development, operations, qa, the business, etc., with the CM manager as the chair. All changes have to be presented to the board. In one place I worked you needed unanimous approval to implement a change. In another a 2/3 majority was enough. At both places tho...
What is the best way to handle change management? My organization's main project went live on Monday. That was my third day here. Now that I've been here almost a week, I'm tasked with creating a change management plan for the maintenance of the application and preparation for phase 2, which will commence "someday." We...
TITLE: What is the best way to handle change management? QUESTION: My organization's main project went live on Monday. That was my third day here. Now that I've been here almost a week, I'm tasked with creating a change management plan for the maintenance of the application and preparation for phase 2, which will comm...
[ "process", "change-management", "itil" ]
5
4
1,603
3
0
2008-10-08T20:12:38.847000
2008-10-10T11:42:12.670000
184,653
184,816
SharePoint Lists vs Database Tables performance
We are looking to store transactional data in SharePoint lists. The lists will easily grow to 100,000+ items. How would the query performance be compared with queries on a database table with these columns? Queries: Select by Id Select Where ColumnValue = X Group By OrderId Group By Date The SP List will be 6 columns w...
Don't do it. SharePoint is not good at handling transactional data and will perform badly. Any abilities you might have to improve performance at the database level (like adding indexes) may have detrimental effects on the SharePoint installation (although columns in lists can be "indexed" through SharePoint. Essential...
SharePoint Lists vs Database Tables performance We are looking to store transactional data in SharePoint lists. The lists will easily grow to 100,000+ items. How would the query performance be compared with queries on a database table with these columns? Queries: Select by Id Select Where ColumnValue = X Group By Order...
TITLE: SharePoint Lists vs Database Tables performance QUESTION: We are looking to store transactional data in SharePoint lists. The lists will easily grow to 100,000+ items. How would the query performance be compared with queries on a database table with these columns? Queries: Select by Id Select Where ColumnValue ...
[ "sql-server", "performance", "sharepoint", "list" ]
6
18
13,859
8
0
2008-10-08T20:12:40.687000
2008-10-08T20:45:55.953000
184,661
190,325
How to keep automated tests fast?
Automated tests MUST be fast to reflect real time project state. The idea is that: after any commit to repository automated build is performed (as fast as it can be done). if build succeeded automated tests are started. MUST be fast. This is the best way i know to find out if your changes break anything. At first it se...
There are a number of optimization strategies you can do to improve the throughput of tests, but you need to ask yourself what the goal of this testing is, and why it needs to be fast. Some tests take time. This is a fact of life. Integration tests usually take time, and you usually have to set up an environment in ord...
How to keep automated tests fast? Automated tests MUST be fast to reflect real time project state. The idea is that: after any commit to repository automated build is performed (as fast as it can be done). if build succeeded automated tests are started. MUST be fast. This is the best way i know to find out if your chan...
TITLE: How to keep automated tests fast? QUESTION: Automated tests MUST be fast to reflect real time project state. The idea is that: after any commit to repository automated build is performed (as fast as it can be done). if build succeeded automated tests are started. MUST be fast. This is the best way i know to fin...
[ "performance", "testing", "continuous-integration", "automated-tests" ]
6
5
966
7
0
2008-10-08T20:14:50.540000
2008-10-10T06:35:53.470000
184,662
184,785
Should I change my utilities.pl to a utilities.pm module?
In our product we have a big utilities file that we require (with do ) at the beginning of a lot of our files. Is there a reason not to turn this into a module? For example, instead of doing this: do '../dbi_utilities.pl'; our ($db,$user,$pw,$attr); my $Data = DBI->connect($db,$user,$pw,$attr) or die "Could not connect...
The only reason not to do this is time. That is, it'll take time to clean up your interface, as well as all calling apps to use the new interface. What it'll cost you in time now will be more than made up when you start using proper tests ("make test" or "./Build test" or just "prove...") and be able to check that your...
Should I change my utilities.pl to a utilities.pm module? In our product we have a big utilities file that we require (with do ) at the beginning of a lot of our files. Is there a reason not to turn this into a module? For example, instead of doing this: do '../dbi_utilities.pl'; our ($db,$user,$pw,$attr); my $Data = D...
TITLE: Should I change my utilities.pl to a utilities.pm module? QUESTION: In our product we have a big utilities file that we require (with do ) at the beginning of a lot of our files. Is there a reason not to turn this into a module? For example, instead of doing this: do '../dbi_utilities.pl'; our ($db,$user,$pw,$a...
[ "perl", "perl-module" ]
6
9
352
5
0
2008-10-08T20:15:16.313000
2008-10-08T20:40:26.760000
184,663
185,093
How can you validate Elements based on an attribute Value using a Schema?
The XML I'm trying to validate is as follows: How can this be validated using a Schema? Note: element can only contain bar when attribute="foo". element can only contain world when attribute="hello"
You can't do this in XML Schema 1.0. In XML Schema 1.1 you will be able to use the element to do it, but I'm guessing you want something that you can use now. You can use Schematron as a second layer of validation that will allow you to test arbitrary XPath assertions about your XML document. There's a fairly old artic...
How can you validate Elements based on an attribute Value using a Schema? The XML I'm trying to validate is as follows: How can this be validated using a Schema? Note: element can only contain bar when attribute="foo". element can only contain world when attribute="hello"
TITLE: How can you validate Elements based on an attribute Value using a Schema? QUESTION: The XML I'm trying to validate is as follows: How can this be validated using a Schema? Note: element can only contain bar when attribute="foo". element can only contain world when attribute="hello" ANSWER: You can't do this in...
[ "xml", "validation", "schema", "xsd" ]
2
6
2,064
1
0
2008-10-08T20:15:18.323000
2008-10-08T21:59:00.673000
184,666
184,736
Should I practice "mockist" or "classical" TDD?
I've read (and re-read) Martin Fowler's Mocks Aren't Stubs. In it, he defines two different approaches to TDD: "Classical" and "Mockist". He attempts to answer the question " So should I be a classicist or a mockist? ", but he admits that he has never tried mockist TDD on "anything more than toys." So I thought I'd ask...
I don't think you need to choose one over the other. Both have their advantages and disadvantages and both are tools for your toolbox. "Mockist" tdd makes you a bit more flexible in what you can test while classical TDD makes your tests a bit less brittle because they tend to look more at the input/vs output instead of...
Should I practice "mockist" or "classical" TDD? I've read (and re-read) Martin Fowler's Mocks Aren't Stubs. In it, he defines two different approaches to TDD: "Classical" and "Mockist". He attempts to answer the question " So should I be a classicist or a mockist? ", but he admits that he has never tried mockist TDD on...
TITLE: Should I practice "mockist" or "classical" TDD? QUESTION: I've read (and re-read) Martin Fowler's Mocks Aren't Stubs. In it, he defines two different approaches to TDD: "Classical" and "Mockist". He attempts to answer the question " So should I be a classicist or a mockist? ", but he admits that he has never tr...
[ "tdd", "mocking" ]
45
49
10,206
5
0
2008-10-08T20:16:03.503000
2008-10-08T20:27:08.457000
184,669
184,756
How to make a hotfix deployment using Visual Studio?
Let's say that you have a product that is written in Visual Studio and you provide your customers and users with an installer for that product. Then, you have some minor changes that you want to deploy to your users; you don't want your users to have to go through an uninstall process, backing up the configuration and ...
Use WiX. It can deal with all those things (installation web applications, services, etc), and it's very flexible, free, and it's what Microsoft uses to build their installers. You can install Votive to work with WiX inside of Visual Studio. The details of how to do exactly what you're asking is a bit complex, and depe...
How to make a hotfix deployment using Visual Studio? Let's say that you have a product that is written in Visual Studio and you provide your customers and users with an installer for that product. Then, you have some minor changes that you want to deploy to your users; you don't want your users to have to go through an...
TITLE: How to make a hotfix deployment using Visual Studio? QUESTION: Let's say that you have a product that is written in Visual Studio and you provide your customers and users with an installer for that product. Then, you have some minor changes that you want to deploy to your users; you don't want your users to hav...
[ "windows", "deployment", "hotfix" ]
3
3
2,817
2
0
2008-10-08T20:16:44.907000
2008-10-08T20:32:59.037000
184,676
184,685
How should I learn C?
I'm interested in learning C. I have read K & R, and I have even done some simple C extension work in R and Python. What's a worthwhile project idea for doing something more substantial with C? Any good online resources, similar to Dive Into Python? In particular, resources focused on programmers that already know newe...
Have a look at After K&R what book to use to learn programming in plain C?
How should I learn C? I'm interested in learning C. I have read K & R, and I have even done some simple C extension work in R and Python. What's a worthwhile project idea for doing something more substantial with C? Any good online resources, similar to Dive Into Python? In particular, resources focused on programmers ...
TITLE: How should I learn C? QUESTION: I'm interested in learning C. I have read K & R, and I have even done some simple C extension work in R and Python. What's a worthwhile project idea for doing something more substantial with C? Any good online resources, similar to Dive Into Python? In particular, resources focus...
[ "c", "kernighan-and-ritchie" ]
5
7
2,540
8
0
2008-10-08T20:18:03.950000
2008-10-08T20:19:45.773000
184,678
184,827
why does parsing this date string throw an unparseable date exception?
I'm using SimpleDateFormat with the pattern EEE MM/dd hh:mma, passing in the date String Thu 10/9 08:15PM and it's throwing an Unparseable date exception. Why? I've used various patterns with SimpleDateFormat before so I'm fairly familiar with its usage. Maybe I'm missing something obvious from staring at it too long. ...
To test if it's the date format, write a test class to prove it out. For these types of things, I like to use bsh (beanshell). Here was my test: sdf = new java.text.SimpleDateFormat("EEE MM/dd hh:mma"); System.out.println(sdf.format(sdf.parse("Thu 10/9 08:15PM"))); Which outputted: Fri 10/09 08:15PM So, at least with m...
why does parsing this date string throw an unparseable date exception? I'm using SimpleDateFormat with the pattern EEE MM/dd hh:mma, passing in the date String Thu 10/9 08:15PM and it's throwing an Unparseable date exception. Why? I've used various patterns with SimpleDateFormat before so I'm fairly familiar with its u...
TITLE: why does parsing this date string throw an unparseable date exception? QUESTION: I'm using SimpleDateFormat with the pattern EEE MM/dd hh:mma, passing in the date String Thu 10/9 08:15PM and it's throwing an Unparseable date exception. Why? I've used various patterns with SimpleDateFormat before so I'm fairly f...
[ "java", "date" ]
0
2
8,189
3
0
2008-10-08T20:18:41.703000
2008-10-08T20:48:39.273000
184,681
184,697
Which is faster between is and typeof
Which of these pieces of code is faster? if (obj is ClassA) {} if (obj.GetType() == typeof(ClassA)) {} Edit: I'm aware that they don't do the same thing.
This should answer that question, and then some. The second line, if (obj.GetType() == typeof(ClassA)) {}, is faster, for those that don't want to read the article. (Be aware that they don't do the same thing)
Which is faster between is and typeof Which of these pieces of code is faster? if (obj is ClassA) {} if (obj.GetType() == typeof(ClassA)) {} Edit: I'm aware that they don't do the same thing.
TITLE: Which is faster between is and typeof QUESTION: Which of these pieces of code is faster? if (obj is ClassA) {} if (obj.GetType() == typeof(ClassA)) {} Edit: I'm aware that they don't do the same thing. ANSWER: This should answer that question, and then some. The second line, if (obj.GetType() == typeof(ClassA...
[ "c#", "rtti" ]
156
173
126,546
4
0
2008-10-08T20:19:03.793000
2008-10-08T20:21:03.617000
184,683
185,041
Play audio from a stream using C#
Is there a way in C# to play audio (for example, MP3) direcly from a System.IO.Stream that for instance was returend from a WebRequest without saving the data temporarily to the disk? Solution with NAudio With the help of NAudio 1.3 it is possible to: Load an MP3 file from a URL into a MemoryStream Convert MP3 data int...
Edit: Answer updated to reflect changes in recent versions of NAudio It's possible using the NAudio open source.NET audio library I have written. It looks for an ACM codec on your PC to do the conversion. The Mp3FileReader supplied with NAudio currently expects to be able to reposition within the source stream (it buil...
Play audio from a stream using C# Is there a way in C# to play audio (for example, MP3) direcly from a System.IO.Stream that for instance was returend from a WebRequest without saving the data temporarily to the disk? Solution with NAudio With the help of NAudio 1.3 it is possible to: Load an MP3 file from a URL into a...
TITLE: Play audio from a stream using C# QUESTION: Is there a way in C# to play audio (for example, MP3) direcly from a System.IO.Stream that for instance was returend from a WebRequest without saving the data temporarily to the disk? Solution with NAudio With the help of NAudio 1.3 it is possible to: Load an MP3 file...
[ ".net", "audio", "stream", "mp3", "naudio" ]
104
60
175,209
10
0
2008-10-08T20:19:23.060000
2008-10-08T21:44:46.523000
184,703
184,752
Compare Strings given in $_POST with php
I have a form that is sending in sizes of things, and I need to see what the strings are equal to so that I can set the price accordingly. When i try to do this, it says that they are not equal, and i get no prices. This is the code i'm using: if ($_POST['sizes'] == "Small ($30)"){$total = "30";} if ($_POST['sizes'] ==...
What Paul Dixon said is correct. Might I also recommend using a switch statement instead of that clunky chunk of if statements (which actually has a logic bug in it, I might add - $total will always equal $_POST['price'] when not 'Large ($50)' )
Compare Strings given in $_POST with php I have a form that is sending in sizes of things, and I need to see what the strings are equal to so that I can set the price accordingly. When i try to do this, it says that they are not equal, and i get no prices. This is the code i'm using: if ($_POST['sizes'] == "Small ($30)...
TITLE: Compare Strings given in $_POST with php QUESTION: I have a form that is sending in sizes of things, and I need to see what the strings are equal to so that I can set the price accordingly. When i try to do this, it says that they are not equal, and i get no prices. This is the code i'm using: if ($_POST['sizes...
[ "php", "post", "compare" ]
4
8
12,587
9
0
2008-10-08T20:22:03.770000
2008-10-08T20:31:54.110000
184,704
184,731
Is it possible to detect if an exception occurred before I entered a finally block?
In Java, is there an elegant way to detect if an exception occurred prior to running the finally block? When dealing with "close()" statements, it's common to need exception handling within the finally block. Ideally, we'd want to maintain both exceptions and propagate them up (as both of them may contain useful inform...
Your idea about setting a variable outside the scope of the try/catch/finally is correct. There cannot be more than one exception propagating at once.
Is it possible to detect if an exception occurred before I entered a finally block? In Java, is there an elegant way to detect if an exception occurred prior to running the finally block? When dealing with "close()" statements, it's common to need exception handling within the finally block. Ideally, we'd want to maint...
TITLE: Is it possible to detect if an exception occurred before I entered a finally block? QUESTION: In Java, is there an elegant way to detect if an exception occurred prior to running the finally block? When dealing with "close()" statements, it's common to need exception handling within the finally block. Ideally, ...
[ "java", "exception" ]
23
13
14,225
5
0
2008-10-08T20:22:05.817000
2008-10-08T20:25:41.097000
184,710
184,745
What is the difference between a deep copy and a shallow copy?
What is the difference between a deep copy and a shallow copy?
Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements. Deep copies duplicate everything. A deep copy of a collection is two collections with all of the elements in the...
What is the difference between a deep copy and a shallow copy? What is the difference between a deep copy and a shallow copy?
TITLE: What is the difference between a deep copy and a shallow copy? QUESTION: What is the difference between a deep copy and a shallow copy? ANSWER: Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collec...
[ "language-agnostic", "copy", "deep-copy", "shallow-copy" ]
753
902
840,030
31
0
2008-10-08T20:22:42.850000
2008-10-08T20:29:36.737000
184,729
901,882
As a "mockist" TDD practitioner, should I mock other methods in the same class as the method under test?
After reading Martin Fowler's Mocks Aren't Stubs, I've discovered I've been practicing TDD in the "mockist" fashion. But I'm wondering if even in mockist TDD if one can take mocking too far. Here's an updated example in Python-style pseudo-code: def sync_path(self): if self.confirm_or_create_connection(): self.sync(sel...
The technique is called "mock objects", not "mock methods" for a reason. It encourages designs that divide the system into easily composed, collaborating objects and away from procedural code. The aim is to raise the level of abstraction so that you mostly program by composing objects and rarely write low-level control...
As a "mockist" TDD practitioner, should I mock other methods in the same class as the method under test? After reading Martin Fowler's Mocks Aren't Stubs, I've discovered I've been practicing TDD in the "mockist" fashion. But I'm wondering if even in mockist TDD if one can take mocking too far. Here's an updated exampl...
TITLE: As a "mockist" TDD practitioner, should I mock other methods in the same class as the method under test? QUESTION: After reading Martin Fowler's Mocks Aren't Stubs, I've discovered I've been practicing TDD in the "mockist" fashion. But I'm wondering if even in mockist TDD if one can take mocking too far. Here's...
[ "tdd", "mocking" ]
11
8
1,508
7
0
2008-10-08T20:25:11.503000
2009-05-23T16:37:48.950000
184,777
184,794
Passing data between C++ (MFC) app and C#
We have a monolithic MFC GUI app that is nearing the end of it's life in C++. We are planning to build new functionality in C# and pass data between each app. Question is: What is the best approach for passing data between C++ and C#? Notes: Both ends will have a GUI front end and will probably only need to pass simple...
Personally I'd be thinking of using something like named pipes as they are easy to use from the C++ side and the System.IO.Pipes on the.NET side also. It would also be the path of probably least resistance if you're planning to replace the other non.NET bits of the app over time.
Passing data between C++ (MFC) app and C# We have a monolithic MFC GUI app that is nearing the end of it's life in C++. We are planning to build new functionality in C# and pass data between each app. Question is: What is the best approach for passing data between C++ and C#? Notes: Both ends will have a GUI front end ...
TITLE: Passing data between C++ (MFC) app and C# QUESTION: We have a monolithic MFC GUI app that is nearing the end of it's life in C++. We are planning to build new functionality in C# and pass data between each app. Question is: What is the best approach for passing data between C++ and C#? Notes: Both ends will hav...
[ "c#", "c++", "ipc" ]
8
7
8,102
9
0
2008-10-08T20:38:33.630000
2008-10-08T20:41:26.230000
184,782
375,277
ASP.NET Session Timeout Testing
I'm a doing some blackbox testing of a ASP.Net website and I need to test different session timeout scenarios. I'm not sure they fully encapsulated session timeouts. Other then leaving a page open for 20 minutes is there an easier way to force a session timeout?
Decrease the timeout The easiest and most non-intrusive way to test this is probably to just decrease the timeout to a fairly small number, such as 3 or 5 minutes. This way you can pause for a few minutes to simulate a longer pause without worrying about application restarts or special reset code having any affect on y...
ASP.NET Session Timeout Testing I'm a doing some blackbox testing of a ASP.Net website and I need to test different session timeout scenarios. I'm not sure they fully encapsulated session timeouts. Other then leaving a page open for 20 minutes is there an easier way to force a session timeout?
TITLE: ASP.NET Session Timeout Testing QUESTION: I'm a doing some blackbox testing of a ASP.Net website and I need to test different session timeout scenarios. I'm not sure they fully encapsulated session timeouts. Other then leaving a page open for 20 minutes is there an easier way to force a session timeout? ANSWER...
[ "asp.net", "testing", "session", "timeout" ]
36
73
43,430
10
0
2008-10-08T20:39:59.103000
2008-12-17T17:09:37.767000
184,804
202,413
Adding to a ColdFusion classpath running on an instanced JRun server
I'm having some trouble getting my ColdFusion server classpath to recognize my custom Java jars. The classpath is not reading my jvm.config file correctly (I assume out of my JRun server which is where the CF instance is running out of, it's a production server with multiple sites attached). I have been banging my head...
I've answered my own question eventually, here it is: In console, you have to INSTALL the service manually with the following line: jrunsvc -install jrun_server service-name service-display service-description -config custom_jvm.config "jrun_server" is actually the instance you are installing on. So if it's say product...
Adding to a ColdFusion classpath running on an instanced JRun server I'm having some trouble getting my ColdFusion server classpath to recognize my custom Java jars. The classpath is not reading my jvm.config file correctly (I assume out of my JRun server which is where the CF instance is running out of, it's a product...
TITLE: Adding to a ColdFusion classpath running on an instanced JRun server QUESTION: I'm having some trouble getting my ColdFusion server classpath to recognize my custom Java jars. The classpath is not reading my jvm.config file correctly (I assume out of my JRun server which is where the CF instance is running out ...
[ "service", "coldfusion", "web", "classpath", "jrun" ]
0
1
1,668
1
0
2008-10-08T20:43:35.787000
2008-10-14T19:05:01.260000
184,814
4,210,173
Is there some industry standard for unacceptable webapp response time?
There's a cots (commercial off-the-shelf) application that I work on customizing, where a couple of pages take an extremely long time to load for certain distributions of data. (I'm talking approximately 3 minutes for a page to load in this instance... and the time is growing exponentially). Clearly this is unacceptabl...
Jakob Nielsen's research has answered this for any application (web apps aren't special in this regard): 0.1 second: Limit for users feeling that they are directly manipulating objects in the UI. 1 second: Limit for users feeling that they are freely navigating the command space without having to unduly wait for the co...
Is there some industry standard for unacceptable webapp response time? There's a cots (commercial off-the-shelf) application that I work on customizing, where a couple of pages take an extremely long time to load for certain distributions of data. (I'm talking approximately 3 minutes for a page to load in this instance...
TITLE: Is there some industry standard for unacceptable webapp response time? QUESTION: There's a cots (commercial off-the-shelf) application that I work on customizing, where a couple of pages take an extremely long time to load for certain distributions of data. (I'm talking approximately 3 minutes for a page to loa...
[ "performance", "scalability", "duplication" ]
47
68
64,418
9
0
2008-10-08T20:45:09.683000
2010-11-17T23:12:00.707000
184,825
185,452
Monitoring memory usage for a C DLL called with Java via JNI?
How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is using ~70MB, but the task in the Task Manager shows 200Mb+, and I'd like to see what...
You can monitor the native heap with counters in the performance montitor. (perfmon32) however it wont break it down for you on a per DLL basis, even jvm.dll will be included here. Most profiling tools out there can attach to a process and capture and track memory allocations and deallocations. This allows them to spec...
Monitoring memory usage for a C DLL called with Java via JNI? How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is using ~70MB, but the t...
TITLE: Monitoring memory usage for a C DLL called with Java via JNI? QUESTION: How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is usin...
[ "java", "c", "memory", "dll", "java-native-interface" ]
6
3
6,908
4
0
2008-10-08T20:48:04.467000
2008-10-09T00:13:45.660000
184,840
185,051
ASP.NET session and storing objects that use COM interop
I'm working on an asp.net web site. We have to use com interop to interact with legacy vb6 activex components. The components in many cases rely on receiving a context object (which is itself a vb6 activex component) as a parameter. The context object is fairly costly to construct. Therefore one idea is that a context ...
I think you will very rapidly get problems with one request blocking another. ASP.NET by default initialises COM on its threads to put the thread in a multi-threaded apartment. VB6 components were apartment-model at best. That means that when the MTA thread creates the component, it's put into the main STA if one alrea...
ASP.NET session and storing objects that use COM interop I'm working on an asp.net web site. We have to use com interop to interact with legacy vb6 activex components. The components in many cases rely on receiving a context object (which is itself a vb6 activex component) as a parameter. The context object is fairly c...
TITLE: ASP.NET session and storing objects that use COM interop QUESTION: I'm working on an asp.net web site. We have to use com interop to interact with legacy vb6 activex components. The components in many cases rely on receiving a context object (which is itself a vb6 activex component) as a parameter. The context ...
[ "asp.net", "com", "session", "interop" ]
0
3
1,399
2
0
2008-10-08T20:51:18.923000
2008-10-08T21:47:37.093000
184,853
759,017
Xterm control sequence to 'T' output to a file
I swear there used to be a way in X to start capturing all terminal traffic to a file on your host. It may have been a HummingBird extension, but I thought it was standard. Now, I can't find the trick. Am I hallucinating (happens when you get old), or is it possible? I'm not talking about 'tee'. I want to be able to se...
This feature is called logging and exists in the source code but is disabled by default for security reasons. Do you really want everyone with the ability to write control sequences to your terminal ( e.g., the author of any file you might one day cat ) to be able to write arbitrary data to arbitrarily-named files unde...
Xterm control sequence to 'T' output to a file I swear there used to be a way in X to start capturing all terminal traffic to a file on your host. It may have been a HummingBird extension, but I thought it was standard. Now, I can't find the trick. Am I hallucinating (happens when you get old), or is it possible? I'm n...
TITLE: Xterm control sequence to 'T' output to a file QUESTION: I swear there used to be a way in X to start capturing all terminal traffic to a file on your host. It may have been a HummingBird extension, but I thought it was standard. Now, I can't find the trick. Am I hallucinating (happens when you get old), or is ...
[ "x11", "vnc", "xterm" ]
0
3
2,405
3
0
2008-10-08T20:54:59.663000
2009-04-17T04:24:46.067000
184,857
185,032
How can I programmatically receive faxes? Preferable in java
I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider?
I suggest using fax to email. I've been using RapidFax for the past year or so, and it is fairly inexpensive and fast. I'm happy with it. Alternatively, there are some Web Service based fax services, like InterFax.
How can I programmatically receive faxes? Preferable in java I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider?
TITLE: How can I programmatically receive faxes? Preferable in java QUESTION: I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider? ANSWER: I suggest using fax to email. I've been using RapidFax for the past year or so, and it is...
[ "java", "fax" ]
2
2
2,209
4
0
2008-10-08T20:55:32.113000
2008-10-08T21:41:56.183000
184,858
184,916
What is the right way to change the behavior of an <a> tag?
I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this: Click But I'm not sure that is the best way and in this case it is navigating to page.html# which isn't good for what I'm doing.
Usually, you should always have a fall back link to make sure that clients with JavaScript disabled still has some functionality. This concept is called unobtrusive JavaScript. Example... Let's say you have the following search link: Search You can always do the following: var link = document.getElementById('searchLink...
What is the right way to change the behavior of an <a> tag? I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this: Click But I'm not sure that is the best way and in this case it is navigating to page.htm...
TITLE: What is the right way to change the behavior of an <a> tag? QUESTION: I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this: Click But I'm not sure that is the best way and in this case it is navi...
[ "javascript", "ajax" ]
5
18
1,392
10
0
2008-10-08T20:55:52.597000
2008-10-08T21:05:20.423000
184,869
184,897
Are GUID collisions possible?
I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collisons, but is a collision still possible?
Basically, no. I think someone went mucking with your database. Depending on the version GUID you're using the value is either unique (for things like version 1 GUIDs), or both unique and unpredictable (for things like version 4 GUIDs). SQL Server's implementation for their NEWID() function appears to use a 128-bit ran...
Are GUID collisions possible? I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collisons, but is a coll...
TITLE: Are GUID collisions possible? QUESTION: I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collis...
[ "sql-server", "guid" ]
158
158
102,089
20
0
2008-10-08T20:58:04.603000
2008-10-08T21:00:41.027000
184,871
185,286
I have a button inside a ControlTemplate. How do I get a reference to it?
I just want to enable or disable the button inside a ControlTemplate for a WPF Editor that I'm using.
I agree with Joel that the preferred method would be to trigger the setting of the button's Enabled property with xaml markup, either through a trigger or by binding the Enabled value to another dependency property, possibly on a parent element, likely with the help of a ValueConverter. However, if you have to do it ex...
I have a button inside a ControlTemplate. How do I get a reference to it? I just want to enable or disable the button inside a ControlTemplate for a WPF Editor that I'm using.
TITLE: I have a button inside a ControlTemplate. How do I get a reference to it? QUESTION: I just want to enable or disable the button inside a ControlTemplate for a WPF Editor that I'm using. ANSWER: I agree with Joel that the preferred method would be to trigger the setting of the button's Enabled property with xam...
[ "wpf", "controltemplate" ]
1
2
2,646
4
0
2008-10-08T20:58:12.247000
2008-10-08T23:06:36.637000
184,873
184,915
Techniques to measure application performance
I maintain an application which, during the course of two years, has constantly required new hardware to be even usable, due to the amount of new users / new data inserted. However, justifying the investiment is sometimes very hard to do. I started to wonder - how can I establish the maximum number of users a web appli...
You can use this performance algorithm: http://i.msdn.microsoft.com/cc500561.fig02_L(en-us).gif R Response time. The total time from the user requesting a page (by clicking a link, and so on) to when the full page is rendered on the user's computer. Typically measured in seconds. Payload Total bytes sent to the browser...
Techniques to measure application performance I maintain an application which, during the course of two years, has constantly required new hardware to be even usable, due to the amount of new users / new data inserted. However, justifying the investiment is sometimes very hard to do. I started to wonder - how can I est...
TITLE: Techniques to measure application performance QUESTION: I maintain an application which, during the course of two years, has constantly required new hardware to be even usable, due to the amount of new users / new data inserted. However, justifying the investiment is sometimes very hard to do. I started to wond...
[ "performance", "concurrency", "max" ]
2
4
1,309
2
0
2008-10-08T20:58:26.087000
2008-10-08T21:04:33.670000
184,878
185,005
Expose a WCF Service through a Named Pipes binding
Intro: I successfully implemented a WCF Service hosted in a Windows Service a few days ago. The community here at StackOverflow helped me with the WSDL exposure here. I thank you once again. However recently I found out that there is another potential client for this service this time located on the same machine as the...
Your endpoint looks fine, although I'm curious about what's in localBinding... Sounds like the easiest option is to just change the endpoint configuration on the named pipes client to match your service endpoint. The client shouldn't care as long as it's the only endpoint in the clients config file. Otherwise you'll ha...
Expose a WCF Service through a Named Pipes binding Intro: I successfully implemented a WCF Service hosted in a Windows Service a few days ago. The community here at StackOverflow helped me with the WSDL exposure here. I thank you once again. However recently I found out that there is another potential client for this s...
TITLE: Expose a WCF Service through a Named Pipes binding QUESTION: Intro: I successfully implemented a WCF Service hosted in a Windows Service a few days ago. The community here at StackOverflow helped me with the WSDL exposure here. I thank you once again. However recently I found out that there is another potential...
[ "wcf", "named-pipes", "service-discovery", "netnamedpipebinding" ]
11
13
34,937
2
0
2008-10-08T20:58:44.040000
2008-10-08T21:27:08.647000
184,880
1,703,014
Which Facebook .NET Library is the best to use?
There is a list of projects here, mainly the Facebook Developer Toolkit and Facebook.NET. However, I've seen a lot of negative feedback about the toolkit and it seems like Facebook.NET hasn't been upgraded to the latest facebook API. Are either of these worth using? Any other good libraries out there? Specifically I'm ...
Just saw that this was released today: The Facebook SDK from Microsoft. This toolkit is provided as a Facebook Client Library similar to Facebook's PHP Client Library or Facebook's JavaScript library. The goal is to enable.NET developers to quickly and easily leverage the various features of the Facebook Platform. This...
Which Facebook .NET Library is the best to use? There is a list of projects here, mainly the Facebook Developer Toolkit and Facebook.NET. However, I've seen a lot of negative feedback about the toolkit and it seems like Facebook.NET hasn't been upgraded to the latest facebook API. Are either of these worth using? Any o...
TITLE: Which Facebook .NET Library is the best to use? QUESTION: There is a list of projects here, mainly the Facebook Developer Toolkit and Facebook.NET. However, I've seen a lot of negative feedback about the toolkit and it seems like Facebook.NET hasn't been upgraded to the latest facebook API. Are either of these ...
[ ".net", "asp.net", "asp.net-mvc", "facebook", "facebooktoolkit" ]
27
3
10,110
15
0
2008-10-08T20:58:47.427000
2009-11-09T18:56:58.703000
184,923
184,933
Effective way to notify user of input validation failures in an editable table
Im looking for ideas on how to effectively notify users that their input into an editable table is invalid. For example, if one column of a table represents an American zip code and the user enters in the zip code "85rr3" into a cell, how would you notify the user of the issue?
I'd probably highlight it in red after entered, then maybe a warning at the top of the table.
Effective way to notify user of input validation failures in an editable table Im looking for ideas on how to effectively notify users that their input into an editable table is invalid. For example, if one column of a table represents an American zip code and the user enters in the zip code "85rr3" into a cell, how wo...
TITLE: Effective way to notify user of input validation failures in an editable table QUESTION: Im looking for ideas on how to effectively notify users that their input into an editable table is invalid. For example, if one column of a table represents an American zip code and the user enters in the zip code "85rr3" i...
[ "user-interface", "validation" ]
1
5
352
4
0
2008-10-08T21:06:38.893000
2008-10-08T21:08:01.573000
184,927
184,990
window.resizeTo affects subsequent Firefox windows
I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300) People do like having the page fit its window in this way. However with Firefox the next browser window the user opens comes up at the same size, which is ridiculously small. Is there a way to tell Firefox to resize the curre...
Two different questions at work here: 1. Specifying Window Dimensions- Specifying window attributes using window.open will not affect the dimensions of other windows. You are getting the expected behavior from Firefox with regards to the resizeTo function. 2. The User Experience- What users value first and foremost is ...
window.resizeTo affects subsequent Firefox windows I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300) People do like having the page fit its window in this way. However with Firefox the next browser window the user opens comes up at the same size, which is ridiculously small....
TITLE: window.resizeTo affects subsequent Firefox windows QUESTION: I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300) People do like having the page fit its window in this way. However with Firefox the next browser window the user opens comes up at the same size, which is r...
[ "firefox", "user-interface", "resize", "user-experience" ]
3
4
2,969
7
0
2008-10-08T21:07:14.540000
2008-10-08T21:21:50.423000
184,940
188,167
Recommended spec for a build server
We're using CruiseControl.NET to manage our builds and we're in the process of obtaining a new build server. I've been tasked with coming up with the spec for the new server. This server will need to run multiple builds concurrently and as effeciently as possible. What would you consider the ideal spec for this server?...
I would also point out that all of the above recommendations depend on what you are using to compile. If you are using the VisualStudio command line for instance, you will be very sad the first time you try concurrent builds. Also how many builds will be going on, if they are concurrent. Most people try beefing up buil...
Recommended spec for a build server We're using CruiseControl.NET to manage our builds and we're in the process of obtaining a new build server. I've been tasked with coming up with the spec for the new server. This server will need to run multiple builds concurrently and as effeciently as possible. What would you cons...
TITLE: Recommended spec for a build server QUESTION: We're using CruiseControl.NET to manage our builds and we're in the process of obtaining a new build server. I've been tasked with coming up with the spec for the new server. This server will need to run multiple builds concurrently and as effeciently as possible. W...
[ "build", "cruisecontrol.net" ]
1
1
3,447
3
0
2008-10-08T21:10:00.260000
2008-10-09T16:52:51.230000
184,970
184,975
Error with C# Partial classes
I am using partial classes to split some functionality between 2 files, but I am getting an error. What am I doing wrong? A1.cs: private partial class A { private string SomeProperty { get { return "SomeGeneratedString"; } } } A2.cs: private partial class A { void SomeFunction() { //trying to access this.SomeProperty p...
Are the two partial classes in the same namespace? That could be an explanation.
Error with C# Partial classes I am using partial classes to split some functionality between 2 files, but I am getting an error. What am I doing wrong? A1.cs: private partial class A { private string SomeProperty { get { return "SomeGeneratedString"; } } } A2.cs: private partial class A { void SomeFunction() { //trying...
TITLE: Error with C# Partial classes QUESTION: I am using partial classes to split some functionality between 2 files, but I am getting an error. What am I doing wrong? A1.cs: private partial class A { private string SomeProperty { get { return "SomeGeneratedString"; } } } A2.cs: private partial class A { void SomeFun...
[ "c#", "partial-classes" ]
22
46
19,705
12
0
2008-10-08T21:16:15.347000
2008-10-08T21:17:43.347000
184,983
185,098
Java ColorSpace Support
I need to take a BufferedImage and convert it to YCbCr format so that I can do a more efficient Brightness/contrast manipulation on it, but I can't figure out how to do this. I've tried ColorConvertOp but there doesn't seem to be an appropriate ColorSpace for YCbCr (though there is a type for it?). I could do the conve...
I am not familiar with YCbCr, I just saw (in Wikipedia) it is used by Jpeg images... Intuitively, should I play with brightness, I would have used HSB instead. I see that's what Jerry does with him Java Image Filters (HSBAdjustFilter). The source is available, perhaps you can find an idea there. In any case, showing us...
Java ColorSpace Support I need to take a BufferedImage and convert it to YCbCr format so that I can do a more efficient Brightness/contrast manipulation on it, but I can't figure out how to do this. I've tried ColorConvertOp but there doesn't seem to be an appropriate ColorSpace for YCbCr (though there is a type for it...
TITLE: Java ColorSpace Support QUESTION: I need to take a BufferedImage and convert it to YCbCr format so that I can do a more efficient Brightness/contrast manipulation on it, but I can't figure out how to do this. I've tried ColorConvertOp but there doesn't seem to be an appropriate ColorSpace for YCbCr (though ther...
[ "java", "color-scheme" ]
0
1
955
2
0
2008-10-08T21:19:07.730000
2008-10-08T22:03:13.910000
184,996
185,222
Custom Filters/Validators in Zend Framework
I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter /MyFilter.php /Validator /MyValidator.php I would like to put custom filters and validators in their respective folders and have them loaded automatically when used. However, I cannot figure out how to best accomplish this...
I designed and implemented Zend_Filter_Input back in 2007. You can add new class prefixes to help load your custom filter and validator classes. By default, Zend_Filter_Input searches for classes that have the prefixes "Zend_Filter" and "Zend_Validate". Try this: $inputFilter->addNamespace('Core_Filter'); Before you ru...
Custom Filters/Validators in Zend Framework I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter /MyFilter.php /Validator /MyValidator.php I would like to put custom filters and validators in their respective folders and have them loaded automatically when used. However, I c...
TITLE: Custom Filters/Validators in Zend Framework QUESTION: I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter /MyFilter.php /Validator /MyValidator.php I would like to put custom filters and validators in their respective folders and have them loaded automatically when ...
[ "php", "zend-framework" ]
9
19
5,602
1
0
2008-10-08T21:22:55.677000
2008-10-08T22:46:17.227000
185,004
867,423
java.beans.Introspector getBeanInfo does not pickup any superinterface's properties
I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public interface Person { String getName(); } public interface Employee extends Person { int getSalary(); } Introspecting on Employee only yields salary even though name is inherited from Person. Why is thi...
This issue is covered in Sun bug java.beans.Introspector doesn't work for interfaces
java.beans.Introspector getBeanInfo does not pickup any superinterface's properties I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public interface Person { String getName(); } public interface Employee extends Person { int getSalary(); } Introspecting ...
TITLE: java.beans.Introspector getBeanInfo does not pickup any superinterface's properties QUESTION: I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public interface Person { String getName(); } public interface Employee extends Person { int getSalary()...
[ "java", "reflection", "javabeans" ]
5
3
3,543
4
0
2008-10-08T21:27:05.683000
2009-05-15T07:38:58.773000
185,014
185,143
How to version milestones developed in parallel that may not be completed sequentially?
I am currently working on a project with five other developers and we are using subversion for our revision control system. We have established that we have 12 milestones leading up to the first release of our software. We have labeled the milestones using version numbers (0.1 through 0.12) and descriptive labels. For ...
I don't think that you can because you have conflicting goals - parallel development and sequential milestones. Either you hold off making the 0.3 release until 0.1 and 0.2 are completed or you have to think of another way of assigning milestone numbers. Maybe instead of using 0.1 etc. you could name the milestones bas...
How to version milestones developed in parallel that may not be completed sequentially? I am currently working on a project with five other developers and we are using subversion for our revision control system. We have established that we have 12 milestones leading up to the first release of our software. We have labe...
TITLE: How to version milestones developed in parallel that may not be completed sequentially? QUESTION: I am currently working on a project with five other developers and we are using subversion for our revision control system. We have established that we have 12 milestones leading up to the first release of our soft...
[ "svn", "versioning" ]
5
2
976
3
0
2008-10-08T21:30:28.393000
2008-10-08T22:19:44.190000
185,028
185,077
HTTP Compression in IIS 6 - vs Third Party Solutions
Anyone had any experience with httpZip product (ISAPI - based compression for IIS). I'm wondering if this is worthwhile compared to the native compression in IIS6... Pros / Cons / pitfalls of either approach?
The website itself tells you to use native IIS6 except for specific reasons. If a company is telling you not to use their own product, they must have done the comparison themselves and not come out favorably. It is refreshing for a company to actually look out for its users like that... If you need the features, use th...
HTTP Compression in IIS 6 - vs Third Party Solutions Anyone had any experience with httpZip product (ISAPI - based compression for IIS). I'm wondering if this is worthwhile compared to the native compression in IIS6... Pros / Cons / pitfalls of either approach?
TITLE: HTTP Compression in IIS 6 - vs Third Party Solutions QUESTION: Anyone had any experience with httpZip product (ISAPI - based compression for IIS). I'm wondering if this is worthwhile compared to the native compression in IIS6... Pros / Cons / pitfalls of either approach? ANSWER: The website itself tells you to...
[ "iis-6", "compression", "gzip" ]
2
2
656
1
0
2008-10-08T21:37:26.023000
2008-10-08T21:54:33.150000
185,033
216,046
GLUT: any way to add a "file readable" hook to the event loop?
I'd like to open a socket and hang a readable event on the GLUT event loop... any ideas on how to do this? Portable standard GLUT code is best, but I'm open to platform-specific hacks as well. Thanks!
GLUT doesn't support this very well. See GLUT FAQ #18 You could register an idle function with glutIdleFunc, and in the idle function poll your socket to see if there's new data available. In order to avoid blocking when you read from your socket, you need to set your socket to be non-blocking by calling: #include #inc...
GLUT: any way to add a "file readable" hook to the event loop? I'd like to open a socket and hang a readable event on the GLUT event loop... any ideas on how to do this? Portable standard GLUT code is best, but I'm open to platform-specific hacks as well. Thanks!
TITLE: GLUT: any way to add a "file readable" hook to the event loop? QUESTION: I'd like to open a socket and hang a readable event on the GLUT event loop... any ideas on how to do this? Portable standard GLUT code is best, but I'm open to platform-specific hacks as well. Thanks! ANSWER: GLUT doesn't support this ver...
[ "opengl", "glut", "event-loop" ]
0
2
251
1
0
2008-10-08T21:42:00.130000
2008-10-19T05:23:49.477000
185,034
185,046
Testing the type of a DOM element in JavaScript
Is there a way to test the type of an element in JavaScript? The answer may or may not require the prototype library, however the following setup does make use of the library. function(event) { var element = event.element(); // if the element is an anchor... // if the element is a td... }
You can use typeof(N) to get the actual object type, but what you want to do is check the tag, not the type of the DOM element. In that case, use the elem.tagName or elem.nodeName property. if you want to get really creative, you can use a dictionary of tagnames and anonymous closures instead if a switch or if/else.
Testing the type of a DOM element in JavaScript Is there a way to test the type of an element in JavaScript? The answer may or may not require the prototype library, however the following setup does make use of the library. function(event) { var element = event.element(); // if the element is an anchor... // if the ele...
TITLE: Testing the type of a DOM element in JavaScript QUESTION: Is there a way to test the type of an element in JavaScript? The answer may or may not require the prototype library, however the following setup does make use of the library. function(event) { var element = event.element(); // if the element is an ancho...
[ "javascript", "prototypejs" ]
107
136
142,131
7
0
2008-10-08T21:42:18.960000
2008-10-08T21:45:43.633000
185,042
185,056
How do I resolve "%1 is not a valid Win32 application"?
Environment: Windows Server 2003 R2 Enterprise 64bit, SP2.NET framework is supposedly installed (2.0 SP2, 3.0 SP2, 3.5 SP1) I say "supposedly" because they are listed as installed under Add/Remove programs. I'm not sure it's properly installed, because the "ASP.NET" tab isn't added to any of the sites in IIS. In the II...
Have you tried running: aspnet_regiis -i from the command line?
How do I resolve "%1 is not a valid Win32 application"? Environment: Windows Server 2003 R2 Enterprise 64bit, SP2.NET framework is supposedly installed (2.0 SP2, 3.0 SP2, 3.5 SP1) I say "supposedly" because they are listed as installed under Add/Remove programs. I'm not sure it's properly installed, because the "ASP.NE...
TITLE: How do I resolve "%1 is not a valid Win32 application"? QUESTION: Environment: Windows Server 2003 R2 Enterprise 64bit, SP2.NET framework is supposedly installed (2.0 SP2, 3.0 SP2, 3.5 SP1) I say "supposedly" because they are listed as installed under Add/Remove programs. I'm not sure it's properly installed, b...
[ ".net", "asp.net", "configuration", "64-bit", "win64" ]
13
10
96,630
6
0
2008-10-08T21:44:56.287000
2008-10-08T21:48:50.883000
185,050
186,074
C++ testing framework: recommendation sought
I'm looking for a "quick and dirty" C++ testing framework I can use on my Windows/Visual Studio box. It's just me developing, so it doesn't have to be enterprise class software. Staring at a list of testing frameworks, I am somewhat befuddled... http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C.2B.2B
Here's a great article about C++ TDD frameworks. For the record, my personal preference is CxxTest, which I have been happily using for about six months now.
C++ testing framework: recommendation sought I'm looking for a "quick and dirty" C++ testing framework I can use on my Windows/Visual Studio box. It's just me developing, so it doesn't have to be enterprise class software. Staring at a list of testing frameworks, I am somewhat befuddled... http://en.wikipedia.org/wiki/...
TITLE: C++ testing framework: recommendation sought QUESTION: I'm looking for a "quick and dirty" C++ testing framework I can use on my Windows/Visual Studio box. It's just me developing, so it doesn't have to be enterprise class software. Staring at a list of testing frameworks, I am somewhat befuddled... http://en.w...
[ "c++", "windows", "unit-testing", "frameworks" ]
4
5
1,086
7
0
2008-10-08T21:47:27.907000
2008-10-09T06:03:04.643000
185,052
185,963
How to change the default Browser in Expression Blend
I want to set IE as my default browser for running Silver light applications from Expression Blend, but I don't want to change my windows default from Mozilla. Is there a settings option in Blend to do this?
Right now there is not a setting to do that. It will use the default configured browser.
How to change the default Browser in Expression Blend I want to set IE as my default browser for running Silver light applications from Expression Blend, but I don't want to change my windows default from Mozilla. Is there a settings option in Blend to do this?
TITLE: How to change the default Browser in Expression Blend QUESTION: I want to set IE as my default browser for running Silver light applications from Expression Blend, but I don't want to change my windows default from Mozilla. Is there a settings option in Blend to do this? ANSWER: Right now there is not a settin...
[ "silverlight", "expression-blend" ]
3
5
954
1
0
2008-10-08T21:47:43.007000
2008-10-09T04:48:59.927000
185,072
185,146
Learning LINQ: QuickSort
I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort. Now -- ignoring the fact that I could just use an ORDERBY and that this is a very silly qsort implementation -- what I came up with was this: public clas...
Just change the type of the parameter to IEnumerable and use the var construct instead of your List for your local variables. This will make your QSLinq method better because it will accept more types of parameters, for example int[], as well as List. See the new method: public static IEnumerable QSLinq(IEnumerable _it...
Learning LINQ: QuickSort I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort. Now -- ignoring the fact that I could just use an ORDERBY and that this is a very silly qsort implementation -- what I came up w...
TITLE: Learning LINQ: QuickSort QUESTION: I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort. Now -- ignoring the fact that I could just use an ORDERBY and that this is a very silly qsort implementation -...
[ "c#", ".net", "linq" ]
10
9
3,975
6
0
2008-10-08T21:52:45.727000
2008-10-08T22:20:21.130000
185,080
189,185
What is the general complexity of building a canonical language representation?
It is often handy to have a canonical representation of a language (in my case they are usually domain specific languages); however, I believe there are strict limits on the expressiveness of the languages involved that determine whether a canonical form can be determined and/or created for an arbitrary program in that...
By "canonical representation" I assume you mean the following: Call programs P and Q equivalent if they "do the same thing" on the same inputs. "Doing the same thing" means that the programs have the same output, and either both programs halt after a finite time or both enter an infinite loop. This equivalence relation...
What is the general complexity of building a canonical language representation? It is often handy to have a canonical representation of a language (in my case they are usually domain specific languages); however, I believe there are strict limits on the expressiveness of the languages involved that determine whether a ...
TITLE: What is the general complexity of building a canonical language representation? QUESTION: It is often handy to have a canonical representation of a language (in my case they are usually domain specific languages); however, I believe there are strict limits on the expressiveness of the languages involved that de...
[ "dsl", "language-theory", "canonical-form" ]
0
1
551
2
0
2008-10-08T21:55:30.587000
2008-10-09T20:57:20.550000
185,082
1,020,569
Is it possible to limit standard streams available to linux at the process level?
I would like to be able to spawn a linux process that would only have access to stdin, stdout, and stderr (nothing more and nothing less). Can I do this at the process level itself? I am also implicitly stating (oxymoron) that I don't want the spawned process to be able to change the "thing" that the other end of the s...
As stated in another answer SELinux does have various permissions that help lock down any process. The kernel manages access to certain objects (with associated set of permissions) for example a file is an object, a directory is an object, a unix datagram socket is an object and many more. probably the easiest thing to...
Is it possible to limit standard streams available to linux at the process level? I would like to be able to spawn a linux process that would only have access to stdin, stdout, and stderr (nothing more and nothing less). Can I do this at the process level itself? I am also implicitly stating (oxymoron) that I don't wan...
TITLE: Is it possible to limit standard streams available to linux at the process level? QUESTION: I would like to be able to spawn a linux process that would only have access to stdin, stdout, and stderr (nothing more and nothing less). Can I do this at the process level itself? I am also implicitly stating (oxymoron...
[ "linux", "stream", "selinux" ]
3
2
531
4
0
2008-10-08T21:55:37.373000
2009-06-20T00:16:49.387000
185,083
286,448
Can I inject a thread in a remote app domain from C#
I was wondering if its possible to inject a thread into a remote app domain running in a separate process. My guess is that I could do this using the debugging interfaces (ICorDebug) but I was wondering if there is any other way?
This can be done there is sample code in snoop It sets up a hook, and using managed c++ tells the appdomain to load an assembly. Really impressive...
Can I inject a thread in a remote app domain from C# I was wondering if its possible to inject a thread into a remote app domain running in a separate process. My guess is that I could do this using the debugging interfaces (ICorDebug) but I was wondering if there is any other way?
TITLE: Can I inject a thread in a remote app domain from C# QUESTION: I was wondering if its possible to inject a thread into a remote app domain running in a separate process. My guess is that I could do this using the debugging interfaces (ICorDebug) but I was wondering if there is any other way? ANSWER: This can b...
[ "c#", ".net", "appdomain", "code-injection" ]
2
0
2,264
4
0
2008-10-08T21:55:40.727000
2008-11-13T07:36:24.620000
185,091
185,100
Delphi 7 compile error - “Duplicate resource(s)” between .res and .dfm
I got a very similar error to the one below: How can I fix this delphi 7 compile error - "Duplicate resource(s)" However, the error I got is this: [Error] WARNING. Duplicate resource(s): [Error] Type 10 (RCDATA), ID TFMMAINTQUOTE: [Error] File P:\[PATH SNIPPED]\Manufacturing.RES resource kept; file FMaintQuote.DFM reso...
Try renaming Manufacturing,res to Manufacturing.bak or something. Delphi should recreate the res file. You would of course need to recreate any references, strings etc in the res file in the new one, but worth trying anyway...
Delphi 7 compile error - “Duplicate resource(s)” between .res and .dfm I got a very similar error to the one below: How can I fix this delphi 7 compile error - "Duplicate resource(s)" However, the error I got is this: [Error] WARNING. Duplicate resource(s): [Error] Type 10 (RCDATA), ID TFMMAINTQUOTE: [Error] File P:\[P...
TITLE: Delphi 7 compile error - “Duplicate resource(s)” between .res and .dfm QUESTION: I got a very similar error to the one below: How can I fix this delphi 7 compile error - "Duplicate resource(s)" However, the error I got is this: [Error] WARNING. Duplicate resource(s): [Error] Type 10 (RCDATA), ID TFMMAINTQUOTE: ...
[ "delphi" ]
4
2
16,440
8
0
2008-10-08T21:58:38.490000
2008-10-08T22:04:03.567000
185,112
185,140
Stripping out a link in jQuery
I have a bit of html like so: I need to strip off the links so I'm just left with a couple of image tags. What would be the most efficient way to do this with jQuery?
$("a > img").parent() // match all, select parents.each( function() // for each link { $(this).replaceWith( // replace the $(this).children().remove() ); // with its detached children. });
Stripping out a link in jQuery I have a bit of html like so: I need to strip off the links so I'm just left with a couple of image tags. What would be the most efficient way to do this with jQuery?
TITLE: Stripping out a link in jQuery QUESTION: I have a bit of html like so: I need to strip off the links so I'm just left with a couple of image tags. What would be the most efficient way to do this with jQuery? ANSWER: $("a > img").parent() // match all, select parents.each( function() // for each link { $(this)....
[ "javascript", "jquery" ]
6
9
1,200
3
0
2008-10-08T22:08:46.020000
2008-10-08T22:19:19.387000
185,114
185,121
How do I "use" a Perl module in a directory not in @INC?
I have a module in the parent directory of my script and I would like to 'use' it. If I do use '../Foo.pm'; I get syntax errors. I tried to do: push @INC, '..'; use EPMS; and.. apparently doesn't show up in @INC I'm going crazy! What's wrong here?
use takes place at compile-time, so this would work: BEGIN {push @INC, '..'} use EPMS; But the better solution is to use lib, which is a nicer way of writing the above: use lib '..'; use EPMS; In case you are running from a different directory, though, the use of FindBin is recommended: use FindBin; # locate this scrip...
How do I "use" a Perl module in a directory not in @INC? I have a module in the parent directory of my script and I would like to 'use' it. If I do use '../Foo.pm'; I get syntax errors. I tried to do: push @INC, '..'; use EPMS; and.. apparently doesn't show up in @INC I'm going crazy! What's wrong here?
TITLE: How do I "use" a Perl module in a directory not in @INC? QUESTION: I have a module in the parent directory of my script and I would like to 'use' it. If I do use '../Foo.pm'; I get syntax errors. I tried to do: push @INC, '..'; use EPMS; and.. apparently doesn't show up in @INC I'm going crazy! What's wrong her...
[ "perl", "module", "relative-path" ]
70
113
82,517
8
0
2008-10-08T22:08:54.400000
2008-10-08T22:11:29.073000
185,141
185,475
How to avoid screen flickering when a control must be constantly repainted in C#?
I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be dragged into it. I am just drawing a simple rectangle around the ListView and updating the opacity ...
I stumbled on a solution for this if anyone is interested. It turns out that the flashing is caused by the painting of the background. I used SetStyle to tell the control that I will be handling all of the painting. SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.Opaque | ControlStyles.UserPaint | C...
How to avoid screen flickering when a control must be constantly repainted in C#? I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be dragged into it. ...
TITLE: How to avoid screen flickering when a control must be constantly repainted in C#? QUESTION: I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be...
[ "c#", ".net", "onpaint" ]
3
4
7,269
6
0
2008-10-08T22:19:29.010000
2008-10-09T00:24:58.523000
185,180
194,802
Navigation on validation failure in Seam/JSF
I've been playing with Seam (2.0.2.SP1) for a few weeks, and I have most of the basics nailed down, but I haven't come up with a decent solution to the following. Suppose I have a form at /foo.xhtml, with a rewrite rule such that URLs like /foo.seam?id= are converted to /foo/. There's a commandButton on the form with a...
You would normally redisplay the same view on a validation failure, rather than redirect. Assuming that you are using UrlRewrite for the rewrite rules, perhaps you can use an outbound-rule so that the /foo/{fooId} URL is still shown in this case.
Navigation on validation failure in Seam/JSF I've been playing with Seam (2.0.2.SP1) for a few weeks, and I have most of the basics nailed down, but I haven't come up with a decent solution to the following. Suppose I have a form at /foo.xhtml, with a rewrite rule such that URLs like /foo.seam?id= are converted to /foo...
TITLE: Navigation on validation failure in Seam/JSF QUESTION: I've been playing with Seam (2.0.2.SP1) for a few weeks, and I have most of the basics nailed down, but I haven't come up with a decent solution to the following. Suppose I have a form at /foo.xhtml, with a rewrite rule such that URLs like /foo.seam?id= are...
[ "java", "rest", "jsf", "seam" ]
1
1
1,600
1
0
2008-10-08T22:32:05.397000
2008-10-11T23:12:52.713000
185,185
185,811
Alternative to libraries of static classes
I have a large collection of static 'Utility' classes that contain very generic static methods. For example, I have a CollectionUtility class that has useful methods like: public static void RemoveDuplicates(ICollection collection)... etc With C# 3.0 I've been converting these to extension methods. Now, I've heard some...
You're talking about code that would be shared library stuff. Static methods do have a place in shared libs. Check out System.Linq.Enumerable I'd follow these guidelines: These aren't static methods by default. They should only be static methods because they are naturally stateless (behavior only depend on parameters)....
Alternative to libraries of static classes I have a large collection of static 'Utility' classes that contain very generic static methods. For example, I have a CollectionUtility class that has useful methods like: public static void RemoveDuplicates(ICollection collection)... etc With C# 3.0 I've been converting these...
TITLE: Alternative to libraries of static classes QUESTION: I have a large collection of static 'Utility' classes that contain very generic static methods. For example, I have a CollectionUtility class that has useful methods like: public static void RemoveDuplicates(ICollection collection)... etc With C# 3.0 I've bee...
[ "c#", "class", "static" ]
3
1
1,589
4
0
2008-10-08T22:35:21.053000
2008-10-09T03:16:22.140000
185,203
185,218
PHP 5.x syncronized file access (no database)
I'm mostly familiar with Java, C and C++ in which there are ways to control that only one thread is accessing a resource at any given time. Now I'm in search for something similar but in PHP 5.x. To formulate my problem with one example: I have an ASCII-file which only stores a number, the value of a page load counter....
You could try php's variant of flock ( http://www.php.net/flock ) I would envision something similar to (this assumes that the file /tmp/counter.txt already exists and has a counter in the file):
PHP 5.x syncronized file access (no database) I'm mostly familiar with Java, C and C++ in which there are ways to control that only one thread is accessing a resource at any given time. Now I'm in search for something similar but in PHP 5.x. To formulate my problem with one example: I have an ASCII-file which only stor...
TITLE: PHP 5.x syncronized file access (no database) QUESTION: I'm mostly familiar with Java, C and C++ in which there are ways to control that only one thread is accessing a resource at any given time. Now I'm in search for something similar but in PHP 5.x. To formulate my problem with one example: I have an ASCII-fi...
[ "php", "file", "synchronization", "mutex" ]
6
7
1,524
2
0
2008-10-08T22:41:58.793000
2008-10-08T22:45:21.423000
185,204
185,251
Is there a way to determine whether an e-mail reaches its destination?
I have a PHP script that sends critical e-mails. I know how to check whether the e-mail was sent successfully. However, is there a way to verify whether the e-mail reached its destination?
If you make the email HTML based, you can include images in it which contain URLs with information unique to the recipient. You could structure your application so that these URLs trigger some code to mark that particular email as read before returning the required image data. To be totally effective, the images would ...
Is there a way to determine whether an e-mail reaches its destination? I have a PHP script that sends critical e-mails. I know how to check whether the e-mail was sent successfully. However, is there a way to verify whether the e-mail reached its destination?
TITLE: Is there a way to determine whether an e-mail reaches its destination? QUESTION: I have a PHP script that sends critical e-mails. I know how to check whether the e-mail was sent successfully. However, is there a way to verify whether the e-mail reached its destination? ANSWER: If you make the email HTML based,...
[ "php", "error-handling", "email", "error-detection" ]
8
9
8,745
12
0
2008-10-08T22:42:33.287000
2008-10-08T22:55:14.383000
185,208
185,214
How do I get and set Environment variables in C#?
How can I get Environnment variables and if something is missing, set the value?
Use the System.Environment class. The methods var value = System.Environment.GetEnvironmentVariable(variable [, Target]) and System.Environment.SetEnvironmentVariable(variable, value [, Target]) will do the job for you. The optional parameter Target is an enum of type EnvironmentVariableTarget and it can be one of: Mac...
How do I get and set Environment variables in C#? How can I get Environnment variables and if something is missing, set the value?
TITLE: How do I get and set Environment variables in C#? QUESTION: How can I get Environnment variables and if something is missing, set the value? ANSWER: Use the System.Environment class. The methods var value = System.Environment.GetEnvironmentVariable(variable [, Target]) and System.Environment.SetEnvironmentVari...
[ "c#", ".net", ".net-2.0", "environment-variables" ]
260
349
336,695
9
0
2008-10-08T22:43:17.277000
2008-10-08T22:44:20.753000
185,210
185,225
What are some best practices for handling sensitive information?
I'm currently creating an application for a customer that will allow them to automatically bill their customers credit cards. I'm curious as to what are some best practices to safely store and access the credit card information, and for that matter, any other sensitive information, like social security numbers, account...
Read the PCI requirements. Everything will be there. Actually, you must follow them.
What are some best practices for handling sensitive information? I'm currently creating an application for a customer that will allow them to automatically bill their customers credit cards. I'm curious as to what are some best practices to safely store and access the credit card information, and for that matter, any o...
TITLE: What are some best practices for handling sensitive information? QUESTION: I'm currently creating an application for a customer that will allow them to automatically bill their customers credit cards. I'm curious as to what are some best practices to safely store and access the credit card information, and for ...
[ "security", "credit-card" ]
4
5
1,073
6
0
2008-10-08T22:43:31.130000
2008-10-08T22:47:36.020000
185,235
185,257
jQuery tabs - getting newly selected index
I've previously used jquery-ui tabs extension to load page fragments via ajax, and to conceal or reveal hidden div s within a page. Both of these methods are well documented, and I've had no problems there. Now, however, I want to do something different with tabs. When the user selects a tab, it should reload the page ...
I would take a look at the events for Tabs. The following is taken from the jQuery docs: $('.ui-tabs-nav').bind('tabsselect', function(event, ui) { ui.options // options used to intialize this widget ui.tab // anchor element of the selected (clicked) tab ui.panel // element, that contains the contents of the selected (...
jQuery tabs - getting newly selected index I've previously used jquery-ui tabs extension to load page fragments via ajax, and to conceal or reveal hidden div s within a page. Both of these methods are well documented, and I've had no problems there. Now, however, I want to do something different with tabs. When the use...
TITLE: jQuery tabs - getting newly selected index QUESTION: I've previously used jquery-ui tabs extension to load page fragments via ajax, and to conceal or reveal hidden div s within a page. Both of these methods are well documented, and I've had no problems there. Now, however, I want to do something different with ...
[ "javascript", "jquery", "jquery-ui", "jquery-plugins", "jquery-ui-tabs" ]
26
37
69,551
8
0
2008-10-08T22:51:00.710000
2008-10-08T22:56:52.710000
185,236
185,253
How do I tell if someone's faking a filetype? (PHP)
I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a zip file as somezipfile.png and store it, thus keepin...
Magic number. If you can read first few bytes of a binary file you can know what kind of file it is.
How do I tell if someone's faking a filetype? (PHP) I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a z...
TITLE: How do I tell if someone's faking a filetype? (PHP) QUESTION: I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that user...
[ "php", "upload", "mime-types", "file-type" ]
12
18
3,149
9
0
2008-10-08T22:51:53.703000
2008-10-08T22:56:09.450000
185,239
586,688
Displaying Loading text while doing a WebRequest
I have a button on my webform. Clicking this button will do an HttpWebRequest during the onclick event handler. After the request we copy the response from the request into HttpContext.Current.Response and send that to the client. This web request can take a while (up to 5 seconds, since it's generating a report). Duri...
As an alternative to the Professional AJAX.NET library, jQuery has a really nice way of doing this. Take a look at this example of using a.NET PageMethod (if possible in your scenario). You define a page method call in jQuery, you can tack on your loading... message in a hidden div. Say what callback you want to return...
Displaying Loading text while doing a WebRequest I have a button on my webform. Clicking this button will do an HttpWebRequest during the onclick event handler. After the request we copy the response from the request into HttpContext.Current.Response and send that to the client. This web request can take a while (up to...
TITLE: Displaying Loading text while doing a WebRequest QUESTION: I have a button on my webform. Clicking this button will do an HttpWebRequest during the onclick event handler. After the request we copy the response from the request into HttpContext.Current.Response and send that to the client. This web request can t...
[ "asp.net", "httpwebrequest" ]
1
4
2,220
4
0
2008-10-08T22:52:16.107000
2009-02-25T16:13:54.357000
185,240
189,625
Uninitialized string offset error from PHP import script
I have an import-from-excel script as part of a CMS that previously ran without issue. My shared-hosting provider has recently upgraded their infrastructure, including PHP from 5.1 to 5.2.6, and the script now returns "Uninitialized string offset: -XXX in /path/scriptname.php on line 27" (XXX being a decreasing number ...
Uninitialized string offset:... means that $data is not an array.
Uninitialized string offset error from PHP import script I have an import-from-excel script as part of a CMS that previously ran without issue. My shared-hosting provider has recently upgraded their infrastructure, including PHP from 5.1 to 5.2.6, and the script now returns "Uninitialized string offset: -XXX in /path/s...
TITLE: Uninitialized string offset error from PHP import script QUESTION: I have an import-from-excel script as part of a CMS that previously ran without issue. My shared-hosting provider has recently upgraded their infrastructure, including PHP from 5.1 to 5.2.6, and the script now returns "Uninitialized string offse...
[ "php", "apache", "web-hosting" ]
4
2
10,145
3
0
2008-10-08T22:52:31.363000
2008-10-09T23:50:45.300000
185,241
185,301
How do I see the hex values of a string in a VS2008 watch window?
I have a string in a watch window in VS2008 and want to see the hex representation of each character. If I right click there's a hexadecimal option but this doesn't appear to do anything. Anybody know how to view the string as a series of hex values?
Add your string as a watch, then edit the watch expression and append ".ToCharArray()" to view it as an array of chars. When you expand your watch you will see char code next to each individual char. Checking "Hexadecimal display" will show you hex codes for each character.
How do I see the hex values of a string in a VS2008 watch window? I have a string in a watch window in VS2008 and want to see the hex representation of each character. If I right click there's a hexadecimal option but this doesn't appear to do anything. Anybody know how to view the string as a series of hex values?
TITLE: How do I see the hex values of a string in a VS2008 watch window? QUESTION: I have a string in a watch window in VS2008 and want to see the hex representation of each character. If I right click there's a hexadecimal option but this doesn't appear to do anything. Anybody know how to view the string as a series ...
[ "c#", "visual-studio-2008", "debugging" ]
6
8
5,754
2
0
2008-10-08T22:52:31.987000
2008-10-08T23:10:41.233000
185,254
185,298
How can a Win32 process get the pid of its parent?
I'm currently passing the pid on the command line to the child, but is there a way to do this in the Win32 API? Alternatively, can someone alleviate my fear that the pid I'm passing might belong to another process after some time if the parent has died?
Notice that if the parent process terminates it is very possible and even likely that the PID will be reused for another process. This is standard windows operation. So to be sure, once you receive the id of the parent and are sure it is really your parent you should open a handle to it and use that.
How can a Win32 process get the pid of its parent? I'm currently passing the pid on the command line to the child, but is there a way to do this in the Win32 API? Alternatively, can someone alleviate my fear that the pid I'm passing might belong to another process after some time if the parent has died?
TITLE: How can a Win32 process get the pid of its parent? QUESTION: I'm currently passing the pid on the command line to the child, but is there a way to do this in the Win32 API? Alternatively, can someone alleviate my fear that the pid I'm passing might belong to another process after some time if the parent has die...
[ "winapi", "process" ]
41
13
60,691
5
0
2008-10-08T22:56:09.763000
2008-10-08T23:10:15.883000
185,262
185,294
How does your company do "Enterprise" Password Management?
We've talked about personal password management here but how do you guys manage your passwords at a company wide level?
We have managed to plan our company applications so they are mainly web based and open source or in-house developed. This then allowed us to use LDAP to hook into active directory for logging into our intranet. From there we modified the logins into various products we use (MediaWiki, Wordpress, SugarCRM etc.) so that ...
How does your company do "Enterprise" Password Management? We've talked about personal password management here but how do you guys manage your passwords at a company wide level?
TITLE: How does your company do "Enterprise" Password Management? QUESTION: We've talked about personal password management here but how do you guys manage your passwords at a company wide level? ANSWER: We have managed to plan our company applications so they are mainly web based and open source or in-house develope...
[ "security", "passwords", "enterprise" ]
36
6
30,211
13
0
2008-10-08T22:59:11.410000
2008-10-08T23:08:23.280000
185,282
185,285
How can I make a class global to the entire application?
I would like to access a class everywhere in my application, how can I do this? To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call the same code in both place by using something. In php I would just include...
The concept of global classes in C# is really just a simple matter of referencing the appropriate assembly containing the class. Once you have reference the needed assembly, you can refer to the class of choice either by it's fully qualified Type name, or by importing the namespace that contains the class. ( Concrete i...
How can I make a class global to the entire application? I would like to access a class everywhere in my application, how can I do this? To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call the same code in b...
TITLE: How can I make a class global to the entire application? QUESTION: I would like to access a class everywhere in my application, how can I do this? To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call ...
[ "c#", ".net" ]
5
4
26,289
4
0
2008-10-08T23:04:53.303000
2008-10-08T23:06:11.833000
185,306
185,315
IIS Recycling too often
We run a.NET 1.1 application on W2k3 server. The app pool is configured to recycle at 512MB. However, a week ago it started to recycle every 2 minutes. Since we run a web farm, the anonymous user we run IIS with is a domain account. About a week ago, that user account expired, and we have to re-enable it. Could that ha...
Try finding out more info by Logging ASP.NET Application Shutdown Events
IIS Recycling too often We run a.NET 1.1 application on W2k3 server. The app pool is configured to recycle at 512MB. However, a week ago it started to recycle every 2 minutes. Since we run a web farm, the anonymous user we run IIS with is a domain account. About a week ago, that user account expired, and we have to re-...
TITLE: IIS Recycling too often QUESTION: We run a.NET 1.1 application on W2k3 server. The app pool is configured to recycle at 512MB. However, a week ago it started to recycle every 2 minutes. Since we run a web farm, the anonymous user we run IIS with is a domain account. About a week ago, that user account expired, ...
[ "asp.net", "iis", "windows-server-2003" ]
2
4
1,264
3
0
2008-10-08T23:12:29.387000
2008-10-08T23:15:32.143000
185,314
185,342
What happens if I don't close a System.Diagnostics.Process in my C# console app?
I have a C# app which uses a System.Diagnostics.Process to run another exe. I ran into some example code where the process is started in a try block and closed in a finally block. I also saw example code where the process is not closed. What happens when the process is not closed? Are the resources used by the process ...
When the other process exits, all of its resources are freed up, but you will still be holding onto a process handle (which is a pointer to a block of information about the process) unless you call Close() on your Process reference. I doubt there would be much of an issue, but you may as well. Process implements IDispo...
What happens if I don't close a System.Diagnostics.Process in my C# console app? I have a C# app which uses a System.Diagnostics.Process to run another exe. I ran into some example code where the process is started in a try block and closed in a finally block. I also saw example code where the process is not closed. Wh...
TITLE: What happens if I don't close a System.Diagnostics.Process in my C# console app? QUESTION: I have a C# app which uses a System.Diagnostics.Process to run another exe. I ran into some example code where the process is started in a try block and closed in a finally block. I also saw example code where the process...
[ "c#", "process" ]
5
14
3,414
3
0
2008-10-08T23:15:23.220000
2008-10-08T23:25:44.057000
185,327
185,439
Oracle joins ( left outer, right, etc. :S )
I knew stackoverflow would help me for other than know what is the "favorite programming cartoon":P This was the accepted answer by: Bill Karwin Thanks to all for the help ( I would like to double vote you all ) My query ended up like this ( this is the real one ) SELECT accepted.folio, COALESCE( inprog.activityin, acc...
Try something like this (I haven't tested it): SELECT p_new.identifier, COALESCE(p_inprog.activity, p_new.activity) AS activity, p_inprog.participant, COALESCE(p_inprog.closedate, p_new.closedate) AS closedate FROM performance p_new LEFT OUTER JOIN performance p_inprog ON (p_new.identifier = p_inprog.identifier AND p_i...
Oracle joins ( left outer, right, etc. :S ) I knew stackoverflow would help me for other than know what is the "favorite programming cartoon":P This was the accepted answer by: Bill Karwin Thanks to all for the help ( I would like to double vote you all ) My query ended up like this ( this is the real one ) SELECT acce...
TITLE: Oracle joins ( left outer, right, etc. :S ) QUESTION: I knew stackoverflow would help me for other than know what is the "favorite programming cartoon":P This was the accepted answer by: Bill Karwin Thanks to all for the help ( I would like to double vote you all ) My query ended up like this ( this is the real...
[ "sql", "oracle", "join", "left-join" ]
4
3
2,023
9
0
2008-10-08T23:19:44.660000
2008-10-09T00:07:14.427000
185,349
185,589
Can I specify a generic type in XAML (pre .NET 4 Framework)?
In XAML I can declare a DataTemplate so that the template is used whenever a specific type is displayed. For example, this DataTemplate will use a TextBlock to display the name of a customer: I'm wondering if it's possible to define a DataTemplate that will be used any time an IList is displayed. So if a ContentControl...
Not out of the box, no; but there are enterprising developers out there who have done so. Mike Hillberg at Microsoft played with it in this post, for example. Google has others of course.
Can I specify a generic type in XAML (pre .NET 4 Framework)? In XAML I can declare a DataTemplate so that the template is used whenever a specific type is displayed. For example, this DataTemplate will use a TextBlock to display the name of a customer: I'm wondering if it's possible to define a DataTemplate that will b...
TITLE: Can I specify a generic type in XAML (pre .NET 4 Framework)? QUESTION: In XAML I can declare a DataTemplate so that the template is used whenever a specific type is displayed. For example, this DataTemplate will use a TextBlock to display the name of a customer: I'm wondering if it's possible to define a DataTe...
[ "c#", "wpf", "xaml", "generics" ]
75
24
43,723
5
0
2008-10-08T23:28:07.360000
2008-10-09T01:26:00.490000
185,363
185,504
Implementing functionality/code directly in database system
RDBMS packages today offer a tremendous amount of functionality beyond standard data storage and retrieval. SQL Server for example can send emails, expose web service methods, and execute CLR code amongst other capabilities. However, I have always tried to limit the amount of processing my database server does to just ...
I know Microsoft SQL Server and Oracle really push using stored procedures for everything, which helps to encapsulate the relational architecture and creates a more procedural interface for the software developers, who typically aren't as facile writing SQL queries. But then half your application logic is written in PL...
Implementing functionality/code directly in database system RDBMS packages today offer a tremendous amount of functionality beyond standard data storage and retrieval. SQL Server for example can send emails, expose web service methods, and execute CLR code amongst other capabilities. However, I have always tried to lim...
TITLE: Implementing functionality/code directly in database system QUESTION: RDBMS packages today offer a tremendous amount of functionality beyond standard data storage and retrieval. SQL Server for example can send emails, expose web service methods, and execute CLR code amongst other capabilities. However, I have a...
[ "database" ]
3
4
277
2
0
2008-10-08T23:35:06.363000
2008-10-09T00:40:53.343000
185,378
185,397
Regular expression to match start of filename and filename extension
What is the regular expression to match strings (in this case, file names) that start with 'Run' and have a filename extension of '.py'? The regular expression should match any of the following: RunFoo.py RunBar.py Run42.py It should not match: myRunFoo.py RunBar.py1 Run42.txt The SQL equivalent of what I am looking fo...
For a regular expression, you would use: re.match(r'Run.*\.py$') A quick explanation:. means match any character. * means match any repetition of the previous character (hence.* means any sequence of chars) \ is an escape to escape the explicit dot $ indicates "end of the string", so we don't match "Run_foo.py.txt" How...
Regular expression to match start of filename and filename extension What is the regular expression to match strings (in this case, file names) that start with 'Run' and have a filename extension of '.py'? The regular expression should match any of the following: RunFoo.py RunBar.py Run42.py It should not match: myRunF...
TITLE: Regular expression to match start of filename and filename extension QUESTION: What is the regular expression to match strings (in this case, file names) that start with 'Run' and have a filename extension of '.py'? The regular expression should match any of the following: RunFoo.py RunBar.py Run42.py It should...
[ "python", "sql", "regex", "sql-like" ]
31
61
115,868
8
0
2008-10-08T23:42:27.737000
2008-10-08T23:48:59.517000
185,381
185,449
How do I programmatically use the "using" keyword in C#?
I have some System.Diagnotics.Processes to run. I'd like to call the close method on them automatically. Apparently the "using" keyword does this for me. Is this the way to use the using keyword? foreach(string command in S) // command is something like "c:\a.exe" { try { using(p = Process.Start(command)) { // I litera...
using(p = Process.Start(command)) This will compile, as the Process class implements IDisposable, however you actually want to call the Close method. Logic would have it that the Dispose method would call Close for you, and by digging into the CLR using reflector, we can see that it does in fact do this for us. So far ...
How do I programmatically use the "using" keyword in C#? I have some System.Diagnotics.Processes to run. I'd like to call the close method on them automatically. Apparently the "using" keyword does this for me. Is this the way to use the using keyword? foreach(string command in S) // command is something like "c:\a.exe...
TITLE: How do I programmatically use the "using" keyword in C#? QUESTION: I have some System.Diagnotics.Processes to run. I'd like to call the close method on them automatically. Apparently the "using" keyword does this for me. Is this the way to use the using keyword? foreach(string command in S) // command is someth...
[ "c#", "process" ]
7
15
1,725
3
0
2008-10-08T23:43:51.993000
2008-10-09T00:12:28.610000
185,384
185,409
Order of static constructors/initializers in C#
While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this: static private List a = new List () { 0 }; static private List b = new List () { a[0] }; Without doing anything special that worked. Is that just luck? Does C# have rules to resolve this? Edit:...
It seems to depend on the sequence of lines. This code works: static private List a = new List () { 1 }; static private List b = new List () { a[0] }; while this code does not work (it throws a NullReferenceException ) static private List a = new List () { b[0] }; static private List b = new List () { 1 }; So, obviousl...
Order of static constructors/initializers in C# While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this: static private List a = new List () { 0 }; static private List b = new List () { a[0] }; Without doing anything special that worked. Is that just...
TITLE: Order of static constructors/initializers in C# QUESTION: While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this: static private List a = new List () { 0 }; static private List b = new List () { a[0] }; Without doing anything special that wo...
[ "c#", "static", "dependencies", "internals" ]
29
15
11,447
4
0
2008-10-08T23:44:32.850000
2008-10-08T23:54:31.127000
185,389
185,692
MVC model structure in Python
I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have: Model/__init__p.y should hold all Model class names so I can do a "from Model import User" e.g. from a Controller or a unit test case Model...
There is an inconsistency in your specification. You say Database.py needs to import all Model classes to do ORM but then you say the User class need access to the Database to do queries. Think of these as layers of an API. The Database class provides an API (maybe object-oriented) to some physical persistence layer (s...
MVC model structure in Python I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have: Model/__init__p.y should hold all Model class names so I can do a "from Model import User" e.g. from a Contro...
TITLE: MVC model structure in Python QUESTION: I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have: Model/__init__p.y should hold all Model class names so I can do a "from Model import User" ...
[ "python", "model-view-controller", "model", "structure" ]
3
7
4,072
3
0
2008-10-08T23:46:30.443000
2008-10-09T02:22:03.623000
185,423
185,581
How can I open a link in the default web browser from an HTA?
I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using opens the link in IE regardless of the default browser. Is there a way to use the default browser? Using JavaScript is an option.
Create a shell and attempt to run a URL. This works for me (save as whatever.hta and execute it) on my system. Clicking on the button opens Google in Firefox: HTA Test
How can I open a link in the default web browser from an HTA? I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using opens the link in IE regardless of the default browser. Is there a way to use the default browser?...
TITLE: How can I open a link in the default web browser from an HTA? QUESTION: I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using opens the link in IE regardless of the default browser. Is there a way to use th...
[ "javascript", "browser", "hta" ]
13
30
54,236
2
0
2008-10-08T23:59:40.027000
2008-10-09T01:18:51.317000
185,429
185,438
How to use JSON to create object that Inherits from Object Type?
I know how to use JSON to create objects, but there doesn't seem to be away to use JSON to create an object that is of a specific object type. Here's an example of an Object and creating an instance of it: Person = function() { }; Person.prototype = { FirstName: null, GetFirstName: function() { return this.FirstName; }...
I don't imagine so. I'd create a function on the Person class to initialise from a JSON object if I were you. function Person() { this.loadFromJSON = function(json) { this.FirstName = json.FirstName; }; } If you didn't know what class the JSON object was representing beforehand, perhaps add an extra variable into your ...
How to use JSON to create object that Inherits from Object Type? I know how to use JSON to create objects, but there doesn't seem to be away to use JSON to create an object that is of a specific object type. Here's an example of an Object and creating an instance of it: Person = function() { }; Person.prototype = { Fir...
TITLE: How to use JSON to create object that Inherits from Object Type? QUESTION: I know how to use JSON to create objects, but there doesn't seem to be away to use JSON to create an object that is of a specific object type. Here's an example of an Object and creating an instance of it: Person = function() { }; Person...
[ "javascript", "json", "inheritance" ]
13
15
19,301
3
0
2008-10-09T00:02:10.270000
2008-10-09T00:06:46.347000
185,444
256,120
Why is MPI considered harder than shared memory and Erlang considered easier, when they are both message-passing?
There's a lot of interest these days in Erlang as a language for writing parallel programs on multicore. I've heard people argue that Erlang's message-passing model is easier to program than the dominant shared-memory models such as threads. Conversely, in the high-performance computing community the dominant parallel ...
I agree with all previous answers, but I think a key point that is not made totally clear is that one reason that MPI might be considered hard and Erlang easy is the match of model to the domain. Erlang is based on a concept of local memory, asynchronous message passing, and shared state solved by using some form of gl...
Why is MPI considered harder than shared memory and Erlang considered easier, when they are both message-passing? There's a lot of interest these days in Erlang as a language for writing parallel programs on multicore. I've heard people argue that Erlang's message-passing model is easier to program than the dominant sh...
TITLE: Why is MPI considered harder than shared memory and Erlang considered easier, when they are both message-passing? QUESTION: There's a lot of interest these days in Erlang as a language for writing parallel programs on multicore. I've heard people argue that Erlang's message-passing model is easier to program th...
[ "erlang", "multicore", "parallel-processing", "mpi" ]
35
40
10,871
7
0
2008-10-09T00:10:25.713000
2008-11-01T21:13:56.457000
185,445
185,580
FileLoadException on windows 2003 for managed c++ dll
My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll built off this managed c++ project on my XP development...
Have you changed your development environment recently? In particular have you installed a service pack or new release of Visual Studio? It appears you are linking against a C++ runtime that is not available on the client's server. You can use the Windows Event Viewer to identify the DLL failing to load, or if this sho...
FileLoadException on windows 2003 for managed c++ dll My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll b...
TITLE: FileLoadException on windows 2003 for managed c++ dll QUESTION: My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries...
[ "c#", ".net", "c++" ]
0
1
234
2
0
2008-10-09T00:10:34.810000
2008-10-09T01:18:32.707000
185,447
185,532
Should I just move the file or create a class which moves it?
Okay, I got this small program which tags (as in ID3v2.4 etc.) some music files. Now I want the user to have the option to move and/or rename those tagged files if he/she wishes to. Considering that I am trying to keep a fairly clean and loosely coupled design in this system (even though extensibility is not really imp...
Off the top of my head, building on @S.Lott, keep the commands themselves simple and atomic, and create a command queue. The UI add's commands to the queue, and the program executes the commands sequentially. Additionally, you could hang onto (memento's) of executed commands and provide an undo facility.
Should I just move the file or create a class which moves it? Okay, I got this small program which tags (as in ID3v2.4 etc.) some music files. Now I want the user to have the option to move and/or rename those tagged files if he/she wishes to. Considering that I am trying to keep a fairly clean and loosely coupled desi...
TITLE: Should I just move the file or create a class which moves it? QUESTION: Okay, I got this small program which tags (as in ID3v2.4 etc.) some music files. Now I want the user to have the option to move and/or rename those tagged files if he/she wishes to. Considering that I am trying to keep a fairly clean and lo...
[ "c#" ]
1
2
136
2
0
2008-10-09T00:11:48.690000
2008-10-09T00:56:08.197000
185,448
185,460
Would you consider this a singleton/singleton pattern?
Imagine in the Global.asax.cs file I had an instance class as a private field. Let's say like this: private MyClass _myClass = new MyClass(); And I had a static method on Global called GetMyClass() that gets the current HttpApplication and returns that instance. public static MyClass GetMyClass() { return ((Global)Http...
Whether or not this fits the cookie-cutter pattern of a Singleton, it still suffers from the same problems as Singleton: It is a static, concrete reference and cannot be substituted for separate behavior or stubbed/mocked during a test You cannot subclass this and preserve this behavior, so it's quite easy to circumven...
Would you consider this a singleton/singleton pattern? Imagine in the Global.asax.cs file I had an instance class as a private field. Let's say like this: private MyClass _myClass = new MyClass(); And I had a static method on Global called GetMyClass() that gets the current HttpApplication and returns that instance. pu...
TITLE: Would you consider this a singleton/singleton pattern? QUESTION: Imagine in the Global.asax.cs file I had an instance class as a private field. Let's say like this: private MyClass _myClass = new MyClass(); And I had a static method on Global called GetMyClass() that gets the current HttpApplication and returns...
[ "asp.net", "design-patterns" ]
3
4
1,197
6
0
2008-10-09T00:12:02.263000
2008-10-09T00:17:14.217000
185,451
185,473
Quick-and-dirty way to ensure only one instance of a shell script is running at a time
What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time?
Here's an implementation that uses a lockfile and echoes a PID into it. This serves as a protection if the process is killed before removing the pidfile: LOCKFILE=/tmp/lock.txt if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then echo "already running" exit fi # make sure the lockfile is removed when we exit and t...
Quick-and-dirty way to ensure only one instance of a shell script is running at a time What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time?
TITLE: Quick-and-dirty way to ensure only one instance of a shell script is running at a time QUESTION: What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time? ANSWER: Here's an implementation that uses a lockfile and echoes a PID into it. This serves as a protec...
[ "bash", "shell", "process", "lockfile" ]
211
125
142,573
43
0
2008-10-09T00:13:25.910000
2008-10-09T00:24:09.850000
185,474
185,571
C# Retrieving correct DbConnection object by connection string
I have a connection string being passed to a function, and I need to create a DbConnection based object (i.e. SQLConnection, OracleConnection, OLEDbConnection etc) based on this string. Is there any inbuilt functionality to do this, or any 3rd party libraries to assist. We are not necessarily building this connection s...
DbConnection GetConnection(string connStr) { string providerName = null; var csb = new DbConnectionStringBuilder { ConnectionString = connStr }; if (csb.ContainsKey("provider")) { providerName = csb["provider"].ToString(); } else { var css = ConfigurationManager.ConnectionStrings.Cast ().FirstOrDefault(x => x.Connecti...
C# Retrieving correct DbConnection object by connection string I have a connection string being passed to a function, and I need to create a DbConnection based object (i.e. SQLConnection, OracleConnection, OLEDbConnection etc) based on this string. Is there any inbuilt functionality to do this, or any 3rd party librari...
TITLE: C# Retrieving correct DbConnection object by connection string QUESTION: I have a connection string being passed to a function, and I need to create a DbConnection based object (i.e. SQLConnection, OracleConnection, OLEDbConnection etc) based on this string. Is there any inbuilt functionality to do this, or any...
[ ".net", "ado.net", "connection-string", "dbconnection" ]
23
32
38,837
4
0
2008-10-09T00:24:16.030000
2008-10-09T01:13:03.357000
185,477
1,091,872
Determine if swf is in a "debug" player or mode
Is there a way using Flash (CS3+AS3) to determine if the published swf is running in a debug player or in Flash's debug mode? I'm aware that Flex provides the ability to setup different build targets (release/debug) and that you can use something like CONFIG::debug for #ifdef style inclusion of code at compile time. I'...
Check out this class http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/ This class provides two pertinent (and different) pieces of information: Was the SWF built with the -debug switch (has debug symbols compiled in)? Is the Flash player a debug player (ha...
Determine if swf is in a "debug" player or mode Is there a way using Flash (CS3+AS3) to determine if the published swf is running in a debug player or in Flash's debug mode? I'm aware that Flex provides the ability to setup different build targets (release/debug) and that you can use something like CONFIG::debug for #i...
TITLE: Determine if swf is in a "debug" player or mode QUESTION: Is there a way using Flash (CS3+AS3) to determine if the published swf is running in a debug player or in Flash's debug mode? I'm aware that Flex provides the ability to setup different build targets (release/debug) and that you can use something like CO...
[ "flash", "actionscript-3", "debugging" ]
8
20
8,997
1
0
2008-10-09T00:25:47.930000
2009-07-07T11:46:37.357000
185,479
187,192
AIR Caching framework/library
Anyone know of a good memory/disk caching library for AIR? Extra points for being compatible with Flash CS3, and being free (as in beer). I'd like to cache results of http requests: both binary and text (xml).
The bulk-loader project might have what you're looking for. I haven't used it myself but in the description it says (among other things): Cache management Various asset types (XML, NetStreams, Swfs, Images, Sound, Text Files) From quickly looking at the code and some of the examples in the wiki it looks like it has mem...
AIR Caching framework/library Anyone know of a good memory/disk caching library for AIR? Extra points for being compatible with Flash CS3, and being free (as in beer). I'd like to cache results of http requests: both binary and text (xml).
TITLE: AIR Caching framework/library QUESTION: Anyone know of a good memory/disk caching library for AIR? Extra points for being compatible with Flash CS3, and being free (as in beer). I'd like to cache results of http requests: both binary and text (xml). ANSWER: The bulk-loader project might have what you're lookin...
[ "flash", "actionscript-3", "caching", "air" ]
1
3
991
2
0
2008-10-09T00:27:46.163000
2008-10-09T13:13:51.937000
185,483
185,562
Prevent direct access to a PHP page
How do I prevent my users from accessing directly pages meant for ajax calls only? Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source... p/s: Using Apache as webserver. EDIT: To answer why, I have...
As others have said, Ajax request can be emulated be creating the proper headers. If you want to have a basic check to see if the request is an Ajax request you can use: if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { //Request identified as ajax request } However you should never base your security on this...
Prevent direct access to a PHP page How do I prevent my users from accessing directly pages meant for ajax calls only? Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source... p/s: Using Apache as we...
TITLE: Prevent direct access to a PHP page QUESTION: How do I prevent my users from accessing directly pages meant for ajax calls only? Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source... p/s: ...
[ "php", "ajax", "apache" ]
17
24
17,542
10
0
2008-10-09T00:29:47.203000
2008-10-09T01:09:30.883000
185,486
185,739
Which Eclipse Subversion plugin should I use?
Subclipse, Subversive, or something else? There's a bit of debate around the topic, can we come to some conclusion here? EDIT: It's been a couple months now, and I ended up deciding the plugin slowed Eclipse down too much, and was a hassle to use every time I changed a file from outside Eclipse. I ditched the plugin al...
This depends. Subclipse has superior support for checking out projects as maven projects - this is the sole reason we use Subclipse. Other than that, I have noticed subclipse bugs with syncing with SVN. Subversive is much better at detecting new files to add to version control, and is also far superior with merging cod...
Which Eclipse Subversion plugin should I use? Subclipse, Subversive, or something else? There's a bit of debate around the topic, can we come to some conclusion here? EDIT: It's been a couple months now, and I ended up deciding the plugin slowed Eclipse down too much, and was a hassle to use every time I changed a file...
TITLE: Which Eclipse Subversion plugin should I use? QUESTION: Subclipse, Subversive, or something else? There's a bit of debate around the topic, can we come to some conclusion here? EDIT: It's been a couple months now, and I ended up deciding the plugin slowed Eclipse down too much, and was a hassle to use every tim...
[ "eclipse", "svn", "plugins" ]
53
53
44,431
5
0
2008-10-09T00:30:08.530000
2008-10-09T02:41:04.507000
185,487
185,783
Return values from different tables based on a priority
Assuming I have three tables: TableA (key, value) TableB (key, value) TableC (key, value) and I want to return a value for all keys. If the key exists in TableC return that value else if the key exists in B return that value else return the value from table A The best I have come up with so far is SELECT key,Value FROM...
OK, using your concrete example as a basis, I came up with a solution different from the others posted (although I think I like your solution better). This was tested on MS SQL Server 2005 - changes may be needed for your SQL dialect. First, some DDL to set the stage: CREATE TABLE [dbo].[StandardSchedule]( [scheduledat...
Return values from different tables based on a priority Assuming I have three tables: TableA (key, value) TableB (key, value) TableC (key, value) and I want to return a value for all keys. If the key exists in TableC return that value else if the key exists in B return that value else return the value from table A The ...
TITLE: Return values from different tables based on a priority QUESTION: Assuming I have three tables: TableA (key, value) TableB (key, value) TableC (key, value) and I want to return a value for all keys. If the key exists in TableC return that value else if the key exists in B return that value else return the value...
[ "sql" ]
1
3
1,360
7
0
2008-10-09T00:30:30.573000
2008-10-09T03:00:57.570000
185,510
185,529
How can I concatenate regex literals in JavaScript?
Is it possible to do something like this? var pattern = /some regex segment/ + /* comment here */ /another segment/; Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
Here is how to create a regular expression without using the regular expression literal syntax. This lets you do arbitrary string manipulation before it becomes a regular expression object: var segment_part = "some bit of the regexp"; var pattern = new RegExp("some regex segment" + /*comment here */ segment_part + /* t...
How can I concatenate regex literals in JavaScript? Is it possible to do something like this? var pattern = /some regex segment/ + /* comment here */ /another segment/; Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
TITLE: How can I concatenate regex literals in JavaScript? QUESTION: Is it possible to do something like this? var pattern = /some regex segment/ + /* comment here */ /another segment/; Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident...
[ "javascript", "regex", "syntax" ]
194
226
135,306
13
0
2008-10-09T00:43:12.760000
2008-10-09T00:54:14.067000
185,520
185,548
Convert Month Number to Month Name Function in SQL
I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible.
A little hacky but should work: SELECT DATENAME(month, DATEADD(month, @mydate-1, CAST('2008-01-01' AS datetime)))
Convert Month Number to Month Name Function in SQL I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible.
TITLE: Convert Month Number to Month Name Function in SQL QUESTION: I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible. ANSWER: A little hacky but s...
[ "sql", "sql-server", "t-sql", "sql-server-2005" ]
251
176
1,279,520
34
0
2008-10-09T00:50:54.900000
2008-10-09T01:03:33.283000
185,521
185,612
What other objects are accessible inside <%# %> tags in aspx?
I run into similar codes like this all the time in aspx pages: I was wondering what other objects I have access to inside of that <%# %> tag. How come DataBinder.Eval() and Container.DataItem are not visible anywhere inside.CS code?
Within <%# %> tags you have access to Anything that is visible in your code-behind class (including protected methods and properties). Anything declared on the aspx page using <@import @>. Anything passed in as the event arguments when the ItemDataBound event is fired (e.g. RepeaterItemEventArgs, DataListItemEventArgs,...
What other objects are accessible inside <%# %> tags in aspx? I run into similar codes like this all the time in aspx pages: I was wondering what other objects I have access to inside of that <%# %> tag. How come DataBinder.Eval() and Container.DataItem are not visible anywhere inside.CS code?
TITLE: What other objects are accessible inside <%# %> tags in aspx? QUESTION: I run into similar codes like this all the time in aspx pages: I was wondering what other objects I have access to inside of that <%# %> tag. How come DataBinder.Eval() and Container.DataItem are not visible anywhere inside.CS code? ANSWER...
[ "asp.net", "data-binding" ]
4
8
1,183
6
0
2008-10-09T00:51:10.373000
2008-10-09T01:37:54.087000
185,522
196,182
Actionscript3 E4X XML and CSS: Do I really have to use CDATA?
When working with CSS inside of XML such as when parsed in flash, if I don't use CDATA like the following: <span class="IwuvAS3"></span> then the parsed data drops down a line for every "<" character it sees. When parsing the data into a single-line text field, nothing was shown because it was actually down a line. Soo...
Set the TextField's condenseWhite property to true - so only < br/> tags will generate linebreaks.
Actionscript3 E4X XML and CSS: Do I really have to use CDATA? When working with CSS inside of XML such as when parsed in flash, if I don't use CDATA like the following: <span class="IwuvAS3"></span> then the parsed data drops down a line for every "<" character it sees. When parsing the data into a single-line text fie...
TITLE: Actionscript3 E4X XML and CSS: Do I really have to use CDATA? QUESTION: When working with CSS inside of XML such as when parsed in flash, if I don't use CDATA like the following: <span class="IwuvAS3"></span> then the parsed data drops down a line for every "<" character it sees. When parsing the data into a si...
[ "actionscript-3", "e4x", "cdata" ]
0
3
2,918
2
0
2008-10-09T00:51:38.203000
2008-10-12T21:59:54.607000
185,533
185,555
How does the DropBox Mac client work?
I've been looking at the DropBox Mac client and I'm currently researching implementing a similar interface for a different service. How exactly do they interface with finder like this? I highly doubt these objects represented in the folder are actual documents downloaded on every load? They must dynamically download as...
Two suggestions: MacFUSE WebDAV The former will allow you to write an app that appears as a filesystem and does all the right things; the latter will allow you move everything server-side and let the user just mount your service as a file share.
How does the DropBox Mac client work? I've been looking at the DropBox Mac client and I'm currently researching implementing a similar interface for a different service. How exactly do they interface with finder like this? I highly doubt these objects represented in the folder are actual documents downloaded on every l...
TITLE: How does the DropBox Mac client work? QUESTION: I've been looking at the DropBox Mac client and I'm currently researching implementing a similar interface for a different service. How exactly do they interface with finder like this? I highly doubt these objects represented in the folder are actual documents dow...
[ "macos", "filesystems", "integration", "finder", "fsevents" ]
10
6
12,673
6
0
2008-10-09T00:57:30.283000
2008-10-09T01:06:27.707000
185,535
186,870
Largest Heap used in a managed environment? (.net/java)
What is the largest heap you have personally used in a managed environment such as Java or.NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was?
I work on a 64-bit.Net system that typically uses 9-12 GB, and sometimes as much as 20GB. I have not seen any performance problems even while garbage collecting, and I have been looking hard as I was not expecting it to work so well. An earlier version hung on to some objects for too long resulting in occasional GCs th...
Largest Heap used in a managed environment? (.net/java) What is the largest heap you have personally used in a managed environment such as Java or.NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was?
TITLE: Largest Heap used in a managed environment? (.net/java) QUESTION: What is the largest heap you have personally used in a managed environment such as Java or.NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was? ANSWER: I work on a ...
[ "c#", "java", ".net", "memory", "memory-management" ]
2
2
754
5
0
2008-10-09T00:57:45.867000
2008-10-09T11:43:00.747000
185,536
189,915
In openGL, how can you get items to draw back to front?
By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square first then create a slightly smaller black square on top of it thus creating a black pane with a white border. This post had some discussion on it a...
The following call will turn off depth testing causing objects to be drawn in the order created. This will in effect cause objects to draw back to front. glDepthFunc(GL_NEVER); // Ignore depth values (Z) to cause drawing bottom to top Be sure you do not call this: glEnable (GL_DEPTH_TEST); // Enables Depth Testing
In openGL, how can you get items to draw back to front? By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square first then create a slightly smaller black square on top of it thus creating a black pane wi...
TITLE: In openGL, how can you get items to draw back to front? QUESTION: By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square first then create a slightly smaller black square on top of it thus creati...
[ "opengl", "z-order" ]
15
27
36,230
6
0
2008-10-09T00:57:58.393000
2008-10-10T02:28:34.640000
185,559
185,716
Remove domain information from login id in C#
I would like to remove the domain/computer information from a login id in C#. So, I would like to make either "Domain\me" or "Domain\me" just "me". I could always check for the existence of either, and use that as the index to start the substring...but I am looking for something more elegant and compact. Worse case sce...
when all you have is a hammer, everything looks like a nail..... use a razor blade ---- using System; using System.Text.RegularExpressions; public class MyClass { public static void Main() { string domainUser = Regex.Replace("domain\\user",".*\\\\(.*)", "$1",RegexOptions.None); Console.WriteLine(domainUser); } }
Remove domain information from login id in C# I would like to remove the domain/computer information from a login id in C#. So, I would like to make either "Domain\me" or "Domain\me" just "me". I could always check for the existence of either, and use that as the index to start the substring...but I am looking for some...
TITLE: Remove domain information from login id in C# QUESTION: I would like to remove the domain/computer information from a login id in C#. So, I would like to make either "Domain\me" or "Domain\me" just "me". I could always check for the existence of either, and use that as the index to start the substring...but I a...
[ "c#", "string", "indexof" ]
23
43
25,211
9
0
2008-10-09T01:08:15.910000
2008-10-09T02:29:56.477000
185,573
185,632
What is mattr_accessor in a Rails module?
I couldn't really find this in Rails documentation but it seems like 'mattr_accessor' is the Module corollary for 'attr_accessor' (getter & setter) in a normal Ruby class. Eg. in a class class User attr_accessor:name def set_fullname @name = "#{self.first_name} #{self.last_name}" end end Eg. in a module module Authent...
Rails extends Ruby with both mattr_accessor (Module accessor) and cattr_accessor (as well as _ reader / _writer versions). As Ruby's attr_accessor generates getter/setter methods for instances, cattr/mattr_accessor provide getter/setter methods at the class or module level. Thus: module Config mattr_accessor:hostname m...
What is mattr_accessor in a Rails module? I couldn't really find this in Rails documentation but it seems like 'mattr_accessor' is the Module corollary for 'attr_accessor' (getter & setter) in a normal Ruby class. Eg. in a class class User attr_accessor:name def set_fullname @name = "#{self.first_name} #{self.last_nam...
TITLE: What is mattr_accessor in a Rails module? QUESTION: I couldn't really find this in Rails documentation but it seems like 'mattr_accessor' is the Module corollary for 'attr_accessor' (getter & setter) in a normal Ruby class. Eg. in a class class User attr_accessor:name def set_fullname @name = "#{self.first_nam...
[ "ruby-on-rails", "ruby", "class", "module", "activesupport" ]
120
197
39,994
2
0
2008-10-09T01:15:15.193000
2008-10-09T01:49:21.817000
185,584
201,052
Dynamic (?) parser
Does there exist a parser that generates an AST/parse tree at runtime? Kind of like a library that would accept a string of EBNF grammar or something analogous and spit out a data structure? I'm aware of antlr, jlex and their ilk. They generate source code which could do this. (like to skip the compile step) I'm aware ...
Take a look at parser combinators which i think may help you. It is possible to make parsers at runtime using this technique. One popular parser combinator is Parsec which uses Haskell as its host language. From the parsec documentation: Combinator parsers are written and used within the same programming language as th...
Dynamic (?) parser Does there exist a parser that generates an AST/parse tree at runtime? Kind of like a library that would accept a string of EBNF grammar or something analogous and spit out a data structure? I'm aware of antlr, jlex and their ilk. They generate source code which could do this. (like to skip the compi...
TITLE: Dynamic (?) parser QUESTION: Does there exist a parser that generates an AST/parse tree at runtime? Kind of like a library that would accept a string of EBNF grammar or something analogous and spit out a data structure? I'm aware of antlr, jlex and their ilk. They generate source code which could do this. (like...
[ "parsing", "compiler-construction", "interpreter", "lex" ]
7
5
4,634
6
0
2008-10-09T01:21:10.330000
2008-10-14T12:58:52.263000
185,606
185,625
Insert array into database in a single row
I wonder if this would be doable? To insert an array into one field in the database. For instance I have a title, I want to have that title with only one id, but it's going to be bilingually used on the website. It feels a bit unnecessary to make another table to have their global ids and then another table with the ac...
it's doable: $title = serialize($array); and then to decode: $title = unserialize($mysql_data); but as mentioned it really lessens the benefits of a database in the first place. i'd definitely suggest looking into a multi-table or multi-column option instead, depending on the amount of languages you want to support and...
Insert array into database in a single row I wonder if this would be doable? To insert an array into one field in the database. For instance I have a title, I want to have that title with only one id, but it's going to be bilingually used on the website. It feels a bit unnecessary to make another table to have their gl...
TITLE: Insert array into database in a single row QUESTION: I wonder if this would be doable? To insert an array into one field in the database. For instance I have a title, I want to have that title with only one id, but it's going to be bilingually used on the website. It feels a bit unnecessary to make another tabl...
[ "php", "mysql", "database", "arrays", "internationalization" ]
8
15
12,655
5
0
2008-10-09T01:32:31.600000
2008-10-09T01:43:59.567000
185,609
185,731
page Preinit, Init, load
I am having a doubt in page_init, page preinit, load. I need to know when we use this also where we need to call our objects in different stages of our life cycle. Please let me know how they will process for each events raised
Page events happen first before user control events. So the pages PageInit event fires, then the all user controls PageInit events fire. The pages PageLoad event fires, then all user controls PageLoad events fire. etc... Sometimes developers will put initialization of private objects in their user controls PageLoad han...
page Preinit, Init, load I am having a doubt in page_init, page preinit, load. I need to know when we use this also where we need to call our objects in different stages of our life cycle. Please let me know how they will process for each events raised
TITLE: page Preinit, Init, load QUESTION: I am having a doubt in page_init, page preinit, load. I need to know when we use this also where we need to call our objects in different stages of our life cycle. Please let me know how they will process for each events raised ANSWER: Page events happen first before user con...
[ "asp.net" ]
3
4
12,992
3
0
2008-10-09T01:35:01.940000
2008-10-09T02:36:10.973000