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
45,600
231,357
A issue with the jquery dialog when using the themeroller css
The demos for the jquery ui dialog all use the "flora" theme. I wanted a customized theme, so I used the themeroller to generate a css file. When I used it, everything seemed to be working fine, but later I found that I can't control any input element contained in the dialog (i.e, can't type into a text field, can't ch...
I think it is because you have the classes different. (flora) (custom) Even with the flora theme, you would still use the ui-dialog class to define it as a dialog. I've done modals before and I've never even defined a class in the tag. jQueryUI should take care of that for you. Try getting rid of the class attribute or...
A issue with the jquery dialog when using the themeroller css The demos for the jquery ui dialog all use the "flora" theme. I wanted a customized theme, so I used the themeroller to generate a css file. When I used it, everything seemed to be working fine, but later I found that I can't control any input element contai...
TITLE: A issue with the jquery dialog when using the themeroller css QUESTION: The demos for the jquery ui dialog all use the "flora" theme. I wanted a customized theme, so I used the themeroller to generate a css file. When I used it, everything seemed to be working fine, but later I found that I can't control any in...
[ "javascript", "jquery", "user-interface", "dialog" ]
7
3
4,478
4
0
2008-09-05T11:55:12.313000
2008-10-23T20:27:16.847000
45,604
45,728
Why doesn't C# support implied generic types on class constructors?
C# doesn't require you to specify a generic type parameter if the compiler can infer it, for instance: List myInts = new List {0,1,1, 2,3,5,8,13,21,34,55,89,144,233,377, 610,987,1597,2584,4181,6765}; //this statement is clunky List myStrings = myInts. Select ( i => i.ToString() ). ToList (); //the type is inferred fr...
Actually, your question isn't bad. I've been toying with a generic programming language for last few years and although I've never come around to actually develop it (and probably never will), I've thought a lot about generic type inference and one of my top priorities has always been to allow the construction of class...
Why doesn't C# support implied generic types on class constructors? C# doesn't require you to specify a generic type parameter if the compiler can infer it, for instance: List myInts = new List {0,1,1, 2,3,5,8,13,21,34,55,89,144,233,377, 610,987,1597,2584,4181,6765}; //this statement is clunky List myStrings = myInts....
TITLE: Why doesn't C# support implied generic types on class constructors? QUESTION: C# doesn't require you to specify a generic type parameter if the compiler can infer it, for instance: List myInts = new List {0,1,1, 2,3,5,8,13,21,34,55,89,144,233,377, 610,987,1597,2584,4181,6765}; //this statement is clunky List m...
[ "c#", ".net", "generics" ]
55
34
16,714
3
0
2008-09-05T12:01:39.380000
2008-09-05T12:58:05.767000
45,613
45,625
Javascript collection of DOM objects - why can't I reverse with Array.reverse()?
What could be the problem with reversing the array of DOM objects as in the following code: var imagesArr = new Array(); imagesArr = document.getElementById("myDivHolderId").getElementsByTagName("img"); imagesArr.reverse(); In Firefox 3, when I call the reverse() method the script stops executing and shows the followin...
Because getElementsByTag name actually returns a NodeList structure. It has similar array like indexing properties for syntactic convenience, but it is not an array. For example, the set of entries is actually constantly being dynamically updated - if you add a new img tag under myDivHolderId, it will automatically app...
Javascript collection of DOM objects - why can't I reverse with Array.reverse()? What could be the problem with reversing the array of DOM objects as in the following code: var imagesArr = new Array(); imagesArr = document.getElementById("myDivHolderId").getElementsByTagName("img"); imagesArr.reverse(); In Firefox 3, w...
TITLE: Javascript collection of DOM objects - why can't I reverse with Array.reverse()? QUESTION: What could be the problem with reversing the array of DOM objects as in the following code: var imagesArr = new Array(); imagesArr = document.getElementById("myDivHolderId").getElementsByTagName("img"); imagesArr.reverse(...
[ "javascript", "arrays" ]
24
18
20,799
8
0
2008-09-05T12:05:42.943000
2008-09-05T12:17:39.777000
45,621
45,647
How do you deal with polymorphism in a database?
Example I have Person, SpecialPerson, and User. Person and SpecialPerson are just people - they don't have a user name or password on a site, but they are stored in a database for record keeping. User has all of the same data as Person and potentially SpecialPerson, along with a user name and password as they are regis...
There are generally three ways of mapping object inheritance to database tables. You can make one big table with all the fields from all the objects with a special field for the type. This is fast but wastes space, although modern databases save space by not storing empty fields. And if you're only looking for all user...
How do you deal with polymorphism in a database? Example I have Person, SpecialPerson, and User. Person and SpecialPerson are just people - they don't have a user name or password on a site, but they are stored in a database for record keeping. User has all of the same data as Person and potentially SpecialPerson, alon...
TITLE: How do you deal with polymorphism in a database? QUESTION: Example I have Person, SpecialPerson, and User. Person and SpecialPerson are just people - they don't have a user name or password on a site, but they are stored in a database for record keeping. User has all of the same data as Person and potentially S...
[ "database-design", "oop" ]
66
50
34,449
14
0
2008-09-05T12:16:12.933000
2008-09-05T12:26:59.693000
45,623
45,630
Sockets and Processes in Java
In Java, what would the best way be to have a constantly listening port open, and still send upon receipt of a packet. I am not particularly savvy with network programming at the moment, so the tutorials I have found on the net aren't particularly helpful. Would it make sense to have the listening socket as a serversoc...
If you can afford the threading, try this (keep in mind I've left out some details like exception handling and playing nice with threads). You may want to look into SocketChannels and/or NIO async sockets / selectors. This should get you started. boolean finished = false; int port = 10000; ServerSocket server = new Ser...
Sockets and Processes in Java In Java, what would the best way be to have a constantly listening port open, and still send upon receipt of a packet. I am not particularly savvy with network programming at the moment, so the tutorials I have found on the net aren't particularly helpful. Would it make sense to have the l...
TITLE: Sockets and Processes in Java QUESTION: In Java, what would the best way be to have a constantly listening port open, and still send upon receipt of a packet. I am not particularly savvy with network programming at the moment, so the tutorials I have found on the net aren't particularly helpful. Would it make s...
[ "java", "networking", "sockets", "blackberry" ]
4
12
1,414
4
0
2008-09-05T12:16:50.140000
2008-09-05T12:20:37.213000
45,624
265,268
How do I change the default author for accessing a local SVN repository?
I use TortoiseSVN to access file based local repo. In all my commits an author is my Windows login name. Is it possible to use different name? I know how to change author after commit but how to change before? Installing apache/svnserver is not an option.
Yes, it's possible. TortoiseSVN and the svn command line client share the same settings location in your profile folder. So you may simply checkout one version using svn.exe: $ svn co --username different_user_name file:///C:/path/to/your/repo... and Subversion will happily replace the associated username for that repo...
How do I change the default author for accessing a local SVN repository? I use TortoiseSVN to access file based local repo. In all my commits an author is my Windows login name. Is it possible to use different name? I know how to change author after commit but how to change before? Installing apache/svnserver is not an...
TITLE: How do I change the default author for accessing a local SVN repository? QUESTION: I use TortoiseSVN to access file based local repo. In all my commits an author is my Windows login name. Is it possible to use different name? I know how to change author after commit but how to change before? Installing apache/s...
[ "svn", "tortoisesvn", "default", "author" ]
13
17
24,012
5
0
2008-09-05T12:17:17.347000
2008-11-05T14:27:20.753000
45,626
49,371
Using ASP.NET AJAX PageMethods and Validators
I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on how to do this?
Ok so I finally solved this: You need to call Page_ClientValidate() in your Save javascript method and If it returns true continue with the save, the Page_ClientValidate() initiates the client side validators, See code below: function Save() { var clientValidationPassed =Page_ClientValidate(); if(clientValidationPassed...
Using ASP.NET AJAX PageMethods and Validators I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on how to do this?
TITLE: Using ASP.NET AJAX PageMethods and Validators QUESTION: I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on ho...
[ "asp.net-ajax", "validation" ]
3
1
1,135
3
0
2008-09-05T12:17:42.633000
2008-09-08T09:32:20.150000
45,634
45,648
How do I write SELECT FROM myTable WHERE id IN (SELECT...) in Linq?
How do you rewrite this in Linq? SELECT Id, Name FROM TableA WHERE TableA.Id IN (SELECT xx from TableB INNER JOIN Table C....) So in plain english, I want to select Id and Name from TableA where TableA's Id is in a result set from a second query.
from a in TableA where (from b in TableB join c in TableC on b.id equals c.id where.. select b.id).Contains(a.Id) select new { a.Id, a.Name }
How do I write SELECT FROM myTable WHERE id IN (SELECT...) in Linq? How do you rewrite this in Linq? SELECT Id, Name FROM TableA WHERE TableA.Id IN (SELECT xx from TableB INNER JOIN Table C....) So in plain english, I want to select Id and Name from TableA where TableA's Id is in a result set from a second query.
TITLE: How do I write SELECT FROM myTable WHERE id IN (SELECT...) in Linq? QUESTION: How do you rewrite this in Linq? SELECT Id, Name FROM TableA WHERE TableA.Id IN (SELECT xx from TableB INNER JOIN Table C....) So in plain english, I want to select Id and Name from TableA where TableA's Id is in a result set from a s...
[ "sql", "linq", "linq-to-sql" ]
9
10
10,563
3
0
2008-09-05T12:22:32.060000
2008-09-05T12:27:28.647000
45,650
45,664
Common Files in Visual Studio Solution
Many times I have seen Visual Studio solutions which have multiple projects that share source files. These common source files are usually out in a common directory and in the solution explorer their icon shows up with a link arrow in the bottom left. However, any time I try to add a source file to the project that is ...
Right click on a project, select Add->Existing Item->Add as link (press on small arrow on Add button)
Common Files in Visual Studio Solution Many times I have seen Visual Studio solutions which have multiple projects that share source files. These common source files are usually out in a common directory and in the solution explorer their icon shows up with a link arrow in the bottom left. However, any time I try to ad...
TITLE: Common Files in Visual Studio Solution QUESTION: Many times I have seen Visual Studio solutions which have multiple projects that share source files. These common source files are usually out in a common directory and in the solution explorer their icon shows up with a link arrow in the bottom left. However, an...
[ "visual-studio", "projects-and-solutions" ]
9
22
6,134
2
0
2008-09-05T12:27:52.733000
2008-09-05T12:31:41.523000
45,651
45,667
SQL: How to get the id of values I just INSERTed?
I inserted some values into a table. There is a column whose value is auto-generated. In the next statement of my code, I want to retrieve this value. Can you tell me how to do it the right way?
@@IDENTITY is not scope safe and will get you back the id from another table if you have an insert trigger on the original table, always use SCOPE_IDENTITY()
SQL: How to get the id of values I just INSERTed? I inserted some values into a table. There is a column whose value is auto-generated. In the next statement of my code, I want to retrieve this value. Can you tell me how to do it the right way?
TITLE: SQL: How to get the id of values I just INSERTed? QUESTION: I inserted some values into a table. There is a column whose value is auto-generated. In the next statement of my code, I want to retrieve this value. Can you tell me how to do it the right way? ANSWER: @@IDENTITY is not scope safe and will get you ba...
[ "sql-server" ]
84
60
120,297
21
0
2008-09-05T12:27:58.210000
2008-09-05T12:31:48.903000
45,653
45,735
Has anyone connected BizTalk with QuickBooks?
We use QuickBooks for financial management, and feed it from a variety of sources. I now need to hook it up to BizTalk, and I'd hate to reinvent the wheel. I've done searches, and as far as I can tell there's no QuickBooks adapter for BizTalk. Does anyone know of anything that'll do the job, preferably something that d...
Quickbooks talks.NET quite easily. You'll need the QuickBooks SDK 7.0 and a copy of Visual Studio.NET, but after that it's very easy to do anything with Quickbooks. Imports QBFC7Lib Sub AttachToDB() If isAttachedtoQB Then Exit Sub Lasterror = "Unknown QuickBooks Error" Try QbSession = New QBSessionManager QbSession.O...
Has anyone connected BizTalk with QuickBooks? We use QuickBooks for financial management, and feed it from a variety of sources. I now need to hook it up to BizTalk, and I'd hate to reinvent the wheel. I've done searches, and as far as I can tell there's no QuickBooks adapter for BizTalk. Does anyone know of anything t...
TITLE: Has anyone connected BizTalk with QuickBooks? QUESTION: We use QuickBooks for financial management, and feed it from a variety of sources. I now need to hook it up to BizTalk, and I'd hate to reinvent the wheel. I've done searches, and as far as I can tell there's no QuickBooks adapter for BizTalk. Does anyone ...
[ "biztalk", "quickbooks" ]
3
1
635
4
0
2008-09-05T12:29:03.200000
2008-09-05T13:02:52.057000
45,658
63,430
How do I retrieve IPIEHTMLDocument2 interface on IE Mobile
I wrote an Active X plugin for IE7 which implements IObjectWithSite besides some other necessary interfaces (note no IOleClient). This interface is queried and called by IE7. During the SetSite() call I retrieve a pointer to IE7's site interface which I can use to retrieve the IHTMLDocument2 interface using the followi...
I found the following code in the Google Gears code, here. I copied the functions I think you need to here. The one you need is at the bottom (GetHtmlWindow2), but the other two are needed as well. Hopefully I didn't miss anything, but if I did the stuff you need is probably at the link. #ifdef WINCE // We can't get IW...
How do I retrieve IPIEHTMLDocument2 interface on IE Mobile I wrote an Active X plugin for IE7 which implements IObjectWithSite besides some other necessary interfaces (note no IOleClient). This interface is queried and called by IE7. During the SetSite() call I retrieve a pointer to IE7's site interface which I can use...
TITLE: How do I retrieve IPIEHTMLDocument2 interface on IE Mobile QUESTION: I wrote an Active X plugin for IE7 which implements IObjectWithSite besides some other necessary interfaces (note no IOleClient). This interface is queried and called by IE7. During the SetSite() call I retrieve a pointer to IE7's site interfa...
[ "c++", "internet-explorer", "windows-mobile", "pocketpc" ]
2
4
1,341
2
0
2008-09-05T12:29:34.320000
2008-09-15T14:32:04.847000
45,695
45,712
Visual Studio Add-in not going away
Ok, so I demo'd Refactor Pro and Resharper, I'm more comfortable with Resharper so that's what I bought. When I uninstalled Refactor Pro I thought everything was breezy. However, now when I open Visual Studio I get The Add-in 'DevExpress Tools' failed to load or caused and exception, woudl you like to remove this Add i...
I had the same issue with the VS.NET 2005 version and I'm not sure it is related. It was a registry problem and when i contacted the people from devexpress they send me a clean up tool. You can try to see if there is another clean up tool for 2008 or search in the registry for the file name and remove it manually.
Visual Studio Add-in not going away Ok, so I demo'd Refactor Pro and Resharper, I'm more comfortable with Resharper so that's what I bought. When I uninstalled Refactor Pro I thought everything was breezy. However, now when I open Visual Studio I get The Add-in 'DevExpress Tools' failed to load or caused and exception,...
TITLE: Visual Studio Add-in not going away QUESTION: Ok, so I demo'd Refactor Pro and Resharper, I'm more comfortable with Resharper so that's what I bought. When I uninstalled Refactor Pro I thought everything was breezy. However, now when I open Visual Studio I get The Add-in 'DevExpress Tools' failed to load or cau...
[ "visual-studio" ]
7
5
1,439
2
0
2008-09-05T12:44:19.277000
2008-09-05T12:50:55.253000
45,702
45,710
How to compile a .NET application to native code?
Let's say I want to run a.NET application on a machine where the.NET framework is not available; Is there any way to compile the application to native code?
Microsoft has an article describing how you can Compile MSIL to Native Code You can use Ngen. The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into...
How to compile a .NET application to native code? Let's say I want to run a.NET application on a machine where the.NET framework is not available; Is there any way to compile the application to native code?
TITLE: How to compile a .NET application to native code? QUESTION: Let's say I want to run a.NET application on a machine where the.NET framework is not available; Is there any way to compile the application to native code? ANSWER: Microsoft has an article describing how you can Compile MSIL to Native Code You can us...
[ ".net", "compilation", "native-code" ]
95
45
75,915
16
0
2008-09-05T12:46:24.890000
2008-09-05T12:50:23.537000
45,705
45,731
How would you architect a desktop application in C# 3.0
I've created a simple desktop application in C# 3.0 to learn some C#, wpf and.Net 3.5. My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database. My first iteration of this app is ugly as hell and I'm in the process of refac...
I would start with the Composite Application Guidance for WPF ( cough PRISM cough ) from Microsoft's P&P team. With the download comes a great reference application that is the starting point for most of my WPF development today. The DotNetRocks crew just interviewed Glenn Block and Brian Noyes about this if you're int...
How would you architect a desktop application in C# 3.0 I've created a simple desktop application in C# 3.0 to learn some C#, wpf and.Net 3.5. My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database. My first iteration of ...
TITLE: How would you architect a desktop application in C# 3.0 QUESTION: I've created a simple desktop application in C# 3.0 to learn some C#, wpf and.Net 3.5. My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database. My f...
[ "c#", "wpf", "architecture" ]
10
4
3,406
5
0
2008-09-05T12:48:42.433000
2008-09-05T12:59:13.703000
45,716
226,949
How to do multi-column sorting on a Visual Basic 6 ListView?
I am working in Visual Basic 6 and need to sort by multiple columns in a ListView. For example, sorting a list of music tracks by artist, then album, then track number. As far as I know, VB6 does not support this out of the box. Here are the suggestions I have already heard: Sort the data in a SQL table first and displ...
I would create a hidden column in the listview that concatenates those three columns and sort by that
How to do multi-column sorting on a Visual Basic 6 ListView? I am working in Visual Basic 6 and need to sort by multiple columns in a ListView. For example, sorting a list of music tracks by artist, then album, then track number. As far as I know, VB6 does not support this out of the box. Here are the suggestions I hav...
TITLE: How to do multi-column sorting on a Visual Basic 6 ListView? QUESTION: I am working in Visual Basic 6 and need to sort by multiple columns in a ListView. For example, sorting a list of music tracks by artist, then album, then track number. As far as I know, VB6 does not support this out of the box. Here are the...
[ "sql-server", "vb6", "sorting" ]
4
4
4,535
2
0
2008-09-05T12:53:40.270000
2008-10-22T18:15:01.823000
45,729
45,747
What path should I pass as an AssemblyPath parameter to the Publish.GacRemove function?
I want to use the Publish.GacRemove function to remove an assembly from GAC. However, I don't understand what path I should pass as an argument. Should it be a path to the original DLL (what if I removed it after installing it in the GAC?) or the path to the assembly in the GAC? UPDATE: I finally used these API wrapper...
I am using the GacInstall to publish my assemblies, however once installed into the gac, I sometimes delete my ‘temporary’ copy of the assemblies. And then, if I ever wanted to uninstall the assemblies from the gac I do not have the files at the original path. This is causing a problem since I cannot seem to get the Ga...
What path should I pass as an AssemblyPath parameter to the Publish.GacRemove function? I want to use the Publish.GacRemove function to remove an assembly from GAC. However, I don't understand what path I should pass as an argument. Should it be a path to the original DLL (what if I removed it after installing it in th...
TITLE: What path should I pass as an AssemblyPath parameter to the Publish.GacRemove function? QUESTION: I want to use the Publish.GacRemove function to remove an assembly from GAC. However, I don't understand what path I should pass as an argument. Should it be a path to the original DLL (what if I removed it after i...
[ ".net", "gac" ]
1
2
2,346
2
0
2008-09-05T12:58:57.167000
2008-09-05T13:06:26.587000
45,732
45,864
How can I extract a part of a xaml object graph via linq to xml?
I have an object graph serialized to xaml. A rough sample of what it looks like is: I want to use Linq to XML in order to extract the serialized objects within the TheCollection. Note: MyObject may be named differently at runtime; I'm interested in any object that implements the same interface, which has a public colle...
Will, It is not possible to find out whether an object implements some interface by looking at XAML. With constraints given you can find xml element that has a child named. You can use following code: It will return all elements having child element which name ends with.TheCollection static IEnumerable FindElement(XEle...
How can I extract a part of a xaml object graph via linq to xml? I have an object graph serialized to xaml. A rough sample of what it looks like is: I want to use Linq to XML in order to extract the serialized objects within the TheCollection. Note: MyObject may be named differently at runtime; I'm interested in any ob...
TITLE: How can I extract a part of a xaml object graph via linq to xml? QUESTION: I have an object graph serialized to xaml. A rough sample of what it looks like is: I want to use Linq to XML in order to extract the serialized objects within the TheCollection. Note: MyObject may be named differently at runtime; I'm in...
[ "linq", "xaml", "linq-to-xml" ]
1
0
353
2
0
2008-09-05T13:01:34.133000
2008-09-05T13:47:36.037000
45,736
45,759
apache mod_proxy error os10060 and returning 503?
Can't get to my site. Apache gives the following error message: [Fri Sep 05 08:47:42 2008] [error] (OS 10060)A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.: proxy: HTTP: attempt to co...
Can you connect to the proxied host (10.10.10.1) directly? Is it functioning normally?
apache mod_proxy error os10060 and returning 503? Can't get to my site. Apache gives the following error message: [Fri Sep 05 08:47:42 2008] [error] (OS 10060)A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host ...
TITLE: apache mod_proxy error os10060 and returning 503? QUESTION: Can't get to my site. Apache gives the following error message: [Fri Sep 05 08:47:42 2008] [error] (OS 10060)A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed becau...
[ "apache", "proxy" ]
1
2
5,134
2
0
2008-09-05T13:03:03.180000
2008-09-05T13:09:34.083000
45,741
49,293
Customize the Sharepoint add list column page
I have defined a custom Sharepoint list for special attributes related to a software application inventory and installed it as a feature. I also want to group these attributes in categories. How could I change the Sharepoint page that allows the user to add a column to a list, so that when the user adds a column to my ...
From what I understand you want to add a choice column data type thats already prepopulated so that users can then add it to their own content types? have a look here, this is probably what you want to do: http://www.sharethispoint.com/archive/2006/08/07/23.aspx
Customize the Sharepoint add list column page I have defined a custom Sharepoint list for special attributes related to a software application inventory and installed it as a feature. I also want to group these attributes in categories. How could I change the Sharepoint page that allows the user to add a column to a li...
TITLE: Customize the Sharepoint add list column page QUESTION: I have defined a custom Sharepoint list for special attributes related to a software application inventory and installed it as a feature. I also want to group these attributes in categories. How could I change the Sharepoint page that allows the user to ad...
[ "sharepoint", "list" ]
1
1
1,204
1
0
2008-09-05T13:04:44.377000
2008-09-08T08:07:27.547000
45,779
45,901
C# Dynamic Event Subscription
How would you dynamically subscribe to a C# event so that given a Object instance and a String name containing the name of the event, you subscribe to that event and do something (write to the console for example) when that event has been fired? It would seem using Reflection this isn't possible and I would like to avo...
You can compile expression trees to use void methods without any arguments as event handlers for events of any type. To accommodate other event handler types, you have to map the event handler's parameters to the events somehow. using System; using System.Linq; using System.Linq.Expressions; using System.Reflection; c...
C# Dynamic Event Subscription How would you dynamically subscribe to a C# event so that given a Object instance and a String name containing the name of the event, you subscribe to that event and do something (write to the console for example) when that event has been fired? It would seem using Reflection this isn't po...
TITLE: C# Dynamic Event Subscription QUESTION: How would you dynamically subscribe to a C# event so that given a Object instance and a String name containing the name of the event, you subscribe to that event and do something (write to the console for example) when that event has been fired? It would seem using Reflec...
[ "c#", "events", "reflection", "delegates" ]
34
29
35,805
10
0
2008-09-05T13:17:38.637000
2008-09-05T14:14:37.080000
45,783
56,109
Automate Deployment for Web Applications?
My team is currently trying to automate the deployment of our.Net and PHP web applications. We want to streamline deployments, and to avoid the hassle and many of the headaches caused by doing it manually. We require a solution that will enable us to: - Compile the application - Version the application with the SVN ver...
Thank you all for your kind suggestions. We checked them all out, but after careful consideration we decided to roll our own with a combination of CruiseControl, NAnt, MSBuild and MSDeploy. This article has some great information: Integrating MSBuild with CruiseControl.NET Here's roughly how our solution works: Develop...
Automate Deployment for Web Applications? My team is currently trying to automate the deployment of our.Net and PHP web applications. We want to streamline deployments, and to avoid the hassle and many of the headaches caused by doing it manually. We require a solution that will enable us to: - Compile the application ...
TITLE: Automate Deployment for Web Applications? QUESTION: My team is currently trying to automate the deployment of our.Net and PHP web applications. We want to streamline deployments, and to avoid the hassle and many of the headaches caused by doing it manually. We require a solution that will enable us to: - Compil...
[ ".net", "php", "deployment", "web-applications" ]
41
33
25,114
9
0
2008-09-05T13:18:23.267000
2008-09-11T09:17:22.203000
45,792
45,836
How can I fork a background processes from a Perl CGI script on Windows?
I've had some trouble forking of processes from a Perl CGI script when running on Windows. The main issue seems to be that 'fork' is emulated when running on windows, and doesn't actually seem to create a new process (just another thread in the current one). This means that web servers (like IIS) which are waiting for ...
If you want to do this in a platform independent way, Proc::Background is probably the best way.
How can I fork a background processes from a Perl CGI script on Windows? I've had some trouble forking of processes from a Perl CGI script when running on Windows. The main issue seems to be that 'fork' is emulated when running on windows, and doesn't actually seem to create a new process (just another thread in the cu...
TITLE: How can I fork a background processes from a Perl CGI script on Windows? QUESTION: I've had some trouble forking of processes from a Perl CGI script when running on Windows. The main issue seems to be that 'fork' is emulated when running on windows, and doesn't actually seem to create a new process (just anothe...
[ "windows", "perl", "cgi", "background", "fork" ]
8
9
5,506
5
0
2008-09-05T13:21:09.423000
2008-09-05T13:36:59.197000
45,796
45,926
Using IIS6, how can I place files in a sub-folder but have them served as if they were in the root?
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding content: Development team adding code. Business team adding simple web pages. For sanity and organization, we would like for the business team to add their web pages to a sub-folder in the project: Root: for pages of development team Content: for pa...
I don't have any way to test this right now, but I think you can use the -f flag on RewriteCond to check if a file exists, in either directory. RewriteCond %{REQUEST_FILENAME} -!f RewriteCond Content/%{REQUEST_FILENAME} -f RewriteRule (.*) Content/(.*) Something like that might do what you're after, too.
Using IIS6, how can I place files in a sub-folder but have them served as if they were in the root? Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding content: Development team adding code. Business team adding simple web pages. For sanity and organization, we would like for the business team to add...
TITLE: Using IIS6, how can I place files in a sub-folder but have them served as if they were in the root? QUESTION: Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding content: Development team adding code. Business team adding simple web pages. For sanity and organization, we would like for the bu...
[ "asp.net", "iis-6", "url-rewriting" ]
2
1
393
2
0
2008-09-05T13:23:01.027000
2008-09-05T14:32:21.903000
45,803
45,823
Service to make an audio podcast from a video one?
Video podcast??? Audio only mp3 player I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast. I would most like a website which would suck in the RSS and spit out an RSS (I'm thinking of something like Feedburner), though would settle for something on...
You could automate this using the open source command line tool ffmpeg. Parse the RSS to get the video files, fetch them over the net if needed, then spit each one out to a command line like this: ffmpeg -i episode1.mov -ab 128000 episode1.mp3 The -ab switch sets the output bit rate to 128 kbits/s on the audio file, ad...
Service to make an audio podcast from a video one? Video podcast??? Audio only mp3 player I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast. I would most like a website which would suck in the RSS and spit out an RSS (I'm thinking of something lik...
TITLE: Service to make an audio podcast from a video one? QUESTION: Video podcast??? Audio only mp3 player I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast. I would most like a website which would suck in the RSS and spit out an RSS (I'm thinkin...
[ "audio", "video", "podcast" ]
4
5
733
4
0
2008-09-05T13:24:01.367000
2008-09-05T13:31:01.287000
45,813
182,363
WPF Get Element(s) under mouse
Is there a way with WPF to get an array of elements under the mouse on a MouseMove event?
From " WPF Unleashed ", page 383: Visual hit testing can inform you about all Visual s that intersect a location, [...] you must use [...] the [VisualTreeHelper.]HitTest method that accepts a HitTestResultCallback delegate. Before this version of HitTest returns, the delegate is invoked once for each relevant Visual, s...
WPF Get Element(s) under mouse Is there a way with WPF to get an array of elements under the mouse on a MouseMove event?
TITLE: WPF Get Element(s) under mouse QUESTION: Is there a way with WPF to get an array of elements under the mouse on a MouseMove event? ANSWER: From " WPF Unleashed ", page 383: Visual hit testing can inform you about all Visual s that intersect a location, [...] you must use [...] the [VisualTreeHelper.]HitTest me...
[ "wpf", "element", "visualtreehelper", "visual-tree" ]
37
41
47,278
3
0
2008-09-05T13:28:16.347000
2008-10-08T11:59:34.923000
45,824
45,835
Counting number of views for a page ignoring search engines?
I notice that StackOverflow has a views count for each question and that these view numbers are fairly low and accurate. I have a similar thing on one of my sites. It basically logs a "hit" whenever the page is loaded in the backend code. Unfortunately it also does this for search engine hits giving bloated and inaccur...
An AJAX call will do it, but usually search engines will not load images, javascript or CSS files, so it may be easier to include one of those files in the page, and pass the URL of the page you want to log a request against as a parameter in the file request. For example, in the page... http://www.example.com/example....
Counting number of views for a page ignoring search engines? I notice that StackOverflow has a views count for each question and that these view numbers are fairly low and accurate. I have a similar thing on one of my sites. It basically logs a "hit" whenever the page is loaded in the backend code. Unfortunately it als...
TITLE: Counting number of views for a page ignoring search engines? QUESTION: I notice that StackOverflow has a views count for each question and that these view numbers are fairly low and accurate. I have a similar thing on one of my sites. It basically logs a "hit" whenever the page is loaded in the backend code. Un...
[ "search-engine", "website-metrics" ]
10
5
1,704
6
0
2008-09-05T13:31:57.010000
2008-09-05T13:36:08.980000
45,827
45,863
How do you automatically set the focus to a textbox when a web page loads?
How do you automatically set the focus to a textbox when a web page loads? Is there an HTML tag to do it or does it have to be done via Javascript?
If you're using jquery: $(function() { $("#Box1").focus(); }); or prototype: Event.observe(window, 'load', function() { $("Box1").focus(); }); or plain javascript: window.onload = function() { document.getElementById("Box1").focus(); }; though keep in mind that this will replace other on load handlers, so look up addLo...
How do you automatically set the focus to a textbox when a web page loads? How do you automatically set the focus to a textbox when a web page loads? Is there an HTML tag to do it or does it have to be done via Javascript?
TITLE: How do you automatically set the focus to a textbox when a web page loads? QUESTION: How do you automatically set the focus to a textbox when a web page loads? Is there an HTML tag to do it or does it have to be done via Javascript? ANSWER: If you're using jquery: $(function() { $("#Box1").focus(); }); or prot...
[ "javascript", "html" ]
175
263
388,833
14
0
2008-09-05T13:33:44.260000
2008-09-05T13:46:38.410000
45,838
45,853
How many app.config files are you allowed to have per AppDomain?
I'm hoping there's a way to avoid custom configuration files if an application runs in a single AppDomain.
From Suzanne Cook's.NET CLR Notes: App.Config Files: As default the app config file of the default appdomain is in the process exe’s directory and named the same as the process exe + ".config". Also, note that a web.config file is an app.config - ASP.NET sets that as the config file for your appdomain. To change the co...
How many app.config files are you allowed to have per AppDomain? I'm hoping there's a way to avoid custom configuration files if an application runs in a single AppDomain.
TITLE: How many app.config files are you allowed to have per AppDomain? QUESTION: I'm hoping there's a way to avoid custom configuration files if an application runs in a single AppDomain. ANSWER: From Suzanne Cook's.NET CLR Notes: App.Config Files: As default the app config file of the default appdomain is in the pr...
[ ".net", "configuration" ]
2
5
1,698
1
0
2008-09-05T13:37:33.517000
2008-09-05T13:43:12.397000
45,846
45,858
Web Design for Google Chrome
What, if any, considerations (HTML, CSS, JavaScript) should you take when designing for Google Chrome?
Chrome uses Webkit, the same engine as is used by Safari, OmniWeb, iCab and more. Just code everything based on the standards and verify in each browser.
Web Design for Google Chrome What, if any, considerations (HTML, CSS, JavaScript) should you take when designing for Google Chrome?
TITLE: Web Design for Google Chrome QUESTION: What, if any, considerations (HTML, CSS, JavaScript) should you take when designing for Google Chrome? ANSWER: Chrome uses Webkit, the same engine as is used by Safari, OmniWeb, iCab and more. Just code everything based on the standards and verify in each browser.
[ "google-chrome" ]
1
9
1,025
5
0
2008-09-05T13:39:46.897000
2008-09-05T13:44:07.947000
45,861
46,174
How do I get js2-mode to use spaces instead of tabs in Emacs?
I am using js2-mode to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2.
Do you have (setq-default indent-tabs-mode nil) in your.emacs? It works fine for me in emacs 23.0.60.1 when I do that. js2-mode uses the standard emacs function indent-to, which respects indent-tabs-mode, to do its indenting.
How do I get js2-mode to use spaces instead of tabs in Emacs? I am using js2-mode to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2.
TITLE: How do I get js2-mode to use spaces instead of tabs in Emacs? QUESTION: I am using js2-mode to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2. ANSWER: Do you have (setq-default indent-tabs-mode nil) ...
[ "javascript", "emacs", "ide", "js2-mode" ]
23
25
6,370
3
0
2008-09-05T13:45:21.753000
2008-09-05T16:14:19.537000
45,865
45,870
Can you disable the back button in a JFace wizard?
I'm writing a wizard for an Eclipse RCP application. After doing some processing on a file and taking some user input, I don't want to let the user go back to make changes. At this point they must either accept or reject the changes they are about to make to the system. What I can't seem to find is a method call that l...
You can return null from the getPreviousPage() method in your wizard page implementation.
Can you disable the back button in a JFace wizard? I'm writing a wizard for an Eclipse RCP application. After doing some processing on a file and taking some user input, I don't want to let the user go back to make changes. At this point they must either accept or reject the changes they are about to make to the system...
TITLE: Can you disable the back button in a JFace wizard? QUESTION: I'm writing a wizard for an Eclipse RCP application. After doing some processing on a file and taking some user input, I don't want to let the user go back to make changes. At this point they must either accept or reject the changes they are about to ...
[ "java", "eclipse", "rcp", "jface", "wizard" ]
7
12
4,546
4
0
2008-09-05T13:48:32.197000
2008-09-05T13:51:12.907000
45,879
45,987
MySQL Partitioning / Sharding / Splitting - which way to go?
We have an InnoDB database that is about 70 GB and we expect it to grow to several hundred GB in the next 2 to 3 years. About 60 % of the data belong to a single table. Currently the database is working quite well as we have a server with 64 GB of RAM, so almost the whole database fits into memory, but we’re concerned ...
If you think you're going to be IO/memory bound, I don't think partitioning is going to be helpful. As usual, benchmarking first will help you figure out the best direction. If you don't have spare servers with 64GB of memory kicking around, you can always ask your vendor for a 'demo unit'. I would lean towards shardin...
MySQL Partitioning / Sharding / Splitting - which way to go? We have an InnoDB database that is about 70 GB and we expect it to grow to several hundred GB in the next 2 to 3 years. About 60 % of the data belong to a single table. Currently the database is working quite well as we have a server with 64 GB of RAM, so alm...
TITLE: MySQL Partitioning / Sharding / Splitting - which way to go? QUESTION: We have an InnoDB database that is about 70 GB and we expect it to grow to several hundred GB in the next 2 to 3 years. About 60 % of the data belong to a single table. Currently the database is working quite well as we have a server with 64...
[ "mysql", "partitioning", "database-performance", "sharding" ]
50
9
19,872
8
0
2008-09-05T13:59:07.663000
2008-09-05T15:00:05.877000
45,882
1,568,341
View TFS checkin history through merges?
In TFS when you merge branch A to branch B and checkin, you get a single changeset on B (typically with a comment like "merged A->B"). This means B doesn't have any of the checkin history from A. So if someone created a new file on branch A, you can't tell who created it from branch B. And if someone updated a file on ...
TFS 2010 will include support for this. Brian Harry talks about it in this presentation. You will now be able to see where a change originated and who made it after the change has been merged to a different branch.
View TFS checkin history through merges? In TFS when you merge branch A to branch B and checkin, you get a single changeset on B (typically with a comment like "merged A->B"). This means B doesn't have any of the checkin history from A. So if someone created a new file on branch A, you can't tell who created it from br...
TITLE: View TFS checkin history through merges? QUESTION: In TFS when you merge branch A to branch B and checkin, you get a single changeset on B (typically with a comment like "merged A->B"). This means B doesn't have any of the checkin history from A. So if someone created a new file on branch A, you can't tell who ...
[ "tfs", "merge", "branch" ]
17
6
14,544
7
0
2008-09-05T14:00:26.053000
2009-10-14T19:07:37.613000
45,888
1,885,355
What is the most efficient way to sort an Html Select's Options by value, while preserving the currently selected item?
I have jQuery but I'm not sure if it has any built-in sorting helpers. I could make a 2d array of each item's text, value, and selected properties, but I don't think that javascript's built in Array.sort() would work correctly.
Extract options into a temporary array, sort, then rebuild the list: var my_options = $("#my_select option"); var selected = $("#my_select").val(); my_options.sort(function(a,b) { if (a.text > b.text) return 1; if (a.text < b.text) return -1; return 0 }) $("#my_select").empty().append( my_options ); $("#my_select").v...
What is the most efficient way to sort an Html Select's Options by value, while preserving the currently selected item? I have jQuery but I'm not sure if it has any built-in sorting helpers. I could make a 2d array of each item's text, value, and selected properties, but I don't think that javascript's built in Array.s...
TITLE: What is the most efficient way to sort an Html Select's Options by value, while preserving the currently selected item? QUESTION: I have jQuery but I'm not sure if it has any built-in sorting helpers. I could make a 2d array of each item's text, value, and selected properties, but I don't think that javascript'...
[ "javascript", "jquery", "arrays", "sorting", "html-select" ]
86
138
106,970
12
0
2008-09-05T14:05:34.917000
2009-12-11T01:51:28.060000
45,898
46,212
Opening a non-standard URL in a Cocoa app
In an application that I'm writing I have some code like this: NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSString* myurl = @"http://www.somewebsite.com/method?a=%d"; NSURL* url = [NSURL URLWithString:myurl]; [ws openURL:url]; The main difference being that myurl comes from somewhere outside my control. Note th...
I'm not sure if this is exactly what you're looking for, but there is a method in NSString that will sanitize a URL: stringByAddingPercentEscapesUsingEncoding:
Opening a non-standard URL in a Cocoa app In an application that I'm writing I have some code like this: NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSString* myurl = @"http://www.somewebsite.com/method?a=%d"; NSURL* url = [NSURL URLWithString:myurl]; [ws openURL:url]; The main difference being that myurl comes ...
TITLE: Opening a non-standard URL in a Cocoa app QUESTION: In an application that I'm writing I have some code like this: NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSString* myurl = @"http://www.somewebsite.com/method?a=%d"; NSURL* url = [NSURL URLWithString:myurl]; [ws openURL:url]; The main difference being...
[ "objective-c", "macos", "cocoa" ]
6
8
1,577
3
0
2008-09-05T14:12:18.427000
2008-09-05T16:21:18.100000
45,904
45,955
How do you add an image?
Situation: I have a simple XML document that contains image information. I need to transform it into HTML. However, I can't see where the open tag is and when I use the XSL code below, it shows the following error message: "Cannot write an attribute node when no element start tag is open." XML content: Dan Testing This...
Just to clarify the problem here - the error is in the following bit of code: The instruction xsl:copy-of takes a node or node-set and makes a copy of it - outputting a node or node-set. However an attribute cannot contain a node, only a textual value, so xsl:value-of would be a possible solution (as this returns the t...
How do you add an image? Situation: I have a simple XML document that contains image information. I need to transform it into HTML. However, I can't see where the open tag is and when I use the XSL code below, it shows the following error message: "Cannot write an attribute node when no element start tag is open." XML ...
TITLE: How do you add an image? QUESTION: Situation: I have a simple XML document that contains image information. I need to transform it into HTML. However, I can't see where the open tag is and when I use the XSL code below, it shows the following error message: "Cannot write an attribute node when no element start ...
[ "xml", "xslt", "xslt-1.0" ]
18
27
127,227
5
0
2008-09-05T14:17:22.737000
2008-09-05T14:44:27.460000
45,941
45,978
Branch / merge management in Subversion 1.5
I've used subversion for a while, and used the svnmerge.py script for a while in my old job to manage merges between branches. I believe Subversion 1.5 is now out, and was supposed to have some branch / merge management system integrated with it. So, can someone give me a quick overview of how to track merges in a bran...
Usage Merge tracking is managed by the client and stored in a property ( svn:mergeinfo ). To use merge tracking you just merge as usual but without the revision range: svn merge trunkURL The client will take care of reading the properties to see what revision(s) need to be merged in and then update the properties with ...
Branch / merge management in Subversion 1.5 I've used subversion for a while, and used the svnmerge.py script for a while in my old job to manage merges between branches. I believe Subversion 1.5 is now out, and was supposed to have some branch / merge management system integrated with it. So, can someone give me a qui...
TITLE: Branch / merge management in Subversion 1.5 QUESTION: I've used subversion for a while, and used the svnmerge.py script for a while in my old job to manage merges between branches. I believe Subversion 1.5 is now out, and was supposed to have some branch / merge management system integrated with it. So, can som...
[ "svn", "version-control" ]
5
4
1,324
3
0
2008-09-05T14:38:05.853000
2008-09-05T14:55:53.347000
45,953
45,966
php execute a background process
I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete. Any suggestions would be much appreciated.
Assuming this is running on a Linux machine, I've always handled it like this: exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile)); This launches the command $cmd, redirects the command output to $outputfile, and writes the process id to $pidfile. That lets you easily monitor what the process is ...
php execute a background process I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete. Any suggestions would be much appreciated.
TITLE: php execute a background process QUESTION: I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete. Any suggestions would be much appreciated. ANSW...
[ "php" ]
287
395
281,020
23
0
2008-09-05T14:43:48.053000
2008-09-05T14:49:53
45,964
45,975
How to multiply 10 to an "Integer" object in Java?
How do I multiply 10 to an Integer object and get back the Integer object? I am looking for the neatest way of doing this. I would probably do it this way: Get int from Integer object, multiply it with the other int and create another Integer object with this int value. Code will be something like... integerObj = new I...
With Java 5's autoboxing, you can simply do: Integer a = new Integer(2); // or even just Integer a = 2; a *= 10; System.out.println(a);
How to multiply 10 to an "Integer" object in Java? How do I multiply 10 to an Integer object and get back the Integer object? I am looking for the neatest way of doing this. I would probably do it this way: Get int from Integer object, multiply it with the other int and create another Integer object with this int value...
TITLE: How to multiply 10 to an "Integer" object in Java? QUESTION: How do I multiply 10 to an Integer object and get back the Integer object? I am looking for the neatest way of doing this. I would probably do it this way: Get int from Integer object, multiply it with the other int and create another Integer object w...
[ "java", "types", "casting" ]
9
27
32,040
6
0
2008-09-05T14:49:27.667000
2008-09-05T14:52:57.907000
45,988
625,057
Choosing a folder with .NET 3.5
In a C#.NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using System.Windows.Forms.FolderBrowserDialog but that's a bit lame. Mainly because you can't type the path into it (so you need to map a network drive, instead of typing a UNC path...
Don't create it yourself! It's been done. You can use FolderBrowserDialogEx - a re-usable derivative of the built-in FolderBrowserDialog. This one allows you to type in a path, even a UNC path. You can also browse for computers or printers with it. Works just like the built-in FBD, but... better. Full Source code. Free...
Choosing a folder with .NET 3.5 In a C#.NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using System.Windows.Forms.FolderBrowserDialog but that's a bit lame. Mainly because you can't type the path into it (so you need to map a network dri...
TITLE: Choosing a folder with .NET 3.5 QUESTION: In a C#.NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using System.Windows.Forms.FolderBrowserDialog but that's a bit lame. Mainly because you can't type the path into it (so you need to...
[ "c#", ".net", "wpf", "winforms" ]
27
36
16,464
4
0
2008-09-05T15:01:28.607000
2009-03-09T04:55:47.160000
45,991
45,998
What's the easiest way to convert Wiki markup to HTML?
I'm building a website that requires very basic markup capabilities. I can't use any 3rd party plugins, so I just need a simple way to convert markup to HTML. I might have a total of 3 tags that I'll allow. What is the best way to convert ==Heading== to Heading, or --bold-- to bold? Can this be done simply with Regex, ...
It's not really a simple problem, because if you're going to display things back to the user, you'll need to also sanitise the input to ensure you don't create any cross site scripting vulnerabilities. That said, you could probably do something pretty simple as you describe most easily with a regular expression replace...
What's the easiest way to convert Wiki markup to HTML? I'm building a website that requires very basic markup capabilities. I can't use any 3rd party plugins, so I just need a simple way to convert markup to HTML. I might have a total of 3 tags that I'll allow. What is the best way to convert ==Heading== to Heading, or...
TITLE: What's the easiest way to convert Wiki markup to HTML? QUESTION: I'm building a website that requires very basic markup capabilities. I can't use any 3rd party plugins, so I just need a simple way to convert markup to HTML. I might have a total of 3 tags that I'll allow. What is the best way to convert ==Headin...
[ "html", "wiki", "markup" ]
12
4
23,573
3
0
2008-09-05T15:04:16.790000
2008-09-05T15:10:07.010000
46,003
46,016
How to change "Generate Method Stub" to throw NotImplementedException in VS?
How can I change default Generate Method Stub behavior in Visaul Studio to generate method with body throw new NotImplementedException(); instead of throw new Exception("The method or operation is not implemented.");
Taken from: http://blogs.msdn.com/ansonh/archive/2005/12/08/501763.aspx Visual Studio 2005 supports targeting the 1.0 version of the compact framework. In order to keep the size of the compact framework small, it does not include all of the same types that exist in the desktop framework. One of the types that is not in...
How to change "Generate Method Stub" to throw NotImplementedException in VS? How can I change default Generate Method Stub behavior in Visaul Studio to generate method with body throw new NotImplementedException(); instead of throw new Exception("The method or operation is not implemented.");
TITLE: How to change "Generate Method Stub" to throw NotImplementedException in VS? QUESTION: How can I change default Generate Method Stub behavior in Visaul Studio to generate method with body throw new NotImplementedException(); instead of throw new Exception("The method or operation is not implemented."); ANSWER:...
[ ".net", "visual-studio", "configuration" ]
8
8
1,925
2
0
2008-09-05T15:11:29.500000
2008-09-05T15:17:12.593000
46,004
46,015
How do you implement resource "edit" forms in a RESTful way?
We are trying to implement a REST API for an application we have now. We want to expose read/write capabilities for various resources using the REST API. How do we implement the "form" part of this? I get how to expose "read" of our data by creating RESTful URLs that essentially function as method calls and return the ...
If you're submitting the data via plain HTML, you're restricted to doing a POST based form. The URI that the POST request is sent to should not be the URI for the resource being modified. You should either POST to a collection resource that ADDs a newly created resource each time (with the URI for the new resource in t...
How do you implement resource "edit" forms in a RESTful way? We are trying to implement a REST API for an application we have now. We want to expose read/write capabilities for various resources using the REST API. How do we implement the "form" part of this? I get how to expose "read" of our data by creating RESTful U...
TITLE: How do you implement resource "edit" forms in a RESTful way? QUESTION: We are trying to implement a REST API for an application we have now. We want to expose read/write capabilities for various resources using the REST API. How do we implement the "form" part of this? I get how to expose "read" of our data by ...
[ "rest" ]
12
3
12,992
4
0
2008-09-05T15:11:44.383000
2008-09-05T15:17:08.787000
46,013
46,024
Best way for a program to self update
What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself?
You have a couple options: You could use another application.exe to do the auto update. This is probably the best method. You can also rename a program's exe while it is running. Hence allowing you to get the file from some update server and replace it. On the program's next startup it will be using the new.exe. You ca...
Best way for a program to self update What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself?
TITLE: Best way for a program to self update QUESTION: What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself? ANSWER: You have a couple options: You could use another application.exe...
[ "updating", "patch" ]
8
10
2,856
7
0
2008-09-05T15:15:49.990000
2008-09-05T15:20:23.537000
46,029
72,421
Data Validation Design Patterns
If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone recommend a good design pattern to look into? Speci...
Just an update on this: I decided to go with the Decorator pattern. That is, I have one 'generic' table class that implements an IValidateableTable interface (which contains validate() method). Then, I created several validation decorators (that also implement IValidateableTable ) which I can wrap around each table tha...
Data Validation Design Patterns If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone recommend a good de...
TITLE: Data Validation Design Patterns QUESTION: If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone r...
[ "design-patterns", "validation", "oop" ]
14
19
37,161
5
0
2008-09-05T15:24:39.830000
2008-09-16T13:50:23.427000
46,030
46,092
C# Force Form Focus
So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it to display properly. The problem that...
I also had trouble activating and bringing a window to the foreground. Here is the code that eventually worked for me. I'm not sure if it will solve your problem. Basically, call ShowWindow() then SetForegroundWindow(). using System.Diagnostics; using System.Runtime.InteropServices; // Sets the window to be foreground...
C# Force Form Focus So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it to display proper...
TITLE: C# Force Form Focus QUESTION: So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it...
[ "c#", "winforms" ]
25
18
56,233
8
0
2008-09-05T15:25:11.030000
2008-09-05T15:49:22.937000
46,074
46,143
Redirect from domain name to a dotted quad hosted box
I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either PHP or some kind of DNS/.htaccess voodoo. So if I go to www.mydomain.com/test it redirects (but keeps the url of ( www.mydomain.com/test ) in the browser's a...
Instead of pointing www.yourdomain.com/test at your test server, why not use test.yourdomain.com? Assuming you have access to the DNS records for yourdomain.com, you should just need to create an A record mapping test.yourdomain.com to your test server's IP address.
Redirect from domain name to a dotted quad hosted box I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either PHP or some kind of DNS/.htaccess voodoo. So if I go to www.mydomain.com/test it redirects (but keeps t...
TITLE: Redirect from domain name to a dotted quad hosted box QUESTION: I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either PHP or some kind of DNS/.htaccess voodoo. So if I go to www.mydomain.com/test it redi...
[ "php", "hosting", "dns" ]
6
6
367
5
0
2008-09-05T15:43:15.010000
2008-09-05T16:07:40.693000
46,079
46,138
What is the best approach for (client-side) disabling of a submit button?
Details: Only disable after user clicks the submit button, but before the posting back to the server ASP.NET Webforms (.NET 1.1) Prefer jQuery (if any library at all) Must be enabled if form reloads (i.e. credit card failed) This isn't a necessity that I do this, but if there is a simple way to do it without having to ...
For all submit buttons, via JQuery, it'd be: $('input[type=submit]').click(function() { this.disabled = true; }); Or it might be more useful to do so on form submission: $('form').submit(function() { $('input[type=submit]', this).attr("disabled","disabled"); }); But I think we could give a better answer to your questio...
What is the best approach for (client-side) disabling of a submit button? Details: Only disable after user clicks the submit button, but before the posting back to the server ASP.NET Webforms (.NET 1.1) Prefer jQuery (if any library at all) Must be enabled if form reloads (i.e. credit card failed) This isn't a necessit...
TITLE: What is the best approach for (client-side) disabling of a submit button? QUESTION: Details: Only disable after user clicks the submit button, but before the posting back to the server ASP.NET Webforms (.NET 1.1) Prefer jQuery (if any library at all) Must be enabled if form reloads (i.e. credit card failed) Thi...
[ "asp.net", "javascript", "jquery", "webforms", ".net-1.1" ]
11
12
4,566
7
0
2008-09-05T15:45:22.713000
2008-09-05T16:05:04.677000
46,080
46,083
How do you move a file?
I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it? (My current strategy has been to copy the file into the new folder and check it in and then delete the file from the curr...
Subversion has native support for moving files. svn move SOURCE DESTINATION See the online help (svn help move) for more information.
How do you move a file? I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it? (My current strategy has been to copy the file into the new folder and check it in and then delet...
TITLE: How do you move a file? QUESTION: I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it? (My current strategy has been to copy the file into the new folder and check it...
[ "svn", "tortoisesvn" ]
223
97
137,045
13
0
2008-09-05T15:45:53.380000
2008-09-05T15:46:55.907000
46,096
46,104
What are the names given to these 2 LINQ expressions
I'm trying to find the correct names for these 2 "types" of coding expressions in LINQ so that I can refer to them correctly. I want to say that the first is called "Fluent Style"? var selectVar = arrayVar.Select( (a,i) => new { Line = a }); var selectVar = from s in arrayVar select new { Line = s };
First - calling an extension method. This style of coding is called " fluent interface " as you mentioned. Second method is called language integrated query
What are the names given to these 2 LINQ expressions I'm trying to find the correct names for these 2 "types" of coding expressions in LINQ so that I can refer to them correctly. I want to say that the first is called "Fluent Style"? var selectVar = arrayVar.Select( (a,i) => new { Line = a }); var selectVar = from s i...
TITLE: What are the names given to these 2 LINQ expressions QUESTION: I'm trying to find the correct names for these 2 "types" of coding expressions in LINQ so that I can refer to them correctly. I want to say that the first is called "Fluent Style"? var selectVar = arrayVar.Select( (a,i) => new { Line = a }); var se...
[ "linq" ]
0
4
155
3
0
2008-09-05T15:50:20.453000
2008-09-05T15:52:44.037000
46,124
46,126
Is there a list of browser conditionals for use including stylesheets?
I've seen people doing things like this in their HTML: Does this work across all modern browsers and is there a list of browser types that will work with that kind of if statement? Edit Thanks Ross. Interesting to find out about gt, lt, gte, & lte.
This works across all browsers because anything except IE sees. Only IE reads the comment if it contains a conditional clause. Have a look at this article You can also specify which version of IE. For example:
Is there a list of browser conditionals for use including stylesheets? I've seen people doing things like this in their HTML: Does this work across all modern browsers and is there a list of browser types that will work with that kind of if statement? Edit Thanks Ross. Interesting to find out about gt, lt, gte, & lte.
TITLE: Is there a list of browser conditionals for use including stylesheets? QUESTION: I've seen people doing things like this in their HTML: Does this work across all modern browsers and is there a list of browser types that will work with that kind of if statement? Edit Thanks Ross. Interesting to find out about gt...
[ "css", "browser", "conditional-statements" ]
8
11
726
4
0
2008-09-05T15:58:13.913000
2008-09-05T15:59:02.397000
46,125
46,141
Can XPath match on parts of an element's name?
I want to do this: //*fu which returns all nodes whose name ends in fu, such as and, but not
Do something like: //*[ends-with(name(), 'fu')] For a good XPath reference, check out W3Schools.
Can XPath match on parts of an element's name? I want to do this: //*fu which returns all nodes whose name ends in fu, such as and, but not
TITLE: Can XPath match on parts of an element's name? QUESTION: I want to do this: //*fu which returns all nodes whose name ends in fu, such as and, but not ANSWER: Do something like: //*[ends-with(name(), 'fu')] For a good XPath reference, check out W3Schools.
[ "xml", "xpath" ]
39
41
26,454
3
0
2008-09-05T15:58:16.550000
2008-09-05T16:06:18.917000
46,130
47,308
How do I group in memory lists?
I have a list of Foo. Foo has properties Bar and Lum. Some Foo s have identical values for Bar. How can I use lambda/linq to group my Foo s by Bar so I can iterate over each grouping's Lum s?
Deeno, Enjoy: var foos = new List { new Foo{Bar = 1,Lum = 1}, new Foo{Bar = 1,Lum = 2}, new Foo{Bar = 2,Lum = 3}, }; // Using language integrated queries: var q = from foo in foos group foo by foo.Bar into groupedFoos let lums = from fooGroup in groupedFoos select fooGroup.Lum select new { Bar = groupedFoos.Key, Lums...
How do I group in memory lists? I have a list of Foo. Foo has properties Bar and Lum. Some Foo s have identical values for Bar. How can I use lambda/linq to group my Foo s by Bar so I can iterate over each grouping's Lum s?
TITLE: How do I group in memory lists? QUESTION: I have a list of Foo. Foo has properties Bar and Lum. Some Foo s have identical values for Bar. How can I use lambda/linq to group my Foo s by Bar so I can iterate over each grouping's Lum s? ANSWER: Deeno, Enjoy: var foos = new List { new Foo{Bar = 1,Lum = 1}, new Foo...
[ "c#", ".net", "linq", "lambda" ]
5
3
386
2
0
2008-09-05T16:01:35.887000
2008-09-06T07:34:15.007000
46,136
46,184
What is the best approach to moving a preexisting project from Flash 7/AS2 to Flex/AS3?
I have a large codebase that targetted Flash 7, with a lot of AS2 classes. I'm hoping that I'll be able to use Flex for any new projects, but a lot of new stuff in our roadmap is additions to the old code. The syntax for AS2 and AS3 is generally the same, so I'm starting to wonder how hard it would be to port the curre...
Some notable problems I saw when attempting to convert a large number of AS2 classes to AS3: Package naming class your.package.YourClass { } becomes package your.package { class YourClass { } } Imports are required You must explicitly import any outside classes used -- referring to them by their fully qualified name is...
What is the best approach to moving a preexisting project from Flash 7/AS2 to Flex/AS3? I have a large codebase that targetted Flash 7, with a lot of AS2 classes. I'm hoping that I'll be able to use Flex for any new projects, but a lot of new stuff in our roadmap is additions to the old code. The syntax for AS2 and AS3...
TITLE: What is the best approach to moving a preexisting project from Flash 7/AS2 to Flex/AS3? QUESTION: I have a large codebase that targetted Flash 7, with a lot of AS2 classes. I'm hoping that I'll be able to use Flex for any new projects, but a lot of new stuff in our roadmap is additions to the old code. The synt...
[ "apache-flex", "flash", "actionscript-3", "porting" ]
6
6
1,047
5
0
2008-09-05T16:04:36.580000
2008-09-05T16:15:47.523000
46,147
46,196
Why are all links are red, in Chrome and Safari?
Have just started using Google Chrome, and noticed in parts of our site, e.g. all the links on the page, are bright red. They should be black with a dotted underline. Is there some gotcha in WebKit rendering that turns all links red regardless of the style?
Are all of the resources that you're linking to in the present at the locations where your page is seeking them (verify this by actually checking it). I've also had an issue when checking an app in Safari where I was attempting to pull a file that wasn't there and I had very similar output to yours (red links). EDIT: A...
Why are all links are red, in Chrome and Safari? Have just started using Google Chrome, and noticed in parts of our site, e.g. all the links on the page, are bright red. They should be black with a dotted underline. Is there some gotcha in WebKit rendering that turns all links red regardless of the style?
TITLE: Why are all links are red, in Chrome and Safari? QUESTION: Have just started using Google Chrome, and noticed in parts of our site, e.g. all the links on the page, are bright red. They should be black with a dotted underline. Is there some gotcha in WebKit rendering that turns all links red regardless of the st...
[ "css", "safari", "google-chrome", "webkit" ]
5
4
3,117
7
0
2008-09-05T16:08:19.007000
2008-09-05T16:17:54.553000
46,155
46,181
How can I validate an email address in JavaScript?
I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?
Using regular expressions is probably the best way of validating an email address in JavaScript. View a bunch of tests on JSFiddle taken from Chromium. const validateEmail = (email) => { return String(email).toLowerCase().match( /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[...
How can I validate an email address in JavaScript? I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?
TITLE: How can I validate an email address in JavaScript? QUESTION: I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this? ANSWER: Using regular expressions is probably th...
[ "javascript", "html", "regex", "email-validation" ]
5,474
6,575
4,692,898
79
0
2008-09-05T16:10:11.093000
2008-09-05T16:15:34.747000
46,156
46,207
What could cause Run-time error 1012 Error accessing application data directories
Friend of mine has a problem:). There is an application written in Visual Basic 6.0 (not by him). One of users reported that when it run on Windows 2000 and tried to scan folders on disk it raised box with message: Run-time error 1012 Error accessing application data directories We couldn't google anything about it and...
Error 1012 is rather generically ERROR_CANT_READ. See this Microsoft list, but it also implies it refers to the registry. You could try running SysInternals Process Monitor to look for failing file/registry operations by the process.
What could cause Run-time error 1012 Error accessing application data directories Friend of mine has a problem:). There is an application written in Visual Basic 6.0 (not by him). One of users reported that when it run on Windows 2000 and tried to scan folders on disk it raised box with message: Run-time error 1012 Err...
TITLE: What could cause Run-time error 1012 Error accessing application data directories QUESTION: Friend of mine has a problem:). There is an application written in Visual Basic 6.0 (not by him). One of users reported that when it run on Windows 2000 and tried to scan folders on disk it raised box with message: Run-t...
[ "windows", "vb6", "runtime-error" ]
0
2
1,013
1
0
2008-09-05T16:10:14.087000
2008-09-05T16:20:23.097000
46,189
46,206
Mapping collections with LINQ
I have a collection of objects to which I'd like to just add a new property. How do I do that with LINQ?
var a = from i in ObjectCollection select new {i.prop1, i.prop2, i.prop3,..., newprop = newProperty}
Mapping collections with LINQ I have a collection of objects to which I'd like to just add a new property. How do I do that with LINQ?
TITLE: Mapping collections with LINQ QUESTION: I have a collection of objects to which I'd like to just add a new property. How do I do that with LINQ? ANSWER: var a = from i in ObjectCollection select new {i.prop1, i.prop2, i.prop3,..., newprop = newProperty}
[ "linq", "functional-programming" ]
7
3
224
3
0
2008-09-05T16:17:16.753000
2008-09-05T16:19:35.860000
46,214
46,253
Good ways to improve jQuery selector performance?
I'm looking for any way that I can improve the selector performance of a jQuery call. Specifically things like this: Is $("div.myclass") faster than $(".myclass") I would think it might be, but I don't know if jQuery is smart enough to limit the search by tag name first, etc. Anyone have any ideas for how to formulate ...
There is no doubt that filtering by tag name first is much faster than filtering by classname. This will be the case until all browsers implement getElementsByClassName natively, as is the case with getElementsByTagName.
Good ways to improve jQuery selector performance? I'm looking for any way that I can improve the selector performance of a jQuery call. Specifically things like this: Is $("div.myclass") faster than $(".myclass") I would think it might be, but I don't know if jQuery is smart enough to limit the search by tag name first...
TITLE: Good ways to improve jQuery selector performance? QUESTION: I'm looking for any way that I can improve the selector performance of a jQuery call. Specifically things like this: Is $("div.myclass") faster than $(".myclass") I would think it might be, but I don't know if jQuery is smart enough to limit the search...
[ "javascript", "jquery", "performance", "css-selectors" ]
74
35
30,282
12
0
2008-09-05T16:22:26.837000
2008-09-05T16:39:39.383000
46,219
46,242
How to determine if user selected a file for file upload?
If I have a tag, and a submit button, how do I determine, in IE6 (and above) if a file has been selected by the user. In FF, I just do: var selected = document.getElementById("uploadBox").files.length > 0; But that doesn't work in IE.
This works in IE (and FF, I believe): if(document.getElementById("uploadBox").value!= "") { // you have a file }
How to determine if user selected a file for file upload? If I have a tag, and a submit button, how do I determine, in IE6 (and above) if a file has been selected by the user. In FF, I just do: var selected = document.getElementById("uploadBox").files.length > 0; But that doesn't work in IE.
TITLE: How to determine if user selected a file for file upload? QUESTION: If I have a tag, and a submit button, how do I determine, in IE6 (and above) if a file has been selected by the user. In FF, I just do: var selected = document.getElementById("uploadBox").files.length > 0; But that doesn't work in IE. ANSWER: ...
[ "javascript", "html", "upload" ]
71
132
118,489
5
0
2008-09-05T16:23:48.580000
2008-09-05T16:33:12.597000
46,220
46,357
iPhone app crashing with NSUnknownKeyException setValue:forUndefinedKey:
I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging. Essentially my app displays an image and when touched plays a short sound. When compiling and building the project in XCode, everything builds successfully, but when the app is run in the iPhone simulator, it crash...
(This isn't really iPhone specific - the same thing will happen in regular Cocoa). NSUnknownKeyException is a common error when using Key-Value Coding to access a key that the object doesn't have. The properties of most Cocoa objects can be accessing directly: [@"hello world" length] // Objective-C 1.0 @"hello world".l...
iPhone app crashing with NSUnknownKeyException setValue:forUndefinedKey: I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging. Essentially my app displays an image and when touched plays a short sound. When compiling and building the project in XCode, everything build...
TITLE: iPhone app crashing with NSUnknownKeyException setValue:forUndefinedKey: QUESTION: I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging. Essentially my app displays an image and when touched plays a short sound. When compiling and building the project in XCode...
[ "iphone", "xib", "key-value-coding" ]
19
22
28,846
8
0
2008-09-05T16:23:57.330000
2008-09-05T17:28:35.070000
46,231
46,486
How to generate a verification code/number?
I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instead, it will validate the number against an ...
After some research, I think I'll go with the ISO 7064 Mod 97,10 formula. It seems pretty solid as it is used to validate IBAN (International Bank Account Number). The formula is very simple: Take a number: 123456 Apply the following formula to obtain the 2 digits checksum: mod(98 - mod(number * 100, 97), 97) => 76 Con...
How to generate a verification code/number? I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but inst...
TITLE: How to generate a verification code/number? QUESTION: I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid...
[ "algorithm", "checksum", "error-checking", "data-consistency" ]
28
32
50,892
9
0
2008-09-05T16:28:34.840000
2008-09-05T18:30:26.107000
46,252
46,257
Is there a way I can have a VM gain access to my computer?
I would like to have a VM to look at how applications appear and to develop OS-specific applications, however, I want to keep all my code on my Windows machine so if I decide to nuke a VM or anything like that, it's all still there. If it matters, I'm using VirtualBox.
This is usually handled with network shares. Share your code folder from your host machine and access it from the VMs.
Is there a way I can have a VM gain access to my computer? I would like to have a VM to look at how applications appear and to develop OS-specific applications, however, I want to keep all my code on my Windows machine so if I decide to nuke a VM or anything like that, it's all still there. If it matters, I'm using Vir...
TITLE: Is there a way I can have a VM gain access to my computer? QUESTION: I would like to have a VM to look at how applications appear and to develop OS-specific applications, however, I want to keep all my code on my Windows machine so if I decide to nuke a VM or anything like that, it's all still there. If it matt...
[ "virtual-machine", "virtualbox" ]
0
5
1,336
4
0
2008-09-05T16:38:39.260000
2008-09-05T16:40:26.887000
46,276
46,294
Test Driven Development in PHP
I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework. I would like to start using TDD in new projects but I'm really not sure where to begin. What recommendations do you have for a PHP...
I've used both PHPUnit & SimpleTest and I found SimpleTest to be easier to use. As far as TDD goes, I haven't had much luck with it in the purest sense. I think that's mainly a time/discipline issue on my part though. Adding tests after the fact has been somewhat useful but my favorite things to do is use write SimpleT...
Test Driven Development in PHP I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework. I would like to start using TDD in new projects but I'm really not sure where to begin. What recomm...
TITLE: Test Driven Development in PHP QUESTION: I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework. I would like to start using TDD in new projects but I'm really not sure where to ...
[ "php", "unit-testing", "tdd" ]
44
41
16,913
8
0
2008-09-05T16:48:44.260000
2008-09-05T16:54:04.623000
46,277
47,808
Passing large files to WCF service
We have an encryption service that we've exposed over net. tcp. Most of the time, the service is used to encrypt/decrypt strings. However, every now and then, we the need to encrypt large documents (pdf, JPG, bmp, etc.). What are the best endpoint settings for a scenario like this? Should I accept/return a stream? I've...
MSDN describes how to enable streaming over WCF rather well. Note, if the link between client and server needs to be encrypted, then you'll need to "roll your own" encryption mechanism. The default net.tcp encryption requires X.509 certificates, which won't work with streams as this kind of encryption needs to work on ...
Passing large files to WCF service We have an encryption service that we've exposed over net. tcp. Most of the time, the service is used to encrypt/decrypt strings. However, every now and then, we the need to encrypt large documents (pdf, JPG, bmp, etc.). What are the best endpoint settings for a scenario like this? Sh...
TITLE: Passing large files to WCF service QUESTION: We have an encryption service that we've exposed over net. tcp. Most of the time, the service is used to encrypt/decrypt strings. However, every now and then, we the need to encrypt large documents (pdf, JPG, bmp, etc.). What are the best endpoint settings for a scen...
[ "wcf", "web-services" ]
6
4
3,431
2
0
2008-09-05T16:49:07.800000
2008-09-06T20:23:16.653000
46,281
71,406
How do DVCSs (DRCSs) work?
I have been hearing a lot of good things about DVCS systems, in particular about bazaar. Apart from the concept of distributed repository, I see two main advantages being touted: the merge is better automated, and the rename is handled right. Could someone please point me at some text explaining how exactly the improve...
Merge is not intrinsically better in DVCS, it is just that they would be practically very difficult to use if the branch/merge did not work correctly (svn arguably does not implement branching/merging correctly), because instead of making a checkout, you are making a new branch everytime you start working on a project ...
How do DVCSs (DRCSs) work? I have been hearing a lot of good things about DVCS systems, in particular about bazaar. Apart from the concept of distributed repository, I see two main advantages being touted: the merge is better automated, and the rename is handled right. Could someone please point me at some text explain...
TITLE: How do DVCSs (DRCSs) work? QUESTION: I have been hearing a lot of good things about DVCS systems, in particular about bazaar. Apart from the concept of distributed repository, I see two main advantages being touted: the merge is better automated, and the rename is handled right. Could someone please point me at...
[ "git", "version-control", "dvcs", "bazaar" ]
0
2
605
5
0
2008-09-05T16:50:23.740000
2008-09-16T11:33:12.850000
46,282
46,378
How do I create an XmlNode from a call to XmlSerializer.Serialize?
I am using a class library which represents some of its configuration in.xml. The configuration is read in using the XmlSerializer. Fortunately, the classes which represent the.xml use the XmlAnyElement attribute at which allows me to extend the configuration data for my own purposes without modifying the original clas...
So you need to have your class contain custom configuration information, then serialize that class to XML, then make that serialized XML into an XML node: is that right? Could you just take the string created by the XMLSerializer and wrap that in it's own XML tags? XmlSerializer xs = new XmlSerializer(typeof(MyConfig))...
How do I create an XmlNode from a call to XmlSerializer.Serialize? I am using a class library which represents some of its configuration in.xml. The configuration is read in using the XmlSerializer. Fortunately, the classes which represent the.xml use the XmlAnyElement attribute at which allows me to extend the configu...
TITLE: How do I create an XmlNode from a call to XmlSerializer.Serialize? QUESTION: I am using a class library which represents some of its configuration in.xml. The configuration is read in using the XmlSerializer. Fortunately, the classes which represent the.xml use the XmlAnyElement attribute at which allows me to ...
[ "c#", "xml" ]
15
13
21,280
4
0
2008-09-05T16:50:35.973000
2008-09-05T17:43:28.387000
46,283
46,314
Can a service have multiple endpoints?
We have a service that has some settings that are supported only over net.tcp. What's the best way to add another endpoint? Do I need to create an entire new host?
A service may have multiple endpoints within a single host, but every endpoint must have a unique combination of address, binding and contract. For an IIS-hosted service (that is, an.SVC file), just set the address of the endpoint to a relative URI and make sure that your Visual Studio or wsdl.exe generated client spec...
Can a service have multiple endpoints? We have a service that has some settings that are supported only over net.tcp. What's the best way to add another endpoint? Do I need to create an entire new host?
TITLE: Can a service have multiple endpoints? QUESTION: We have a service that has some settings that are supported only over net.tcp. What's the best way to add another endpoint? Do I need to create an entire new host? ANSWER: A service may have multiple endpoints within a single host, but every endpoint must have a...
[ ".net", "wcf", "web-services" ]
8
6
23,430
4
0
2008-09-05T16:50:44.847000
2008-09-05T17:03:12.633000
46,292
46,308
Plug In Design for .NET App
I’m looking at rewriting a portion of our application in C# (currently legacy VB6 code). The module I am starting with is responsible for importing data from a variety of systems into our database. About 5-6 times a year, a new client asks us to write a new import for the system that they use. Presently, this requires ...
I would recommend you take a look at the Managed Add-In Framework that shipped with.NET 3.5. The Add-In team has posted some samples and tools at CodePlex site as well..
Plug In Design for .NET App I’m looking at rewriting a portion of our application in C# (currently legacy VB6 code). The module I am starting with is responsible for importing data from a variety of systems into our database. About 5-6 times a year, a new client asks us to write a new import for the system that they us...
TITLE: Plug In Design for .NET App QUESTION: I’m looking at rewriting a portion of our application in C# (currently legacy VB6 code). The module I am starting with is responsible for importing data from a variety of systems into our database. About 5-6 times a year, a new client asks us to write a new import for the s...
[ ".net", "plugins", "interface-design" ]
5
3
673
3
0
2008-09-05T16:53:13.860000
2008-09-05T16:59:46.497000
46,305
46,313
Setting Nameservers - how?
I understand how I can change the dns settings for my domains by editing my bind configs, when I run my own name-servers. I know that I can define the name-servers with my registrar via their online control panels. But I have no idea how that part works... How does my registrar store the data about the name-servers? Is...
The registrar is responsible for setting the Root DNS entry that says, "When someone asks for stackoverflow.com, tell them that the authoritative DNS is xxx.xxx.xxx.xxx". They have an interface that allows them to make changes to the records they own. Then the requester must go to the authoritative DNS (Which is the on...
Setting Nameservers - how? I understand how I can change the dns settings for my domains by editing my bind configs, when I run my own name-servers. I know that I can define the name-servers with my registrar via their online control panels. But I have no idea how that part works... How does my registrar store the data...
TITLE: Setting Nameservers - how? QUESTION: I understand how I can change the dns settings for my domains by editing my bind configs, when I run my own name-servers. I know that I can define the name-servers with my registrar via their online control panels. But I have no idea how that part works... How does my regist...
[ "dns", "config" ]
3
2
1,356
5
0
2008-09-05T16:58:59.790000
2008-09-05T17:02:17.520000
46,324
46,448
Possible to perform cross-database queries with PostgreSQL?
I'm going to guess that the answer is "no" based on the below error message (and this Google result ), but is there anyway to perform a cross-database query using PostgreSQL? databaseA=# select * from databaseB.public.someTableName; ERROR: cross-database references are not implemented: "databaseB.public.someTableName" ...
Note: As the original asker implied, if you are setting up two databases on the same machine you probably want to make two schemas instead - in that case you don't need anything special to query across them. postgres_fdw Use postgres_fdw (foreign data wrapper) to connect to tables in any Postgres database - local or re...
Possible to perform cross-database queries with PostgreSQL? I'm going to guess that the answer is "no" based on the below error message (and this Google result ), but is there anyway to perform a cross-database query using PostgreSQL? databaseA=# select * from databaseB.public.someTableName; ERROR: cross-database refer...
TITLE: Possible to perform cross-database queries with PostgreSQL? QUESTION: I'm going to guess that the answer is "no" based on the below error message (and this Google result ), but is there anyway to perform a cross-database query using PostgreSQL? databaseA=# select * from databaseB.public.someTableName; ERROR: cr...
[ "sql", "postgresql" ]
216
165
354,408
10
0
2008-09-05T17:09:13.853000
2008-09-05T18:10:20.070000
46,332
46,583
How to organize a complex Flash project
Let's compile a list of tips. (Understandably there will be some subjectivity involved, but some pointers would be useful to someone overwhelmed by tackling a large project within the Flash framework.)
These are just scattered thoughts on organization for projects being worked on mostly with the Flash IDE. First, I highly recommend using source control, like Subversion, CVS, or Git. Organization of filesystem folder structure is subjective, but I generally have a "src" folder for all my source FLAs and AS class files...
How to organize a complex Flash project Let's compile a list of tips. (Understandably there will be some subjectivity involved, but some pointers would be useful to someone overwhelmed by tackling a large project within the Flash framework.)
TITLE: How to organize a complex Flash project QUESTION: Let's compile a list of tips. (Understandably there will be some subjectivity involved, but some pointers would be useful to someone overwhelmed by tackling a large project within the Flash framework.) ANSWER: These are just scattered thoughts on organization f...
[ "actionscript-3", "flash" ]
5
2
4,192
3
0
2008-09-05T17:15:51.997000
2008-09-05T19:04:26.197000
46,338
46,356
Can you access a model from inside another model in CodeIgniter?
I am writing a webapp using CodeIgniter that requires authentication. I created a model which handles all my authentication. However, I can't find a way to access this authentication model from inside another model. Is there a way to access a model from inside another mode, or a better way to handle authentication insi...
In general, you don't want to create objects inside an object. That's a bad habit, instead, write a clear API and inject a model into your model. setWhatever($model1);?>
Can you access a model from inside another model in CodeIgniter? I am writing a webapp using CodeIgniter that requires authentication. I created a model which handles all my authentication. However, I can't find a way to access this authentication model from inside another model. Is there a way to access a model from i...
TITLE: Can you access a model from inside another model in CodeIgniter? QUESTION: I am writing a webapp using CodeIgniter that requires authentication. I created a model which handles all my authentication. However, I can't find a way to access this authentication model from inside another model. Is there a way to acc...
[ "php", "codeigniter", "authentication", "model" ]
20
14
21,568
4
0
2008-09-05T17:18:55.983000
2008-09-05T17:26:45.090000
46,346
46,396
.NET Console Application Tab Completion
Any ideas on how to implement tab completion for a.NET (C#) Console Application? And I mean within an application that is run and then loops for user input (like if you run ftp.exe without any arguments), like this: string line = string.Empty; while (line!= "exit") { //do something here Console.ReadLine(); } I know I p...
Take a look at this code from the Mono project http://tirania.org/blog/archive/2008/Aug-26.html I played with it some the other day. It does a lot of command line editingy, but I don't think it does line completion.
.NET Console Application Tab Completion Any ideas on how to implement tab completion for a.NET (C#) Console Application? And I mean within an application that is run and then loops for user input (like if you run ftp.exe without any arguments), like this: string line = string.Empty; while (line!= "exit") { //do somethi...
TITLE: .NET Console Application Tab Completion QUESTION: Any ideas on how to implement tab completion for a.NET (C#) Console Application? And I mean within an application that is run and then loops for user input (like if you run ftp.exe without any arguments), like this: string line = string.Empty; while (line!= "exi...
[ ".net", "console" ]
17
6
7,016
5
0
2008-09-05T17:22:53.850000
2008-09-05T17:49:20.963000
46,350
46,391
Center a block of content when you don't know its width in advance
After lots of attempts and search I have never found a satisfactory way to do it with CSS2. A simple way to accomplish it is to wrap it into a handy as shown in the sample below. Do you know how to do it avoiding table layouts and also avoiding quirky tricks? table { margin: 0 auto; } test test What I want to know is h...
@Jason, yep, works. Good times. I'll propose the following, though: body { text-align: center; }.my-centered-content { margin: 0 auto; /* Centering */ display: inline; } test test EDIT @Santi, a block-level element will fill the width of the parent container, so it will effectively be width:100% and the text will ...
Center a block of content when you don't know its width in advance After lots of attempts and search I have never found a satisfactory way to do it with CSS2. A simple way to accomplish it is to wrap it into a handy as shown in the sample below. Do you know how to do it avoiding table layouts and also avoiding quirky t...
TITLE: Center a block of content when you don't know its width in advance QUESTION: After lots of attempts and search I have never found a satisfactory way to do it with CSS2. A simple way to accomplish it is to wrap it into a handy as shown in the sample below. Do you know how to do it avoiding table layouts and also...
[ "html", "css" ]
8
9
4,356
6
0
2008-09-05T17:24:42.457000
2008-09-05T17:48:53.913000
46,354
46,382
"Invalid column name" error on SQL statement from OpenQuery results
I'm trying to perform a SQL query through a linked SSAS server. The initial query works fine: SELECT "Ugly OLAP name" as "Value" FROM OpenQuery( OLAP, 'OLAP Query') But if I try to add: WHERE "Value" > 0 I get an error Invalid column name 'Value' Any ideas what I might be doing wrong? So the problem was that the order ...
This should work: SELECT A.Value FROM ( SELECT "Ugly OLAP name" as "Value" FROM OpenQuery( OLAP, 'OLAP Query') ) AS a WHERE a.Value > 0 It's not that Value is a reserved word, the problem is that it's a column alias, not the column name. By making it an inline view, "Value" becomes the column name and can then be used ...
"Invalid column name" error on SQL statement from OpenQuery results I'm trying to perform a SQL query through a linked SSAS server. The initial query works fine: SELECT "Ugly OLAP name" as "Value" FROM OpenQuery( OLAP, 'OLAP Query') But if I try to add: WHERE "Value" > 0 I get an error Invalid column name 'Value' Any i...
TITLE: "Invalid column name" error on SQL statement from OpenQuery results QUESTION: I'm trying to perform a SQL query through a linked SSAS server. The initial query works fine: SELECT "Ugly OLAP name" as "Value" FROM OpenQuery( OLAP, 'OLAP Query') But if I try to add: WHERE "Value" > 0 I get an error Invalid column ...
[ "sql", "sql-server" ]
21
17
85,197
4
0
2008-09-05T17:26:38.367000
2008-09-05T17:45:43.983000
46,377
46,384
How do I specify multiple constraints on a generic type in C#?
What is the syntax for placing constraints on multiple types? The basic example: class Animal where SpeciesType: Species I would like to place constraints on both types in the following definition such that SpeciesType must inherit from Species and OrderType must inherit from Order: class Animal
public class Animal where SpeciesType: Species where OrderType: Order { }
How do I specify multiple constraints on a generic type in C#? What is the syntax for placing constraints on multiple types? The basic example: class Animal where SpeciesType: Species I would like to place constraints on both types in the following definition such that SpeciesType must inherit from Species and OrderTyp...
TITLE: How do I specify multiple constraints on a generic type in C#? QUESTION: What is the syntax for placing constraints on multiple types? The basic example: class Animal where SpeciesType: Species I would like to place constraints on both types in the following definition such that SpeciesType must inherit from Sp...
[ "c#", ".net", "oop", "generics", "type-constraints" ]
33
60
9,774
2
0
2008-09-05T17:43:03.473000
2008-09-05T17:46:13.810000
46,380
46,400
Why doesn't Oracle tell you WHICH table or view does not exist?
If you've used Oracle, you've probably gotten the helpful message "ORA-00942: Table or view does not exist". Is there a legitimate technical reason the message doesn't include the name of the missing object? Arguments about this being due to security sound like they were crafted by the TSA. If I'm an attacker, I'd know...
You can set an EVENT in your parameter file (plain text or spfile) to force Oracle to dump a detailed trace file in the user_dump_dest, the object name might be in there, if not the SQL should be. EVENT="942 trace name errorstack level 12" If you are using a plain text file you need to keep all your EVENT settings on c...
Why doesn't Oracle tell you WHICH table or view does not exist? If you've used Oracle, you've probably gotten the helpful message "ORA-00942: Table or view does not exist". Is there a legitimate technical reason the message doesn't include the name of the missing object? Arguments about this being due to security sound...
TITLE: Why doesn't Oracle tell you WHICH table or view does not exist? QUESTION: If you've used Oracle, you've probably gotten the helpful message "ORA-00942: Table or view does not exist". Is there a legitimate technical reason the message doesn't include the name of the missing object? Arguments about this being due...
[ "sql", "database", "oracle", "ora-00942" ]
66
14
24,245
8
0
2008-09-05T17:45:02.223000
2008-09-05T17:51:57.167000
46,385
46,386
Delete all but top n from database table in SQL
What's the best way to delete all rows from a table in sql but to keep n number of rows on the top?
DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table) Edit: Chris brings up a good performance hit since the TOP 10 query would be run for each row. If this is a one time thing, then it may not be as big of a deal, but if it is a common thing, then I did look closer at it.
Delete all but top n from database table in SQL What's the best way to delete all rows from a table in sql but to keep n number of rows on the top?
TITLE: Delete all but top n from database table in SQL QUESTION: What's the best way to delete all rows from a table in sql but to keep n number of rows on the top? ANSWER: DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table) Edit: Chris brings up a good performance hit since the TOP 10 query would be run ...
[ "sql" ]
98
94
108,163
11
0
2008-09-05T17:46:33.607000
2008-09-05T17:47:34.073000
46,387
46,405
How to get the correct Content-Length for a POST request
I am using a perl script to POST to Google Appengine application. I post a text file containing some XML using the -F option. http://www.cpan.org/authors/id/E/EL/ELIJAH/bget-1.1 There is a version 1.2, already tested and get the same issue. The post looks something like this. Host: foo.appspot.com User-Agent: lwp-reque...
Is the number of extra bytes you need equal to the number of lines in the file? I ask because perhaps its possible that somehow carriage-returns are being introduced but not counted.
How to get the correct Content-Length for a POST request I am using a perl script to POST to Google Appengine application. I post a text file containing some XML using the -F option. http://www.cpan.org/authors/id/E/EL/ELIJAH/bget-1.1 There is a version 1.2, already tested and get the same issue. The post looks somethi...
TITLE: How to get the correct Content-Length for a POST request QUESTION: I am using a perl script to POST to Google Appengine application. I post a text file containing some XML using the -F option. http://www.cpan.org/authors/id/E/EL/ELIJAH/bget-1.1 There is a version 1.2, already tested and get the same issue. The ...
[ "perl", "google-app-engine", "https" ]
3
3
7,233
3
0
2008-09-05T17:48:00.467000
2008-09-05T17:53:02.873000
46,389
46,966
How to export findbugs results from Eclipse findbugs plugin?
I have findbugs plugin for eclipse which when run on my project will show results in Bugs explorer clubbed by the type of bug. I need to be able to do two things: Export all these to excel sheet Find out the bugs reported in a set of files (and be able to do it recursively w/o running for whole project and exporting an...
Findbugs dumps its results into an XML file in your workspace's.metadata folder. Look for the subfolder that's named something like findbugs. You can also download a standalone version of Findbugs that will save the results wherever you like. Once you have the results file, you might be able to import from XML to Excel...
How to export findbugs results from Eclipse findbugs plugin? I have findbugs plugin for eclipse which when run on my project will show results in Bugs explorer clubbed by the type of bug. I need to be able to do two things: Export all these to excel sheet Find out the bugs reported in a set of files (and be able to do ...
TITLE: How to export findbugs results from Eclipse findbugs plugin? QUESTION: I have findbugs plugin for eclipse which when run on my project will show results in Bugs explorer clubbed by the type of bug. I need to be able to do two things: Export all these to excel sheet Find out the bugs reported in a set of files (...
[ "java", "eclipse-plugin", "findbugs" ]
7
7
14,312
2
0
2008-09-05T17:48:28.470000
2008-09-05T21:49:12.383000
46,394
46,410
Automatic Timeout Web Client Use
One of the problems I have come across having complex tasks on the browser is with automatic timeouts. Currently our site has a sliding expiration of 30 minutes. Normally, this isn't a problem because we use asp.net and most of the time the users update one or two fields and then submit the form. This obviously keeps t...
We recently went through this in my organization. Although it is not the best solution, and hitting the right session across multiple browser windows is rough, we put a countdown timer on our page, included a button that just went back and hit the server to restart the session, and also provided the user with a JavaScr...
Automatic Timeout Web Client Use One of the problems I have come across having complex tasks on the browser is with automatic timeouts. Currently our site has a sliding expiration of 30 minutes. Normally, this isn't a problem because we use asp.net and most of the time the users update one or two fields and then submit...
TITLE: Automatic Timeout Web Client Use QUESTION: One of the problems I have come across having complex tasks on the browser is with automatic timeouts. Currently our site has a sliding expiration of 30 minutes. Normally, this isn't a problem because we use asp.net and most of the time the users update one or two fiel...
[ "c#", "asp.net" ]
0
2
613
4
0
2008-09-05T17:49:11.713000
2008-09-05T17:54:38.657000
46,415
46,461
Passing untampered data from Flash app to server?
I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the server. What are some good methods of getting this done? One simple way i...
Encrypt the data with a public key stored in the binary. This will raise the barrier of entry for an attack. In addition to that, sanity check the data as it arrives on the server. This could be as simple as calculating the maximum number of points that could realistically be earned per time unit of play, or transmitti...
Passing untampered data from Flash app to server? I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the server. What are some g...
TITLE: Passing untampered data from Flash app to server? QUESTION: I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the serve...
[ "flash", "security", "encryption" ]
2
3
3,385
5
0
2008-09-05T17:56:00.730000
2008-09-05T18:16:27.857000
46,425
46,437
Lisp list iteration
I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why? (defun biggerElems(x xs) (let ((xst)) (dolist (elem xs) (if (> x elem) (setf xst (remove elem xs)))) xst))
I think it's this line that's not right: (setf xst (remove elem xs)))) The first argument to setf is the place, followed by the value. It looks like you have it backwards (and xst is either nil or uninitialized). You might find it easier to do this: (defun biggerElems (x xs) (remove-if (lambda (item) (> item x)) xs))
Lisp list iteration I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why? (defun biggerElems(x xs) (let ((xst)) (dolist (elem xs) (if (> x elem) (setf xst (remove elem xs)))) xst))
TITLE: Lisp list iteration QUESTION: I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why? (defun biggerElems(x xs) (let ((xst)) (dolist (elem xs) (if (> x elem) (setf xst (remove elem xs)))) xst)) ANSWER: I think ...
[ "lisp", "list", "iteration" ]
4
5
3,374
6
0
2008-09-05T17:59:01.237000
2008-09-05T18:06:23.810000
46,454
50,264
WebBrowserControl Scroll to Bottom
I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display the messages between the user and the recipient. How do I get the control to automatically scroll to the bottom every time I update the DocumentText of the control?
Thanks guys -- I voted you both up but neither would work out for my situation. What I ended up doing was webCtrl.Document.Window.ScrollTo(0, int.MaxValue);
WebBrowserControl Scroll to Bottom I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display the messages between the user and the recipient. How do I get the control to automatically scroll to the bottom every time I update the DocumentText of the control?
TITLE: WebBrowserControl Scroll to Bottom QUESTION: I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display the messages between the user and the recipient. How do I get the control to automatically scroll to the bottom every time I update the DocumentText of the control? ...
[ ".net", "user-controls", "wysiwyg" ]
2
5
9,163
5
0
2008-09-05T18:12:31.390000
2008-09-08T17:41:40.660000
46,482
46,526
Read Access File into a DataSet
Is there an easy way to read an entire Access file (.mdb) into a DataSet in.NET (specifically C# or VB)? Or at least to get a list of tables from an access file so that I can loop through it and add them one at a time into a DataSet?
Thanks for the suggestions. I was able to use those samples to put together this code, which seems to achieve what I'm looking for. Using cn = New OleDbConnection(connectionstring) cn.Open() Dim ds As DataSet = new DataSet() Dim Schema As DataTable = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing...
Read Access File into a DataSet Is there an easy way to read an entire Access file (.mdb) into a DataSet in.NET (specifically C# or VB)? Or at least to get a list of tables from an access file so that I can loop through it and add them one at a time into a DataSet?
TITLE: Read Access File into a DataSet QUESTION: Is there an easy way to read an entire Access file (.mdb) into a DataSet in.NET (specifically C# or VB)? Or at least to get a list of tables from an access file so that I can loop through it and add them one at a time into a DataSet? ANSWER: Thanks for the suggestions....
[ ".net", "ms-access", "dataset" ]
2
5
7,191
5
0
2008-09-05T18:29:04.863000
2008-09-05T18:40:24.960000
46,483
46,491
htmlentities() vs. htmlspecialchars()
What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other?
From the PHP documentation for htmlentities: This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities. From the PHP documentation for htmlspecialchars: Certain characters have special signific...
htmlentities() vs. htmlspecialchars() What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other?
TITLE: htmlentities() vs. htmlspecialchars() QUESTION: What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other? ANSWER: From the PHP documentation for htmlentities: This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characte...
[ "php" ]
602
393
364,902
11
0
2008-09-05T18:29:12.880000
2008-09-05T18:31:52.920000
46,484
46,507
How to encrypt email addresses using JQuery
Is there a way to use JQuery to cloak or encrypt email addresses on an HTML page without changing the syntax in the href?
Using JQuery may not be the route you want to take since this would be on the client side... Is there a reason you're not encrypting on server side?
How to encrypt email addresses using JQuery Is there a way to use JQuery to cloak or encrypt email addresses on an HTML page without changing the syntax in the href?
TITLE: How to encrypt email addresses using JQuery QUESTION: Is there a way to use JQuery to cloak or encrypt email addresses on an HTML page without changing the syntax in the href? ANSWER: Using JQuery may not be the route you want to take since this would be on the client side... Is there a reason you're not encry...
[ "jquery", "email" ]
8
6
6,447
5
0
2008-09-05T18:29:25.533000
2008-09-05T18:35:51.133000
46,489
47,242
Referencing Embedded resources from other resources in c#
In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using ClientScriptManager.GetWebResourceUrl(). However, in some of my js files, I have references to other static assets like image urls. I would like to make those assembly resources ...
I'd suggest that you emit the web resources as a dynamic javascript associative array. Server side code: StringBuilder script = new StringBuilder(); script.Append("var imgResources = {};"); script.AppendFormat("imgResources['{0}'] = '{1}';", "drophint", Page.ClientScript.GetWebResourceUrl(Page.GetType(), "assembly.loca...
Referencing Embedded resources from other resources in c# In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using ClientScriptManager.GetWebResourceUrl(). However, in some of my js files, I have references to other static assets like ...
TITLE: Referencing Embedded resources from other resources in c# QUESTION: In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using ClientScriptManager.GetWebResourceUrl(). However, in some of my js files, I have references to other s...
[ "c#", "asp.net", "javascript" ]
3
3
2,499
3
0
2008-09-05T18:31:39.193000
2008-09-06T03:57:02.530000
46,495
147,571
SQL Server 2005 error
Why can't you do this and is there are work around? You get this error. Msg 2714, Level 16, State 1, Line 13 There is already an object named '#temptable' in the database. declare @x int set @x = 1 if (@x = 0) begin select 1 as Value into #temptable end else begin select 2 as Value into #temptable end select * from ...
This is a two-part question and while Kev Fairchild provides a good answer to the second question he totally ignores the first - why is the error produced? The answer lies in the way the preprocessor works. This SELECT field-list INTO #symbol... is resolved into a parse-tree that is directly equivalent to DECLARE #symb...
SQL Server 2005 error Why can't you do this and is there are work around? You get this error. Msg 2714, Level 16, State 1, Line 13 There is already an object named '#temptable' in the database. declare @x int set @x = 1 if (@x = 0) begin select 1 as Value into #temptable end else begin select 2 as Value into #temptab...
TITLE: SQL Server 2005 error QUESTION: Why can't you do this and is there are work around? You get this error. Msg 2714, Level 16, State 1, Line 13 There is already an object named '#temptable' in the database. declare @x int set @x = 1 if (@x = 0) begin select 1 as Value into #temptable end else begin select 2 as V...
[ "sql-server", "temp-tables" ]
0
1
242
6
0
2008-09-05T18:32:21.220000
2008-09-29T04:58:08.787000
46,496
46,579
Should I avoid using Java Label Statements?
Today I had a coworker suggest I refactor my code to use a label statement to control flow through 2 nested for loops I had created. I've never used them before because personally I think they decrease the readability of a program. I am willing to change my mind about using them if the argument is solid enough however....
Many algorithms are expressed more easily if you can jump across two loops (or a loop containing a switch statement). Don't feel bad about it. On the other hand, it may indicate an overly complex solution. So stand back and look at the problem. Some people prefer a "single entry, single exit" approach to all loops. Tha...
Should I avoid using Java Label Statements? Today I had a coworker suggest I refactor my code to use a label statement to control flow through 2 nested for loops I had created. I've never used them before because personally I think they decrease the readability of a program. I am willing to change my mind about using t...
TITLE: Should I avoid using Java Label Statements? QUESTION: Today I had a coworker suggest I refactor my code to use a label statement to control flow through 2 nested for loops I had created. I've never used them before because personally I think they decrease the readability of a program. I am willing to change my ...
[ "java", "loops" ]
69
49
34,995
12
0
2008-09-05T18:32:25.900000
2008-09-05T19:03:10.567000
46,512
46,535
Can Visual Studio put timestamps in the build log?
In the build log I'd like to the start and end time of each project's compilation. Is there any way to get VS to do this?
For VC++ builds you can enable build timing. Go to Tools->Options->Projects and Solutions->VC++ Project settings and choose the option for 'Build Timing'
Can Visual Studio put timestamps in the build log? In the build log I'd like to the start and end time of each project's compilation. Is there any way to get VS to do this?
TITLE: Can Visual Studio put timestamps in the build log? QUESTION: In the build log I'd like to the start and end time of each project's compilation. Is there any way to get VS to do this? ANSWER: For VC++ builds you can enable build timing. Go to Tools->Options->Projects and Solutions->VC++ Project settings and cho...
[ "visual-studio", "build" ]
31
14
13,210
5
0
2008-09-05T18:37:09.430000
2008-09-05T18:43:51.020000
46,532
47,396
Do namespaces propagate to children in XElement objects?
If I have an XElement that has child elements, and if I remove a child element from the parent, removing all references between the two, will the child XElement have the same namespaces as the parent? In other words, if I have the following XML: and I remove the child element, will the child element's xml look like or ...
The answer is yes, namespaces do propagate to children. You do NOT have to specify the namespace within child elements. The scoping of a namespace includes all elements until the closing tag of the element it was defined in. See section #6.1 here http://www.w3.org/TR/REC-xml-names/#scoping hope that helps
Do namespaces propagate to children in XElement objects? If I have an XElement that has child elements, and if I remove a child element from the parent, removing all references between the two, will the child XElement have the same namespaces as the parent? In other words, if I have the following XML: and I remove the ...
TITLE: Do namespaces propagate to children in XElement objects? QUESTION: If I have an XElement that has child elements, and if I remove a child element from the parent, removing all references between the two, will the child XElement have the same namespaces as the parent? In other words, if I have the following XML:...
[ ".net", "namespaces", "linq-to-xml" ]
2
1
1,824
2
0
2008-09-05T18:43:25.203000
2008-09-06T11:43:30.273000
46,541
151,332
When should you use the singleton pattern instead of a static class?
Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, every interviewer likes to see illustrative examples.:)
Singletons can implement interfaces and inherit from other classes. Singletons can be lazy loaded. Only when it is actually needed. That's very handy if the initialisation includes expensive resource loading or database connections. Singletons offer an actual object. Singletons can be extended into a factory. The objec...
When should you use the singleton pattern instead of a static class? Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, ev...
TITLE: When should you use the singleton pattern instead of a static class? QUESTION: Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought...
[ "design-patterns" ]
87
82
53,337
22
0
2008-09-05T18:48:03.693000
2008-09-30T00:43:21.857000
46,568
46,695
Can you programmatically restart a j2ee application?
Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how? I would like to be able to do it in an app-server-agnostic way, if it is possible. The application will be run on many different app servers-- basically whatever the client prefers. If it isn't possible to do this in an...
I would suggest that you're unlikely to find an appserver agnostic way. And while I don't pretend to know your requirements, I might question a design that requires the application to restart itself, other than an installer that is deploying a new version. Finally, I would suggest that for any nontrivial purpose "any" ...
Can you programmatically restart a j2ee application? Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how? I would like to be able to do it in an app-server-agnostic way, if it is possible. The application will be run on many different app servers-- basically whatever the ...
TITLE: Can you programmatically restart a j2ee application? QUESTION: Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how? I would like to be able to do it in an app-server-agnostic way, if it is possible. The application will be run on many different app servers-- basic...
[ "java", "jakarta-ee" ]
5
6
1,170
3
0
2008-09-05T19:00:08.797000
2008-09-05T19:31:45.490000
46,571
47,197
cfqueryparam with like operator in ColdFusion
I have been tasked with going through a number of ColdFusion sites that have recently been the subject of a rather nasty SQL Injection attack. Basically my work involves adding > tags to all of the inline sql. For the most part I've got it down, but can anybody tell me how to use cfqueryparam with the LIKE operator? If...
@Joel, I have to disagree. select a,b,c from Foo where name like Never suggest to someone that they should "select star." Bad form! Even for an example! (Even copied from the question!) The query is pre-compiled and you should include the wild card character(s) as part of the parameter being passed to the query. This f...
cfqueryparam with like operator in ColdFusion I have been tasked with going through a number of ColdFusion sites that have recently been the subject of a rather nasty SQL Injection attack. Basically my work involves adding > tags to all of the inline sql. For the most part I've got it down, but can anybody tell me how ...
TITLE: cfqueryparam with like operator in ColdFusion QUESTION: I have been tasked with going through a number of ColdFusion sites that have recently been the subject of a rather nasty SQL Injection attack. Basically my work involves adding > tags to all of the inline sql. For the most part I've got it down, but can an...
[ "coldfusion", "railo", "cfml", "openbd" ]
28
50
10,822
2
0
2008-09-05T19:00:58.793000
2008-09-06T02:21:48.750000
46,572
46,577
What is the ASP.NET process for IIS 7.0?
Looking at what's running and nothing jumps out. Thanks!
It should be w3wp.exe EDIT: In line with Darren's comment, you should also check the "Show processes from all users" in Task Manager if that is where you are looking for the process.
What is the ASP.NET process for IIS 7.0? Looking at what's running and nothing jumps out. Thanks!
TITLE: What is the ASP.NET process for IIS 7.0? QUESTION: Looking at what's running and nothing jumps out. Thanks! ANSWER: It should be w3wp.exe EDIT: In line with Darren's comment, you should also check the "Show processes from all users" in Task Manager if that is where you are looking for the process.
[ "asp.net", "iis-7" ]
7
8
1,398
5
0
2008-09-05T19:01:03.600000
2008-09-05T19:02:45.407000
46,582
47,735
Response.Redirect with POST instead of Get?
We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to "submit" a form with POST, not GET. I was hoping there was an easy way to accomplish this, but I'm starting to think there isn't. I think I must now create a simple other page, ...
Doing this requires understanding how HTTP redirects work. When you use Response.Redirect(), you send a response (to the browser that made the request) with HTTP Status Code 302, which tells the browser where to go next. By definition, the browser will make that via a GET request, even if the original request was a POS...
Response.Redirect with POST instead of Get? We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to "submit" a form with POST, not GET. I was hoping there was an easy way to accomplish this, but I'm starting to think there isn't. I t...
TITLE: Response.Redirect with POST instead of Get? QUESTION: We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to "submit" a form with POST, not GET. I was hoping there was an easy way to accomplish this, but I'm starting to thin...
[ "asp.net", "https", "response.redirect" ]
281
246
298,176
14
0
2008-09-05T19:03:46.183000
2008-09-06T18:54:00.723000
46,584
46,618
When should one use a project reference opposed to a binary reference?
My company has a common code library which consists of many class libary projects along with supporting test projects. Each class library project outputs a single binary, e.g. Company.Common.Serialization.dll. Since we own the compiled, tested binaries as well as the source code, there's debate as to whether our consum...
It sounds to me as though you've covered all the major points. We've had a similar discussion at work recently and we're not quite decided yet. However, one thing we've looked into is to reference the binary files, to gain all the advantages you note, but have the binaries built by a common build system where the sourc...
When should one use a project reference opposed to a binary reference? My company has a common code library which consists of many class libary projects along with supporting test projects. Each class library project outputs a single binary, e.g. Company.Common.Serialization.dll. Since we own the compiled, tested binar...
TITLE: When should one use a project reference opposed to a binary reference? QUESTION: My company has a common code library which consists of many class libary projects along with supporting test projects. Each class library project outputs a single binary, e.g. Company.Common.Serialization.dll. Since we own the comp...
[ "standards", "coding-style" ]
16
6
2,118
6
0
2008-09-05T19:04:26.727000
2008-09-05T19:13:03.727000