question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
33,341
33,365
ASP.Net RadioButton visibility inside a RadioButtonList
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?
Under the hood, you can access the attributes of the item and assign it a CSS style. So you should be able to then programmatically assign it by specifying: RadioButtonList.Items(1).CssClass.Add("visibility", "hidden") and get the job done.
ASP.Net RadioButton visibility inside a RadioButtonList Is there a way to hide radio buttons inside a RadioButtonList control programmatically?
TITLE: ASP.Net RadioButton visibility inside a RadioButtonList QUESTION: Is there a way to hide radio buttons inside a RadioButtonList control programmatically? ANSWER: Under the hood, you can access the attributes of the item and assign it a CSS style. So you should be able to then programmatically assign it by specifying: RadioButtonList.Items(1).CssClass.Add("visibility", "hidden") and get the job done.
[ "asp.net", "radio-button", "radiobuttonlist" ]
8
6
16,948
8
0
2008-08-28T20:37:19.067000
2008-08-28T20:52:07.907000
33,347
33,502
About scripting SVG
I'm considering developing a website similar to stackoverflow, but the answers may also consist of drawings (schematics, in this case). I want to have an area in the answer form where they can make this schematic without requiring special plugins, etc. Are we to the point where SVG has or should have critical mass soon (1-2 years) such that designing a website where script-run SVG as a primary feature is reasonable (ie, requiring Firefox or another SVG/AJAX compliant browser)? What are some good resources for learning cross platform SVG scripting (likely in javascript)?
Unfortunately, I don't have an answer, but I do have three pointers to projects that you could look at. The first is the Lively Kernel by Dan Ingalls (yes, the Dan Ingalls) at Sun Labs. It is an implementation of a Smalltalk Virtual World in JavaScript on top of SVG. More precisely, it is an implementation of the Morphic GUI framework from Squeak Smalltalk in JavaScript using SVG and a port of (parts of) Squeak Smalltalk in JavaScript. Or, if you're not a Smalltalker and the above doesn't make sense to you: it's an Operating System, written in JavaScript with the JavaScript interpreter as the CPU, SVG as the graphics card and the browser as the computer. This is about as extreme as it gets, when it comes to JavaScript and SVG. And it only fully works in Safari 3 and partly in Firefox 3, although there is an experimental port to Internet Explorer as well. The second project is John Resig's Processing.js port of the Processing visualization language to JavaScript. It uses the element instead of SVG precisely because of the problems that you mentioned. This one however, only works in Firefox 3. The third one is Real-Time 3D in JavaScript by Useless Pickles. It uses only JavaScript, DOM and CSS and no SVG or or Flash or whatever. And it is portable to almost any browser, including Internet Explorer 7 and up. Doing 2D should be even easier than this. Between those three projects you should be able to find some inspiration and also to find some people who tried to push the envelope with JavaScript and SVG or JavaScript and Graphics and can tell you what works and what doesn't. Conclusion: doing cross-browser SVG or cross-browser is nigh impossible, but with a little bit of craziness, cross-browser graphics without SVG or is possible.
About scripting SVG I'm considering developing a website similar to stackoverflow, but the answers may also consist of drawings (schematics, in this case). I want to have an area in the answer form where they can make this schematic without requiring special plugins, etc. Are we to the point where SVG has or should have critical mass soon (1-2 years) such that designing a website where script-run SVG as a primary feature is reasonable (ie, requiring Firefox or another SVG/AJAX compliant browser)? What are some good resources for learning cross platform SVG scripting (likely in javascript)?
TITLE: About scripting SVG QUESTION: I'm considering developing a website similar to stackoverflow, but the answers may also consist of drawings (schematics, in this case). I want to have an area in the answer form where they can make this schematic without requiring special plugins, etc. Are we to the point where SVG has or should have critical mass soon (1-2 years) such that designing a website where script-run SVG as a primary feature is reasonable (ie, requiring Firefox or another SVG/AJAX compliant browser)? What are some good resources for learning cross platform SVG scripting (likely in javascript)? ANSWER: Unfortunately, I don't have an answer, but I do have three pointers to projects that you could look at. The first is the Lively Kernel by Dan Ingalls (yes, the Dan Ingalls) at Sun Labs. It is an implementation of a Smalltalk Virtual World in JavaScript on top of SVG. More precisely, it is an implementation of the Morphic GUI framework from Squeak Smalltalk in JavaScript using SVG and a port of (parts of) Squeak Smalltalk in JavaScript. Or, if you're not a Smalltalker and the above doesn't make sense to you: it's an Operating System, written in JavaScript with the JavaScript interpreter as the CPU, SVG as the graphics card and the browser as the computer. This is about as extreme as it gets, when it comes to JavaScript and SVG. And it only fully works in Safari 3 and partly in Firefox 3, although there is an experimental port to Internet Explorer as well. The second project is John Resig's Processing.js port of the Processing visualization language to JavaScript. It uses the element instead of SVG precisely because of the problems that you mentioned. This one however, only works in Firefox 3. The third one is Real-Time 3D in JavaScript by Useless Pickles. It uses only JavaScript, DOM and CSS and no SVG or or Flash or whatever. And it is portable to almost any browser, including Internet Explorer 7 and up. Doing 2D should be even easier than this. Between those three projects you should be able to find some inspiration and also to find some people who tried to push the envelope with JavaScript and SVG or JavaScript and Graphics and can tell you what works and what doesn't. Conclusion: doing cross-browser SVG or cross-browser is nigh impossible, but with a little bit of craziness, cross-browser graphics without SVG or is possible.
[ "javascript", "ajax", "svg" ]
18
7
8,474
5
0
2008-08-28T20:39:52.290000
2008-08-28T22:00:41.160000
33,390
33,405
Best use pattern for a DataContext
What's the best lifetime model for a DataContext? Should I just create a new one whenever I need it (aka, function level), should I keep one available in each class that would use it (class level), or should I create a static class with a static DataContext (app-domain level)? Are there any considered best practices on this?
You pretty much need to keep the same data context available throughout the lifetime of the operations you want to perform if you're ever going to be storing changes which are to be.SubmitChanges() 'd later, as otherwise you will lose those changes. If you're just querying stuff then it's fine to create them as needed, but then if later you want to.SubmitChanges() you'll have to refactor your code a lot, so you may as well adopt the pattern of effectively keeping the datacontext global throughout your app from the beginning. Note the data context is disconnected. The connection is only made when the query data is enumerated (not when you first run the query, it's a 'lazy' data type so only provides data when it's needed), and then closed immediately afterwards. On.SubmitChanges() the connection is opened to submit the changes then closed immediately afterwards. So don't think keeping the datacontext around keeps a connection open, it doesn't (you can hook the StateChange event of the connection to confirm this for yourself, that's how I'm sure). There is a great article over at Rick Strahl's Blog which covers this topic in depth, far more than my answer here provides!!
Best use pattern for a DataContext What's the best lifetime model for a DataContext? Should I just create a new one whenever I need it (aka, function level), should I keep one available in each class that would use it (class level), or should I create a static class with a static DataContext (app-domain level)? Are there any considered best practices on this?
TITLE: Best use pattern for a DataContext QUESTION: What's the best lifetime model for a DataContext? Should I just create a new one whenever I need it (aka, function level), should I keep one available in each class that would use it (class level), or should I create a static class with a static DataContext (app-domain level)? Are there any considered best practices on this? ANSWER: You pretty much need to keep the same data context available throughout the lifetime of the operations you want to perform if you're ever going to be storing changes which are to be.SubmitChanges() 'd later, as otherwise you will lose those changes. If you're just querying stuff then it's fine to create them as needed, but then if later you want to.SubmitChanges() you'll have to refactor your code a lot, so you may as well adopt the pattern of effectively keeping the datacontext global throughout your app from the beginning. Note the data context is disconnected. The connection is only made when the query data is enumerated (not when you first run the query, it's a 'lazy' data type so only provides data when it's needed), and then closed immediately afterwards. On.SubmitChanges() the connection is opened to submit the changes then closed immediately afterwards. So don't think keeping the datacontext around keeps a connection open, it doesn't (you can hook the StateChange event of the connection to confirm this for yourself, that's how I'm sure). There is a great article over at Rick Strahl's Blog which covers this topic in depth, far more than my answer here provides!!
[ "linq-to-sql", ".net-3.5" ]
3
5
848
2
0
2008-08-28T21:02:15.903000
2008-08-28T21:08:12.470000
33,412
1,088,009
How do you configure HttpOnly cookies in tomcat / java webapps?
After reading Jeff's blog post on Protecting Your Cookies: HttpOnly. I'd like to implement HttpOnly cookies in my web application. How do you tell tomcat to use http only cookies for sessions?
httpOnly is supported as of Tomcat 6.0.19 and Tomcat 5.5.28. See the changelog entry for bug 44382. The last comment for bug 44382 states, "this has been applied to 5.5.x and will be included in 5.5.28 onwards." However, it does not appear that 5.5.28 has been released. The httpOnly functionality can be enabled for all webapps in conf/context.xml:... My interpretation is that it also works for an individual context by setting it on the desired Context entry in conf/server.xml (in the same manner as above).
How do you configure HttpOnly cookies in tomcat / java webapps? After reading Jeff's blog post on Protecting Your Cookies: HttpOnly. I'd like to implement HttpOnly cookies in my web application. How do you tell tomcat to use http only cookies for sessions?
TITLE: How do you configure HttpOnly cookies in tomcat / java webapps? QUESTION: After reading Jeff's blog post on Protecting Your Cookies: HttpOnly. I'd like to implement HttpOnly cookies in my web application. How do you tell tomcat to use http only cookies for sessions? ANSWER: httpOnly is supported as of Tomcat 6.0.19 and Tomcat 5.5.28. See the changelog entry for bug 44382. The last comment for bug 44382 states, "this has been applied to 5.5.x and will be included in 5.5.28 onwards." However, it does not appear that 5.5.28 has been released. The httpOnly functionality can be enabled for all webapps in conf/context.xml:... My interpretation is that it also works for an individual context by setting it on the desired Context entry in conf/server.xml (in the same manner as above).
[ "java", "security", "cookies", "xss", "httponly" ]
77
66
193,206
10
0
2008-08-28T21:09:30.707000
2009-07-06T16:46:12.847000
33,438
33,516
Using Hibernate to work with Text Files
I am using Hibernate in a Java application to access my Database and it works pretty well with MS-SQL and MySQL. But some of the data I have to show on some forms has to come from Text files, and by Text files I mean Human-Readable files, they can be CSV, Tab-Delimited, or even a key, value pair, per line since my data is as simple as this, but my preference of course is XML files. My question is: Can I use hibernate to read those files using HQL, Query, EntityManager and all those resources Hibernate provides me to access files. Which file format should I use and How I configure My persistence.xml file to recognize files as Tables?
Hibernate is written against the JDBC API. So, you need a JDBC driver that works with the file format you are interested in. Obviously, even for read-only access, this isn't going to perform well, but it might still be useful if that's not a high priority. On a Windows system, you can set up ODBC datasources for delimited text files, Excel files, etc. Then you can set up the JdbcOdbcDriver in your Java application to use this data source. For most of the applications I work on, I would not consider this approach; I would use an import/export mechanism to convert from a real database (even if it's an in-process database like Berkeley DB or Derby) to the text files. Yes, it's an extra step, but it could be automated, and the performance isn't likely to be much worse than trying to use the text files directly (it will likely be much better, overall), and it will be more robust and easy to develop.
Using Hibernate to work with Text Files I am using Hibernate in a Java application to access my Database and it works pretty well with MS-SQL and MySQL. But some of the data I have to show on some forms has to come from Text files, and by Text files I mean Human-Readable files, they can be CSV, Tab-Delimited, or even a key, value pair, per line since my data is as simple as this, but my preference of course is XML files. My question is: Can I use hibernate to read those files using HQL, Query, EntityManager and all those resources Hibernate provides me to access files. Which file format should I use and How I configure My persistence.xml file to recognize files as Tables?
TITLE: Using Hibernate to work with Text Files QUESTION: I am using Hibernate in a Java application to access my Database and it works pretty well with MS-SQL and MySQL. But some of the data I have to show on some forms has to come from Text files, and by Text files I mean Human-Readable files, they can be CSV, Tab-Delimited, or even a key, value pair, per line since my data is as simple as this, but my preference of course is XML files. My question is: Can I use hibernate to read those files using HQL, Query, EntityManager and all those resources Hibernate provides me to access files. Which file format should I use and How I configure My persistence.xml file to recognize files as Tables? ANSWER: Hibernate is written against the JDBC API. So, you need a JDBC driver that works with the file format you are interested in. Obviously, even for read-only access, this isn't going to perform well, but it might still be useful if that's not a high priority. On a Windows system, you can set up ODBC datasources for delimited text files, Excel files, etc. Then you can set up the JdbcOdbcDriver in your Java application to use this data source. For most of the applications I work on, I would not consider this approach; I would use an import/export mechanism to convert from a real database (even if it's an in-process database like Berkeley DB or Derby) to the text files. Yes, it's an extra step, but it could be automated, and the performance isn't likely to be much worse than trying to use the text files directly (it will likely be much better, overall), and it will be more robust and easy to develop.
[ "java", "database", "hibernate", "text-files" ]
8
8
8,086
3
0
2008-08-28T21:24:19.780000
2008-08-28T22:07:04.733000
33,457
33,742
SMO and Sql Server 7.0
Does anyone have a definitive answer to whether Sql Server Management Objects is compatible with Sql Server 7.0? The docs state: Because SMO is compatible with SQL Server version 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008, you easily manage a multi-version environment. But trying to connect to a Sql 7 instance gets me: "This SQL Server version (7.0) is not supported." Has anyone been successful in getting these 2 to play nice?
you can use SMO to connect to SQL Server versions 7, 2000, and 2005, but SMO does not support databases set to compatibility levels 60, 65, and 70. for SQL Server 7.0 the compatibility level is 70 Obviously this is conflicting information...I assume if your compatibility level of your DB is 70 you can not connect. To check run: EXEC sp_dbcmptlevel ' databasename ' Looking through this link, it seems you might be able to change the compatibility level by running this: EXEC sp_dbcmptlevel ' databasename ', 80 Obviously make a back up before changing anything.
SMO and Sql Server 7.0 Does anyone have a definitive answer to whether Sql Server Management Objects is compatible with Sql Server 7.0? The docs state: Because SMO is compatible with SQL Server version 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008, you easily manage a multi-version environment. But trying to connect to a Sql 7 instance gets me: "This SQL Server version (7.0) is not supported." Has anyone been successful in getting these 2 to play nice?
TITLE: SMO and Sql Server 7.0 QUESTION: Does anyone have a definitive answer to whether Sql Server Management Objects is compatible with Sql Server 7.0? The docs state: Because SMO is compatible with SQL Server version 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008, you easily manage a multi-version environment. But trying to connect to a Sql 7 instance gets me: "This SQL Server version (7.0) is not supported." Has anyone been successful in getting these 2 to play nice? ANSWER: you can use SMO to connect to SQL Server versions 7, 2000, and 2005, but SMO does not support databases set to compatibility levels 60, 65, and 70. for SQL Server 7.0 the compatibility level is 70 Obviously this is conflicting information...I assume if your compatibility level of your DB is 70 you can not connect. To check run: EXEC sp_dbcmptlevel ' databasename ' Looking through this link, it seems you might be able to change the compatibility level by running this: EXEC sp_dbcmptlevel ' databasename ', 80 Obviously make a back up before changing anything.
[ "sql-server", "smo" ]
0
2
6,879
4
0
2008-08-28T21:36:43.637000
2008-08-29T01:13:36
33,459
33,519
How do you use a flash object as a link?
Is it possible to use a flash document embedded in HTML as a link? I tried just wrapping the object element with an a like this: In Internet Explorer, that made it show the location in the status bar like a link, but it doesn't do anything. I just have the.swf file, so I can't add a click handler in ActionScript.
Though the object really should respond to being wrapped in an a href tag, you could open the swf in vim and just throw in an _root.onPress=function(){getURL("http://yes.no/");}; or if it's AS3, something like _root.addEventHandler(MouseEvent.PRESS, function (e:event) {getURL("http://yes.no/");}); But if editing the swf is your route, you'd likely have more success with a tool for the purpose.
How do you use a flash object as a link? Is it possible to use a flash document embedded in HTML as a link? I tried just wrapping the object element with an a like this: In Internet Explorer, that made it show the location in the status bar like a link, but it doesn't do anything. I just have the.swf file, so I can't add a click handler in ActionScript.
TITLE: How do you use a flash object as a link? QUESTION: Is it possible to use a flash document embedded in HTML as a link? I tried just wrapping the object element with an a like this: In Internet Explorer, that made it show the location in the status bar like a link, but it doesn't do anything. I just have the.swf file, so I can't add a click handler in ActionScript. ANSWER: Though the object really should respond to being wrapped in an a href tag, you could open the swf in vim and just throw in an _root.onPress=function(){getURL("http://yes.no/");}; or if it's AS3, something like _root.addEventHandler(MouseEvent.PRESS, function (e:event) {getURL("http://yes.no/");}); But if editing the swf is your route, you'd likely have more success with a tool for the purpose.
[ "html", "flash" ]
8
1
34,157
4
0
2008-08-28T21:37:13.697000
2008-08-28T22:09:06.130000
33,469
33,795
Caching Patterns in ASP.NET
So I just fixed a bug in a framework I'm developing. The pseudo-pseudocode looks like this: myoldObject = new MyObject { someValue = "old value" }; cache.Insert("myObjectKey", myoldObject); myNewObject = cache.Get("myObjectKey"); myNewObject.someValue = "new value"; if(myObject.someValue!= cache.Get("myObjectKey").someValue) myObject.SaveToDatabase(); So, essentially, I was getting an object from the cache, and then later on comparing the original object to the cached object to see if I need to save it to the database in case it's changed. The problem arose because the original object is a reference...so changing someValue also changed the referenced cached object, so it'd never save back to the database. I fixed it by cloning the object off of the cached version, severing the reference and allowing me to compare the new object against the cached one. My question is: is there a better way to do this, some pattern, that you could recommend? I can't be the only person that's done this before:)
Dirty tracking is the normal way to handle this, I think. Something like: class MyObject { public string SomeValue { get { return _someValue; } set { if (value!= SomeValue) { IsDirty = true; _someValue = value; } } public bool IsDirty { get; private set; } void SaveToDatabase() { base.SaveToDatabase(); IsDirty = false; } } myoldObject = new MyObject { someValue = "old value" }; cache.Insert("myObjectKey", myoldObject); myNewObject = cache.Get("myObjectKey"); myNewObject.someValue = "new value"; if(myNewObject.IsDirty) myNewObject.SaveToDatabase();
Caching Patterns in ASP.NET So I just fixed a bug in a framework I'm developing. The pseudo-pseudocode looks like this: myoldObject = new MyObject { someValue = "old value" }; cache.Insert("myObjectKey", myoldObject); myNewObject = cache.Get("myObjectKey"); myNewObject.someValue = "new value"; if(myObject.someValue!= cache.Get("myObjectKey").someValue) myObject.SaveToDatabase(); So, essentially, I was getting an object from the cache, and then later on comparing the original object to the cached object to see if I need to save it to the database in case it's changed. The problem arose because the original object is a reference...so changing someValue also changed the referenced cached object, so it'd never save back to the database. I fixed it by cloning the object off of the cached version, severing the reference and allowing me to compare the new object against the cached one. My question is: is there a better way to do this, some pattern, that you could recommend? I can't be the only person that's done this before:)
TITLE: Caching Patterns in ASP.NET QUESTION: So I just fixed a bug in a framework I'm developing. The pseudo-pseudocode looks like this: myoldObject = new MyObject { someValue = "old value" }; cache.Insert("myObjectKey", myoldObject); myNewObject = cache.Get("myObjectKey"); myNewObject.someValue = "new value"; if(myObject.someValue!= cache.Get("myObjectKey").someValue) myObject.SaveToDatabase(); So, essentially, I was getting an object from the cache, and then later on comparing the original object to the cached object to see if I need to save it to the database in case it's changed. The problem arose because the original object is a reference...so changing someValue also changed the referenced cached object, so it'd never save back to the database. I fixed it by cloning the object off of the cached version, severing the reference and allowing me to compare the new object against the cached one. My question is: is there a better way to do this, some pattern, that you could recommend? I can't be the only person that's done this before:) ANSWER: Dirty tracking is the normal way to handle this, I think. Something like: class MyObject { public string SomeValue { get { return _someValue; } set { if (value!= SomeValue) { IsDirty = true; _someValue = value; } } public bool IsDirty { get; private set; } void SaveToDatabase() { base.SaveToDatabase(); IsDirty = false; } } myoldObject = new MyObject { someValue = "old value" }; cache.Insert("myObjectKey", myoldObject); myNewObject = cache.Get("myObjectKey"); myNewObject.someValue = "new value"; if(myNewObject.IsDirty) myNewObject.SaveToDatabase();
[ "asp.net", "caching" ]
17
27
4,681
3
0
2008-08-28T21:43:16.163000
2008-08-29T01:51:02.760000
33,471
164,940
Subversion: Fail update when there are conflicts?
Is there a way to tell subversion "update/merge unless it would cause a conflict"? I know you can use --dry-run / status -u to check before running the update, but I often have others running updates and getting broken webpages because they don't notice the "C index.php" line. I've also noticed that svn doesn't seem too unhappy about conflicts - it still says "updated to revision blah" and exits zero, regardless of conflicts. So I have to parse the line-by-line output to discover them. Surely there's a better way?
You can use the --accept parameter to indicate what should happen when a conflict occurs: --accept ARG: specify automatic conflict resolution action ('postpone', 'base', 'mine-full', 'theirs-full', 'edit', 'launch') See also the interactive conflict resolution page in the svnbook
Subversion: Fail update when there are conflicts? Is there a way to tell subversion "update/merge unless it would cause a conflict"? I know you can use --dry-run / status -u to check before running the update, but I often have others running updates and getting broken webpages because they don't notice the "C index.php" line. I've also noticed that svn doesn't seem too unhappy about conflicts - it still says "updated to revision blah" and exits zero, regardless of conflicts. So I have to parse the line-by-line output to discover them. Surely there's a better way?
TITLE: Subversion: Fail update when there are conflicts? QUESTION: Is there a way to tell subversion "update/merge unless it would cause a conflict"? I know you can use --dry-run / status -u to check before running the update, but I often have others running updates and getting broken webpages because they don't notice the "C index.php" line. I've also noticed that svn doesn't seem too unhappy about conflicts - it still says "updated to revision blah" and exits zero, regardless of conflicts. So I have to parse the line-by-line output to discover them. Surely there's a better way? ANSWER: You can use the --accept parameter to indicate what should happen when a conflict occurs: --accept ARG: specify automatic conflict resolution action ('postpone', 'base', 'mine-full', 'theirs-full', 'edit', 'launch') See also the interactive conflict resolution page in the svnbook
[ "svn", "command-line", "merge", "conflict" ]
4
3
1,616
6
0
2008-08-28T21:44:08.593000
2008-10-02T22:46:26.557000
33,475
33,486
ssh hangs when command invoked directly, but exits cleanly when run interactive
I need to launch a server on the remote machine and retrieve the port number that the server process is lsitening on. When invoked, the server will listen on a random port and output the port number on stderr. I want to automate the process of logging on to the remote machine, launching the process, and retrieving the port number. I wrote a Python script called " invokejob.py " that lives on the remote machine to act as a wrapper that invokes the job and then returns the port number, it looks like this: import re, subprocess executable =... # Name of executable regex =... # Regex to extract the port number from the output p = subprocess.Popen(executable, bufsize=1, # line buffered stderr=subprocess.PIPE ) s = p.stderr.readline() port = re.match(regex).groups()[0] print port If I log in interactively, this script works: $ ssh remotehost.example.com Last login: Thu Aug 28 17:31:18 2008 from localhost $./invokejob.py 63409 $ exit logout Connection to remotehost.example.com closed. (Note: successful logout, it did not hang). However, if I try to invoke it from the command-line, it just hangs: $ ssh remotehost.example.com invokejob.py Does anybody know why it hangs in the second case, and what I can do to avoid this? Note that I need to retrieve the output of the program, so I can't just use the ssh "-f" flag or redirect standard output.
s = p.stderr.readline() I suspect it's the above line. When you invoke a command directly through ssh, you don't get your full pty (assuming Linux), and thus no stderr to read from. When you log in interactively, stdin, stdout, and stderr are set up for you, and so your script works.
ssh hangs when command invoked directly, but exits cleanly when run interactive I need to launch a server on the remote machine and retrieve the port number that the server process is lsitening on. When invoked, the server will listen on a random port and output the port number on stderr. I want to automate the process of logging on to the remote machine, launching the process, and retrieving the port number. I wrote a Python script called " invokejob.py " that lives on the remote machine to act as a wrapper that invokes the job and then returns the port number, it looks like this: import re, subprocess executable =... # Name of executable regex =... # Regex to extract the port number from the output p = subprocess.Popen(executable, bufsize=1, # line buffered stderr=subprocess.PIPE ) s = p.stderr.readline() port = re.match(regex).groups()[0] print port If I log in interactively, this script works: $ ssh remotehost.example.com Last login: Thu Aug 28 17:31:18 2008 from localhost $./invokejob.py 63409 $ exit logout Connection to remotehost.example.com closed. (Note: successful logout, it did not hang). However, if I try to invoke it from the command-line, it just hangs: $ ssh remotehost.example.com invokejob.py Does anybody know why it hangs in the second case, and what I can do to avoid this? Note that I need to retrieve the output of the program, so I can't just use the ssh "-f" flag or redirect standard output.
TITLE: ssh hangs when command invoked directly, but exits cleanly when run interactive QUESTION: I need to launch a server on the remote machine and retrieve the port number that the server process is lsitening on. When invoked, the server will listen on a random port and output the port number on stderr. I want to automate the process of logging on to the remote machine, launching the process, and retrieving the port number. I wrote a Python script called " invokejob.py " that lives on the remote machine to act as a wrapper that invokes the job and then returns the port number, it looks like this: import re, subprocess executable =... # Name of executable regex =... # Regex to extract the port number from the output p = subprocess.Popen(executable, bufsize=1, # line buffered stderr=subprocess.PIPE ) s = p.stderr.readline() port = re.match(regex).groups()[0] print port If I log in interactively, this script works: $ ssh remotehost.example.com Last login: Thu Aug 28 17:31:18 2008 from localhost $./invokejob.py 63409 $ exit logout Connection to remotehost.example.com closed. (Note: successful logout, it did not hang). However, if I try to invoke it from the command-line, it just hangs: $ ssh remotehost.example.com invokejob.py Does anybody know why it hangs in the second case, and what I can do to avoid this? Note that I need to retrieve the output of the program, so I can't just use the ssh "-f" flag or redirect standard output. ANSWER: s = p.stderr.readline() I suspect it's the above line. When you invoke a command directly through ssh, you don't get your full pty (assuming Linux), and thus no stderr to read from. When you log in interactively, stdin, stdout, and stderr are set up for you, and so your script works.
[ "python", "ssh" ]
2
3
3,839
2
0
2008-08-28T21:48:09.363000
2008-08-28T21:53:10.850000
33,476
34,454
JSF Lifecycle and Custom components
There are a couple of things that I am having a difficult time understanding with regards to developing custom components in JSF. For the purposes of these questions, you can assume that all of the custom controls are using valuebindings/expressions (not literal bindings), but I'm interested in explanations on them as well. Where do I set the value for the valuebinding? Is this supposed to happen in decode? Or should decode do something else and then have the value set in encodeBegin? Read from the Value Binding - When do I read data from the valuebinding vs. reading it from submittedvalue and putting it into the valuebinding? When are action listeners on forms called in relation to all of this? The JSF lifecycle pages all mention events happening at various steps, but its not completely clear to me when just a simple listener for a commandbutton is being called I've tried a few combinations, but always end up with hard to find bugs that I believe are coming from basic misunderstandings of the event lifecycle.
There is a pretty good diagram in the JSF specification that shows the request lifecycle - essential for understanding this stuff. The steps are: Restore View. The UIComponent tree is rebuilt. Apply Request Values. Editable components should implement EditableValueHolder. This phase walks the component tree and calls the processDecodes methods. If the component isn't something complex like a UIData, it won't do much except call its own decode method. The decode method doesn't do much except find its renderer and invokes its decode method, passing itself as an argument. It is the renderer's job to get any submitted value and set it via setSubmittedValue. Process Validations. This phase calls processValidators which will call validate. The validate method takes the submitted value, converts it with any converters, validates it with any validators and (assuming the data passes those tests) calls setValue. This will store the value as a local variable. While this local variable is not null, it will be returned and not the value from the value binding for any calls to getValue. Update Model Values. This phase calls processUpdates. In an input component, this will call updateModel which will get the ValueExpression and invoke it to set the value on the model. Invoke Application. Button event listeners and so on will be invoked here (as will navigation if memory serves). Render Response. The tree is rendered via the renderers and the state saved. If any of these phases fail (e.g. a value is invalid), the lifecycle skips to Render Response. Various events can be fired after most of these phases, invoking listeners as appropriate (like value change listeners after Process Validations). This is a somewhat simplified version of events. Refer to the specification for more details. I would question why you are writing your own UIComponent. This is a non-trivial task and a deep understanding of the JSF architecture is required to get it right. If you need a custom control, it is better to create a concrete control that extends an exisiting UIComponent (like HtmlInputText does) with an equivalent renderer. If contamination isn't an issue, there is an open-source JSF implementation in the form of Apache MyFaces.
JSF Lifecycle and Custom components There are a couple of things that I am having a difficult time understanding with regards to developing custom components in JSF. For the purposes of these questions, you can assume that all of the custom controls are using valuebindings/expressions (not literal bindings), but I'm interested in explanations on them as well. Where do I set the value for the valuebinding? Is this supposed to happen in decode? Or should decode do something else and then have the value set in encodeBegin? Read from the Value Binding - When do I read data from the valuebinding vs. reading it from submittedvalue and putting it into the valuebinding? When are action listeners on forms called in relation to all of this? The JSF lifecycle pages all mention events happening at various steps, but its not completely clear to me when just a simple listener for a commandbutton is being called I've tried a few combinations, but always end up with hard to find bugs that I believe are coming from basic misunderstandings of the event lifecycle.
TITLE: JSF Lifecycle and Custom components QUESTION: There are a couple of things that I am having a difficult time understanding with regards to developing custom components in JSF. For the purposes of these questions, you can assume that all of the custom controls are using valuebindings/expressions (not literal bindings), but I'm interested in explanations on them as well. Where do I set the value for the valuebinding? Is this supposed to happen in decode? Or should decode do something else and then have the value set in encodeBegin? Read from the Value Binding - When do I read data from the valuebinding vs. reading it from submittedvalue and putting it into the valuebinding? When are action listeners on forms called in relation to all of this? The JSF lifecycle pages all mention events happening at various steps, but its not completely clear to me when just a simple listener for a commandbutton is being called I've tried a few combinations, but always end up with hard to find bugs that I believe are coming from basic misunderstandings of the event lifecycle. ANSWER: There is a pretty good diagram in the JSF specification that shows the request lifecycle - essential for understanding this stuff. The steps are: Restore View. The UIComponent tree is rebuilt. Apply Request Values. Editable components should implement EditableValueHolder. This phase walks the component tree and calls the processDecodes methods. If the component isn't something complex like a UIData, it won't do much except call its own decode method. The decode method doesn't do much except find its renderer and invokes its decode method, passing itself as an argument. It is the renderer's job to get any submitted value and set it via setSubmittedValue. Process Validations. This phase calls processValidators which will call validate. The validate method takes the submitted value, converts it with any converters, validates it with any validators and (assuming the data passes those tests) calls setValue. This will store the value as a local variable. While this local variable is not null, it will be returned and not the value from the value binding for any calls to getValue. Update Model Values. This phase calls processUpdates. In an input component, this will call updateModel which will get the ValueExpression and invoke it to set the value on the model. Invoke Application. Button event listeners and so on will be invoked here (as will navigation if memory serves). Render Response. The tree is rendered via the renderers and the state saved. If any of these phases fail (e.g. a value is invalid), the lifecycle skips to Render Response. Various events can be fired after most of these phases, invoking listeners as appropriate (like value change listeners after Process Validations). This is a somewhat simplified version of events. Refer to the specification for more details. I would question why you are writing your own UIComponent. This is a non-trivial task and a deep understanding of the JSF architecture is required to get it right. If you need a custom control, it is better to create a concrete control that extends an exisiting UIComponent (like HtmlInputText does) with an equivalent renderer. If contamination isn't an issue, there is an open-source JSF implementation in the form of Apache MyFaces.
[ "java", "jsf", "jakarta-ee", "custom-component" ]
19
20
11,043
4
0
2008-08-28T21:48:57.053000
2008-08-29T15:09:23.110000
33,478
35,561
Can you recommend an ASP.NET control library?
Do you have a good experience with a control library? Something that is kind of robust, well documented, consistent (across different controls) and quite well integrated into the Visual Studio.
I'll second the vote for Telerik. Their controls for the most part "just work" and their support has been excellent. I primarily use their forums and I still receive a response within a day (unlike some other vendors who barely seem to notice that they've even got a forum). It also feels like they've actually spent time trying out a lot of the ways customer's will use their controls. The documentation and support reflects it. They aren't perfect, though. One issue that they had in the past, and that they've addressed in the latest releases (what they were calling their "Prometheus" controls, now just "Rad Controls for ASP.NET AJAX") is the performance of the controls. In previous releases they were definitely a bit sluggish (I'm thinking specifically of their RadGrid and RadEditor). Now they're noticeably faster (esp. the RadEditor - it loads MUCH faster). Overall I wouldn't think twice of recommending them.
Can you recommend an ASP.NET control library? Do you have a good experience with a control library? Something that is kind of robust, well documented, consistent (across different controls) and quite well integrated into the Visual Studio.
TITLE: Can you recommend an ASP.NET control library? QUESTION: Do you have a good experience with a control library? Something that is kind of robust, well documented, consistent (across different controls) and quite well integrated into the Visual Studio. ANSWER: I'll second the vote for Telerik. Their controls for the most part "just work" and their support has been excellent. I primarily use their forums and I still receive a response within a day (unlike some other vendors who barely seem to notice that they've even got a forum). It also feels like they've actually spent time trying out a lot of the ways customer's will use their controls. The documentation and support reflects it. They aren't perfect, though. One issue that they had in the past, and that they've addressed in the latest releases (what they were calling their "Prometheus" controls, now just "Rad Controls for ASP.NET AJAX") is the performance of the controls. In previous releases they were definitely a bit sluggish (I'm thinking specifically of their RadGrid and RadEditor). Now they're noticeably faster (esp. the RadEditor - it loads MUCH faster). Overall I wouldn't think twice of recommending them.
[ "asp.net", "controls" ]
0
3
2,521
7
0
2008-08-28T21:49:51.327000
2008-08-30T01:46:53.403000
33,484
33,981
Can I export translations of place names from freebase.com
So I've looked at this use of the freebase API and I was really impressed with the translations of the name that it found. IE Rome, Roma, Rom, Rzym, Rooma,로마, 罗马市. This is because I have a database of some 5000+ location names and I would very much like all French, German or Korean translations for these English names. The problem is I spent about two hours clicking around freebase, and could find no way to get a view of city/location names in a different language mapped to English. So I'd love it if someone who understands what freebase is and how it's organized could get me a link to that view which theoretically I could then export. Also I just wanted to share this question because I'm totally impressed with freebase and think if people haven't looked at it they should.
The query [{ limit: 100, type: '/location/location', name: [{ value: null, lang: { name: { value: null, lang: '/lang/en', }, } }], }]; returns for every location and every language, the name of that location in that language. The results are organized by language. For example, here is a very small segment of the return value: { 'lang': { 'name': { 'lang': '/lang/en', 'value': 'Russian' } }, 'value': 'Сан-Франциско' }, { 'lang': { 'name': { 'lang': '/lang/en', 'value': 'Swedish' } }, 'value': 'San Francisco' }, { 'lang': { 'name': { 'lang': '/lang/en', 'value': 'Portuguese' } }, 'value': 'São Francisco (Califórnia)' }, For a no-programming solution, copy-paste the following into an HTML file and open it with your browser: mjt.freebase.MqlRead([{ limit: 10, type: '/location/location', name: [{ value:null, lang:{ name:{ value:null, lang:'/lang/en', }, } }], }]) var name = topic.name[rowi]; ${(name.lang['q:name']||name.lang.name).value}: $name.value Of course, that will only include the first 10 results. Up the limit above if you want more. (By the way, not only is Freebase cool, so is this mjt templating language!)
Can I export translations of place names from freebase.com So I've looked at this use of the freebase API and I was really impressed with the translations of the name that it found. IE Rome, Roma, Rom, Rzym, Rooma,로마, 罗马市. This is because I have a database of some 5000+ location names and I would very much like all French, German or Korean translations for these English names. The problem is I spent about two hours clicking around freebase, and could find no way to get a view of city/location names in a different language mapped to English. So I'd love it if someone who understands what freebase is and how it's organized could get me a link to that view which theoretically I could then export. Also I just wanted to share this question because I'm totally impressed with freebase and think if people haven't looked at it they should.
TITLE: Can I export translations of place names from freebase.com QUESTION: So I've looked at this use of the freebase API and I was really impressed with the translations of the name that it found. IE Rome, Roma, Rom, Rzym, Rooma,로마, 罗马市. This is because I have a database of some 5000+ location names and I would very much like all French, German or Korean translations for these English names. The problem is I spent about two hours clicking around freebase, and could find no way to get a view of city/location names in a different language mapped to English. So I'd love it if someone who understands what freebase is and how it's organized could get me a link to that view which theoretically I could then export. Also I just wanted to share this question because I'm totally impressed with freebase and think if people haven't looked at it they should. ANSWER: The query [{ limit: 100, type: '/location/location', name: [{ value: null, lang: { name: { value: null, lang: '/lang/en', }, } }], }]; returns for every location and every language, the name of that location in that language. The results are organized by language. For example, here is a very small segment of the return value: { 'lang': { 'name': { 'lang': '/lang/en', 'value': 'Russian' } }, 'value': 'Сан-Франциско' }, { 'lang': { 'name': { 'lang': '/lang/en', 'value': 'Swedish' } }, 'value': 'San Francisco' }, { 'lang': { 'name': { 'lang': '/lang/en', 'value': 'Portuguese' } }, 'value': 'São Francisco (Califórnia)' }, For a no-programming solution, copy-paste the following into an HTML file and open it with your browser: mjt.freebase.MqlRead([{ limit: 10, type: '/location/location', name: [{ value:null, lang:{ name:{ value:null, lang:'/lang/en', }, } }], }]) var name = topic.name[rowi]; ${(name.lang['q:name']||name.lang.name).value}: $name.value Of course, that will only include the first 10 results. Up the limit above if you want more. (By the way, not only is Freebase cool, so is this mjt templating language!)
[ "translation", "freebase" ]
3
4
691
2
0
2008-08-28T21:51:40.480000
2008-08-29T05:01:21.570000
33,485
34,080
ASP.NET vs. Silverlight
I'm starting a new web project and I am considering two presentation frameworks. I am thinking either about ASP.NET MVC or Silverlight. I would tend toward Silverlight since I'm quite experienced.NET developer while I have just a basic knowledge of ASP.NET controls.
It is mainly going to be an iternal product so browsers are not an issue. You still have not written a proper description about the nature of your application. It is difficult to assess which technology is a good fit without first knowing well enough the domain the application is being applied to, and the problems it is designed to solve. In general, Microsoft is positioning these array of presentation technologies on the " Reach vs Rich " continuum. You have "plain old" HTML and Javascript on one end, acceptable by the most number of client machines out there, and the ultimate full-blown WPF on the other side where limited number of machines can handle. You did mention this to be an internal app, so WPF via XBAP or ClickOnce are also possible. So the scale would align this way: (reach) ASP.NET, AJAX, Silverlight, WPF (rich). So the question is just how rich you want/need it to be for the users until it hurts the deployment base? Frankly if all you fetch are forms and tabular data and statistics then regular ASP.NET web forms are just fine. If you want on-the-fly resizable graphs and client-side interactive with back-end WCF web services Silverlight can do that. If you want even more powerful graphical rendering than WPF via the remote deployment options is your bet.
ASP.NET vs. Silverlight I'm starting a new web project and I am considering two presentation frameworks. I am thinking either about ASP.NET MVC or Silverlight. I would tend toward Silverlight since I'm quite experienced.NET developer while I have just a basic knowledge of ASP.NET controls.
TITLE: ASP.NET vs. Silverlight QUESTION: I'm starting a new web project and I am considering two presentation frameworks. I am thinking either about ASP.NET MVC or Silverlight. I would tend toward Silverlight since I'm quite experienced.NET developer while I have just a basic knowledge of ASP.NET controls. ANSWER: It is mainly going to be an iternal product so browsers are not an issue. You still have not written a proper description about the nature of your application. It is difficult to assess which technology is a good fit without first knowing well enough the domain the application is being applied to, and the problems it is designed to solve. In general, Microsoft is positioning these array of presentation technologies on the " Reach vs Rich " continuum. You have "plain old" HTML and Javascript on one end, acceptable by the most number of client machines out there, and the ultimate full-blown WPF on the other side where limited number of machines can handle. You did mention this to be an internal app, so WPF via XBAP or ClickOnce are also possible. So the scale would align this way: (reach) ASP.NET, AJAX, Silverlight, WPF (rich). So the question is just how rich you want/need it to be for the users until it hurts the deployment base? Frankly if all you fetch are forms and tabular data and statistics then regular ASP.NET web forms are just fine. If you want on-the-fly resizable graphs and client-side interactive with back-end WCF web services Silverlight can do that. If you want even more powerful graphical rendering than WPF via the remote deployment options is your bet.
[ "asp.net", "silverlight" ]
22
33
29,927
11
0
2008-08-28T21:51:58.870000
2008-08-29T06:56:58.233000
33,495
33,855
Could you make a case for using Berkeley DB XML
I'm trying to read through the documentation on Berkeley DB XML, and I think I could really use a developer's blog post or synopsis of when they had a problem that found the XML layer atop Berkeley DB was the exact prescription for. Maybe I'm not getting it, but it seems like they're both in-process DBs, and ultimately you will parse your XML into objects or data, so why not start by storing your data parsed, rather than as XML?
Ultimately I want my data stored in some reasonable format. If that data started as XML and I want to retrieve it/them using XQuery, without the XML layer, I have to write a lot of code to do the XQuery by myself, and perhaps even worse to know my XML well enough to be able to have a reasonable storage system for it. Conversely, so long as the performance of the system allows, I can forget about that part of the back end, and just worry about my XML document and up (i.e. to the user) level and leave the rest as a black box. It gives me the B-DB storage goodness, but I get to use it from a document-centric perspective.
Could you make a case for using Berkeley DB XML I'm trying to read through the documentation on Berkeley DB XML, and I think I could really use a developer's blog post or synopsis of when they had a problem that found the XML layer atop Berkeley DB was the exact prescription for. Maybe I'm not getting it, but it seems like they're both in-process DBs, and ultimately you will parse your XML into objects or data, so why not start by storing your data parsed, rather than as XML?
TITLE: Could you make a case for using Berkeley DB XML QUESTION: I'm trying to read through the documentation on Berkeley DB XML, and I think I could really use a developer's blog post or synopsis of when they had a problem that found the XML layer atop Berkeley DB was the exact prescription for. Maybe I'm not getting it, but it seems like they're both in-process DBs, and ultimately you will parse your XML into objects or data, so why not start by storing your data parsed, rather than as XML? ANSWER: Ultimately I want my data stored in some reasonable format. If that data started as XML and I want to retrieve it/them using XQuery, without the XML layer, I have to write a lot of code to do the XQuery by myself, and perhaps even worse to know my XML well enough to be able to have a reasonable storage system for it. Conversely, so long as the performance of the system allows, I can forget about that part of the back end, and just worry about my XML document and up (i.e. to the user) level and leave the rest as a black box. It gives me the B-DB storage goodness, but I get to use it from a document-centric perspective.
[ "berkeley-db", "berkeley-db-xml" ]
3
6
412
1
0
2008-08-28T21:57:24.193000
2008-08-29T02:30:51.150000
33,497
33,564
How do I recover from an unchecked exception?
Unchecked exceptions are alright if you want to handle every failure the same way, for example by logging it and skipping to the next request, displaying a message to the user and handling the next event, etc. If this is my use case, all I have to do is catch some general exception type at a high level in my system, and handle everything the same way. But I want to recover from specific problems, and I'm not sure the best way to approach it with unchecked exceptions. Here is a concrete example. Suppose I have a web application, built using Struts2 and Hibernate. If an exception bubbles up to my "action", I log it, and display a pretty apology to the user. But one of the functions of my web application is creating new user accounts, that require a unique user name. If a user picks a name that already exists, Hibernate throws an org.hibernate.exception.ConstraintViolationException (an unchecked exception) down in the guts of my system. I'd really like to recover from this particular problem by asking the user to choose another user name, rather than giving them the same "we logged your problem but for now you're hosed" message. Here are a few points to consider: There a lot of people creating accounts simultaneously. I don't want to lock the whole user table between a "SELECT" to see if the name exists and an "INSERT" if it doesn't. In the case of relational databases, there might be some tricks to work around this, but what I'm really interested in is the general case where pre-checking for an exception won't work because of a fundamental race condition. Same thing could apply to looking for a file on the file system, etc. Given my CTO's propensity for drive-by management induced by reading technology columns in "Inc.", I need a layer of indirection around the persistence mechanism so that I can throw out Hibernate and use Kodo, or whatever, without changing anything except the lowest layer of persistence code. As a matter of fact, there are several such layers of abstraction in my system. How can I prevent them from leaking in spite of unchecked exceptions? One of the declaimed weaknesses of checked exceptions is having to "handle" them in every call on the stack—either by declaring that a calling method throws them, or by catching them and handling them. Handling them often means wrapping them in another checked exception of a type appropriate to the level of abstraction. So, for example, in checked-exception land, a file-system–based implementation of my UserRegistry might catch IOException, while a database implementation would catch SQLException, but both would throw a UserNotFoundException that hides the underlying implementation. How do I take advantage of unchecked exceptions, sparing myself of the burden of this wrapping at each layer, without leaking implementation details?
IMO, wrapping exceptions (checked or otherwise) has several benefits that are worth the cost: 1) It encourages you to think about the failure modes for the code you write. Basically, you have to consider the exceptions that the code you call may throw, and in turn you'll consider the exceptions you'll throw for the code that calls yours. 2) It gives you the opportunity to add additional debugging information into the exception chain. For instance, if you have a method that throws an exception on a duplicate username, you might wrap that exception with one that includes additional information about the circumstances of the failure (for example, the IP of the request that provided the dupe username) that wasn't available to the lower-level code. The cookie trail of exceptions may help you debug a complex problem (it certainly has for me). 3) It lets you become implementation-independent from the lower level code. If you're wrapping exceptions and need to swap out Hibernate for some other ORM, you only have to change your Hibernate-handling code. All the other layers of code will still be successfully using the wrapped exceptions and will interpret them in the same way, even though the underlying circumstances have changed. Note that this applies even if Hibernate changes in some way (ex: they switch exceptions in a new version); it's not just for wholesale technology replacement. 4) It encourages you use different classes of exceptions to represent different situations. For example, you may have a DuplicateUsernameException when the user tries to reuse a username, and a DatabaseFailureException when you can't check for dupe usernames due to a broken DB connection. This, in turn, lets you answer your question ("how do I recover?") in flexible and powerful ways. If you get a DuplicateUsernameException, you may decide to suggest a different username to the user. If you get a DatabaseFailureException, you may let it bubble up to the point where it displays a "down for maintenance" page to the user and send off a notification email to you. Once you have custom exceptions, you have customizeable responses -- and that's a good thing.
How do I recover from an unchecked exception? Unchecked exceptions are alright if you want to handle every failure the same way, for example by logging it and skipping to the next request, displaying a message to the user and handling the next event, etc. If this is my use case, all I have to do is catch some general exception type at a high level in my system, and handle everything the same way. But I want to recover from specific problems, and I'm not sure the best way to approach it with unchecked exceptions. Here is a concrete example. Suppose I have a web application, built using Struts2 and Hibernate. If an exception bubbles up to my "action", I log it, and display a pretty apology to the user. But one of the functions of my web application is creating new user accounts, that require a unique user name. If a user picks a name that already exists, Hibernate throws an org.hibernate.exception.ConstraintViolationException (an unchecked exception) down in the guts of my system. I'd really like to recover from this particular problem by asking the user to choose another user name, rather than giving them the same "we logged your problem but for now you're hosed" message. Here are a few points to consider: There a lot of people creating accounts simultaneously. I don't want to lock the whole user table between a "SELECT" to see if the name exists and an "INSERT" if it doesn't. In the case of relational databases, there might be some tricks to work around this, but what I'm really interested in is the general case where pre-checking for an exception won't work because of a fundamental race condition. Same thing could apply to looking for a file on the file system, etc. Given my CTO's propensity for drive-by management induced by reading technology columns in "Inc.", I need a layer of indirection around the persistence mechanism so that I can throw out Hibernate and use Kodo, or whatever, without changing anything except the lowest layer of persistence code. As a matter of fact, there are several such layers of abstraction in my system. How can I prevent them from leaking in spite of unchecked exceptions? One of the declaimed weaknesses of checked exceptions is having to "handle" them in every call on the stack—either by declaring that a calling method throws them, or by catching them and handling them. Handling them often means wrapping them in another checked exception of a type appropriate to the level of abstraction. So, for example, in checked-exception land, a file-system–based implementation of my UserRegistry might catch IOException, while a database implementation would catch SQLException, but both would throw a UserNotFoundException that hides the underlying implementation. How do I take advantage of unchecked exceptions, sparing myself of the burden of this wrapping at each layer, without leaking implementation details?
TITLE: How do I recover from an unchecked exception? QUESTION: Unchecked exceptions are alright if you want to handle every failure the same way, for example by logging it and skipping to the next request, displaying a message to the user and handling the next event, etc. If this is my use case, all I have to do is catch some general exception type at a high level in my system, and handle everything the same way. But I want to recover from specific problems, and I'm not sure the best way to approach it with unchecked exceptions. Here is a concrete example. Suppose I have a web application, built using Struts2 and Hibernate. If an exception bubbles up to my "action", I log it, and display a pretty apology to the user. But one of the functions of my web application is creating new user accounts, that require a unique user name. If a user picks a name that already exists, Hibernate throws an org.hibernate.exception.ConstraintViolationException (an unchecked exception) down in the guts of my system. I'd really like to recover from this particular problem by asking the user to choose another user name, rather than giving them the same "we logged your problem but for now you're hosed" message. Here are a few points to consider: There a lot of people creating accounts simultaneously. I don't want to lock the whole user table between a "SELECT" to see if the name exists and an "INSERT" if it doesn't. In the case of relational databases, there might be some tricks to work around this, but what I'm really interested in is the general case where pre-checking for an exception won't work because of a fundamental race condition. Same thing could apply to looking for a file on the file system, etc. Given my CTO's propensity for drive-by management induced by reading technology columns in "Inc.", I need a layer of indirection around the persistence mechanism so that I can throw out Hibernate and use Kodo, or whatever, without changing anything except the lowest layer of persistence code. As a matter of fact, there are several such layers of abstraction in my system. How can I prevent them from leaking in spite of unchecked exceptions? One of the declaimed weaknesses of checked exceptions is having to "handle" them in every call on the stack—either by declaring that a calling method throws them, or by catching them and handling them. Handling them often means wrapping them in another checked exception of a type appropriate to the level of abstraction. So, for example, in checked-exception land, a file-system–based implementation of my UserRegistry might catch IOException, while a database implementation would catch SQLException, but both would throw a UserNotFoundException that hides the underlying implementation. How do I take advantage of unchecked exceptions, sparing myself of the burden of this wrapping at each layer, without leaking implementation details? ANSWER: IMO, wrapping exceptions (checked or otherwise) has several benefits that are worth the cost: 1) It encourages you to think about the failure modes for the code you write. Basically, you have to consider the exceptions that the code you call may throw, and in turn you'll consider the exceptions you'll throw for the code that calls yours. 2) It gives you the opportunity to add additional debugging information into the exception chain. For instance, if you have a method that throws an exception on a duplicate username, you might wrap that exception with one that includes additional information about the circumstances of the failure (for example, the IP of the request that provided the dupe username) that wasn't available to the lower-level code. The cookie trail of exceptions may help you debug a complex problem (it certainly has for me). 3) It lets you become implementation-independent from the lower level code. If you're wrapping exceptions and need to swap out Hibernate for some other ORM, you only have to change your Hibernate-handling code. All the other layers of code will still be successfully using the wrapped exceptions and will interpret them in the same way, even though the underlying circumstances have changed. Note that this applies even if Hibernate changes in some way (ex: they switch exceptions in a new version); it's not just for wholesale technology replacement. 4) It encourages you use different classes of exceptions to represent different situations. For example, you may have a DuplicateUsernameException when the user tries to reuse a username, and a DatabaseFailureException when you can't check for dupe usernames due to a broken DB connection. This, in turn, lets you answer your question ("how do I recover?") in flexible and powerful ways. If you get a DuplicateUsernameException, you may decide to suggest a different username to the user. If you get a DatabaseFailureException, you may let it bubble up to the point where it displays a "down for maintenance" page to the user and send off a notification email to you. Once you have custom exceptions, you have customizeable responses -- and that's a good thing.
[ "c#", "java", "api", "exception" ]
4
15
3,296
9
0
2008-08-28T21:57:40.480000
2008-08-28T22:32:53.390000
33,510
33,580
What is the best approach to both modularity and platform independence?
I hope this question does not come off as broad as it may seem at first. I am designing a software application that I would like to be both cross-platform and modular. I am still in the planning phase and can pick practically any language and toolset. This makes things harder, not easier, because there are seemingly so many ways of accomplishing both of the goals (modularity, platform agnosticism). My basic premise is that security, data storage, interaction with the operating system, and configuration should all be handled by a "container" application - but most of the other functionality will be supplied through plug-in modules. If I had to describe it at a high level (without completely giving away my idea), it would be a single application that can do many different jobs, all dedicated to the same goal (there are lots of disparate things to do, but all the data has to interact and be highly available). I find myself wrestling with not so much how to do it (I can think of lots of ways), but which method is best. For example, I know that Eclipse practically embodies what I am describing, but I find Java applications in general (and Eclipse is no exception) to be too large and slow for what I need. Ditto desktop apps written Python and Ruby (which are excellent languages!) I don't mind recompiling the code base for different platforms as native exectables. Yet, C and C++ have their own set of issues. As a C# developer, I have a preference for managed code, but I am not at all sold on Mono, yet (I could be convinced). Does anyone have any ideas/experiences/ specific favorite frameworks to share?
Just to cite an example: for.NET apps there are the CAB (Composite Application Block) and the Composite Application Guidance for WPF. Both are mainly implementations of a set of several design patterns focused on modularity and loose coupling between components similar to a plug-in architecture: you have an IOC framework, MVC base classes, a loosely coupled event broker, dynamic loading of modules and other stuff. So I suppose that kind of pattern infrastructure is what you are trying to find, just not specifically for.NET. But if you see the CAB as a set of pattern implementations, you can see that almost every language and platform has some form of already built-in or third party frameworks for individual patterns. So my take would be: Study (if you are not familiar with) some of those design patterns. You could take as an example the CAB framework for WPF documentation: Patterns in the Composite Application Library Design your architecture thinking on which of those patterns you think would be useful for what you want to achieve first without thinking in specific pattern implementations or products. Once you have your 'architectural requirements' defined more specifically, look for individual frameworks that help accomplish each one of those patterns/features for the language you decide to use and put together your own application framework based on them. I agree that the hard part is to make all this platform independent. I really cannot think on any other solution to choose a mature platform independent language like Java.
What is the best approach to both modularity and platform independence? I hope this question does not come off as broad as it may seem at first. I am designing a software application that I would like to be both cross-platform and modular. I am still in the planning phase and can pick practically any language and toolset. This makes things harder, not easier, because there are seemingly so many ways of accomplishing both of the goals (modularity, platform agnosticism). My basic premise is that security, data storage, interaction with the operating system, and configuration should all be handled by a "container" application - but most of the other functionality will be supplied through plug-in modules. If I had to describe it at a high level (without completely giving away my idea), it would be a single application that can do many different jobs, all dedicated to the same goal (there are lots of disparate things to do, but all the data has to interact and be highly available). I find myself wrestling with not so much how to do it (I can think of lots of ways), but which method is best. For example, I know that Eclipse practically embodies what I am describing, but I find Java applications in general (and Eclipse is no exception) to be too large and slow for what I need. Ditto desktop apps written Python and Ruby (which are excellent languages!) I don't mind recompiling the code base for different platforms as native exectables. Yet, C and C++ have their own set of issues. As a C# developer, I have a preference for managed code, but I am not at all sold on Mono, yet (I could be convinced). Does anyone have any ideas/experiences/ specific favorite frameworks to share?
TITLE: What is the best approach to both modularity and platform independence? QUESTION: I hope this question does not come off as broad as it may seem at first. I am designing a software application that I would like to be both cross-platform and modular. I am still in the planning phase and can pick practically any language and toolset. This makes things harder, not easier, because there are seemingly so many ways of accomplishing both of the goals (modularity, platform agnosticism). My basic premise is that security, data storage, interaction with the operating system, and configuration should all be handled by a "container" application - but most of the other functionality will be supplied through plug-in modules. If I had to describe it at a high level (without completely giving away my idea), it would be a single application that can do many different jobs, all dedicated to the same goal (there are lots of disparate things to do, but all the data has to interact and be highly available). I find myself wrestling with not so much how to do it (I can think of lots of ways), but which method is best. For example, I know that Eclipse practically embodies what I am describing, but I find Java applications in general (and Eclipse is no exception) to be too large and slow for what I need. Ditto desktop apps written Python and Ruby (which are excellent languages!) I don't mind recompiling the code base for different platforms as native exectables. Yet, C and C++ have their own set of issues. As a C# developer, I have a preference for managed code, but I am not at all sold on Mono, yet (I could be convinced). Does anyone have any ideas/experiences/ specific favorite frameworks to share? ANSWER: Just to cite an example: for.NET apps there are the CAB (Composite Application Block) and the Composite Application Guidance for WPF. Both are mainly implementations of a set of several design patterns focused on modularity and loose coupling between components similar to a plug-in architecture: you have an IOC framework, MVC base classes, a loosely coupled event broker, dynamic loading of modules and other stuff. So I suppose that kind of pattern infrastructure is what you are trying to find, just not specifically for.NET. But if you see the CAB as a set of pattern implementations, you can see that almost every language and platform has some form of already built-in or third party frameworks for individual patterns. So my take would be: Study (if you are not familiar with) some of those design patterns. You could take as an example the CAB framework for WPF documentation: Patterns in the Composite Application Library Design your architecture thinking on which of those patterns you think would be useful for what you want to achieve first without thinking in specific pattern implementations or products. Once you have your 'architectural requirements' defined more specifically, look for individual frameworks that help accomplish each one of those patterns/features for the language you decide to use and put together your own application framework based on them. I agree that the hard part is to make all this platform independent. I really cannot think on any other solution to choose a mature platform independent language like Java.
[ "compiled", "interpreted-language" ]
1
2
560
6
0
2008-08-28T22:03:58.093000
2008-08-28T22:45:33.983000
33,513
33,528
Should I use a software hosting solution for my personal projects?
Right now, I keep all of my projects on my laptop. I'm thinking that I shouldn't do this, but instead use a version control system and check them in/out from an external hosting repository (Google Code, SourceForge, etc). I see several benefits here - first, I don't have to worry about losing my code if my computer crashes and burns or my external HDD crashes and burns; second, I can share my code with the world and perhaps even get more help when I need it. Is this a good idea? If so, what are some other project hosts that I should investigate (other than Google Code and SourceForge)?
After losing some freelance work to a hard drive crash, I've become keen on the philosophy that "It doesn't exist until its in source control". As I don't want to necessarily share the source for my projects with the rest of the world, I pay for webhosting (using Dreamhost who have great deals on basic shared hosting and easy one-click installs for things like subversion) and store my data that way. They don't claim to be any sort of backup service, but all I really want is a second copy offsite somewhere. If I do decide to share the code I can always make it public later. Do note that sourceforge does not allow private/personal projects, and Google Code forces you to license your code using an open source license. Both have some limitations on the number of projects you can create (and aren't really intended to store everybody and their brother's personal projects). Assembla looks pretty slick although it is hard to tell what all you get for free. I'm definitely going to try it out. There is an extensive list at wikipedia.
Should I use a software hosting solution for my personal projects? Right now, I keep all of my projects on my laptop. I'm thinking that I shouldn't do this, but instead use a version control system and check them in/out from an external hosting repository (Google Code, SourceForge, etc). I see several benefits here - first, I don't have to worry about losing my code if my computer crashes and burns or my external HDD crashes and burns; second, I can share my code with the world and perhaps even get more help when I need it. Is this a good idea? If so, what are some other project hosts that I should investigate (other than Google Code and SourceForge)?
TITLE: Should I use a software hosting solution for my personal projects? QUESTION: Right now, I keep all of my projects on my laptop. I'm thinking that I shouldn't do this, but instead use a version control system and check them in/out from an external hosting repository (Google Code, SourceForge, etc). I see several benefits here - first, I don't have to worry about losing my code if my computer crashes and burns or my external HDD crashes and burns; second, I can share my code with the world and perhaps even get more help when I need it. Is this a good idea? If so, what are some other project hosts that I should investigate (other than Google Code and SourceForge)? ANSWER: After losing some freelance work to a hard drive crash, I've become keen on the philosophy that "It doesn't exist until its in source control". As I don't want to necessarily share the source for my projects with the rest of the world, I pay for webhosting (using Dreamhost who have great deals on basic shared hosting and easy one-click installs for things like subversion) and store my data that way. They don't claim to be any sort of backup service, but all I really want is a second copy offsite somewhere. If I do decide to share the code I can always make it public later. Do note that sourceforge does not allow private/personal projects, and Google Code forces you to license your code using an open source license. Both have some limitations on the number of projects you can create (and aren't really intended to store everybody and their brother's personal projects). Assembla looks pretty slick although it is hard to tell what all you get for free. I'm definitely going to try it out. There is an extensive list at wikipedia.
[ "version-control", "projects", "project-hosting" ]
4
4
1,671
10
0
2008-08-28T22:05:04.083000
2008-08-28T22:14:11.643000
33,529
33,541
How exactly do you configure httpOnlyCookies in ASP.NET?
Inspired by this CodingHorror article, " Protecting Your Cookies: HttpOnly " How do you set this property? Somewhere in the web config?
If you're using ASP.NET 2.0 or greater, you can turn it on in the Web.config file. In the section, add the following line:
How exactly do you configure httpOnlyCookies in ASP.NET? Inspired by this CodingHorror article, " Protecting Your Cookies: HttpOnly " How do you set this property? Somewhere in the web config?
TITLE: How exactly do you configure httpOnlyCookies in ASP.NET? QUESTION: Inspired by this CodingHorror article, " Protecting Your Cookies: HttpOnly " How do you set this property? Somewhere in the web config? ANSWER: If you're using ASP.NET 2.0 or greater, you can turn it on in the Web.config file. In the section, add the following line:
[ "asp.net", "cookies", "xss", "httponly" ]
54
76
141,949
4
0
2008-08-28T22:14:16.650000
2008-08-28T22:19:38.587000
33,534
33,563
Extending base classes in Python
I'm trying to extend some "base" classes in Python: class xlist (list): def len(self): return len(self) def add(self, *args): self.extend(args) return None class xint (int): def add(self, value): self += value return self x = xlist([1,2,3]) print x.len() ## >>> 3 ok print x ## >>> [1,2,3] ok x.add (4, 5, 6) print x ## >>> [1,2,3,4,5,6] ok x = xint(10) print x ## >>> 10 ok x.add (2) print x ## >>> 10 # Not ok (#1) print type(x) ## >>> ok x += 5 print type(x) ## >>> # Not ok (#2) It works fine in the list case because the append method modifies the object "in place", without returning it. But in the int case, the add method doesn't modify the value of the external x variable. I suppose that's fine in the sense that self is a local variable in the add method of the class, but this is preventing me from modifying the initial value assigned to the instance of the class. Is it possible to extend a class this way or should I define a class property with the base type and map all the needed methods to this property?
int is a value type, so each time you do an assignment, (e.g. both instances of += above), it doesn't modify the object you have on the heap, but replaces the reference with one of the result of the right hand side of the assignment (i.e. an int ) list isn't a value type, so it isn't bound by the same rules. this page has more details on the differences: The Python Language Reference - 3. Data model IMO, yes, you should define a new class that keeps an int as an instance variable
Extending base classes in Python I'm trying to extend some "base" classes in Python: class xlist (list): def len(self): return len(self) def add(self, *args): self.extend(args) return None class xint (int): def add(self, value): self += value return self x = xlist([1,2,3]) print x.len() ## >>> 3 ok print x ## >>> [1,2,3] ok x.add (4, 5, 6) print x ## >>> [1,2,3,4,5,6] ok x = xint(10) print x ## >>> 10 ok x.add (2) print x ## >>> 10 # Not ok (#1) print type(x) ## >>> ok x += 5 print type(x) ## >>> # Not ok (#2) It works fine in the list case because the append method modifies the object "in place", without returning it. But in the int case, the add method doesn't modify the value of the external x variable. I suppose that's fine in the sense that self is a local variable in the add method of the class, but this is preventing me from modifying the initial value assigned to the instance of the class. Is it possible to extend a class this way or should I define a class property with the base type and map all the needed methods to this property?
TITLE: Extending base classes in Python QUESTION: I'm trying to extend some "base" classes in Python: class xlist (list): def len(self): return len(self) def add(self, *args): self.extend(args) return None class xint (int): def add(self, value): self += value return self x = xlist([1,2,3]) print x.len() ## >>> 3 ok print x ## >>> [1,2,3] ok x.add (4, 5, 6) print x ## >>> [1,2,3,4,5,6] ok x = xint(10) print x ## >>> 10 ok x.add (2) print x ## >>> 10 # Not ok (#1) print type(x) ## >>> ok x += 5 print type(x) ## >>> # Not ok (#2) It works fine in the list case because the append method modifies the object "in place", without returning it. But in the int case, the add method doesn't modify the value of the external x variable. I suppose that's fine in the sense that self is a local variable in the add method of the class, but this is preventing me from modifying the initial value assigned to the instance of the class. Is it possible to extend a class this way or should I define a class property with the base type and map all the needed methods to this property? ANSWER: int is a value type, so each time you do an assignment, (e.g. both instances of += above), it doesn't modify the object you have on the heap, but replaces the reference with one of the result of the right hand side of the assignment (i.e. an int ) list isn't a value type, so it isn't bound by the same rules. this page has more details on the differences: The Python Language Reference - 3. Data model IMO, yes, you should define a new class that keeps an int as an instance variable
[ "python" ]
16
6
24,861
5
0
2008-08-28T22:18:02.740000
2008-08-28T22:32:40.147000
33,545
33,598
Converter for VB.NET Code to Linux Platform Exist?
I am interested in moving a number of my projects from Visual Studio and Access/Office Basic with a SQL back-end to the Linux world. Are there any utilities available to move code over to a similar platform on Linux?
Here's a link to the Mono Migration Analyzer to get started. It will help you pinpoint Microsoft specific calls, but you'll probably have to do the db conversion and data access layer manually. You may be surprised - mono does have a System.Data.SqlClient namespace so you may not have much work to do.
Converter for VB.NET Code to Linux Platform Exist? I am interested in moving a number of my projects from Visual Studio and Access/Office Basic with a SQL back-end to the Linux world. Are there any utilities available to move code over to a similar platform on Linux?
TITLE: Converter for VB.NET Code to Linux Platform Exist? QUESTION: I am interested in moving a number of my projects from Visual Studio and Access/Office Basic with a SQL back-end to the Linux world. Are there any utilities available to move code over to a similar platform on Linux? ANSWER: Here's a link to the Mono Migration Analyzer to get started. It will help you pinpoint Microsoft specific calls, but you'll probably have to do the db conversion and data access layer manually. You may be surprised - mono does have a System.Data.SqlClient namespace so you may not have much work to do.
[ "vb.net", "linux", "ms-access" ]
2
4
1,807
3
0
2008-08-28T22:22:55.973000
2008-08-28T23:01:58.843000
33,559
34,816
How to get started with PowerShell?
I played with one of the early beta versions of PowerShell V1, but haven't used it since it went "gold". What is the best way to get started using PowerShell? Which version of PowerShell should I be using (V1.0 vs 2.0 CTP's)? What are you using PowerShell for? Are there any tools that make using PowerShell easier (that is, development environments)?
For learning PowerShell, there are a number of great resources Technet Virtual Labs ( Introduction to Windows PowerShell ) PowerShellCommunity.org - Forums, blogs, script repository powershell on irc.freenode.net PowerShell podcasts - PowerScripting.net and Get-Scripting.blogspot.com For IDE style environments, you have PowerShell Analyzer (free) and PowerGUI (free), PowerShell Plus (commercial), PrimalScript (commercial), and Admin Script Editor (commerical). I use PowerShell for everything that I can. Right now, I'm looking at Psake, a PowerShell based build script environment. I use if for managing my Active Directory, Hyper-V, Twitter, some keyboard automation (hosting PowerShell in a winforms app to grab keystrokes), and a ton of other stuff. Another cool project I have to check out is PSExpect for testing. I also use it for database access - monitoring changes made to rows in a database by applications. It is also integrated in to my network monitoring solution. I am also looking to use PowerShell as a scripting engine for a project I am working on. EDIT: If you are just learning PowerShell, I would focus on V1. As you get more comfortable, take a look at the CTP, but too much can change from the CTP to what is actually released as V2 to make that your learning tool. Version 2 is out and available from XP SP3, Server 2003, Vista, and Server 2008 and in the box for Win7 and Server 2008 R2. What you learned for V1 will still serve you well, but now I would concentrate on V2, as there is a superior feature set. Good luck!
How to get started with PowerShell? I played with one of the early beta versions of PowerShell V1, but haven't used it since it went "gold". What is the best way to get started using PowerShell? Which version of PowerShell should I be using (V1.0 vs 2.0 CTP's)? What are you using PowerShell for? Are there any tools that make using PowerShell easier (that is, development environments)?
TITLE: How to get started with PowerShell? QUESTION: I played with one of the early beta versions of PowerShell V1, but haven't used it since it went "gold". What is the best way to get started using PowerShell? Which version of PowerShell should I be using (V1.0 vs 2.0 CTP's)? What are you using PowerShell for? Are there any tools that make using PowerShell easier (that is, development environments)? ANSWER: For learning PowerShell, there are a number of great resources Technet Virtual Labs ( Introduction to Windows PowerShell ) PowerShellCommunity.org - Forums, blogs, script repository powershell on irc.freenode.net PowerShell podcasts - PowerScripting.net and Get-Scripting.blogspot.com For IDE style environments, you have PowerShell Analyzer (free) and PowerGUI (free), PowerShell Plus (commercial), PrimalScript (commercial), and Admin Script Editor (commerical). I use PowerShell for everything that I can. Right now, I'm looking at Psake, a PowerShell based build script environment. I use if for managing my Active Directory, Hyper-V, Twitter, some keyboard automation (hosting PowerShell in a winforms app to grab keystrokes), and a ton of other stuff. Another cool project I have to check out is PSExpect for testing. I also use it for database access - monitoring changes made to rows in a database by applications. It is also integrated in to my network monitoring solution. I am also looking to use PowerShell as a scripting engine for a project I am working on. EDIT: If you are just learning PowerShell, I would focus on V1. As you get more comfortable, take a look at the CTP, but too much can change from the CTP to what is actually released as V2 to make that your learning tool. Version 2 is out and available from XP SP3, Server 2003, Vista, and Server 2008 and in the box for Win7 and Server 2008 R2. What you learned for V1 will still serve you well, but now I would concentrate on V2, as there is a superior feature set. Good luck!
[ "powershell", "scripting" ]
71
50
23,413
15
0
2008-08-28T22:30:54.923000
2008-08-29T17:34:28.750000
33,577
119,595
How do I perform a recursive checkout using ClearCase?
I want to check out all files in all subdirectories of a specified folder. (And it is painful to do this using the GUI, because there is no recursive checkout option).
Beware: ClearCase is File-centric, not repository centric (like SVN or CVS). That means it is rarely a good solution to checkout all files (and it can be fairly long with ClearCase;) ) That being said, the question is perfectly legitimate and I would like to point out another way: open a cleartool session in the 'specified folder': c:\MyFolder> cleartool cleartool> co -c "Reason for massive checkout".../* does the trick too. But as the aku's answer, it does checkout everything: files and directories... and you may most not need to checkout directories! cleartool find somedir -type f -exec "cleartool checkout -c \"Reason for massive checkout\" \"%CLEARCASE_PN%\"" would only checkout files... Now the problem is to checkin everything that has changed. It is problematic since often not everything has changed, and CleaCase will trigger an error message when trying to check in an identical file. Meaning you will need 2 commands: ct lsco -r -cvi -fmt "ci -nc \"%n\"\n" | ct ct lsco -r -cvi -fmt "unco -rm %n\n" | ct (with ' ct being ' cleartool ': type ' doskey ct=cleartool $* ' on Windows to set that alias) Note that ct ci -nc will check-in with the comment used for the checkout stage. So it is not a checkin without a comment (like the -nc option -- or "no comment" -- could make believe).
How do I perform a recursive checkout using ClearCase? I want to check out all files in all subdirectories of a specified folder. (And it is painful to do this using the GUI, because there is no recursive checkout option).
TITLE: How do I perform a recursive checkout using ClearCase? QUESTION: I want to check out all files in all subdirectories of a specified folder. (And it is painful to do this using the GUI, because there is no recursive checkout option). ANSWER: Beware: ClearCase is File-centric, not repository centric (like SVN or CVS). That means it is rarely a good solution to checkout all files (and it can be fairly long with ClearCase;) ) That being said, the question is perfectly legitimate and I would like to point out another way: open a cleartool session in the 'specified folder': c:\MyFolder> cleartool cleartool> co -c "Reason for massive checkout".../* does the trick too. But as the aku's answer, it does checkout everything: files and directories... and you may most not need to checkout directories! cleartool find somedir -type f -exec "cleartool checkout -c \"Reason for massive checkout\" \"%CLEARCASE_PN%\"" would only checkout files... Now the problem is to checkin everything that has changed. It is problematic since often not everything has changed, and CleaCase will trigger an error message when trying to check in an identical file. Meaning you will need 2 commands: ct lsco -r -cvi -fmt "ci -nc \"%n\"\n" | ct ct lsco -r -cvi -fmt "unco -rm %n\n" | ct (with ' ct being ' cleartool ': type ' doskey ct=cleartool $* ' on Windows to set that alias) Note that ct ci -nc will check-in with the comment used for the checkout stage. So it is not a checkin without a comment (like the -nc option -- or "no comment" -- could make believe).
[ "version-control", "clearcase" ]
12
24
24,980
2
0
2008-08-28T22:44:22.880000
2008-09-23T07:32:12.160000
33,590
35,019
Drawing a custom label on a pie chart in Yahoo's Flash Library ASTRA
Has anyone looked at Yahoo's ASTRA? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the myPieChart.dataTipFunction. For data that looks like: myPieChart.dataProvider = [ { category: "Groceries", cost: 50 }, { category: "Transportation", cost: 175} ] myPieChart.dataField = "cost"; myPieChart.categoryField = "category"; I wrote a function like this: import com.yahoo.astra.fl.charts.series.* myPieChart.dataTipFunction = function (obj:Object, index:int, series:ISeries):String { return obj.category + "\n$" + obj.cost; }; There's ceil(2.718281828459045) problems with this: I'm directly calling the category and cost properties of the data provider. The names are actually configurable when setting up the chart, I'd like to maintain that flexibility. The default data tip would show the category, the cost (without a dollar sign), and the percentage it makes up in the pie chart. So here, I've lost the percentage. I just have no idea which property of what would hold that. It might be part of the series. I probably only need to override the dataItemRenderer for the cost part of the series, but I don't know how to access it. The documentation is a little... lacking there. Normally I would just look at the default implementation of the dataTipFunction but it's all inside a compiled shm that's part of the components distributed from yahoo. Can anyone help me complete this overridden function with percentage information and the flexibility mentioned in point 1?
Okay... so no-one's tried Astra, or people just avoid Flash questions. After a lot of guess work it turns out I needed to cast the series to a PieSeries and then work with those member functions, as the ISeries was useless on it's own. myPieChart.dataTipFunction = function (item:Object, index:int, series:ISeries):String { var oPieSeries:PieSeries = series as PieSeries; return oPieSeries.itemToCategory(item,index) + "\n$" + oPieSeries.itemToData(item) + "\n" + Number(oPieSeries.itemToPercentage(item)).toFixed(2) + "%"; };
Drawing a custom label on a pie chart in Yahoo's Flash Library ASTRA Has anyone looked at Yahoo's ASTRA? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the myPieChart.dataTipFunction. For data that looks like: myPieChart.dataProvider = [ { category: "Groceries", cost: 50 }, { category: "Transportation", cost: 175} ] myPieChart.dataField = "cost"; myPieChart.categoryField = "category"; I wrote a function like this: import com.yahoo.astra.fl.charts.series.* myPieChart.dataTipFunction = function (obj:Object, index:int, series:ISeries):String { return obj.category + "\n$" + obj.cost; }; There's ceil(2.718281828459045) problems with this: I'm directly calling the category and cost properties of the data provider. The names are actually configurable when setting up the chart, I'd like to maintain that flexibility. The default data tip would show the category, the cost (without a dollar sign), and the percentage it makes up in the pie chart. So here, I've lost the percentage. I just have no idea which property of what would hold that. It might be part of the series. I probably only need to override the dataItemRenderer for the cost part of the series, but I don't know how to access it. The documentation is a little... lacking there. Normally I would just look at the default implementation of the dataTipFunction but it's all inside a compiled shm that's part of the components distributed from yahoo. Can anyone help me complete this overridden function with percentage information and the flexibility mentioned in point 1?
TITLE: Drawing a custom label on a pie chart in Yahoo's Flash Library ASTRA QUESTION: Has anyone looked at Yahoo's ASTRA? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the myPieChart.dataTipFunction. For data that looks like: myPieChart.dataProvider = [ { category: "Groceries", cost: 50 }, { category: "Transportation", cost: 175} ] myPieChart.dataField = "cost"; myPieChart.categoryField = "category"; I wrote a function like this: import com.yahoo.astra.fl.charts.series.* myPieChart.dataTipFunction = function (obj:Object, index:int, series:ISeries):String { return obj.category + "\n$" + obj.cost; }; There's ceil(2.718281828459045) problems with this: I'm directly calling the category and cost properties of the data provider. The names are actually configurable when setting up the chart, I'd like to maintain that flexibility. The default data tip would show the category, the cost (without a dollar sign), and the percentage it makes up in the pie chart. So here, I've lost the percentage. I just have no idea which property of what would hold that. It might be part of the series. I probably only need to override the dataItemRenderer for the cost part of the series, but I don't know how to access it. The documentation is a little... lacking there. Normally I would just look at the default implementation of the dataTipFunction but it's all inside a compiled shm that's part of the components distributed from yahoo. Can anyone help me complete this overridden function with percentage information and the flexibility mentioned in point 1? ANSWER: Okay... so no-one's tried Astra, or people just avoid Flash questions. After a lot of guess work it turns out I needed to cast the series to a PieSeries and then work with those member functions, as the ISeries was useless on it's own. myPieChart.dataTipFunction = function (item:Object, index:int, series:ISeries):String { var oPieSeries:PieSeries = series as PieSeries; return oPieSeries.itemToCategory(item,index) + "\n$" + oPieSeries.itemToData(item) + "\n" + Number(oPieSeries.itemToPercentage(item)).toFixed(2) + "%"; };
[ "flash", "actionscript-3", "datatipfunction" ]
1
2
1,788
2
0
2008-08-28T22:54:37.690000
2008-08-29T18:53:02.870000
33,619
33,628
Concurrent logins in a web farm
I'm really asking this by proxy, another team at work has had a change request from our customer. The problem is that our customer doesn't want their employees to login with one user more than one at the same time. That they are getting locked out and sharing logins. Since this is on a web farm, what would be the best way to tackle this issue? Wouldn't caching to the database cause performance issues?
You could look at using a distributed cache system like memcached It would solve this problem pretty well (it's MUCH faster than a database), and is also excellent for caching pretty much anything else too
Concurrent logins in a web farm I'm really asking this by proxy, another team at work has had a change request from our customer. The problem is that our customer doesn't want their employees to login with one user more than one at the same time. That they are getting locked out and sharing logins. Since this is on a web farm, what would be the best way to tackle this issue? Wouldn't caching to the database cause performance issues?
TITLE: Concurrent logins in a web farm QUESTION: I'm really asking this by proxy, another team at work has had a change request from our customer. The problem is that our customer doesn't want their employees to login with one user more than one at the same time. That they are getting locked out and sharing logins. Since this is on a web farm, what would be the best way to tackle this issue? Wouldn't caching to the database cause performance issues? ANSWER: You could look at using a distributed cache system like memcached It would solve this problem pretty well (it's MUCH faster than a database), and is also excellent for caching pretty much anything else too
[ "asp.net", "authentication" ]
1
7
706
4
0
2008-08-28T23:17:43.017000
2008-08-28T23:22:58.670000
33,630
33,659
What's the maximum amount of RAM I can use in a Windows box?
Obviously, that's 64-bit windows. Also, what's the maximum amount of memory a single 64-bit process can use? I was kind of counting on using it all... (Yes, I know what I'm doing, please don't tell me that if I need that much RAM i must be doing something wrong) Also, is this the same for a.Net 2.0 process? Or is there a lower limit for.Net?
From http://technet.microsoft.com/en-us/library/cc758523.aspx - Windows Server 2003, 64 bit Datacenter Edition supports physical memory up to 512GB A single process should be able to use most of it, some will be used by the OS. The answer from Re0sless is better then mine. The limit is now 2TB, in Datacenter SP2, and 2008.
What's the maximum amount of RAM I can use in a Windows box? Obviously, that's 64-bit windows. Also, what's the maximum amount of memory a single 64-bit process can use? I was kind of counting on using it all... (Yes, I know what I'm doing, please don't tell me that if I need that much RAM i must be doing something wrong) Also, is this the same for a.Net 2.0 process? Or is there a lower limit for.Net?
TITLE: What's the maximum amount of RAM I can use in a Windows box? QUESTION: Obviously, that's 64-bit windows. Also, what's the maximum amount of memory a single 64-bit process can use? I was kind of counting on using it all... (Yes, I know what I'm doing, please don't tell me that if I need that much RAM i must be doing something wrong) Also, is this the same for a.Net 2.0 process? Or is there a lower limit for.Net? ANSWER: From http://technet.microsoft.com/en-us/library/cc758523.aspx - Windows Server 2003, 64 bit Datacenter Edition supports physical memory up to 512GB A single process should be able to use most of it, some will be used by the OS. The answer from Re0sless is better then mine. The limit is now 2TB, in Datacenter SP2, and 2008.
[ "windows", "memory", ".net-2.0", "64-bit", "hardware" ]
2
1
4,635
8
0
2008-08-28T23:25:02.783000
2008-08-28T23:40:25.040000
33,637
33,707
How does GPS in a mobile phone work exactly?
I assume it doesn't connect to anything (other than the satelite I guess), is this right? Or it does and has some kind of charge?
GPS, the Global Positioning System run by the United States Military, is free for civilian use, though the reality is that we're paying for it with tax dollars. However, GPS on cell phones is a bit more murky. In general, it won't cost you anything to turn on the GPS in your cell phone, but when you get a location it usually involves the cell phone company in order to get it quickly with little signal, as well as get a location when the satellites aren't visible (since the gov't requires a fix even if the satellites aren't visible for emergency 911 purposes). It uses up some cellular bandwidth. This also means that for phones without a regular GPS receiver, you cannot use the GPS at all if you don't have cell phone service. For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions). This particular kind of GPS is called assisted GPS (AGPS), and there are several levels of assistance used. GPS A normal GPS receiver listens to a particular frequency for radio signals. Satellites send time coded messages at this frequency. Each satellite has an atomic clock, and sends the current exact time as well. The GPS receiver figures out which satellites it can hear, and then starts gathering those messages. The messages include time, current satellite positions, and a few other bits of information. The message stream is slow - this is to save power, and also because all the satellites transmit on the same frequency and they're easier to pick out if they go slow. Because of this, and the amount of information needed to operate well, it can take 30-60 seconds to get a location on a regular GPS. When it knows the position and time code of at least 3 satellites, a GPS receiver can assume it's on the earth's surface and get a good reading. 4 satellites are needed if you aren't on the ground and you want altitude as well. AGPS As you saw above, it can take a long time to get a position fix with a normal GPS. There are ways to speed this up, but unless you're carrying an atomic clock with you all the time, or leave the GPS on all the time, then there's always going to be a delay of between 5-60 seconds before you get a location. In order to save cost, most cell phones share the GPS receiver components with the cellular components, and you can't get a fix and talk at the same time. People don't like that (especially when there's an emergency) so the lowest form of GPS does the following: Get some information from the cell phone company to feed to the GPS receiver - some of this is gross positioning information based on what cellular towers can 'hear' your phone, so by this time they already phone your location to within a city block or so. Switch from cellular to GPS receiver for 0.1 second (or some small, practically unoticable period of time) and collect the raw GPS data (no processing on the phone). Switch back to the phone mode, and send the raw data to the phone company The phone company processes that data (acts as an offline GPS receiver) and send the location back to your phone. This saves a lot of money on the phone design, but it has a heavy load on cellular bandwidth, and with a lot of requests coming it requires a lot of fast servers. Still, overall it can be cheaper and faster to implement. They are reluctant, however, to release GPS based features on these phones due to this load - so you won't see turn by turn navigation here. More recent designs include a full GPS chip. They still get data from the phone company - such as current location based on tower positioning, and current satellite locations - this provides sub 1 second fix times. This information is only needed once, and the GPS can keep track of everything after that with very little power. If the cellular network is unavailable, then they can still get a fix after awhile. If the GPS satellites aren't visible to the receiver, then they can still get a rough fix from the cellular towers. But to completely answer your question - it's as free as the phone company lets it be, and so far they do not charge for it at all. I doubt that's going to change in the future. In the higher end phones with a full GPS receiver you may even be able to load your own software and access it, such as with mologogo on a motorola iDen phone - the J2ME development kit is free, and the phone is only $40 (prepaid phone with $5 credit). Unlimited internet is about $10 a month, so for $40 to start and $10 a month you can get an internet tracking system. (Prices circa August 2008) It's only going to get cheaper and more full featured from here on out... Re: Google maps and such Yes, Google maps and all other cell phone mapping systems require a data connection of some sort at varying times during usage. When you move far enough in one direction, for instance, it'll request new tiles from its server. Your average phone doesn't have enough storage to hold a map of the US, nor the processor power to render it nicely. iPhone would be able to if you wanted to use the storage space up with maps, but given that most iPhones have a full time unlimited data plan most users would rather use that space for other things.
How does GPS in a mobile phone work exactly? I assume it doesn't connect to anything (other than the satelite I guess), is this right? Or it does and has some kind of charge?
TITLE: How does GPS in a mobile phone work exactly? QUESTION: I assume it doesn't connect to anything (other than the satelite I guess), is this right? Or it does and has some kind of charge? ANSWER: GPS, the Global Positioning System run by the United States Military, is free for civilian use, though the reality is that we're paying for it with tax dollars. However, GPS on cell phones is a bit more murky. In general, it won't cost you anything to turn on the GPS in your cell phone, but when you get a location it usually involves the cell phone company in order to get it quickly with little signal, as well as get a location when the satellites aren't visible (since the gov't requires a fix even if the satellites aren't visible for emergency 911 purposes). It uses up some cellular bandwidth. This also means that for phones without a regular GPS receiver, you cannot use the GPS at all if you don't have cell phone service. For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions). This particular kind of GPS is called assisted GPS (AGPS), and there are several levels of assistance used. GPS A normal GPS receiver listens to a particular frequency for radio signals. Satellites send time coded messages at this frequency. Each satellite has an atomic clock, and sends the current exact time as well. The GPS receiver figures out which satellites it can hear, and then starts gathering those messages. The messages include time, current satellite positions, and a few other bits of information. The message stream is slow - this is to save power, and also because all the satellites transmit on the same frequency and they're easier to pick out if they go slow. Because of this, and the amount of information needed to operate well, it can take 30-60 seconds to get a location on a regular GPS. When it knows the position and time code of at least 3 satellites, a GPS receiver can assume it's on the earth's surface and get a good reading. 4 satellites are needed if you aren't on the ground and you want altitude as well. AGPS As you saw above, it can take a long time to get a position fix with a normal GPS. There are ways to speed this up, but unless you're carrying an atomic clock with you all the time, or leave the GPS on all the time, then there's always going to be a delay of between 5-60 seconds before you get a location. In order to save cost, most cell phones share the GPS receiver components with the cellular components, and you can't get a fix and talk at the same time. People don't like that (especially when there's an emergency) so the lowest form of GPS does the following: Get some information from the cell phone company to feed to the GPS receiver - some of this is gross positioning information based on what cellular towers can 'hear' your phone, so by this time they already phone your location to within a city block or so. Switch from cellular to GPS receiver for 0.1 second (or some small, practically unoticable period of time) and collect the raw GPS data (no processing on the phone). Switch back to the phone mode, and send the raw data to the phone company The phone company processes that data (acts as an offline GPS receiver) and send the location back to your phone. This saves a lot of money on the phone design, but it has a heavy load on cellular bandwidth, and with a lot of requests coming it requires a lot of fast servers. Still, overall it can be cheaper and faster to implement. They are reluctant, however, to release GPS based features on these phones due to this load - so you won't see turn by turn navigation here. More recent designs include a full GPS chip. They still get data from the phone company - such as current location based on tower positioning, and current satellite locations - this provides sub 1 second fix times. This information is only needed once, and the GPS can keep track of everything after that with very little power. If the cellular network is unavailable, then they can still get a fix after awhile. If the GPS satellites aren't visible to the receiver, then they can still get a rough fix from the cellular towers. But to completely answer your question - it's as free as the phone company lets it be, and so far they do not charge for it at all. I doubt that's going to change in the future. In the higher end phones with a full GPS receiver you may even be able to load your own software and access it, such as with mologogo on a motorola iDen phone - the J2ME development kit is free, and the phone is only $40 (prepaid phone with $5 credit). Unlimited internet is about $10 a month, so for $40 to start and $10 a month you can get an internet tracking system. (Prices circa August 2008) It's only going to get cheaper and more full featured from here on out... Re: Google maps and such Yes, Google maps and all other cell phone mapping systems require a data connection of some sort at varying times during usage. When you move far enough in one direction, for instance, it'll request new tiles from its server. Your average phone doesn't have enough storage to hold a map of the US, nor the processor power to render it nicely. iPhone would be able to if you wanted to use the storage space up with maps, but given that most iPhones have a full time unlimited data plan most users would rather use that space for other things.
[ "gps", "mobile-phones" ]
33
56
294,920
2
0
2008-08-28T23:29:57.607000
2008-08-29T00:36:44.687000
33,638
33,656
Testing and Managing database versions against code versions
As you develop an application database changes inevitably pop up. The trick I find is keeping your database build in step with your code. In the past I have added a build step that executed SQL scripts against the target database but that is dangerous in so much as you could inadvertanly add bogus data or worse. My question is what are the tips and tricks to keep the database in step with the code? What about when you roll back the code? Branching?
Version numbers embedded in the database are helpful. You have two choices, embedding values into a table (allows versioning multiple items) that can be queried, or having an explictly named object (such as a table or somesuch) you can test for. When you release to production, do you have a rollback plan in the event of unexpected catastrophe? If you do, is it the application of a schema rollback script? Use your rollback script to rollback the database to a previous code version.
Testing and Managing database versions against code versions As you develop an application database changes inevitably pop up. The trick I find is keeping your database build in step with your code. In the past I have added a build step that executed SQL scripts against the target database but that is dangerous in so much as you could inadvertanly add bogus data or worse. My question is what are the tips and tricks to keep the database in step with the code? What about when you roll back the code? Branching?
TITLE: Testing and Managing database versions against code versions QUESTION: As you develop an application database changes inevitably pop up. The trick I find is keeping your database build in step with your code. In the past I have added a build step that executed SQL scripts against the target database but that is dangerous in so much as you could inadvertanly add bogus data or worse. My question is what are the tips and tricks to keep the database in step with the code? What about when you roll back the code? Branching? ANSWER: Version numbers embedded in the database are helpful. You have two choices, embedding values into a table (allows versioning multiple items) that can be queried, or having an explictly named object (such as a table or somesuch) you can test for. When you release to production, do you have a rollback plan in the event of unexpected catastrophe? If you do, is it the application of a schema rollback script? Use your rollback script to rollback the database to a previous code version.
[ "database", "version-control", "testing", "build-process" ]
8
3
761
7
0
2008-08-28T23:30:16.780000
2008-08-28T23:38:10.893000
33,664
36,749
Best Practices for Managing Linq to SQL Dbml Files?
I've just started using Linq to SQL, and I'm wondering if anyone has any best practices they can share for managing dbml files. How do you keep them up to date with the database? Do you have a single dbml file for the entire database, or is it split into multiple logical units? How does managing this file work in a team environment? Any other tips and tricks welcome.
Have you looked at SqlMetal? It's officially supported, although not promoted too much. You can use it to build dbmls from the commandline - we've used it as part of a db's continous integration updates (make sure you have really good code separation if you do this though - partial classes are a saviour - as the dbml will get overwritten). If I recall correctly it doesn't have quite the same features as the model designer in Visual Studio (I think it handles pluralisation differently). There a good post about it on Ben Hall's blog.
Best Practices for Managing Linq to SQL Dbml Files? I've just started using Linq to SQL, and I'm wondering if anyone has any best practices they can share for managing dbml files. How do you keep them up to date with the database? Do you have a single dbml file for the entire database, or is it split into multiple logical units? How does managing this file work in a team environment? Any other tips and tricks welcome.
TITLE: Best Practices for Managing Linq to SQL Dbml Files? QUESTION: I've just started using Linq to SQL, and I'm wondering if anyone has any best practices they can share for managing dbml files. How do you keep them up to date with the database? Do you have a single dbml file for the entire database, or is it split into multiple logical units? How does managing this file work in a team environment? Any other tips and tricks welcome. ANSWER: Have you looked at SqlMetal? It's officially supported, although not promoted too much. You can use it to build dbmls from the commandline - we've used it as part of a db's continous integration updates (make sure you have really good code separation if you do this though - partial classes are a saviour - as the dbml will get overwritten). If I recall correctly it doesn't have quite the same features as the model designer in Visual Studio (I think it handles pluralisation differently). There a good post about it on Ben Hall's blog.
[ "linq-to-sql" ]
33
19
9,042
5
0
2008-08-28T23:42:14.037000
2008-08-31T10:21:21.397000
33,685
39,161
SQL 2000 'TRY CATCH like' Error Handling
This is a sql 2000 database that I am working with. I have what I call a staging table that is a raw data dump of data, so everything is ntext or nvarchar(255). I need to cast/convert all of this data into the appropriate data types (ie int, decimal, nvarchar, etc.) The way I was going to do this was to iterate through all records using a while loop and attempt a CAST on each column on a single record during each iteration, after I visit a particular record I flag it as processed (bit field). But how can I log the error when/if it occurs but allow the while loop to continue. At first I implemented this using a TRY CATCH in a local SQL 2005 instance (to get the project going) and all was working well, but i learned today that the dev & production database that the international DBA's have set up is a SQL 2000 instance so I have to conform. EDIT: I am using a SSIS package to populate the staging table. I see that now I must revisit that package and implement a script component to handle the conversions. Thanks guys EDIT: I am doing this on a record by record basis, not a batch insert, so the transaction idea seems like it would be feasible but I'm not sure how to trap @@ERROR and allow the stored procedure to continue. EDIT: I really like Guy's approach, I am going to implement it this way.
Generally I don't like "loop through the record" solutions as they tend to be slow and you end up writing a lot of custom code. So... Depending on how many records are in your staging table, you could post process the data with a series of SQL statements that test the columns for correctness and mark any records that fail the test. i.e. UPDATE staging_table SET status_code = 'FAIL_TEST_1' WHERE status_code IS NULL AND ISDATE(ntext_column1) = 0; UPDATE staging_table SET status_code = 'FAIL_TEST_2' WHERE status_code IS NULL AND ISNUMERIC(ntext_column2) = 0; etc... Finally INSERT INTO results_table ( mydate, myprice ) SELECT ntext_column1 AS mydate, ntext_column2 AS myprice FROM staging_table WHERE status_code IS NULL; DELETE FROM staging_table WHERE status_code IS NULL; And the staging table has all the errors, that you can export and report out.
SQL 2000 'TRY CATCH like' Error Handling This is a sql 2000 database that I am working with. I have what I call a staging table that is a raw data dump of data, so everything is ntext or nvarchar(255). I need to cast/convert all of this data into the appropriate data types (ie int, decimal, nvarchar, etc.) The way I was going to do this was to iterate through all records using a while loop and attempt a CAST on each column on a single record during each iteration, after I visit a particular record I flag it as processed (bit field). But how can I log the error when/if it occurs but allow the while loop to continue. At first I implemented this using a TRY CATCH in a local SQL 2005 instance (to get the project going) and all was working well, but i learned today that the dev & production database that the international DBA's have set up is a SQL 2000 instance so I have to conform. EDIT: I am using a SSIS package to populate the staging table. I see that now I must revisit that package and implement a script component to handle the conversions. Thanks guys EDIT: I am doing this on a record by record basis, not a batch insert, so the transaction idea seems like it would be feasible but I'm not sure how to trap @@ERROR and allow the stored procedure to continue. EDIT: I really like Guy's approach, I am going to implement it this way.
TITLE: SQL 2000 'TRY CATCH like' Error Handling QUESTION: This is a sql 2000 database that I am working with. I have what I call a staging table that is a raw data dump of data, so everything is ntext or nvarchar(255). I need to cast/convert all of this data into the appropriate data types (ie int, decimal, nvarchar, etc.) The way I was going to do this was to iterate through all records using a while loop and attempt a CAST on each column on a single record during each iteration, after I visit a particular record I flag it as processed (bit field). But how can I log the error when/if it occurs but allow the while loop to continue. At first I implemented this using a TRY CATCH in a local SQL 2005 instance (to get the project going) and all was working well, but i learned today that the dev & production database that the international DBA's have set up is a SQL 2000 instance so I have to conform. EDIT: I am using a SSIS package to populate the staging table. I see that now I must revisit that package and implement a script component to handle the conversions. Thanks guys EDIT: I am doing this on a record by record basis, not a batch insert, so the transaction idea seems like it would be feasible but I'm not sure how to trap @@ERROR and allow the stored procedure to continue. EDIT: I really like Guy's approach, I am going to implement it this way. ANSWER: Generally I don't like "loop through the record" solutions as they tend to be slow and you end up writing a lot of custom code. So... Depending on how many records are in your staging table, you could post process the data with a series of SQL statements that test the columns for correctness and mark any records that fail the test. i.e. UPDATE staging_table SET status_code = 'FAIL_TEST_1' WHERE status_code IS NULL AND ISDATE(ntext_column1) = 0; UPDATE staging_table SET status_code = 'FAIL_TEST_2' WHERE status_code IS NULL AND ISNUMERIC(ntext_column2) = 0; etc... Finally INSERT INTO results_table ( mydate, myprice ) SELECT ntext_column1 AS mydate, ntext_column2 AS myprice FROM staging_table WHERE status_code IS NULL; DELETE FROM staging_table WHERE status_code IS NULL; And the staging table has all the errors, that you can export and report out.
[ "sql-server" ]
5
2
8,682
5
0
2008-08-28T23:59:43.790000
2008-09-02T10:12:35.037000
33,696
33,736
Cocoa tips for PHP developers?
I'm a PHP developer, and I use the MVC pattern and object-oriented code. I really want to write applications for the iPhone, but to do that I need to know Cocoa, but to do that I need to know Objective-C 2.0, but to do that I need to know C, and to do that I need to know about compiled languages (versus interpreted). Where should I begin? Do I really need to begin with plain old "C", as Joel would recommend? Caveat: I like to produce working widgets, not elegant theories.
Yes, you're really best off learning C and then Objective-C. There are some resources that will get you over the C and Objective-C language learning curve: Uli Kusterer's online book Masters of the Void Stephen Kochan's book Programming in Objective-C And there are some resources that will get you over the framework learning curve: CocoaLab's online book Become an Xcoder Aaron Hillegass' book Cocoa Programming for Mac OS X Despite what Jeff might say, learning C is important for professional software developers for just this reason. It's sort of a baseline low-level lingua franca that other innovation happens atop. The reason Jeff has been able to get away with not learning C is not because you don't need to know C, but because he learned Pascal which is in many ways isomorphic to C. (It has all the same concepts, including pointers and manual memory management.)
Cocoa tips for PHP developers? I'm a PHP developer, and I use the MVC pattern and object-oriented code. I really want to write applications for the iPhone, but to do that I need to know Cocoa, but to do that I need to know Objective-C 2.0, but to do that I need to know C, and to do that I need to know about compiled languages (versus interpreted). Where should I begin? Do I really need to begin with plain old "C", as Joel would recommend? Caveat: I like to produce working widgets, not elegant theories.
TITLE: Cocoa tips for PHP developers? QUESTION: I'm a PHP developer, and I use the MVC pattern and object-oriented code. I really want to write applications for the iPhone, but to do that I need to know Cocoa, but to do that I need to know Objective-C 2.0, but to do that I need to know C, and to do that I need to know about compiled languages (versus interpreted). Where should I begin? Do I really need to begin with plain old "C", as Joel would recommend? Caveat: I like to produce working widgets, not elegant theories. ANSWER: Yes, you're really best off learning C and then Objective-C. There are some resources that will get you over the C and Objective-C language learning curve: Uli Kusterer's online book Masters of the Void Stephen Kochan's book Programming in Objective-C And there are some resources that will get you over the framework learning curve: CocoaLab's online book Become an Xcoder Aaron Hillegass' book Cocoa Programming for Mac OS X Despite what Jeff might say, learning C is important for professional software developers for just this reason. It's sort of a baseline low-level lingua franca that other innovation happens atop. The reason Jeff has been able to get away with not learning C is not because you don't need to know C, but because he learned Pascal which is in many ways isomorphic to C. (It has all the same concepts, including pointers and manual memory management.)
[ "php", "c", "objective-c", "cocoa" ]
4
7
953
6
0
2008-08-29T00:19:55.567000
2008-08-29T01:08:04.703000
33,703
33,780
How can you make a .net windows forms project look fresh?
I'm working on a visual studio 2005 vb.net windows forms project that's been around for several years. It's full of default textboxes, labels, dropdowns, datagrids, datetime pickers -- all the standard stuff. The end result is a very gray, old-looking project. What would be the best approach to making this project look fresh and snazzy? I'd rather not rewrite the entire solution with all brand new forms objects, but would that be avoidable?
I was actually just sprucing up a dialog today. A lot of it depends on what kind of application you have, and what OS it is running on. A couple of these tips will certainly go a long way to jazzing things up. Ensure adequate spacing between controls — don't cram them all together. Space is appealing. You might also trying flowing the controls a little differently when you have more space. Put in some new 3D and glossy images. You can put a big yellow exclamation mark on a custom warning dialog. Replace old toolbar buttons with new ones. Two libraries I have used and like are GlyFX and IconExperience. You can find free ones too. Ideally get a graphic artist to make some custom ones for the specific actions your application does to fill in between the common ones you use (make sure they all go together). That will go a long way to making it look fancy. Try a different font. Tahoma is a good one. Often times the default font is MS Sans Serif. You can do better. Avoid Times New Roman and Comic Sans though. Also avoid large blocks of bold — use it sparingly. Generally you want all your fonts the same, and only use different fonts sparingly to set certain bits of text apart. Add subdued colors to certain controls. This is a tricky one. You always want to use subdued colors, nothing bright or stark usually, but the colors should indicate something, or if you have a grid you can use it to show logical grouping. This is a slippery slope. Be aware that users might change their system colors, which will change how your colors look. Ideally give them a few color themes, or the ability to change colors. Instead of thinking eye-candy, think usability. Make the most common course of action obvious. Mark Miller of DevExpress has a great talk on the Science of User Interface Design. I actually have a video of it and might be able to post it online with a little clean-up. Invest in a few good quality 3rd party controls. Replacing all your controls could be a pain, but if you are using the default grids for example, you would really jazz it up with a good grid from DevExpress or some other component vendor. Be aware that different vendors have different philosophies for how their components are used, so swapping them out can be a bit of a pain. Start small to test the waters, and then try something really complicated before you commit to replacing all of them. The only thing worse then ugly grids is ugly grids mixed with pretty grids. Consistency is golden! You also might look at replacing your old tool bars and menus with a Ribbon Control like Microsoft did in Office 2007. Then everyone will think you are really uptown! Again only replacing key components and UI elements without thinking you need to revamp the whole UI. Of course pay attention to the basics like tab order, etc. Consistency, consistency, consistency. Some apps lend themselves to full blown skinning, while others don't. Generally you don't want anything flashy that gets used a lot.
How can you make a .net windows forms project look fresh? I'm working on a visual studio 2005 vb.net windows forms project that's been around for several years. It's full of default textboxes, labels, dropdowns, datagrids, datetime pickers -- all the standard stuff. The end result is a very gray, old-looking project. What would be the best approach to making this project look fresh and snazzy? I'd rather not rewrite the entire solution with all brand new forms objects, but would that be avoidable?
TITLE: How can you make a .net windows forms project look fresh? QUESTION: I'm working on a visual studio 2005 vb.net windows forms project that's been around for several years. It's full of default textboxes, labels, dropdowns, datagrids, datetime pickers -- all the standard stuff. The end result is a very gray, old-looking project. What would be the best approach to making this project look fresh and snazzy? I'd rather not rewrite the entire solution with all brand new forms objects, but would that be avoidable? ANSWER: I was actually just sprucing up a dialog today. A lot of it depends on what kind of application you have, and what OS it is running on. A couple of these tips will certainly go a long way to jazzing things up. Ensure adequate spacing between controls — don't cram them all together. Space is appealing. You might also trying flowing the controls a little differently when you have more space. Put in some new 3D and glossy images. You can put a big yellow exclamation mark on a custom warning dialog. Replace old toolbar buttons with new ones. Two libraries I have used and like are GlyFX and IconExperience. You can find free ones too. Ideally get a graphic artist to make some custom ones for the specific actions your application does to fill in between the common ones you use (make sure they all go together). That will go a long way to making it look fancy. Try a different font. Tahoma is a good one. Often times the default font is MS Sans Serif. You can do better. Avoid Times New Roman and Comic Sans though. Also avoid large blocks of bold — use it sparingly. Generally you want all your fonts the same, and only use different fonts sparingly to set certain bits of text apart. Add subdued colors to certain controls. This is a tricky one. You always want to use subdued colors, nothing bright or stark usually, but the colors should indicate something, or if you have a grid you can use it to show logical grouping. This is a slippery slope. Be aware that users might change their system colors, which will change how your colors look. Ideally give them a few color themes, or the ability to change colors. Instead of thinking eye-candy, think usability. Make the most common course of action obvious. Mark Miller of DevExpress has a great talk on the Science of User Interface Design. I actually have a video of it and might be able to post it online with a little clean-up. Invest in a few good quality 3rd party controls. Replacing all your controls could be a pain, but if you are using the default grids for example, you would really jazz it up with a good grid from DevExpress or some other component vendor. Be aware that different vendors have different philosophies for how their components are used, so swapping them out can be a bit of a pain. Start small to test the waters, and then try something really complicated before you commit to replacing all of them. The only thing worse then ugly grids is ugly grids mixed with pretty grids. Consistency is golden! You also might look at replacing your old tool bars and menus with a Ribbon Control like Microsoft did in Office 2007. Then everyone will think you are really uptown! Again only replacing key components and UI elements without thinking you need to revamp the whole UI. Of course pay attention to the basics like tab order, etc. Consistency, consistency, consistency. Some apps lend themselves to full blown skinning, while others don't. Generally you don't want anything flashy that gets used a lot.
[ ".net", "visual-studio", "winforms", "user-interface" ]
34
38
35,923
7
0
2008-08-29T00:30:56.757000
2008-08-29T01:42:16.337000
33,708
33,715
My (Java/Swing) MouseListener isn't listening, help me figure out why
So I've got a JPanel implementing MouseListener and MouseMotionListener: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DisplayArea extends JPanel implements MouseListener, MouseMotionListener { public DisplayArea(Rectangle bounds, Display display) { setLayout(null); setBounds(bounds); setOpaque(false); setPreferredSize(new Dimension(bounds.width, bounds.height)); this.display = display; } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; if (display.getControlPanel().Antialiasing()) { g2.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)); } g2.setColor(Color.white); g2.fillRect(0, 0, getWidth(), getHeight()); } public void mousePressed(MouseEvent event) { System.out.println("mousePressed()"); mx1 = event.getX(); my1 = event.getY(); } public void mouseReleased(MouseEvent event) { System.out.println("mouseReleased()"); mx2 = event.getX(); my2 = event.getY(); int mode = display.getControlPanel().Mode(); switch (mode) { case ControlPanel.LINE: System.out.println("Line from " + mx1 + ", " + my1 + " to " + mx2 + ", " + my2 + "."); } } public void mouseEntered(MouseEvent event) { System.out.println("mouseEntered()"); } public void mouseExited(MouseEvent event) { System.out.println("mouseExited()"); } public void mouseClicked(MouseEvent event) { System.out.println("mouseClicked()"); } public void mouseMoved(MouseEvent event) { System.out.println("mouseMoved()"); } public void mouseDragged(MouseEvent event) { System.out.println("mouseDragged()"); } private Display display = null; private int mx1 = -1; private int my1 = -1; private int mx2 = -1; private int my2 = -1; } The trouble is, none of these mouse functions are ever called. DisplayArea is created like this: da = new DisplayArea(new Rectangle(CONTROL_WIDTH, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT), this); I am not really a Java programmer (this is part of an assignment), but I can't see anything glaringly obvious. Can someone smarter than I see anything?
The implements mouselistener, mousemotionlistener just allows the displayArea class to listen to some, to be defined, Swing component's mouse events. You have to explicitly define what it should be listening at. So I suppose you could add something like this to the constructor: this.addMouseListener(this); this.addMouseMotionListener(this);
My (Java/Swing) MouseListener isn't listening, help me figure out why So I've got a JPanel implementing MouseListener and MouseMotionListener: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DisplayArea extends JPanel implements MouseListener, MouseMotionListener { public DisplayArea(Rectangle bounds, Display display) { setLayout(null); setBounds(bounds); setOpaque(false); setPreferredSize(new Dimension(bounds.width, bounds.height)); this.display = display; } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; if (display.getControlPanel().Antialiasing()) { g2.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)); } g2.setColor(Color.white); g2.fillRect(0, 0, getWidth(), getHeight()); } public void mousePressed(MouseEvent event) { System.out.println("mousePressed()"); mx1 = event.getX(); my1 = event.getY(); } public void mouseReleased(MouseEvent event) { System.out.println("mouseReleased()"); mx2 = event.getX(); my2 = event.getY(); int mode = display.getControlPanel().Mode(); switch (mode) { case ControlPanel.LINE: System.out.println("Line from " + mx1 + ", " + my1 + " to " + mx2 + ", " + my2 + "."); } } public void mouseEntered(MouseEvent event) { System.out.println("mouseEntered()"); } public void mouseExited(MouseEvent event) { System.out.println("mouseExited()"); } public void mouseClicked(MouseEvent event) { System.out.println("mouseClicked()"); } public void mouseMoved(MouseEvent event) { System.out.println("mouseMoved()"); } public void mouseDragged(MouseEvent event) { System.out.println("mouseDragged()"); } private Display display = null; private int mx1 = -1; private int my1 = -1; private int mx2 = -1; private int my2 = -1; } The trouble is, none of these mouse functions are ever called. DisplayArea is created like this: da = new DisplayArea(new Rectangle(CONTROL_WIDTH, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT), this); I am not really a Java programmer (this is part of an assignment), but I can't see anything glaringly obvious. Can someone smarter than I see anything?
TITLE: My (Java/Swing) MouseListener isn't listening, help me figure out why QUESTION: So I've got a JPanel implementing MouseListener and MouseMotionListener: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DisplayArea extends JPanel implements MouseListener, MouseMotionListener { public DisplayArea(Rectangle bounds, Display display) { setLayout(null); setBounds(bounds); setOpaque(false); setPreferredSize(new Dimension(bounds.width, bounds.height)); this.display = display; } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; if (display.getControlPanel().Antialiasing()) { g2.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)); } g2.setColor(Color.white); g2.fillRect(0, 0, getWidth(), getHeight()); } public void mousePressed(MouseEvent event) { System.out.println("mousePressed()"); mx1 = event.getX(); my1 = event.getY(); } public void mouseReleased(MouseEvent event) { System.out.println("mouseReleased()"); mx2 = event.getX(); my2 = event.getY(); int mode = display.getControlPanel().Mode(); switch (mode) { case ControlPanel.LINE: System.out.println("Line from " + mx1 + ", " + my1 + " to " + mx2 + ", " + my2 + "."); } } public void mouseEntered(MouseEvent event) { System.out.println("mouseEntered()"); } public void mouseExited(MouseEvent event) { System.out.println("mouseExited()"); } public void mouseClicked(MouseEvent event) { System.out.println("mouseClicked()"); } public void mouseMoved(MouseEvent event) { System.out.println("mouseMoved()"); } public void mouseDragged(MouseEvent event) { System.out.println("mouseDragged()"); } private Display display = null; private int mx1 = -1; private int my1 = -1; private int mx2 = -1; private int my2 = -1; } The trouble is, none of these mouse functions are ever called. DisplayArea is created like this: da = new DisplayArea(new Rectangle(CONTROL_WIDTH, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT), this); I am not really a Java programmer (this is part of an assignment), but I can't see anything glaringly obvious. Can someone smarter than I see anything? ANSWER: The implements mouselistener, mousemotionlistener just allows the displayArea class to listen to some, to be defined, Swing component's mouse events. You have to explicitly define what it should be listening at. So I suppose you could add something like this to the constructor: this.addMouseListener(this); this.addMouseMotionListener(this);
[ "java", "swing", "actionlistener", "mouselistener" ]
6
13
2,488
3
0
2008-08-29T00:37:55.650000
2008-08-29T00:42:33.953000
33,720
33,743
Change templates in Xcode
How would I change the initial templates created by Xcode when creating a new Cocoa Class. I am referring to the comments and class name created when using Xcode's new class wizard.
You wouldn't change the existing templates. In other words, don't modify anything under the /Developer hierarchy (or wherever you installed your developer tools). Instead, clone the templates you want to have customized variants of. Then change their names and the information in them. Finally, put them in the appropriate location in your account's Library/Application Support folder, specifically: File templates: ~/Library/Application Support/Developer/Shared/Xcode/File Templates/ Target templates: ~/Library/Application Support/Developer/Shared/Xcode/Target Templates/ Project templates: ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/ That way they won't be overwritten when you install new developer tools, and you can tweak them to your heart's content. Update For newer versions of Xcode the updated path will be: ~/Library/Developer/Xcode/Templates/File Templates/Source
Change templates in Xcode How would I change the initial templates created by Xcode when creating a new Cocoa Class. I am referring to the comments and class name created when using Xcode's new class wizard.
TITLE: Change templates in Xcode QUESTION: How would I change the initial templates created by Xcode when creating a new Cocoa Class. I am referring to the comments and class name created when using Xcode's new class wizard. ANSWER: You wouldn't change the existing templates. In other words, don't modify anything under the /Developer hierarchy (or wherever you installed your developer tools). Instead, clone the templates you want to have customized variants of. Then change their names and the information in them. Finally, put them in the appropriate location in your account's Library/Application Support folder, specifically: File templates: ~/Library/Application Support/Developer/Shared/Xcode/File Templates/ Target templates: ~/Library/Application Support/Developer/Shared/Xcode/Target Templates/ Project templates: ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/ That way they won't be overwritten when you install new developer tools, and you can tweak them to your heart's content. Update For newer versions of Xcode the updated path will be: ~/Library/Developer/Xcode/Templates/File Templates/Source
[ "xcode", "macos", "templates", "xcode4", "xcode4.5" ]
114
112
53,559
10
0
2008-08-29T00:44:14.307000
2008-08-29T01:14:27.997000
33,727
33,775
CLR Profiler - Attaching to existing process
I would like to use something like CLR Profiles on.Net 2.0 to see what objects are taking more space in the heap at any given time (of an ASP.Net worker process). However, the CLR Profiler only lets me START an app, not attach to an existing one. I assume this is because it tracks allocations and GC too, but i'm not very interested in that. I would just like something that takes a snapshot of the current state of the heap, and shows me what is there and how many objects of each kind there are, and how many bytes total are being used by each object type. Any ideas?
.Net Memory Profiler is exactly what you need. It's not free but there's a trial version. Actually I used the trial to find leaks on our last project. One notable feature is: Easily identify memory leaks by collecting and comparing snapshots of.NET memory I think this is what your looking for.
CLR Profiler - Attaching to existing process I would like to use something like CLR Profiles on.Net 2.0 to see what objects are taking more space in the heap at any given time (of an ASP.Net worker process). However, the CLR Profiler only lets me START an app, not attach to an existing one. I assume this is because it tracks allocations and GC too, but i'm not very interested in that. I would just like something that takes a snapshot of the current state of the heap, and shows me what is there and how many objects of each kind there are, and how many bytes total are being used by each object type. Any ideas?
TITLE: CLR Profiler - Attaching to existing process QUESTION: I would like to use something like CLR Profiles on.Net 2.0 to see what objects are taking more space in the heap at any given time (of an ASP.Net worker process). However, the CLR Profiler only lets me START an app, not attach to an existing one. I assume this is because it tracks allocations and GC too, but i'm not very interested in that. I would just like something that takes a snapshot of the current state of the heap, and shows me what is there and how many objects of each kind there are, and how many bytes total are being used by each object type. Any ideas? ANSWER: .Net Memory Profiler is exactly what you need. It's not free but there's a trial version. Actually I used the trial to find leaks on our last project. One notable feature is: Easily identify memory leaks by collecting and comparing snapshots of.NET memory I think this is what your looking for.
[ "memory", ".net-2.0", "clr", "profiler" ]
5
3
4,845
2
0
2008-08-29T00:54:44.220000
2008-08-29T01:37:05.943000
33,728
34,056
How should I build a good (web) API
I'm going to build an API for a web app and I'm interested in what people can suggest as good practices. I'm already planning to make it versioned (version 1 can only control certain aspects of the system, version 2 could control more, but this may need a change in the way authentication is performed that would be incompatible with version 1), and the authentication will be distinct from the standard username/password people use to log in (if someone does use a malicious tool it won't open them up to full impersonation, just whatever the api allows). Does anyone have further ideas, or examples of sites with particularly good APIs you have used?
Read the RESTful Web Services book, which give you a good overview of how to use REST in practice, and get to up to speed quickly enough to get started now, with some confidence. This is more useful than just looking at an existing API, because it also discusses design choices and trade-offs.
How should I build a good (web) API I'm going to build an API for a web app and I'm interested in what people can suggest as good practices. I'm already planning to make it versioned (version 1 can only control certain aspects of the system, version 2 could control more, but this may need a change in the way authentication is performed that would be incompatible with version 1), and the authentication will be distinct from the standard username/password people use to log in (if someone does use a malicious tool it won't open them up to full impersonation, just whatever the api allows). Does anyone have further ideas, or examples of sites with particularly good APIs you have used?
TITLE: How should I build a good (web) API QUESTION: I'm going to build an API for a web app and I'm interested in what people can suggest as good practices. I'm already planning to make it versioned (version 1 can only control certain aspects of the system, version 2 could control more, but this may need a change in the way authentication is performed that would be incompatible with version 1), and the authentication will be distinct from the standard username/password people use to log in (if someone does use a malicious tool it won't open them up to full impersonation, just whatever the api allows). Does anyone have further ideas, or examples of sites with particularly good APIs you have used? ANSWER: Read the RESTful Web Services book, which give you a good overview of how to use REST in practice, and get to up to speed quickly enough to get started now, with some confidence. This is more useful than just looking at an existing API, because it also discusses design choices and trade-offs.
[ "api-design" ]
22
12
2,393
5
0
2008-08-29T00:56:33.903000
2008-08-29T06:30:49.733000
33,745
33,815
WordPress MediaWiki integration
On the other end of the spectrum, I would be happy if I could install a wiki and share the login credentials between WordPress and the wiki. I hacked MediaWiki a while ago to share logins with another site (in ASP Classic ) via session cookies, and it was a pain to do and even worse to maintain. Ideally, I would like to find a plug-in or someone who knows a more elegant solution.
The tutorial WordPress, bbPress & MediaWiki should get you on the right track to integrating MediaWiki into your WordPress install. It's certainly going to be a lot easier than hacking WordPress to have wiki features, especially with the sort of granular permissions you're describing.
WordPress MediaWiki integration On the other end of the spectrum, I would be happy if I could install a wiki and share the login credentials between WordPress and the wiki. I hacked MediaWiki a while ago to share logins with another site (in ASP Classic ) via session cookies, and it was a pain to do and even worse to maintain. Ideally, I would like to find a plug-in or someone who knows a more elegant solution.
TITLE: WordPress MediaWiki integration QUESTION: On the other end of the spectrum, I would be happy if I could install a wiki and share the login credentials between WordPress and the wiki. I hacked MediaWiki a while ago to share logins with another site (in ASP Classic ) via session cookies, and it was a pain to do and even worse to maintain. Ideally, I would like to find a plug-in or someone who knows a more elegant solution. ANSWER: The tutorial WordPress, bbPress & MediaWiki should get you on the right track to integrating MediaWiki into your WordPress install. It's certainly going to be a lot easier than hacking WordPress to have wiki features, especially with the sort of granular permissions you're describing.
[ "php", "mysql", "wordpress", "lamp", "mediawiki" ]
10
9
18,834
6
0
2008-08-29T01:15:24.593000
2008-08-29T02:05:23.613000
33,746
33,757
XML attribute vs XML element
At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of our data. During the process we have been discussing with the team of the other application about the structure of the XML file. The sample I came up with is essentially something like: The other team said that this was not industry standard and that attributes should only be used for meta data. They suggested: something something something something something The reason I suggested the first is that the size of the file created is much smaller. There will be roughly 80000 items that will be in the file during transfer. Their suggestion in reality turns out to be three times larger than the one I suggested. I searched for the mysterious "Industry Standard" that was mentioned, but the closest I could find was that XML attributes should only be used for meta data, but said the debate was about what was actually meta data. After the long winded explanation (sorry) how do you determine what is meta data, and when designing the structure of an XML document how should you decide when to use an attribute or an element?
I use this rule of thumb: An Attribute is something that is self-contained, i.e., a color, an ID, a name. An Element is something that does or could have attributes of its own or contain other elements. So yours is close. I would have done something like: EDIT: Updated the original example based on feedback below. something XYX YYZ
XML attribute vs XML element At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of our data. During the process we have been discussing with the team of the other application about the structure of the XML file. The sample I came up with is essentially something like: The other team said that this was not industry standard and that attributes should only be used for meta data. They suggested: something something something something something The reason I suggested the first is that the size of the file created is much smaller. There will be roughly 80000 items that will be in the file during transfer. Their suggestion in reality turns out to be three times larger than the one I suggested. I searched for the mysterious "Industry Standard" that was mentioned, but the closest I could find was that XML attributes should only be used for meta data, but said the debate was about what was actually meta data. After the long winded explanation (sorry) how do you determine what is meta data, and when designing the structure of an XML document how should you decide when to use an attribute or an element?
TITLE: XML attribute vs XML element QUESTION: At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of our data. During the process we have been discussing with the team of the other application about the structure of the XML file. The sample I came up with is essentially something like: The other team said that this was not industry standard and that attributes should only be used for meta data. They suggested: something something something something something The reason I suggested the first is that the size of the file created is much smaller. There will be roughly 80000 items that will be in the file during transfer. Their suggestion in reality turns out to be three times larger than the one I suggested. I searched for the mysterious "Industry Standard" that was mentioned, but the closest I could find was that XML attributes should only be used for meta data, but said the debate was about what was actually meta data. After the long winded explanation (sorry) how do you determine what is meta data, and when designing the structure of an XML document how should you decide when to use an attribute or an element? ANSWER: I use this rule of thumb: An Attribute is something that is self-contained, i.e., a color, an ID, a name. An Element is something that does or could have attributes of its own or contain other elements. So yours is close. I would have done something like: EDIT: Updated the original example based on feedback below. something XYX YYZ
[ "xml", "xsd" ]
272
153
84,307
21
0
2008-08-29T01:15:52.220000
2008-08-29T01:28:13.203000
33,751
33,767
How do I add a MIME type to .htaccess?
I would like to add the following MIME type to a site run by Apache: jnlp application/x-java-jnlp-file That is the Tomcat format. I'm on a shared host, so I can only create an.htaccess file. Would someone please specify the complete contents of such a file?
AddType application/x-java-jnlp-file.jnlp Note that you might not actually be allowed to do that. See also the documentation of the AddType directive and the.htaccess howto.
How do I add a MIME type to .htaccess? I would like to add the following MIME type to a site run by Apache: jnlp application/x-java-jnlp-file That is the Tomcat format. I'm on a shared host, so I can only create an.htaccess file. Would someone please specify the complete contents of such a file?
TITLE: How do I add a MIME type to .htaccess? QUESTION: I would like to add the following MIME type to a site run by Apache: jnlp application/x-java-jnlp-file That is the Tomcat format. I'm on a shared host, so I can only create an.htaccess file. Would someone please specify the complete contents of such a file? ANSWER: AddType application/x-java-jnlp-file.jnlp Note that you might not actually be allowed to do that. See also the documentation of the AddType directive and the.htaccess howto.
[ "java", "apache", ".htaccess", "mime", "jnlp" ]
12
12
8,826
2
0
2008-08-29T01:25:43.897000
2008-08-29T01:33:07.403000
33,761
33,773
How can I retrieve a list of parameters from a stored procedure in SQL Server
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters that belong to a stored procedure on a SQL Server before I actually execute it? I have an a "multi-environment" scenario where there are multiple versions of the same database schema. Examples of environments might be "Development", "Staging", & "Production". "Development" is going to have one version of the stored procedure and "Staging" is going to have another. All I want to do is validate that a parameter is going to be there before passing it a value and calling the stored procedure. Avoiding that SqlException rather than having to catch it is a plus for me. Joshua
You can use SqlCommandBuilder.DeriveParameters() (see SqlCommandBuilder.DeriveParameters - Get Parameter Information for a Stored Procedure - ADO.NET Tutorials ) or there's this way which isn't as elegant.
How can I retrieve a list of parameters from a stored procedure in SQL Server Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters that belong to a stored procedure on a SQL Server before I actually execute it? I have an a "multi-environment" scenario where there are multiple versions of the same database schema. Examples of environments might be "Development", "Staging", & "Production". "Development" is going to have one version of the stored procedure and "Staging" is going to have another. All I want to do is validate that a parameter is going to be there before passing it a value and calling the stored procedure. Avoiding that SqlException rather than having to catch it is a plus for me. Joshua
TITLE: How can I retrieve a list of parameters from a stored procedure in SQL Server QUESTION: Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters that belong to a stored procedure on a SQL Server before I actually execute it? I have an a "multi-environment" scenario where there are multiple versions of the same database schema. Examples of environments might be "Development", "Staging", & "Production". "Development" is going to have one version of the stored procedure and "Staging" is going to have another. All I want to do is validate that a parameter is going to be there before passing it a value and calling the stored procedure. Avoiding that SqlException rather than having to catch it is a plus for me. Joshua ANSWER: You can use SqlCommandBuilder.DeriveParameters() (see SqlCommandBuilder.DeriveParameters - Get Parameter Information for a Stored Procedure - ADO.NET Tutorials ) or there's this way which isn't as elegant.
[ "c#", "sql-server", "ado.net" ]
16
9
27,961
8
0
2008-08-29T01:31:27.550000
2008-08-29T01:36:27.520000
33,768
67,704
Any advice for speeding up the compile time in Flex Builder 3?
I run Flex Builder 3 on a mac and as my project grows - the compile time gets longer and longer and longer. I am using some SWC's and there is a fair amount of code but it shouldn't take minutes to build and crash daily should it?
In addition to the suggestions already mentioned, close any projects that you have open that you are not using. Rich click on the Project in the Navigator view and select "Close Unrelated Projects". Depending on how many projects you have open, this can lead to a significant improvements in compile time, as well as all around performance. mike chambers mesh@adobe.com
Any advice for speeding up the compile time in Flex Builder 3? I run Flex Builder 3 on a mac and as my project grows - the compile time gets longer and longer and longer. I am using some SWC's and there is a fair amount of code but it shouldn't take minutes to build and crash daily should it?
TITLE: Any advice for speeding up the compile time in Flex Builder 3? QUESTION: I run Flex Builder 3 on a mac and as my project grows - the compile time gets longer and longer and longer. I am using some SWC's and there is a fair amount of code but it shouldn't take minutes to build and crash daily should it? ANSWER: In addition to the suggestions already mentioned, close any projects that you have open that you are not using. Rich click on the Project in the Navigator view and select "Close Unrelated Projects". Depending on how many projects you have open, this can lead to a significant improvements in compile time, as well as all around performance. mike chambers mesh@adobe.com
[ "apache-flex", "macos", "flexbuilder", "compilation" ]
12
5
12,669
14
0
2008-08-29T01:34:14
2008-09-15T22:43:19.817000
33,790
33,791
How can I use `scp` to deploy a website's `.htaccess` file?
I am currently using the following command to upload my site content: scp -r web/* user@site.com:site.com/ This works great except that the.htaccess file is not sent. Presumably, this is because it's hidden. I have tried adding a second line to send the file explicitely: scp -r web/.htaccess user@site.com:site.com/.htaccess This works great except now I have to enter my password twice. Any thoughts on how to make this deploy with only 1 or 0 entries of my password?
Just combine the two commands: scp -r web/* web/.htaccess user@site.com:site.com/ If you want 0 entries of your password you can set up public key authentication for ssh/scp.
How can I use `scp` to deploy a website's `.htaccess` file? I am currently using the following command to upload my site content: scp -r web/* user@site.com:site.com/ This works great except that the.htaccess file is not sent. Presumably, this is because it's hidden. I have tried adding a second line to send the file explicitely: scp -r web/.htaccess user@site.com:site.com/.htaccess This works great except now I have to enter my password twice. Any thoughts on how to make this deploy with only 1 or 0 entries of my password?
TITLE: How can I use `scp` to deploy a website's `.htaccess` file? QUESTION: I am currently using the following command to upload my site content: scp -r web/* user@site.com:site.com/ This works great except that the.htaccess file is not sent. Presumably, this is because it's hidden. I have tried adding a second line to send the file explicitely: scp -r web/.htaccess user@site.com:site.com/.htaccess This works great except now I have to enter my password twice. Any thoughts on how to make this deploy with only 1 or 0 entries of my password? ANSWER: Just combine the two commands: scp -r web/* web/.htaccess user@site.com:site.com/ If you want 0 entries of your password you can set up public key authentication for ssh/scp.
[ ".htaccess", "deployment", "scp", "shared-hosting" ]
4
9
2,756
3
0
2008-08-29T01:44:54.427000
2008-08-29T01:47:21.317000
33,813
36,316
What are some useful TextMate features?
I noticed that many people here use TextMate for coding on OS X. I've recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don't know what you're looking for. So, what feature have you found most helpful for coding (mainly in Python)? Are there any third-party bundles I should know about, besides what's included?
Don't neglect the 'mate' command line tool. You can use it to pipe output into TextMate, so if you do the following... diff file1.py file2.py | mate...it will not only open in TextMate, but it is smart enough to know that you're looking at a diff and highlight lines on screen. TextMate's SVN integration is great; it also seems to have bundles for some other version control systems as well. Add GetBundle to browse the bundle repository. I found the jQuery bundle through it and it's very handy. As others have mentioned, rolling your own bundle for frequently used snippets is very helpful. If you have some snippets that are specific to a project or framework, you might want to prefix all of them with a common letter to keep the namespace tidy.
What are some useful TextMate features? I noticed that many people here use TextMate for coding on OS X. I've recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don't know what you're looking for. So, what feature have you found most helpful for coding (mainly in Python)? Are there any third-party bundles I should know about, besides what's included?
TITLE: What are some useful TextMate features? QUESTION: I noticed that many people here use TextMate for coding on OS X. I've recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don't know what you're looking for. So, what feature have you found most helpful for coding (mainly in Python)? Are there any third-party bundles I should know about, besides what's included? ANSWER: Don't neglect the 'mate' command line tool. You can use it to pipe output into TextMate, so if you do the following... diff file1.py file2.py | mate...it will not only open in TextMate, but it is smart enough to know that you're looking at a diff and highlight lines on screen. TextMate's SVN integration is great; it also seems to have bundles for some other version control systems as well. Add GetBundle to browse the bundle repository. I found the jQuery bundle through it and it's very handy. As others have mentioned, rolling your own bundle for frequently used snippets is very helpful. If you have some snippets that are specific to a project or framework, you might want to prefix all of them with a common letter to keep the namespace tidy.
[ "python", "macos", "text-editor", "textmate" ]
21
29
7,429
17
0
2008-08-29T02:03:34.070000
2008-08-30T20:14:02.197000
33,814
34,614
How to determine if an html tag splits across multiple lines
I'm writing a PHP script that involves scraping web pages. Currently, the script analyzes the page line by line, but it breaks if there is a tag that spans multiple lines, like If worse comes to worst, I could possibly preprocess the page by removing all line breaks, then re-inserting them at the closest >, but this seems like a kludge. Ideally, I'd be able to detect a tag that spans lines, conjoin only those to lines, and continue processing. So what's the best method to detect this?
Perhaps for future projects I'll use a parsing library, but that's kind of aside from the question at hand. This is my current solution. rstrpos is strpos, but from the reverse direction. Example use: for($i=0; $i And here's that implementation: function rstrpos($string, $charToFind, $relativePos) { $searchPos = $relativePos; $searchChar = ''; while (($searchChar!= $charToFind)&&($searchPos>-1)) { $newPos = $searchPos-1; $searchChar = substr($string,$newPos,strlen($charToFind)); $searchPos = $newPos; } if (!empty($searchChar)) { return $searchPos; return TRUE; } else { return FALSE; } } function handle_multiline_tags(&$i, $line, $lines) { //if a tag is opened but not closed before a line break, $open = rstrpos($line, '<', strlen($line)); $close = rstrpos($line, '>', strlen($line)); if(($open > $close)&&($open > -1)&&($close > -1)) { $i++; return trim($line).trim(handle_multiline_tags(&$i, $lines[$i], $lines)); } else { return trim($line); } } This could probably be optimized in some way, but for my purposes, it's sufficient.
How to determine if an html tag splits across multiple lines I'm writing a PHP script that involves scraping web pages. Currently, the script analyzes the page line by line, but it breaks if there is a tag that spans multiple lines, like If worse comes to worst, I could possibly preprocess the page by removing all line breaks, then re-inserting them at the closest >, but this seems like a kludge. Ideally, I'd be able to detect a tag that spans lines, conjoin only those to lines, and continue processing. So what's the best method to detect this?
TITLE: How to determine if an html tag splits across multiple lines QUESTION: I'm writing a PHP script that involves scraping web pages. Currently, the script analyzes the page line by line, but it breaks if there is a tag that spans multiple lines, like If worse comes to worst, I could possibly preprocess the page by removing all line breaks, then re-inserting them at the closest >, but this seems like a kludge. Ideally, I'd be able to detect a tag that spans lines, conjoin only those to lines, and continue processing. So what's the best method to detect this? ANSWER: Perhaps for future projects I'll use a parsing library, but that's kind of aside from the question at hand. This is my current solution. rstrpos is strpos, but from the reverse direction. Example use: for($i=0; $i And here's that implementation: function rstrpos($string, $charToFind, $relativePos) { $searchPos = $relativePos; $searchChar = ''; while (($searchChar!= $charToFind)&&($searchPos>-1)) { $newPos = $searchPos-1; $searchChar = substr($string,$newPos,strlen($charToFind)); $searchPos = $newPos; } if (!empty($searchChar)) { return $searchPos; return TRUE; } else { return FALSE; } } function handle_multiline_tags(&$i, $line, $lines) { //if a tag is opened but not closed before a line break, $open = rstrpos($line, '<', strlen($line)); $close = rstrpos($line, '>', strlen($line)); if(($open > $close)&&($open > -1)&&($close > -1)) { $i++; return trim($line).trim(handle_multiline_tags(&$i, $lines[$i], $lines)); } else { return trim($line); } } This could probably be optimized in some way, but for my purposes, it's sufficient.
[ "php", "html", "scripting" ]
3
1
1,917
6
0
2008-08-29T02:03:39.017000
2008-08-29T16:20:57.163000
33,822
33,831
Any way to write a Windows .bat file to kill processes?
Every time I turn on my company-owned development machine, I have to kill 10+ processes using the Task Manager or any other process management app just to get decent performance out of my IDE. Yes, these are processes from programs that my company installs on my machine for security and compliance. What I'd like to do is have a.bat file or script of some kind with which I can kill the processes in question. Does anybody know how to do this?
You can do this with ' taskkill '. With the /IM parameter, you can specify image names. Example: taskkill /im somecorporateprocess.exe You can also do this to ' force ' kill: Example: taskkill /f /im somecorporateprocess.exe Just add one line per process you want to kill, save it as a.bat file, and add in your startup directory. Problem solved! If this is a legacy system, PsKill will do the same.
Any way to write a Windows .bat file to kill processes? Every time I turn on my company-owned development machine, I have to kill 10+ processes using the Task Manager or any other process management app just to get decent performance out of my IDE. Yes, these are processes from programs that my company installs on my machine for security and compliance. What I'd like to do is have a.bat file or script of some kind with which I can kill the processes in question. Does anybody know how to do this?
TITLE: Any way to write a Windows .bat file to kill processes? QUESTION: Every time I turn on my company-owned development machine, I have to kill 10+ processes using the Task Manager or any other process management app just to get decent performance out of my IDE. Yes, these are processes from programs that my company installs on my machine for security and compliance. What I'd like to do is have a.bat file or script of some kind with which I can kill the processes in question. Does anybody know how to do this? ANSWER: You can do this with ' taskkill '. With the /IM parameter, you can specify image names. Example: taskkill /im somecorporateprocess.exe You can also do this to ' force ' kill: Example: taskkill /f /im somecorporateprocess.exe Just add one line per process you want to kill, save it as a.bat file, and add in your startup directory. Problem solved! If this is a legacy system, PsKill will do the same.
[ "performance", "batch-file", "process" ]
147
228
435,071
9
0
2008-08-29T02:09:55.960000
2008-08-29T02:14:00.100000
33,829
33,838
How do I detect if a function is available during JNLP execution?
I have an application which really should be installed, but does work fine when deployed using JNLP. However, it would seem that some Java functions such as Runtime.exec don't work using the default security options. I would like to therefore disable UI functionality that relies upon such functions. So my question is, how do I detect at runtime whether certain functions are available or not? The case study, here of course, is Runtime.exec.
You want to ask to the SecurityManager if you have Exec right with the checkExec method.
How do I detect if a function is available during JNLP execution? I have an application which really should be installed, but does work fine when deployed using JNLP. However, it would seem that some Java functions such as Runtime.exec don't work using the default security options. I would like to therefore disable UI functionality that relies upon such functions. So my question is, how do I detect at runtime whether certain functions are available or not? The case study, here of course, is Runtime.exec.
TITLE: How do I detect if a function is available during JNLP execution? QUESTION: I have an application which really should be installed, but does work fine when deployed using JNLP. However, it would seem that some Java functions such as Runtime.exec don't work using the default security options. I would like to therefore disable UI functionality that relies upon such functions. So my question is, how do I detect at runtime whether certain functions are available or not? The case study, here of course, is Runtime.exec. ANSWER: You want to ask to the SecurityManager if you have Exec right with the checkExec method.
[ "java", "security", "deployment", "permissions", "jnlp" ]
0
1
276
3
0
2008-08-29T02:13:17.933000
2008-08-29T02:18:20.883000
33,836
33,862
How can I find the revision history of the file that was deleted and then resubmitted to SVN?
This is a follow on question to " How do I delete 1 file from a revision in SVN? " but because it probably has a very different answer and I believe that others would benefit from knowing the answer. (I don't know the answer yet.) The previous question was answered and I discovered that it is not possible to remove a revision from SVN. The second best solution was to remove the file from SVN, commit and then add the file back and commit again. I now want to make sure that the original file's revision history has gone. So I am hoping that the answer to the question " How can I find the revision history of the file that was deleted and then resubmitted to SVN? " is that you can't.
With a simple svn log -v [folder] you can browse quickly the adding and deletion. ------------------------------------------------------------------------ r14 | kame | 2008-08-29 04:23:43 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié: A /a.txt Readded a ------------------------------------------------------------------------ r13 | kame | 2008-08-29 04:23:24 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié: D /a.txt Delete a ------------------------------------------------------------------------ r12 | kame | 2008-08-29 04:23:06 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié: A /a.txt svn log won't show the file, svn diff will pretend that the old revision does not exist, but a svn checkout targeting the old revision will happily give you the old file.
How can I find the revision history of the file that was deleted and then resubmitted to SVN? This is a follow on question to " How do I delete 1 file from a revision in SVN? " but because it probably has a very different answer and I believe that others would benefit from knowing the answer. (I don't know the answer yet.) The previous question was answered and I discovered that it is not possible to remove a revision from SVN. The second best solution was to remove the file from SVN, commit and then add the file back and commit again. I now want to make sure that the original file's revision history has gone. So I am hoping that the answer to the question " How can I find the revision history of the file that was deleted and then resubmitted to SVN? " is that you can't.
TITLE: How can I find the revision history of the file that was deleted and then resubmitted to SVN? QUESTION: This is a follow on question to " How do I delete 1 file from a revision in SVN? " but because it probably has a very different answer and I believe that others would benefit from knowing the answer. (I don't know the answer yet.) The previous question was answered and I discovered that it is not possible to remove a revision from SVN. The second best solution was to remove the file from SVN, commit and then add the file back and commit again. I now want to make sure that the original file's revision history has gone. So I am hoping that the answer to the question " How can I find the revision history of the file that was deleted and then resubmitted to SVN? " is that you can't. ANSWER: With a simple svn log -v [folder] you can browse quickly the adding and deletion. ------------------------------------------------------------------------ r14 | kame | 2008-08-29 04:23:43 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié: A /a.txt Readded a ------------------------------------------------------------------------ r13 | kame | 2008-08-29 04:23:24 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié: D /a.txt Delete a ------------------------------------------------------------------------ r12 | kame | 2008-08-29 04:23:06 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié: A /a.txt svn log won't show the file, svn diff will pretend that the old revision does not exist, but a svn checkout targeting the old revision will happily give you the old file.
[ "svn" ]
1
2
401
4
0
2008-08-29T02:17:06.800000
2008-08-29T02:33:39.677000
33,837
33,854
IE CSS Bug - How do I maintain a position:absolute when dynamic javascript content on the page changes
I have a page where there is a column and a content div, somewhat like this: blahblahblah With some styling I have an image that is split between the column and the content but needs to maintain the same vertical positioning so that it lines up. Styling is similar to this: #column { width:150px; height:450px; left:-150px; bottom:-140px; background:url(../images/image.png) no-repeat; position:absolute; z-index:1; } #container { background:transparent url(../images/container.png) no-repeat scroll left bottom; position:relative; width:100px; } This works great when content in #content is dynamically loaded before rendering. This also works great in firefox always. However, in IE6 and IE7 if I use javascript to change the content (and thus height) of #content, the images no longer line up ( #column doesn't move). If I use IE Developer Bar to just update the div (say add position:absolute manually) the image jumps down and lines up again. Is there something I am missing here? @Ricky - Hmm, that means in this case there is no solution I think. At its best there will be a jaggedy matchup afterwards but as my content expands and contracts etc. hiding/showing doesn't work out to be practical. Still thanks for answering with the best solution.
Its a bug in the rendering engine. I run into it all the time. One potential way to solve it is to hide and show the div whenever you change the content (that in turn changes the height): var divCol = document.getElementById('column'); divCol.style.display = 'none'; divCol.style.display = 'block'; Hopefully this happens fast enough that it isn't noticeable:)
IE CSS Bug - How do I maintain a position:absolute when dynamic javascript content on the page changes I have a page where there is a column and a content div, somewhat like this: blahblahblah With some styling I have an image that is split between the column and the content but needs to maintain the same vertical positioning so that it lines up. Styling is similar to this: #column { width:150px; height:450px; left:-150px; bottom:-140px; background:url(../images/image.png) no-repeat; position:absolute; z-index:1; } #container { background:transparent url(../images/container.png) no-repeat scroll left bottom; position:relative; width:100px; } This works great when content in #content is dynamically loaded before rendering. This also works great in firefox always. However, in IE6 and IE7 if I use javascript to change the content (and thus height) of #content, the images no longer line up ( #column doesn't move). If I use IE Developer Bar to just update the div (say add position:absolute manually) the image jumps down and lines up again. Is there something I am missing here? @Ricky - Hmm, that means in this case there is no solution I think. At its best there will be a jaggedy matchup afterwards but as my content expands and contracts etc. hiding/showing doesn't work out to be practical. Still thanks for answering with the best solution.
TITLE: IE CSS Bug - How do I maintain a position:absolute when dynamic javascript content on the page changes QUESTION: I have a page where there is a column and a content div, somewhat like this: blahblahblah With some styling I have an image that is split between the column and the content but needs to maintain the same vertical positioning so that it lines up. Styling is similar to this: #column { width:150px; height:450px; left:-150px; bottom:-140px; background:url(../images/image.png) no-repeat; position:absolute; z-index:1; } #container { background:transparent url(../images/container.png) no-repeat scroll left bottom; position:relative; width:100px; } This works great when content in #content is dynamically loaded before rendering. This also works great in firefox always. However, in IE6 and IE7 if I use javascript to change the content (and thus height) of #content, the images no longer line up ( #column doesn't move). If I use IE Developer Bar to just update the div (say add position:absolute manually) the image jumps down and lines up again. Is there something I am missing here? @Ricky - Hmm, that means in this case there is no solution I think. At its best there will be a jaggedy matchup afterwards but as my content expands and contracts etc. hiding/showing doesn't work out to be practical. Still thanks for answering with the best solution. ANSWER: Its a bug in the rendering engine. I run into it all the time. One potential way to solve it is to hide and show the div whenever you change the content (that in turn changes the height): var divCol = document.getElementById('column'); divCol.style.display = 'none'; divCol.style.display = 'block'; Hopefully this happens fast enough that it isn't noticeable:)
[ "css", "internet-explorer-6", "internet-explorer-7" ]
2
3
1,440
3
0
2008-08-29T02:17:57.843000
2008-08-29T02:30:41.463000
33,843
33,847
How to avoid pauses when editing code on a network drive?
I'm planning on doing more coding from home but in order to do so, I need to be able to edit files on a Samba drive on our dev server. The problem I've run into with several editors is that the network latency causes the editor to lock up for long periods of time (Eclipse, TextMate). Some editors cope with this a lot better than others, but are there any file system or other tweaks I can make to minimize the impact of lag? A few additional points: There's a policy against having company data on personal machines, so I'd like to avoid checking out the code locally. The mount is over a PPTP VPN connection. Mounting to Linux or OS X client
Use a source control system — Subversion, Perforce, Git, Mercurial, Bazaar, etc. — so you're never editing code on a shared server. Instead you should be editing a local work area and committing changes to a repository located on the network. Also, convince your company to adapt their policy such that company code is allowed on personal machines if it's on an encrypted volume. Encrypted disk images that you can use for this are trivial to create using Disk Utility, and can use strong cryptography. You can get even more security by not storing your encryption passphrase in your keychain, and instead typing it every time you mount the encrypted volume; this means that even if your local user account is compromised, as long as you don't have the volume mounted, nobody else will be able to mount it. I did this all the time when I was consulting and none of my clients — some of whom had similar rules about company code — ever had a problem with it once I explained how things worked. (I think some of them even started using encrypted disk images even within their offices.)
How to avoid pauses when editing code on a network drive? I'm planning on doing more coding from home but in order to do so, I need to be able to edit files on a Samba drive on our dev server. The problem I've run into with several editors is that the network latency causes the editor to lock up for long periods of time (Eclipse, TextMate). Some editors cope with this a lot better than others, but are there any file system or other tweaks I can make to minimize the impact of lag? A few additional points: There's a policy against having company data on personal machines, so I'd like to avoid checking out the code locally. The mount is over a PPTP VPN connection. Mounting to Linux or OS X client
TITLE: How to avoid pauses when editing code on a network drive? QUESTION: I'm planning on doing more coding from home but in order to do so, I need to be able to edit files on a Samba drive on our dev server. The problem I've run into with several editors is that the network latency causes the editor to lock up for long periods of time (Eclipse, TextMate). Some editors cope with this a lot better than others, but are there any file system or other tweaks I can make to minimize the impact of lag? A few additional points: There's a policy against having company data on personal machines, so I'd like to avoid checking out the code locally. The mount is over a PPTP VPN connection. Mounting to Linux or OS X client ANSWER: Use a source control system — Subversion, Perforce, Git, Mercurial, Bazaar, etc. — so you're never editing code on a shared server. Instead you should be editing a local work area and committing changes to a repository located on the network. Also, convince your company to adapt their policy such that company code is allowed on personal machines if it's on an encrypted volume. Encrypted disk images that you can use for this are trivial to create using Disk Utility, and can use strong cryptography. You can get even more security by not storing your encryption passphrase in your keychain, and instead typing it every time you mount the encrypted volume; this means that even if your local user account is compromised, as long as you don't have the volume mounted, nobody else will be able to mount it. I did this all the time when I was consulting and none of my clients — some of whom had similar rules about company code — ever had a problem with it once I explained how things worked. (I think some of them even started using encrypted disk images even within their offices.)
[ "networking", "text-editor", "textmate", "samba" ]
4
9
807
4
0
2008-08-29T02:22:16.960000
2008-08-29T02:25:17.280000
33,852
34,108
Using Unsigned Primitive Types
Most of time we represent concepts which can never be less than 0. For example to declare length, we write: int length; The name expresses its purpose well but you can assign negative values to it. It seems that for some situations, you can represent your intent more clearly by writing it this way instead: uint length; Some disadvantages that I can think of: unsigned types (uint, ulong, ushort) are not CLS compliant so you can't use it with other languages that don't support this.Net classes use signed types most of the time so you have to cast Thoughts?
“When in Rome, do as the Romans do.” While there is theoretically an advantage in using unsigned values where applicable because it makes the code more expressive, this is simply not done in C#. I'm not sure why the developers initially didn't design the interfaces to handle uints and make the type CLS compliant but now the train has left the station. Since consistency is generally important I'd advise taking the C# road and using int s.
Using Unsigned Primitive Types Most of time we represent concepts which can never be less than 0. For example to declare length, we write: int length; The name expresses its purpose well but you can assign negative values to it. It seems that for some situations, you can represent your intent more clearly by writing it this way instead: uint length; Some disadvantages that I can think of: unsigned types (uint, ulong, ushort) are not CLS compliant so you can't use it with other languages that don't support this.Net classes use signed types most of the time so you have to cast Thoughts?
TITLE: Using Unsigned Primitive Types QUESTION: Most of time we represent concepts which can never be less than 0. For example to declare length, we write: int length; The name expresses its purpose well but you can assign negative values to it. It seems that for some situations, you can represent your intent more clearly by writing it this way instead: uint length; Some disadvantages that I can think of: unsigned types (uint, ulong, ushort) are not CLS compliant so you can't use it with other languages that don't support this.Net classes use signed types most of the time so you have to cast Thoughts? ANSWER: “When in Rome, do as the Romans do.” While there is theoretically an advantage in using unsigned values where applicable because it makes the code more expressive, this is simply not done in C#. I'm not sure why the developers initially didn't design the interfaces to handle uints and make the type CLS compliant but now the train has left the station. Since consistency is generally important I'd advise taking the C# road and using int s.
[ "c#", "primitive-types" ]
7
5
1,010
6
0
2008-08-29T02:28:57.223000
2008-08-29T07:22:37.987000
33,881
316,867
Font rendering for web pages
I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there. Note: Its only in windows that it is like this. Mainly in Opera and FF also in IE7 but not quite as bad. In Linux the font looks good. I haven't looked at a Mac. What do you guys do to fix this? if anything. I noticed that the titles here on SO are also pretty jagged but they are just small enough not to look bad.
There is nothing you can do to force the user to change the way that their operating system renders fonts. If it is that big a deal to you then you can replace the large headings with images, this allows you to control exactly how the font is rendered (and ensures that the heading looks exactly as you wish, even if the user doesnt have your suggested font installed). If you do this make sure that you provide an alternative text representation for those who do not see images. I tend to use CSS to show a background image, and hide the contents of the heading. Like this. Heading Text To be honest this does seem like overkill if it is on all large text. And be aware that it will increase the amount of data that your clients need to download. However for a large heading this method can lead to something that looks nicer than OS rendered text.
Font rendering for web pages I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there. Note: Its only in windows that it is like this. Mainly in Opera and FF also in IE7 but not quite as bad. In Linux the font looks good. I haven't looked at a Mac. What do you guys do to fix this? if anything. I noticed that the titles here on SO are also pretty jagged but they are just small enough not to look bad.
TITLE: Font rendering for web pages QUESTION: I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there. Note: Its only in windows that it is like this. Mainly in Opera and FF also in IE7 but not quite as bad. In Linux the font looks good. I haven't looked at a Mac. What do you guys do to fix this? if anything. I noticed that the titles here on SO are also pretty jagged but they are just small enough not to look bad. ANSWER: There is nothing you can do to force the user to change the way that their operating system renders fonts. If it is that big a deal to you then you can replace the large headings with images, this allows you to control exactly how the font is rendered (and ensures that the heading looks exactly as you wish, even if the user doesnt have your suggested font installed). If you do this make sure that you provide an alternative text representation for those who do not see images. I tend to use CSS to show a background image, and hide the contents of the heading. Like this. Heading Text To be honest this does seem like overkill if it is on all large text. And be aware that it will increase the amount of data that your clients need to download. However for a large heading this method can lead to something that looks nicer than OS rendered text.
[ "fonts", "typography" ]
1
1
788
4
0
2008-08-29T02:44:44.643000
2008-11-25T09:58:42.233000
33,893
33,919
Determining width of a printed string by a webapp
In my (PHP) web app, I have a part of my site that keeps a history of recent searches. The most recent queries get shown in a side box. If the query text is too long, I truncate it and show ellipses. Eg: "My very long query is..." Currently, I truncate after a certain number of characters. Since the font is not monotype, a query of all I's is more narrow than a query of all W's. I'd like them to all be about the same width prior to the ellipses. Is there a way to get the approximate width of the resulting string so that the ellipses for any given string will occur in about the same number of pixels from the beginning? Does CSS have a way? Does PHP? Would this be better handled by JavaScript?
Here's another take on it and you don't have to live without the ellipsis! … Some long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Some more long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Short text. Fail! There is one flaw with this, if the text is short enough to be fully displayed, the ellipses will still be displayed as well. [EDIT: 6/26/2009] At the suggestion of Power-Coder I have revised this a little. There are really only two changes, the addition of the doctype (see notes below) and the addition of the display: inline-block attribute on the.qrytxt DIV. Here is what it looks like now... … Some long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Some more long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Short text. FTW Notes: Viewed in IE 8.0, Opera 9, FF 3 A doctype is required for IE to get the display: inline-block to work correctly. If the.qrytxt DIV's overflow occurs on a long word, there is going to be a wide gap between the ellipsis and the last visible word. You can see this by viewing the example and resizing your browser width in small increments. (this probably existed in the original example as well, I just may have not noticed it then) So again, an imperfect CSS-only solution. Javascript may be the only thing that can get the effect perfect. [EDIT: 6/27/2009] Here is another alternative which uses browser specific extensions. Some long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. Some more long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. Short text. FTW Note that in order for the above example to work, you must create the xml file referenced by the -moz-binding rule, ellipsis-xbl.xml. It's should contain the following xml:
Determining width of a printed string by a webapp In my (PHP) web app, I have a part of my site that keeps a history of recent searches. The most recent queries get shown in a side box. If the query text is too long, I truncate it and show ellipses. Eg: "My very long query is..." Currently, I truncate after a certain number of characters. Since the font is not monotype, a query of all I's is more narrow than a query of all W's. I'd like them to all be about the same width prior to the ellipses. Is there a way to get the approximate width of the resulting string so that the ellipses for any given string will occur in about the same number of pixels from the beginning? Does CSS have a way? Does PHP? Would this be better handled by JavaScript?
TITLE: Determining width of a printed string by a webapp QUESTION: In my (PHP) web app, I have a part of my site that keeps a history of recent searches. The most recent queries get shown in a side box. If the query text is too long, I truncate it and show ellipses. Eg: "My very long query is..." Currently, I truncate after a certain number of characters. Since the font is not monotype, a query of all I's is more narrow than a query of all W's. I'd like them to all be about the same width prior to the ellipses. Is there a way to get the approximate width of the resulting string so that the ellipses for any given string will occur in about the same number of pixels from the beginning? Does CSS have a way? Does PHP? Would this be better handled by JavaScript? ANSWER: Here's another take on it and you don't have to live without the ellipsis! … Some long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Some more long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Short text. Fail! There is one flaw with this, if the text is short enough to be fully displayed, the ellipses will still be displayed as well. [EDIT: 6/26/2009] At the suggestion of Power-Coder I have revised this a little. There are really only two changes, the addition of the doctype (see notes below) and the addition of the display: inline-block attribute on the.qrytxt DIV. Here is what it looks like now... … Some long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Some more long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. … Short text. FTW Notes: Viewed in IE 8.0, Opera 9, FF 3 A doctype is required for IE to get the display: inline-block to work correctly. If the.qrytxt DIV's overflow occurs on a long word, there is going to be a wide gap between the ellipsis and the last visible word. You can see this by viewing the example and resizing your browser width in small increments. (this probably existed in the original example as well, I just may have not noticed it then) So again, an imperfect CSS-only solution. Javascript may be the only thing that can get the effect perfect. [EDIT: 6/27/2009] Here is another alternative which uses browser specific extensions. Some long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. Some more long text which will arbitrarily be cut off at whatever word fits best but will have an ellipsis at the end. Short text. FTW Note that in order for the above example to work, you must create the xml file referenced by the -moz-binding rule, ellipsis-xbl.xml. It's should contain the following xml:
[ "php", "javascript", "css" ]
10
9
861
5
0
2008-08-29T02:53:44.717000
2008-08-29T03:43:14.737000
33,901
33,916
Best iCalendar library for Java?
I'm looking for a library to handle iCalendar data in Java. Open source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have. Does anyone have any recommendations?
I had limited success with iCal4j ( intro ) on a project last year. It seems to be a fairly popular choice for ical work in the java community. If I remember correctly the API can be slightly confusing at first glance. However It's pretty solid in the long run. Good luck, Brian
Best iCalendar library for Java? I'm looking for a library to handle iCalendar data in Java. Open source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have. Does anyone have any recommendations?
TITLE: Best iCalendar library for Java? QUESTION: I'm looking for a library to handle iCalendar data in Java. Open source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have. Does anyone have any recommendations? ANSWER: I had limited success with iCal4j ( intro ) on a project last year. It seems to be a fairly popular choice for ical work in the java community. If I remember correctly the API can be slightly confusing at first glance. However It's pretty solid in the long run. Good luck, Brian
[ "java", "icalendar" ]
66
52
47,877
2
0
2008-08-29T03:06:08.447000
2008-08-29T03:33:26.103000
33,909
33,913
Ribbon Toolbar and Visual Studio 2008 Service Pack 1
Today I was listening to the Hanselminutes show about.NET 3.5 SP1...What's inside, and they twice mentioned the Office 2007-like Ribbon control that is included in Visual Studio 2008 Service Pack 1. I am very interested about this, as I was previously looking at purchasing this from a 3rd party vendor (likely DevComponent's DotNetBar ). However, I did some research this morning and have found nothing about this control being included for use with C# and WPF. Does anyone know more about the included Ribbon control and whether or not it is available for C# or WPF?
Yeah I did a double-take when I heard them say that too. The ribbon control, along with a DatePicker and DataGrid, are being developed out of band over here on CodePlex. I'm not sure why Carl and Scott were suggesting that it was part of the SP1 release. Vincent Sibal posts about DataGrid (which is available already in some form) on his blog.
Ribbon Toolbar and Visual Studio 2008 Service Pack 1 Today I was listening to the Hanselminutes show about.NET 3.5 SP1...What's inside, and they twice mentioned the Office 2007-like Ribbon control that is included in Visual Studio 2008 Service Pack 1. I am very interested about this, as I was previously looking at purchasing this from a 3rd party vendor (likely DevComponent's DotNetBar ). However, I did some research this morning and have found nothing about this control being included for use with C# and WPF. Does anyone know more about the included Ribbon control and whether or not it is available for C# or WPF?
TITLE: Ribbon Toolbar and Visual Studio 2008 Service Pack 1 QUESTION: Today I was listening to the Hanselminutes show about.NET 3.5 SP1...What's inside, and they twice mentioned the Office 2007-like Ribbon control that is included in Visual Studio 2008 Service Pack 1. I am very interested about this, as I was previously looking at purchasing this from a 3rd party vendor (likely DevComponent's DotNetBar ). However, I did some research this morning and have found nothing about this control being included for use with C# and WPF. Does anyone know more about the included Ribbon control and whether or not it is available for C# or WPF? ANSWER: Yeah I did a double-take when I heard them say that too. The ribbon control, along with a DatePicker and DataGrid, are being developed out of band over here on CodePlex. I'm not sure why Carl and Scott were suggesting that it was part of the SP1 release. Vincent Sibal posts about DataGrid (which is available already in some form) on his blog.
[ "wpf", "visual-studio-2008", "user-interface", ".net-3.5", "ribbon" ]
6
4
11,022
4
0
2008-08-29T03:16:22.553000
2008-08-29T03:19:42.343000
33,923
37,010
What is tail recursion?
Whilst starting to learn lisp, I've come across the term tail-recursive. What does it mean exactly?
Consider a simple function that adds the first N natural numbers. (e.g. sum(5) = 0 + 1 + 2 + 3 + 4 + 5 = 15 ). Here is a simple JavaScript implementation that uses recursion: function recsum(x) { if (x === 0) { return 0; } else { return x + recsum(x - 1); } } If you called recsum(5), this is what the JavaScript interpreter would evaluate: recsum(5) 5 + recsum(4) 5 + (4 + recsum(3)) 5 + (4 + (3 + recsum(2))) 5 + (4 + (3 + (2 + recsum(1)))) 5 + (4 + (3 + (2 + (1 + recsum(0))))) 5 + (4 + (3 + (2 + (1 + 0)))) 5 + (4 + (3 + (2 + 1))) 5 + (4 + (3 + 3)) 5 + (4 + 6) 5 + 10 15 Note how every recursive call has to complete before the JavaScript interpreter begins to actually do the work of calculating the sum. Here's a tail-recursive version of the same function: function tailrecsum(x, running_total = 0) { if (x === 0) { return running_total; } else { return tailrecsum(x - 1, running_total + x); } } Here's the sequence of events that would occur if you called tailrecsum(5), (which would effectively be tailrecsum(5, 0), because of the default second argument). tailrecsum(5, 0) tailrecsum(4, 5) tailrecsum(3, 9) tailrecsum(2, 12) tailrecsum(1, 14) tailrecsum(0, 15) 15 In the tail-recursive case, with each evaluation of the recursive call, the running_total is updated. Note: The original answer used examples from Python. These have been changed to JavaScript, since Python interpreters don't support tail call optimization. However, while tail call optimization is part of the ECMAScript 2015 spec, most JavaScript interpreters don't support it.
What is tail recursion? Whilst starting to learn lisp, I've come across the term tail-recursive. What does it mean exactly?
TITLE: What is tail recursion? QUESTION: Whilst starting to learn lisp, I've come across the term tail-recursive. What does it mean exactly? ANSWER: Consider a simple function that adds the first N natural numbers. (e.g. sum(5) = 0 + 1 + 2 + 3 + 4 + 5 = 15 ). Here is a simple JavaScript implementation that uses recursion: function recsum(x) { if (x === 0) { return 0; } else { return x + recsum(x - 1); } } If you called recsum(5), this is what the JavaScript interpreter would evaluate: recsum(5) 5 + recsum(4) 5 + (4 + recsum(3)) 5 + (4 + (3 + recsum(2))) 5 + (4 + (3 + (2 + recsum(1)))) 5 + (4 + (3 + (2 + (1 + recsum(0))))) 5 + (4 + (3 + (2 + (1 + 0)))) 5 + (4 + (3 + (2 + 1))) 5 + (4 + (3 + 3)) 5 + (4 + 6) 5 + 10 15 Note how every recursive call has to complete before the JavaScript interpreter begins to actually do the work of calculating the sum. Here's a tail-recursive version of the same function: function tailrecsum(x, running_total = 0) { if (x === 0) { return running_total; } else { return tailrecsum(x - 1, running_total + x); } } Here's the sequence of events that would occur if you called tailrecsum(5), (which would effectively be tailrecsum(5, 0), because of the default second argument). tailrecsum(5, 0) tailrecsum(4, 5) tailrecsum(3, 9) tailrecsum(2, 12) tailrecsum(1, 14) tailrecsum(0, 15) 15 In the tail-recursive case, with each evaluation of the recursive call, the running_total is updated. Note: The original answer used examples from Python. These have been changed to JavaScript, since Python interpreters don't support tail call optimization. However, while tail call optimization is part of the ECMAScript 2015 spec, most JavaScript interpreters don't support it.
[ "algorithm", "language-agnostic", "functional-programming", "recursion", "tail-recursion" ]
2,052
2,077
612,458
29
0
2008-08-29T03:48:03.790000
2008-08-31T18:21:13.897000
33,937
33,944
How to handle variable width FieldObjects in Crystal Reports
I have a Crystal Report which is viewed via a CrystalReportViewer control on an.aspx page (using VS2008). The report has two data-driven FieldObjects (which can contain a variable number of chars) which I would like to display on the same line beside each other. Problem is when the text in the first FieldObject is too long it overlaps the text in the second FieldObject. I have tried setting the 'CanGrow=True' and 'MaxNumberOfLines=1' on the first FieldObject to 'push' the second FieldObject further to the right, but this didn't work. How do I get the second FieldObject to always display immediately after the first FieldObject regardless of the length of the text in the first? Cheers in advance of any knowledge you can drop.
you can add a text object to the report. And while editing the text of the text object, drag the field you want to show from the object explorer into the text box. Then hit space, then drag the second field in to the same text box. Your two fields will always be one space a part. You could, of course, add more spaces or any other text you want.
How to handle variable width FieldObjects in Crystal Reports I have a Crystal Report which is viewed via a CrystalReportViewer control on an.aspx page (using VS2008). The report has two data-driven FieldObjects (which can contain a variable number of chars) which I would like to display on the same line beside each other. Problem is when the text in the first FieldObject is too long it overlaps the text in the second FieldObject. I have tried setting the 'CanGrow=True' and 'MaxNumberOfLines=1' on the first FieldObject to 'push' the second FieldObject further to the right, but this didn't work. How do I get the second FieldObject to always display immediately after the first FieldObject regardless of the length of the text in the first? Cheers in advance of any knowledge you can drop.
TITLE: How to handle variable width FieldObjects in Crystal Reports QUESTION: I have a Crystal Report which is viewed via a CrystalReportViewer control on an.aspx page (using VS2008). The report has two data-driven FieldObjects (which can contain a variable number of chars) which I would like to display on the same line beside each other. Problem is when the text in the first FieldObject is too long it overlaps the text in the second FieldObject. I have tried setting the 'CanGrow=True' and 'MaxNumberOfLines=1' on the first FieldObject to 'push' the second FieldObject further to the right, but this didn't work. How do I get the second FieldObject to always display immediately after the first FieldObject regardless of the length of the text in the first? Cheers in advance of any knowledge you can drop. ANSWER: you can add a text object to the report. And while editing the text of the text object, drag the field you want to show from the object explorer into the text box. Then hit space, then drag the second field in to the same text box. Your two fields will always be one space a part. You could, of course, add more spaces or any other text you want.
[ "crystal-reports" ]
3
5
3,076
2
0
2008-08-29T04:00:20.920000
2008-08-29T04:07:39.623000
33,949
33,963
Convert Web.config from .NET 2.0 to 3.5
What is the minimum I need to add to a.NET 2.0 WebSite's web.config to make it.NET 3.5? Visual Studio adds all the config sections and script handlers, but if you aren't using those are they are really necessary? Is there a command line tool to "upgrade" a.NET 2.0 web.config to 3.5?
There is a good description of the 3.5 web.config available here: https://web.archive.org/web/20211020153237/https://www.4guysfromrolla.com/articles/121207-1.aspx The assemblies and config sections are important because they tell the runtime to use the new 3.5 dlls instead of the 2.0 dlls The codedom section tells the compiler to use 3.5. If you're not using ASP.Net Ajax you can probably skip the rest. I've never tested that though.
Convert Web.config from .NET 2.0 to 3.5 What is the minimum I need to add to a.NET 2.0 WebSite's web.config to make it.NET 3.5? Visual Studio adds all the config sections and script handlers, but if you aren't using those are they are really necessary? Is there a command line tool to "upgrade" a.NET 2.0 web.config to 3.5?
TITLE: Convert Web.config from .NET 2.0 to 3.5 QUESTION: What is the minimum I need to add to a.NET 2.0 WebSite's web.config to make it.NET 3.5? Visual Studio adds all the config sections and script handlers, but if you aren't using those are they are really necessary? Is there a command line tool to "upgrade" a.NET 2.0 web.config to 3.5? ANSWER: There is a good description of the 3.5 web.config available here: https://web.archive.org/web/20211020153237/https://www.4guysfromrolla.com/articles/121207-1.aspx The assemblies and config sections are important because they tell the runtime to use the new 3.5 dlls instead of the 2.0 dlls The codedom section tells the compiler to use 3.5. If you're not using ASP.Net Ajax you can probably skip the rest. I've never tested that though.
[ ".net", "asp.net", "configuration", "migration" ]
6
9
17,651
4
0
2008-08-29T04:15:24.190000
2008-08-29T04:36:43.890000
33,955
33,982
NHibernate SetTimeout on ICriteria
Could someone tell me what the units the SetTimeout(int) method in the ICriteria interface uses? Is it milliseconds, seconds, minutes or other?
A little bit of poking around suggests that it could be seconds: Assuming that ICriteria is the same as the Criteria interface in Hibernate core, then the JavaDoc for org.hibernate.Criteria provides a hint - the "see also" link to java.sql.Statement.setQueryTimeout(). The latter refers to its timeout parameter as seconds. Assuming that the NHibernate implementation follows the implied contract of that method, then that should be fine. However, for peace of mind's sake, I went and looked for some NHibernate specific stuff. There are various references to CommandTimeout; for example, here, related to NHibernate. Sure enough, the documentation for CommandTimeout states that it's seconds. I almost didn't post the above, because I don't know the answer outright, and can't find any concrete documentation - but since there is so little on the issue, I figured it couldn't hurt to present these findings.
NHibernate SetTimeout on ICriteria Could someone tell me what the units the SetTimeout(int) method in the ICriteria interface uses? Is it milliseconds, seconds, minutes or other?
TITLE: NHibernate SetTimeout on ICriteria QUESTION: Could someone tell me what the units the SetTimeout(int) method in the ICriteria interface uses? Is it milliseconds, seconds, minutes or other? ANSWER: A little bit of poking around suggests that it could be seconds: Assuming that ICriteria is the same as the Criteria interface in Hibernate core, then the JavaDoc for org.hibernate.Criteria provides a hint - the "see also" link to java.sql.Statement.setQueryTimeout(). The latter refers to its timeout parameter as seconds. Assuming that the NHibernate implementation follows the implied contract of that method, then that should be fine. However, for peace of mind's sake, I went and looked for some NHibernate specific stuff. There are various references to CommandTimeout; for example, here, related to NHibernate. Sure enough, the documentation for CommandTimeout states that it's seconds. I almost didn't post the above, because I don't know the answer outright, and can't find any concrete documentation - but since there is so little on the issue, I figured it couldn't hurt to present these findings.
[ "nhibernate" ]
25
28
10,008
2
0
2008-08-29T04:25:18.893000
2008-08-29T05:01:57.170000
33,960
33,967
How do you get the ethernet address using Java?
I would like to retrieve the ethernet address of the network interface that is used to access a particular website. How can this be done in Java? Solution Note that the accepted solution of getHardwareAddress is only available in Java 6. There does not seem to be a solution for Java 5 aside from executing i(f|p)confing.
java.net.NetworkInterface.getHardwareAddress (method added in Java 6) It has to be called on the machine you are interested in - the MAC is not transferred across network boundaries (i.e. LAN and WAN). If you want to make use of it on a website server to interrogate the clients, you'd have to run an applet that would report the result back to you. For Java 5 and older I found code parsing output of command line tools on various systems.
How do you get the ethernet address using Java? I would like to retrieve the ethernet address of the network interface that is used to access a particular website. How can this be done in Java? Solution Note that the accepted solution of getHardwareAddress is only available in Java 6. There does not seem to be a solution for Java 5 aside from executing i(f|p)confing.
TITLE: How do you get the ethernet address using Java? QUESTION: I would like to retrieve the ethernet address of the network interface that is used to access a particular website. How can this be done in Java? Solution Note that the accepted solution of getHardwareAddress is only available in Java 6. There does not seem to be a solution for Java 5 aside from executing i(f|p)confing. ANSWER: java.net.NetworkInterface.getHardwareAddress (method added in Java 6) It has to be called on the machine you are interested in - the MAC is not transferred across network boundaries (i.e. LAN and WAN). If you want to make use of it on a website server to interrogate the clients, you'd have to run an applet that would report the result back to you. For Java 5 and older I found code parsing output of command line tools on various systems.
[ "java", "networking", "ethernet" ]
21
18
5,231
3
0
2008-08-29T04:31:24.667000
2008-08-29T04:48:46.717000
33,969
1,318,059
Best way to implement request throttling in ASP.NET MVC?
We're experimenting with various ways to throttle user actions in a given time period: Limit question/answer posts Limit edits Limit feed retrievals For the time being, we're using the Cache to simply insert a record of user activity - if that record exists if/when the user does the same activity, we throttle. Using the Cache automatically gives us stale data cleaning and sliding activity windows of users, but how it will scale could be a problem. What are some other ways of ensuring that requests/user actions can be effectively throttled (emphasis on stability)?
Here's a generic version of what we've been using on Stack Overflow for the past year: /// /// Decorates any MVC route that needs to have client requests limited by time. /// /// /// Uses the current System.Web.Caching.Cache to store each client request to the decorated route. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class ThrottleAttribute: ActionFilterAttribute { /// /// A unique name for this Throttle. /// /// /// We'll be inserting a Cache record based on this name and client IP, e.g. "Name-192.168.0.1" /// public string Name { get; set; } /// /// The number of seconds clients must wait before executing this decorated route again. /// public int Seconds { get; set; } /// /// A text message that will be sent to the client upon throttling. You can include the token {n} to /// show this.Seconds in the message, e.g. "Wait {n} seconds before trying again". /// public string Message { get; set; } public override void OnActionExecuting(ActionExecutingContext c) { var key = string.Concat(Name, "-", c.HttpContext.Request.UserHostAddress); var allowExecute = false; if (HttpRuntime.Cache[key] == null) { HttpRuntime.Cache.Add(key, true, // is this the smallest data we can have? null, // no dependencies DateTime.Now.AddSeconds(Seconds), // absolute expiration Cache.NoSlidingExpiration, CacheItemPriority.Low, null); // no callback allowExecute = true; } if (!allowExecute) { if (String.IsNullOrEmpty(Message)) Message = "You may only perform this action every {n} seconds."; c.Result = new ContentResult { Content = Message.Replace("{n}", Seconds.ToString()) }; // see 409 - http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html c.HttpContext.Response.StatusCode = (int)HttpStatusCode.Conflict; } } } Sample usage: [Throttle(Name="TestThrottle", Message = "You must wait {n} seconds before accessing this url again.", Seconds = 5)] public ActionResult TestThrottle() { return Content("TestThrottle executed"); } The ASP.NET Cache works like a champ here - by using it, you get automatic clean-up of your throttle entries. And with our growing traffic, we're not seeing that this is an issue on the server. Feel free to give feedback on this method; when we make Stack Overflow better, you get your Ewok fix even faster:)
Best way to implement request throttling in ASP.NET MVC? We're experimenting with various ways to throttle user actions in a given time period: Limit question/answer posts Limit edits Limit feed retrievals For the time being, we're using the Cache to simply insert a record of user activity - if that record exists if/when the user does the same activity, we throttle. Using the Cache automatically gives us stale data cleaning and sliding activity windows of users, but how it will scale could be a problem. What are some other ways of ensuring that requests/user actions can be effectively throttled (emphasis on stability)?
TITLE: Best way to implement request throttling in ASP.NET MVC? QUESTION: We're experimenting with various ways to throttle user actions in a given time period: Limit question/answer posts Limit edits Limit feed retrievals For the time being, we're using the Cache to simply insert a record of user activity - if that record exists if/when the user does the same activity, we throttle. Using the Cache automatically gives us stale data cleaning and sliding activity windows of users, but how it will scale could be a problem. What are some other ways of ensuring that requests/user actions can be effectively throttled (emphasis on stability)? ANSWER: Here's a generic version of what we've been using on Stack Overflow for the past year: /// /// Decorates any MVC route that needs to have client requests limited by time. /// /// /// Uses the current System.Web.Caching.Cache to store each client request to the decorated route. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class ThrottleAttribute: ActionFilterAttribute { /// /// A unique name for this Throttle. /// /// /// We'll be inserting a Cache record based on this name and client IP, e.g. "Name-192.168.0.1" /// public string Name { get; set; } /// /// The number of seconds clients must wait before executing this decorated route again. /// public int Seconds { get; set; } /// /// A text message that will be sent to the client upon throttling. You can include the token {n} to /// show this.Seconds in the message, e.g. "Wait {n} seconds before trying again". /// public string Message { get; set; } public override void OnActionExecuting(ActionExecutingContext c) { var key = string.Concat(Name, "-", c.HttpContext.Request.UserHostAddress); var allowExecute = false; if (HttpRuntime.Cache[key] == null) { HttpRuntime.Cache.Add(key, true, // is this the smallest data we can have? null, // no dependencies DateTime.Now.AddSeconds(Seconds), // absolute expiration Cache.NoSlidingExpiration, CacheItemPriority.Low, null); // no callback allowExecute = true; } if (!allowExecute) { if (String.IsNullOrEmpty(Message)) Message = "You may only perform this action every {n} seconds."; c.Result = new ContentResult { Content = Message.Replace("{n}", Seconds.ToString()) }; // see 409 - http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html c.HttpContext.Response.StatusCode = (int)HttpStatusCode.Conflict; } } } Sample usage: [Throttle(Name="TestThrottle", Message = "You must wait {n} seconds before accessing this url again.", Seconds = 5)] public ActionResult TestThrottle() { return Content("TestThrottle executed"); } The ASP.NET Cache works like a champ here - by using it, you get automatic clean-up of your throttle entries. And with our growing traffic, we're not seeing that this is an issue on the server. Feel free to give feedback on this method; when we make Stack Overflow better, you get your Ewok fix even faster:)
[ "asp.net-mvc", "throttling" ]
229
259
66,255
6
0
2008-08-29T04:50:50.410000
2009-08-23T08:21:56.053000
33,971
33,983
Standardised text editing behaviour across Mac applications
I've switched over to a Mac recently and, although things have been going quite well, the very different text-editing behaviours across applications is driving me insane. Home, End, Page Up, Page Down, Apple-arrow, Ctrl-arrow, alt-arrow etc. quite often do different things depending on the application. Is there a way to standardise this behaviour?
There are standards, but they are not based around what you're used to from windows. It drove me mad until I got over myself and decided to learn what the actual standards were. Since then I've been sold. The ones I use: Command - Left / Right - Jump to start/end of line Can also do this with ctrl - a / e which is great if you're used to ssh Command - Up / Down - Jump to top/bottom of text field or document Option - Left / Right - Jump to start/end of word or previous/next word These basically replace home / end / pgup / pgdown, and ctrl - left / right from the windows world. I find this to be a massive win due to the fact I have a macbook pro and almost no laptops have proper home / end / pgup / pgdown keys - not needing them in OSX is a godsend Here's a big list of the rest of them
Standardised text editing behaviour across Mac applications I've switched over to a Mac recently and, although things have been going quite well, the very different text-editing behaviours across applications is driving me insane. Home, End, Page Up, Page Down, Apple-arrow, Ctrl-arrow, alt-arrow etc. quite often do different things depending on the application. Is there a way to standardise this behaviour?
TITLE: Standardised text editing behaviour across Mac applications QUESTION: I've switched over to a Mac recently and, although things have been going quite well, the very different text-editing behaviours across applications is driving me insane. Home, End, Page Up, Page Down, Apple-arrow, Ctrl-arrow, alt-arrow etc. quite often do different things depending on the application. Is there a way to standardise this behaviour? ANSWER: There are standards, but they are not based around what you're used to from windows. It drove me mad until I got over myself and decided to learn what the actual standards were. Since then I've been sold. The ones I use: Command - Left / Right - Jump to start/end of line Can also do this with ctrl - a / e which is great if you're used to ssh Command - Up / Down - Jump to top/bottom of text field or document Option - Left / Right - Jump to start/end of word or previous/next word These basically replace home / end / pgup / pgdown, and ctrl - left / right from the windows world. I find this to be a massive win due to the fact I have a macbook pro and almost no laptops have proper home / end / pgup / pgdown keys - not needing them in OSX is a godsend Here's a big list of the rest of them
[ "macos", "keyboard-shortcuts" ]
3
6
206
2
0
2008-08-29T04:52:38.267000
2008-08-29T05:06:09.687000
33,973
33,984
How do I efficiently keep track of the smallest element in a collection?
In the vein of programming questions: suppose there's a collection of objects that can be compared to each other and sorted. What's the most efficient way to keep track of the smallest element in the collection as objects are added and the current smallest occasionally removed?
Using a min-heap is the best way. http://en.wikipedia.org/wiki/Heap_(data_structure) It is tailor made for this application.
How do I efficiently keep track of the smallest element in a collection? In the vein of programming questions: suppose there's a collection of objects that can be compared to each other and sorted. What's the most efficient way to keep track of the smallest element in the collection as objects are added and the current smallest occasionally removed?
TITLE: How do I efficiently keep track of the smallest element in a collection? QUESTION: In the vein of programming questions: suppose there's a collection of objects that can be compared to each other and sorted. What's the most efficient way to keep track of the smallest element in the collection as objects are added and the current smallest occasionally removed? ANSWER: Using a min-heap is the best way. http://en.wikipedia.org/wiki/Heap_(data_structure) It is tailor made for this application.
[ "data-structures", "collections" ]
4
6
1,693
7
0
2008-08-29T04:54:09.247000
2008-08-29T05:07:49.027000
33,976
34,169
Microsoft Office 2007 automated installation - editing the config.xml file
I'm creating an automated installation of Office 2007. To customise your Office 2007 installation the Office Customization Tool (OCT) does most of the work for you. One the OCT's features is the ability to run additional programs during the Office installation. However it is pretty poor at it. Fortunately by editing the appropiate config.xml file contained within the installer files you have more control over running these additional programs. Within the config.xml file this feature is defined by the command element. This link on TechNet talks all about it. In this documentation it states: Attributes You can specify double-quotation marks (") in the Path and Args attributes by specifying two double-quotation marks together (""). I would like to use double-quotation marks in an argument that I wish to pass to the command I'm executing. Unfortunately when I configure my config.xml file as shown in the example, the Office 2007 installer crashes and displays the following error message in the setup logs: Parsing config.xml at: \\aumel1pc356\c$\Documents and Settings\nichollsd2\Desktop\source\office\Enterprise.WW\config.xml Error: XML document load failed for file: \\aumel1pc356\c$\Documents and Settings\nichollsd2\Desktop\source\office\Enterprise.WW\config.xml HResult: 0x1. Does anyone have any experience with this issue? I'd love to get another perspective on it.
In standard XML you embed quotes in attribute values using ", &34; or . See the page on Wikipedia for a list of XML entity references. I don't know if this will solve your problem, but seeing as it is an XML parser error it should.
Microsoft Office 2007 automated installation - editing the config.xml file I'm creating an automated installation of Office 2007. To customise your Office 2007 installation the Office Customization Tool (OCT) does most of the work for you. One the OCT's features is the ability to run additional programs during the Office installation. However it is pretty poor at it. Fortunately by editing the appropiate config.xml file contained within the installer files you have more control over running these additional programs. Within the config.xml file this feature is defined by the command element. This link on TechNet talks all about it. In this documentation it states: Attributes You can specify double-quotation marks (") in the Path and Args attributes by specifying two double-quotation marks together (""). I would like to use double-quotation marks in an argument that I wish to pass to the command I'm executing. Unfortunately when I configure my config.xml file as shown in the example, the Office 2007 installer crashes and displays the following error message in the setup logs: Parsing config.xml at: \\aumel1pc356\c$\Documents and Settings\nichollsd2\Desktop\source\office\Enterprise.WW\config.xml Error: XML document load failed for file: \\aumel1pc356\c$\Documents and Settings\nichollsd2\Desktop\source\office\Enterprise.WW\config.xml HResult: 0x1. Does anyone have any experience with this issue? I'd love to get another perspective on it.
TITLE: Microsoft Office 2007 automated installation - editing the config.xml file QUESTION: I'm creating an automated installation of Office 2007. To customise your Office 2007 installation the Office Customization Tool (OCT) does most of the work for you. One the OCT's features is the ability to run additional programs during the Office installation. However it is pretty poor at it. Fortunately by editing the appropiate config.xml file contained within the installer files you have more control over running these additional programs. Within the config.xml file this feature is defined by the command element. This link on TechNet talks all about it. In this documentation it states: Attributes You can specify double-quotation marks (") in the Path and Args attributes by specifying two double-quotation marks together (""). I would like to use double-quotation marks in an argument that I wish to pass to the command I'm executing. Unfortunately when I configure my config.xml file as shown in the example, the Office 2007 installer crashes and displays the following error message in the setup logs: Parsing config.xml at: \\aumel1pc356\c$\Documents and Settings\nichollsd2\Desktop\source\office\Enterprise.WW\config.xml Error: XML document load failed for file: \\aumel1pc356\c$\Documents and Settings\nichollsd2\Desktop\source\office\Enterprise.WW\config.xml HResult: 0x1. Does anyone have any experience with this issue? I'd love to get another perspective on it. ANSWER: In standard XML you embed quotes in attribute values using ", &34; or . See the page on Wikipedia for a list of XML entity references. I don't know if this will solve your problem, but seeing as it is an XML parser error it should.
[ "xml", "installation", "packaging", "office-2007" ]
3
2
6,060
1
0
2008-08-29T04:57:32.547000
2008-08-29T08:14:32.870000
33,978
35,645
Find out how much memory is being used by an object in Python
How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want.
There's no easy way to find out the memory size of a python object. One of the problems you may find is that Python objects - like lists and dicts - may have references to other python objects (in this case, what would your size be? The size containing the size of each object or not?). There are some pointers overhead and internal structures related to object types and garbage collection. Finally, some python objects have non-obvious behaviors. For instance, lists reserve space for more objects than they have, most of the time; dicts are even more complicated since they can operate in different ways (they have a different implementation for small number of keys and sometimes they over allocate entries). There is a big chunk of code (and an updated big chunk of code ) out there to try to best approximate the size of a python object in memory. You may also want to check some old description about PyObject (the internal C struct that represents virtually all python objects).
Find out how much memory is being used by an object in Python How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want.
TITLE: Find out how much memory is being used by an object in Python QUESTION: How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want. ANSWER: There's no easy way to find out the memory size of a python object. One of the problems you may find is that Python objects - like lists and dicts - may have references to other python objects (in this case, what would your size be? The size containing the size of each object or not?). There are some pointers overhead and internal structures related to object types and garbage collection. Finally, some python objects have non-obvious behaviors. For instance, lists reserve space for more objects than they have, most of the time; dicts are even more complicated since they can operate in different ways (they have a different implementation for small number of keys and sometimes they over allocate entries). There is a big chunk of code (and an updated big chunk of code ) out there to try to best approximate the size of a python object in memory. You may also want to check some old description about PyObject (the internal C struct that represents virtually all python objects).
[ "python", "performance", "memory-profiling" ]
317
163
290,204
5
0
2008-08-29T04:59:31.200000
2008-08-30T03:25:43.557000
33,990
34,074
Can't create a subversion repository with Eclipse 3.4.0, svn 1.5.1
I'm working on mac OS x 10.4. I have a subversion repository stored on an external drive connected via USB. I created a new python project in Eclipse (using the PyDev plugin). When I use right click Team->Share Project to set up a new project with subversion, I get the following error: Error while creating module: org.tigris.subversion.javahl.ClientException: Couldn't open a repository svn: Unable to open ra_local session to URL svn: Unable to open repository 'file:///Volumes/svn-repos/Palindrome/Palindrome' The subversion repository has the following permissions: drwxrwxrwx 9 cameronl cameronl 306 Aug 23 10:08 svn-repos The external drive is formatted as Mac OS extended I'm completely stumped. Anybody have any suggestions?
Try adding the repository first using the "SVN Repository Exploring" perspective (Window > Open Perspective > Other... > SVN Repository Exploring). Make sure that the URL you are using points to the correct directory, which typically contains these default repository files: conf/ dav/ db/ format hooks/ locks/ README.txt Hope this helps.
Can't create a subversion repository with Eclipse 3.4.0, svn 1.5.1 I'm working on mac OS x 10.4. I have a subversion repository stored on an external drive connected via USB. I created a new python project in Eclipse (using the PyDev plugin). When I use right click Team->Share Project to set up a new project with subversion, I get the following error: Error while creating module: org.tigris.subversion.javahl.ClientException: Couldn't open a repository svn: Unable to open ra_local session to URL svn: Unable to open repository 'file:///Volumes/svn-repos/Palindrome/Palindrome' The subversion repository has the following permissions: drwxrwxrwx 9 cameronl cameronl 306 Aug 23 10:08 svn-repos The external drive is formatted as Mac OS extended I'm completely stumped. Anybody have any suggestions?
TITLE: Can't create a subversion repository with Eclipse 3.4.0, svn 1.5.1 QUESTION: I'm working on mac OS x 10.4. I have a subversion repository stored on an external drive connected via USB. I created a new python project in Eclipse (using the PyDev plugin). When I use right click Team->Share Project to set up a new project with subversion, I get the following error: Error while creating module: org.tigris.subversion.javahl.ClientException: Couldn't open a repository svn: Unable to open ra_local session to URL svn: Unable to open repository 'file:///Volumes/svn-repos/Palindrome/Palindrome' The subversion repository has the following permissions: drwxrwxrwx 9 cameronl cameronl 306 Aug 23 10:08 svn-repos The external drive is formatted as Mac OS extended I'm completely stumped. Anybody have any suggestions? ANSWER: Try adding the repository first using the "SVN Repository Exploring" perspective (Window > Open Perspective > Other... > SVN Repository Exploring). Make sure that the URL you are using points to the correct directory, which typically contains these default repository files: conf/ dav/ db/ format hooks/ locks/ README.txt Hope this helps.
[ "eclipse", "svn", "macos" ]
4
2
5,726
1
0
2008-08-29T05:12:07.613000
2008-08-29T06:51:48.077000
34,009
34,035
Tool for querying databases
I want to query a number of different databases mainly Oracle and Informix. Can anyone suggest me some tool using which I can do this easily?
Try WinSQL lite at http://www.indus-soft.com/SynametricsWebApp/WinSQL.jsp. It is absolutely free and does not expire. It is only one file and does not come with any bulky DLLs. If you don't like it, simply delete the file from your hard drive. An introduction about how to use it against an informix database can be found in this article.
Tool for querying databases I want to query a number of different databases mainly Oracle and Informix. Can anyone suggest me some tool using which I can do this easily?
TITLE: Tool for querying databases QUESTION: I want to query a number of different databases mainly Oracle and Informix. Can anyone suggest me some tool using which I can do this easily? ANSWER: Try WinSQL lite at http://www.indus-soft.com/SynametricsWebApp/WinSQL.jsp. It is absolutely free and does not expire. It is only one file and does not come with any bulky DLLs. If you don't like it, simply delete the file from your hard drive. An introduction about how to use it against an informix database can be found in this article.
[ "database" ]
0
5
1,129
12
0
2008-08-29T05:31:38.767000
2008-08-29T06:05:58.980000
34,015
34,054
php scripts writing to non-world-writable files
How can you allow a PHP script to write to a file with high-security restrictions, such as only allowing a single user to write to it? The difficulty seems to be that a PHP script is running as a low-permissions user (maybe apache, or www, or nobody?), and even if I chown apache the_writable_file, the directory it's in might not be writable for the low-level user. In general, what's the usual way that PHP can work with local files in a secure way?
Unfortunately, in shared hosts that use mod_php, there is no way to restrict access to secure files to your web app and login user. The solution is to run your web app as your login user. When you do that, UNIX file permissions can correctly lock everyone else out. There are several ways to implement that, including SuExec, suPHP, or running PHP with FastCGI with mod_fcgid or mod_proxy_fcgid. FastCGI is my favorite way. Another solution is to use a dedicated host or virtual private server.
php scripts writing to non-world-writable files How can you allow a PHP script to write to a file with high-security restrictions, such as only allowing a single user to write to it? The difficulty seems to be that a PHP script is running as a low-permissions user (maybe apache, or www, or nobody?), and even if I chown apache the_writable_file, the directory it's in might not be writable for the low-level user. In general, what's the usual way that PHP can work with local files in a secure way?
TITLE: php scripts writing to non-world-writable files QUESTION: How can you allow a PHP script to write to a file with high-security restrictions, such as only allowing a single user to write to it? The difficulty seems to be that a PHP script is running as a low-permissions user (maybe apache, or www, or nobody?), and even if I chown apache the_writable_file, the directory it's in might not be writable for the low-level user. In general, what's the usual way that PHP can work with local files in a secure way? ANSWER: Unfortunately, in shared hosts that use mod_php, there is no way to restrict access to secure files to your web app and login user. The solution is to run your web app as your login user. When you do that, UNIX file permissions can correctly lock everyone else out. There are several ways to implement that, including SuExec, suPHP, or running PHP with FastCGI with mod_fcgid or mod_proxy_fcgid. FastCGI is my favorite way. Another solution is to use a dedicated host or virtual private server.
[ "php", "permissions" ]
2
2
925
3
0
2008-08-29T05:36:19.333000
2008-08-29T06:29:43.977000
34,019
34,091
Install the Radrails plugin for Aptana Studio offline
I downloaded and installed the Aptana Studio free version. But apparently, to install the Radrails plugin for ruby on rails development you have to connect to the internet. I don't have internet on my machine right now. So is there a way I could download the installer from another machine and copy it over my existing Aptana installation? Update: Found a link for download here (Access denied now)
I wrote down my duel with Aptana Rails - See if this helps you. There is a link on manual installation that may be what you're looking for.
Install the Radrails plugin for Aptana Studio offline I downloaded and installed the Aptana Studio free version. But apparently, to install the Radrails plugin for ruby on rails development you have to connect to the internet. I don't have internet on my machine right now. So is there a way I could download the installer from another machine and copy it over my existing Aptana installation? Update: Found a link for download here (Access denied now)
TITLE: Install the Radrails plugin for Aptana Studio offline QUESTION: I downloaded and installed the Aptana Studio free version. But apparently, to install the Radrails plugin for ruby on rails development you have to connect to the internet. I don't have internet on my machine right now. So is there a way I could download the installer from another machine and copy it over my existing Aptana installation? Update: Found a link for download here (Access denied now) ANSWER: I wrote down my duel with Aptana Rails - See if this helps you. There is a link on manual installation that may be what you're looking for.
[ "ruby-on-rails", "aptana", "radrails" ]
4
3
5,484
2
0
2008-08-29T05:43:06.273000
2008-08-29T07:09:27.317000
34,020
34,060
Are Python threads buggy?
A reliable coder friend told me that Python's current multi-threading implementation is seriously buggy - enough to avoid using altogether. What can said about this rumor?
Python threads are good for concurrent I/O programming. Threads are swapped out of the CPU as soon as they block waiting for input from file, network, etc. This allows other Python threads to use the CPU while others wait. This would allow you to write a multi-threaded web server or web crawler, for example. However, Python threads are serialized by the GIL when they enter interpreter core. This means that if two threads are crunching numbers, only one can run at any given moment. It also means that you can't take advantage of multi-core or multi-processor architectures. There are solutions like running multiple Python interpreters concurrently, using a C based threading library. This is not for the faint of heart and the benefits might not be worth the trouble. Let's hope for an all Python solution in a future release.
Are Python threads buggy? A reliable coder friend told me that Python's current multi-threading implementation is seriously buggy - enough to avoid using altogether. What can said about this rumor?
TITLE: Are Python threads buggy? QUESTION: A reliable coder friend told me that Python's current multi-threading implementation is seriously buggy - enough to avoid using altogether. What can said about this rumor? ANSWER: Python threads are good for concurrent I/O programming. Threads are swapped out of the CPU as soon as they block waiting for input from file, network, etc. This allows other Python threads to use the CPU while others wait. This would allow you to write a multi-threaded web server or web crawler, for example. However, Python threads are serialized by the GIL when they enter interpreter core. This means that if two threads are crunching numbers, only one can run at any given moment. It also means that you can't take advantage of multi-core or multi-processor architectures. There are solutions like running multiple Python interpreters concurrently, using a C based threading library. This is not for the faint of heart and the benefits might not be worth the trouble. Let's hope for an all Python solution in a future release.
[ "python", "multithreading" ]
28
58
12,612
6
0
2008-08-29T05:43:16.960000
2008-08-29T06:33:54.780000
34,023
34,052
How to embed control change commands inside of a MIDI file
I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not play again when the song loops.) I am having a tough time finding information on how to modify existing MIDI files so that they may send a control change signal to the synthesizer. Has anyone had experience with this? I think that I should have been more clear with my original question. I am using an existing game engine which takes care of playing the music. I am under the impression that this control change value must be embedded directly in the MIDI file itself as I have no control over the synthesizer. From the manual: MIDI files are played via the DirectMusic Synthesizer. If a BGM MIDI file contains the control change value 111, that value is recognized as where the song will start repeating after it reaches the end. I wish I could do it programmatically. I suppose what I am after here is some sort of editor which will allow me to modify the MIDI file that I already have.
DirectMusicProducer is probably your best free option if you are playing using DirectMusic. I don't believe the MIDI record feature will include control changes, but your engine may support playing segment files which are much more flexible. The only MIDI sequencer I use cost around $300 (USD) about 10 years ago (and no longer appears to exist), but I am not aware of any good quality free MIDI file sequencers. (Note that "MIDI editor" is probably different to "MIDI file editor" or "MIDI sequencer")
How to embed control change commands inside of a MIDI file I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not play again when the song loops.) I am having a tough time finding information on how to modify existing MIDI files so that they may send a control change signal to the synthesizer. Has anyone had experience with this? I think that I should have been more clear with my original question. I am using an existing game engine which takes care of playing the music. I am under the impression that this control change value must be embedded directly in the MIDI file itself as I have no control over the synthesizer. From the manual: MIDI files are played via the DirectMusic Synthesizer. If a BGM MIDI file contains the control change value 111, that value is recognized as where the song will start repeating after it reaches the end. I wish I could do it programmatically. I suppose what I am after here is some sort of editor which will allow me to modify the MIDI file that I already have.
TITLE: How to embed control change commands inside of a MIDI file QUESTION: I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not play again when the song loops.) I am having a tough time finding information on how to modify existing MIDI files so that they may send a control change signal to the synthesizer. Has anyone had experience with this? I think that I should have been more clear with my original question. I am using an existing game engine which takes care of playing the music. I am under the impression that this control change value must be embedded directly in the MIDI file itself as I have no control over the synthesizer. From the manual: MIDI files are played via the DirectMusic Synthesizer. If a BGM MIDI file contains the control change value 111, that value is recognized as where the song will start repeating after it reaches the end. I wish I could do it programmatically. I suppose what I am after here is some sort of editor which will allow me to modify the MIDI file that I already have. ANSWER: DirectMusicProducer is probably your best free option if you are playing using DirectMusic. I don't believe the MIDI record feature will include control changes, but your engine may support playing segment files which are much more flexible. The only MIDI sequencer I use cost around $300 (USD) about 10 years ago (and no longer appears to exist), but I am not aware of any good quality free MIDI file sequencers. (Note that "MIDI editor" is probably different to "MIDI file editor" or "MIDI sequencer")
[ "midi" ]
1
2
989
3
0
2008-08-29T05:49:05.840000
2008-08-29T06:25:28.043000
34,059
34,152
What is the difference between Build Solution and Batch Build in Visual Studio 2008?
What is the difference between Build Solution and Batch Build in Visual Studio 2008?
The key point which seems to be missed in both the existing answers is that batch build allows you to build multiple configurations of each project (e.g. you can build debug and release configurations with a single operation). With a normal build, you have to use the configuration manager to select just one configuration for each project.
What is the difference between Build Solution and Batch Build in Visual Studio 2008? What is the difference between Build Solution and Batch Build in Visual Studio 2008?
TITLE: What is the difference between Build Solution and Batch Build in Visual Studio 2008? QUESTION: What is the difference between Build Solution and Batch Build in Visual Studio 2008? ANSWER: The key point which seems to be missed in both the existing answers is that batch build allows you to build multiple configurations of each project (e.g. you can build debug and release configurations with a single operation). With a normal build, you have to use the configuration manager to select just one configuration for each project.
[ "visual-studio", "build" ]
15
23
19,830
5
0
2008-08-29T06:33:28.930000
2008-08-29T08:02:08.937000
34,065
35,717
How to read a value from the Windows registry
Given the key for some registry value (e.g. HKEY_LOCAL_MACHINE\blah\blah\blah\foo) how can I: Safely determine that such a key exists. Programmatically (i.e. with code) get its value. I have absolutely no intention of writing anything back to the registry (for the duration of my career if I can help it). So we can skip the lecture about every molecule in my body exploding at the speed of light if I write to the registry incorrectly. Prefer answers in C++, but mostly just need to know what the special Windows API incantation to get at the value is.
Here is some pseudo-code to retrieve the following: If a registry key exists What the default value is for that registry key What a string value is What a DWORD value is Example code: Include the library dependency: Advapi32.lib HKEY hKey; LONG lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Perl", 0, KEY_READ, &hKey); bool bExistsAndSuccess (lRes == ERROR_SUCCESS); bool bDoesNotExistsSpecifically (lRes == ERROR_FILE_NOT_FOUND); std::wstring strValueOfBinDir; std::wstring strKeyDefaultValue; GetStringRegKey(hKey, L"BinDir", strValueOfBinDir, L"bad"); GetStringRegKey(hKey, L"", strKeyDefaultValue, L"bad"); LONG GetDWORDRegKey(HKEY hKey, const std::wstring &strValueName, DWORD &nValue, DWORD nDefaultValue) { nValue = nDefaultValue; DWORD dwBufferSize(sizeof(DWORD)); DWORD nResult(0); LONG nError =::RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, reinterpret_cast (&nResult), &dwBufferSize); if (ERROR_SUCCESS == nError) { nValue = nResult; } return nError; } LONG GetBoolRegKey(HKEY hKey, const std::wstring &strValueName, bool &bValue, bool bDefaultValue) { DWORD nDefValue((bDefaultValue)? 1: 0); DWORD nResult(nDefValue); LONG nError = GetDWORDRegKey(hKey, strValueName.c_str(), nResult, nDefValue); if (ERROR_SUCCESS == nError) { bValue = (nResult!= 0)? true: false; } return nError; } LONG GetStringRegKey(HKEY hKey, const std::wstring &strValueName, std::wstring &strValue, const std::wstring &strDefaultValue) { strValue = strDefaultValue; WCHAR szBuffer[512]; DWORD dwBufferSize = sizeof(szBuffer); ULONG nError; nError = RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, (LPBYTE)szBuffer, &dwBufferSize); if (ERROR_SUCCESS == nError) { strValue = szBuffer; } return nError; }
How to read a value from the Windows registry Given the key for some registry value (e.g. HKEY_LOCAL_MACHINE\blah\blah\blah\foo) how can I: Safely determine that such a key exists. Programmatically (i.e. with code) get its value. I have absolutely no intention of writing anything back to the registry (for the duration of my career if I can help it). So we can skip the lecture about every molecule in my body exploding at the speed of light if I write to the registry incorrectly. Prefer answers in C++, but mostly just need to know what the special Windows API incantation to get at the value is.
TITLE: How to read a value from the Windows registry QUESTION: Given the key for some registry value (e.g. HKEY_LOCAL_MACHINE\blah\blah\blah\foo) how can I: Safely determine that such a key exists. Programmatically (i.e. with code) get its value. I have absolutely no intention of writing anything back to the registry (for the duration of my career if I can help it). So we can skip the lecture about every molecule in my body exploding at the speed of light if I write to the registry incorrectly. Prefer answers in C++, but mostly just need to know what the special Windows API incantation to get at the value is. ANSWER: Here is some pseudo-code to retrieve the following: If a registry key exists What the default value is for that registry key What a string value is What a DWORD value is Example code: Include the library dependency: Advapi32.lib HKEY hKey; LONG lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Perl", 0, KEY_READ, &hKey); bool bExistsAndSuccess (lRes == ERROR_SUCCESS); bool bDoesNotExistsSpecifically (lRes == ERROR_FILE_NOT_FOUND); std::wstring strValueOfBinDir; std::wstring strKeyDefaultValue; GetStringRegKey(hKey, L"BinDir", strValueOfBinDir, L"bad"); GetStringRegKey(hKey, L"", strKeyDefaultValue, L"bad"); LONG GetDWORDRegKey(HKEY hKey, const std::wstring &strValueName, DWORD &nValue, DWORD nDefaultValue) { nValue = nDefaultValue; DWORD dwBufferSize(sizeof(DWORD)); DWORD nResult(0); LONG nError =::RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, reinterpret_cast (&nResult), &dwBufferSize); if (ERROR_SUCCESS == nError) { nValue = nResult; } return nError; } LONG GetBoolRegKey(HKEY hKey, const std::wstring &strValueName, bool &bValue, bool bDefaultValue) { DWORD nDefValue((bDefaultValue)? 1: 0); DWORD nResult(nDefValue); LONG nError = GetDWORDRegKey(hKey, strValueName.c_str(), nResult, nDefValue); if (ERROR_SUCCESS == nError) { bValue = (nResult!= 0)? true: false; } return nError; } LONG GetStringRegKey(HKEY hKey, const std::wstring &strValueName, std::wstring &strValue, const std::wstring &strDefaultValue) { strValue = strDefaultValue; WCHAR szBuffer[512]; DWORD dwBufferSize = sizeof(szBuffer); ULONG nError; nError = RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, (LPBYTE)szBuffer, &dwBufferSize); if (ERROR_SUCCESS == nError) { strValue = szBuffer; } return nError; }
[ "c++", "windows", "winapi", "registry" ]
104
84
186,467
8
0
2008-08-29T06:40:21.333000
2008-08-30T05:51:31.757000
34,076
34,096
Checking if userinput is a valid URI in XUL
Is there a built-in function/method that can check if a given string is a valid URI or not in the Mozilla XUL toolkit? I have looked for one but found none, but since this is my first time using XUL and its documentation it could be that I just overlooked it. So I'm just making sure before I start writing my own IsValidURI function.
The nsIIOService.newURI(...) method is what you're looking for. It throws NS_ERROR_MALFORMED_URI if the URI string is invalid. Example: try { var ioServ = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var uriObj = ioServ.newURI(uriString, uriCharset, baseURI); } catch (e) { // catch the error here }
Checking if userinput is a valid URI in XUL Is there a built-in function/method that can check if a given string is a valid URI or not in the Mozilla XUL toolkit? I have looked for one but found none, but since this is my first time using XUL and its documentation it could be that I just overlooked it. So I'm just making sure before I start writing my own IsValidURI function.
TITLE: Checking if userinput is a valid URI in XUL QUESTION: Is there a built-in function/method that can check if a given string is a valid URI or not in the Mozilla XUL toolkit? I have looked for one but found none, but since this is my first time using XUL and its documentation it could be that I just overlooked it. So I'm just making sure before I start writing my own IsValidURI function. ANSWER: The nsIIOService.newURI(...) method is what you're looking for. It throws NS_ERROR_MALFORMED_URI if the URI string is invalid. Example: try { var ioServ = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var uriObj = ioServ.newURI(uriString, uriCharset, baseURI); } catch (e) { // catch the error here }
[ "javascript", "validation", "firefox", "xul" ]
6
4
362
1
0
2008-08-29T06:54:07.913000
2008-08-29T07:10:49.590000
34,087
34,114
Dividing a list of nodes in half
foo bar My list has 12 nodes, but the second list is always 8 and the first is always 4. What's wrong with my selects?
When you do count(*), the current node is the node element being processed. You want either count(current()/node) or last() (preferable), or just calculate the midpoint to a variable for better performance and clearer code: foo bar
Dividing a list of nodes in half foo bar My list has 12 nodes, but the second list is always 8 and the first is always 4. What's wrong with my selects?
TITLE: Dividing a list of nodes in half QUESTION: foo bar My list has 12 nodes, but the second list is always 8 and the first is always 4. What's wrong with my selects? ANSWER: When you do count(*), the current node is the node element being processed. You want either count(current()/node) or last() (preferable), or just calculate the midpoint to a variable for better performance and clearer code: foo bar
[ "xml", "xslt" ]
4
7
2,805
4
0
2008-08-29T07:03:42.820000
2008-08-29T07:28:45.817000
34,093
34,095
How to apply an XSLT Stylesheet in C#
I want to apply an XSLT Stylesheet to an XML Document using C# and write the output to a File.
I found a possible answer here: http://web.archive.org/web/20130329123237/http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=63 From the article: XPathDocument myXPathDoc = new XPathDocument(myXmlFile); XslTransform myXslTrans = new XslTransform(); myXslTrans.Load(myStyleSheet); XmlTextWriter myWriter = new XmlTextWriter("result.html",null); myXslTrans.Transform(myXPathDoc,null,myWriter); Edit: But my trusty compiler says, XslTransform is obsolete: Use XslCompiledTransform instead: XPathDocument myXPathDoc = new XPathDocument(myXmlFile); XslCompiledTransform myXslTrans = new XslCompiledTransform(); myXslTrans.Load(myStyleSheet); XmlTextWriter myWriter = new XmlTextWriter("result.html",null); myXslTrans.Transform(myXPathDoc,null,myWriter);
How to apply an XSLT Stylesheet in C# I want to apply an XSLT Stylesheet to an XML Document using C# and write the output to a File.
TITLE: How to apply an XSLT Stylesheet in C# QUESTION: I want to apply an XSLT Stylesheet to an XML Document using C# and write the output to a File. ANSWER: I found a possible answer here: http://web.archive.org/web/20130329123237/http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=63 From the article: XPathDocument myXPathDoc = new XPathDocument(myXmlFile); XslTransform myXslTrans = new XslTransform(); myXslTrans.Load(myStyleSheet); XmlTextWriter myWriter = new XmlTextWriter("result.html",null); myXslTrans.Transform(myXPathDoc,null,myWriter); Edit: But my trusty compiler says, XslTransform is obsolete: Use XslCompiledTransform instead: XPathDocument myXPathDoc = new XPathDocument(myXmlFile); XslCompiledTransform myXslTrans = new XslCompiledTransform(); myXslTrans.Load(myStyleSheet); XmlTextWriter myWriter = new XmlTextWriter("result.html",null); myXslTrans.Transform(myXPathDoc,null,myWriter);
[ "c#", "xml", "xslt" ]
204
187
150,989
5
0
2008-08-29T07:10:31.260000
2008-08-29T07:10:36.953000
34,109
502,997
MS WF state machine workflows and MS CRM Dynamics 4.0
MS CRM Dynamics 4.0 incorporates the MS WF engine. The built in designer allows the creation of sequential workflows whos activities have native access to CRM entities. Is it possible to: Create a state machine workflow outside of CRM (i.e. in visual studio) and import it into CRM? Have this workflow access the CRM entities?
It is NOT possible to create a state machine workflow for use in MSCRM. It is also not supported to create any workflow outside of MSCRM and import it. As a work around you could write either all the logic you need into a custom workflow activity and import that into MSCRM and have it called from a normal workflow. The other option is build a seperate application which runs a state machine workflow and interacts with MSCRM via the web services. You could (would need to?) combine this with a custom workflow activity to kick off processes.
MS WF state machine workflows and MS CRM Dynamics 4.0 MS CRM Dynamics 4.0 incorporates the MS WF engine. The built in designer allows the creation of sequential workflows whos activities have native access to CRM entities. Is it possible to: Create a state machine workflow outside of CRM (i.e. in visual studio) and import it into CRM? Have this workflow access the CRM entities?
TITLE: MS WF state machine workflows and MS CRM Dynamics 4.0 QUESTION: MS CRM Dynamics 4.0 incorporates the MS WF engine. The built in designer allows the creation of sequential workflows whos activities have native access to CRM entities. Is it possible to: Create a state machine workflow outside of CRM (i.e. in visual studio) and import it into CRM? Have this workflow access the CRM entities? ANSWER: It is NOT possible to create a state machine workflow for use in MSCRM. It is also not supported to create any workflow outside of MSCRM and import it. As a work around you could write either all the logic you need into a custom workflow activity and import that into MSCRM and have it called from a normal workflow. The other option is build a seperate application which runs a state machine workflow and interacts with MSCRM via the web services. You could (would need to?) combine this with a custom workflow activity to kick off processes.
[ "workflow", "workflow-foundation", "dynamics-crm", "crm" ]
6
6
1,381
3
0
2008-08-29T07:22:46.970000
2009-02-02T12:12:01.147000
34,112
34,146
VS2008: Copy Web Site from command line
How do I execute the "Copy Web Site" command for an ASP.NET project in VS2008 from the command line? If I need to script this, let me have some pointers on where I can learn that.
Would this help you get started? Walkthrough: Deploying an ASP.NET Web Application Using XCOPY
VS2008: Copy Web Site from command line How do I execute the "Copy Web Site" command for an ASP.NET project in VS2008 from the command line? If I need to script this, let me have some pointers on where I can learn that.
TITLE: VS2008: Copy Web Site from command line QUESTION: How do I execute the "Copy Web Site" command for an ASP.NET project in VS2008 from the command line? If I need to script this, let me have some pointers on where I can learn that. ANSWER: Would this help you get started? Walkthrough: Deploying an ASP.NET Web Application Using XCOPY
[ "asp.net", "visual-studio-2008", "command-line" ]
2
4
604
1
0
2008-08-29T07:28:08.097000
2008-08-29T07:57:43.457000
34,120
34,145
HTML Scraping in Php
I've been doing some HTML scraping in PHP using regular expressions. This works, but the result is finicky and fragile. Has anyone used any packages that provide a more robust solution? A config driven solution would be ideal, but I'm not picky.
I would recomend PHP Simple HTML DOM Parser after you have scraped the HTML from the page. It supports invalid HTML, and provides a very easy way to handle HTML elements.
HTML Scraping in Php I've been doing some HTML scraping in PHP using regular expressions. This works, but the result is finicky and fragile. Has anyone used any packages that provide a more robust solution? A config driven solution would be ideal, but I'm not picky.
TITLE: HTML Scraping in Php QUESTION: I've been doing some HTML scraping in PHP using regular expressions. This works, but the result is finicky and fragile. Has anyone used any packages that provide a more robust solution? A config driven solution would be ideal, but I'm not picky. ANSWER: I would recomend PHP Simple HTML DOM Parser after you have scraped the HTML from the page. It supports invalid HTML, and provides a very easy way to handle HTML elements.
[ "php", "html", "screen-scraping" ]
39
28
45,817
7
0
2008-08-29T07:32:15.217000
2008-08-29T07:55:42.710000
34,125
34,129
Which, if any, C++ compilers do tail-recursion optimization?
It seems to me that it would work perfectly well to do tail-recursion optimization in both C and C++, yet while debugging I never seem to see a frame stack that indicates this optimization. That is kind of good, because the stack tells me how deep the recursion is. However, the optimization would be kind of nice as well. Do any C++ compilers do this optimization? Why? Why not? How do I go about telling the compiler to do it? For MSVC: /O2 or /Ox For GCC: -O2 or -O3 How about checking if the compiler has done this in a certain case? For MSVC, enable PDB output to be able to trace the code, then inspect the code For GCC..? I'd still take suggestions for how to determine if a certain function is optimized like this by the compiler (even though I find it reassuring that Konrad tells me to assume it) It is always possible to check if the compiler does this at all by making an infinite recursion and checking if it results in an infinite loop or a stack overflow (I did this with GCC and found out that -O2 is sufficient), but I want to be able to check a certain function that I know will terminate anyway. I'd love to have an easy way of checking this:) After some testing, I discovered that destructors ruin the possibility of making this optimization. It can sometimes be worth it to change the scoping of certain variables and temporaries to make sure they go out of scope before the return-statement starts. If any destructor needs to be run after the tail-call, the tail-call optimization can not be done.
All current mainstream compilers perform tail call optimisation fairly well (and have done for more than a decade), even for mutually recursive calls such as: int bar(int, int); int foo(int n, int acc) { return (n == 0)? acc: bar(n - 1, acc + 2); } int bar(int n, int acc) { return (n == 0)? acc: foo(n - 1, acc + 1); } Letting the compiler do the optimisation is straightforward: Just switch on optimisation for speed: For MSVC, use /O2 or /Ox. For GCC, Clang and ICC, use -O3 An easy way to check if the compiler did the optimisation is to perform a call that would otherwise result in a stack overflow — or looking at the assembly output. As an interesting historical note, tail call optimisation for C was added to the GCC in the course of a diploma thesis by Mark Probst. The thesis describes some interesting caveats in the implementation. It's worth reading.
Which, if any, C++ compilers do tail-recursion optimization? It seems to me that it would work perfectly well to do tail-recursion optimization in both C and C++, yet while debugging I never seem to see a frame stack that indicates this optimization. That is kind of good, because the stack tells me how deep the recursion is. However, the optimization would be kind of nice as well. Do any C++ compilers do this optimization? Why? Why not? How do I go about telling the compiler to do it? For MSVC: /O2 or /Ox For GCC: -O2 or -O3 How about checking if the compiler has done this in a certain case? For MSVC, enable PDB output to be able to trace the code, then inspect the code For GCC..? I'd still take suggestions for how to determine if a certain function is optimized like this by the compiler (even though I find it reassuring that Konrad tells me to assume it) It is always possible to check if the compiler does this at all by making an infinite recursion and checking if it results in an infinite loop or a stack overflow (I did this with GCC and found out that -O2 is sufficient), but I want to be able to check a certain function that I know will terminate anyway. I'd love to have an easy way of checking this:) After some testing, I discovered that destructors ruin the possibility of making this optimization. It can sometimes be worth it to change the scoping of certain variables and temporaries to make sure they go out of scope before the return-statement starts. If any destructor needs to be run after the tail-call, the tail-call optimization can not be done.
TITLE: Which, if any, C++ compilers do tail-recursion optimization? QUESTION: It seems to me that it would work perfectly well to do tail-recursion optimization in both C and C++, yet while debugging I never seem to see a frame stack that indicates this optimization. That is kind of good, because the stack tells me how deep the recursion is. However, the optimization would be kind of nice as well. Do any C++ compilers do this optimization? Why? Why not? How do I go about telling the compiler to do it? For MSVC: /O2 or /Ox For GCC: -O2 or -O3 How about checking if the compiler has done this in a certain case? For MSVC, enable PDB output to be able to trace the code, then inspect the code For GCC..? I'd still take suggestions for how to determine if a certain function is optimized like this by the compiler (even though I find it reassuring that Konrad tells me to assume it) It is always possible to check if the compiler does this at all by making an infinite recursion and checking if it results in an infinite loop or a stack overflow (I did this with GCC and found out that -O2 is sufficient), but I want to be able to check a certain function that I know will terminate anyway. I'd love to have an easy way of checking this:) After some testing, I discovered that destructors ruin the possibility of making this optimization. It can sometimes be worth it to change the scoping of certain variables and temporaries to make sure they go out of scope before the return-statement starts. If any destructor needs to be run after the tail-call, the tail-call optimization can not be done. ANSWER: All current mainstream compilers perform tail call optimisation fairly well (and have done for more than a decade), even for mutually recursive calls such as: int bar(int, int); int foo(int n, int acc) { return (n == 0)? acc: bar(n - 1, acc + 2); } int bar(int n, int acc) { return (n == 0)? acc: foo(n - 1, acc + 1); } Letting the compiler do the optimisation is straightforward: Just switch on optimisation for speed: For MSVC, use /O2 or /Ox. For GCC, Clang and ICC, use -O3 An easy way to check if the compiler did the optimisation is to perform a call that would otherwise result in a stack overflow — or looking at the assembly output. As an interesting historical note, tail call optimisation for C was added to the GCC in the course of a diploma thesis by Mark Probst. The thesis describes some interesting caveats in the implementation. It's worth reading.
[ "c++", "optimization", "tail-recursion" ]
172
152
54,488
5
0
2008-08-29T07:35:47.517000
2008-08-29T07:40:32.280000
34,126
34,163
What is the best way to add an event in JavaScript?
I see 2 main ways to set events in JavaScript: Add an event directly inside the tag like this: do foo Set them by JavaScript like this: do bar and add an event in a
In my experience, there are two major points to this: 1) The most important thing is to be consistent. I don't think either of the two methods is necessarily easier to read, as long as you stick to it. I only get confused when both methods are used in a project (or even worse on the same page) because then I have to start searching for the calls and don't immediately know where to look. 2) The second kind, i.e. Event.observe() has advantages when the same or a very similar action is taken on multiple events because this becomes obvious when all those calls are in the same place. Also, as Konrad pointed out, in some cases this can be handled with a single call.
What is the best way to add an event in JavaScript? I see 2 main ways to set events in JavaScript: Add an event directly inside the tag like this: do foo Set them by JavaScript like this: do bar and add an event in a
TITLE: What is the best way to add an event in JavaScript? QUESTION: I see 2 main ways to set events in JavaScript: Add an event directly inside the tag like this: do foo Set them by JavaScript like this: do bar and add an event in a ANSWER: In my experience, there are two major points to this: 1) The most important thing is to be consistent. I don't think either of the two methods is necessarily easier to read, as long as you stick to it. I only get confused when both methods are used in a project (or even worse on the same page) because then I have to start searching for the calls and don't immediately know where to look. 2) The second kind, i.e. Event.observe() has advantages when the same or a very similar action is taken on multiple events because this becomes obvious when all those calls are in the same place. Also, as Konrad pointed out, in some cases this can be handled with a single call.
[ "javascript", "html", "events", "event-binding" ]
9
4
10,615
6
0
2008-08-29T07:35:56.783000
2008-08-29T08:10:41.037000
34,128
34,150
How to you pass a variable amount of parmeters to web-service
We are trying to create a web-service that we plan to pass a variable amount of variables to it. Can this be done? Basically instead of pass all possible parameters we wish to pass only the set values and use the defaults set in the web-service. Here is an example of the XML we are looking to send, we would sent an unknown amount of functions depending on the needed return. Some Title 25 13 Will this work or should we do a different way?
I would pass in an xml document instead of doing concreate functions for this. The webservice in your example is leaky - the consumer needs to know too much about this interface and the implementation of the webservice internally. XML Document and then tie that with an XSD. That way you can prevalidte the input to the webservice. Take a look at these IBM Developer ASP.NET Forum I would also recommend using this for testing webservices and its free WSStudio
How to you pass a variable amount of parmeters to web-service We are trying to create a web-service that we plan to pass a variable amount of variables to it. Can this be done? Basically instead of pass all possible parameters we wish to pass only the set values and use the defaults set in the web-service. Here is an example of the XML we are looking to send, we would sent an unknown amount of functions depending on the needed return. Some Title 25 13 Will this work or should we do a different way?
TITLE: How to you pass a variable amount of parmeters to web-service QUESTION: We are trying to create a web-service that we plan to pass a variable amount of variables to it. Can this be done? Basically instead of pass all possible parameters we wish to pass only the set values and use the defaults set in the web-service. Here is an example of the XML we are looking to send, we would sent an unknown amount of functions depending on the needed return. Some Title 25 13 Will this work or should we do a different way? ANSWER: I would pass in an xml document instead of doing concreate functions for this. The webservice in your example is leaky - the consumer needs to know too much about this interface and the implementation of the webservice internally. XML Document and then tie that with an XSD. That way you can prevalidte the input to the webservice. Take a look at these IBM Developer ASP.NET Forum I would also recommend using this for testing webservices and its free WSStudio
[ "c#", "web-services", "soap" ]
4
5
1,912
4
0
2008-08-29T07:38:40.507000
2008-08-29T08:02:00.543000
34,144
34,167
In Maven 2, how do I know from which dependency comes a transitive dependency?
I would like to know which dependency described in my pom.xml brings a transitive dependency in my target directory. To be more precise, I have the library "poi-2.5.1-final-20040804.jar" in my WEB-INF/lib directory and I would like to know which dependency in my pom.xml brings that.
To add to @David Crow, here's a dependency:tree example from the Maven site: mvn dependency:tree -Dincludes=velocity:velocity might output [INFO] [dependency:tree] [INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT [INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile [INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile [INFO] \- velocity:velocity:jar:1.4:compile
In Maven 2, how do I know from which dependency comes a transitive dependency? I would like to know which dependency described in my pom.xml brings a transitive dependency in my target directory. To be more precise, I have the library "poi-2.5.1-final-20040804.jar" in my WEB-INF/lib directory and I would like to know which dependency in my pom.xml brings that.
TITLE: In Maven 2, how do I know from which dependency comes a transitive dependency? QUESTION: I would like to know which dependency described in my pom.xml brings a transitive dependency in my target directory. To be more precise, I have the library "poi-2.5.1-final-20040804.jar" in my WEB-INF/lib directory and I would like to know which dependency in my pom.xml brings that. ANSWER: To add to @David Crow, here's a dependency:tree example from the Maven site: mvn dependency:tree -Dincludes=velocity:velocity might output [INFO] [dependency:tree] [INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT [INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile [INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile [INFO] \- velocity:velocity:jar:1.4:compile
[ "java", "maven-2", "build-process" ]
123
163
62,296
6
0
2008-08-29T07:55:12.883000
2008-08-29T08:14:10.107000
34,155
34,387
Looking for examples of "real" uses of continuations
I'm trying to grasp the concept of continuations and I found several small teaching examples like this one from the Wikipedia article: (define the-continuation #f) (define (test) (let ((i 0)); call/cc calls its first function argument, passing; a continuation variable representing this point in; the program as the argument to that function.;; In this case, the function argument assigns that; continuation to the variable the-continuation.; (call/cc (lambda (k) (set! the-continuation k)));; The next time the-continuation is called, we start here. (set! i (+ i 1)) i)) I understand what this little function does, but I can't see any obvious application of it. While I don't expect to use continuations all over my code anytime soon, I wish I knew a few cases where they can be appropriate. So I'm looking for more explicitely usefull code samples of what continuations can offer me as a programmer. Cheers!
In Algo & Data II we used these all the times to "exit" or "return" from a (long) function for example the BFS algorthm to traverse trees with was implemented like this: (define (BFS graph root-discovered node-discovered edge-discovered edge-bumped. nodes) (define visited (make-vector (graph.order graph) #f)) (define q (queue.new)) (define exit ()) (define (BFS-tree node) (if (node-discovered node) (exit node)) (graph.map-edges graph node (lambda (node2) (cond ((not (vector-ref visited node2)) (when (edge-discovered node node2) (vector-set! visited node2 #t) (queue.enqueue! q node2))) (else (edge-bumped node node2))))) (if (not (queue.empty? q)) (BFS-tree (queue.serve! q)))) (call-with-current-continuation (lambda (my-future) (set! exit my-future) (cond ((null? nodes) (graph.map-nodes graph (lambda (node) (when (not (vector-ref visited node)) (vector-set! visited node #t) (root-discovered node) (BFS-tree node))))) (else (let loop-nodes ((node-list (car nodes))) (vector-set! visited (car node-list) #t) (root-discovered (car node-list)) (BFS-tree (car node-list)) (if (not (null? (cdr node-list))) (loop-nodes (cdr node-list))))))))) As you can see the algorithm will exit when the node-discovered function returns true: (if (node-discovered node) (exit node)) the function will also give a "return value": 'node' why the function exits, is because of this statement: (call-with-current-continuation (lambda (my-future) (set! exit my-future) when we use exit, it will go back to the state before the execution, emptying the call-stack and return the value you gave it. So basically, call-cc is used (here) to jump out of a recursive function, instead of waiting for the entire recursion to end by itself (which can be quite expensive when doing lots of computational work) another smaller example doing the same with call-cc: (define (connected? g node1 node2) (define visited (make-vector (graph.order g) #f)) (define return ()) (define (connected-rec x y) (if (eq? x y) (return #t)) (vector-set! visited x #t) (graph.map-edges g x (lambda (t) (if (not (vector-ref visited t)) (connected-rec t y))))) (call-with-current-continuation (lambda (future) (set! return future) (connected-rec node1 node2) (return #f))))
Looking for examples of "real" uses of continuations I'm trying to grasp the concept of continuations and I found several small teaching examples like this one from the Wikipedia article: (define the-continuation #f) (define (test) (let ((i 0)); call/cc calls its first function argument, passing; a continuation variable representing this point in; the program as the argument to that function.;; In this case, the function argument assigns that; continuation to the variable the-continuation.; (call/cc (lambda (k) (set! the-continuation k)));; The next time the-continuation is called, we start here. (set! i (+ i 1)) i)) I understand what this little function does, but I can't see any obvious application of it. While I don't expect to use continuations all over my code anytime soon, I wish I knew a few cases where they can be appropriate. So I'm looking for more explicitely usefull code samples of what continuations can offer me as a programmer. Cheers!
TITLE: Looking for examples of "real" uses of continuations QUESTION: I'm trying to grasp the concept of continuations and I found several small teaching examples like this one from the Wikipedia article: (define the-continuation #f) (define (test) (let ((i 0)); call/cc calls its first function argument, passing; a continuation variable representing this point in; the program as the argument to that function.;; In this case, the function argument assigns that; continuation to the variable the-continuation.; (call/cc (lambda (k) (set! the-continuation k)));; The next time the-continuation is called, we start here. (set! i (+ i 1)) i)) I understand what this little function does, but I can't see any obvious application of it. While I don't expect to use continuations all over my code anytime soon, I wish I knew a few cases where they can be appropriate. So I'm looking for more explicitely usefull code samples of what continuations can offer me as a programmer. Cheers! ANSWER: In Algo & Data II we used these all the times to "exit" or "return" from a (long) function for example the BFS algorthm to traverse trees with was implemented like this: (define (BFS graph root-discovered node-discovered edge-discovered edge-bumped. nodes) (define visited (make-vector (graph.order graph) #f)) (define q (queue.new)) (define exit ()) (define (BFS-tree node) (if (node-discovered node) (exit node)) (graph.map-edges graph node (lambda (node2) (cond ((not (vector-ref visited node2)) (when (edge-discovered node node2) (vector-set! visited node2 #t) (queue.enqueue! q node2))) (else (edge-bumped node node2))))) (if (not (queue.empty? q)) (BFS-tree (queue.serve! q)))) (call-with-current-continuation (lambda (my-future) (set! exit my-future) (cond ((null? nodes) (graph.map-nodes graph (lambda (node) (when (not (vector-ref visited node)) (vector-set! visited node #t) (root-discovered node) (BFS-tree node))))) (else (let loop-nodes ((node-list (car nodes))) (vector-set! visited (car node-list) #t) (root-discovered (car node-list)) (BFS-tree (car node-list)) (if (not (null? (cdr node-list))) (loop-nodes (cdr node-list))))))))) As you can see the algorithm will exit when the node-discovered function returns true: (if (node-discovered node) (exit node)) the function will also give a "return value": 'node' why the function exits, is because of this statement: (call-with-current-continuation (lambda (my-future) (set! exit my-future) when we use exit, it will go back to the state before the execution, emptying the call-stack and return the value you gave it. So basically, call-cc is used (here) to jump out of a recursive function, instead of waiting for the entire recursion to end by itself (which can be quite expensive when doing lots of computational work) another smaller example doing the same with call-cc: (define (connected? g node1 node2) (define visited (make-vector (graph.order g) #f)) (define return ()) (define (connected-rec x y) (if (eq? x y) (return #t)) (vector-set! visited x #t) (graph.map-edges g x (lambda (t) (if (not (vector-ref visited t)) (connected-rec t y))))) (call-with-current-continuation (lambda (future) (set! return future) (connected-rec node1 node2) (return #f))))
[ "ruby", "language-agnostic", "scheme", "smalltalk", "continuations" ]
21
16
3,088
12
0
2008-08-29T08:07:58.687000
2008-08-29T11:36:06.473000
34,161
34,172
Delete Records from Access database, error while deleting
I have the following situation: I built an Access form with a subform (which records are linked to the records of main form via certain key). When I try to delete any record in the subform, I get the following message: “Access has suspended the action because you and another user tried to change the data” (approximate translation from German). Does anyone know how to delete those records from the subform (and, respectively, from the table behind the form).
If you are currently 'editing' the current form then it will not allow the action. Editing a record can sometimes be triggered by simply clicking inside a field, or other simple actions you wouldn't normally consider 'editing'. This is usually avoided in Access by using the RunCommand method to undo any edits before deleting the record: DoCmd.RunCommand acCmdUndo
Delete Records from Access database, error while deleting I have the following situation: I built an Access form with a subform (which records are linked to the records of main form via certain key). When I try to delete any record in the subform, I get the following message: “Access has suspended the action because you and another user tried to change the data” (approximate translation from German). Does anyone know how to delete those records from the subform (and, respectively, from the table behind the form).
TITLE: Delete Records from Access database, error while deleting QUESTION: I have the following situation: I built an Access form with a subform (which records are linked to the records of main form via certain key). When I try to delete any record in the subform, I get the following message: “Access has suspended the action because you and another user tried to change the data” (approximate translation from German). Does anyone know how to delete those records from the subform (and, respectively, from the table behind the form). ANSWER: If you are currently 'editing' the current form then it will not allow the action. Editing a record can sometimes be triggered by simply clicking inside a field, or other simple actions you wouldn't normally consider 'editing'. This is usually avoided in Access by using the RunCommand method to undo any edits before deleting the record: DoCmd.RunCommand acCmdUndo
[ "database", "ms-access" ]
1
1
1,931
3
0
2008-08-29T08:10:21.287000
2008-08-29T08:19:42.093000
34,182
56,934
Alternatives for enhanced reading and parsing text files using .NET
I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using.NET/C#.
Answering my own question: I ended up using the Microsoft.VisualBasic.FileIO.TextFieldParser object, see: http://msdn.microsoft.com/en-us/library/f68t4563.aspx (example of implementation here) This allows me to handle csv files without worrying about how to cope with whether fields are enclosed in quotes, contain commas, escaped quotes etc.
Alternatives for enhanced reading and parsing text files using .NET I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using.NET/C#.
TITLE: Alternatives for enhanced reading and parsing text files using .NET QUESTION: I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using.NET/C#. ANSWER: Answering my own question: I ended up using the Microsoft.VisualBasic.FileIO.TextFieldParser object, see: http://msdn.microsoft.com/en-us/library/f68t4563.aspx (example of implementation here) This allows me to handle csv files without worrying about how to cope with whether fields are enclosed in quotes, contain commas, escaped quotes etc.
[ ".net", "file-io", "text-files" ]
3
4
3,915
9
0
2008-08-29T08:36:35.047000
2008-09-11T15:41:16.383000
34,183
38,331
C#.Net: Why is my Process.Start() hanging?
I'm trying to run a batch file, as another user, from my web app. For some reason, the batch file hangs! I can see "cmd.exe" running in the task manager, but it just sits there forever, unable to be killed, and the batch file is not running. Here's my code: SecureString password = new SecureString(); foreach (char c in "mypassword".ToCharArray()) password.AppendChar(c); ProcessStartInfo psi = new ProcessStartInfo(); psi.WorkingDirectory = @"c:\build"; psi.FileName = Environment.SystemDirectory + @"\cmd.exe"; psi.Arguments = "/q /c build.cmd"; psi.UseShellExecute = false; psi.UserName = "builder"; psi.Password = password; Process.Start(psi); If you didn't guess, this batch file builds my application (a different application than the one that is executing this command). The Process.Start(psi); line returns immediately, as it should, but the batch file just seems to hang, without executing. Any ideas? EDIT: See my answer below for the contents of the batch file. The output.txt never gets created. I added these lines: psi.RedirectStandardOutput = true; Process p = Process.Start(psi); String outp = p.StandardOutput.ReadLine(); and stepped through them in debug mode. The code hangs on the ReadLine(). I'm stumped!
I believe I've found the answer. It seems that Microsoft, in all their infinite wisdom, has blocked batch files from being executed by IIS in Windows Server 2003. Brenden Tompkins has a work-around here: http://codebetter.com/blogs/brendan.tompkins/archive/2004/05/13/13484.aspx That won't work for me, because my batch file uses IF and GOTO, but it would definitely work for simple batch files.
C#.Net: Why is my Process.Start() hanging? I'm trying to run a batch file, as another user, from my web app. For some reason, the batch file hangs! I can see "cmd.exe" running in the task manager, but it just sits there forever, unable to be killed, and the batch file is not running. Here's my code: SecureString password = new SecureString(); foreach (char c in "mypassword".ToCharArray()) password.AppendChar(c); ProcessStartInfo psi = new ProcessStartInfo(); psi.WorkingDirectory = @"c:\build"; psi.FileName = Environment.SystemDirectory + @"\cmd.exe"; psi.Arguments = "/q /c build.cmd"; psi.UseShellExecute = false; psi.UserName = "builder"; psi.Password = password; Process.Start(psi); If you didn't guess, this batch file builds my application (a different application than the one that is executing this command). The Process.Start(psi); line returns immediately, as it should, but the batch file just seems to hang, without executing. Any ideas? EDIT: See my answer below for the contents of the batch file. The output.txt never gets created. I added these lines: psi.RedirectStandardOutput = true; Process p = Process.Start(psi); String outp = p.StandardOutput.ReadLine(); and stepped through them in debug mode. The code hangs on the ReadLine(). I'm stumped!
TITLE: C#.Net: Why is my Process.Start() hanging? QUESTION: I'm trying to run a batch file, as another user, from my web app. For some reason, the batch file hangs! I can see "cmd.exe" running in the task manager, but it just sits there forever, unable to be killed, and the batch file is not running. Here's my code: SecureString password = new SecureString(); foreach (char c in "mypassword".ToCharArray()) password.AppendChar(c); ProcessStartInfo psi = new ProcessStartInfo(); psi.WorkingDirectory = @"c:\build"; psi.FileName = Environment.SystemDirectory + @"\cmd.exe"; psi.Arguments = "/q /c build.cmd"; psi.UseShellExecute = false; psi.UserName = "builder"; psi.Password = password; Process.Start(psi); If you didn't guess, this batch file builds my application (a different application than the one that is executing this command). The Process.Start(psi); line returns immediately, as it should, but the batch file just seems to hang, without executing. Any ideas? EDIT: See my answer below for the contents of the batch file. The output.txt never gets created. I added these lines: psi.RedirectStandardOutput = true; Process p = Process.Start(psi); String outp = p.StandardOutput.ReadLine(); and stepped through them in debug mode. The code hangs on the ReadLine(). I'm stumped! ANSWER: I believe I've found the answer. It seems that Microsoft, in all their infinite wisdom, has blocked batch files from being executed by IIS in Windows Server 2003. Brenden Tompkins has a work-around here: http://codebetter.com/blogs/brendan.tompkins/archive/2004/05/13/13484.aspx That won't work for me, because my batch file uses IF and GOTO, but it would definitely work for simple batch files.
[ "c#", ".net" ]
14
5
16,376
9
0
2008-08-29T08:36:36.903000
2008-09-01T19:41:24.163000
34,194
316,015
ASP.NET MVC on IIS6
Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6? I haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S. So I was wondering on how you best build applications in ASP.NET MVC and make it easily available to deploy on both IIS6 and IIS7. Keep in mind that this is for standard web-hosts, so there is no access to ISAPI-filters or special settings inside IIS6. Are there anything else one should think about when developing ASP.NET MVC-applications to target IIS6? Any functions that doesn't work? UPDATE: One of the bigger issues is the thing with routes. The pattern {controller}/{action} will work on IIS7, but not IIS6 which needs {controller}.mvc/{action}. So how do I make this transparent? Again, no ISAPI and no IIS-settings, please.
It took me a bit, but I figured out how to make the extensions work with IIS 6. First, you need to rework the base routing to include.aspx so that they will be routed through the ASP.NET ISAPI filter. routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); If you navigate to Home.aspx, for example, your site should be working fine. But Default.aspx and the default page address of http://[website]/ stop working correctly. So how is that fixed? Well, you need to define a second route. Unfortunately, using Default.aspx as the route does not work properly: routes.MapRoute( "Default2", // Route name "Default.aspx", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); So how do you get this to work? Well, this is where you need the original routing code: routes.MapRoute( "Default2", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); When you do this, Default.aspx and http://[website]/ both start working again, I think because they become successfully mapped back to the Home controller. So the complete solution is: public class MvcApplication: System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); routes.MapRoute( "Default2", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); } } And your site should start working just fine under IIS 6. (At least it does on my PC.) And as a bonus, if you are using Html.ActionLink() in your pages, you should not have to change any other line of code throughout the entire site. This method takes care of properly tagging on the.aspx extension to the controller.
ASP.NET MVC on IIS6 Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6? I haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S. So I was wondering on how you best build applications in ASP.NET MVC and make it easily available to deploy on both IIS6 and IIS7. Keep in mind that this is for standard web-hosts, so there is no access to ISAPI-filters or special settings inside IIS6. Are there anything else one should think about when developing ASP.NET MVC-applications to target IIS6? Any functions that doesn't work? UPDATE: One of the bigger issues is the thing with routes. The pattern {controller}/{action} will work on IIS7, but not IIS6 which needs {controller}.mvc/{action}. So how do I make this transparent? Again, no ISAPI and no IIS-settings, please.
TITLE: ASP.NET MVC on IIS6 QUESTION: Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6? I haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S. So I was wondering on how you best build applications in ASP.NET MVC and make it easily available to deploy on both IIS6 and IIS7. Keep in mind that this is for standard web-hosts, so there is no access to ISAPI-filters or special settings inside IIS6. Are there anything else one should think about when developing ASP.NET MVC-applications to target IIS6? Any functions that doesn't work? UPDATE: One of the bigger issues is the thing with routes. The pattern {controller}/{action} will work on IIS7, but not IIS6 which needs {controller}.mvc/{action}. So how do I make this transparent? Again, no ISAPI and no IIS-settings, please. ANSWER: It took me a bit, but I figured out how to make the extensions work with IIS 6. First, you need to rework the base routing to include.aspx so that they will be routed through the ASP.NET ISAPI filter. routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); If you navigate to Home.aspx, for example, your site should be working fine. But Default.aspx and the default page address of http://[website]/ stop working correctly. So how is that fixed? Well, you need to define a second route. Unfortunately, using Default.aspx as the route does not work properly: routes.MapRoute( "Default2", // Route name "Default.aspx", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); So how do you get this to work? Well, this is where you need the original routing code: routes.MapRoute( "Default2", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); When you do this, Default.aspx and http://[website]/ both start working again, I think because they become successfully mapped back to the Home controller. So the complete solution is: public class MvcApplication: System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); routes.MapRoute( "Default2", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); } } And your site should start working just fine under IIS 6. (At least it does on my PC.) And as a bonus, if you are using Html.ActionLink() in your pages, you should not have to change any other line of code throughout the entire site. This method takes care of properly tagging on the.aspx extension to the controller.
[ ".net", "asp.net-mvc", "deployment", "iis-6" ]
25
14
10,330
8
0
2008-08-29T08:45:19.673000
2008-11-25T00:43:54.613000
34,204
185,256
How do I get latest from a Visual Studio solution from the command line?
How do I get the latest version of my solution recursively like its done in the solution explorer context menu of Visual Studio? I want to do this from the command line or via a macro. I'm trying to automate a part of my daily routine by using a set of batch files. I am sure a lot of developers would love to have something like this. tf get only gets contents of a folder recursively (not solution). It does not look at project dependencies and so on. That won't work.
TFS has a.Net SDK that allows you to create your own custom programs that interact with a TFS Server. You could write a small program that performs the task you need: TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("MyServer"); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); WorkSpace[] myWorkSpaces = vcs.QueryWorkSpaces("MyWorkSpaceName", "MyLoginName", "MyComputer"); myWorkSpaces[0].Get(VersionSpec.Latest, GetOptions.GetAll);
How do I get latest from a Visual Studio solution from the command line? How do I get the latest version of my solution recursively like its done in the solution explorer context menu of Visual Studio? I want to do this from the command line or via a macro. I'm trying to automate a part of my daily routine by using a set of batch files. I am sure a lot of developers would love to have something like this. tf get only gets contents of a folder recursively (not solution). It does not look at project dependencies and so on. That won't work.
TITLE: How do I get latest from a Visual Studio solution from the command line? QUESTION: How do I get the latest version of my solution recursively like its done in the solution explorer context menu of Visual Studio? I want to do this from the command line or via a macro. I'm trying to automate a part of my daily routine by using a set of batch files. I am sure a lot of developers would love to have something like this. tf get only gets contents of a folder recursively (not solution). It does not look at project dependencies and so on. That won't work. ANSWER: TFS has a.Net SDK that allows you to create your own custom programs that interact with a TFS Server. You could write a small program that performs the task you need: TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("MyServer"); VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); WorkSpace[] myWorkSpaces = vcs.QueryWorkSpaces("MyWorkSpaceName", "MyLoginName", "MyComputer"); myWorkSpaces[0].Get(VersionSpec.Latest, GetOptions.GetAll);
[ "visual-studio-2008", "command-line", "tfs", "macros" ]
9
4
8,810
7
0
2008-08-29T08:53:58.127000
2008-10-08T22:56:49.107000
34,209
35,633
Django ImageField core=False in newforms admin
In the transition to newforms admin I'm having difficulty figuring out how specify core=False for ImageFields. I get the following error: TypeError: __init__() got an unexpected keyword argument 'core' [Edit] However, by just removing the core argument I get a "This field is required." error in the admin interface on attempted submission. How does one accomplish what core=False is meant to do using newforms admin?
To get rid of "This field is required," you need to make it not required, by using blank=True (and possibly null=True as well, if it's not a CharField).
Django ImageField core=False in newforms admin In the transition to newforms admin I'm having difficulty figuring out how specify core=False for ImageFields. I get the following error: TypeError: __init__() got an unexpected keyword argument 'core' [Edit] However, by just removing the core argument I get a "This field is required." error in the admin interface on attempted submission. How does one accomplish what core=False is meant to do using newforms admin?
TITLE: Django ImageField core=False in newforms admin QUESTION: In the transition to newforms admin I'm having difficulty figuring out how specify core=False for ImageFields. I get the following error: TypeError: __init__() got an unexpected keyword argument 'core' [Edit] However, by just removing the core argument I get a "This field is required." error in the admin interface on attempted submission. How does one accomplish what core=False is meant to do using newforms admin? ANSWER: To get rid of "This field is required," you need to make it not required, by using blank=True (and possibly null=True as well, if it's not a CharField).
[ "python", "django", "django-models" ]
6
5
1,161
3
0
2008-08-29T09:03:27.883000
2008-08-30T03:04:44.560000
34,237
34,261
How to hide the cancel button on an ASP.NET ChangePassword control
I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show. Is there a good way to hide it without resorting to silly "width = 0" sort of games? Or perhaps there's a generic way to walk through the parts of a composite control like this and hide individual parts?
Set CancelButtonStyle.CssClass to something like "hiddenItem" and set the CSS to "display:none". Otherwise you can convert the control to a template and simply delete away the cancel-button manually. When you click the control in Design-mode in Visual Studio, you get a little arrow with options and one of them is "Convert to Template".
How to hide the cancel button on an ASP.NET ChangePassword control I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show. Is there a good way to hide it without resorting to silly "width = 0" sort of games? Or perhaps there's a generic way to walk through the parts of a composite control like this and hide individual parts?
TITLE: How to hide the cancel button on an ASP.NET ChangePassword control QUESTION: I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show. Is there a good way to hide it without resorting to silly "width = 0" sort of games? Or perhaps there's a generic way to walk through the parts of a composite control like this and hide individual parts? ANSWER: Set CancelButtonStyle.CssClass to something like "hiddenItem" and set the CSS to "display:none". Otherwise you can convert the control to a template and simply delete away the cancel-button manually. When you click the control in Design-mode in Visual Studio, you get a little arrow with options and one of them is "Convert to Template".
[ "asp.net", "webforms" ]
3
7
4,872
3
0
2008-08-29T09:21:42.053000
2008-08-29T09:36:08.960000
34,243
34,266
Python descriptor protocol analog in other languages?
Is there something like the Python descriptor protocol implemented in other languages? It seems like a nice way to increase modularity/encapsulation without bloating your containing class' implementation, but I've never heard of a similar thing in any other languages. Is it likely absent from other languages because of the lookup overhead?
I've not heard of a direct equivalent either. You could probably achieve the same effect with macros, especially in a language like Lisp which has extremely powerful macros. I wouldn't be at all surprised if other languages start to incorporate something similar because it is so powerful.
Python descriptor protocol analog in other languages? Is there something like the Python descriptor protocol implemented in other languages? It seems like a nice way to increase modularity/encapsulation without bloating your containing class' implementation, but I've never heard of a similar thing in any other languages. Is it likely absent from other languages because of the lookup overhead?
TITLE: Python descriptor protocol analog in other languages? QUESTION: Is there something like the Python descriptor protocol implemented in other languages? It seems like a nice way to increase modularity/encapsulation without bloating your containing class' implementation, but I've never heard of a similar thing in any other languages. Is it likely absent from other languages because of the lookup overhead? ANSWER: I've not heard of a direct equivalent either. You could probably achieve the same effect with macros, especially in a language like Lisp which has extremely powerful macros. I wouldn't be at all surprised if other languages start to incorporate something similar because it is so powerful.
[ "python", "language-features", "encapsulation" ]
10
4
998
2
0
2008-08-29T09:24:08.583000
2008-08-29T09:39:47.423000
34,249
34,255
Best algorithm to test if a linked list has a cycle
What's the best (halting) algorithm for determining if a linked list has a cycle in it? [Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better. [Edit] Original question was not addressing nodes with outdegree > 1, but there's some talk about it. That question is more along the lines of "Best algorithm to detect cycles in a directed graph".
Have two pointers iterating through the list; make one iterate through at twice the speed of the other, and compare their positions at each step. Off the top of my head, something like: node* tortoise(begin), * hare(begin); while(hare = hare->next) { if(hare == tortoise) { throw std::logic_error("There's a cycle"); } hare = hare->next; if(hare == tortoise) { throw std::logic_error("There's a cycle"); } tortoise = tortoise->next; } O(n), which is as good as you can get.
Best algorithm to test if a linked list has a cycle What's the best (halting) algorithm for determining if a linked list has a cycle in it? [Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better. [Edit] Original question was not addressing nodes with outdegree > 1, but there's some talk about it. That question is more along the lines of "Best algorithm to detect cycles in a directed graph".
TITLE: Best algorithm to test if a linked list has a cycle QUESTION: What's the best (halting) algorithm for determining if a linked list has a cycle in it? [Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better. [Edit] Original question was not addressing nodes with outdegree > 1, but there's some talk about it. That question is more along the lines of "Best algorithm to detect cycles in a directed graph". ANSWER: Have two pointers iterating through the list; make one iterate through at twice the speed of the other, and compare their positions at each step. Off the top of my head, something like: node* tortoise(begin), * hare(begin); while(hare = hare->next) { if(hare == tortoise) { throw std::logic_error("There's a cycle"); } hare = hare->next; if(hare == tortoise) { throw std::logic_error("There's a cycle"); } tortoise = tortoise->next; } O(n), which is as good as you can get.
[ "algorithm", "data-structures", "linked-list" ]
32
51
21,229
12
0
2008-08-29T09:30:05.510000
2008-08-29T09:34:18.277000
34,262
34,377
Query TFS for updated files
I want to get an overview of files that are updated in TFS (that someone else checked in) that I don't have the latest version for.
In Visual Studio Source Control Explorer, right click on the directory you want to compare, and select "Compare". It will pop up a dialog with a couple of filtering options, and then show you what's out of date.
Query TFS for updated files I want to get an overview of files that are updated in TFS (that someone else checked in) that I don't have the latest version for.
TITLE: Query TFS for updated files QUESTION: I want to get an overview of files that are updated in TFS (that someone else checked in) that I don't have the latest version for. ANSWER: In Visual Studio Source Control Explorer, right click on the directory you want to compare, and select "Compare". It will pop up a dialog with a couple of filtering options, and then show you what's out of date.
[ "tfs" ]
2
2
644
2
0
2008-08-29T09:36:27.383000
2008-08-29T11:23:05.257000
34,270
34,290
COMException "Library not registered." while using System.DirectoryServices
I have only just started received the following error in my windows forms application under.NET 2 framework on windows 2000 when using System.DirectoryServices. {System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException: {"Library not registered."} _className: Nothing _COMPlusExceptionCode: -532459699 _data: Nothing _dynamicMethods: Nothing _exceptionMethod: Nothing _exceptionMethodString: Nothing _helpURL: Nothing _HResult: -2147319779 _innerException: Nothing _message: "Library not registered." _remoteStackIndex: 0 _remoteStackTraceString: Nothing _source: Nothing _stackTrace: {System.Array} _stackTraceString: Nothing _xcode: -532459699 _xptrs: 0 Source: "System.DirectoryServices" StackTrace: " at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll() I have re-installed the framework and re-registered activeds.dll however this has not resolved the issue. I am guessing I need to find another dll and re-register it however it is not clear which dll this would be.
Having used Reflector to have a quick peak at the Directory Services code, it looks like your Active Directory Service Interfaces installation might be kaput. You can download version 2.5 from Technet although I'm not sure if it's the latest version or if it works with Windows 2000.
COMException "Library not registered." while using System.DirectoryServices I have only just started received the following error in my windows forms application under.NET 2 framework on windows 2000 when using System.DirectoryServices. {System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException: {"Library not registered."} _className: Nothing _COMPlusExceptionCode: -532459699 _data: Nothing _dynamicMethods: Nothing _exceptionMethod: Nothing _exceptionMethodString: Nothing _helpURL: Nothing _HResult: -2147319779 _innerException: Nothing _message: "Library not registered." _remoteStackIndex: 0 _remoteStackTraceString: Nothing _source: Nothing _stackTrace: {System.Array} _stackTraceString: Nothing _xcode: -532459699 _xptrs: 0 Source: "System.DirectoryServices" StackTrace: " at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll() I have re-installed the framework and re-registered activeds.dll however this has not resolved the issue. I am guessing I need to find another dll and re-register it however it is not clear which dll this would be.
TITLE: COMException "Library not registered." while using System.DirectoryServices QUESTION: I have only just started received the following error in my windows forms application under.NET 2 framework on windows 2000 when using System.DirectoryServices. {System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException: {"Library not registered."} _className: Nothing _COMPlusExceptionCode: -532459699 _data: Nothing _dynamicMethods: Nothing _exceptionMethod: Nothing _exceptionMethodString: Nothing _helpURL: Nothing _HResult: -2147319779 _innerException: Nothing _message: "Library not registered." _remoteStackIndex: 0 _remoteStackTraceString: Nothing _source: Nothing _stackTrace: {System.Array} _stackTraceString: Nothing _xcode: -532459699 _xptrs: 0 Source: "System.DirectoryServices" StackTrace: " at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll() I have re-installed the framework and re-registered activeds.dll however this has not resolved the issue. I am guessing I need to find another dll and re-register it however it is not clear which dll this would be. ANSWER: Having used Reflector to have a quick peak at the Directory Services code, it looks like your Active Directory Service Interfaces installation might be kaput. You can download version 2.5 from Technet although I'm not sure if it's the latest version or if it works with Windows 2000.
[ "com", ".net-2.0", "active-directory" ]
1
1
2,034
1
0
2008-08-29T09:41:56.777000
2008-08-29T09:55:21.847000
34,286
34,298
Visually Tag/Mark a Window
I'm looking for a way to visually mark or tag a window (any OS) so that it stands out. A while back, I accidentally replaced a live production database containing thousands of records with an empty dev version, simply because the two instances of Enterprise Manager looked identical to one another. I'd like to avoid that in the future!
None that I'm aware of, but perhaps a virtual desktop system for your OS of choice would help keep the separation a little better for you.
Visually Tag/Mark a Window I'm looking for a way to visually mark or tag a window (any OS) so that it stands out. A while back, I accidentally replaced a live production database containing thousands of records with an empty dev version, simply because the two instances of Enterprise Manager looked identical to one another. I'd like to avoid that in the future!
TITLE: Visually Tag/Mark a Window QUESTION: I'm looking for a way to visually mark or tag a window (any OS) so that it stands out. A while back, I accidentally replaced a live production database containing thousands of records with an empty dev version, simply because the two instances of Enterprise Manager looked identical to one another. I'd like to avoid that in the future! ANSWER: None that I'm aware of, but perhaps a virtual desktop system for your OS of choice would help keep the separation a little better for you.
[ "user-interface" ]
0
1
83
3
0
2008-08-29T09:52:47.983000
2008-08-29T09:59:52.023000
34,300
34,342
Has .NET made raw COM and DCOM programming redundant?
Has the introduction of the.net framework made raw programming in COM and DCOM redundant? (Except for using some COM+ services, e.g. for transaction management through the System.EnterpriseServices namespace)
Not yet, because the OS is still unmanaged. If MS finally do what their labs have been talking about for years and produce a fully managed OS then it will. That OS won't be backwards compatible though. They would have to produce managed versions of Office, IE, etc first. They will have to produce a virtual machine to run unmanaged apps. The pain would be something similar to the move from Mac OS9 to OSX.
Has .NET made raw COM and DCOM programming redundant? Has the introduction of the.net framework made raw programming in COM and DCOM redundant? (Except for using some COM+ services, e.g. for transaction management through the System.EnterpriseServices namespace)
TITLE: Has .NET made raw COM and DCOM programming redundant? QUESTION: Has the introduction of the.net framework made raw programming in COM and DCOM redundant? (Except for using some COM+ services, e.g. for transaction management through the System.EnterpriseServices namespace) ANSWER: Not yet, because the OS is still unmanaged. If MS finally do what their labs have been talking about for years and produce a fully managed OS then it will. That OS won't be backwards compatible though. They would have to produce managed versions of Office, IE, etc first. They will have to produce a virtual machine to run unmanaged apps. The pain would be something similar to the move from Mac OS9 to OSX.
[ ".net", "com", "com+", "dcom" ]
4
10
1,052
5
0
2008-08-29T10:00:33.567000
2008-08-29T10:38:33.037000
34,301
34,315
Multiple web-sites running in IIS simulatenously
At work, we have multiple branches that we may be working on at any time. Our solution so far as been to create multiple web-sites but you can only run one web-site at a time. This makes switching between branches more of a pain that in should be. I just want to go to the URL, mapped in my hosts file, for that branch and it just work. Our client machines are XP machines with IIS 5.1. Is there any way to make IIS 5.1 run more than one web-site simultaneously?
Yes, it is a restriction and this one website can have only 10 simultanious connections. Buy a Windows 2003 or 2008 Small Business Edition, it is quite cost-effective in this scenario.
Multiple web-sites running in IIS simulatenously At work, we have multiple branches that we may be working on at any time. Our solution so far as been to create multiple web-sites but you can only run one web-site at a time. This makes switching between branches more of a pain that in should be. I just want to go to the URL, mapped in my hosts file, for that branch and it just work. Our client machines are XP machines with IIS 5.1. Is there any way to make IIS 5.1 run more than one web-site simultaneously?
TITLE: Multiple web-sites running in IIS simulatenously QUESTION: At work, we have multiple branches that we may be working on at any time. Our solution so far as been to create multiple web-sites but you can only run one web-site at a time. This makes switching between branches more of a pain that in should be. I just want to go to the URL, mapped in my hosts file, for that branch and it just work. Our client machines are XP machines with IIS 5.1. Is there any way to make IIS 5.1 run more than one web-site simultaneously? ANSWER: Yes, it is a restriction and this one website can have only 10 simultanious connections. Buy a Windows 2003 or 2008 Small Business Edition, it is quite cost-effective in this scenario.
[ "iis" ]
4
3
2,064
7
0
2008-08-29T10:00:43.393000
2008-08-29T10:08:49.660000
34,314
34,318
How do I implement Search Functionality in a website?
I want to implement search functionality for a website (assume it is similar to SO). I don't want to use Google search of stuff like that. My question is: How do I implement this? There are two methods I am aware of: Search all the databases in the application when the user gives his query. Index all the data I have and store it somewhere else and query from there (like what Google does). Can anyone tell me which way to go? What are the pros and cons? Better, are there any better ways to do this?
Use lucene, http://lucene.apache.org/java/docs/ Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. It is available in java and.net. It is also in available in php in the form of a zend framework module. Lucene does what you wanted(indexing of the searched items), you have to keep track of a lucene index but it is much better than doing a database search in terms of performance. BTW, SO search is powered by lucene.:D
How do I implement Search Functionality in a website? I want to implement search functionality for a website (assume it is similar to SO). I don't want to use Google search of stuff like that. My question is: How do I implement this? There are two methods I am aware of: Search all the databases in the application when the user gives his query. Index all the data I have and store it somewhere else and query from there (like what Google does). Can anyone tell me which way to go? What are the pros and cons? Better, are there any better ways to do this?
TITLE: How do I implement Search Functionality in a website? QUESTION: I want to implement search functionality for a website (assume it is similar to SO). I don't want to use Google search of stuff like that. My question is: How do I implement this? There are two methods I am aware of: Search all the databases in the application when the user gives his query. Index all the data I have and store it somewhere else and query from there (like what Google does). Can anyone tell me which way to go? What are the pros and cons? Better, are there any better ways to do this? ANSWER: Use lucene, http://lucene.apache.org/java/docs/ Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. It is available in java and.net. It is also in available in php in the form of a zend framework module. Lucene does what you wanted(indexing of the searched items), you have to keep track of a lucene index but it is much better than doing a database search in terms of performance. BTW, SO search is powered by lucene.:D
[ "search" ]
70
40
83,440
7
0
2008-08-29T10:08:12.190000
2008-08-29T10:09:40.830000
34,322
34,466
Do webtests need VS tester edition on the build server?
Using the TFS build server without VS 2008 Team System Tester Edition installed - is it possible to run a series of webtests as part of a build? I know that Webtests can only be recorded using the Tester Edition of VS. Here's a post about this from Jeff, back when he was at Vertigo. I'm just trying to run the tests, though. Does that require the Tester Edition of VS to be installed, as well?
You don't have to have the tester's edition; the Developer Edition works, as long as you can code and run those tests locally. I believe with the standard MSDN license, if you have Developer Edition, you can run a single build server with a copy of it. There might be some extra limitations, such as who can run builds on the server; you should review your license agreement to see if there are any issues.
Do webtests need VS tester edition on the build server? Using the TFS build server without VS 2008 Team System Tester Edition installed - is it possible to run a series of webtests as part of a build? I know that Webtests can only be recorded using the Tester Edition of VS. Here's a post about this from Jeff, back when he was at Vertigo. I'm just trying to run the tests, though. Does that require the Tester Edition of VS to be installed, as well?
TITLE: Do webtests need VS tester edition on the build server? QUESTION: Using the TFS build server without VS 2008 Team System Tester Edition installed - is it possible to run a series of webtests as part of a build? I know that Webtests can only be recorded using the Tester Edition of VS. Here's a post about this from Jeff, back when he was at Vertigo. I'm just trying to run the tests, though. Does that require the Tester Edition of VS to be installed, as well? ANSWER: You don't have to have the tester's edition; the Developer Edition works, as long as you can code and run those tests locally. I believe with the standard MSDN license, if you have Developer Edition, you can run a single build server with a copy of it. There might be some extra limitations, such as who can run builds on the server; you should review your license agreement to see if there are any issues.
[ "tfs", "build-process" ]
0
1
102
1
0
2008-08-29T10:14:21.537000
2008-08-29T15:36:11.267000
34,325
34,329
Should I use a cross-platform GUI-toolkit or rely on the native ones?
On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI. Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have to maintain a seperate Windows-version and Mac-Version anyway) The GUI will probably be very simple and only need very basic functionality. I always felt that native GUIs feel far more intuitive than its cross-platform brethren...
If you have the expertise, use native frontends, it'll effectively double the job you have to do for UI but from my experience non-native UI is a little bit clunkier than their native counterparts.
Should I use a cross-platform GUI-toolkit or rely on the native ones? On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI. Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have to maintain a seperate Windows-version and Mac-Version anyway) The GUI will probably be very simple and only need very basic functionality. I always felt that native GUIs feel far more intuitive than its cross-platform brethren...
TITLE: Should I use a cross-platform GUI-toolkit or rely on the native ones? QUESTION: On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI. Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have to maintain a seperate Windows-version and Mac-Version anyway) The GUI will probably be very simple and only need very basic functionality. I always felt that native GUIs feel far more intuitive than its cross-platform brethren... ANSWER: If you have the expertise, use native frontends, it'll effectively double the job you have to do for UI but from my experience non-native UI is a little bit clunkier than their native counterparts.
[ "c++", "user-interface", "cross-platform" ]
5
8
2,117
7
0
2008-08-29T10:17:08.877000
2008-08-29T10:19:41.757000