question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
95,055
95,080
Java: Best Place to Begin Learning Basic Networking
I am trying to write a simple networked chat program in Java. I have almost no networking experience. I was wondering what resources I should begin looking at (beside here of course). Sticking with the core Java API would be best for now.
I found a great tutorial into networking and java from sun's own website: http://download.oracle.com/javase/tutorial/networking/TOC.html The socket section even has you write a mini client / server chat demo.
Java: Best Place to Begin Learning Basic Networking I am trying to write a simple networked chat program in Java. I have almost no networking experience. I was wondering what resources I should begin looking at (beside here of course). Sticking with the core Java API would be best for now.
TITLE: Java: Best Place to Begin Learning Basic Networking QUESTION: I am trying to write a simple networked chat program in Java. I have almost no networking experience. I was wondering what resources I should begin looking at (beside here of course). Sticking with the core Java API would be best for now. ANSWER: I ...
[ "java", "networking" ]
10
16
9,817
8
0
2008-09-18T18:04:02.207000
2008-09-18T18:07:05.023000
95,059
96,132
How can I automate the process of deploying an InfoPath Form to SharePoint Server 2007?
It is a real pain to deploy my InfoPath 2007 Forms from the designer into our development environment's SharePoint server. All of our forms require "full trust" since they include business logic written in C#. Here are the manual steps: 1) Run the "Publish Form" wizard in InfoPath, specifying the target site to publish...
You can package InfoPath forms in SharePoint solutions (WSP files). These can be deployed by making use of STSADM. For more information: http://blogs.importchaos.com/alonsorobles/2008/06/04/creating-a-sharepoint-solution-for-an-infopath-form-template-deployment/#comments http://www.crsw.com/mark/Lists/Posts/Post.aspx?I...
How can I automate the process of deploying an InfoPath Form to SharePoint Server 2007? It is a real pain to deploy my InfoPath 2007 Forms from the designer into our development environment's SharePoint server. All of our forms require "full trust" since they include business logic written in C#. Here are the manual st...
TITLE: How can I automate the process of deploying an InfoPath Form to SharePoint Server 2007? QUESTION: It is a real pain to deploy my InfoPath 2007 Forms from the designer into our development environment's SharePoint server. All of our forms require "full trust" since they include business logic written in C#. Here...
[ "sharepoint", "deployment", "sharepoint-2007", "infopath", "stsadm" ]
6
8
3,140
3
0
2008-09-18T18:04:51.753000
2008-09-18T19:39:34.380000
95,077
95,199
storing state across postback
What is the best way to store string data across postback. I need to store an ID and name for multiple entities. I was thinking of using a datatable in viewstate, but would that make viewstate grow too large? I can't use a database yet because I'll be inserting a record that those other records need to be related to. S...
You actually have a lot of options - the one you choose will entirely depend on the requirements of your own application. ViewState - you can add the data to the page's viewstate. The advantages of this is that the data will live only for the lifetime of the user being on the page and posting it back to the server. Ano...
storing state across postback What is the best way to store string data across postback. I need to store an ID and name for multiple entities. I was thinking of using a datatable in viewstate, but would that make viewstate grow too large? I can't use a database yet because I'll be inserting a record that those other re...
TITLE: storing state across postback QUESTION: What is the best way to store string data across postback. I need to store an ID and name for multiple entities. I was thinking of using a datatable in viewstate, but would that make viewstate grow too large? I can't use a database yet because I'll be inserting a record t...
[ "asp.net" ]
2
4
899
6
0
2008-09-18T18:06:55.930000
2008-09-18T18:16:37.433000
95,087
97,790
SQLite / Firebird embedded for numeric data
I have an experiment streaming up 1Mb/s of numeric data which needs to be stored for later processing. It seems as easy to write directly into a database as to a CSV file and I would then have the ability to easily retrieve subsets or ranges. I have experience of sqlite2 (when it only had text fields) and it seemed pre...
If you only need to read/write the data, without any checking or manipulation done in database, then both should do it fine. Firebird's database file can be copied, as long as the system has the same endianess (i.e. you cannot copy the file between systems with Intel and PPC processors, but Intel-Intel is fine). Howeve...
SQLite / Firebird embedded for numeric data I have an experiment streaming up 1Mb/s of numeric data which needs to be stored for later processing. It seems as easy to write directly into a database as to a CSV file and I would then have the ability to easily retrieve subsets or ranges. I have experience of sqlite2 (whe...
TITLE: SQLite / Firebird embedded for numeric data QUESTION: I have an experiment streaming up 1Mb/s of numeric data which needs to be stored for later processing. It seems as easy to write directly into a database as to a CSV file and I would then have the ability to easily retrieve subsets or ranges. I have experien...
[ "database", "sqlite", "firebird" ]
2
3
3,162
5
0
2008-09-18T18:07:29.047000
2008-09-18T22:49:15.283000
95,089
1,193,101
How to handle UTF-8 characters in sqlite2 to sqlite3 migration
Trying the easy approach: sqlite2 mydb.db.dump | sqlite3 mydb-new.db I got this error: SQL error near line 84802: no such column: Ð In that line the script is this: INSERT INTO vehiculo VALUES(127548,'21K0065217', Ñ,'PA007808',65217,279,1989,3,468,'1998-07-30 00:00:00.000000','14/697/98-07',2,'',1); My guess is that th...
Simply open the v2 database with the sqlite3 binary CLI, and then save it. The database file will be transparently migrated to v3. It doesn't work. $sqlite3 db2 SQLite version 3.6.16 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>.tables Error: file is encrypted or is not a database sq...
How to handle UTF-8 characters in sqlite2 to sqlite3 migration Trying the easy approach: sqlite2 mydb.db.dump | sqlite3 mydb-new.db I got this error: SQL error near line 84802: no such column: Ð In that line the script is this: INSERT INTO vehiculo VALUES(127548,'21K0065217', Ñ,'PA007808',65217,279,1989,3,468,'1998-07-...
TITLE: How to handle UTF-8 characters in sqlite2 to sqlite3 migration QUESTION: Trying the easy approach: sqlite2 mydb.db.dump | sqlite3 mydb-new.db I got this error: SQL error near line 84802: no such column: Ð In that line the script is this: INSERT INTO vehiculo VALUES(127548,'21K0065217', Ñ,'PA007808',65217,279,19...
[ "windows", "command-line", "utf-8", "sqlite", "sqlite2" ]
1
1
2,168
4
0
2008-09-18T18:07:34.070000
2009-07-28T09:57:00.880000
95,098
95,259
Why is Application.Restart() not reliable?
Using the method Application.Restart() in C# should restart the current application: but it seems that this is not always working. Is there a reason for this Issue, can somebody tell me, why it doesn't work all the time?
There could be a lot of reasons for this. It's not that the method doesn't work; rather, many times programmers forget that they've put something in their code that would stop the application from automatically shutting down, or starting up. Two examples: The Closing event on a form can stop an app's shutdown If you're...
Why is Application.Restart() not reliable? Using the method Application.Restart() in C# should restart the current application: but it seems that this is not always working. Is there a reason for this Issue, can somebody tell me, why it doesn't work all the time?
TITLE: Why is Application.Restart() not reliable? QUESTION: Using the method Application.Restart() in C# should restart the current application: but it seems that this is not always working. Is there a reason for this Issue, can somebody tell me, why it doesn't work all the time? ANSWER: There could be a lot of reaso...
[ "c#", ".net" ]
48
30
67,887
12
0
2008-09-18T18:08:05.410000
2008-09-18T18:21:47.970000
95,106
425,667
Vim shortcut for adding arguments to a function
Is there a Vim shortcut for jumping to the argument list of the current function? I often find myself needing to mess with the argument list of a function, and it's kind of annoying to have to do?def or?function or 10k or what-have-you until I finally get to it, then /( or t( or 5e to get to the right position in the a...
The fool proof way of getting to the begining of a function is to use [[. So you use map,a ma[[kf(a so it can take you to the function definition, search for the first occurance of "(" and then put you in the insert mode.
Vim shortcut for adding arguments to a function Is there a Vim shortcut for jumping to the argument list of the current function? I often find myself needing to mess with the argument list of a function, and it's kind of annoying to have to do?def or?function or 10k or what-have-you until I finally get to it, then /( o...
TITLE: Vim shortcut for adding arguments to a function QUESTION: Is there a Vim shortcut for jumping to the argument list of the current function? I often find myself needing to mess with the argument list of a function, and it's kind of annoying to have to do?def or?function or 10k or what-have-you until I finally ge...
[ "vim", "keyboard-shortcuts" ]
1
1
1,765
3
0
2008-09-18T18:09:21.447000
2009-01-08T20:01:52.697000
95,112
95,142
How do I delay code execution in Visual Basic (VB6)?
I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait? Trivial example: Call ExternalLongRunningProcess Call DoOtherStuff How do I delay 'DoOtherStuff'?
VB.Net: I would use a WaitOne event handle. VB 6.0: I've seen a DoEvents Loop. Do If isSomeCheckCondition() Then Exit Do DoEvents Loop Finally, You could just sleep: Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Sleep 10000
How do I delay code execution in Visual Basic (VB6)? I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait? Trivial example: Call ExternalLongRunningProcess Call DoOtherStuff How do I delay 'DoOtherStuff'?
TITLE: How do I delay code execution in Visual Basic (VB6)? QUESTION: I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait? Trivial example: Call ExternalLongRunningProcess Call DoOtherStuff How do I dela...
[ "process", "vb6" ]
14
16
83,250
8
0
2008-09-18T18:09:44.860000
2008-09-18T18:12:28.257000
95,120
95,157
Where is the best place to store user related data in asp.net?
When a customer logs in to my site, I need to know their account id and their menu id. This lets me know what data they can see on a page and what menu they get. I don't want to have to read this data over and over. Should I store this in a session variable or customize the membership user and membership provider to co...
As already suggested, the profile system is super easy. http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx
Where is the best place to store user related data in asp.net? When a customer logs in to my site, I need to know their account id and their menu id. This lets me know what data they can see on a page and what menu they get. I don't want to have to read this data over and over. Should I store this in a session variable...
TITLE: Where is the best place to store user related data in asp.net? QUESTION: When a customer logs in to my site, I need to know their account id and their menu id. This lets me know what data they can see on a page and what menu they get. I don't want to have to read this data over and over. Should I store this in ...
[ "c#", "asp.net" ]
5
4
473
4
0
2008-09-18T18:10:45.030000
2008-09-18T18:13:18.677000
95,134
95,984
How does jstl's sql tag work?
I'm using the following code to query a database from my jsp, but I'd like to know more about what's happening behind the scenes. These are my two primary questions. Does the tag access the ResultSet directly, or is the query result being stored in a datastructure in memory? When is the connection closed? <%@ taglib pr...
Observations based on the source for org.apache.taglibs.standard.tag.common.sql.QueryTagSupport The taglib traverses through the ResultSet and puts all of the data in arrays, Maps, and Lists. So, everything is loaded into memory before you even start looping. The connection is opened when the query start tag is encount...
How does jstl's sql tag work? I'm using the following code to query a database from my jsp, but I'd like to know more about what's happening behind the scenes. These are my two primary questions. Does the tag access the ResultSet directly, or is the query result being stored in a datastructure in memory? When is the co...
TITLE: How does jstl's sql tag work? QUESTION: I'm using the following code to query a database from my jsp, but I'd like to know more about what's happening behind the scenes. These are my two primary questions. Does the tag access the ResultSet directly, or is the query result being stored in a datastructure in memo...
[ "java", "jsp", "web-applications", "jstl" ]
3
8
5,097
2
0
2008-09-18T18:11:58.960000
2008-09-18T19:23:52.063000
95,181
97,630
Java Serialization with non serializable parts
I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is a property that is not serializable. How can I serialize (and de-serialize) this object? Correction: MyClass2 is, of course, not an interface but a class.
As someone else noted, chapter 11 of Josh Bloch's Effective Java is an indispensible resource on Java Serialization. A couple points from that chapter pertinent to your question: assuming you want to serialize the state of the non-serializable field in MyClass2, that field must be accessible to MyClass, either directly...
Java Serialization with non serializable parts I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is a property that is not serializable. How can I serialize (and de-serialize) this object? Correction: MyClass2 is, of course, not an interface but a class.
TITLE: Java Serialization with non serializable parts QUESTION: I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is a property that is not serializable. How can I serialize (and de-serialize) this object? Correction: MyClass2 is, of course, not an interface but a class. ANSWER: As ...
[ "java", "serialization" ]
56
51
103,437
10
0
2008-09-18T18:15:15.893000
2008-09-18T22:24:30.663000
95,183
95,256
How does one create an index on the date part of DATETIME field in MySql
How do I create an index on the date part of DATETIME field? mysql> SHOW COLUMNS FROM transactionlist; +-------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+------------------+------+-----+---------+----------------+ | Trans...
If I remember correctly, that will run a whole table scan because you're passing the column through a function. MySQL will obediently run the function for each and every column, bypassing the index since the query optimizer can't really know the results of the function. What I would do is something like: SELECT * FROM ...
How does one create an index on the date part of DATETIME field in MySql How do I create an index on the date part of DATETIME field? mysql> SHOW COLUMNS FROM transactionlist; +-------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------...
TITLE: How does one create an index on the date part of DATETIME field in MySql QUESTION: How do I create an index on the date part of DATETIME field? mysql> SHOW COLUMNS FROM transactionlist; +-------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra...
[ "mysql" ]
77
72
77,083
13
0
2008-09-18T18:15:25.160000
2008-09-18T18:21:33.693000
95,218
95,809
T-SQL triggers firing a "Column name or number of supplied values does not match table definition" error
Here's something I haven't been able to fix, and I've looked everywhere. Perhaps someone here will know! I have a table called dandb_raw, with three columns in particular: dunsId (PK), name, and searchName. I also have a trigger that acts on this table: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [d...
I think David and Cervo combined have hit on the problem here. I'm pretty sure part of what was happening was that we were using #newMatches in multiple triggers. When one trigger changed some rows, it would fire another trigger, which would attempt to use the connection scoped #newMatches. As a result, it would try to...
T-SQL triggers firing a "Column name or number of supplied values does not match table definition" error Here's something I haven't been able to fix, and I've looked everywhere. Perhaps someone here will know! I have a table called dandb_raw, with three columns in particular: dunsId (PK), name, and searchName. I also h...
TITLE: T-SQL triggers firing a "Column name or number of supplied values does not match table definition" error QUESTION: Here's something I haven't been able to fix, and I've looked everywhere. Perhaps someone here will know! I have a table called dandb_raw, with three columns in particular: dunsId (PK), name, and se...
[ "sql", "t-sql", "triggers" ]
5
2
5,668
4
0
2008-09-18T18:18:14.840000
2008-09-18T19:07:23.443000
95,221
96,060
How to evaluate Eclipse RCP for an in-house project?
I have only a basic understanding of Eclipse RCP. I am about to start an in-house application for our technical support team, that will likely grow over time. The team is distributed across continents so I would like to be able to auto-update the application when new versions are made available. The application aims to...
The best way to evaluate RCP is to create a small project... I started with the tutorial here: http://www.ibm.com/developerworks/edu/os-dw-os-ecl-rcpapp.html and gradually created a less trivial application. Probably the best single resource I've found is the "Eclipse Rich Client Platform" book (which I initially borro...
How to evaluate Eclipse RCP for an in-house project? I have only a basic understanding of Eclipse RCP. I am about to start an in-house application for our technical support team, that will likely grow over time. The team is distributed across continents so I would like to be able to auto-update the application when new...
TITLE: How to evaluate Eclipse RCP for an in-house project? QUESTION: I have only a basic understanding of Eclipse RCP. I am about to start an in-house application for our technical support team, that will likely grow over time. The team is distributed across continents so I would like to be able to auto-update the ap...
[ "eclipse-rcp", "eclipse-ecf" ]
1
1
460
1
0
2008-09-18T18:18:34.810000
2008-09-18T19:30:27.693000
95,222
95,494
GLSL major mode for Emacs?
I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode. If there isn't one, any goo...
Add the following code to your ~/.emacs file. (autoload 'glsl-mode "glsl-mode" nil t) (add-to-list 'auto-mode-alist '("\\.vert\\'". glsl-mode)) (add-to-list 'auto-mode-alist '("\\.frag\\'". glsl-mode)) Put the file http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/glsl-mode.el somewhere on your emacs path. You c...
GLSL major mode for Emacs? I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode. ...
TITLE: GLSL major mode for Emacs? QUESTION: I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar sho...
[ "emacs", "elisp", "glsl" ]
15
15
3,801
2
0
2008-09-18T18:18:36.713000
2008-09-18T18:40:16.490000
95,235
95,386
What's the best way to send a file over a network using C#?
Can anyone point me to a tutorial on the best way to open a connection from client to server, read in a binary file and send its contents reliably across the network connection? Even better, is there an open source library that already does this that I could refer to?
You should look into binary serialization and sending it over a TCP socket. Good explanation on different types of serialization: http://www.dotnetspider.com/resources/408-XML-serialization-Binary-serialization.aspx Good primer on TCP Client/Server in C#: http://www.codeproject.com/KB/IP/tcpclientserver.aspx
What's the best way to send a file over a network using C#? Can anyone point me to a tutorial on the best way to open a connection from client to server, read in a binary file and send its contents reliably across the network connection? Even better, is there an open source library that already does this that I could r...
TITLE: What's the best way to send a file over a network using C#? QUESTION: Can anyone point me to a tutorial on the best way to open a connection from client to server, read in a binary file and send its contents reliably across the network connection? Even better, is there an open source library that already does t...
[ "c#", ".net", "ftp", "tcp", "data-transfer" ]
8
6
33,749
6
0
2008-09-18T18:19:48.677000
2008-09-18T18:32:32.047000
95,257
95,728
How to get a table of dates between x and y in sql server 2005
I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, allowing me to mark missing days with a 0
Strictly speaking this doesn't exactly answer your question, but its pretty neat. Assuming you can live with specifying the number of days after the start date, then using a Common Table Expression gives you: WITH numbers ( n ) AS ( SELECT 1 UNION ALL SELECT 1 + n FROM numbers WHERE n < 500 ) SELECT DATEADD(day,n-1,'20...
How to get a table of dates between x and y in sql server 2005 I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, allowing me to mark ...
TITLE: How to get a table of dates between x and y in sql server 2005 QUESTION: I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, al...
[ "sql-server", "date", "temp-tables", "procedure" ]
10
18
6,552
9
0
2008-09-18T18:21:35.177000
2008-09-18T19:00:12.120000
95,297
95,482
Legality of Encryption in Standard Libraries
Some programming languages such as Java and C# include encryption packages in their standard libraries. Others such as Python and Ruby make you download third-party modules to do strong encryption. I assume that this is for legal reasons; perhaps Sun Microsystems has enough lawyers that they aren't afraid of getting su...
There are two issues: importation of encryption software, and exportation of encryption software. Some countries (China, Russia, Iran, Iraq, Myanmar, etc.) restrict the use of cryptography by their citizens. It is illegal to import encryption software to those countries. To enable unlimited encryption strength in the J...
Legality of Encryption in Standard Libraries Some programming languages such as Java and C# include encryption packages in their standard libraries. Others such as Python and Ruby make you download third-party modules to do strong encryption. I assume that this is for legal reasons; perhaps Sun Microsystems has enough ...
TITLE: Legality of Encryption in Standard Libraries QUESTION: Some programming languages such as Java and C# include encryption packages in their standard libraries. Others such as Python and Ruby make you download third-party modules to do strong encryption. I assume that this is for legal reasons; perhaps Sun Micros...
[ "encryption", "programming-languages" ]
6
7
2,672
4
0
2008-09-18T18:25:32.063000
2008-09-18T18:39:35.523000
95,305
95,338
Looking for regex to extract email addresses from /etc/passwd
Most of my users have email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field. Can somebody give me a regex to grab just the email address (delimeted by commas) from a line in thi...
What about:,([^@]+@[^,:]+) Where the group contains the email address. [Updated based upon comment that address doesn't always get terminated by a comma]
Looking for regex to extract email addresses from /etc/passwd Most of my users have email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field. Can somebody give me a regex to grab j...
TITLE: Looking for regex to extract email addresses from /etc/passwd QUESTION: Most of my users have email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field. Can somebody give me...
[ "regex", "linux", "sed" ]
1
6
13,960
7
0
2008-09-18T18:26:26.787000
2008-09-18T18:28:45.627000
95,326
95,405
What tools and techniques do you use to fix browser memory leaks?
I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids. Tips?
You should try the Javascript Memory Leak detector developed internally at Microsoft.
What tools and techniques do you use to fix browser memory leaks? I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids. Tips?
TITLE: What tools and techniques do you use to fix browser memory leaks? QUESTION: I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids. Tips? ANSWER: You should try the Javascript Memory Leak detector dev...
[ "javascript", "internet-explorer", "memory" ]
11
6
6,371
3
0
2008-09-18T18:27:28.097000
2008-09-18T18:33:39.297000
95,346
96,404
RSS Statistics/Traffic Metrics
I want to track how much traffic I'm getting on an RSS feed that is set up using.Net 2.0 & SQL Server. Is there an industry standard on what metrics I should use, for example, page hits?
Feedburner analysis gives you statistics like: (source: blogperfume.com ) (source: blogperfume.com ) (source: blogperfume.com )
RSS Statistics/Traffic Metrics I want to track how much traffic I'm getting on an RSS feed that is set up using.Net 2.0 & SQL Server. Is there an industry standard on what metrics I should use, for example, page hits?
TITLE: RSS Statistics/Traffic Metrics QUESTION: I want to track how much traffic I'm getting on an RSS feed that is set up using.Net 2.0 & SQL Server. Is there an industry standard on what metrics I should use, for example, page hits? ANSWER: Feedburner analysis gives you statistics like: (source: blogperfume.com ) (...
[ "rss", "metrics" ]
1
3
375
3
0
2008-09-18T18:29:18.497000
2008-09-18T20:11:58.593000
95,361
95,718
Visual Studio 2005. RC File includes
I'm programming in C++ on Visual Studio 2005. My question deals with.rc files. You can manually place include directives like (#include "blah.h"), at the top of an.rc file. But that's bad news since the first time someone opens the.rc file in the resource editor, it gets overwritten. I know there is a place to make the...
Add your #include to the file in the normal way, but also add it to one the three "TEXTINCLUDE" sections in the file, like so: 2 TEXTINCLUDE BEGIN "#include ""windows.h""\r\n" "#include ""blah.h\r\n" "\0" END Note the following details: Each line is contained in quotes Use pairs of quotes, e.g., "" to place a quote cha...
Visual Studio 2005. RC File includes I'm programming in C++ on Visual Studio 2005. My question deals with.rc files. You can manually place include directives like (#include "blah.h"), at the top of an.rc file. But that's bad news since the first time someone opens the.rc file in the resource editor, it gets overwritten...
TITLE: Visual Studio 2005. RC File includes QUESTION: I'm programming in C++ on Visual Studio 2005. My question deals with.rc files. You can manually place include directives like (#include "blah.h"), at the top of an.rc file. But that's bad news since the first time someone opens the.rc file in the resource editor, i...
[ "visual-studio", "visual-studio-2005" ]
9
6
6,768
5
0
2008-09-18T18:30:15.827000
2008-09-18T18:59:11.250000
95,364
96,157
How do I modify a ReadOnly Linq property
I have a LINQ to SQL generated class with a readonly property: _ Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer) Get Return Me._TotalLogins End Get End Property This prevents it from being changed externally, but I would like to update the property from within my class like below: Partial Public C...
Set the existing TotalLogins property as either private or protected and remove the readonly attribute. You may also want to rename it e.g. InternalTotalLogins. Then create a new property by hand in the partial class that exposes it publically as a read-only property: Public ReadOnly Property TotalLogins() As System.Nu...
How do I modify a ReadOnly Linq property I have a LINQ to SQL generated class with a readonly property: _ Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer) Get Return Me._TotalLogins End Get End Property This prevents it from being changed externally, but I would like to update the property from wit...
TITLE: How do I modify a ReadOnly Linq property QUESTION: I have a LINQ to SQL generated class with a readonly property: _ Public ReadOnly Property TotalLogins() As System.Nullable(Of Integer) Get Return Me._TotalLogins End Get End Property This prevents it from being changed externally, but I would like to update the...
[ "vb.net", "linq-to-sql" ]
1
2
2,296
3
0
2008-09-18T18:30:49.320000
2008-09-18T19:42:40.613000
95,378
96,468
Batch source-code aware spell check
What is a tool or technique that can be used to perform spell checks upon a whole source code base and its associated resource files? The spell check should be source code aware meaning that it would stick to checking string literals in the code and not the code itself. Bonus points if the spell checker understands com...
As you mentioned, many IDEs have this functionality already, and one such IDE is Eclipse. However, unlike many other IDEs Eclipse is: A) open source B) designed to be programmable For instance, here's an article on using Eclipse's code formatting functionality from the command line: http://www.peterfriese.de/formatting...
Batch source-code aware spell check What is a tool or technique that can be used to perform spell checks upon a whole source code base and its associated resource files? The spell check should be source code aware meaning that it would stick to checking string literals in the code and not the code itself. Bonus points ...
TITLE: Batch source-code aware spell check QUESTION: What is a tool or technique that can be used to perform spell checks upon a whole source code base and its associated resource files? The spell check should be source code aware meaning that it would stick to checking string literals in the code and not the code its...
[ "spell-checking" ]
12
1
2,289
2
0
2008-09-18T18:31:55.293000
2008-09-18T20:19:44.627000
95,379
95,498
Passing parameters to start as a console or GUI application?
I have a console application that will be kicked off with a scheduler. If for some reason, part of that file is not able to be built I need a GUI front end so we can run it the next day with specific input. Is there as way pass parameters to the application entry point to start the console application or the GUI applic...
It sounds like what you want is to either run as a console app or a windows app based on a commandline switch. If you look at the last message in this thread, Jeffrey Knight posted code to do what you are asking. However, note that many "hybrid" apps actually ship two different executables (look at visual studio- deven...
Passing parameters to start as a console or GUI application? I have a console application that will be kicked off with a scheduler. If for some reason, part of that file is not able to be built I need a GUI front end so we can run it the next day with specific input. Is there as way pass parameters to the application e...
TITLE: Passing parameters to start as a console or GUI application? QUESTION: I have a console application that will be kicked off with a scheduler. If for some reason, part of that file is not able to be built I need a GUI front end so we can run it the next day with specific input. Is there as way pass parameters to...
[ "c#" ]
3
3
4,373
5
0
2008-09-18T18:31:57.490000
2008-09-18T18:40:28.890000
95,389
213,866
How do I force a Java subclass to define an Annotation?
If a class defined an annotation, is it somehow possible to force its subclass to define the same annotation? For instance, we have a simple class/subclass pair that share the @Author @interface. What I'd like to do is force each further subclass to define the same @Author annotation, preventing a RuntimeException some...
You can do that with JSR 269, at compile time. See: http://today.java.net/pub/a/today/2006/06/29/validate-java-ee-annotations-with-annotation-processors.html#pluggable-annotation-processing-api Edit 2020-09-20: Link is dead, archived version here: https://web.archive.org/web/20150516080739/http://today.java.net/pub/a/t...
How do I force a Java subclass to define an Annotation? If a class defined an annotation, is it somehow possible to force its subclass to define the same annotation? For instance, we have a simple class/subclass pair that share the @Author @interface. What I'd like to do is force each further subclass to define the sam...
TITLE: How do I force a Java subclass to define an Annotation? QUESTION: If a class defined an annotation, is it somehow possible to force its subclass to define the same annotation? For instance, we have a simple class/subclass pair that share the @Author @interface. What I'd like to do is force each further subclass...
[ "java", "annotations", "subclass" ]
11
4
10,676
3
0
2008-09-18T18:32:40.750000
2008-10-17T21:09:26.390000
95,419
5,104,630
What are all the different ways to create an object in Java?
Had a conversation with a coworker the other day about this. There's the obvious using a constructor, but what are the other ways there?
There are four different ways to create objects in java: A. Using new keyword This is the most common way to create an object in java. Almost 99% of objects are created in this way. MyObject object = new MyObject(); B. Using Class.forName() If we know the name of the class & if it has a public default constructor we ca...
What are all the different ways to create an object in Java? Had a conversation with a coworker the other day about this. There's the obvious using a constructor, but what are the other ways there?
TITLE: What are all the different ways to create an object in Java? QUESTION: Had a conversation with a coworker the other day about this. There's the obvious using a constructor, but what are the other ways there? ANSWER: There are four different ways to create objects in java: A. Using new keyword This is the most ...
[ "java" ]
184
291
444,545
22
0
2008-09-18T18:35:16.937000
2011-02-24T12:26:43.660000
95,426
95,513
Unit Testing in .NET: How to Mock Entity Data Provider
Does anyone know whether there's a way to mock Entity Data Provider so Unit Tests don't hit the live data? I found this blog but it seems the project hasn't been released: http://www.chrisdoesdev.com/index.php/archives/62 Thanks
Mattwar has a great article on his blog about mocking up LinqtoSql with reflection -- perhaps you can use that as a starting point?
Unit Testing in .NET: How to Mock Entity Data Provider Does anyone know whether there's a way to mock Entity Data Provider so Unit Tests don't hit the live data? I found this blog but it seems the project hasn't been released: http://www.chrisdoesdev.com/index.php/archives/62 Thanks
TITLE: Unit Testing in .NET: How to Mock Entity Data Provider QUESTION: Does anyone know whether there's a way to mock Entity Data Provider so Unit Tests don't hit the live data? I found this blog but it seems the project hasn't been released: http://www.chrisdoesdev.com/index.php/archives/62 Thanks ANSWER: Mattwar h...
[ "unit-testing", "entity-framework", "mocking" ]
4
3
1,524
2
0
2008-09-18T18:35:41.273000
2008-09-18T18:41:41.073000
95,432
95,640
How do I open "Find Files" dialog from command-line in Windows XP to search a specific folder?
I'd like to create a hotkey to search for files under a specific folder in Windows XP; I'm using AutoHotkey to create this shortcut. Problem is that I need to know a command-line statement to run in order to open the standard Windows "Find Files/Folders" dialog. I've googled for a while and haven't found any page indic...
from http://www.pcreview.co.uk/forums/thread-1468270.php @echo off echo CreateObject("Shell.Application").FindFiles >%temp%\myff.vbs cscript.exe //Nologo %temp%\myff.vbs del %temp%\myff.vbs
How do I open "Find Files" dialog from command-line in Windows XP to search a specific folder? I'd like to create a hotkey to search for files under a specific folder in Windows XP; I'm using AutoHotkey to create this shortcut. Problem is that I need to know a command-line statement to run in order to open the standard...
TITLE: How do I open "Find Files" dialog from command-line in Windows XP to search a specific folder? QUESTION: I'd like to create a hotkey to search for files under a specific folder in Windows XP; I'm using AutoHotkey to create this shortcut. Problem is that I need to know a command-line statement to run in order to...
[ "windows", "windows-xp" ]
4
3
17,741
11
0
2008-09-18T18:36:15.517000
2008-09-18T18:52:14.777000
95,442
1,846,968
Sniffing traffic between a Flex app and ColdFusion backend
What is a good strategy for sniffing/tracing function calls between a Flex application and a ColdFusion-based backend running on ColdFusion server? I understand they use AMF protocol. I'm used to using Fiddler to sniff transactions between HTTP clients and servers, and it works great as long as you're using plain text ...
Firebug with the Flashbug plugin will show all decoded AMF messages both to and from a Flash app. Works well over HTTPS too. https://addons.mozilla.org/en-us/firefox/addon/amf-explorer/.
Sniffing traffic between a Flex app and ColdFusion backend What is a good strategy for sniffing/tracing function calls between a Flex application and a ColdFusion-based backend running on ColdFusion server? I understand they use AMF protocol. I'm used to using Fiddler to sniff transactions between HTTP clients and serv...
TITLE: Sniffing traffic between a Flex app and ColdFusion backend QUESTION: What is a good strategy for sniffing/tracing function calls between a Flex application and a ColdFusion-based backend running on ColdFusion server? I understand they use AMF protocol. I'm used to using Fiddler to sniff transactions between HTT...
[ "apache-flex", "debugging", "coldfusion", "amf", "sniffing" ]
7
1
3,560
6
0
2008-09-18T18:36:52.660000
2009-12-04T13:33:12.287000
95,459
95,489
What's the canonical way to store arbitrary (possibly marked up) text in SQL?
What do wikis/stackoverflow/etc. do when it comes to storing text? Is the text broken at newlines? Is it broken into fixed-length chunks? How do you best store arbitrarily long chunks of text?
nvarchar(max) ftw. because over complicating simple things is bad, mmkay?
What's the canonical way to store arbitrary (possibly marked up) text in SQL? What do wikis/stackoverflow/etc. do when it comes to storing text? Is the text broken at newlines? Is it broken into fixed-length chunks? How do you best store arbitrarily long chunks of text?
TITLE: What's the canonical way to store arbitrary (possibly marked up) text in SQL? QUESTION: What do wikis/stackoverflow/etc. do when it comes to storing text? Is the text broken at newlines? Is it broken into fixed-length chunks? How do you best store arbitrarily long chunks of text? ANSWER: nvarchar(max) ftw. bec...
[ "sql", "text" ]
3
10
939
8
0
2008-09-18T18:38:14.153000
2008-09-18T18:40:00.170000
95,492
95,539
How do I convert a date/time to epoch time (unix time/seconds since 1970) in Perl?
Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT? Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array?
This is the simplest way to get unix time: use Time::Local; timelocal($second,$minute,$hour,$day,$month-1,$year); Note the reverse order of the arguments and that January is month 0. For many more options, see the DateTime module from CPAN. As for parsing, see the Date::Parse module from CPAN. If you really need to get...
How do I convert a date/time to epoch time (unix time/seconds since 1970) in Perl? Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT? Bonus question: If given the date/time as a string, how would y...
TITLE: How do I convert a date/time to epoch time (unix time/seconds since 1970) in Perl? QUESTION: Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT? Bonus question: If given the date/time as a s...
[ "perl", "datetime", "parsing", "date", "time" ]
54
27
141,256
14
0
2008-09-18T18:40:08.970000
2008-09-18T18:43:36.777000
95,500
95,896
Can this macro be converted to a function?
While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure: #define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) Very useful as it is but can it be converted into an inline function or template? OK, ARRAYSIZE...
As been stated, the code actually work out the number of elements in an array, not struct. I would just write out the sizeof() division explicitly when I want it. If I were to make it a function, I would want to make it clear in its definition that it's expecting an array. template inline size_t array_size(const T (&ar...
Can this macro be converted to a function? While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure: #define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) Very useful as it is but can it be converted into an...
TITLE: Can this macro be converted to a function? QUESTION: While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure: #define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) Very useful as it is but can it be...
[ "c++", "macros", "c-preprocessor" ]
8
19
4,205
16
0
2008-09-18T18:40:34.773000
2008-09-18T19:15:33.423000
95,506
99,351
How do I use JUnitPerf with JWebUnit and JUnit 4?
I have a series of functional tests against a web application that correctly run, but each require the class level setup and teardown provided with the @BeforeClass and @AfterClass annotations, and hence require JUnit 4.0 or above. Now I want to perform load testing using a small number of these functional tests, which...
You need a JUnit4 aware TestFactory. I've included one below. import junit.framework.JUnit4TestAdapter; import junit.framework.TestCase; import junit.framework.TestSuite; import com.clarkware.junitperf.TestFactory; class JUnit4TestFactory extends TestFactory { static class DummyTestCase extends TestCase { public voi...
How do I use JUnitPerf with JWebUnit and JUnit 4? I have a series of functional tests against a web application that correctly run, but each require the class level setup and teardown provided with the @BeforeClass and @AfterClass annotations, and hence require JUnit 4.0 or above. Now I want to perform load testing usi...
TITLE: How do I use JUnitPerf with JWebUnit and JUnit 4? QUESTION: I have a series of functional tests against a web application that correctly run, but each require the class level setup and teardown provided with the @BeforeClass and @AfterClass annotations, and hence require JUnit 4.0 or above. Now I want to perfor...
[ "java", "unit-testing" ]
8
10
4,058
1
0
2008-09-18T18:41:24.707000
2008-09-19T03:39:12.170000
95,510
95,605
How to detect whether Vista UAC is enabled?
I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?
This registry key should tell you: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System Value EnableLUA (DWORD) 1 enabled / 0 or missing disabled But that assumes you have the rights to read it. Programmatically you can try to read the user's token and guess if it's an admin running with UAC enabled (see here...
How to detect whether Vista UAC is enabled? I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?
TITLE: How to detect whether Vista UAC is enabled? QUESTION: I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer? ANSWER: This registry key should tell you: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Po...
[ "windows-vista", "uac" ]
22
18
22,673
8
0
2008-09-18T18:41:36.703000
2008-09-18T18:49:26.200000
95,525
95,689
Why is my program asking for permission to run on Vista?
I've just built a VS C++ 6.0 program using VS 2008. When I attempt to run or debug the application, Vista asks for permission. What is it about how the program is built that causes this? The program is being built and run from a subfolder of C:\Dev This response made no sense to me as a solution to the problem.
Possibility 1: Your program is marked as needing admin rights in its manifest Possibility 2: Your program is called setup.exe or install.exe - such program names always cause administrator rights to be required For detailed explanation of those and other possibilities why you see this check Getting to Know User Account...
Why is my program asking for permission to run on Vista? I've just built a VS C++ 6.0 program using VS 2008. When I attempt to run or debug the application, Vista asks for permission. What is it about how the program is built that causes this? The program is being built and run from a subfolder of C:\Dev This response ...
TITLE: Why is my program asking for permission to run on Vista? QUESTION: I've just built a VS C++ 6.0 program using VS 2008. When I attempt to run or debug the application, Vista asks for permission. What is it about how the program is built that causes this? The program is being built and run from a subfolder of C:\...
[ "visual-studio-2008", "windows-vista" ]
3
3
1,157
4
0
2008-09-18T18:42:37.013000
2008-09-18T18:56:36.590000
95,547
95,573
Should I catch exceptions only to log them?
Should I catch exceptions for logging purposes? public foo(..) { try {... } catch (Exception ex) { Logger.Error(ex); throw; } } If I have this in place in each of my layers (DataAccess, Business and WebService) it means the exception is logged several times. Does it make sense to do so if my layers are in separate proj...
Definitely not. You should find the correct place to handle the exception (actually do something, like catch-and-not-rethrow), and then log it. You can and should include the entire stack trace of course, but following your suggestion would litter the code with try-catch blocks.
Should I catch exceptions only to log them? Should I catch exceptions for logging purposes? public foo(..) { try {... } catch (Exception ex) { Logger.Error(ex); throw; } } If I have this in place in each of my layers (DataAccess, Business and WebService) it means the exception is logged several times. Does it make sens...
TITLE: Should I catch exceptions only to log them? QUESTION: Should I catch exceptions for logging purposes? public foo(..) { try {... } catch (Exception ex) { Logger.Error(ex); throw; } } If I have this in place in each of my layers (DataAccess, Business and WebService) it means the exception is logged several times....
[ "c#", "logging", "exception" ]
31
39
16,346
16
0
2008-09-18T18:44:30.830000
2008-09-18T18:47:10.043000
95,554
95,968
Overriding a MIME type in Rails
I want to override the JSON MIME type ("application/json") in Rails to ("text/x-json"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions? Thanks.
This should work (in an initializer, plugin, or some similar place): Mime.send(:remove_const,:JSON) Mime::Type.register "text/x-json",:json
Overriding a MIME type in Rails I want to override the JSON MIME type ("application/json") in Rails to ("text/x-json"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions? Thanks.
TITLE: Overriding a MIME type in Rails QUESTION: I want to override the JSON MIME type ("application/json") in Rails to ("text/x-json"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions? Thanks. ANSWER: This should work (in an initializer, plugin, or some similar place): ...
[ "ruby-on-rails", "ruby", "json", "mime", "mime-types" ]
4
11
5,943
2
0
2008-09-18T18:44:56.320000
2008-09-18T19:22:06.060000
95,567
95,983
Is there any benefit to using Cocoa's version of MVC with .NET?
There's a diagram depicting the difference between traditional MVC and Cocoa MVC here: Cocoa Design Patterns: The Model-View-Controller Design Pattern Are there any benefits of doing it the "Cocoa" way in.NET using Visual Studio?
There's no reason not to do it that way, if it makes more sense to you. Be aware that a lot of things in the Cocoa framework are the way they are due to higher-level design decisions, for example favoring composition and delegation over subclassing. If you want, you can design C# software that looks like Objective-C so...
Is there any benefit to using Cocoa's version of MVC with .NET? There's a diagram depicting the difference between traditional MVC and Cocoa MVC here: Cocoa Design Patterns: The Model-View-Controller Design Pattern Are there any benefits of doing it the "Cocoa" way in.NET using Visual Studio?
TITLE: Is there any benefit to using Cocoa's version of MVC with .NET? QUESTION: There's a diagram depicting the difference between traditional MVC and Cocoa MVC here: Cocoa Design Patterns: The Model-View-Controller Design Pattern Are there any benefits of doing it the "Cocoa" way in.NET using Visual Studio? ANSWER:...
[ ".net", "cocoa", "model-view-controller" ]
2
3
3,211
4
0
2008-09-18T18:46:40.500000
2008-09-18T19:23:46.603000
95,578
100,032
How to determine the Schemas inside an Oracle Data Pump Export file
I have an Oracle database backup file (.dmp) that was created with expdp. The.dmp file was an export of an entire database. I need to restore 1 of the schemas from within this dump file. I don't know the names of the schemas inside this dump file. To use impdp to import the data I need the name of the schema to load. S...
If you open the DMP file with an editor that can handle big files, you might be able to locate the areas where the schema names are mentioned. Just be sure not to change anything. It would be better if you opened a copy of the original dump.
How to determine the Schemas inside an Oracle Data Pump Export file I have an Oracle database backup file (.dmp) that was created with expdp. The.dmp file was an export of an entire database. I need to restore 1 of the schemas from within this dump file. I don't know the names of the schemas inside this dump file. To u...
TITLE: How to determine the Schemas inside an Oracle Data Pump Export file QUESTION: I have an Oracle database backup file (.dmp) that was created with expdp. The.dmp file was an export of an entire database. I need to restore 1 of the schemas from within this dump file. I don't know the names of the schemas inside th...
[ "oracle", "import", "oracle-dump" ]
42
13
137,109
9
0
2008-09-18T18:47:31.400000
2008-09-19T06:25:02.473000
95,600
96,245
JQuery error option in $.ajax utility
The documentation indicates that the error: option function will make available: XHR instance, a status message string (in this case always error) and an optional exception object returned from the XHR instance (Book: JQuery in Action) Using the following (in the $.ajax call) I was able to determine I had a "parsererro...
Looking at the jQuery source code, there are four returned statuses, in additon to success: timeout - when your specified timeout is exceeded error - http error, like 404 notmodified - when requested resource was not modified since last request parsererror - when an xml/json response is bad
JQuery error option in $.ajax utility The documentation indicates that the error: option function will make available: XHR instance, a status message string (in this case always error) and an optional exception object returned from the XHR instance (Book: JQuery in Action) Using the following (in the $.ajax call) I was...
TITLE: JQuery error option in $.ajax utility QUESTION: The documentation indicates that the error: option function will make available: XHR instance, a status message string (in this case always error) and an optional exception object returned from the XHR instance (Book: JQuery in Action) Using the following (in the ...
[ "jquery", "ajax" ]
34
22
75,844
5
0
2008-09-18T18:49:15.593000
2008-09-18T19:53:23.567000
95,606
95,678
XNA load in a texture or mesh from a file without using the content pipeline
In XNA, how do I load in a texture or mesh from a file without using the content pipeline?
I believe Texture2D.FromFile(); is what you are looking for. It does not look like you can do this with a Model though. http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.texture2d.fromfile.aspx
XNA load in a texture or mesh from a file without using the content pipeline In XNA, how do I load in a texture or mesh from a file without using the content pipeline?
TITLE: XNA load in a texture or mesh from a file without using the content pipeline QUESTION: In XNA, how do I load in a texture or mesh from a file without using the content pipeline? ANSWER: I believe Texture2D.FromFile(); is what you are looking for. It does not look like you can do this with a Model though. http:...
[ "xna" ]
2
1
5,012
5
0
2008-09-18T18:49:37.560000
2008-09-18T18:55:51.803000
95,631
98,931
Open a file with su/sudo inside Emacs
Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is C-x C-f /sudo::/path/to/file but this requires an expensive round-trip through SSH. Is there a more direct way? [EDIT] @JBB is right. I want to be able to...
The nice thing about Tramp is that you only pay for that round-trip to SSH when you open the first file. Sudo then caches your credentials, and Emacs saves a handle, so that subsequent sudo-opened files take much less time. I haven't found the extra time it takes to save burdening, either. It's fast enough, IMO.
Open a file with su/sudo inside Emacs Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is C-x C-f /sudo::/path/to/file but this requires an expensive round-trip through SSH. Is there a more direct way? [EDI...
TITLE: Open a file with su/sudo inside Emacs QUESTION: Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is C-x C-f /sudo::/path/to/file but this requires an expensive round-trip through SSH. Is there a mor...
[ "emacs", "file-permissions", "sudo" ]
190
70
67,027
10
0
2008-09-18T18:51:47.320000
2008-09-19T02:17:30.400000
95,635
95,679
What does a just-in-time (JIT) compiler do?
What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?
A JIT compiler runs after the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-in-time, as it's called) into a form that's usually faster, typically the host CPU's native instruction set. A JIT has access to dynamic runtime information whereas a standard c...
What does a just-in-time (JIT) compiler do? What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?
TITLE: What does a just-in-time (JIT) compiler do? QUESTION: What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description? ANSWER: A JIT compiler runs after the program has started and compiles the code (usually bytecode or some kind of VM i...
[ "compilation", "compiler-construction", "jit" ]
641
622
297,156
18
0
2008-09-18T18:52:08.630000
2008-09-18T18:55:52.207000
95,642
95,676
Does an application-wide exception handler make sense?
Long story short, I have a substantial Python application that, among other things, does outcalls to "losetup", "mount", etc. on Linux. Essentially consuming system resources that must be released when complete. If my application crashes, I want to ensure these system resources are properly released. Does it make sense...
I like top-level exception handlers in general (regardless of language). They're a great place to cleanup resources that may not be immediately related to resources consumed inside the method that throws the exception. It's also a fantastic place to log those exceptions if you have such a framework in place. Top-level ...
Does an application-wide exception handler make sense? Long story short, I have a substantial Python application that, among other things, does outcalls to "losetup", "mount", etc. on Linux. Essentially consuming system resources that must be released when complete. If my application crashes, I want to ensure these sys...
TITLE: Does an application-wide exception handler make sense? QUESTION: Long story short, I have a substantial Python application that, among other things, does outcalls to "losetup", "mount", etc. on Linux. Essentially consuming system resources that must be released when complete. If my application crashes, I want t...
[ "python", "exception" ]
12
11
1,042
6
0
2008-09-18T18:52:30.920000
2008-09-18T18:55:38.120000
95,649
95,729
When should I consider changing thread priority
I once was asked to increase thread priority to fix a problem. I refused, saying that changing it was dangerous and was not the root cause of the problem. My question is, under what circumstannces should I conider changing priority of threads?
When you've made a list of the threads you're using and defined a priority order for them which makes sense in terms of the work they do. If you nudge threads up here and there in order to bodge your way out of a problem, eventually they'll all be high priority and you're back where you started. Don't assume you can fi...
When should I consider changing thread priority I once was asked to increase thread priority to fix a problem. I refused, saying that changing it was dangerous and was not the root cause of the problem. My question is, under what circumstannces should I conider changing priority of threads?
TITLE: When should I consider changing thread priority QUESTION: I once was asked to increase thread priority to fix a problem. I refused, saying that changing it was dangerous and was not the root cause of the problem. My question is, under what circumstannces should I conider changing priority of threads? ANSWER: W...
[ "multithreading", "language-agnostic" ]
7
6
4,642
5
0
2008-09-18T18:53:05.820000
2008-09-18T19:00:18.500000
95,651
97,027
How to use oAuth tokens
I'm using a library to get an 'oAuth_token' and 'oAuth_token_secret'. If I make a request to a REST web service how are those two keys leveraged to verify authentication?
Providing a C# example is a little difficult because there are a number of variables i.e. the signature method being used, additional parameters the service might be expecting etc. which would affect the complexity of the example. I've developed an open source OAuth library for.Net and posted an article on beginning to...
How to use oAuth tokens I'm using a library to get an 'oAuth_token' and 'oAuth_token_secret'. If I make a request to a REST web service how are those two keys leveraged to verify authentication?
TITLE: How to use oAuth tokens QUESTION: I'm using a library to get an 'oAuth_token' and 'oAuth_token_secret'. If I make a request to a REST web service how are those two keys leveraged to verify authentication? ANSWER: Providing a C# example is a little difficult because there are a number of variables i.e. the sign...
[ "c#", "rest", "oauth" ]
4
7
5,610
1
0
2008-09-18T18:53:25.990000
2008-09-18T21:12:00.993000
95,655
95,833
comparison of ways to maintain state
There are various ways to maintain user state using in web development. These are the ones that I can think of right now: Query String Cookies Form Methods (Get and Post) Viewstate (ASP.NET only I guess) Session (InProc Web server) Session (Dedicated web server) Session (Database) Local Persistence (Google Gears) (than...
While this is a very complicated question to answer, I have a few quick-bite things I think about when considering implementing state. Query string state is only useful for the most basic tasks -- e.g., maintaining the position of a user within a wizard, perhaps, or providing a path to redirect the user to after they c...
comparison of ways to maintain state There are various ways to maintain user state using in web development. These are the ones that I can think of right now: Query String Cookies Form Methods (Get and Post) Viewstate (ASP.NET only I guess) Session (InProc Web server) Session (Dedicated web server) Session (Database) L...
TITLE: comparison of ways to maintain state QUESTION: There are various ways to maintain user state using in web development. These are the ones that I can think of right now: Query String Cookies Form Methods (Get and Post) Viewstate (ASP.NET only I guess) Session (InProc Web server) Session (Dedicated web server) Se...
[ "state" ]
11
12
13,072
8
0
2008-09-18T18:54:00.090000
2008-09-18T19:09:31.583000
95,700
509,999
VB.Net (or C#) 2008 Multi Threaded Import
I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where I can look at and play with the source of a VERY simple mult...
The referenced DevX article is from 2001 and.Net Framework 1.1, but today.Net Framework 2.0 provides the BackgroundWorker class. This is the recommended threading class if your application includes a foreground UI component. From MSDN Threads and Threading: If you need to run background threads that interact with the u...
VB.Net (or C#) 2008 Multi Threaded Import I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where I can look at and ...
TITLE: VB.Net (or C#) 2008 Multi Threaded Import QUESTION: I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where ...
[ "sql-server", "vb.net", "visual-studio", "multithreading", "import" ]
3
2
2,594
3
0
2008-09-18T18:57:10.113000
2009-02-04T03:53:10.937000
95,724
99,966
What is the easiest way to convert from asp classic to asp.net?
I am a.Net developer that has been tasked with upgrading a classic asp website to asp.net. The website is currently running on luck and bubble gum but there is not enough time or money to stop progress and do a full rewrite. Of course I will still need to be able to deliver new features while I am upgrading. What strat...
Having been a longtime classic asp programmer, and now an ASP.NET dev, I would take the time and architect it properly in the 2.0 framework (3.5 if you want/need the features). My last job we had a large handful of very badly build classic asp apps that we were rebuilding, and the "nuke and pave" approach was the most ...
What is the easiest way to convert from asp classic to asp.net? I am a.Net developer that has been tasked with upgrading a classic asp website to asp.net. The website is currently running on luck and bubble gum but there is not enough time or money to stop progress and do a full rewrite. Of course I will still need to ...
TITLE: What is the easiest way to convert from asp classic to asp.net? QUESTION: I am a.Net developer that has been tasked with upgrading a classic asp website to asp.net. The website is currently running on luck and bubble gum but there is not enough time or money to stop progress and do a full rewrite. Of course I w...
[ "asp.net", "asp-classic" ]
14
11
13,721
9
0
2008-09-18T18:59:45.380000
2008-09-19T05:53:52.377000
95,727
96,035
How to convert floats to human-readable fractions?
Let's say we have 0.33, we need to output 1/3. If we have 0.4, we need to output 2/5. The idea is to make it human-readable to make the user understand " x parts out of y " as a better way of understanding data. I know that percentages is a good substitute but I was wondering if there was a simple way to do this?
I have found David Eppstein's find rational approximation to given real number C code to be exactly what you are asking for. Its based on the theory of continued fractions and very fast and fairly compact. I have used versions of this customized for specific numerator and denominator limits. /* ** find rational approxi...
How to convert floats to human-readable fractions? Let's say we have 0.33, we need to output 1/3. If we have 0.4, we need to output 2/5. The idea is to make it human-readable to make the user understand " x parts out of y " as a better way of understanding data. I know that percentages is a good substitute but I was wo...
TITLE: How to convert floats to human-readable fractions? QUESTION: Let's say we have 0.33, we need to output 1/3. If we have 0.4, we need to output 2/5. The idea is to make it human-readable to make the user understand " x parts out of y " as a better way of understanding data. I know that percentages is a good subst...
[ "algorithm", "language-agnostic", "numbers" ]
115
75
64,614
26
0
2008-09-18T19:00:09.140000
2008-09-18T19:28:07.560000
95,731
561,099
Why does an onclick property set with setAttribute fail to work in IE?
Ran into this problem today, posting in case someone else has the same issue. var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBtn"); execBtn.setAttribute("value", "Execute"); execBtn.setAttribute("onclick", "runCommand();"); Turns out to get IE to r...
to make this work in both FF and IE you must write both ways: button_element.setAttribute('onclick','doSomething();'); // for FF button_element.onclick = function() {doSomething();}; // for IE thanks to this post. UPDATE: This is to demonstrate that sometimes it is necessary to use setAttribute! This method works if yo...
Why does an onclick property set with setAttribute fail to work in IE? Ran into this problem today, posting in case someone else has the same issue. var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBtn"); execBtn.setAttribute("value", "Execute"); exe...
TITLE: Why does an onclick property set with setAttribute fail to work in IE? QUESTION: Ran into this problem today, posting in case someone else has the same issue. var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBtn"); execBtn.setAttribute("value...
[ "javascript", "internet-explorer" ]
54
55
199,971
13
0
2008-09-18T19:00:31.900000
2009-02-18T13:48:31.093000
95,760
97,072
How can I generate a list of function dependencies in MATLAB?
In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of dependencies is for a given m-file. Is there a built-in/freely downloadable way to do t...
For newer releases of Matlab (eg 2007 or 2008) you could use the built in functions: mlint dependency report and coverage report Another option is to use Matlab's profiler. The command is profile, it can also be used to track dependencies. To use profile, you could do >> profile on % turn profiling on >> foo; % entry p...
How can I generate a list of function dependencies in MATLAB? In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of dependencies is for a giv...
TITLE: How can I generate a list of function dependencies in MATLAB? QUESTION: In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of depende...
[ "function", "matlab", "dependencies", "code-analysis" ]
36
36
19,178
2
0
2008-09-18T19:03:18.790000
2008-09-18T21:16:33.727000
95,767
97,176
How can I catch AWT thread exceptions in Java?
We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console.
There is a distinction between uncaught exceptions in the EDT and outside the EDT. Another question has a solution for both but if you want just the EDT portion chewed up... class AWTExceptionHandler { public void handle(Throwable t) { try { // insert your exception handling code here // or do nothing to make it go aw...
How can I catch AWT thread exceptions in Java? We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console.
TITLE: How can I catch AWT thread exceptions in Java? QUESTION: We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console. ANSWER: There is a distinction between uncaught exceptions in the EDT and outside the EDT. Another question has a solution for both but if y...
[ "java", "swing", "exception", "awt" ]
18
10
6,981
4
0
2008-09-18T19:04:00.037000
2008-09-18T21:27:40.877000
95,820
95,826
In Perl, how do I create a hash whose keys come from a given array?
Let's say I have an array, and I know I'm going to be doing a lot of "Does the array contain X?" checks. The efficient way to do this is to turn that array into a hash, where the keys are the array's elements, and then you can just say if($hash{X}) {... } Is there an easy way to do this array-to-hash conversion? Ideall...
%hash = map { $_ => 1 } @array; It's not as short as the "@hash{@array} =..." solutions, but those ones require the hash and array to already be defined somewhere else, whereas this one can take an anonymous array and return an anonymous hash. What this does is take each element in the array and pair it up with a "1". ...
In Perl, how do I create a hash whose keys come from a given array? Let's say I have an array, and I know I'm going to be doing a lot of "Does the array contain X?" checks. The efficient way to do this is to turn that array into a hash, where the keys are the array's elements, and then you can just say if($hash{X}) {.....
TITLE: In Perl, how do I create a hash whose keys come from a given array? QUESTION: Let's say I have an array, and I know I'm going to be doing a lot of "Does the array contain X?" checks. The efficient way to do this is to turn that array into a hash, where the keys are the array's elements, and then you can just sa...
[ "arrays", "perl", "hash" ]
85
129
130,136
14
0
2008-09-18T19:08:09.840000
2008-09-18T19:08:38.153000
95,824
101,403
Replace a character with a string in LaTeX
I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this: \replace{File,New} and that would generate something like \textbf{File}$\rightarrow$\textbf{New} This is a simple example, but I'd like to be able to put formatting/structure in a sing...
The general case is rather more tricky (when you're not using commas as separators), but the example you gave can be coded without too much trouble with some knowledge of the LaTeX internals. \documentclass[12pt]{article} \makeatletter \newcommand\formatnice[1]{% \let\@formatsep\@formatsepinit \@for\@ii:=#1\do{% \@form...
Replace a character with a string in LaTeX I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this: \replace{File,New} and that would generate something like \textbf{File}$\rightarrow$\textbf{New} This is a simple example, but I'd like to be...
TITLE: Replace a character with a string in LaTeX QUESTION: I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this: \replace{File,New} and that would generate something like \textbf{File}$\rightarrow$\textbf{New} This is a simple example, ...
[ "latex" ]
10
7
23,140
5
0
2008-09-18T19:08:31.897000
2008-09-19T12:22:30.623000
95,834
96,672
What is the most efficient way to handle the lifecycle of an object with COM interop?
I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM. I'm currently implementing IDisposable in my COM helper and using Marshal.ReleaseComObject(). However, if my Workflow fails, the Dispose() method isn't being called and the Word...
I can not see what failure you have that does not calls the Dispose() method. I made a test with a sequential workflow that contains only a code activity which just throws an exception and the Dispose() method of my workflow is called twice (this is because of the standard WorkflowTerminated event handler). Check the f...
What is the most efficient way to handle the lifecycle of an object with COM interop? I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM. I'm currently implementing IDisposable in my COM helper and using Marshal.ReleaseComObject(...
TITLE: What is the most efficient way to handle the lifecycle of an object with COM interop? QUESTION: I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM. I'm currently implementing IDisposable in my COM helper and using Marshal...
[ "com", "interop", "workflow-foundation", "marshalling", ".net-3.0" ]
0
1
412
2
0
2008-09-18T19:09:34.373000
2008-09-18T20:38:29.263000
95,850
96,240
How to find Commit Charge programmatically?
I'm looking for the total commit charge.
public static long GetCommitCharge() { var p = new System.Diagnostics.PerformanceCounter("Memory", "Committed Bytes"); return p.RawValue; }
How to find Commit Charge programmatically? I'm looking for the total commit charge.
TITLE: How to find Commit Charge programmatically? QUESTION: I'm looking for the total commit charge. ANSWER: public static long GetCommitCharge() { var p = new System.Diagnostics.PerformanceCounter("Memory", "Committed Bytes"); return p.RawValue; }
[ "c#" ]
1
4
1,729
2
0
2008-09-18T19:11:03.497000
2008-09-18T19:52:43.647000
95,862
95,889
Is there any place a developer can go besides Google to learn what it is they need to learn?
I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA before, during or after Hibernate? Is there a better solution to Hibernate? (And I'm not really looking for informat...
Sometimes the best way to learn is to just dig in to a framework. Sure, you could use someones wrapper API around something, but if there is something wrong w/ hibernate, then you wouldn't know what's happening. And to answer "how do i know what i should know prior to hibernate", you don't, that's why you are learning....
Is there any place a developer can go besides Google to learn what it is they need to learn? I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA before, during or after...
TITLE: Is there any place a developer can go besides Google to learn what it is they need to learn? QUESTION: I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA befor...
[ "language-agnostic" ]
2
4
740
13
0
2008-09-18T19:12:34.820000
2008-09-18T19:15:02.537000
95,875
95,935
How to check if a variable is loaded in JavaScript?
How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following? if (!isObjectLoaded(someVar)) { someVar= loadObject(); }
If it is an object then you should just be able to check to see if it is null or undefined and then load it if it is. if (myObject === null || myObject === undefined) { myObject = loadObject(); } Using the typeof function is also an option as it returns the type of the object provided. However, it will return null or u...
How to check if a variable is loaded in JavaScript? How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following? if (!isObjectLoaded(someVar)) { someVar= loadObject(); }
TITLE: How to check if a variable is loaded in JavaScript? QUESTION: How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following? if (!isObjectLoaded(someVar)) { someVar= loadObject(); } ANSWER: If it is an object then you should just be able to check to see if it is null or...
[ "javascript", "object" ]
25
37
67,650
10
0
2008-09-18T19:13:41.603000
2008-09-18T19:18:07.710000
95,886
95,940
What is the best way to present data from a very large resultset?
I'm writing a report view of an audit trail, and I need to display this in a.jsp. What's the "best" way to get the data from the database to the screen? We're using Spring for dependency injection, Data Access Objects, and Hibernate. I can use hibernate or straight jdbc for this report. If I load all the records into m...
It seems like this is a natural place to use pagination of your Hibernate results -- run the query at the Servlet level, and paginate results in a way similar to how this person describes: http://blog.hibernate.org/Bloggers/Everyone/Year/2004/Month/08/Day/14#pagination This is the easiest method of implementing Hiberna...
What is the best way to present data from a very large resultset? I'm writing a report view of an audit trail, and I need to display this in a.jsp. What's the "best" way to get the data from the database to the screen? We're using Spring for dependency injection, Data Access Objects, and Hibernate. I can use hibernate ...
TITLE: What is the best way to present data from a very large resultset? QUESTION: I'm writing a report view of an audit trail, and I need to display this in a.jsp. What's the "best" way to get the data from the database to the screen? We're using Spring for dependency injection, Data Access Objects, and Hibernate. I ...
[ "java", "hibernate", "web-applications", "jdbc" ]
2
6
1,875
4
0
2008-09-18T19:14:44.597000
2008-09-18T19:18:34.853000
95,890
95,927
What is a variable's linkage and storage specifier?
When someone talks about a variables storage class specifier, what are they talking about? They also often talk about variable linkage in the same context, what is that?
The storage class specifier controls the storage and the linkage of your variables. These are two concepts that are different. C specifies the following specifiers for variables: auto, extern, register, static. Storage The storage duration determines how long your variable will live in ram. There are three types of sto...
What is a variable's linkage and storage specifier? When someone talks about a variables storage class specifier, what are they talking about? They also often talk about variable linkage in the same context, what is that?
TITLE: What is a variable's linkage and storage specifier? QUESTION: When someone talks about a variables storage class specifier, what are they talking about? They also often talk about variable linkage in the same context, what is that? ANSWER: The storage class specifier controls the storage and the linkage of you...
[ "c++", "c" ]
11
33
5,354
2
0
2008-09-18T19:15:06.453000
2008-09-18T19:17:34.607000
95,895
95,928
How to check if one DateTime is greater than the other in C#
I have two DateTime objects: StartDate and EndDate. I want to make sure StartDate is before EndDate. How is this done in C#?
if (StartDate < EndDate) // code if you just want the dates, and not the time if (StartDate.Date < EndDate.Date) // code
How to check if one DateTime is greater than the other in C# I have two DateTime objects: StartDate and EndDate. I want to make sure StartDate is before EndDate. How is this done in C#?
TITLE: How to check if one DateTime is greater than the other in C# QUESTION: I have two DateTime objects: StartDate and EndDate. I want to make sure StartDate is before EndDate. How is this done in C#? ANSWER: if (StartDate < EndDate) // code if you just want the dates, and not the time if (StartDate.Date < EndDate....
[ "c#" ]
142
259
235,164
10
0
2008-09-18T19:15:32.333000
2008-09-18T19:17:37.583000
95,909
96,050
Client View of Everyone Looking at a Webpage
First let me say that I really feel directionless on this question. I am using windows integrated security, and I can use vb.net to look up information about a user from AD. I also have other information about users I can look up from a MS SQL 2005 server by getting the logon identity name. What I would like to do is d...
The answer probably depends on how accurate you need the display to be. If it's just to give users a sense of the other people using the site I'd suggest something similar to what you've described, but backing off on the update frequency: on a page request associate the user with the page (and a timestamp) use an Ajax ...
Client View of Everyone Looking at a Webpage First let me say that I really feel directionless on this question. I am using windows integrated security, and I can use vb.net to look up information about a user from AD. I also have other information about users I can look up from a MS SQL 2005 server by getting the logo...
TITLE: Client View of Everyone Looking at a Webpage QUESTION: First let me say that I really feel directionless on this question. I am using windows integrated security, and I can use vb.net to look up information about a user from AD. I also have other information about users I can look up from a MS SQL 2005 server b...
[ ".net", "asp.net", "sql-server", "vb.net", "ajax" ]
1
2
214
6
0
2008-09-18T19:16:30.723000
2008-09-18T19:29:13.923000
95,910
95,973
Find a private field with Reflection?
Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this with properties where I have looked for an attribute, bu...
Use BindingFlags.NonPublic and BindingFlags.Instance flags FieldInfo[] fields = myType.GetFields( BindingFlags.NonPublic | BindingFlags.Instance);
Find a private field with Reflection? Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this with properties wh...
TITLE: Find a private field with Reflection? QUESTION: Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this ...
[ "c#", ".net", "reflection", ".net-attributes" ]
278
352
225,506
11
0
2008-09-18T19:16:32.300000
2008-09-18T19:22:27.183000
95,912
95,918
How can I detect if my process is running UAC-elevated or not?
My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time?
The following C++ function can do that: HRESULT GetElevationType( __out TOKEN_ELEVATION_TYPE * ptet ); /* Parameters: ptet [out] Pointer to a variable that receives the elevation type of the current process. The possible values are: TokenElevationTypeDefault - This value indicates that either UAC is disabled, or th...
How can I detect if my process is running UAC-elevated or not? My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time?
TITLE: How can I detect if my process is running UAC-elevated or not? QUESTION: My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time? ANSWER: The following C++ function can do that: HRESULT GetElevatio...
[ "windows-7", "windows-vista", "uac", "elevation" ]
42
20
11,859
4
0
2008-09-18T19:16:53.733000
2008-09-18T19:17:11.283000
95,954
96,045
Are delegates not just shorthand interfaces?
Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo { bool Func(int x) { return (x>0); } } class Baz: Foo { bool Func(int x) { return (x<0); } } Now we can toss around Bar and Baz as a Foos and call their Func methods. Delegates simplify this a little bit: delegate bool Foo(int x); bool Bar(int x) { ...
There is a slight difference, delegates can access the member variables of classes in which, they are defined. In C# (unlike Java) all inner class are consider to be static. Therefore if you are using an interface to manage a callback, e.g. an ActionListener for a button. The implementing inner class needs to be passed...
Are delegates not just shorthand interfaces? Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo { bool Func(int x) { return (x>0); } } class Baz: Foo { bool Func(int x) { return (x<0); } } Now we can toss around Bar and Baz as a Foos and call their Func methods. Delegates simplify this a little bit: ...
TITLE: Are delegates not just shorthand interfaces? QUESTION: Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo { bool Func(int x) { return (x>0); } } class Baz: Foo { bool Func(int x) { return (x<0); } } Now we can toss around Bar and Baz as a Foos and call their Func methods. Delegates simplify t...
[ "c#", "delegates", "interface" ]
12
15
2,216
10
0
2008-09-18T19:20:24.503000
2008-09-18T19:29:00.100000
95,956
96,034
FindNextFile fails on 64-bit Windows?
using C++Builder 2007, the FindFirstFile and FindNextFile functions doesn't seem to be able to find some files on 64-bit versions of Vista and XP. My test application is 32-bit. If I use them to iterate through the folder C:\Windows\System32\Drivers they only find a handful of files although there are 185 when I issue ...
Is there redirection going on? See the remarks on Wow64DisableWow64FsRedirection http://msdn.microsoft.com/en-gb/library/aa365743.aspx
FindNextFile fails on 64-bit Windows? using C++Builder 2007, the FindFirstFile and FindNextFile functions doesn't seem to be able to find some files on 64-bit versions of Vista and XP. My test application is 32-bit. If I use them to iterate through the folder C:\Windows\System32\Drivers they only find a handful of file...
TITLE: FindNextFile fails on 64-bit Windows? QUESTION: using C++Builder 2007, the FindFirstFile and FindNextFile functions doesn't seem to be able to find some files on 64-bit versions of Vista and XP. My test application is 32-bit. If I use them to iterate through the folder C:\Windows\System32\Drivers they only find...
[ "c++", "64-bit", "c++builder" ]
11
9
9,902
6
0
2008-09-18T19:20:33.083000
2008-09-18T19:28:05.250000
95,967
96,049
How do you list the primary key of a SQL Server table?
Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK.
SELECT Col.Column_Name from INFORMATION_SCHEMA.TABLE_CONSTRAINTS Tab, INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE Col WHERE Col.Constraint_Name = Tab.Constraint_Name AND Col.Table_Name = Tab.Table_Name AND Tab.Constraint_Type = 'PRIMARY KEY' AND Col.Table_Name = ' '
How do you list the primary key of a SQL Server table? Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK.
TITLE: How do you list the primary key of a SQL Server table? QUESTION: Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK. ANSWER: SELECT Col.Column_Name from INFORMATION_SCHEMA.TABLE_CONSTRAINTS Tab, INFORMATION_SCHEMA.C...
[ "sql", "sql-server", "t-sql" ]
142
188
251,081
28
0
2008-09-18T19:22:04.470000
2008-09-18T19:29:07.260000
95,974
95,997
Do access modifiers affect reflection also?
I always believe they did, but seeing some answers here make me doubt... Can I access private fields/properties/methods from outside a class through reflection?
Yes you can access private fields via reflection. This is how a lot of ORMs go about populating an object without going through your properties (which will invoke business logic you might not have intended to be run on an object load). Access modifiers are not a form of security!
Do access modifiers affect reflection also? I always believe they did, but seeing some answers here make me doubt... Can I access private fields/properties/methods from outside a class through reflection?
TITLE: Do access modifiers affect reflection also? QUESTION: I always believe they did, but seeing some answers here make me doubt... Can I access private fields/properties/methods from outside a class through reflection? ANSWER: Yes you can access private fields via reflection. This is how a lot of ORMs go about pop...
[ ".net", "reflection", "access-modifiers" ]
7
6
691
4
0
2008-09-18T19:22:27.777000
2008-09-18T19:24:57.177000
96,003
96,055
Multiple relations to the same model in Rails
Let's say I have two models, Classes and People. A Class might have one or two People as instructors, and twenty people as students. So, I need to have multiple relationships between the models -- one where it's 1->M for instructors, and one where it's 1->M for students. Edit: Instructors and Students must be the same;...
There are many options here, but assuming instructors are always instructors and students are always students, you can use inheritance: class Person < ActiveRecord::Base; end # btw, model names are singular in rails class Student < Person; end class Instructor < Person; end then class Course < ActiveRecord::Base # rena...
Multiple relations to the same model in Rails Let's say I have two models, Classes and People. A Class might have one or two People as instructors, and twenty people as students. So, I need to have multiple relationships between the models -- one where it's 1->M for instructors, and one where it's 1->M for students. Ed...
TITLE: Multiple relations to the same model in Rails QUESTION: Let's say I have two models, Classes and People. A Class might have one or two People as instructors, and twenty people as students. So, I need to have multiple relationships between the models -- one where it's 1->M for instructors, and one where it's 1->...
[ "ruby-on-rails" ]
14
17
6,248
2
0
2008-09-18T19:25:13.103000
2008-09-18T19:29:35.933000
96,027
96,057
What is the easier way to know if a type param implements an interface in c# 2.0?
For example, given a type param method i'm looking for something like the part in bold void MyMethod< T >() { if ( typeof(T).Implements( IMyInterface ) ) { //Do something else //Do something else } Anwers using C# 3.0 are also welcome, but first drop the.NET 2.0 ones please;)
Type.IsAssignableFrom if(typeof(IMyInterface).IsAssignableFrom(typeof(T))) { // something } else { // something else }
What is the easier way to know if a type param implements an interface in c# 2.0? For example, given a type param method i'm looking for something like the part in bold void MyMethod< T >() { if ( typeof(T).Implements( IMyInterface ) ) { //Do something else //Do something else } Anwers using C# 3.0 are also welcome, bu...
TITLE: What is the easier way to know if a type param implements an interface in c# 2.0? QUESTION: For example, given a type param method i'm looking for something like the part in bold void MyMethod< T >() { if ( typeof(T).Implements( IMyInterface ) ) { //Do something else //Do something else } Anwers using C# 3.0 ar...
[ "c#", "reflection", "types" ]
2
6
173
3
0
2008-09-18T19:27:20.620000
2008-09-18T19:30:20.673000
96,029
96,063
Get URL of ASP.Net Page in code-behind
I have an ASP.Net page that will be hosted on a couple different servers, and I want to get the URL of the page (or even better: the site where the page is hosted) as a string for use in the code-behind. Any ideas?
Use this: Request.Url.AbsoluteUri That will get you the full path (including http://...)
Get URL of ASP.Net Page in code-behind I have an ASP.Net page that will be hosted on a couple different servers, and I want to get the URL of the page (or even better: the site where the page is hosted) as a string for use in the code-behind. Any ideas?
TITLE: Get URL of ASP.Net Page in code-behind QUESTION: I have an ASP.Net page that will be hosted on a couple different servers, and I want to get the URL of the page (or even better: the site where the page is hosted) as a string for use in the code-behind. Any ideas? ANSWER: Use this: Request.Url.AbsoluteUri That ...
[ "asp.net" ]
203
237
367,345
10
0
2008-09-18T19:27:25.690000
2008-09-18T19:30:31.033000
96,040
96,262
Flex best practices?
I have the feeling that is easy to find samples, tutorials and simple examples on Flex. It seems harder to find tips and good practices based on real-life projects. Any tips on how to: How to write maintainable actionscript code How to ensure a clean separation of concern. Has anybody used an MVC framework such as cair...
I work often with Flex in my job, and I will be happy to help.. but your questions deserve an article for each one:) I'll try some short answer. Maintenable code: I think that the same rules of any other OO languages apply. Some flex-specific rules I'm use to follow: use strong typed variables, always consider dispatch...
Flex best practices? I have the feeling that is easy to find samples, tutorials and simple examples on Flex. It seems harder to find tips and good practices based on real-life projects. Any tips on how to: How to write maintainable actionscript code How to ensure a clean separation of concern. Has anybody used an MVC f...
TITLE: Flex best practices? QUESTION: I have the feeling that is easy to find samples, tutorials and simple examples on Flex. It seems harder to find tips and good practices based on real-life projects. Any tips on how to: How to write maintainable actionscript code How to ensure a clean separation of concern. Has any...
[ "apache-flex", "actionscript", "blazeds", "puremvc" ]
8
5
1,901
3
0
2008-09-18T19:28:40.290000
2008-09-18T19:55:19.787000
96,042
96,231
What's safecall?
I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi. Reading the example code, I noticed there are some functions whose signatures are followed by the safecall keyword. Here's an example: function AddSymbol(ASymbol: OleVariant): WordBool; safecall; What is the pu...
Safecall passes parameters from right to left, instead of the pascal or register (default) from left to right With safecall, the procedure or function removes parameters from the stack upon returning (like pascal, but not like cdecl where it's up to the caller) Safecall implements exception 'firewalls'; esp on Win32, t...
What's safecall? I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi. Reading the example code, I noticed there are some functions whose signatures are followed by the safecall keyword. Here's an example: function AddSymbol(ASymbol: OleVariant): WordBool; safecal...
TITLE: What's safecall? QUESTION: I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi. Reading the example code, I noticed there are some functions whose signatures are followed by the safecall keyword. Here's an example: function AddSymbol(ASymbol: OleVariant):...
[ "delphi", "calling-convention" ]
16
14
12,127
4
0
2008-09-18T19:28:53.237000
2008-09-18T19:51:03.417000
96,054
96,089
Is is possible to convert C# double[,,] array to double[] without making a copy
I have huge 3D arrays of numbers in my.NET application. I need to convert them to a 1D array to pass it to a COM library. Is there a way to convert the array without making a copy of all the data? I can do the conversion like this, but then I use twice the ammount of memory which is an issue in my application: double[]...
I don't believe the way C# stores that data in memory would make it feasible the same way a simple cast in C would. Why not use a 1d array to begin with and perhaps make a class for the type so you can access it in your program as if it were a 3d array?
Is is possible to convert C# double[,,] array to double[] without making a copy I have huge 3D arrays of numbers in my.NET application. I need to convert them to a 1D array to pass it to a COM library. Is there a way to convert the array without making a copy of all the data? I can do the conversion like this, but then...
TITLE: Is is possible to convert C# double[,,] array to double[] without making a copy QUESTION: I have huge 3D arrays of numbers in my.NET application. I need to convert them to a 1D array to pass it to a COM library. Is there a way to convert the array without making a copy of all the data? I can do the conversion l...
[ "c#", ".net", "arrays" ]
6
8
8,349
5
0
2008-09-18T19:29:30.833000
2008-09-18T19:33:33.083000
96,066
96,235
Automated unit testing with JavaScript
I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently JSUnit works well with JUnit, but it seems to be abandonware and lacks good support for Ajax, debugging, and timeouts. Has anyone had any luck automating (with Ant ) a unit testing library such as YUI test, jQuery's QUnit,...
There are many JavaScript unit test framework out there (JSUnit, scriptaculous,...), but JSUnit is the only one I know that may be used with an automated build. If you are doing 'true' unit test you should not need AJAX support. For example, if you are using an RPC Ajax framework such as DWR, you can easily write a moc...
Automated unit testing with JavaScript I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently JSUnit works well with JUnit, but it seems to be abandonware and lacks good support for Ajax, debugging, and timeouts. Has anyone had any luck automating (with Ant ) a unit testing li...
TITLE: Automated unit testing with JavaScript QUESTION: I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently JSUnit works well with JUnit, but it seems to be abandonware and lacks good support for Ajax, debugging, and timeouts. Has anyone had any luck automating (with Ant )...
[ "javascript", "jquery", "unit-testing", "ant", "automation" ]
62
21
25,812
14
0
2008-09-18T19:30:36.790000
2008-09-18T19:51:49.983000
96,086
98,475
Developing UI in JavaScript using TDD Principles
I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this? Is it best to separate the visual from the functional? Do you develop the visual elements first, and then write tests and then code for functionality?
I've done some TDD with Javascript in the past, and what I had to do was make the distinction between Unit and Integration tests. Selenium will test your overall site, with the output from the server, its post backs, ajax calls, all of that. But for unit testing, none of that is important. What you want is just the UI ...
Developing UI in JavaScript using TDD Principles I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this? Is it best to separate the visual from the functional? Do you develop the visual elements first, and t...
TITLE: Developing UI in JavaScript using TDD Principles QUESTION: I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this? Is it best to separate the visual from the functional? Do you develop the visual ele...
[ "javascript", "user-interface", "tdd" ]
44
21
11,263
7
0
2008-09-18T19:33:09.950000
2008-09-19T00:54:02.970000
96,113
96,163
Unix commands like ping, ssh, work fine but socket-based programs are failing in connect
I got a call from a tester about a machine that was failing our software. When I examined the problem machine, I quickly realized the problem was fairly low level: Inbound network traffic works fine. Basic outbound command like ping and ssh are working fine, but anything involving the connect() call is failing with "No...
I would check firewall configuration on that machine. It is possible for iptables (I guess your SUSE has iptables firewall) to be setup to let trough only ping ICMP packets.
Unix commands like ping, ssh, work fine but socket-based programs are failing in connect I got a call from a tester about a machine that was failing our software. When I examined the problem machine, I quickly realized the problem was fairly low level: Inbound network traffic works fine. Basic outbound command like pin...
TITLE: Unix commands like ping, ssh, work fine but socket-based programs are failing in connect QUESTION: I got a call from a tester about a machine that was failing our software. When I examined the problem machine, I quickly realized the problem was fairly low level: Inbound network traffic works fine. Basic outboun...
[ "linux", "sockets", "suse" ]
1
2
1,313
4
0
2008-09-18T19:36:43.123000
2008-09-18T19:43:09.503000
96,123
96,228
open IE without toolbar or address bar from Windows VB Application
Shell ("explorer.exe www.google.com") is how I'm currently opening my products ad page after successful install. However I think it would look much nicer if I could do it more like Avira does, or even a popup where there are no address bar links etc. Doing this via an inbrowser link is easy enough Link text But how wou...
If you want it to look professional, you need to use an actual browser component. VB.NET comes with one. If you are using an older version of VB, you'd need to go third party. If you want to stay with a shell open, you would have to individually target the browser command-line and pass arguments to indicate that it sho...
open IE without toolbar or address bar from Windows VB Application Shell ("explorer.exe www.google.com") is how I'm currently opening my products ad page after successful install. However I think it would look much nicer if I could do it more like Avira does, or even a popup where there are no address bar links etc. Do...
TITLE: open IE without toolbar or address bar from Windows VB Application QUESTION: Shell ("explorer.exe www.google.com") is how I'm currently opening my products ad page after successful install. However I think it would look much nicer if I could do it more like Avira does, or even a popup where there are no address...
[ "vb.net", "browser", "popup" ]
0
1
4,597
2
0
2008-09-18T19:38:10.127000
2008-09-18T19:50:08.753000
96,133
1,439,358
REDUX: How to overcome an incompatibility between the ksh on Linux vs. that installed on AIX/Solaris/HPUX?
I have uncovered another problem in the effort that we are making to port several hundreds of ksh scripts from AIX, Solaris and HPUX to Linux. See here for the previous problem. This code: #!/bin/ksh if [ -a k* ]; then echo "Oh yeah!" else echo "No way!" fi exit 0 (when run in a directory with several files whose name ...
Well after one year there seems to be no solution to my problem. I am adding this answer to say that I will have to live with it......
REDUX: How to overcome an incompatibility between the ksh on Linux vs. that installed on AIX/Solaris/HPUX? I have uncovered another problem in the effort that we are making to port several hundreds of ksh scripts from AIX, Solaris and HPUX to Linux. See here for the previous problem. This code: #!/bin/ksh if [ -a k* ];...
TITLE: REDUX: How to overcome an incompatibility between the ksh on Linux vs. that installed on AIX/Solaris/HPUX? QUESTION: I have uncovered another problem in the effort that we are making to port several hundreds of ksh scripts from AIX, Solaris and HPUX to Linux. See here for the previous problem. This code: #!/bin...
[ "linux", "solaris", "ksh", "aix", "hp-ux" ]
2
0
858
4
0
2008-09-18T19:39:45.533000
2009-09-17T14:49:42.577000
96,153
140,581
How to click a button on an ASP.NET web page programmatically?
I am trying to figure out how to click a button on a web page programmatically. Specifically, I have a WinForm with a WebBrowser control. Once it navigates to the target ASP.NET login page I'm trying to work with, in the DocumentCompleted event handler I have the following coded: HtmlDocument doc = webBrowser1.Document...
How does this work? Works for me HtmlDocument doc = webBrowser1.Document; doc.All["userIDTextBox"].SetAttribute("Value", "user1"); doc.All["userPasswordTextBox"].SetAttribute("Value", "Password!"); doc.All["logonButton"].InvokeMember("Click");
How to click a button on an ASP.NET web page programmatically? I am trying to figure out how to click a button on a web page programmatically. Specifically, I have a WinForm with a WebBrowser control. Once it navigates to the target ASP.NET login page I'm trying to work with, in the DocumentCompleted event handler I ha...
TITLE: How to click a button on an ASP.NET web page programmatically? QUESTION: I am trying to figure out how to click a button on a web page programmatically. Specifically, I have a WinForm with a WebBrowser control. Once it navigates to the target ASP.NET login page I'm trying to work with, in the DocumentCompleted ...
[ "asp.net" ]
7
8
29,395
9
0
2008-09-18T19:42:14.513000
2008-09-26T16:35:36.187000
96,156
1,203,757
chapters in videos for the iPhone
Is it possible to use chapters in videos for the iPhone in an application? For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s. Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the chapter 2 from 50s to 95s? My questio...
iPhone SDK 3.0+ has a new MPMoviePlayerController.initialPlaybackTime property for setting the time to start movie playback. This will be "rounded" to the nearest earlier keyframe time, so does not provide exact start positioning, but pretty close.
chapters in videos for the iPhone Is it possible to use chapters in videos for the iPhone in an application? For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s. Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the cha...
TITLE: chapters in videos for the iPhone QUESTION: Is it possible to use chapters in videos for the iPhone in an application? For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s. Can I start plating the video at 50s (chapter 2) until the end? Can I make it...
[ "iphone", "video" ]
3
4
2,746
3
0
2008-09-18T19:42:31.487000
2009-07-30T00:07:29.383000
96,164
282,698
Partial site SSL using asp.net login control
I'm attempting to convert a home-grown login system to the standard asp.net login control included in.net. I want all communication on the website for a user not logged in to be in clear text, but lock everything in SSL once the user logs in - including the transmission of the username and password. I had this working ...
You're not going to be able to do what you're talking about simply, because the postback (which is what the login control uses) is going to be whatever the page's security is (SSL or non-SSL). Your best bet in this scenario is to use an IFRAME which contains an HTTPS (SSL) page that just contains thelogin control. You ...
Partial site SSL using asp.net login control I'm attempting to convert a home-grown login system to the standard asp.net login control included in.net. I want all communication on the website for a user not logged in to be in clear text, but lock everything in SSL once the user logs in - including the transmission of t...
TITLE: Partial site SSL using asp.net login control QUESTION: I'm attempting to convert a home-grown login system to the standard asp.net login control included in.net. I want all communication on the website for a user not logged in to be in clear text, but lock everything in SSL once the user logs in - including the...
[ "asp.net", "ssl", "authentication" ]
5
2
3,422
3
0
2008-09-18T19:43:53.683000
2008-11-12T01:17:16.460000
96,196
96,268
When are C++ macros beneficial?
The C preprocessor is justifiably feared and shunned by the C++ community. In-lined functions, consts and templates are usually a safer and superior alternative to a #define. The following macro: #define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) is in no way superior to the type safe: inline bool succeeded(int hr) { return hr...
As wrappers for debug functions, to automatically pass things like __FILE__, __LINE__, etc: #ifdef ( DEBUG ) #define M_DebugLog( msg ) std::cout << __FILE__ << ":" << __LINE__ << ": " << msg #else #define M_DebugLog( msg ) #endif Since C++20 the magic type std::source_location can however be used instead of __LINE__ an...
When are C++ macros beneficial? The C preprocessor is justifiably feared and shunned by the C++ community. In-lined functions, consts and templates are usually a safer and superior alternative to a #define. The following macro: #define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) is in no way superior to the type safe: inline bo...
TITLE: When are C++ macros beneficial? QUESTION: The C preprocessor is justifiably feared and shunned by the C++ community. In-lined functions, consts and templates are usually a safer and superior alternative to a #define. The following macro: #define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) is in no way superior to the ty...
[ "c++", "c-preprocessor" ]
183
130
103,564
38
0
2008-09-18T19:46:04.567000
2008-09-18T19:56:26.227000
96,211
96,513
How to determine size in bytes of a result set from LINQ to SQL
When writing manual SQL its pretty easy to estimate the size and shape of data returned by a query. I'm increasingly finding it hard to do this with LINQ to SQL queries. Sometimes I find WAY more data than I was expecting - which can really slow down a remote client that is accessing a database directly. I'd like to be...
Looks like you can grab the SqlConnection of your DataContext and turn on statistics. One of the statistics is "bytes returned". MSDN Reference Link
How to determine size in bytes of a result set from LINQ to SQL When writing manual SQL its pretty easy to estimate the size and shape of data returned by a query. I'm increasingly finding it hard to do this with LINQ to SQL queries. Sometimes I find WAY more data than I was expecting - which can really slow down a rem...
TITLE: How to determine size in bytes of a result set from LINQ to SQL QUESTION: When writing manual SQL its pretty easy to estimate the size and shape of data returned by a query. I'm increasingly finding it hard to do this with LINQ to SQL queries. Sometimes I find WAY more data than I was expecting - which can real...
[ "sql-server", "linq", "linq-to-sql", "datacontext" ]
2
2
955
3
0
2008-09-18T19:48:25.577000
2008-09-18T20:25:03.647000
96,218
96,899
.NET Compact Framework Printing libraries
Can anyone point to libraries that can be used for Printing from Compact.Net Framework 1.0? Criteria: I need to be able to print Text and Bar codes. The library should preferably be upgradable to.Net 2.0 or above with minimal disruption. Can be either Open Source [that can be distributed as part of Commercial applicati...
You've not given us much detail, like the device you're using or the printer type you want to print to (local, lan, serial, network, etc), however I'll see if I can at least point you in the right direction. The de-facto standard for CF printing is PrinterCE from Field Software. PrintBoy from Bachmann Software also wor...
.NET Compact Framework Printing libraries Can anyone point to libraries that can be used for Printing from Compact.Net Framework 1.0? Criteria: I need to be able to print Text and Bar codes. The library should preferably be upgradable to.Net 2.0 or above with minimal disruption. Can be either Open Source [that can be d...
TITLE: .NET Compact Framework Printing libraries QUESTION: Can anyone point to libraries that can be used for Printing from Compact.Net Framework 1.0? Criteria: I need to be able to print Text and Bar codes. The library should preferably be upgradable to.Net 2.0 or above with minimal disruption. Can be either Open Sou...
[ "c#", "windows-mobile", "compact-framework" ]
7
7
5,791
1
0
2008-09-18T19:49:04.357000
2008-09-18T20:59:58.010000
96,226
96,552
Well developed web site architecture using linq to sql?
Anybody found yet a good web site architecture using linq to sql? Any help will be very helpful!
We just finished up an internal IT project banking heavily on Linq2Sql and it paid off. I was a bit skeptical at first, but I think it worked out great in the end. Just remember, the fundamentals don't change. try to stay as stateless as possible keep clean lines between your services and data access don't fight linq, ...
Well developed web site architecture using linq to sql? Anybody found yet a good web site architecture using linq to sql? Any help will be very helpful!
TITLE: Well developed web site architecture using linq to sql? QUESTION: Anybody found yet a good web site architecture using linq to sql? Any help will be very helpful! ANSWER: We just finished up an internal IT project banking heavily on Linq2Sql and it paid off. I was a bit skeptical at first, but I think it worke...
[ "linq-to-sql", "architecture" ]
0
4
702
4
0
2008-09-18T19:49:50.893000
2008-09-18T20:28:18.680000
96,233
96,263
Why would I use 2's complement to compare two doubles instead of comparing their differences against an epsilon value?
Referenced here and here...Why would I use two's complement over an epsilon method? It seems like the epsilon method would be good enough for most cases. Update: I'm purely looking for a theoretical reason why you'd use one over the other. I've always used the epsilon method. Has anyone used the 2's complement comparis...
the second link you reference mentions an article that has quite a long description of the issue: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm but unless you are tweaking performance I would stick with epsilon so people can debug your code
Why would I use 2's complement to compare two doubles instead of comparing their differences against an epsilon value? Referenced here and here...Why would I use two's complement over an epsilon method? It seems like the epsilon method would be good enough for most cases. Update: I'm purely looking for a theoretical re...
TITLE: Why would I use 2's complement to compare two doubles instead of comparing their differences against an epsilon value? QUESTION: Referenced here and here...Why would I use two's complement over an epsilon method? It seems like the epsilon method would be good enough for most cases. Update: I'm purely looking fo...
[ "c++", "floating-point", "double" ]
3
3
1,813
6
0
2008-09-18T19:51:14.197000
2008-09-18T19:55:23.190000
96,247
96,436
What is the best place to store a configuration file in a Java web application (WAR)?
I create a web application (WAR) and deploy it on Tomcat. In the webapp there is a page with a form where an administrator can enter some configuration data. I don't want to store this data in an DBMS, but just in an XML file on the file system. Where to put it? I would like to put the file somewhere in the directory t...
What we do is to put it in a separate directory on the server (you could use something like /config, /opt/config, /root/config, /home/username/config, or anything you want). When our servlets start up, they read the XML file, get a few things out of it (most importantly DB connection information), and that's it. I aske...
What is the best place to store a configuration file in a Java web application (WAR)? I create a web application (WAR) and deploy it on Tomcat. In the webapp there is a page with a form where an administrator can enter some configuration data. I don't want to store this data in an DBMS, but just in an XML file on the f...
TITLE: What is the best place to store a configuration file in a Java web application (WAR)? QUESTION: I create a web application (WAR) and deploy it on Tomcat. In the webapp there is a page with a form where an administrator can enter some configuration data. I don't want to store this data in an DBMS, but just in an...
[ "java", "web-applications", "tomcat", "jakarta-ee" ]
58
50
64,231
6
0
2008-09-18T19:53:51.320000
2008-09-18T20:15:24
96,249
96,477
How do I append to an alist in scheme?
Adding an element to the head of an alist (Associative list) is simple enough: > (cons '(ding. 53) '((foo. 42) (bar. 27))) ((ding. 53) (foo. 42) (bar. 27)) Appending to the tail of an alist is a bit trickier though. After some experimenting, I produced this: > (define (alist-append alist pair) `(,@alist,pair)) > (alist...
You don't append to an a-list. You cons onto an a-list. An a-list is logically a set of associations. You don't care about the order of elements in a set. All you care about is presence or absence of a particular element. In the case of an a-list, all you care about is whether there exists an association for a given ta...
How do I append to an alist in scheme? Adding an element to the head of an alist (Associative list) is simple enough: > (cons '(ding. 53) '((foo. 42) (bar. 27))) ((ding. 53) (foo. 42) (bar. 27)) Appending to the tail of an alist is a bit trickier though. After some experimenting, I produced this: > (define (alist-appen...
TITLE: How do I append to an alist in scheme? QUESTION: Adding an element to the head of an alist (Associative list) is simple enough: > (cons '(ding. 53) '((foo. 42) (bar. 27))) ((ding. 53) (foo. 42) (bar. 27)) Appending to the tail of an alist is a bit trickier though. After some experimenting, I produced this: > (d...
[ "list", "lisp", "scheme", "associative" ]
5
5
3,321
2
0
2008-09-18T19:54:09.137000
2008-09-18T20:21:08.710000
96,250
96,478
Can I create a Visual Studio macro to launch a specific project in the debugger?
My project has both client and server components in the same solution file. I usually have the debugger set to start them together when debugging, but it's often the case where I start the server up outside of the debugger so I can start and stop the client as needed when working on client-side only stuff. (this is muc...
Ok. This appears to work from most UI (all?) contexts provided the solution is loaded: Sub DebugTheServer() DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate() DTE.ActiveWindow.Object.GetItem("Solution\ServerFolder\ServerProject").Select(vsUISelectionType.vsUISelectionTypeSelect) DTE.Windows.Item(Consta...
Can I create a Visual Studio macro to launch a specific project in the debugger? My project has both client and server components in the same solution file. I usually have the debugger set to start them together when debugging, but it's often the case where I start the server up outside of the debugger so I can start a...
TITLE: Can I create a Visual Studio macro to launch a specific project in the debugger? QUESTION: My project has both client and server components in the same solution file. I usually have the debugger set to start them together when debugging, but it's often the case where I start the server up outside of the debugge...
[ "visual-studio", "visual-studio-2008", "macros" ]
5
6
1,812
2
0
2008-09-18T19:54:09.900000
2008-09-18T20:21:16.370000
96,279
96,295
Visual Studio: Detecting unneeded Assemblies
On larger and/or long running projects, I tend to reference many assemblies and namespaces, and often I end up removing some functionality later on or moving it into a different project. I just wonder, is there a way to check every project (heck, every.cs file) in my whole Visual Studio solution and get a list of all r...
Resharper will do this for you and you can set it up in the Clean Code option that you can run solution wide;o)
Visual Studio: Detecting unneeded Assemblies On larger and/or long running projects, I tend to reference many assemblies and namespaces, and often I end up removing some functionality later on or moving it into a different project. I just wonder, is there a way to check every project (heck, every.cs file) in my whole V...
TITLE: Visual Studio: Detecting unneeded Assemblies QUESTION: On larger and/or long running projects, I tend to reference many assemblies and namespaces, and often I end up removing some functionality later on or moving it into a different project. I just wonder, is there a way to check every project (heck, every.cs f...
[ ".net", "visual-studio" ]
13
4
5,949
10
0
2008-09-18T19:58:18.580000
2008-09-18T19:59:42.600000
96,297
96,602
What are some popular naming conventions for Unit Tests?
General Follow the same standards for all tests. Be clear about what each test state is. Be specific about the expected behavior. Examples 1) MethodName_StateUnderTest_ExpectedBehavior Public void Sum_NegativeNumberAs1stParam_ExceptionThrown() Public void Sum_NegativeNumberAs2ndParam_ExceptionThrown () Public void Su...
I am pretty much with you on this one man. The naming conventions you have used are: Clear about what each test state is. Specific about the expected behaviour. What more do you need from a test name? Contrary to Ray's answer I don't think the Test prefix is necessary. It's test code, we know that. If you need to do th...
What are some popular naming conventions for Unit Tests? General Follow the same standards for all tests. Be clear about what each test state is. Be specific about the expected behavior. Examples 1) MethodName_StateUnderTest_ExpectedBehavior Public void Sum_NegativeNumberAs1stParam_ExceptionThrown() Public void Sum_Ne...
TITLE: What are some popular naming conventions for Unit Tests? QUESTION: General Follow the same standards for all tests. Be clear about what each test state is. Be specific about the expected behavior. Examples 1) MethodName_StateUnderTest_ExpectedBehavior Public void Sum_NegativeNumberAs1stParam_ExceptionThrown() ...
[ "unit-testing", "naming-conventions" ]
208
98
112,560
7
0
2008-09-18T19:59:56.237000
2008-09-18T20:32:48.137000
96,313
96,415
How can I restore svn control if the .svn folder has been damaged?
I've got a couple large checkouts where the.svn folder has become damaged so I'm getting and error, "Cleanup failed to process the following path.." And I can no longer commit or update files in that directory. I'd just delete and do the checkout again but the whole directory is over a gig. Is there a tool that will re...
In case you have changes to the files, and cannot delete them, you can use the Subversion 1.5 feature that allows you to 'checkout with obstructions'. Just delete the.svn directory in this directory and: (you don't need to delete inside directories when using --depth files, thanks Eric) In case the broken directory was...
How can I restore svn control if the .svn folder has been damaged? I've got a couple large checkouts where the.svn folder has become damaged so I'm getting and error, "Cleanup failed to process the following path.." And I can no longer commit or update files in that directory. I'd just delete and do the checkout again ...
TITLE: How can I restore svn control if the .svn folder has been damaged? QUESTION: I've got a couple large checkouts where the.svn folder has become damaged so I'm getting and error, "Cleanup failed to process the following path.." And I can no longer commit or update files in that directory. I'd just delete and do t...
[ "svn" ]
27
23
22,728
7
0
2008-09-18T20:02:16.667000
2008-09-18T20:13:07.450000
96,317
96,343
How do you get the root namespace of an assembly?
Given an instance of System.Reflection.Assembly.
Not possible. Nothing specifies a "Root" namespace. The default namespace in the options is a visual studio thing, not a.net thing
How do you get the root namespace of an assembly? Given an instance of System.Reflection.Assembly.
TITLE: How do you get the root namespace of an assembly? QUESTION: Given an instance of System.Reflection.Assembly. ANSWER: Not possible. Nothing specifies a "Root" namespace. The default namespace in the options is a visual studio thing, not a.net thing
[ ".net", "reflection" ]
59
51
40,236
17
0
2008-09-18T20:02:45.870000
2008-09-18T20:04:46.317000
96,326
96,636
KornShell (ksh) code to send attachments with mailx and uuencode?
I need to attach a file with mailx but at the moment I am not having success. Here's my code: subject="Something happened" to="somebody@somewhere.com" body="Attachment Test" attachment=/path/to/somefile.csv uuencode $attachment | mailx -s "$subject" "$to" << EOF The message is ready to be sent with the following file...
You have to concat both the text of your message and the uuencoded attachment: $ subject="Something happened" $ to="somebody@somewhere.com" $ body="Attachment Test" $ attachment=/path/to/somefile.csv $ $ cat >msg.txt < The message is ready to be sent with the following file or link attachments: > > somefile.csv > > Not...
KornShell (ksh) code to send attachments with mailx and uuencode? I need to attach a file with mailx but at the moment I am not having success. Here's my code: subject="Something happened" to="somebody@somewhere.com" body="Attachment Test" attachment=/path/to/somefile.csv uuencode $attachment | mailx -s "$subject" "$t...
TITLE: KornShell (ksh) code to send attachments with mailx and uuencode? QUESTION: I need to attach a file with mailx but at the moment I am not having success. Here's my code: subject="Something happened" to="somebody@somewhere.com" body="Attachment Test" attachment=/path/to/somefile.csv uuencode $attachment | mailx...
[ "shell", "unix", "scripting", "solaris", "ksh" ]
3
3
32,667
2
0
2008-09-18T20:03:13.340000
2008-09-18T20:35:21.627000
96,340
96,466
Best Approach For Configuring Multiple .Net Applications
We have a suite of interlinked.Net 3.5 applications. Some are web sites, some are web services, and some are windows applications. Each app currently has its own configuration file (app.config or web.config), and currently there are some duplicate keys across the config files (which at the moment are kept in sync manua...
We use file templates such as MyApp.config.template and MyWeb.config.template with NAnt properties for the bits that are different between environments. So the template file might look a bit like this: ${DbConnString} During a build we generate all the configs for the different environments by just looping through each...
Best Approach For Configuring Multiple .Net Applications We have a suite of interlinked.Net 3.5 applications. Some are web sites, some are web services, and some are windows applications. Each app currently has its own configuration file (app.config or web.config), and currently there are some duplicate keys across the...
TITLE: Best Approach For Configuring Multiple .Net Applications QUESTION: We have a suite of interlinked.Net 3.5 applications. Some are web sites, some are web services, and some are windows applications. Each app currently has its own configuration file (app.config or web.config), and currently there are some duplica...
[ ".net", "asp.net", "configuration" ]
4
1
1,340
5
0
2008-09-18T20:04:36.397000
2008-09-18T20:19:27
96,360
96,422
Writing post data from one java servlet to another
I am trying to write a servlet that will send a XML file (xml formatted string) to another servlet via a POST. (Non essential xml generating code replaced with "Hello there") StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = new URL("theservlet's URL"); HttpURLConnection connection = (HttpURLC...
This kind of thing is much easier using a library like HttpClient. There's even a post XML code example: PostMethod post = new PostMethod(url); RequestEntity entity = new FileRequestEntity(inputFile, "text/xml; charset=ISO-8859-1"); post.setRequestEntity(entity); HttpClient httpclient = new HttpClient(); int result = h...
Writing post data from one java servlet to another I am trying to write a servlet that will send a XML file (xml formatted string) to another servlet via a POST. (Non essential xml generating code replaced with "Hello there") StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = new URL("theservle...
TITLE: Writing post data from one java servlet to another QUESTION: I am trying to write a servlet that will send a XML file (xml formatted string) to another servlet via a POST. (Non essential xml generating code replaced with "Hello there") StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = ...
[ "java", "servlets" ]
9
13
31,497
4
0
2008-09-18T20:06:30.587000
2008-09-18T20:13:48.480000
96,377
99,169
Using Validation in WPF With Dependency Property and Style Triggers
I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below: public class NotNullOrEmptyValidationRule: ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (String.IsNullOrEmpty(value as String)) return new ValidationResult(false, "Val...
i see your binding on the TextBox is set to a path of 'Text' - is that a field on whatever the datacontext of this textbox is? is the textbox actually getting a value put into it? also, if you put a breakpoint in your validation method, is that ever getting fired? you may want to lookup how to log failures in binding a...
Using Validation in WPF With Dependency Property and Style Triggers I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below: public class NotNullOrEmptyValidationRule: ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (String.IsN...
TITLE: Using Validation in WPF With Dependency Property and Style Triggers QUESTION: I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below: public class NotNullOrEmptyValidationRule: ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo...
[ "wpf", "validation", "validationrules" ]
1
1
7,641
4
0
2008-09-18T20:08:18.727000
2008-09-19T03:06:58.923000