PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
23,755
08/22/2008 23:49:32
1,709
08/18/2008 07:05:30
329
37
How do you find a needle in a haystack?
When implementing a needle search of a haystack in an object-oriented way, you essentially have three alternatives: <pre><code>1. needle.find(haystack) 2. haystack.find(needle) 3. searcher.find(needle, haystack)</code></pre> Which do you prefer, and why? I know some people prefer the second alternative because it avoids introducing a third object. However, I can't help feeling that the third approach is more conceptually "correct", at least if your goal is to model "the real world". In which cases do you think it is justified to introduce helper objects, such as the searcher in this example, and when should they be avoided?
designpatterns
bestpractices
classdesign
programstructure
null
null
open
How do you find a needle in a haystack? === When implementing a needle search of a haystack in an object-oriented way, you essentially have three alternatives: <pre><code>1. needle.find(haystack) 2. haystack.find(needle) 3. searcher.find(needle, haystack)</code></pre> Which do you prefer, and why? I know some people prefer the second alternative because it avoids introducing a third object. However, I can't help feeling that the third approach is more conceptually "correct", at least if your goal is to model "the real world". In which cases do you think it is justified to introduce helper objects, such as the searcher in this example, and when should they be avoided?
0
23,763
08/22/2008 23:57:13
85
08/01/2008 16:38:08
66
0
Colorizing images in Java
I'm working on some code to colorize an image in Java. Basically what I'd like to do is something along the lines of GIMP's colorize command, so that if I have a BufferedImage and a Color, I can colorize the Image with the given color. Anyone got any ideas? My current best guess at doing something like this is to get the rgb value of each pixel in the BufferedImage and add the RGB value of the Color to it with some scaling factor.
java
colors
bufferedimage
colorize
null
null
open
Colorizing images in Java === I'm working on some code to colorize an image in Java. Basically what I'd like to do is something along the lines of GIMP's colorize command, so that if I have a BufferedImage and a Color, I can colorize the Image with the given color. Anyone got any ideas? My current best guess at doing something like this is to get the rgb value of each pixel in the BufferedImage and add the RGB value of the Color to it with some scaling factor.
0
23,770
08/23/2008 00:05:58
2,567
08/22/2008 22:50:45
41
4
Good strategy for leaving an audit trail/change history for DB applications?
What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently use and develop for could really benefit from a more comprehensive way of tracking how records have changed over time. For instance, right now records can have a number of timestamp and modified user fields, but we currently don't have a scheme for logging multiple change, for instance if an operation is rolled back. In a perfect world, it would be possible to reconstruct the record as it was after each save, etc. Some info on the DB: - Needs to have the capacity to grow by thousands of records per week - 50-60 Tables - Main revisioned tables may have several million records each - Reasonable amount of foreign keys and indexes set - Using PostgreSQL 8.x
database
database-design
postgresql
null
null
null
open
Good strategy for leaving an audit trail/change history for DB applications? === What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently use and develop for could really benefit from a more comprehensive way of tracking how records have changed over time. For instance, right now records can have a number of timestamp and modified user fields, but we currently don't have a scheme for logging multiple change, for instance if an operation is rolled back. In a perfect world, it would be possible to reconstruct the record as it was after each save, etc. Some info on the DB: - Needs to have the capacity to grow by thousands of records per week - 50-60 Tables - Main revisioned tables may have several million records each - Reasonable amount of foreign keys and indexes set - Using PostgreSQL 8.x
0
23,774
08/23/2008 00:09:34
50
08/01/2008 13:29:54
518
34
postfix and sending mail to an external server
I know this isn't a help forum, but i've looked everywhere for the past 5 hours trying to find a solution to this, and nothing seems to work. Hopefully someone will have run into this problem before and come up with a solution I've got a debian server and i would like to have it serve my mail as well. I set up postfix and everything works dandy when i send mail to any account in the database, but when i want to send anything to a random email (podcast@stackoverflow for example) it throws the error 450 4.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table I've tried to edit the /etc/postfix/main.cf file to change smtpd_recipients_restrictions so that it does not include reject_unauth_destination. however, with this removed, postfix stops listening on port 25 and sending mail at all becomes impossible. Any ideas to get this working?
postfix
mailserver
null
null
null
null
open
postfix and sending mail to an external server === I know this isn't a help forum, but i've looked everywhere for the past 5 hours trying to find a solution to this, and nothing seems to work. Hopefully someone will have run into this problem before and come up with a solution I've got a debian server and i would like to have it serve my mail as well. I set up postfix and everything works dandy when i send mail to any account in the database, but when i want to send anything to a random email (podcast@stackoverflow for example) it throws the error 450 4.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table I've tried to edit the /etc/postfix/main.cf file to change smtpd_recipients_restrictions so that it does not include reject_unauth_destination. however, with this removed, postfix stops listening on port 25 and sending mail at all becomes impossible. Any ideas to get this working?
0
23,787
08/23/2008 00:22:24
1,490
08/15/2008 21:35:24
284
43
Cleanest Way to Find a Match In a List
What is the best way to find something in a list? I know LINQ has some nice tricks, but let's also get suggestions for C# 2.0. Lets get the best refactorings for this common code pattern. Currently I use code like this: // mObjList is a List<MyObject> MyObject match = null; foreach (MyObject mo in mObjList) { if (Criteria(mo)) { match = mo; break; } } or // mObjList is a List<MyObject> bool foundIt = false; foreach (MyObject mo in mObjList) { if (Criteria(mo)) { foundIt = true; break; } }
c#
refactor
null
null
null
null
open
Cleanest Way to Find a Match In a List === What is the best way to find something in a list? I know LINQ has some nice tricks, but let's also get suggestions for C# 2.0. Lets get the best refactorings for this common code pattern. Currently I use code like this: // mObjList is a List<MyObject> MyObject match = null; foreach (MyObject mo in mObjList) { if (Criteria(mo)) { match = mo; break; } } or // mObjList is a List<MyObject> bool foundIt = false; foreach (MyObject mo in mObjList) { if (Criteria(mo)) { foundIt = true; break; } }
0
23,802
08/23/2008 00:43:18
1,862
08/18/2008 23:53:20
444
48
How to handle including needed classes in PHP
I'm wondering what the best practice is for handling the problem with having to "include" so many files in my PHP scripts in order to ensure that all the classes I need to use are accessible to my script. Currently, I'm just using include_once to include the classes I access directly. Each of those would include_once the classes that they access. I've looked into using the __autoload function, but hat doesn't seem to work well if you plan to have your class files organized in a directory tree. If you did this, it seems like you'd end up walking the directory tree until you found the class you were looking for. Also, I'm not sure how this effects classes with the same name in different namespaces. Is there an easier way to handle this? Or is PHP just not suited to "enterprisey" type applications with lots of different objects all located in separate files that can be in many different directories.
php
null
null
null
null
null
open
How to handle including needed classes in PHP === I'm wondering what the best practice is for handling the problem with having to "include" so many files in my PHP scripts in order to ensure that all the classes I need to use are accessible to my script. Currently, I'm just using include_once to include the classes I access directly. Each of those would include_once the classes that they access. I've looked into using the __autoload function, but hat doesn't seem to work well if you plan to have your class files organized in a directory tree. If you did this, it seems like you'd end up walking the directory tree until you found the class you were looking for. Also, I'm not sure how this effects classes with the same name in different namespaces. Is there an easier way to handle this? Or is PHP just not suited to "enterprisey" type applications with lots of different objects all located in separate files that can be in many different directories.
0
23,836
08/23/2008 01:50:44
1,343
08/14/2008 15:46:01
216
19
What is the "best" simple instal system for XP/Vista?
Heavy emphasis on simple. I've never made an installer and I'd rather not have to learn much. A system that I could hand a pile of files to and it would make some smart guesses about where to put them would be ideal. Go ahead and answer the general question. However In my cases I'm stuck with some extra constraints. The program to be installed is written in VB6 (or is it 5?) and a few previous versions of VB, so it's *not* going to be updated any time soon. I have a running install and will have a Clean VM to play with So I'll be doing a loop of: run the install, find where it's broken, fix it, add that to the installer, revert the VM, try again. If anyone has a better approach I'm open to suggestions. I *MUST* get it working on XP and I'd really like to also have something that will work on Vista as well.
windows
installer
null
null
null
null
open
What is the "best" simple instal system for XP/Vista? === Heavy emphasis on simple. I've never made an installer and I'd rather not have to learn much. A system that I could hand a pile of files to and it would make some smart guesses about where to put them would be ideal. Go ahead and answer the general question. However In my cases I'm stuck with some extra constraints. The program to be installed is written in VB6 (or is it 5?) and a few previous versions of VB, so it's *not* going to be updated any time soon. I have a running install and will have a Clean VM to play with So I'll be doing a loop of: run the install, find where it's broken, fix it, add that to the installer, revert the VM, try again. If anyone has a better approach I'm open to suggestions. I *MUST* get it working on XP and I'd really like to also have something that will work on Vista as well.
0
23,853
08/23/2008 02:09:25
2,274
08/21/2008 12:44:42
1
0
How I hide empty Velocity variable names ?
I am using Struts + Velocity in a Java application, but after I submit a form, the confirmation page (Velocity template) shows the variable names instead an empty label, like the Age in following example: > **Name**: Fernando > **Age**: {person.age} > **Sex**: Male I would like to know how to hide it!
java
templates
struts
velocity
null
null
open
How I hide empty Velocity variable names ? === I am using Struts + Velocity in a Java application, but after I submit a form, the confirmation page (Velocity template) shows the variable names instead an empty label, like the Age in following example: > **Name**: Fernando > **Age**: {person.age} > **Sex**: Male I would like to know how to hide it!
0
23,860
08/23/2008 02:19:30
292
08/04/2008 13:14:31
377
14
What is the best way to learn recursion
When I started in programming I started with c++ and was doing recursion in my second semester in a data structures class. I don't even remember how we started it, I think it was linked lists, but its a concept that I picked up easily and can jump into quickly, even when I haven't written any recursive code in quite some time. What is the best way to explain recursion to someone who doesn't understand it? What kind of simple examples could you show to someone to demonstrate the concept and quick exercises they could practice with to get the hang of it?
language-agnostic
pointers
recursion
discussion
null
null
open
What is the best way to learn recursion === When I started in programming I started with c++ and was doing recursion in my second semester in a data structures class. I don't even remember how we started it, I think it was linked lists, but its a concept that I picked up easily and can jump into quickly, even when I haven't written any recursive code in quite some time. What is the best way to explain recursion to someone who doesn't understand it? What kind of simple examples could you show to someone to demonstrate the concept and quick exercises they could practice with to get the hang of it?
0
23,867
08/23/2008 02:29:18
781
08/08/2008 21:28:19
131
10
Closing and Disposing a WCF Service
The Close method on an ICommunicationObject can throw two types of exceptions as MSDN outlines [here][1]. I understand why the Close method can throw those exceptions, but what I don't understand is why the Dispose method on a service proxy calls the Close method without a try around it. Isn't your Dispose method the one place where you want make sure you don't throw any exceptions? [1]: http://msdn.microsoft.com/en-us/library/ms195520.aspx
wcf
web-service
null
null
null
null
open
Closing and Disposing a WCF Service === The Close method on an ICommunicationObject can throw two types of exceptions as MSDN outlines [here][1]. I understand why the Close method can throw those exceptions, but what I don't understand is why the Dispose method on a service proxy calls the Close method without a try around it. Isn't your Dispose method the one place where you want make sure you don't throw any exceptions? [1]: http://msdn.microsoft.com/en-us/library/ms195520.aspx
0
23,899
08/23/2008 02:56:37
2,477
08/22/2008 13:21:51
46
9
Is there a good guide out there for refactoring classic ASP?
I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development. One basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at least it's easy to understand @ the top of the file what's generally going on. Is there a worthwhile MVC framework for ASP? Or a best practice at how to at least get business logic out of the views? (I remember doing a lot of includes back in the day -- is that still the way to do it?) I'd love to get some unit testing going for business logic too, but maybe I'm asking too much?
asp
refactor
spaghetti-code
mvc
null
null
open
Is there a good guide out there for refactoring classic ASP? === I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development. One basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at least it's easy to understand @ the top of the file what's generally going on. Is there a worthwhile MVC framework for ASP? Or a best practice at how to at least get business logic out of the views? (I remember doing a lot of includes back in the day -- is that still the way to do it?) I'd love to get some unit testing going for business logic too, but maybe I'm asking too much?
0
23,907
08/23/2008 03:00:46
745
08/08/2008 13:47:26
239
16
How can I graph the Lines of Code history for git repo?
Basically I want to get the number of lines-of-code in the repository after each commit. The only (really crappy) ways I have found is to use git filter-branch to run "wc -l *", and a script that run git reset --hard on each commit, then ran wc -l To make it a bit clearer, when the tool is run, it would output the lines of code of the very first commit, then the second and so on.. This is what I want the tool to output (as an example): me@something:~/$ gitsloc --branch master 10 48 153 450 1734 1542 I've played around with the ruby 'git' library, but the closest I found was using the .lines() method on a diff, which seems like it should give the added lines (but does not.. it returns 0 when you delete lines for example) require 'rubygems' require 'git' total = 0 g = Git.open(working_dir = '/Users/dbr/Desktop/code_projects/tvdb_api') last = nil g.log.each do |cur| diff = g.diff(last, cur) total = total + diff.lines puts total last = cur end
ruby
git
lines-of-code
sloc
null
null
open
How can I graph the Lines of Code history for git repo? === Basically I want to get the number of lines-of-code in the repository after each commit. The only (really crappy) ways I have found is to use git filter-branch to run "wc -l *", and a script that run git reset --hard on each commit, then ran wc -l To make it a bit clearer, when the tool is run, it would output the lines of code of the very first commit, then the second and so on.. This is what I want the tool to output (as an example): me@something:~/$ gitsloc --branch master 10 48 153 450 1734 1542 I've played around with the ruby 'git' library, but the closest I found was using the .lines() method on a diff, which seems like it should give the added lines (but does not.. it returns 0 when you delete lines for example) require 'rubygems' require 'git' total = 0 g = Git.open(working_dir = '/Users/dbr/Desktop/code_projects/tvdb_api') last = nil g.log.each do |cur| diff = g.diff(last, cur) total = total + diff.lines puts total last = cur end
0
23,918
08/23/2008 03:23:44
364
08/05/2008 05:33:41
332
21
OpenGL Rotation
I'm trying to do a simple rotation in OpenGL but must be missing the point. I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally. At the moment I have code like this: glPushMatrix(); glRotatef(90.0, 0.0, 1.0, 0.0); glBegin(GL_TRIANGLES); glVertex3f( 1.0, 1.0, 0.0 ); glVertex3f( 3.0, 2.0, 0.0 ); glVertex3f( 3.0, 1.0, 0.0 ); glEnd(); glPopMatrix(); But the result is not a triangle rotated 90 degrees.
opengl
c++
null
null
null
null
open
OpenGL Rotation === I'm trying to do a simple rotation in OpenGL but must be missing the point. I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally. At the moment I have code like this: glPushMatrix(); glRotatef(90.0, 0.0, 1.0, 0.0); glBegin(GL_TRIANGLES); glVertex3f( 1.0, 1.0, 0.0 ); glVertex3f( 3.0, 2.0, 0.0 ); glVertex3f( 3.0, 1.0, 0.0 ); glEnd(); glPopMatrix(); But the result is not a triangle rotated 90 degrees.
0
23,927
08/23/2008 03:40:31
1,327
08/14/2008 14:37:22
108
11
What are some references, lessons and or best practices for SQL optimization training.
I know this falls into the black arts area of programming, but this is suddenly an area that I need to strengthen in my professional life. There are a couple of topics were this subject has been touched on but I'm not sure the item has been really addressed about how to become one with the system. For example: I became a phenomenally better C++ programmer when I began to understand how the compiler worked, I became a better software engineer when I understood how people worked. They are different study paths. What I'm asking is if you were to put a self help course together to become better at not just writing syntactically correct SQL, and well normalized databases, but fast optimized ones as well. What would you focus on, who would you talk to, who would you read, and how would you get there?
mssql
tsql
sql2005
sql2008
null
null
open
What are some references, lessons and or best practices for SQL optimization training. === I know this falls into the black arts area of programming, but this is suddenly an area that I need to strengthen in my professional life. There are a couple of topics were this subject has been touched on but I'm not sure the item has been really addressed about how to become one with the system. For example: I became a phenomenally better C++ programmer when I began to understand how the compiler worked, I became a better software engineer when I understood how people worked. They are different study paths. What I'm asking is if you were to put a self help course together to become better at not just writing syntactically correct SQL, and well normalized databases, but fast optimized ones as well. What would you focus on, who would you talk to, who would you read, and how would you get there?
0
23,930
08/23/2008 03:46:32
1,337
08/14/2008 15:09:52
71
20
Factorial Algorithms in different languages
I want to see all the different ways you can come up with, for a factorial subroutine, or program. - Procedural - Functional - Object Oriented - Different languages - One liners - Obfuscated Basically I want to see an example, of different ways of writing an algorithm, and what they would look like in different languages. Bonus points if it really works.
algorithm
null
null
null
null
null
open
Factorial Algorithms in different languages === I want to see all the different ways you can come up with, for a factorial subroutine, or program. - Procedural - Functional - Object Oriented - Different languages - One liners - Obfuscated Basically I want to see an example, of different ways of writing an algorithm, and what they would look like in different languages. Bonus points if it really works.
0
23,935
08/23/2008 03:48:55
290
08/04/2008 12:57:50
359
48
Peer Reviews or Pair Programming, or Both?
Do you participate in code peer reviews or practice pair programming, or both? Have you been able to demonstrate an increase in software quality using these practices? What benefits and drawbacks have you observed in the course of practice? What hurdles to implementation did you face? In my own case, our development team pursued peer reviews of a number of different software artifacts (requirements analyses, test plans, code, and so on). Peer programming was not even considered as an option. The peer review practice was pushed down from the top, and the developers never bought into it. We had an external SQA group that gathered metrics from the activities, but the numbers were pretty worthless since the effort was half-hearted. After years of this being the "official" way to do things, the developers have come to collectively ignore the prescribed procedures. Now there is less visibility into when bugs are getting interjected into the lifecycle. And not doing the peer reviews has led to increased specialization on the team...where no one really knows the requirements/logic of components outside their own specialized area of the system. It would be valuable to know your experiences w/ peer reviews or pair programming, especially success stories.
peerreview
pair-programming
sqa
software-engineering
null
null
open
Peer Reviews or Pair Programming, or Both? === Do you participate in code peer reviews or practice pair programming, or both? Have you been able to demonstrate an increase in software quality using these practices? What benefits and drawbacks have you observed in the course of practice? What hurdles to implementation did you face? In my own case, our development team pursued peer reviews of a number of different software artifacts (requirements analyses, test plans, code, and so on). Peer programming was not even considered as an option. The peer review practice was pushed down from the top, and the developers never bought into it. We had an external SQA group that gathered metrics from the activities, but the numbers were pretty worthless since the effort was half-hearted. After years of this being the "official" way to do things, the developers have come to collectively ignore the prescribed procedures. Now there is less visibility into when bugs are getting interjected into the lifecycle. And not doing the peer reviews has led to increased specialization on the team...where no one really knows the requirements/logic of components outside their own specialized area of the system. It would be valuable to know your experiences w/ peer reviews or pair programming, especially success stories.
0
23,950
08/23/2008 04:03:18
828
08/09/2008 06:12:41
6
1
Best method to get objects from a BlockingQueue in a concurrent program?
What is the best method to get objects out of a BlockingQueue, in a concurrent program, without hitting a race condition? I'm currently doing the following and I'm not convinced it is the best method: BlockingQueue<Violation> vQueue; /* in the constructor I pass in a BlockingQueue object full of violations that need to be processed - cut out for brevity */ Violation v; while ( ( v = vQueue.poll(500, TimeUnit.MILLISECONDS) ) != null ) { // do stuff with the violation } I have yet to hit a race condition... but, I'm none too sure if this is truly safe. Matt
java
concurrency
null
null
null
null
open
Best method to get objects from a BlockingQueue in a concurrent program? === What is the best method to get objects out of a BlockingQueue, in a concurrent program, without hitting a race condition? I'm currently doing the following and I'm not convinced it is the best method: BlockingQueue<Violation> vQueue; /* in the constructor I pass in a BlockingQueue object full of violations that need to be processed - cut out for brevity */ Violation v; while ( ( v = vQueue.poll(500, TimeUnit.MILLISECONDS) ) != null ) { // do stuff with the violation } I have yet to hit a race condition... but, I'm none too sure if this is truly safe. Matt
0
23,961
08/23/2008 04:11:36
2,580
08/23/2008 04:11:35
1
0
What to do about ScanAlert?
One of my clients uses McAfee ScanAlert (i.e., HackerSafe). It basically hits the site with about 1500 bad requests a day looking for security holes. Since it demonstrates malicious behavior it is tempting to just block it after a couple bad requests, but maybe I should let it exercise the UI. Is it a true test if I don't let it finish?
performance
security
null
null
null
null
open
What to do about ScanAlert? === One of my clients uses McAfee ScanAlert (i.e., HackerSafe). It basically hits the site with about 1500 bad requests a day looking for security holes. Since it demonstrates malicious behavior it is tempting to just block it after a couple bad requests, but maybe I should let it exercise the UI. Is it a true test if I don't let it finish?
0
23,962
08/23/2008 04:12:29
184
08/03/2008 05:34:19
716
9
Is there some way to speed up recursion by remembering child nodes?
For example, Look at the code that calculates the n-th Fibonacci number: fib(int n) { if(n==0 || n==1) return 1; return fib(n-1) + fib(n-2); } The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers). Assume that we are calculating fib(10). In this process, say fib(5) is calculated a lot of times. Is there some way to store this in memory for fast retrieval and thereby increase the speed of recursion? I am looking for a generic technique that can be used in almost all problems.
recursion
null
null
null
null
null
open
Is there some way to speed up recursion by remembering child nodes? === For example, Look at the code that calculates the n-th Fibonacci number: fib(int n) { if(n==0 || n==1) return 1; return fib(n-1) + fib(n-2); } The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers). Assume that we are calculating fib(10). In this process, say fib(5) is calculated a lot of times. Is there some way to store this in memory for fast retrieval and thereby increase the speed of recursion? I am looking for a generic technique that can be used in almost all problems.
0
23,963
08/23/2008 04:14:17
419
08/05/2008 14:48:22
1,995
120
RESTful web services and HTTP verbs
What is the minimum set of HTTP verbs that a server should allow for a web service to be classed as RESTful? What if my hoster doesn't permit ***PUT*** and ***DELETE***? Is this actually important, can I live happily ever after with just ***GET*** and ***POST*** ?
rest
webservices
null
null
null
null
open
RESTful web services and HTTP verbs === What is the minimum set of HTTP verbs that a server should allow for a web service to be classed as RESTful? What if my hoster doesn't permit ***PUT*** and ***DELETE***? Is this actually important, can I live happily ever after with just ***GET*** and ***POST*** ?
0
23,970
08/23/2008 04:22:44
1,190
08/13/2008 12:15:38
602
51
How do I marshall a lambda (Proc) in Ruby?
Joe Van Dyk [asked the Ruby mailing list][1]: > Hi, > In Ruby, I guess you can't marshal a lambda/proc object, right? Is that possible in lisp or other languages? > What I was trying to do: > `l = lamda { ... }` > `Bj.submit "/path/to/ruby/program", :stdin => Marshal.dump(l)` > So, I'm sending BackgroundJob a lambda object, which contains the context/code for what to do. But, guess that wasn't possible. I ended up marshaling a normal ruby object that contained instructions for what to do after the program ran. > Joe [1]: http://www.zenspider.com/pipermail/ruby/2008-August/004223.html
ruby
proc
lambda
serialization
null
null
open
How do I marshall a lambda (Proc) in Ruby? === Joe Van Dyk [asked the Ruby mailing list][1]: > Hi, > In Ruby, I guess you can't marshal a lambda/proc object, right? Is that possible in lisp or other languages? > What I was trying to do: > `l = lamda { ... }` > `Bj.submit "/path/to/ruby/program", :stdin => Marshal.dump(l)` > So, I'm sending BackgroundJob a lambda object, which contains the context/code for what to do. But, guess that wasn't possible. I ended up marshaling a normal ruby object that contained instructions for what to do after the program ran. > Joe [1]: http://www.zenspider.com/pipermail/ruby/2008-August/004223.html
0
23,988
08/23/2008 04:37:51
2,581
08/23/2008 04:37:51
1
0
Why is an s-box input longer than its output?
http://en.wikipedia.org/wiki/S-box I can't understand where the extra bits are coming from in this article about s-boxes. Why doesn't the s-box take in the same number of bits for input as output?
cryptography
null
null
null
null
null
open
Why is an s-box input longer than its output? === http://en.wikipedia.org/wiki/S-box I can't understand where the extra bits are coming from in this article about s-boxes. Why doesn't the s-box take in the same number of bits for input as output?
0
23,994
08/23/2008 04:51:32
2,305
08/21/2008 15:05:48
8
4
Experiences Using ASP.NET MVC Framework
I am wondering what experiences people are having using the ASP.NET MVC Framework? In particular I am looking for feedback on the type of experience folks are having using the framework. What are people using for their view engine? What about the db layer, NHibernate, LINQ to SQL or something else? Thank you.
asp.net-mvc
null
null
null
null
null
open
Experiences Using ASP.NET MVC Framework === I am wondering what experiences people are having using the ASP.NET MVC Framework? In particular I am looking for feedback on the type of experience folks are having using the framework. What are people using for their view engine? What about the db layer, NHibernate, LINQ to SQL or something else? Thank you.
0
23,996
08/23/2008 04:53:47
2,165
08/20/2008 17:43:59
1
1
Setting Attributes in Webby Layouts
I'm working with [Webby][1] and am looking for some clarification. Can I define attributes like `title` or `author` in my layout? [1]: http://webby.rubyforge.org "Webby"
ruby
webby
null
null
null
null
open
Setting Attributes in Webby Layouts === I'm working with [Webby][1] and am looking for some clarification. Can I define attributes like `title` or `author` in my layout? [1]: http://webby.rubyforge.org "Webby"
0
24,004
08/23/2008 05:06:44
2,528
08/22/2008 16:39:39
74
4
To what extent should a developer learn database?
Modern Databases systems today come with loads of feature. And you would agree with me that to learn one database you must unlearn the concepts you learned in another database. For e.g. each database would implement locking differently than other. So to carry the concepts of one database to another would be a recipe for failure. And there could be other examples where two database would perform very very differently. So while developing the database driven systems should the programmers need to know the database in detail so that they code for performance? I don't think it would be appropriate to have the DBA called for performance later as his job is to only maintain the database and help out the developer in case of emergency but not on a regular basis. What do you think should be the extent the developer needs to gain an insight into the database? Thanks.
database
null
null
null
null
null
open
To what extent should a developer learn database? === Modern Databases systems today come with loads of feature. And you would agree with me that to learn one database you must unlearn the concepts you learned in another database. For e.g. each database would implement locking differently than other. So to carry the concepts of one database to another would be a recipe for failure. And there could be other examples where two database would perform very very differently. So while developing the database driven systems should the programmers need to know the database in detail so that they code for performance? I don't think it would be appropriate to have the DBA called for performance later as his job is to only maintain the database and help out the developer in case of emergency but not on a regular basis. What do you think should be the extent the developer needs to gain an insight into the database? Thanks.
0
24,040
08/23/2008 06:33:08
718
08/08/2008 07:07:38
1,035
51
Is there a site for detailed unit testing samples?
Is there a site for unit testing as [RefactorMyCode][1] for refactoring? I think it would be a great help for beginners like me. [1]: http://refactormycode.com/
testing
unit-testing
null
null
null
null
open
Is there a site for detailed unit testing samples? === Is there a site for unit testing as [RefactorMyCode][1] for refactoring? I think it would be a great help for beginners like me. [1]: http://refactormycode.com/
0
24,041
08/23/2008 06:34:09
1,363
08/14/2008 18:24:19
89
3
Markdown vs Markup - are they related?
I'm using markdown to edit this question right now. In some wikis I used wiki markup. Are they the same thing? Are they related? Please explain. If I want to implement one or the other in a web project (like stackoverflow) what do I need to use?
markdown
markup
null
null
null
null
open
Markdown vs Markup - are they related? === I'm using markdown to edit this question right now. In some wikis I used wiki markup. Are they the same thing? Are they related? Please explain. If I want to implement one or the other in a web project (like stackoverflow) what do I need to use?
0
24,045
08/23/2008 06:42:01
163
08/02/2008 20:40:09
77
8
AnkhSVN versus VisualSVN
I currently use AnkhSVN to integrate subversion into Visual Studio. Is there any reason I should switch to VisualSVN? AnkhSVN is free (in more than one sense of the word) while VisualSVN costs $50. So right there unless I'm missing some great feature of VisualSVN I don't see any reason to switch.
subversion
visual-studio
ankhsvn
visualsvn
null
07/18/2012 12:04:19
not constructive
AnkhSVN versus VisualSVN === I currently use AnkhSVN to integrate subversion into Visual Studio. Is there any reason I should switch to VisualSVN? AnkhSVN is free (in more than one sense of the word) while VisualSVN costs $50. So right there unless I'm missing some great feature of VisualSVN I don't see any reason to switch.
4
24,046
08/23/2008 06:43:08
2,051
08/20/2008 00:46:22
21
2
The Safari Back Button Problem
I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years. A few days ago I got a call "The website is locking up for people using Safari!" Okay, step one download Safari(v3.1.2), step two surf to the site. Everything appears to work fine. Long story short I finally isolated the problem and it relates to Safari's back button. The website uses a fancy-pants javascript menu that works in every browser I've tried including Safari, the first time around. But in Safari if you follow a link off the page and then hit the back button the menu no longer works. I made a pared down webpage to illustrate the principle. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head><title>Safari Back Button Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body onload="alert('Hello');"> <a href="http://www.codinghorror.com">Coding Horror</a> </body> </html> Load the page and you see the alert box. Then follow the link off the page and hit the back button. In IE and Firefox you see the alert box again, in Safari you do not. After a vigorous googling I've discovered others with similar problems but no really satisfactory answers. So my question is how can I make my pages work the same way in Safari after the user hits the back button as they do in other browsers? If this is a stupid question please be gentle, javascript is somewhat new to me.
javascript
safari
null
null
null
null
open
The Safari Back Button Problem === I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years. A few days ago I got a call "The website is locking up for people using Safari!" Okay, step one download Safari(v3.1.2), step two surf to the site. Everything appears to work fine. Long story short I finally isolated the problem and it relates to Safari's back button. The website uses a fancy-pants javascript menu that works in every browser I've tried including Safari, the first time around. But in Safari if you follow a link off the page and then hit the back button the menu no longer works. I made a pared down webpage to illustrate the principle. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head><title>Safari Back Button Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body onload="alert('Hello');"> <a href="http://www.codinghorror.com">Coding Horror</a> </body> </html> Load the page and you see the alert box. Then follow the link off the page and hit the back button. In IE and Firefox you see the alert box again, in Safari you do not. After a vigorous googling I've discovered others with similar problems but no really satisfactory answers. So my question is how can I make my pages work the same way in Safari after the user hits the back button as they do in other browsers? If this is a stupid question please be gentle, javascript is somewhat new to me.
0
24,099
08/23/2008 09:19:54
163
08/02/2008 20:40:09
84
9
Best way to license Microsoft software as a very small developer
I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer? My previous boss suggested I get a TechNet Plus subscription for OS licenses, I've done that and appears to be what I need, but open to other options for the future. Visual Studio I'm having a hard time figuring out exactly what is the difference between Professional and Standard. Also I'd really like a digital version, but seems that expensive MSDN subscription is the only way?
visual-studio
windows
licensing
microsoft
consulting
null
open
Best way to license Microsoft software as a very small developer === I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer? My previous boss suggested I get a TechNet Plus subscription for OS licenses, I've done that and appears to be what I need, but open to other options for the future. Visual Studio I'm having a hard time figuring out exactly what is the difference between Professional and Standard. Also I'd really like a digital version, but seems that expensive MSDN subscription is the only way?
0
24,109
08/23/2008 09:52:59
46
08/01/2008 13:13:21
461
27
C++ IDE for linux
I'm currently in the process of expanding my programming horizons to linux. In order to do that, it is important to have a good basic toolset on which you can rely on. and what is more basic then the IDE in which you write your code? (honestly, you don't want to code in notepad; been there done that). there are two other questions/answers I could find here at stackoverflow that are somewhat related: - [Lightweight IDE for linux][1] and - [What tools do you use to develop C++ applications on Linux?][2] but I'm not really looking for a *lightweight* IDE and if it is really worth the money I will pay for it, so it doesn't need to be free as well. So my question is: *what is a good IDE available in linux to use as a programming platform for writing c++ code?* The minimum should be like any other good IDE: syntax highlighting, code completion (like [intellisense][3] or its eclipse counterpart) and integrated debugging (basic breakpoints are good) I already have searched for it myself, but there is so much to choose from that it is almost impossible to separate the good from the bads by hand, especially for someone like me without any c++ coding experience in linux. However I do know that [eclipse supports c++][4], and I really like that IDE for java, but is it any good for c++ and won't I miss out on something that is even better? the second post actually has some good suggestions, but what I am missing is what exactly makes the sugested IDE so good for the user, what are its advantages/disadvantages? maybe my question should therefore be: *what IDE do you propose given your own experience with it?, and why that one? ... convince me* [1]: http://stackoverflow.com/questions/2756/lightweight-ide-for-linux [2]: http://stackoverflow.com/questions/17228/what-tools-do-you-use-to-develop-c-applications-on-linux [3]: http://en.wikipedia.org/wiki/IntelliSense [4]: http://www.eclipse.org/cdt/
c++
ide
linux
null
null
null
open
C++ IDE for linux === I'm currently in the process of expanding my programming horizons to linux. In order to do that, it is important to have a good basic toolset on which you can rely on. and what is more basic then the IDE in which you write your code? (honestly, you don't want to code in notepad; been there done that). there are two other questions/answers I could find here at stackoverflow that are somewhat related: - [Lightweight IDE for linux][1] and - [What tools do you use to develop C++ applications on Linux?][2] but I'm not really looking for a *lightweight* IDE and if it is really worth the money I will pay for it, so it doesn't need to be free as well. So my question is: *what is a good IDE available in linux to use as a programming platform for writing c++ code?* The minimum should be like any other good IDE: syntax highlighting, code completion (like [intellisense][3] or its eclipse counterpart) and integrated debugging (basic breakpoints are good) I already have searched for it myself, but there is so much to choose from that it is almost impossible to separate the good from the bads by hand, especially for someone like me without any c++ coding experience in linux. However I do know that [eclipse supports c++][4], and I really like that IDE for java, but is it any good for c++ and won't I miss out on something that is even better? the second post actually has some good suggestions, but what I am missing is what exactly makes the sugested IDE so good for the user, what are its advantages/disadvantages? maybe my question should therefore be: *what IDE do you propose given your own experience with it?, and why that one? ... convince me* [1]: http://stackoverflow.com/questions/2756/lightweight-ide-for-linux [2]: http://stackoverflow.com/questions/17228/what-tools-do-you-use-to-develop-c-applications-on-linux [3]: http://en.wikipedia.org/wiki/IntelliSense [4]: http://www.eclipse.org/cdt/
0
24,113
08/23/2008 09:57:28
2,528
08/22/2008 16:39:39
97
4
Outlook Add-in using .NET
We have been developing an Outlook Add-in using Visual Studio 2008. However I am facing a strange behavior while adding a command button to a custom command bar. This behavior is reflected when we add the button in the reply, reply all and forward windows. The issue is that the caption of the command button is not visible though when we debug using VS it shows the caption correctly. But the button is captionless when viewed in Outlook(2003). I have the code snippet as below. Any help would be appreciated. private void AddButtonInNewInspector(Microsoft.Office.Interop.Outlook.Inspector inspector) { try { if (inspector.CurrentItem is Microsoft.Office.Interop.Outlook.MailItem) { try { foreach (CommandBar c in inspector.CommandBars) { if (c.Name == "custom") { c.Delete(); } } } catch { } finally { //Add Custom Command bar and command button. CommandBar myCommandBar = inspector.CommandBars.Add("custom", MsoBarPosition.msoBarTop, false, true); myCommandBar.Visible = true; CommandBarControl myCommandbarButton = myCommandBar.Controls.Add(MsoControlType.msoControlButton, 1, "Add", System.Reflection.Missing.Value, true); myCommandbarButton.Caption = "Add Email"; myCommandbarButton.Width = 900; myCommandbarButton.Visible = true; myCommandbarButton.DescriptionText = "This is Add Email Button"; CommandBarButton btnclickhandler = (CommandBarButton)myCommandbarButton; btnclickhandler.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this.OnAddEmailButtonClick); } } } catch (System.Exception ex) { MessageBox.Show(ex.Message.ToString(), "AddButtInNewInspector"); } }
.net
outlook
add-in
null
null
null
open
Outlook Add-in using .NET === We have been developing an Outlook Add-in using Visual Studio 2008. However I am facing a strange behavior while adding a command button to a custom command bar. This behavior is reflected when we add the button in the reply, reply all and forward windows. The issue is that the caption of the command button is not visible though when we debug using VS it shows the caption correctly. But the button is captionless when viewed in Outlook(2003). I have the code snippet as below. Any help would be appreciated. private void AddButtonInNewInspector(Microsoft.Office.Interop.Outlook.Inspector inspector) { try { if (inspector.CurrentItem is Microsoft.Office.Interop.Outlook.MailItem) { try { foreach (CommandBar c in inspector.CommandBars) { if (c.Name == "custom") { c.Delete(); } } } catch { } finally { //Add Custom Command bar and command button. CommandBar myCommandBar = inspector.CommandBars.Add("custom", MsoBarPosition.msoBarTop, false, true); myCommandBar.Visible = true; CommandBarControl myCommandbarButton = myCommandBar.Controls.Add(MsoControlType.msoControlButton, 1, "Add", System.Reflection.Missing.Value, true); myCommandbarButton.Caption = "Add Email"; myCommandbarButton.Width = 900; myCommandbarButton.Visible = true; myCommandbarButton.DescriptionText = "This is Add Email Button"; CommandBarButton btnclickhandler = (CommandBarButton)myCommandbarButton; btnclickhandler.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this.OnAddEmailButtonClick); } } } catch (System.Exception ex) { MessageBox.Show(ex.Message.ToString(), "AddButtInNewInspector"); } }
0
24,125
08/23/2008 10:30:55
1,013
08/11/2008 13:24:18
168
27
Screencast software
I want to screencast an application in windows. What good options are out there? I just want it for 1-3 videos, so I prefer free but am willing to pay if have to. Thanks
windows
video
null
null
null
null
open
Screencast software === I want to screencast an application in windows. What good options are out there? I just want it for 1-3 videos, so I prefer free but am willing to pay if have to. Thanks
0
24,130
08/23/2008 10:41:36
1,384,652
08/01/2008 12:01:23
1,292
78
Classes vs 2D arrays
Which is better to use in PHP, a 2D array or a class? I've included an example of what I mean by this. // Using a class class someClass { public $name; public $height; public $weight; function __construct($name, $height, $weight) { $this -> name = $name; $this -> height = $height; $this -> weight = $weight; } } $classArray[1] = new someClass('Bob', 10, 20); $classArray[2] = new someClass('Fred', 15, 10); $classArray[3] = new someClass('Ned', 25, 30); // Using a 2D array $normalArray[1]['name'] = 'Bob'; $normalArray[1]['height'] = 10; $normalArray[1]['weight'] = 20; $normalArray[2]['name'] = 'Fred'; $normalArray[2]['height'] = 15; $normalArray[2]['weight'] = 10; $normalArray[3]['name'] = 'Ned'; $normalArray[3]['height'] = 25; $normalArray[3]['weight'] = 30;
php
arrays
classes
null
null
null
open
Classes vs 2D arrays === Which is better to use in PHP, a 2D array or a class? I've included an example of what I mean by this. // Using a class class someClass { public $name; public $height; public $weight; function __construct($name, $height, $weight) { $this -> name = $name; $this -> height = $height; $this -> weight = $weight; } } $classArray[1] = new someClass('Bob', 10, 20); $classArray[2] = new someClass('Fred', 15, 10); $classArray[3] = new someClass('Ned', 25, 30); // Using a 2D array $normalArray[1]['name'] = 'Bob'; $normalArray[1]['height'] = 10; $normalArray[1]['weight'] = 20; $normalArray[2]['name'] = 'Fred'; $normalArray[2]['height'] = 15; $normalArray[2]['weight'] = 10; $normalArray[3]['name'] = 'Ned'; $normalArray[3]['height'] = 25; $normalArray[3]['weight'] = 30;
0
24,165
08/23/2008 12:01:25
1,820
08/18/2008 18:06:03
571
26
From Monorail to ASP.Net MVC
The last time I took on a non-trivial .Net/C# application I used Castle Monorail and on the whole enjoyed the experience. Early-access/preview releases of .Net MVC were not yet available. Many "Microsoft shops" will now find the "official" solution more appealing. Has anyone gone from Monorail to .Net MVC. How did you find the switch? What are the biggest differences, presently?
asp.net-mvc
asp.net
c#
castle
monorail
null
open
From Monorail to ASP.Net MVC === The last time I took on a non-trivial .Net/C# application I used Castle Monorail and on the whole enjoyed the experience. Early-access/preview releases of .Net MVC were not yet available. Many "Microsoft shops" will now find the "official" solution more appealing. Has anyone gone from Monorail to .Net MVC. How did you find the switch? What are the biggest differences, presently?
0
24,168
08/23/2008 12:04:48
1,219
08/13/2008 13:44:47
1,196
81
Why are relational set-based queries better than cursors?
When writing database queries in something like TSQL or PLSQL, we often have a choice of iterating over rows with a cursor to accomplish the task, or crafting a single SQL statement that does the same job all at once. Also, we have the choice of simply pulling a large set of data back into our application and then processing it row by row, with C# or Java or PHP or whatever. Why is it better to use set-based queries? What is the theory behind this choice? What is a good example of a cursor-based solution and its relational equivalent?
sql
language-agnostic
query
cursor
null
null
open
Why are relational set-based queries better than cursors? === When writing database queries in something like TSQL or PLSQL, we often have a choice of iterating over rows with a cursor to accomplish the task, or crafting a single SQL statement that does the same job all at once. Also, we have the choice of simply pulling a large set of data back into our application and then processing it row by row, with C# or Java or PHP or whatever. Why is it better to use set-based queries? What is the theory behind this choice? What is a good example of a cursor-based solution and its relational equivalent?
0
24,179
08/23/2008 12:22:04
2,588
08/23/2008 12:17:49
1
0
How does Hive compare to HBase?
I'm interested in finding out how the recently-released (http://mirror.facebook.com/facebook/hive/hadoop-0.17/) Hive compares to HBase in terms of performance. The SQL-like interface used by Hive is very much preferable to the HBase API we have implemented.
hadoop
hbase
hive
null
null
null
open
How does Hive compare to HBase? === I'm interested in finding out how the recently-released (http://mirror.facebook.com/facebook/hive/hadoop-0.17/) Hive compares to HBase in terms of performance. The SQL-like interface used by Hive is very much preferable to the HBase API we have implemented.
0
24,193
08/23/2008 12:41:43
267
08/04/2008 10:11:06
2,280
127
Python code generator for Visual Studio?
I had an idea, if I add a python .py file to my C# project, and tag the file with a custom generator that would execute the python file, and treat the output as the result of the code generation, ie. put it into a C# file, that would allow me to do quite a lot of code generation as part of the build process. Does anyone know if such a custom generator for Visual Studio 2008 exists?
python
code-generation
visual-studio
null
null
null
open
Python code generator for Visual Studio? === I had an idea, if I add a python .py file to my C# project, and tag the file with a custom generator that would execute the python file, and treat the output as the result of the code generation, ie. put it into a C# file, that would allow me to do quite a lot of code generation as part of the build process. Does anyone know if such a custom generator for Visual Studio 2008 exists?
0
24,196
08/23/2008 12:47:55
1,175
08/13/2008 10:21:54
513
63
Good Framework for Bitmaps and Button Handling
We have a set of applications that basically display a bunch of bitmaps and text, then allow user to press "buttons" (certain bitmaps) that cause actions to occur. We currently have these implemented using DirectX and a bunch of code to place the bitmaps and handle the button-presses. But we'd like to have the following features: - portable to Linux - some sort of "editor" that would allow us to lay out screens without hard-coding locations of elements in code - not resource intensive (these terminals don't have a lot of memory or CPU) - we're currently using C++, so management would prefer that, but other languages would be considered - We'd prefer a free, open-source solution, but would be willing to buy something if it is not too expensive. (We have a couple dozen developers, and tens of thousands of terminals deployed.) We don't like the common GUI toolkits or widgets. We want something that has more of the look of a game than of a dialog box. Any suggestions for off-the-shelf stuff we could use?
graphics
bitmaps
gui
c++
null
null
open
Good Framework for Bitmaps and Button Handling === We have a set of applications that basically display a bunch of bitmaps and text, then allow user to press "buttons" (certain bitmaps) that cause actions to occur. We currently have these implemented using DirectX and a bunch of code to place the bitmaps and handle the button-presses. But we'd like to have the following features: - portable to Linux - some sort of "editor" that would allow us to lay out screens without hard-coding locations of elements in code - not resource intensive (these terminals don't have a lot of memory or CPU) - we're currently using C++, so management would prefer that, but other languages would be considered - We'd prefer a free, open-source solution, but would be willing to buy something if it is not too expensive. (We have a couple dozen developers, and tens of thousands of terminals deployed.) We don't like the common GUI toolkits or widgets. We want something that has more of the look of a game than of a dialog box. Any suggestions for off-the-shelf stuff we could use?
0
24,200
08/23/2008 12:53:09
1,948
08/19/2008 14:55:33
26
3
What's the fastest way to bulk insert a lot of data in SQL Server (C# client)
I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process. I am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across the wire which helped a lot, but I'm still looking for more. I have a simple table that looks like this: CREATE TABLE [BulkData]( [ContainerId] [int] NOT NULL, [BinId] [smallint] NOT NULL, [Sequence] [smallint] NOT NULL, [ItemId] [int] NOT NULL, [Left] [smallint] NOT NULL, [Top] [smallint] NOT NULL, [Right] [smallint] NOT NULL, [Bottom] [smallint] NOT NULL, CONSTRAINT [PKBulkData] PRIMARY KEY CLUSTERED ( [ContainerIdId] ASC, [BinId] ASC, [Sequence] ASC )) I'm inserting data in chunks that average about 300 rows where ContainerId and BinId are constant in each chunk and the Sequence value is 0-n and the values are pre-sorted based on the primary key. The %Disk time performance counter spends a lot of time at 100% so it is clear that disk IO is the main issue but the speeds I'm getting are several orders of magnitude below a raw file copy. Does it help any if I: 1. Drop the Primary key while I am doing the inserting and recreate it later 2. Do inserts into a temporary table with the same schema and periodically transfer them into the main table to keep the size of the table where insertions are happening small 3. Anything else? ~ Andrew
sql
c#
sql-server
sql-server-2005
null
null
open
What's the fastest way to bulk insert a lot of data in SQL Server (C# client) === I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process. I am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across the wire which helped a lot, but I'm still looking for more. I have a simple table that looks like this: CREATE TABLE [BulkData]( [ContainerId] [int] NOT NULL, [BinId] [smallint] NOT NULL, [Sequence] [smallint] NOT NULL, [ItemId] [int] NOT NULL, [Left] [smallint] NOT NULL, [Top] [smallint] NOT NULL, [Right] [smallint] NOT NULL, [Bottom] [smallint] NOT NULL, CONSTRAINT [PKBulkData] PRIMARY KEY CLUSTERED ( [ContainerIdId] ASC, [BinId] ASC, [Sequence] ASC )) I'm inserting data in chunks that average about 300 rows where ContainerId and BinId are constant in each chunk and the Sequence value is 0-n and the values are pre-sorted based on the primary key. The %Disk time performance counter spends a lot of time at 100% so it is clear that disk IO is the main issue but the speeds I'm getting are several orders of magnitude below a raw file copy. Does it help any if I: 1. Drop the Primary key while I am doing the inserting and recreate it later 2. Do inserts into a temporary table with the same schema and periodically transfer them into the main table to keep the size of the table where insertions are happening small 3. Anything else? ~ Andrew
0
24,207
08/23/2008 12:57:16
1,968
08/19/2008 15:59:21
591
40
“rusage” statistics
I'm trying to use “rusage” statistics in my program to get data similar to that of the [time](http://en.wikipedia.org/wiki/Time_%28Unix%29) tool. However, I'm pretty sure that I'm doing something wrong. The values seem about right but can be a bit weird at times. I didn't find good resources online. Does somebody know how to do it better? Sorry for the long code. class StopWatch { public: void start() { getrusage(RUSAGE_SELF, &m_begin); gettimeofday(&m_tmbegin, 0); } void stop() { getrusage(RUSAGE_SELF, &m_end); gettimeofday(&m_tmend, 0); timeval_sub(m_end.ru_utime, m_begin.ru_utime, m_diff.ru_utime); timeval_sub(m_end.ru_stime, m_begin.ru_stime, m_diff.ru_stime); timeval_sub(m_tmend, m_tmbegin, m_tmdiff); } void printf(std::ostream& out) const { using namespace std; timeval const& utime = m_diff.ru_utime; timeval const& stime = m_diff.ru_stime; format_time(out, utime); out << "u "; format_time(out, stime); out << "s "; format_time(out, m_tmdiff); } private: rusage m_begin; rusage m_end; rusage m_diff; timeval m_tmbegin; timeval m_tmend; timeval m_tmdiff; static void timeval_add(timeval const& a, timeval const& b, timeval& ret) { ret.tv_usec = a.tv_usec + b.tv_usec; ret.tv_sec = a.tv_sec + b.tv_sec; if (ret.tv_usec > 999999) { ret.tv_usec -= 1000000; ++ret.tv_sec; } } static void timeval_sub(timeval const& a, timeval const& b, timeval& ret) { ret.tv_usec = a.tv_usec - b.tv_usec; ret.tv_sec = a.tv_sec - b.tv_sec; if (a.tv_usec < b.tv_usec) { ret.tv_usec += 1000000; --ret.tv_sec; } } static void format_time(std::ostream& out, timeval const& tv) { using namespace std; long usec = tv.tv_usec; while (usec >= 1000) usec /= 10; out << tv.tv_sec << '.' << setw(3) << setfill('0') << usec; } }; // class StopWatch
c++
unix
profiling
null
null
null
open
“rusage” statistics === I'm trying to use “rusage” statistics in my program to get data similar to that of the [time](http://en.wikipedia.org/wiki/Time_%28Unix%29) tool. However, I'm pretty sure that I'm doing something wrong. The values seem about right but can be a bit weird at times. I didn't find good resources online. Does somebody know how to do it better? Sorry for the long code. class StopWatch { public: void start() { getrusage(RUSAGE_SELF, &m_begin); gettimeofday(&m_tmbegin, 0); } void stop() { getrusage(RUSAGE_SELF, &m_end); gettimeofday(&m_tmend, 0); timeval_sub(m_end.ru_utime, m_begin.ru_utime, m_diff.ru_utime); timeval_sub(m_end.ru_stime, m_begin.ru_stime, m_diff.ru_stime); timeval_sub(m_tmend, m_tmbegin, m_tmdiff); } void printf(std::ostream& out) const { using namespace std; timeval const& utime = m_diff.ru_utime; timeval const& stime = m_diff.ru_stime; format_time(out, utime); out << "u "; format_time(out, stime); out << "s "; format_time(out, m_tmdiff); } private: rusage m_begin; rusage m_end; rusage m_diff; timeval m_tmbegin; timeval m_tmend; timeval m_tmdiff; static void timeval_add(timeval const& a, timeval const& b, timeval& ret) { ret.tv_usec = a.tv_usec + b.tv_usec; ret.tv_sec = a.tv_sec + b.tv_sec; if (ret.tv_usec > 999999) { ret.tv_usec -= 1000000; ++ret.tv_sec; } } static void timeval_sub(timeval const& a, timeval const& b, timeval& ret) { ret.tv_usec = a.tv_usec - b.tv_usec; ret.tv_sec = a.tv_sec - b.tv_sec; if (a.tv_usec < b.tv_usec) { ret.tv_usec += 1000000; --ret.tv_sec; } } static void format_time(std::ostream& out, timeval const& tv) { using namespace std; long usec = tv.tv_usec; while (usec >= 1000) usec /= 10; out << tv.tv_sec << '.' << setw(3) << setfill('0') << usec; } }; // class StopWatch
0
24,212
08/23/2008 13:07:19
1,304
08/14/2008 13:19:08
35
4
Use QItemDelegate to show image thumbnails
What's the best way to use QT4's [QItemDelegate][1] to show thumbnails for images in a view? Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)? Can anyone link to some example code that achieves this? [1]: http://doc.trolltech.com/4.4/qitemdelegate.html
c++
qt
model-driven
null
null
null
open
Use QItemDelegate to show image thumbnails === What's the best way to use QT4's [QItemDelegate][1] to show thumbnails for images in a view? Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)? Can anyone link to some example code that achieves this? [1]: http://doc.trolltech.com/4.4/qitemdelegate.html
0
24,216
08/23/2008 13:17:48
2,078
08/20/2008 08:00:36
47
10
Resharper vs. CodeRush
I know there are many discussions if Resharper or CodeRush is better. At my company we currently use Resharper and I'm fine with it. But last week I watched a screencast about CodeRush and thought it was amazing. There are just so many "new" refactorings that I immediately thought about a migration. What's your favorite tool for refactoring, code-analysis, navigation inside Visual Studio etc and why? At which areas do you think is Resharper better and at which areas CodeRush?
#visualstudio
resharper
coderush
null
null
07/14/2011 13:45:01
too localized
Resharper vs. CodeRush === I know there are many discussions if Resharper or CodeRush is better. At my company we currently use Resharper and I'm fine with it. But last week I watched a screencast about CodeRush and thought it was amazing. There are just so many "new" refactorings that I immediately thought about a migration. What's your favorite tool for refactoring, code-analysis, navigation inside Visual Studio etc and why? At which areas do you think is Resharper better and at which areas CodeRush?
3
24,221
08/23/2008 13:23:14
142
08/02/2008 12:41:43
87
6
Java Annotations
What is the purpose of annotations in Java? I have this fuzzy idea of them as somewhere in between a comment and actual code. Do they effect the running of a program?? What are typical usages for them? Also, are they unique to Java, is there a C++ equivalent?
java
annotations
null
null
null
null
open
Java Annotations === What is the purpose of annotations in Java? I have this fuzzy idea of them as somewhere in between a comment and actual code. Do they effect the running of a program?? What are typical usages for them? Also, are they unique to Java, is there a C++ equivalent?
0
24,241
08/23/2008 13:57:06
2,128
08/20/2008 13:32:09
38
2
Code Injection With C#
I just saw [This Question][1] and it made me wonder: Can you use windows hooks or other methods to do code injection with c#? I've seen lots of things about code injection but all of them are done in C/C++. I don't know either of those languages and have a really hard time translating. Does anyone have any ideas on how to do this? [1]: http://stackoverflow.com/questions/24230/injecting-a-managed-net-assembly-dll-into-another-process
codeinjection
c#
null
null
null
null
open
Code Injection With C# === I just saw [This Question][1] and it made me wonder: Can you use windows hooks or other methods to do code injection with c#? I've seen lots of things about code injection but all of them are done in C/C++. I don't know either of those languages and have a really hard time translating. Does anyone have any ideas on how to do this? [1]: http://stackoverflow.com/questions/24230/injecting-a-managed-net-assembly-dll-into-another-process
0
24,243
08/23/2008 14:01:32
298
08/04/2008 13:29:28
94
7
Select existing data from database to create test data
I have a SqlServer database that I've manually filled with some test data. Now I'd like to extract this test data as insert statements and check it in to source control. The idea is that other team members should be able to create the same database, run the created insert scripts and have the same data to test and develop on. Is there a good tool out there to do this? I'm **not** looking for a tool to generate data as discussed [here][1]. [1]: http://stackoverflow.com/questions/16317/creating-test-data-in-a-database
sql-server
database
null
null
null
null
open
Select existing data from database to create test data === I have a SqlServer database that I've manually filled with some test data. Now I'd like to extract this test data as insert statements and check it in to source control. The idea is that other team members should be able to create the same database, run the created insert scripts and have the same data to test and develop on. Is there a good tool out there to do this? I'm **not** looking for a tool to generate data as discussed [here][1]. [1]: http://stackoverflow.com/questions/16317/creating-test-data-in-a-database
0
24,252
08/23/2008 14:19:34
1,037
08/11/2008 17:42:51
288
23
Starting with .NET
Being a self-taught "amateur" programmer, I do most programming in my spare time, for relatively small projects, or for small study-related utilities. I greatly enjoy it, though, and have learned a great deal over the past couple of years. Through various weblogs and websites, I've become acquainted with version control, bug tracking, unit testing etc. The languages I'm currently working in are mostly Delphi (2007 for Win32), as well as some PHP. I've been very happy with both (actually, I'm using Delphi for a rather large side-project), but the things I've seen of .NET (especially C#) seem very, _very_ interesting. I haven't really had the time to dive into .NET, though; also, it seems like there are some serious financial burdens one needs to overcome before one can get started with it (the whole VS stack is quite an investment for someone who doesn't spend his whole work day programming). So my question boils down to, actually, a couple of related questions: - What strengths of .NET would make a switch to it worthwhile for an amateur programmer like me? - What are good resources to get started with .NET/C#, esp. books? - How would you build a relatively cheap development stack for .NET? I realize this is a rather open question, but I haven't really found a good web resource that covers these topics. Also, advice from experienced programmers like you guys around here tends to be invaluable! Thanks a lot!
.net
c#
gettingstarted
null
null
06/11/2012 08:32:04
not constructive
Starting with .NET === Being a self-taught "amateur" programmer, I do most programming in my spare time, for relatively small projects, or for small study-related utilities. I greatly enjoy it, though, and have learned a great deal over the past couple of years. Through various weblogs and websites, I've become acquainted with version control, bug tracking, unit testing etc. The languages I'm currently working in are mostly Delphi (2007 for Win32), as well as some PHP. I've been very happy with both (actually, I'm using Delphi for a rather large side-project), but the things I've seen of .NET (especially C#) seem very, _very_ interesting. I haven't really had the time to dive into .NET, though; also, it seems like there are some serious financial burdens one needs to overcome before one can get started with it (the whole VS stack is quite an investment for someone who doesn't spend his whole work day programming). So my question boils down to, actually, a couple of related questions: - What strengths of .NET would make a switch to it worthwhile for an amateur programmer like me? - What are good resources to get started with .NET/C#, esp. books? - How would you build a relatively cheap development stack for .NET? I realize this is a rather open question, but I haven't really found a good web resource that covers these topics. Also, advice from experienced programmers like you guys around here tends to be invaluable! Thanks a lot!
4
24,262
08/23/2008 14:31:21
2,605
08/23/2008 14:25:40
1
0
About File permissions in C#
While creating a file synchronization program in C# I tryed to make a method 'copy' from LocalFileItem class that uses sing System.IO.File.Copy(destination.Path, Path, true) where Path is a string. After executing this code with destination.Path = "C:\\Test2" and this.Path = "C:\\Test\\F1.txt" I get an exception saying that I do not have the required file permissions to do this operation on C:\Test, but C:\Test is owned by myself(the current user). Does anybody knows what is going on, or how to get around this?
c#
null
null
null
null
null
open
About File permissions in C# === While creating a file synchronization program in C# I tryed to make a method 'copy' from LocalFileItem class that uses sing System.IO.File.Copy(destination.Path, Path, true) where Path is a string. After executing this code with destination.Path = "C:\\Test2" and this.Path = "C:\\Test\\F1.txt" I get an exception saying that I do not have the required file permissions to do this operation on C:\Test, but C:\Test is owned by myself(the current user). Does anybody knows what is going on, or how to get around this?
0
24,270
08/23/2008 14:40:28
2,131
08/20/2008 13:45:48
304
33
What's the point of OOP?
As far as I can tell, in spite of the countless millions or billions spent on OOP education, languages, and tools, OOP has not improved developer productivity or software reliability, nor has it reduced development costs. Few people use OOP in any rigorous sense (few people adhere to or understand principles such as LSP); there seems to be little uniformity or consistency to the approaches that people take to modelling problem domains. All too often, the class is used simply for its syntactic sugar; it puts the functions for a record type into their own little namespace. I've written a large amount of code for a wide variety of applications. Although there have been places where true substitutable subtyping played a valuable role in the application, these have been pretty exceptional. In general, though much lip service is given to talk of "re-use" the reality is that unless a piece of code does _exactly_ what you want it to do, there's very little cost-effective "re-use". It's extremely hard to design classes to be extensible _in the right way_, and so the cost of extension is normally so great that "re-use" simply isn't worthwhile. In many regards, this doesn't surprise me. The real world isn't "OO", and the idea implicit in OO--that we can model things with some class taxonomy--seems to me very fundamentally flawed (I can sit on a table, a tree stump, a car bonnet, someone's lap--but not one of those is-a chair). Even if we move to more abstract domains, OO modelling is often difficult, counterintuitive, and ultimately unhelpful (consider the classic examples of circles/ellipses or squares/rectangles). So what am I missing here? Where's the value of OOP, and why has all the time and money failed to make software any better?
language-agnostic
oop
null
null
null
null
open
What's the point of OOP? === As far as I can tell, in spite of the countless millions or billions spent on OOP education, languages, and tools, OOP has not improved developer productivity or software reliability, nor has it reduced development costs. Few people use OOP in any rigorous sense (few people adhere to or understand principles such as LSP); there seems to be little uniformity or consistency to the approaches that people take to modelling problem domains. All too often, the class is used simply for its syntactic sugar; it puts the functions for a record type into their own little namespace. I've written a large amount of code for a wide variety of applications. Although there have been places where true substitutable subtyping played a valuable role in the application, these have been pretty exceptional. In general, though much lip service is given to talk of "re-use" the reality is that unless a piece of code does _exactly_ what you want it to do, there's very little cost-effective "re-use". It's extremely hard to design classes to be extensible _in the right way_, and so the cost of extension is normally so great that "re-use" simply isn't worthwhile. In many regards, this doesn't surprise me. The real world isn't "OO", and the idea implicit in OO--that we can model things with some class taxonomy--seems to me very fundamentally flawed (I can sit on a table, a tree stump, a car bonnet, someone's lap--but not one of those is-a chair). Even if we move to more abstract domains, OO modelling is often difficult, counterintuitive, and ultimately unhelpful (consider the classic examples of circles/ellipses or squares/rectangles). So what am I missing here? Where's the value of OOP, and why has all the time and money failed to make software any better?
0
24,279
08/23/2008 14:58:11
1,384,652
08/01/2008 12:01:23
1,312
80
Functional programming and non-functional programming
In my second year of University we were "taught" Haskell, I know almost nothing about it and even less about functional programming. What is functional programming, why and/xor where would I want to use it instead of non-functional programming and am I correct in thinking that C is a non-functional programming language? **Related topics**<br> [What’s a good beginning text on functional programming?][1] [1]: http://stackoverflow.com/questions/23166/whats-a-good-beginning-text-on-functional-programming
functionalprogramming
functional
null
null
null
null
open
Functional programming and non-functional programming === In my second year of University we were "taught" Haskell, I know almost nothing about it and even less about functional programming. What is functional programming, why and/xor where would I want to use it instead of non-functional programming and am I correct in thinking that C is a non-functional programming language? **Related topics**<br> [What’s a good beginning text on functional programming?][1] [1]: http://stackoverflow.com/questions/23166/whats-a-good-beginning-text-on-functional-programming
0
24,298
08/23/2008 15:27:11
168
08/02/2008 21:53:24
1
0
Best Solution For Authentication in Ruby on Rails
I'm looking for a pre-built solution I can use in my RoR application. I'm ideally looking for something similar to the ASP.NET Forms authentication that provides email validation, sign-up controls, and allows users to reset their passwords. Oh yeah, and easily allows me to pull the user that is currently logged into the application. I've started to look into the already written pieces, but I've found it to be really confusing. I've looked at LoginGenerator, RestfulAuthentication, SaltedLoginGenerator, but there doesn't seem to be one place that has great tutorials or provide a comparison of them. If there's a site I just haven't discovered yet, or if there is a de-facto standard that most people use, I'd appreciate the helping hand.
ruby
rubyonrails
null
null
null
null
open
Best Solution For Authentication in Ruby on Rails === I'm looking for a pre-built solution I can use in my RoR application. I'm ideally looking for something similar to the ASP.NET Forms authentication that provides email validation, sign-up controls, and allows users to reset their passwords. Oh yeah, and easily allows me to pull the user that is currently logged into the application. I've started to look into the already written pieces, but I've found it to be really confusing. I've looked at LoginGenerator, RestfulAuthentication, SaltedLoginGenerator, but there doesn't seem to be one place that has great tutorials or provide a comparison of them. If there's a site I just haven't discovered yet, or if there is a de-facto standard that most people use, I'd appreciate the helping hand.
0
24,310
08/23/2008 15:49:06
25
08/01/2008 12:15:23
1,028
60
Programming a simple IRC (Internet-Relay-Chat) Client.
I started using IRC at a young age, and I have always been fascinated with it. As a language exercise, I was thinking about programming a simple IRC client in Ruby with [Shoes][1] as a graphical front-end. My question to you, kind-sirs, what do I need to become familiar with to start on this great adventure (besides shoes and Ruby of course)? I image there is some-sort of specification on IRC Protocol. Any pointers? [1]: http://www.shoooes.net/
ruby
shoes
irc-protocol
irc
null
null
open
Programming a simple IRC (Internet-Relay-Chat) Client. === I started using IRC at a young age, and I have always been fascinated with it. As a language exercise, I was thinking about programming a simple IRC client in Ruby with [Shoes][1] as a graphical front-end. My question to you, kind-sirs, what do I need to become familiar with to start on this great adventure (besides shoes and Ruby of course)? I image there is some-sort of specification on IRC Protocol. Any pointers? [1]: http://www.shoooes.net/
0
24,315
08/23/2008 15:54:56
392
08/05/2008 12:29:07
610
36
Is It Possible To Raise An Event When A File Becomes Accessible?
In C# I can use the FileSystemWatcher object to watch for a specific file and raise an event when it is created, modified, etc. The problem I have with this class is that it raises the event the moment the file becomes created, even if the process which created the file is still in the process of writing. I have found this to be very problematic, especially if I'm trying to read something like an XML document where the file must have some structure to it which won't exist until it is completed being written. Does .NET (preferably 2.0) have any way to raise an event after the file becomes accessible, or do I have to constantly try reading the file until it doesn't throw an exception to know it is available?
c#
.net
file-io
null
null
null
open
Is It Possible To Raise An Event When A File Becomes Accessible? === In C# I can use the FileSystemWatcher object to watch for a specific file and raise an event when it is created, modified, etc. The problem I have with this class is that it raises the event the moment the file becomes created, even if the process which created the file is still in the process of writing. I have found this to be very problematic, especially if I'm trying to read something like an XML document where the file must have some structure to it which won't exist until it is completed being written. Does .NET (preferably 2.0) have any way to raise an event after the file becomes accessible, or do I have to constantly try reading the file until it doesn't throw an exception to know it is available?
0
24,319
08/23/2008 15:55:28
1,709
08/18/2008 07:05:30
427
41
Where can I find good technical video podcasts or videos for download?
When I'm eating, or generally feeling bored, I like to watch a TV-series or something for entertainment. However, being somewhat of a geek, I was wondering if there were any technical video podcasts out there that I should be subscribing to? Any site that provides programming or technology-related videos for streaming or download will do. A good example of the kind of videos I am looking for are Apple's video lectures for the iPod SDK. Does something like "Slashdot video" exist? Note that stuff like <a href="http://en.wikipedia.org/wiki/Strong_Bad">Strong Bad</a> is fun the first few times, but it's not really the kind of thing I'm looking for. I want to learn something (useful) while eating dinner!
podcast
video
selfimprovement
entertainment
null
01/05/2012 11:13:41
not constructive
Where can I find good technical video podcasts or videos for download? === When I'm eating, or generally feeling bored, I like to watch a TV-series or something for entertainment. However, being somewhat of a geek, I was wondering if there were any technical video podcasts out there that I should be subscribing to? Any site that provides programming or technology-related videos for streaming or download will do. A good example of the kind of videos I am looking for are Apple's video lectures for the iPod SDK. Does something like "Slashdot video" exist? Note that stuff like <a href="http://en.wikipedia.org/wiki/Strong_Bad">Strong Bad</a> is fun the first few times, but it's not really the kind of thing I'm looking for. I want to learn something (useful) while eating dinner!
4
24,368
08/23/2008 16:48:44
2,594
08/23/2008 12:42:57
1
1
Am I In A Death March Project?
The facts: - The other programmer is constantly slipping deadlines with no status updates, at the moment he is slipping the single biggest feature on the website (which he asked to work on) by 3-4 weeks from his initial estimate. - The people for whom the software is being written fear taking action against the other programmer because they claim he has tremendous "business value" and "understands social networks", thus I think devaluing me and my opinions/knowledge. - The code quality is so poor I find much of the framework a mystery and the source code unreadable - Thus when something goes horribly wrong I have to rely on the other programmer (the frameworks creator) to fix it, slowing me down. - The designer on the project is constantly messing little things up - e.g. phantom buttons whose proclaimed functionality leaves no clues to its actual implementation. Sometimes the design flaws are found after the page design has already been converted to HTML, thus causing them to have to pay to get the page "resliced". - I've tried proposing ideas like a Scrum meeting daily, or even once a week, but the "CEO" thinks these are too "airy fairy" to really help us out. - I proposed several quality improvement ideas to the other programmer (unit testing new features, spacing code so it's not a blob, commenting functions so I know how they work, documenting his framework a bit, even separating HTML from PHP) but he never seems to want to get on board. I'm not all doom and gloom I promise, but I must know am I on a death march and if so should I gracefully walk away? Is there any hope of turning this ship around? The "CEO" thinks that the solution is to have me sit down and type out a list of all the functionality for **their** website as a sort of "Bible", anyone have a better idea?
php
project-management
deathmarch
bestpractices
null
04/19/2012 15:13:21
not constructive
Am I In A Death March Project? === The facts: - The other programmer is constantly slipping deadlines with no status updates, at the moment he is slipping the single biggest feature on the website (which he asked to work on) by 3-4 weeks from his initial estimate. - The people for whom the software is being written fear taking action against the other programmer because they claim he has tremendous "business value" and "understands social networks", thus I think devaluing me and my opinions/knowledge. - The code quality is so poor I find much of the framework a mystery and the source code unreadable - Thus when something goes horribly wrong I have to rely on the other programmer (the frameworks creator) to fix it, slowing me down. - The designer on the project is constantly messing little things up - e.g. phantom buttons whose proclaimed functionality leaves no clues to its actual implementation. Sometimes the design flaws are found after the page design has already been converted to HTML, thus causing them to have to pay to get the page "resliced". - I've tried proposing ideas like a Scrum meeting daily, or even once a week, but the "CEO" thinks these are too "airy fairy" to really help us out. - I proposed several quality improvement ideas to the other programmer (unit testing new features, spacing code so it's not a blob, commenting functions so I know how they work, documenting his framework a bit, even separating HTML from PHP) but he never seems to want to get on board. I'm not all doom and gloom I promise, but I must know am I on a death march and if so should I gracefully walk away? Is there any hope of turning this ship around? The "CEO" thinks that the solution is to have me sit down and type out a list of all the functionality for **their** website as a sort of "Bible", anyone have a better idea?
4
24,384
08/23/2008 17:03:08
2,196
08/20/2008 20:54:36
23
1
Teaching someone to program
What is the best way to teach someone how to program, the language doesn't matter. It's more of a case of how to make them think logical and clearly on how to over come a problem. Or is this something that comes naturally to most developers and can't be taught. Any online resources or book recommendations appreciated.
process
logic
developer
junior
thought
null
open
Teaching someone to program === What is the best way to teach someone how to program, the language doesn't matter. It's more of a case of how to make them think logical and clearly on how to over come a problem. Or is this something that comes naturally to most developers and can't be taught. Any online resources or book recommendations appreciated.
0
24,408
08/23/2008 17:24:48
2,362
08/21/2008 20:46:43
5
3
Database query representation impersonating file on Windows share?
Is there any way to have something that looks just like a file on a Windows file share but is really a resource served up over HTTP? For context, I'm working with an old app that can only deal with files on a Windows file share, I want to create a simple HTTP-based service to serve the content of the files dynamically to pick up real time changes to the underlying data on request Thanks all,
http
null
null
null
null
null
open
Database query representation impersonating file on Windows share? === Is there any way to have something that looks just like a file on a Windows file share but is really a resource served up over HTTP? For context, I'm working with an old app that can only deal with files on a Windows file share, I want to create a simple HTTP-based service to serve the content of the files dynamically to pick up real time changes to the underlying data on request Thanks all,
0
24,414
08/23/2008 17:30:23
2,621
08/23/2008 17:30:22
1
0
Can I capture Windows Mobile PIE keyboard events?
Anyone know of a way to capture keyboard events (keyup / keydown) in Portable IE under Window mobile? I noticed that key events are not supported in JS, and would like to come up with a solution that works without any client side additions.
events
windows-mobile
portableie
null
null
null
open
Can I capture Windows Mobile PIE keyboard events? === Anyone know of a way to capture keyboard events (keyup / keydown) in Portable IE under Window mobile? I noticed that key events are not supported in JS, and would like to come up with a solution that works without any client side additions.
0
24,439
08/23/2008 17:54:12
2,141
08/20/2008 14:38:34
131
2
IE 7+ Favorites
Is it possible to develop a plug-in for Internet Explorer that can replace the existing favorites functionality?
internet-explorer
bookmarks
favorites
null
null
null
open
IE 7+ Favorites === Is it possible to develop a plug-in for Internet Explorer that can replace the existing favorites functionality?
0
24,450
08/23/2008 18:16:13
2,625
08/23/2008 18:02:50
1
0
What are the best MVC web frameworks on the market?
I am looking for a Web Framework to move windows based applications to the web. The main requirements to WF are the following: 1. unit tests support 2. desktop and mobile browsers support 3. long term viability 4. maturity of the framework
mvc
webframework
null
null
null
null
open
What are the best MVC web frameworks on the market? === I am looking for a Web Framework to move windows based applications to the web. The main requirements to WF are the following: 1. unit tests support 2. desktop and mobile browsers support 3. long term viability 4. maturity of the framework
0
24,451
08/23/2008 18:18:04
1,597
08/17/2008 10:01:21
46
3
'goto' usage
I've long been under the impression that 'goto' should never be used if possible. While perusing libavcodec (which is written in C) the other day, I noticed multiple uses of it. Is it ever advantageous to use 'goto' in a language that supports loops and functions? If so, why?
language-agnostic
null
null
null
null
null
open
'goto' usage === I've long been under the impression that 'goto' should never be used if possible. While perusing libavcodec (which is written in C) the other day, I noticed multiple uses of it. Is it ever advantageous to use 'goto' in a language that supports loops and functions? If so, why?
0
24,456
08/23/2008 18:24:21
2,025
08/19/2008 20:59:50
305
55
Embedding IPTC image data with PHP GD
I'm trying to embed a IPTC data onto a JPEG image using `iptcembed()` but am having a bit of trouble. I have verified it is in the end product: // Embed the IPTC data $content = iptcembed($data, $path); // Verify IPTC data is in the end image $iptc = iptcparse($content); var_dump($iptc); Which returns the tags entered. However when I save and reload the image the tags are non existant: // Save the edited image $im = imagecreatefromstring($content); imagejpeg($im, 'phplogo-edited.jpg'); imagedestroy($im); // Get data from the saved image $image = getimagesize('./phplogo-edited.jpg'); // If APP13/IPTC data exists output it if(isset($image['APP13'])) { $iptc = iptcparse($image['APP13']); print_r($iptc); } else { // Otherwise tell us what the image *does* contain // SO: This is what's happening print_r($image); } So why aren't the tags in the saved image? ---------- The PHP source is [avaliable here][1], and the respective outputs are: 1. [Image output][2] 2. [Data output][3] Thanks, Ross [1]: http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php?source [2]: http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php?return_image [3]: http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php
php
gd
iptc
null
null
null
open
Embedding IPTC image data with PHP GD === I'm trying to embed a IPTC data onto a JPEG image using `iptcembed()` but am having a bit of trouble. I have verified it is in the end product: // Embed the IPTC data $content = iptcembed($data, $path); // Verify IPTC data is in the end image $iptc = iptcparse($content); var_dump($iptc); Which returns the tags entered. However when I save and reload the image the tags are non existant: // Save the edited image $im = imagecreatefromstring($content); imagejpeg($im, 'phplogo-edited.jpg'); imagedestroy($im); // Get data from the saved image $image = getimagesize('./phplogo-edited.jpg'); // If APP13/IPTC data exists output it if(isset($image['APP13'])) { $iptc = iptcparse($image['APP13']); print_r($iptc); } else { // Otherwise tell us what the image *does* contain // SO: This is what's happening print_r($image); } So why aren't the tags in the saved image? ---------- The PHP source is [avaliable here][1], and the respective outputs are: 1. [Image output][2] 2. [Data output][3] Thanks, Ross [1]: http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php?source [2]: http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php?return_image [3]: http://dev.uvshock.co.uk/GDDoc/examples/iptcembed.php
0
24,467
08/23/2008 18:31:02
2,078
08/20/2008 08:00:36
62
10
(N)Hibernate Auto-Join
I'm developing a web- application using NHibernate. Can you tell me how to write a NHibernate Query for the following SQL query: select v1.Id from View v1 left join View v2 on v1.SourceView = v2.Id order by v1.Position It's basically a auto-join but I don't know how to write this in Nhibernate. Lets say the property names are the same as the table column names.
nhibernate
sql
null
null
null
null
open
(N)Hibernate Auto-Join === I'm developing a web- application using NHibernate. Can you tell me how to write a NHibernate Query for the following SQL query: select v1.Id from View v1 left join View v2 on v1.SourceView = v2.Id order by v1.Position It's basically a auto-join but I don't know how to write this in Nhibernate. Lets say the property names are the same as the table column names.
0
24,468
08/23/2008 18:33:55
616
08/07/2008 11:16:13
1
1
Running "partially trusted" .NET assemblies from a network share
When I try to run a .NET assembly (`boo.exe`) from a network share (mapped to a drive), it fails since it's only partially trusted: Unhandled Exception: System.Security.SecurityException: That assembly does not allow partially trusted callers. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at BooCommandLine..ctor() at Program..ctor() at ProgramModule.Main(String[] argv) The action that failed was: LinkDemand The assembly or AppDomain that failed was: boo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67 The Zone of the assembly that failed was: Intranet The Url of the assembly that failed was: file:///H:/boo-svn/bin/boo.exe With instructions from [a blog post](http://www.georgewesolowski.com/blog/PermaLink,guid,4cc5fcdf-cc68-4cf0-a083-b22a8bdc92d6.aspx), I added a policy to the .NET Configuration fully trusting all assemblies with `file:///H:/*` as their URL. I verified this by entering the URL `file:///H:/boo-svn/bin/boo.exe` into the *Evaluate Assembly...* tool in the .NET Configuration and noting that boo.exe had the *Unrestricted* permission (which it didn't have before the policy). Even with the permission, `boo.exe` does not run. I still get the same error message. What can I do to debug this problem? Is there another way to run "partially trusted" assemblies from network shares without having to change something for every assembly I want to run?
.net
null
null
null
null
null
open
Running "partially trusted" .NET assemblies from a network share === When I try to run a .NET assembly (`boo.exe`) from a network share (mapped to a drive), it fails since it's only partially trusted: Unhandled Exception: System.Security.SecurityException: That assembly does not allow partially trusted callers. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at BooCommandLine..ctor() at Program..ctor() at ProgramModule.Main(String[] argv) The action that failed was: LinkDemand The assembly or AppDomain that failed was: boo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67 The Zone of the assembly that failed was: Intranet The Url of the assembly that failed was: file:///H:/boo-svn/bin/boo.exe With instructions from [a blog post](http://www.georgewesolowski.com/blog/PermaLink,guid,4cc5fcdf-cc68-4cf0-a083-b22a8bdc92d6.aspx), I added a policy to the .NET Configuration fully trusting all assemblies with `file:///H:/*` as their URL. I verified this by entering the URL `file:///H:/boo-svn/bin/boo.exe` into the *Evaluate Assembly...* tool in the .NET Configuration and noting that boo.exe had the *Unrestricted* permission (which it didn't have before the policy). Even with the permission, `boo.exe` does not run. I still get the same error message. What can I do to debug this problem? Is there another way to run "partially trusted" assemblies from network shares without having to change something for every assembly I want to run?
0
24,470
08/23/2008 18:36:33
2,626
08/23/2008 18:24:02
1
1
SQL Server PIVOT examples?
Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I have a query returning the following. Action1 VIEW Action1 EDIT Action2 VIEW Action3 VIEW Action3 EDIT I would like to use PIVOT (if even possible) to make the results like so: Action1 VIEW EDIT Action2 VIEW NULL Action3 VIEW EDIT Is this even possible with the PIVOT functionality?
t-sql
pivot
null
null
null
null
open
SQL Server PIVOT examples? === Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I have a query returning the following. Action1 VIEW Action1 EDIT Action2 VIEW Action3 VIEW Action3 EDIT I would like to use PIVOT (if even possible) to make the results like so: Action1 VIEW EDIT Action2 VIEW NULL Action3 VIEW EDIT Is this even possible with the PIVOT functionality?
0
24,471
08/23/2008 18:37:32
2,141
08/20/2008 14:38:34
140
2
Zip Code Database
Are there any open source/free databases for US zip codes?
database
zipcode
null
null
null
null
open
Zip Code Database === Are there any open source/free databases for US zip codes?
0
24,481
08/23/2008 18:45:47
2,627
08/23/2008 18:28:32
1
0
What is the "best" way to store international addresses in a database?
What is the "*best*" way to store international addresses in a database? Answer in the form of a schema and an explanation of the reasons why you chose to normalize (or not) the way you did. **Note: You decide what fields you think are necessary.**
database
internationalization
globalization
address
null
null
open
What is the "best" way to store international addresses in a database? === What is the "*best*" way to store international addresses in a database? Answer in the form of a schema and an explanation of the reasons why you chose to normalize (or not) the way you did. **Note: You decide what fields you think are necessary.**
0
24,495
08/23/2008 18:59:43
2,274
08/21/2008 12:44:42
33
1
Reading model objects mapped in Velocity Templates
I have a Struts + Velocity structure like for example, a Person class, whose one property is a Car object (with its own getter/setter methods) and it is mapped to a Velocity form that submits to an Action, using ModelDriven and getModel structure. I what to put a button on the form that shows "View Car" if car property is not null or car.id != 0 or show another button "Choose Car" if car is null or car.id = 0. How do I code this. I tried something like that in the template file: #if($car != null) #ssubmit("name=view" "value=View Car") #else #ssubmit("name=new" "value=Choose Car") #end But I keep getting error about Null value in the *#if* line. I also created a boolean method hasCar() in Person to try, but I can't access it and I don't know why. And Velocity + Struts tutorials are difficult to find or have good information. Thanks
velocit
struts
java
null
null
null
open
Reading model objects mapped in Velocity Templates === I have a Struts + Velocity structure like for example, a Person class, whose one property is a Car object (with its own getter/setter methods) and it is mapped to a Velocity form that submits to an Action, using ModelDriven and getModel structure. I what to put a button on the form that shows "View Car" if car property is not null or car.id != 0 or show another button "Choose Car" if car is null or car.id = 0. How do I code this. I tried something like that in the template file: #if($car != null) #ssubmit("name=view" "value=View Car") #else #ssubmit("name=new" "value=Choose Car") #end But I keep getting error about Null value in the *#if* line. I also created a boolean method hasCar() in Person to try, but I can't access it and I don't know why. And Velocity + Struts tutorials are difficult to find or have good information. Thanks
0
24,496
08/23/2008 19:01:06
2,628
08/23/2008 18:34:26
1
0
What alternatives are there to Model-View-Controller?
While going through university and from following the development of SO, I've heard a lot about the Model-View-Controller architectural design pattern. I inadvertently used the MVC pattern even before I knew what it was, and still use it in my everyday job. From what I've seen, it's probably the most popular pattern used today. What I haven't heard much about though, are the alternative patterns you can use instead of MVC. What options are there, and for what reasons would you decide to use them over MVC? I'm also interested in knowing the types of systems they are typical of being used for. Finally, what are the pros and cons that come along with using them?
mvc
null
null
null
null
null
open
What alternatives are there to Model-View-Controller? === While going through university and from following the development of SO, I've heard a lot about the Model-View-Controller architectural design pattern. I inadvertently used the MVC pattern even before I knew what it was, and still use it in my everyday job. From what I've seen, it's probably the most popular pattern used today. What I haven't heard much about though, are the alternative patterns you can use instead of MVC. What options are there, and for what reasons would you decide to use them over MVC? I'm also interested in knowing the types of systems they are typical of being used for. Finally, what are the pros and cons that come along with using them?
0
24,506
08/23/2008 19:06:17
1,680
08/17/2008 23:46:58
60
2
What is the purpose of the 'AppManifest.xaml' file in Silverlight applications?
In opening up the .xap file that is generated as output from a Silverlight application I've been tinkering with lately I noticed a file called 'AppManifest.xaml'. I've also noticed an option in the property pages for the Silverlight project that appears to allow you to otionally not output that file for the project. When unchecking that option, however, I get errors when running the application: "Invalid or malformed application: Check manifest". What is the purpose of this file?
silverlight
null
null
null
null
null
open
What is the purpose of the 'AppManifest.xaml' file in Silverlight applications? === In opening up the .xap file that is generated as output from a Silverlight application I've been tinkering with lately I noticed a file called 'AppManifest.xaml'. I've also noticed an option in the property pages for the Silverlight project that appears to allow you to otionally not output that file for the project. When unchecking that option, however, I get errors when running the application: "Invalid or malformed application: Check manifest". What is the purpose of this file?
0
24,515
08/23/2008 19:17:34
1,178
08/13/2008 11:15:35
73
8
"bad words" filter
Not very technical, but... I have to implement a bad words filter in a new site we are developing. So I need a "good" bad words list to feed my db with... any hint / direction? Looking around with google I [found this][1] one, and it's a start, but nothing more. Yes, I know that this kind of filters are easily escaped... but the client will is the client will !!! :-) The site will have to filter out both english and italian words, but for italian I can ask my colleagues to help me with a community-built list of "parolacce" :-) - an email will do. Thanks for any help. [1]: http://urbanoalvarez.es/blog/2008/04/04/bad-words-list/
list
dictionary
badwords
null
null
null
open
"bad words" filter === Not very technical, but... I have to implement a bad words filter in a new site we are developing. So I need a "good" bad words list to feed my db with... any hint / direction? Looking around with google I [found this][1] one, and it's a start, but nothing more. Yes, I know that this kind of filters are easily escaped... but the client will is the client will !!! :-) The site will have to filter out both english and italian words, but for italian I can ask my colleagues to help me with a community-built list of "parolacce" :-) - an email will do. Thanks for any help. [1]: http://urbanoalvarez.es/blog/2008/04/04/bad-words-list/
0
24,516
08/23/2008 19:18:48
1,891
08/19/2008 05:37:52
1
1
Resolving reduce/reduce conflict in yacc/ocamlyacc
I'm trying to parse a grammar in ocamlyacc (pretty much the same as regular yacc) which supports function application with no operators (like in Ocaml or Haskell), and the normal assortment of binary and unary operators. I'm getting a reduce/reduce conflict with the '-' operator, which can be used both for subtraction and negation. Here is a sample of the grammar I'm using: %token <int> INT %token <string> ID %token MINUS %start expr %type <expr> expr %nonassoc INT ID %left MINUS %left APPLY %% expr: INT { ExprInt $1 } | ID { ExprId $1 } | expr MINUS expr { ExprSub($1, $3) } | MINUS expr { ExprNeg $2 } | expr expr %prec APPLY { ExprApply($1, $2) }; The problem is that when you get an expression like "a - b" the parser doesn't know whether this should be reduced as "a (-b)" (negation of b, followed by application) or "a - b" (subtraction). The subtraction reduction is correct. How do I resolve the conflict in favor of that rule?
parsing
ocaml
grammar
yacc
null
null
open
Resolving reduce/reduce conflict in yacc/ocamlyacc === I'm trying to parse a grammar in ocamlyacc (pretty much the same as regular yacc) which supports function application with no operators (like in Ocaml or Haskell), and the normal assortment of binary and unary operators. I'm getting a reduce/reduce conflict with the '-' operator, which can be used both for subtraction and negation. Here is a sample of the grammar I'm using: %token <int> INT %token <string> ID %token MINUS %start expr %type <expr> expr %nonassoc INT ID %left MINUS %left APPLY %% expr: INT { ExprInt $1 } | ID { ExprId $1 } | expr MINUS expr { ExprSub($1, $3) } | MINUS expr { ExprNeg $2 } | expr expr %prec APPLY { ExprApply($1, $2) }; The problem is that when you get an expression like "a - b" the parser doesn't know whether this should be reduced as "a (-b)" (negation of b, followed by application) or "a - b" (subtraction). The subtraction reduction is correct. How do I resolve the conflict in favor of that rule?
0
24,520
08/23/2008 19:23:35
1,560
08/16/2008 17:17:39
53
1
Is there a better alternative to rentacoder for developers?
I've read a lot of reviews about rentacoder and all of them say that the pay is too low, do you know a better site?
outsourcing
null
null
null
null
null
open
Is there a better alternative to rentacoder for developers? === I've read a lot of reviews about rentacoder and all of them say that the pay is too low, do you know a better site?
0
24,528
08/23/2008 19:30:47
1,690
08/18/2008 01:39:04
49
6
Tips for running Subversion in a Windows world
*(Inspired by the [Hidden Features of C#](http://beta.stackoverflow.com/questions/9033/hidden-features-of-c) post.)* I'm curious to hear the experiences of those who are currently running their SVN server on Windows. The Godfather himself has a post on [how to setup SVN as a Windows service](http://www.codinghorror.com/blog/archives/001093.html). It's a great first step, but it doesn't touch on other topics, such as: * What to use for a web-based repo browser? [WebSVN](http://websvn.tigris.org/) _can_ work on Windows, but it ain't pretty. * How to manage the passwd file. * Is it possible to integrate with Active Directory without running Apache? * Strategies for backing up the repository. * Useful global ignore patterns for Visual Studio development (suggestions [here](http://blog.jasonhoekstra.com/2008/07/useful-net-subversion-global-ignore.html), [here](http://www.thushanfernando.com/?p=12), and [here](http://blog.donnfelker.com/2007/08/10/SubVersionTortoiseSVNGlobalIgnorePattern.aspx) for example). Our company switched from SourceGear Vault to Subversion about one month ago. We've got the basics down pat, but would love to discover people's tips and tricks for running SVN in a MSFT world.
svn
subversion
windows
null
null
null
open
Tips for running Subversion in a Windows world === *(Inspired by the [Hidden Features of C#](http://beta.stackoverflow.com/questions/9033/hidden-features-of-c) post.)* I'm curious to hear the experiences of those who are currently running their SVN server on Windows. The Godfather himself has a post on [how to setup SVN as a Windows service](http://www.codinghorror.com/blog/archives/001093.html). It's a great first step, but it doesn't touch on other topics, such as: * What to use for a web-based repo browser? [WebSVN](http://websvn.tigris.org/) _can_ work on Windows, but it ain't pretty. * How to manage the passwd file. * Is it possible to integrate with Active Directory without running Apache? * Strategies for backing up the repository. * Useful global ignore patterns for Visual Studio development (suggestions [here](http://blog.jasonhoekstra.com/2008/07/useful-net-subversion-global-ignore.html), [here](http://www.thushanfernando.com/?p=12), and [here](http://blog.donnfelker.com/2007/08/10/SubVersionTortoiseSVNGlobalIgnorePattern.aspx) for example). Our company switched from SourceGear Vault to Subversion about one month ago. We've got the basics down pat, but would love to discover people's tips and tricks for running SVN in a MSFT world.
0
24,532
08/23/2008 19:35:44
2,586
08/23/2008 08:44:06
1
0
One book to learn/get introduced to a programming language
If one would be allowed to read only one book to learn new programming language what book would that be? My (rather small) list would be - C - C Programming Language by Brian W. Kernighan, Dennis M. Ritchie - C++ - The C++ Programming Language by Bjarne Stroustrup - Java - Thinking in Java by Bruce Eckel - Lisp - Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, and Julie Sussman - ML - Elements of ML Programming by Jeffrey D. Ullman What about Python, Ruby, C# and others?
books
null
null
null
null
null
open
One book to learn/get introduced to a programming language === If one would be allowed to read only one book to learn new programming language what book would that be? My (rather small) list would be - C - C Programming Language by Brian W. Kernighan, Dennis M. Ritchie - C++ - The C++ Programming Language by Bjarne Stroustrup - Java - Thinking in Java by Bruce Eckel - Lisp - Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, and Julie Sussman - ML - Elements of ML Programming by Jeffrey D. Ullman What about Python, Ruby, C# and others?
0
24,541
08/23/2008 19:51:31
1,965
08/19/2008 15:51:08
1,066
70
Create a database from another database?
Is there an automatic way in SQL Server 2005 to create a database from several tables in another database? I need to work on a project and I only need a few tables to run it locally, and I don't want to make a backup of a 50 gig DB.
t-sql
sql-server-2005
null
null
null
null
open
Create a database from another database? === Is there an automatic way in SQL Server 2005 to create a database from several tables in another database? I need to work on a project and I only need a few tables to run it locally, and I don't want to make a backup of a 50 gig DB.
0
24,542
08/23/2008 19:52:39
1,891
08/19/2008 05:37:52
6
1
Using bitwise operators for Booleans in C++
Is there any reason not to use the bitwise operators &, |, and ^ for "bool" values in C++? I sometimes run into situations where I want exactly one of two conditions to be true (XOR), so I just throw the ^ operator into a conditional expression. I also sometimes want all parts of a condition to be evaluated whether the result is true or not (rather than short-circuiting), so I use & and |. I also need to accumulate Boolean values sometimes, and &= and |= can be quite useful. I've gotten a few raised eyebrows when doing this, but the code is still meaningful and cleaner than it would be otherwise. Is there any reason NOT to use these for bools? Are there any modern compilers that give bad results for this?
c++
null
null
null
null
null
open
Using bitwise operators for Booleans in C++ === Is there any reason not to use the bitwise operators &, |, and ^ for "bool" values in C++? I sometimes run into situations where I want exactly one of two conditions to be true (XOR), so I just throw the ^ operator into a conditional expression. I also sometimes want all parts of a condition to be evaluated whether the result is true or not (rather than short-circuiting), so I use & and |. I also need to accumulate Boolean values sometimes, and &= and |= can be quite useful. I've gotten a few raised eyebrows when doing this, but the code is still meaningful and cleaner than it would be otherwise. Is there any reason NOT to use these for bools? Are there any modern compilers that give bad results for this?
0
24,546
08/23/2008 19:54:09
112
08/02/2008 05:39:11
93
2
unable to get wikipedia pages with LWP::Simple
I'm trying to fetch wikipedia pages using LWP::Simple, but they're not coming back. This code: #!/usr/bin/perl use strict; use LWP::Simple; print get("http://en.wikipedia.org/wiki/Stack_overflow"); doesn't print anything. But if I use some other webpage, say <code>http://www.google.com</code>, it works fine. Is there some other name that I should be using to refer to wikipedia pages? What could be going on here?
perl
wikipedia
lwp
lwpsimple
null
null
open
unable to get wikipedia pages with LWP::Simple === I'm trying to fetch wikipedia pages using LWP::Simple, but they're not coming back. This code: #!/usr/bin/perl use strict; use LWP::Simple; print get("http://en.wikipedia.org/wiki/Stack_overflow"); doesn't print anything. But if I use some other webpage, say <code>http://www.google.com</code>, it works fine. Is there some other name that I should be using to refer to wikipedia pages? What could be going on here?
0
24,551
08/23/2008 19:59:42
2,635
08/23/2008 19:46:51
11
1
Best Practice: Initialize class fields in constructor or at declaration?
I've been programming in C# and Java recently and I am curious what people would consider the best practice concerning when you should initialize your classes fields? Should you do it at declaration?: public class Die { private int topFace = 1; public void Roll() { // .... } } or in a constructor.. public class Die { private int topFace; public Die() { topFace = 1; } public void Roll() { // ... } } I'm really curious what some of you veterans think is the best practice.. I want to be consistent and stick to one approach.
c#
java
null
null
null
null
open
Best Practice: Initialize class fields in constructor or at declaration? === I've been programming in C# and Java recently and I am curious what people would consider the best practice concerning when you should initialize your classes fields? Should you do it at declaration?: public class Die { private int topFace = 1; public void Roll() { // .... } } or in a constructor.. public class Die { private int topFace; public Die() { topFace = 1; } public void Roll() { // ... } } I'm really curious what some of you veterans think is the best practice.. I want to be consistent and stick to one approach.
0
24,556
08/23/2008 20:03:52
2,595
08/23/2008 12:52:27
1
0
Attaching entities to data contexts
In LINQ to SQL, is it possible to check to see if an entity is already part of the data context before trying to attach it? A little context if it helps... I have this code in my global.asax as a helper method. Normally, between requests, this isn't a problem. But right after signing in,this is getting called more than once and the second time I end up trying to attach the Member object in the same unit of work where it was created. private void CheckCurrentUser() { if (!HttpContext.Current.User.Identity.IsAuthenticated) { AppHelper.CurrentMember = null; return; } IUserService userService = new UserService(); if (AppHelper.CurrentMember != null) userService.AttachExisting(AppHelper.CurrentMember); else AppHelper.CurrentMember = userService.GetMember( HttpContext.Current.User.Identity.Name, AppHelper.CurrentLocation); }
c#
linq-to-sql
null
null
null
null
open
Attaching entities to data contexts === In LINQ to SQL, is it possible to check to see if an entity is already part of the data context before trying to attach it? A little context if it helps... I have this code in my global.asax as a helper method. Normally, between requests, this isn't a problem. But right after signing in,this is getting called more than once and the second time I end up trying to attach the Member object in the same unit of work where it was created. private void CheckCurrentUser() { if (!HttpContext.Current.User.Identity.IsAuthenticated) { AppHelper.CurrentMember = null; return; } IUserService userService = new UserService(); if (AppHelper.CurrentMember != null) userService.AttachExisting(AppHelper.CurrentMember); else AppHelper.CurrentMember = userService.GetMember( HttpContext.Current.User.Identity.Name, AppHelper.CurrentLocation); }
0
24,579
08/23/2008 20:39:23
1,632
08/17/2008 17:09:25
190
21
WYSIWYG editor gem for Rails?
Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?
ruby
ruby-on-rails
gem
webdevelopment
null
null
open
WYSIWYG editor gem for Rails? === Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?
0
24,580
08/23/2008 20:42:25
2,541
08/22/2008 18:21:46
11
3
How do you automate a visual studio build?
How do you turn a Visual Studio build that you'd perform in the IDE into a script that you can run from the command line?
build-automation
visual-studio
null
null
null
null
open
How do you automate a visual studio build? === How do you turn a Visual Studio build that you'd perform in the IDE into a script that you can run from the command line?
0
24,595
08/23/2008 20:56:56
2,639
08/23/2008 20:32:12
1
2
Code Classic ASP in Linux
What should i use to code Classic ASP under Linux. I have really tried to use Emacs and Vim but I don't have the time to learn them.
classicasp
editor
linux
null
null
null
open
Code Classic ASP in Linux === What should i use to code Classic ASP under Linux. I have really tried to use Emacs and Vim but I don't have the time to learn them.
0
24,596
08/23/2008 20:58:25
2,628
08/23/2008 18:34:26
31
0
What Web Application Framework for Java is Recommended?
In my previous job, I worked for a company who had an enterprise application built using JSP technology. Now, I have recently started working for a new company where one application is built using Struts, and another using Apache Wicket. I am considering creating my own website using Java and am trying to decide what framework to use. However, doing a quick search for Java frameworks returns more than 50 to choose from! My website is just going to be for my own enjoyment in the beginning, but if it becomes popular it would be good for it to have some scalability, or to at least be able to redesign for that. Of the more common frameworks, what are the main differences between them, and are there instances where one significantly outperforms? For example, high-traffic enterprise applications versus low traffic small applications? I'm also wondering if some are much easier to learn and use than others. Does anyone have any experience with some of these frameworks and is able to make a recommendation, or does the sheer number of choices just serve as an early warning to avoid java-based web development if possible?
java
struts
apache-wicket
jsp
null
09/03/2011 12:00:57
not constructive
What Web Application Framework for Java is Recommended? === In my previous job, I worked for a company who had an enterprise application built using JSP technology. Now, I have recently started working for a new company where one application is built using Struts, and another using Apache Wicket. I am considering creating my own website using Java and am trying to decide what framework to use. However, doing a quick search for Java frameworks returns more than 50 to choose from! My website is just going to be for my own enjoyment in the beginning, but if it becomes popular it would be good for it to have some scalability, or to at least be able to redesign for that. Of the more common frameworks, what are the main differences between them, and are there instances where one significantly outperforms? For example, high-traffic enterprise applications versus low traffic small applications? I'm also wondering if some are much easier to learn and use than others. Does anyone have any experience with some of these frameworks and is able to make a recommendation, or does the sheer number of choices just serve as an early warning to avoid java-based web development if possible?
4
24,599
08/23/2008 21:02:29
2,536
08/22/2008 17:37:07
36
4
Stylus/tablet input device
I need to make a WebCast presentation soon and need to do some "whiteboarding" during that WebCast. Does anyone have any stylus/tablet input device recommendations? Anyone ever used such an input device with WebEx's whiteboard feature? rp
input-devices
webcast
null
null
null
null
open
Stylus/tablet input device === I need to make a WebCast presentation soon and need to do some "whiteboarding" during that WebCast. Does anyone have any stylus/tablet input device recommendations? Anyone ever used such an input device with WebEx's whiteboard feature? rp
0
24,620
08/23/2008 21:35:46
2,374
08/21/2008 22:14:30
88
7
Why should you prevent a class from being subclassed?
What can be reasons to prevent a class from being inherited? (e.g. using sealed on a c# class) Right now I can't think of any.
object-oriented
null
null
null
null
null
open
Why should you prevent a class from being subclassed? === What can be reasons to prevent a class from being inherited? (e.g. using sealed on a c# class) Right now I can't think of any.
0
24,622
08/23/2008 21:39:54
2,118
08/20/2008 12:54:09
257
13
Setting PHP Include Path on a per site basis?
I can set the php include path in the php.ini: include_path = /path/to/site/includes/ But then other websites are effected so that is no good. I can set the php include in the start of every file: $path = '/path/to/site/includes/'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); But that seems like bad practice and clutters things up. So I can make an include of that and then include it into every file: include 'includes/config.php'; or include '../includes/config.php'; This is what I'm doing right now, but the include path of config.php will change depending on what is including it. Is there a better way? Does it matter?
php
include
bestpractice
null
null
null
open
Setting PHP Include Path on a per site basis? === I can set the php include path in the php.ini: include_path = /path/to/site/includes/ But then other websites are effected so that is no good. I can set the php include in the start of every file: $path = '/path/to/site/includes/'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); But that seems like bad practice and clutters things up. So I can make an include of that and then include it into every file: include 'includes/config.php'; or include '../includes/config.php'; This is what I'm doing right now, but the include path of config.php will change depending on what is including it. Is there a better way? Does it matter?
0
24,626
08/23/2008 21:41:49
1,556
08/16/2008 16:41:03
340
14
Abstraction VS Information Hiding
Can you tell me what is difference between **ABSTRACTION** and **INFORMATION HIDING** in software development? I am confused abstraction hides detail implementation and information hiding abstracts whole details of something.
abstraction
information-hiding
ooad
null
null
null
open
Abstraction VS Information Hiding === Can you tell me what is difference between **ABSTRACTION** and **INFORMATION HIDING** in software development? I am confused abstraction hides detail implementation and information hiding abstracts whole details of something.
0
24,642
08/23/2008 21:56:15
2,628
08/23/2008 18:34:26
41
0
Can Traditional Design Patterns be Implemented Using JavaScript?
I'm a moderately skilled programmer using JavaScript but I am no guru. I know you can do some pretty powerful things with it, I just haven't seen much other than fairly basic DOM manipulation. I'm wondering if it is possible to implement traditional design pattern concepts such as Factory Method, Singleton, etc. and if people could provide some examples? Also, if it is possible, would there actually be any reason for using them in a web application?
javascript
design-patterns
null
null
null
null
open
Can Traditional Design Patterns be Implemented Using JavaScript? === I'm a moderately skilled programmer using JavaScript but I am no guru. I know you can do some pretty powerful things with it, I just haven't seen much other than fairly basic DOM manipulation. I'm wondering if it is possible to implement traditional design pattern concepts such as Factory Method, Singleton, etc. and if people could provide some examples? Also, if it is possible, would there actually be any reason for using them in a web application?
0
24,644
08/23/2008 21:56:47
2,644
08/23/2008 21:56:47
1
0
Hooking my program with windows explorer's rename event
Is there any way, in any language, to hook my program when a user renames a file? For example: A user renames a file and presses enter (or clicks away) to confirm the rename action. BEFORE the file is actually renamed, my program "listens" to this event and pops up a message saying "Are you sure you want to rename C:\test\file.txt to C:\test\test.txt?". I'm thinking/hoping this is possible with C++, C# or .NET.. But I don't have any clue where to look for. Thank you.
windows
rename
null
null
null
null
open
Hooking my program with windows explorer's rename event === Is there any way, in any language, to hook my program when a user renames a file? For example: A user renames a file and presses enter (or clicks away) to confirm the rename action. BEFORE the file is actually renamed, my program "listens" to this event and pops up a message saying "Are you sure you want to rename C:\test\file.txt to C:\test\test.txt?". I'm thinking/hoping this is possible with C++, C# or .NET.. But I don't have any clue where to look for. Thank you.
0
24,648
08/23/2008 21:58:53
1,534
08/16/2008 12:20:49
629
41
What's the best way to get to know linux or BSD kernel internals?
I'd like to gain better knowledge of operating system internals. Process management, memory management, and stuff like that. <br> I was thinking of learning by getting to know either linux or BSD kernel.<br> Which one kernel is better for learning purposes?<br> What's the best place to start?<br> Can you recommend any good books?<br>
linux
operating-system
kernel
bsd
null
null
open
What's the best way to get to know linux or BSD kernel internals? === I'd like to gain better knowledge of operating system internals. Process management, memory management, and stuff like that. <br> I was thinking of learning by getting to know either linux or BSD kernel.<br> Which one kernel is better for learning purposes?<br> What's the best place to start?<br> Can you recommend any good books?<br>
0
24,675
08/23/2008 22:37:49
2,025
08/19/2008 20:59:50
327
61
Tactics for using PHP in a high-load site
Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the planet, albeit one that knows PHP and a few optimisation techniques. ---------- I'm developing a tool in **PHP** that could attain quite a lot of users, if it works out right. However while I'm fully capable of developing the program I'm pretty much clueless when it comes to making something that can deal with huge traffic. So here's a few questions on it (feel free to turn this question into a resource thread as well). ## Databases ## At the moment I plan to use the MySQLi features in PHP5. However how should I setup the databases in relation to users and content? Do I actually *need* multiple databases? At the moment everything's jumbled into one database - although I've been considering spreading user data to one, actual content to another and finally core site content (template masters etc.) to another. My reasoning behind this is that sending queries to different databases will ease up the load on them as one database = 3 load sources. Also would this still be effective if they were all on the same server? ## Caching ## I have a template system that is used to build the pages and swap out variables. Master templates are stored in the database and each time a template is called it's cached copy (a html document) is called. At the moment I have two types of variable in these templates - a static var and a dynamic var. Static vars are usually things like page names, the name of the site - things that don't change often; dynamic vars are things that change on each page load. My question on this: Say I have comments on different articles. Which is a better solution: store the simple comment template and render comments (from a DB call) each time the page is loaded or store a cached copy of the comments page as a html page - each time a comment is added/edited/deleted the page is recached. ## Finally ## Does anyone have any tips/pointers for running a high load site on PHP. I'm pretty sure it's a workable language to use - Facebook and Yahoo! give it great precedence - but are there any experiences I should watch out for? Thanks, Ross
php
high-load
null
null
null
null
open
Tactics for using PHP in a high-load site === Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the planet, albeit one that knows PHP and a few optimisation techniques. ---------- I'm developing a tool in **PHP** that could attain quite a lot of users, if it works out right. However while I'm fully capable of developing the program I'm pretty much clueless when it comes to making something that can deal with huge traffic. So here's a few questions on it (feel free to turn this question into a resource thread as well). ## Databases ## At the moment I plan to use the MySQLi features in PHP5. However how should I setup the databases in relation to users and content? Do I actually *need* multiple databases? At the moment everything's jumbled into one database - although I've been considering spreading user data to one, actual content to another and finally core site content (template masters etc.) to another. My reasoning behind this is that sending queries to different databases will ease up the load on them as one database = 3 load sources. Also would this still be effective if they were all on the same server? ## Caching ## I have a template system that is used to build the pages and swap out variables. Master templates are stored in the database and each time a template is called it's cached copy (a html document) is called. At the moment I have two types of variable in these templates - a static var and a dynamic var. Static vars are usually things like page names, the name of the site - things that don't change often; dynamic vars are things that change on each page load. My question on this: Say I have comments on different articles. Which is a better solution: store the simple comment template and render comments (from a DB call) each time the page is loaded or store a cached copy of the comments page as a html page - each time a comment is added/edited/deleted the page is recached. ## Finally ## Does anyone have any tips/pointers for running a high load site on PHP. I'm pretty sure it's a workable language to use - Facebook and Yahoo! give it great precedence - but are there any experiences I should watch out for? Thanks, Ross
0
24,678
08/23/2008 22:42:50
2,648
08/23/2008 22:40:47
1
0
eclipse javascript editor
I'm looking for opinions on the best JavaScript editor available as an Eclipse plugin. I've been using Spket, which is good, but I'm convinced there must be something better out there, is there....? Cheers, Donal
javascript
eclipse
plugins
editor
null
10/06/2011 02:20:23
not constructive
eclipse javascript editor === I'm looking for opinions on the best JavaScript editor available as an Eclipse plugin. I've been using Spket, which is good, but I'm convinced there must be something better out there, is there....? Cheers, Donal
4
24,680
08/23/2008 22:46:06
217
08/03/2008 15:59:20
1
1
Using Subversion with VB6
My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in VB6, so I have a couple of questions: - What's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not worth the trouble...) - Are there any best practices for using Subversion with VB6? (file types to ignore, etc.) Thanks!
vb6
subversion
svn
null
null
null
open
Using Subversion with VB6 === My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in VB6, so I have a couple of questions: - What's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not worth the trouble...) - Are there any best practices for using Subversion with VB6? (file types to ignore, etc.) Thanks!
0
24,692
08/23/2008 23:08:03
1,662
08/17/2008 20:30:20
105
9
Where can you find fun/educational programming challenges?
I've searched around for different challenge sites, and most of them seem to be geared towards difficulty in problem solving logically, rather than trying to use your language of choice to do something you haven't used it for. Their center is around mathematics rather than function design. Some kind of point system for correctly solving challenges, or solving them the most efficient/smallest would be neat as well.
challenge
null
null
null
null
12/06/2011 23:16:37
not constructive
Where can you find fun/educational programming challenges? === I've searched around for different challenge sites, and most of them seem to be geared towards difficulty in problem solving logically, rather than trying to use your language of choice to do something you haven't used it for. Their center is around mathematics rather than function design. Some kind of point system for correctly solving challenges, or solving them the most efficient/smallest would be neat as well.
4
24,708
08/23/2008 23:41:03
2,644
08/23/2008 21:56:47
11
1
Where do I find information about Blog APIs and how to use them?
I'm thinking of creating a small offline blog editor for personal use and I don't know how do the APIs work. Where can I find this information? I'm particularly looking for the most common providers: Blogger, Wordpress, MovableType, Live Spaces (not sure if this has an API) etc.
api
blogs
null
null
null
null
open
Where do I find information about Blog APIs and how to use them? === I'm thinking of creating a small offline blog editor for personal use and I don't know how do the APIs work. Where can I find this information? I'm particularly looking for the most common providers: Blogger, Wordpress, MovableType, Live Spaces (not sure if this has an API) etc.
0
24,715
08/24/2008 00:09:34
658
08/07/2008 15:07:47
216
19
SQL many-to-many matching
I'm implementing a tagging system for a website. There are multiple tags per object and multiple objects per tag. This is accomplished by maintaining a table with two values per record, one for the ids of the object and the tag. I'm looking to write a query to find the objects that match a given set of tags. Suppose I had the following data (in [object] -> [tags]* format) apple -> fruit red food banana -> fruit yellow food cheese -> yellow food firetruck -> vehicle red If I want to match (red), I should get apple and firetruck. If I want to match (fruit, food) I should get (apple, banana). How do I write a SQL query do do what I want?
sql
many-to-many
tagging
null
null
null
open
SQL many-to-many matching === I'm implementing a tagging system for a website. There are multiple tags per object and multiple objects per tag. This is accomplished by maintaining a table with two values per record, one for the ids of the object and the tag. I'm looking to write a query to find the objects that match a given set of tags. Suppose I had the following data (in [object] -> [tags]* format) apple -> fruit red food banana -> fruit yellow food cheese -> yellow food firetruck -> vehicle red If I want to match (red), I should get apple and firetruck. If I want to match (fruit, food) I should get (apple, banana). How do I write a SQL query do do what I want?
0
24,723
08/24/2008 00:21:10
1,406
08/15/2008 12:26:06
1
1
Best regex to catch XSS attack (in Java)?
Jeff actually posted about this in [Sanitize HTML][1]. But his example is in C# and I'm actually more interested in a Java version. Does anyone has a better version for Java? Does his example is good enough that I could just convert it directly from C# to Java? [1]: http://refactormycode.com/codes/333-sanitize-html
java
html
regex
xss
null
null
open
Best regex to catch XSS attack (in Java)? === Jeff actually posted about this in [Sanitize HTML][1]. But his example is in C# and I'm actually more interested in a Java version. Does anyone has a better version for Java? Does his example is good enough that I could just convert it directly from C# to Java? [1]: http://refactormycode.com/codes/333-sanitize-html
0
24,730
08/24/2008 00:35:22
1,965
08/19/2008 15:51:08
1,109
74
What is this 'Multiple-step OLE DB' error?
I'm doing a little bit of work on a horrid piece of software built by Bangalores best. It's written in mostly classic ASP/VbScript, but "ported" to ASP.NET, though most of the code is classic ASP style in the ASPX pages :( I'm getting this message when it tries to connect to my local database: **Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.** Line 38: MasterConn = New ADODB.Connection() Line 39: MasterConn.connectiontimeout = 10000 Line 40: MasterConn.Open(strDB) Anybody have a clue what this error means? Its connecting to my local machine (running SQLEXPRESS) using this connection string: PROVIDER=MSDASQL;DRIVER={SQL Server};Server=JONATHAN-PC\SQLEXPRESS\;DATABASE=NetTraining;Integrated Security=true Which is the connection string that it was initially using, I just repointed it at my database.
ado.net
classicasp
oledb
null
null
null
open
What is this 'Multiple-step OLE DB' error? === I'm doing a little bit of work on a horrid piece of software built by Bangalores best. It's written in mostly classic ASP/VbScript, but "ported" to ASP.NET, though most of the code is classic ASP style in the ASPX pages :( I'm getting this message when it tries to connect to my local database: **Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.** Line 38: MasterConn = New ADODB.Connection() Line 39: MasterConn.connectiontimeout = 10000 Line 40: MasterConn.Open(strDB) Anybody have a clue what this error means? Its connecting to my local machine (running SQLEXPRESS) using this connection string: PROVIDER=MSDASQL;DRIVER={SQL Server};Server=JONATHAN-PC\SQLEXPRESS\;DATABASE=NetTraining;Integrated Security=true Which is the connection string that it was initially using, I just repointed it at my database.
0
24,731
08/24/2008 00:38:00
1,220
08/13/2008 13:44:48
748
49
Displaying version of underlying software in footer of web app?
I am thinking about providing the version of say, the database schema, and the dlls for business logic in the footer of my web application. Is this advised? Are there any pitfalls, or pointers of how to do this best? Usability concerns? **I already have a version scheme, for both schema and dlls, used in my CI solution.**
web-application
versioning
assemblies
null
null
null
open
Displaying version of underlying software in footer of web app? === I am thinking about providing the version of say, the database schema, and the dlls for business logic in the footer of my web application. Is this advised? Are there any pitfalls, or pointers of how to do this best? Usability concerns? **I already have a version scheme, for both schema and dlls, used in my CI solution.**
0