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
190,059
190,163
Building windows c++ libraries without a runtime?
I'm trying to create a c++ library for use on windows/MSVC. My problem is that it seems that in order to link properly, I need to distribute a bunch of different versions, linked against different versions of MSVC's c++ runtimes - single and multi-threaded, debug and release, different compiler versions, various other ...
You want static linking, as a general answer. Quick note on Chris' answer (don't want to de-boost cause it's mostly good, but...): DO NOT link to msvcrt.dll (the unversioned one); this is the OS-specific version DLL, and if you link to it, your app probably will not work on other versions of Windows. You should always ...
Building windows c++ libraries without a runtime? I'm trying to create a c++ library for use on windows/MSVC. My problem is that it seems that in order to link properly, I need to distribute a bunch of different versions, linked against different versions of MSVC's c++ runtimes - single and multi-threaded, debug and re...
TITLE: Building windows c++ libraries without a runtime? QUESTION: I'm trying to create a c++ library for use on windows/MSVC. My problem is that it seems that in order to link properly, I need to distribute a bunch of different versions, linked against different versions of MSVC's c++ runtimes - single and multi-thre...
[ "c++", "visual-c++", "runtime" ]
5
6
2,396
3
0
2008-10-10T03:46:31.953000
2008-10-10T04:50:15.367000
190,066
359,658
What is the best way to use the .SaveChanges() method in ADO.Net Data Services?
Does anyone have some good information on the usage of the.SaveChanges() method? I am experiencing a variety of issues when attempting to use the.SaveChanges() method on my data context object. I am taking data from an existing data source, creating the appropriate EntityFramework/DataService objects, populating those ...
I have no big experience in using EntityFramework (just some random experiment), have you tried calling.SaveChanges() every n iterations? I mean something like this: int i = 0; foreach (var item in collection) { // do something with your data if ((i++ % 10) == 0) context.SaveChanges(); } context.SaveChanges(); I know i...
What is the best way to use the .SaveChanges() method in ADO.Net Data Services? Does anyone have some good information on the usage of the.SaveChanges() method? I am experiencing a variety of issues when attempting to use the.SaveChanges() method on my data context object. I am taking data from an existing data source,...
TITLE: What is the best way to use the .SaveChanges() method in ADO.Net Data Services? QUESTION: Does anyone have some good information on the usage of the.SaveChanges() method? I am experiencing a variety of issues when attempting to use the.SaveChanges() method on my data context object. I am taking data from an exi...
[ "entity-framework", "wcf-data-services", "savechanges" ]
9
4
4,045
2
0
2008-10-10T03:49:53.273000
2008-12-11T15:09:01.740000
190,108
190,120
why won't it post these results?
I am having trouble grabbing the values from the form once processed. I need your help. function updateUser($table, $id) { if($_POST) { processUpdate($table, $id); } else { updateForm($table, $id); } } function processUpdate($table, $id) { print $table; //testing print $id; //testing $email=addslashes($HTTP_POST_VAR...
Is the method attribute of the form set to post? And are all of the input's name attribute set right? Have you looked at the html output to make sure that there were no syntax errors? Also, try using $_POST instead of $HTTP_POST_VARS
why won't it post these results? I am having trouble grabbing the values from the form once processed. I need your help. function updateUser($table, $id) { if($_POST) { processUpdate($table, $id); } else { updateForm($table, $id); } } function processUpdate($table, $id) { print $table; //testing print $id; //testing ...
TITLE: why won't it post these results? QUESTION: I am having trouble grabbing the values from the form once processed. I need your help. function updateUser($table, $id) { if($_POST) { processUpdate($table, $id); } else { updateForm($table, $id); } } function processUpdate($table, $id) { print $table; //testing pri...
[ "php", "mysql", "html" ]
1
1
168
2
0
2008-10-10T04:17:37.743000
2008-10-10T04:25:18.740000
190,125
190,169
NHibernate Order By question
Ok, so I have an nHibernate ICriteria that returns an object. I want to order by a single property but NOT asc or desc I want certain values of the property to come to the top of the repeater based on the selection. Like if I choose "video" I want all records with videos to come to the top. Now, can I do this in the qu...
Well...if you can't figure out how to do it with NHibernate, you could always use linq-to-objects, then bind your repeater to that: var bubbleVideos = from item in criteriaList orderby (item.ItemType == "video"? 0: 1) select item; repeater.DataSource = bubbleVideos.ToList();
NHibernate Order By question Ok, so I have an nHibernate ICriteria that returns an object. I want to order by a single property but NOT asc or desc I want certain values of the property to come to the top of the repeater based on the selection. Like if I choose "video" I want all records with videos to come to the top....
TITLE: NHibernate Order By question QUESTION: Ok, so I have an nHibernate ICriteria that returns an object. I want to order by a single property but NOT asc or desc I want certain values of the property to come to the top of the repeater based on the selection. Like if I choose "video" I want all records with videos t...
[ "c#", ".net", "sql", "nhibernate" ]
3
3
3,852
1
0
2008-10-10T04:29:19.403000
2008-10-10T04:56:14.590000
190,130
190,159
Where and how does Windows XP store wep/wpa keys?
Like the title says Where and How (i.e. if encrypted, with what method) does Windows XP store WEP/WPA Keys?
I found this: http://msdn.microsoft.com/en-us/library/ms706987(VS.85).aspx.
Where and how does Windows XP store wep/wpa keys? Like the title says Where and How (i.e. if encrypted, with what method) does Windows XP store WEP/WPA Keys?
TITLE: Where and how does Windows XP store wep/wpa keys? QUESTION: Like the title says Where and How (i.e. if encrypted, with what method) does Windows XP store WEP/WPA Keys? ANSWER: I found this: http://msdn.microsoft.com/en-us/library/ms706987(VS.85).aspx.
[ "windows", "windows-vista" ]
2
1
1,807
1
0
2008-10-10T04:34:02.890000
2008-10-10T04:48:24.733000
190,138
190,153
VB.NET Strong-typed collection
I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo". I thought I could do this using generics, using the following syntax: Public Cla...
Why don't you just use a List(Of Foo)... It is already in VB.NET under System.Collections.Generic. To use, simply declare as such: Private myList As New List(Of Foo) 'Creates a Foo List' Private myIntList As New List(Of Integer) 'Creates an Integer List' See MSDN > List(T) Class (System.Collections.Generic) for more in...
VB.NET Strong-typed collection I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo". I thought I could do this using generics, using t...
TITLE: VB.NET Strong-typed collection QUESTION: I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo". I thought I could do this using...
[ "vb.net", "generics", "class", "collections" ]
10
10
12,523
2
0
2008-10-10T04:39:25.577000
2008-10-10T04:45:21.040000
190,143
190,216
Is there an equivalent to Thread.sleep when dealing with Eclipse Jobs?
I am writing Eclipse plugins where there are quite a few running jobs. In some cases, I want the job to "sleep" for a while at the current point of execution and continue from that spot (rather than reschedule the job and start it from scratch). My understanding is that using Thread.sleep within Eclipse jobs is quite d...
I think your best bet may be to reschedule the job and pick up where you left off. Something like: class MyJob { int state; IStatus run(IProgressMonitor m) { if (state == 0) { phase1(); schedule(1000); } else if (state == 1) { phase2(); } return Status.OK; } void phase1() { state = 1; } void phase2() { state = 2; } }
Is there an equivalent to Thread.sleep when dealing with Eclipse Jobs? I am writing Eclipse plugins where there are quite a few running jobs. In some cases, I want the job to "sleep" for a while at the current point of execution and continue from that spot (rather than reschedule the job and start it from scratch). My ...
TITLE: Is there an equivalent to Thread.sleep when dealing with Eclipse Jobs? QUESTION: I am writing Eclipse plugins where there are quite a few running jobs. In some cases, I want the job to "sleep" for a while at the current point of execution and continue from that spot (rather than reschedule the job and start it ...
[ "eclipse", "scheduling", "sleep" ]
2
3
925
1
0
2008-10-10T04:42:01.577000
2008-10-10T05:23:23.443000
190,145
190,321
How to insert emoticons in LaTeX?
I know it's a long shot, but is there some package or means to insert emoticons into a LaTeX document?
I know at least two partial ways: First: $\ddot\smile$ Second: \usepackage{wasysym} \smiley \frownie Or you can use images (as mentioned in other replies).
How to insert emoticons in LaTeX? I know it's a long shot, but is there some package or means to insert emoticons into a LaTeX document?
TITLE: How to insert emoticons in LaTeX? QUESTION: I know it's a long shot, but is there some package or means to insert emoticons into a LaTeX document? ANSWER: I know at least two partial ways: First: $\ddot\smile$ Second: \usepackage{wasysym} \smiley \frownie Or you can use images (as mentioned in other replies).
[ "latex", "emoticons" ]
40
41
72,561
8
0
2008-10-10T04:42:28.707000
2008-10-10T06:27:55.593000
190,157
191,401
Cross-component Communication within a View (MVC)
What are some best practices to orchestrate the interaction between complex components that are in your View? I'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deserve being unit tested on their own. Would you: Define abstract interf...
Option #3 sounds like the Mediator pattern and is often the best approach when the update logic and communication between the objects is complex. It also has the added advantage of keeping the control logic and initialization centralized which tends to make tracing through and debugging these types of cases easier.
Cross-component Communication within a View (MVC) What are some best practices to orchestrate the interaction between complex components that are in your View? I'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deserve being unit test...
TITLE: Cross-component Communication within a View (MVC) QUESTION: What are some best practices to orchestrate the interaction between complex components that are in your View? I'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deser...
[ "model-view-controller", "design-patterns" ]
5
4
915
2
0
2008-10-10T04:47:37.557000
2008-10-10T13:58:43.080000
190,160
192,585
How do I create the migrations for a legacy database?
I am currently developing a Rails application using a database that was designed before I was aware of Rails existence. I have currently created some migrations to add some new tables and new columns to existing tables. I would like to have the migrations to recreate the full database. Which steps should I follow? Shou...
I think this will require some manual work. You can start out by running rake db:schema:dump if you do not have the file db/schema.rb in your project. You probably already have a db/schema.rb file if you have been using migrations. That file will contain the ruby representation of the database you have configured for d...
How do I create the migrations for a legacy database? I am currently developing a Rails application using a database that was designed before I was aware of Rails existence. I have currently created some migrations to add some new tables and new columns to existing tables. I would like to have the migrations to recreat...
TITLE: How do I create the migrations for a legacy database? QUESTION: I am currently developing a Rails application using a database that was designed before I was aware of Rails existence. I have currently created some migrations to add some new tables and new columns to existing tables. I would like to have the mig...
[ "ruby-on-rails", "migration" ]
1
3
2,113
3
0
2008-10-10T04:49:09.537000
2008-10-10T18:38:13.703000
190,162
190,177
How do you maintain your multi-language application?
How do you keep the spoken languages strings in your program up to date? Is there an inexpensive way? Where can you find people to do the conversions over time?
There are companies which will translate resource files in the standard formats for fees; I think that's how most large companies do it. I asked a similar question recently here about the best way to structure code in a project to support this, with my additional desire to preserve the readable strings in code. This is...
How do you maintain your multi-language application? How do you keep the spoken languages strings in your program up to date? Is there an inexpensive way? Where can you find people to do the conversions over time?
TITLE: How do you maintain your multi-language application? QUESTION: How do you keep the spoken languages strings in your program up to date? Is there an inexpensive way? Where can you find people to do the conversions over time? ANSWER: There are companies which will translate resource files in the standard formats...
[ "desktop-application", "multilingual" ]
1
1
915
5
0
2008-10-10T04:50:13.107000
2008-10-10T05:02:16.950000
190,168
190,437
Persisting an environment variable through Ruby
I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script set_abc_env.rb to set environment variable 'ABC' to 'blah', I expect to run the following: C:> echo %ABC% C:> set_abc_env.rb C:> echo %ABC% blah How do I do this?
You can access environment variables via Ruby ENV object: i = ENV['ABC']; # nil ENV['ABC'] = '123'; i = ENV['ABC']; # '123' Bad news is, as MSDN says, a process can never directly change the environment variables of another process that is not a child of that process. So when script exits, you lose all changes it did. ...
Persisting an environment variable through Ruby I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script set_abc_env.rb to set environment variable 'ABC' to 'blah', I expect to run the following: C:> echo %ABC% C:> set_abc_env.rb C:> echo %...
TITLE: Persisting an environment variable through Ruby QUESTION: I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script set_abc_env.rb to set environment variable 'ABC' to 'blah', I expect to run the following: C:> echo %ABC% C:> set_abc...
[ "windows", "ruby", "environment-variables", "dos" ]
9
25
9,416
2
0
2008-10-10T04:54:45.373000
2008-10-10T07:41:22.183000
190,184
190,208
execv() and const-ness
I often use the execv() function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this: const char *args[4]; args[0] = "/usr/bin/whatever"; args[1] = filename.c_str(); args[2] = someparameter.c_str(); args[3] = 0; execv(args[0], args); This doesn't compile because execv() takes c...
The Open Group Base Specifications explains why this is: for compatibility with existing C code. Neither the pointers nor the string contents themselves are intended to be changed, though. Thus, in this case, you can get away with const_cast -ing the result of c_str(). Quote: The statement about argv[] and envp[] being...
execv() and const-ness I often use the execv() function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this: const char *args[4]; args[0] = "/usr/bin/whatever"; args[1] = filename.c_str(); args[2] = someparameter.c_str(); args[3] = 0; execv(args[0], args); This doesn't compile ...
TITLE: execv() and const-ness QUESTION: I often use the execv() function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this: const char *args[4]; args[0] = "/usr/bin/whatever"; args[1] = filename.c_str(); args[2] = someparameter.c_str(); args[3] = 0; execv(args[0], args); Thi...
[ "c++", "unix" ]
38
42
10,148
4
0
2008-10-10T05:06:55.460000
2008-10-10T05:20:20.143000
190,198
190,226
Why isn't my .net-calculated MD5 hash equivalent to the hash calculated on a web site?
I am trying to generate equivalent MD5 hashes in both JavaScript and.Net. Not having done either, I decided to use against a third party calculation - this web site for the word "password". I will add in salts later, but at the moment, I can't get the.net version to match up with the web site's hash: 5f4dcc3b5aa765d61d...
Running the code from the MSDN site you quote: // Hash an input string and return the hash as // a 32 character hexadecimal string. static string getMd5Hash(string input) { // Create a new instance of the MD5CryptoServiceProvider object. MD5 md5Hasher = MD5.Create(); // Convert the input string to a byte array and com...
Why isn't my .net-calculated MD5 hash equivalent to the hash calculated on a web site? I am trying to generate equivalent MD5 hashes in both JavaScript and.Net. Not having done either, I decided to use against a third party calculation - this web site for the word "password". I will add in salts later, but at the momen...
TITLE: Why isn't my .net-calculated MD5 hash equivalent to the hash calculated on a web site? QUESTION: I am trying to generate equivalent MD5 hashes in both JavaScript and.Net. Not having done either, I decided to use against a third party calculation - this web site for the word "password". I will add in salts later...
[ ".net", "security", "hash", "cryptography" ]
5
9
4,351
6
0
2008-10-10T05:16:32.100000
2008-10-10T05:28:22.390000
190,204
190,237
Is java.util.regexp efficient enough?
I need to do a lot of searches of certain patterns in source files while the user is changing them, so I need to do regexp matching that is efficient in time and memory. The pattern repeats itself so should be compiled once, but I need to be able to retrieve subparts (rather than just confirm a match) I'm considering u...
I am not sure there is a huge performance gap in term of the different regexp java engines. But there sure is a performance issue when constructing a regexp (and that is, if the data is large enough, as noted by Jeff Atwood ) The only thing you should avoid is catastrophic backtracking, better avoided when using atomic...
Is java.util.regexp efficient enough? I need to do a lot of searches of certain patterns in source files while the user is changing them, so I need to do regexp matching that is efficient in time and memory. The pattern repeats itself so should be compiled once, but I need to be able to retrieve subparts (rather than j...
TITLE: Is java.util.regexp efficient enough? QUESTION: I need to do a lot of searches of certain patterns in source files while the user is changing them, so I need to do regexp matching that is efficient in time and memory. The pattern repeats itself so should be compiled once, but I need to be able to retrieve subpa...
[ "java", "regex" ]
5
9
7,221
3
0
2008-10-10T05:18:41.520000
2008-10-10T05:33:51.007000
190,224
190,347
JUnit and junit.framework.TestSuite - No runnable methods
I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests. Odd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fine, altough when I'm trying the same thing with the test suite there's alway...
I'm not experienced in ant - so I'm not using it for testing it right now. Searching the internet it seems like I'm mixing up the old jUnit 3.8 and jUnit 4.0 behavior. Trying now a way to use the "new behavior" edited: now it works: AllTest changed to: import org.junit.runner.RunWith; import org.junit.runners.Suite; im...
JUnit and junit.framework.TestSuite - No runnable methods I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests. Odd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fine, altough when I...
TITLE: JUnit and junit.framework.TestSuite - No runnable methods QUESTION: I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests. Odd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fi...
[ "java", "unit-testing", "junit" ]
6
6
18,412
4
0
2008-10-10T05:28:07.663000
2008-10-10T06:51:08.073000
190,227
190,254
Building a LINQ query programmatically without local variables tricking me
Assume my objects are in perfect working order (i.e. TDD makes me think they work). I have a list that I create like this (except indented properly): var result = from v in vendors from p in v.Products orderby p.Name select p; This works - I get all products from all vendors. Now I have a list of conditions, built up a...
(Edited for clarity.) The problem is the foreach loop, and the fact that the "a" variable is being captured and then changed each time. Here's a modification which will work, by effectively introducing a "new" variable for each iteration of the loop, and capturing that new variable. foreach (Attribute a in requiredAttr...
Building a LINQ query programmatically without local variables tricking me Assume my objects are in perfect working order (i.e. TDD makes me think they work). I have a list that I create like this (except indented properly): var result = from v in vendors from p in v.Products orderby p.Name select p; This works - I get...
TITLE: Building a LINQ query programmatically without local variables tricking me QUESTION: Assume my objects are in perfect working order (i.e. TDD makes me think they work). I have a list that I create like this (except indented properly): var result = from v in vendors from p in v.Products orderby p.Name select p; ...
[ "c#", "linq" ]
13
20
5,553
3
0
2008-10-10T05:28:32.390000
2008-10-10T05:41:27.963000
190,229
190,235
Where is the itoa function in Linux?
itoa() is a really handy function to convert a number to a string. Linux does not seem to have itoa(), is there an equivalent function or do I have to use sprintf(str, "%d", num)?
EDIT: Sorry, I should have remembered that this machine is decidedly non-standard, having plugged in various non-standard libc implementations for academic purposes;-) As itoa() is indeed non-standard, as mentioned by several helpful commenters, it is best to use sprintf(target_string,"%d",source_int) or (better yet, b...
Where is the itoa function in Linux? itoa() is a really handy function to convert a number to a string. Linux does not seem to have itoa(), is there an equivalent function or do I have to use sprintf(str, "%d", num)?
TITLE: Where is the itoa function in Linux? QUESTION: itoa() is a really handy function to convert a number to a string. Linux does not seem to have itoa(), is there an equivalent function or do I have to use sprintf(str, "%d", num)? ANSWER: EDIT: Sorry, I should have remembered that this machine is decidedly non-sta...
[ "c", "linux" ]
171
126
362,866
18
0
2008-10-10T05:29:51.280000
2008-10-10T05:31:24.177000
190,232
190,268
Can a recursive function be inline?
inline int factorial(int n) { if(!n) return 1; else return n*factorial(n-1); } As I was reading this, found that the above code would lead to "infinite compilation" if not handled by compiler correctly. How does the compiler decide whether to inline a function or not?
First, the inline specification on a function is just a hint. The compiler can (and often does) completely ignore the presence or absence of an inline qualifier. With that said, a compiler can inline a recursive function, much as it can unroll an infinite loop. It simply has to place a limit on the level to which it wi...
Can a recursive function be inline? inline int factorial(int n) { if(!n) return 1; else return n*factorial(n-1); } As I was reading this, found that the above code would lead to "infinite compilation" if not handled by compiler correctly. How does the compiler decide whether to inline a function or not?
TITLE: Can a recursive function be inline? QUESTION: inline int factorial(int n) { if(!n) return 1; else return n*factorial(n-1); } As I was reading this, found that the above code would lead to "infinite compilation" if not handled by compiler correctly. How does the compiler decide whether to inline a function or no...
[ "c++", "c", "compiler-construction" ]
158
159
54,467
9
0
2008-10-10T05:30:44.460000
2008-10-10T05:47:13.117000
190,243
190,317
How to acquire specific revision of a newly added file from CVS via command line?
One of our internally written tool is fed a cvs commit trace of the form: Checking in src/com/package/AFile.java; /home/cvs/src/com/package/AFile.java,v <-- Afile.java new revision: 1.1.2.56; previous revision: 1.1.2.55 done The tool then acquires the file from cvs by issuing a cvs update -r 1.1.2.56 command in a worki...
It is not clear what is your final goal: to bring whole repository into required state (choosen revision of the choosen branch) or to acquire the single file from the repository for further processing. I assume it is the latter. Then, you need this command: cvs checkout -r -p filename.ext > ~/tmp/filename.ext This will...
How to acquire specific revision of a newly added file from CVS via command line? One of our internally written tool is fed a cvs commit trace of the form: Checking in src/com/package/AFile.java; /home/cvs/src/com/package/AFile.java,v <-- Afile.java new revision: 1.1.2.56; previous revision: 1.1.2.55 done The tool then...
TITLE: How to acquire specific revision of a newly added file from CVS via command line? QUESTION: One of our internally written tool is fed a cvs commit trace of the form: Checking in src/com/package/AFile.java; /home/cvs/src/com/package/AFile.java,v <-- Afile.java new revision: 1.1.2.56; previous revision: 1.1.2.55 ...
[ "version-control", "command-line", "cvs" ]
9
25
25,876
6
0
2008-10-10T05:35:54.357000
2008-10-10T06:21:19.397000
190,251
190,327
Can you divide one alias by another in MySQL?
I have a multi-table query, similar to this (simplified version) SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating FROM table1 LEFT JOIN table2 ON table1.dom_id = table2.rev_domain_from WHERE dom_lastreview!= 0 AND rev_status = 1 GROUP BY dom_url ORDER BY sum_rev_rating/rev_cou...
You're not able to do calculations with aliases. One way of doing this would be to simply create another alias and order by that. SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating, sum(table2.rev_rating)/count(table2.rev_id) as avg_rev_rating FROM table1 LEFT JOIN table2 ON tab...
Can you divide one alias by another in MySQL? I have a multi-table query, similar to this (simplified version) SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating FROM table1 LEFT JOIN table2 ON table1.dom_id = table2.rev_domain_from WHERE dom_lastreview!= 0 AND rev_status = 1 GR...
TITLE: Can you divide one alias by another in MySQL? QUESTION: I have a multi-table query, similar to this (simplified version) SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating FROM table1 LEFT JOIN table2 ON table1.dom_id = table2.rev_domain_from WHERE dom_lastreview!= 0 AND...
[ "mysql" ]
11
15
12,522
2
0
2008-10-10T05:40:38.760000
2008-10-10T06:36:23.967000
190,253
190,255
jQuery selector regular expressions
I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector. I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is? EDIT: The attribute filters al...
James Padolsey created a wonderful filter that allows regex to be used for selection. Say you have the following div: Padolsey's:regex filter can select it like so: $("div:regex(class,.*sd.*)") Also, check the official documentation on selectors. UPDATE:: syntax Deprecation JQuery 3.0 Since jQuery.expr[':'] used in Pad...
jQuery selector regular expressions I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector. I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the synta...
TITLE: jQuery selector regular expressions QUESTION: I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector. I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documenta...
[ "javascript", "jquery", "regex", "jquery-selectors" ]
646
361
496,197
10
0
2008-10-10T05:40:48.353000
2008-10-10T05:41:58.557000
190,257
195,556
Best Role-Based Access Control (RBAC) database model
What is the best database schema to track role-based access controls for a web application? I am using Rails, but the RBAC plugin linked by Google looks unmaintained (only 300 commits to SVN; latest was almost a year ago). The concept is simple enough to implement from scratch, yet complex and important enough that it'...
To my rather basic knowledge in that area, the basic actors of an RBAC are: Resources. Permissions. Users. Roles (i.e. Groups). Resources <- require -> ( one or many ) Permissions. Roles <- are collections of -> ( one or many ) Permissions. Users <- can have -> ( one or many ) Roles. The tables for such a model would b...
Best Role-Based Access Control (RBAC) database model What is the best database schema to track role-based access controls for a web application? I am using Rails, but the RBAC plugin linked by Google looks unmaintained (only 300 commits to SVN; latest was almost a year ago). The concept is simple enough to implement fr...
TITLE: Best Role-Based Access Control (RBAC) database model QUESTION: What is the best database schema to track role-based access controls for a web application? I am using Rails, but the RBAC plugin linked by Google looks unmaintained (only 300 commits to SVN; latest was almost a year ago). The concept is simple enou...
[ "ruby-on-rails", "permissions", "roles", "access-control", "rbac" ]
54
86
60,195
10
0
2008-10-10T05:42:48.927000
2008-10-12T14:36:01.070000
190,263
190,366
Localization testing, formatting all strings with XXXXX
We are trying to look at optimizing our localization testing. Our QA group had a suggestion of a special mode to force all strings from the resources to be entirely contained of X. We already API hijack LoadString, and the MFC implementation of it, so doing it should not be a major hurdle. My question is how would you ...
If this approach is to highlight formatted strings (or format sequences) in the application (i.e. all text appearing other than XXXX), you could locate the escape sequence (using regex perhaps) and insert block quotes around the formatted (substituted) values, e.g. Some\ntext -> Some[\n]text You get readability (all st...
Localization testing, formatting all strings with XXXXX We are trying to look at optimizing our localization testing. Our QA group had a suggestion of a special mode to force all strings from the resources to be entirely contained of X. We already API hijack LoadString, and the MFC implementation of it, so doing it sho...
TITLE: Localization testing, formatting all strings with XXXXX QUESTION: We are trying to look at optimizing our localization testing. Our QA group had a suggestion of a special mode to force all strings from the resources to be entirely contained of X. We already API hijack LoadString, and the MFC implementation of i...
[ "c++", "mfc", "localization" ]
3
3
1,336
6
0
2008-10-10T05:45:27.317000
2008-10-10T07:01:38.347000
190,265
190,277
Searching byte[]
Searching for a string within a string is extremely well supported in.NET but what do you do when the data you need to search isn't a string? I have binary data arriving in regular chunks via a NetworkStream. Packets are binary but they all start with a signature sequence of bytes. I accumulate the chunks into a larger...
You can use Array.IndexOf to find a single byte. However, I would caution you that some valid data might accidentally be your signature and completely throw off your application. A better solution in my opinion would be to always send a four byte integer that contains the size of the packet. Then read that many bytes i...
Searching byte[] Searching for a string within a string is extremely well supported in.NET but what do you do when the data you need to search isn't a string? I have binary data arriving in regular chunks via a NetworkStream. Packets are binary but they all start with a signature sequence of bytes. I accumulate the chu...
TITLE: Searching byte[] QUESTION: Searching for a string within a string is extremely well supported in.NET but what do you do when the data you need to search isn't a string? I have binary data arriving in regular chunks via a NetworkStream. Packets are binary but they all start with a signature sequence of bytes. I ...
[ ".net", "search", "binary" ]
6
3
463
3
0
2008-10-10T05:46:22.057000
2008-10-10T05:50:58.630000
190,270
190,276
Installing ASP.Net 2.0 after IIS
I just got a dedicated server from a hosting company, and for some reason, it didn't have IIS installed. It did have.Net 2.0, though. So I installed IIS, but now my ASP.net websites won't work. I just get a 404, no event log entries, nothing... I noticed in the redistributable package information that: "To access the f...
run from the command line aspnet_regiis -i You may have to navigate to the folder it was installed. Mine and the default is C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
Installing ASP.Net 2.0 after IIS I just got a dedicated server from a hosting company, and for some reason, it didn't have IIS installed. It did have.Net 2.0, though. So I installed IIS, but now my ASP.net websites won't work. I just get a 404, no event log entries, nothing... I noticed in the redistributable package i...
TITLE: Installing ASP.Net 2.0 after IIS QUESTION: I just got a dedicated server from a hosting company, and for some reason, it didn't have IIS installed. It did have.Net 2.0, though. So I installed IIS, but now my ASP.net websites won't work. I just get a 404, no event log entries, nothing... I noticed in the redistr...
[ "iis", ".net-2.0", "installation" ]
5
11
7,284
4
0
2008-10-10T05:48:03.193000
2008-10-10T05:50:51.423000
190,292
190,498
Unit Testing with items that need to send headers
I'm currently working with PHPUnit to try and develop tests alongside what I'm writing, however, I'm currently working on writing the Session Manager, and am having issues doing so... The constructor for the Session handling class is private function __construct() { if (!headers_sent()) { session_start(); self::$sessio...
Well, your session manager is basically broken by design. To be able to test something, it must be possible to isolate it from side effects. Unfortunately, PHP is designed in such a way, that it encourages liberal use of global state ( echo, header, exit, session_start etc. etc.). The best thing you can do, is to isola...
Unit Testing with items that need to send headers I'm currently working with PHPUnit to try and develop tests alongside what I'm writing, however, I'm currently working on writing the Session Manager, and am having issues doing so... The constructor for the Session handling class is private function __construct() { if ...
TITLE: Unit Testing with items that need to send headers QUESTION: I'm currently working with PHPUnit to try and develop tests alongside what I'm writing, however, I'm currently working on writing the Session Manager, and am having issues doing so... The constructor for the Session handling class is private function _...
[ "php", "unit-testing", "phpunit" ]
47
39
21,938
11
0
2008-10-10T06:01:46.767000
2008-10-10T08:17:01.270000
190,295
2,241,159
Testing Abstract Classes
How do I test the concrete methods of an abstract class with PHPUnit? I'd expect that I'd have to create some sort of object as part of the test. Though, I've no idea the best practice for this or if PHPUnit allows for this.
Unit testing of abstract classes doesn't necessary mean testing the interface, as abstract classes can have concrete methods, and this concrete methods can be tested. It is not so uncommon, when writing some library code, to have certain base class that you expect to extend in your application layer. And if you want to...
Testing Abstract Classes How do I test the concrete methods of an abstract class with PHPUnit? I'd expect that I'd have to create some sort of object as part of the test. Though, I've no idea the best practice for this or if PHPUnit allows for this.
TITLE: Testing Abstract Classes QUESTION: How do I test the concrete methods of an abstract class with PHPUnit? I'd expect that I'd have to create some sort of object as part of the test. Though, I've no idea the best practice for this or if PHPUnit allows for this. ANSWER: Unit testing of abstract classes doesn't ne...
[ "unit-testing", "phpunit", "abstract-class" ]
159
263
66,731
6
0
2008-10-10T06:03:07.513000
2010-02-10T23:35:03.847000
190,296
190,306
How do you effectively model inheritance in a database?
What are the best practices for modeling inheritance in databases? What are the trade-offs (e.g. queriability)? (I'm most interested in SQL Server and.NET, but I also want to understand how other platforms address this issue.)
There are several ways to model inheritance in a database. Which you choose depends on your needs. Here are a few options: Table-Per-Type (TPT) Each class has its own table. The base class has all the base class elements in it, and each class which derives from it has its own table, with a primary key which is also a f...
How do you effectively model inheritance in a database? What are the best practices for modeling inheritance in databases? What are the trade-offs (e.g. queriability)? (I'm most interested in SQL Server and.NET, but I also want to understand how other platforms address this issue.)
TITLE: How do you effectively model inheritance in a database? QUESTION: What are the best practices for modeling inheritance in databases? What are the trade-offs (e.g. queriability)? (I'm most interested in SQL Server and.NET, but I also want to understand how other platforms address this issue.) ANSWER: There are ...
[ ".net", "sql-server", "oop", "inheritance", "database-design" ]
182
211
78,223
10
0
2008-10-10T06:03:27.590000
2008-10-10T06:11:28.853000
190,299
190,308
How to determine the file size from an attachment to a POP3 message
I'm writing a program to read from a POP3 mailbox and upload the email message into my ticketing system. I would like to then take the attachments and upload them as well. I've got all the information I need except the file size. Is there a way to determine the file size from the mail message? I am taking the attachmen...
Is the size of the base64-decoded byte array correct for you? If so, all you need to do is calculate the size without decoding it, right? A byte array of size N will encode to (N * 4)/3 bytes, always rounding up. You need to look at the last few characters of the string to work out how much to remove for rounding. Basi...
How to determine the file size from an attachment to a POP3 message I'm writing a program to read from a POP3 mailbox and upload the email message into my ticketing system. I would like to then take the attachments and upload them as well. I've got all the information I need except the file size. Is there a way to dete...
TITLE: How to determine the file size from an attachment to a POP3 message QUESTION: I'm writing a program to read from a POP3 mailbox and upload the email message into my ticketing system. I would like to then take the attachments and upload them as well. I've got all the information I need except the file size. Is t...
[ "c#", ".net", "file" ]
2
4
1,364
1
0
2008-10-10T06:05:59.070000
2008-10-10T06:13:09.413000
190,334
190,337
Video API For Building Video-Conference App
I'm going to be building an application within the next six months that will be functioning as a 2-way video-conferencing system, as well as sharing some other data back and forth. I'll probably be using some sort of relatively expensive USB webcam, and am aware of the USB Video Class Device standard, which seems to th...
with gnome, you have ekiga. You can cross compile it for win32 too. It uses OPAL (Open Phone Abstraction Library) underneath. Maybe the tool itself will suit your needs, otherwise you can adapt it (OSS) or you can only keep low level API
Video API For Building Video-Conference App I'm going to be building an application within the next six months that will be functioning as a 2-way video-conferencing system, as well as sharing some other data back and forth. I'll probably be using some sort of relatively expensive USB webcam, and am aware of the USB Vi...
TITLE: Video API For Building Video-Conference App QUESTION: I'm going to be building an application within the next six months that will be functioning as a 2-way video-conferencing system, as well as sharing some other data back and forth. I'll probably be using some sort of relatively expensive USB webcam, and am a...
[ "video-streaming", "webcam", "tapi", "h.323" ]
1
1
1,782
3
0
2008-10-10T06:40:22.477000
2008-10-10T06:43:46.230000
190,344
190,521
WPF Blurry fonts issue- Solutions
Problem is described and demonstrated on the following links: Paul Stovell WPF: Blurry Text Rendering www.gamedev.net forum Microsoft Connect: WPF text renderer produces badly blurred text on small font sizes Explanation: Text Clarity in WPF. This link has font comparison. I would like to collect all possible solutions...
Technical background There is a in-depth article about WPF Text rendering from one of the WPF Text Program Managers on windowsclient.net: Text Clarity in WPF. The problem boils down to WPF needing a linearly scaling font-renderer for smooth animations. Pure ClearType on the other hand takes quite a bit of freedom with ...
WPF Blurry fonts issue- Solutions Problem is described and demonstrated on the following links: Paul Stovell WPF: Blurry Text Rendering www.gamedev.net forum Microsoft Connect: WPF text renderer produces badly blurred text on small font sizes Explanation: Text Clarity in WPF. This link has font comparison. I would like...
TITLE: WPF Blurry fonts issue- Solutions QUESTION: Problem is described and demonstrated on the following links: Paul Stovell WPF: Blurry Text Rendering www.gamedev.net forum Microsoft Connect: WPF text renderer produces badly blurred text on small font sizes Explanation: Text Clarity in WPF. This link has font compar...
[ "wpf", "fonts" ]
158
109
69,337
12
0
2008-10-10T06:50:27.183000
2008-10-10T08:31:38.650000
190,349
190,362
Explicit multi-core C# applications
Is there any easy way to explicitly make an already threaded application utilise a multicore environment? (if avaliable). The first problem would be how do I determine if my runtime environment supports multi-core applications? If I then determine that I can use multi core functionality, can I explicitly assign threads...
If your application is already threaded properly, you dont have to do anything. Thread context execution and handling is done for you. Now when it comes to threading, is your app threaded in a way to utilize the cores? do you have processor intensive tasks split into seperate threads. If not, then you will need to make...
Explicit multi-core C# applications Is there any easy way to explicitly make an already threaded application utilise a multicore environment? (if avaliable). The first problem would be how do I determine if my runtime environment supports multi-core applications? If I then determine that I can use multi core functional...
TITLE: Explicit multi-core C# applications QUESTION: Is there any easy way to explicitly make an already threaded application utilise a multicore environment? (if avaliable). The first problem would be how do I determine if my runtime environment supports multi-core applications? If I then determine that I can use mul...
[ "c#", "multicore", "runtime-environment" ]
5
11
15,253
5
0
2008-10-10T06:52:10.410000
2008-10-10T07:00:19.020000
190,368
190,574
Getting the string representation of a type at runtime in Scala
In Scala, is it possible to get the string representation of a type at runtime? I am trying to do something along these lines: def printTheNameOfThisType[T]() = { println(T.toString) }
Note: this answer is out of date! Please see answer using TypeTag for Scala 2.10 and above May I recommend #Scala on freenode 10:48 http://stackoverflow.com/questions/190368/getting-the-string-representation-of-a-type-at-runtime-in-scala <-- isnt this posible? 10:48 possible 10:48 Title: Getting the string representati...
Getting the string representation of a type at runtime in Scala In Scala, is it possible to get the string representation of a type at runtime? I am trying to do something along these lines: def printTheNameOfThisType[T]() = { println(T.toString) }
TITLE: Getting the string representation of a type at runtime in Scala QUESTION: In Scala, is it possible to get the string representation of a type at runtime? I am trying to do something along these lines: def printTheNameOfThisType[T]() = { println(T.toString) } ANSWER: Note: this answer is out of date! Please see...
[ "scala", "types" ]
11
6
7,464
4
0
2008-10-10T07:04:13.367000
2008-10-10T08:53:43.723000
190,376
190,382
Is String.hashCode() portable across VMs, JDKs and OSs?
An interesting issue came up recently. We came across some code that is using hashCode() as a salt source for MD5 encryption but this raises the question: will hashCode() return the same value for the same object on different VMs, different JDK versions and operating systems? Even if its not guaranteed, has it changed ...
No. From http://tecfa.unige.ch/guides/java/langspec-1.0/javalang.doc1.html: The general contract of hashCode is as follows: Whenever it is invoked on the same object more than once during an execution of a Java application, hashCode must consistently return the same integer. The integer may be positive, negative, or ze...
Is String.hashCode() portable across VMs, JDKs and OSs? An interesting issue came up recently. We came across some code that is using hashCode() as a salt source for MD5 encryption but this raises the question: will hashCode() return the same value for the same object on different VMs, different JDK versions and operat...
TITLE: Is String.hashCode() portable across VMs, JDKs and OSs? QUESTION: An interesting issue came up recently. We came across some code that is using hashCode() as a salt source for MD5 encryption but this raises the question: will hashCode() return the same value for the same object on different VMs, different JDK v...
[ "java", "hashcode" ]
7
9
762
5
0
2008-10-10T07:11:00.497000
2008-10-10T07:14:19.773000
190,380
190,393
Storing more than 1 data item at a single index in a linked-list?
I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more? For example, using the Collections API to store an integer I would do the following: LinkedList linky = ne...
There seems to be a little confusion about how linked lists work. Essentially, a linked list is composed of nodes, each of which contains one datum (an object, which itself can contain several member variables, to be precise), and a link to the next node in the list (or a null pointer if there is no such next node). Yo...
Storing more than 1 data item at a single index in a linked-list? I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more? For example, using the Collections API t...
TITLE: Storing more than 1 data item at a single index in a linked-list? QUESTION: I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more? For example, using the...
[ "java", "collections", "linked-list" ]
3
18
43,531
6
0
2008-10-10T07:13:50.990000
2008-10-10T07:18:12.060000
190,385
190,395
How to manipulate images at the pixel level in C#
How do I manipulate images at the pixel level in C#? I need to be able to read/modify each bitmap pixel RGB values separately. A code sample would be appreciated.
If you want speed, then LockBits. See here for a good walkthrough by Bob Powell. If you just want to edit a few, then GetPixel / SetPixel should do what you want.
How to manipulate images at the pixel level in C# How do I manipulate images at the pixel level in C#? I need to be able to read/modify each bitmap pixel RGB values separately. A code sample would be appreciated.
TITLE: How to manipulate images at the pixel level in C# QUESTION: How do I manipulate images at the pixel level in C#? I need to be able to read/modify each bitmap pixel RGB values separately. A code sample would be appreciated. ANSWER: If you want speed, then LockBits. See here for a good walkthrough by Bob Powell....
[ "c#", "image-processing", "image-manipulation" ]
48
51
101,766
5
0
2008-10-10T07:15:43.623000
2008-10-10T07:19:05.583000
190,396
190,412
Adding HTML entities using CSS content
How do you use the CSS content property to add HTML entities? Using something like this just prints to the screen instead of the non-breaking space:.breadcrumbs a:before { content: ' '; }
You have to use the escaped unicode: Like.breadcrumbs a:before { content: '\0000a0'; }
Adding HTML entities using CSS content How do you use the CSS content property to add HTML entities? Using something like this just prints to the screen instead of the non-breaking space:.breadcrumbs a:before { content: ' '; }
TITLE: Adding HTML entities using CSS content QUESTION: How do you use the CSS content property to add HTML entities? Using something like this just prints to the screen instead of the non-breaking space:.breadcrumbs a:before { content: ' '; } ANSWER: You have to use the escaped unicode: Like.breadcrumbs a:before { c...
[ "html", "css", "html-entities", "css-content" ]
1,132
1,177
503,680
10
0
2008-10-10T07:19:25.160000
2008-10-10T07:27:52.243000
190,402
190,409
How can I get Emacs style key bindings in Visual Studio?
How can I get Emacs style key bindings in Visual Studio? Is it available in Settings? Do I need a Plug-in?
You can try the Emacs keyboard scheme ( Tools->Options->Environment->Keyboard )
How can I get Emacs style key bindings in Visual Studio? How can I get Emacs style key bindings in Visual Studio? Is it available in Settings? Do I need a Plug-in?
TITLE: How can I get Emacs style key bindings in Visual Studio? QUESTION: How can I get Emacs style key bindings in Visual Studio? Is it available in Settings? Do I need a Plug-in? ANSWER: You can try the Emacs keyboard scheme ( Tools->Options->Environment->Keyboard )
[ "visual-studio", "configuration", "emacs", "keyboard-shortcuts" ]
36
25
20,065
10
0
2008-10-10T07:22:35.560000
2008-10-10T07:25:47.067000
190,431
4,238,528
Is git-svn dcommit after merging in git dangerous?
My motivation for trying out git-svn is the effortless merging and branching. Then I noticed that man git-svn(1) says: Running git-merge or git-pull is NOT recommended on a branch you plan to dcommit from. Subversion does not represent merges in any reasonable or useful fashion; so users using Subversion cannot see any...
Actually, I found an even better way with the --no-ff option on git merge. All this squash technic I used before is no longer required. My new workflow is now as follows: I have a "master" branch that is the only branch that I dcommit from and that clone the SVN repository ( -s assume you have a standard SVN layout in ...
Is git-svn dcommit after merging in git dangerous? My motivation for trying out git-svn is the effortless merging and branching. Then I noticed that man git-svn(1) says: Running git-merge or git-pull is NOT recommended on a branch you plan to dcommit from. Subversion does not represent merges in any reasonable or usefu...
TITLE: Is git-svn dcommit after merging in git dangerous? QUESTION: My motivation for trying out git-svn is the effortless merging and branching. Then I noticed that man git-svn(1) says: Running git-merge or git-pull is NOT recommended on a branch you plan to dcommit from. Subversion does not represent merges in any r...
[ "svn", "git", "merge", "branch", "git-svn" ]
135
176
37,121
6
0
2008-10-10T07:38:52.157000
2010-11-21T15:05:31.930000
190,440
208,669
Specify parts of the header that have to be signed and/or encrypted in WCF with binding that support standards
Using Ws2007HttpBinding and securing the service, the WSDL file generated shows in the policy section that all the ws-addressing headers and the body will be signed, and that the body will be encrypted. We would like to specify which headers have to be signed and/or encrypted, like it is possible in Apache rampart. For...
Nevermind, after a few days I found an answer over here: http://blogs.msdn.com/drnick/archive/2007/01/19/securing-custom-headers-version-2.aspx
Specify parts of the header that have to be signed and/or encrypted in WCF with binding that support standards Using Ws2007HttpBinding and securing the service, the WSDL file generated shows in the policy section that all the ws-addressing headers and the body will be signed, and that the body will be encrypted. We wou...
TITLE: Specify parts of the header that have to be signed and/or encrypted in WCF with binding that support standards QUESTION: Using Ws2007HttpBinding and securing the service, the WSDL file generated shows in the policy section that all the ws-addressing headers and the body will be signed, and that the body will be...
[ "wcf", "wsdl", "ws-security", "ws-addressing" ]
0
1
1,960
1
0
2008-10-10T07:41:55.240000
2008-10-16T13:56:11.303000
190,445
190,483
Perl: HTML Scraping from an Authenticated website
While HTML Scraping is pretty well-documented from what I can see, and I understand the concept and implementation of it, what is the best method for scraping from content that is tucked away behind authentication forms. I refer to scraping from content that I legitimately have access to, so a method for automatically ...
Check out the Perl WWW::Mechanize library - it builds on LWP to provide tools for doing exactly the kind of interaction you refer to, and it can maintain state with cookies while you're about it! WWW::Mechanize, or Mech for short, helps you automate interaction with a website. It supports performing a sequence of page ...
Perl: HTML Scraping from an Authenticated website While HTML Scraping is pretty well-documented from what I can see, and I understand the concept and implementation of it, what is the best method for scraping from content that is tucked away behind authentication forms. I refer to scraping from content that I legitimat...
TITLE: Perl: HTML Scraping from an Authenticated website QUESTION: While HTML Scraping is pretty well-documented from what I can see, and I understand the concept and implementation of it, what is the best method for scraping from content that is tucked away behind authentication forms. I refer to scraping from conten...
[ "screen-scraping" ]
4
4
4,962
4
0
2008-10-10T07:46:52.017000
2008-10-10T08:06:36.283000
190,450
190,467
How can I store multiple values in a Perl hash table?
Up until recently, I've been storing multiple values into different hashes with the same keys as follows: %boss = ( "Allan" => "George", "Bob" => "George", "George" => "lisa" ); %status = ( "Allan" => "Contractor", "Bob" => "Part-time", "George" => "Full-time" ); and then I can reference $boss("Bob") and $status("Bob"...
This is the standard way, as per perldoc perldsc. ~> more test.pl %chums = ( "Allan" => {"Boss" => "George", "Status" => "Contractor"}, "Bob" => {"Boss" => "Peter", "Status" => "Part-time"} ); print $chums{"Allan"}{"Boss"}."\n"; print $chums{"Bob"}{"Boss"}."\n"; print $chums{"Bob"}{"Status"}."\n"; $chums{"Bob"}{"Wife"...
How can I store multiple values in a Perl hash table? Up until recently, I've been storing multiple values into different hashes with the same keys as follows: %boss = ( "Allan" => "George", "Bob" => "George", "George" => "lisa" ); %status = ( "Allan" => "Contractor", "Bob" => "Part-time", "George" => "Full-time" ); a...
TITLE: How can I store multiple values in a Perl hash table? QUESTION: Up until recently, I've been storing multiple values into different hashes with the same keys as follows: %boss = ( "Allan" => "George", "Bob" => "George", "George" => "lisa" ); %status = ( "Allan" => "Contractor", "Bob" => "Part-time", "George" =...
[ "perl", "hash", "multiple-value", "perl-data-structures" ]
24
26
46,318
5
0
2008-10-10T07:47:53.433000
2008-10-10T08:00:41.083000
190,454
191,218
Restore SVN backups from multiple files
I have a very large (~6GB) SVN repository, for which I've written a batch file script to do an incremental backup each day. The script checks when the last backup was run and dumps only the revisions since then. The files are named: backup-{lower_revision}-{higher_revision}.svn eg: backup-156-162.svn, backup-163-170.sv...
You should rename your files just by numbering the day [01, 02,..31] so your files can easily be sorted For the dump it is not important to know which revisions are inside. I follow a different approach, because loading back a huge Repo like this takes some time, so you should consider the following: You can use svnadm...
Restore SVN backups from multiple files I have a very large (~6GB) SVN repository, for which I've written a batch file script to do an incremental backup each day. The script checks when the last backup was run and dumps only the revisions since then. The files are named: backup-{lower_revision}-{higher_revision}.svn e...
TITLE: Restore SVN backups from multiple files QUESTION: I have a very large (~6GB) SVN repository, for which I've written a batch file script to do an incremental backup each day. The script checks when the last backup was run and dumps only the revisions since then. The files are named: backup-{lower_revision}-{high...
[ "svn" ]
2
5
7,644
4
0
2008-10-10T07:49:23.383000
2008-10-10T13:18:05.410000
190,461
190,495
A simple, medium secure,login protocol?
I asked here about a protocol that I was asked to implement, and how secure it was. Since it seemed clear from the very beginning that it was shit. Being so I ask: Can you guys point me to some very simple login protocol (I am null at cryptography systems)?? I am developing both server and client side of the applicatio...
Check out Challenge Response Authentication Server includes a random challenge string in the login form When you login, javascript hashes the password, and then hashes that with the challenge Server then performs the same check (your DB should store hashed passwords, but this method prevents you from effectively using ...
A simple, medium secure,login protocol? I asked here about a protocol that I was asked to implement, and how secure it was. Since it seemed clear from the very beginning that it was shit. Being so I ask: Can you guys point me to some very simple login protocol (I am null at cryptography systems)?? I am developing both ...
TITLE: A simple, medium secure,login protocol? QUESTION: I asked here about a protocol that I was asked to implement, and how secure it was. Since it seemed clear from the very beginning that it was shit. Being so I ask: Can you guys point me to some very simple login protocol (I am null at cryptography systems)?? I a...
[ "security", "authentication", "protocols" ]
2
4
2,352
5
0
2008-10-10T07:56:34.413000
2008-10-10T08:14:21.883000
190,464
190,481
How much of an operating system could be written in, say, Python?
This is a pretty-much theoretical question, but.. How much of an operating system could be written in a language like Python, Ruby, Perl, or Lisp, Haskell etc? It seems like a lot of the stuff like init.d could trivially be done in a scripting language. One of the firewall-device-OS's ( m0n0wall ) uses PHP for its syst...
Technically, any of it could be, if you write a compiler to do so. OSes have been done in Java (JNode),.NET (MOSA, Singularity, SharpOS, Cosmos), Haskell (HOUSE), Python (Unununium), etc. Edit: I see a lot of people talking about the very lowest level being an area where this couldn't be done; this isn't true. There's ...
How much of an operating system could be written in, say, Python? This is a pretty-much theoretical question, but.. How much of an operating system could be written in a language like Python, Ruby, Perl, or Lisp, Haskell etc? It seems like a lot of the stuff like init.d could trivially be done in a scripting language. ...
TITLE: How much of an operating system could be written in, say, Python? QUESTION: This is a pretty-much theoretical question, but.. How much of an operating system could be written in a language like Python, Ruby, Perl, or Lisp, Haskell etc? It seems like a lot of the stuff like init.d could trivially be done in a sc...
[ "operating-system" ]
15
23
5,511
11
0
2008-10-10T07:58:24.457000
2008-10-10T08:06:01.620000
190,476
198,446
Is there a way to write a group by query in LinqToSql grouping not on a scalar value?
I have those maps in my repository. public IQueryable GetAwTypes() { return from awt in _db.AwTypes select new AwType { Id = awt.Id, Header = awt.Header, Description = awt.Description }; } public IQueryable GetAws() { return from aw in _db.Aws select new Aw { Id = aw.Id, Bw = (from bw in GetBws() where bw.Id == aw.Bw ...
AwType is a reference type. It would be a bad idea to group on that reference type... Each AwType in that query is a unique reference, so n elements would yield n groups. Try this: var awGroups = from aw in _repository.GetAws() group aw by aw.AwType.ID into newGroup //changed to group on ID select newGroup; List > Ret...
Is there a way to write a group by query in LinqToSql grouping not on a scalar value? I have those maps in my repository. public IQueryable GetAwTypes() { return from awt in _db.AwTypes select new AwType { Id = awt.Id, Header = awt.Header, Description = awt.Description }; } public IQueryable GetAws() { return from aw ...
TITLE: Is there a way to write a group by query in LinqToSql grouping not on a scalar value? QUESTION: I have those maps in my repository. public IQueryable GetAwTypes() { return from awt in _db.AwTypes select new AwType { Id = awt.Id, Header = awt.Header, Description = awt.Description }; } public IQueryable GetAws()...
[ "c#", "linq", "linq-to-sql" ]
1
1
517
3
0
2008-10-10T08:04:54.053000
2008-10-13T17:59:01.720000
190,493
194,646
Add Custom Controls to MoviePlayer
I am trying to figure out how to add a custom control to the iPhone MoviePlayer. For an example of what I am trying to do see the following image. I am trying to add something like the controls on the right and left of the basic movie controls. I had done this in the Open SDK by adding a subclass to the playerview, but...
I found the BEST way to do this! You create your movie player like normal and then do the following: id vvController = [theMovie videoViewController]; [[vvController _overlayView] addSubview:mainView]; Where 'mainView' is your custom overlay. Doing this makes it so your custom overlay will show and hide with the normal...
Add Custom Controls to MoviePlayer I am trying to figure out how to add a custom control to the iPhone MoviePlayer. For an example of what I am trying to do see the following image. I am trying to add something like the controls on the right and left of the basic movie controls. I had done this in the Open SDK by addin...
TITLE: Add Custom Controls to MoviePlayer QUESTION: I am trying to figure out how to add a custom control to the iPhone MoviePlayer. For an example of what I am trying to do see the following image. I am trying to add something like the controls on the right and left of the basic movie controls. I had done this in the...
[ "iphone", "objective-c", "cocoa-touch" ]
14
10
16,335
5
0
2008-10-10T08:14:09.980000
2008-10-11T21:08:04.257000
190,499
190,632
How do I get the stream of header/footer in a WordprocessingDocument
I need to know how I get the stream of the headers and footers of a WordprocessingDocument. I get the MainDocument by the MainDocumentPart of a WordprocessingDocument. Do you know how I get the header? I tried to use the method GetPartsOfType but it returned null. Greets Sebastian
Obtaining the header and the footer is a little bit more complex, than getting a document part. As it is described here (a quite good sorce of information), there can be many headers and footers within the document and even within a section. So what you have to do is to open that main document part, identify the w:head...
How do I get the stream of header/footer in a WordprocessingDocument I need to know how I get the stream of the headers and footers of a WordprocessingDocument. I get the MainDocument by the MainDocumentPart of a WordprocessingDocument. Do you know how I get the header? I tried to use the method GetPartsOfType but it r...
TITLE: How do I get the stream of header/footer in a WordprocessingDocument QUESTION: I need to know how I get the stream of the headers and footers of a WordprocessingDocument. I get the MainDocument by the MainDocumentPart of a WordprocessingDocument. Do you know how I get the header? I tried to use the method GetPa...
[ "c#", ".net", "xml", "ms-office", "openxml" ]
1
0
1,903
1
0
2008-10-10T08:17:05.183000
2008-10-10T09:21:37.037000
190,503
190,536
XML Text Format
Does anyone know of a good program where I can paste in xml (getting it from a System.out in my java class) and it will format the xml so it's not a really long line of text?
I like XMLPad. It has a nice formatter plus a bunch of visualisers such as tree view and grid view. There is also a nice interactive XPath query tool and probably many more features.
XML Text Format Does anyone know of a good program where I can paste in xml (getting it from a System.out in my java class) and it will format the xml so it's not a really long line of text?
TITLE: XML Text Format QUESTION: Does anyone know of a good program where I can paste in xml (getting it from a System.out in my java class) and it will format the xml so it's not a really long line of text? ANSWER: I like XMLPad. It has a nice formatter plus a bunch of visualisers such as tree view and grid view. Th...
[ "xml", "editor", "text-formatting" ]
2
3
1,086
8
0
2008-10-10T08:20:45.537000
2008-10-10T08:40:53.687000
190,504
190,506
How do I use or resolve issues with visual form inheritance in Delphi?
I've been working on a project in Delphi 7 where I wanted to have forms inherit components from other forms. I was able to get this working, but came across the following issues (and I'm going to post the solutions to hopefully help others in the future): In the.pas file of a form, I would change the form to inherit fr...
First, for those who don't know how to inherit a form visually, you create the ancestor form as usual. Then go to File > New > Other. Select the tab with the name of the current project, and choose the form you want to inherit from. If you want to inherit from a form that's not part of the current project, open that fo...
How do I use or resolve issues with visual form inheritance in Delphi? I've been working on a project in Delphi 7 where I wanted to have forms inherit components from other forms. I was able to get this working, but came across the following issues (and I'm going to post the solutions to hopefully help others in the fu...
TITLE: How do I use or resolve issues with visual form inheritance in Delphi? QUESTION: I've been working on a project in Delphi 7 where I wanted to have forms inherit components from other forms. I was able to get this working, but came across the following issues (and I'm going to post the solutions to hopefully hel...
[ "delphi", "inheritance" ]
13
27
17,460
2
0
2008-10-10T08:20:55.940000
2008-10-10T08:21:26.003000
190,516
190,570
Getting all direct Reports from Active Directory
I'm trying to get all the direct reports of a User through Active Directory, recursively. So given a user, i will end up with a list of all users who have this person as manager or who have a person as manager who has a person as manager... who eventually has the input user as manager. My current attempt is rather slow...
First off, setting Scope to "subtree" is unnecessary when you already have the DN you are looking for. Also, how about finding all objects whose "manager" property is the person you look for, then iterating them. This should generally be faster than the other way around. (&(objectCategory=user)(manager= )) EDIT: The fo...
Getting all direct Reports from Active Directory I'm trying to get all the direct reports of a User through Active Directory, recursively. So given a user, i will end up with a list of all users who have this person as manager or who have a person as manager who has a person as manager... who eventually has the input u...
TITLE: Getting all direct Reports from Active Directory QUESTION: I'm trying to get all the direct reports of a User through Active Directory, recursively. So given a user, i will end up with a list of all users who have this person as manager or who have a person as manager who has a person as manager... who eventual...
[ "c#", "active-directory", "ldap" ]
12
10
18,125
1
0
2008-10-10T08:28:37.657000
2008-10-10T08:51:38
190,524
190,655
Mapping computed properties in Linq-to-SQL to actuall SQL statements
I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property in a lambda expression or in general in a query it either throws an ...
When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect that when this is part of a larger Expression, the expression interpreter will complain (which seems like what you are describing). However, I suspect that you might be able to break it down a bit. Try addin...
Mapping computed properties in Linq-to-SQL to actuall SQL statements I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property...
TITLE: Mapping computed properties in Linq-to-SQL to actuall SQL statements QUESTION: I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to...
[ "c#", ".net", "linq", "linq-to-sql" ]
2
3
2,275
3
0
2008-10-10T08:32:46.933000
2008-10-10T09:42:29.490000
190,525
206,458
Hobbit monitoring - multiple graphs per test?
I'm not sure how familiar people are with the hobbit monitoring system - http://hobbitmon.sourceforge.net/ - but I've got a tricky question. I've got a custom test, which returns two NCV values. One value normally returns ~300 milliseconds, the other one returns 500 000 euro. Obviously, these two values don't graph ver...
The easiest way is to add them to the "trends" page for the host. This is easy enough you just put a TRENDS section in bb-hosts on your server. The second easiest way is to put the HTML in to access the graph directy, that's a bit trickier.
Hobbit monitoring - multiple graphs per test? I'm not sure how familiar people are with the hobbit monitoring system - http://hobbitmon.sourceforge.net/ - but I've got a tricky question. I've got a custom test, which returns two NCV values. One value normally returns ~300 milliseconds, the other one returns 500 000 eur...
TITLE: Hobbit monitoring - multiple graphs per test? QUESTION: I'm not sure how familiar people are with the hobbit monitoring system - http://hobbitmon.sourceforge.net/ - but I've got a tricky question. I've got a custom test, which returns two NCV values. One value normally returns ~300 milliseconds, the other one r...
[ "monitoring", "graph", "hobbitmon" ]
5
1
1,525
2
0
2008-10-10T08:33:06.760000
2008-10-15T20:57:42.403000
190,528
218,642
How do I use micro-state accounting in Linux?
I would like to access micro-state accounting timers programmatically on Linux. I guess the first part of the question is where are these available? Which kernel versions and distros? Which hardware platforms? The second part is how to actually go about accessing the timers? What is the system call? Here is a (somewhat...
Patches and user-space programs are available at http://www.gelato.unsw.edu.au/patches/. As the patches did not migrate upstream, seemingly because of too high complexity/overhead, you'll have to roll your own kernel.
How do I use micro-state accounting in Linux? I would like to access micro-state accounting timers programmatically on Linux. I guess the first part of the question is where are these available? Which kernel versions and distros? Which hardware platforms? The second part is how to actually go about accessing the timers...
TITLE: How do I use micro-state accounting in Linux? QUESTION: I would like to access micro-state accounting timers programmatically on Linux. I guess the first part of the question is where are these available? Which kernel versions and distros? Which hardware platforms? The second part is how to actually go about ac...
[ "c", "linux", "performance", "operating-system" ]
3
2
948
2
0
2008-10-10T08:35:07.677000
2008-10-20T14:30:19.407000
190,531
190,541
Hex operations in C#
Any hints on parsing / converting / operating on hex values in c#? In particular I want to cast a decimal int to hex and then output as a string...
Int32 decValue = 42; string hexValue = decValue.ToString("X"); Int32 decValue2 = Int32.Parse(hexValue, System.Globalization.NumberStyles.HexNumber); See this post: How to convert numbers between hexadecimal and decimal in C#?
Hex operations in C# Any hints on parsing / converting / operating on hex values in c#? In particular I want to cast a decimal int to hex and then output as a string...
TITLE: Hex operations in C# QUESTION: Any hints on parsing / converting / operating on hex values in c#? In particular I want to cast a decimal int to hex and then output as a string... ANSWER: Int32 decValue = 42; string hexValue = decValue.ToString("X"); Int32 decValue2 = Int32.Parse(hexValue, System.Globalization...
[ "c#", "hex" ]
0
1
6,029
1
0
2008-10-10T08:38:33.143000
2008-10-10T08:41:58.677000
190,542
197,082
Java, Alfresco Web Service API and Unicode NamedValues
I'm using Java for accessing Alfresco content server via it's web service API for importing some content into it. Content should have some NamedValue properties set to UTF-8(cyrillic) string. I keep getting the Sax parser exception: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x1b) was found in th...
The problem was that alfresco-web-service-client.jar library I used was from 2.9B distribution (I am hitting 2.9B community content server), and dependency libs bcprov-jdk15-136.jar and xmlsec-1.4.0.jar were not adequate (remained old from 2.1 verison). I should have used bcprov-jdk15-137.jar and xmlsec-1.4.1.jar which...
Java, Alfresco Web Service API and Unicode NamedValues I'm using Java for accessing Alfresco content server via it's web service API for importing some content into it. Content should have some NamedValue properties set to UTF-8(cyrillic) string. I keep getting the Sax parser exception: org.xml.sax.SAXParseException: A...
TITLE: Java, Alfresco Web Service API and Unicode NamedValues QUESTION: I'm using Java for accessing Alfresco content server via it's web service API for importing some content into it. Content should have some NamedValue properties set to UTF-8(cyrillic) string. I keep getting the Sax parser exception: org.xml.sax.SA...
[ "java", "web-services", "unicode", "alfresco" ]
2
2
3,482
3
0
2008-10-10T08:42:30.860000
2008-10-13T09:18:36.700000
190,543
190,554
How can I change the width of a Windows console window?
Is it possible to programmatically, or otherwise, increase the width of the Windows console window? Or do I need to create a wrapper program that looks and acts like the console somehow? Are there any programs around that do this already? I use Cygwin extensively in my development, and it seems a little ridiculous to m...
You can increase it manually by right-clicking the tray icon and entering the options dialog. There are also third-party terminal emulators for Windows, such as Console:
How can I change the width of a Windows console window? Is it possible to programmatically, or otherwise, increase the width of the Windows console window? Or do I need to create a wrapper program that looks and acts like the console somehow? Are there any programs around that do this already? I use Cygwin extensively ...
TITLE: How can I change the width of a Windows console window? QUESTION: Is it possible to programmatically, or otherwise, increase the width of the Windows console window? Or do I need to create a wrapper program that looks and acts like the console somehow? Are there any programs around that do this already? I use C...
[ "windows", "windows-xp", "console" ]
27
22
64,116
11
0
2008-10-10T08:42:59.470000
2008-10-10T08:46:40.070000
190,553
190,565
What's the Difference Between func(int &param) and func(int *param)?
In the following code, both amp_swap() and star_swap() seems to be doing the same thing. So why will someone prefer to use one over the other? Which one is the preferred notation and why? Or is it just a matter of taste? #include using namespace std; void amp_swap(int &x, int &y) { int temp = x; x = y; y = temp; } vo...
One is using a reference, one is using a pointer. I would use the one with references, because you can't pass a NULL reference (whereas you can pass a NULL pointer). So if you do: star_swap(NULL, NULL); Your application will crash. Whereas if you try: amp_swap(NULL, NULL); // This won't compile Always go with reference...
What's the Difference Between func(int &param) and func(int *param)? In the following code, both amp_swap() and star_swap() seems to be doing the same thing. So why will someone prefer to use one over the other? Which one is the preferred notation and why? Or is it just a matter of taste? #include using namespace std; ...
TITLE: What's the Difference Between func(int &param) and func(int *param)? QUESTION: In the following code, both amp_swap() and star_swap() seems to be doing the same thing. So why will someone prefer to use one over the other? Which one is the preferred notation and why? Or is it just a matter of taste? #include usi...
[ "c++", "pointers", "reference" ]
12
13
2,072
8
0
2008-10-10T08:46:36.810000
2008-10-10T08:50:17.880000
190,559
190,651
Java: Threading Techniques & Concepts
When using threads I sometimes visualise them as weaving together 3 or more dimensional interconnections between Objects in a Spatial context. This isn't a general use case scenario, but for what I do it is a useful way to think about it. Are there any APIs which you use which aid threading? Have you used threads in a ...
Are there any APIs which you use which aid threading? You mean appart from java.util.concurrent? FunctionalJava got some constructs which aid in concurrent programming, as described in a multipart tutorial that starts here. Have you used threads in a manner which doesn't conceptualise as thread being a process? Yes, to...
Java: Threading Techniques & Concepts When using threads I sometimes visualise them as weaving together 3 or more dimensional interconnections between Objects in a Spatial context. This isn't a general use case scenario, but for what I do it is a useful way to think about it. Are there any APIs which you use which aid ...
TITLE: Java: Threading Techniques & Concepts QUESTION: When using threads I sometimes visualise them as weaving together 3 or more dimensional interconnections between Objects in a Spatial context. This isn't a general use case scenario, but for what I do it is a useful way to think about it. Are there any APIs which ...
[ "java", "multithreading", "visualization" ]
6
13
3,311
4
0
2008-10-10T08:48:41.253000
2008-10-10T09:39:54.940000
190,560
2,302,005
jQuery animate backgroundColor
I am trying to animate a change in backgroundColor using jQuery on mouseover. I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working with is a div. $(".usercontent").mouseover(functio...
The color plugin is only 4kb so much cheaper than the UI library. Of course you'll want to use a decent version of the plugin and not some buggy old thing which doesn't handle Safari and crashes when the transitions are too fast. Since a minified version isn't supplied you might like test various compressors and make y...
jQuery animate backgroundColor I am trying to animate a change in backgroundColor using jQuery on mouseover. I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working with is a div. $("....
TITLE: jQuery animate backgroundColor QUESTION: I am trying to animate a change in backgroundColor using jQuery on mouseover. I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working w...
[ "javascript", "jquery", "colors", "jquery-animate" ]
338
336
517,605
18
0
2008-10-10T08:49:28.303000
2010-02-20T11:25:30.733000
190,587
358,181
How can I pull artifacts from TeamCity?
I would like to pull artifacts from teamcity. I've been trying to use c# and the HtmlAgilityPack to goto the website and find the latest version and its artifacts. I'm currently stuck at the login, I think I just need to be sending Session Cookies out. Am I going in the right direction, has anyone else tried this? I re...
There are simpler solutions, please read this: http://www.jetbrains.net/confluence/display/TCD4/Patterns+For+Accessing+Build+Artifacts
How can I pull artifacts from TeamCity? I would like to pull artifacts from teamcity. I've been trying to use c# and the HtmlAgilityPack to goto the website and find the latest version and its artifacts. I'm currently stuck at the login, I think I just need to be sending Session Cookies out. Am I going in the right dir...
TITLE: How can I pull artifacts from TeamCity? QUESTION: I would like to pull artifacts from teamcity. I've been trying to use c# and the HtmlAgilityPack to goto the website and find the latest version and its artifacts. I'm currently stuck at the login, I think I just need to be sending Session Cookies out. Am I goin...
[ "ant", "continuous-integration", "nant", "teamcity", "html-agility-pack" ]
5
6
2,041
1
0
2008-10-10T09:02:53.890000
2008-12-11T01:11:58.093000
190,590
190,591
Does Ruby have a built-in do ... while?
Ruby has a wealth of conditional constructs, including if / unless, while / until etc. The while block from C: while (condition) {... } can be directly translated to Ruby: while condition... end However, I can't seem to find a built-in equivalent in Ruby for a C-like do... while block in which the block contents are ex...
...The best I could come up with is the loop construct with a break at the end: loop do... break unless condition end
Does Ruby have a built-in do ... while? Ruby has a wealth of conditional constructs, including if / unless, while / until etc. The while block from C: while (condition) {... } can be directly translated to Ruby: while condition... end However, I can't seem to find a built-in equivalent in Ruby for a C-like do... while ...
TITLE: Does Ruby have a built-in do ... while? QUESTION: Ruby has a wealth of conditional constructs, including if / unless, while / until etc. The while block from C: while (condition) {... } can be directly translated to Ruby: while condition... end However, I can't seem to find a built-in equivalent in Ruby for a C...
[ "ruby", "conditional-statements", "keyword" ]
14
31
10,764
4
0
2008-10-10T09:03:46.323000
2008-10-10T09:04:09.800000
190,593
192,173
Page Lifecycle - Using FindControl to reference a control created programmatically during page load
I'm creating some text boxes on my form programmatically which I need to reference later using FindControl. I've put the FindControl instruction in the page load method after the code which creates them but get an error: Object reference not set to an instance of an object. I assume this is because the textbox controls...
Did you put your textbox control inside of another control such as a panel or grid? If so you need to recursively search all the controls on the page. Here is an example of a recursive FindControl implementation: Recursive Page.FindControl. You can find many other examples by googling "recursive findcontrol".
Page Lifecycle - Using FindControl to reference a control created programmatically during page load I'm creating some text boxes on my form programmatically which I need to reference later using FindControl. I've put the FindControl instruction in the page load method after the code which creates them but get an error:...
TITLE: Page Lifecycle - Using FindControl to reference a control created programmatically during page load QUESTION: I'm creating some text boxes on my form programmatically which I need to reference later using FindControl. I've put the FindControl instruction in the page load method after the code which creates them...
[ "c#", "asp.net", ".net", "controls" ]
2
3
5,356
6
0
2008-10-10T09:04:46.103000
2008-10-10T16:34:08.820000
190,594
195,998
Deploying binary gems to a different platform
I have a Rails app that I need to deploy. Here are the facts: The app was developed on Windows and requires Windows binary gems The app is to be deployed onto an Open Solaris shared server (Joyent) I do not have permissions to install gems on the server For the non-binary gems, I can simply do a rake gems:unpack locall...
The app was developed on Windows and requires Windows binary gems The app is to be deployed onto an Open Solaris shared server (Joyent) You do realise that you can't run windows binaries on open solaris. Windows is in fact entirely different from solaris... If the gems are from a third party, you may be able to downloa...
Deploying binary gems to a different platform I have a Rails app that I need to deploy. Here are the facts: The app was developed on Windows and requires Windows binary gems The app is to be deployed onto an Open Solaris shared server (Joyent) I do not have permissions to install gems on the server For the non-binary g...
TITLE: Deploying binary gems to a different platform QUESTION: I have a Rails app that I need to deploy. Here are the facts: The app was developed on Windows and requires Windows binary gems The app is to be deployed onto an Open Solaris shared server (Joyent) I do not have permissions to install gems on the server Fo...
[ "ruby-on-rails", "ruby", "deployment", "rubygems" ]
0
2
946
5
0
2008-10-10T09:05:12.077000
2008-10-12T20:27:02.467000
190,596
191,011
Drag and drop in winapi
I have a pure Winapi application that needs a few new features. One of them would best be implemented as two lists where you can drag-and-drop (multiple) elements between the lists. The new feature can be limited to a single dialog. What would be the quickest way to implement this? A few ideas: Pure Winapi (is it Detec...
My advice would be that if the application is in pure winapi, keep it that way. Starting a.NET framework runtime just for one dialog with draggable items is as bad as hosting a WebBrowser control and using JQuery for that one functionality - it's at least thedailywtf.com-worthy if you ask me (but then again, you're not...
Drag and drop in winapi I have a pure Winapi application that needs a few new features. One of them would best be implemented as two lists where you can drag-and-drop (multiple) elements between the lists. The new feature can be limited to a single dialog. What would be the quickest way to implement this? A few ideas: ...
TITLE: Drag and drop in winapi QUESTION: I have a pure Winapi application that needs a few new features. One of them would best be implemented as two lists where you can drag-and-drop (multiple) elements between the lists. The new feature can be limited to a single dialog. What would be the quickest way to implement t...
[ "c", "windows", "winapi", "drag-and-drop" ]
6
9
9,326
5
0
2008-10-10T09:06:46.053000
2008-10-10T12:19:32.093000
190,598
190,604
Is there a way to see if a character is using 1 or 2 bytes in Delphi 2009?
Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char). Sizeof(char) currently being 2. What I am interested in is whether anyone knows of a way which on a character by character b...
You could check the value of the character: if ord(c) < 128 then // is an ascii character
Is there a way to see if a character is using 1 or 2 bytes in Delphi 2009? Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char). Sizeof(char) currently being 2. What I am interes...
TITLE: Is there a way to see if a character is using 1 or 2 bytes in Delphi 2009? QUESTION: Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char). Sizeof(char) currently being 2....
[ "delphi", "unicode", "delphi-2009", "character-encoding" ]
4
5
4,732
7
0
2008-10-10T09:07:04.100000
2008-10-10T09:09:51.570000
190,625
190,665
Initialise A Variable With The Output Of A Stored Procedure In MS SQL Server
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5), @DESC VARCHAR(255) OUTPUT ) AS DECLARE @SERVERNAME nvarchar(30) DECLARE @DBASE nvarchar(30) DECLARE @SQL nvarchar(2000) SET @SERVERNAME = Convert(nvarchar, (SELECT spData FROM dbSpecificData WHERE spLook...
Change the line: SET @myDesc = EXEC UDSPRBHPRIMBUSTYPESTARTUP @CODE = @myCode, @DESC = @@tempDesc OUTPUT to EXEC UDSPRBHPRIMBUSTYPESTARTUP @CODE = @myCode, @DESC = @tempDesc OUTPUT And you have missed assigning @DESC in the stored procedure. SET @SQL = 'SELECT @DESC = clnt_cat_desc FROM ' + @SERVERNAME + '.' + @DBASE +...
Initialise A Variable With The Output Of A Stored Procedure In MS SQL Server I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5), @DESC VARCHAR(255) OUTPUT ) AS DECLARE @SERVERNAME nvarchar(30) DECLARE @DBASE nvarchar(30) DECLARE @SQL nvarchar(2000) SET @S...
TITLE: Initialise A Variable With The Output Of A Stored Procedure In MS SQL Server QUESTION: I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5), @DESC VARCHAR(255) OUTPUT ) AS DECLARE @SERVERNAME nvarchar(30) DECLARE @DBASE nvarchar(30) DECLARE @SQL nvar...
[ "sql-server", "sql-server-2005", "t-sql", "stored-procedures" ]
1
7
15,595
4
0
2008-10-10T09:20:11.267000
2008-10-10T09:52:01.437000
190,629
190,633
What is the easiest way to parse an INI file in Java?
I am writing a drop-in replacement for a legacy application in Java. One of the requirements is that the ini files that the older application used have to be read as-is into the new Java Application. The format of this ini files is the common windows style, with header sections and key=value pairs, using # as the chara...
The library I've used is ini4j. It is lightweight and parses the ini files with ease. Also it uses no esoteric dependencies to 10,000 other jar files, as one of the design goals was to use only the standard Java API This is an example on how the library is used: Ini ini = new Ini(new File(filename)); java.util.prefs.Pr...
What is the easiest way to parse an INI file in Java? I am writing a drop-in replacement for a legacy application in Java. One of the requirements is that the ini files that the older application used have to be read as-is into the new Java Application. The format of this ini files is the common windows style, with hea...
TITLE: What is the easiest way to parse an INI file in Java? QUESTION: I am writing a drop-in replacement for a legacy application in Java. One of the requirements is that the ini files that the older application used have to be read as-is into the new Java Application. The format of this ini files is the common windo...
[ "java", "parsing", "ini" ]
111
134
174,753
13
0
2008-10-10T09:20:55.820000
2008-10-10T09:22:12.433000
190,643
190,799
Has anyone used (or considered using) Sql Server Compact Edition?
I've been preparing to deliver a presentation on SQL Server Compact Edition 3.5 (SP1 - recently released) and I was wondering if anyone had designed (or contemplated designing) a system with SQL Server CE 3.5 (or earlier versions)? In particular, has anyone thought of (or experienced) using SQLCE as a solution for offl...
At work, we recently had to migrate a project that was designed for SQL Server Express to SQLCE. At first I thought it was going to be awful, mainly due to the fact that there are no stored procedures. Once we started digging into it though, and saw what it DOES offer, we were convinced it was the right move. It suppor...
Has anyone used (or considered using) Sql Server Compact Edition? I've been preparing to deliver a presentation on SQL Server Compact Edition 3.5 (SP1 - recently released) and I was wondering if anyone had designed (or contemplated designing) a system with SQL Server CE 3.5 (or earlier versions)? In particular, has any...
TITLE: Has anyone used (or considered using) Sql Server Compact Edition? QUESTION: I've been preparing to deliver a presentation on SQL Server Compact Edition 3.5 (SP1 - recently released) and I was wondering if anyone had designed (or contemplated designing) a system with SQL Server CE 3.5 (or earlier versions)? In p...
[ "sql-server", "database", "windows-mobile", "sql-server-ce" ]
7
9
2,280
9
0
2008-10-10T09:35:33
2008-10-10T10:47:47.923000
190,666
190,689
LINQ to SQL and Concurrency Issues
We are trying to build a High-Volume Orders Record System. There are three primary tables: 1. Orders 2. OrderDetails 3. OrderShipment The Shipment table contains n record per order and any record shipment entry can be changed before the Customer accepts th order, after which it is frozen. (A business requirement) Altho...
If you are having genuine issues with concurrent updates on the same data, then you might consider performing the entire operation in a transaction - i.e. getting the data and committing it. As long as you treat the get/update/commit as a short-lived, atomic operation (i.e. you don't pause for user-input in the middle)...
LINQ to SQL and Concurrency Issues We are trying to build a High-Volume Orders Record System. There are three primary tables: 1. Orders 2. OrderDetails 3. OrderShipment The Shipment table contains n record per order and any record shipment entry can be changed before the Customer accepts th order, after which it is fro...
TITLE: LINQ to SQL and Concurrency Issues QUESTION: We are trying to build a High-Volume Orders Record System. There are three primary tables: 1. Orders 2. OrderDetails 3. OrderShipment The Shipment table contains n record per order and any record shipment entry can be changed before the Customer accepts th order, aft...
[ "c#", "linq", "linq-to-sql", "concurrency", "transactions" ]
7
7
11,116
3
0
2008-10-10T09:52:46.770000
2008-10-10T10:07:36.053000
190,667
190,728
Need only some rows in a CListCtrl control to have check boxes
I'm using a CListCtrl control to display information in my MFC app. At the moment I have LVS_EX_CHECKBOXES set in SetExtendedStyle so all rows in the control have a checkbox next to them. What I would like however is that only some of the rows in the control have checkboxes. Is this possible? If it is how is this done?...
For each item which shouldn't have a checkbox: LVITEM lvi; lvi.stateMask = LVIS_STATEIMAGEMASK; lvi.state = INDEXTOSTATEIMAGEMASK(0);::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); To 'create' the check box for an item: SetCheck(Item, true/false);
Need only some rows in a CListCtrl control to have check boxes I'm using a CListCtrl control to display information in my MFC app. At the moment I have LVS_EX_CHECKBOXES set in SetExtendedStyle so all rows in the control have a checkbox next to them. What I would like however is that only some of the rows in the contro...
TITLE: Need only some rows in a CListCtrl control to have check boxes QUESTION: I'm using a CListCtrl control to display information in my MFC app. At the moment I have LVS_EX_CHECKBOXES set in SetExtendedStyle so all rows in the control have a checkbox next to them. What I would like however is that only some of the ...
[ "mfc" ]
2
7
3,940
2
0
2008-10-10T09:53:04.647000
2008-10-10T10:23:04.540000
190,675
190,841
Read colors of image with Python (GAE)
How can I read the colors of an image with python using google app engine? Example: I like to build a function to determine the most striking colors of an image to set a harmonic background color for it.
The Images API does not (currently) contain pixel-level functions. To quote the overview document: Note: In order to use the Images API in your local environment you must first download and install PIL, the Python Imaging Library. PIL is not available on App Engine; it is only used as a stub for the Images API in your ...
Read colors of image with Python (GAE) How can I read the colors of an image with python using google app engine? Example: I like to build a function to determine the most striking colors of an image to set a harmonic background color for it.
TITLE: Read colors of image with Python (GAE) QUESTION: How can I read the colors of an image with python using google app engine? Example: I like to build a function to determine the most striking colors of an image to set a harmonic background color for it. ANSWER: The Images API does not (currently) contain pixel-...
[ "python", "google-app-engine", "image", "analysis" ]
1
2
1,742
3
0
2008-10-10T09:56:47.090000
2008-10-10T11:02:47.113000
190,681
190,697
When is loop unwinding effective?
Loop unwinding is a common way to help the compiler to optimize performance. I was wondering if and to what extent the performance gain is affected by what is in the body of the loop: number of statements number of function calls use of complex data types, virtual methods, etc. dynamic (de)allocation of memory What rul...
In general unrolling loops by hand is not worth the effort. The compiler knows better how the target architecture works and will unroll the loop if it is beneficial. There are code-paths that benefit when unrolled for Pentium-M type CPU's but don't benefit for Core2 for example. If I unroll by hand the compiler can't m...
When is loop unwinding effective? Loop unwinding is a common way to help the compiler to optimize performance. I was wondering if and to what extent the performance gain is affected by what is in the body of the loop: number of statements number of function calls use of complex data types, virtual methods, etc. dynamic...
TITLE: When is loop unwinding effective? QUESTION: Loop unwinding is a common way to help the compiler to optimize performance. I was wondering if and to what extent the performance gain is affected by what is in the body of the loop: number of statements number of function calls use of complex data types, virtual met...
[ "c++", "performance", "algorithm", "optimization" ]
12
32
3,974
10
0
2008-10-10T09:59:55.710000
2008-10-10T10:10:41.883000
190,685
190,858
How to use Process Monitor to Resolve an UnauthorizedAccessException
I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception: UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied." I've been advised to use Process Monitor to help resolve this, but it's quite a complex tool, and I really don't have time...
When PM starts it displays a filter dialog. Just click 'Reset' to use the standard filtering. This will generate lots of messages, and you are only interested in very few of them. Under Process Name, select a line with the process you want to monitor. Richtclick it and choose include. That limits the reported events to...
How to use Process Monitor to Resolve an UnauthorizedAccessException I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception: UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied." I've been advised to use Process Monitor to help reso...
TITLE: How to use Process Monitor to Resolve an UnauthorizedAccessException QUESTION: I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception: UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied." I've been advised to use Process Mo...
[ "asp.net", "debugging" ]
0
4
7,110
2
0
2008-10-10T10:03:24.690000
2008-10-10T11:09:29.953000
190,693
191,080
Oracle - How does transaction, rollback segment and the undo_retention parameter work?
I'm no DBA, and I'm having a bit of a hard time understanding Oracle's transaction management process. From what I understood by reading some reliable-looking pages on the Internet (most notably this AskTom note -- but don't bother with the comments), when a transaction is commited, the new data is not reported on the ...
Lots to cover here! The person in your company is essentially right, except that the changes are written to the data block in memory as they are made, even before the commit; and they are written out to disk entirely independently of when you commit (possibly before, possibly after, never as part of the commit operatio...
Oracle - How does transaction, rollback segment and the undo_retention parameter work? I'm no DBA, and I'm having a bit of a hard time understanding Oracle's transaction management process. From what I understood by reading some reliable-looking pages on the Internet (most notably this AskTom note -- but don't bother w...
TITLE: Oracle - How does transaction, rollback segment and the undo_retention parameter work? QUESTION: I'm no DBA, and I'm having a bit of a hard time understanding Oracle's transaction management process. From what I understood by reading some reliable-looking pages on the Internet (most notably this AskTom note -- ...
[ "oracle", "transactions", "ora-01555" ]
9
14
10,156
3
0
2008-10-10T10:09:30.857000
2008-10-10T12:46:28.313000
190,701
190,760
Creating your own Tinyurl style uid
I'm writing a small article on humanly readable alternatives to Guids/UIDs, for example those used on TinyURL for the url hashes (which are often printed in magazines, so need to be short). The simple uid I'm generating is - 6 characters: either a lowercase letter (a-z) or 0-9. "According to my calculations captain", t...
The probability of a collision against one specific ID is: p = ( 0.5 * ( (0.5*1/10) + (0.5*1/26) ) )^6 which is around 1.7×10^-9. The probability of a collision after generating n IDs is 1-p^n, so you'll have roughly a 0.17% chance of a collision for each new insertion after 1 million IDs have been inserted, around 1.7...
Creating your own Tinyurl style uid I'm writing a small article on humanly readable alternatives to Guids/UIDs, for example those used on TinyURL for the url hashes (which are often printed in magazines, so need to be short). The simple uid I'm generating is - 6 characters: either a lowercase letter (a-z) or 0-9. "Acco...
TITLE: Creating your own Tinyurl style uid QUESTION: I'm writing a small article on humanly readable alternatives to Guids/UIDs, for example those used on TinyURL for the url hashes (which are often printed in magazines, so need to be short). The simple uid I'm generating is - 6 characters: either a lowercase letter (...
[ "c#", "algorithm", "probability" ]
17
4
12,245
8
0
2008-10-10T10:11:43.283000
2008-10-10T10:37:55.463000
190,702
190,764
MySQL: Select N rows, but with only unique values in one column
Given this data set: ID Name City Birthyear 1 Egon Spengler New York 1957 2 Mac Taylor New York 1955 3 Sarah Connor Los Angeles 1959 4 Jean-Luc Picard La Barre 2305 5 Ellen Ripley Nostromo 2092 6 James T. Kirk Riverside 2233 7 Henry Jones Chicago 1899 I need to find the 3 oldest persons, but only one of every city. If ...
Probably not the most elegant of solutions, and the performance of IN may suffer on larger tables. The nested query gets the minimum Birthyear for each city. Only records who have this Birthyear are matched in the outer query. Ordering by age then limiting to 3 results gets you the 3 oldest people who are also the olde...
MySQL: Select N rows, but with only unique values in one column Given this data set: ID Name City Birthyear 1 Egon Spengler New York 1957 2 Mac Taylor New York 1955 3 Sarah Connor Los Angeles 1959 4 Jean-Luc Picard La Barre 2305 5 Ellen Ripley Nostromo 2092 6 James T. Kirk Riverside 2233 7 Henry Jones Chicago 1899 I ne...
TITLE: MySQL: Select N rows, but with only unique values in one column QUESTION: Given this data set: ID Name City Birthyear 1 Egon Spengler New York 1957 2 Mac Taylor New York 1955 3 Sarah Connor Los Angeles 1959 4 Jean-Luc Picard La Barre 2305 5 Ellen Ripley Nostromo 2092 6 James T. Kirk Riverside 2233 7 Henry Jones...
[ "sql", "mysql", "unique", "aggregate-functions", "min" ]
34
19
75,238
5
0
2008-10-10T10:11:46.983000
2008-10-10T10:39:20.420000
190,714
190,848
Do I need to worry about the String Constant Pool?
I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects. Do I need to worry about the String Constant Pool for memory and performance? Is there any way to see how big the pool is at any point?
As Mario said, the constant pool is only relevant to intern()ed Strings, and to Strings that are constants in java code (these are implicitly interned). But there is one more caveat that might apply to your case: The substring() method will share the underlying char[] with the original String. So the pattern String lar...
Do I need to worry about the String Constant Pool? I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects. Do I need to worry about the String Constant Pool for memory and performance? Is there any way to see how big the pool is at any point?
TITLE: Do I need to worry about the String Constant Pool? QUESTION: I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects. Do I need to worry about the String Constant Pool for memory and performance? Is there any way to see how big the pool is at any poi...
[ "java", "string" ]
2
4
1,180
5
0
2008-10-10T10:18:00.777000
2008-10-10T11:05:52.987000
190,740
190,801
Setting ruby hash .default to a list
I thought I understood what the default method does to a hash... Give a default value for a key if it doesn't exist: irb(main):001:0> a = {} => {} irb(main):002:0> a.default = 4 => 4 irb(main):003:0> a[8] => 4 irb(main):004:0> a[9] += 1 => 5 irb(main):005:0> a => {9=>5} All good. But if I set the default to be a empty ...
Hash.default is used to set the default value returned when you query a key that doesn't exist. An entry in the collection is not created for you, just because queried it. Also, the value you set default to is an instance of an object (an Array in your case), so when this is returned, it can be manipulated. a = {} a.de...
Setting ruby hash .default to a list I thought I understood what the default method does to a hash... Give a default value for a key if it doesn't exist: irb(main):001:0> a = {} => {} irb(main):002:0> a.default = 4 => 4 irb(main):003:0> a[8] => 4 irb(main):004:0> a[9] += 1 => 5 irb(main):005:0> a => {9=>5} All good. Bu...
TITLE: Setting ruby hash .default to a list QUESTION: I thought I understood what the default method does to a hash... Give a default value for a key if it doesn't exist: irb(main):001:0> a = {} => {} irb(main):002:0> a.default = 4 => 4 irb(main):003:0> a[8] => 4 irb(main):004:0> a[9] += 1 => 5 irb(main):005:0> a => {...
[ "ruby", "hashmap" ]
42
51
17,554
7
0
2008-10-10T10:28:53.080000
2008-10-10T10:48:54.817000
190,748
191,876
Why can't I put a variable declaration in the test portion of a while loop?
You can, obviously, put a variable declaration in a for loop: for (int i = 0;... and I've noticed that you can do the same thing in if and switch statements as well: if ((int i = f())!= 0)... switch (int ch = stream.get())... But when I try to do the same thing in a while loop: while ((int ch = stream.get())!= -1)... ...
The grammar for a condition in the '03 standard is defined as follows: condition: expression type-specifier-seq declarator = assignment-expression The above will therefore only allow conditions such as: if ( i && j && k ) {} if ( (i = j) ==0 ) {} if ( int i = j ) {} The standard allows the condition to declare a variab...
Why can't I put a variable declaration in the test portion of a while loop? You can, obviously, put a variable declaration in a for loop: for (int i = 0;... and I've noticed that you can do the same thing in if and switch statements as well: if ((int i = f())!= 0)... switch (int ch = stream.get())... But when I try to...
TITLE: Why can't I put a variable declaration in the test portion of a while loop? QUESTION: You can, obviously, put a variable declaration in a for loop: for (int i = 0;... and I've noticed that you can do the same thing in if and switch statements as well: if ((int i = f())!= 0)... switch (int ch = stream.get())......
[ "c++" ]
22
15
28,616
6
0
2008-10-10T10:33:06.627000
2008-10-10T15:29:24.240000
190,749
190,824
Initialized event of WPF UserControl not firing
I've got a very simple WPF UserControl that looks like this: namespace MyUserControl { /// /// Interaction logic for UserControl1.xaml /// public partial class UserControl1: UserControl { public UserControl1() { InitializeComponent(); } protected override void OnRender(DrawingContext drawingContext) { Rect rect = new ...
The MSDN doc says This event will be raised whenever the EndInit or OnVisualParentChanged methods are called. Calls to either method could have come from application code, or through the Extensible Application Markup Language (XAML) processor behavior when a XAML page is processed. I can reproduce your problem here. I ...
Initialized event of WPF UserControl not firing I've got a very simple WPF UserControl that looks like this: namespace MyUserControl { /// /// Interaction logic for UserControl1.xaml /// public partial class UserControl1: UserControl { public UserControl1() { InitializeComponent(); } protected override void OnRender(D...
TITLE: Initialized event of WPF UserControl not firing QUESTION: I've got a very simple WPF UserControl that looks like this: namespace MyUserControl { /// /// Interaction logic for UserControl1.xaml /// public partial class UserControl1: UserControl { public UserControl1() { InitializeComponent(); } protected overri...
[ ".net", "wpf", ".net-3.5" ]
9
18
21,618
1
0
2008-10-10T10:33:25.160000
2008-10-10T10:56:25.037000
190,755
190,903
What's the best way to document Perl code?
Any suggestion how I can document my Perl code? What do you use and what tools are available to help me? Which module do you use to convert pod to html?
Look inside almost any Perl module and you'll see the Plain Old Documentation (POD) format. On CPAN Search, when looking at a module you have the option of viewing the raw source, so that's one way you can look at the raw pod, but you can also use perldoc from the command line. The -m switch shows you the file perldoc ...
What's the best way to document Perl code? Any suggestion how I can document my Perl code? What do you use and what tools are available to help me? Which module do you use to convert pod to html?
TITLE: What's the best way to document Perl code? QUESTION: Any suggestion how I can document my Perl code? What do you use and what tools are available to help me? Which module do you use to convert pod to html? ANSWER: Look inside almost any Perl module and you'll see the Plain Old Documentation (POD) format. On CP...
[ "perl", "documentation", "perl-pod" ]
27
48
19,080
8
0
2008-10-10T10:37:07.257000
2008-10-10T11:29:35.077000
190,759
191,284
Can PHP detect if its run from a cron job or from the command line?
I'm looking for way to PHP to detect if a script was run from a manual invocation on a shell (me logging in and running it), or if it was run from the crontab entry. I have various maintenance type scripts written in php that i have set to run in my crontab. Occasionally, and I need to run them manually ahead of schedu...
Instead of detecting when the script is run from the crontab, it's probably easier to detect when you're running it manually. There are a lot of environment variables (in the $_ENV array) that are set when you run a script from the command line. What these are will vary depending on your sever setup and how you log in....
Can PHP detect if its run from a cron job or from the command line? I'm looking for way to PHP to detect if a script was run from a manual invocation on a shell (me logging in and running it), or if it was run from the crontab entry. I have various maintenance type scripts written in php that i have set to run in my cr...
TITLE: Can PHP detect if its run from a cron job or from the command line? QUESTION: I'm looking for way to PHP to detect if a script was run from a manual invocation on a shell (me logging in and running it), or if it was run from the crontab entry. I have various maintenance type scripts written in php that i have s...
[ "php", "cron" ]
70
48
47,598
22
0
2008-10-10T10:37:45.930000
2008-10-10T13:31:35.367000
190,771
190,806
How secure is sending sensitive data over https?
Is SSL secure enough for using sensitive data (like password) in query string? Is there any extra options to implement?
SSL provides secure, transport-level security. Nobody between client and server should be able to read the information. But you should change your mind about writing sensitive data in the querystring. It will show up in the browser's history and is visible in the address bar of the browser and in logs on the server. Se...
How secure is sending sensitive data over https? Is SSL secure enough for using sensitive data (like password) in query string? Is there any extra options to implement?
TITLE: How secure is sending sensitive data over https? QUESTION: Is SSL secure enough for using sensitive data (like password) in query string? Is there any extra options to implement? ANSWER: SSL provides secure, transport-level security. Nobody between client and server should be able to read the information. But ...
[ "security", "ssl", "query-string" ]
24
49
18,350
10
0
2008-10-10T10:41:42.833000
2008-10-10T10:51:14.563000
190,775
190,885
Stemming algorithm that produces real words
I need to take a paragraph of text and extract from it a list of "tags". Most of this is quite straight forward. However I need some help now stemming the resulting word list to avoid duplicates. Example: Community / Communities I've used an implementation of Porter Stemmer algorithm (I'm writing in PHP by the way): ht...
The core issue here is that stemming algorithms operate on a phonetic basis purely based on the language's spelling rules with no actual understanding of the language they're working with. To produce real words, you'll probably have to merge the stemmer's output with some form of lookup function to convert the stems ba...
Stemming algorithm that produces real words I need to take a paragraph of text and extract from it a list of "tags". Most of this is quite straight forward. However I need some help now stemming the resulting word list to avoid duplicates. Example: Community / Communities I've used an implementation of Porter Stemmer a...
TITLE: Stemming algorithm that produces real words QUESTION: I need to take a paragraph of text and extract from it a list of "tags". Most of this is quite straight forward. However I need some help now stemming the resulting word list to avoid duplicates. Example: Community / Communities I've used an implementation o...
[ "php", "nlp", "stemming", "snowball", "porter-stemmer" ]
36
16
36,875
3
0
2008-10-10T10:43:29.290000
2008-10-10T11:22:12.283000
190,776
190,962
How To have Dynamic SQL in MySQL Stored Procedure
How do you build and use dynamic sql in a MySQL stored procedure?
I don't believe MySQL supports dynamic sql. You can do "prepared" statements which is similar, but different. Here is an example: mysql> PREPARE stmt FROM -> 'select count(*) -> from information_schema.schemata -> where schema_name =? or schema_name =?'; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql> EX...
How To have Dynamic SQL in MySQL Stored Procedure How do you build and use dynamic sql in a MySQL stored procedure?
TITLE: How To have Dynamic SQL in MySQL Stored Procedure QUESTION: How do you build and use dynamic sql in a MySQL stored procedure? ANSWER: I don't believe MySQL supports dynamic sql. You can do "prepared" statements which is similar, but different. Here is an example: mysql> PREPARE stmt FROM -> 'select count(*) ->...
[ "mysql", "dynamic" ]
73
60
150,936
3
0
2008-10-10T10:43:32.627000
2008-10-10T11:56:47.990000
190,803
190,861
Newely explained concepts in .net Framework 3.5
We have developed our website(Business users website) in.net Framework 2.0 Our client us to migrate to.net Framework 3.5. I am not interested in developing the same thing in both the frameworks. Please anyone tell me some of the new features like card space, work flow, presentation foundation concepts in.net framework ...
You can migrate your website to.Net 3.5 without requiring any code changes. Depending on the language you are using there are several new features in 3.5 that can greatly simplify your code. This does not have to be an all or nothing proposition. I would recommend that you take advantage of the features that make sense...
Newely explained concepts in .net Framework 3.5 We have developed our website(Business users website) in.net Framework 2.0 Our client us to migrate to.net Framework 3.5. I am not interested in developing the same thing in both the frameworks. Please anyone tell me some of the new features like card space, work flow, pr...
TITLE: Newely explained concepts in .net Framework 3.5 QUESTION: We have developed our website(Business users website) in.net Framework 2.0 Our client us to migrate to.net Framework 3.5. I am not interested in developing the same thing in both the frameworks. Please anyone tell me some of the new features like card sp...
[ "asp.net", ".net-3.5" ]
0
2
1,605
1
0
2008-10-10T10:50:16.623000
2008-10-10T11:10:33.103000
190,805
191,448
How does one go about developer scalability and code-reuse in Flash?
I've so far dabbled in Flash doing 1-man shows for quite some time, but have never done any big projects with it, where actually source management and code-reuse was truly necessary. However I'm considering Flash for a new project, but this time around it's won't be a 1-man show, that's when it struck me that I had no ...
Good communication Don't work in.fla's. 100% of the code in.as files UML (at least discussed) Different tasks for everybody Comments in commits to code repository "Manage your code so that anybody can at any time take over your job" Consider the bus factor With junior developers it's also good to go through basic stuff...
How does one go about developer scalability and code-reuse in Flash? I've so far dabbled in Flash doing 1-man shows for quite some time, but have never done any big projects with it, where actually source management and code-reuse was truly necessary. However I'm considering Flash for a new project, but this time aroun...
TITLE: How does one go about developer scalability and code-reuse in Flash? QUESTION: I've so far dabbled in Flash doing 1-man shows for quite some time, but have never done any big projects with it, where actually source management and code-reuse was truly necessary. However I'm considering Flash for a new project, b...
[ "flash", "code-reuse" ]
1
3
151
2
0
2008-10-10T10:50:35.173000
2008-10-10T14:06:26.153000
190,819
190,845
Flash Standard Libraries?
For a new project with Flash I was looking for something along the lines of standard libraries for basic programming needs, along the lines of Python or Ruby standard libraries. But the only thing I found was a dead project on Sourceforge. Thus is there no standard library for flash? Does everyone reinvent the wheel ea...
The basic libraries are built into flash. Then on top of that there is flex, which gives you an entire RIA framework. Then there are 3rd party frameworks for 3d, physics engines, various design patterns ( MVC, IoC etc) to name just a few. So no, you do not not to reinvent the wheel every time.
Flash Standard Libraries? For a new project with Flash I was looking for something along the lines of standard libraries for basic programming needs, along the lines of Python or Ruby standard libraries. But the only thing I found was a dead project on Sourceforge. Thus is there no standard library for flash? Does ever...
TITLE: Flash Standard Libraries? QUESTION: For a new project with Flash I was looking for something along the lines of standard libraries for basic programming needs, along the lines of Python or Ruby standard libraries. But the only thing I found was a dead project on Sourceforge. Thus is there no standard library fo...
[ "flash", "code-reuse", "standard-library" ]
1
4
225
2
0
2008-10-10T10:54:50.827000
2008-10-10T11:05:24.440000
190,833
190,865
Is it possible to add to the available parameters of a request (HttpServletRequest)
I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a 'setParameter' method and the parameter map when manipulated throws an error saying it is locked. Is there an alternative I can try?
Subclass HttpServletRequestWrapper and override the getParameter methods. The description of this class reads: Provides a convenient implementation of the HttpServletRequest interface that can be subclassed by developers wishing to adapt the request to a Servlet. In the filter, wrap the request in an instance of your s...
Is it possible to add to the available parameters of a request (HttpServletRequest) I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a 'setParameter' method and the parameter map when manipulated throws an error saying it is locked. Is there an alter...
TITLE: Is it possible to add to the available parameters of a request (HttpServletRequest) QUESTION: I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a 'setParameter' method and the parameter map when manipulated throws an error saying it is locked....
[ "java", "http", "servlets" ]
10
13
22,942
6
0
2008-10-10T11:00:24.497000
2008-10-10T11:12:34.177000
190,838
190,888
What JDBC tools do you use for synchronization of data sources?
I'm hoping to find out what tools folks use to synchronize data between databases. I'm looking for a JDBC solution that can be used as a command-line tool. There used to be a tool called Sync4J that used the SyncML framework but this seems to have fallen by the wayside.
I have heard that the Data Replication Service provided by Db4O is really good. It allows you to use Hibernate to back onto a RDBMS - I don't think it supports JDBC tho ( http://www.db4o.com/about/productinformation/drs/Default.aspx?AspxAutoDetectCookieSupport=1 ) There is an open source project called Daffodil, but I ...
What JDBC tools do you use for synchronization of data sources? I'm hoping to find out what tools folks use to synchronize data between databases. I'm looking for a JDBC solution that can be used as a command-line tool. There used to be a tool called Sync4J that used the SyncML framework but this seems to have fallen b...
TITLE: What JDBC tools do you use for synchronization of data sources? QUESTION: I'm hoping to find out what tools folks use to synchronize data between databases. I'm looking for a JDBC solution that can be used as a command-line tool. There used to be a tool called Sync4J that used the SyncML framework but this seem...
[ "java", "database", "jdbc", "synchronization" ]
13
7
4,423
4
0
2008-10-10T11:01:53.107000
2008-10-10T11:23:12.860000
190,840
190,954
How can I convert my current page to pdf after some content dynamically added via AJAX?
I have found some libraries or web services in PHP that does the job. The problem is that the conversion is done when the page is fully loaded, I would like to convert the page to PDF after some content dynamically added via AJAX in onload event. Thank you very much, Omar
Wow, thank you everyone I didn't know that this is comunity is so active. To answer Beepcake about the project: When the page loads the app retrieves, from more than 40 servers, biological information via AJAX request, then a unique view is displayed where you can manipulate the graphic with many options. So, the cool ...
How can I convert my current page to pdf after some content dynamically added via AJAX? I have found some libraries or web services in PHP that does the job. The problem is that the conversion is done when the page is fully loaded, I would like to convert the page to PDF after some content dynamically added via AJAX in...
TITLE: How can I convert my current page to pdf after some content dynamically added via AJAX? QUESTION: I have found some libraries or web services in PHP that does the job. The problem is that the conversion is done when the page is fully loaded, I would like to convert the page to PDF after some content dynamically...
[ "php", "ajax", "pdf" ]
4
1
1,763
6
0
2008-10-10T11:02:14.320000
2008-10-10T11:54:20.290000
190,852
190,878
How can I get file extensions with JavaScript?
See code: var file1 = "50.xsl"; var file2 = "30.doc"; getFileExtension(file1); //returns xsl getFileExtension(file2); //returns doc function getFileExtension(filename) { /*TODO*/ }
Newer Edit: Lots of things have changed since this question was initially posted - there's a lot of really good information in wallacer's revised answer as well as VisioN's excellent breakdown Edit: Just because this is the accepted answer; wallacer's answer is indeed much better: return filename.split('.').pop(); My o...
How can I get file extensions with JavaScript? See code: var file1 = "50.xsl"; var file2 = "30.doc"; getFileExtension(file1); //returns xsl getFileExtension(file2); //returns doc function getFileExtension(filename) { /*TODO*/ }
TITLE: How can I get file extensions with JavaScript? QUESTION: See code: var file1 = "50.xsl"; var file2 = "30.doc"; getFileExtension(file1); //returns xsl getFileExtension(file2); //returns doc function getFileExtension(filename) { /*TODO*/ } ANSWER: Newer Edit: Lots of things have changed since this question was ...
[ "javascript", "file-extension" ]
739
1,167
854,734
36
0
2008-10-10T11:08:05.090000
2008-10-10T11:18:02.933000
190,867
191,398
Multiple viewports of the same DisplayObject
Is it possible to have multiple view of the same display object? (e.g. same-computer multi-player game using split screen) The sample code that failed to work follows: var content: Sprite = new Sprite(); var v1: Sprite = new Sprite(); var v2: Sprite = new Sprite(); with(content.graphics) { lineStyle(2, 0xff0000); draw...
The easiest way to do this is to have a bitmap that's updated with the original display object's contents, something like: var bitmap:Bitmap = new Bitmap(new BitmapData(1,1)); addChild(bitmap); addEventListener(Event.ENTER_FRAME,enterFrameHandler); function enterFrameHandler(event:Event):void { bitmap.bitmapData.disp...
Multiple viewports of the same DisplayObject Is it possible to have multiple view of the same display object? (e.g. same-computer multi-player game using split screen) The sample code that failed to work follows: var content: Sprite = new Sprite(); var v1: Sprite = new Sprite(); var v2: Sprite = new Sprite(); with(con...
TITLE: Multiple viewports of the same DisplayObject QUESTION: Is it possible to have multiple view of the same display object? (e.g. same-computer multi-player game using split screen) The sample code that failed to work follows: var content: Sprite = new Sprite(); var v1: Sprite = new Sprite(); var v2: Sprite = new S...
[ "flash", "actionscript-3", "viewport", "displayobject", "scrollrect" ]
1
2
1,471
3
0
2008-10-10T11:12:39.107000
2008-10-10T13:58:29.070000
190,876
190,895
On Qt widgets like DoubleSpinBox or ComboBox, how do i have custom right click menu
I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box). How do i get it. Is there some way I can have a custom menu that comes up on right click or Is there a way i can add items to the menu th...
First, for Qt4, the simplest way is to create an action to reset the data, and add it the the widget using the addAction method (or use the designer). Then, set the contextMenuPolicy attribute to Qt::ActionsContextMenu. The context menu will appear and the action will be triggered. Code example: QAction *reset_act = ne...
On Qt widgets like DoubleSpinBox or ComboBox, how do i have custom right click menu I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box). How do i get it. Is there some way I can have a custo...
TITLE: On Qt widgets like DoubleSpinBox or ComboBox, how do i have custom right click menu QUESTION: I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box). How do i get it. Is there some way ...
[ "qt", "right-click" ]
3
5
4,288
2
0
2008-10-10T11:16:56.227000
2008-10-10T11:27:05.707000
190,890
191,745
Order of tags in <head></head>
does it matter at all what order the or
The accepted answer is kind of wrong, depending on the encoding of the document. If no encoding is sent by in the HTTP header, the browser has to determine the encoding from the document itself. If the document uses a declaration to declare its encoding, then any ASCII-valued character (character code < 128) occurring ...
Order of tags in <head></head> does it matter at all what order the or
TITLE: Order of tags in <head></head> QUESTION: does it matter at all what order the or ANSWER: The accepted answer is kind of wrong, depending on the encoding of the document. If no encoding is sent by in the HTTP header, the browser has to determine the encoding from the document itself. If the document uses a decl...
[ "html", "xhtml" ]
49
16
10,427
14
0
2008-10-10T11:23:35.900000
2008-10-10T15:02:14.653000
190,908
191,245
How can I disable the UITableView selection?
When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
All you have to do is set the selection style on the UITableViewCell instance using either: Objective-C: cell.selectionStyle = UITableViewCellSelectionStyleNone; or [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; Swift 2: cell.selectionStyle = UITableViewCellSelectionStyle.None Swift 3 and 4.x: cell.selecti...
How can I disable the UITableView selection? When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
TITLE: How can I disable the UITableView selection? QUESTION: When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing? ANSWER: All you have to do is set the selection style on the UITableViewCell instance using either: Objective-C: cell.se...
[ "ios", "uitableview", "cocoa-touch" ]
1,278
2,029
540,551
42
0
2008-10-10T11:32:27.833000
2008-10-10T13:22:04.480000
190,911
190,920
How to generate ASP.NET page every time when using master pages?
I'm moving an old VBScript web site over to ASP.NET, so I'm starting to use master pages instead of #includeing lots of other files with server side VBScript in them. How can I stop the pages (as in the ones that are based on master pages) from being generated once and then stored? If I make a change to the master page...
It sounds like you have caching enabled, as normal behaviour without caching is to regenrate.
How to generate ASP.NET page every time when using master pages? I'm moving an old VBScript web site over to ASP.NET, so I'm starting to use master pages instead of #includeing lots of other files with server side VBScript in them. How can I stop the pages (as in the ones that are based on master pages) from being gene...
TITLE: How to generate ASP.NET page every time when using master pages? QUESTION: I'm moving an old VBScript web site over to ASP.NET, so I'm starting to use master pages instead of #includeing lots of other files with server side VBScript in them. How can I stop the pages (as in the ones that are based on master page...
[ "asp.net", "master-pages" ]
1
2
413
2
0
2008-10-10T11:34:25.257000
2008-10-10T11:37:40.943000
190,912
191,075
/etc/motd printing twice on Gentoo Linux
I've run into a problem where I'm getting two printouts of my /etc/motd file on Gentoo Linux. sshd is doing one of the printouts, and I can toggle that by configuring /etc/ssh/sshd_config, but I can't find out who's printing the second copy. I can't disable sshd from printing out the motd due to an audit requirement. I...
Looks like the answer was in the /etc/pam.d/login and /etc/pam.d/system-login files. I had to comment out the pam_motd.so lines.
/etc/motd printing twice on Gentoo Linux I've run into a problem where I'm getting two printouts of my /etc/motd file on Gentoo Linux. sshd is doing one of the printouts, and I can toggle that by configuring /etc/ssh/sshd_config, but I can't find out who's printing the second copy. I can't disable sshd from printing ou...
TITLE: /etc/motd printing twice on Gentoo Linux QUESTION: I've run into a problem where I'm getting two printouts of my /etc/motd file on Gentoo Linux. sshd is doing one of the printouts, and I can toggle that by configuring /etc/ssh/sshd_config, but I can't find out who's printing the second copy. I can't disable ssh...
[ "bash", "ssh", "gentoo" ]
6
8
12,053
10
0
2008-10-10T11:34:39.840000
2008-10-10T12:44:11.890000