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
114,154
114,175
How does a XAML definition get turned into an object instance?
XAML allows you to specify an attribute value using a string that contains curly braces. Here is an example that creates a Binding instance and assigns it to the Text property of the TextBox element. I want to extend XAML so that the developer could enter this as valid... This would create an instance of my class and s...
take a look at markupextensions http://blogs.msdn.com/wpfsdk/archive/2007/03/22/blogpost-text-creatingasimplecustommarkupextension.aspx
How does a XAML definition get turned into an object instance? XAML allows you to specify an attribute value using a string that contains curly braces. Here is an example that creates a Binding instance and assigns it to the Text property of the TextBox element. I want to extend XAML so that the developer could enter t...
TITLE: How does a XAML definition get turned into an object instance? QUESTION: XAML allows you to specify an attribute value using a string that contains curly braces. Here is an example that creates a Binding instance and assigns it to the Text property of the TextBox element. I want to extend XAML so that the devel...
[ "wpf", "xaml" ]
4
1
1,598
2
0
2008-09-22T10:29:04.317000
2008-09-22T10:36:49.573000
114,163
114,171
Does CASCADE Delete execute as transaction?
I want to perform cascade delete for some tables in my database, but I'm interested in what happens in case there's a failure when deleting something. Will everything rollback?
In general¹, yes, cascade deletes are done in the same transaction (or subtransaction) as your original delete. You should read the documentation of your SQL server, though. ¹ The exception is if you're using a database that doesn't support transactions, like MySQL with MyISAM tables.
Does CASCADE Delete execute as transaction? I want to perform cascade delete for some tables in my database, but I'm interested in what happens in case there's a failure when deleting something. Will everything rollback?
TITLE: Does CASCADE Delete execute as transaction? QUESTION: I want to perform cascade delete for some tables in my database, but I'm interested in what happens in case there's a failure when deleting something. Will everything rollback? ANSWER: In general¹, yes, cascade deletes are done in the same transaction (or s...
[ "sql", "cascade" ]
13
15
4,990
3
0
2008-09-22T10:33:11.517000
2008-09-22T10:35:59.497000
114,165
3,575,801
How to implement WiX installer upgrade?
At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine. I've read on several places on the Internet about a major upgrade but couldn't get it to work. Can anyone please specify the exact steps that I...
In the newest versions (from the 3.5.1315.0 beta), you can use the MajorUpgrade element instead of using your own. For example, we use this code to do automatic upgrades. It prevents downgrades, giving a localised error message, and also prevents upgrading an already existing identical version (i.e. only lower versions...
How to implement WiX installer upgrade? At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine. I've read on several places on the Internet about a major upgrade but couldn't get it to work. Can anyo...
TITLE: How to implement WiX installer upgrade? QUESTION: At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine. I've read on several places on the Internet about a major upgrade but couldn't get it...
[ "installation", "wix", "windows-installer" ]
250
218
139,142
12
0
2008-09-22T10:34:12.450000
2010-08-26T13:57:27.633000
114,172
114,235
Wrap an executable to diagnose it's invocations
I have a Windows executable (whoami) which is crashing every so often. It's called from another process to get details about the current user and domain. I'd like to know what parameters are passed when it fails. Does anyone know of an appropriate way to wrap the process and write it's command line arguments to log whi...
From a batch file: echo Parameters: %* >> logfile.txt whoami.exe %* With the caveat that you can have problems if the parameters contain spaces (and you passed the in escaping with "), because the command-line parser basically de-escapes them and they should be re-escaped before passed to an other executable.
Wrap an executable to diagnose it's invocations I have a Windows executable (whoami) which is crashing every so often. It's called from another process to get details about the current user and domain. I'd like to know what parameters are passed when it fails. Does anyone know of an appropriate way to wrap the process ...
TITLE: Wrap an executable to diagnose it's invocations QUESTION: I have a Windows executable (whoami) which is crashing every so often. It's called from another process to get details about the current user and domain. I'd like to know what parameters are passed when it fails. Does anyone know of an appropriate way to...
[ "windows", "scripting" ]
2
1
437
6
0
2008-09-22T10:36:19.447000
2008-09-22T10:57:10.693000
114,179
114,206
Updating reference to a member variable in use
I got this síngleton cache object and it exposes an IEnumerable property which just returns a private IEnumerable variable. I have a static method on my singleton object that updates this member variable (that exists on the single 'Instance' instance of this cache object). Let's say some thread is currently iterating o...
The thread which is currently enumerating sektioner will continue to enumerate it even when you update the reference within the singleton. There is nothing special about objects which implement IEnumerable. You should perhaps add the volatile keyword to the sektioner field as you are not providing read-locking and mult...
Updating reference to a member variable in use I got this síngleton cache object and it exposes an IEnumerable property which just returns a private IEnumerable variable. I have a static method on my singleton object that updates this member variable (that exists on the single 'Instance' instance of this cache object)....
TITLE: Updating reference to a member variable in use QUESTION: I got this síngleton cache object and it exposes an IEnumerable property which just returns a private IEnumerable variable. I have a static method on my singleton object that updates this member variable (that exists on the single 'Instance' instance of t...
[ "c#", ".net", "singleton" ]
0
1
409
4
0
2008-09-22T10:37:44.297000
2008-09-22T10:47:14.867000
114,180
114,189
Should I use a pointer or a reference to remotely assign a variable?
What would be better practice when giving a function the original variable to work with: unsigned long x = 4; void func1(unsigned long& val) { val = 5; } func1(x); or: void func2(unsigned long* val) { *val = 5; } func2(&x); IOW: Is there any reason to pick one over another?
My rule of thumb is: Use pointers if you want to do pointer arithmetic with them (e.g. incrementing the pointer address to step through an array) or if you ever have to pass a NULL-pointer. Use references otherwise.
Should I use a pointer or a reference to remotely assign a variable? What would be better practice when giving a function the original variable to work with: unsigned long x = 4; void func1(unsigned long& val) { val = 5; } func1(x); or: void func2(unsigned long* val) { *val = 5; } func2(&x); IOW: Is there any reason t...
TITLE: Should I use a pointer or a reference to remotely assign a variable? QUESTION: What would be better practice when giving a function the original variable to work with: unsigned long x = 4; void func1(unsigned long& val) { val = 5; } func1(x); or: void func2(unsigned long* val) { *val = 5; } func2(&x); IOW: Is ...
[ "c++", "variables", "pointers", "reference" ]
278
306
128,943
12
0
2008-09-22T10:38:32.110000
2008-09-22T10:40:15.977000
114,192
114,896
How do I handle data which must be persisted in a database, but isn't a proper model, in Ruby on Rails?
Imagine a web application written in Ruby on Rails. Part of the state of that application is represented in a piece of data which doesn't fit the description of a model. This state descriptor needs to be persisted in the same database as the models. Where it differs from a model is that there needs to be only one insta...
From your description I think the rails-settings plugin should do what you need. From the Readme: "Settings is a plugin that makes managing a table of global key, value pairs easy. Think of it like a global Hash stored in you database, that uses simple ActiveRecord like methods for manipulation. Keep track of any globa...
How do I handle data which must be persisted in a database, but isn't a proper model, in Ruby on Rails? Imagine a web application written in Ruby on Rails. Part of the state of that application is represented in a piece of data which doesn't fit the description of a model. This state descriptor needs to be persisted in...
TITLE: How do I handle data which must be persisted in a database, but isn't a proper model, in Ruby on Rails? QUESTION: Imagine a web application written in Ruby on Rails. Part of the state of that application is represented in a piece of data which doesn't fit the description of a model. This state descriptor needs ...
[ "ruby-on-rails", "ruby", "persistence" ]
5
3
660
5
0
2008-09-22T10:41:34.443000
2008-09-22T13:35:01.733000
114,194
114,252
Where to Store writable data to be shared by all users in a vista installer?
My app is installed via NSIS. I want the installer to install the program for all users. I can do this, by installing to the 'program files' directory. There is a database file (firebird), that all user accounts on the system should share. If I store this database file in the 'program files' directory it will be read o...
Data for all users should be stored in %ALLUSERSPROFILE%, or call SHGetFolderPath() with the parameter CSIDL_COMMON_APPDATA to get the all users storage area. See http://www.deez.info/sengelha/2006/02/28/windows-vista-changes/ for more details.
Where to Store writable data to be shared by all users in a vista installer? My app is installed via NSIS. I want the installer to install the program for all users. I can do this, by installing to the 'program files' directory. There is a database file (firebird), that all user accounts on the system should share. If ...
TITLE: Where to Store writable data to be shared by all users in a vista installer? QUESTION: My app is installed via NSIS. I want the installer to install the program for all users. I can do this, by installing to the 'program files' directory. There is a database file (firebird), that all user accounts on the system...
[ "windows-vista", "installation", "nsis", "acl" ]
4
4
2,878
4
0
2008-09-22T10:42:26.080000
2008-09-22T11:02:06.530000
114,196
119,526
How do you URL encode parameters in Erlang?
I'm using httpc:request to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service. Is there a function in Erlang that is similar to CGI.escape in Ruby for this purpos...
You can find here the YAWS url_encode and url_decode routines They are fairly straightforward, although comments indicate the encode is not 100% complete for all punctuation characters.
How do you URL encode parameters in Erlang? I'm using httpc:request to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service. Is there a function in Erlang that is s...
TITLE: How do you URL encode parameters in Erlang? QUESTION: I'm using httpc:request to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service. Is there a function i...
[ "http", "url", "encoding", "erlang" ]
20
9
14,988
8
0
2008-09-22T10:44:07.900000
2008-09-23T07:17:03.833000
114,204
1,111,598
How do I read/write as the authenticated user with Apache/WebDAV?
I've set up DAV in apache2, which works great. The thing is, all read/write operations are done with the apache user's credentials. Instead I want to use the HTTP authenticated user's credentials. If I authenticate as "john", all read and write operations should use the system user john's credentials (from /etc/passwd)...
We have been using davenport ( http://davenport.sourceforge.net/ ) for years to provide access to Windows/samba shares over webdav. Samba/Windows gives a lot of control over this sort of thing, and the Davenport just makes it usable over the web over SSL without a VPN
How do I read/write as the authenticated user with Apache/WebDAV? I've set up DAV in apache2, which works great. The thing is, all read/write operations are done with the apache user's credentials. Instead I want to use the HTTP authenticated user's credentials. If I authenticate as "john", all read and write operation...
TITLE: How do I read/write as the authenticated user with Apache/WebDAV? QUESTION: I've set up DAV in apache2, which works great. The thing is, all read/write operations are done with the apache user's credentials. Instead I want to use the HTTP authenticated user's credentials. If I authenticate as "john", all read a...
[ "apache", "authentication", "webdav" ]
0
1
6,300
2
0
2008-09-22T10:45:50.673000
2009-07-10T19:45:02.200000
114,207
114,231
reinitialize system wide environment variable in linux
I just want my apache to register some of my predefined environment so that i can retrieve it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO=/bar/baz using root and restarted apache.
Environment variables are inherited by processes in Unix. The files in /etc/profile.d are only executed (in the current shell, not in a subshell) when you log in. Just changing the value there and then restarting a process will not update the environment. Possible Fixes: log out/log in, then start apache source the fil...
reinitialize system wide environment variable in linux I just want my apache to register some of my predefined environment so that i can retrieve it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO=/bar/baz using root and restarted apache.
TITLE: reinitialize system wide environment variable in linux QUESTION: I just want my apache to register some of my predefined environment so that i can retrieve it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO=/bar/baz using root and restarted apache. ANSWER: ...
[ "php", "linux", "variables", "environment" ]
5
6
3,843
4
0
2008-09-22T10:47:41.963000
2008-09-22T10:56:23.863000
114,208
114,215
How to list some specific images in some folder on web server?
Let me explain: this is path to this folder: > www.my_site.com/images And images are created by user_id, and for example, images of user_id = 27 are, 27_1.jpg, 27_2.jpg, 27_3.jpg! How to list and print images which start with 27_%.jpg? I hope You have understood me! PS. I am totally beginmer in ASP.NET (VB) and please ...
The best way is to just loop through all the files in the directory. While dbRead.Read dim sUserId as String= dbread('user_id') For Each sFile As String In IO.Directory.GetFiles("C:\") if sFile.StartsWith (sUserId) Then 'Do something. End If Next Loop However, to actually show the images, you're best bet could be to cr...
How to list some specific images in some folder on web server? Let me explain: this is path to this folder: > www.my_site.com/images And images are created by user_id, and for example, images of user_id = 27 are, 27_1.jpg, 27_2.jpg, 27_3.jpg! How to list and print images which start with 27_%.jpg? I hope You have under...
TITLE: How to list some specific images in some folder on web server? QUESTION: Let me explain: this is path to this folder: > www.my_site.com/images And images are created by user_id, and for example, images of user_id = 27 are, 27_1.jpg, 27_2.jpg, 27_3.jpg! How to list and print images which start with 27_%.jpg? I h...
[ "asp.net", "vb.net" ]
0
1
1,261
2
0
2008-09-22T10:47:49.780000
2008-09-22T10:50:32.800000
114,211
114,221
Boost shared_ptr container question
Let's say I have a container (std::vector) of pointers used by a multi-threaded application. When adding new pointers to the container, the code is protected using a critical section (boost::mutex). All well and good. The code should be able to return one of these pointers to a thread for processing, but another separa...
For the threading safety of boost::shared_ptr you should check this link. It's not guarantied to be safe, but on many platforms it works. Modifying the std::vector is not safe AFAIK.
Boost shared_ptr container question Let's say I have a container (std::vector) of pointers used by a multi-threaded application. When adding new pointers to the container, the code is protected using a critical section (boost::mutex). All well and good. The code should be able to return one of these pointers to a threa...
TITLE: Boost shared_ptr container question QUESTION: Let's say I have a container (std::vector) of pointers used by a multi-threaded application. When adding new pointers to the container, the code is protected using a critical section (boost::mutex). All well and good. The code should be able to return one of these p...
[ "c++", "boost", "smart-pointers" ]
0
3
4,185
3
0
2008-09-22T10:48:59.310000
2008-09-22T10:53:10.780000
114,212
114,753
Thoughts on Design - Core Control Logic and Rendering Layers
I just wanted to see if I could have your thoughts on the design of some work I am currently doing. Here's the current situation - Basically: I am developing a series of controls for our applications. Some of these may be used in both WinForms and ASP.NET Web applications. I am on a constant endeavor to improve my test...
From your description it's a bit like how I do MVP but with the events going the other way. I usually have a very thin view that hides behind an interface and that knows nothing about the presenter. The view is the one who throws events on user actions. Usually all the view does is translate UI specific to primitives o...
Thoughts on Design - Core Control Logic and Rendering Layers I just wanted to see if I could have your thoughts on the design of some work I am currently doing. Here's the current situation - Basically: I am developing a series of controls for our applications. Some of these may be used in both WinForms and ASP.NET Web...
TITLE: Thoughts on Design - Core Control Logic and Rendering Layers QUESTION: I just wanted to see if I could have your thoughts on the design of some work I am currently doing. Here's the current situation - Basically: I am developing a series of controls for our applications. Some of these may be used in both WinFor...
[ "design-patterns", "architecture" ]
1
2
337
1
0
2008-09-22T10:49:10.417000
2008-09-22T13:08:24.357000
114,214
114,267
Class method differences in Python: bound, unbound and static
What is the difference between the following class methods? Is it that one is static and the other is not? class Test(object): def method_one(self): print "Called method_one" def method_two(): print "Called method_two" a_test = Test() a_test.method_one() a_test.method_two()
In Python, there is a distinction between bound and unbound methods. Basically, a call to a member function (like method_one ), a bound function a_test.method_one() is translated to Test.method_one(a_test) i.e. a call to an unbound method. Because of that, a call to your version of method_two will fail with a TypeError...
Class method differences in Python: bound, unbound and static What is the difference between the following class methods? Is it that one is static and the other is not? class Test(object): def method_one(self): print "Called method_one" def method_two(): print "Called method_two" a_test = Test() a_test.method_one() a...
TITLE: Class method differences in Python: bound, unbound and static QUESTION: What is the difference between the following class methods? Is it that one is static and the other is not? class Test(object): def method_one(self): print "Called method_one" def method_two(): print "Called method_two" a_test = Test() a_t...
[ "python", "static-methods" ]
256
437
162,983
13
0
2008-09-22T10:49:43.190000
2008-09-22T11:05:54.620000
114,229
114,240
PHP: array_map on object?
I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes. How can I achieve something similar to array_map or array_walk with objects?
use get_object_vars() to get an associative array of the members, and use the functions you mentioned. btw, you can also do a foreach on an object like you would on an array, which is sometimes useful as well.
PHP: array_map on object? I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes. How can I achieve something similar to array_map or array_walk with objects?
TITLE: PHP: array_map on object? QUESTION: I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes. How can I achieve something similar to array_map or array_walk wit...
[ "php", "oop" ]
9
13
41,155
3
0
2008-09-22T10:56:07.670000
2008-09-22T10:57:57.430000
114,236
114,385
Solaris Core dump analysis
I use pstack to analyze core dump files in Solaris How else can I analyze the core dump from solaris? What commands can be used to do this? What other information will be available from the dump?
You can use Solaris modular debugger,mdb, or dbx. mdb comes with SUNWmdb (or SUNWmdb x for the 64 bits version) package. A core file is the image of your running process at the time it crashed. Depending on whether your application was compiled with debug flags or not,you will be able to view an image of the stack, hen...
Solaris Core dump analysis I use pstack to analyze core dump files in Solaris How else can I analyze the core dump from solaris? What commands can be used to do this? What other information will be available from the dump?
TITLE: Solaris Core dump analysis QUESTION: I use pstack to analyze core dump files in Solaris How else can I analyze the core dump from solaris? What commands can be used to do this? What other information will be available from the dump? ANSWER: You can use Solaris modular debugger,mdb, or dbx. mdb comes with SUNWm...
[ "gdb", "solaris", "coredump", "dbx" ]
20
18
56,559
8
0
2008-09-22T10:57:11.737000
2008-09-22T11:44:40.983000
114,237
114,263
Considering object encapsulation, should getters return an immutable property?
When a getter returns a property, such as returning a List of other related objects, should that list and it's objects be immutable to prevent code outside of the class, changing the state of those objects, without the main parent object knowing? For example if a Contact object, has a getDetails getter, which returns a...
It's a matter of whether you should be "defensive" in your code. If you're the (sole) user of your class and you trust yourself then by all means no need for immutability. However, if this code needs to work no matter what, or you don't trust your user, then make everything that is externalized immutable. That said, mo...
Considering object encapsulation, should getters return an immutable property? When a getter returns a property, such as returning a List of other related objects, should that list and it's objects be immutable to prevent code outside of the class, changing the state of those objects, without the main parent object kno...
TITLE: Considering object encapsulation, should getters return an immutable property? QUESTION: When a getter returns a property, such as returning a List of other related objects, should that list and it's objects be immutable to prevent code outside of the class, changing the state of those objects, without the main...
[ "java", "oop" ]
19
6
4,044
11
0
2008-09-22T10:57:30.053000
2008-09-22T11:04:55.353000
114,238
114,264
Difference between managed C++ and C++
The second question is: When do I use what of these two?
When not specified, C++ is unmanaged C++, compiled to machine code. In unmanaged C++ you must manage memory allocation manually. Managed C++ is a language invented by Microsoft, that compiles to bytecode run by the.NET Framework. It uses mostly the same syntax as C++ (hence the name) but is compiled in the same way as ...
Difference between managed C++ and C++ The second question is: When do I use what of these two?
TITLE: Difference between managed C++ and C++ QUESTION: The second question is: When do I use what of these two? ANSWER: When not specified, C++ is unmanaged C++, compiled to machine code. In unmanaged C++ you must manage memory allocation manually. Managed C++ is a language invented by Microsoft, that compiles to by...
[ "c++", "visual-c++", "programming-languages", "managed-c++" ]
54
76
61,062
5
0
2008-09-22T10:57:33.140000
2008-09-22T11:05:01.593000
114,242
114,265
SQL: inner join on alias column
Previously I have asked to strip text from a field and convert it to an int, this works successfully. But now, I would like to do an INNER JOIN on this new value. So I have this: SELECT CONVERT(int, SUBSTRING(accountingTab.id, PATINDEX('%[0-9]%', accountingTab.id), 999)) AS 'memId', userDetails.title, userDetails.lname...
If you have to do this, you have design problems. If you're able, I would suggest you need to refactor your table or relationships.
SQL: inner join on alias column Previously I have asked to strip text from a field and convert it to an int, this works successfully. But now, I would like to do an INNER JOIN on this new value. So I have this: SELECT CONVERT(int, SUBSTRING(accountingTab.id, PATINDEX('%[0-9]%', accountingTab.id), 999)) AS 'memId', user...
TITLE: SQL: inner join on alias column QUESTION: Previously I have asked to strip text from a field and convert it to an int, this works successfully. But now, I would like to do an INNER JOIN on this new value. So I have this: SELECT CONVERT(int, SUBSTRING(accountingTab.id, PATINDEX('%[0-9]%', accountingTab.id), 999)...
[ "sql", "inner-join" ]
4
0
14,597
3
0
2008-09-22T10:58:22.983000
2008-09-22T11:05:48.800000
114,260
114,299
How can I share a variable value between classic asp, .NET and javascript?
I've created an IHttpHandler in.NET C# which returns pieces of html to a classic asp page. The classic asp page communicates with the IHttpHandler through basic http requests using ServerXMLHTTP in vbscript or Ajax Calls in JavaScript. Now, I need a way to share a variable which I have in vbscript but not in javascript...
How about having a hidden variable on the page in which you can store the value of the variable from your server side vb script of your asp pages. Then you can use Javascript to query this variable to send across to the Asp.Net handler through your ajax calls.
How can I share a variable value between classic asp, .NET and javascript? I've created an IHttpHandler in.NET C# which returns pieces of html to a classic asp page. The classic asp page communicates with the IHttpHandler through basic http requests using ServerXMLHTTP in vbscript or Ajax Calls in JavaScript. Now, I ne...
TITLE: How can I share a variable value between classic asp, .NET and javascript? QUESTION: I've created an IHttpHandler in.NET C# which returns pieces of html to a classic asp page. The classic asp page communicates with the IHttpHandler through basic http requests using ServerXMLHTTP in vbscript or Ajax Calls in Jav...
[ "asp.net", "session", "asp-classic", "httphandler" ]
0
0
2,214
4
0
2008-09-22T11:04:32.673000
2008-09-22T11:16:52.160000
114,266
114,292
Http Exception generated while validating viewstate
I am getting the following error whenever I click on a postbacking control HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster...
There is an article about this here: http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx. The basic problem is that Your page hasn't completed loading before You perform the postback. A few different solutions are in the article listed above: 1. Set enableEventValidation to false ...
Http Exception generated while validating viewstate I am getting the following error whenever I click on a postbacking control HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation...
TITLE: Http Exception generated while validating viewstate QUESTION: I am getting the following error whenever I click on a postbacking control HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validation...
[ "asp.net" ]
1
3
379
2
0
2008-09-22T11:05:53.167000
2008-09-22T11:13:29.750000
114,272
114,309
Are there any utilites that will help me refactor CSS
I am working with some CSS that is poorly written to say the least. I am not a design/CSS expert, but I at least understand the C in CSS. While the builtin CSS support inside of VS-2008 is far improved over previous versions, it still doesn't quite do what I am looking for. I was wondering if anyone know of a good prog...
The Dust-Me Selectors Firefox extension can scan a website and tell you what CSS is used and what is not. Removing unused CSS is one good first step in refactoring. I have often found that when some section is removed from a website, the HTML is removed but the CSS is not.
Are there any utilites that will help me refactor CSS I am working with some CSS that is poorly written to say the least. I am not a design/CSS expert, but I at least understand the C in CSS. While the builtin CSS support inside of VS-2008 is far improved over previous versions, it still doesn't quite do what I am look...
TITLE: Are there any utilites that will help me refactor CSS QUESTION: I am working with some CSS that is poorly written to say the least. I am not a design/CSS expert, but I at least understand the C in CSS. While the builtin CSS support inside of VS-2008 is far improved over previous versions, it still doesn't quite...
[ "asp.net", "css", "refactoring" ]
23
21
3,729
13
0
2008-09-22T11:07:05.677000
2008-09-22T11:19:17.100000
114,284
115,320
Optimize SQL query on large-ish table
First of all, this question regards MySQL 3.23.58, so be advised. I have 2 tables with the following definition: Table A: id INT (primary), customer_id INT, offlineid INT Table B: id INT (primary), name VARCHAR(255) Now, table A contains in the range of 65k+ records, while table B contains ~40 records. In addition to ...
You could try making sure there are covering indexes defined on each table. A covering index is just an index where each column requested in the select or used in a join is included in the index. This way, the engine only has to read the index entry and doesn't have to also do the corresponding row lookup to get any re...
Optimize SQL query on large-ish table First of all, this question regards MySQL 3.23.58, so be advised. I have 2 tables with the following definition: Table A: id INT (primary), customer_id INT, offlineid INT Table B: id INT (primary), name VARCHAR(255) Now, table A contains in the range of 65k+ records, while table B...
TITLE: Optimize SQL query on large-ish table QUESTION: First of all, this question regards MySQL 3.23.58, so be advised. I have 2 tables with the following definition: Table A: id INT (primary), customer_id INT, offlineid INT Table B: id INT (primary), name VARCHAR(255) Now, table A contains in the range of 65k+ reco...
[ "mysql", "sql", "optimization" ]
3
0
2,702
9
0
2008-09-22T11:11:49.270000
2008-09-22T14:59:36.040000
114,288
114,568
What unit-test frameworks would you recommend for J2ME?
I'm relatively new to J2ME and about to begin my first serious project. My experience in testing isn't too deep either. I'm looking for a unit test framework for J2ME. So far I've seen J2MEUnit, but I don't now how well supported it is. I've seen JavaTest Harness but I don't know if it's not an overkill. Please tell me...
This is a blog entry of a spanish company who makes movile games. Compares many frameworks and the conclusion is (translated): MoMEUnit Offer very useful information about the tests. Is easily ported and Ant compabile. A disadvantage (or maybe not), its that it needs that every test class have an unique test method, us...
What unit-test frameworks would you recommend for J2ME? I'm relatively new to J2ME and about to begin my first serious project. My experience in testing isn't too deep either. I'm looking for a unit test framework for J2ME. So far I've seen J2MEUnit, but I don't now how well supported it is. I've seen JavaTest Harness ...
TITLE: What unit-test frameworks would you recommend for J2ME? QUESTION: I'm relatively new to J2ME and about to begin my first serious project. My experience in testing isn't too deep either. I'm looking for a unit test framework for J2ME. So far I've seen J2MEUnit, but I don't now how well supported it is. I've seen...
[ "unit-testing", "testing", "java-me" ]
2
5
1,400
5
0
2008-09-22T11:12:22.763000
2008-09-22T12:31:40.933000
114,296
114,310
Can i use my WatiN tests to stresstest?
In my current project we are testing our ASP.NET GUI using WatiN and Mbunit. When I was writing the tests I realized that it would be great if we also could use all of these for stresstesting. Currently we are using Grinder to stresstest but then we have to script our cases all over again which for many reasons isent t...
We have issues on our build server when running WatiN tests as it often throws timeouts trying to access the Internet Explorer COM component. It seems to hang randomly while waiting for the total page to load. Given this, I would not recommend it for stress testing as the results will be inaccurate and the tests are li...
Can i use my WatiN tests to stresstest? In my current project we are testing our ASP.NET GUI using WatiN and Mbunit. When I was writing the tests I realized that it would be great if we also could use all of these for stresstesting. Currently we are using Grinder to stresstest but then we have to script our cases all o...
TITLE: Can i use my WatiN tests to stresstest? QUESTION: In my current project we are testing our ASP.NET GUI using WatiN and Mbunit. When I was writing the tests I realized that it would be great if we also could use all of these for stresstesting. Currently we are using Grinder to stresstest but then we have to scri...
[ "testing", "watin", "mbunit", "stress-testing" ]
2
3
2,059
4
0
2008-09-22T11:15:56.887000
2008-09-22T11:20:27.703000
114,305
114,319
Monitor running .net apps
I have some.net apps running that I need to monitor for example, then MethodA is called in App1, my monitor app should detect this. I have a lot of running apps and the solution proposed here is to recompile all those apps and include a new line in the desired methods that we want to monitor. I want to do this only if ...
There are several ways you could do this. One is to use log4Net, 'sprinkle' your methods with calls to log4Net's write methods. You can choose a variety of logging appenders (destinations) such as email or a database, but a less known tip is to download the standalone program, DebugView (SysInternals -> now Microsoft) ...
Monitor running .net apps I have some.net apps running that I need to monitor for example, then MethodA is called in App1, my monitor app should detect this. I have a lot of running apps and the solution proposed here is to recompile all those apps and include a new line in the desired methods that we want to monitor. ...
TITLE: Monitor running .net apps QUESTION: I have some.net apps running that I need to monitor for example, then MethodA is called in App1, my monitor app should detect this. I have a lot of running apps and the solution proposed here is to recompile all those apps and include a new line in the desired methods that we...
[ ".net", "monitoring" ]
2
3
358
5
0
2008-09-22T11:18:46.833000
2008-09-22T11:24:52.903000
114,306
114,312
How to quickly add tickets in Trac?
It's very painful to add multiple tickets to Trac or to have it as your own todo list. That causes people to use their own task management tools so tasks are then spread all around. Is there any plugin or macro that would quicken the process of adding a ticket?
If you're using Eclipse: Mylyn is perfect. Otherwise you could always get the XML RPC plugin. http://trac-hacks.org/wiki/XmlRpcPlugin and roll your own little tool. For quickly creating similar tickets, you could use the Clone plugin: http://trac-hacks.org/wiki/CloneTicketPlugin Edit And I second Espen's idea with the ...
How to quickly add tickets in Trac? It's very painful to add multiple tickets to Trac or to have it as your own todo list. That causes people to use their own task management tools so tasks are then spread all around. Is there any plugin or macro that would quicken the process of adding a ticket?
TITLE: How to quickly add tickets in Trac? QUESTION: It's very painful to add multiple tickets to Trac or to have it as your own todo list. That causes people to use their own task management tools so tasks are then spread all around. Is there any plugin or macro that would quicken the process of adding a ticket? ANS...
[ "plugins", "trac", "bug-tracking" ]
9
7
7,011
6
0
2008-09-22T11:18:54.387000
2008-09-22T11:21:49.200000
114,321
114,333
Best way to deal with session timeout in web apps?
I am currently building an internal web application used in a factory/warehouse type location. The users will be sharing a single PC between several people, so we need to have a fairly short session timeout to stop people wandering off and leaving the application logged in where someone else can come to the PC and do s...
Keep the server informed about the fact that the user is actively entering information. For instance send a message to the server if the user presses the TAB key or clicks with a mouse on a field. The final solution is up to you.
Best way to deal with session timeout in web apps? I am currently building an internal web application used in a factory/warehouse type location. The users will be sharing a single PC between several people, so we need to have a fairly short session timeout to stop people wandering off and leaving the application logge...
TITLE: Best way to deal with session timeout in web apps? QUESTION: I am currently building an internal web application used in a factory/warehouse type location. The users will be sharing a single PC between several people, so we need to have a fairly short session timeout to stop people wandering off and leaving the...
[ "authentication", "web-applications", "session" ]
11
3
10,063
11
0
2008-09-22T11:26:29.390000
2008-09-22T11:30:31.067000
114,327
114,430
Abusing XmlReader ReadSubtree()
I need to parse a xml file which is practically an image of a really big tree structure, so I'm using the XmlReader class to populate the tree 'on the fly'. Each node is passed just the xml chunk it expects from its parent via the ReadSubtree() function. This has the advantage of not having to worry about when a node h...
ReadSubTree() gives you an XmlReader that wraps the original XmlReader. This new reader appears to consumers as a complete document. This might be important if the code you pass the subtree to thinks it is getting a standalone xml document. For example the Depth property of the new Reader starts out at 0. It is a prett...
Abusing XmlReader ReadSubtree() I need to parse a xml file which is practically an image of a really big tree structure, so I'm using the XmlReader class to populate the tree 'on the fly'. Each node is passed just the xml chunk it expects from its parent via the ReadSubtree() function. This has the advantage of not hav...
TITLE: Abusing XmlReader ReadSubtree() QUESTION: I need to parse a xml file which is practically an image of a really big tree structure, so I'm using the XmlReader class to populate the tree 'on the fly'. Each node is passed just the xml chunk it expects from its parent via the ReadSubtree() function. This has the ad...
[ ".net", "xml", "xmlreader" ]
5
11
5,128
2
0
2008-09-22T11:28:29.120000
2008-09-22T11:58:22.527000
114,332
114,781
Visual Studio setup problem - 'A problem has been encountered while loading the setup components. Canceling setup.'
I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to uninstall, reinstall or repair Visual Studio 2008 (team system version). If I can't resolve this issue I have no choice bu...
A colleague found this MS auto-uninstall tool which has successfully uninstalled VS2008 for me and saved me hours of work!! Hopefully this might be useful to others. Doesn't speak highly of MS's faith in their usual VS maintenance tools that they have to provide this as well!
Visual Studio setup problem - 'A problem has been encountered while loading the setup components. Canceling setup.' I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to uninst...
TITLE: Visual Studio setup problem - 'A problem has been encountered while loading the setup components. Canceling setup.' QUESTION: I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenev...
[ "visual-studio", "installation", "visual-studio-2008", "visual-studio-2005" ]
153
151
124,754
16
0
2008-09-22T11:30:01.160000
2008-09-22T13:13:28.573000
114,339
114,367
HTML Tag ClientID in a .NET Project
If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. My Link For example to give the link a different class depending on the current page i.e. if (Path.GetFileName(Request.PhysicalPath) == "MyPage") { myLink.Attributes.Add("class","active"); }.NET changes the ID...
AFAIK there is no way. It shows the actual control tree, which is in this case masterpage-content-control. However if you add an ID to the masterpage (this.ID = "whatever") then you will see "whatever" instead of ctl00 (which means control index 0).
HTML Tag ClientID in a .NET Project If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. My Link For example to give the link a different class depending on the current page i.e. if (Path.GetFileName(Request.PhysicalPath) == "MyPage") { myLink.Attributes.Add("cl...
TITLE: HTML Tag ClientID in a .NET Project QUESTION: If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. My Link For example to give the link a different class depending on the current page i.e. if (Path.GetFileName(Request.PhysicalPath) == "MyPage") { myLink....
[ ".net", "asp.net" ]
7
2
6,432
9
0
2008-09-22T11:32:21.857000
2008-09-22T11:41:45.437000
114,415
115,468
Using JET with EMF
I need to run JET templates on a EMF model metadata - i.e. the model itself (not data) is input to my JET template. More practically - I want generate non java code, based on EMF templates. How I do it? Thank you
For code generation, you could use Acceleo. That is like Xpand very comfortable model to text generation (Acceleo language is very intuitive for model browsing) and also less painful than JET.
Using JET with EMF I need to run JET templates on a EMF model metadata - i.e. the model itself (not data) is input to my JET template. More practically - I want generate non java code, based on EMF templates. How I do it? Thank you
TITLE: Using JET with EMF QUESTION: I need to run JET templates on a EMF model metadata - i.e. the model itself (not data) is input to my JET template. More practically - I want generate non java code, based on EMF templates. How I do it? Thank you ANSWER: For code generation, you could use Acceleo. That is like Xpan...
[ "eclipse-emf", "eclipse-m2t-jet" ]
0
0
1,227
2
0
2008-09-22T11:55:14.097000
2008-09-22T15:21:24.177000
114,417
114,433
Executing JavaScript on page load selectively
Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify these functions. Any great ideas on how to execute a piece of code...
A cookie would work just fine. Or you could modify the query string each time with a "mode=x" or "load=x" parameter. This would present a problem if the user tries to bookmark the final page, though. If that's an option, the cookie solution is fine. I would guess they need cookies enabled to get that far in the app any...
Executing JavaScript on page load selectively Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify these functions. Any...
TITLE: Executing JavaScript on page load selectively QUESTION: Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify th...
[ "javascript" ]
1
2
884
4
0
2008-09-22T11:55:17.277000
2008-09-22T11:58:34.383000
114,431
553,257
Fast word count function in Vim
I am trying to display a live word count in the vim statusline. I do this by setting my status line in my.vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This should work nicely as the statusline ...
Here's a usable version of Rodrigo Queiro's idea. It doesn't change the status bar, and it restores the statusmsg variable. function WordCount() let s:old_status = v:statusmsg exe "silent normal g\ " let s:word_count = str2nr(split(v:statusmsg)[11]) let v:statusmsg = s:old_status return s:word_count endfunction This se...
Fast word count function in Vim I am trying to display a live word count in the vim statusline. I do this by setting my status line in my.vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This shoul...
TITLE: Fast word count function in Vim QUESTION: I am trying to display a live word count in the vim statusline. I do this by setting my status line in my.vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the statu...
[ "vim" ]
41
23
16,675
17
0
2008-09-22T11:58:22.560000
2009-02-16T13:13:01.353000
114,457
114,567
Consequences of running a Java Class file on different JREs?
What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?
The Java SE 6 Compatibility page lists the compatibility of Jave SE 6 to Java SE 5.0. Furthermore, there is a link to Incompatibilities in J2SE 5.0 (since 1.4.2) as well. By looking at the two documents, it should be possible to find out whether there are any incomapatibilities of programs written under JDK 1.4.2 and J...
Consequences of running a Java Class file on different JREs? What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?
TITLE: Consequences of running a Java Class file on different JREs? QUESTION: What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5? ANSWER: The Java SE 6 Compatibility page lists the compatibility of Jave SE 6 to Java SE 5.0. Furthermore, there is a link to Incompatibilities ...
[ "java", "java1.4" ]
3
6
2,767
8
0
2008-09-22T12:05:06.473000
2008-09-22T12:31:40.827000
114,493
114,513
Determine the number of rows in a range
I know the range name of the start of a list - 1 column wide and x rows deep. How do I calculate x? There is more data in the column than just this list. However, this list is contiguous - there is nothing in any of the cells above or below or either side beside it.
Function ListRowCount(ByVal FirstCellName as String) as Long With thisworkbook.Names(FirstCellName).RefersToRange If isempty(.Offset(1,0).value) Then ListRowCount = 1 Else ListRowCount =.End(xlDown).row -.row + 1 End If End With End Function But if you are damn sure there's nothing around the list, then just thisworkbo...
Determine the number of rows in a range I know the range name of the start of a list - 1 column wide and x rows deep. How do I calculate x? There is more data in the column than just this list. However, this list is contiguous - there is nothing in any of the cells above or below or either side beside it.
TITLE: Determine the number of rows in a range QUESTION: I know the range name of the start of a list - 1 column wide and x rows deep. How do I calculate x? There is more data in the column than just this list. However, this list is contiguous - there is nothing in any of the cells above or below or either side beside...
[ "vba", "excel" ]
17
11
180,350
6
0
2008-09-22T12:15:03.750000
2008-09-22T12:21:54.810000
114,501
114,653
How to set the background-position to an absolute distance, starting from right?
I want to set a background image for a div, in a way that it is in the upper RIGHT of the div, but with a fixed 10px distance from top and right. Here is how I would do that if wanted it in the upper LEFT of the div: background: url(images/img06.gif) no-repeat 10px 10px; Is there anyway to achieve the same result, but ...
Use the previously mentioned rule along with a top and right margin: background: url(images/img06.gif) no-repeat top right; margin-top: 10px; margin-right: 10px; Background images only appear within padding, not margins. If adding the margin isn't an option you may have to resort to another div, although I'd recommend ...
How to set the background-position to an absolute distance, starting from right? I want to set a background image for a div, in a way that it is in the upper RIGHT of the div, but with a fixed 10px distance from top and right. Here is how I would do that if wanted it in the upper LEFT of the div: background: url(images...
TITLE: How to set the background-position to an absolute distance, starting from right? QUESTION: I want to set a background image for a div, in a way that it is in the upper RIGHT of the div, but with a fixed 10px distance from top and right. Here is how I would do that if wanted it in the upper LEFT of the div: back...
[ "css" ]
27
17
68,613
8
0
2008-09-22T12:18:03.447000
2008-09-22T12:47:19.697000
114,504
114,685
Is it possible to send a collection of ID's as a ADO.NET SQL parameter?
Eg. can I write something like this code: public void InactiveCustomers(IEnumerable customerIDs) { //... myAdoCommand.CommandText = "UPDATE Customer SET Active = 0 WHERE CustomerID in (@CustomerIDs)"; myAdoCommand.Parameters["@CustomerIDs"].Value = customerIDs; //... } The only way I know is to Join my IEnumerable and ...
Generally the way that you do this is to pass in a comma-separated list of values, and within your stored procedure, parse the list out and insert it into a temp table, which you can then use for joins. As of Sql Server 2005, this is standard practice for dealing with parameters that need to hold arrays. Here's a good ...
Is it possible to send a collection of ID's as a ADO.NET SQL parameter? Eg. can I write something like this code: public void InactiveCustomers(IEnumerable customerIDs) { //... myAdoCommand.CommandText = "UPDATE Customer SET Active = 0 WHERE CustomerID in (@CustomerIDs)"; myAdoCommand.Parameters["@CustomerIDs"].Value =...
TITLE: Is it possible to send a collection of ID's as a ADO.NET SQL parameter? QUESTION: Eg. can I write something like this code: public void InactiveCustomers(IEnumerable customerIDs) { //... myAdoCommand.CommandText = "UPDATE Customer SET Active = 0 WHERE CustomerID in (@CustomerIDs)"; myAdoCommand.Parameters["@Cus...
[ ".net", "sql", "ado.net" ]
20
17
8,765
6
0
2008-09-22T12:19:10.090000
2008-09-22T12:52:25.860000
114,525
114,593
The difference between the two functions? ("function x" vs "var x = function")
Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the difference between: function sum(x, y) { return x+y; } // and var sum = function (x, y) { return x+y; } Why is one used over the other?
The first is known as a named function where the second is known as an anonymous function. The key practical difference is in when you can use the sum function. For example:- var z = sum(2, 3); function sum(x, y) { return x+y; } z is assigned 5 whereas this:- var z = sum(2, 3); var sum = function(x, y) { return x+y; } ...
The difference between the two functions? ("function x" vs "var x = function") Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the difference between: function sum(x, y) { return x+y; } // and var sum = function (x, y) { return x+y; } Why is one used over the othe...
TITLE: The difference between the two functions? ("function x" vs "var x = function") QUESTION: Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the difference between: function sum(x, y) { return x+y; } // and var sum = function (x, y) { return x+y; } Why is one ...
[ "javascript" ]
58
56
17,819
7
0
2008-09-22T12:24:06.583000
2008-09-22T12:36:17.727000
114,527
114,552
Simplest way to have a configuration file in a Windows Forms C# application
I'm really new to.NET, and I still didn't get the hang about how configuration files work. Every time I search on Google about it I get results about web.config, but I'm writing a Windows Forms application. I figured out that I need to use the System.Configuration namespace, but the documentation isn't helping. How do ...
You want to use an App.Config. When you add a new item to a project there is something called Applications Configuration file. Add that. Then you add keys in the configuration/appsettings section Like: Access the members by doing System.Configuration.ConfigurationSettings.AppSettings["MyKey"]; This works in.NET 2 and a...
Simplest way to have a configuration file in a Windows Forms C# application I'm really new to.NET, and I still didn't get the hang about how configuration files work. Every time I search on Google about it I get results about web.config, but I'm writing a Windows Forms application. I figured out that I need to use the ...
TITLE: Simplest way to have a configuration file in a Windows Forms C# application QUESTION: I'm really new to.NET, and I still didn't get the hang about how configuration files work. Every time I search on Google about it I get results about web.config, but I'm writing a Windows Forms application. I figured out that ...
[ ".net", "xml", "winforms", "configuration" ]
97
135
261,548
11
0
2008-09-22T12:24:59.670000
2008-09-22T12:29:32.623000
114,538
114,566
Visually designing a database structure
I am quite happy to code out tables by hand when making a database but it's not the easiest way to convey information about a database to someone else, especially someone that's not so comfortable coding the tables via a script and would instead use something such at phpMyAdmin. Is there thus a free program (for me to ...
Well on the PC you can use MS Visio to produce a DB Entity diagram. It will even reverse engineer one from an existing Database. A pain to set-up the first time you use it, but quite handy thereafter.
Visually designing a database structure I am quite happy to code out tables by hand when making a database but it's not the easiest way to convey information about a database to someone else, especially someone that's not so comfortable coding the tables via a script and would instead use something such at phpMyAdmin. ...
TITLE: Visually designing a database structure QUESTION: I am quite happy to code out tables by hand when making a database but it's not the easiest way to convey information about a database to someone else, especially someone that's not so comfortable coding the tables via a script and would instead use something su...
[ "database", "language-agnostic", "database-design" ]
9
8
7,875
10
0
2008-09-22T12:27:12.037000
2008-09-22T12:31:36.020000
114,541
423,534
How do I access (listen for) the multimedia keys (play/pause) in Mac OS X?
I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs. Can anyone point me resources on accessing these keys or tell me how to do it? I have extensive programming experience, but this will be my ...
This blog post has a solution: http://www.rogueamoeba.com/utm/posts/Article/mediaKeys-2007-09-29-17-00.html You basically need to subclass NSApplication and override sendEvent, looking for special scan codes. I don't know what songbird is, but if it's not a real application then I doubt you'll be able to do this. Or ma...
How do I access (listen for) the multimedia keys (play/pause) in Mac OS X? I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs. Can anyone point me resources on accessing these keys or tell me ...
TITLE: How do I access (listen for) the multimedia keys (play/pause) in Mac OS X? QUESTION: I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs. Can anyone point me resources on accessing thes...
[ "macos", "xul", "songbird" ]
8
2
2,417
3
0
2008-09-22T12:27:37.917000
2009-01-08T07:42:37.573000
114,543
114,549
How can I horizontally center an element?
How can I horizontally center a within another using CSS? Foo foo
With flexbox it is very easy to style the div horizontally and vertically centered. #inner { border: 0.05em solid black; } #outer { border: 0.05em solid red; width:100%; display: flex; justify-content: center; } Foo foo To align the div vertically centered, use the property align-items: center. Other Solutions You can...
How can I horizontally center an element? How can I horizontally center a within another using CSS? Foo foo
TITLE: How can I horizontally center an element? QUESTION: How can I horizontally center a within another using CSS? Foo foo ANSWER: With flexbox it is very easy to style the div horizontally and vertically centered. #inner { border: 0.05em solid black; } #outer { border: 0.05em solid red; width:100%; display: flex;...
[ "html", "css", "alignment", "centering" ]
5,097
5,540
4,904,241
132
0
2008-09-22T12:27:57.510000
2008-09-22T12:29:07.710000
114,555
114,662
Setting up Subversion on a Red Hat system
I'm fairly new to the world of versioning but would like to introduce Subversion into our small development team as we're finding that more and more we are working on the same projects/files. We primarily code in PHP on a LAMP environment (Red Hat Enterprise). What I'm looking for are some starting points to get me up ...
It depends on what version of RHEL you are running. Setting up Subversion in general is very easy you just have to install the binaries and run svnserve or adapt the Apache configuration. Get it: http://subversion.tigris.org/getting.html Install it svnadmin create --fs-type=fsfs After that you have a repository which y...
Setting up Subversion on a Red Hat system I'm fairly new to the world of versioning but would like to introduce Subversion into our small development team as we're finding that more and more we are working on the same projects/files. We primarily code in PHP on a LAMP environment (Red Hat Enterprise). What I'm looking ...
TITLE: Setting up Subversion on a Red Hat system QUESTION: I'm fairly new to the world of versioning but would like to introduce Subversion into our small development team as we're finding that more and more we are working on the same projects/files. We primarily code in PHP on a LAMP environment (Red Hat Enterprise)....
[ "php", "svn", "redhat" ]
1
1
9,497
4
0
2008-09-22T12:30:26.553000
2008-09-22T12:49:38.847000
114,559
114,846
Mac toolbar via WINE / Crossover
Does anyone know if it's possible to get a Win32 application to run under wine / crossover but have the main toolbar appear as a Mac toolbar (i.e. outside the wine / crossover app)?
What is the "main toolbar"? In Win32, windows do not require a menu bar (ie: IE), or even a main window (!) so this is obviously not possible in general. If you really wanted to, you could send GetMenu() to the first created window, then use (something like? I haven't used the menu APIs much) GetMenuItemInfo() to fill ...
Mac toolbar via WINE / Crossover Does anyone know if it's possible to get a Win32 application to run under wine / crossover but have the main toolbar appear as a Mac toolbar (i.e. outside the wine / crossover app)?
TITLE: Mac toolbar via WINE / Crossover QUESTION: Does anyone know if it's possible to get a Win32 application to run under wine / crossover but have the main toolbar appear as a Mac toolbar (i.e. outside the wine / crossover app)? ANSWER: What is the "main toolbar"? In Win32, windows do not require a menu bar (ie: I...
[ "winapi", "macos", "wine" ]
1
1
369
1
0
2008-09-22T12:30:48.800000
2008-09-22T13:25:15.500000
114,581
114,701
How helpful is knowing lambda calculus?
To all the people who know lambda calculus: What benefit has it bought you, regarding programming? Would you recommend that people learn it?
If you want to program in any functional programming language, it's essential. I mean, how useful is it to know about Turing machines? Well, if you write C, the language paradigm is quite close to Turing machines -- you have an instruction pointer and a current instruction, and the machine takes some action in the curr...
How helpful is knowing lambda calculus? To all the people who know lambda calculus: What benefit has it bought you, regarding programming? Would you recommend that people learn it?
TITLE: How helpful is knowing lambda calculus? QUESTION: To all the people who know lambda calculus: What benefit has it bought you, regarding programming? Would you recommend that people learn it? ANSWER: If you want to program in any functional programming language, it's essential. I mean, how useful is it to know ...
[ "math", "functional-programming", "computer-science", "lambda-calculus" ]
78
32
25,435
11
0
2008-09-22T12:34:26.247000
2008-09-22T12:55:18.693000
114,586
114,601
Smart design of a math parser?
What is the smartest way to design a math parser? What I mean is a function that takes a math string (like: "2 + 3 / 2 + (2 * 5)") and returns the calculated value?
A pretty good approach would involve two steps. The first step involves converting the expression from infix to postfix (e.g. via Dijkstra's shunting yard ) notation. Once that's done, it's pretty trivial to write a postfix evaluator.
Smart design of a math parser? What is the smartest way to design a math parser? What I mean is a function that takes a math string (like: "2 + 3 / 2 + (2 * 5)") and returns the calculated value?
TITLE: Smart design of a math parser? QUESTION: What is the smartest way to design a math parser? What I mean is a function that takes a math string (like: "2 + 3 / 2 + (2 * 5)") and returns the calculated value? ANSWER: A pretty good approach would involve two steps. The first step involves converting the expression...
[ "math", "parsing", "calculator" ]
61
91
43,063
8
0
2008-09-22T12:35:33.420000
2008-09-22T12:37:46.677000
114,590
114,876
Simple web "live chat" software (LAMP stack) that integrates with Jabber/Aim
I've looked for this a few times in the past, to no avail. I would like a simple php/ajax web chat interface, that, and this is the critical part, will interface with my IM client (Pidgin)... via Jabber or Aim. Plugoo is almost what I want, except it is hosted, and flash based. Flash-based would be OK if not ideal, but...
This wouldn't be that hard, if you implement the Oscar protocol that AIM uses. It's not very complex, and that would allow you to build a nice web based AIM client for your website. There may be a 3rd party solution that you could use, but as far as I know, Oscar is pretty trivial.
Simple web "live chat" software (LAMP stack) that integrates with Jabber/Aim I've looked for this a few times in the past, to no avail. I would like a simple php/ajax web chat interface, that, and this is the critical part, will interface with my IM client (Pidgin)... via Jabber or Aim. Plugoo is almost what I want, ex...
TITLE: Simple web "live chat" software (LAMP stack) that integrates with Jabber/Aim QUESTION: I've looked for this a few times in the past, to no avail. I would like a simple php/ajax web chat interface, that, and this is the critical part, will interface with my IM client (Pidgin)... via Jabber or Aim. Plugoo is almo...
[ "php", "ajax", "chat", "xmpp" ]
6
6
5,980
7
0
2008-09-22T12:35:52.203000
2008-09-22T13:30:24.163000
114,597
114,626
What is the fastest way to scale and display an image in Python?
I am required to display a two dimensional numpy.array of int16 at 20fps or so. Using Matplotlib's imshow chokes on anything above 10fps. There obviously are some issues with scaling and interpolation. I should add that the dimensions of the array are not known, but will probably be around thirty by four hundred. These...
The fastest way to display 30x400 data points is to: Use OpenGL color arrays If you can quickly transform your data to what OpenGL understands as color array, you could create a vertex array describing quads, one for each sensor, then update your color array and draw this orthographically on screen. Use OpenGL textures...
What is the fastest way to scale and display an image in Python? I am required to display a two dimensional numpy.array of int16 at 20fps or so. Using Matplotlib's imshow chokes on anything above 10fps. There obviously are some issues with scaling and interpolation. I should add that the dimensions of the array are not...
TITLE: What is the fastest way to scale and display an image in Python? QUESTION: I am required to display a two dimensional numpy.array of int16 at 20fps or so. Using Matplotlib's imshow chokes on anything above 10fps. There obviously are some issues with scaling and interpolation. I should add that the dimensions of...
[ "python", "animation", "matplotlib", "image-scaling" ]
6
6
2,330
1
0
2008-09-22T12:36:53.183000
2008-09-22T12:43:30.297000
114,658
114,693
Catching base Exception class in .NET
I keep hearing that catch (Exception ex) Is bad practise, however, I often use it in event handlers where an operation may for example go to network, allowing the possibility of many different types of failure. In this case, I catch all exceptions and display the error message to the user in a message box. Is this cons...
The bad practice is catch (Exception ex){} and variants: catch (Exception ex){ return false; } etc. Catching all exceptions on the top-level and passing them on to the user (by either logging them or displaying them in a message-box, depending on whether you are writing a server- or a client-application), is exactly th...
Catching base Exception class in .NET I keep hearing that catch (Exception ex) Is bad practise, however, I often use it in event handlers where an operation may for example go to network, allowing the possibility of many different types of failure. In this case, I catch all exceptions and display the error message to t...
TITLE: Catching base Exception class in .NET QUESTION: I keep hearing that catch (Exception ex) Is bad practise, however, I often use it in event handlers where an operation may for example go to network, allowing the possibility of many different types of failure. In this case, I catch all exceptions and display the ...
[ "c#", "exception" ]
21
33
9,780
16
0
2008-09-22T12:48:47.697000
2008-09-22T12:54:21.613000
114,707
114,715
Editable data grid for C# WinForms
I need to present the user with a matrix of which one column is editable. What is the most appropriate control to use? I can't use a ListView because you can only edit the first column (the label) and that's no good to me. Is the DataGridView the way to go, or are there third party alternative components that do a bett...
DataGridView is the best choice as it is free and comes with.NET WinForms 2.0. You can define editable columns or read-only. Plus you can customize the appearance if required.
Editable data grid for C# WinForms I need to present the user with a matrix of which one column is editable. What is the most appropriate control to use? I can't use a ListView because you can only edit the first column (the label) and that's no good to me. Is the DataGridView the way to go, or are there third party al...
TITLE: Editable data grid for C# WinForms QUESTION: I need to present the user with a matrix of which one column is editable. What is the most appropriate control to use? I can't use a ListView because you can only edit the first column (the label) and that's no good to me. Is the DataGridView the way to go, or are th...
[ "c#", "winforms", "user-interface", "editing" ]
7
13
18,794
3
0
2008-09-22T12:56:49.470000
2008-09-22T12:58:21.307000
114,733
114,795
ReportViewer - modify toolbar?
Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there. Like, I had to remove export to excel, and did it th...
There are a lot of properties to set which buttons would you like to see. For example ShowBackButton, ShowExportButton, ShowFindControls, and so on. Check them in the help, all starts with "Show". But you are right, you cannot add new buttons. You have to create your own toolbar in order to do this. What do you mean ab...
ReportViewer - modify toolbar? Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there. Like, I had to remove...
TITLE: ReportViewer - modify toolbar? QUESTION: Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there. Lik...
[ "reportviewer", "toolbar", "rdlc" ]
7
4
29,556
8
0
2008-09-22T13:03:12.870000
2008-09-22T13:16:43.370000
114,764
114,926
Toggling the state of a menu item
I have an Eclipse RCP app I'm working on. It has some view-specific menus and one of the menu items is an item which I would like to display a tick next to when the corresponding functionality is enabled. Similarly, the next time the item is selected, the item should become unticked to reflect that the corresponding fu...
The solution involves having the command handler implement the IElementUpdater interface. The UI element can then be updated as so: public void updateElement(UIElement element, Map parameters) { element.setChecked(isSelected); } updateElement is called as part of a UI refresh which can be invoked from the handler's exe...
Toggling the state of a menu item I have an Eclipse RCP app I'm working on. It has some view-specific menus and one of the menu items is an item which I would like to display a tick next to when the corresponding functionality is enabled. Similarly, the next time the item is selected, the item should become unticked to...
TITLE: Toggling the state of a menu item QUESTION: I have an Eclipse RCP app I'm working on. It has some view-specific menus and one of the menu items is an item which I would like to display a tick next to when the corresponding functionality is enabled. Similarly, the next time the item is selected, the item should ...
[ "java", "eclipse" ]
3
1
3,008
2
0
2008-09-22T13:10:21.933000
2008-09-22T13:43:15.410000
114,804
115,169
Reading from a promiscuous network device
I want to write a real-time analysis tool for wireless traffic. Does anyone know how to read from a promiscuous (or sniffing) device in C? I know that you need to have root access to do it. I was wondering if anyone knows what functions are necessary to do this. Normal sockets don't seem to make sense here.
On Linux you use a PF_PACKET socket to read data from a raw device, such as an ethernet interface running in promiscuous mode: s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)) This will send copies of every packet received up to your socket. It is quite likely that you don't really want every packet, though. The kerne...
Reading from a promiscuous network device I want to write a real-time analysis tool for wireless traffic. Does anyone know how to read from a promiscuous (or sniffing) device in C? I know that you need to have root access to do it. I was wondering if anyone knows what functions are necessary to do this. Normal sockets ...
TITLE: Reading from a promiscuous network device QUESTION: I want to write a real-time analysis tool for wireless traffic. Does anyone know how to read from a promiscuous (or sniffing) device in C? I know that you need to have root access to do it. I was wondering if anyone knows what functions are necessary to do thi...
[ "c", "linux", "sockets", "wireless", "promiscuous-mode" ]
10
17
15,784
5
0
2008-09-22T13:18:16.563000
2008-09-22T14:31:56.980000
114,807
114,813
Should I learn/become proficient in Javascript?
I am a.NET webdev using ASP.NET, C# etc... I "learned" javascript in college 5+ years ago and can do basic jobs with it. But I wonder if it is useful to become proficient in it. Why should I learn Javascript? Is it more advantageous then learning JQuery or a different library?
Yes, definitely learn Javascript before you learn one of the libraries about. It's the whole walk-before-you-can-run thing.
Should I learn/become proficient in Javascript? I am a.NET webdev using ASP.NET, C# etc... I "learned" javascript in college 5+ years ago and can do basic jobs with it. But I wonder if it is useful to become proficient in it. Why should I learn Javascript? Is it more advantageous then learning JQuery or a different lib...
TITLE: Should I learn/become proficient in Javascript? QUESTION: I am a.NET webdev using ASP.NET, C# etc... I "learned" javascript in college 5+ years ago and can do basic jobs with it. But I wonder if it is useful to become proficient in it. Why should I learn Javascript? Is it more advantageous then learning JQuery ...
[ "javascript" ]
13
31
5,179
20
0
2008-09-22T13:18:52.177000
2008-09-22T13:20:32.347000
114,814
114,836
count (non-blank) lines-of-code in bash
In Bash, how do I count the number of non-blank lines of code in a project?
cat foo.c | sed '/^\s*$/d' | wc -l And if you consider comments blank lines: cat foo.pl | sed '/^\s*#/d;/^\s*$/d' | wc -l Although, that's language dependent.
count (non-blank) lines-of-code in bash In Bash, how do I count the number of non-blank lines of code in a project?
TITLE: count (non-blank) lines-of-code in bash QUESTION: In Bash, how do I count the number of non-blank lines of code in a project? ANSWER: cat foo.c | sed '/^\s*$/d' | wc -l And if you consider comments blank lines: cat foo.pl | sed '/^\s*#/d;/^\s*$/d' | wc -l Although, that's language dependent.
[ "bash", "unix", "count", "lines", "nonblank" ]
178
217
157,563
21
0
2008-09-22T13:20:42.283000
2008-09-22T13:23:10.327000
114,819
114,883
Getting a vector<Derived*> into a function that expects a vector<Base*>
Consider these classes. class Base {... }; class Derived: public Base {... }; this function void BaseFoo( std::vector vec ) {... } And finally my vector std::vector derived; I want to pass derived to function BaseFoo, but the compiler doesn't let me. How do I solve this, without copying the whole vector to a std::vect...
vector and vector are unrelated types, so you can't do this. This is explained in the C++ FAQ here. You need to change your variable from a vector to a vector and insert Derived objects into it. Also, to avoid copying the vector unnecessarily, you should pass it by const-reference, not by value: void BaseFoo( const std...
Getting a vector<Derived*> into a function that expects a vector<Base*> Consider these classes. class Base {... }; class Derived: public Base {... }; this function void BaseFoo( std::vector vec ) {... } And finally my vector std::vector derived; I want to pass derived to function BaseFoo, but the compiler doesn't let ...
TITLE: Getting a vector<Derived*> into a function that expects a vector<Base*> QUESTION: Consider these classes. class Base {... }; class Derived: public Base {... }; this function void BaseFoo( std::vector vec ) {... } And finally my vector std::vector derived; I want to pass derived to function BaseFoo, but the com...
[ "c++", "stl", "vector", "covariance" ]
28
44
9,684
9
0
2008-09-22T13:21:02.547000
2008-09-22T13:31:38.607000
114,830
114,831
Is a Python dictionary an example of a hash table?
One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?
Yes, it is a hash mapping or hash table. You can read a description of python's dict implementation, as written by Tim Peters, here. That's why you can't use something 'not hashable' as a dict key, like a list: >>> a = {} >>> b = ['some', 'list'] >>> hash(b) Traceback (most recent call last): File " ", line 1, in TypeE...
Is a Python dictionary an example of a hash table? One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?
TITLE: Is a Python dictionary an example of a hash table? QUESTION: One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it? ANSWER: Yes, it is a hash mapping or hash table. ...
[ "python", "hash", "dictionary", "hashmap", "hashtable" ]
264
320
261,546
4
0
2008-09-22T13:22:28.987000
2008-09-22T13:23:00.203000
114,851
114,887
How do I bind the result of DataTable.Select() to a ListBox control?
I have the following code: ListBox.DataSource = DataSet.Tables("table_name").Select("some_criteria = match") ListBox.DisplayMember = "name" The DataTable.Select() method returns an array of System.Data.DataRow objects. No matter what I specify in the ListBox.DisplayMember property, all I see is the ListBox with the cor...
Use a DataView instead. ListBox.DataSource = new DataView(DataSet.Tables("table_name"), "some_criteria = match", "name", DataViewRowState.CurrentRows); ListBox.DisplayMember = "name"
How do I bind the result of DataTable.Select() to a ListBox control? I have the following code: ListBox.DataSource = DataSet.Tables("table_name").Select("some_criteria = match") ListBox.DisplayMember = "name" The DataTable.Select() method returns an array of System.Data.DataRow objects. No matter what I specify in the ...
TITLE: How do I bind the result of DataTable.Select() to a ListBox control? QUESTION: I have the following code: ListBox.DataSource = DataSet.Tables("table_name").Select("some_criteria = match") ListBox.DisplayMember = "name" The DataTable.Select() method returns an array of System.Data.DataRow objects. No matter what...
[ ".net", "data-binding", "listbox", "datatable", "datarow" ]
12
33
31,399
2
0
2008-09-22T13:25:51.630000
2008-09-22T13:32:45.077000
114,859
114,952
How to prevent creating intermediate objects in cascading operators?
I use a custom Matrix class in my application, and I frequently add multiple matrices: Matrix result = a + b + c + d; // a, b, c and d are also Matrices However, this creates an intermediate matrix for each addition operation. Since this is simple addition, it is possible to avoid the intermediate objects and create th...
You could limit yourself to a single small intermediate by using lazy evaluation. Something like public class LazyMatrix { public static implicit operator Matrix(LazyMatrix l) { Matrix m = new Matrix(); foreach (Matrix x in l.Pending) { for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) m.Contents[i, j] += x.Conte...
How to prevent creating intermediate objects in cascading operators? I use a custom Matrix class in my application, and I frequently add multiple matrices: Matrix result = a + b + c + d; // a, b, c and d are also Matrices However, this creates an intermediate matrix for each addition operation. Since this is simple add...
TITLE: How to prevent creating intermediate objects in cascading operators? QUESTION: I use a custom Matrix class in my application, and I frequently add multiple matrices: Matrix result = a + b + c + d; // a, b, c and d are also Matrices However, this creates an intermediate matrix for each addition operation. Since ...
[ "c#", ".net", "operators" ]
2
8
435
11
0
2008-09-22T13:27:25.137000
2008-09-22T13:49:02.900000
114,860
114,882
What is the best way to pack JavaScript code without getting performance flaws?
I am searching for a way to compress JavaScript code for the iPhone. Is there a way to avoid using a lot of CPU time on the small and rather slow device?
Use JSMin and avoid packer which is really more CPU consuming and slower to "deflate"
What is the best way to pack JavaScript code without getting performance flaws? I am searching for a way to compress JavaScript code for the iPhone. Is there a way to avoid using a lot of CPU time on the small and rather slow device?
TITLE: What is the best way to pack JavaScript code without getting performance flaws? QUESTION: I am searching for a way to compress JavaScript code for the iPhone. Is there a way to avoid using a lot of CPU time on the small and rather slow device? ANSWER: Use JSMin and avoid packer which is really more CPU consumi...
[ "javascript", "iphone", "compression" ]
6
5
4,654
8
0
2008-09-22T13:27:25.713000
2008-09-22T13:31:27.530000
114,872
114,904
How expensive are JS function calls (compared to allocating memory for a variable)?
Given some JS code like that one here: for (var i = 0; i < document.getElementsByName('scale_select').length; i++) { document.getElementsByName('scale_select')[i].onclick = vSetScale; } Would the code be faster if we put the result of getElementsByName into a variable before the loop and then use the variable after tha...
Definitely. The memory required to store that would only be a pointer to a DOM object and that's significantly less painful than doing a DOM search each time you need to use something! Idealish code: var scale_select = document.getElementsByName('scale_select'); for (var i = 0; i < scale_select.length; i++) scale_selec...
How expensive are JS function calls (compared to allocating memory for a variable)? Given some JS code like that one here: for (var i = 0; i < document.getElementsByName('scale_select').length; i++) { document.getElementsByName('scale_select')[i].onclick = vSetScale; } Would the code be faster if we put the result of g...
TITLE: How expensive are JS function calls (compared to allocating memory for a variable)? QUESTION: Given some JS code like that one here: for (var i = 0; i < document.getElementsByName('scale_select').length; i++) { document.getElementsByName('scale_select')[i].onclick = vSetScale; } Would the code be faster if we p...
[ "javascript", "function", "optimization" ]
12
17
1,047
8
0
2008-09-22T13:29:03.573000
2008-09-22T13:37:13.803000
114,874
114,903
How to determine the value of socket listen() backlog parameter?
How should I determine what to use for a listening socket's backlog parameter? Is it a problem to simply specify a very large number?
From the docs: A value for the backlog of SOMAXCONN is a special constant that instructs the underlying service provider responsible for socket s to set the length of the queue of pending connections to a maximum reasonable value.
How to determine the value of socket listen() backlog parameter? How should I determine what to use for a listening socket's backlog parameter? Is it a problem to simply specify a very large number?
TITLE: How to determine the value of socket listen() backlog parameter? QUESTION: How should I determine what to use for a listening socket's backlog parameter? Is it a problem to simply specify a very large number? ANSWER: From the docs: A value for the backlog of SOMAXCONN is a special constant that instructs the u...
[ "c++", "c", "sockets", "tcp", "listen" ]
40
1
36,683
3
0
2008-09-22T13:29:07.787000
2008-09-22T13:37:06.423000
114,892
115,248
QTVR-like Panorama in Flash/ActionScript?
It has been a few years since I used Actionscript. Back in the day, I made a project that emulated a QTVR panorama (at the time I was using Flash, you could only embed very basic mov files) by simply moving a very long flattened pano image left or right behind a mask. The effect was okay, but not as nice as a real pano...
My advice would be - download PaperVision, cut your image into strips, then arrange these in ring as 3d planes.
QTVR-like Panorama in Flash/ActionScript? It has been a few years since I used Actionscript. Back in the day, I made a project that emulated a QTVR panorama (at the time I was using Flash, you could only embed very basic mov files) by simply moving a very long flattened pano image left or right behind a mask. The effec...
TITLE: QTVR-like Panorama in Flash/ActionScript? QUESTION: It has been a few years since I used Actionscript. Back in the day, I made a project that emulated a QTVR panorama (at the time I was using Flash, you could only embed very basic mov files) by simply moving a very long flattened pano image left or right behind...
[ "flash", "actionscript", "graphics", "quicktime" ]
0
1
1,863
3
0
2008-09-22T13:33:59.287000
2008-09-22T14:45:40.660000
114,910
115,246
How to pass an array parameter in TOAD
Using toad and an oracle database, how can I call a sp and see the results by passing an array to one of the parameters of the sp?
In the Editor tab you can call it like this: begin myproc (my_array_type(1,4,7,9)); end;
How to pass an array parameter in TOAD Using toad and an oracle database, how can I call a sp and see the results by passing an array to one of the parameters of the sp?
TITLE: How to pass an array parameter in TOAD QUESTION: Using toad and an oracle database, how can I call a sp and see the results by passing an array to one of the parameters of the sp? ANSWER: In the Editor tab you can call it like this: begin myproc (my_array_type(1,4,7,9)); end;
[ "oracle", "associative-array", "toad" ]
3
3
2,543
1
0
2008-09-22T13:39:28.697000
2008-09-22T14:45:19.490000
114,914
1,139,139
How do you fix "Too many open files" problem in Hudson?
We use Hudson as a continuous integration system to execute automated builds (nightly and based on CVS polling) of a lot of our projects. Some projects poll CVS every 15 minutes, some others poll every 5 minutes and some poll every hour. Every few weeks we'll get a build that fails with the following output: FATAL: jav...
This is Hudson issue 715 ( http://issues.hudson-ci.org/browse/HUDSON-715 ). The current recommendation is to set the 'maximum number of simultaneous polling threads' to keep the polling activity down.
How do you fix "Too many open files" problem in Hudson? We use Hudson as a continuous integration system to execute automated builds (nightly and based on CVS polling) of a lot of our projects. Some projects poll CVS every 15 minutes, some others poll every 5 minutes and some poll every hour. Every few weeks we'll get ...
TITLE: How do you fix "Too many open files" problem in Hudson? QUESTION: We use Hudson as a continuous integration system to execute automated builds (nightly and based on CVS polling) of a lot of our projects. Some projects poll CVS every 15 minutes, some others poll every 5 minutes and some poll every hour. Every fe...
[ "java", "exception", "continuous-integration", "build-automation", "hudson" ]
7
4
9,276
5
0
2008-09-22T13:40:14.357000
2009-07-16T17:39:32.393000
114,928
114,937
.NET Process.Start default directory?
I'm firing off a Java application from inside of a C#.NET console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support files. Is there a process parameter that can be set to ...
Yes! ProcessStartInfo Has a property called WorkingDirectory, just use:... using System.Diagnostics;... var startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = // working directory // set additional properties Process proc = Process.Start(startInfo);
.NET Process.Start default directory? I'm firing off a Java application from inside of a C#.NET console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support files. Is there a...
TITLE: .NET Process.Start default directory? QUESTION: I'm firing off a Java application from inside of a C#.NET console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support...
[ "c#" ]
136
214
115,128
7
0
2008-09-22T13:44:33.833000
2008-09-22T13:46:44.077000
114,946
164,799
Vertical Scrolling Marquee for foxpro
Could anyone could point me to some code/give me ideas on how to create a smooth scrolling vertical marquee for VFP 8 or 9? Any help is appreciated.
Here's a quick program that will scroll messages. Put the following in a prg file and run it. I'd make a containerScrollArea a class that encapsulates the timer, labels, and scrolling code. Give it GetNextMessage method that you can override to retrieve the messages. * Put a container on the screen to hold our scroller...
Vertical Scrolling Marquee for foxpro Could anyone could point me to some code/give me ideas on how to create a smooth scrolling vertical marquee for VFP 8 or 9? Any help is appreciated.
TITLE: Vertical Scrolling Marquee for foxpro QUESTION: Could anyone could point me to some code/give me ideas on how to create a smooth scrolling vertical marquee for VFP 8 or 9? Any help is appreciated. ANSWER: Here's a quick program that will scroll messages. Put the following in a prg file and run it. I'd make a c...
[ "scroll", "visual-foxpro", "foxpro", "marquee" ]
0
0
4,586
3
0
2008-09-22T13:47:45.727000
2008-10-02T21:58:41.617000
114,953
114,973
How to get email and their attachments from PHP
I'm writing a photo gallery webapp for a friend's wedding and they want a photo gallery for guests to submit the digital photos they take on the day. After evaluating all the options, I've decided the easiest thing for users would be to let them use a familiar interface (their email) and just have them send in the pict...
What MTA are you using? If you use postfix + maildrop you can create a filtering rule that pipes certain messages through a PHP script that then handles the incoming mails. (google for maildrop and xfilter ).
How to get email and their attachments from PHP I'm writing a photo gallery webapp for a friend's wedding and they want a photo gallery for guests to submit the digital photos they take on the day. After evaluating all the options, I've decided the easiest thing for users would be to let them use a familiar interface (...
TITLE: How to get email and their attachments from PHP QUESTION: I'm writing a photo gallery webapp for a friend's wedding and they want a photo gallery for guests to submit the digital photos they take on the day. After evaluating all the options, I've decided the easiest thing for users would be to let them use a fa...
[ "php", "email" ]
18
4
41,930
7
0
2008-09-22T13:49:13.917000
2008-09-22T13:54:08.193000
114,970
199,981
How can I trigger Core Animation on an animator proxy during a call to resizeSubviewsWithOldSize?
I have some NSViews that I'm putting in one of two layouts depending on the size of my window. I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method. This works, but I'd like to animate the change. So naturally I tried calling the animator proxy when I set the new frames, bu...
I don't think you can do this easily because CA's animations are run via a timer and the timer won't fire during the runloop modes that are active while the user is dragging. If you can control the runloop as the user is dragging, play around with the runloop modes. That'll make it work. I don't think you can change it...
How can I trigger Core Animation on an animator proxy during a call to resizeSubviewsWithOldSize? I have some NSViews that I'm putting in one of two layouts depending on the size of my window. I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method. This works, but I'd like to...
TITLE: How can I trigger Core Animation on an animator proxy during a call to resizeSubviewsWithOldSize? QUESTION: I have some NSViews that I'm putting in one of two layouts depending on the size of my window. I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method. This work...
[ "cocoa", "core-animation" ]
3
2
615
2
0
2008-09-22T13:53:48.117000
2008-10-14T04:00:09.603000
114,996
115,009
PHP and MS Access
How can we connect a PHP script to MS Access (.mdb) file? I tried by including following PHP code: $db_path = $_SERVER['DOCUMENT_ROOT']. '\WebUpdate\\'. $file_name. '.mdb'; $cfg_dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=". $db_path; $odbcconnect = odbc_connect($cfg_dsn, '', ''); But it failed and I received f...
Here's a sample for a connect and a simple select... open($connstr); $rS = $db_conn->execute("SELECT * FROM Employees"); $f1 = $rS->Fields(0); $f2 = $rS->Fields(1); while (!$rS->EOF) { print $f1->value." ".$f2->value." \n"; $rS->MoveNext(); } $rS->Close(); $db_conn->Close();?>
PHP and MS Access How can we connect a PHP script to MS Access (.mdb) file? I tried by including following PHP code: $db_path = $_SERVER['DOCUMENT_ROOT']. '\WebUpdate\\'. $file_name. '.mdb'; $cfg_dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=". $db_path; $odbcconnect = odbc_connect($cfg_dsn, '', ''); But it faile...
TITLE: PHP and MS Access QUESTION: How can we connect a PHP script to MS Access (.mdb) file? I tried by including following PHP code: $db_path = $_SERVER['DOCUMENT_ROOT']. '\WebUpdate\\'. $file_name. '.mdb'; $cfg_dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=". $db_path; $odbcconnect = odbc_connect($cfg_dsn, '',...
[ "php", "ms-access" ]
0
5
4,866
5
0
2008-09-22T13:58:50.647000
2008-09-22T14:02:12.917000
115,001
115,196
How can I generate "migration" DDL from NHibernate mapping files?
I'm using NHibernate 2 and PostgreSQL in my project. SchemaExport class does a great job generating DDL scheme for database, but it's great until the first application. Is there any way to generate "migration" DLL (batch of "ALTER TABLE"'s instead of DROP/CREATE pair) using NHibernate mapping files?
Look into SchemaUpdate. Very similiar API as SchemaExport but it only creates migrations.
How can I generate "migration" DDL from NHibernate mapping files? I'm using NHibernate 2 and PostgreSQL in my project. SchemaExport class does a great job generating DDL scheme for database, but it's great until the first application. Is there any way to generate "migration" DLL (batch of "ALTER TABLE"'s instead of DRO...
TITLE: How can I generate "migration" DDL from NHibernate mapping files? QUESTION: I'm using NHibernate 2 and PostgreSQL in my project. SchemaExport class does a great job generating DDL scheme for database, but it's great until the first application. Is there any way to generate "migration" DLL (batch of "ALTER TABLE...
[ "nhibernate", "postgresql", "continuous-integration", "ddl" ]
5
10
2,235
2
0
2008-09-22T14:00:14.170000
2008-09-22T14:36:42.427000
115,021
115,068
Keep sources from external repositories up-to-date
After you start tracking the source of a bunch of open source software, how do you keep your code in sync? Run svn update every time you want to look at or play with the code? It strikes me that it would be better to essentially start mirroring the code with (say) a cron job every night. Have people set up workflows to...
The general workflow recommended by the Subversion book is to update your working copy often; at the start of every work-day is a good time. But you don't have to. Just update whenever you feel like seeing the latest changes. I have a number of open source repositories checked out under a src/ directory. Every couple o...
Keep sources from external repositories up-to-date After you start tracking the source of a bunch of open source software, how do you keep your code in sync? Run svn update every time you want to look at or play with the code? It strikes me that it would be better to essentially start mirroring the code with (say) a cr...
TITLE: Keep sources from external repositories up-to-date QUESTION: After you start tracking the source of a bunch of open source software, how do you keep your code in sync? Run svn update every time you want to look at or play with the code? It strikes me that it would be better to essentially start mirroring the co...
[ "version-control" ]
0
3
158
4
0
2008-09-22T14:04:17.263000
2008-09-22T14:13:39.863000
115,031
115,106
An Issue with converting enumerations in C++\CLI
I have an assembly, written in C++\CLI, which uses some of enumerations, provided by.Net. It has such kind of properties: property System::ServiceProcess::ServiceControllerStatus ^ Status { ServiceControllerStatus ^ get() { return (ServiceControllerStatus)_status->dwCurrentState; } } it works fine, but when i use this ...
In C++/CLI ^ is like the analagous * in standard C++. Because enumerations are value types the ^ should not be included otherwise you will see them as System.Enum. Remove the ^ and you will see the correct enumeration on C# side. property System::ServiceProcess::ServiceControllerStatus Status { System::ServiceProcess::...
An Issue with converting enumerations in C++\CLI I have an assembly, written in C++\CLI, which uses some of enumerations, provided by.Net. It has such kind of properties: property System::ServiceProcess::ServiceControllerStatus ^ Status { ServiceControllerStatus ^ get() { return (ServiceControllerStatus)_status->dwCurr...
TITLE: An Issue with converting enumerations in C++\CLI QUESTION: I have an assembly, written in C++\CLI, which uses some of enumerations, provided by.Net. It has such kind of properties: property System::ServiceProcess::ServiceControllerStatus ^ Status { ServiceControllerStatus ^ get() { return (ServiceControllerStat...
[ "c#", "enums", "c++-cli", "enumeration" ]
5
5
871
2
0
2008-09-22T14:05:52.987000
2008-09-22T14:22:13.913000
115,039
118,939
Is there any reason to not use my IoC as a general Settings Repository?
Suppose that the ApplicationSettings class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those settings - DefaultUnitOfMeasure. My reading of proper use of Inversion of Control Containers ...
IoC.Container.Resolve("default_uom"); I see this as a classic anti-pattern, where you are using the IoC container as a service locater - the key issues that result are: Your application no longer fails-fast if your container is misconfigured (you'll only know about it the first time it tries to resolve that particular ...
Is there any reason to not use my IoC as a general Settings Repository? Suppose that the ApplicationSettings class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those settings - DefaultUni...
TITLE: Is there any reason to not use my IoC as a general Settings Repository? QUESTION: Suppose that the ApplicationSettings class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those set...
[ "inversion-of-control" ]
5
4
348
4
0
2008-09-22T14:08:23.183000
2008-09-23T03:26:33.623000
115,095
115,133
Retrieve Web Browser Stored Form Data?
I have my web browsers set to save what I type into text boxes on forms. I have a lot of search terms stored in the text box of my browser and would like to get at it via a program of some sort before I clear these values out. There are far too many for me to go through one at a time. The web browser must store this da...
Firefox 3 In Firefox on Windows it's stored in a SQLite file, in: C:\Documents and Settings\ \Application Data \Mozilla\Firefox\Profiles\.default\formhistory.sqlite Once you have the SQLite file, you can put together a script to read the data from it pretty quickly - here's a good primer to using SQLite with PHP 5 for ...
Retrieve Web Browser Stored Form Data? I have my web browsers set to save what I type into text boxes on forms. I have a lot of search terms stored in the text box of my browser and would like to get at it via a program of some sort before I clear these values out. There are far too many for me to go through one at a t...
TITLE: Retrieve Web Browser Stored Form Data? QUESTION: I have my web browsers set to save what I type into text boxes on forms. I have a lot of search terms stored in the text box of my browser and would like to get at it via a program of some sort before I clear these values out. There are far too many for me to go ...
[ "internet-explorer", "firefox", "browser", "cross-browser" ]
0
1
4,398
2
0
2008-09-22T14:19:40.130000
2008-09-22T14:27:04.573000
115,096
115,123
How do I prevent TFS from overwriting a label?
If i make a label in TFS, and later make a new label with the same name... then the old label is replaced by the new one. How do I prevent TFS from overwriting a label?
The following MSDN article covers using the Scope of a label to try and minimize the occurrences of these mishaps: Using the /Child Option to Avoid Labeling Mishaps If you issue a label command together with a pre-existing label name and an itemspec that includes files that are already marked by the same label, the val...
How do I prevent TFS from overwriting a label? If i make a label in TFS, and later make a new label with the same name... then the old label is replaced by the new one. How do I prevent TFS from overwriting a label?
TITLE: How do I prevent TFS from overwriting a label? QUESTION: If i make a label in TFS, and later make a new label with the same name... then the old label is replaced by the new one. How do I prevent TFS from overwriting a label? ANSWER: The following MSDN article covers using the Scope of a label to try and minim...
[ "version-control", "tfs", "label", "overwrite" ]
1
1
1,196
2
0
2008-09-22T14:20:00.377000
2008-09-22T14:26:03.297000
115,098
115,101
CVS: Replace HEAD with a branch
How do I replace the HEAD of a CVS repository with a branch?
Check out this page, which has a pretty easy to follow walk through of branching and merging in CVS http://kb.wisc.edu/middleware/page.php?id=4087 It also includes an example of replacing HEAD with a specified branch Replacing One Branch With Another Tag the end of your branch cvs tag merge_NEW_BRANCH Switch back to th...
CVS: Replace HEAD with a branch How do I replace the HEAD of a CVS repository with a branch?
TITLE: CVS: Replace HEAD with a branch QUESTION: How do I replace the HEAD of a CVS repository with a branch? ANSWER: Check out this page, which has a pretty easy to follow walk through of branching and merging in CVS http://kb.wisc.edu/middleware/page.php?id=4087 It also includes an example of replacing HEAD with a ...
[ "cvs", "branch" ]
14
23
15,974
1
0
2008-09-22T14:20:13.420000
2008-09-22T14:21:22.730000
115,103
2,605,254
How do you implement position-sensitive zooming inside a JScrollPane?
I am trying to implement position-sensitive zooming inside a JScrollPane. The JScrollPane contains a component with a customized paint that will draw itself inside whatever space it is allocated - so zooming is as easy as using a MouseWheelListener that resizes the inner component as required. But I also want zooming i...
Tested this, seems to work... private void updatePreferredSize(int n, Point p) { double d = (double) n * 1.08; d = (n > 0)? 1 / d: -d; int w = (int) (getWidth() * d); int h = (int) (getHeight() * d); preferredSize.setSize(w, h); int offX = (int)(p.x * d) - p.x; int offY = (int)(p.y * d) - p.y; setLocation(getLocation...
How do you implement position-sensitive zooming inside a JScrollPane? I am trying to implement position-sensitive zooming inside a JScrollPane. The JScrollPane contains a component with a customized paint that will draw itself inside whatever space it is allocated - so zooming is as easy as using a MouseWheelListener t...
TITLE: How do you implement position-sensitive zooming inside a JScrollPane? QUESTION: I am trying to implement position-sensitive zooming inside a JScrollPane. The JScrollPane contains a component with a customized paint that will draw itself inside whatever space it is allocated - so zooming is as easy as using a Mo...
[ "java", "swing", "user-interface", "zooming" ]
11
8
7,900
4
0
2008-09-22T14:21:33.947000
2010-04-09T05:27:57.613000
115,108
115,132
Use VBA in Office 2007 Applications?
Is VBA going to go away any time soon, like VB6 has? Should I not develop new Office applications with VBA? Or should I be developing all new Office Apps with VSTO? Update: Recently read this article.
Office VSTO offers a great deal of additional functionality over Office VBA, and while I don't believe Microsoft has signaled that it's going to terminate VBA (in fact, they've said explicitly that it will be around at least until Office 14; Office 2007 = Office 12), I think it's well worth the effort to move your appl...
Use VBA in Office 2007 Applications? Is VBA going to go away any time soon, like VB6 has? Should I not develop new Office applications with VBA? Or should I be developing all new Office Apps with VSTO? Update: Recently read this article.
TITLE: Use VBA in Office 2007 Applications? QUESTION: Is VBA going to go away any time soon, like VB6 has? Should I not develop new Office applications with VBA? Or should I be developing all new Office Apps with VSTO? Update: Recently read this article. ANSWER: Office VSTO offers a great deal of additional functiona...
[ "excel", "vba", "visual-studio", "ms-office", "vsto" ]
4
9
2,177
7
0
2008-09-22T14:22:43.663000
2008-09-22T14:26:48.007000
115,115
115,157
Test Automation with Embedded Hardware
Has anyone had success automating testing directly on embedded hardware? Specifically, I am thinking of automating a battery of unit tests for hardware layer modules. We need to have greater confidence in our hardware layer code. A lot of our projects use interrupt driven timers, ADCs, serial io, serial SPI devices (fl...
Sure. In the automotive industry we use $100,000 custom built testers for each new product to verify the hardware and software are operating correctly. The developers, however, also build a cheaper (sub $1,000) tester that includes a bunch of USB I/O, A/D, PWM in/out, etc and either use scripting on the workstation, or...
Test Automation with Embedded Hardware Has anyone had success automating testing directly on embedded hardware? Specifically, I am thinking of automating a battery of unit tests for hardware layer modules. We need to have greater confidence in our hardware layer code. A lot of our projects use interrupt driven timers, ...
TITLE: Test Automation with Embedded Hardware QUESTION: Has anyone had success automating testing directly on embedded hardware? Specifically, I am thinking of automating a battery of unit tests for hardware layer modules. We need to have greater confidence in our hardware layer code. A lot of our projects use interru...
[ "c++", "c", "unit-testing", "embedded", "testing-strategies" ]
26
22
8,620
9
0
2008-09-22T14:24:16.890000
2008-09-22T14:30:33.770000
115,116
115,120
Should unit test classes be kept under version control with the rest of the code?
If I create a test suite for a development project, should those classes be kept under version control with the rest of the project code?
Yes, there is no reason not to put them in source control. What if the tests change? What if the interfaces change, necessitating that the tests change?
Should unit test classes be kept under version control with the rest of the code? If I create a test suite for a development project, should those classes be kept under version control with the rest of the project code?
TITLE: Should unit test classes be kept under version control with the rest of the code? QUESTION: If I create a test suite for a development project, should those classes be kept under version control with the rest of the project code? ANSWER: Yes, there is no reason not to put them in source control. What if the te...
[ "unit-testing", "version-control" ]
13
31
1,876
13
0
2008-09-22T14:24:18.417000
2008-09-22T14:25:19.693000
115,121
115,211
no respond_to block in edit action (generated with scaffold)?
Does anyone know why there is no respond_to block for generated edit actions? Every other action in typical scaffold controllers has a respond_to block in order to output html and xml formats. Why is the edit action an exception? I'm using the latest version of Ruby on Rails (2.1.1).
Rails handles the 99% case: It's fairly unlikely you'd ever need to do any XML or JSON translations in your Edit action, because non-visually, the Edit action is pretty much just like the Show action. Nonvisual clients that want to update a model in your application can call the controller this way GET /my_models/[:id]...
no respond_to block in edit action (generated with scaffold)? Does anyone know why there is no respond_to block for generated edit actions? Every other action in typical scaffold controllers has a respond_to block in order to output html and xml formats. Why is the edit action an exception? I'm using the latest version...
TITLE: no respond_to block in edit action (generated with scaffold)? QUESTION: Does anyone know why there is no respond_to block for generated edit actions? Every other action in typical scaffold controllers has a respond_to block in order to output html and xml formats. Why is the edit action an exception? I'm using ...
[ "ruby-on-rails", "ruby" ]
7
12
654
3
0
2008-09-22T14:25:38.587000
2008-09-22T14:39:25.370000
115,124
115,739
What are your experiences with Windows Workflow Foundation?
I am evaluating WF for use in line of business applications on the web, and I would love to hear some recent first-hand accounts of this technology. My main interest here is in improving the maintainability of projects and maybe in increasing developer productivity when working on complex processes that change frequent...
Windows Workflow Foundation is a very capable product but still very much in its 1st version:-( The main reasons for use include: Visually modeling business requirements. Separating your business logic from the business rules and externalizing rules as XML files. Separating your business flow from your application by e...
What are your experiences with Windows Workflow Foundation? I am evaluating WF for use in line of business applications on the web, and I would love to hear some recent first-hand accounts of this technology. My main interest here is in improving the maintainability of projects and maybe in increasing developer product...
TITLE: What are your experiences with Windows Workflow Foundation? QUESTION: I am evaluating WF for use in line of business applications on the web, and I would love to hear some recent first-hand accounts of this technology. My main interest here is in improving the maintainability of projects and maybe in increasing...
[ "asp.net", ".net", "workflow", "workflow-foundation" ]
34
22
5,766
12
0
2008-09-22T14:26:06.837000
2008-09-22T16:01:16.127000
115,126
115,187
Strategies for Caching on the Web?
What concerns, processes, and questions do you take into account when deciding when and how to cache. Is it always a no win situation? This presupposes you are stuck with a code base that has been optimized.
I have been working with DotNetNuke most recently for web applications and there are a number of things that I consider each time I implement caching solutions. Do all users need to see cached content? How often does each bit of content change? Can I cache the entire page? Do I need a manual way to purge the cache? Can...
Strategies for Caching on the Web? What concerns, processes, and questions do you take into account when deciding when and how to cache. Is it always a no win situation? This presupposes you are stuck with a code base that has been optimized.
TITLE: Strategies for Caching on the Web? QUESTION: What concerns, processes, and questions do you take into account when deciding when and how to cache. Is it always a no win situation? This presupposes you are stuck with a code base that has been optimized. ANSWER: I have been working with DotNetNuke most recently ...
[ "caching" ]
7
3
1,355
8
0
2008-09-22T14:26:20.237000
2008-09-22T14:35:10.340000
115,159
115,199
When should I use # and = in ASP.NET controls?
I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate. For example: <%= Grid.ClientID %> or <%# Eval("FullName")%> Can someone explain when each should be used so I can keep it straight in my mind? Is # only used in controls that support databinding?
<%= %> is the equivalent of doing Response.Write("") wherever you place it. <%# %> is for Databinding and can only be used where databinding is supported (you can use these on the page-level outside a control if you call Page.DataBind() in your codebehind) Databinding Expressions Overview
When should I use # and = in ASP.NET controls? I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate. For example: <%= Grid.ClientID %> or <%# Eval("FullName")%> Can someone explain when each should be used so I can keep it straight in my mind? Is # only used in controls t...
TITLE: When should I use # and = in ASP.NET controls? QUESTION: I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate. For example: <%= Grid.ClientID %> or <%# Eval("FullName")%> Can someone explain when each should be used so I can keep it straight in my mind? Is # only ...
[ "asp.net", "data-binding" ]
27
24
4,709
3
0
2008-09-22T14:30:57.840000
2008-09-22T14:37:06.030000
115,184
115,243
Does it matter which vendor's JDK you build with?
If I'm deploying to servers with WebSphere 6.1 (Java 1.5), should I use IBM's JDK on my build box? Or will Sun's JDK compile to the same binary? If I should use IBM's, where can I get the Windows x64 version?
I would as much as possible try to keep development as close to production as possible. Ibm and Sun's JDK's certainly both satisfy the SDK certification, but they are by no means identical. Their instrumentation and memory management are at least slightly different. If nothing else, the bugs in the JDK will be differen...
Does it matter which vendor's JDK you build with? If I'm deploying to servers with WebSphere 6.1 (Java 1.5), should I use IBM's JDK on my build box? Or will Sun's JDK compile to the same binary? If I should use IBM's, where can I get the Windows x64 version?
TITLE: Does it matter which vendor's JDK you build with? QUESTION: If I'm deploying to servers with WebSphere 6.1 (Java 1.5), should I use IBM's JDK on my build box? Or will Sun's JDK compile to the same binary? If I should use IBM's, where can I get the Windows x64 version? ANSWER: I would as much as possible try to...
[ "java", "build-process" ]
13
9
5,780
8
0
2008-09-22T14:34:43.930000
2008-09-22T14:44:28.260000
115,210
115,262
How to check whether a file is valid UTF-8?
I'm processing some data files that are supposed to be valid UTF-8 but aren't, which causes the parser (not under my control) to fail. I'd like to add a stage of pre-validating the data for UTF-8 well-formedness, but I've not yet found a utility to help do this. There's a web service at W3C which appears to be dead, an...
You can use GNU iconv: $ iconv -f UTF-8 your_file -o /dev/null; echo $? Or with older versions of iconv, such as on macOS: $ iconv -f UTF-8 your_file > /dev/null; echo $? The command will return 0 if the file could be converted successfully, and 1 if not. Additionally, it will print out the byte offset where the invali...
How to check whether a file is valid UTF-8? I'm processing some data files that are supposed to be valid UTF-8 but aren't, which causes the parser (not under my control) to fail. I'd like to add a stage of pre-validating the data for UTF-8 well-formedness, but I've not yet found a utility to help do this. There's a web...
TITLE: How to check whether a file is valid UTF-8? QUESTION: I'm processing some data files that are supposed to be valid UTF-8 but aren't, which causes the parser (not under my control) to fail. I'd like to add a stage of pre-validating the data for UTF-8 well-formedness, but I've not yet found a utility to help do t...
[ "validation", "utf-8", "internationalization" ]
82
113
92,957
6
0
2008-09-22T14:39:15.543000
2008-09-22T14:48:53.490000
115,222
115,282
Can I safely edit a renamed file in perforce
I have a file I need to move that's already under perforce. Once moved it needs some editing - update the package, etc - appropriate to its new location. Should I submit the move changespec and then reopen it for edit, or can I do this in one go? If so, what is the appropriate sequence of events?
I have done this before in one go, but depending on your build process, I recommend against it. What I generally do is this: Move the file. If the move needs a change in order to compile, open it for edit and make those changes. Submit the changes, telling perforce to reopen the files for editing. Make the changes for ...
Can I safely edit a renamed file in perforce I have a file I need to move that's already under perforce. Once moved it needs some editing - update the package, etc - appropriate to its new location. Should I submit the move changespec and then reopen it for edit, or can I do this in one go? If so, what is the appropria...
TITLE: Can I safely edit a renamed file in perforce QUESTION: I have a file I need to move that's already under perforce. Once moved it needs some editing - update the package, etc - appropriate to its new location. Should I submit the move changespec and then reopen it for edit, or can I do this in one go? If so, wha...
[ "version-control", "perforce" ]
6
7
5,632
5
0
2008-09-22T14:41:20.810000
2008-09-22T14:53:14.277000
115,237
115,238
How to disable a programmatical breakpoint / assert?
I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same debugging session no longer break into the debugger. How can I do this?
x86 / x64 Assuming you are writing x86/x64 application, write following in your watch window: x86: *(char *)eip,x x64: *(char *)rip,x You should see a value 0xcc, which is opcode for INT 3. Replace it with 0x90, which is opcode for NOP. You can also use the memory window with eip as an address. PPC Assuming you are wri...
How to disable a programmatical breakpoint / assert? I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same debugging session no lo...
TITLE: How to disable a programmatical breakpoint / assert? QUESTION: I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same debug...
[ "visual-studio", "debugging", "x86", "assert", "debugbreak" ]
17
37
9,955
2
0
2008-09-22T14:43:25.703000
2008-09-22T14:43:45.483000
115,249
115,286
RegisterStartupScript on Logout page
I am trying to have a logout page where is displays a messages and then redirects to the login page. This is in ASP.net 2.0. I have this in my Page_Load: ClientScript.RegisterStartupScript(typeof(Page), "pageredirect", JavascriptRedirect() ); This is my redirect function: private string JavascriptRedirect() { StringBui...
By the way: You don't need Javascript to redirect the browser to a page after a certain amount of time. Just use a plain HTML meta Tag in your section. The number stands for the time in seconds, the URL for the target.
RegisterStartupScript on Logout page I am trying to have a logout page where is displays a messages and then redirects to the login page. This is in ASP.net 2.0. I have this in my Page_Load: ClientScript.RegisterStartupScript(typeof(Page), "pageredirect", JavascriptRedirect() ); This is my redirect function: private st...
TITLE: RegisterStartupScript on Logout page QUESTION: I am trying to have a logout page where is displays a messages and then redirects to the login page. This is in ASP.net 2.0. I have this in my Page_Load: ClientScript.RegisterStartupScript(typeof(Page), "pageredirect", JavascriptRedirect() ); This is my redirect fu...
[ "asp.net" ]
0
1
1,342
5
0
2008-09-22T14:46:03.840000
2008-09-22T14:54:24.617000
115,269
115,313
Refactoring Java factory method
There's something very unsatisfactory about this code: /* Given a command string in which the first 8 characters are the command name padded on the right with whitespace, construct the appropriate kind of Command object. */ public class CommandFactory { public Command getCommand(String cmd) { cmdName = cmd.subString(0,...
Your map of strings to commands I think is good. You could even factor out the string command name to the constructor (i.e. shouldn't StartCommand know that its command is "START"?) If you could do this, instantiation of your command objects is much simpler: Class c = commandMap.get(cmdName); if (c!= null) return c.new...
Refactoring Java factory method There's something very unsatisfactory about this code: /* Given a command string in which the first 8 characters are the command name padded on the right with whitespace, construct the appropriate kind of Command object. */ public class CommandFactory { public Command getCommand(String c...
TITLE: Refactoring Java factory method QUESTION: There's something very unsatisfactory about this code: /* Given a command string in which the first 8 characters are the command name padded on the right with whitespace, construct the appropriate kind of Command object. */ public class CommandFactory { public Command g...
[ "java", "factory" ]
15
12
6,990
18
0
2008-09-22T14:50:58.353000
2008-09-22T14:58:14.203000
115,277
115,378
Fast search in java swing applications?
I'm wandering myself what component is the best for displaying fast search results in swing. I want to create something like this, make a text field where user can enter some text, during his entering I'll improve in back end fast search on database, and I want to show data bellow the text box, and he will be able to b...
Are you looking for something like an AutoComplete component for Java Swing? SwingX has such a component. See here for the JavaDoc. It has a lot of utility methods to do various things, i.e. auto-completing a text box from the contents of a JList.
Fast search in java swing applications? I'm wandering myself what component is the best for displaying fast search results in swing. I want to create something like this, make a text field where user can enter some text, during his entering I'll improve in back end fast search on database, and I want to show data bello...
TITLE: Fast search in java swing applications? QUESTION: I'm wandering myself what component is the best for displaying fast search results in swing. I want to create something like this, make a text field where user can enter some text, during his entering I'll improve in back end fast search on database, and I want ...
[ "java", "swing", "search" ]
2
6
4,201
6
0
2008-09-22T14:52:04.857000
2008-09-22T15:09:33.957000
115,281
115,312
error when switching to different svn branch
I've got two SVN branches (eg development and stable) and want to switch from one to another... In every tutorial there is command like: rootOfLocalSvnCopy:>svn switch urlToNewBranch. But it leads in error in my case: svn: REPORT request failed on '/svn/rootOfLocalSvnCopy/!svn/vcc/default' svn: Cannot replace a directo...
OK, I get it work. Error was in dot that I used to specify local directory in a command. correct usage is without it, svn can handle it all itself: rootOfLocalSvnCopy:>svn switch urlToNewBranch (No dot at the end...)
error when switching to different svn branch I've got two SVN branches (eg development and stable) and want to switch from one to another... In every tutorial there is command like: rootOfLocalSvnCopy:>svn switch urlToNewBranch. But it leads in error in my case: svn: REPORT request failed on '/svn/rootOfLocalSvnCopy/!s...
TITLE: error when switching to different svn branch QUESTION: I've got two SVN branches (eg development and stable) and want to switch from one to another... In every tutorial there is command like: rootOfLocalSvnCopy:>svn switch urlToNewBranch. But it leads in error in my case: svn: REPORT request failed on '/svn/roo...
[ "svn", "branch", "switch-statement" ]
2
5
2,023
1
0
2008-09-22T14:52:33
2008-09-22T14:58:06.823000
115,283
115,511
Which Reporting technology?
Which reporting technology would fit for the best situation/type of product? I am now thinking of 3 technologies: Embedded Reports (Crystal Reports;MS Reporting services) Server reports (MS Reporting Services) OLAP Databases (MS Analysis Services) Which report technology would you use for an off the shelf product? Is i...
OLAP isn't a reporting platform, it's in the database layer. If you're going to have a collection of pre-planned, canned reports, then Crystal or RS are the best ideas. Personally I prefer Crystal but it can be quite a pain to develop reports - but when they're approved, Crystal is a rock steady platform. (We integrate...
Which Reporting technology? Which reporting technology would fit for the best situation/type of product? I am now thinking of 3 technologies: Embedded Reports (Crystal Reports;MS Reporting services) Server reports (MS Reporting Services) OLAP Databases (MS Analysis Services) Which report technology would you use for an...
TITLE: Which Reporting technology? QUESTION: Which reporting technology would fit for the best situation/type of product? I am now thinking of 3 technologies: Embedded Reports (Crystal Reports;MS Reporting services) Server reports (MS Reporting Services) OLAP Databases (MS Analysis Services) Which report technology wo...
[ "reporting" ]
4
3
3,560
6
0
2008-09-22T14:53:33.307000
2008-09-22T15:27:39.217000
115,291
1,946,330
How much speed-up from converting 3D maths to SSE or other SIMD?
I am using 3D maths in my application extensively. How much speed-up can I achieve by converting my vector/matrix library to SSE, AltiVec or a similar SIMD code?
In my experience I typically see about a 3x improvement in taking an algorithm from x87 to SSE, and a better than 5x improvement in going to VMX/Altivec (because of complicated issues having to do with pipeline depth, scheduling, etc). But I usually only do this in cases where I have hundreds or thousands of numbers to...
How much speed-up from converting 3D maths to SSE or other SIMD? I am using 3D maths in my application extensively. How much speed-up can I achieve by converting my vector/matrix library to SSE, AltiVec or a similar SIMD code?
TITLE: How much speed-up from converting 3D maths to SSE or other SIMD? QUESTION: I am using 3D maths in my application extensively. How much speed-up can I achieve by converting my vector/matrix library to SSE, AltiVec or a similar SIMD code? ANSWER: In my experience I typically see about a 3x improvement in taking ...
[ "optimization", "x86", "native", "sse", "simd" ]
10
7
5,010
7
0
2008-09-22T14:55:20.323000
2009-12-22T13:20:27.077000
115,295
247,294
Do you know a good open-source version-control viewer?
I'm looking for a tool like Atlassian's FishEye. The alternatives I've found so far (like StatCVS, ViewCVS or Bonsai ) are either lacking in features or are quite a pain to install and maintain. So before staying with one of these tools, I'd like to be sure I did not miss any other good, easy to install, open-source (p...
ViewVC is a good open source, web based, repository viewer similar to FishEye. I know you've looked at it, and you're right, it was a hassle to set up, but once setup, it's run without any intervention for almost three years for us.
Do you know a good open-source version-control viewer? I'm looking for a tool like Atlassian's FishEye. The alternatives I've found so far (like StatCVS, ViewCVS or Bonsai ) are either lacking in features or are quite a pain to install and maintain. So before staying with one of these tools, I'd like to be sure I did n...
TITLE: Do you know a good open-source version-control viewer? QUESTION: I'm looking for a tool like Atlassian's FishEye. The alternatives I've found so far (like StatCVS, ViewCVS or Bonsai ) are either lacking in features or are quite a pain to install and maintain. So before staying with one of these tools, I'd like ...
[ "version-control", "cvs", "atlassian-fisheye" ]
6
1
1,783
5
0
2008-09-22T14:55:36.377000
2008-10-29T15:40:12.080000
115,306
115,327
Does it make sense to mix an RTOS and cyclic executive?
On a small embedded system project we have some code which we would like to run in a thread so we are electing to build in top of an embedded RTOS (eCos). Previously, we have used a cyclic executive in main() that drove tasks each implemented as a state machine. For some tasks we encountered problems where the task wou...
This is a perfectly valid design. In one of our product, we used a similar design, where the asynchronous I/O channels (TCP/IP, 2 serial streams) were in their own tasks and we had a "main" task which would be responsible for multiple areas of functionality. Think of tasks as simply a partitioning mechanism that allows...
Does it make sense to mix an RTOS and cyclic executive? On a small embedded system project we have some code which we would like to run in a thread so we are electing to build in top of an embedded RTOS (eCos). Previously, we have used a cyclic executive in main() that drove tasks each implemented as a state machine. F...
TITLE: Does it make sense to mix an RTOS and cyclic executive? QUESTION: On a small embedded system project we have some code which we would like to run in a thread so we are electing to build in top of an embedded RTOS (eCos). Previously, we have used a cyclic executive in main() that drove tasks each implemented as ...
[ "multithreading", "embedded", "rtos" ]
8
7
1,181
4
0
2008-09-22T14:57:08.557000
2008-09-22T15:01:36.580000
115,328
115,351
How can I do Databinding in c#?
I have the following class public class Car { public Name {get; set;} } and I want to bind this programmatically to a text box. How do I do that? Shooting in the dark:... Car car = new Car(); TextEdit editBox = new TextEdit(); editBox.DataBinding.Add("Name", car, "Car - Name");... I get the following error "Cannot bind...
You want editBox.DataBindings.Add("Text", car, "Name"); The first parameter is the name of the property on the control that you want to be databound, the second is the data source, the third parameter is the property on the data source that you want to bind to.
How can I do Databinding in c#? I have the following class public class Car { public Name {get; set;} } and I want to bind this programmatically to a text box. How do I do that? Shooting in the dark:... Car car = new Car(); TextEdit editBox = new TextEdit(); editBox.DataBinding.Add("Name", car, "Car - Name");... I get ...
TITLE: How can I do Databinding in c#? QUESTION: I have the following class public class Car { public Name {get; set;} } and I want to bind this programmatically to a text box. How do I do that? Shooting in the dark:... Car car = new Car(); TextEdit editBox = new TextEdit(); editBox.DataBinding.Add("Name", car, "Car -...
[ "c#", "winforms", "data-binding" ]
36
53
35,966
10
0
2008-09-22T15:01:38.173000
2008-09-22T15:05:02.097000