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
44,630
44,647
version control practice
In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and then it was done. I wanted to see if this wa...
You can use various ways to handle this situation, depending on your source control system. Private branches: Allow you to check in and work on code while you go, merging back and forth at appropriate times. Shelvesets/pacakaged changesets: Allow you to store changesets and send them around for review - ensuring they'r...
version control practice In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and then it was done. I...
TITLE: version control practice QUESTION: In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and t...
[ "version-control" ]
5
4
760
11
0
2008-09-04T19:51:26.267000
2008-09-04T19:59:30.287000
44,637
44,648
How to start using ndepend?
I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? What information should I look for first? What points out prob...
Scott Hanselman / Stuart Celarier / Patrick Cauldwell's poster with ndepend metrics has some useful information on it. Rather than trying to break down all the heuristics being used I'd focus on only a few at a time starting with "zone of pain / zone of uselessness" and cyclomatic complexity. There is also a podcast wh...
How to start using ndepend? I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? What information should I look for...
TITLE: How to start using ndepend? QUESTION: I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? What information...
[ ".net", "static-analysis", "ndepend" ]
19
15
1,510
3
0
2008-09-04T19:54:37.693000
2008-09-04T20:00:04.123000
44,644
46,874
Identifying ASP.NET web service references
At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about 20-30 different web applications and corre...
You need a service registry (UDDI??)... If you had a means to catalog these services and their consumers, it would make this job of dependency discovery a lot easier. That is not an easy solution, though. It takes time and documentation to get a catalog in place. I think the quickest solution would be to query your IIS...
Identifying ASP.NET web service references At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about...
TITLE: Identifying ASP.NET web service references QUESTION: At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We p...
[ "web-services", "iis", "reflection", "esb" ]
0
0
476
2
0
2008-09-04T19:58:27.980000
2008-09-05T20:59:34.720000
44,656
44,761
Is there a good method in C# for throwing an exception on a given thread
The code that I want to write is like this: void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff } } catch (MyException ex) { // Do the right thing for this exception. } } I know I can have thread ...
This is NOT a good idea This article talks about ruby's timeout library. which throws exceptions across threads. It explains how doing such a thing is fundamentally broken. It's not just broken in ruby, it's broken anywhere that throws exceptions across threads. In a nutshell, what can (and does) happen is this: Thread...
Is there a good method in C# for throwing an exception on a given thread The code that I want to write is like this: void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff } } catch (MyException ex) ...
TITLE: Is there a good method in C# for throwing an exception on a given thread QUESTION: The code that I want to write is like this: void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff } } catch...
[ "c#", "multithreading", "exception" ]
11
10
8,599
8
0
2008-09-04T20:03:50.527000
2008-09-04T20:55:16.097000
44,692
45,529
dotNetNuke/Moodle integration
anyone out there have a moodle module for dotnetnuke, or some kind of integration setup that at least allows SSO?
This webpage provides details on how to implement Single Sign-on between DotNetNuke and Moodle.
dotNetNuke/Moodle integration anyone out there have a moodle module for dotnetnuke, or some kind of integration setup that at least allows SSO?
TITLE: dotNetNuke/Moodle integration QUESTION: anyone out there have a moodle module for dotnetnuke, or some kind of integration setup that at least allows SSO? ANSWER: This webpage provides details on how to implement Single Sign-on between DotNetNuke and Moodle.
[ "dotnetnuke", "single-sign-on", "moodle" ]
3
0
1,038
1
0
2008-09-04T20:22:11.230000
2008-09-05T10:56:46.667000
44,693
44,762
Efficient alternatives for exposing a Collection
In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity? My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me with either returning a reference to the list, or a pointer to the lis...
RichQ's answer is a reasonable technique, if you're using an array, vector, etc. If you're using a collection that isn't indexed by ordinal values... or think you might need to at some point in the near future... then you might want to consider exposing your own iterator type(s), and associated begin() / end() methods:...
Efficient alternatives for exposing a Collection In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity? My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me with either returning...
TITLE: Efficient alternatives for exposing a Collection QUESTION: In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity? My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me wit...
[ "c++", "performance", "collections", "data-integrity" ]
12
5
714
10
0
2008-09-04T20:22:18.923000
2008-09-04T20:56:04.113000
44,714
44,738
How to have two remote origins for Git?
Our git server will be local, but we want an server where our local repo is also kept online but only used in a push to fashion. How can one do that?
You can add remotes with git remote add You can then push to a remote with git push master:master to push your local master branch to the remote master branch. When you create a repo with git clone the remote is named origin but you can create a public repository for your online server and push to it with git push publ...
How to have two remote origins for Git? Our git server will be local, but we want an server where our local repo is also kept online but only used in a push to fashion. How can one do that?
TITLE: How to have two remote origins for Git? QUESTION: Our git server will be local, but we want an server where our local repo is also kept online but only used in a push to fashion. How can one do that? ANSWER: You can add remotes with git remote add You can then push to a remote with git push master:master to pu...
[ "git" ]
19
34
7,500
1
0
2008-09-04T20:36:15.597000
2008-09-04T20:47:06.147000
44,715
44,835
Why do Ruby setters need "self." qualification within the class?
Ruby setters—whether created by (c)attr_accessor or manually—seem to be the only methods that need self. qualification when accessed within the class itself. This seems to put Ruby alone the world of languages: All methods need self / this (like Perl, and I think Javascript) No methods require self / this is (C#, Java)...
The important thing to remember here is that Ruby methods can be (un)defined at any point, so to intelligently resolve the ambiguity, every assignment would need to run code to check whether there is a method with the assigned-to name at the time of assignment.
Why do Ruby setters need "self." qualification within the class? Ruby setters—whether created by (c)attr_accessor or manually—seem to be the only methods that need self. qualification when accessed within the class itself. This seems to put Ruby alone the world of languages: All methods need self / this (like Perl, and...
TITLE: Why do Ruby setters need "self." qualification within the class? QUESTION: Ruby setters—whether created by (c)attr_accessor or manually—seem to be the only methods that need self. qualification when accessed within the class itself. This seems to put Ruby alone the world of languages: All methods need self / th...
[ "ruby" ]
78
18
10,365
3
0
2008-09-04T20:36:16.580000
2008-09-04T21:28:32.710000
44,721
44,724
Howto Enable Font Antialiasing in Windows
I have downloaded a font that looks less than desirable if it is not anti-aliased. I can not figure out how to enable anti-aliasing in VS, I have changed the 'Smooth Edges of Screen Fonts' in the system performance options but that does not seem to help. VS2008 on XP SP3. What am I missing?
Try using ClearType, not Standard font smoothing. It's in Display properties, Appearance, Effects.
Howto Enable Font Antialiasing in Windows I have downloaded a font that looks less than desirable if it is not anti-aliased. I can not figure out how to enable anti-aliasing in VS, I have changed the 'Smooth Edges of Screen Fonts' in the system performance options but that does not seem to help. VS2008 on XP SP3. What ...
TITLE: Howto Enable Font Antialiasing in Windows QUESTION: I have downloaded a font that looks less than desirable if it is not anti-aliased. I can not figure out how to enable anti-aliasing in VS, I have changed the 'Smooth Edges of Screen Fonts' in the system performance options but that does not seem to help. VS200...
[ "fonts", "windows-xp", "antialiasing" ]
21
33
66,709
3
0
2008-09-04T20:38:31.100000
2008-09-04T20:41:09.453000
44,737
44,753
Is there a plugin for targetting .NET 1.1 with VS 2008?
Is there a plugin for targetting.NET 1.1 with VS 2008?
According to Scott Guthrie, the reason VS 2008 does not support 1.0 or 1.1... "...is that there were significant CLR engine changes between.NET 1.x and 2.x that make debugging very difficult to support. In the end the costing of the work to support that was so large and impacted so many parts of Visual Studio that we w...
Is there a plugin for targetting .NET 1.1 with VS 2008? Is there a plugin for targetting.NET 1.1 with VS 2008?
TITLE: Is there a plugin for targetting .NET 1.1 with VS 2008? QUESTION: Is there a plugin for targetting.NET 1.1 with VS 2008? ANSWER: According to Scott Guthrie, the reason VS 2008 does not support 1.0 or 1.1... "...is that there were significant CLR engine changes between.NET 1.x and 2.x that make debugging very d...
[ ".net", "visual-studio-2008", ".net-1.1", "multi-targeting" ]
2
4
718
2
0
2008-09-04T20:46:51.313000
2008-09-04T20:52:17.353000
44,757
44,770
How to cache ASP.NET user controls?
I heard on a recent podcast (Polymorphic) that it is possible to cache a user control as opposed to the entire page. I think my header control which displays static content and my footer control could benefit from being cached. How can I go about caching just those controls?
Take a look here You can use VaryByParam and VaryByControl in the output cache.
How to cache ASP.NET user controls? I heard on a recent podcast (Polymorphic) that it is possible to cache a user control as opposed to the entire page. I think my header control which displays static content and my footer control could benefit from being cached. How can I go about caching just those controls?
TITLE: How to cache ASP.NET user controls? QUESTION: I heard on a recent podcast (Polymorphic) that it is possible to cache a user control as opposed to the entire page. I think my header control which displays static content and my footer control could benefit from being cached. How can I go about caching just those ...
[ "asp.net", "caching", "user-controls" ]
3
4
1,042
2
0
2008-09-04T20:54:32.807000
2008-09-04T21:01:12.603000
44,760
47,127
Eclipse "Share Project" by hand?
What actually happens to the file system when you do a Subclipse Share Project on an Eclipse project that was externally checked out from Subversion? All the.svn folders are already in place. I get an error when I try to Share Project the right way, and I'd rather not delete and re-checkout the projects from the SVN Re...
Dunno exactly what happens within eclipse, I presume it does some funky stuff in the.metadata directory of the workspace. That said, I would recommend the following to get eclipse to learn about the svn settings of the project: Delete the project from the workspace (keep "Delete project contents on disk" unchecked) Fil...
Eclipse "Share Project" by hand? What actually happens to the file system when you do a Subclipse Share Project on an Eclipse project that was externally checked out from Subversion? All the.svn folders are already in place. I get an error when I try to Share Project the right way, and I'd rather not delete and re-chec...
TITLE: Eclipse "Share Project" by hand? QUESTION: What actually happens to the file system when you do a Subclipse Share Project on an Eclipse project that was externally checked out from Subversion? All the.svn folders are already in place. I get an error when I try to Share Project the right way, and I'd rather not ...
[ "eclipse", "svn", "subclipse" ]
6
12
6,601
3
0
2008-09-04T20:54:41.997000
2008-09-06T00:20:06.250000
44,771
44,923
Ajax Autocomplete Webservice Call - Service Method, am I calling this correctly?
Ok, so my method in my webservice requires a type to be passed, it is called in the ServiceMethod property of the AutoCompleteExtender, I am fuzzy about how I should do that so I called it like this: ServiceMethod="DropDownLoad<<%=(typeof)subCategory%>>" where subCategory is a page property that looks like this: protec...
I dont' think calling a Generic Method on a webservice is possible. If you look at the service description of two identical methods, one generic, one not: [WebMethod] public string[] GetSearchList(string prefixText, int count) { } [WebMethod] public string[] GetSearchList2 (string prefixText, int count) { } They are i...
Ajax Autocomplete Webservice Call - Service Method, am I calling this correctly? Ok, so my method in my webservice requires a type to be passed, it is called in the ServiceMethod property of the AutoCompleteExtender, I am fuzzy about how I should do that so I called it like this: ServiceMethod="DropDownLoad<<%=(typeof)...
TITLE: Ajax Autocomplete Webservice Call - Service Method, am I calling this correctly? QUESTION: Ok, so my method in my webservice requires a type to be passed, it is called in the ServiceMethod property of the AutoCompleteExtender, I am fuzzy about how I should do that so I called it like this: ServiceMethod="DropDo...
[ "c#", "asp.net", "asp.net-ajax" ]
1
1
2,235
2
0
2008-09-04T21:01:42.463000
2008-09-04T22:52:28.407000
44,777
44,783
Sending a mail as both HTML and Plain Text in .net
I'm sending mail from my C# Application, using the SmtpClient. Works great, but I have to decide if I want to send the mail as Plain Text or HTML. I wonder, is there a way to send both? I think that's called multipart. I googled a bit, but most examples essentially did not use SmtpClient but composed the whole SMTP-Bod...
What you want to do is use the AlternateViews property on the MailMessage http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.alternateviews.aspx
Sending a mail as both HTML and Plain Text in .net I'm sending mail from my C# Application, using the SmtpClient. Works great, but I have to decide if I want to send the mail as Plain Text or HTML. I wonder, is there a way to send both? I think that's called multipart. I googled a bit, but most examples essentially did...
TITLE: Sending a mail as both HTML and Plain Text in .net QUESTION: I'm sending mail from my C# Application, using the SmtpClient. Works great, but I have to decide if I want to send the mail as Plain Text or HTML. I wonder, is there a way to send both? I think that's called multipart. I googled a bit, but most exampl...
[ "c#", ".net" ]
53
48
59,057
7
0
2008-09-04T21:03:48.667000
2008-09-04T21:07:00.203000
44,778
44,781
How would you make a comma-separated string from a list of strings?
What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,b,c'? (The cases ['s'] and [] should be mapped to 's' and '', respectively.) I usually end up using something like ''.join(...
my_list = ['a', 'b', 'c', 'd'] my_string = ','.join(my_list) 'a,b,c,d' This won't work if the list contains integers And if the list contains non-string types (such as integers, floats, bools, None) then do: my_string = ','.join(map(str, my_list))
How would you make a comma-separated string from a list of strings? What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,b,c'? (The cases ['s'] and [] should be mapped to 's' a...
TITLE: How would you make a comma-separated string from a list of strings? QUESTION: What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,b,c'? (The cases ['s'] and [] should ...
[ "python", "string", "list" ]
704
1,310
869,278
15
0
2008-09-04T21:04:04.873000
2008-09-04T21:06:12.030000
44,780
45,907
What's the best way to implement a SQL script that will grant permissions to a database role on all the user tables in a database?
What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database? Ideally, this script could be run multiple times, as new tables were added to the database. SQL Server Management Studio generates scripts for...
Dr Zimmerman is on the right track here. I'd be looking to write a stored procedure that has a cursor looping through user objects using execute immediate to affect the grant. Something like this: IF EXISTS ( SELECT 1 FROM sysobjects WHERE name = 'sp_grantastic' AND type = 'P' ) DROP PROCEDURE sp_grantastic GO CREATE P...
What's the best way to implement a SQL script that will grant permissions to a database role on all the user tables in a database? What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database? Ideally, th...
TITLE: What's the best way to implement a SQL script that will grant permissions to a database role on all the user tables in a database? QUESTION: What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a dat...
[ "sql", "sql-server", "t-sql", "permissions" ]
2
1
4,073
5
0
2008-09-04T21:05:31.923000
2008-09-05T14:20:54.880000
44,787
44,810
How do you get the current image name from an ASP.Net website?
Scenario: You have an ASP.Net webpage that should display the next image in a series of images. If 1.jpg is currently loaded, the refresh should load 2.jpg. Assuming I would use this code, where do you get the current images name. string currImage = MainPic.ImageUrl.Replace(".jpg", ""); currImage = currImage.Replace("~...
int num = 1; if(Session["ImageNumber"]!= null) { num = Convert.ToInt32(Session["ImageNumber"]) + 1; } Session["ImageNumber"] = num;
How do you get the current image name from an ASP.Net website? Scenario: You have an ASP.Net webpage that should display the next image in a series of images. If 1.jpg is currently loaded, the refresh should load 2.jpg. Assuming I would use this code, where do you get the current images name. string currImage = MainPic...
TITLE: How do you get the current image name from an ASP.Net website? QUESTION: Scenario: You have an ASP.Net webpage that should display the next image in a series of images. If 1.jpg is currently loaded, the refresh should load 2.jpg. Assuming I would use this code, where do you get the current images name. string c...
[ "c#", "asp.net" ]
0
5
1,653
7
0
2008-09-04T21:08:28.280000
2008-09-04T21:19:23.870000
44,795
44,863
How can I determine whether a given date is in Daylight Saving Time for a given timezone in .NET 2.0?
I'm on.NET 2.0, running under Medium Trust (so TimeZoneInfo and the Registry are not allowed options). I'm asking the user for two dates and a time zone, and would really love to be able to automatically determine whether I need to adjust the time zone for DST. This probably isn't even a valid scenario unless I have so...
In.NET 2.0 you have to code this yourself. It involves researching daylight savings time laws in various regions and building that into your own data structures. The problem is somewhat simplified if you only care about a subset of time zones, for example just in the USA, but if you need all global time zones, you have...
How can I determine whether a given date is in Daylight Saving Time for a given timezone in .NET 2.0? I'm on.NET 2.0, running under Medium Trust (so TimeZoneInfo and the Registry are not allowed options). I'm asking the user for two dates and a time zone, and would really love to be able to automatically determine whet...
TITLE: How can I determine whether a given date is in Daylight Saving Time for a given timezone in .NET 2.0? QUESTION: I'm on.NET 2.0, running under Medium Trust (so TimeZoneInfo and the Registry are not allowed options). I'm asking the user for two dates and a time zone, and would really love to be able to automatica...
[ ".net", ".net-2.0", "timezone", "medium-trust" ]
3
2
1,104
5
0
2008-09-04T21:11:43.360000
2008-09-04T21:44:23.483000
44,799
44,807
Preventing Command Line Injection Attacks
We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools. Obviously, this is a big security nightmare waiting to happen. Unfortunately, we've not yet found any classes in the.NET Framework that execute command lin...
Are you executing the programs directly or going through the shell? If you always launch an external program by giving the full path name to the executable and leaving the shell out of the equation, then you aren't really susceptible to any kind of command line injection. EDIT: DrFloyd, the shell is responsible for eva...
Preventing Command Line Injection Attacks We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools. Obviously, this is a big security nightmare waiting to happen. Unfortunately, we've not yet found any classes in ...
TITLE: Preventing Command Line Injection Attacks QUESTION: We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools. Obviously, this is a big security nightmare waiting to happen. Unfortunately, we've not yet fou...
[ "security", "command-line", "code-injection" ]
10
6
10,266
7
0
2008-09-04T21:12:50.797000
2008-09-04T21:18:10.723000
44,817
45,891
Flex and ADO.NET Data Services...anyone done it?
Has anyone used ADO.NET Data Services as a data source for Adobe Flex applications? If so, any success stories or tragedies to avoid? If you did use it, how did you handle security?
I use WebORB for.NET to do Flex remoting and then use DLINQ on the server. One tricky thing about using LINQ with WebORB is that WebORB uses Reflection to automatically retrieve all the relationships of the object(s) you return to Flex. This causes severe time penalties as LINQ uses lazy loading to load relationships. ...
Flex and ADO.NET Data Services...anyone done it? Has anyone used ADO.NET Data Services as a data source for Adobe Flex applications? If so, any success stories or tragedies to avoid? If you did use it, how did you handle security?
TITLE: Flex and ADO.NET Data Services...anyone done it? QUESTION: Has anyone used ADO.NET Data Services as a data source for Adobe Flex applications? If so, any success stories or tragedies to avoid? If you did use it, how did you handle security? ANSWER: I use WebORB for.NET to do Flex remoting and then use DLINQ on...
[ "apache-flex", "ado.net" ]
2
3
1,295
4
0
2008-09-04T21:20:27.317000
2008-09-05T14:06:47.973000
44,821
45,170
Default smart device project can't find dependencies
When running the default c++ project in Visual Studios for a Windows CE 5.0 device, I get an error complaining about missing resources. Depends says that my executable needs ayghsell.dll (the Windows Mobile shell), and CoreDll.dll. Does this mean that my executable can only be run on Windows Mobile devices, instead of ...
Depends what you mean by a generic Windows CE installation. Windows CE itself is a modularised operating system, so different devices can have different modules included. Therefore each Windows CE device can have a radically different OS installed (headless even). Coredll is the standard "common" library that gets incl...
Default smart device project can't find dependencies When running the default c++ project in Visual Studios for a Windows CE 5.0 device, I get an error complaining about missing resources. Depends says that my executable needs ayghsell.dll (the Windows Mobile shell), and CoreDll.dll. Does this mean that my executable c...
TITLE: Default smart device project can't find dependencies QUESTION: When running the default c++ project in Visual Studios for a Windows CE 5.0 device, I get an error complaining about missing resources. Depends says that my executable needs ayghsell.dll (the Windows Mobile shell), and CoreDll.dll. Does this mean th...
[ "c++", "visual-studio", "windows-mobile", "windows-ce" ]
1
3
535
1
0
2008-09-04T21:20:43.650000
2008-09-05T03:10:02.077000
44,824
46,191
Is JINI at all active anymore?
Everyone I talk to who knows (knew) about it claims it was the greatest thing since sliced bread. Why did it fail? Or, if it didn't fail, who's using it now?
Check out GigaSpaces. It's a quite successful Jini/Javaspaces implementation. I think Jini has a great model, but it is stuck with Java. Web-services is more appealing because it works with standarized protocols, even though Jini service discovery is more natural.
Is JINI at all active anymore? Everyone I talk to who knows (knew) about it claims it was the greatest thing since sliced bread. Why did it fail? Or, if it didn't fail, who's using it now?
TITLE: Is JINI at all active anymore? QUESTION: Everyone I talk to who knows (knew) about it claims it was the greatest thing since sliced bread. Why did it fail? Or, if it didn't fail, who's using it now? ANSWER: Check out GigaSpaces. It's a quite successful Jini/Javaspaces implementation. I think Jini has a great m...
[ "java", "jini" ]
7
8
2,235
7
0
2008-09-04T21:22:03.210000
2008-09-05T16:17:27.707000
44,834
44,842
What does __all__ mean in Python?
I see __all__ in __init__.py files. What does it do?
It's a list of public objects of that module, as interpreted by import *. It overrides the default of hiding everything that begins with an underscore.
What does __all__ mean in Python? I see __all__ in __init__.py files. What does it do?
TITLE: What does __all__ mean in Python? QUESTION: I see __all__ in __init__.py files. What does it do? ANSWER: It's a list of public objects of that module, as interpreted by import *. It overrides the default of hiding everything that begins with an underscore.
[ "python", "syntax", "namespaces" ]
1,702
856
635,288
10
0
2008-09-04T21:28:18.547000
2008-09-04T21:30:46.213000
44,851
45,061
Substitution Control at the User Control Level?
I am trying to create some cached user controls. Basically Header and Footer are static. Except the footer has one link that reads in the URL of the page and puts it into the javascript for sending a link to a friend. So I need that link to be dynamic. I set up a substitution control and had the static method return th...
I would forget about server side caching in this instance and rely on the simplicity of client side caching. Your Javascript code could be client side cached just as easily as HTML, either by linking to an external javascript file and adding the necessary headers/expiries, or by embedding the script within the page its...
Substitution Control at the User Control Level? I am trying to create some cached user controls. Basically Header and Footer are static. Except the footer has one link that reads in the URL of the page and puts it into the javascript for sending a link to a friend. So I need that link to be dynamic. I set up a substitu...
TITLE: Substitution Control at the User Control Level? QUESTION: I am trying to create some cached user controls. Basically Header and Footer are static. Except the footer has one link that reads in the URL of the page and puts it into the javascript for sending a link to a friend. So I need that link to be dynamic. I...
[ "asp.net", "caching", "user-controls" ]
1
1
671
1
0
2008-09-04T21:33:53.087000
2008-09-05T00:58:26.700000
44,853
44,870
Why am I getting a ClassCastException when generating javadocs?
I'm using ant to generate javadocs, but get this exception over and over - why? I'm using JDK version 1.6.0_06. [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc [javadoc] at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDe...
It looks like this has been reported as a Java bug. It appears to be caused by using annotations from a 3rd party library (like JUnit) and not including the jar with that annotation in the javadoc invocation. If that is the case, just use the -classpath option on javadoc and include the extra jar files.
Why am I getting a ClassCastException when generating javadocs? I'm using ant to generate javadocs, but get this exception over and over - why? I'm using JDK version 1.6.0_06. [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc [javadoc] at com....
TITLE: Why am I getting a ClassCastException when generating javadocs? QUESTION: I'm using ant to generate javadocs, but get this exception over and over - why? I'm using JDK version 1.6.0_06. [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc...
[ "java", "ant", "javadoc", "classcastexception" ]
55
54
22,750
4
0
2008-09-04T21:37:43.203000
2008-09-04T21:51:26.010000
44,899
46,996
How to find the current name of the test being executing?
I know I can figure out the name of the method as its being executed, just wondering if there is a way from the setup method. I guess an attribute method would work but from the setup method it would be the best. EDIT NUnit
I know this is going to sound negative, but don't do it!:-) The idea behind the setup method is that it executes something required by every test, which means that it doesn't matter which test is being executed, so you don't need to know the name of the method. If you are after different data used in initialisation, th...
How to find the current name of the test being executing? I know I can figure out the name of the method as its being executed, just wondering if there is a way from the setup method. I guess an attribute method would work but from the setup method it would be the best. EDIT NUnit
TITLE: How to find the current name of the test being executing? QUESTION: I know I can figure out the name of the method as its being executed, just wondering if there is a way from the setup method. I guess an attribute method would work but from the setup method it would be the best. EDIT NUnit ANSWER: I know this...
[ "visual-studio", "unit-testing" ]
1
1
386
1
0
2008-09-04T22:25:34.087000
2008-09-05T22:23:15.487000
44,903
44,908
Is there any way to repopulate an Html Select's Options without firing the Change event (using jQuery)?
I have multiple selects: one two three one two three What I want is to select "one" from the first select, then have that option be removed from the second one. Then if you select "two" from the second one, I want that one removed from the first one. Here's the JS I have currently: $(function () { var $one = $("#one");...
I am not (currently) a user of jQuery, but I can tell you that you need to temporarily disconnect your event handler while you repopulate the items or, at the least, set a flag that you then test for and based on its value, handle the change.
Is there any way to repopulate an Html Select's Options without firing the Change event (using jQuery)? I have multiple selects: one two three one two three What I want is to select "one" from the first select, then have that option be removed from the second one. Then if you select "two" from the second one, I want th...
TITLE: Is there any way to repopulate an Html Select's Options without firing the Change event (using jQuery)? QUESTION: I have multiple selects: one two three one two three What I want is to select "one" from the first select, then have that option be removed from the second one. Then if you select "two" from the sec...
[ "javascript", "jquery", "dom", "html-select" ]
9
3
1,492
3
0
2008-09-04T22:32:51.573000
2008-09-04T22:38:57.347000
44,905
44,921
C# switch statement limitations - why?
When writing a switch statement, there appears to be two limitations on what you can switch on in case statements. For example (and yes, I know, if you're doing this sort of thing it probably means your object-oriented (OO) architecture is iffy - this is just a contrived example!), Type t = typeof(int); switch (t) { ...
This is my original post, which sparked some debate... because it is wrong: The switch statement is not the same thing as a big if-else statement. Each case must be unique and evaluated statically. The switch statement does a constant time branch regardless of how many cases you have. The if-else statement evaluates ea...
C# switch statement limitations - why? When writing a switch statement, there appears to be two limitations on what you can switch on in case statements. For example (and yes, I know, if you're doing this sort of thing it probably means your object-oriented (OO) architecture is iffy - this is just a contrived example!)...
TITLE: C# switch statement limitations - why? QUESTION: When writing a switch statement, there appears to be two limitations on what you can switch on in case statements. For example (and yes, I know, if you're doing this sort of thing it probably means your object-oriented (OO) architecture is iffy - this is just a c...
[ "c#", "switch-statement" ]
151
107
124,266
17
0
2008-09-04T22:34:47.030000
2008-09-04T22:51:03.980000
44,909
44,971
What essential design artifacts do you produce?
In the course of your software development lifecycle, what essential design artifacts do you produce? What makes them essential to your practice? The project I'm currently on has been in production for more than 8 years. This web application has been actively enhanced and maintained over that time. While we have CMMI -...
Having worked on a lot of waterfall projects in the past and a lot of adhoc and agile projects more recently, there's a number of design artifacts I like to create although I can't state enough that it really depends on the details of the project (methodology, team structure, timescale, tools, etc.). For a generic, ser...
What essential design artifacts do you produce? In the course of your software development lifecycle, what essential design artifacts do you produce? What makes them essential to your practice? The project I'm currently on has been in production for more than 8 years. This web application has been actively enhanced and...
TITLE: What essential design artifacts do you produce? QUESTION: In the course of your software development lifecycle, what essential design artifacts do you produce? What makes them essential to your practice? The project I'm currently on has been in production for more than 8 years. This web application has been act...
[ "artifacts" ]
2
6
10,960
6
0
2008-09-04T22:39:52.790000
2008-09-04T23:28:49.020000
44,912
44,928
Java Delegates?
Does the Java language have delegate features, similar to how C# has support for delegates?
Not really, no. You may be able to achieve the same effect by using reflection to get Method objects you can then invoke, and the other way is to create an interface with a single 'invoke' or 'execute' method, and then instantiate them to call the method your interested in (i.e. using an anonymous inner class). You mig...
Java Delegates? Does the Java language have delegate features, similar to how C# has support for delegates?
TITLE: Java Delegates? QUESTION: Does the Java language have delegate features, similar to how C# has support for delegates? ANSWER: Not really, no. You may be able to achieve the same effect by using reflection to get Method objects you can then invoke, and the other way is to create an interface with a single 'invo...
[ "java", "delegates" ]
224
170
302,304
14
0
2008-09-04T22:45:00.030000
2008-09-04T22:54:49.447000
44,914
44,934
Windows Forms Application Performance
My app has many controls on its surface, and more are added dynamically at runtime. Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc). What are your tips and tricks to improve WinForms app performance?
I know of two things you can do but they don't always apply to all situations. You're going to get better performance if you're using absolute positioning for each control (myNewlyCreatedButton.Location.X/Y) as opposed to using a flow layout panel or a table layout panel. WinForms has to do a lot less math trying to fi...
Windows Forms Application Performance My app has many controls on its surface, and more are added dynamically at runtime. Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc). What are your tips and tricks ...
TITLE: Windows Forms Application Performance QUESTION: My app has many controls on its surface, and more are added dynamically at runtime. Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc). What are you...
[ "winforms", "performance" ]
5
5
3,676
4
0
2008-09-04T22:48:22.143000
2008-09-04T23:00:44.690000
44,917
44,932
Explicit vs implicit SQL joins
Is there any efficiency difference in an explicit vs implicit inner join? For example: SELECT * FROM table a INNER JOIN table b ON a.id = b.id; vs. SELECT a.*, b.* FROM table a, table b WHERE a.id = b.id;
Performance-wise, they are exactly the same (at least in SQL Server). PS: Be aware that the "implicit OUTER JOIN " syntax--using *= or =* in a WHERE after using comma--is deprecated since SQL Server 2005. (The "implicit ( CROSS ) JOIN " syntax using comma as used in the question is still supported.) Deprecation of "Old...
Explicit vs implicit SQL joins Is there any efficiency difference in an explicit vs implicit inner join? For example: SELECT * FROM table a INNER JOIN table b ON a.id = b.id; vs. SELECT a.*, b.* FROM table a, table b WHERE a.id = b.id;
TITLE: Explicit vs implicit SQL joins QUESTION: Is there any efficiency difference in an explicit vs implicit inner join? For example: SELECT * FROM table a INNER JOIN table b ON a.id = b.id; vs. SELECT a.*, b.* FROM table a, table b WHERE a.id = b.id; ANSWER: Performance-wise, they are exactly the same (at least in ...
[ "sql", "join" ]
495
172
230,523
12
0
2008-09-04T22:49:58.117000
2008-09-04T22:56:56.413000
44,937
44,939
How do you make an etag that matches Apache?
I want to make an etag that matches what Apache produces. How does apache create it's etags?
Apache uses the standard format of inode-filesize-mtime. The only caveat to this is that the mtime must be epoch time and padded with zeros so it is 16 digits. Here is how to do it in PHP: $fs = stat($file); header("Etag: ".sprintf('"%x-%x-%s"', $fs['ino'], $fs['size'],base_convert(str_pad($fs['mtime'],16,"0"),10,16)))...
How do you make an etag that matches Apache? I want to make an etag that matches what Apache produces. How does apache create it's etags?
TITLE: How do you make an etag that matches Apache? QUESTION: I want to make an etag that matches what Apache produces. How does apache create it's etags? ANSWER: Apache uses the standard format of inode-filesize-mtime. The only caveat to this is that the mtime must be epoch time and padded with zeros so it is 16 dig...
[ "apache", "http", "etag" ]
13
11
7,533
4
0
2008-09-04T23:02:07.743000
2008-09-04T23:04:03.837000
44,940
44,947
Learning CIL
Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good.
The only CIL book on my shelf is Expert.NET 2.0 IL Assembler by Serge Lidin. In terms of what the individual opcodes do or mean, the Microsoft documentation on System.Reflection.Emit has some pretty good information. And it's always useful to look at existing IL with Reflector. Edit: CIL (and indeed the CLR in general)...
Learning CIL Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good.
TITLE: Learning CIL QUESTION: Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good. ANSWER: The only CIL book on my shelf is Expert.NET 2.0 IL Assembler by Serge Lidin. In terms of what the indi...
[ ".net", "cil" ]
9
20
1,676
3
0
2008-09-04T23:04:12.340000
2008-09-04T23:09:31.970000
44,942
44,954
Cast List<int> to List<string> in .NET 2.0
Can you cast a List to List somehow? I know I could loop through and.ToString() the thing, but a cast would be awesome. I'm in C# 2.0 (so no LINQ ).
.NET 2.0 has the ConvertAll method where you can pass in a converter function: List l1 = new List (new int[] { 1, 2, 3 } ); List l2 = l1.ConvertAll (delegate(int i) { return i.ToString(); });
Cast List<int> to List<string> in .NET 2.0 Can you cast a List to List somehow? I know I could loop through and.ToString() the thing, but a cast would be awesome. I'm in C# 2.0 (so no LINQ ).
TITLE: Cast List<int> to List<string> in .NET 2.0 QUESTION: Can you cast a List to List somehow? I know I could loop through and.ToString() the thing, but a cast would be awesome. I'm in C# 2.0 (so no LINQ ). ANSWER: .NET 2.0 has the ConvertAll method where you can pass in a converter function: List l1 = new List (ne...
[ "c#", "generics", "casting" ]
104
157
95,744
8
0
2008-09-04T23:06:56.360000
2008-09-04T23:16:00.050000
44,961
44,995
What are the primary differences between Haskell and F#?
I've searched on the Internet for comparisons between F# and Haskell but haven't found anything really definitive. What are the primary differences and why would I want to choose one over the other?
Haskell is a "pure" functional language, where as F# has aspects of both imperative/OO and functional languages. Haskell also has lazy evaluation, which is fairly rare amongst functional languages. What do these things mean? A pure functional language, means there are no side effects (or changes in shared state, when a...
What are the primary differences between Haskell and F#? I've searched on the Internet for comparisons between F# and Haskell but haven't found anything really definitive. What are the primary differences and why would I want to choose one over the other?
TITLE: What are the primary differences between Haskell and F#? QUESTION: I've searched on the Internet for comparisons between F# and Haskell but haven't found anything really definitive. What are the primary differences and why would I want to choose one over the other? ANSWER: Haskell is a "pure" functional langua...
[ "haskell", "f#", "functional-programming", "language-comparisons" ]
135
127
32,879
5
0
2008-09-04T23:24:51.883000
2008-09-04T23:54:34.247000
44,973
44,986
Can I run rubygems in ironruby?
Is it currently possible with pre release of ironruby to run rubygems? It seems as if I have to set an environment variable to find them?
You've been able to run rubygems under IronRuby for quite a while now. Simply download and install the latest IronRuby from codeplex, and run igem on the command line Original Answer: I'm on that mailing list - to save you the digging, someone asked this a few weeks ago, and this was the answer The answer (at this poin...
Can I run rubygems in ironruby? Is it currently possible with pre release of ironruby to run rubygems? It seems as if I have to set an environment variable to find them?
TITLE: Can I run rubygems in ironruby? QUESTION: Is it currently possible with pre release of ironruby to run rubygems? It seems as if I have to set an environment variable to find them? ANSWER: You've been able to run rubygems under IronRuby for quite a while now. Simply download and install the latest IronRuby from...
[ "rubygems", "ironruby" ]
3
6
2,174
3
0
2008-09-04T23:29:54.650000
2008-09-04T23:45:04.270000
44,980
604,042
Programmatically Determine a Duration of a Locked Workstation?
How can one determine, in code, how long the machine is locked? Other ideas outside of C# are also welcome. I like the windows service idea (and have accepted it) for simplicity and cleanliness, but unfortunately I don't think it will work for me in this particular case. I wanted to run this on my workstation at work r...
I hadn't found this before, but from any application you can hookup a SessionSwitchEventHandler. Obviously your application will need to be running, but so long as it is: Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch); void SystemEvents_SessionSw...
Programmatically Determine a Duration of a Locked Workstation? How can one determine, in code, how long the machine is locked? Other ideas outside of C# are also welcome. I like the windows service idea (and have accepted it) for simplicity and cleanliness, but unfortunately I don't think it will work for me in this pa...
TITLE: Programmatically Determine a Duration of a Locked Workstation? QUESTION: How can one determine, in code, how long the machine is locked? Other ideas outside of C# are also welcome. I like the windows service idea (and have accepted it) for simplicity and cleanliness, but unfortunately I don't think it will work...
[ "c#", "windows" ]
115
155
50,607
8
0
2008-09-04T23:37:56.207000
2009-03-02T21:19:36.123000
44,989
44,991
How do you index into a var in LINQ?
I'm trying to get the following bit of code to work in LINQPad but am unable to index into a var. Anybody know how to index into a var in LINQ? string[] sa = {"one", "two", "three"}; sa[1].Dump(); var va = sa.Select( (a,i) => new {Line = a, Index = i}); va[1].Dump(); // Cannot apply indexing with [] to an expression o...
As the comment says, you cannot apply indexing with [] to an expression of type System.Collections.Generic.IEnumerable. The IEnumerable interface only supports the method GetEnumerator(). However with LINQ you can call the extension method ElementAt(int).
How do you index into a var in LINQ? I'm trying to get the following bit of code to work in LINQPad but am unable to index into a var. Anybody know how to index into a var in LINQ? string[] sa = {"one", "two", "three"}; sa[1].Dump(); var va = sa.Select( (a,i) => new {Line = a, Index = i}); va[1].Dump(); // Cannot appl...
TITLE: How do you index into a var in LINQ? QUESTION: I'm trying to get the following bit of code to work in LINQPad but am unable to index into a var. Anybody know how to index into a var in LINQ? string[] sa = {"one", "two", "three"}; sa[1].Dump(); var va = sa.Select( (a,i) => new {Line = a, Index = i}); va[1].Dump...
[ "c#", "linq" ]
10
21
5,538
2
0
2008-09-04T23:48:17.960000
2008-09-04T23:51:26.003000
44,999
45,034
reassign value to query string parameter
I have a "showall" query string parameter in the url, the parameter is being added dynamically when "Show All/Show Pages" button is clicked. I want the ability to toggle "showall" query string parameter value depending on user clicking the "Show All/Show Pages" button. I'm doing some nested "if's" and string.Replace() ...
Just to elaborate on Toran's answer: Use: To toggle your state: protected void ToggleState(object sender, EventArgs e) { //parse string as boolean, invert, and convert back to string ShowAll.Value = (!Boolean.Parse(ShowAll.Value)).ToString(); }
reassign value to query string parameter I have a "showall" query string parameter in the url, the parameter is being added dynamically when "Show All/Show Pages" button is clicked. I want the ability to toggle "showall" query string parameter value depending on user clicking the "Show All/Show Pages" button. I'm doing...
TITLE: reassign value to query string parameter QUESTION: I have a "showall" query string parameter in the url, the parameter is being added dynamically when "Show All/Show Pages" button is clicked. I want the ability to toggle "showall" query string parameter value depending on user clicking the "Show All/Show Pages"...
[ "c#", "query-string" ]
1
3
797
4
0
2008-09-04T23:57:24.647000
2008-09-05T00:24:38.513000
45,002
71,858
In Lucene how do terms get used in calculating scores, can I override it with a CustomScoreQuery?
Has someone successfully overridden the scoring of documents in a query so that the "relevancy" of a term to the field contents can be determined through one's own function? If so, was it by implementing a CustomScoreQuery and overriding the customScore(int, float, float)? I cannot seem to find a way to build either a ...
I don't know lucene directly, but I can tell you that Solr, an application based on lucene, has got this feature: Boosting query via functions Let me know if it helps you.
In Lucene how do terms get used in calculating scores, can I override it with a CustomScoreQuery? Has someone successfully overridden the scoring of documents in a query so that the "relevancy" of a term to the field contents can be determined through one's own function? If so, was it by implementing a CustomScoreQuery...
TITLE: In Lucene how do terms get used in calculating scores, can I override it with a CustomScoreQuery? QUESTION: Has someone successfully overridden the scoring of documents in a query so that the "relevancy" of a term to the field contents can be determined through one's own function? If so, was it by implementing ...
[ "lucene", "scoring" ]
5
2
1,307
1
0
2008-09-04T23:59:24.533000
2008-09-16T12:51:01.120000
45,004
45,008
Complex CSS selector for parent of active child
Is there a way to select a parent element based on the class of a child element in the class? The example that is relevant to me relating to HTML output by a nice menu plugin for http://drupal.org. The output renders like this: Active Page Some Other Page My question is whether or not it is possible to apply a style to...
You can use has(): li:has(a:active) { /*... */ } Unfortunately, there's no way to do that with CSS. It's not very difficult with JavaScript though: // JavaScript code: document.getElementsByClassName("active")[0].parentNode; // jQuery code: $('.active').parent().get(0); // This would be the 's parent.
Complex CSS selector for parent of active child Is there a way to select a parent element based on the class of a child element in the class? The example that is relevant to me relating to HTML output by a nice menu plugin for http://drupal.org. The output renders like this: Active Page Some Other Page My question is w...
TITLE: Complex CSS selector for parent of active child QUESTION: Is there a way to select a parent element based on the class of a child element in the class? The example that is relevant to me relating to HTML output by a nice menu plugin for http://drupal.org. The output renders like this: Active Page Some Other Pag...
[ "css", "css-selectors" ]
383
208
466,406
10
0
2008-09-05T00:01:36.243000
2008-09-05T00:06:05.843000
45,015
5,686,237
Safely turning a JSON string into an object
Given a string of JSON data, how can I safely turn that string into a JavaScript object? Obviously I can do this unsafely with something like: var obj = eval("(" + json + ')'); but that leaves me vulnerable to the JSON string containing other code, which it seems very dangerous to simply eval.
JSON.parse(jsonString) is a pure JavaScript approach so long as you can guarantee a reasonably modern browser.
Safely turning a JSON string into an object Given a string of JSON data, how can I safely turn that string into a JavaScript object? Obviously I can do this unsafely with something like: var obj = eval("(" + json + ')'); but that leaves me vulnerable to the JSON string containing other code, which it seems very dangero...
TITLE: Safely turning a JSON string into an object QUESTION: Given a string of JSON data, how can I safely turn that string into a JavaScript object? Obviously I can do this unsafely with something like: var obj = eval("(" + json + ')'); but that leaves me vulnerable to the JSON string containing other code, which it ...
[ "javascript", "json", "parsing" ]
1,497
2,120
1,454,822
28
0
2008-09-05T00:12:01.570000
2011-04-16T11:45:21.977000
45,030
45,037
How to parse a string into a nullable int
I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed. I was kind of hoping that this would work int? val = stringVal as int?; But that won't work, so the way I'm doing it now is I've written this extension method public static i...
int.TryParse is probably a tad easier: public static int? ToNullableInt(this string s) { int i; if (int.TryParse(s, out i)) return i; return null; } Edit @Glenn int.TryParse is "built into the framework". It and int.Parse are the way to parse strings to ints.
How to parse a string into a nullable int I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed. I was kind of hoping that this would work int? val = stringVal as int?; But that won't work, so the way I'm doing it now is I've wri...
TITLE: How to parse a string into a nullable int QUESTION: I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed. I was kind of hoping that this would work int? val = stringVal as int?; But that won't work, so the way I'm doing ...
[ "c#", ".net", "string", ".net-3.5", "nullable" ]
358
407
235,075
23
0
2008-09-05T00:22:54.630000
2008-09-05T00:25:27.433000
45,036
45,049
Will the Garbage Collector call IDisposable.Dispose for me?
The.NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I've always done in the rare situations where a finalizer is warranted. However, what happens if I just do this: class Foo: IDisposable { publi...
The.Net Garbage Collector calls the Object.Finalize method of an object on garbage collection. By default this does nothing and must be overidden if you want to free additional resources. Dispose is NOT automatically called and must be explicity called if resources are to be released, such as within a 'using' or 'try f...
Will the Garbage Collector call IDisposable.Dispose for me? The.NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I've always done in the rare situations where a finalizer is warranted. However, wh...
TITLE: Will the Garbage Collector call IDisposable.Dispose for me? QUESTION: The.NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I've always done in the rare situations where a finalizer is warr...
[ ".net", "dispose", "idisposable" ]
151
137
38,238
9
0
2008-09-05T00:25:21.287000
2008-09-05T00:40:06.167000
45,042
45,046
How do you retrieve the commit message and file list for a particular revision?
I need to deploy a few files that were checked in sometime ago (can't remember the exact ones), so I'm looking to get a list so I can deploy just those files. What is the svn command to do this?
svn log has a --verbose parameter. I don't have a repository here to test with, but does that return a list of modified files? You can also use svn diff -r to retrieve the full change details, which you can parse or read manually to find out which files were changed.
How do you retrieve the commit message and file list for a particular revision? I need to deploy a few files that were checked in sometime ago (can't remember the exact ones), so I'm looking to get a list so I can deploy just those files. What is the svn command to do this?
TITLE: How do you retrieve the commit message and file list for a particular revision? QUESTION: I need to deploy a few files that were checked in sometime ago (can't remember the exact ones), so I'm looking to get a list so I can deploy just those files. What is the svn command to do this? ANSWER: svn log has a --ve...
[ "svn", "version-control" ]
14
5
15,395
2
0
2008-09-05T00:35:51.480000
2008-09-05T00:39:34.747000
45,045
83,999
What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?
When executing SubmitChanges to the DataContext after updating a couple properties with a LINQ to SQL connection (against SQL Server Compact Edition) I get a "Row not found or changed." ChangeConflictException. var ctx = new Data.MobileServerDataDataContext(Common.DatabasePath); var deviceSessionRecord = ctx.Sessions.F...
Thats nasty, but simple: Check if the data types for all fields in the O/R-Designer match the data types in your SQL table. Double check for nullable! A column should be either nullable in both the O/R-Designer and SQL, or not nullable in both. For example, a NVARCHAR column "title" is marked as NULLable in your databa...
What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database? When executing SubmitChanges to the DataContext after updating a couple properties with a LINQ to SQL connection (against SQL Server Compact Edition) I get a "Row not found or changed." ChangeConflic...
TITLE: What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database? QUESTION: When executing SubmitChanges to the DataContext after updating a couple properties with a LINQ to SQL connection (against SQL Server Compact Edition) I get a "Row not found or chang...
[ ".net", "linq", "linq-to-sql" ]
107
203
77,202
16
0
2008-09-05T00:39:31.707000
2008-09-17T14:44:57.607000
45,062
45,065
LINQ to SQL Association - "Properties do not have matching types"
I am trying to link two fields of a given table to the same field in another table. I have done this before so I can't work out what is wrong this time. Anyway: Table1 - Id (Primary) - FK-Table2a (Nullable, foreign key relationship in DB to Table2.Id) - FK-Table2b (Nullable, foreign key relationship in DB to Table2.Id)...
No idea on the cause, but I just reconstructed my.dbml from scratch and it fixed itself. Oh for a "refresh" feature...
LINQ to SQL Association - "Properties do not have matching types" I am trying to link two fields of a given table to the same field in another table. I have done this before so I can't work out what is wrong this time. Anyway: Table1 - Id (Primary) - FK-Table2a (Nullable, foreign key relationship in DB to Table2.Id) - ...
TITLE: LINQ to SQL Association - "Properties do not have matching types" QUESTION: I am trying to link two fields of a given table to the same field in another table. I have done this before so I can't work out what is wrong this time. Anyway: Table1 - Id (Primary) - FK-Table2a (Nullable, foreign key relationship in D...
[ "c#", "asp.net", "linq-to-sql", "dynamic-data" ]
1
2
2,144
3
0
2008-09-05T00:58:59.740000
2008-09-05T01:12:58.910000
45,075
45,248
Java: Flash a window to grab user's attention
Is there a better way to flash a window in Java than this: public static void flashWindow(JFrame frame) throws InterruptedException { int sleepTime = 50; frame.setVisible(false); Thread.sleep(sleepTime); frame.setVisible(true); Thread.sleep(sleepTime); frame.setVisible(false); Thread.sleep(sleepTime); frame.setVisible(...
There are two common ways to do this: use JNI to set urgency hints on the taskbar's window, and create a notification icon/message. I prefer the second way, since it's cross-platform and less annoying. See documentation on the TrayIcon class, particularly the displayMessage() method. The following links may be of inter...
Java: Flash a window to grab user's attention Is there a better way to flash a window in Java than this: public static void flashWindow(JFrame frame) throws InterruptedException { int sleepTime = 50; frame.setVisible(false); Thread.sleep(sleepTime); frame.setVisible(true); Thread.sleep(sleepTime); frame.setVisible(fals...
TITLE: Java: Flash a window to grab user's attention QUESTION: Is there a better way to flash a window in Java than this: public static void flashWindow(JFrame frame) throws InterruptedException { int sleepTime = 50; frame.setVisible(false); Thread.sleep(sleepTime); frame.setVisible(true); Thread.sleep(sleepTime); fra...
[ "java", "user-interface" ]
3
6
7,664
2
0
2008-09-05T01:29:03.007000
2008-09-05T04:56:17.533000
45,078
45,094
Flex and .NET - What's a good way to get data into Flex, WebORB? Web Services?
Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't get much response so I thought I'd rephrase. Does anyone have any experience building Adobe Flex applications with a.NET back-end? If so, what architecture did you use and what third-party tools if any did you employ. I've read a little abou...
I've mainly used plain ASP.NET pages that return XML for situations that are mainly one-way (data from ASP.NET --> Flex/Flash) communication. The Flex side just uses a URLLoader to hit the ASP.NET page and loads the result as XML. If the communication needs to be a little more two-sided (sending more than a couple para...
Flex and .NET - What's a good way to get data into Flex, WebORB? Web Services? Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't get much response so I thought I'd rephrase. Does anyone have any experience building Adobe Flex applications with a.NET back-end? If so, what architecture did yo...
TITLE: Flex and .NET - What's a good way to get data into Flex, WebORB? Web Services? QUESTION: Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't get much response so I thought I'd rephrase. Does anyone have any experience building Adobe Flex applications with a.NET back-end? If so, what a...
[ ".net", "apache-flex" ]
2
1
1,652
2
0
2008-09-05T01:31:19.770000
2008-09-05T02:00:34.570000
45,093
45,096
RegEx to Detect SQL Injection
Is there a Regular Expression that can detect SQL in a string? Does anyone have a sample of something that they have used before to share?
Don't do it. You're practically guaranteed to fail. Use PreparedStatement (or its equivalent) instead.
RegEx to Detect SQL Injection Is there a Regular Expression that can detect SQL in a string? Does anyone have a sample of something that they have used before to share?
TITLE: RegEx to Detect SQL Injection QUESTION: Is there a Regular Expression that can detect SQL in a string? Does anyone have a sample of something that they have used before to share? ANSWER: Don't do it. You're practically guaranteed to fail. Use PreparedStatement (or its equivalent) instead.
[ "sql", "regex", "sql-injection" ]
7
41
25,517
5
0
2008-09-05T02:00:32.993000
2008-09-05T02:02:34.377000
45,097
45,133
How do I know if Javascript has been turned off inside browser?
I assume that you can't use a JavaScript code snippet to validate if the browser user has turned off JavaScript. So what can I use instead? Can someone offer a code sample? I'm looking to wrap an if/then statement around it. I often code in CFML, if that helps.
Are we talking about something like this: JavaScript:...... Your browser does not support JavaScript!......
How do I know if Javascript has been turned off inside browser? I assume that you can't use a JavaScript code snippet to validate if the browser user has turned off JavaScript. So what can I use instead? Can someone offer a code sample? I'm looking to wrap an if/then statement around it. I often code in CFML, if that h...
TITLE: How do I know if Javascript has been turned off inside browser? QUESTION: I assume that you can't use a JavaScript code snippet to validate if the browser user has turned off JavaScript. So what can I use instead? Can someone offer a code sample? I'm looking to wrap an if/then statement around it. I often code ...
[ "javascript", "browser" ]
5
4
4,780
16
0
2008-09-05T02:04:13.077000
2008-09-05T02:22:35.343000
45,122
45,126
Python packages - import by class, not file
Say I have the following file structure: app/ app.py controllers/ __init__.py project.py plugin.py If app/controllers/project.py defines a class Project, app.py would import it like this: from app.controllers.project import Project I'd like to just be able to do: from app.controllers import Project How would this be do...
You need to put from project import Project in controllers/__init__.py. Note that when Absolute imports become the default (Python 2.7?), you will want to add a dot before the module name (to avoid collisions with a top-level model named project ), i.e., from.project import Project
Python packages - import by class, not file Say I have the following file structure: app/ app.py controllers/ __init__.py project.py plugin.py If app/controllers/project.py defines a class Project, app.py would import it like this: from app.controllers.project import Project I'd like to just be able to do: from app.con...
TITLE: Python packages - import by class, not file QUESTION: Say I have the following file structure: app/ app.py controllers/ __init__.py project.py plugin.py If app/controllers/project.py defines a class Project, app.py would import it like this: from app.controllers.project import Project I'd like to just be able t...
[ "python", "package" ]
61
104
56,142
1
0
2008-09-05T02:15:33.707000
2008-09-05T02:18:21.080000
45,123
45,138
Interfaces and Versioning
I am designing a new System and I have a lot of Interfaces that will grow over time with the system. What is the best practice to name this interfaces ISomethingV01 ISomethingV02 etc and I do this public interface ISomething{ void method(); } then I have to add method 2 so now what I do? public interface ISomethingV2:I...
Ideally, you shouldn't be changing your interfaces very often (if at all). If you do need to change an interface, you should reconsider its purpose and see if the original name still applies to it. If you still feel that the interfaces will change, and the interfaces changes are small (adding items) and you have contro...
Interfaces and Versioning I am designing a new System and I have a lot of Interfaces that will grow over time with the system. What is the best practice to name this interfaces ISomethingV01 ISomethingV02 etc and I do this public interface ISomething{ void method(); } then I have to add method 2 so now what I do? publi...
TITLE: Interfaces and Versioning QUESTION: I am designing a new System and I have a lot of Interfaces that will grow over time with the system. What is the best practice to name this interfaces ISomethingV01 ISomethingV02 etc and I do this public interface ISomething{ void method(); } then I have to add method 2 so no...
[ "naming-conventions", "interface", "versioning" ]
12
5
3,071
5
0
2008-09-05T02:15:49.040000
2008-09-05T02:29:49.770000
45,163
45,429
How do I convert a list with graphical links to an inline list?
Given this HTML: Galleries Information And this CSS: #topnav_galleries a, #topnav_information a { background-repeat: no-repeat; text-indent: -9000px; padding: 0; margin: 0 0; overflow: hidden; height: 46px; width: 136px; display: block; } #topnav { list-style-type: none; } #topnav_galleries a { background-image: url('i...
Try this: #topnav { overflow:hidden; } #topnav li { float:left; } And for IE you will need to add the following: #topnav { zoom:1; } Otherwise your floated < li > tags will spill out of the containing < ul >.
How do I convert a list with graphical links to an inline list? Given this HTML: Galleries Information And this CSS: #topnav_galleries a, #topnav_information a { background-repeat: no-repeat; text-indent: -9000px; padding: 0; margin: 0 0; overflow: hidden; height: 46px; width: 136px; display: block; } #topnav { list-st...
TITLE: How do I convert a list with graphical links to an inline list? QUESTION: Given this HTML: Galleries Information And this CSS: #topnav_galleries a, #topnav_information a { background-repeat: no-repeat; text-indent: -9000px; padding: 0; margin: 0 0; overflow: hidden; height: 46px; width: 136px; display: block; }...
[ "html", "css" ]
1
4
795
3
0
2008-09-05T03:03:22.873000
2008-09-05T08:26:22.160000
45,169
45,211
How do I return an array of strings from an ActiveX object to JScript
I need to call into a Win32 API to get a series of strings, and I would like to return an array of those strings to JavaScript. This is for script that runs on local machine for administration scripts, not for the web browser. My IDL file for the COM object has the interface that I am calling into as: HRESULT GetArrayO...
If i recall correctly, you'll need to wrap the SAFEARRAY in a VARIANT in order for it to get through, and then use a VBArray object to unpack it on the JS side of things: HRESULT GetArrayOfStrings(/*[out, retval]*/ VARIANT* pvarBstrStringArray) { //... _variant_t ret; ret.vt = VT_ARRAY|VT_VARIANT; ret.parray = rgBstrS...
How do I return an array of strings from an ActiveX object to JScript I need to call into a Win32 API to get a series of strings, and I would like to return an array of those strings to JavaScript. This is for script that runs on local machine for administration scripts, not for the web browser. My IDL file for the COM...
TITLE: How do I return an array of strings from an ActiveX object to JScript QUESTION: I need to call into a Win32 API to get a series of strings, and I would like to return an array of those strings to JavaScript. This is for script that runs on local machine for administration scripts, not for the web browser. My ID...
[ "javascript", "com", "activex" ]
5
6
4,460
2
0
2008-09-05T03:07:46.217000
2008-09-05T04:04:12.930000
45,179
45,186
Are there benefits to Classic ASP over ASP.net
Having worked with Classic ASP for about 2 years now by creating a few 100 simple web forms I can't see a good reason for switching to.net; however, I'm not that versed in.net so I'm sure I could be missing a few things. Some points that I often hear around work can be found here: http://www.packtpub.com/article/Classi...
You're missing more than a few things! ASP.NET is orders of magnitudes more productive, robust, and maintainable than old-school ASP ever thought about being. Server side controls, third-party controls, master pages, forms authentication, forms validation, an OO model than encourages appropriate application partitionin...
Are there benefits to Classic ASP over ASP.net Having worked with Classic ASP for about 2 years now by creating a few 100 simple web forms I can't see a good reason for switching to.net; however, I'm not that versed in.net so I'm sure I could be missing a few things. Some points that I often hear around work can be fou...
TITLE: Are there benefits to Classic ASP over ASP.net QUESTION: Having worked with Classic ASP for about 2 years now by creating a few 100 simple web forms I can't see a good reason for switching to.net; however, I'm not that versed in.net so I'm sure I could be missing a few things. Some points that I often hear arou...
[ "asp.net", "asp-classic" ]
53
74
11,882
19
0
2008-09-05T03:19:57.747000
2008-09-05T03:27:57.103000
45,180
45,187
Problems with disabling IIS shutdown of idle worker process?
I ran into an issue with an IIS web app shutting down an idle worker process! The next request would then have to re-initialize the application, leading to delays. I disabled the IIS shutdown of idle worker processes on the application pool to resolve this. Are there any issues associated with turning this off? If the ...
I'm assuming that you're referring to IIS 6. Instead of disabling shutdown altogether, maybe you can just increase the amount of time it waits before killing the process. The server is essentially conserving resources - if your server can stand the resource allocation for a process that mostly sits around doing nothing...
Problems with disabling IIS shutdown of idle worker process? I ran into an issue with an IIS web app shutting down an idle worker process! The next request would then have to re-initialize the application, leading to delays. I disabled the IIS shutdown of idle worker processes on the application pool to resolve this. A...
TITLE: Problems with disabling IIS shutdown of idle worker process? QUESTION: I ran into an issue with an IIS web app shutting down an idle worker process! The next request would then have to re-initialize the application, leading to delays. I disabled the IIS shutdown of idle worker processes on the application pool ...
[ "iis" ]
5
1
2,227
1
0
2008-09-05T03:20:56.247000
2008-09-05T03:28:07.993000
45,202
45,699
IoC Container Configuration/Registration
I absolutely need to use an IoC container for decoupling dependencies in an ever increasingly complex system of enterprise services. The issue I am facing is one related to configuration (a.k.a. registration). We currently have 4 different environments -- development to production and in between. These environments hav...
I use Ninject. I like the fact that I don't have to use Xml to configure the dependencies. I can just use straight up C# code. There are multiple ways of doing it also. I know other libraries have that feature, but Ninject offers fast instantiation, it is pretty lightweight, it has conditional binding, supports compact...
IoC Container Configuration/Registration I absolutely need to use an IoC container for decoupling dependencies in an ever increasingly complex system of enterprise services. The issue I am facing is one related to configuration (a.k.a. registration). We currently have 4 different environments -- development to producti...
TITLE: IoC Container Configuration/Registration QUESTION: I absolutely need to use an IoC container for decoupling dependencies in an ever increasingly complex system of enterprise services. The issue I am facing is one related to configuration (a.k.a. registration). We currently have 4 different environments -- devel...
[ "dependency-injection", "inversion-of-control" ]
1
2
1,850
4
0
2008-09-05T03:51:57.547000
2008-09-05T12:44:47.577000
45,227
45,233
List operations in Lisp
I have been searching everywhere for the following functionality in Lisp, and have gotten nowhere: find the index of something in a list. example: (index-of item InThisList) replace something at a specific spot in a list. example: (replace item InThisList AtThisIndex);i think this can be done with 'setf'? return an ite...
You can use setf and nth to replace and retrieve values by index. (let ((myList '(1 2 3 4 5 6))) (setf (nth 4 myList) 101); <---- myList) (1 2 3 4 101 6) To find by index you can use the position function. (let ((myList '(1 2 3 4 5 6))) (setf (nth 4 myList) 101) (list myList (position 101 myList))) ((1 2 3 4 101 6) 4...
List operations in Lisp I have been searching everywhere for the following functionality in Lisp, and have gotten nowhere: find the index of something in a list. example: (index-of item InThisList) replace something at a specific spot in a list. example: (replace item InThisList AtThisIndex);i think this can be done wi...
TITLE: List operations in Lisp QUESTION: I have been searching everywhere for the following functionality in Lisp, and have gotten nowhere: find the index of something in a list. example: (index-of item InThisList) replace something at a specific spot in a list. example: (replace item InThisList AtThisIndex);i think t...
[ "functional-programming", "lisp", "list" ]
7
23
8,449
6
0
2008-09-05T04:26:49.803000
2008-09-05T04:33:41.173000
45,228
46,201
Where can I find the time and space complexity of the built-in sequence types in Python
I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online?
Checkout the TimeComplexity page on the py dot org wiki. It covers set/dicts/lists/etc at least as far as time complexity goes.
Where can I find the time and space complexity of the built-in sequence types in Python I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online?
TITLE: Where can I find the time and space complexity of the built-in sequence types in Python QUESTION: I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online? ANSWER: Checkout t...
[ "python", "performance", "complexity-theory", "big-o", "sequences" ]
19
19
4,042
3
0
2008-09-05T04:27:46.557000
2008-09-05T16:19:03.537000
45,230
45,237
Is it possible to forward ssh requests that come in over a certain port to another machine?
I have a small local network. Only one of the machines is available to the outside world (this is not easily changeable). I'd like to be able to set it up such that ssh requests that don't come in on the standard port go to another machine. Is this possible? If so, how? Oh and all of these machines are running either U...
Another way to go would be to use ssh tunneling (which happens on the client side). You'd do an ssh command like this: ssh -L 8022:myinsideserver:22 paul@myoutsideserver That connects you to the machine that's accessible from the outside (myoutsideserver) and creates a tunnel through that ssh connection to port 22 (the...
Is it possible to forward ssh requests that come in over a certain port to another machine? I have a small local network. Only one of the machines is available to the outside world (this is not easily changeable). I'd like to be able to set it up such that ssh requests that don't come in on the standard port go to anot...
TITLE: Is it possible to forward ssh requests that come in over a certain port to another machine? QUESTION: I have a small local network. Only one of the machines is available to the outside world (this is not easily changeable). I'd like to be able to set it up such that ssh requests that don't come in on the standa...
[ "macos", "ubuntu", "ssh", "port" ]
6
12
4,081
6
0
2008-09-05T04:30:19.980000
2008-09-05T04:40:18.740000
45,239
679,997
What is the best technique for consistent form, function between all web browsers (including Google Chrome)?
Short version: What is the cleanest and most maintainable technique for consistant presentation and AJAX function across all browsers used by both web developers and web developers' end-users? IE 6, 7, 8 Firefox 2, 3 Safari Google Chrome Opera Long version: I wrote a web app aimed at other web developers. I want my app...
I am in a similar situation, working on a web app that is targeted at IT professionals, and required to support the same set of browsers, minus Opera. Some general things I've learned so far: Test often, in as many of your target browsers as you can. Make sure you have time for this in your development schedule. Toolki...
What is the best technique for consistent form, function between all web browsers (including Google Chrome)? Short version: What is the cleanest and most maintainable technique for consistant presentation and AJAX function across all browsers used by both web developers and web developers' end-users? IE 6, 7, 8 Firefox...
TITLE: What is the best technique for consistent form, function between all web browsers (including Google Chrome)? QUESTION: Short version: What is the cleanest and most maintainable technique for consistant presentation and AJAX function across all browsers used by both web developers and web developers' end-users? ...
[ "css", "google-chrome", "portability" ]
10
14
1,452
11
0
2008-09-05T04:43:43.350000
2009-03-25T02:19:42.190000
45,252
45,370
Load Balancing of Process in 1 Server
I have 1 process that receives incoming connection from port 1000 in 1 linux server. However, 1 process is not fast enough to handle all the incoming request. I want to run multiple processes in the server but with 1 end-point. In this way, the client will only see 1 end-point/process not multiple. I have checked LVS a...
You also may want to go with a web server like nginx. It can load balance your app against multiple ports of the same app, and is commonly used to load balance Ruby on Rails apps (which are single threaded). The downside is that you need to run multiple copies of your app (one on each port) for this load balancing to w...
Load Balancing of Process in 1 Server I have 1 process that receives incoming connection from port 1000 in 1 linux server. However, 1 process is not fast enough to handle all the incoming request. I want to run multiple processes in the server but with 1 end-point. In this way, the client will only see 1 end-point/proc...
TITLE: Load Balancing of Process in 1 Server QUESTION: I have 1 process that receives incoming connection from port 1000 in 1 linux server. However, 1 process is not fast enough to handle all the incoming request. I want to run multiple processes in the server but with 1 end-point. In this way, the client will only se...
[ "linux", "load-balancing" ]
1
2
2,252
7
0
2008-09-05T05:06:23.437000
2008-09-05T07:13:01.993000
45,253
45,261
Adding functionality to Rails
I'm working on a Rails app and am looking to include some functionality from " Getting the Hostname or IP in Ruby on Rails " that I asked. I'm having problems getting it to work. I was under the impression that I should just make a file in the lib directory, so I named it 'get_ip.rb', with the contents: require 'socket...
You haven't described how you're trying to use the method, so I apologize in advance if this is stuff you already know. The methods on a module never come into use unless the module is included into a class. Instance methods on a class require there to be an instance of the class. You probably want a class method inste...
Adding functionality to Rails I'm working on a Rails app and am looking to include some functionality from " Getting the Hostname or IP in Ruby on Rails " that I asked. I'm having problems getting it to work. I was under the impression that I should just make a file in the lib directory, so I named it 'get_ip.rb', with...
TITLE: Adding functionality to Rails QUESTION: I'm working on a Rails app and am looking to include some functionality from " Getting the Hostname or IP in Ruby on Rails " that I asked. I'm having problems getting it to work. I was under the impression that I should just make a file in the lib directory, so I named it...
[ "ruby-on-rails", "ruby" ]
2
4
1,026
3
0
2008-09-05T05:07:38.333000
2008-09-05T05:19:10.490000
45,264
45,271
Django Calendar Widget?
Does anyone know of any existing packages or libraries that can be used to build a calendar in a django app?
A quick google search reveals django-gencal, which looks like exactly what you need. It would also be worth looking at the snippets under the calendar tag on Django Snippets at http://www.djangosnippets.org/tags/calendar/.
Django Calendar Widget? Does anyone know of any existing packages or libraries that can be used to build a calendar in a django app?
TITLE: Django Calendar Widget? QUESTION: Does anyone know of any existing packages or libraries that can be used to build a calendar in a django app? ANSWER: A quick google search reveals django-gencal, which looks like exactly what you need. It would also be worth looking at the snippets under the calendar tag on Dj...
[ "django", "calendar" ]
34
17
32,197
8
0
2008-09-05T05:20:57.443000
2008-09-05T05:27:26.397000
45,267
46,158
How do I make AutoCompleteExtender render above select controls in IE6
When an AutoCompleteExtender is displayed in IE6 it seems to ignore z-index and renders below any select controls (like dropdownlists ) in IE6. How do I make it render above dropdownlists?
@Orion has this partially correct - there is one other way to deal with these, and that is to cover the offending select lists with an iframe. This technique is used in Cody Lindley's ThickBox (written for jQuery). See the code for details on how to do it.
How do I make AutoCompleteExtender render above select controls in IE6 When an AutoCompleteExtender is displayed in IE6 it seems to ignore z-index and renders below any select controls (like dropdownlists ) in IE6. How do I make it render above dropdownlists?
TITLE: How do I make AutoCompleteExtender render above select controls in IE6 QUESTION: When an AutoCompleteExtender is displayed in IE6 it seems to ignore z-index and renders below any select controls (like dropdownlists ) in IE6. How do I make it render above dropdownlists? ANSWER: @Orion has this partially correct...
[ "asp.net", "internet-explorer-6", "autocompleteextender" ]
0
0
2,516
2
0
2008-09-05T05:24:55.263000
2008-09-05T16:10:38.970000
45,286
45,316
How can I overwrite the same portion of the console in a Windows native C++ console app, without using a 3rd Party library?
I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same lines. For the sake of example: Running... nn% complete Buffer size: bbbb bytes should be the output, where 'nn' is the current percentage complete,...
You can use SetConsoleCursorPosition. You'll need to call GetStdHandle to get a handle to the output buffer.
How can I overwrite the same portion of the console in a Windows native C++ console app, without using a 3rd Party library? I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same lines. For the sake of e...
TITLE: How can I overwrite the same portion of the console in a Windows native C++ console app, without using a 3rd Party library? QUESTION: I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same lines....
[ "c++", "windows", "console" ]
15
9
13,881
5
0
2008-09-05T05:42:57.217000
2008-09-05T06:12:27.007000
45,325
45,327
How do you force Visual Studio to regenerate the .designer files for aspx/ascx files?
Sometimes when I'm editing page or control the.designer files stop being updated with the new controls I'm putting on the page. I'm not sure what's causing this to happen, but I'm wondering if there's any way of forcing Visual Studio to regenerate the.designer file. I'm using Visual Studio 2008 EDIT: Sorry I should hav...
If you open the.aspx file and switch between design view and html view and back it will prompt VS to check the controls and add any that are missing to the designer file. In VS2013-15 there is a Convert to Web Application command under the Project menu. Prior to VS2013 this option was available in the right-click conte...
How do you force Visual Studio to regenerate the .designer files for aspx/ascx files? Sometimes when I'm editing page or control the.designer files stop being updated with the new controls I'm putting on the page. I'm not sure what's causing this to happen, but I'm wondering if there's any way of forcing Visual Studio ...
TITLE: How do you force Visual Studio to regenerate the .designer files for aspx/ascx files? QUESTION: Sometimes when I'm editing page or control the.designer files stop being updated with the new controls I'm putting on the page. I'm not sure what's causing this to happen, but I'm wondering if there's any way of forc...
[ "asp.net", "visual-studio", "visual-studio-2008" ]
432
388
351,759
50
0
2008-09-05T06:21:06.517000
2008-09-05T06:25:29.457000
45,331
63,710
MS Visual Studio "Package Load Failure" error
I'm receiving "Package Load Failure" error when I open VS 2005 after I installed the latest VisualSVN (v. 1.5.2). Anyone facing this error? Is there any tool out there to help identify which package didn't load and/or help unload a specific package?
Installing the Visual Studio SDK will install the "Package Load Analyzer" package. This allows you to see what package failed to load and why.
MS Visual Studio "Package Load Failure" error I'm receiving "Package Load Failure" error when I open VS 2005 after I installed the latest VisualSVN (v. 1.5.2). Anyone facing this error? Is there any tool out there to help identify which package didn't load and/or help unload a specific package?
TITLE: MS Visual Studio "Package Load Failure" error QUESTION: I'm receiving "Package Load Failure" error when I open VS 2005 after I installed the latest VisualSVN (v. 1.5.2). Anyone facing this error? Is there any tool out there to help identify which package didn't load and/or help unload a specific package? ANSWE...
[ "visual-studio-2005", "visualsvn" ]
0
1
2,163
2
0
2008-09-05T06:28:41.397000
2008-09-15T15:04:04.660000
45,339
45,371
Why is my web control null?
I have a web site in asp.net that uses a master page. In this master page I have a multiview control with one view that has all the content for the content pages and one view that has some local content to the master page where I show error messages from all content pages. In this error view I have a asp.net Label cont...
It seems that the problem was one of sloppiness. Someone had forgotten to delete the auto-generated Content-controls that Visual Studio throws in on all content pages where the master page has a ContentPlaceHolder-control. If a content page has a Content-control, all controls that are placed in the ContentPlaceHolder-c...
Why is my web control null? I have a web site in asp.net that uses a master page. In this master page I have a multiview control with one view that has all the content for the content pages and one view that has some local content to the master page where I show error messages from all content pages. In this error view...
TITLE: Why is my web control null? QUESTION: I have a web site in asp.net that uses a master page. In this master page I have a multiview control with one view that has all the content for the content pages and one view that has some local content to the master page where I show error messages from all content pages. ...
[ "asp.net", "master-pages" ]
3
4
6,255
4
0
2008-09-05T06:36:03.143000
2008-09-05T07:15:19.057000
45,361
46,330
Tomcat doFilter() invoked with committed response
I have a Tomcat Filter that delegates requests to the a handling object depending on the URL. This is the only filter in the FilterChain. I have an Ajax app that hammers this filter with lots of requests. Recently I noticed an issue where the filter's doFilter method is often called with a committed response as a param...
I have tried using Tomcat 6.16 and 6.18. This is definitely is the only filter in the chain. It seems that something is keeping a reference to the servlet outputStream. I wrapped the ServletOutputStream in my own OutputStream and then made sure the reference is destroyed. This fixed the issue so that I no longer see a ...
Tomcat doFilter() invoked with committed response I have a Tomcat Filter that delegates requests to the a handling object depending on the URL. This is the only filter in the FilterChain. I have an Ajax app that hammers this filter with lots of requests. Recently I noticed an issue where the filter's doFilter method is...
TITLE: Tomcat doFilter() invoked with committed response QUESTION: I have a Tomcat Filter that delegates requests to the a handling object depending on the URL. This is the only filter in the FilterChain. I have an Ajax app that hammers this filter with lots of requests. Recently I noticed an issue where the filter's ...
[ "java", "tomcat", "servlets" ]
8
4
1,765
2
0
2008-09-05T07:07:06.593000
2008-09-05T17:14:40.767000
45,372
61,050
Calculated columns in mysql on INSERT statements
Let's say that I want to have a table that logs the date and the number of columns in some other table (or really any sort of math / string concat etc). CREATE TABLE `log` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `date` DATETIME NOT NULL, `count` INTEGER NOT NULL, PRIMARY KEY (`id`) ); Is it possible to have the count c...
Triggers are the best tool for annotating data when a table is changed by insert, update or delete. To automatically set the date column of a new row in the log with the current date, you'd create a trigger that looked something like this: create trigger log_date before insert on log for each row begin set new.date = c...
Calculated columns in mysql on INSERT statements Let's say that I want to have a table that logs the date and the number of columns in some other table (or really any sort of math / string concat etc). CREATE TABLE `log` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `date` DATETIME NOT NULL, `count` INTEGER NOT NULL, PRIMARY...
TITLE: Calculated columns in mysql on INSERT statements QUESTION: Let's say that I want to have a table that logs the date and the number of columns in some other table (or really any sort of math / string concat etc). CREATE TABLE `log` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `date` DATETIME NOT NULL, `count` INTEGER...
[ "sql", "mysql", "database" ]
3
6
4,134
3
0
2008-09-05T07:15:27.807000
2008-09-14T01:46:27.893000
45,385
45,392
Good python library for generating audio files?
Can anyone recommend a good library for generating an audio file, such as mp3, wav, or even midi, from python? I've seen recommendations for working with the id tags (song name, artist, etc) in mp3 files, but this is not my goal.
See http://wiki.python.org/moin/Audio/ and http://wiki.python.org/moin/PythonInMusic, maybe some of the projects listed there can be of help. Also, Google is your friend.
Good python library for generating audio files? Can anyone recommend a good library for generating an audio file, such as mp3, wav, or even midi, from python? I've seen recommendations for working with the id tags (song name, artist, etc) in mp3 files, but this is not my goal.
TITLE: Good python library for generating audio files? QUESTION: Can anyone recommend a good library for generating an audio file, such as mp3, wav, or even midi, from python? I've seen recommendations for working with the id tags (song name, artist, etc) in mp3 files, but this is not my goal. ANSWER: See http://wiki...
[ "python", "audio", "mp3" ]
7
10
4,456
2
0
2008-09-05T07:33:43.783000
2008-09-05T07:44:45.413000
45,387
45,397
Accessible controls for ASP.NET
In my last job we ended up rewriting the complete ASP.NET stack (forms, controls, validation, postback handling, ajax library etc...) - the reason I was given was that the ASP.NET controls were not accessible enough, not were any of the third party controls that were assessed for the project. Can anyone point me to goo...
You could take a look at the 'App_Browsers' feature in.NET. It gives you the opportunity to hook into the rendering engine for each control. The original intention for this was to be able to alter the HTML output of controls depending on the user's browser - but you can also do it for all browsers. You could also take ...
Accessible controls for ASP.NET In my last job we ended up rewriting the complete ASP.NET stack (forms, controls, validation, postback handling, ajax library etc...) - the reason I was given was that the ASP.NET controls were not accessible enough, not were any of the third party controls that were assessed for the pro...
TITLE: Accessible controls for ASP.NET QUESTION: In my last job we ended up rewriting the complete ASP.NET stack (forms, controls, validation, postback handling, ajax library etc...) - the reason I was given was that the ASP.NET controls were not accessible enough, not were any of the third party controls that were as...
[ "asp.net", "ajax", "accessibility" ]
0
1
273
1
0
2008-09-05T07:40:27.530000
2008-09-05T07:47:01.880000
45,399
45,479
Advantages and disadvantages of GUID / UUID database keys
I've worked on a number of database systems in the past where moving entries between databases would have been made a lot easier if all the database keys had been GUID / UUID values. I've considered going down this path a few times, but there's always a bit of uncertainty, especially around performance and un-read-out-...
Advantages: Can generate them offline. Makes replication trivial (as opposed to int's, which makes it REALLY hard) ORM's usually like them Unique across applications. So We can use the PK's from our CMS (guid) in our app (also guid) and know we are NEVER going to get a clash. Disadvantages: Larger space use, but space ...
Advantages and disadvantages of GUID / UUID database keys I've worked on a number of database systems in the past where moving entries between databases would have been made a lot easier if all the database keys had been GUID / UUID values. I've considered going down this path a few times, but there's always a bit of u...
TITLE: Advantages and disadvantages of GUID / UUID database keys QUESTION: I've worked on a number of database systems in the past where moving entries between databases would have been made a lot easier if all the database keys had been GUID / UUID values. I've considered going down this path a few times, but there's...
[ "database", "guid", "uuid" ]
277
291
113,162
10
0
2008-09-05T08:00:50.380000
2008-09-05T09:44:55.717000
45,400
45,440
Source control system for single developer
What's the recommended source control system for a very small team (one developer)? Price does not matter. Customer would pay:-) I'm working on Vista32 with VS 2008 in C++ and later in C# and with WPF. Setting up an extra (physical) server for this seems overkill to me. Any opinions?
I would use Subversion (in fact I use it) [ update: Jul 2014 -- I use Git -- see end of the answer]. SVN is: free, good enough (see disadvantages below), simple, works fine on Windows (and Linux too), a lot of people use it so it's easy to get help, can integrate with most of IDEs i.e. Visual Studio (i.e. ankhsvn or Vi...
Source control system for single developer What's the recommended source control system for a very small team (one developer)? Price does not matter. Customer would pay:-) I'm working on Vista32 with VS 2008 in C++ and later in C# and with WPF. Setting up an extra (physical) server for this seems overkill to me. Any op...
TITLE: Source control system for single developer QUESTION: What's the recommended source control system for a very small team (one developer)? Price does not matter. Customer would pay:-) I'm working on Vista32 with VS 2008 in C++ and later in C# and with WPF. Setting up an extra (physical) server for this seems over...
[ "version-control" ]
57
63
22,498
26
0
2008-09-05T08:01:17.447000
2008-09-05T08:45:23.520000
45,401
45,421
Lightweight 3D Graphics Engine .NET (Compact and Full Framework)
I am creating a GUI for a machine that runs remote (WinXP) or on the machine itself (Windows CE 6.0). Right now I've created a fast visualisation (read: very simple) of the machine itself. The goal is to make a bit more complex visualisation of the machine and for that I would need a lightweight 3d engine. The engine s...
Did you try Irrlicht. Recently Irrlicht has acquired official.NET bindings, allowing users to develop in.Net languages such as VB.NET, C# and Boo. There is also Ogre 3D and also Axiom Engine
Lightweight 3D Graphics Engine .NET (Compact and Full Framework) I am creating a GUI for a machine that runs remote (WinXP) or on the machine itself (Windows CE 6.0). Right now I've created a fast visualisation (read: very simple) of the machine itself. The goal is to make a bit more complex visualisation of the machin...
TITLE: Lightweight 3D Graphics Engine .NET (Compact and Full Framework) QUESTION: I am creating a GUI for a machine that runs remote (WinXP) or on the machine itself (Windows CE 6.0). Right now I've created a fast visualisation (read: very simple) of the machine itself. The goal is to make a bit more complex visualisa...
[ "c#", "3d-engine" ]
3
3
4,670
4
0
2008-09-05T08:02:39.160000
2008-09-05T08:16:41.560000
45,407
45,448
Is there any difference between the box models of IE8 and Firefox3?
What are the main differences (if any) between the box models of IE8 and Firefox3? Are they the same now? What are the other main differences between these two browsers? Can a web developer assume that these two browsers as the same since they (seem to) support the latest web standards?
The Internet Explorer box model has been "fixed" since Internet Explorer 6 so long as your pages are in standard compliants mode. See: Quirks mode and Internet Explorer box model bug. Until I learnt about doctype declerations getting IE to work properly was a real PAIN, because IE runs in "quirks mode" by default. So h...
Is there any difference between the box models of IE8 and Firefox3? What are the main differences (if any) between the box models of IE8 and Firefox3? Are they the same now? What are the other main differences between these two browsers? Can a web developer assume that these two browsers as the same since they (seem to...
TITLE: Is there any difference between the box models of IE8 and Firefox3? QUESTION: What are the main differences (if any) between the box models of IE8 and Firefox3? Are they the same now? What are the other main differences between these two browsers? Can a web developer assume that these two browsers as the same s...
[ "firefox", "browser", "internet-explorer-8" ]
18
13
4,075
3
0
2008-09-05T08:06:32.740000
2008-09-05T09:07:55.993000
45,408
45,417
JIT code generation techniques
How does a virtual machine generate native machine code on the fly and execute it? Assuming you can figure out what are the native machine op-codes you want to emit, how do you go about actually running it? Is it something as hacky as mapping the mnemonic instructions to binary codes, stuffing it into an char* pointer ...
You can just make the program counter point to the code you want to execute. Remember that data can be data or code. On x86 the program counter is the EIP register. The IP part of EIP stands for instruction pointer. The JMP instruction is called to jump to an address. After the jump EIP will contain this address. Is it...
JIT code generation techniques How does a virtual machine generate native machine code on the fly and execute it? Assuming you can figure out what are the native machine op-codes you want to emit, how do you go about actually running it? Is it something as hacky as mapping the mnemonic instructions to binary codes, stu...
TITLE: JIT code generation techniques QUESTION: How does a virtual machine generate native machine code on the fly and execute it? Assuming you can figure out what are the native machine op-codes you want to emit, how do you go about actually running it? Is it something as hacky as mapping the mnemonic instructions to...
[ "interpreter", "jit", ".net-assembly" ]
19
8
1,680
7
0
2008-09-05T08:07:00.273000
2008-09-05T08:15:05.247000
45,414
45,550
Why does the Eclipse code formatter break </a> in a Javadoc @see tag?
I'm using Eclipse 3.4 and have configured the Java code formatter with all of the options on the Comments tab enabled. The problem is that when I format a document comment that contains: * @see test the code formatter inserts a space in the closing HTML, breaking it: * @see test< /a> Why? How do I stop this happening? ...
I can only assume it's a bug in Eclipse. It only happens with @see tags, it happens also for all 3 builtin code formatter settings. There are some interesting bugs reported already in the neighbourhood, but I couldn't find this specific one. See for example a search for @see in the Eclipse Bugzilla.
Why does the Eclipse code formatter break </a> in a Javadoc @see tag? I'm using Eclipse 3.4 and have configured the Java code formatter with all of the options on the Comments tab enabled. The problem is that when I format a document comment that contains: * @see test the code formatter inserts a space in the closing H...
TITLE: Why does the Eclipse code formatter break </a> in a Javadoc @see tag? QUESTION: I'm using Eclipse 3.4 and have configured the Java code formatter with all of the options on the Comments tab enabled. The problem is that when I format a document comment that contains: * @see test the code formatter inserts a spac...
[ "java", "eclipse", "javadoc", "eclipse-3.4" ]
4
4
1,698
3
0
2008-09-05T08:12:44.627000
2008-09-05T11:13:21.853000
45,415
159,437
How to run NUnit v2.4.8 tests with NAnt 0.86 beta?
I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success. The error I get is the following: [nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" contains no tests. Of course, the assembly contains tests that I can run...
I can't remember why, but I gave up on using the task and I've been using the task and nunit-console.exe happily. If it helps, here's my test target that runs NUnit and FxCop. Note that it skips them if the executables aren't in the Windows path.
How to run NUnit v2.4.8 tests with NAnt 0.86 beta? I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success. The error I get is the following: [nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" contains no tests. Of...
TITLE: How to run NUnit v2.4.8 tests with NAnt 0.86 beta? QUESTION: I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success. The error I get is the following: [nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" con...
[ ".net", "unit-testing", "nunit", "nant" ]
6
10
2,264
1
0
2008-09-05T08:14:39.567000
2008-10-01T19:58:47.590000
45,424
202,693
Struts 2: return to calling page
I'm using Struts 2. I'd like to return from an Action to the page which invoked it. Say I'm in page x.jsp, I invoke Visual action to change CSS preferences in the session; I want to return to x.jsp rather than to a fixed page (i.e. home.jsp ) Here's the relevant struts.xml fragment: /pages/home.jsp Of course my Visuali...
You can use a dynamic result in struts.xml. For instance: ${next} Then in your action, you create a field called next. So to invoke the action you will pass the name of the page that you want to forward to next. The action then returns "next" and struts will know which page to go to. There is a nicer explanation on thi...
Struts 2: return to calling page I'm using Struts 2. I'd like to return from an Action to the page which invoked it. Say I'm in page x.jsp, I invoke Visual action to change CSS preferences in the session; I want to return to x.jsp rather than to a fixed page (i.e. home.jsp ) Here's the relevant struts.xml fragment: /pa...
TITLE: Struts 2: return to calling page QUESTION: I'm using Struts 2. I'd like to return from an Action to the page which invoked it. Say I'm in page x.jsp, I invoke Visual action to change CSS preferences in the session; I want to return to x.jsp rather than to a fixed page (i.e. home.jsp ) Here's the relevant struts...
[ "java", "struts2", "struts" ]
2
4
22,944
4
0
2008-09-05T08:18:52.443000
2008-10-14T20:36:06.363000
45,426
45,466
SQL file encoding in Visual Studio
When we create stored procedures in Visual Studio (with the extension.sql) the file encoding is automatically set to 'Unicode (UTF-8 with signature) - Codepage 65001'. This causes ours DBA's problems as their scripts don't like it. We have to manually go in and change them to 'Western European (windows) - Codepage 1252...
I think somebody faced a similar problem like yours and had the following workaround which is posted at http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=319830
SQL file encoding in Visual Studio When we create stored procedures in Visual Studio (with the extension.sql) the file encoding is automatically set to 'Unicode (UTF-8 with signature) - Codepage 65001'. This causes ours DBA's problems as their scripts don't like it. We have to manually go in and change them to 'Western...
TITLE: SQL file encoding in Visual Studio QUESTION: When we create stored procedures in Visual Studio (with the extension.sql) the file encoding is automatically set to 'Unicode (UTF-8 with signature) - Codepage 65001'. This causes ours DBA's problems as their scripts don't like it. We have to manually go in and chang...
[ "sql", "visual-studio", "stored-procedures" ]
5
3
6,261
3
0
2008-09-05T08:20:13.890000
2008-09-05T09:28:35.897000
45,431
590,946
NCover, TypeMock and MSTest
has anyone got NCover, TypeMock and MSTest to work together? and if so how. I've had 2 or 3 serious tries at this now and just can't get it to work. I'm using MSTest 9, NCover 2.1 and TypeMock 4.1. Ideally I would like to run them from an MSBuild task. Cheers Mat
Well its a bit late but here is the answer for future generations... Few key points: In older version of Typemock (like 4.1) you need an enterprise license in order to run Typemock with NCover. In the current version all licenses have the same features list. In order to run Typemock with other profilers you need to use...
NCover, TypeMock and MSTest has anyone got NCover, TypeMock and MSTest to work together? and if so how. I've had 2 or 3 serious tries at this now and just can't get it to work. I'm using MSTest 9, NCover 2.1 and TypeMock 4.1. Ideally I would like to run them from an MSBuild task. Cheers Mat
TITLE: NCover, TypeMock and MSTest QUESTION: has anyone got NCover, TypeMock and MSTest to work together? and if so how. I've had 2 or 3 serious tries at this now and just can't get it to work. I'm using MSTest 9, NCover 2.1 and TypeMock 4.1. Ideally I would like to run them from an MSBuild task. Cheers Mat ANSWER: W...
[ "ncover", "typemock" ]
0
2
1,257
1
0
2008-09-05T08:29:08.957000
2009-02-26T15:13:12.747000
45,453
45,969
ICalendar and event updates not working in Outlook
I'm generating ICalendar (.ics) files. Using the UID and SEQUENCE fields I can update existing events in Google Calendar and in Windows Calendar BUT NOT in MS Outlook 2007 - it just creates a second event How do I get them to work for Outlook? Thanks Tom
I've continued to do some testing and have now managed to get Outlook to update and cancel events based on the.cs file. Outlook in fact seems to respond to the rules defined in RFC 2446 In summary you have to specify METHOD:REQUEST and ORGANIZER:xxxxxxxx in addition to UID: and SEQUENCE: For a cancellation you have to ...
ICalendar and event updates not working in Outlook I'm generating ICalendar (.ics) files. Using the UID and SEQUENCE fields I can update existing events in Google Calendar and in Windows Calendar BUT NOT in MS Outlook 2007 - it just creates a second event How do I get them to work for Outlook? Thanks Tom
TITLE: ICalendar and event updates not working in Outlook QUESTION: I'm generating ICalendar (.ics) files. Using the UID and SEQUENCE fields I can update existing events in Google Calendar and in Windows Calendar BUT NOT in MS Outlook 2007 - it just creates a second event How do I get them to work for Outlook? Thanks ...
[ "language-agnostic", "icalendar", "rfc2445", "rfc5545" ]
27
26
29,750
5
0
2008-09-05T09:14:03.747000
2008-09-05T14:52:00.670000
45,470
45,474
Suggest some good MVC framework in perl
Can you suggest some good MVC framework for perl -- one I am aware of is catalyst The need is to be able to expose services on the perl infrastructure which can be called by Java/.Net applications seamlessly.
I'll tell you right now that Catalyst has by far the best reputation amongst Perl developers in terms of a rapid application development MVC framework. In terms of "pure" MVC I'm not sure there are even that many "mature" or at least production-ready alternatives. If Catalyst doesn't seem right to you, then you could b...
Suggest some good MVC framework in perl Can you suggest some good MVC framework for perl -- one I am aware of is catalyst The need is to be able to expose services on the perl infrastructure which can be called by Java/.Net applications seamlessly.
TITLE: Suggest some good MVC framework in perl QUESTION: Can you suggest some good MVC framework for perl -- one I am aware of is catalyst The need is to be able to expose services on the perl infrastructure which can be called by Java/.Net applications seamlessly. ANSWER: I'll tell you right now that Catalyst has by...
[ "perl", "model-view-controller" ]
16
21
9,281
12
0
2008-09-05T09:36:30.493000
2008-09-05T09:41:31.060000
45,481
45,493
How to do streaming read of a large XML file in C# 3.5
How can you do a streaming read on a large XML file that contains a xs:sequence just below root element, without loading the whole file into a XDocument instance in memory?
Going with a SAX-style element parser and the XmlTextReader class created with XmlReader.Create would be a good idea, yes. Here's a slightly-modified code example from CodeGuru: void ParseURL(string strUrl) { try { using (var reader = XmlReader.Create(strUrl)) { while (reader.Read()) { switch (reader.NodeType) { case X...
How to do streaming read of a large XML file in C# 3.5 How can you do a streaming read on a large XML file that contains a xs:sequence just below root element, without loading the whole file into a XDocument instance in memory?
TITLE: How to do streaming read of a large XML file in C# 3.5 QUESTION: How can you do a streaming read on a large XML file that contains a xs:sequence just below root element, without loading the whole file into a XDocument instance in memory? ANSWER: Going with a SAX-style element parser and the XmlTextReader class...
[ "c#", ".net", "xml", ".net-3.5", "streaming" ]
11
9
9,972
6
0
2008-09-05T09:45:59.397000
2008-09-05T10:02:45.580000
45,485
45,542
Are there conventions for function names when using the Perl Test::More?
Are there conventions for function names when using the Perl Test::More or Test::Simple modules? I'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the environment after successful completion of the test(s). cheers, Rob
I dont think there are any such conventions out there. The only way you can do it is perhaps use BEGIN/END blocks, if the resources are to be used over the whole file. The general approach I take is to put related tests in one code block and then initialize the variables/resource etc there. You can perhaps keep an easy...
Are there conventions for function names when using the Perl Test::More? Are there conventions for function names when using the Perl Test::More or Test::Simple modules? I'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the environment after...
TITLE: Are there conventions for function names when using the Perl Test::More? QUESTION: Are there conventions for function names when using the Perl Test::More or Test::Simple modules? I'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the...
[ "perl", "testing", "frameworks" ]
3
3
1,177
8
0
2008-09-05T09:51:43.203000
2008-09-05T11:07:25.627000
45,494
45,498
MySQL Error 1093 - Can't specify target table for update in FROM clause
I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); I tried to delete them executing: DELETE FROM story_cate...
Update: This answer covers the general error classification. For a more specific answer about how to best handle the OP's exact query, please see other answers to this question In MySQL, you can't modify the same table which you use in the SELECT part. This behaviour is documented at: http://dev.mysql.com/doc/refman/5....
MySQL Error 1093 - Can't specify target table for update in FROM clause I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_i...
TITLE: MySQL Error 1093 - Can't specify target table for update in FROM clause QUESTION: I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_cate...
[ "mysql", "subquery", "sql-delete", "mysql-error-1093" ]
837
960
757,141
18
0
2008-09-05T10:03:46.590000
2008-09-05T10:07:48.143000
45,507
45,832
Is there a Python library for generating .ico files?
I'm looking to create favicon.ico files programatically from Python, but PIL only has support for reading ico files.
According to Wikipedia modern browsers can handle favicons in PNG format, so maybe you could just generate that? Alternatively the ICO article describes the format...
Is there a Python library for generating .ico files? I'm looking to create favicon.ico files programatically from Python, but PIL only has support for reading ico files.
TITLE: Is there a Python library for generating .ico files? QUESTION: I'm looking to create favicon.ico files programatically from Python, but PIL only has support for reading ico files. ANSWER: According to Wikipedia modern browsers can handle favicons in PNG format, so maybe you could just generate that? Alternativ...
[ "python", "favicon" ]
36
7
33,631
7
0
2008-09-05T10:26:47.223000
2008-09-05T13:35:32.900000
45,510
45,537
How can I call a .NET DLL from an Inno Setup script?
I want to call a function from a.NET DLL (coded in C#) from an Inno Setup script. I have: marked the Register for COM interop option in the project properties, changed the ComVisible setting in the AssemblyInfo.cs file, added these lines to the ISS script: [Files] Source: c:\temp\1\MyDLL.dll; Flags: dontcopy [Code] fun...
Oops, my bad, it's been too long since I've read pascal! So, if you need to get the value then there are a couple of possibilities: Write the functionality in C/C++ and export the function, that's definitely supported. Use a Managed C++ dll to shim to your.NET dll, and expose the call as a C interface point (this shoul...
How can I call a .NET DLL from an Inno Setup script? I want to call a function from a.NET DLL (coded in C#) from an Inno Setup script. I have: marked the Register for COM interop option in the project properties, changed the ComVisible setting in the AssemblyInfo.cs file, added these lines to the ISS script: [Files] So...
TITLE: How can I call a .NET DLL from an Inno Setup script? QUESTION: I want to call a function from a.NET DLL (coded in C#) from an Inno Setup script. I have: marked the Register for COM interop option in the project properties, changed the ComVisible setting in the AssemblyInfo.cs file, added these lines to the ISS ...
[ ".net", "installation", "inno-setup", "pascalscript" ]
12
5
9,983
7
0
2008-09-05T10:28:46.813000
2008-09-05T11:03:44.623000
45,528
45,587
Simplest way to change listview and treeview colours
I'm trying to find a simple way to change the colour of the text and background in listview and treeview controls in WTL or plain Win32 code. I really don't want to have to implement full owner drawing for these controls, simply change the colours used. I want to make sure that the images are still drawn with proper tr...
Have a look at the following macros: ListView_SetBkColor ListView_SetTextColor TreeView_SetBkColor TreeView_SetTextColor
Simplest way to change listview and treeview colours I'm trying to find a simple way to change the colour of the text and background in listview and treeview controls in WTL or plain Win32 code. I really don't want to have to implement full owner drawing for these controls, simply change the colours used. I want to mak...
TITLE: Simplest way to change listview and treeview colours QUESTION: I'm trying to find a simple way to change the colour of the text and background in listview and treeview controls in WTL or plain Win32 code. I really don't want to have to implement full owner drawing for these controls, simply change the colours u...
[ "c++", "winapi", "wtl" ]
5
3
2,882
4
0
2008-09-05T10:54:12.460000
2008-09-05T11:38:06.083000
45,535
45,548
Get month and year from a datetime in SQL Server 2005
I need the month+year from the datetime in SQL Server like 'Jan 2008'. I'm grouping the query by month, year. I've searched and found functions like datepart, convert, etc., but none of them seem useful for this. Am I missing something here? Is there a function for this?
If you mean you want them back as a string, in that format; SELECT CONVERT(CHAR(4), date_of_birth, 100) + CONVERT(CHAR(4), date_of_birth, 120) FROM customers Here are the other format options
Get month and year from a datetime in SQL Server 2005 I need the month+year from the datetime in SQL Server like 'Jan 2008'. I'm grouping the query by month, year. I've searched and found functions like datepart, convert, etc., but none of them seem useful for this. Am I missing something here? Is there a function for ...
TITLE: Get month and year from a datetime in SQL Server 2005 QUESTION: I need the month+year from the datetime in SQL Server like 'Jan 2008'. I'm grouping the query by month, year. I've searched and found functions like datepart, convert, etc., but none of them seem useful for this. Am I missing something here? Is the...
[ "sql", "sql-server" ]
97
81
846,972
20
0
2008-09-05T11:02:44.640000
2008-09-05T11:12:32.667000
45,546
45,585
How do I return a 403 Forbidden in Spring MVC?
I want my controller to return the right HTTP response code when the user lacks permission to view a particular page.
Quickie If you are using plain JSP views (as is most common), then simply add <% response.setStatus( 403 ); %> somewhere in your view file. At the top is a nice place. Detail In MVC, i would always set this in the view, and in most cases with Spring-MVC, use the SimpleMappingExceptionResolver to present the correct vie...
How do I return a 403 Forbidden in Spring MVC? I want my controller to return the right HTTP response code when the user lacks permission to view a particular page.
TITLE: How do I return a 403 Forbidden in Spring MVC? QUESTION: I want my controller to return the right HTTP response code when the user lacks permission to view a particular page. ANSWER: Quickie If you are using plain JSP views (as is most common), then simply add <% response.setStatus( 403 ); %> somewhere in your...
[ "java", "spring", "http-status-code-403", "httpforbiddenhandler" ]
40
13
90,768
6
0
2008-09-05T11:11:21.203000
2008-09-05T11:35:15.937000
45,553
45,641
How to get browser IP or hostname?
I have a web application that should behave differently for internal users than external ones. The web application is available over the Internet, and therefore obviously to the internal users as well. All the users are anonymous, not authenticated, but the page should render differently for internal users than externa...
I recommend using IP addresses as well. I'm dealing with this exact same situation setting up an authentication system right now as well and the conditions described by Epso and Robin M are exactly what is happening. External users coming to the site give me their actual IP address while all internal users provide the ...
How to get browser IP or hostname? I have a web application that should behave differently for internal users than external ones. The web application is available over the Internet, and therefore obviously to the internal users as well. All the users are anonymous, not authenticated, but the page should render differen...
TITLE: How to get browser IP or hostname? QUESTION: I have a web application that should behave differently for internal users than external ones. The web application is available over the Internet, and therefore obviously to the internal users as well. All the users are anonymous, not authenticated, but the page shou...
[ "asp.net", "visual-studio" ]
1
3
3,967
5
0
2008-09-05T11:15:25.763000
2008-09-05T12:24:35.033000
45,571
45,573
fprintf returns success but can't write to an existing file
In my code fprintf returns successfully by returning the number of bytes written in STREAM, but in the actual file the string I wrote is not there.
The output is probably just buffered. Try closing the file using close() or call fflush() on the stream to force the string to the file.
fprintf returns success but can't write to an existing file In my code fprintf returns successfully by returning the number of bytes written in STREAM, but in the actual file the string I wrote is not there.
TITLE: fprintf returns success but can't write to an existing file QUESTION: In my code fprintf returns successfully by returning the number of bytes written in STREAM, but in the actual file the string I wrote is not there. ANSWER: The output is probably just buffered. Try closing the file using close() or call fflu...
[ "c", "file", "io", "stream", "printf" ]
3
5
1,081
1
0
2008-09-05T11:24:39.627000
2008-09-05T11:27:31.087000
45,577
942,103
Syntax highlighting for html markup disappears in Visual Studio 2008
This happened to me in Visual Studio 2008 pre and post 2008 sp1 on more than one computer and to someone else I know, so it can't be an isolated incident. Seemingly random, every so often I lose all syntax highlighting in my aspx page (the html) so that Visual Studio now looks like a really expensive version of notepad...
it happened to me after an uninstall of visual studio using a removal tool at http://msdn.microsoft.com/en-us/vstudio/bb968856.aspx I had to run this before upgrading sql server management studio to 2008 version syntax highlighting has disappeared since because of package loading failures. I didn't find the fix yet so ...
Syntax highlighting for html markup disappears in Visual Studio 2008 This happened to me in Visual Studio 2008 pre and post 2008 sp1 on more than one computer and to someone else I know, so it can't be an isolated incident. Seemingly random, every so often I lose all syntax highlighting in my aspx page (the html) so th...
TITLE: Syntax highlighting for html markup disappears in Visual Studio 2008 QUESTION: This happened to me in Visual Studio 2008 pre and post 2008 sp1 on more than one computer and to someone else I know, so it can't be an isolated incident. Seemingly random, every so often I lose all syntax highlighting in my aspx pag...
[ "asp.net", "html", "visual-studio", "visual-studio-2008" ]
2
3
2,593
7
0
2008-09-05T11:29:22.970000
2009-06-02T21:56:11.567000
45,582
1,380,478
How can I convince GroovyShell to maintain state over eval() calls?
I'm trying to use Groovy to create an interactive scripting / macro mode for my application. The application is OSGi and much of the information the scripts may need is not know up front. I figured I could use GroovyShell and call eval() multiple times continually appending to the namespace as OSGi bundles are loaded. ...
Ended up injecting code before each script compilation. End goal is that the user written script has a domain-specific-language available for use.
How can I convince GroovyShell to maintain state over eval() calls? I'm trying to use Groovy to create an interactive scripting / macro mode for my application. The application is OSGi and much of the information the scripts may need is not know up front. I figured I could use GroovyShell and call eval() multiple times...
TITLE: How can I convince GroovyShell to maintain state over eval() calls? QUESTION: I'm trying to use Groovy to create an interactive scripting / macro mode for my application. The application is OSGi and much of the information the scripts may need is not know up front. I figured I could use GroovyShell and call eva...
[ "java", "groovy", "scripting", "groovyshell" ]
3
1
1,829
3
0
2008-09-05T11:33:04.957000
2009-09-04T17:08:35.407000
45,593
45,692
Is there a way to perform a "Refresh Dependencies" in a setup project outside VS2008?
I have a solution with several projects. One of them is a setup project. If you expand the setup project in the Solution Explorer, you see a Detected Dependencies node. If you right click on it, you get a menu item called Refresh Dependencies. This refreshes any dependencies based on the files included in the setup. I ...
Record or create a macro: Option Strict Off Option Explicit Off Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics Public Module RefreshDependencies Sub TemporaryMacro() DTE.ActiveWindow.Object.GetItem("Project\Setup1\Setup1").Select(vsUISelectionType.vsUISelectionTypeSelect) DT...
Is there a way to perform a "Refresh Dependencies" in a setup project outside VS2008? I have a solution with several projects. One of them is a setup project. If you expand the setup project in the Solution Explorer, you see a Detected Dependencies node. If you right click on it, you get a menu item called Refresh Depe...
TITLE: Is there a way to perform a "Refresh Dependencies" in a setup project outside VS2008? QUESTION: I have a solution with several projects. One of them is a setup project. If you expand the setup project in the Solution Explorer, you see a Detected Dependencies node. If you right click on it, you get a menu item c...
[ "c#", "visual-studio-2008", "msbuild", "installation", "cruisecontrol.net" ]
7
2
5,748
1
0
2008-09-05T11:49:02.483000
2008-09-05T12:42:37.597000