question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
197,027
476,759
How can I declare a dropdown box in a view to set a value to a model in ASP.NET MVC?
I would like to declare a dropdown box in a view in an ASP.NET MVC application, for letting the user select a lookup value. I know how to declare plain text boxes but is there an official helper for declaring dropdown boxes (date time pickers and the rest)?. I also don't know what structure I should pass to my view for...
If you have a table of Product Types with description and a value ( id ) that you want to map to your dropdown then do the following inside your action in the controller. //Lets assume you retrieve your product types somehow here ViewData["ProductTypes"] = new List (); Then inside your view type the following <%= Html....
How can I declare a dropdown box in a view to set a value to a model in ASP.NET MVC? I would like to declare a dropdown box in a view in an ASP.NET MVC application, for letting the user select a lookup value. I know how to declare plain text boxes but is there an official helper for declaring dropdown boxes (date time ...
TITLE: How can I declare a dropdown box in a view to set a value to a model in ASP.NET MVC? QUESTION: I would like to declare a dropdown box in a view in an ASP.NET MVC application, for letting the user select a lookup value. I know how to declare plain text boxes but is there an official helper for declaring dropdown...
[ "asp.net-mvc" ]
10
4
10,478
2
0
2008-10-13T08:42:00.440000
2009-01-24T22:19:05.310000
197,033
197,108
where is the Oracle Event Log located?
Where is the location of my oracle event log (on a default Linux installation)?
select value from v$parameter where name = 'background_dump_dest'
where is the Oracle Event Log located? Where is the location of my oracle event log (on a default Linux installation)?
TITLE: where is the Oracle Event Log located? QUESTION: Where is the location of my oracle event log (on a default Linux installation)? ANSWER: select value from v$parameter where name = 'background_dump_dest'
[ "linux", "oracle", "logging" ]
16
18
62,812
2
0
2008-10-13T08:49:49.647000
2008-10-13T09:35:29.240000
197,045
375,202
Setting default values for columns in JPA
Is it possible to set a default value for columns in JPA, and if, how is it done using annotations?
Actually it is possible in JPA, although a little bit of a hack using the columnDefinition property of the @Column annotation, for example: @Column(name="Price", columnDefinition="Decimal(10,2) default '100.00'")
Setting default values for columns in JPA Is it possible to set a default value for columns in JPA, and if, how is it done using annotations?
TITLE: Setting default values for columns in JPA QUESTION: Is it possible to set a default value for columns in JPA, and if, how is it done using annotations? ANSWER: Actually it is possible in JPA, although a little bit of a hack using the columnDefinition property of the @Column annotation, for example: @Column(nam...
[ "java", "jpa", "annotations" ]
304
280
554,409
20
0
2008-10-13T08:55:50.117000
2008-12-17T16:44:06.493000
197,047
197,090
What is the difference between <% %> and <%=%>?
What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which?
See also this question. MVC hasn't changed how these bee-stings work, just how often they're used. Basically: <% - execute code <%@ - page directive <%$ - resource access <%= - explicit output to page <%# - data binding <%-- - server side comment block Also new in ASP.Net 4: <%: - writes out to the page, but with HTML ...
What is the difference between <% %> and <%=%>? What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which?
TITLE: What is the difference between <% %> and <%=%>? QUESTION: What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which? ANSWER: See also this question. MVC hasn't changed how these bee-stings work, just how often they're used. Basically: <% - execute code <%@ - page directive <%$ - res...
[ "asp.net", "asp.net-mvc" ]
15
37
1,919
4
0
2008-10-13T08:56:54.420000
2008-10-13T09:25:53.830000
197,048
198,063
Idiomatic use of std::auto_ptr or only use shared_ptr?
Now that shared_ptr is in tr1, what do you think should happen to the use of std::auto_ptr? They both have different use cases, but all use cases of auto_ptr can be solved with shared_ptr, too. Will you abandon auto_ptr or continue to use it in cases where you want to express explicitly that only one class has ownershi...
To provide a little more ammunition to the 'avoid std::auto_ptr ' camp: auto_ptr is being deprecated in the next standard (C++0x). I think this alone is good enough ammunition for any argument to use something else. However, as Konrad Rudolph mentioned, the default replacement for auto_ptr should probably be boost::sco...
Idiomatic use of std::auto_ptr or only use shared_ptr? Now that shared_ptr is in tr1, what do you think should happen to the use of std::auto_ptr? They both have different use cases, but all use cases of auto_ptr can be solved with shared_ptr, too. Will you abandon auto_ptr or continue to use it in cases where you want...
TITLE: Idiomatic use of std::auto_ptr or only use shared_ptr? QUESTION: Now that shared_ptr is in tr1, what do you think should happen to the use of std::auto_ptr? They both have different use cases, but all use cases of auto_ptr can be solved with shared_ptr, too. Will you abandon auto_ptr or continue to use it in ca...
[ "c++", "coding-style", "smart-pointers", "tr1" ]
19
13
4,588
5
0
2008-10-13T08:56:56.480000
2008-10-13T15:52:00.837000
197,057
197,495
javac.exe AST programmatic access example
Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example?
Yes, it is possible, but only since Java 6. Peter von der Ahé talks about the two JSRs in this interview. Of JSR 199: The JSR 199 Compiler API consists of three things: The first one basically allows you to invoke a compiler via the API. Second, the API allows you to customize how the compiler finds and writes out file...
javac.exe AST programmatic access example Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example?
TITLE: javac.exe AST programmatic access example QUESTION: Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example? ANSWER: Yes, it is possible, but only since Java 6. Peter von der Ahé talks about the two JSRs in this interview. Of JSR 199: The JSR 1...
[ "java", "javac", "abstract-syntax-tree" ]
10
14
6,549
2
0
2008-10-13T09:03:28.633000
2008-10-13T12:53:50.527000
197,059
197,062
Convert dictionary values into array
What is the most efficient way of turning the list of values of a dictionary into an array? For example, if I have a Dictionary where Key is String and Value is Foo, I want to get Foo[] I am using VS 2005, C# 2.0
// dict is Dictionary Foo[] foos = new Foo[dict.Count]; dict.Values.CopyTo(foos, 0); // or in C# 3.0: var foos = dict.Values.ToArray();
Convert dictionary values into array What is the most efficient way of turning the list of values of a dictionary into an array? For example, if I have a Dictionary where Key is String and Value is Foo, I want to get Foo[] I am using VS 2005, C# 2.0
TITLE: Convert dictionary values into array QUESTION: What is the most efficient way of turning the list of values of a dictionary into an array? For example, if I have a Dictionary where Key is String and Value is Foo, I want to get Foo[] I am using VS 2005, C# 2.0 ANSWER: // dict is Dictionary Foo[] foos = new Foo[...
[ "c#", ".net", "arrays", "generics", "dictionary" ]
96
151
199,086
5
0
2008-10-13T09:04:00.740000
2008-10-13T09:05:08.490000
197,070
197,079
Eclipse Abstract Syntax Tree Programmatic Access
Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for a given piece of code? eg getting the AST for: Class1.java package parseable; public class Class1 { /** * @param args */ public static void main(String[] args) { System.out.println("Hello world!"); } }
It is not an exact answer, that may give you a place where to start: As said in this question, A full example is available in this eclipse corner article, also more details in the eclipse help. And in the slide 59 of this presentation, you see how to apply a change to your source code.
Eclipse Abstract Syntax Tree Programmatic Access Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for a given piece of code? eg getting the AST for: Class1.java package parseable; public class Class1 { /** * @param args */ public static void main(String[] args) { System.out....
TITLE: Eclipse Abstract Syntax Tree Programmatic Access QUESTION: Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for a given piece of code? eg getting the AST for: Class1.java package parseable; public class Class1 { /** * @param args */ public static void main(String[] a...
[ "java", "eclipse", "abstract-syntax-tree" ]
3
3
1,209
2
0
2008-10-13T09:09:28.233000
2008-10-13T09:15:02.073000
197,081
197,087
Flatten Ruby method in C#
How can I do the Ruby method "Flatten" Ruby Method in C#. This method flattens a jagged array into a single-dimensional array. For example: s = [ 1, 2, 3 ] #=> [1, 2, 3] t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, ...
Recursive solution: IEnumerable Flatten(IEnumerable array) { foreach(var item in array) { if(item is IEnumerable) { foreach(var subitem in Flatten((IEnumerable)item)) { yield return subitem; } } else { yield return item; } } } EDIT 1: Jon explains in the comments why it cannot be a generic method, take a look! EDIT 2: ...
Flatten Ruby method in C# How can I do the Ruby method "Flatten" Ruby Method in C#. This method flattens a jagged array into a single-dimensional array. For example: s = [ 1, 2, 3 ] #=> [1, 2, 3] t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] a.flatten #=> [1...
TITLE: Flatten Ruby method in C# QUESTION: How can I do the Ruby method "Flatten" Ruby Method in C#. This method flattens a jagged array into a single-dimensional array. For example: s = [ 1, 2, 3 ] #=> [1, 2, 3] t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10...
[ "c#", "ruby", "arrays" ]
6
12
1,296
4
0
2008-10-13T09:17:38.340000
2008-10-13T09:24:48.857000
197,088
197,582
Whats the difference between Keyboard.Focus(item) and item.Focus()?
In WPF, there are two ways to set the focus to an element. You can either call the.Focus() method of the input element, or call Keyboard.Focus() with the input element as parameter. // first way: item.Focus(); // alternate way: Keyboard.Focus(item); What is the difference between these two? Are there special reasons to...
One of the first things that item.Focus() does is call Keyboard.Focus( this ). If that fails, then it makes calls to FocusManager, as decasteljau has answered. The following are copied from disassambler view in Reflector. This is from UIElement ( UIElement3D is the same): public bool Focus() { if (Keyboard.Focus(this) ...
Whats the difference between Keyboard.Focus(item) and item.Focus()? In WPF, there are two ways to set the focus to an element. You can either call the.Focus() method of the input element, or call Keyboard.Focus() with the input element as parameter. // first way: item.Focus(); // alternate way: Keyboard.Focus(item); Wh...
TITLE: Whats the difference between Keyboard.Focus(item) and item.Focus()? QUESTION: In WPF, there are two ways to set the focus to an element. You can either call the.Focus() method of the input element, or call Keyboard.Focus() with the input element as parameter. // first way: item.Focus(); // alternate way: Keyboa...
[ ".net", "wpf" ]
15
24
5,293
3
0
2008-10-13T09:25:12.647000
2008-10-13T13:31:31.370000
197,096
197,138
How to convert in SQL the number of seconds into a human-readable duration?
In a SQL-database I make some selects, that get an duration (as result of a subtraction between two dates) in seconds as an int. But I want to format this result in a human-readable form like 'hh:mm' or 'dd:hh'. Is that possible in SQL and how can I realize this?
In SQL 2005, You can use the following: select convert(varchar(8), dateadd(second, [SecondsColumn], 0), 108) Which first converts the seconds into a date after 1900-01-01, and then gets the hh:mm:ss part. If the column is more than 24 hours, this will roll over, if you want days and then hours in that case just do some...
How to convert in SQL the number of seconds into a human-readable duration? In a SQL-database I make some selects, that get an duration (as result of a subtraction between two dates) in seconds as an int. But I want to format this result in a human-readable form like 'hh:mm' or 'dd:hh'. Is that possible in SQL and how ...
TITLE: How to convert in SQL the number of seconds into a human-readable duration? QUESTION: In a SQL-database I make some selects, that get an duration (as result of a subtraction between two dates) in seconds as an int. But I want to format this result in a human-readable form like 'hh:mm' or 'dd:hh'. Is that possib...
[ "sql", "int", "duration" ]
2
5
10,545
5
0
2008-10-13T09:31:17.923000
2008-10-13T09:47:52.820000
197,097
197,197
Oracle 10g - UTL_MAIL package
I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions? I connect to my DB as SYSMAN and load the following two scripts; @C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql @C:\oracle\product\10.2.0\db_1\rdbms\admin\prvtmail.plb I set up the SMTP server; AL...
I'm pretty sure that public synonyms will be the only difference. SELECT * FROM ALL_SYNONYMS WHERE OWNER = 'PUBLIC' and table_name LIKE 'UTL%' will confirm or deny
Oracle 10g - UTL_MAIL package I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions? I connect to my DB as SYSMAN and load the following two scripts; @C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql @C:\oracle\product\10.2.0\db_1\rdbms\admin\prvtmail.pl...
TITLE: Oracle 10g - UTL_MAIL package QUESTION: I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions? I connect to my DB as SYSMAN and load the following two scripts; @C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql @C:\oracle\product\10.2.0\db_1\rdbms...
[ "oracle", "email" ]
4
5
21,045
4
0
2008-10-13T09:31:37.407000
2008-10-13T10:24:35.880000
197,099
199,950
Select specific rows with SQL Server XML column type
I'm trying to select data from a table defined similar to the following: Column | Data Type ------------------------- Id | Int DataType | Int LoggedData | XML but I only want to select those rows with a specific DataType value, and that contain a string (or evaluates a piece of XPath) in the LoggedData column. A quick ...
If you want to filter by a searchterm (like a SQL variable) you will probably need to use something like this: Select Id, LoggedData From myTable Where DataType = 29 And LoggedData.exist('RootNode/ns1:ChildNode[@value=sql:variable("@searchterm")]')=1 where @searchterm is your SQL variable.
Select specific rows with SQL Server XML column type I'm trying to select data from a table defined similar to the following: Column | Data Type ------------------------- Id | Int DataType | Int LoggedData | XML but I only want to select those rows with a specific DataType value, and that contain a string (or evaluates...
TITLE: Select specific rows with SQL Server XML column type QUESTION: I'm trying to select data from a table defined similar to the following: Column | Data Type ------------------------- Id | Int DataType | Int LoggedData | XML but I only want to select those rows with a specific DataType value, and that contain a st...
[ "sql-server", "xml", "t-sql", "select" ]
2
1
4,297
2
0
2008-10-13T09:32:20.090000
2008-10-14T03:40:28.443000
197,111
197,114
Fastest "Get Duplicates" SQL script
What is an example of a fast SQL to get duplicates in datasets with hundreds of thousands of records. I typically use something like: SELECT afield1, afield2 FROM afile a WHERE 1 < (SELECT count(afield1) FROM afile b WHERE a.afield1 = b.afield1); But this is quite slow.
This is the more direct way: select afield1,count(afield1) from atable group by afield1 having count(afield1) > 1
Fastest "Get Duplicates" SQL script What is an example of a fast SQL to get duplicates in datasets with hundreds of thousands of records. I typically use something like: SELECT afield1, afield2 FROM afile a WHERE 1 < (SELECT count(afield1) FROM afile b WHERE a.afield1 = b.afield1); But this is quite slow.
TITLE: Fastest "Get Duplicates" SQL script QUESTION: What is an example of a fast SQL to get duplicates in datasets with hundreds of thousands of records. I typically use something like: SELECT afield1, afield2 FROM afile a WHERE 1 < (SELECT count(afield1) FROM afile b WHERE a.afield1 = b.afield1); But this is quite s...
[ "sql", "scripting", "duplicates", "performance" ]
43
78
39,023
5
0
2008-10-13T09:36:18.333000
2008-10-13T09:38:27.877000
197,112
197,126
PHP Static variable not working as expected
This example is from php.net: And this is my code: function getNextQuestionID() { static $idx = 0; return $idx++; } And I use it in JavaScript: 'quizID=' + " " Returns 0 everytime. Why?
I believe you misunderstand what static vars do. Try this code and you may understand better: echo getNextQuestionID(). ", " getNextQuestionID(). ", " getNextQuestionID(); And you will see what I mean. The static var only lives as long as the script does. The reason it is returning 0 on the first run instead of 1 is be...
PHP Static variable not working as expected This example is from php.net: And this is my code: function getNextQuestionID() { static $idx = 0; return $idx++; } And I use it in JavaScript: 'quizID=' + " " Returns 0 everytime. Why?
TITLE: PHP Static variable not working as expected QUESTION: This example is from php.net: And this is my code: function getNextQuestionID() { static $idx = 0; return $idx++; } And I use it in JavaScript: 'quizID=' + " " Returns 0 everytime. Why? ANSWER: I believe you misunderstand what static vars do. Try this code ...
[ "php", "javascript" ]
0
5
2,320
4
0
2008-10-13T09:36:19.927000
2008-10-13T09:42:13.470000
197,121
198,542
How do I write a for loop that iterates over a CAtlMap selectively deleting elements as it goes?
I'm trying to do the following without too much special case code to deal with invalidated POSITIONs etc: What's the best way to fill in the blanks? void DeleteUnreferencedRecords(CAtlMap & records) { for(____;____;____) { if( NotReferencedElsewhere(record) ) { // Delete record _______; } } }
According to this: http://msdn.microsoft.com/en-us/library/0h4c3zkw(VS.80).aspx RemoveAtPos has these semantics Removes the key/value pair stored at the specified position. The memory used to store the element is freed. The POSITION referenced by pos becomes invalid, and while the POSITION of any other elements in the ...
How do I write a for loop that iterates over a CAtlMap selectively deleting elements as it goes? I'm trying to do the following without too much special case code to deal with invalidated POSITIONs etc: What's the best way to fill in the blanks? void DeleteUnreferencedRecords(CAtlMap & records) { for(____;____;____) { ...
TITLE: How do I write a for loop that iterates over a CAtlMap selectively deleting elements as it goes? QUESTION: I'm trying to do the following without too much special case code to deal with invalidated POSITIONs etc: What's the best way to fill in the blanks? void DeleteUnreferencedRecords(CAtlMap & records) { for(...
[ "c++", "atl" ]
0
2
1,614
3
0
2008-10-13T09:40:54.083000
2008-10-13T18:31:21.483000
197,123
197,188
Renaming accessor/mutator methods in Eclipse?
Is there any way to automatically rename accessor/mutator when a variable they get/set gets refactored -> renamed (Eclipse 3.4)?
1 - When you select Refactor->Rename on a variable, Eclipse prompts you to enter the new name in an "in-line" box. Directly below it, there is a help message and next to it a small icon (an arrow going down).Click on that arrow and then select "Open Rename Dialog". A new pop-up appears with the checkboxes you need. 2 -...
Renaming accessor/mutator methods in Eclipse? Is there any way to automatically rename accessor/mutator when a variable they get/set gets refactored -> renamed (Eclipse 3.4)?
TITLE: Renaming accessor/mutator methods in Eclipse? QUESTION: Is there any way to automatically rename accessor/mutator when a variable they get/set gets refactored -> renamed (Eclipse 3.4)? ANSWER: 1 - When you select Refactor->Rename on a variable, Eclipse prompts you to enter the new name in an "in-line" box. Dir...
[ "eclipse", "refactoring", "eclipse-3.4" ]
10
19
724
2
0
2008-10-13T09:41:11.850000
2008-10-13T10:20:23.877000
197,124
218,511
Data Cut off when exporting to excel in SQL Reporting Services 2005
I am having huge lines data which could accomdate in Textbox. While I am exporting to excel the wrapping up of data occurs and the data is being cut off. When i manually change the textbox height i can see the full data but i need the full data to be displayed in the first time itself.
In your report layout, set the CanGrow property of the Textbox to True.
Data Cut off when exporting to excel in SQL Reporting Services 2005 I am having huge lines data which could accomdate in Textbox. While I am exporting to excel the wrapping up of data occurs and the data is being cut off. When i manually change the textbox height i can see the full data but i need the full data to be d...
TITLE: Data Cut off when exporting to excel in SQL Reporting Services 2005 QUESTION: I am having huge lines data which could accomdate in Textbox. While I am exporting to excel the wrapping up of data occurs and the data is being cut off. When i manually change the textbox height i can see the full data but i need the...
[ "asp.net", "sql-server", "reporting-services" ]
0
1
1,081
1
0
2008-10-13T09:41:44.737000
2008-10-20T13:54:40.603000
197,125
197,134
Free Bug Tracker in .NET
Is there any good bug tracker based on.NET which is free?
Two bug trackers I know: BugTracker.NET BugTracker.NET is a free, open-source, web-based bug tracker or customer support issue tracker written using ASP.NET, C#, and Microsoft SQL Server (or its free cousin, SQL Server Express). BugNET BugNET is an issue tracking and project issue management solution built using the AS...
Free Bug Tracker in .NET Is there any good bug tracker based on.NET which is free?
TITLE: Free Bug Tracker in .NET QUESTION: Is there any good bug tracker based on.NET which is free? ANSWER: Two bug trackers I know: BugTracker.NET BugTracker.NET is a free, open-source, web-based bug tracker or customer support issue tracker written using ASP.NET, C#, and Microsoft SQL Server (or its free cousin, SQ...
[ ".net", "bug-tracking" ]
22
36
21,243
4
0
2008-10-13T09:42:01.163000
2008-10-13T09:46:38.267000
197,127
197,141
Prevent exception messages from being translated into the user's language?
How do I make my application always use English when displaying win32/.net exceptions messages? I got this message, it looks like someone used babelfish to translate it (it's Swedish): "System.ComponentModel.Win32Exception: Programmet kunde inte starta eftersom programmets sida-vid-sidakonfiguration är felaktig." Extre...
You can try setting Thread.CurrentThread.CurrentUICulture and/or.CurrentCulture to CultureInfo("en-US").
Prevent exception messages from being translated into the user's language? How do I make my application always use English when displaying win32/.net exceptions messages? I got this message, it looks like someone used babelfish to translate it (it's Swedish): "System.ComponentModel.Win32Exception: Programmet kunde inte...
TITLE: Prevent exception messages from being translated into the user's language? QUESTION: How do I make my application always use English when displaying win32/.net exceptions messages? I got this message, it looks like someone used babelfish to translate it (it's Swedish): "System.ComponentModel.Win32Exception: Pro...
[ "c#", ".net", "exception", "globalization" ]
35
10
9,531
4
0
2008-10-13T09:43:13.967000
2008-10-13T09:50:22.113000
197,132
197,167
How can I keep the session clean?
This is in regards to a situation where Session is used to store some temporary data - one example being information entered during a multi-step registration process. If a website has a number of such sections - which wants to utilize the session as temporary data store for pages within the section, what is a good way ...
Time should keep the session clean. Sessions should expire and in doing so nuke all their data. This is default behaviour. I'll agree that storing too much data in a session is not a great thing for server-resources but as you know, it's sometimes a necessary evil. If you're really that bothered, consider moving your s...
How can I keep the session clean? This is in regards to a situation where Session is used to store some temporary data - one example being information entered during a multi-step registration process. If a website has a number of such sections - which wants to utilize the session as temporary data store for pages withi...
TITLE: How can I keep the session clean? QUESTION: This is in regards to a situation where Session is used to store some temporary data - one example being information entered during a multi-step registration process. If a website has a number of such sections - which wants to utilize the session as temporary data sto...
[ "asp.net", "session" ]
1
2
748
4
0
2008-10-13T09:45:54.383000
2008-10-13T10:06:59.007000
197,135
207,796
Getting notifications when the user tries sending an SMS
My application is implemented as a service (running under services.exe). I am adding a new feature which requires being notified when the user sends an SMS. I have tried using IMAPIAdviseSink, registering with both IMAPISession and IMsgStore, but I do not get any notifications. The other options I can see are to create...
You can't use IMAPIAdviseSink from a service. You need to use it from separate process and notify the service of the events you're interested in.
Getting notifications when the user tries sending an SMS My application is implemented as a service (running under services.exe). I am adding a new feature which requires being notified when the user sends an SMS. I have tried using IMAPIAdviseSink, registering with both IMAPISession and IMsgStore, but I do not get any...
TITLE: Getting notifications when the user tries sending an SMS QUESTION: My application is implemented as a service (running under services.exe). I am adding a new feature which requires being notified when the user sends an SMS. I have tried using IMAPIAdviseSink, registering with both IMAPISession and IMsgStore, bu...
[ "c++", "windows-mobile", "embedded" ]
0
2
265
2
0
2008-10-13T09:46:57.033000
2008-10-16T08:39:28.010000
197,140
197,251
What is the best implementation of STL for VS2005?
I'm currently using default implementation of STL for VS2005 and I'm not really satisfied with it. Perhaps there is something better?
The Dinkumware STL implementation (supplied with VS2005) is actually quite good. The STL is a general purpose library and so it is almost always possible to write something better for very specific use cases. I'm aware of the following alternative implementations, but I've never used them with VS2005: SGI Standard Temp...
What is the best implementation of STL for VS2005? I'm currently using default implementation of STL for VS2005 and I'm not really satisfied with it. Perhaps there is something better?
TITLE: What is the best implementation of STL for VS2005? QUESTION: I'm currently using default implementation of STL for VS2005 and I'm not really satisfied with it. Perhaps there is something better? ANSWER: The Dinkumware STL implementation (supplied with VS2005) is actually quite good. The STL is a general purpos...
[ "c++", "visual-studio-2005", "stl" ]
3
8
1,189
5
0
2008-10-13T09:50:13.283000
2008-10-13T10:58:30.057000
197,160
197,166
How do you optimise your Javascript?
Well... simple question, right? But with no so simple answers. In firefox i use firebug console (profile) but... what to do in other browsers? Like Internet Explorer / Opera / Safari (on windows)
You may use JavaScript optimizers http://js-optimizer.sourceforge.net/ http://www.xtreeme.com/javascript-optimizer/
How do you optimise your Javascript? Well... simple question, right? But with no so simple answers. In firefox i use firebug console (profile) but... what to do in other browsers? Like Internet Explorer / Opera / Safari (on windows)
TITLE: How do you optimise your Javascript? QUESTION: Well... simple question, right? But with no so simple answers. In firefox i use firebug console (profile) but... what to do in other browsers? Like Internet Explorer / Opera / Safari (on windows) ANSWER: You may use JavaScript optimizers http://js-optimizer.source...
[ "javascript", "performance" ]
6
3
886
6
0
2008-10-13T10:00:54.027000
2008-10-13T10:06:51.953000
197,162
291,292
NTFS performance and large volumes of files and directories
How does Windows with NTFS perform with large volumes of files and directories? Is there any guidance around limits of files or directories you can place in a single directory before you run into performance problems or other issues? E.g. is having a folder with 100,000 folders inside of it an OK thing to do?
Here's some advice from someone with an environment where we have folders containing tens of millions of files. A folder stores the index information (links to child files & child folder) in an index file. This file will get very large when you have a lot of children. Note that it doesn't distinguish between a child th...
NTFS performance and large volumes of files and directories How does Windows with NTFS perform with large volumes of files and directories? Is there any guidance around limits of files or directories you can place in a single directory before you run into performance problems or other issues? E.g. is having a folder wi...
TITLE: NTFS performance and large volumes of files and directories QUESTION: How does Windows with NTFS perform with large volumes of files and directories? Is there any guidance around limits of files or directories you can place in a single directory before you run into performance problems or other issues? E.g. is ...
[ "windows", "performance", "filesystems", "ntfs" ]
205
301
143,668
8
0
2008-10-13T10:01:43.493000
2008-11-14T20:27:10.173000
197,170
197,210
VMWare ctrl-z key binding, how to remove
When I Alt + Tab to my VM from my host the VM does not get keyboard input until I click inside it. This is causing me an issue as it looks like the VM has control of the input (as the cursor is flashing away). If while in this state, VMWare server has the focus rather then the application inside it, if you do ctrl + Z ...
This will not remove the key binding from VmWare, but you could set the option to "Grab keyboard and mouse intput on key press" in the VmWare preferences. VmWare help explicitly states that this will disable the system accelerator key sequences.
VMWare ctrl-z key binding, how to remove When I Alt + Tab to my VM from my host the VM does not get keyboard input until I click inside it. This is causing me an issue as it looks like the VM has control of the input (as the cursor is flashing away). If while in this state, VMWare server has the focus rather then the a...
TITLE: VMWare ctrl-z key binding, how to remove QUESTION: When I Alt + Tab to my VM from my host the VM does not get keyboard input until I click inside it. This is causing me an issue as it looks like the VM has control of the input (as the cursor is flashing away). If while in this state, VMWare server has the focus...
[ "keyboard-shortcuts", "vmware-server" ]
11
6
3,572
2
0
2008-10-13T10:10:30.997000
2008-10-13T10:35:46.763000
197,171
197,208
How to set Visual Studio as the default post-mortem debugger?
Not too long ago, I had a problem which required me to set WinDbg.exe as the default post-mortem debugger. Now that I've fixed that and am back doing normal work, it would be really nice if I could set VS to be my default post-mortem debugger. How does one go about doing this? Also, how do I make VS attach to an alread...
from the Microsoft support page: Start Registry Editor and locate the following Registry subkey in the HKEY_LOCAL_MACHINE subtree: \SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AEDEBUG Select the Debugger value. On the Edit menu, click String. To use the Windows debugger, type windbg -p %ld -e %ld. To use Visual C++ 4....
How to set Visual Studio as the default post-mortem debugger? Not too long ago, I had a problem which required me to set WinDbg.exe as the default post-mortem debugger. Now that I've fixed that and am back doing normal work, it would be really nice if I could set VS to be my default post-mortem debugger. How does one g...
TITLE: How to set Visual Studio as the default post-mortem debugger? QUESTION: Not too long ago, I had a problem which required me to set WinDbg.exe as the default post-mortem debugger. Now that I've fixed that and am back doing normal work, it would be really nice if I could set VS to be my default post-mortem debugg...
[ "visual-studio" ]
16
9
13,718
2
0
2008-10-13T10:11:00.433000
2008-10-13T10:34:41.477000
197,174
197,181
Error with no HashCode, Equals eclipse
I'm looking for a very specific eclipse plugin that will tell me if a class in my project is not implementing hashCode or/and equals methods. Does anyone know of such a plugin? Thanks
Can you not use the Checkstyle plugin and write your own Checkstyle rule? (There's a Checkstyle rule for overriding equals but not hashCode, but nothing to make sure that both are implemented for all classes, AFAIK.)
Error with no HashCode, Equals eclipse I'm looking for a very specific eclipse plugin that will tell me if a class in my project is not implementing hashCode or/and equals methods. Does anyone know of such a plugin? Thanks
TITLE: Error with no HashCode, Equals eclipse QUESTION: I'm looking for a very specific eclipse plugin that will tell me if a class in my project is not implementing hashCode or/and equals methods. Does anyone know of such a plugin? Thanks ANSWER: Can you not use the Checkstyle plugin and write your own Checkstyle ru...
[ "java", "eclipse", "plugins", "equals", "hashcode" ]
4
3
602
2
0
2008-10-13T10:12:12.053000
2008-10-13T10:15:50.300000
197,182
197,191
Windows Forms application like Google Chrome with multiple processes
Is there any way to use C# to build a container application where each tab is actually its own process like with Google chrome?
You can use the SetParent Win32 call to do this, but it's really fraught with problems. I had enough troubles getting it all to work nicely using windows from different AppDomains - there'd be even more difficulties with whole extra processes. Basically there's potentially a lot of communication required between the tw...
Windows Forms application like Google Chrome with multiple processes Is there any way to use C# to build a container application where each tab is actually its own process like with Google chrome?
TITLE: Windows Forms application like Google Chrome with multiple processes QUESTION: Is there any way to use C# to build a container application where each tab is actually its own process like with Google chrome? ANSWER: You can use the SetParent Win32 call to do this, but it's really fraught with problems. I had en...
[ "c#", "winforms", "process" ]
26
25
12,043
7
0
2008-10-13T10:15:58.787000
2008-10-13T10:21:59.723000
197,190
197,391
Why can't I use a type argument in a type parameter with multiple bounds?
So, I understand that the following doesn't work, but why doesn't it work? interface Adapter {} class Adaptulator { > void add(Class extl, Class intl) { addAdapterFactory(new AdapterFactory (extl, intl)); } } The add() method gives me a compile error, "Cannot specify any additional bound Adapter when first bound is a ...
I'm also not sure why the restriction is there. You could try sending a friendly e-mail to the designers of Java 5 Generics (chiefly Gilad Bracha and Neal Gafter). My guess is that they wanted to support only an absolute minimum of intersection types (which is what multiple bounds essentially are), to make the language...
Why can't I use a type argument in a type parameter with multiple bounds? So, I understand that the following doesn't work, but why doesn't it work? interface Adapter {} class Adaptulator { > void add(Class extl, Class intl) { addAdapterFactory(new AdapterFactory (extl, intl)); } } The add() method gives me a compile ...
TITLE: Why can't I use a type argument in a type parameter with multiple bounds? QUESTION: So, I understand that the following doesn't work, but why doesn't it work? interface Adapter {} class Adaptulator { > void add(Class extl, Class intl) { addAdapterFactory(new AdapterFactory (extl, intl)); } } The add() method g...
[ "java", "generics", "constraints" ]
60
37
16,834
5
0
2008-10-13T10:21:58.290000
2008-10-13T12:25:15.343000
197,199
197,204
Proxy choices: mod_proxy_balancer, nginx + proxy balancer, haproxy?
We're running a Rails site at http://hansard.millbanksystems.com, on a dedicated Accelerator. We currently have Apache setup with mod-proxy-balancer, proxying to four mongrels running the application. Some requests are rather slow and in order to prevent the situation where other requests get queued up behind them, we'...
Apache is a bit of a strange beast to use for your balancing. It's certainly capable but it's like using a tank to do the shopping. Haproxy/Nginx are more specifically tailored for the job. You should get higher throughput and use fewer resources at the same time.
Proxy choices: mod_proxy_balancer, nginx + proxy balancer, haproxy? We're running a Rails site at http://hansard.millbanksystems.com, on a dedicated Accelerator. We currently have Apache setup with mod-proxy-balancer, proxying to four mongrels running the application. Some requests are rather slow and in order to preve...
TITLE: Proxy choices: mod_proxy_balancer, nginx + proxy balancer, haproxy? QUESTION: We're running a Rails site at http://hansard.millbanksystems.com, on a dedicated Accelerator. We currently have Apache setup with mod-proxy-balancer, proxying to four mongrels running the application. Some requests are rather slow and...
[ "ruby-on-rails", "apache", "proxy", "solaris", "mongrel" ]
4
4
5,077
6
0
2008-10-13T10:26:54.973000
2008-10-13T10:32:47.753000
197,211
197,478
Class design with vector as a private/public member?
what is the best way to put a container class or a some other class inside a class as private or a public member? Requirements: 1.Vector< someclass> inside my class 2.Add and count of vector is needed interface
If the container's state is part of the class's invariant, then it should, if possible, be private. For example, if the container represents a three dimensional vector then part of the invariant might be that it always contains exactly 3 numbers. Exposing it as a public member would allow code external to the class to ...
Class design with vector as a private/public member? what is the best way to put a container class or a some other class inside a class as private or a public member? Requirements: 1.Vector< someclass> inside my class 2.Add and count of vector is needed interface
TITLE: Class design with vector as a private/public member? QUESTION: what is the best way to put a container class or a some other class inside a class as private or a public member? Requirements: 1.Vector< someclass> inside my class 2.Add and count of vector is needed interface ANSWER: If the container's state is p...
[ "c++", "class-design", "encapsulation" ]
2
1
2,031
6
0
2008-10-13T10:35:49.073000
2008-10-13T12:48:57.447000
197,215
205,272
Active Reverse Proxy
Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client? As an example: Proxy relays client request for pdf document to another server, response received by proxy, watermark added to pages of pdf, watermarked p...
I found a description of Deliverance over on the python tags, and it may be useful for what you're looking for. I have no experience with it myself, so grain of salt and all that. http://www.openplans.org/projects/deliverance/introduction
Active Reverse Proxy Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client? As an example: Proxy relays client request for pdf document to another server, response received by proxy, watermark added to pages ...
TITLE: Active Reverse Proxy QUESTION: Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client? As an example: Proxy relays client request for pdf document to another server, response received by proxy, waterma...
[ "apache", "proxy", "reverse", "reverse-proxy" ]
1
0
1,029
4
0
2008-10-13T10:38:41.687000
2008-10-15T15:53:11.333000
197,224
197,243
What is a pre-revprop-change hook in SVN, and how do I create it?
I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?
Basically it's a script that is launched before unversioned property is modified on the repository, so that you can manage more precisely what's happening on your repository. There are templates in the SVN distrib for different hooks, located in the /hooks subdirectory (*.tmpl that you have to edit and rename depending...
What is a pre-revprop-change hook in SVN, and how do I create it? I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?
TITLE: What is a pre-revprop-change hook in SVN, and how do I create it? QUESTION: I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it? A...
[ "svn", "svn-hooks" ]
181
53
118,520
11
0
2008-10-13T10:44:49.367000
2008-10-13T10:54:16.227000
197,228
197,237
How to check if a file exists in javascript?
I'm using the jquery library to load the content of an html file. Something like this: $("#Main").load("login.html") If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file to load exists or no...
You can use the ajaxComplete event, whis gives you access to the xhr object which you can query the status of the request e.g a status of 404 will mean the file does not exist. More Info in the docs http://docs.jquery.com/Ajax/ajaxComplete#callback Test here http://pastebin.me/48f32a74927bb e.g $("#someDivId").ajaxComp...
How to check if a file exists in javascript? I'm using the jquery library to load the content of an html file. Something like this: $("#Main").load("login.html") If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how ...
TITLE: How to check if a file exists in javascript? QUESTION: I'm using the jquery library to load the content of an html file. Something like this: $("#Main").load("login.html") If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for examp...
[ "jquery", "file", "exists" ]
3
12
21,649
2
0
2008-10-13T10:46:07.210000
2008-10-13T10:52:01.270000
197,229
200,392
BizTalk Server BAM Portal on x64 Windows 2008/IIS 7.0
We are attempting to install BizTalk Server 2006 R2 on a fresh server with x64 Windows 2008. The basic configuration is complaining that the “Default Web Site” we select for the BAM Portal installation is not validated due to “IIS is not 32-bit enabled.” Despite setting the appPool (Classic mode) 32-bit property to Tru...
It looks like Microsoft’s official statement is Biztalk Server 2006 R2 with Windows 2008 is “not supported”. BizTalk Server 2009 is the one that is meant to be married to Windows 2008. UPDATE, MOFE INFO I should additionally comment that the process of setting up a multiple servers for a BizTalk Group requires configur...
BizTalk Server BAM Portal on x64 Windows 2008/IIS 7.0 We are attempting to install BizTalk Server 2006 R2 on a fresh server with x64 Windows 2008. The basic configuration is complaining that the “Default Web Site” we select for the BAM Portal installation is not validated due to “IIS is not 32-bit enabled.” Despite set...
TITLE: BizTalk Server BAM Portal on x64 Windows 2008/IIS 7.0 QUESTION: We are attempting to install BizTalk Server 2006 R2 on a fresh server with x64 Windows 2008. The basic configuration is complaining that the “Default Web Site” we select for the BAM Portal installation is not validated due to “IIS is not 32-bit ena...
[ "iis-7", "64-bit", "biztalk", "biztalk2006r2" ]
1
3
1,462
3
0
2008-10-13T10:46:08.583000
2008-10-14T08:37:21.980000
197,233
197,254
How to parse a command line with regular expressions?
I want to split a command line like string in single string parameters. How look the regular expression for it. The problem are that the parameters can be quoted. For example like: "param 1" param2 "param 3" should result in: param 1, param2, param 3
I tend to use regexlib for this kind of problem. If you go to: http://regexlib.com/ and search for "command line" you'll find three results which look like they are trying to solve this or similar problems - should be a good start. This may work: http://regexlib.com/Search.aspx?k=command+line&c=-1&m=-1&ps=20
How to parse a command line with regular expressions? I want to split a command line like string in single string parameters. How look the regular expression for it. The problem are that the parameters can be quoted. For example like: "param 1" param2 "param 3" should result in: param 1, param2, param 3
TITLE: How to parse a command line with regular expressions? QUESTION: I want to split a command line like string in single string parameters. How look the regular expression for it. The problem are that the parameters can be quoted. For example like: "param 1" param2 "param 3" should result in: param 1, param2, param...
[ "regex", "parsing" ]
12
7
50,102
16
0
2008-10-13T10:48:45.693000
2008-10-13T10:58:48.153000
197,236
567,377
Removing contents of PlaceHolderPageTitleInTitleArea
In sharepoint there is a content place holder called PlaceHolderPageTitlteInTitleArea. I'm trying to remove everything in it from a custom RenderingTemplate that I placed in CONTROLTEMPLATES. So is it possible to achieve this either by using inline code or some other ways. Right now I've fixed it with this code in my S...
If you create a Custom Master Page and modify the tag to read instead, you can achieve the same result. You can create a Custom Master page by opening the site using SharePoint Designer, creating the new Master Page, copying the contents of Default.master into it, then modifying the placeholder tag, and setting that ne...
Removing contents of PlaceHolderPageTitleInTitleArea In sharepoint there is a content place holder called PlaceHolderPageTitlteInTitleArea. I'm trying to remove everything in it from a custom RenderingTemplate that I placed in CONTROLTEMPLATES. So is it possible to achieve this either by using inline code or some other...
TITLE: Removing contents of PlaceHolderPageTitleInTitleArea QUESTION: In sharepoint there is a content place holder called PlaceHolderPageTitlteInTitleArea. I'm trying to remove everything in it from a custom RenderingTemplate that I placed in CONTROLTEMPLATES. So is it possible to achieve this either by using inline ...
[ "sharepoint" ]
3
4
6,373
1
0
2008-10-13T10:51:15.953000
2009-02-19T21:55:31.180000
197,241
197,247
About System.Linq.Lookup class
I came across this class while reading a C# book and have some questions. Why is this added into System.Linq namespace and not into usuall Collections namespace? What the intention behind this class is Why this class is not intended for direct instantiation? This is available through the ToLookup extension only, right?
Purpose of the class: a dictionary where a key can map to multiple values. Think of it as being for grouping rather than one-to-one mapping. Only through ToLookup decision: Pass. Again, seems like a bad call to me. On the other hand, it means that the result is immutable to the outside world, which is quite nice. It's ...
About System.Linq.Lookup class I came across this class while reading a C# book and have some questions. Why is this added into System.Linq namespace and not into usuall Collections namespace? What the intention behind this class is Why this class is not intended for direct instantiation? This is available through the ...
TITLE: About System.Linq.Lookup class QUESTION: I came across this class while reading a C# book and have some questions. Why is this added into System.Linq namespace and not into usuall Collections namespace? What the intention behind this class is Why this class is not intended for direct instantiation? This is avai...
[ "c#", "linq" ]
15
17
4,536
2
0
2008-10-13T10:53:13.313000
2008-10-13T10:56:45.660000
197,258
197,273
Calling a static member function of a C++ STL container's value_type
I'm trying to get my head around why the following doesn't work. I have a std::vector and I want to call a static member function of it's contained value_type like so: std::vector v; unsigned u = v.value_type::Dim(); where Vector is in fact a typedef for a templated type: template class SVector; typedef SVector Vector;...
You are accessing the value_type trough the variable instance and not the variable type. Method 1 - this works: typedef std::vector MyVector; MyVector v; unsigned u = MyVector::value_type::Dim(); Method 2 - or this: std::vector v; unsigned u = std::vector::value_type::Dim(); If you typedef like on method 1 you do not h...
Calling a static member function of a C++ STL container's value_type I'm trying to get my head around why the following doesn't work. I have a std::vector and I want to call a static member function of it's contained value_type like so: std::vector v; unsigned u = v.value_type::Dim(); where Vector is in fact a typedef ...
TITLE: Calling a static member function of a C++ STL container's value_type QUESTION: I'm trying to get my head around why the following doesn't work. I have a std::vector and I want to call a static member function of it's contained value_type like so: std::vector v; unsigned u = v.value_type::Dim(); where Vector is ...
[ "c++", "stl" ]
2
15
2,619
1
0
2008-10-13T11:03:06.850000
2008-10-13T11:15:34.093000
197,266
197,317
Table layout wrong in IE(7)
Below is the code of a simple html with a table layout. In FF it's looking as I think it should look like, in IE7 it doesn't. what am I doing wrong? And how can I fix it? test 192 100 200 200 200 200 100 100 100 100 100 100 100
I assume you are complaining about the minimal height of the middle row (the one containing only rowspanned cells), and the enlarged height of the adjacent rows to compensate, leaving gaps between the divs. IE cannot calculate optimal row heights when the row contains only rowspanned cells. The usual solution when you ...
Table layout wrong in IE(7) Below is the code of a simple html with a table layout. In FF it's looking as I think it should look like, in IE7 it doesn't. what am I doing wrong? And how can I fix it? test 192 100 200 200 200 200 100 100 100 100 100 100 100
TITLE: Table layout wrong in IE(7) QUESTION: Below is the code of a simple html with a table layout. In FF it's looking as I think it should look like, in IE7 it doesn't. what am I doing wrong? And how can I fix it? test 192 100 200 200 200 200 100 100 100 100 100 100 100 ANSWER: I assume you are complaining about th...
[ "html", "layout", "internet-explorer-7", "html-table" ]
4
4
11,278
6
0
2008-10-13T11:10:54.057000
2008-10-13T11:42:16.270000
197,274
230,949
What are "ForwardedTypes" in the context of Castle Windsor component registration?
As the subject says, really! What do they do?
Forwarded types allow you to have more than one service implemented by a single implementation, for a concrete example say we have two interfaces for working with tree nodes of some sort: public interface INodeAlterationProvider {... } public interface IChildNodeListProvider {... } And various components take a depende...
What are "ForwardedTypes" in the context of Castle Windsor component registration? As the subject says, really! What do they do?
TITLE: What are "ForwardedTypes" in the context of Castle Windsor component registration? QUESTION: As the subject says, really! What do they do? ANSWER: Forwarded types allow you to have more than one service implemented by a single implementation, for a concrete example say we have two interfaces for working with t...
[ "c#", "inversion-of-control", "castle-windsor" ]
16
19
3,464
1
0
2008-10-13T11:16:02.003000
2008-10-23T18:48:32.893000
197,291
197,300
Grouping by intervals
Given a table (mytable) containing a numeric field (mynum), how would one go about writing an SQL query which summarizes the table's data based on ranges of values in that field rather than each distinct value? For the sake of a more concrete example, let's make it intervals of 3 and just "summarize" with a count(*), s...
The idea is to compute some function of the field that has constant value within each group you want: select count(*), round(mynum/3.0) foo from mytable group by foo;
Grouping by intervals Given a table (mytable) containing a numeric field (mynum), how would one go about writing an SQL query which summarizes the table's data based on ranges of values in that field rather than each distinct value? For the sake of a more concrete example, let's make it intervals of 3 and just "summari...
TITLE: Grouping by intervals QUESTION: Given a table (mytable) containing a numeric field (mynum), how would one go about writing an SQL query which summarizes the table's data based on ranges of values in that field rather than each distinct value? For the sake of a more concrete example, let's make it intervals of 3...
[ "sql", "mysql" ]
17
19
14,799
2
0
2008-10-13T11:28:06.067000
2008-10-13T11:33:20.877000
197,297
197,299
How do you design an enumerator that returns (theoretically) an infinite amount of items?
I'm writing code that looks similar to this: public IEnumerable Unfold (this T seed) { while (true) { yield return [next (T)object in custom sequence]; } } Obviously, this method is never going to return. (The C# compiler silently allows this, while R# gives me the warning "Function never returns".) Generally speaking,...
So long as you document very clearly that the method will never finish iterating (the method itself returns very quickly, of course) then I think it's fine. Indeed, it can make some algorithms much neater. I don't believe there are any significant memory/perf implications - although if you refer to an "expensive" objec...
How do you design an enumerator that returns (theoretically) an infinite amount of items? I'm writing code that looks similar to this: public IEnumerable Unfold (this T seed) { while (true) { yield return [next (T)object in custom sequence]; } } Obviously, this method is never going to return. (The C# compiler silently...
TITLE: How do you design an enumerator that returns (theoretically) an infinite amount of items? QUESTION: I'm writing code that looks similar to this: public IEnumerable Unfold (this T seed) { while (true) { yield return [next (T)object in custom sequence]; } } Obviously, this method is never going to return. (The C#...
[ "c#", "enumerator" ]
6
7
1,294
4
0
2008-10-13T11:31:39.507000
2008-10-13T11:33:20.017000
197,302
197,326
How to unset variable in C#?
How can I unset variable? For example, PHP has an unset($var) function.
There is not really an equivalent to "unset". The closest match I know is the use of the default keyword. For example: MyType myvar = default(MyType); string a = default(string); The variable will still be "set", but it will have its default value.
How to unset variable in C#? How can I unset variable? For example, PHP has an unset($var) function.
TITLE: How to unset variable in C#? QUESTION: How can I unset variable? For example, PHP has an unset($var) function. ANSWER: There is not really an equivalent to "unset". The closest match I know is the use of the default keyword. For example: MyType myvar = default(MyType); string a = default(string); The variable ...
[ "c#" ]
30
34
68,913
10
0
2008-10-13T11:33:54.867000
2008-10-13T11:47:06.027000
197,304
197,788
local rails on Mac OSX loses connection to mysql
On occasion, my local Rails app loses its connection to MySQL. I get some error that the connection failed, but if I just refresh the page, it works fine. This has never happpened in my STAGE or PROD environments (I deploy to Ubuntu), so it has not been that big a deal. Does this happen to anybody else? Is there someth...
I remember having this problem a while back (before i upgraded to Leopard?). They're tricky to diagnose, but have a look at logfiles, and try setting "wait_timeout" longer (you shouldn't have to mess with "max_connections". See: http://www.mysqlperformanceblog.com/2008/08/23/how-to-track-down-the-source-of-aborted_conn...
local rails on Mac OSX loses connection to mysql On occasion, my local Rails app loses its connection to MySQL. I get some error that the connection failed, but if I just refresh the page, it works fine. This has never happpened in my STAGE or PROD environments (I deploy to Ubuntu), so it has not been that big a deal. ...
TITLE: local rails on Mac OSX loses connection to mysql QUESTION: On occasion, my local Rails app loses its connection to MySQL. I get some error that the connection failed, but if I just refresh the page, it works fine. This has never happpened in my STAGE or PROD environments (I deploy to Ubuntu), so it has not been...
[ "mysql", "ruby-on-rails", "macos" ]
3
1
261
2
0
2008-10-13T11:34:54.867000
2008-10-13T14:34:01.120000
197,307
197,313
Best way to search in a varchar column in sql server
What would you recommend to search a sql server table (varchar(max) column) for a term? Let's say, like in ebay, if you search for "wii brand new", you get results like "Brand New Nintendo Wii Fit Game + Balance Board Bundle", "Wii Fit (Wii) BRAND NEW WII FIT GAME + BALANCE BOARD". I think it basically searches every w...
You are looking for fulltext indexing, it allows you to do more advanced querying than regular expressions or like. Check this article for a quick introduction, the instructions are for SQL Server 2000, where it is a little harder to setup than in 2005 or 2008. Relevant quote: With full-text searching, you can perform ...
Best way to search in a varchar column in sql server What would you recommend to search a sql server table (varchar(max) column) for a term? Let's say, like in ebay, if you search for "wii brand new", you get results like "Brand New Nintendo Wii Fit Game + Balance Board Bundle", "Wii Fit (Wii) BRAND NEW WII FIT GAME + ...
TITLE: Best way to search in a varchar column in sql server QUESTION: What would you recommend to search a sql server table (varchar(max) column) for a term? Let's say, like in ebay, if you search for "wii brand new", you get results like "Brand New Nintendo Wii Fit Game + Balance Board Bundle", "Wii Fit (Wii) BRAND N...
[ "sql-server", "search" ]
6
6
15,818
2
0
2008-10-13T11:37:02.600000
2008-10-13T11:40:13.747000
197,319
197,356
Kohana PHP, ORM and MySQL BLOBs
I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's ORM library. The code looks something like: $attachment = new Attachment_Model(); $attachment->name = $info['FileName']; $attachment->size = strlen($info['Data']); $attachment->data = $info['Data']; $attachment->mime_type = $info['content-type']; $a...
It turns out that, in this case, I was using the BLOB data type. The BLOB data type truncates data at 65535 characters (silently, without throwing an error!) I've upped it to a MEDIUMBLOB (which has a max length of 16777215 characters), and it seems to work OK!
Kohana PHP, ORM and MySQL BLOBs I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's ORM library. The code looks something like: $attachment = new Attachment_Model(); $attachment->name = $info['FileName']; $attachment->size = strlen($info['Data']); $attachment->data = $info['Data']; $attachment->mime_...
TITLE: Kohana PHP, ORM and MySQL BLOBs QUESTION: I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's ORM library. The code looks something like: $attachment = new Attachment_Model(); $attachment->name = $info['FileName']; $attachment->size = strlen($info['Data']); $attachment->data = $info['Data']; ...
[ "php", "mysql", "orm", "kohana", "blob" ]
3
3
1,949
2
0
2008-10-13T11:43:28.327000
2008-10-13T12:09:24.283000
197,345
197,506
Flash Organisation Chart
I've been searching for a library that can render organisation charts in either flash and/or javascript(preferably jQuery). I know of several javascript and/or flash chart libraries but none of them seem to be able to render an organisation chart such as this: http://www.fsai.ie/images/org_chart.gif
iLog Elixir seems to have what you're looking for, in Flash/Flex. It's a commercial product and quite expensive, though. I Also found these blog posts (apparently by people from their dev team) where you can see a bit of how org charts are implemented in their product.
Flash Organisation Chart I've been searching for a library that can render organisation charts in either flash and/or javascript(preferably jQuery). I know of several javascript and/or flash chart libraries but none of them seem to be able to render an organisation chart such as this: http://www.fsai.ie/images/org_char...
TITLE: Flash Organisation Chart QUESTION: I've been searching for a library that can render organisation charts in either flash and/or javascript(preferably jQuery). I know of several javascript and/or flash chart libraries but none of them seem to be able to render an organisation chart such as this: http://www.fsai....
[ "javascript", "jquery", "flash", "charts" ]
2
4
4,505
3
0
2008-10-13T12:03:45.620000
2008-10-13T12:57:08.787000
197,357
198,888
ASP.NET Forms Authentication With Only UserName
I have a bit of a hybrid situation on my hands. I'm writing an intranet asp.net web app. I don't want to use full blown Windows Authentication, because I don't have proper groups set up in Active Directory to be able to authenticate users simply based on what group they are in. Up until now, I had created a membership ...
Set your web.config to use Forms Authentication. Make sure Integrated Authentication is turned on in IIS (you may need to disable anonymous as well). This will allow you to get the user's NT name. You can get the user's NT name with: Request.ServerVariables["LOGON_USER"] You can log the user in, no password needed, wit...
ASP.NET Forms Authentication With Only UserName I have a bit of a hybrid situation on my hands. I'm writing an intranet asp.net web app. I don't want to use full blown Windows Authentication, because I don't have proper groups set up in Active Directory to be able to authenticate users simply based on what group they a...
TITLE: ASP.NET Forms Authentication With Only UserName QUESTION: I have a bit of a hybrid situation on my hands. I'm writing an intranet asp.net web app. I don't want to use full blown Windows Authentication, because I don't have proper groups set up in Active Directory to be able to authenticate users simply based on...
[ "asp.net", "security", "asp.net-membership", "membership" ]
0
7
1,313
1
0
2008-10-13T12:09:31.740000
2008-10-13T20:18:01.660000
197,362
197,597
Select products where the category belongs to any category in the hierarchy
I have a products table that contains a FK for a category, the Categories table is created in a way that each category can have a parent category, example: Computers Processors Intel Pentium Core 2 Duo AMD Athlon I need to make a select query that if the selected category is Processors, it will return products that is ...
The best solution for this is at the database design stage. Your categories table needs to be a Nested Set. The article Managing Hierarchical Data in MySQL is not that MySQL specific (despite the title), and gives a great overview of the different methods of storing a hierarchy in a database table. Executive Summary: N...
Select products where the category belongs to any category in the hierarchy I have a products table that contains a FK for a category, the Categories table is created in a way that each category can have a parent category, example: Computers Processors Intel Pentium Core 2 Duo AMD Athlon I need to make a select query t...
TITLE: Select products where the category belongs to any category in the hierarchy QUESTION: I have a products table that contains a FK for a category, the Categories table is created in a way that each category can have a parent category, example: Computers Processors Intel Pentium Core 2 Duo AMD Athlon I need to mak...
[ "sql", "sql-server", "select", "hierarchy" ]
8
6
6,880
9
0
2008-10-13T12:10:41.393000
2008-10-13T13:35:55.573000
197,369
197,434
Library of Useful (Difficult) SQL scripts
Does anyone know where I can find a library of common but difficult (out of the ordinary) SQL script examples. I am talking about those examples you cannot find in the documentation but do need very often to accomplish tasks such as finding duplicates etc. It would be a big time saver to have something like that handy....
You may find this wiki on LessThanDot useful, for the most part, it is by Denis Gobo, Microsoft SQL MVP. EDIT: The wiki includes 100+ SQL Server Programming Hacks, the list is, I think, too long to include here, however, there is a comprehensive index. Also available from the same site: SQL Server Admin Hacks.
Library of Useful (Difficult) SQL scripts Does anyone know where I can find a library of common but difficult (out of the ordinary) SQL script examples. I am talking about those examples you cannot find in the documentation but do need very often to accomplish tasks such as finding duplicates etc. It would be a big tim...
TITLE: Library of Useful (Difficult) SQL scripts QUESTION: Does anyone know where I can find a library of common but difficult (out of the ordinary) SQL script examples. I am talking about those examples you cannot find in the documentation but do need very often to accomplish tasks such as finding duplicates etc. It ...
[ "sql", "scripting" ]
68
52
20,470
11
0
2008-10-13T12:18:23.843000
2008-10-13T12:37:23.430000
197,372
197,374
Parameterized test case classes in JUnit 3.x
I have a JUnit 3.x TestCase which I would like to be able to parameterize. I'd like to parametrize the entire TestCase (including the fixture). However, the TestSuite.addTestSuite() method does not allow be to pass a TestCase object, just a class: TestSuite suite = new TestSuite("suite"); suite.addTestSuite(MyTestCase....
If this is Java 5 or higher, you might want to consider switching to JUnit 4, which has support for parameterized test cases built in.
Parameterized test case classes in JUnit 3.x I have a JUnit 3.x TestCase which I would like to be able to parameterize. I'd like to parametrize the entire TestCase (including the fixture). However, the TestSuite.addTestSuite() method does not allow be to pass a TestCase object, just a class: TestSuite suite = new TestS...
TITLE: Parameterized test case classes in JUnit 3.x QUESTION: I have a JUnit 3.x TestCase which I would like to be able to parameterize. I'd like to parametrize the entire TestCase (including the fixture). However, the TestSuite.addTestSuite() method does not allow be to pass a TestCase object, just a class: TestSuite...
[ "java", "junit" ]
5
3
9,897
5
0
2008-10-13T12:18:43.280000
2008-10-13T12:21:06.410000
197,375
197,382
Visual c++ "for each" portability
I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports for each syntax on stl lists et al to facilitate iteration. For example: list myList; for each (Object o in myList) { o.foo(); } I was very happy to discover it, but I'm concerned about portability for the dreaded day...
For each is not standard C or C++ syntax. If you want to be able to compile this code in gcc or g++, you will need to create an iterator and use a standard for loop. QuantumPete [edit] This seems to be a new feature introduced into MS Visual C++, so this is definitely not portable. Ref: http://msdn.microsoft.com/en-us/...
Visual c++ "for each" portability I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports for each syntax on stl lists et al to facilitate iteration. For example: list myList; for each (Object o in myList) { o.foo(); } I was very happy to discover it, but I'm concerned abo...
TITLE: Visual c++ "for each" portability QUESTION: I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports for each syntax on stl lists et al to facilitate iteration. For example: list myList; for each (Object o in myList) { o.foo(); } I was very happy to discover it, but...
[ "c++", "visual-c++", "stl", "foreach" ]
24
25
21,377
9
0
2008-10-13T12:21:29.343000
2008-10-13T12:23:03.100000
197,379
197,440
How do I create a symlink in Windows Vista?
I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to some good documentation on this subject would b...
Symbolic links in Windows are created using the CreateSymbolicLink API Function, which takes parameters very similar to the command line arguments accepted by the Mklink command line utility. Assuming you're correctly referencing the JNI and Win32 SDK headers, your code could thus be as simple as: JNIEXPORT jboolean JN...
How do I create a symlink in Windows Vista? I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to som...
TITLE: How do I create a symlink in Windows Vista? QUESTION: I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the lin...
[ "c++", "c", "windows", "java-native-interface", "symlink" ]
6
10
3,294
3
0
2008-10-13T12:22:27.983000
2008-10-13T12:38:15.830000
197,381
197,408
Optimizing single-row queries from large tables in MySQL
I am dealing with MySQL tables that are essentially results of raytracing simulations on a simulated office room with a single venetian blind. I usually need to retrieve the simulation's result for a unique combination of time and blind's settings. So I end up doing a lot of SELECT result FROM results WHERE timestamp='...
The answer is most definately a yes. If you define a unique index on timestamp, opening and slatangle MySQL should be able to find your row with very few disc seeks. You might experiment with creating an index on timestamp, opening, slateangle and result. MySQL may be able to fetch your data from the index without touc...
Optimizing single-row queries from large tables in MySQL I am dealing with MySQL tables that are essentially results of raytracing simulations on a simulated office room with a single venetian blind. I usually need to retrieve the simulation's result for a unique combination of time and blind's settings. So I end up do...
TITLE: Optimizing single-row queries from large tables in MySQL QUESTION: I am dealing with MySQL tables that are essentially results of raytracing simulations on a simulated office room with a single venetian blind. I usually need to retrieve the simulation's result for a unique combination of time and blind's settin...
[ "mysql", "optimization" ]
2
3
1,124
4
0
2008-10-13T12:22:51.213000
2008-10-13T12:30:37.670000
197,383
1,583,143
Locating bundles by identifier
I want to create a bundle from an arbitrary bundle identifier e.g. com.apple.iokit.IOStorageFamily It's not an unreasonable thing to do as bundle IDs are supposed to be unique, however the obvious code does not work: NSString* bID = @"com.apple.iokit.IOStorageFamily"; NSBundle* bundle = [NSBundle bundleWithIdentifier:b...
Just recently Andrew Myrick answered a similar question on the darwin-dev mailing list: KextManagerCreateURLForBundleIdentifier() in may be of use, though I believe it only works for kexts that are either 1) loaded, or 2) in /S/L/E/. Here is the Snow Leopard headerdoc: /*! * @function KextManagerCreateURLForBundleIdent...
Locating bundles by identifier I want to create a bundle from an arbitrary bundle identifier e.g. com.apple.iokit.IOStorageFamily It's not an unreasonable thing to do as bundle IDs are supposed to be unique, however the obvious code does not work: NSString* bID = @"com.apple.iokit.IOStorageFamily"; NSBundle* bundle = [...
TITLE: Locating bundles by identifier QUESTION: I want to create a bundle from an arbitrary bundle identifier e.g. com.apple.iokit.IOStorageFamily It's not an unreasonable thing to do as bundle IDs are supposed to be unique, however the obvious code does not work: NSString* bID = @"com.apple.iokit.IOStorageFamily"; NS...
[ "cocoa", "macos" ]
6
3
5,125
6
0
2008-10-13T12:23:03.413000
2009-10-17T20:40:37.920000
197,387
197,499
Docstrings for data?
Is there a way to describe the module's data in a similar way that a docstring describes a module or a funcion? class MyClass(object): def my_function(): """This docstring works!""" return True my_list = [] """This docstring does not work!"""
To my knowledge, it is not possible to assign docstrings to module data members. PEP 224 suggests this feature, but the PEP was rejected. I suggest you document the data members of a module in the module's docstring: # module.py: """About the module. module.data: contains the word "spam" """ data = "spam"
Docstrings for data? Is there a way to describe the module's data in a similar way that a docstring describes a module or a funcion? class MyClass(object): def my_function(): """This docstring works!""" return True my_list = [] """This docstring does not work!"""
TITLE: Docstrings for data? QUESTION: Is there a way to describe the module's data in a similar way that a docstring describes a module or a funcion? class MyClass(object): def my_function(): """This docstring works!""" return True my_list = [] """This docstring does not work!""" ANSWER: To my knowledge, it is not po...
[ "python", "docstring" ]
22
15
2,174
3
0
2008-10-13T12:24:04.160000
2008-10-13T12:55:53.813000
197,388
197,431
Generate User Specific 1 Time Coupon Code
So I need to generate a code that can be tied to a specific user/prospect with a dollar amount built into it. It needs to be reversible so that client application can confirm the validity of the code and apply the discount a manager intends. I'd like to make the code as short as possible but it needs to be well obfusca...
Generate a public/private key pair for signing. Digitally sign the combination of user ID and coupon value using the private key. Publish the coupon value + signature as the coupon code, encoded, for example, using letters and numbers. The client application would verify the code by recreating the combination of data t...
Generate User Specific 1 Time Coupon Code So I need to generate a code that can be tied to a specific user/prospect with a dollar amount built into it. It needs to be reversible so that client application can confirm the validity of the code and apply the discount a manager intends. I'd like to make the code as short a...
TITLE: Generate User Specific 1 Time Coupon Code QUESTION: So I need to generate a code that can be tied to a specific user/prospect with a dollar amount built into it. It needs to be reversible so that client application can confirm the validity of the code and apply the discount a manager intends. I'd like to make t...
[ "c#", "language-agnostic", "encoding", "cryptography" ]
8
7
5,102
7
0
2008-10-13T12:24:04.783000
2008-10-13T12:36:52.057000
197,407
200,913
Define a calculated member in MDX by filtering a measure's value
I need to define a calculated member in MDX (this is SAS OLAP, but I'd appreciate answers from people who work with different OLAP implementations anyway). The new measure's value should be calculated from an existing measure by applying an additional filter condition. I suppose it will be clearer with an example: Exis...
To begin with, you can define a new calculated measure in your MDX, and tell it to use the value of another measure, but with a filter applied: WITH MEMBER [Measures].[Incoming Traffic] AS '([Measures].[Total traffic], [Direction].[(All)].[In])' Whenever you show the new measure on a report, it will behave as if it has...
Define a calculated member in MDX by filtering a measure's value I need to define a calculated member in MDX (this is SAS OLAP, but I'd appreciate answers from people who work with different OLAP implementations anyway). The new measure's value should be calculated from an existing measure by applying an additional fil...
TITLE: Define a calculated member in MDX by filtering a measure's value QUESTION: I need to define a calculated member in MDX (this is SAS OLAP, but I'd appreciate answers from people who work with different OLAP implementations anyway). The new measure's value should be calculated from an existing measure by applying...
[ "sas", "olap", "mdx" ]
3
8
27,489
2
0
2008-10-13T12:30:32.757000
2008-10-14T12:16:59.803000
197,410
197,583
Enterprise Library Database Trace Listener?
I'm using EntLib v4 for Logging and currently I'm saving the events to the default text file listener. I would like to use MS SQL database as my event sink and I saw that the database listener is already provided, but I don't know how to create logging database and stored procedures? After googling around I saw that in...
I just checked and its in the installation for the source. On my machine its in C:\EntLib4Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts. You can use the createloggingdb.cmd file or parse loggingdatabase.sql yourself for the relevant commands.
Enterprise Library Database Trace Listener? I'm using EntLib v4 for Logging and currently I'm saving the events to the default text file listener. I would like to use MS SQL database as my event sink and I saw that the database listener is already provided, but I don't know how to create logging database and stored pro...
TITLE: Enterprise Library Database Trace Listener? QUESTION: I'm using EntLib v4 for Logging and currently I'm saving the events to the default text file listener. I would like to use MS SQL database as my event sink and I saw that the database listener is already provided, but I don't know how to create logging datab...
[ "enterprise-library" ]
5
8
5,353
1
0
2008-10-13T12:30:57
2008-10-13T13:31:45.300000
197,414
197,454
Handle errors with ErrorController rather than a direct view
I'm trying to get my head around the Error Handling in MVC. What I'm looking for is a centralized way to catch errors, log them, if possible resolve them, if nessecary take other actions and finally show the correct view to the user. I think I can use the [HandleError] filter for this, but I don't see any way to route ...
HandleErrorAttribute that comes with MVC is a pretty basic IExceptionFilter. You have a few options to achieve what i think u want. You can either use [HandleError (Type=typeof(MyException),View="ErrorView")] on actions/controllers or implement your own HandleErrorAttribute isnt very complex. I think MS recommends you ...
Handle errors with ErrorController rather than a direct view I'm trying to get my head around the Error Handling in MVC. What I'm looking for is a centralized way to catch errors, log them, if possible resolve them, if nessecary take other actions and finally show the correct view to the user. I think I can use the [Ha...
TITLE: Handle errors with ErrorController rather than a direct view QUESTION: I'm trying to get my head around the Error Handling in MVC. What I'm looking for is a centralized way to catch errors, log them, if possible resolve them, if nessecary take other actions and finally show the correct view to the user. I think...
[ "c#", "asp.net-mvc", "error-handling", "error-logging" ]
6
4
7,118
4
0
2008-10-13T12:32:02.987000
2008-10-13T12:41:57.307000
197,444
199,052
Building libcurl with SSL support on Windows
I'm using libcurl in a Win32 C++ application. I have the curllib.vcproj project added to my solution and set my other projects to depend on it. How do I build it with SSL support enabled?
This answer is outdated. See the actual guide here https://curl.se/docs/install.html. cmake is also available. Well, since this post failed badly, I had to dig into the matter myself. Also check out the other answers and comments for additional info regarding other versions etc. EDIT: Since I posted this Q there seems ...
Building libcurl with SSL support on Windows I'm using libcurl in a Win32 C++ application. I have the curllib.vcproj project added to my solution and set my other projects to depend on it. How do I build it with SSL support enabled?
TITLE: Building libcurl with SSL support on Windows QUESTION: I'm using libcurl in a Win32 C++ application. I have the curllib.vcproj project added to my solution and set my other projects to depend on it. How do I build it with SSL support enabled? ANSWER: This answer is outdated. See the actual guide here https://c...
[ "winapi", "ssl", "curl", "openssl", "libcurl" ]
44
48
56,432
10
0
2008-10-13T12:39:40.117000
2008-10-13T21:14:15.430000
197,447
197,456
How to find all dependencies of a .NET project?
Basically, what I need is something like Dependecy Walker, but it should work with.NET applications. Is there anywhere such tool?
Reflector - previously from Lutz Roeder, now from Red-Gate software.
How to find all dependencies of a .NET project? Basically, what I need is something like Dependecy Walker, but it should work with.NET applications. Is there anywhere such tool?
TITLE: How to find all dependencies of a .NET project? QUESTION: Basically, what I need is something like Dependecy Walker, but it should work with.NET applications. Is there anywhere such tool? ANSWER: Reflector - previously from Lutz Roeder, now from Red-Gate software.
[ ".net", "dependencies" ]
21
10
23,478
8
0
2008-10-13T12:39:49.010000
2008-10-13T12:42:28.333000
197,459
197,470
Why are Wemf and Google Analytics telling me so different things?
The website works with Wemf and Google Analytics, but they are giving me very different results; WEMF counts 10 - 30 % more page views than Google Analytics... Why can this be? Google Analytics works only with JavaScript enabled, yes - but I don't think that's the reason for this difference. The site which should be co...
Don't know much about WEMF. Could it be that Google Analytics does a better job at detecting and not counting search engine spider traffic?
Why are Wemf and Google Analytics telling me so different things? The website works with Wemf and Google Analytics, but they are giving me very different results; WEMF counts 10 - 30 % more page views than Google Analytics... Why can this be? Google Analytics works only with JavaScript enabled, yes - but I don't think ...
TITLE: Why are Wemf and Google Analytics telling me so different things? QUESTION: The website works with Wemf and Google Analytics, but they are giving me very different results; WEMF counts 10 - 30 % more page views than Google Analytics... Why can this be? Google Analytics works only with JavaScript enabled, yes - ...
[ "statistics", "count", "google-analytics" ]
1
5
397
3
0
2008-10-13T12:44:15.257000
2008-10-13T12:47:07.497000
197,461
197,464
What is the difference between "VC++" and "C++"?
Someone asked me how familiar I am with VC++ and how familiar I am with C++. What is the difference?
C++ is the actual language, VC++ is Microsoft's Visual C++, an IDE for C++ development. From stason.org: C++ is the programming language, Visual C++ is Microsoft's implementation of it. When people talk about learning Visual C++, it usually has more to do with learning how to use the programming environment, and how to...
What is the difference between "VC++" and "C++"? Someone asked me how familiar I am with VC++ and how familiar I am with C++. What is the difference?
TITLE: What is the difference between "VC++" and "C++"? QUESTION: Someone asked me how familiar I am with VC++ and how familiar I am with C++. What is the difference? ANSWER: C++ is the actual language, VC++ is Microsoft's Visual C++, an IDE for C++ development. From stason.org: C++ is the programming language, Visua...
[ "c++", "visual-c++" ]
59
75
33,863
10
0
2008-10-13T12:44:35.943000
2008-10-13T12:46:20.137000
197,466
197,475
What's a good templating system for PHP?
What's the best/easiest to integrate templating system for PHP, and what are the benefits of using one? I currently don't use one at all, and am thinking that it might help to seperate content from presentation a little more.
Smarty I've found it to be fast, easy to use, and easy to install (even in a shared-hosting environment). It also doesn't require that you use validating XHTML which is handy sometimes (although I think the template engines that do require valid XHTML are probably faster.) It's really nice to have your content in one p...
What's a good templating system for PHP? What's the best/easiest to integrate templating system for PHP, and what are the benefits of using one? I currently don't use one at all, and am thinking that it might help to seperate content from presentation a little more.
TITLE: What's a good templating system for PHP? QUESTION: What's the best/easiest to integrate templating system for PHP, and what are the benefits of using one? I currently don't use one at all, and am thinking that it might help to seperate content from presentation a little more. ANSWER: Smarty I've found it to be...
[ "php", "templates" ]
5
12
1,378
9
0
2008-10-13T12:46:45.860000
2008-10-13T12:47:49.993000
197,468
253,883
Does ATL/WTL still require the use of a global _Module variable?
I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as: CAppModule _Module; To get ATL to work correctly. But recently I've read som...
Technically you do not need a global _Module instance since ATL/WTL version 7. Earlier ATL/WTL code referenced _Module by this specific name and expected you to declare a single instance of this object. This has since been replaced by a single instance object named _AtlBaseModule that is automatically declared for you ...
Does ATL/WTL still require the use of a global _Module variable? I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as: CAppModule ...
TITLE: Does ATL/WTL still require the use of a global _Module variable? QUESTION: I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable su...
[ "c++", "atl", "wtl" ]
5
7
3,938
2
0
2008-10-13T12:46:55.970000
2008-10-31T15:16:18.333000
197,474
197,496
JPA and Hibernate - Criteria vs. JPQL or HQL
What are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to understand/build than HQL. When do you use Criteria and when HQL? What do you prefer in which use cases? Or is it just a matter of tas...
I mostly prefer Criteria Queries for dynamic queries. For example it is much easier to add some ordering dynamically or leave some parts (e.g. restrictions) out depending on some parameter. On the other hand I'm using HQL for static and complex queries, because it's much easier to understand/read HQL. Also, HQL is a bi...
JPA and Hibernate - Criteria vs. JPQL or HQL What are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to understand/build than HQL. When do you use Criteria and when HQL? What do you prefer in w...
TITLE: JPA and Hibernate - Criteria vs. JPQL or HQL QUESTION: What are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to understand/build than HQL. When do you use Criteria and when HQL? What ...
[ "java", "hibernate", "hql", "criteria", "hibernate-criteria" ]
312
220
160,745
22
0
2008-10-13T12:47:33.067000
2008-10-13T12:54:37.357000
197,489
197,505
jQuery drag and drop - how to get at element being dragged
I am using the jQuery library to implement drag and drop. How do I get at the element that is being dragged when it is dropped? I want to get the id of the image inside the div. The following element is dragged: I have the standard dropped function from their example: $(".drop").droppable({ accept: ".block", activeClas...
Is it not the ui.draggable? If you go here (in Firefox and assuming you have firebug) and look in the firebug console youll see I am doing a console.dir of the ui.draggable object which is the div being dragged http://jsbin.com/ixizi Therefore the code you need in the drop function is drop: function(ev, ui) { //to get ...
jQuery drag and drop - how to get at element being dragged I am using the jQuery library to implement drag and drop. How do I get at the element that is being dragged when it is dropped? I want to get the id of the image inside the div. The following element is dragged: I have the standard dropped function from their e...
TITLE: jQuery drag and drop - how to get at element being dragged QUESTION: I am using the jQuery library to implement drag and drop. How do I get at the element that is being dragged when it is dropped? I want to get the id of the image inside the div. The following element is dragged: I have the standard dropped fun...
[ "javascript", "jquery", "drag-and-drop" ]
38
41
90,510
8
0
2008-10-13T12:51:32.573000
2008-10-13T12:57:00.253000
197,497
197,504
How do I determine number of window handles an application is using?
What is the best way to determine how many window handles an application is using? Is there a tool or a WMI performance counter that I could use? I would like to run up an app and watch a counter of some sort and see that the number of window handles is increasing. for (int i=0; i < 1000; i++) { System.Threading.Thread...
Perfmon, which comes with your computer can do it. You can also add a column to your task manager processes tab (Handle Count). Instructions for Perfmon Add a counter (click the +) Choose Process under Performance object Choose Handle Count under the counter list Choose your process from the instance list Click Add, cl...
How do I determine number of window handles an application is using? What is the best way to determine how many window handles an application is using? Is there a tool or a WMI performance counter that I could use? I would like to run up an app and watch a counter of some sort and see that the number of window handles ...
TITLE: How do I determine number of window handles an application is using? QUESTION: What is the best way to determine how many window handles an application is using? Is there a tool or a WMI performance counter that I could use? I would like to run up an app and watch a counter of some sort and see that the number ...
[ "windows", "winapi" ]
5
11
15,208
4
0
2008-10-13T12:55:27.653000
2008-10-13T12:56:55.467000
197,518
199,621
Can I create a single VB6 OCX with multiple controls?
I have inherited a load of VB6 code which has tons of individual OCX files, each of which contain a single control. I have two questions: Firstly, Is it possible to refactor them so that I can have a single OCX file with all the OCX's in it? Secondly, if it is possible, how do I do this? TIA
Yes this is possible. You can do this by selecting Project->Add User Control from within an existing ActiveX User Control project. From here you can choose to add a new control to the project or add an existing user control. Also, it can certainly make sense to group related controls together into a single project, as ...
Can I create a single VB6 OCX with multiple controls? I have inherited a load of VB6 code which has tons of individual OCX files, each of which contain a single control. I have two questions: Firstly, Is it possible to refactor them so that I can have a single OCX file with all the OCX's in it? Secondly, if it is possi...
TITLE: Can I create a single VB6 OCX with multiple controls? QUESTION: I have inherited a load of VB6 code which has tons of individual OCX files, each of which contain a single control. I have two questions: Firstly, Is it possible to refactor them so that I can have a single OCX file with all the OCX's in it? Second...
[ "com", "vb6", "ocx" ]
1
6
2,184
2
0
2008-10-13T13:00:56.237000
2008-10-14T00:50:27.227000
197,521
197,530
Best way of using List<T> and exposing Collection<T>
I must implement a web service which expose a list of values (integers, custom classes etc). My working solution returns a List, and according to FxCop it is better to return a Collection or ReadOnlyCollection. If I choose to return a ReadOnlyCollection, the web service shows an error like: To be XML serializable, type...
List or Collection are fine in this case. In terms of the original question, you can wrap a List in a Collection very simply: List list = new List (); //... Collection col = new Collection (list); This is a true wrapper; add an item to the wrapper (col), and it gets added to the list. This can be slightly confusing, be...
Best way of using List<T> and exposing Collection<T> I must implement a web service which expose a list of values (integers, custom classes etc). My working solution returns a List, and according to FxCop it is better to return a Collection or ReadOnlyCollection. If I choose to return a ReadOnlyCollection, the web serv...
TITLE: Best way of using List<T> and exposing Collection<T> QUESTION: I must implement a web service which expose a list of values (integers, custom classes etc). My working solution returns a List, and according to FxCop it is better to return a Collection or ReadOnlyCollection. If I choose to return a ReadOnlyCollec...
[ "c#", "web-services", "generics", "fxcop" ]
8
14
2,273
2
0
2008-10-13T13:01:43.567000
2008-10-13T13:05:46.587000
197,525
197,556
What is the simplest way to charge money over the Internet?
I have a.Net 2.0/3.5 WebApplication. I want to be able to take money over the internet for my service. Each of my customers will have an AccountNo. I wish to offer several products each of which will have fixed price. I need for my customer to login to my system and elect to pay me money for a product of their choice a...
I've used 2checkout.com for years and found it to be a good solution. I eventually switched to regnow but only because I wanted to take advantage of their affiliate network. Here are some options: 2checkout.com regnow (also has affiliate network) paypal - In contrast to what most people think, you don't need a paypal a...
What is the simplest way to charge money over the Internet? I have a.Net 2.0/3.5 WebApplication. I want to be able to take money over the internet for my service. Each of my customers will have an AccountNo. I wish to offer several products each of which will have fixed price. I need for my customer to login to my syst...
TITLE: What is the simplest way to charge money over the Internet? QUESTION: I have a.Net 2.0/3.5 WebApplication. I want to be able to take money over the internet for my service. Each of my customers will have an AccountNo. I wish to offer several products each of which will have fixed price. I need for my customer t...
[ ".net", "asp.net-2.0", "payment" ]
14
7
2,082
6
0
2008-10-13T13:04:18.850000
2008-10-13T13:19:08.807000
197,571
197,610
What real-world projects would you suggest as code examples to study?
What real-world projects would you suggest looking through the sources? As I'm learning Java Swing, mucommander seems to be a decent example. The code is excessively commented though. EDIT: No shameless plugs plz:).
Take a look at the Windows version of truecrypt. It is one of the best organized open source projects I've ever seen. You can almost tell how the whole thing works just from the directory and file layout.
What real-world projects would you suggest as code examples to study? What real-world projects would you suggest looking through the sources? As I'm learning Java Swing, mucommander seems to be a decent example. The code is excessively commented though. EDIT: No shameless plugs plz:).
TITLE: What real-world projects would you suggest as code examples to study? QUESTION: What real-world projects would you suggest looking through the sources? As I'm learning Java Swing, mucommander seems to be a decent example. The code is excessively commented though. EDIT: No shameless plugs plz:). ANSWER: Take a ...
[ "coding-style" ]
5
0
512
5
0
2008-10-13T13:27:08.680000
2008-10-13T13:44:09.503000
197,589
922,240
What are best fit patterns to use when developing VSX Package or Isolated Shell Package?
When I am developing a bunch of designers/tools, what are some of the best fit patterns that go with a VSX Package and/or VSX Isolated Shell Package? Any samples, links would be great.
If you're looking for general design patterns, I would suggest looking into the Presentation Model pattern (also known as MVP and MVVM) for writing a custom designer. In general, all VSPackages (regardless of the kind of tool) use the Service Locator pattern (i.e. IServiceProvider) for communicating with the IDE and ot...
What are best fit patterns to use when developing VSX Package or Isolated Shell Package? When I am developing a bunch of designers/tools, what are some of the best fit patterns that go with a VSX Package and/or VSX Isolated Shell Package? Any samples, links would be great.
TITLE: What are best fit patterns to use when developing VSX Package or Isolated Shell Package? QUESTION: When I am developing a bunch of designers/tools, what are some of the best fit patterns that go with a VSX Package and/or VSX Isolated Shell Package? Any samples, links would be great. ANSWER: If you're looking f...
[ "design-patterns", "vsx" ]
2
2
228
2
0
2008-10-13T13:33:57.963000
2009-05-28T17:41:24.077000
197,603
197,647
Uploading and Downloading Comparison using WebRequest & Sockets
Hiya I am working on an FTP client, can someone tell me the difference in speed and efficiency for using WebRequest and sockets (direct network streams) to download and upload files on the FTP server. (Our files will be video streams.) I am using C#3.5.
This is without the benefit of extensive testing but I've used both methods in the past. WebRequest does some inheriting from the Stream class and is really just a convenient wrapper for doing the sort of work you're up to. Any losses you might face could, I think, be written off as negligible. Perhaps a tiny amount of...
Uploading and Downloading Comparison using WebRequest & Sockets Hiya I am working on an FTP client, can someone tell me the difference in speed and efficiency for using WebRequest and sockets (direct network streams) to download and upload files on the FTP server. (Our files will be video streams.) I am using C#3.5.
TITLE: Uploading and Downloading Comparison using WebRequest & Sockets QUESTION: Hiya I am working on an FTP client, can someone tell me the difference in speed and efficiency for using WebRequest and sockets (direct network streams) to download and upload files on the FTP server. (Our files will be video streams.) I ...
[ "c#", "networking", "ftp" ]
1
1
432
1
0
2008-10-13T13:39:04.820000
2008-10-13T13:56:53.877000
197,614
197,652
Need help understanding "getbits()" method in Chapter 2 of K&R C
In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding how one of the sample methods works. Here's the method provided: unsigned int getbits(unsigned int x, int p, int n) { return (x >> (p + 1 - n)) & ~(~0 << n); } The idea is that, for the given number x, it will return the n bi...
Let's use 16 bits for our example. In that case, ~0 is equal to 1111111111111111 When we left-shift this n bits (3 in your case), we get: 1111111111111000 because the 1 s at the left are discarded and 0 s are fed in at the right. Then re-complementing it gives: 0000000000000111 so it's just a clever way to get n 1-bits...
Need help understanding "getbits()" method in Chapter 2 of K&R C In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding how one of the sample methods works. Here's the method provided: unsigned int getbits(unsigned int x, int p, int n) { return (x >> (p + 1 - n)) & ~(~0 << n); } ...
TITLE: Need help understanding "getbits()" method in Chapter 2 of K&R C QUESTION: In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding how one of the sample methods works. Here's the method provided: unsigned int getbits(unsigned int x, int p, int n) { return (x >> (p + 1 - n)...
[ "c", "operators", "bit-manipulation", "bit-shift", "complement" ]
36
43
14,226
6
0
2008-10-13T13:46:05.087000
2008-10-13T13:59:08.803000
197,621
197,666
How to safely allow web-server to write to its own docroot?
As a follow up to an earlier question that attracted a whole zero answers, I'm wondering about the possibilities of allowing a web server (apache) to write to its own document root (Linux), in order to dynamically create meta-redirect files. Of course, this sounds incredibly dangerous, and I'm wary of going the whole h...
What's usually done is to allow writes only to subdirectories, hopefully located in a noexec mounted partition. That said, it seems to me that you should just create a set of RewriteMap directives to do your dynamic redirection, there's no need to write files in the document root to accomplish that. I answered similarl...
How to safely allow web-server to write to its own docroot? As a follow up to an earlier question that attracted a whole zero answers, I'm wondering about the possibilities of allowing a web server (apache) to write to its own document root (Linux), in order to dynamically create meta-redirect files. Of course, this so...
TITLE: How to safely allow web-server to write to its own docroot? QUESTION: As a follow up to an earlier question that attracted a whole zero answers, I'm wondering about the possibilities of allowing a web server (apache) to write to its own document root (Linux), in order to dynamically create meta-redirect files. ...
[ "security", "apache", "webserver" ]
0
2
252
3
0
2008-10-13T13:48:26.703000
2008-10-13T14:03:59.387000
197,622
197,631
Commonclipse for Visual Studio?
Is there a Visual Studio plugin/tool/snippet for.NET that is similar to commonclipse for the java eclipse platform that automatically generates the ToString(), Equals(), GetHashCode() methods for you?
Resharper will do it. (not a free tool unfortunately) Here's a blog post about that specific functionality:
Commonclipse for Visual Studio? Is there a Visual Studio plugin/tool/snippet for.NET that is similar to commonclipse for the java eclipse platform that automatically generates the ToString(), Equals(), GetHashCode() methods for you?
TITLE: Commonclipse for Visual Studio? QUESTION: Is there a Visual Studio plugin/tool/snippet for.NET that is similar to commonclipse for the java eclipse platform that automatically generates the ToString(), Equals(), GetHashCode() methods for you? ANSWER: Resharper will do it. (not a free tool unfortunately) Here's...
[ "c#", "visual-studio" ]
2
3
116
1
0
2008-10-13T13:48:47.093000
2008-10-13T13:52:19.097000
197,634
197,641
Microsoft MVC "echo/print/output" etc
With ASP.NET's view engine/template aspx/ashx pages the way to spit to screen seems to be: <%= Person.Name %> Which was fine with webforms as alot of model data was bound to controls programatically. But with MVC we are now using this syntax more oftern. The issue I have with it is quite trivial, but annoying either wa...
Consider something like this, instead: <% foreach(var Person in People) { Response.Write(Person.Name); } %> I believe that'll work. (Although I haven't tested it; I've only just begun with MVC and don't have the toolset here at the office.) EDIT: I apparently missed the actual question...:) Microsoft does provide an ou...
Microsoft MVC "echo/print/output" etc With ASP.NET's view engine/template aspx/ashx pages the way to spit to screen seems to be: <%= Person.Name %> Which was fine with webforms as alot of model data was bound to controls programatically. But with MVC we are now using this syntax more oftern. The issue I have with it is...
TITLE: Microsoft MVC "echo/print/output" etc QUESTION: With ASP.NET's view engine/template aspx/ashx pages the way to spit to screen seems to be: <%= Person.Name %> Which was fine with webforms as alot of model data was bound to controls programatically. But with MVC we are now using this syntax more oftern. The issue...
[ "asp.net", "asp.net-mvc" ]
7
11
8,506
6
0
2008-10-13T13:53:42.370000
2008-10-13T13:55:28.093000
197,635
198,033
Hibernate @ManyToMany mapping with composite keys
I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary keys LSFOCTB which primary key is composed of: LSFOC_CODSOC,LSFOC_CODLSC,LSFOC_CODFOC LSFORTB which primary key is composed of: LSFOR_CODSOC,LSFOR_CODLSC,LSFOC_CODFOR The table in charge of the ManyToMany relationship is: LS...
The problem seems to be that you are creating a join table with 6 columns and there are duplicate names for your columns. You are actually creating 2 columns with the name LSFCF_CODLSC and 2 columns named LSFCF_CODFOR and 2 columns named LSFCF_CODSOC. I would suggest that you try this: @JoinTable(name = "LSFCFTB", join...
Hibernate @ManyToMany mapping with composite keys I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary keys LSFOCTB which primary key is composed of: LSFOC_CODSOC,LSFOC_CODLSC,LSFOC_CODFOC LSFORTB which primary key is composed of: LSFOR_CODSOC,LSFOR_CODLSC,LSFOC_CODFOR The tabl...
TITLE: Hibernate @ManyToMany mapping with composite keys QUESTION: I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary keys LSFOCTB which primary key is composed of: LSFOC_CODSOC,LSFOC_CODLSC,LSFOC_CODFOC LSFORTB which primary key is composed of: LSFOR_CODSOC,LSFOR_CODLSC,LSFO...
[ "java", "hibernate", "jakarta-ee" ]
1
1
6,126
1
0
2008-10-13T13:54:17.410000
2008-10-13T15:40:53.030000
197,639
246,167
"Could not load type..." when upgrading to W2K3 and IIS6
I have a c#.NET 2.0 application that has been running on W2K/IIS5 quite happily for several years. The sysadmin team are currently setting up a W2K3 box for the app, using the same install files, but are running into the dreaded "Could not load type..." error. The type in question is the class (i.e. code behind) for th...
Your best bet for finding out why an assembly isn't loading is the Assembly Binding Log Viewer. http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx
"Could not load type..." when upgrading to W2K3 and IIS6 I have a c#.NET 2.0 application that has been running on W2K/IIS5 quite happily for several years. The sysadmin team are currently setting up a W2K3 box for the app, using the same install files, but are running into the dreaded "Could not load type..." error. Th...
TITLE: "Could not load type..." when upgrading to W2K3 and IIS6 QUESTION: I have a c#.NET 2.0 application that has been running on W2K/IIS5 quite happily for several years. The sysadmin team are currently setting up a W2K3 box for the app, using the same install files, but are running into the dreaded "Could not load ...
[ ".net", "asp.net", "iis" ]
0
1
857
2
0
2008-10-13T13:55:10.480000
2008-10-29T08:58:39.380000
197,649
198,137
How to calculate center of an ellipse by two points and radius sizes
While working on SVG implementation for Internet Explorer to be based on its own VML format I came to a problem of translation of an SVG elliptical arc to an VML elliptical arc. In VML an arc is given by: two angles for two points on ellipse and lengths of radiuses, In SVG an arc is given by: two pairs of coordinates f...
So the solution is here: The parametrized formula of an ellipse: x = x0 + a * cos(t) y = y0 + b * sin(t) Let's put known coordinates of two points to it: x1 = x0 + a * cos(t1) x2 = x0 + a * cos(t2) y1 = y0 + b * sin(t1) y2 = y0 + b * sin(t2) Now we have a system of equations with 4 variables: center of ellipse (x0/y0) ...
How to calculate center of an ellipse by two points and radius sizes While working on SVG implementation for Internet Explorer to be based on its own VML format I came to a problem of translation of an SVG elliptical arc to an VML elliptical arc. In VML an arc is given by: two angles for two points on ellipse and lengt...
TITLE: How to calculate center of an ellipse by two points and radius sizes QUESTION: While working on SVG implementation for Internet Explorer to be based on its own VML format I came to a problem of translation of an SVG elliptical arc to an VML elliptical arc. In VML an arc is given by: two angles for two points on...
[ "math", "geometry", "svg", "vml", "ellipse" ]
23
31
21,458
6
0
2008-10-13T13:57:04.877000
2008-10-13T16:13:34.883000
197,675
197,699
How does delete[] "know" the size of the operand array?
Foo* set = new Foo[100]; //... delete [] set; You don't pass the array's boundaries to delete[]. But where is that information stored? Is it standardised?
When you allocate memory on the heap, your allocator will keep track of how much memory you have allocated. This is usually stored in a "head" segment just before the memory that you get allocated. That way when it's time to free the memory, the de-allocator knows exactly how much memory to free.
How does delete[] "know" the size of the operand array? Foo* set = new Foo[100]; //... delete [] set; You don't pass the array's boundaries to delete[]. But where is that information stored? Is it standardised?
TITLE: How does delete[] "know" the size of the operand array? QUESTION: Foo* set = new Foo[100]; //... delete [] set; You don't pass the array's boundaries to delete[]. But where is that information stored? Is it standardised? ANSWER: When you allocate memory on the heap, your allocator will keep track of how much m...
[ "c++" ]
307
230
51,264
9
0
2008-10-13T14:06:08.197000
2008-10-13T14:10:52.070000
197,676
197,686
Embedded C: what does var = 0xFF; do?
I'm working with embedded C for the first time. Although my C is rusty, I can read the code but I don't really have a grasp on why certain lines are the way the are. For example, I want to know if a variable is true or false and send it back to another application. Rather than setting the variable to 1 or 0, the origin...
0xFF sets all the bits in a char. The original implementer probably decided that the standard 0 and 1 wasn't good enough and decided that if all bits off is false then all bits on is true. That works because in C any value other than 0 is true. Though this will set all bytes in a char, it will also work for any other v...
Embedded C: what does var = 0xFF; do? I'm working with embedded C for the first time. Although my C is rusty, I can read the code but I don't really have a grasp on why certain lines are the way the are. For example, I want to know if a variable is true or false and send it back to another application. Rather than sett...
TITLE: Embedded C: what does var = 0xFF; do? QUESTION: I'm working with embedded C for the first time. Although my C is rusty, I can read the code but I don't really have a grasp on why certain lines are the way the are. For example, I want to know if a variable is true or false and send it back to another application...
[ "c", "embedded" ]
19
31
67,488
9
0
2008-10-13T14:06:16.013000
2008-10-13T14:08:17.177000
197,682
198,080
WCF - What is the difference between Binding.RecieveTimeout and Binding.ReliableSession.InactivityTimeout?
In WCF, what is the difference between Binding.RecieveTimeout and Binding.ReliableSession.InactivityTimeout?
From http://blogs.msdn.com/drnick/archive/2007/06/26/session-lifetime-on-the-server.aspx When using a reliable session, there are two different inactivity timers that must be satisfied to keep the connection alive. If either inactivity timer goes off, then the connection is killed. The first inactivity timer is on the ...
WCF - What is the difference between Binding.RecieveTimeout and Binding.ReliableSession.InactivityTimeout? In WCF, what is the difference between Binding.RecieveTimeout and Binding.ReliableSession.InactivityTimeout?
TITLE: WCF - What is the difference between Binding.RecieveTimeout and Binding.ReliableSession.InactivityTimeout? QUESTION: In WCF, what is the difference between Binding.RecieveTimeout and Binding.ReliableSession.InactivityTimeout? ANSWER: From http://blogs.msdn.com/drnick/archive/2007/06/26/session-lifetime-on-the-...
[ "wcf" ]
3
3
4,210
1
0
2008-10-13T14:07:32.267000
2008-10-13T15:57:00.937000
197,703
197,915
Alternative IDE for Silverlight
I want to play around with silverlight without having to buy a Visual Studio 2008 license. I already used my trial time with Visual Studio, so I'm trying to find another solution. Any thing out there? Thanks
Visual Web Developer Express SP1 is supported with RC0 and later. Install it first, then install the tools.
Alternative IDE for Silverlight I want to play around with silverlight without having to buy a Visual Studio 2008 license. I already used my trial time with Visual Studio, so I'm trying to find another solution. Any thing out there? Thanks
TITLE: Alternative IDE for Silverlight QUESTION: I want to play around with silverlight without having to buy a Visual Studio 2008 license. I already used my trial time with Visual Studio, so I'm trying to find another solution. Any thing out there? Thanks ANSWER: Visual Web Developer Express SP1 is supported with RC...
[ "silverlight", "ide" ]
4
11
5,739
3
0
2008-10-13T14:11:24.253000
2008-10-13T15:08:06.340000
197,708
198,289
What are the best options for Rich Text Editing in Rails?
I'd like to use Rich Text Editing in place on forms in order to let admins change instructions. What are the best options for doing this? [To be more clear - the admins are non-technical but may want to control some formatting without using markup or with as little markup as possible. What I'd like is for them to be ab...
We started with TinyMCE but we are switching to Yahoo's Rich Text Editor because there were some weird issues with the way TinyMCE worked and because the Rich Text Editor documentation and default look-and-feel is superior. Both are pretty easy to integrate with Rails (they are just JavaScript, after all). There are pl...
What are the best options for Rich Text Editing in Rails? I'd like to use Rich Text Editing in place on forms in order to let admins change instructions. What are the best options for doing this? [To be more clear - the admins are non-technical but may want to control some formatting without using markup or with as lit...
TITLE: What are the best options for Rich Text Editing in Rails? QUESTION: I'd like to use Rich Text Editing in place on forms in order to let admins change instructions. What are the best options for doing this? [To be more clear - the admins are non-technical but may want to control some formatting without using mar...
[ "ruby-on-rails", "text-editor", "in-place" ]
21
12
14,036
7
0
2008-10-13T14:13:00.787000
2008-10-13T17:07:18.737000
197,713
197,726
Making a Table Row clickable
I wonder what the best way to make an entire tr clickable would be? The most common (and only?) solution seems to be using JavaScript, by using onclick="javascript:document.location.href('bla.htm');" (not to forget: Setting a proper cursor with onmouseover/onmouseout). While that works, it is a pity that the target URL...
Fortunately or unfortunately, most modern browsers do not let you control the status bar anymore (it was possible and popular back in the day) because of fraudulent intentions. Your better bet would be a title attribute or a javascript tooltip.
Making a Table Row clickable I wonder what the best way to make an entire tr clickable would be? The most common (and only?) solution seems to be using JavaScript, by using onclick="javascript:document.location.href('bla.htm');" (not to forget: Setting a proper cursor with onmouseover/onmouseout). While that works, it ...
TITLE: Making a Table Row clickable QUESTION: I wonder what the best way to make an entire tr clickable would be? The most common (and only?) solution seems to be using JavaScript, by using onclick="javascript:document.location.href('bla.htm');" (not to forget: Setting a proper cursor with onmouseover/onmouseout). Whi...
[ "javascript", "html" ]
28
4
54,919
14
0
2008-10-13T14:13:53.580000
2008-10-13T14:17:42.853000
197,720
197,736
Instantiating a C++ class in C# using P/Invoke via a pointer
I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C# application, in order to generate a PE file. This function returns a pointer to an C++ object defined here, is there any way I can access fields from this class via C# or do I need to write an unmanaged wrapper DLL? The code I'm ...
You need a wrapper library to be able to use the class from C#. The best bet would be to create the wrapper using C++/CLI, which can directly call the unmanaged function and expose the details with a managed class. This will eliminate the need to use P/Invoke for anything. (Well, technically if you know the class layou...
Instantiating a C++ class in C# using P/Invoke via a pointer I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C# application, in order to generate a PE file. This function returns a pointer to an C++ object defined here, is there any way I can access fields from this class via C# ...
TITLE: Instantiating a C++ class in C# using P/Invoke via a pointer QUESTION: I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C# application, in order to generate a PE file. This function returns a pointer to an C++ object defined here, is there any way I can access fields from ...
[ "c#", ".net", "pinvoke" ]
1
2
2,493
2
0
2008-10-13T14:16:33.247000
2008-10-13T14:19:39.760000
197,725
209,072
Programmatically Set Browser Proxy Settings in C#
I'm writing an winforms app that needs to set internet explorer's proxy settings and then open a new browser window. At the moment, I'm applying the proxy settings by going into the registry: RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);...
This depends somewhat on your exact needs. If you are writing a C# app and simply want to set the default proxy settings that your app will use, use the class System.Net.GlobalProxySelection ( http://msdn.microsoft.com/en-us/library/system.net.globalproxyselection.aspx ). You can also set the proxy for any particular c...
Programmatically Set Browser Proxy Settings in C# I'm writing an winforms app that needs to set internet explorer's proxy settings and then open a new browser window. At the moment, I'm applying the proxy settings by going into the registry: RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\W...
TITLE: Programmatically Set Browser Proxy Settings in C# QUESTION: I'm writing an winforms app that needs to set internet explorer's proxy settings and then open a new browser window. At the moment, I'm applying the proxy settings by going into the registry: RegistryKey registry = Registry.CurrentUser.OpenSubKey("Soft...
[ "c#", "proxy", "registry" ]
37
22
74,188
6
0
2008-10-13T14:17:41.170000
2008-10-16T15:34:34.427000
197,741
198,548
Credit Card processing library that handles many merchant gateways?
Looking for a c# library that interfaces to multiple merchant gateways. Should at minimum be able to handle PayPal and authorize.
I've used dotnetcharge with success. They have support for something like 50 payment processors, plus (most importantly), data storage encryption for credit card information.
Credit Card processing library that handles many merchant gateways? Looking for a c# library that interfaces to multiple merchant gateways. Should at minimum be able to handle PayPal and authorize.
TITLE: Credit Card processing library that handles many merchant gateways? QUESTION: Looking for a c# library that interfaces to multiple merchant gateways. Should at minimum be able to handle PayPal and authorize. ANSWER: I've used dotnetcharge with success. They have support for something like 50 payment processors...
[ "c#", ".net", "e-commerce", "credit-card" ]
9
2
2,521
2
0
2008-10-13T14:21:24.047000
2008-10-13T18:32:31.217000
197,742
197,946
Generate a default CRUD UI when using Castle ActiveRecord (.net)
Is there any simple way to generate a default crud (given an entity) with activerecord (castle implementation) or something similar for NET? There is something like this for RoR ( it think its called activescaffold) Thanks
There is a default scaffolding support You can see at http://www.castleproject.org/monorail/gettingstarted/scaffolding.html It's useful for initial stages of development, but if you have complex mappings you will have to extend it.
Generate a default CRUD UI when using Castle ActiveRecord (.net) Is there any simple way to generate a default crud (given an entity) with activerecord (castle implementation) or something similar for NET? There is something like this for RoR ( it think its called activescaffold) Thanks
TITLE: Generate a default CRUD UI when using Castle ActiveRecord (.net) QUESTION: Is there any simple way to generate a default crud (given an entity) with activerecord (castle implementation) or something similar for NET? There is something like this for RoR ( it think its called activescaffold) Thanks ANSWER: There...
[ ".net", "castle-activerecord", "crud" ]
2
1
627
1
0
2008-10-13T14:21:41.753000
2008-10-13T15:15:43.720000
197,744
200,582
Can I determine when a default printer was set on windows
We are trying to trace the time a windows default printer was changed and by who or what. Any ideas?
I don't think that is tracked anywhere. For past changes, you might be out of luck. For future changes, you could try setting up security auditing (via regedit: Permissions->Acvanced->Auditing) on HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows and watch for changes to that key in the Security event log. The ...
Can I determine when a default printer was set on windows We are trying to trace the time a windows default printer was changed and by who or what. Any ideas?
TITLE: Can I determine when a default printer was set on windows QUESTION: We are trying to trace the time a windows default printer was changed and by who or what. Any ideas? ANSWER: I don't think that is tracked anywhere. For past changes, you might be out of luck. For future changes, you could try setting up secur...
[ "windows", "printing" ]
0
2
702
1
0
2008-10-13T14:21:52.300000
2008-10-14T09:58:30.863000
197,747
197,842
How to create foreign key relationships with the Entity Framework?
I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far: db.Models.Order order = DB.Models.Order.CreateOrder( apple ); order.CustomerReference.Attach( ( from c in ...
(Thanks John for the grammar fixes) So I figured it out. This is what you have to do: db.Models.Order order = DB.Models.Order.CreateOrder( apple ); order.Customer = (from c in db.Customer where c.Id == custId select c).First(); db.SaveChanges(); I hope that helps people.
How to create foreign key relationships with the Entity Framework? I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far: db.Models.Order order = DB.Models.Order...
TITLE: How to create foreign key relationships with the Entity Framework? QUESTION: I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far: db.Models.Order order...
[ "asp.net-mvc", "entity-framework", "foreign-key-relationship" ]
5
8
13,187
3
0
2008-10-13T14:23:09.533000
2008-10-13T14:51:45.187000
197,748
197,761
How do I change the background color with JavaScript?
Anyone know a simple method to swap the background color of a webpage using JavaScript?
Modify the JavaScript property document.body.style.background. For example: function changeBackground(color) { document.body.style.background = color; } window.addEventListener("load",function() { changeBackground('red') }); Note: this does depend a bit on how your page is put together, for example if you're using a D...
How do I change the background color with JavaScript? Anyone know a simple method to swap the background color of a webpage using JavaScript?
TITLE: How do I change the background color with JavaScript? QUESTION: Anyone know a simple method to swap the background color of a webpage using JavaScript? ANSWER: Modify the JavaScript property document.body.style.background. For example: function changeBackground(color) { document.body.style.background = color; ...
[ "javascript", "css" ]
195
247
865,242
21
0
2008-10-13T14:23:39.470000
2008-10-13T14:27:01.773000
197,753
197,826
How to change the value of associated field
I have 2 classes with a LINQ association between them i.e.: Table1: Table2: ID ID Name Description ForiegnID The association here is between Table1.ID -> Table2.ForiegnID I need to be able to change the value of Table2.ForiegnID, however I can't and think it is because of the association (as when I remove it, it works)...
Check out the designer.cs file. This is the key's property [Column(Storage="_ParentKey", DbType="Int")] public System.Nullable ParentKey { get { return this._ParentKey; } set { if ((this._ParentKey!= value)) { //This code is added by the association if (this._Parent.HasLoadedOrAssignedValue) { throw new System.Data.Lin...
How to change the value of associated field I have 2 classes with a LINQ association between them i.e.: Table1: Table2: ID ID Name Description ForiegnID The association here is between Table1.ID -> Table2.ForiegnID I need to be able to change the value of Table2.ForiegnID, however I can't and think it is because of the...
TITLE: How to change the value of associated field QUESTION: I have 2 classes with a LINQ association between them i.e.: Table1: Table2: ID ID Name Description ForiegnID The association here is between Table1.ID -> Table2.ForiegnID I need to be able to change the value of Table2.ForiegnID, however I can't and think it...
[ "c#", "linq", "linq-to-sql", "associations" ]
6
7
13,692
3
0
2008-10-13T14:24:27.677000
2008-10-13T14:44:52.393000
197,757
197,824
Printing pointers in C
I was trying to understand something with pointers, so I wrote this code: #include int main(void) { char s[] = "asd"; char **p = &s printf("The value of s is: %p\n", s); printf("The direction of s is: %p\n", &s); printf("The value of p is: %p\n", p); printf("The direction of p is: %p\n", &p); printf("The direction o...
"s" is not a "char*", it's a "char[4]". And so, "&s" is not a "char**", but actually "a pointer to an array of 4 characater". Your compiler may treat "&s" as if you had written "&s[0]", which is roughly the same thing, but is a "char*". When you write "char** p = &s" you are trying to say "I want p to be set to the add...
Printing pointers in C I was trying to understand something with pointers, so I wrote this code: #include int main(void) { char s[] = "asd"; char **p = &s printf("The value of s is: %p\n", s); printf("The direction of s is: %p\n", &s); printf("The value of p is: %p\n", p); printf("The direction of p is: %p\n", &p); ...
TITLE: Printing pointers in C QUESTION: I was trying to understand something with pointers, so I wrote this code: #include int main(void) { char s[] = "asd"; char **p = &s printf("The value of s is: %p\n", s); printf("The direction of s is: %p\n", &s); printf("The value of p is: %p\n", p); printf("The direction of p...
[ "c", "pointers" ]
59
38
275,644
8
0
2008-10-13T14:25:38.530000
2008-10-13T14:44:10.723000
197,758
197,805
Help with a regex that matches something either before OR after something else
I have a bunch of XML that has lines that look like this <_char font_name="/ITC Stone Serif Std Bold" italic="true" /> but sometimes look like this <_char font_size="88175" italic="true" font_name="/ITC Stone Serif Std Bold" /> Here's what I need to do Replace italic="true" with italic="false for every line that contai...
Does the simple use of '|' operator satisfy you? name="/ITC Stone Sans Std Bold"[^>]italic="(true)"|italic="(true)"[^>]font_name="/ITC Stone Serif Std Bold" That should detect any line with the attribute name before of after attribute italic with value true.
Help with a regex that matches something either before OR after something else I have a bunch of XML that has lines that look like this <_char font_name="/ITC Stone Serif Std Bold" italic="true" /> but sometimes look like this <_char font_size="88175" italic="true" font_name="/ITC Stone Serif Std Bold" /> Here's what I...
TITLE: Help with a regex that matches something either before OR after something else QUESTION: I have a bunch of XML that has lines that look like this <_char font_name="/ITC Stone Serif Std Bold" italic="true" /> but sometimes look like this <_char font_size="88175" italic="true" font_name="/ITC Stone Serif Std Bold...
[ "regex" ]
4
3
2,830
5
0
2008-10-13T14:26:07.097000
2008-10-13T14:38:50.470000