PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
60,174
09/12/2008 23:55:00
428,190
08/09/2008 23:23:13
255
32
Best way to stop SQL Injection in PHP
So specifically in a mysql database. Take the following code and tell me what to do. //connect $unsafe_variable = $_POST["user-input"]; mysql_query("INSERT INTO table (column) VALUES ('" . $unsafe_variable . "')"); //disconnect
php
sql
mysql
sql-injection
injection
null
open
Best way to stop SQL Injection in PHP === So specifically in a mysql database. Take the following code and tell me what to do. //connect $unsafe_variable = $_POST["user-input"]; mysql_query("INSERT INTO table (column) VALUES ('" . $unsafe_variable . "')"); //disconnect
0
60,199
09/13/2008 00:19:50
6,218
09/13/2008 00:19:50
1
0
Is it possible to write ActiveX Controls in C# that will run in Excel?
I have been searching on the web for some example code on how we can write a custom ActiveX Control for use in Excel using .NET but so far I have found old articles suggesting that it is not supported. Can anybody give me an indication if it is possible using .NET 1.1 and if so to any pointers on best practices? Thanks David
activex
.net
excel
null
null
null
open
Is it possible to write ActiveX Controls in C# that will run in Excel? === I have been searching on the web for some example code on how we can write a custom ActiveX Control for use in Excel using .NET but so far I have found old articles suggesting that it is not supported. Can anybody give me an indication if it is possible using .NET 1.1 and if so to any pointers on best practices? Thanks David
0
60,204
09/13/2008 00:25:58
4,903
09/06/2008 14:16:54
302
19
Multiple permission types (roles) stored in database as single decimal
I was going to ask a question here about whether or not my design for some users/roles database tables was acceptable, but after some research I came across this question: [What is the best way to handle multiple permission types?][1] [1]: /questions/1451/what-is-the-best-way-to-handle-multiple-permission-types It sounds like an innovative approach, so instead of a many-to-many relationship users\_to\_roles table, I have multiple permissions defined as a single decimal (int data type I presume). That means all permissions for a single user are in one column. It probably won't make sense until you read the other question and answer I can't get my brain around this one. Can someone please explain the conversion process? It sounds "right", but I'm just not getting how I convert the roles to a decimal before it goes in the db, and how it gets converted back when it comes out of the db. I'm using Java, but if you stubbed it out, that would be cool as well. Here is the original answer in the off chance the other question gets deleted: "Personally, I sometimes use a flagged enumeration of permissions. This way you can use AND, OR, NOT and XOR bitwise operations on the enumeration's items. [Flags] public enum Permission { VIEWUSERS = 1, // 2^0 // 0000 0001 EDITUSERS = 2, // 2^1 // 0000 0010 VIEWPRODUCTS = 4, // 2^2 // 0000 0100 EDITPRODUCTS = 8, // 2^3 // 0000 1000 VIEWCLIENTS = 16, // 2^4 // 0001 0000 EDITCLIENTS = 32, // 2^5 // 0010 0000 DELETECLIENTS = 64, // 2^6 // 0100 0000 } Then, you can combine several permissions using the AND bitwise operator. For example, if a user can view & edit users, the binary result of the operation is 0000 0011 which converted to decimal is 3. You can then store the permission of one user into a single column of your DataBase (in our case it would be 3). Inside your application, you just need another bitwise operation (OR) to verify if a user has a particular permission or not."
database
permissions
roles
user
null
null
open
Multiple permission types (roles) stored in database as single decimal === I was going to ask a question here about whether or not my design for some users/roles database tables was acceptable, but after some research I came across this question: [What is the best way to handle multiple permission types?][1] [1]: /questions/1451/what-is-the-best-way-to-handle-multiple-permission-types It sounds like an innovative approach, so instead of a many-to-many relationship users\_to\_roles table, I have multiple permissions defined as a single decimal (int data type I presume). That means all permissions for a single user are in one column. It probably won't make sense until you read the other question and answer I can't get my brain around this one. Can someone please explain the conversion process? It sounds "right", but I'm just not getting how I convert the roles to a decimal before it goes in the db, and how it gets converted back when it comes out of the db. I'm using Java, but if you stubbed it out, that would be cool as well. Here is the original answer in the off chance the other question gets deleted: "Personally, I sometimes use a flagged enumeration of permissions. This way you can use AND, OR, NOT and XOR bitwise operations on the enumeration's items. [Flags] public enum Permission { VIEWUSERS = 1, // 2^0 // 0000 0001 EDITUSERS = 2, // 2^1 // 0000 0010 VIEWPRODUCTS = 4, // 2^2 // 0000 0100 EDITPRODUCTS = 8, // 2^3 // 0000 1000 VIEWCLIENTS = 16, // 2^4 // 0001 0000 EDITCLIENTS = 32, // 2^5 // 0010 0000 DELETECLIENTS = 64, // 2^6 // 0100 0000 } Then, you can combine several permissions using the AND bitwise operator. For example, if a user can view & edit users, the binary result of the operation is 0000 0011 which converted to decimal is 3. You can then store the permission of one user into a single column of your DataBase (in our case it would be 3). Inside your application, you just need another bitwise operation (OR) to verify if a user has a particular permission or not."
0
60,208
09/13/2008 00:36:30
4,907
09/06/2008 14:28:01
1
0
Replacements for switch statement in python?
I want to write a function in python that returns different fixed values based on the value of an input index. In other languages I would use a switch or case statement, but python does not appear to have a switch statement. What are the recommended python solutions in this scenario?
python
switch-statement
null
null
null
null
open
Replacements for switch statement in python? === I want to write a function in python that returns different fixed values based on the value of an input index. In other languages I would use a switch or case statement, but python does not appear to have a switch statement. What are the recommended python solutions in this scenario?
0
60,213
09/13/2008 00:38:31
1,179
08/13/2008 11:20:03
360
30
Why won't my local Apache open html pages?
so, I'm running Apache on my laptop. If I go to "localhost", I get the page that says, > If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page. except, I can't add content and replace that page. I can click on its links, and that works fine. First of all, there's not even an "index.html" document in that directory. If I try to directly access one that I created with localhost/index.html, I get "the request URL was not found on the server." So, I'm not even sure where that page is coming from. I've searched for words in that page under the apache directory, and nothing turns up. It seems to redirect somewhere. Just as a test, I KNOW that it loads localhost/manual/index.html (doesn't matter what that is) so I tried to replace that with something I've written, and I received the message > The server encountered an internal error or misconfiguration and was unable to complete your request. The error log says, > [Fri Sep 12 20:27:54 2008] [error] [client 127.0.0.1] Syntax error in type map, no ':' in C:/Program Files/Apache Group/Apache2/manual/index.html for header <head>\r\n But, that page works fine if I open directly with a browser. so, basically, I don't know what I don't know here. I'm not sure what apache is looking for. I'm not sure if the error is in my config file, my html page, or what. Oh, and the reason I want to open this using apache is (mainly) because I'm trying to test some php, so I'm trying to get apache to run locally. Thanks.
apache
null
null
null
null
null
open
Why won't my local Apache open html pages? === so, I'm running Apache on my laptop. If I go to "localhost", I get the page that says, > If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page. except, I can't add content and replace that page. I can click on its links, and that works fine. First of all, there's not even an "index.html" document in that directory. If I try to directly access one that I created with localhost/index.html, I get "the request URL was not found on the server." So, I'm not even sure where that page is coming from. I've searched for words in that page under the apache directory, and nothing turns up. It seems to redirect somewhere. Just as a test, I KNOW that it loads localhost/manual/index.html (doesn't matter what that is) so I tried to replace that with something I've written, and I received the message > The server encountered an internal error or misconfiguration and was unable to complete your request. The error log says, > [Fri Sep 12 20:27:54 2008] [error] [client 127.0.0.1] Syntax error in type map, no ':' in C:/Program Files/Apache Group/Apache2/manual/index.html for header <head>\r\n But, that page works fine if I open directly with a browser. so, basically, I don't know what I don't know here. I'm not sure what apache is looking for. I'm not sure if the error is in my config file, my html page, or what. Oh, and the reason I want to open this using apache is (mainly) because I'm trying to test some php, so I'm trying to get apache to run locally. Thanks.
0
60,221
09/13/2008 00:53:10
2,128
08/20/2008 13:32:09
333
5
How to animate the command line?
I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this: > [======>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] 37% and of course the loading bar moves and the percent changes, But it doesn't make a new line. I cannot figure out how to do this. Can someone point me in the right direction?
command-line
null
null
null
null
null
open
How to animate the command line? === I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this: > [======>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] 37% and of course the loading bar moves and the percent changes, But it doesn't make a new line. I cannot figure out how to do this. Can someone point me in the right direction?
0
60,244
09/13/2008 01:28:06
2,313
08/21/2008 15:27:23
188
18
Is there raplacement to cat on Windows
I need to join to binary files is *.bat script on Windows. How can I achieve that?
command-line
windows
scripting
null
null
null
open
Is there raplacement to cat on Windows === I need to join to binary files is *.bat script on Windows. How can I achieve that?
0
60,256
09/13/2008 01:57:34
2,915
08/25/2008 23:15:12
3,268
137
How do you balance fun feature creep with time constraints?
I enjoy programming, usually. Tedius stuff is easy to get done as quickly and correctly as possible so I can get through it and not have to see it again. But a lot of my coding is *fun* and when I get in the 'zone' I just really enjoy myself. Which is where I make the mistake of spending too much time, perhaps adding features, perhaps writing it in a cool or elegant manner, or just doing neat prototypes. - How do you recognize this is happening before it exceeds your time frame? - What do you do before starting a potentially fun piece of code, or during, to get back on track? - When is it ok to let yourself go "hog wild" and just enjoy it without worrying about consequences? -Adam
estimation
intermediate
feature-creep
in-the-zone
null
10/31/2011 02:57:33
not constructive
How do you balance fun feature creep with time constraints? === I enjoy programming, usually. Tedius stuff is easy to get done as quickly and correctly as possible so I can get through it and not have to see it again. But a lot of my coding is *fun* and when I get in the 'zone' I just really enjoy myself. Which is where I make the mistake of spending too much time, perhaps adding features, perhaps writing it in a cool or elegant manner, or just doing neat prototypes. - How do you recognize this is happening before it exceeds your time frame? - What do you do before starting a potentially fun piece of code, or during, to get back on track? - When is it ok to let yourself go "hog wild" and just enjoy it without worrying about consequences? -Adam
4
60,259
09/13/2008 02:02:00
1,747
08/18/2008 12:12:28
101
10
How to load an xml string in the code behind to databound UI controls that bind to the XPath of the XML?
Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI. Has anyone found a way to load a dynamic xml string (for example load it from a file during runtime), then use that xml string as the XmlDataprovider source? Code snippets would be great.
wpf
data-binding
xmldataprovider
null
null
null
open
How to load an xml string in the code behind to databound UI controls that bind to the XPath of the XML? === Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI. Has anyone found a way to load a dynamic xml string (for example load it from a file during runtime), then use that xml string as the XmlDataprovider source? Code snippets would be great.
0
60,260
09/13/2008 02:04:20
5,303
09/08/2008 23:31:54
1
0
My first Lisp macro; is it leaky?
I've been working through <a href="http://gigamonkeys.com/book">Practical Common Lisp</a> and as an exercise decided to write a macro to determine if a number is a multiple of another number: <code>(defmacro multp (value factor) `(= (rem ,value ,factor) 0))</code> so that : <code>(multp 40 10)</code> evaluates to true whilst <code>(multp 40 13)</code> does not The question is does this macro <a href="http://gigamonkeys.com/book/macros-defining-your-own.html#plugging-the-leaks">leak</a> in some way? Also is this "good" Lisp? Is there already an existing function/macro that I could have used?
lisp
macro
null
null
null
null
open
My first Lisp macro; is it leaky? === I've been working through <a href="http://gigamonkeys.com/book">Practical Common Lisp</a> and as an exercise decided to write a macro to determine if a number is a multiple of another number: <code>(defmacro multp (value factor) `(= (rem ,value ,factor) 0))</code> so that : <code>(multp 40 10)</code> evaluates to true whilst <code>(multp 40 13)</code> does not The question is does this macro <a href="http://gigamonkeys.com/book/macros-defining-your-own.html#plugging-the-leaks">leak</a> in some way? Also is this "good" Lisp? Is there already an existing function/macro that I could have used?
0
60,269
09/13/2008 02:25:54
3,827
08/31/2008 04:42:17
720
53
How to implement draggable tab using Java Swing?
How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs.
java
gui
swing
tab
null
null
open
How to implement draggable tab using Java Swing? === How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs.
0
60,271
09/13/2008 02:30:32
4,939
09/06/2008 20:36:05
40
1
Best way to write a Safari Extension
What is the best way to write a Safari extension? I've written a couple XUL extensions for Firefox, and now I'd like to write versions of them for Safari. Is there a way that would allow you to add buttons or forms to the browser UI, since this is not possible with an Input manager or Service menu?
safari
apple
plugin-development
null
null
07/27/2012 10:19:15
not constructive
Best way to write a Safari Extension === What is the best way to write a Safari extension? I've written a couple XUL extensions for Firefox, and now I'd like to write versions of them for Safari. Is there a way that would allow you to add buttons or forms to the browser UI, since this is not possible with an Input manager or Service menu?
4
60,274
09/13/2008 02:37:13
4,977
09/07/2008 07:24:42
265
15
What are some good rigid body mechanics references?
I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I took only took through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real problem is reading complex formulas and such, so I'm looking for some decent rigid body mechanics references that will make some sense. Anyone have any good references?
physics
math
null
null
null
null
open
What are some good rigid body mechanics references? === I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I took only took through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real problem is reading complex formulas and such, so I'm looking for some decent rigid body mechanics references that will make some sense. Anyone have any good references?
0
60,285
09/13/2008 02:59:22
525
08/06/2008 14:41:28
203
23
If possible how can one embed PostGreSQL?
If it's possible, I'm interested in being able to embed a PostGreSQL database, similar to [sqllite][1]. I've read that it's [not possible][2]. I'm no database expert though, so I want to hear from you. Essentially I want PostGreSQL without all the configuration and installation. If it's possible, tell me how. [1]: http://www.sqlite.org/ [2]: http://bytes.com/forum/thread647637.html
database
postgresql
embedded
null
null
null
open
If possible how can one embed PostGreSQL? === If it's possible, I'm interested in being able to embed a PostGreSQL database, similar to [sqllite][1]. I've read that it's [not possible][2]. I'm no database expert though, so I want to hear from you. Essentially I want PostGreSQL without all the configuration and installation. If it's possible, tell me how. [1]: http://www.sqlite.org/ [2]: http://bytes.com/forum/thread647637.html
0
60,290
09/13/2008 03:10:18
3,764
08/30/2008 16:14:55
57
3
Can I change the appearance of an html image during hover without a second image?
Is there a way to change the appearance of an icon (ie. contrast / luminosity) when I hover the cursor, without requiring a second image file?
html
css
image
null
null
null
open
Can I change the appearance of an html image during hover without a second image? === Is there a way to change the appearance of an icon (ie. contrast / luminosity) when I hover the cursor, without requiring a second image file?
0
60,293
09/13/2008 03:12:48
1,327
08/14/2008 14:37:22
493
38
Listview background drawing problem C# Winform.
I have a little problem with a Listview. I can load it with listview items fine, but when I set the background color it doesn't draw the color all the way to the left side of the row [The listViewItems are loaded with ListViewSubItems to make a grid view, only the first column shows the error]. There is a a narrow strip that doesn't paint. The width of that strip is approximatly the same as a row header would be if I had a row header. If you have a thought on what can be done to make the background draw I'd love to hear it. Now just to try a new idea, I'm offering a ten vote bounty for the first solution that still has me using this awfull construct of a mess of a psuedo grid view. [I love legacy code.]
c#
winforms
listview
bounty
null
null
open
Listview background drawing problem C# Winform. === I have a little problem with a Listview. I can load it with listview items fine, but when I set the background color it doesn't draw the color all the way to the left side of the row [The listViewItems are loaded with ListViewSubItems to make a grid view, only the first column shows the error]. There is a a narrow strip that doesn't paint. The width of that strip is approximatly the same as a row header would be if I had a row header. If you have a thought on what can be done to make the background draw I'd love to hear it. Now just to try a new idea, I'm offering a ten vote bounty for the first solution that still has me using this awfull construct of a mess of a psuedo grid view. [I love legacy code.]
0
60,330
09/13/2008 04:37:18
4,228
09/02/2008 13:12:45
38
5
What function does a tag cloud serve?
I see them all the time and always ignore them. Can someone explain to me why they have become so prevalent? If I'm using a site that allows me to explore it via tags (e.g., this one, del.icio.us, etc.) that's what I will do. Why would I need a "cloud" of tags upon which to click? I can just type that tag(s) into a search box. What am I missing?
tags
null
null
null
null
null
open
What function does a tag cloud serve? === I see them all the time and always ignore them. Can someone explain to me why they have become so prevalent? If I'm using a site that allows me to explore it via tags (e.g., this one, del.icio.us, etc.) that's what I will do. Why would I need a "cloud" of tags upon which to click? I can just type that tag(s) into a search box. What am I missing?
0
60,331
09/13/2008 04:40:37
4,240
09/02/2008 13:51:18
78
5
C++ Quiz - Singletons
I'll soon be posting an article on [my blog][1], but I'd like to verify I haven't missed anything first. Find an example I've missed, and I'll cite you on my post... The topic is failed Singleton implementations - in what cases can you *accidentally* get multiple instances of a singleton? So far, I've come up with Race Condition on first call to instance() Incorporation into multiple DLLs or DLL and executable Template definition of a singleton - actually separate classes Any other ways I'm missing - perhaps with inheritance? Please help improve my post... [1]: http://theschmitzer.blogspot.com
c++
oop
patterns
null
null
null
open
C++ Quiz - Singletons === I'll soon be posting an article on [my blog][1], but I'd like to verify I haven't missed anything first. Find an example I've missed, and I'll cite you on my post... The topic is failed Singleton implementations - in what cases can you *accidentally* get multiple instances of a singleton? So far, I've come up with Race Condition on first call to instance() Incorporation into multiple DLLs or DLL and executable Template definition of a singleton - actually separate classes Any other ways I'm missing - perhaps with inheritance? Please help improve my post... [1]: http://theschmitzer.blogspot.com
0
60,352
09/13/2008 05:51:17
2,679
08/24/2008 14:31:44
265
17
Can distutils create empty __init__.py files
If all my `__init__.py` files are empty, do I have to store them into version control, or is there a way to make distutils create empty `__init__.py` files during installation?
python
distutils
null
null
null
null
open
Can distutils create empty __init__.py files === If all my `__init__.py` files are empty, do I have to store them into version control, or is there a way to make distutils create empty `__init__.py` files during installation?
0
60,360
09/13/2008 06:14:52
4,639
09/04/2008 23:07:22
172
2
AJAX Library Strategies
What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed is there a practical limit to the size/number of libraries to include or is this negligible? Are there pairs that work particularly well together (e.g. Prototype/Scriptaculous) or pairs that don't?
ajax
jquery
yui
prototype
scriptaculous
null
open
AJAX Library Strategies === What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed is there a practical limit to the size/number of libraries to include or is this negligible? Are there pairs that work particularly well together (e.g. Prototype/Scriptaculous) or pairs that don't?
0
60,368
09/13/2008 06:42:46
5,004
09/07/2008 10:03:29
247
4
continues integration web service
I am in a position where I could become a team leader of a team distributed over two countries. This team would be the tech. team for a start up company that we plan to bootstrap on limited funds. So I am trying to find out ways to minimize upfront expenses. Right now we are planning to use Java and will have a lot of junit tests. I am planing on using github for VCS and lighthouse for a bug tracker. In addition I want to add a continues integration server but I do not know of any continues integration servers that are offered as a web service. Does anybody know if there are continues integration servers available in a software as a service model? P.S. if anybody knows were I can get these three services at one location that would be great to know to.
continuous-integration
team
collaboration
remote
null
05/05/2012 18:57:36
not constructive
continues integration web service === I am in a position where I could become a team leader of a team distributed over two countries. This team would be the tech. team for a start up company that we plan to bootstrap on limited funds. So I am trying to find out ways to minimize upfront expenses. Right now we are planning to use Java and will have a lot of junit tests. I am planing on using github for VCS and lighthouse for a bug tracker. In addition I want to add a continues integration server but I do not know of any continues integration servers that are offered as a web service. Does anybody know if there are continues integration servers available in a software as a service model? P.S. if anybody knows were I can get these three services at one location that would be great to know to.
4
60,369
09/13/2008 06:47:53
4,883
09/06/2008 10:24:59
818
5
Alternative to PHP QuickForm?
I'm currently playing around with [HTML_QuickForm](http://pear.php.net/package/HTML_QuickForm) for generating forms in PHP. It seems kind of limited in that it's hard to insert my own javascript or customizing the display and grouping of certain elements. Are there any alternatives to QuickForm that might provide more flexibility?
php
null
null
null
null
null
open
Alternative to PHP QuickForm? === I'm currently playing around with [HTML_QuickForm](http://pear.php.net/package/HTML_QuickForm) for generating forms in PHP. It seems kind of limited in that it's hard to insert my own javascript or customizing the display and grouping of certain elements. Are there any alternatives to QuickForm that might provide more flexibility?
0
60,394
09/13/2008 07:53:06
1,324,220
08/23/2008 19:01:43
655
27
Calculate code metrics
Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?
metrics
null
null
null
null
null
open
Calculate code metrics === Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?
0
60,409
09/13/2008 08:26:34
4,867
09/06/2008 08:12:36
21
1
In PHP is it possible to use a function inside a variable
I know in php you can embed variables inside variables, like: <? $var1 = "I\'m including {$var2} in this variable.."; ?> But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write: <?php $var1 = "I\'m including "; $var1 .= somefunc(); $var1 = " in this variable.."; ?> But what if I have a long variable for output, and I don't want to do that every time, or I want to use multiple functions: <?php $var1 = <<<EOF <html lang="en"> <head> <title>AAAHHHHH</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> There is <b>alot</b> of text and html here... but I want some <i>functions</i>! -somefunc() doesn't work -{somefunc()} doesn't work -$somefunc() and {$somefunc()} doesn't work of course because a function needs to be a string -more non-working: ${somefunc()} </body> </html> EOF; ?> Or I want dynamic changes in that load of code: <? function somefunc($stuff){ $output = "my bold text <b>{$stuff}</b>."; return $output; } $var1 = <<<EOF <html lang="en"> <head> <title>AAAHHHHH</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> somefunc("is awesome!") somefunc("is actually not so awesome..") because somefunc("won\'t work due to my problem.") </body> </html> EOF; ?> Well?
php
html
function
variables
null
null
open
In PHP is it possible to use a function inside a variable === I know in php you can embed variables inside variables, like: <? $var1 = "I\'m including {$var2} in this variable.."; ?> But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write: <?php $var1 = "I\'m including "; $var1 .= somefunc(); $var1 = " in this variable.."; ?> But what if I have a long variable for output, and I don't want to do that every time, or I want to use multiple functions: <?php $var1 = <<<EOF <html lang="en"> <head> <title>AAAHHHHH</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> There is <b>alot</b> of text and html here... but I want some <i>functions</i>! -somefunc() doesn't work -{somefunc()} doesn't work -$somefunc() and {$somefunc()} doesn't work of course because a function needs to be a string -more non-working: ${somefunc()} </body> </html> EOF; ?> Or I want dynamic changes in that load of code: <? function somefunc($stuff){ $output = "my bold text <b>{$stuff}</b>."; return $output; } $var1 = <<<EOF <html lang="en"> <head> <title>AAAHHHHH</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> somefunc("is awesome!") somefunc("is actually not so awesome..") because somefunc("won\'t work due to my problem.") </body> </html> EOF; ?> Well?
0
60,419
09/13/2008 08:45:16
3,661
08/29/2008 18:16:14
40
2
Do I really need to use transactions in stored procedures? [MSSQL 2005]
I'm writing a pretty straightforward e-commerce app in asp.net, do i need to use transactions in my stored procedures?
asp.net
sql
sql-server
null
null
null
open
Do I really need to use transactions in stored procedures? [MSSQL 2005] === I'm writing a pretty straightforward e-commerce app in asp.net, do i need to use transactions in my stored procedures?
0
60,422
09/13/2008 08:49:41
3,390
08/28/2008 12:25:07
76
3
IDebugProgramProvider2.GetProviderProcessData on Vista
As part of a JavaScript Profiler for IE 6/7 I needed to load a custom debugger that I created into IE. I got this working fine on XP, but couldn't get it working on Vista (full story here: [http://damianblog.com/2008/09/09/tracejs-v2-rip/][1]). The call to GetProviderProcessData is failing on Vista. Anyone have any suggestions? Thanks, Damian // Create the MsProgramProvider IDebugProgramProvider2* pIDebugProgramProvider2 = 0; HRESULT st = CoCreateInstance(CLSID_MsProgramProvider, 0, CLSCTX_ALL, IID_IDebugProgramProvider2, (void**)&pIDebugProgramProvider2); if(st != S_OK) { return st; } // Get the IDebugProgramNode2 instances running in this process AD_PROCESS_ID processID; processID.ProcessId.dwProcessId = GetCurrentProcessId(); processID.ProcessIdType = AD_PROCESS_ID_SYSTEM; CONST_GUID_ARRAY engineFilter; engineFilter.dwCount = 0; PROVIDER_PROCESS_DATA processData; st = pIDebugProgramProvider2->GetProviderProcessData(PFLAG_GET_PROGRAM_NODES|PFLAG_DEBUGGEE, 0, processID, engineFilter, &processData); if(st != S_OK) { ShowError(L"GPPD Failed", st); pIDebugProgramProvider2->Release(); return st; } [1]: http://damianblog.com/2008/09/09/tracejs-v2-rip/
c++
debugging
null
null
null
null
open
IDebugProgramProvider2.GetProviderProcessData on Vista === As part of a JavaScript Profiler for IE 6/7 I needed to load a custom debugger that I created into IE. I got this working fine on XP, but couldn't get it working on Vista (full story here: [http://damianblog.com/2008/09/09/tracejs-v2-rip/][1]). The call to GetProviderProcessData is failing on Vista. Anyone have any suggestions? Thanks, Damian // Create the MsProgramProvider IDebugProgramProvider2* pIDebugProgramProvider2 = 0; HRESULT st = CoCreateInstance(CLSID_MsProgramProvider, 0, CLSCTX_ALL, IID_IDebugProgramProvider2, (void**)&pIDebugProgramProvider2); if(st != S_OK) { return st; } // Get the IDebugProgramNode2 instances running in this process AD_PROCESS_ID processID; processID.ProcessId.dwProcessId = GetCurrentProcessId(); processID.ProcessIdType = AD_PROCESS_ID_SYSTEM; CONST_GUID_ARRAY engineFilter; engineFilter.dwCount = 0; PROVIDER_PROCESS_DATA processData; st = pIDebugProgramProvider2->GetProviderProcessData(PFLAG_GET_PROGRAM_NODES|PFLAG_DEBUGGEE, 0, processID, engineFilter, &processData); if(st != S_OK) { ShowError(L"GPPD Failed", st); pIDebugProgramProvider2->Release(); return st; } [1]: http://damianblog.com/2008/09/09/tracejs-v2-rip/
0
60,436
09/13/2008 09:35:37
5,189
09/08/2008 11:44:07
133
10
What is the benefit of using ONLY OpenId authentication on a site?
From my experience with OpenId, I see a number of significant downsides: **Adds a critical point to failure to the site**<br> It is not a failure that can be fixed by the site even if detected. If the open-id provider is down for three days, what recourse does the site have to allow its users to login and access the information they own? **Takes a user to another sites content and every time they logon to your site**<br> Even if the open-id provider does not have an error, the user is re-directed to their site to login. The login page has content and links. So there is a chance a user will actually be drawn away from the site to go down the internet rabbit hole. Why would I want to send my users to another company's website? **Adds a non-trial amount of time to the signup**<br> To sign up with the site a new user is forced to read a new standard, chose a provider, and signup. Standards are something that the technical people should agree to in order to make a user experience frictionless, they are not something that should be thrust on the users. ------ For all of the downside, the one upside is to allow users to have fewer logins on the net. If a site has opt-in for OpenId then users who want that feature can use it. **What I would like to understand is:** What benefit does a site get for making OpenId <b>mandatory</b>?
openid
null
null
null
null
null
open
What is the benefit of using ONLY OpenId authentication on a site? === From my experience with OpenId, I see a number of significant downsides: **Adds a critical point to failure to the site**<br> It is not a failure that can be fixed by the site even if detected. If the open-id provider is down for three days, what recourse does the site have to allow its users to login and access the information they own? **Takes a user to another sites content and every time they logon to your site**<br> Even if the open-id provider does not have an error, the user is re-directed to their site to login. The login page has content and links. So there is a chance a user will actually be drawn away from the site to go down the internet rabbit hole. Why would I want to send my users to another company's website? **Adds a non-trial amount of time to the signup**<br> To sign up with the site a new user is forced to read a new standard, chose a provider, and signup. Standards are something that the technical people should agree to in order to make a user experience frictionless, they are not something that should be thrust on the users. ------ For all of the downside, the one upside is to allow users to have fewer logins on the net. If a site has opt-in for OpenId then users who want that feature can use it. **What I would like to understand is:** What benefit does a site get for making OpenId <b>mandatory</b>?
0
60,438
09/13/2008 09:37:02
2,138
08/20/2008 14:23:45
125
10
access $(this) with href="javascript:..." in JQuery
I am using JQuery. I call a javascript function with next html: <li><span><a href="javascript:uncheckEl('tagVO-$id')">$tagname</a></span></li> I would like to **remove the *li*** element and i thought this would be easy with the **$(this)** object. This is my javascript function: function uncheckEl(id) { $("#"+id+"").attr("checked",""); $("#"+id+"").parent("li").css("color","black"); $(this).parent("li").remove(); // This is not working retrieveItems(); } But **$(this)** is undefined. Any ideas?
jquery
null
null
null
null
null
open
access $(this) with href="javascript:..." in JQuery === I am using JQuery. I call a javascript function with next html: <li><span><a href="javascript:uncheckEl('tagVO-$id')">$tagname</a></span></li> I would like to **remove the *li*** element and i thought this would be easy with the **$(this)** object. This is my javascript function: function uncheckEl(id) { $("#"+id+"").attr("checked",""); $("#"+id+"").parent("li").css("color","black"); $(this).parent("li").remove(); // This is not working retrieveItems(); } But **$(this)** is undefined. Any ideas?
0
60,446
09/13/2008 09:56:04
6,254
09/13/2008 09:53:39
1
0
Windows Mobile development in Python
What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?
windows
python
mobile
null
null
null
open
Windows Mobile development in Python === What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?
0
60,455
09/13/2008 10:21:08
1,915
08/19/2008 14:11:04
225
17
Take a screenshot of a webpage with javascript?
Is it possible to to take a screenshot of a webpage with javascript and then submit that back to the server? I'm not so concerned with browser security issues etc as the implementation would be for [HTA][1]. But is it possible? [1]: http://msdn.microsoft.com/en-us/library/ms536471(vs.85).aspx
javascript
null
null
null
null
null
open
Take a screenshot of a webpage with javascript? === Is it possible to to take a screenshot of a webpage with javascript and then submit that back to the server? I'm not so concerned with browser security issues etc as the implementation would be for [HTA][1]. But is it possible? [1]: http://msdn.microsoft.com/en-us/library/ms536471(vs.85).aspx
0
60,456
09/13/2008 10:22:50
3,263
08/27/2008 15:33:09
207
13
DynamicPopulateExtender ,TextArea and line feeds
I have this in a page : <textarea id="taEditableContent" runat="server" rows="5"></textarea> <ajaxToolkit:DynamicPopulateExtender ID="dpeEditPopulate" runat="server" TargetControlID="taEditableContent" ClearContentsDuringUpdate="true" PopulateTriggerControlID="hLink" ServicePath="/Content.asmx" ServiceMethod="EditContent" ContextKey='<%=ContextKey %>' /> Basically, a DynamicPopulateExtender that fills the contents of a textarea from a webservice. Problem is, no matter how I return the line breaks, the text in the text area will have no line feeds. If I return the newlines as "br/" the entire text area remains empty. If I return new lines as "/r/n" , I get all the text as one continous line. The webservice returns the string correctly: <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://rprealm.com/">First line Third line Fourth line</string> But what I get in the text area is : First line Third line Fourth line
web-services
soap
ajaxtoolkit
null
null
null
open
DynamicPopulateExtender ,TextArea and line feeds === I have this in a page : <textarea id="taEditableContent" runat="server" rows="5"></textarea> <ajaxToolkit:DynamicPopulateExtender ID="dpeEditPopulate" runat="server" TargetControlID="taEditableContent" ClearContentsDuringUpdate="true" PopulateTriggerControlID="hLink" ServicePath="/Content.asmx" ServiceMethod="EditContent" ContextKey='<%=ContextKey %>' /> Basically, a DynamicPopulateExtender that fills the contents of a textarea from a webservice. Problem is, no matter how I return the line breaks, the text in the text area will have no line feeds. If I return the newlines as "br/" the entire text area remains empty. If I return new lines as "/r/n" , I get all the text as one continous line. The webservice returns the string correctly: <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://rprealm.com/">First line Third line Fourth line</string> But what I get in the text area is : First line Third line Fourth line
0
60,461
09/13/2008 10:30:33
123
08/02/2008 08:01:26
1,815
106
Programmatically get own phone number in Symbian
How to get the phone number of the device in Symbian?
symbian
telephony
null
null
null
null
open
Programmatically get own phone number in Symbian === How to get the phone number of the device in Symbian?
0
60,464
09/13/2008 10:34:52
340
08/04/2008 18:49:59
157
2
Changing the default folder in emacs
I am fairly new to emacs and I have been trying to figure out how to change the default folder for c-x c-f on start up. For instance when I first load emacs and hit c-x c-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some way to customize the .emacs file to do this, but I am still unsure what that is.
emacs
folder
null
null
null
null
open
Changing the default folder in emacs === I am fairly new to emacs and I have been trying to figure out how to change the default folder for c-x c-f on start up. For instance when I first load emacs and hit c-x c-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the desktop. I believe there is some way to customize the .emacs file to do this, but I am still unsure what that is.
0
60,474
09/13/2008 10:58:27
4,977
09/07/2008 07:24:42
282
17
Using the DLR for (primarily) static language compilation...
I'm building a compiler that targets .NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of the code is completely static. So now that that's been explained, I have the following questions: - Has the DLR been used for static compilation, outside of small examples on MSDN blogs? - If so, what sort of performance was achieved? - If not, is there anything fundamentally preventing this? - Are there any better mechanisms of generating code than either using the DLR or emitting IL directly? Any insight into this or references to blogs/code/talks would be greatly appreciated.
.net
compiler
language
cil
dlr
null
open
Using the DLR for (primarily) static language compilation... === I'm building a compiler that targets .NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of the code is completely static. So now that that's been explained, I have the following questions: - Has the DLR been used for static compilation, outside of small examples on MSDN blogs? - If so, what sort of performance was achieved? - If not, is there anything fundamentally preventing this? - Are there any better mechanisms of generating code than either using the DLR or emitting IL directly? Any insight into this or references to blogs/code/talks would be greatly appreciated.
0
60,477
09/13/2008 11:09:32
1,768
08/18/2008 13:32:15
284
16
Getting started with REST
I am looking for some good links with best practices and sample code on creating [REST][1]ful services using .NET. Also, any other input you might have regarding REST would be greatly appreciated. [1]: http://en.wikipedia.org/wiki/Representational_State_Transfer
.net
rest
null
null
null
null
open
Getting started with REST === I am looking for some good links with best practices and sample code on creating [REST][1]ful services using .NET. Also, any other input you might have regarding REST would be greatly appreciated. [1]: http://en.wikipedia.org/wiki/Representational_State_Transfer
0
60,478
09/13/2008 11:09:53
4,857
09/06/2008 03:07:01
81
3
Self Testing Systems.
I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently.<br><br> The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically.<br><br><br> Here is the scenario:<br><br> * So we hash out a system quickly to a specified set of interfaces, it has zero optimizations, yet we are confident that it is 100% stable though *( a dubious claim, but for the sake of this scenario please play along )*<br><br> * We then profile the original classes, and start to program replacements for the bottlenecks.<br><br> * The original and the replacement are initiated simultaneously and synchronized: the original is allowed to run to completion, if the replacement hasn´t completed it is vetoed by the system as a replacement for the original. A replacement must always return the same value as the original, for a specified number of times, and for a specific range of values.<br><br> * If exception occurs after a replacement is adopted, the system automatically tries the same operation with a class which superseded it.<br><br><br> Seen a similar concept in practise ?<br><br> Critique Please
language-agnostic
unit-testing
design
null
null
null
open
Self Testing Systems. === I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently.<br><br> The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically.<br><br><br> Here is the scenario:<br><br> * So we hash out a system quickly to a specified set of interfaces, it has zero optimizations, yet we are confident that it is 100% stable though *( a dubious claim, but for the sake of this scenario please play along )*<br><br> * We then profile the original classes, and start to program replacements for the bottlenecks.<br><br> * The original and the replacement are initiated simultaneously and synchronized: the original is allowed to run to completion, if the replacement hasn´t completed it is vetoed by the system as a replacement for the original. A replacement must always return the same value as the original, for a specified number of times, and for a specific range of values.<br><br> * If exception occurs after a replacement is adopted, the system automatically tries the same operation with a class which superseded it.<br><br><br> Seen a similar concept in practise ?<br><br> Critique Please
0
60,484
09/13/2008 11:29:17
6,258
09/13/2008 11:19:45
1
1
What's the best way to write JavaScript/Ruby applications on Windows Mobile device?
I recently bought a Windows Mobile device and since I'm a developer I want to use it as a development platform. Yes, it's not supposed to be used like that but it's always with me and my laptop isn't. I know [cke][1] is a good editor for code but how can I run JavaScript/Ruby code without too much of a headache? I probably could write a web application, send code to it and get the results back but maybe there's better solutions? [1]: http://www.animaniak.com/cke/cke_main.asp
javascript
ruby
windows-mobile
pocketpc
wm
null
open
What's the best way to write JavaScript/Ruby applications on Windows Mobile device? === I recently bought a Windows Mobile device and since I'm a developer I want to use it as a development platform. Yes, it's not supposed to be used like that but it's always with me and my laptop isn't. I know [cke][1] is a good editor for code but how can I run JavaScript/Ruby code without too much of a headache? I probably could write a web application, send code to it and get the results back but maybe there's better solutions? [1]: http://www.animaniak.com/cke/cke_main.asp
0
60,507
09/13/2008 12:53:06
6,266
09/13/2008 12:51:36
1
0
C++ function pointers problem
ok say I have void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or static class method Render(MainMenuRender); Render(MainMenu::Render); However I really want to be able to use a class method as well since in most cases the rendering function will want to access member varribles, and Id rather not make the class instance global...eg Render(MainMenu->Render); However I really have no idea how to do this, and still allow functions and static methods to be used.
c++
function-pointers
null
null
null
null
open
C++ function pointers problem === ok say I have void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or static class method Render(MainMenuRender); Render(MainMenu::Render); However I really want to be able to use a class method as well since in most cases the rendering function will want to access member varribles, and Id rather not make the class instance global...eg Render(MainMenu->Render); However I really have no idea how to do this, and still allow functions and static methods to be used.
0
60,516
09/13/2008 13:05:04
3,055
08/26/2008 13:54:44
691
63
Where to put master page's code in an MVC application?
I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc. So my question was, where should I put these master-page database calling code? Normally, these should goes into its own controller class right? But then that'd mean I'd have to wire them up manually (e.g. passing ViewDatas) since it is out of the normal routing framework provided by the MVC framework. Is there a way to this cleanly without wiring ViewData passing/Action calls to master pages manually or subclassing the frameworks'? The amount of documentation is very low... and I'm very new to all this including the concepts of MVC itself so please share your tips/techniques on this. Thanks!
asp.net-mvc
design
mvc
null
null
null
open
Where to put master page's code in an MVC application? === I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc. So my question was, where should I put these master-page database calling code? Normally, these should goes into its own controller class right? But then that'd mean I'd have to wire them up manually (e.g. passing ViewDatas) since it is out of the normal routing framework provided by the MVC framework. Is there a way to this cleanly without wiring ViewData passing/Action calls to master pages manually or subclassing the frameworks'? The amount of documentation is very low... and I'm very new to all this including the concepts of MVC itself so please share your tips/techniques on this. Thanks!
0
60,518
09/13/2008 13:07:39
5,190
09/08/2008 12:03:43
1,131
72
What are the problems of using transactions in a database?
From [this post][1]. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If yes, how would you define them? [1]: http://stackoverflow.com/questions/60419/do-i-really-need-to-use-transactions-in-stored-procedures-mssql-2005
sql
transactions
null
null
null
null
open
What are the problems of using transactions in a database? === From [this post][1]. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If yes, how would you define them? [1]: http://stackoverflow.com/questions/60419/do-i-really-need-to-use-transactions-in-stored-procedures-mssql-2005
0
60,542
09/13/2008 13:38:39
49,824
09/13/2008 13:38:39
11
1
Smoothing Zedgraph linegraphs withouth 'bumps'
When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles. While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little 'dive' or 'bump' before going upwards or downwards. In most cases, if the datapoint are themselves kinda smooth, this isn't a problem, but if you'r datapoints go from say 0 to 15, the 'dive' makes the line go under the x-axis, which makes it seems as though there are some datapoints below zero (which is not the case). How can I fix this (prefably easily ;)
linegraph
smooth
zedgraph
null
null
null
open
Smoothing Zedgraph linegraphs withouth 'bumps' === When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles. While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little 'dive' or 'bump' before going upwards or downwards. In most cases, if the datapoint are themselves kinda smooth, this isn't a problem, but if you'r datapoints go from say 0 to 15, the 'dive' makes the line go under the x-axis, which makes it seems as though there are some datapoints below zero (which is not the case). How can I fix this (prefably easily ;)
0
60,547
09/13/2008 13:47:04
1,816
08/18/2008 17:35:38
195
27
C (or any) compilers deterministic performance
Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: >How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and that the compiler is fully deterministic? To this question I had absolutely no reply as I have always taken the compiler for granted. It takes in code and spews out machine code. How can I go about and test that the compiler isn't actually adding functionality that I haven't asked it for? or even more dangerously implementing code in a slightly different manner to that which I expect? I am aware that this is perhapse not really an issue for everyone, and indeed the answer might just be... "you're over a barrel and deal with it". However, when working in an embedded environment, you trust your compiler implicitly. How can I prove to myself and QA that I am right in doing so?
c
compiler
deterministic
null
null
null
open
C (or any) compilers deterministic performance === Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: >How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and that the compiler is fully deterministic? To this question I had absolutely no reply as I have always taken the compiler for granted. It takes in code and spews out machine code. How can I go about and test that the compiler isn't actually adding functionality that I haven't asked it for? or even more dangerously implementing code in a slightly different manner to that which I expect? I am aware that this is perhapse not really an issue for everyone, and indeed the answer might just be... "you're over a barrel and deal with it". However, when working in an embedded environment, you trust your compiler implicitly. How can I prove to myself and QA that I am right in doing so?
0
60,558
09/13/2008 14:16:35
6,277
09/13/2008 14:11:42
1
0
Terminal emulation in Flex
I need to do some emulation of some old DOS or mainframe terminals in Flex. Something like the image below for example. ![alt text][1] The different coloured text is easy enough, but the ability to do different background colours, such as the yellow background is beyond the capabilities of the standard Flash text. I may also need to be able to enter text at certain places and scroll text up the "terminal". Any idea how I'd attack this? Or better still, any existing code/components for this sort of thing? Thanks in advance. Evan [1]: http://i36.tinypic.com/2encfes.png
flex
null
null
null
null
null
open
Terminal emulation in Flex === I need to do some emulation of some old DOS or mainframe terminals in Flex. Something like the image below for example. ![alt text][1] The different coloured text is easy enough, but the ability to do different background colours, such as the yellow background is beyond the capabilities of the standard Flash text. I may also need to be able to enter text at certain places and scroll text up the "terminal". Any idea how I'd attack this? Or better still, any existing code/components for this sort of thing? Thanks in advance. Evan [1]: http://i36.tinypic.com/2encfes.png
0
60,565
09/13/2008 14:25:30
6,276
09/13/2008 14:11:05
1
0
How to run executable at end of Setup Project?
I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to get the Setup Project to run an executable after the install finishes. An ideas? NOTE: You cannot use Custom Actions because these are used as part of the install process, I want to run my installed application once the user presses the 'Close' button at the end of the install.
winforms
setup
null
null
null
null
open
How to run executable at end of Setup Project? === I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to get the Setup Project to run an executable after the install finishes. An ideas? NOTE: You cannot use Custom Actions because these are used as part of the install process, I want to run my installed application once the user presses the 'Close' button at the end of the install.
0
60,569
09/13/2008 14:30:08
5,304
09/09/2008 00:22:24
355
11
How do I create an in-memory Handle in haskell?
I want something that looks like a file Handle but is really backed by an in-memory buffer to use for IO redirects. How can I do this?
file-io
io
haskell
null
null
null
open
How do I create an in-memory Handle in haskell? === I want something that looks like a file Handle but is really backed by an in-memory buffer to use for IO redirects. How can I do this?
0
60,570
09/13/2008 14:30:29
445,087
09/02/2008 17:25:48
451
13
Usage of the "PIML" Idiom
Backgrounder: The PIML Idiom is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of. This hides internal implementation details and data from the user of the library. When implementing the this idiom why would you place the public methods on the pimpl class and not the public class since the public classes method implementaions would be compiled into the library and the user only has the header file? To illustrate, this code puts the Purr() implementation on the impl class and wraps it as well, why not implement Purr directly on the public class? //header file: class Cat { private: class CatImpl; // Not defined here CatImpl *cat_; // Handle public: Cat(); // Constructor ~Cat(); // Destructor // Other operations... Purr(); }; //CPP file: #include "cat.h" class Cat::CatImpl { Purr(); ... // The actual implementation can be anything }; Cat::Cat() { cat_ = new CatImpl; } Cat::~Cat() { delete cat_; } Cat::Purr(){ cat_->Purr(); } CatImpl::Purr(){ printf("purrrrrr"); }
c++
oop
opague-pointer
pimpl-idiom
information-hiding
null
open
Usage of the "PIML" Idiom === Backgrounder: The PIML Idiom is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of. This hides internal implementation details and data from the user of the library. When implementing the this idiom why would you place the public methods on the pimpl class and not the public class since the public classes method implementaions would be compiled into the library and the user only has the header file? To illustrate, this code puts the Purr() implementation on the impl class and wraps it as well, why not implement Purr directly on the public class? //header file: class Cat { private: class CatImpl; // Not defined here CatImpl *cat_; // Handle public: Cat(); // Constructor ~Cat(); // Destructor // Other operations... Purr(); }; //CPP file: #include "cat.h" class Cat::CatImpl { Purr(); ... // The actual implementation can be anything }; Cat::Cat() { cat_ = new CatImpl; } Cat::~Cat() { delete cat_; } Cat::Purr(){ cat_->Purr(); } CatImpl::Purr(){ printf("purrrrrr"); }
0
60,573
09/13/2008 14:40:21
4,653
09/05/2008 00:53:33
13
1
XmlSerializer - There was an error reflecting type
Using csharp Dotnet 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: **There was an error reflecting type.** Inside the data class there is another composite object. Does this also need to have the [Serializable] attribute or by having it on the top object does it recursively apply it to all objects inside? any thoughts?
c#
xml
serialization
null
null
null
open
XmlSerializer - There was an error reflecting type === Using csharp Dotnet 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: **There was an error reflecting type.** Inside the data class there is another composite object. Does this also need to have the [Serializable] attribute or by having it on the top object does it recursively apply it to all objects inside? any thoughts?
0
60,585
09/13/2008 14:57:45
2,581
08/23/2008 04:37:51
81
7
PHP Forms-Based Authentication on Windows using Local User Accounts
I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM). I know that if Active Directory is setup, you can use the PHP LDAP module to connect and authenticate in your script, but without AD there is no LDAP. What is the equivalent for standalone machines?
php
windows
apache
authentication
sam
null
open
PHP Forms-Based Authentication on Windows using Local User Accounts === I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM). I know that if Active Directory is setup, you can use the PHP LDAP module to connect and authenticate in your script, but without AD there is no LDAP. What is the equivalent for standalone machines?
0
60,590
09/13/2008 15:00:28
4,376
09/03/2008 09:30:40
142
12
Best way to initiate a download?
On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment." A couple of possible approaches I know about, and browser compatibility (based on a quick test): 1) Do a window.open pointing to the new file. *FireFox 3 blocks this. *IE6 blocks this. *IE7 blocks this. 2) Create an iframe pointing to the new file. *FireFox 3 seems to think this is OK. (Maybe it's because I already accepted it once?) *IE6 blocks this. *IE7 blocks this. How can I do this so that at least these three browsers will not object? Bonus: is there a method that doesn't require browser-conditional statements? (I believe that download.com employs both methods conditionally, but I can't get either one to work.)
download
php
javascript
null
null
null
open
Best way to initiate a download? === On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment." A couple of possible approaches I know about, and browser compatibility (based on a quick test): 1) Do a window.open pointing to the new file. *FireFox 3 blocks this. *IE6 blocks this. *IE7 blocks this. 2) Create an iframe pointing to the new file. *FireFox 3 seems to think this is OK. (Maybe it's because I already accepted it once?) *IE6 blocks this. *IE7 blocks this. How can I do this so that at least these three browsers will not object? Bonus: is there a method that doesn't require browser-conditional statements? (I believe that download.com employs both methods conditionally, but I can't get either one to work.)
0
9,944,247
03/30/2012 13:47:26
220,255
11/27/2009 21:29:40
492
15
reportlab ValueError: Invalid color value 'initial'
ReportLab/xhtml2pdf have worked perfectly until now when it crashes at this style bit in HTML: <p style="border-style: initial; border-color: initial; border-image: initial; font-family: Ubuntu-R; font-size: small; border-width: 0px; padding: 0px; margin: 0px;">Done:</p> with this error: File "/usr/local/lib/python2.7/dist-packages/reportlab/lib/colors.py", line 850, in __call__ raise ValueError('Invalid color value %r' % arg) ValueError: Invalid color value 'initial' I use it typically like this: pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('UTF-8')), result, encoding='UTF-8', link_callback=fetch_resources) Is there a way to overcome this other than patching it's original code?
python
reportlab
xhtml2pdf
null
null
null
open
reportlab ValueError: Invalid color value 'initial' === ReportLab/xhtml2pdf have worked perfectly until now when it crashes at this style bit in HTML: <p style="border-style: initial; border-color: initial; border-image: initial; font-family: Ubuntu-R; font-size: small; border-width: 0px; padding: 0px; margin: 0px;">Done:</p> with this error: File "/usr/local/lib/python2.7/dist-packages/reportlab/lib/colors.py", line 850, in __call__ raise ValueError('Invalid color value %r' % arg) ValueError: Invalid color value 'initial' I use it typically like this: pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('UTF-8')), result, encoding='UTF-8', link_callback=fetch_resources) Is there a way to overcome this other than patching it's original code?
0
9,944,150
03/30/2012 13:41:55
497,567
11/04/2010 18:23:44
310
10
Entity framework data missing
I have tables linked by FK, I query on the first table using entity framework. I expected to be able to do the following <table1>.<table2> in .NET Is this not the case? How would I get the whole chain of tables available to me by querying on the first table?
.net
entity-framework
null
null
null
null
open
Entity framework data missing === I have tables linked by FK, I query on the first table using entity framework. I expected to be able to do the following <table1>.<table2> in .NET Is this not the case? How would I get the whole chain of tables available to me by querying on the first table?
0
9,944,254
03/30/2012 13:48:00
29,119
10/17/2008 21:58:53
442
4
Collection data not appearing in models after being posted. (Includes collections of collections.)
I have a PersonEditorModel that contains a list of people that I want represented in the editor. I have a collection of Person objects that contains a collection of Address objects. I want to render text boxes for all of these so that the user can edit names and address associated with those names. class PersonEditorModel { public List<Person> People; } class Person { public string Name; public List<Address> Addresses; } class Address { public string Value; } I'm generating a form for editing the addresses and the names associated with them. It's using Ajax.BeginForm because this is a simplified example derived from a problem I'm having in a bigger app where the form updates a different part of the page using Ajax to get a result. In the base form's cshtml: @model Models.Person @using (Ajax.BeginForm("Update", new AjaxOptions { HttpMethod = "Post" })) { <div> @Html.EditorFor(x => x.People) <button type="submit">Commit Changes</button> </div> } Person.cshtml: @model Models.Person <div> @Html.TextBoxFor(x => x.Name) </div> <div> @Html.EditorFor(x => x.Addresses) </div> Address.cshtml: @model Models.Address <div> @Html.TextBoxFor(x => x.Value) </div> The controller's method for the action: public ActionResult Update(List<Person> people) { /* snip */ } When I submit this form, a breakpoint placed immediately within Update() shows that "people" is a list of the right length but it contains absolutely no data--all the addresses are empty strings, even though the form data as appears in Request.Form looks correct. What could be causing such a problem and what would be an idiomatic MVC way to solve this issue? NOTE: This is a simplified example of some behavior I'm seeing in a more complex app. I think I've captured the essence of the issue here, but there may be some other unknown complicating factor. Let me know what could complicate this to cause the issue I'm seeing and I'll try to provide whatever additional details I can. I've tried making Update take a PersonEditorModel parameter instead, but that gets absolutely no data at all.
c#
asp.net-mvc
asp.net-mvc-3
mvc
null
null
open
Collection data not appearing in models after being posted. (Includes collections of collections.) === I have a PersonEditorModel that contains a list of people that I want represented in the editor. I have a collection of Person objects that contains a collection of Address objects. I want to render text boxes for all of these so that the user can edit names and address associated with those names. class PersonEditorModel { public List<Person> People; } class Person { public string Name; public List<Address> Addresses; } class Address { public string Value; } I'm generating a form for editing the addresses and the names associated with them. It's using Ajax.BeginForm because this is a simplified example derived from a problem I'm having in a bigger app where the form updates a different part of the page using Ajax to get a result. In the base form's cshtml: @model Models.Person @using (Ajax.BeginForm("Update", new AjaxOptions { HttpMethod = "Post" })) { <div> @Html.EditorFor(x => x.People) <button type="submit">Commit Changes</button> </div> } Person.cshtml: @model Models.Person <div> @Html.TextBoxFor(x => x.Name) </div> <div> @Html.EditorFor(x => x.Addresses) </div> Address.cshtml: @model Models.Address <div> @Html.TextBoxFor(x => x.Value) </div> The controller's method for the action: public ActionResult Update(List<Person> people) { /* snip */ } When I submit this form, a breakpoint placed immediately within Update() shows that "people" is a list of the right length but it contains absolutely no data--all the addresses are empty strings, even though the form data as appears in Request.Form looks correct. What could be causing such a problem and what would be an idiomatic MVC way to solve this issue? NOTE: This is a simplified example of some behavior I'm seeing in a more complex app. I think I've captured the essence of the issue here, but there may be some other unknown complicating factor. Let me know what could complicate this to cause the issue I'm seeing and I'll try to provide whatever additional details I can. I've tried making Update take a PersonEditorModel parameter instead, but that gets absolutely no data at all.
0
9,944,256
03/30/2012 13:48:03
438,309
09/02/2010 19:15:08
15
2
Selenium selectWindow does not find window opened with openWindow
in Selenium IDE on FireFox 11, I use openWindow | ${myURL} | receiverWindow selectWindow | receiverWindow and I get [info] Executing: |selectWindow | receiverWindow | | [debug] Command found, going to execute selectWindow [debug] getWindowByName(receiverWindow) [debug] getWindowNameByTitle(receiverWindow) [error] Could not find window with title receiverWindow With FireBug, I looked into the DOM of the sucessfully opened window and found a top-level entry: seleniumWindowName | "receiverWindow" So, it lookes like selenium seems to have stored the WindowID somehow but seems to look other placec than where It has stored it. I also tried selectWindow | "receiverWindow" (with quotes) but with no success. What am I not getting right here?
selenium
selenium-ide
null
null
null
null
open
Selenium selectWindow does not find window opened with openWindow === in Selenium IDE on FireFox 11, I use openWindow | ${myURL} | receiverWindow selectWindow | receiverWindow and I get [info] Executing: |selectWindow | receiverWindow | | [debug] Command found, going to execute selectWindow [debug] getWindowByName(receiverWindow) [debug] getWindowNameByTitle(receiverWindow) [error] Could not find window with title receiverWindow With FireBug, I looked into the DOM of the sucessfully opened window and found a top-level entry: seleniumWindowName | "receiverWindow" So, it lookes like selenium seems to have stored the WindowID somehow but seems to look other placec than where It has stored it. I also tried selectWindow | "receiverWindow" (with quotes) but with no success. What am I not getting right here?
0
9,944,266
03/30/2012 13:48:32
639,517
03/01/2011 14:37:56
18
2
How to change tag values with Greasemonkey
I have this wonderful iFrame that has wonkey dimensions that I want to change to something useful on load. <iframe id="iWork" width="640px" height="530px" /> I've tried googling around and found that the following should work, but it does not seem to do anything: var query = document.querySelector("#iWork"); if (query) { query.setAttribute("width", "1000"); query.setAttribute("height", "1000"); } ... but it doesn't change anything :-/ Any pointers on what I am doing wrong would be awesome.
javascript
greasemonkey
userscripts
null
null
null
open
How to change tag values with Greasemonkey === I have this wonderful iFrame that has wonkey dimensions that I want to change to something useful on load. <iframe id="iWork" width="640px" height="530px" /> I've tried googling around and found that the following should work, but it does not seem to do anything: var query = document.querySelector("#iWork"); if (query) { query.setAttribute("width", "1000"); query.setAttribute("height", "1000"); } ... but it doesn't change anything :-/ Any pointers on what I am doing wrong would be awesome.
0
9,944,272
03/30/2012 13:48:54
1,026,137
11/02/2011 17:09:17
1
0
having a minor issue with this javascript+ajax
am trying to translate information, when i use the following code, it runs successfully, as i have given the textarea information in prior <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <title>Example Ajax POST</title> <script type="text/javascript"><!-- // create the XMLHttpRequest object, according browser function get_XmlHttp() { // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value) var xmlHttp = null; if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ... xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject) { // for Internet Explorer 5 or 6 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlHttp; } // sends data to a php file, via POST, and displays the received answer function ajaxrequest(php_file, tagID, tolang) { if(tolang=="-")return; var request = get_XmlHttp(); // call the function for the XMLHttpRequest instance // create pairs index=value with data that must be sent to server var the_data = 'data='+document.getElementById('txt2').innerHTML+'&to='+tolang; request.open("POST", php_file, true); // set the request // adds a header to tell the PHP script to recognize the data as is sent via POST request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(the_data); // calls the send() method with datas as parameter // Check request status // If the response is received completely, will be transferred to the HTML tag with tagID request.onreadystatechange = function() { if (request.readyState == 4) { document.getElementById(tagID).innerHTML = request.responseText; } } } --></script> </head> <body> <textarea id="txt2" rows="20" cols="50">hi wassup</textarea><br/> <select name="langlist" onchange="ajaxrequest('translator.php', 'txt2', this.options[this.selectedIndex].value)"> <option value="-" selected>-</option> <option value="ar">Arabic</option><option value="bg"> Bulgarian</option><option value="ca"> Catalan</option><option value="zh-CHS"> Chinese Simplified</option><option value="zh-CHT"> Chinese Traditional</option><option value="cs"> Czech</option><option value="da"> Danish</option><option value="nl"> Dutch</option><option value="en"> English</option><option value="et"> Estonian</option><option value="fi"> Finnish</option><option value="fr"> French</option><option value="de"> German</option><option value="el"> Greek</option><option value="ht"> Haitian Creole</option><option value="he"> Hebrew</option><option value="hi"> Hindi</option><option value="mww"> Hmong Daw</option><option value="hu"> Hungarian</option><option value="id"> Indonesian</option><option value="it"> Italian</option><option value="ja"> Japanese</option><option value="ko"> Korean</option><option value="lv"> Latvian</option><option value="lt"> Lithuanian</option><option value="no"> Norwegian</option><option value="pl"> Polish</option><option value="pt"> Portuguese</option><option value="ro"> Romanian</option><option value="ru"> Russian</option><option value="sk"> Slovak</option><option value="sl"> Slovenian</option><option value="es"> Spanish</option><option value="sv"> Swedish</option><option value="th"> Thai</option><option value="tr"> Turkish</option><option value="uk"> Ukrainian</option><option value="vi"> Vietnamese</option> </select><img src="http://www.allsaints-sec.glasgow.sch.uk/Images/QuestionMarkIcon16.gif" title="plz save your copy of data, as there will be chances of data loss during translation"/> </body> </html> if you remove the text in textarea before initial load of page, then the translation is not working, as shown in below code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <title>Example Ajax POST</title> <script type="text/javascript"><!-- // create the XMLHttpRequest object, according browser function get_XmlHttp() { // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value) var xmlHttp = null; if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ... xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject) { // for Internet Explorer 5 or 6 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlHttp; } // sends data to a php file, via POST, and displays the received answer function ajaxrequest(php_file, tagID, tolang) { if(tolang=="-")return; var request = get_XmlHttp(); // call the function for the XMLHttpRequest instance // create pairs index=value with data that must be sent to server var the_data = 'data='+document.getElementById('txt2').innerHTML+'&to='+tolang; request.open("POST", php_file, true); // set the request // adds a header to tell the PHP script to recognize the data as is sent via POST request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(the_data); // calls the send() method with datas as parameter // Check request status // If the response is received completely, will be transferred to the HTML tag with tagID request.onreadystatechange = function() { if (request.readyState == 4) { document.getElementById(tagID).innerHTML = request.responseText; } } } --></script> </head> <body> <textarea id="txt2" rows="20" cols="50"></textarea><br/> <select name="langlist" onchange="ajaxrequest('translator.php', 'txt2', this.options[this.selectedIndex].value)"> <option value="-" selected>-</option> <option value="ar">Arabic</option><option value="bg"> Bulgarian</option><option value="ca"> Catalan</option><option value="zh-CHS"> Chinese Simplified</option><option value="zh-CHT"> Chinese Traditional</option><option value="cs"> Czech</option><option value="da"> Danish</option><option value="nl"> Dutch</option><option value="en"> English</option><option value="et"> Estonian</option><option value="fi"> Finnish</option><option value="fr"> French</option><option value="de"> German</option><option value="el"> Greek</option><option value="ht"> Haitian Creole</option><option value="he"> Hebrew</option><option value="hi"> Hindi</option><option value="mww"> Hmong Daw</option><option value="hu"> Hungarian</option><option value="id"> Indonesian</option><option value="it"> Italian</option><option value="ja"> Japanese</option><option value="ko"> Korean</option><option value="lv"> Latvian</option><option value="lt"> Lithuanian</option><option value="no"> Norwegian</option><option value="pl"> Polish</option><option value="pt"> Portuguese</option><option value="ro"> Romanian</option><option value="ru"> Russian</option><option value="sk"> Slovak</option><option value="sl"> Slovenian</option><option value="es"> Spanish</option><option value="sv"> Swedish</option><option value="th"> Thai</option><option value="tr"> Turkish</option><option value="uk"> Ukrainian</option><option value="vi"> Vietnamese</option> </select><img src="http://www.allsaints-sec.glasgow.sch.uk/Images/QuestionMarkIcon16.gif" title="plz save your copy of data, as there will be chances of data loss during translation"/> </body> </html> am not getting the point in here, can anyone tell me why is this problem.
javascript
html
ajax
xhtml
textarea
null
open
having a minor issue with this javascript+ajax === am trying to translate information, when i use the following code, it runs successfully, as i have given the textarea information in prior <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <title>Example Ajax POST</title> <script type="text/javascript"><!-- // create the XMLHttpRequest object, according browser function get_XmlHttp() { // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value) var xmlHttp = null; if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ... xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject) { // for Internet Explorer 5 or 6 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlHttp; } // sends data to a php file, via POST, and displays the received answer function ajaxrequest(php_file, tagID, tolang) { if(tolang=="-")return; var request = get_XmlHttp(); // call the function for the XMLHttpRequest instance // create pairs index=value with data that must be sent to server var the_data = 'data='+document.getElementById('txt2').innerHTML+'&to='+tolang; request.open("POST", php_file, true); // set the request // adds a header to tell the PHP script to recognize the data as is sent via POST request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(the_data); // calls the send() method with datas as parameter // Check request status // If the response is received completely, will be transferred to the HTML tag with tagID request.onreadystatechange = function() { if (request.readyState == 4) { document.getElementById(tagID).innerHTML = request.responseText; } } } --></script> </head> <body> <textarea id="txt2" rows="20" cols="50">hi wassup</textarea><br/> <select name="langlist" onchange="ajaxrequest('translator.php', 'txt2', this.options[this.selectedIndex].value)"> <option value="-" selected>-</option> <option value="ar">Arabic</option><option value="bg"> Bulgarian</option><option value="ca"> Catalan</option><option value="zh-CHS"> Chinese Simplified</option><option value="zh-CHT"> Chinese Traditional</option><option value="cs"> Czech</option><option value="da"> Danish</option><option value="nl"> Dutch</option><option value="en"> English</option><option value="et"> Estonian</option><option value="fi"> Finnish</option><option value="fr"> French</option><option value="de"> German</option><option value="el"> Greek</option><option value="ht"> Haitian Creole</option><option value="he"> Hebrew</option><option value="hi"> Hindi</option><option value="mww"> Hmong Daw</option><option value="hu"> Hungarian</option><option value="id"> Indonesian</option><option value="it"> Italian</option><option value="ja"> Japanese</option><option value="ko"> Korean</option><option value="lv"> Latvian</option><option value="lt"> Lithuanian</option><option value="no"> Norwegian</option><option value="pl"> Polish</option><option value="pt"> Portuguese</option><option value="ro"> Romanian</option><option value="ru"> Russian</option><option value="sk"> Slovak</option><option value="sl"> Slovenian</option><option value="es"> Spanish</option><option value="sv"> Swedish</option><option value="th"> Thai</option><option value="tr"> Turkish</option><option value="uk"> Ukrainian</option><option value="vi"> Vietnamese</option> </select><img src="http://www.allsaints-sec.glasgow.sch.uk/Images/QuestionMarkIcon16.gif" title="plz save your copy of data, as there will be chances of data loss during translation"/> </body> </html> if you remove the text in textarea before initial load of page, then the translation is not working, as shown in below code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <title>Example Ajax POST</title> <script type="text/javascript"><!-- // create the XMLHttpRequest object, according browser function get_XmlHttp() { // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value) var xmlHttp = null; if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ... xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject) { // for Internet Explorer 5 or 6 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlHttp; } // sends data to a php file, via POST, and displays the received answer function ajaxrequest(php_file, tagID, tolang) { if(tolang=="-")return; var request = get_XmlHttp(); // call the function for the XMLHttpRequest instance // create pairs index=value with data that must be sent to server var the_data = 'data='+document.getElementById('txt2').innerHTML+'&to='+tolang; request.open("POST", php_file, true); // set the request // adds a header to tell the PHP script to recognize the data as is sent via POST request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(the_data); // calls the send() method with datas as parameter // Check request status // If the response is received completely, will be transferred to the HTML tag with tagID request.onreadystatechange = function() { if (request.readyState == 4) { document.getElementById(tagID).innerHTML = request.responseText; } } } --></script> </head> <body> <textarea id="txt2" rows="20" cols="50"></textarea><br/> <select name="langlist" onchange="ajaxrequest('translator.php', 'txt2', this.options[this.selectedIndex].value)"> <option value="-" selected>-</option> <option value="ar">Arabic</option><option value="bg"> Bulgarian</option><option value="ca"> Catalan</option><option value="zh-CHS"> Chinese Simplified</option><option value="zh-CHT"> Chinese Traditional</option><option value="cs"> Czech</option><option value="da"> Danish</option><option value="nl"> Dutch</option><option value="en"> English</option><option value="et"> Estonian</option><option value="fi"> Finnish</option><option value="fr"> French</option><option value="de"> German</option><option value="el"> Greek</option><option value="ht"> Haitian Creole</option><option value="he"> Hebrew</option><option value="hi"> Hindi</option><option value="mww"> Hmong Daw</option><option value="hu"> Hungarian</option><option value="id"> Indonesian</option><option value="it"> Italian</option><option value="ja"> Japanese</option><option value="ko"> Korean</option><option value="lv"> Latvian</option><option value="lt"> Lithuanian</option><option value="no"> Norwegian</option><option value="pl"> Polish</option><option value="pt"> Portuguese</option><option value="ro"> Romanian</option><option value="ru"> Russian</option><option value="sk"> Slovak</option><option value="sl"> Slovenian</option><option value="es"> Spanish</option><option value="sv"> Swedish</option><option value="th"> Thai</option><option value="tr"> Turkish</option><option value="uk"> Ukrainian</option><option value="vi"> Vietnamese</option> </select><img src="http://www.allsaints-sec.glasgow.sch.uk/Images/QuestionMarkIcon16.gif" title="plz save your copy of data, as there will be chances of data loss during translation"/> </body> </html> am not getting the point in here, can anyone tell me why is this problem.
0
9,944,274
03/30/2012 13:48:58
619,570
02/16/2011 11:51:14
1,234
12
boost serialize and std::shared_ptr
I Have a object which the following field : boost::unordered_map<std::string, std::shared_ptr<Foo> > m_liste_; I would like to serialize it, but it seems std::shared_ptr can't be serialized in a simple manner anyone have a solution ?
c++
boost
null
null
null
null
open
boost serialize and std::shared_ptr === I Have a object which the following field : boost::unordered_map<std::string, std::shared_ptr<Foo> > m_liste_; I would like to serialize it, but it seems std::shared_ptr can't be serialized in a simple manner anyone have a solution ?
0
60,609
09/13/2008 15:21:53
5,182
09/08/2008 11:20:40
322
11
Automate Safari web browser using c# on Windows
I wondered if anyone had successfully managed, or knew how to automate the Safari web browser on the Windows platform. Ideally I would like to automate Safari in a similar way to using [mshtml](http://msdn.microsoft.com/en-us/library/aa741317.aspx) for Internet Explorer. Failing that a way to inject javascript into the running process would also be fine. I've used the javascript injection method to automate FireFox via the [jssh](http://www.croczilla.com/jssh) plug-in. I'm looking to automate the browser using .Net to enhance an existing automation framework [WatiN](http://watin.sourceforge.net/)
.net
automation
safari
watin
null
null
open
Automate Safari web browser using c# on Windows === I wondered if anyone had successfully managed, or knew how to automate the Safari web browser on the Windows platform. Ideally I would like to automate Safari in a similar way to using [mshtml](http://msdn.microsoft.com/en-us/library/aa741317.aspx) for Internet Explorer. Failing that a way to inject javascript into the running process would also be fine. I've used the javascript injection method to automate FireFox via the [jssh](http://www.croczilla.com/jssh) plug-in. I'm looking to automate the browser using .Net to enhance an existing automation framework [WatiN](http://watin.sourceforge.net/)
0
60,620
09/13/2008 15:38:01
123
08/02/2008 08:01:26
1,845
107
Silverlight development..
How does one start develop in Silverlight? Does one need a new IDE? or Visual studio will support?
silverlight
ide
null
null
null
null
open
Silverlight development.. === How does one start develop in Silverlight? Does one need a new IDE? or Visual studio will support?
0
60,641
09/13/2008 16:02:07
5,252
09/08/2008 17:54:32
115
2
How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parametrs set are the same)?
I need to replace all WinAPI calls of the - CreateFile, - ReadFile, - SetFilePointer, - CloseHandle with my own implementation (which use low-level file reading via Bluetooth). The code, where functions will be replaced, is Video File Player and it already works with the regular hdd files. It is also needed, that Video Player still can play files from HDD, if the file in the VideoPlayer input is a regular hdd file. What is the best practice for such task?
c++
winapi
visual-c++
null
null
null
open
How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parametrs set are the same)? === I need to replace all WinAPI calls of the - CreateFile, - ReadFile, - SetFilePointer, - CloseHandle with my own implementation (which use low-level file reading via Bluetooth). The code, where functions will be replaced, is Video File Player and it already works with the regular hdd files. It is also needed, that Video Player still can play files from HDD, if the file in the VideoPlayer input is a regular hdd file. What is the best practice for such task?
0
60,645
09/13/2008 16:04:51
3,923
08/31/2008 22:22:32
13
3
Overlapped I/O on anonymous pipe
Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE\_FLAG\_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure.
winapi
pipes
null
null
null
null
open
Overlapped I/O on anonymous pipe === Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE\_FLAG\_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure.
0
60,648
09/13/2008 16:08:31
1,463
08/15/2008 17:26:44
490
34
How can I tell if I have an open relay?
I'm trying to work out if I have an open relay on my server. How do I do that? I've tried http://www.abuse.net/relay.html and it reports: Hmmn, at first glance, host appeared to accept a message for relay. THIS MAY OR MAY NOT MEAN THAT IT'S AN OPEN RELAY. Some systems appear to accept relay mail, but then reject messages internally rather than delivering them, but you cannot tell at this point whether the message will be relayed or not. What further tests can I do to determine if the server has an open relay?
smtp
null
null
null
null
null
open
How can I tell if I have an open relay? === I'm trying to work out if I have an open relay on my server. How do I do that? I've tried http://www.abuse.net/relay.html and it reports: Hmmn, at first glance, host appeared to accept a message for relay. THIS MAY OR MAY NOT MEAN THAT IT'S AN OPEN RELAY. Some systems appear to accept relay mail, but then reject messages internally rather than delivering them, but you cannot tell at this point whether the message will be relayed or not. What further tests can I do to determine if the server has an open relay?
0
60,649
09/13/2008 16:10:34
1,304
08/14/2008 13:19:08
163
12
cross platform IPC
I'm looking for suggestions on possible IPC mechanisms that are: - **cross platform** (WIN32 and Linux at least) - Simple to implement in **C++** as well as the **most common scripting languages** (perl, ruby python etc). - Finally, **simple to use** from a programming point of view! What are my options? I'm programming under Linux, but I'd like what I write to be portable to other OSes in the future. I've thought about using sockets, named pipes, or something like DBus. Does anyone have any advice?
c++
python
linux
crossplatform
ipc
null
open
cross platform IPC === I'm looking for suggestions on possible IPC mechanisms that are: - **cross platform** (WIN32 and Linux at least) - Simple to implement in **C++** as well as the **most common scripting languages** (perl, ruby python etc). - Finally, **simple to use** from a programming point of view! What are my options? I'm programming under Linux, but I'd like what I write to be portable to other OSes in the future. I've thought about using sockets, named pipes, or something like DBus. Does anyone have any advice?
0
60,650
09/13/2008 16:11:02
4,849
09/06/2008 00:06:08
11
1
ASP.NET - Is it possible to trigger a postback from server code?
Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code (_i.e._ without using javascript trickery to submit a form)?
asp.net
postback
null
null
null
null
open
ASP.NET - Is it possible to trigger a postback from server code? === Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code (_i.e._ without using javascript trickery to submit a form)?
0
60,652
09/13/2008 16:11:31
4,653
09/05/2008 00:53:33
18
1
Common memory optimization . .
What are the most common memory optimizations in csharp, dotnet 2.0. Wanted to see if there common things that people may not be doing by default in winform apps . .
c#
optimization
memory-management
null
null
null
open
Common memory optimization . . === What are the most common memory optimizations in csharp, dotnet 2.0. Wanted to see if there common things that people may not be doing by default in winform apps . .
0
60,653
09/13/2008 16:13:29
4,240
09/02/2008 13:51:18
84
5
Is Global Memory Initialized in C++
And if so, how?
c++
memory
memory-management
null
null
null
open
Is Global Memory Initialized in C++ === And if so, how?
0
60,658
09/13/2008 16:18:01
4,240
09/02/2008 13:51:18
89
5
Rails Model, View, Controller, or Helpler? Wherefore Art Thou Logic
In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic. Please answer in the affirmative - With _Do put this here_, rather than _Don't put that there_.
ruby
ruby-on-rails
mvc
null
null
null
open
Rails Model, View, Controller, or Helpler? Wherefore Art Thou Logic === In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic. Please answer in the affirmative - With _Do put this here_, rather than _Don't put that there_.
0
60,664
09/13/2008 16:22:43
2,138
08/20/2008 14:23:45
127
10
Is it possible to display the entity &#8659; in IE6
is it possible to display &#8659; entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: <span>&#8659\;</span> // Not that the ; is escaped to show the entity
internet-explorer-6
null
null
null
null
null
open
Is it possible to display the entity &#8659; in IE6 === is it possible to display &#8659; entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: <span>&#8659\;</span> // Not that the ; is escaped to show the entity
0
60,672
09/13/2008 16:30:26
1,647
08/17/2008 18:32:33
83
11
IIS Integrated Request Processing Pipeline -- Modify Request
I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode. The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. (for ex: HTTP\_EAUTH\_ID) And later in the page lifecycle of an ASPX page, i should be able to use that variable as string eauthId = Request.ServerVariables["HTTP\_EAUTH\_ID"].ToString(); So implementing this module at the Web Server level, is it possible to alter the ServerVariables collection ?? Thanks
c#
asp.net
iis7
null
null
null
open
IIS Integrated Request Processing Pipeline -- Modify Request === I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode. The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. (for ex: HTTP\_EAUTH\_ID) And later in the page lifecycle of an ASPX page, i should be able to use that variable as string eauthId = Request.ServerVariables["HTTP\_EAUTH\_ID"].ToString(); So implementing this module at the Web Server level, is it possible to alter the ServerVariables collection ?? Thanks
0
60,673
09/13/2008 16:30:50
1,304
08/14/2008 13:19:08
163
12
Guidelines to improve your code
What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people _insist_ that every `if` statement is followed by a brace block (`{...}`). I'm interested in what guidelines other people follow, and the reasons behind them. I'm also interested in guidelines that you think are rubbish, but are commonly held. Can anyone suggest a few? To get the ball rolling, I'll mention a few to start with: - Always use braces after every `if` / `else` statement (mentioned above). The rationale behind this is that it's not always easy to tell if a single statement is actually one statement, or a pre-processor macro that expands tomore than one statement, so this code would break: <pre> // top of file: #define statement doSomething(); doSomethingElse // in implementation: if (somecondition) doSomething(); </pre> but if you use braces then it will work as expected. - Use preprocessor macros for conditional compilation ONLY. preprocessor macros can cause all sorts of hell, since they don't collow C++ scoping rules. I've run aground many times due to preprocessor macros with common names in header files. If you're not carefull you can cause all sorts of havock! now over to you:
c++
guidelines
null
null
null
null
open
Guidelines to improve your code === What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people _insist_ that every `if` statement is followed by a brace block (`{...}`). I'm interested in what guidelines other people follow, and the reasons behind them. I'm also interested in guidelines that you think are rubbish, but are commonly held. Can anyone suggest a few? To get the ball rolling, I'll mention a few to start with: - Always use braces after every `if` / `else` statement (mentioned above). The rationale behind this is that it's not always easy to tell if a single statement is actually one statement, or a pre-processor macro that expands tomore than one statement, so this code would break: <pre> // top of file: #define statement doSomething(); doSomethingElse // in implementation: if (somecondition) doSomething(); </pre> but if you use braces then it will work as expected. - Use preprocessor macros for conditional compilation ONLY. preprocessor macros can cause all sorts of hell, since they don't collow C++ scoping rules. I've run aground many times due to preprocessor macros with common names in header files. If you're not carefull you can cause all sorts of havock! now over to you:
0
60,680
09/13/2008 16:42:38
4,321
09/02/2008 20:27:30
11
1
How do I write a python HTTP server to listen on multiple ports?
I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port? What I'm doing now: class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def doGET [...] class ThreadingHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): pass server = ThreadingHTTPServer(('localhost', 80), MyRequestHandler) server.serve_forever()
python
null
null
null
null
null
open
How do I write a python HTTP server to listen on multiple ports? === I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port? What I'm doing now: class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def doGET [...] class ThreadingHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): pass server = ThreadingHTTPServer(('localhost', 80), MyRequestHandler) server.serve_forever()
0
60,683
09/13/2008 16:51:31
4,653
09/05/2008 00:53:33
20
1
Checkbox in listview control
Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated.
c#
gui
null
null
null
null
open
Checkbox in listview control === Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated.
0
60,684
09/13/2008 16:53:41
6,103
09/12/2008 12:33:13
1
0
Deleting lines of code in a text editor
This question is about how you use text editors in general. I’m looking for the best way to _delete_ a plurality of lines of code (no intent to patent it:) This extends to _transposing_ lines, i.e. deleting and adding them somewhere else. Most importantly, I don’t want to be creating any blank lines that I have to delete separately. Sort of like Visual Studio's SHIFT+DELETE feature, but working for multiple lines at once. Say you want to delete line 3 from following code (tabs and newlines visualized as well). The naïve way would be to select the text between angle brackets: <pre> if (true) {\n \t int i = 1;<font color="red">\n</font> <font color="red">\t</font> <font color="magenta">&lt;</font>i *= 2;<font color="magenta">&gt;</font><font color="blue">\n</font> \t i += 3;\n }\n </pre> Then hit backspace. This creates a blank line. Hit backspace twice more to delete <font color="red">\t</font> and <font color="red">\n</font>. You end up with: <pre> if (true) {\n \t int i = 1;<font color="blue">\n</font> \t i += 3;\n }\n </pre> Notice that <font color="blue">\n</font> has taken the place of <font color="red">\n</font>. When you try to select a whole line, Visual Studio doesn't let you select the trailing newline character. For example, placing the cursor on a line and hitting SHIFT+END will not select the newline at the end. Neither will you select the newline if you use your mouse, i.e. clicking in the middle of a line and dragging the cursor all the way to the right. You only select the trailing newline characters if you make a selection that spans at least two lines. Most editors I use do it this way; Microsoft WordPad and Word are counter-examples (and I frequently get newlines wrong when deleting text there; at least Word has a way to display end-of-line and end-of-paragraph characters explicitly). When using Visual Studio and other editors in general, here’s the solution that currently works best for me: Using the mouse, I select the characters that I put between angle brackets: <pre> if (true) {\n \t int i = 1;<font color="magenta">&lt;</font><font color="red">\n</font> <font color="red">\t</font> i *= 2;<font color="magenta">&gt;</font><font color="blue">\n</font> \t i += 3;\n }\n </pre> Hitting backspace now, you delete the line in one go without having to delete any other characters. This works for several contiguous lines at once. Additionally, it can be used for transposing lines. You could drag the selection between the angle brackets to the point marked with a caret: <pre> if (true) {\n \t int i = 1;<font color="magenta">&lt;</font><font color="red">\n</font> <font color="red">\t</font> i *= 2;<font color="magenta">&gt;</font><font color="blue">\n</font> \t i += 3;<font color="green">^</font>\n }\n </pre> This leaves you with: <pre> if (true) {\n \t int i = 1;<font color="blue">\n</font> \t i += 3;<font color="magenta">&lt;</font><font color="red">\n</font> <font color="red">\t</font> i *= 2;<font color="magenta">&gt;</font>\n }\n </pre> where lines 3 and 4 have switched place. There are variations on this theme. When you want to delete line 3, you could also select the following characters: <pre> if (true) {\n \t int i = 1;<font color="red">\n</font> <font color="magenta">&lt;</font><font color="red">\t</font> i *= 2;<font color="blue">\n</font> <font color="magenta">&gt;</font>\t i += 3;\n }\n </pre> In fact, this is what Visual Studio does if you tell it to select a complete line. You do this by clicking in the margin between your code and the column where the red circles go which indicate breakpoints. The mouse pointer is mirrored in that area to distinguish it a little better, but I think it's too narrow and physically too far removed from the code I want to select. Maybe this method is useful to other people as well, even if it only serves to make them aware of how newlines are handled when selecting/deleting text:) It works nicely for most non-specialized text editors. However, given the vast amount of features and plugins for Visual Studio, I'm sure there is better way to delete and move lines of code. Getting the indentation right automatically when moving code between different blocks would be nice (i.e. without hitting "Format Document/Selection"). I'm looking forward to suggestions; no rants on micro-optimization, please:)
text-editor
visual-studio
newline
null
null
null
open
Deleting lines of code in a text editor === This question is about how you use text editors in general. I’m looking for the best way to _delete_ a plurality of lines of code (no intent to patent it:) This extends to _transposing_ lines, i.e. deleting and adding them somewhere else. Most importantly, I don’t want to be creating any blank lines that I have to delete separately. Sort of like Visual Studio's SHIFT+DELETE feature, but working for multiple lines at once. Say you want to delete line 3 from following code (tabs and newlines visualized as well). The naïve way would be to select the text between angle brackets: <pre> if (true) {\n \t int i = 1;<font color="red">\n</font> <font color="red">\t</font> <font color="magenta">&lt;</font>i *= 2;<font color="magenta">&gt;</font><font color="blue">\n</font> \t i += 3;\n }\n </pre> Then hit backspace. This creates a blank line. Hit backspace twice more to delete <font color="red">\t</font> and <font color="red">\n</font>. You end up with: <pre> if (true) {\n \t int i = 1;<font color="blue">\n</font> \t i += 3;\n }\n </pre> Notice that <font color="blue">\n</font> has taken the place of <font color="red">\n</font>. When you try to select a whole line, Visual Studio doesn't let you select the trailing newline character. For example, placing the cursor on a line and hitting SHIFT+END will not select the newline at the end. Neither will you select the newline if you use your mouse, i.e. clicking in the middle of a line and dragging the cursor all the way to the right. You only select the trailing newline characters if you make a selection that spans at least two lines. Most editors I use do it this way; Microsoft WordPad and Word are counter-examples (and I frequently get newlines wrong when deleting text there; at least Word has a way to display end-of-line and end-of-paragraph characters explicitly). When using Visual Studio and other editors in general, here’s the solution that currently works best for me: Using the mouse, I select the characters that I put between angle brackets: <pre> if (true) {\n \t int i = 1;<font color="magenta">&lt;</font><font color="red">\n</font> <font color="red">\t</font> i *= 2;<font color="magenta">&gt;</font><font color="blue">\n</font> \t i += 3;\n }\n </pre> Hitting backspace now, you delete the line in one go without having to delete any other characters. This works for several contiguous lines at once. Additionally, it can be used for transposing lines. You could drag the selection between the angle brackets to the point marked with a caret: <pre> if (true) {\n \t int i = 1;<font color="magenta">&lt;</font><font color="red">\n</font> <font color="red">\t</font> i *= 2;<font color="magenta">&gt;</font><font color="blue">\n</font> \t i += 3;<font color="green">^</font>\n }\n </pre> This leaves you with: <pre> if (true) {\n \t int i = 1;<font color="blue">\n</font> \t i += 3;<font color="magenta">&lt;</font><font color="red">\n</font> <font color="red">\t</font> i *= 2;<font color="magenta">&gt;</font>\n }\n </pre> where lines 3 and 4 have switched place. There are variations on this theme. When you want to delete line 3, you could also select the following characters: <pre> if (true) {\n \t int i = 1;<font color="red">\n</font> <font color="magenta">&lt;</font><font color="red">\t</font> i *= 2;<font color="blue">\n</font> <font color="magenta">&gt;</font>\t i += 3;\n }\n </pre> In fact, this is what Visual Studio does if you tell it to select a complete line. You do this by clicking in the margin between your code and the column where the red circles go which indicate breakpoints. The mouse pointer is mirrored in that area to distinguish it a little better, but I think it's too narrow and physically too far removed from the code I want to select. Maybe this method is useful to other people as well, even if it only serves to make them aware of how newlines are handled when selecting/deleting text:) It works nicely for most non-specialized text editors. However, given the vast amount of features and plugins for Visual Studio, I'm sure there is better way to delete and move lines of code. Getting the indentation right automatically when moving code between different blocks would be nice (i.e. without hitting "Format Document/Selection"). I'm looking forward to suggestions; no rants on micro-optimization, please:)
0
60,685
09/13/2008 16:53:57
1,304
08/14/2008 13:19:08
168
12
improve my python regex!
What follows is a regular expression I have written to match multi-line pre-processor macros in C / C++ code. I'm by no means a regular expressions guru, so I'd welcome any advice on how I can make this better. Here's the regex: <pre>^\s*#define(.*\\\n)+[\S]+(?!\\)</pre> It should match all of this: <pre> #define foo(x) if(x) \ doSomething(x) </pre> But only some of this (shouldn't match the next line of code: <pre> #define foo(x) if(x) \ doSomething(x) normalCode(); </pre> And also shouldn't match single-line preprocessor macros. I'm pretty siure that the regex above works - but as I said, there probably a better way of doing it, and I imagine that there are ways of breaking it. Can anyone suggest any?
python
regex
null
null
null
null
open
improve my python regex! === What follows is a regular expression I have written to match multi-line pre-processor macros in C / C++ code. I'm by no means a regular expressions guru, so I'd welcome any advice on how I can make this better. Here's the regex: <pre>^\s*#define(.*\\\n)+[\S]+(?!\\)</pre> It should match all of this: <pre> #define foo(x) if(x) \ doSomething(x) </pre> But only some of this (shouldn't match the next line of code: <pre> #define foo(x) if(x) \ doSomething(x) normalCode(); </pre> And also shouldn't match single-line preprocessor macros. I'm pretty siure that the regex above works - but as I said, there probably a better way of doing it, and I imagine that there are ways of breaking it. Can anyone suggest any?
0
60,724
09/13/2008 17:47:44
20
08/01/2008 12:09:11
340
19
PayPal versus Amazon Honor System
I'm currently planning to integrate a donation system into a web page for a project that I manage. Currently, there are two services I'm looking at using - PayPal and Amazon Honor System. I want the system to be as easy-to-use as possible - basically, if people choose to donate, I'd like them to have to do so in as little steps as possible, and in a manner that is extremely clear (as in there aren't convoluted steps or form fields to fill out). Does anyone have a recommendation on which service is better to use, and why said service is better than the other?
donations
recommendations
null
null
null
null
open
PayPal versus Amazon Honor System === I'm currently planning to integrate a donation system into a web page for a project that I manage. Currently, there are two services I'm looking at using - PayPal and Amazon Honor System. I want the system to be as easy-to-use as possible - basically, if people choose to donate, I'd like them to have to do so in as little steps as possible, and in a manner that is extremely clear (as in there aren't convoluted steps or form fields to fill out). Does anyone have a recommendation on which service is better to use, and why said service is better than the other?
0
60,736
09/13/2008 18:00:42
4,120
09/01/2008 20:58:46
116
3
How to setup a Subversion (SVN) server on GNU/Linux - Ubuntu
I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to: * get and configure Apache, and necessary modules (I know there are other ways to create a SVN server, but I would like it Apache-specific) * configure a secure way of accessing the server (ssh/https) * configure a set of authorised users (as in, they must authorised to commit, but are free to browse) * validate the setup with an initial commit (a "Hello world" of sorts) These steps can involve any mixture of command line or GUI app instructions. If you can, please note where instructions are specific to a particular distribution or version, and where a users' choice of a particular tool can be used instead (say, nano instead of vi).
svn
ubuntu
debian
subversion
gnulinux
null
open
How to setup a Subversion (SVN) server on GNU/Linux - Ubuntu === I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to: * get and configure Apache, and necessary modules (I know there are other ways to create a SVN server, but I would like it Apache-specific) * configure a secure way of accessing the server (ssh/https) * configure a set of authorised users (as in, they must authorised to commit, but are free to browse) * validate the setup with an initial commit (a "Hello world" of sorts) These steps can involve any mixture of command line or GUI app instructions. If you can, please note where instructions are specific to a particular distribution or version, and where a users' choice of a particular tool can be used instead (say, nano instead of vi).
0
60,740
09/13/2008 18:08:22
3,747
08/30/2008 14:33:59
328
27
Which jQuery plugin should be used to fix the IE6 PNG transparency issue?
Is there an IE6/PNG fix that is officially developed by the jQuery team? If not which of the available plugins should I use?
jquery
png
null
null
null
null
open
Which jQuery plugin should be used to fix the IE6 PNG transparency issue? === Is there an IE6/PNG fix that is officially developed by the jQuery team? If not which of the available plugins should I use?
0
60,751
09/13/2008 18:20:36
6,266
09/13/2008 12:51:36
28
1
c++ Having multiple graphics options
Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function<void()> &Call) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } The function passed then depends on the exact state, eg MainMenu->Render, Loading->Render, etc. These will then oftern call the methods of other objects. void RenderGame() { for(entity::iterator it = entity::instances.begin();it != entity::instance.end(); ++it) (*it)->Render(); UI->Render(); } And a sample class derived from entity::Base class Sprite : public Base { IDirect3DTexture9 *Tex; Point2 Pos; Size2 Size; public: Sprite(IDirect3DTexture9 *Tex, const Point2 &Pos, const Size2 &Size); virtual void Render(); }; Each method then takes care of how best to render given the more detailed settings (eg are pixel shaders supported or not). The problem is I'm really not sure how to extend this to be able to use one of, what may be somewhat diffrent (D3D v OpenGL) render modes...
c++
graphics
null
null
null
null
open
c++ Having multiple graphics options === Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function<void()> &Call) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } The function passed then depends on the exact state, eg MainMenu->Render, Loading->Render, etc. These will then oftern call the methods of other objects. void RenderGame() { for(entity::iterator it = entity::instances.begin();it != entity::instance.end(); ++it) (*it)->Render(); UI->Render(); } And a sample class derived from entity::Base class Sprite : public Base { IDirect3DTexture9 *Tex; Point2 Pos; Size2 Size; public: Sprite(IDirect3DTexture9 *Tex, const Point2 &Pos, const Size2 &Size); virtual void Render(); }; Each method then takes care of how best to render given the more detailed settings (eg are pixel shaders supported or not). The problem is I'm really not sure how to extend this to be able to use one of, what may be somewhat diffrent (D3D v OpenGL) render modes...
0
60,757
09/13/2008 18:34:58
3,153
08/27/2008 02:45:05
1,078
41
Best way to handle user account authentication and passwords
What is the best way to handle user account management in a system, without having your employees who have access to a database, to have access to the accounts. Examples: 1. Storing username/password in the database. This is a bad idea because anyone that has access to a database can see the username and password. And hence use it. 2. Storing username/password hash. This is a better method, but the account can be accessed by replacing the password hash in the database with the hash of another account that you know the auth info for. Then after access is granted reverting it back in the database. How does windows/*nix handle this?
security
database-design
authentication
authorization
null
null
open
Best way to handle user account authentication and passwords === What is the best way to handle user account management in a system, without having your employees who have access to a database, to have access to the accounts. Examples: 1. Storing username/password in the database. This is a bad idea because anyone that has access to a database can see the username and password. And hence use it. 2. Storing username/password hash. This is a better method, but the account can be accessed by replacing the password hash in the database with the hash of another account that you know the auth info for. Then after access is granted reverting it back in the database. How does windows/*nix handle this?
0
60,763
09/13/2008 18:48:13
573
08/06/2008 21:00:42
670
28
Learning kernel hacking and embedded development at home?
I was always attracted to the world of kernel hacking and embedded systems. Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff? Something like kits for writing drivers etc, which come with good documentation and are affordable? Thanks!
linux
kernel
null
null
null
null
open
Learning kernel hacking and embedded development at home? === I was always attracted to the world of kernel hacking and embedded systems. Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff? Something like kits for writing drivers etc, which come with good documentation and are affordable? Thanks!
0
60,764
09/13/2008 18:48:19
2,443
08/22/2008 10:53:30
818
41
How should I load Jars dynamically at runtime?
Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load jars dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a jar file as its argument. Any suggestions for simple code that does this? P.S.: I know some see it as lame to answer your own questions, but I figured I'd do that so that a better one could bubble up past it.
java
jar
null
null
null
null
open
How should I load Jars dynamically at runtime? === Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load jars dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a jar file as its argument. Any suggestions for simple code that does this? P.S.: I know some see it as lame to answer your own questions, but I figured I'd do that so that a better one could bubble up past it.
0
60,768
09/13/2008 18:53:25
5,189
09/08/2008 11:44:07
166
10
Unable to load System.Datal.Linq.dll for CodeDom
I am trying to dynamicly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error: Metadata file 'System.Data.Linq.dll' could not be found My code looks like: CompilerParameters compilerParams = new CompilerParameters(); compilerParams.CompilerOptions = "/target:library /optimize"; compilerParams.GenerateExecutable = false; compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("mscorlib.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); compilerParams.ReferencedAssemblies.Add("System.Data.Linq.dll"); Any ideas?
c#
codedom
null
null
null
null
open
Unable to load System.Datal.Linq.dll for CodeDom === I am trying to dynamicly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error: Metadata file 'System.Data.Linq.dll' could not be found My code looks like: CompilerParameters compilerParams = new CompilerParameters(); compilerParams.CompilerOptions = "/target:library /optimize"; compilerParams.GenerateExecutable = false; compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("mscorlib.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); compilerParams.ReferencedAssemblies.Add("System.Data.Linq.dll"); Any ideas?
0
60,772
09/13/2008 18:56:49
3,827
08/31/2008 04:42:17
790
55
Is help file (or user manual) dead?
Back in the days of Unix, you couldn't even [close a software][1] without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single operation possible in the app. After the Internet, help files became html documents. Nowadays with *Web 2.0* applications, you hardly see the Help. Even [if it's there][2], they simply describe some specific tasks. In other words, the apps are relying more on the *common sense* or [*don't-make-me-think*][3] factor of the user base. Years ago Microsoft came up with a concept called [Inductive User Interface][4], which basically tells programmers to put in instructions on the apps itself, but I am not sure how popular that idea is. Are help files, user manuals, and context sensitive online help with F1 key dead? Have I failed if user could not find out what to do from the UI? If not, what degree of help should I provide? (both for desktop and web app) [1]: http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Exiting [2]: http://mail.google.com/support/ [3]: http://www.sensible.com/ [4]: http://msdn.microsoft.com/en-us/library/ms997506.aspx
gui
language-agnostic
null
null
null
null
open
Is help file (or user manual) dead? === Back in the days of Unix, you couldn't even [close a software][1] without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single operation possible in the app. After the Internet, help files became html documents. Nowadays with *Web 2.0* applications, you hardly see the Help. Even [if it's there][2], they simply describe some specific tasks. In other words, the apps are relying more on the *common sense* or [*don't-make-me-think*][3] factor of the user base. Years ago Microsoft came up with a concept called [Inductive User Interface][4], which basically tells programmers to put in instructions on the apps itself, but I am not sure how popular that idea is. Are help files, user manuals, and context sensitive online help with F1 key dead? Have I failed if user could not find out what to do from the UI? If not, what degree of help should I provide? (both for desktop and web app) [1]: http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Exiting [2]: http://mail.google.com/support/ [3]: http://www.sensible.com/ [4]: http://msdn.microsoft.com/en-us/library/ms997506.aspx
0
60,779
09/13/2008 19:09:01
137
08/02/2008 10:46:12
2,278
122
How do you do fuzzy searches using bound parameters in PDO?
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound parameters to prepared statements in PDO. e.g.: $query = $db->prepare("select * from comments where comment like :search"); $query->bindParam(':search', $str); $query->execute(); I've tried numerous permutations of single quotes and % signs and it's just getting cross with me. I seem to remember wrestling with this at some point before but I can't find any references. Does anyone know how (if?) you can do this nicely in PDO with named parameters?
php
sql
pdo
null
null
null
open
How do you do fuzzy searches using bound parameters in PDO? === Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound parameters to prepared statements in PDO. e.g.: $query = $db->prepare("select * from comments where comment like :search"); $query->bindParam(':search', $str); $query->execute(); I've tried numerous permutations of single quotes and % signs and it's just getting cross with me. I seem to remember wrestling with this at some point before but I can't find any references. Does anyone know how (if?) you can do this nicely in PDO with named parameters?
0
60,785
09/13/2008 19:24:13
44,972
09/02/2008 10:00:56
35
1
How can I show a grey transparent overlay in C#
It should overlay other process which are not owned by the application doing the overlay.
c#
null
null
null
null
null
open
How can I show a grey transparent overlay in C# === It should overlay other process which are not owned by the application doing the overlay.
0
60,788
09/13/2008 19:31:15
44,972
09/02/2008 10:00:56
35
1
How can I listen in on shortcuts when the app is the task bar in C#
An example of an app that does this is [Enso][1], it pops up when you press the caps lock. [1]: http://www.humanized.com/enso/
c#
keyboard-shortcuts
null
null
null
null
open
How can I listen in on shortcuts when the app is the task bar in C# === An example of an app that does this is [Enso][1], it pops up when you press the caps lock. [1]: http://www.humanized.com/enso/
0
60,793
09/13/2008 19:43:17
4,541
09/04/2008 17:37:04
177
3
NInject vs. StructureMap etc...
Does anyone have any good suggestions around IoC/DI frameworks? I'm looking into them a bit, but since IoC is new to me I'm looking for pointers on what to check out first.
inversion-of-control
structuremap
ninject
null
null
07/25/2012 14:05:03
not constructive
NInject vs. StructureMap etc... === Does anyone have any good suggestions around IoC/DI frameworks? I'm looking into them a bit, but since IoC is new to me I'm looking for pointers on what to check out first.
4
60,794
09/13/2008 19:43:26
6,264
09/13/2008 12:34:05
1
3
Scriptaculous Ajax.Autocompleter extra functionality in LI
I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions to a 'stop words' table, which means that if they occur in the table, they won't be suggested anymore. I put a button inside the LI elements and when you click on it it should do an ajax request to a page which then adds the word to the table. That works. But then I want the suggestions to be refreshed instantly, so that the suggestions appear without the word just added to the table. Preferably the selected word is the word next or before the previously clicked word. How do I do this? What happens instead now is that the LI you clicked the button of gets to be the selected word and the suggestions disappear. The list items look like this: <li>{0} <img onclick=\"deleteWord('{0}');\" src=\"delete.gif\"/> </li> where {0} represents the suggested word. The javascript function deleteWord(w) gets to call the webhandler which can add the word to the 'stop words' table.
javascript
prototype
scriptaculous
autocomplete
null
null
open
Scriptaculous Ajax.Autocompleter extra functionality in LI === I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions to a 'stop words' table, which means that if they occur in the table, they won't be suggested anymore. I put a button inside the LI elements and when you click on it it should do an ajax request to a page which then adds the word to the table. That works. But then I want the suggestions to be refreshed instantly, so that the suggestions appear without the word just added to the table. Preferably the selected word is the word next or before the previously clicked word. How do I do this? What happens instead now is that the LI you clicked the button of gets to be the selected word and the suggestions disappear. The list items look like this: <li>{0} <img onclick=\"deleteWord('{0}');\" src=\"delete.gif\"/> </li> where {0} represents the suggested word. The javascript function deleteWord(w) gets to call the webhandler which can add the word to the 'stop words' table.
0
60,800
09/13/2008 19:51:17
6,238
09/13/2008 05:55:39
1
1
Installing Curl IDE/RTE on AMD processors
Trying to move my development environment to Linux. And new to Curl. Can't get it to install the IDE & RTE packages on an AMD HP PC running Ubuntu x64. I tried to install the Debian package via the package installer and get "Error: Wrong architecture - i386". Tried using the --force-architecture switch but it errors out. I'm assuming Curl IDE will just run under Intel processors? Anyone have any luck with this issue and can advise? Thanks in advance.
ide
curl
amd
null
null
null
open
Installing Curl IDE/RTE on AMD processors === Trying to move my development environment to Linux. And new to Curl. Can't get it to install the IDE & RTE packages on an AMD HP PC running Ubuntu x64. I tried to install the Debian package via the package installer and get "Error: Wrong architecture - i386". Tried using the --force-architecture switch but it errors out. I'm assuming Curl IDE will just run under Intel processors? Anyone have any luck with this issue and can advise? Thanks in advance.
0
60,802
09/13/2008 19:55:00
2,595
08/23/2008 12:52:27
18
10
Linq to NHibernate multiple OrderBy calls
I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around? Thanks! Rob Code: IQueryable<AgendaItem> items = _agendaRepository.GetAgendaItems(location) .Where(item => item.Minutes.Contains(query) || item.Description.Contains(query)); int total = items.Count(); var results = items .OrderBy(item => item.Agenda.Date) .ThenBy(item => item.OutcomeType) .ThenBy(item => item.OutcomeNumber) .Skip((page - 1)*pageSize) .Take(pageSize) .ToArray(); return new SearchResult(query, total, results); I've tried replacing ThenBy with multiple OrderBy calls. Same result. The method works great if I comment out the two ThenBy calls. Error I'm receiving: [SqlException (0x80131904): Invalid column name '__hibernate_sort_expr_0____hibernate_sort_expr_1__'. Invalid column name '__hibernate_sort_expr_0____hibernate_sort_expr_1__'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33 System.Data.SqlClient.SqlDataReader.get_MetaData() +83 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() +12 NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) +35 NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) +237 NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +203 NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +70 NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +164 [ADOException: could not execute query [ SELECT this_.Id as Id5_2_, this_.AgendaId as AgendaId5_2_, this_.Description as Descript3_5_2_, this_.OutcomeType as OutcomeT4_5_2_, this_.OutcomeNumber as OutcomeN5_5_2_, this_.Minutes as Minutes5_2_, agenda1_.Id as Id2_0_, agenda1_.LocationId as LocationId2_0_, agenda1_.Date as Date2_0_, location2_.Id as Id7_1_, location2_.Name as Name7_1_ FROM AgendaItem this_ left outer join Agenda agenda1_ on this_.AgendaId=agenda1_.Id left outer join Location location2_ on agenda1_.LocationId=location2_.Id WHERE location2_.Id = ? and (this_.Minutes like ? or this_.Description like ?) ORDER BY agenda1_.Date asc, this_.OutcomeType asc, this_.OutcomeNumber asc ] Positional parameters: #0>1 #0>%Core% #0>%Core% [SQL: SELECT this_.Id as Id5_2_, this_.AgendaId as AgendaId5_2_, this_.Description as Descript3_5_2_, this_.OutcomeType as OutcomeT4_5_2_, this_.OutcomeNumber as OutcomeN5_5_2_, this_.Minutes as Minutes5_2_, agenda1_.Id as Id2_0_, agenda1_.LocationId as LocationId2_0_, agenda1_.Date as Date2_0_, location2_.Id as Id7_1_, location2_.Name as Name7_1_ FROM AgendaItem this_ left outer join Agenda agenda1_ on this_.AgendaId=agenda1_.Id left outer join Location location2_ on agenda1_.LocationId=location2_.Id WHERE location2_.Id = ? and (this_.Minutes like ? or this_.Description like ?) ORDER BY agenda1_.Date asc, this_.OutcomeType asc, this_.OutcomeNumber asc]] NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +258 NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) +18 NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) +87 NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) +342 NHibernate.Impl.CriteriaImpl.List(IList results) +41 NHibernate.Impl.CriteriaImpl.List() +35 NHibernate.Linq.CriteriaResultReader`1.List() in C:\home\dev\tools\NHibernate\NHibernateContribSrc\src\NHibernate.Linq\src\NHibernate.Linq\CriteriaResultReader.cs:22 NHibernate.Linq.<GetEnumerator>d__0.MoveNext() in C:\home\dev\tools\NHibernate\NHibernateContribSrc\src\NHibernate.Linq\src\NHibernate.Linq\CriteriaResultReader.cs:27 System.Linq.Buffer`1..ctor(IEnumerable`1 source) +259 System.Linq.Enumerable.ToArray(IEnumerable`1 source) +81 AMS.Core.Services.SearchService.GetVotingRecords(Location location, String query, Int32 page, Int32 pageSize) in C:\home\dev\AgendaManagementSystem\trunk\AMS.Core\Services\SearchService.cs:23 AMS.Web.Controllers.SearchController.VotingRecords(String q, Nullable`1 page) in C:\home\dev\AgendaManagementSystem\trunk\AMS.Web\Controllers\SearchController.cs:18 lambda_method(ExecutionScope , ControllerBase , Object[] ) +129 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(MethodInfo methodInfo, IDictionary`2 parameters) +192 System.Web.Mvc.<>c__DisplayClassb.<InvokeActionMethodWithFilters>b__8() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +199 System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(MethodInfo methodInfo, IDictionary`2 parameters, IList`1 filters) +209 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +386 System.Web.Mvc.Controller.ExecuteCore() +112 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +107 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +39 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
linq-to-nhibernate
null
null
null
null
null
open
Linq to NHibernate multiple OrderBy calls === I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around? Thanks! Rob Code: IQueryable<AgendaItem> items = _agendaRepository.GetAgendaItems(location) .Where(item => item.Minutes.Contains(query) || item.Description.Contains(query)); int total = items.Count(); var results = items .OrderBy(item => item.Agenda.Date) .ThenBy(item => item.OutcomeType) .ThenBy(item => item.OutcomeNumber) .Skip((page - 1)*pageSize) .Take(pageSize) .ToArray(); return new SearchResult(query, total, results); I've tried replacing ThenBy with multiple OrderBy calls. Same result. The method works great if I comment out the two ThenBy calls. Error I'm receiving: [SqlException (0x80131904): Invalid column name '__hibernate_sort_expr_0____hibernate_sort_expr_1__'. Invalid column name '__hibernate_sort_expr_0____hibernate_sort_expr_1__'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33 System.Data.SqlClient.SqlDataReader.get_MetaData() +83 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() +12 NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) +35 NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) +237 NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +203 NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +70 NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +164 [ADOException: could not execute query [ SELECT this_.Id as Id5_2_, this_.AgendaId as AgendaId5_2_, this_.Description as Descript3_5_2_, this_.OutcomeType as OutcomeT4_5_2_, this_.OutcomeNumber as OutcomeN5_5_2_, this_.Minutes as Minutes5_2_, agenda1_.Id as Id2_0_, agenda1_.LocationId as LocationId2_0_, agenda1_.Date as Date2_0_, location2_.Id as Id7_1_, location2_.Name as Name7_1_ FROM AgendaItem this_ left outer join Agenda agenda1_ on this_.AgendaId=agenda1_.Id left outer join Location location2_ on agenda1_.LocationId=location2_.Id WHERE location2_.Id = ? and (this_.Minutes like ? or this_.Description like ?) ORDER BY agenda1_.Date asc, this_.OutcomeType asc, this_.OutcomeNumber asc ] Positional parameters: #0>1 #0>%Core% #0>%Core% [SQL: SELECT this_.Id as Id5_2_, this_.AgendaId as AgendaId5_2_, this_.Description as Descript3_5_2_, this_.OutcomeType as OutcomeT4_5_2_, this_.OutcomeNumber as OutcomeN5_5_2_, this_.Minutes as Minutes5_2_, agenda1_.Id as Id2_0_, agenda1_.LocationId as LocationId2_0_, agenda1_.Date as Date2_0_, location2_.Id as Id7_1_, location2_.Name as Name7_1_ FROM AgendaItem this_ left outer join Agenda agenda1_ on this_.AgendaId=agenda1_.Id left outer join Location location2_ on agenda1_.LocationId=location2_.Id WHERE location2_.Id = ? and (this_.Minutes like ? or this_.Description like ?) ORDER BY agenda1_.Date asc, this_.OutcomeType asc, this_.OutcomeNumber asc]] NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +258 NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) +18 NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) +87 NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) +342 NHibernate.Impl.CriteriaImpl.List(IList results) +41 NHibernate.Impl.CriteriaImpl.List() +35 NHibernate.Linq.CriteriaResultReader`1.List() in C:\home\dev\tools\NHibernate\NHibernateContribSrc\src\NHibernate.Linq\src\NHibernate.Linq\CriteriaResultReader.cs:22 NHibernate.Linq.<GetEnumerator>d__0.MoveNext() in C:\home\dev\tools\NHibernate\NHibernateContribSrc\src\NHibernate.Linq\src\NHibernate.Linq\CriteriaResultReader.cs:27 System.Linq.Buffer`1..ctor(IEnumerable`1 source) +259 System.Linq.Enumerable.ToArray(IEnumerable`1 source) +81 AMS.Core.Services.SearchService.GetVotingRecords(Location location, String query, Int32 page, Int32 pageSize) in C:\home\dev\AgendaManagementSystem\trunk\AMS.Core\Services\SearchService.cs:23 AMS.Web.Controllers.SearchController.VotingRecords(String q, Nullable`1 page) in C:\home\dev\AgendaManagementSystem\trunk\AMS.Web\Controllers\SearchController.cs:18 lambda_method(ExecutionScope , ControllerBase , Object[] ) +129 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(MethodInfo methodInfo, IDictionary`2 parameters) +192 System.Web.Mvc.<>c__DisplayClassb.<InvokeActionMethodWithFilters>b__8() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +199 System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(MethodInfo methodInfo, IDictionary`2 parameters, IList`1 filters) +209 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +386 System.Web.Mvc.Controller.ExecuteCore() +112 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +107 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +39 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
0
60,805
09/13/2008 19:58:02
1,448
08/15/2008 16:16:35
384
23
Getting random row through SQLAlchemy
How do I select a(or some) random row(s) from a table using SQLAlchemy?
python
sql
database
sqlalchemy
null
null
open
Getting random row through SQLAlchemy === How do I select a(or some) random row(s) from a table using SQLAlchemy?
0
60,816
09/13/2008 20:11:11
44,972
09/02/2008 10:00:56
35
1
Whats a good bloging system to setup with a domain.
It has to allow for hosting additional files like .exe . I also really like the design for blog.stackoverflow.com, what does Jeff use?
blogs
null
null
null
null
12/12/2011 17:19:56
off topic
Whats a good bloging system to setup with a domain. === It has to allow for hosting additional files like .exe . I also really like the design for blog.stackoverflow.com, what does Jeff use?
2
60,820
09/13/2008 20:12:51
6,301
09/13/2008 20:12:50
1
0
Find out how much memory is being used by an object in C#?
Does anyone know of a way to find out how much memory an instance of an object is taking? For example, if I have an instance of the following object: TestClass tc = new TestClass(); Is there a way to find out how much memory the instance "tc" is taking? The reason for asking, is that although C# has built in memory management, I often run into issues with not clearing an instance of an object (e.g. a List that keeps track of something). There are couple of reasonably good memory profilers (e.g. ANTS Profiler) but in a multi-threaded environment is pretty hard to figure out what belongs where, even with those tools.
c#
performance
memory
profiler
null
null
open
Find out how much memory is being used by an object in C#? === Does anyone know of a way to find out how much memory an instance of an object is taking? For example, if I have an instance of the following object: TestClass tc = new TestClass(); Is there a way to find out how much memory the instance "tc" is taking? The reason for asking, is that although C# has built in memory management, I often run into issues with not clearing an instance of an object (e.g. a List that keeps track of something). There are couple of reasonably good memory profilers (e.g. ANTS Profiler) but in a multi-threaded environment is pretty hard to figure out what belongs where, even with those tools.
0
60,822
09/13/2008 20:15:20
1,624
08/17/2008 16:13:30
6
2
Can anyone recommend a Silverlight 2 book?
Even though Silverlight2 is still in it's infancy, can anyone recommend a book to get started with? One that has more of a developer focus than a designer one?
silverlight
null
null
null
null
06/12/2012 11:47:16
not constructive
Can anyone recommend a Silverlight 2 book? === Even though Silverlight2 is still in it's infancy, can anyone recommend a book to get started with? One that has more of a developer focus than a designer one?
4
60,823
09/13/2008 20:18:20
123
08/02/2008 08:01:26
1,885
107
Any tool similar to Hyperterminal application?
> HyperTerminal is a program that you can use to connect to other > computers, Telnet sites, bulletin > board systems (BBSs), online services, > and host computers, using either your > modem, a null modem cable or Ethernet > connection. But My main usage of Hyperterminal is to communicate with hardware through local (virtual )COM ports. I suppose it is removed in Vista for some reason. Are there any other tools that functions similar to Hyperterminal? [I am curious to know even if it is not for vista]
windows-vista
communication
virtual-com-port
hyperterminal
null
null
open
Any tool similar to Hyperterminal application? === > HyperTerminal is a program that you can use to connect to other > computers, Telnet sites, bulletin > board systems (BBSs), online services, > and host computers, using either your > modem, a null modem cable or Ethernet > connection. But My main usage of Hyperterminal is to communicate with hardware through local (virtual )COM ports. I suppose it is removed in Vista for some reason. Are there any other tools that functions similar to Hyperterminal? [I am curious to know even if it is not for vista]
0
60,825
09/13/2008 20:19:38
1,090
08/12/2008 11:16:17
65
5
international characters in Javascript
I am working on a web application, where I transfer data from the server to the browser in XML. Since I'm danish, I quickly run into problems with the characters æøå. I know that in html, I use the "&aelig;&oslash;&aring;" for æøå. however, as soon as the chars pass through javascript, I get black boxes with "?" in them when using æøå, and "&aelig;&oslash;&aring;" is printed as is. I've made sure to set it to utf-8, but that isn't helping much. Ideally, I want it to work with any special characters (naturally). The example that isn't working is included below: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" charset="utf-8"> alert("&aelig;&oslash;&aring;"); alert("æøå"); </script> </head> <body> </body> </html> What am I doing wrong?
javascript
internationalization
character-encoding
null
null
null
open
international characters in Javascript === I am working on a web application, where I transfer data from the server to the browser in XML. Since I'm danish, I quickly run into problems with the characters æøå. I know that in html, I use the "&aelig;&oslash;&aring;" for æøå. however, as soon as the chars pass through javascript, I get black boxes with "?" in them when using æøå, and "&aelig;&oslash;&aring;" is printed as is. I've made sure to set it to utf-8, but that isn't helping much. Ideally, I want it to work with any special characters (naturally). The example that isn't working is included below: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" charset="utf-8"> alert("&aelig;&oslash;&aring;"); alert("æøå"); </script> </head> <body> </body> </html> What am I doing wrong?
0
60,830
09/13/2008 20:25:07
123
08/02/2008 08:01:26
1,885
107
What is wrong with using inline functions?
While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions?
c++
interview-questions
inline
null
null
null
open
What is wrong with using inline functions? === While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions?
0
60,848
09/13/2008 20:38:05
4,883
09/06/2008 10:24:59
858
8
How do you retrieve items from a dictionary in the order that they're inserted?
Is it possible to retrieve items from a Python dictionary in the order that they were inserted?
python
null
null
null
null
null
open
How do you retrieve items from a dictionary in the order that they're inserted? === Is it possible to retrieve items from a Python dictionary in the order that they were inserted?
0
60,857
09/13/2008 20:43:19
1,050
08/11/2008 21:06:09
63
6
mod_rewrite equivalent for IIS 7.0
Is there a mod_rewrite equivalent for IIS 7.0 that's a) more or less complete b) suitable for a production environment, i.e. dependable/secure
iis
mod-rewrite
null
null
null
null
open
mod_rewrite equivalent for IIS 7.0 === Is there a mod_rewrite equivalent for IIS 7.0 that's a) more or less complete b) suitable for a production environment, i.e. dependable/secure
0
60,859
09/13/2008 20:46:22
981
08/11/2008 12:08:30
23
1
Recomendations for an FTP Server with and API? COM or .NET API prefered but open to anything.
I am looking for an FTP Server that has a decent API. It would be great if I could code using .NET Framework. I am currently using Secure FTP from GlobalSCAPE but I have had less than plesant experience working with it.
c#
.net
api
ftp
null
null
open
Recomendations for an FTP Server with and API? COM or .NET API prefered but open to anything. === I am looking for an FTP Server that has a decent API. It would be great if I could code using .NET Framework. I am currently using Secure FTP from GlobalSCAPE but I have had less than plesant experience working with it.
0
60,871
09/13/2008 21:04:08
2,958
08/26/2008 08:58:45
78
6
How to solve Memory Fragmentation
We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we've been looking at some alternative memory allocation mechanisms that may help us and I'm hoping someone can tell me the best one: 1) Use Windows [Low-fragmentation Heap][1] 2) jemalloc - as used in [Firefox 3][2] 3) Doug Lea's [malloc][3] Our server process is developed using cross-platform C++ code, so any solution would be ideally cross-platform also (do *nix operating systems suffer from this type of memory fragmentation?). Also, am I right in thinking that LFH is now the default memory allocation mechanism for Windows Server 2008 / Vista?... Will my current problems "go away" if our customers simply upgrade their server os? [1]: http://msdn.microsoft.com/en-us/library/aa366750.aspx [2]: http://en.wikipedia.org/wiki/Mozilla_Firefox_3 [3]: http://g.oswego.edu/
c++
windows
memory
null
null
null
open
How to solve Memory Fragmentation === We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we've been looking at some alternative memory allocation mechanisms that may help us and I'm hoping someone can tell me the best one: 1) Use Windows [Low-fragmentation Heap][1] 2) jemalloc - as used in [Firefox 3][2] 3) Doug Lea's [malloc][3] Our server process is developed using cross-platform C++ code, so any solution would be ideally cross-platform also (do *nix operating systems suffer from this type of memory fragmentation?). Also, am I right in thinking that LFH is now the default memory allocation mechanism for Windows Server 2008 / Vista?... Will my current problems "go away" if our customers simply upgrade their server os? [1]: http://msdn.microsoft.com/en-us/library/aa366750.aspx [2]: http://en.wikipedia.org/wiki/Mozilla_Firefox_3 [3]: http://g.oswego.edu/
0