PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
30k
⌀ | Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
60,874 | 09/13/2008 21:08:33 | 1,870 | 08/19/2008 00:42:51 | 1,615 | 35 | Advanced directory switching in bash | I know a few advanced ways, to change directories. `pushd` and `popd` (directory stack) or `cd -` (change to last directory).
But I am looking for quick way to achieve the following:
Say, I am in a rather deep dir:
/this/is/a/very/deep/directory/structure/with\ lot\ of\ nasty/names
and I want to switch to
/this/is/another/very/deep/directory/structure/with\ lot\ of\ nasty/names
Is there a cool/quick/geeky way to do it (without the mouse)? | bash | null | null | null | null | null | open | Advanced directory switching in bash
===
I know a few advanced ways, to change directories. `pushd` and `popd` (directory stack) or `cd -` (change to last directory).
But I am looking for quick way to achieve the following:
Say, I am in a rather deep dir:
/this/is/a/very/deep/directory/structure/with\ lot\ of\ nasty/names
and I want to switch to
/this/is/another/very/deep/directory/structure/with\ lot\ of\ nasty/names
Is there a cool/quick/geeky way to do it (without the mouse)? | 0 |
60,877 | 09/13/2008 21:11:18 | 5,086 | 09/07/2008 19:11:44 | 1 | 0 | SQL Select Bottom Records | I have a query where I wish to retrieve the oldest X records. At present my query is something like the following:
SELECT Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate DESC
I know that normally I would remove the 'DESC' keyword to switch the order of the records, however in this instance I still want to get records ordered with the newest item first.
So I want to know if there is any means of performing this query such that I get the oldest X items sorted such that the newest item is first. I should also add that my database exists on SQL Server 2005. | sql | tsql | null | null | null | null | open | SQL Select Bottom Records
===
I have a query where I wish to retrieve the oldest X records. At present my query is something like the following:
SELECT Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate DESC
I know that normally I would remove the 'DESC' keyword to switch the order of the records, however in this instance I still want to get records ordered with the newest item first.
So I want to know if there is any means of performing this query such that I get the oldest X items sorted such that the newest item is first. I should also add that my database exists on SQL Server 2005. | 0 |
60,878 | 09/13/2008 21:11:30 | 3,153 | 08/27/2008 02:45:05 | 1,163 | 43 | Priority of a query in MS SQL | Is there a way to tell MS SQL that a query is not too important and that it can (and should) take it's time?
Likewise is there a way to tell MS SQL that it should give higher priority to a query? | sql | sql-server | database | mssql | null | null | open | Priority of a query in MS SQL
===
Is there a way to tell MS SQL that a query is not too important and that it can (and should) take it's time?
Likewise is there a way to tell MS SQL that it should give higher priority to a query? | 0 |
60,888 | 09/13/2008 21:26:40 | 5,487 | 09/09/2008 23:17:20 | 239 | 8 | How do you avoid Technical Debt while still keep true to Agile, i.e.: avoiding YAGNI and BDUF? | Technical Debt [via Martin Fowler][1], [via Steve McConnell][2]
YAGNI (You Ain't Gonna Need It) [via Wikipedia][3]
BDUF (Big Design Up Front) [via Wikipedia][4]
[1]: http://www.martinfowler.com/bliki/TechnicalDebt.html
[2]: http://forums.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx
[3]: http://en.wikipedia.org/wiki/You_Ain't_Gonna_Need_It
[4]: http://en.wikipedia.org/wiki/BDUF | agile | methodology | architecture | null | null | null | open | How do you avoid Technical Debt while still keep true to Agile, i.e.: avoiding YAGNI and BDUF?
===
Technical Debt [via Martin Fowler][1], [via Steve McConnell][2]
YAGNI (You Ain't Gonna Need It) [via Wikipedia][3]
BDUF (Big Design Up Front) [via Wikipedia][4]
[1]: http://www.martinfowler.com/bliki/TechnicalDebt.html
[2]: http://forums.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx
[3]: http://en.wikipedia.org/wiki/You_Ain't_Gonna_Need_It
[4]: http://en.wikipedia.org/wiki/BDUF | 0 |
60,893 | 09/13/2008 21:35:16 | 317 | 08/04/2008 15:43:28 | 401 | 19 | ASP.NET Convert Invalid String to Null | In my application I have `TextBox` in a `FormView` bound to a `LinqDataSource` like so:
<asp:TextBox ID="MyTextBox" runat="server"
Text='<%# Bind("MyValue") %>' AutoPostBack="True"
ontextchanged="MyTextBox_TextChanged" />
protected void MyTextBox_TextChanged(object sender, EventArgs e)
{
MyFormView.UpdateItem(false);
}
This is inside an `UpdatePanel` so any change to the field is immediately persisted. Also, the value of `MyValue` is `decimal?`. This works fine unless I enter any string which cannot be converted to decimal into the field. In that case, the `UpdateItem` call throws:
> **LinqDataSourceValidationException** -
> Failed to set one or more properties on type MyType. asdf is not a valid value for Decimal.
I understand the problem, ASP.NET does not know how to convert from 'asdf' to decimal?. What I would like it to do is convert all these invalid values to null. What is the best way to do this? | asp.net | linq | linq-to-sql | validation | data-binding | null | open | ASP.NET Convert Invalid String to Null
===
In my application I have `TextBox` in a `FormView` bound to a `LinqDataSource` like so:
<asp:TextBox ID="MyTextBox" runat="server"
Text='<%# Bind("MyValue") %>' AutoPostBack="True"
ontextchanged="MyTextBox_TextChanged" />
protected void MyTextBox_TextChanged(object sender, EventArgs e)
{
MyFormView.UpdateItem(false);
}
This is inside an `UpdatePanel` so any change to the field is immediately persisted. Also, the value of `MyValue` is `decimal?`. This works fine unless I enter any string which cannot be converted to decimal into the field. In that case, the `UpdateItem` call throws:
> **LinqDataSourceValidationException** -
> Failed to set one or more properties on type MyType. asdf is not a valid value for Decimal.
I understand the problem, ASP.NET does not know how to convert from 'asdf' to decimal?. What I would like it to do is convert all these invalid values to null. What is the best way to do this? | 0 |
60,904 | 09/13/2008 21:51:07 | 44,972 | 09/02/2008 10:00:56 | 45 | 1 | How can I open a cmd window in a specific location | Without having to navigate all the way to the directory I want. | cmd.exe | null | null | null | null | null | open | How can I open a cmd window in a specific location
===
Without having to navigate all the way to the directory I want. | 0 |
60,910 | 09/13/2008 21:55:20 | 85 | 08/01/2008 16:38:08 | 242 | 11 | Changing the font in Aquamacs? | I've recently had a need to do a bit of lisp editing and I found the nifty Ready Lisp package for OS X, which is great, except Aquamacs automatically uses a proportional font (which is idiotic, IMHO) and I want to change it to a monospace font. However, I'm not really much of an EMACS user, and the preferences menu in Aquamacs is less than clear on where and how one might make such a change. | osx | emacs | lisp | aquamacs | null | null | open | Changing the font in Aquamacs?
===
I've recently had a need to do a bit of lisp editing and I found the nifty Ready Lisp package for OS X, which is great, except Aquamacs automatically uses a proportional font (which is idiotic, IMHO) and I want to change it to a monospace font. However, I'm not really much of an EMACS user, and the preferences menu in Aquamacs is less than clear on where and how one might make such a change. | 0 |
60,918 | 09/13/2008 22:07:21 | 4,541 | 09/04/2008 17:37:04 | 177 | 3 | What is the worker process for IIS7? | I'm trying to do 'Attach to Process' for debugging in Visual Studio 2008 and I can't figure out what process to attach to. Help. | vs2008 | iis7 | null | null | null | null | open | What is the worker process for IIS7?
===
I'm trying to do 'Attach to Process' for debugging in Visual Studio 2008 and I can't figure out what process to attach to. Help. | 0 |
60,919 | 09/13/2008 22:10:29 | 1,796 | 08/18/2008 15:42:29 | 145 | 30 | Is SqlCommand.Dispose enough? | Can I use this approach efficiently?
using(SqlCommand cmd = new SqlCommand("GetSomething", new SqlConnection(Config.ConnectionString))
{
cmd.Connection.Open();
// set up parameters and CommandType to StoredProcedure etc. etc.
cmd.ExecuteNonQuery();
}
My concern is : Will the Dispose method of the SqlCommand (which is called when exiting the using block) close the underlying SqlConnection object or not?
| .net | dispose | gc | sqlconnection | sqlcommand | null | open | Is SqlCommand.Dispose enough?
===
Can I use this approach efficiently?
using(SqlCommand cmd = new SqlCommand("GetSomething", new SqlConnection(Config.ConnectionString))
{
cmd.Connection.Open();
// set up parameters and CommandType to StoredProcedure etc. etc.
cmd.ExecuteNonQuery();
}
My concern is : Will the Dispose method of the SqlCommand (which is called when exiting the using block) close the underlying SqlConnection object or not?
| 0 |
60,920 | 09/13/2008 22:10:40 | 2,744 | 08/24/2008 20:43:50 | 29 | 1 | What is the best implementation for DB Audit Trail? | A DB Audit Trail captures the User Last Modified, Modified Date, and Created Date.
There are several possible implementations:
- SQL Server Triggers
- Add UserModified, ModifiedDate, CreatedDate columns to the database and include logic in Stored Procedures or Insert, Update statements accordingly.
It would be nice if you include implementation (or link to) in your answer.
| sql-server | audit | null | null | null | null | open | What is the best implementation for DB Audit Trail?
===
A DB Audit Trail captures the User Last Modified, Modified Date, and Created Date.
There are several possible implementations:
- SQL Server Triggers
- Add UserModified, ModifiedDate, CreatedDate columns to the database and include logic in Stored Procedures or Insert, Update statements accordingly.
It would be nice if you include implementation (or link to) in your answer.
| 0 |
60,932 | 09/13/2008 22:19:34 | 2,695 | 08/24/2008 15:29:59 | 743 | 52 | Real life examples of metodologys and lifecycles. | Choosing the correct lifecycle and methodology isn't as easy as it was before (when there weren't so many methodologies, this days a new one emerges every day).
I've found that most projects require a certain level of evolution and that each project is different from the rest. That way, extreme programming works with for a project for a given company with 15 employees but doesn't quite work with a 100 emp company or doesn't work for a given project type (for example real time application, scientific application, etc).
I'd like to have a list of experiences, mostly stating the project type, the project size (number of people working on it), the project time (real or planned), the proyect lifecycle and methodology and if the project succeded or failed. Any other data will be appreciated, I think we might find some patterns if there's enough data. Of course, comments are welcomed.
**Edit:** I'll be constructing a "summary" with the stats of all answers. | software-engineering | methodology | lyfe-cycle | null | null | null | open | Real life examples of metodologys and lifecycles.
===
Choosing the correct lifecycle and methodology isn't as easy as it was before (when there weren't so many methodologies, this days a new one emerges every day).
I've found that most projects require a certain level of evolution and that each project is different from the rest. That way, extreme programming works with for a project for a given company with 15 employees but doesn't quite work with a 100 emp company or doesn't work for a given project type (for example real time application, scientific application, etc).
I'd like to have a list of experiences, mostly stating the project type, the project size (number of people working on it), the project time (real or planned), the proyect lifecycle and methodology and if the project succeded or failed. Any other data will be appreciated, I think we might find some patterns if there's enough data. Of course, comments are welcomed.
**Edit:** I'll be constructing a "summary" with the stats of all answers. | 0 |
60,939 | 09/13/2008 22:27:38 | 2,128 | 08/20/2008 13:32:09 | 380 | 5 | The best way to start a project... | When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the project.
When you are starting, what is your first step? do you plan out the project? make a diagram? write some code on paper? How do you start a project in a manner that you know you will succeed? | project-management | projects | project-planning | null | null | null | open | The best way to start a project...
===
When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the project.
When you are starting, what is your first step? do you plan out the project? make a diagram? write some code on paper? How do you start a project in a manner that you know you will succeed? | 0 |
60,942 | 09/13/2008 22:28:36 | 4,085 | 09/01/2008 17:48:33 | 1 | 2 | How can I send the stdout of one process to multiple processes using (preferably unnamed) pipes in Unix (or Windows)? | I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3:
proc2 -> stdout
/
proc1
\
proc3 -> stdout
I tried
proc1 | (proc2 & proc3)
but it doesn't seem to work, i.e.
echo 123 | (tr 1 a & tr 1 b)
writes
b23
to stdout instead of
a23
b23
| pipes | null | null | null | null | null | open | How can I send the stdout of one process to multiple processes using (preferably unnamed) pipes in Unix (or Windows)?
===
I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3:
proc2 -> stdout
/
proc1
\
proc3 -> stdout
I tried
proc1 | (proc2 & proc3)
but it doesn't seem to work, i.e.
echo 123 | (tr 1 a & tr 1 b)
writes
b23
to stdout instead of
a23
b23
| 0 |
60,944 | 09/13/2008 22:29:57 | 2,755 | 08/24/2008 21:39:28 | 24 | 2 | What are the CSS secrets to a flexible/fluid HTML form? | The below HTML/CSS/Javascript(JQuery) code displays the #makes select box. Selecting an option displays the #models select box with relevant options. The #makes select box sits off center and the #models select box fills the empty space when it is displayed.
How do you style the form so that the #makes select box is centered when it is the only form element displayed, but when both select boxes are displayed, they are both centered within the container?
CSS
.hide { display: none ; }
.show { display: inline ; }
fieldset { border: #206ba4 1px solid; }
fieldset legend { margin-top: -.4em; font-size: 20px; font-weight: bold; color: #206ba4; }
fieldset fieldset { position: relative; margin-top: 25px; padding-top: 0.75em; background-color: #ebf4fa; }
body { margin: 0; padding: 0; font-family : Verdana; font-size : 12px; text-align: center ; }
#wrapper { margin: 40px auto 0 auto ; }
#myFieldset { width: 213px ;}
#area { margin: 20px ;}
#area select {width: 75px ; float:left ;}
#area label {display: block ; font-size: 1.1em; font-weight: bold; color: #000000;}
#area #selection {display: block ; }
#makes {margin: 5px ; }
#models {margin: 5px ; }
Javascript
var cars = [
{
"makes" : "Honda",
"models" : ['Accord','CRV','Pilot']
},
{
"makes" :"Toyota",
"models" : ['Prius','Camry','Corolla']
} ] ;
$(function() {
vehicles = [] ;
for(var i=0; i<cars.length; i++) {
vehicles[cars[i].makes] = cars[i].models ;
}
var options = '' ;
for (var i = 0; i < cars.length; i++) {
options += '<option value="' + cars[i].makes + '">' + cars[i].makes + '</option>';
}
$("#make").html(options); // populate select box with array
$("#make").bind("click",
function() {
$("#model").children().remove() ; // clear select box
var options = '' ;
for (var i = 0; i < vehicles[this.value].length; i++) {
options += '<option value="' + vehicles[this.value][i] + '">' + vehicles[this.value][i] + '</option>';
}
$("#model").html(options); // populate select box with array
$("#models").addClass("show") ;
} // bind function end
); // bind end
});
HTML
<div id="wrapper">
<fieldset id="myFieldset"><legend>Cars</legend>
<fieldset id="area">
<label>Select Make:</label>
<div id="selection">
<div id="makes">
<select id="make"size="2"></select>
</div>
<div class="hide" id="models">
<select id="model" size="3"></select>
</div>
</div>
</fieldset>
</fieldset>
</div>
Thanks
| html | css | null | null | null | null | open | What are the CSS secrets to a flexible/fluid HTML form?
===
The below HTML/CSS/Javascript(JQuery) code displays the #makes select box. Selecting an option displays the #models select box with relevant options. The #makes select box sits off center and the #models select box fills the empty space when it is displayed.
How do you style the form so that the #makes select box is centered when it is the only form element displayed, but when both select boxes are displayed, they are both centered within the container?
CSS
.hide { display: none ; }
.show { display: inline ; }
fieldset { border: #206ba4 1px solid; }
fieldset legend { margin-top: -.4em; font-size: 20px; font-weight: bold; color: #206ba4; }
fieldset fieldset { position: relative; margin-top: 25px; padding-top: 0.75em; background-color: #ebf4fa; }
body { margin: 0; padding: 0; font-family : Verdana; font-size : 12px; text-align: center ; }
#wrapper { margin: 40px auto 0 auto ; }
#myFieldset { width: 213px ;}
#area { margin: 20px ;}
#area select {width: 75px ; float:left ;}
#area label {display: block ; font-size: 1.1em; font-weight: bold; color: #000000;}
#area #selection {display: block ; }
#makes {margin: 5px ; }
#models {margin: 5px ; }
Javascript
var cars = [
{
"makes" : "Honda",
"models" : ['Accord','CRV','Pilot']
},
{
"makes" :"Toyota",
"models" : ['Prius','Camry','Corolla']
} ] ;
$(function() {
vehicles = [] ;
for(var i=0; i<cars.length; i++) {
vehicles[cars[i].makes] = cars[i].models ;
}
var options = '' ;
for (var i = 0; i < cars.length; i++) {
options += '<option value="' + cars[i].makes + '">' + cars[i].makes + '</option>';
}
$("#make").html(options); // populate select box with array
$("#make").bind("click",
function() {
$("#model").children().remove() ; // clear select box
var options = '' ;
for (var i = 0; i < vehicles[this.value].length; i++) {
options += '<option value="' + vehicles[this.value][i] + '">' + vehicles[this.value][i] + '</option>';
}
$("#model").html(options); // populate select box with array
$("#models").addClass("show") ;
} // bind function end
); // bind end
});
HTML
<div id="wrapper">
<fieldset id="myFieldset"><legend>Cars</legend>
<fieldset id="area">
<label>Select Make:</label>
<div id="selection">
<div id="makes">
<select id="make"size="2"></select>
</div>
<div class="hide" id="models">
<select id="model" size="3"></select>
</div>
</div>
</fieldset>
</fieldset>
</div>
Thanks
| 0 |
60,950 | 09/13/2008 22:33:26 | 4,668 | 09/05/2008 04:08:05 | 176 | 8 | Is there a better Windows "Terminal" application? | I loath working on the command line in Windows, primarily because the terminal application is wretched to use compared to terminal applications on linux and OS X. Major complaints
1. No standard copy/paste. You have to turn on "mark" mode and it's only available from a multi-level popup triggered by the (small) left hand corner button. Then copy and paste need to be invoked from the same menu
2. You can't arbitrarily resize the window by dragging, you need to set a preference (back to the multi-level popup) each time you want to resize a window
3. You can only make the window so big before horizontal scroll bars enter the picture. Horizontal scroll bars suck.
4. You can't navigate to folders with \\\\netpath notation (UNC?), you need to map a network drive. This sucks when working on multiple machines that are going to have different drives mapped
Are there any tricks or applications, (paid or otherwise), that address these issue? | terminal | cli | command | line | command-line | null | open | Is there a better Windows "Terminal" application?
===
I loath working on the command line in Windows, primarily because the terminal application is wretched to use compared to terminal applications on linux and OS X. Major complaints
1. No standard copy/paste. You have to turn on "mark" mode and it's only available from a multi-level popup triggered by the (small) left hand corner button. Then copy and paste need to be invoked from the same menu
2. You can't arbitrarily resize the window by dragging, you need to set a preference (back to the multi-level popup) each time you want to resize a window
3. You can only make the window so big before horizontal scroll bars enter the picture. Horizontal scroll bars suck.
4. You can't navigate to folders with \\\\netpath notation (UNC?), you need to map a network drive. This sucks when working on multiple machines that are going to have different drives mapped
Are there any tricks or applications, (paid or otherwise), that address these issue? | 0 |
60,967 | 09/13/2008 22:59:54 | 6,253 | 09/13/2008 09:28:40 | 1 | 2 | How do I keep track of related windows in X11? | Unfortunately, my question is not as simple as keeping track of two windows created by the same process.
Here is what I have:
- Two users, Jack and Jim are remotely logged in to the same Unix system and run X servers
- Jack runs an application, 'AwesomeApp', that opens a GUI in a X window
- Jim runs another instance of this application, opening his own GUI window
- Now, Jack runs a supervisor application that will communicate with the process owning the first window (eg 'AwesomeApp') because it's HIS instance of 'AwesomeApp'
- How can his instance of the supervisor find which instance of 'AwesomeApp' window is his own?
| x11 | null | null | null | null | null | open | How do I keep track of related windows in X11?
===
Unfortunately, my question is not as simple as keeping track of two windows created by the same process.
Here is what I have:
- Two users, Jack and Jim are remotely logged in to the same Unix system and run X servers
- Jack runs an application, 'AwesomeApp', that opens a GUI in a X window
- Jim runs another instance of this application, opening his own GUI window
- Now, Jack runs a supervisor application that will communicate with the process owning the first window (eg 'AwesomeApp') because it's HIS instance of 'AwesomeApp'
- How can his instance of the supervisor find which instance of 'AwesomeApp' window is his own?
| 0 |
60,972 | 09/13/2008 23:14:51 | 2,744 | 08/24/2008 20:43:50 | 29 | 1 | How do you create a database from an EDM? | How do you create a database from an Entity Data Model.
So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server. | sql | ado.net | entity-framework | null | null | null | open | How do you create a database from an EDM?
===
How do you create a database from an Entity Data Model.
So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server. | 0 |
60,973 | 09/13/2008 23:15:24 | 4,653 | 09/05/2008 00:53:33 | 25 | 1 | Whats your favorite new feature in asp.net 3.5? | I am upgrading an asp.net 2.0 site to 3.5 and visual studio 2008. What would be the one thing that you would recommend looking into for upgrade to benefit the site? | c# | asp.net | upgrading | null | null | null | open | Whats your favorite new feature in asp.net 3.5?
===
I am upgrading an asp.net 2.0 site to 3.5 and visual studio 2008. What would be the one thing that you would recommend looking into for upgrade to benefit the site? | 0 |
60,977 | 09/13/2008 23:19:40 | 3,153 | 08/27/2008 02:45:05 | 1,178 | 44 | Mass reset last modification time for resetting detection of source file changes | I sometimes have to work on code that involves me moving my clock ahead forward. In this case some .cpp or .h files get their last modification date updated to the future time as I work on them.
Later when my clock is fixed, and I go to compile, it requires a rebuild of most of the project because some of the last modification dates are in the future. Each subsequent recompile has the same problem.
My only known solution at this point is to:
a) find the file that has the future time and re-save it. This method is not ideal because the project is very big and it takes time even for windows advanced search to find the files that are changed.
or b) delete the whole project and re-check it out from svn.
Does anyone know how I can get around this problem?
Is there perhaps a setting in visual studio that will allow me to tell the compiler to use the archive bit instead of the last modification date to detect source file changes? | time | timezone | svn | c++ | visual-studio | null | open | Mass reset last modification time for resetting detection of source file changes
===
I sometimes have to work on code that involves me moving my clock ahead forward. In this case some .cpp or .h files get their last modification date updated to the future time as I work on them.
Later when my clock is fixed, and I go to compile, it requires a rebuild of most of the project because some of the last modification dates are in the future. Each subsequent recompile has the same problem.
My only known solution at this point is to:
a) find the file that has the future time and re-save it. This method is not ideal because the project is very big and it takes time even for windows advanced search to find the files that are changed.
or b) delete the whole project and re-check it out from svn.
Does anyone know how I can get around this problem?
Is there perhaps a setting in visual studio that will allow me to tell the compiler to use the archive bit instead of the last modification date to detect source file changes? | 0 |
60,995 | 09/13/2008 23:47:04 | 1,635 | 08/17/2008 17:33:54 | 150 | 15 | How do I access the non-IPM_SUBTREE Public Folder Tree with WMI? | I'm trying to verify when the OAB root folder for a new OAB is created with powershell. Is there a WMI class that exposes this? I'm using powershell, but any examples or links will do. | scripting | powershell | exchange | wmi | exchange-server | null | open | How do I access the non-IPM_SUBTREE Public Folder Tree with WMI?
===
I'm trying to verify when the OAB root folder for a new OAB is created with powershell. Is there a WMI class that exposes this? I'm using powershell, but any examples or links will do. | 0 |
61,000 | 09/14/2008 00:01:15 | 2,274 | 08/21/2008 12:44:42 | 362 | 24 | Development directory Structure | I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc.
I recently used a [Maven structure][1] for a java project, but I am not sure it's the best structure for a non-maven driven project.
So, I have two questions: When you guys start new projects, what structure you use? And: What if you need to integrate two different languages, like for example java classes into a PHP application; PHP files are source files, web files, you you use a /src, /classes, webapps/php ? What are your choices in such scenarios.
[1]: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html | directory-structure | null | null | null | null | 12/16/2011 17:26:58 | not constructive | Development directory Structure
===
I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc.
I recently used a [Maven structure][1] for a java project, but I am not sure it's the best structure for a non-maven driven project.
So, I have two questions: When you guys start new projects, what structure you use? And: What if you need to integrate two different languages, like for example java classes into a PHP application; PHP files are source files, web files, you you use a /src, /classes, webapps/php ? What are your choices in such scenarios.
[1]: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html | 4 |
61,002 | 09/14/2008 00:02:41 | 4,061 | 09/01/2008 15:48:37 | 111 | 3 | How can I generate a git diff of what's changed since the last time I pulled? | I'd like to script, preferably in rake, the following actions into a single command:
1. Get the version of my local git repository.
2. Git pull the latest code.
3. Git diff from the version I extracted in step #1 to what is now in my local repository.
In other words, I want to get the latest code form the central repository and immediately generate a diff of what's changed since the last time I pulled. | git | diff | rake | pull | null | null | open | How can I generate a git diff of what's changed since the last time I pulled?
===
I'd like to script, preferably in rake, the following actions into a single command:
1. Get the version of my local git repository.
2. Git pull the latest code.
3. Git diff from the version I extracted in step #1 to what is now in my local repository.
In other words, I want to get the latest code form the central repository and immediately generate a diff of what's changed since the last time I pulled. | 0 |
61,005 | 09/14/2008 00:09:05 | 814 | 08/09/2008 04:07:15 | 275 | 17 | What are the best permission settings for PHP scripts? | What are the best file permission settings for PHP scripts?
| php | null | null | null | null | null | open | What are the best permission settings for PHP scripts?
===
What are the best file permission settings for PHP scripts?
| 0 |
61,008 | 09/14/2008 00:13:07 | 5,469 | 09/09/2008 21:03:22 | 483 | 26 | What steps should be necessary to optimize a poorly performing query? | I know this is a broad question, but I've inherited several poor performers and need to optimize them badly. I was wondering what are the most common steps involved to optimize. So, what steps do some of you guys take when faced with the same situation? | sql-server | optimization | null | null | null | null | open | What steps should be necessary to optimize a poorly performing query?
===
I know this is a broad question, but I've inherited several poor performers and need to optimize them badly. I was wondering what are the most common steps involved to optimize. So, what steps do some of you guys take when faced with the same situation? | 0 |
61,012 | 09/14/2008 00:17:35 | 6,310 | 09/13/2008 22:37:35 | 1 | 0 | Where is the best online Javascript language documentation? | When I do a search, the results are a bit hit-and-miss; many of the 'documentation' sites seem more advertising than information. What are the good sources of Javascript language info on the web? | javascript | documentation | null | null | null | null | open | Where is the best online Javascript language documentation?
===
When I do a search, the results are a bit hit-and-miss; many of the 'documentation' sites seem more advertising than information. What are the good sources of Javascript language info on the web? | 0 |
61,033 | 09/14/2008 01:02:10 | 6,305 | 09/13/2008 21:33:24 | 11 | 1 | How to check if a value exists in SQL table | I've got a table of URL's and I don't want any duplicate URL's. How do I check to see if a given URL is already in the table using PHP/MySQL? | php | sql | mysql | null | null | null | open | How to check if a value exists in SQL table
===
I've got a table of URL's and I don't want any duplicate URL's. How do I check to see if a given URL is already in the table using PHP/MySQL? | 0 |
61,051 | 09/14/2008 01:48:50 | 3,283 | 08/27/2008 16:59:58 | 11 | 2 | When did browsers start supporting multiple classes per tag? | You can use more than one css class in an HTML tag in current web browsers, e.g.:
<div class="style1 style2 style3">foo bar</div>
This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature? | css | browser | null | null | null | null | open | When did browsers start supporting multiple classes per tag?
===
You can use more than one css class in an HTML tag in current web browsers, e.g.:
<div class="style1 style2 style3">foo bar</div>
This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature? | 0 |
61,057 | 09/14/2008 02:02:12 | 4,037 | 09/01/2008 13:58:54 | 18 | 1 | Loadind Assemblies from the Network | This is related to the [this question][1] and the answer maybe the same but
I'll ask anyways.
I understand that we can start managed executables from the network from .NET
3.5 SP1 but what about assemblies loaded from inside the executable?
Does the same thing apply?
[1]: http://stackoverflow.com/questions/24468/running-partially-trusted-net-assemblies-from-a-network-share | .net-3.5 | dll | assembly | networking | security | null | open | Loadind Assemblies from the Network
===
This is related to the [this question][1] and the answer maybe the same but
I'll ask anyways.
I understand that we can start managed executables from the network from .NET
3.5 SP1 but what about assemblies loaded from inside the executable?
Does the same thing apply?
[1]: http://stackoverflow.com/questions/24468/running-partially-trusted-net-assemblies-from-a-network-share | 0 |
61,071 | 09/14/2008 02:29:06 | 781 | 08/08/2008 21:28:19 | 527 | 20 | How do I dissasemble a VC++ application? | I believe the application has some parts that target .NET, and some that don't. I'm particularly interested in looking at the resource files, if there are any. | c++ | null | null | null | null | null | open | How do I dissasemble a VC++ application?
===
I believe the application has some parts that target .NET, and some that don't. I'm particularly interested in looking at the resource files, if there are any. | 0 |
61,073 | 09/14/2008 02:31:05 | 3,191 | 08/27/2008 12:32:21 | 420 | 24 | How can I make my VS2008 x86 installer install x64 assemblies on x64? | I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my .NET product.
I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers were getting crashes on startup with errors about the assembly not being appropriate for their platform.
I sent such a customer a copy of the x64 version of this third-party assembly, and told him to just copy it over the existing x86 one. It worked, sweet! So now I just need to make the installer do this for me.
This actually appears nontrivial :(. Ideally, I just want the installer (which would be x86, since that can run on both platforms) to include both the x86 and x64 versions of this third-party assembly, and install the appropriate one. In other words, I want a single installer that makes my users' lives easy.
I thought I had this worked out, using MSI conditional statements and all that. But apparently no... the VS2008 setup projects won't compile unless you specify "x86" or "x64." If you specify x86, it gives a compilation error saying it can't include the x64 assembly. If you specify x64, then the result cannot be executed on an x86 computer. Damn!
Someone must have had this problem before. Unfortunately Google is unhelpful, so I turn to StackOverflow! | vs2008 | installation | windows-installer | x64 | x86 | null | open | How can I make my VS2008 x86 installer install x64 assemblies on x64?
===
I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my .NET product.
I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers were getting crashes on startup with errors about the assembly not being appropriate for their platform.
I sent such a customer a copy of the x64 version of this third-party assembly, and told him to just copy it over the existing x86 one. It worked, sweet! So now I just need to make the installer do this for me.
This actually appears nontrivial :(. Ideally, I just want the installer (which would be x86, since that can run on both platforms) to include both the x86 and x64 versions of this third-party assembly, and install the appropriate one. In other words, I want a single installer that makes my users' lives easy.
I thought I had this worked out, using MSI conditional statements and all that. But apparently no... the VS2008 setup projects won't compile unless you specify "x86" or "x64." If you specify x86, it gives a compilation error saying it can't include the x64 assembly. If you specify x64, then the result cannot be executed on an x86 computer. Damn!
Someone must have had this problem before. Unfortunately Google is unhelpful, so I turn to StackOverflow! | 0 |
61,084 | 09/14/2008 03:03:48 | 4,449 | 09/03/2008 20:49:28 | 1 | 1 | Empty namespace using Linq Xml | I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g.
XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"),
new XElement(ns + "urlset",
new XElement("url",
new XElement("loc", "http://www.example.com/page"),
new XElement("lastmod", "2008-09-14"))));
The result is ...
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url xmlns="">
<loc>http://www.example.com/page</loc>
<lastmod>2008-09-14</lastmod>
</url>
</urlset>
I would rather not have the xmlns="" on the url element. I can strip it out using Replace on the final xdoc.ToString(), but is there a more correct way? | xml | linq | null | null | null | null | open | Empty namespace using Linq Xml
===
I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g.
XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"),
new XElement(ns + "urlset",
new XElement("url",
new XElement("loc", "http://www.example.com/page"),
new XElement("lastmod", "2008-09-14"))));
The result is ...
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url xmlns="">
<loc>http://www.example.com/page</loc>
<lastmod>2008-09-14</lastmod>
</url>
</urlset>
I would rather not have the xmlns="" on the url element. I can strip it out using Replace on the final xdoc.ToString(), but is there a more correct way? | 0 |
61,085 | 09/14/2008 03:04:29 | 658 | 08/07/2008 15:07:47 | 2,805 | 131 | SQLite/PHP read-only? | I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culprit, but even with the database providing full access (chmod 777) the problem persists. Should I try changing the file owner? If so, what to?
By the way, my machine is the standard Mac OS X Leopard install with PHP activated. | php | sqlite | permissions | pdo | null | null | open | SQLite/PHP read-only?
===
I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culprit, but even with the database providing full access (chmod 777) the problem persists. Should I try changing the file owner? If so, what to?
By the way, my machine is the standard Mac OS X Leopard install with PHP activated. | 0 |
61,088 | 09/14/2008 03:12:50 | 2,443 | 08/22/2008 10:53:30 | 853 | 44 | Hidden Features of JavaScript | **What "Hidden Features" of JavaScript do you think every programmer should know?**
After having seen the excellent quality of the answers to the following question I thought it was time to ask it for JavaScript.
- [Hidden Features of C#][1]
- [Hidden Features of Java][2]
- [Hidden Features of ASP.NET][3]
Even though JavaScript is arguably the most important Client Side language right now (just ask Google) it's surprising how little most web developers appreciate how powerful it really is.
[1]: http://beta.stackoverflow.com/questions/9033/hidden-features-of-c
[2]: http://beta.stackoverflow.com/questions/15496/hidden-features-of-java
[3]: http://beta.stackoverflow.com/questions/54929/what-are-the-hidden-features-of-aspnet | javascript | null | null | null | null | 10/05/2011 05:47:19 | not constructive | Hidden Features of JavaScript
===
**What "Hidden Features" of JavaScript do you think every programmer should know?**
After having seen the excellent quality of the answers to the following question I thought it was time to ask it for JavaScript.
- [Hidden Features of C#][1]
- [Hidden Features of Java][2]
- [Hidden Features of ASP.NET][3]
Even though JavaScript is arguably the most important Client Side language right now (just ask Google) it's surprising how little most web developers appreciate how powerful it really is.
[1]: http://beta.stackoverflow.com/questions/9033/hidden-features-of-c
[2]: http://beta.stackoverflow.com/questions/15496/hidden-features-of-java
[3]: http://beta.stackoverflow.com/questions/54929/what-are-the-hidden-features-of-aspnet | 4 |
61,092 | 09/14/2008 03:17:31 | 5,086 | 09/07/2008 19:11:44 | 8 | 1 | Close and Dispose - which to call? | Having read the threads [Is SqlCommand.Dispose enough?][1] and [Closing and Disposing a WCF Service][2] I am wondering for classes such as SqlConnection or one of the several classes inheriting from the Stream class does it matter if I close Dispose rather than Close?
[1]: http://stackoverflow.com/questions/60919/is-sqlcommanddispose-enough
[2]: http://stackoverflow.com/questions/23867/closing-and-disposing-a-wcf-service | .net | null | null | null | null | null | open | Close and Dispose - which to call?
===
Having read the threads [Is SqlCommand.Dispose enough?][1] and [Closing and Disposing a WCF Service][2] I am wondering for classes such as SqlConnection or one of the several classes inheriting from the Stream class does it matter if I close Dispose rather than Close?
[1]: http://stackoverflow.com/questions/60919/is-sqlcommanddispose-enough
[2]: http://stackoverflow.com/questions/23867/closing-and-disposing-a-wcf-service | 0 |
61,109 | 09/14/2008 03:49:06 | 6,323 | 09/14/2008 03:49:06 | 1 | 0 | What to Learn after C++? | I have been learning C++ for a while now, I find it very powerful. But, the problem is the the level of abstraction is not much and I have to do memory management myself.
What are the languages that I can use which uses a higher level of abstraction. | c++ | programming-languages | null | null | null | null | open | What to Learn after C++?
===
I have been learning C++ for a while now, I find it very powerful. But, the problem is the the level of abstraction is not much and I have to do memory management myself.
What are the languages that I can use which uses a higher level of abstraction. | 0 |
61,110 | 09/14/2008 03:50:10 | 4,850 | 09/06/2008 00:59:14 | 13 | 3 | How to save the output of a console application | I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program execution.
The workaround I use while I don't find a cleaner approach is to subclass `TextWriter` overriding the writing methods so they would both write to a file and call the original stdout writer. Something like this:
public class DirtyWorkaround {
private class DirtyWriter : TextWriter {
private TextWriter stdoutWriter;
private StreamWriter fileWriter;
public DirtyWriter(string path, TextWriter stdoutWriter) {
this.stdoutWriter = stdoutWriter;
this.fileWriter = new StreamWriter(path);
}
override public void Write(string s) {
stdoutWriter.Write(s);
fileWriter.Write(s);
fileWriter.Flush();
}
// Same as above for WriteLine() and WriteLine(string),
// plus whatever methods I need to override to inherit
// from TextWriter (Encoding.Get I guess).
}
public static void Main(string[] args) {
using (DirtyWriter dw = new DirtyWriter("path", Console.Out)) {
Console.SetOut(dw);
// Teh codez
}
}
}
See that it writes to and flushes the file all the time. I'd love to do it only at the end of the execution, but I couldn't find any way to access to the output buffer.
Also, excuse inaccuracies with the above code (had to write it _ad hoc_, sorry ;). | c# | .net | console | stdout | null | null | open | How to save the output of a console application
===
I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program execution.
The workaround I use while I don't find a cleaner approach is to subclass `TextWriter` overriding the writing methods so they would both write to a file and call the original stdout writer. Something like this:
public class DirtyWorkaround {
private class DirtyWriter : TextWriter {
private TextWriter stdoutWriter;
private StreamWriter fileWriter;
public DirtyWriter(string path, TextWriter stdoutWriter) {
this.stdoutWriter = stdoutWriter;
this.fileWriter = new StreamWriter(path);
}
override public void Write(string s) {
stdoutWriter.Write(s);
fileWriter.Write(s);
fileWriter.Flush();
}
// Same as above for WriteLine() and WriteLine(string),
// plus whatever methods I need to override to inherit
// from TextWriter (Encoding.Get I guess).
}
public static void Main(string[] args) {
using (DirtyWriter dw = new DirtyWriter("path", Console.Out)) {
Console.SetOut(dw);
// Teh codez
}
}
}
See that it writes to and flushes the file all the time. I'd love to do it only at the end of the execution, but I couldn't find any way to access to the output buffer.
Also, excuse inaccuracies with the above code (had to write it _ad hoc_, sorry ;). | 0 |
61,143 | 09/14/2008 05:17:44 | 5,360 | 09/09/2008 10:50:44 | 3 | 0 | Recursive Lamba to Traverse a Tree in C# | Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#. | c# | null | null | null | null | null | open | Recursive Lamba to Traverse a Tree in C#
===
Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#. | 0 |
61,150 | 09/14/2008 05:31:57 | 3,087 | 08/26/2008 15:14:26 | 325 | 17 | Mocking Static Blocks in Java | My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make use of Static Blocks and these are one of the annoying points in our push in writing unit tests. Our goal is to be able to write unit tests for classes that depend on this static initialization with minimal code changes.
So far my suggestion to my colleagues is to move the body of the static block into a private static method and call it `staticInit`. This method can then be called from within the static block. For unit testing another class that depends on this class could easily mock `staticInit` with JMockit to not do anything. Let's see this in example.
public class ClassWithStaticInit {
static {
System.out.println("static initializer.");
}
}
Will be changed to
public class ClassWithStaticInit {
static {
staticInit();
}
private static void staticInit() {
System.out.println("static initialized.");
}
}
So that we can do the following in a JUnit.
public class DependentClassTest {
public static class MockClassWithStaticInit {
public static void staticInit() {
}
}
@BeforeClass
public static void setUpBeforeClass() {
Mockit.redefineMethods(ClassWithStaticInit.class, MockClassWithStaticInit.class);
}
}
However this solution also comes with its own problems. You can't run `DependentClassTest` and `ClassWithStaticInitTest` on the same JVM since you actually want the static block to run for `ClassWithStaticInitTest`.
What would be your way of accomplishing this task? Or any better, non-JMockit based solutions that you think would work cleaner? | java | unit-testing | mocking | static-block | null | null | open | Mocking Static Blocks in Java
===
My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make use of Static Blocks and these are one of the annoying points in our push in writing unit tests. Our goal is to be able to write unit tests for classes that depend on this static initialization with minimal code changes.
So far my suggestion to my colleagues is to move the body of the static block into a private static method and call it `staticInit`. This method can then be called from within the static block. For unit testing another class that depends on this class could easily mock `staticInit` with JMockit to not do anything. Let's see this in example.
public class ClassWithStaticInit {
static {
System.out.println("static initializer.");
}
}
Will be changed to
public class ClassWithStaticInit {
static {
staticInit();
}
private static void staticInit() {
System.out.println("static initialized.");
}
}
So that we can do the following in a JUnit.
public class DependentClassTest {
public static class MockClassWithStaticInit {
public static void staticInit() {
}
}
@BeforeClass
public static void setUpBeforeClass() {
Mockit.redefineMethods(ClassWithStaticInit.class, MockClassWithStaticInit.class);
}
}
However this solution also comes with its own problems. You can't run `DependentClassTest` and `ClassWithStaticInitTest` on the same JVM since you actually want the static block to run for `ClassWithStaticInitTest`.
What would be your way of accomplishing this task? Or any better, non-JMockit based solutions that you think would work cleaner? | 0 |
61,151 | 09/14/2008 05:41:11 | 4,883 | 09/06/2008 10:24:59 | 888 | 9 | Where do the Python unit tests go? | If you're writing a library, or an app, where do the unit test files go?
It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.
Is there a best practice here? | python | unit-testing | null | null | null | 11/29/2011 20:53:00 | not constructive | Where do the Python unit tests go?
===
If you're writing a library, or an app, where do the unit test files go?
It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.
Is there a best practice here? | 4 |
61,155 | 09/14/2008 06:01:37 | 4,298 | 09/02/2008 18:17:28 | 29 | 1 | What is the best way to position a div in css? | I'm trying to place this menu:
`<div class="left-menu" style="left: 123px; top: 355px">
`
` <ul>
`
` <li> Categories </li>
`
` <li> Weapons </li>
`
` <li> Armor </li>
`
` <li> Manuals </li>
`
` <li> Sustenance </li>
`
` <li> Test </li>
`
` </ul>
`
` </div>
`
on the left hand side of the page. The problem is that if I use absolute or fixed values,
different screen sizes will render the navigation bar differently. I also have a second div that contains all the main content which also needs to be moved to the right, so far I'm using relative values which seems to work no matter the screen size.
| asp.net | css | layout | null | null | null | open | What is the best way to position a div in css?
===
I'm trying to place this menu:
`<div class="left-menu" style="left: 123px; top: 355px">
`
` <ul>
`
` <li> Categories </li>
`
` <li> Weapons </li>
`
` <li> Armor </li>
`
` <li> Manuals </li>
`
` <li> Sustenance </li>
`
` <li> Test </li>
`
` </ul>
`
` </div>
`
on the left hand side of the page. The problem is that if I use absolute or fixed values,
different screen sizes will render the navigation bar differently. I also have a second div that contains all the main content which also needs to be moved to the right, so far I'm using relative values which seems to work no matter the screen size.
| 0 |
61,176 | 09/14/2008 07:11:31 | 663 | 08/07/2008 15:39:40 | 1 | 0 | Getting mail from GMail into Java application using IMAP | I want to access messages in GMail from a Java application using JavaMail and IMAP. Why am I getting a SocketTimeoutException?
Here is my code:
Properties props = System.getProperties();
props.setProperty("mail.imap.host", "imap.gmail.com");
props.setProperty("mail.imap.port", "993");
props.setProperty("mail.imap.connectiontimeout", "5000");
props.setProperty("mail.imap.timeout", "5000");
try {
Session session = Session.getDefaultInstance(props, new MyAuthenticator());
URLName urlName = new URLName("imap://[email protected]:[email protected]");
Store store = session.getStore(urlName);
if (!store.isConnected()) {
store.connect();
}
} catch (NoSuchProviderException e) {
e.printStackTrace();
System.exit(1);
} catch (MessagingException e) {
e.printStackTrace();
System.exit(2);
}
I set the timeout values so that it wouldn't take "forever" to timeout. Also, MyAuthenticator also has the username and password, which seems redundant with the URL. Is there another way to specify the protocol? (I didn't see it in the JavaDoc for IMAP.)
| java | gmail | imap | null | null | null | open | Getting mail from GMail into Java application using IMAP
===
I want to access messages in GMail from a Java application using JavaMail and IMAP. Why am I getting a SocketTimeoutException?
Here is my code:
Properties props = System.getProperties();
props.setProperty("mail.imap.host", "imap.gmail.com");
props.setProperty("mail.imap.port", "993");
props.setProperty("mail.imap.connectiontimeout", "5000");
props.setProperty("mail.imap.timeout", "5000");
try {
Session session = Session.getDefaultInstance(props, new MyAuthenticator());
URLName urlName = new URLName("imap://[email protected]:[email protected]");
Store store = session.getStore(urlName);
if (!store.isConnected()) {
store.connect();
}
} catch (NoSuchProviderException e) {
e.printStackTrace();
System.exit(1);
} catch (MessagingException e) {
e.printStackTrace();
System.exit(2);
}
I set the timeout values so that it wouldn't take "forever" to timeout. Also, MyAuthenticator also has the username and password, which seems redundant with the URL. Is there another way to specify the protocol? (I didn't see it in the JavaDoc for IMAP.)
| 0 |
61,180 | 09/14/2008 07:23:37 | 5,023 | 09/07/2008 12:27:27 | 409 | 29 | Web in a desktop application: Good web browser controls? | I've been utlising a "web browser control" in desktop based applications (in my case Windows Forms .NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet where required.
I'm really tired of the IE browser control because of the poor quality html it generates on output. Also, I guess that it is really just IE7 behind the scenes and so has many of that browser "issues". Despite this, it is quite a powerful control and provides rich interaction with your desktop app.
So, what other alternatives to the IE browser control are there? I looked at a Mosaic equivalent a year ago but was disappointed with the number of unimplemented features, maybe this has improved recently?
| browser | controls | desktop-application | null | null | null | open | Web in a desktop application: Good web browser controls?
===
I've been utlising a "web browser control" in desktop based applications (in my case Windows Forms .NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet where required.
I'm really tired of the IE browser control because of the poor quality html it generates on output. Also, I guess that it is really just IE7 behind the scenes and so has many of that browser "issues". Despite this, it is quite a powerful control and provides rich interaction with your desktop app.
So, what other alternatives to the IE browser control are there? I looked at a Mosaic equivalent a year ago but was disappointed with the number of unimplemented features, maybe this has improved recently?
| 0 |
61,191 | 09/14/2008 07:44:02 | 6,332 | 09/14/2008 07:44:02 | 1 | 0 | unable to load jtds1.1 driver on Linux machine in a java application | We have a simple spring-hibernate application where in we have set the classpath in the executable jar file. And the app connects to the database using jtds driver, Everything works as expected on windows machine and jdk1.6. But on Linux, the app is unable to find the driver,
But the web application developed using spring-hibernate works fine on Linux machine and connects well to database(sqlserver) on tomcat.
Any suggestions why this might be happening is greatly appreciated. | java | linux | hibernate | spring | jtds | null | open | unable to load jtds1.1 driver on Linux machine in a java application
===
We have a simple spring-hibernate application where in we have set the classpath in the executable jar file. And the app connects to the database using jtds driver, Everything works as expected on windows machine and jdk1.6. But on Linux, the app is unable to find the driver,
But the web application developed using spring-hibernate works fine on Linux machine and connects well to database(sqlserver) on tomcat.
Any suggestions why this might be happening is greatly appreciated. | 0 |
61,211 | 09/14/2008 09:04:41 | 6,149 | 09/12/2008 16:34:54 | 101 | 3 | Tools to create maximum velocity in a .NET dev team | If you were to self-fund a software project which tools, frameworks, components would you employ to ensure maximum productivity for the dev team and that the "real" problem is being worked on. | .net | productivity | null | null | null | null | open | Tools to create maximum velocity in a .NET dev team
===
If you were to self-fund a software project which tools, frameworks, components would you employ to ensure maximum productivity for the dev team and that the "real" problem is being worked on. | 0 |
61,212 | 09/14/2008 09:06:10 | 4,883 | 09/06/2008 10:24:59 | 903 | 9 | How do you remove untracked files from your git working copy? | How do you remove untracked files from your git working copy? | git | null | null | null | null | null | open | How do you remove untracked files from your git working copy?
===
How do you remove untracked files from your git working copy? | 0 |
9,651,685 | 03/11/2012 01:32:57 | 458,879 | 09/26/2010 19:18:57 | 113 | 14 | Django - Join tables that share the same forienKey | I have let's say three classes that I'd like to search within. I would like to let the database do the work for me if possible.
Would it be possible to run a single query on the User object to get all the related fields that match?
I am trying to avoid joining the three tables in my code. If I were to do it in the code, I would query all three classes
then eliminate the duplicates while keep the matches.
Query: Get all users whose name contains "William", category is "Single" and alias is "Bill".
class ModelA(models.Model):
user = models.ForeignKey(User,related_name="%(class)s",null=False)
name = models.CharField(max_length=70)
def __unicode__(self):
return u'%s' % (self.name)
class ModelB(models.Model):
user = models.ForeignKey(User,related_name="%(class)s",null=False)
category = models.CharField(max_length=70)
def __unicode__(self):
return u'%s' % (self.category)
class ModelC(models.Model):
user = models.ForeignKey(User,related_name="%(class)s",null=False)
alias = models.CharField(max_length=70)
def __unicode__(self):
return u'%s' % (self.alias)
Note: this is a example, and I am not looking to combine all the info in a single table.
| django | query | django-tables2 | django-related-manager | null | null | open | Django - Join tables that share the same forienKey
===
I have let's say three classes that I'd like to search within. I would like to let the database do the work for me if possible.
Would it be possible to run a single query on the User object to get all the related fields that match?
I am trying to avoid joining the three tables in my code. If I were to do it in the code, I would query all three classes
then eliminate the duplicates while keep the matches.
Query: Get all users whose name contains "William", category is "Single" and alias is "Bill".
class ModelA(models.Model):
user = models.ForeignKey(User,related_name="%(class)s",null=False)
name = models.CharField(max_length=70)
def __unicode__(self):
return u'%s' % (self.name)
class ModelB(models.Model):
user = models.ForeignKey(User,related_name="%(class)s",null=False)
category = models.CharField(max_length=70)
def __unicode__(self):
return u'%s' % (self.category)
class ModelC(models.Model):
user = models.ForeignKey(User,related_name="%(class)s",null=False)
alias = models.CharField(max_length=70)
def __unicode__(self):
return u'%s' % (self.alias)
Note: this is a example, and I am not looking to combine all the info in a single table.
| 0 |
9,651,689 | 03/11/2012 01:33:47 | 641,882 | 03/02/2011 20:22:13 | 1 | 0 | How does len count in list? | Ok I tried searching before I posted here. So don't shot me down if its already asked.
I want to know in Python's len function.
len([o,1]) -> 2 # Right
But how come in the following
len([a,[b,[c]]]) -> 2 #How?
Shouldn't it be 3??
I know this could be a very trivial question. So again please be patient with it.
Thanks | python | list | trivial | null | null | null | open | How does len count in list?
===
Ok I tried searching before I posted here. So don't shot me down if its already asked.
I want to know in Python's len function.
len([o,1]) -> 2 # Right
But how come in the following
len([a,[b,[c]]]) -> 2 #How?
Shouldn't it be 3??
I know this could be a very trivial question. So again please be patient with it.
Thanks | 0 |
9,651,690 | 03/11/2012 01:34:01 | 731,221 | 04/29/2011 14:16:49 | 243 | 10 | print 1.41069562657e-25 as 1.41*10^-25 | Fairly new to python.
I have a variable
Sr = 2*grav*mass/c**2
it equates to
1.41069562657e-25
(and prints as such)
how do I print it in it's 'normal' form (1.41*10^-25) ?
| python | math | null | null | null | null | open | print 1.41069562657e-25 as 1.41*10^-25
===
Fairly new to python.
I have a variable
Sr = 2*grav*mass/c**2
it equates to
1.41069562657e-25
(and prints as such)
how do I print it in it's 'normal' form (1.41*10^-25) ?
| 0 |
61,217 | 09/14/2008 09:19:09 | 278 | 08/04/2008 11:28:54 | 78 | 7 | Getting HTML with webclient from a page behind a login | This question is a follow up to my [previous question][1] about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" using the webclient object:
WebClient ww = new WebClient();
ww.DownloadString("Login.aspx?UserName=&Password=");
string html = ww.DownloadString("Internal.aspx");
But I still get the login page all the time. I know that the username info is not stored in a cookie. I must be doing something wrong or leaving out an important part. Does anyone know what it could be?
[1]: http://stackoverflow.com/questions/56279/export-aspx-to-html
| asp.net | html | screen-scraping | null | null | null | open | Getting HTML with webclient from a page behind a login
===
This question is a follow up to my [previous question][1] about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" using the webclient object:
WebClient ww = new WebClient();
ww.DownloadString("Login.aspx?UserName=&Password=");
string html = ww.DownloadString("Internal.aspx");
But I still get the login page all the time. I know that the username info is not stored in a cookie. I must be doing something wrong or leaving out an important part. Does anyone know what it could be?
[1]: http://stackoverflow.com/questions/56279/export-aspx-to-html
| 0 |
61,219 | 09/14/2008 09:19:44 | 6,004 | 09/11/2008 22:28:45 | 11 | 3 | Debug.Assert vs. Specific Thrown Exceptions | I've just started skimming 'Debugging MS .Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...).
He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.:
Debug.Assert(i > 3, "i > 3", "This means I got a bad parameter");
Now, personally, it seems crazy to me that he so loves restating his test without an actual sensible 'business logic' comment, perhaps "i <= 3 must never happen because of the flobittyjam widgitification process".
So, I think I get Asserts as a kind-of low-level "Let's protect my assumptions" kind of thing... assuming that one feels this is a test one only needs to do in debug - i.e. you are protecting yourself against colleague and future programmers, and hoping that they actually test things.
But what I don't get is, he then goes on to say that you should use assertions in addition to normal error handling; now what I envisage is something like this:
Debug.Assert(i > 3, "i must be greater than 3 because of the flibbity widgit status");
if (i <= 3)
{
throw new ArgumentOutOfRangeException("i", "i must be > 3 because... i=" + i.ToString());
}
What have I gained by the Debug.Assert repetition of the error condition test? I think I'd get it if we were talking about debug-only double-checking of a very important calculation...
double interestAmount = loan.GetInterest();
Debug.Assert(debugInterestDoubleCheck(loan) == interestAmount, "Mismatch on interest calc");
...but I don't get it for parameter tests which are surely worth checking (in both DEBUG and Release builds)... or not. What am I missing?
| c# | exception-handling | assert | null | null | null | open | Debug.Assert vs. Specific Thrown Exceptions
===
I've just started skimming 'Debugging MS .Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...).
He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.:
Debug.Assert(i > 3, "i > 3", "This means I got a bad parameter");
Now, personally, it seems crazy to me that he so loves restating his test without an actual sensible 'business logic' comment, perhaps "i <= 3 must never happen because of the flobittyjam widgitification process".
So, I think I get Asserts as a kind-of low-level "Let's protect my assumptions" kind of thing... assuming that one feels this is a test one only needs to do in debug - i.e. you are protecting yourself against colleague and future programmers, and hoping that they actually test things.
But what I don't get is, he then goes on to say that you should use assertions in addition to normal error handling; now what I envisage is something like this:
Debug.Assert(i > 3, "i must be greater than 3 because of the flibbity widgit status");
if (i <= 3)
{
throw new ArgumentOutOfRangeException("i", "i must be > 3 because... i=" + i.ToString());
}
What have I gained by the Debug.Assert repetition of the error condition test? I think I'd get it if we were talking about debug-only double-checking of a very important calculation...
double interestAmount = loan.GetInterest();
Debug.Assert(debugInterestDoubleCheck(loan) == interestAmount, "Mismatch on interest calc");
...but I don't get it for parameter tests which are surely worth checking (in both DEBUG and Release builds)... or not. What am I missing?
| 0 |
61,227 | 09/14/2008 09:29:39 | 2,566 | 08/22/2008 22:30:40 | 73 | 9 | C variable and constant value comparison not matching | if i have a
signed char * p;
and i do a comparison
if( *p == 0xFF ) break;
it will never catch 0XFF, but if i replace to -1 it will...
if( *p == (signed char)0xFF ) break;
will catch ...
how come ? is it something with sign flag ?
i though that 0xFF == -1 == 255
| c | null | null | null | null | null | open | C variable and constant value comparison not matching
===
if i have a
signed char * p;
and i do a comparison
if( *p == 0xFF ) break;
it will never catch 0XFF, but if i replace to -1 it will...
if( *p == (signed char)0xFF ) break;
will catch ...
how come ? is it something with sign flag ?
i though that 0xFF == -1 == 255
| 0 |
61,233 | 09/14/2008 09:39:29 | 5,769 | 09/11/2008 10:36:07 | 1 | 0 | The Best Way to shred XML data into SQL Server database columns | What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so:
INSERT INTO some_table (column1, column2, column3)
SELECT
Rows.n.value('(@column1)[1]', 'varchar(20)'),
Rows.n.value('(@column2)[1]', 'nvarchar(100)'),
Rows.n.value('(@column3)[1]', 'int'),
FROM @xml.nodes('//Rows') Rows(n)
However I find that this is getting very slow for even moderate size xml data. | sql-server | xml | null | null | null | null | open | The Best Way to shred XML data into SQL Server database columns
===
What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so:
INSERT INTO some_table (column1, column2, column3)
SELECT
Rows.n.value('(@column1)[1]', 'varchar(20)'),
Rows.n.value('(@column2)[1]', 'nvarchar(100)'),
Rows.n.value('(@column3)[1]', 'int'),
FROM @xml.nodes('//Rows') Rows(n)
However I find that this is getting very slow for even moderate size xml data. | 0 |
61,240 | 09/14/2008 09:57:43 | 3,834 | 08/31/2008 06:25:52 | 90 | 13 | Free, WYSIWYG HTML editor that is Django template compatible | I'm interested to get a free, WYSIWYG HTML editor that is compatible with Django template. Any ideas? | html | django | null | null | null | null | open | Free, WYSIWYG HTML editor that is Django template compatible
===
I'm interested to get a free, WYSIWYG HTML editor that is compatible with Django template. Any ideas? | 0 |
61,250 | 09/14/2008 10:24:54 | 3,661 | 08/29/2008 18:16:14 | 184 | 6 | DIV's vs Tables or CSS vs. Being Stupid | I know that tables are for tabular data, but it's so tempting to use them for layout ... i can handle DIV's to get a three column layout, but when you got 4 nested DIV's, it get tricky.
Is there a tutorial/reference out there to persuade me to use DIV's for layout?
I want to use DIV's, but i refuse to spend an hour to position my DIV/SPAN where i want it. | css | layout | null | null | null | null | open | DIV's vs Tables or CSS vs. Being Stupid
===
I know that tables are for tabular data, but it's so tempting to use them for layout ... i can handle DIV's to get a three column layout, but when you got 4 nested DIV's, it get tricky.
Is there a tutorial/reference out there to persuade me to use DIV's for layout?
I want to use DIV's, but i refuse to spend an hour to position my DIV/SPAN where i want it. | 0 |
61,253 | 09/14/2008 10:37:55 | 699 | 08/07/2008 23:47:19 | 440 | 48 | How to be notified of file/directory change in C/C++, ideally using POSIX | The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Windows and Linux, but I use mac, so I thought posix may help?) | c++ | c | posix | null | null | null | open | How to be notified of file/directory change in C/C++, ideally using POSIX
===
The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Windows and Linux, but I use mac, so I thought posix may help?) | 0 |
61,256 | 09/14/2008 10:42:52 | 6,297 | 09/13/2008 19:43:14 | 1 | 0 | IIS uses proxy for webservice request. How to stop this? | I have a problem with a little .Net web application which uses the Amazon webservice. With the integrated Visual Studio web server everything works fine. But after deploying it to the IIS on the same computer i get the following error message:
Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach
einer bestimmten Zeitspanne nicht ordnungsgemäß reagiert hat, oder
die hergestellte Verbindung war fehlerhaft, da der verbundene Host
nicht reagiert hat 192.168.123.254:8080
Which roughly translates to "cant connect to 192.168.123.254:8080"
The computer is part of an Active Directory. The AD-Server was installed on a network which uses 192.168.123.254 as a proxy. Now it is not reachable and should not be used.
**How do I prevent the IIS from using a proxy?**
I think it has something to do with policy settings for the Internet Explorer. An "old" AD user has this setting, but a newly created user does not. I checked all the group policy settings and nowhere is a proxy defined.
The web server is running in the context of the anonymous internet user account on the local computer. Do local users get settings from the AD? If so how can I change that setting, if I cant login as this user?
What can I do, where else i could check? | asp.net | iis | proxy | webservice | null | null | open | IIS uses proxy for webservice request. How to stop this?
===
I have a problem with a little .Net web application which uses the Amazon webservice. With the integrated Visual Studio web server everything works fine. But after deploying it to the IIS on the same computer i get the following error message:
Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach
einer bestimmten Zeitspanne nicht ordnungsgemäß reagiert hat, oder
die hergestellte Verbindung war fehlerhaft, da der verbundene Host
nicht reagiert hat 192.168.123.254:8080
Which roughly translates to "cant connect to 192.168.123.254:8080"
The computer is part of an Active Directory. The AD-Server was installed on a network which uses 192.168.123.254 as a proxy. Now it is not reachable and should not be used.
**How do I prevent the IIS from using a proxy?**
I think it has something to do with policy settings for the Internet Explorer. An "old" AD user has this setting, but a newly created user does not. I checked all the group policy settings and nowhere is a proxy defined.
The web server is running in the context of the anonymous internet user account on the local computer. Do local users get settings from the AD? If so how can I change that setting, if I cant login as this user?
What can I do, where else i could check? | 0 |
61,262 | 09/14/2008 10:52:33 | 1,695 | 08/18/2008 02:49:06 | 1,230 | 82 | How do you resolve .Net namespace conflicts with the 'using' keyword ? | Here's the problem, you include multiple assemblies and add 'using namespaceX' at the top of your code file.
Now you want to create a class or use a symbol which is defined in multiple namespaces,
e.g. `System.Windows.Controls.Image` & `System.Drawing.Image`
Now unless you use the fully qualified name, there will be a crib/build error due to ambiguity inspite of the right 'using' declarations at the top. What is the way out here?
*(Another knowledge base post.. I found the answer after about 10 minutes of searching because I didn't know the right keyword to search for)* | .net | namespaces | using | null | null | null | open | How do you resolve .Net namespace conflicts with the 'using' keyword ?
===
Here's the problem, you include multiple assemblies and add 'using namespaceX' at the top of your code file.
Now you want to create a class or use a symbol which is defined in multiple namespaces,
e.g. `System.Windows.Controls.Image` & `System.Drawing.Image`
Now unless you use the fully qualified name, there will be a crib/build error due to ambiguity inspite of the right 'using' declarations at the top. What is the way out here?
*(Another knowledge base post.. I found the answer after about 10 minutes of searching because I didn't know the right keyword to search for)* | 0 |
61,272 | 09/14/2008 11:08:16 | 267 | 08/04/2008 10:11:06 | 3,499 | 172 | Breakpoints in core .NET runtime? | I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used.
Is there a way for me to put a breakpoint in the .NET library core itself? Specifically in the constructors of the SqlConnection class, so that I can look at the stack trace and see where it is actually being constructed?
Barring that, is there some other way I can do this?
Specifically, what I want to do is to tack on the *Application Name* parameter, so that our application is more easily identified on the server when looking at connections. | .net | runtime | sqlconnection | breakpoint | null | null | open | Breakpoints in core .NET runtime?
===
I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used.
Is there a way for me to put a breakpoint in the .NET library core itself? Specifically in the constructors of the SqlConnection class, so that I can look at the stack trace and see where it is actually being constructed?
Barring that, is there some other way I can do this?
Specifically, what I want to do is to tack on the *Application Name* parameter, so that our application is more easily identified on the server when looking at connections. | 0 |
61,278 | 09/14/2008 11:24:31 | 3,848 | 08/31/2008 11:24:27 | 78 | 11 | Quick and dirty way to profile your code | What method do you use when you want to get performance data about specific code paths? | c++ | performance | code-snippets | null | null | null | open | Quick and dirty way to profile your code
===
What method do you use when you want to get performance data about specific code paths? | 0 |
61,289 | 09/14/2008 11:54:51 | 6,143 | 09/12/2008 16:01:15 | 11 | 3 | Do you know a service like uservoice.com for bug reports? | Is there a service, similar to [uservoice.com][1] for bug reports?
It should
- very easy to use for normal, non-techie users
- be free
- be easily maintainable
[1]: http://www.uservoice.com | user | maintenance | null | null | null | null | open | Do you know a service like uservoice.com for bug reports?
===
Is there a service, similar to [uservoice.com][1] for bug reports?
It should
- very easy to use for normal, non-techie users
- be free
- be easily maintainable
[1]: http://www.uservoice.com | 0 |
61,311 | 09/14/2008 13:00:05 | 123 | 08/02/2008 08:01:26 | 1,987 | 107 | Web based service for Mangaing/Using Remote Computers.. | Are there any free web based service to manage/use your remote computers?
I use [Logmein][1] free. It solves the purpose. But wondering any other free services available.
Heard [Copilot][2] is great but not free!
[1]: https://secure.logmein.com/home.asp
[2]: https://www.copilot.com/ | remote-working | opensource | null | null | null | null | open | Web based service for Mangaing/Using Remote Computers..
===
Are there any free web based service to manage/use your remote computers?
I use [Logmein][1] free. It solves the purpose. But wondering any other free services available.
Heard [Copilot][2] is great but not free!
[1]: https://secure.logmein.com/home.asp
[2]: https://www.copilot.com/ | 0 |
61,317 | 09/14/2008 13:09:44 | 6,276 | 09/13/2008 14:11:05 | 13 | 2 | Learn Silverlight or WPF first? | It seems that Silverlight/WPF are the long term future for user interface development with .NET. This is great because as I can see the advantage of reusing XAML skills on both the client and web development sides. But looking at WPF/XAML/Silverlight they seem very large technologies and so where is the best place to get start?
I would like to hear from anyone who has good knowledge of both and can recommend which is a better starting point and why. | silverlight | wpf | null | null | null | null | open | Learn Silverlight or WPF first?
===
It seems that Silverlight/WPF are the long term future for user interface development with .NET. This is great because as I can see the advantage of reusing XAML skills on both the client and web development sides. But looking at WPF/XAML/Silverlight they seem very large technologies and so where is the best place to get start?
I would like to hear from anyone who has good knowledge of both and can recommend which is a better starting point and why. | 0 |
61,320 | 09/14/2008 13:14:58 | 3,408 | 08/28/2008 13:20:22 | 131 | 13 | SVN plugins for Eclipse - Subclipse vs. Subversive | SVN in Eclipse is spread into 2 camps. The SVN people have developed a plugin called [Subclipse][1]. The Eclipse people have a plugin called [Subversive][2]. Broadly speaking they both do the same things. What are the advantages and disadvantages of each?
[1]: http://subclipse.tigris.org/
[2]: http://www.eclipse.org/subversive/ | svn | eclipse | subclipse | subversive | null | null | open | SVN plugins for Eclipse - Subclipse vs. Subversive
===
SVN in Eclipse is spread into 2 camps. The SVN people have developed a plugin called [Subclipse][1]. The Eclipse people have a plugin called [Subversive][2]. Broadly speaking they both do the same things. What are the advantages and disadvantages of each?
[1]: http://subclipse.tigris.org/
[2]: http://www.eclipse.org/subversive/ | 0 |
61,341 | 09/14/2008 13:55:31 | 6,062 | 09/12/2008 07:20:39 | 31 | 5 | Is there a way to insert assembly code into C? | I remember back in the day with the old borland DOS compiler you could do something like this:
asm {
mov ax,ex
etc etc...
}
Is there a semi-platform independent way to do this now? I have a need to make a BIOS call, so if there was a way to do this without asm code, that would be equally useful to me. | c | asm | null | null | null | null | open | Is there a way to insert assembly code into C?
===
I remember back in the day with the old borland DOS compiler you could do something like this:
asm {
mov ax,ex
etc etc...
}
Is there a semi-platform independent way to do this now? I have a need to make a BIOS call, so if there was a way to do this without asm code, that would be equally useful to me. | 0 |
61,342 | 09/14/2008 13:56:14 | 2,566 | 08/22/2008 22:30:40 | 103 | 9 | Threads or asynch ? | How do you make your application multithreaded ?
Do you use asynch functions ?
or do you spawn a new thread ?
I think that asynch functions are already spawning a thread so if your job is doing just some file reading, being lazy and just spawning your job on a thread would just "waste" ressources...
So is there some kind of design when using thread or asynch functions ? | multithreading | null | null | null | null | null | open | Threads or asynch ?
===
How do you make your application multithreaded ?
Do you use asynch functions ?
or do you spawn a new thread ?
I think that asynch functions are already spawning a thread so if your job is doing just some file reading, being lazy and just spawning your job on a thread would just "waste" ressources...
So is there some kind of design when using thread or asynch functions ? | 0 |
61,346 | 09/14/2008 14:01:07 | 1,175 | 08/13/2008 10:21:54 | 2,115 | 138 | Can an iPhone App Be Run as Root? | I am thinking about the design of an iPhone app I'd like to create. One possible problem is that this application will have to run as root (to access certain network ports). In a typical UNIX app, I'd just get the app to run with setuid, but I'm wondering if that is possible with an iPhone app.
I've read this question in Apple's forum, which is discouraging:
http://discussions.apple.com/thread.jspa?threadID=1664575
I'm sure I could get around this on a jail-broken iPhone, but that's not what I'm after. Is there any way to run an app under the root account on an unbroken iPhone?
(BTW, there is no need to warn me about the NDA.) | iphone | setuid | permissions | null | null | null | open | Can an iPhone App Be Run as Root?
===
I am thinking about the design of an iPhone app I'd like to create. One possible problem is that this application will have to run as root (to access certain network ports). In a typical UNIX app, I'd just get the app to run with setuid, but I'm wondering if that is possible with an iPhone app.
I've read this question in Apple's forum, which is discouraging:
http://discussions.apple.com/thread.jspa?threadID=1664575
I'm sure I could get around this on a jail-broken iPhone, but that's not what I'm after. Is there any way to run an app under the root account on an unbroken iPhone?
(BTW, there is no need to warn me about the NDA.) | 0 |
61,354 | 09/14/2008 14:08:15 | 5,422 | 09/09/2008 14:02:21 | 131 | 11 | How to get entire chain of Exceptions in Application.ThreadException event handler? | I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with [Application.ThreadException][1].
What I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these exceptions on 'fatality', e.g. with some types of Exceptions the application should keep running and with others it should exit.
In another .NET 2.0 app I learned that, by default, only in debug mode the exceptions actually leave an Application.Run or Application.DoEvents call. In release mode this does not happen, and the exceptions have to be 'caught' using the Application.ThreadException event.
Now, however, I noticed that the exception object passed in the ThreadExceptionEventArgs of the Application.ThreadException event is always the innermost exception in the exception chain. For logging/debugging/design purposes I really want the entire chain of exceptions though. It isn't easy to determine what external system failed for example when you just get to handle a SocketException: when it's wrapped as e.g. a NpgsqlException, then at least you know it's a database problem.
So, how to get to the entire chain of exceptions from this event? Is it even possible or do I need to design my excepion handling in another way?
Note that I do -sort of- have a workaround using [Application.SetUnhandledExceptionMode][2], but this is far from ideal because I'd have to roll my own message loop.
[1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx
[2]: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.setunhandledexceptionmode.aspx | .net | winforms | exception | null | null | null | open | How to get entire chain of Exceptions in Application.ThreadException event handler?
===
I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with [Application.ThreadException][1].
What I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these exceptions on 'fatality', e.g. with some types of Exceptions the application should keep running and with others it should exit.
In another .NET 2.0 app I learned that, by default, only in debug mode the exceptions actually leave an Application.Run or Application.DoEvents call. In release mode this does not happen, and the exceptions have to be 'caught' using the Application.ThreadException event.
Now, however, I noticed that the exception object passed in the ThreadExceptionEventArgs of the Application.ThreadException event is always the innermost exception in the exception chain. For logging/debugging/design purposes I really want the entire chain of exceptions though. It isn't easy to determine what external system failed for example when you just get to handle a SocketException: when it's wrapped as e.g. a NpgsqlException, then at least you know it's a database problem.
So, how to get to the entire chain of exceptions from this event? Is it even possible or do I need to design my excepion handling in another way?
Note that I do -sort of- have a workaround using [Application.SetUnhandledExceptionMode][2], but this is far from ideal because I'd have to roll my own message loop.
[1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx
[2]: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.setunhandledexceptionmode.aspx | 0 |
61,357 | 09/14/2008 14:14:20 | 1,122 | 08/12/2008 14:00:43 | 852 | 80 | Using CSS how best to display name value pairs? | Should I still be using tables anyway?
The table code I'd be replacing is:
<table>
<tr>
<td>Name</td><td>Value</td>
</tr>
...
</table>
From what I've been reading I should have something like
<label class="name">Name</label><label class="value">Value</value><br />
...
Ideas and links to online samples greatly appreciated. I'm a developer way out of my design depth. | html | css | howto | tips-and-tricks | null | null | open | Using CSS how best to display name value pairs?
===
Should I still be using tables anyway?
The table code I'd be replacing is:
<table>
<tr>
<td>Name</td><td>Value</td>
</tr>
...
</table>
From what I've been reading I should have something like
<label class="name">Name</label><label class="value">Value</value><br />
...
Ideas and links to online samples greatly appreciated. I'm a developer way out of my design depth. | 0 |
61,366 | 09/14/2008 14:23:15 | 5,422 | 09/09/2008 14:02:21 | 131 | 11 | Rolling your own message loop, any pitfalls? | This question is slightly related to [this question about exception handling][1]. The workaround I found there consists of rolling my own message loop.
So my Main method now looks basically like this:
[STAThread]
static void Main() {
// this is needed so there'll actually an exception be thrown by
// Application.Run/Application.DoEvents, instead of the ThreadException
// event being raised.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form form = new MainForm();
form.Show();
// the loop is here to keep app running if non-fatal exception is caught.
do {
try {
Application.DoEvents();
Thread.Sleep(100);
}
catch (Exception ex) {
ExceptionHandler.ConsumeException(ex);
}
}
while (!form.IsDisposed);
}
What I'm wondering though, is this a safe/decent way to replace the more typical
'Application.Run(new MainForm());', whether it's used for exception handling or for whatever else, or should I always stick to using Application.Run?
On another app that's in testing now a similar approach is used for both loading (splashscreen) and exception handling, and I don't think it has caused any troubles (yet :-))
[1]: http://stackoverflow.com/questions/61354/how-to-get-entire-chain-of-exceptions-in-applicationthreadexception-event-handl | .net | winforms | null | null | null | null | open | Rolling your own message loop, any pitfalls?
===
This question is slightly related to [this question about exception handling][1]. The workaround I found there consists of rolling my own message loop.
So my Main method now looks basically like this:
[STAThread]
static void Main() {
// this is needed so there'll actually an exception be thrown by
// Application.Run/Application.DoEvents, instead of the ThreadException
// event being raised.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form form = new MainForm();
form.Show();
// the loop is here to keep app running if non-fatal exception is caught.
do {
try {
Application.DoEvents();
Thread.Sleep(100);
}
catch (Exception ex) {
ExceptionHandler.ConsumeException(ex);
}
}
while (!form.IsDisposed);
}
What I'm wondering though, is this a safe/decent way to replace the more typical
'Application.Run(new MainForm());', whether it's used for exception handling or for whatever else, or should I always stick to using Application.Run?
On another app that's in testing now a similar approach is used for both loading (splashscreen) and exception handling, and I don't think it has caused any troubles (yet :-))
[1]: http://stackoverflow.com/questions/61354/how-to-get-entire-chain-of-exceptions-in-applicationthreadexception-event-handl | 0 |
61,372 | 09/14/2008 14:26:50 | 3,764 | 08/30/2008 16:14:55 | 86 | 4 | How can I create a loop in an onClick event? | I want to write an onClick event which submits a form several times, iterating through selected items in a multi-select field, submitting once for each.
**How do I code the loop?**
I'm working in Ruby on Rails and using **remote_function()** to generate the javascript for the ajax call. | javascript | ruby | ruby-on-rails | ajax | loops | null | open | How can I create a loop in an onClick event?
===
I want to write an onClick event which submits a form several times, iterating through selected items in a multi-select field, submitting once for each.
**How do I code the loop?**
I'm working in Ruby on Rails and using **remote_function()** to generate the javascript for the ajax call. | 0 |
61,383 | 09/14/2008 14:41:11 | 2,884 | 08/25/2008 17:51:51 | 138 | 7 | Is there a good admin generator for Ruby on Rails? | My current project is in Rails. Coming from a Symfony (PHP) and Django (Python) background, they both have excellent admin generators. Seems like this is missing in Rails.
For those who aren't familiar with Symfony or Django, they both allow you to specify some metadata around your models to automatically (dynamically) generate an admin interface to do the common CRUD operations. You can create an entire Intranet with only a few commands or lines of code. They have a good appearance and are extensible enough for 99% of your admin needs.
I've looked for something similar for Rails, but all of the projects either have no activity or they died long ago. Is there anything to generate an intranet/admin site for a rails app other than scaffolding? | ruby | ruby-on-rails | null | null | null | null | open | Is there a good admin generator for Ruby on Rails?
===
My current project is in Rails. Coming from a Symfony (PHP) and Django (Python) background, they both have excellent admin generators. Seems like this is missing in Rails.
For those who aren't familiar with Symfony or Django, they both allow you to specify some metadata around your models to automatically (dynamically) generate an admin interface to do the common CRUD operations. You can create an entire Intranet with only a few commands or lines of code. They have a good appearance and are extensible enough for 99% of your admin needs.
I've looked for something similar for Rails, but all of the projects either have no activity or they died long ago. Is there anything to generate an intranet/admin site for a rails app other than scaffolding? | 0 |
61,386 | 09/14/2008 14:50:10 | 5,147 | 09/08/2008 07:23:50 | 131 | 13 | Is knowing blend required? | Do you expect your WPF developers to know expression blend?
Any good resources for learning more about Blend? | wpf | expression | blend | null | null | null | open | Is knowing blend required?
===
Do you expect your WPF developers to know expression blend?
Any good resources for learning more about Blend? | 0 |
61,399 | 09/14/2008 15:18:32 | 3,742 | 08/30/2008 14:08:11 | 158 | 19 | Enhancing the web user experience for the vision impaired | I was listening to a [recent episode of Hanselminutes][1] where Scott Hanselman was discussing accessibility in web applications and it got me thinking about accessibility in my own applications.
We all understand the importance of semantic markup in our web applications as it relates to accessibility but what about other simple enhancements that can be made to improve the user experience for disabled users?
In the episode, there were a number of times where I slapped my forehead and said "Of course! Why haven't I done that?" In particular, Scott talked about a website that placed a hidden link at the top of a web page that said "skip to main content". The link will only be visible to people using screen readers and it allows their screen reader to jump past menus and other secondary content. It's such an obvious improvement yet it's easy not to think of it.
There is more to accessibility and the overall user experience than simply creating valid XHTML and calling it a day.
What are some of your simple tricks for improving the user experience for the vision impaired?
[1]: http://www.hanselminutes.com/default.aspx?showID=143 | accessibility | section508 | null | null | null | null | open | Enhancing the web user experience for the vision impaired
===
I was listening to a [recent episode of Hanselminutes][1] where Scott Hanselman was discussing accessibility in web applications and it got me thinking about accessibility in my own applications.
We all understand the importance of semantic markup in our web applications as it relates to accessibility but what about other simple enhancements that can be made to improve the user experience for disabled users?
In the episode, there were a number of times where I slapped my forehead and said "Of course! Why haven't I done that?" In particular, Scott talked about a website that placed a hidden link at the top of a web page that said "skip to main content". The link will only be visible to people using screen readers and it allows their screen reader to jump past menus and other secondary content. It's such an obvious improvement yet it's easy not to think of it.
There is more to accessibility and the overall user experience than simply creating valid XHTML and calling it a day.
What are some of your simple tricks for improving the user experience for the vision impaired?
[1]: http://www.hanselminutes.com/default.aspx?showID=143 | 0 |
61,400 | 09/14/2008 15:20:44 | 3,713 | 08/30/2008 09:06:27 | 173 | 25 | What Makes a Good Unit Test? | I'm sure most of you Stackoverflowians are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. My question is if you follow any test rules in order to avoid problems in the future. What are the properties of good unit tests or how do you write your tests?
Language agnostic suggestions are encouraged. | language-agnostic | unit-testing | integration-testing | testing-strategies | null | 10/07/2011 13:02:25 | not constructive | What Makes a Good Unit Test?
===
I'm sure most of you Stackoverflowians are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. My question is if you follow any test rules in order to avoid problems in the future. What are the properties of good unit tests or how do you write your tests?
Language agnostic suggestions are encouraged. | 4 |
61,402 | 09/14/2008 15:21:34 | 3,153 | 08/27/2008 02:45:05 | 1,255 | 49 | C++ Exception code lookup | Knowing an exception code, is there a way to find out more about what the actual exception that was thrown means?
My exception in question:
0x64487347
Exception address: 0x1
The call stack shows no information.
I'm reviewing a .dmp of a crash and not actually debugging in Visual Studio. | c++ | exception | visual-c++ | crash | memory-dump | null | open | C++ Exception code lookup
===
Knowing an exception code, is there a way to find out more about what the actual exception that was thrown means?
My exception in question:
0x64487347
Exception address: 0x1
The call stack shows no information.
I'm reviewing a .dmp of a crash and not actually debugging in Visual Studio. | 0 |
61,405 | 09/14/2008 15:26:19 | 1,585 | 08/16/2008 21:03:55 | 367 | 22 | How do I make a subproject with Qt? | I'm about to start on a large Qt application, which is made up of smaller components (groups of classes that work together). For example, there might be a dialog that is used in the project, but should be developed on its own before being integrated into the project. Instead of working on it in another folder somewhere and then copying it into the main project folder, can I create a sub-folder which is dedicated to that dialog, and then somehow incorporate it into the main project? | project-management | qt | null | null | null | null | open | How do I make a subproject with Qt?
===
I'm about to start on a large Qt application, which is made up of smaller components (groups of classes that work together). For example, there might be a dialog that is used in the project, but should be developed on its own before being integrated into the project. Instead of working on it in another folder somewhere and then copying it into the main project folder, can I create a sub-folder which is dedicated to that dialog, and then somehow incorporate it into the main project? | 0 |
61,418 | 09/14/2008 15:40:38 | 267 | 08/04/2008 10:11:06 | 3,499 | 173 | How to disable a warning in Delphi about "return value ... might be undefined"? | I have a function that gives me the following warning:
[DCC Warning] filename.pas(6939): W1035 Return value of function 'function' might be undefined
The function, however, is clean, small, and does have a known, expected, return value. The first statement in the function is:
Result := '';
and there is no local variable or parameter called Result either.
Is there any kind of pragma-like directive I can surround this method with to remove this warning? This is Delphi 2007.
Unfortunately, the help system on this Delphi installation is shot, so I can't pop up the help for that warning right now.
Anyone know off the top of their head what I can do? | delphi | warning | directive | null | null | null | open | How to disable a warning in Delphi about "return value ... might be undefined"?
===
I have a function that gives me the following warning:
[DCC Warning] filename.pas(6939): W1035 Return value of function 'function' might be undefined
The function, however, is clean, small, and does have a known, expected, return value. The first statement in the function is:
Result := '';
and there is no local variable or parameter called Result either.
Is there any kind of pragma-like directive I can surround this method with to remove this warning? This is Delphi 2007.
Unfortunately, the help system on this Delphi installation is shot, so I can't pop up the help for that warning right now.
Anyone know off the top of their head what I can do? | 0 |
61,421 | 09/14/2008 15:43:14 | 2,547 | 08/22/2008 19:10:02 | 1,018 | 49 | How do I make a ListBox refresh its item text? | I'm making an example for someone who hasn't yet realized that controls like <code>ListBox</code> don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the <code>ListBox</code> and I'd like to show him there's a better way.
I noticed that if I have an object stored in the <code>ListBox</code> then update a value that affects <code>ToString</code>, the <code>ListBox</code> does not update itself. I've tried calling <code>Refresh</code> and <code>Update</code> on the control, but neither works. Here's the code of the example I'm using, it requires you to drag a listbox and a button onto the form:
<pre><code>Public Class Form1
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
For i As Integer = 1 To 3
Dim tempInfo As New NumberInfo()
tempInfo.Count = i
tempInfo.Number = i * 100
ListBox1.Items.Add(tempInfo)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each objItem As Object In ListBox1.Items
Dim info As NumberInfo = DirectCast(objItem, NumberInfo)
info.Count += 1
Next
End Sub
End Class
Public Class NumberInfo
Public Count As Integer
Public Number As Integer
Public Overrides Function ToString() As String
Return String.Format("{0}, {1}", Count, Number)
End Function
End Class</code></pre>
I thought that perhaps the problem was using fields and tried implementing *INotifyPropertyChanged*, but this had no effect. (The reason I'm using fields is because it's an example and I don't feel like adding a few dozen lines that have nothing to do with the topic I'm demonstrating.)
Honestly I've never tried updating items in place like this before; in the past I've always been adding/removing items, not editing them. So I've never noticed that I don't know how to make this work.
So what am I missing?
| .net | winforms | gui | null | null | null | open | How do I make a ListBox refresh its item text?
===
I'm making an example for someone who hasn't yet realized that controls like <code>ListBox</code> don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the <code>ListBox</code> and I'd like to show him there's a better way.
I noticed that if I have an object stored in the <code>ListBox</code> then update a value that affects <code>ToString</code>, the <code>ListBox</code> does not update itself. I've tried calling <code>Refresh</code> and <code>Update</code> on the control, but neither works. Here's the code of the example I'm using, it requires you to drag a listbox and a button onto the form:
<pre><code>Public Class Form1
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
For i As Integer = 1 To 3
Dim tempInfo As New NumberInfo()
tempInfo.Count = i
tempInfo.Number = i * 100
ListBox1.Items.Add(tempInfo)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each objItem As Object In ListBox1.Items
Dim info As NumberInfo = DirectCast(objItem, NumberInfo)
info.Count += 1
Next
End Sub
End Class
Public Class NumberInfo
Public Count As Integer
Public Number As Integer
Public Overrides Function ToString() As String
Return String.Format("{0}, {1}", Count, Number)
End Function
End Class</code></pre>
I thought that perhaps the problem was using fields and tried implementing *INotifyPropertyChanged*, but this had no effect. (The reason I'm using fields is because it's an example and I don't feel like adding a few dozen lines that have nothing to do with the topic I'm demonstrating.)
Honestly I've never tried updating items in place like this before; in the past I've always been adding/removing items, not editing them. So I've never noticed that I don't know how to make this work.
So what am I missing?
| 0 |
61,432 | 09/14/2008 16:04:48 | 4,262 | 09/02/2008 14:54:42 | 129 | 8 | Tool for deciphering Spreadsheets? | I recently had a multipage Excel spreadsheet/workbook dumped in my lap. Are there any tools to aid in deciphering spreadsheets? At the moment I click in a little cell to see what's there, then I click in some other little cell that it references, then I click in 3 other cells that it uses and fairly quickly I'm lost in a maze of twisty little cells, all alike.
I need to extract the "business logic" from the sheets in some hopefully non-laborious manner. | spreadsheet | null | null | null | null | null | open | Tool for deciphering Spreadsheets?
===
I recently had a multipage Excel spreadsheet/workbook dumped in my lap. Are there any tools to aid in deciphering spreadsheets? At the moment I click in a little cell to see what's there, then I click in some other little cell that it references, then I click in 3 other cells that it uses and fairly quickly I'm lost in a maze of twisty little cells, all alike.
I need to extract the "business logic" from the sheets in some hopefully non-laborious manner. | 0 |
61,437 | 09/14/2008 16:18:52 | 5,469 | 09/09/2008 21:03:22 | 541 | 28 | What are some viable alternatives to BizTalk Server? | In evaluating different systems integration strategies, I've come across some words of encouragement, but also some words of frustration over BizTalk Server.
What are some pros and cons to using BizTalk Server (both from a developer standpoint and a business user), and should companies also consider open source alternatives? What viable alternatives are out there? | biztalk | opinion | open-source | null | null | null | open | What are some viable alternatives to BizTalk Server?
===
In evaluating different systems integration strategies, I've come across some words of encouragement, but also some words of frustration over BizTalk Server.
What are some pros and cons to using BizTalk Server (both from a developer standpoint and a business user), and should companies also consider open source alternatives? What viable alternatives are out there? | 0 |
61,443 | 09/14/2008 16:23:22 | 445,087 | 09/02/2008 17:25:48 | 501 | 17 | Rollover safe timer (tick) comparisons | I have a counter in hardware that I can observe for timing considerations. It counts miliseconds and is stored in a 16 bit unsigned value. How do I safely check if a timer value has passed a certain time and safely handle the inevitable rollover:
//this is a bit contrived, but it illustrates what I'm trying to do
const uint16_t print_interval = 5000; // milliseconds
static uint16_t last_print_time;
if(ms_timer() - last_print_time > print_interval)
{
printf("Fault!\n");
last_print_time = ms_timer();
}
This code will fail when ms_timer overflows to 0. | c++ | c | timer | rollover | null | null | open | Rollover safe timer (tick) comparisons
===
I have a counter in hardware that I can observe for timing considerations. It counts miliseconds and is stored in a 16 bit unsigned value. How do I safely check if a timer value has passed a certain time and safely handle the inevitable rollover:
//this is a bit contrived, but it illustrates what I'm trying to do
const uint16_t print_interval = 5000; // milliseconds
static uint16_t last_print_time;
if(ms_timer() - last_print_time > print_interval)
{
printf("Fault!\n");
last_print_time = ms_timer();
}
This code will fail when ms_timer overflows to 0. | 0 |
61,446 | 09/14/2008 16:27:21 | 4,279 | 09/02/2008 16:10:17 | 545 | 40 | What is the best code template facility for Emacs? | Particularly, what is the best snippets package out there?
Features:
* easy to define new snippets (plain text, custom input with defaults)
* simple navigation between predefined positions in the snippet
* multiple insertion of the same custom input
* accepts current selected text as a custom input
* *cross-platform* (Windows, Linux)
* dynamically evaluated expressions (embedded code) written in a concise programming language (Perl, Python, Ruby are preferred)
* nicely coexists with others packages in Emacs
Example of code template, a simple `for` loop in C:
for (int i = 0; i < %N%; ++i) {
_
}
It is a lot of typing for such common code. I want to invoke a code template or snippet which inserts
that boilerplate code for me. Additionally it stops (on TAB or other keystroke) at `%N%` (my input replaces it) and final position of the cursor is `_`.
| emacs | code-snippets | template-engine | null | null | null | open | What is the best code template facility for Emacs?
===
Particularly, what is the best snippets package out there?
Features:
* easy to define new snippets (plain text, custom input with defaults)
* simple navigation between predefined positions in the snippet
* multiple insertion of the same custom input
* accepts current selected text as a custom input
* *cross-platform* (Windows, Linux)
* dynamically evaluated expressions (embedded code) written in a concise programming language (Perl, Python, Ruby are preferred)
* nicely coexists with others packages in Emacs
Example of code template, a simple `for` loop in C:
for (int i = 0; i < %N%; ++i) {
_
}
It is a lot of typing for such common code. I want to invoke a code template or snippet which inserts
that boilerplate code for me. Additionally it stops (on TAB or other keystroke) at `%N%` (my input replaces it) and final position of the cursor is `_`.
| 0 |
61,449 | 09/14/2008 16:32:18 | 1,450 | 08/15/2008 16:26:21 | 1,257 | 53 | How Do I Access The Host From VMware Fusion? | I've just created a new Windows XP VM on my Mac using VMware Fusion. The VM is using NAT to share the host's Internet connection.
How do I access a Rails application, which is accessible on the Mac itself using http://localhost:3000? | rails | networking | vmware | null | null | null | open | How Do I Access The Host From VMware Fusion?
===
I've just created a new Windows XP VM on my Mac using VMware Fusion. The VM is using NAT to share the host's Internet connection.
How do I access a Rails application, which is accessible on the Mac itself using http://localhost:3000? | 0 |
61,451 | 09/14/2008 16:37:32 | 796 | 08/09/2008 02:12:46 | 125 | 11 | Does Django have HTML helpers? | Does Django have any template tags to generate common HTML markup? For example, I know that I can get a url using
{% url mapper.views.foo %}
But that only gives me the URL and not the HTML code to create the link. Does Django have anything similar to Rails' link_to helper? I found [django-helpers][1] but since this is a common thing I thought Django would have something built-in.
[1]: http://code.google.com/p/django-helpers/ | django | null | null | null | null | null | open | Does Django have HTML helpers?
===
Does Django have any template tags to generate common HTML markup? For example, I know that I can get a url using
{% url mapper.views.foo %}
But that only gives me the URL and not the HTML code to create the link. Does Django have anything similar to Rails' link_to helper? I found [django-helpers][1] but since this is a common thing I thought Django would have something built-in.
[1]: http://code.google.com/p/django-helpers/ | 0 |
61,453 | 09/14/2008 16:38:38 | 6,300 | 09/13/2008 20:05:47 | 11 | 2 | Accessing Firefox cache from an XPCOM component | Does anybody know how to get local path of file cached by Firefox based on its URL from an XPCOM component? | c++ | firefox | gecko | xpcom | null | null | open | Accessing Firefox cache from an XPCOM component
===
Does anybody know how to get local path of file cached by Firefox based on its URL from an XPCOM component? | 0 |
61,456 | 09/14/2008 16:43:56 | 230 | 08/03/2008 19:32:46 | 652 | 38 | MVC.net JQuery Validation | After trying to avoid JavaScript for years, Iv started using JQuery for [validation][1] in MVC asp.net, as there does not seem to be an official way of doing validation, Iv been surprised how good JQuery is.
Firstly is there a way to get intellisense working for JQuery and its validation plugin, so that i don have to learn the api?
Secondly how do I create a validation summary for this, it currently appends the error to the right of the text box.:
<script type="text/javascript">
$().ready(function() {
$("#CreateLog").validate({
rules: {
UserName: {
required: true,
minLength: 2,
}
},
messages: {
UserName: {
required: "Please enter a username",
minLength: "Your username must consist of at least 2 characters",
}
}
});
});
</script>
<form id="CreateLog" action="Create" method="post" />
<label>UserName</label><br />
<%=Html.TextBox("UserName")%>
<br />
<div class="error"> </div>
<input type=submit value=Save />
</form>
I tried adding this to the script:
errorLabelContainer: $("#CreateLog div.error")
and this to the html:
<div class="error"> </div>
But this didn't work.
[1]: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ | jquery | validation | asp.net-mvc | null | null | null | open | MVC.net JQuery Validation
===
After trying to avoid JavaScript for years, Iv started using JQuery for [validation][1] in MVC asp.net, as there does not seem to be an official way of doing validation, Iv been surprised how good JQuery is.
Firstly is there a way to get intellisense working for JQuery and its validation plugin, so that i don have to learn the api?
Secondly how do I create a validation summary for this, it currently appends the error to the right of the text box.:
<script type="text/javascript">
$().ready(function() {
$("#CreateLog").validate({
rules: {
UserName: {
required: true,
minLength: 2,
}
},
messages: {
UserName: {
required: "Please enter a username",
minLength: "Your username must consist of at least 2 characters",
}
}
});
});
</script>
<form id="CreateLog" action="Create" method="post" />
<label>UserName</label><br />
<%=Html.TextBox("UserName")%>
<br />
<div class="error"> </div>
<input type=submit value=Save />
</form>
I tried adding this to the script:
errorLabelContainer: $("#CreateLog div.error")
and this to the html:
<div class="error"> </div>
But this didn't work.
[1]: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ | 0 |
61,470 | 09/14/2008 17:09:54 | 5,992 | 09/11/2008 21:29:03 | 1 | 0 | Which text editor has the most useful autocomplete for web page editing? | Which text editor has the most useful autocomplete for text editing?
That is, when you type a tag like <p>, the editor will automatically add </p> and put the cursor after the first tag. It should also display a context sensitive list of valid tags when you press CTRL+Space (or similar hotkey)
I've been using Notepad++. I avoid Visual Studio because of the bloat. I installed [Aptana Studio](http://www.aptana.com/studio) yesterday and it looks interesting.
What's your experience? What text editor have you used that has HTML, CSS and JavaScript autocomplete features that help you write web pages quickly? | javascript | html | css | autocomplete | text-editor | null | open | Which text editor has the most useful autocomplete for web page editing?
===
Which text editor has the most useful autocomplete for text editing?
That is, when you type a tag like <p>, the editor will automatically add </p> and put the cursor after the first tag. It should also display a context sensitive list of valid tags when you press CTRL+Space (or similar hotkey)
I've been using Notepad++. I avoid Visual Studio because of the bloat. I installed [Aptana Studio](http://www.aptana.com/studio) yesterday and it looks interesting.
What's your experience? What text editor have you used that has HTML, CSS and JavaScript autocomplete features that help you write web pages quickly? | 0 |
61,480 | 09/14/2008 17:19:53 | 1,368 | 08/14/2008 18:57:47 | 294 | 11 | Class definition, using { get; set;} | In the past we declared classses like:
public class MyClass
{
private int _age;
public int Age
{
get{ return _age; }
set{ _age = value; }
}
}
Now we can do:
public class MyClass
{
public int Age {get; set;}
}
My question is, how can I access the private variable that is created automatically using this notation?
I would rather access the private variable and not the public accessor 'Age' ? Is there a default notation to access the private variable, or it is just not possible? | c# | classes | null | null | null | null | open | Class definition, using { get; set;}
===
In the past we declared classses like:
public class MyClass
{
private int _age;
public int Age
{
get{ return _age; }
set{ _age = value; }
}
}
Now we can do:
public class MyClass
{
public int Age {get; set;}
}
My question is, how can I access the private variable that is created automatically using this notation?
I would rather access the private variable and not the public accessor 'Age' ? Is there a default notation to access the private variable, or it is just not possible? | 0 |
61,486 | 09/14/2008 17:27:28 | 648 | 08/07/2008 13:22:00 | 562 | 38 | [jQuery] Figure out div that is visible out of four divs. | I need to figure out what div is visible out of four possible divs using jQuery. Only one of those div's will be visible at any given time.
This is what I have that works so far:
$("#FeatureImage1:visible, #FeatureImage2:visible, #FeatureImage3:visible, #FeatureImage4:visible").attr("id");
Is there a way to refactor this? Is there an easier way to figure this out?
Thanks | jquery | dom | selectors | null | null | null | open | [jQuery] Figure out div that is visible out of four divs.
===
I need to figure out what div is visible out of four possible divs using jQuery. Only one of those div's will be visible at any given time.
This is what I have that works so far:
$("#FeatureImage1:visible, #FeatureImage2:visible, #FeatureImage3:visible, #FeatureImage4:visible").attr("id");
Is there a way to refactor this? Is there an easier way to figure this out?
Thanks | 0 |
61,487 | 09/14/2008 17:28:29 | 3,055 | 08/26/2008 13:54:44 | 786 | 65 | Do you use UML in Agile development practices? | It feels like an artifacts of an earlier days, but UML sure does have its use. However, agile processes like Extreme Programming advocates "embracing changes", does that also means I should make less documents and UML models as well? Since they gives the impression of setting something in stone.
Where does UML belongs in an Agile development practice? Other than the preliminary spec documents, should I use it at all? | uml | documentation | agile | null | null | null | open | Do you use UML in Agile development practices?
===
It feels like an artifacts of an earlier days, but UML sure does have its use. However, agile processes like Extreme Programming advocates "embracing changes", does that also means I should make less documents and UML models as well? Since they gives the impression of setting something in stone.
Where does UML belongs in an Agile development practice? Other than the preliminary spec documents, should I use it at all? | 0 |
61,499 | 09/14/2008 17:43:47 | 2,566 | 08/22/2008 22:30:40 | 120 | 9 | making portable code | with all the fuss about opensource projects, how come there is still not a strong standard that enables you to make portable code (i mean in C/C++ not java or c#)
everyone is kind of making it's own soup.
there are even some third party libs like Apache Portable Runtime. | c++ | c | portability | null | null | null | open | making portable code
===
with all the fuss about opensource projects, how come there is still not a strong standard that enables you to make portable code (i mean in C/C++ not java or c#)
everyone is kind of making it's own soup.
there are even some third party libs like Apache Portable Runtime. | 0 |
9,750,154 | 03/17/2012 12:54:46 | 905,322 | 08/22/2011 06:15:10 | 184 | 4 | strange text in gmail inbox - php issue? | I have a mailer code which worked fine until a couple days when the received email instead of normal email came as a code to Gmail... like that:
--PHP-mixed-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: multipart/alternative; boundary="PHP-alt-a3bf01bb0d28e41880e43720dfc8860d"
--PHP-alt-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Type here...
--PHP-alt-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<div style="width:900px"><br /><p>
Type here...</p>
--PHP-alt-a3bf01bb0d28e41880e43720dfc8860d--
--PHP-mixed-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: ; name=""
Content-Transfer-Encoding: base64
Content-Disposition: attachment
--PHP-mixed-a3bf01bb0d28e41880e43720dfc8860d--
any idea where to start to track it back. As far as I know I haven't chaned anything on the code at all.
Dummy question but I have no idea where to start... any comment would be welcome and I am willing to learn. Thank you for your time... | php | email | gmail | null | null | null | open | strange text in gmail inbox - php issue?
===
I have a mailer code which worked fine until a couple days when the received email instead of normal email came as a code to Gmail... like that:
--PHP-mixed-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: multipart/alternative; boundary="PHP-alt-a3bf01bb0d28e41880e43720dfc8860d"
--PHP-alt-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Type here...
--PHP-alt-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<div style="width:900px"><br /><p>
Type here...</p>
--PHP-alt-a3bf01bb0d28e41880e43720dfc8860d--
--PHP-mixed-a3bf01bb0d28e41880e43720dfc8860d
Content-Type: ; name=""
Content-Transfer-Encoding: base64
Content-Disposition: attachment
--PHP-mixed-a3bf01bb0d28e41880e43720dfc8860d--
any idea where to start to track it back. As far as I know I haven't chaned anything on the code at all.
Dummy question but I have no idea where to start... any comment would be welcome and I am willing to learn. Thank you for your time... | 0 |
9,750,155 | 03/17/2012 12:54:50 | 1,259,620 | 03/09/2012 15:31:24 | 1 | 0 | Want to create a Restful web service in C Sharp using WCF 4.0 for android client | i want to create a Restful web service in C Sharp using WCF 4.0 for android client. In my webs ervice i need to communicate with my database and sen XML or JSON to client. How can i achieve that? | wcf | null | null | null | null | null | open | Want to create a Restful web service in C Sharp using WCF 4.0 for android client
===
i want to create a Restful web service in C Sharp using WCF 4.0 for android client. In my webs ervice i need to communicate with my database and sen XML or JSON to client. How can i achieve that? | 0 |
9,750,160 | 03/17/2012 12:55:31 | 531,321 | 12/05/2010 16:46:22 | 1,401 | 69 | (#100) The Action Type <type:action>is not approved, so app <app-id>can only publish to administrators, developers, and testers of the app | I am in development mode of a facebook app. I have two users for my app: myself as admin and other as tester. I am using GRAPH API explorer to publish a sample custom action. It is always giving following error for both users. I have made sure that I use right permissions and pass right parameters.
{ "error": { "message": "(#100) The Action Type searchmates:Need is not approved, so app <appid> can only publish to administrators, developers, and testers of the app. User <userid> is not one of those roles.", "type": "OAuthException", "code": 100 }}
I raised a bug also on facebook: [Defect raised][1]. So far no luck. Please help how to proceed.
[1]: https://developers.facebook.com/bugs/171332866318848 | facebook-graph-api | null | null | null | null | null | open | (#100) The Action Type <type:action>is not approved, so app <app-id>can only publish to administrators, developers, and testers of the app
===
I am in development mode of a facebook app. I have two users for my app: myself as admin and other as tester. I am using GRAPH API explorer to publish a sample custom action. It is always giving following error for both users. I have made sure that I use right permissions and pass right parameters.
{ "error": { "message": "(#100) The Action Type searchmates:Need is not approved, so app <appid> can only publish to administrators, developers, and testers of the app. User <userid> is not one of those roles.", "type": "OAuthException", "code": 100 }}
I raised a bug also on facebook: [Defect raised][1]. So far no luck. Please help how to proceed.
[1]: https://developers.facebook.com/bugs/171332866318848 | 0 |
9,750,167 | 03/17/2012 12:56:40 | 1,206,567 | 02/13/2012 10:33:05 | 1 | 0 | Qt+Mac: serial port doesn't answer on commands | I use modified QExtSerialPort because I don't need any libs. I write to port successfully and successfully read from port if data generated by device itself. But on my commands to it it doesn't answer. bytesAvailable () always returns 0 on any attempt to read after successful command record.
Under Windows all works fine.
I test com port with CoolTerm application and it work properly too.
How to fix this behavior?
Thx. | osx | qt | serial-port | qextserialport | null | null | open | Qt+Mac: serial port doesn't answer on commands
===
I use modified QExtSerialPort because I don't need any libs. I write to port successfully and successfully read from port if data generated by device itself. But on my commands to it it doesn't answer. bytesAvailable () always returns 0 on any attempt to read after successful command record.
Under Windows all works fine.
I test com port with CoolTerm application and it work properly too.
How to fix this behavior?
Thx. | 0 |
9,750,168 | 03/17/2012 12:56:44 | 1,142,807 | 01/11/2012 09:00:05 | 319 | 43 | WebView Html Fixed Header Scroll Table | I have a Page in Html which has a big Table.
So I want the First Row (Header) and First Column (Header) to be Fixed.
I tried the Solution given in
[http://ajaxian.com/archives/freeze-pane-functionality][1]
That scroll well in Chrome, Firefox in windows but it does work with WebView in android.
[1]: http://ajaxian.com/archives/freeze-pane-functionality
| javascript | android | html | null | null | null | open | WebView Html Fixed Header Scroll Table
===
I have a Page in Html which has a big Table.
So I want the First Row (Header) and First Column (Header) to be Fixed.
I tried the Solution given in
[http://ajaxian.com/archives/freeze-pane-functionality][1]
That scroll well in Chrome, Firefox in windows but it does work with WebView in android.
[1]: http://ajaxian.com/archives/freeze-pane-functionality
| 0 |
9,749,942 | 03/17/2012 12:21:11 | 1,275,701 | 03/17/2012 12:12:03 | 1 | 0 | Comment/like-count from a facebook post | any ideas how to get the likes/comment count from a facebook post - fast?
My idea was to get the stats of every single post, but it tooks too long.
$post = $facebook->api("/".$array['PostID']."/?fields=comments,likes", array());
$likes_count = count($post['likes']['data']);
$comments_count = count($post['comments']['data']);
I also tried to do it with a batch request like
$buildQuery .= '{"method":"GET","relative_url":"'.$array['PostID'].'/?fields=comments,likes"}';
The problem here is, that it doesn't work, because batch requests supports only POST mode.
What should I try? Any ideas? | facebook | api | comments | posts | null | null | open | Comment/like-count from a facebook post
===
any ideas how to get the likes/comment count from a facebook post - fast?
My idea was to get the stats of every single post, but it tooks too long.
$post = $facebook->api("/".$array['PostID']."/?fields=comments,likes", array());
$likes_count = count($post['likes']['data']);
$comments_count = count($post['comments']['data']);
I also tried to do it with a batch request like
$buildQuery .= '{"method":"GET","relative_url":"'.$array['PostID'].'/?fields=comments,likes"}';
The problem here is, that it doesn't work, because batch requests supports only POST mode.
What should I try? Any ideas? | 0 |
9,749,943 | 03/17/2012 12:21:15 | 815,111 | 04/30/2011 23:12:32 | 23 | 0 | How to make a structure extern and define its typedef | I'm trying to implement tree algorithms in C. I have declared a extern struct in a header file that is completely independent (b_tree_ds.h). Now I plan to import the file in all source files that want to use this struct. So I must declare it using extern in header.
Now the problem is thhat I want to define its typedef as well. the compiler gives error of multiple storage classes. How should I do that.
typedef extern struct node {
struct node* left;
struct node* right;
int key; // contains value
}NODE; | c | extern | structures | null | null | null | open | How to make a structure extern and define its typedef
===
I'm trying to implement tree algorithms in C. I have declared a extern struct in a header file that is completely independent (b_tree_ds.h). Now I plan to import the file in all source files that want to use this struct. So I must declare it using extern in header.
Now the problem is thhat I want to define its typedef as well. the compiler gives error of multiple storage classes. How should I do that.
typedef extern struct node {
struct node* left;
struct node* right;
int key; // contains value
}NODE; | 0 |
9,750,172 | 03/17/2012 12:57:07 | 782,242 | 06/03/2011 06:09:57 | 83 | 1 | How to get Any user's email Id from facebook graph api | I am using facebook graph api and I am able to get the email id of logged in user. I want to know that how can I retrieve any of my Friends email id using his/her id .
Is it possible or not ?
Thanks | iphone | facebook-graph-api | null | null | null | null | open | How to get Any user's email Id from facebook graph api
===
I am using facebook graph api and I am able to get the email id of logged in user. I want to know that how can I retrieve any of my Friends email id using his/her id .
Is it possible or not ?
Thanks | 0 |
9,750,176 | 03/17/2012 12:57:26 | 1,064,059 | 11/24/2011 13:45:25 | 60 | 0 | joining list with table in entity framework | I am using entity framework with asp.net mvc3 razor. Now i had an table which represents the Countries(like India, US) e.t.c. And my requirement is i need to open a pop-up with the flags of all countries which i had in database. And when user click on one flag i need to show that particular country details first and remaining as line by line in the webgrid(asp.net mvc3 razor)
So i had prepared a list of "Countries" by getting all the countries from database.And i prepared another list "OrderofCountries" by adding Order(property) "1" to the which user had clicked. And from 2 to all the remaining countries.Now i need to join this list i.e "OrderofContries" with the remaining tables(from database as for the requirement). But i entity framework it raises error when i join like
Unable to create a constant value of type 'Slmg.BusinessObjects.CountriesBO'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
My idea here is by using order property i can sort the data so that i can get the required data.
Can we join our prepared list with the database table in entiy framework? How to solve my issue. Can any one please help me to find the solution. | entity-framework | null | null | null | null | null | open | joining list with table in entity framework
===
I am using entity framework with asp.net mvc3 razor. Now i had an table which represents the Countries(like India, US) e.t.c. And my requirement is i need to open a pop-up with the flags of all countries which i had in database. And when user click on one flag i need to show that particular country details first and remaining as line by line in the webgrid(asp.net mvc3 razor)
So i had prepared a list of "Countries" by getting all the countries from database.And i prepared another list "OrderofCountries" by adding Order(property) "1" to the which user had clicked. And from 2 to all the remaining countries.Now i need to join this list i.e "OrderofContries" with the remaining tables(from database as for the requirement). But i entity framework it raises error when i join like
Unable to create a constant value of type 'Slmg.BusinessObjects.CountriesBO'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
My idea here is by using order property i can sort the data so that i can get the required data.
Can we join our prepared list with the database table in entiy framework? How to solve my issue. Can any one please help me to find the solution. | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.