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
113,013
113,088
IIS 6.0 Is Stubbornly Remembering Authentication Settings
I have an.asmx in a folder in my application and I keep getting a 401 trying to access it. I have double and triple checked the setting including the directory security settings. It allows anonymous. I turned off Windows Authentication. If I delete the application and the folder its in, then redeploy it under the same ...
After deleting the first application in IIS and its associated files on the disk, try restarting IIS (or your server if possible). Then come back and recreate the whole setup.
IIS 6.0 Is Stubbornly Remembering Authentication Settings I have an.asmx in a folder in my application and I keep getting a 401 trying to access it. I have double and triple checked the setting including the directory security settings. It allows anonymous. I turned off Windows Authentication. If I delete the applicati...
TITLE: IIS 6.0 Is Stubbornly Remembering Authentication Settings QUESTION: I have an.asmx in a folder in my application and I keep getting a 401 trying to access it. I have double and triple checked the setting including the directory security settings. It allows anonymous. I turned off Windows Authentication. If I de...
[ "asp.net", "http", "authentication", "iis-6", "http-status-code-401" ]
0
1
305
3
0
2008-09-22T03:18:43.197000
2008-09-22T03:51:19.127000
113,024
113,204
Whats the best way to pass html embed code via rss feed to a rss parser in php?
Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the DB on the receiving server?
Since RSS is XML, you might want to check out CDATA, which I believe is valid in the various RSS specs. Data Here Here's the w3schools entry on it: http://www.w3schools.com/XML/xml_cdata.asp
Whats the best way to pass html embed code via rss feed to a rss parser in php? Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean ...
TITLE: Whats the best way to pass html embed code via rss feed to a rss parser in php? QUESTION: Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I...
[ "php", "html", "xml", "validation", "rss" ]
3
1
2,236
5
0
2008-09-22T03:22:45.090000
2008-09-22T04:36:54.820000
113,028
113,167
Internet Explorer 8 beta 2 and Standards
Internet Explorer 8 breaks what must be every 3rd page I look at. The point of this early release was, I presume, to give website owners the chance to update their sites so it wouldn't be such a hassle for the final release. Has anyone actually done this? Is anyone even planning on doing this? I have yet to notice any ...
You can also take a look at aggiorno express for IE8 Compat, it is a free tool that automates the tagging of your site with the meta tag Jon points to, it will also remove the flag once u have got ur pages to render correctly under the standards mode. The tool supports both a GUI and command line so it is easy to scrip...
Internet Explorer 8 beta 2 and Standards Internet Explorer 8 breaks what must be every 3rd page I look at. The point of this early release was, I presume, to give website owners the chance to update their sites so it wouldn't be such a hassle for the final release. Has anyone actually done this? Is anyone even planning...
TITLE: Internet Explorer 8 beta 2 and Standards QUESTION: Internet Explorer 8 breaks what must be every 3rd page I look at. The point of this early release was, I presume, to give website owners the chance to update their sites so it wouldn't be such a hassle for the final release. Has anyone actually done this? Is an...
[ "internet-explorer", "internet-explorer-8", "standards", "compatibility" ]
3
1
325
6
0
2008-09-22T03:24:51.577000
2008-09-22T04:24:31.183000
113,033
113,039
How to use one object's method to update another object's attribute?
I have three (C++) classes: Player, Hand, and Card. Player has a member, hand, that holds a Hand. It also has a method, getHand(), that returns the contents of hand. Hand Player::getHand() { return hand; } Hand has a method, addCard(Card c), that adds a card to the hand. I want to do this: player1.getHand().addCard(c);...
If getHand() is not returning a reference you will be in trouble.
How to use one object's method to update another object's attribute? I have three (C++) classes: Player, Hand, and Card. Player has a member, hand, that holds a Hand. It also has a method, getHand(), that returns the contents of hand. Hand Player::getHand() { return hand; } Hand has a method, addCard(Card c), that adds...
TITLE: How to use one object's method to update another object's attribute? QUESTION: I have three (C++) classes: Player, Hand, and Card. Player has a member, hand, that holds a Hand. It also has a method, getHand(), that returns the contents of hand. Hand Player::getHand() { return hand; } Hand has a method, addCard(...
[ "c++", "oop", "methods" ]
3
1
318
8
0
2008-09-22T03:26:28.357000
2008-09-22T03:28:30.693000
113,045
113,055
How to return only the Date from a SQL Server DateTime datatype
SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part: 2008-09-22 00:00:00.000 How can I get that?
NOTE: This answer returns the original DATETIME or DATETIME2 type. For an expression that returns a true DATE type (SQL Server 2008 and later), see BenR's answer below. SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, @your_date)) for example SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) gives me 2008-09-22 00:00:00.000 Pros:...
How to return only the Date from a SQL Server DateTime datatype SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part: 2008-09-22 00:00:00.000 How can I get that?
TITLE: How to return only the Date from a SQL Server DateTime datatype QUESTION: SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part: 2008-09-22 00:00:00.000 How can I get that? ANSWER: NOTE: This answer returns the original DATETIME or DATETIME2 type. For an expression that ...
[ "sql", "date", "t-sql", "datetime", "sql-server-2008" ]
2,181
2,848
3,699,407
47
0
2008-09-22T03:31:33.277000
2008-09-22T03:34:16.873000
113,063
113,069
How to write an RSS feed with Java?
I'm using Java, and need to generate a simple, standards-compliant RSS feed. How can I go about this?
I recommend using Rome: // Feed header SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle("Sample Feed"); feed.setLink("http://example.com/"); // Feed entries List entries = new ArrayList(); feed.setEntries(entries); SyndEntry entry = new SyndEntryImpl(); entry.setTitle("Entry #1"); entry....
How to write an RSS feed with Java? I'm using Java, and need to generate a simple, standards-compliant RSS feed. How can I go about this?
TITLE: How to write an RSS feed with Java? QUESTION: I'm using Java, and need to generate a simple, standards-compliant RSS feed. How can I go about this? ANSWER: I recommend using Rome: // Feed header SyndFeed feed = new SyndFeedImpl(); feed.setFeedType("rss_2.0"); feed.setTitle("Sample Feed"); feed.setLink("http://...
[ "java", "rss", "rome" ]
28
41
36,570
1
0
2008-09-22T03:37:37.147000
2008-09-22T03:39:17.877000
113,077
113,851
Keeping my PHP pretty
I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times. Doing that, however, makes my php code look horrific... it really messes with the form...
Don't panic, every fresh Web programmer face this problem. You HAVE TO separate your program logic from your display. First, try to make your own solution using two files for each Web page: one with only PHP code (no HTML) that fills variables another with HTML and very few PHP: this is your page design Then include wh...
Keeping my PHP pretty I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times. Doing that, however, makes my php code look horrific... it reall...
TITLE: Keeping my PHP pretty QUESTION: I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times. Doing that, however, makes my php code look ho...
[ "php", "html", "formatting" ]
11
26
5,175
14
0
2008-09-22T03:46:23.147000
2008-09-22T08:47:42.907000
113,090
113,101
Dynamic IP-based blacklisting
Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is determined dynamically, based on application's f...
are you on a *nix machine? this sort of thing is probably better left to the OS level, using something like iptables edit: in response to the comment, yes (sort of). however, the idea is that iptables can work independently. you can set a certain threshold to throttle (for example, block requests on port 80 TCP that ex...
Dynamic IP-based blacklisting Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is determined dynamic...
TITLE: Dynamic IP-based blacklisting QUESTION: Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is ...
[ "security", "apache", ".htaccess", "email-spam" ]
6
2
5,264
6
0
2008-09-22T03:53:04.487000
2008-09-22T03:56:25.853000
113,113
113,175
Where can I find some up to date information on OpenID authentication with rails?
The question says it all. I can't seem to find any recent rails tutorials or whatever to set up an OpenID authentication system. I found RestfulOpenIDAuthentication but it's so much older than the vanilla Restful Authentication and the docs don't even mention Rails 2 that I am pretty wary. Does anyone have any tips? I'...
Check out the Railscast covering exactly this topic. It builds on the previous episode which discusses Restful Authentication.
Where can I find some up to date information on OpenID authentication with rails? The question says it all. I can't seem to find any recent rails tutorials or whatever to set up an OpenID authentication system. I found RestfulOpenIDAuthentication but it's so much older than the vanilla Restful Authentication and the do...
TITLE: Where can I find some up to date information on OpenID authentication with rails? QUESTION: The question says it all. I can't seem to find any recent rails tutorials or whatever to set up an OpenID authentication system. I found RestfulOpenIDAuthentication but it's so much older than the vanilla Restful Authent...
[ "ruby-on-rails", "openid" ]
5
1
121
1
0
2008-09-22T04:01:04.360000
2008-09-22T04:28:05.510000
113,118
193,697
Tool to calculate # of lines of code in code behind and aspx files?
Looking for a tool to calculate the # of lines of code in an asp.net (vb.net) application. The tricky part is that it needs to figure out the inline code in aspx files also. So it will be lines of code in vb files (minus comments) plus the inline code in aspx files (not all the lines of aspx files, just the code betwee...
From a previous post, Source Monitor appears to be the answer and NDepend for.NET.
Tool to calculate # of lines of code in code behind and aspx files? Looking for a tool to calculate the # of lines of code in an asp.net (vb.net) application. The tricky part is that it needs to figure out the inline code in aspx files also. So it will be lines of code in vb files (minus comments) plus the inline code ...
TITLE: Tool to calculate # of lines of code in code behind and aspx files? QUESTION: Looking for a tool to calculate the # of lines of code in an asp.net (vb.net) application. The tricky part is that it needs to figure out the inline code in aspx files also. So it will be lines of code in vb files (minus comments) plu...
[ "asp.net", "vb.net" ]
6
2
4,846
4
0
2008-09-22T04:03:17.693000
2008-10-11T05:31:33.243000
113,131
1,421,799
Recommended WPF Calendar
What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months.
Microsoft has now released a WPF calendar control. (source: windowsclient.net ) http://www.codeplex.com/wpf http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-calendar-datepicker-walkthrough.aspx Charles Petzold wrote a good article about customising the WPF calendar control too.
Recommended WPF Calendar What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months.
TITLE: Recommended WPF Calendar QUESTION: What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months. ANSWER: Microsoft has now released a WPF calendar control. (source: windowsclient.net ) http://www.codeplex.com/...
[ ".net", "wpf" ]
2
6
3,984
2
0
2008-09-22T04:09:04.543000
2009-09-14T14:10:30.643000
113,144
113,165
Large Image resizing libraries
Does anyone know of any good image resizing libraries that will handling resizing large images(~7573 x ~9485). Something that is fast and doesn't chew to much memory would be great. At the moment I am using IrfanView and just shell invoking it with arguments but I would like to find something that integrates into.net a...
ImageMagick all the way. It's a codebase with nearly every image-related operation you could possibly want to do, implemented fairly efficiently in C. This includes various types of resizing, both interpolated (bilinear, trilinear, adaptive, etc.), and not (just decimating (sampling) or replicating pixels. There are a ...
Large Image resizing libraries Does anyone know of any good image resizing libraries that will handling resizing large images(~7573 x ~9485). Something that is fast and doesn't chew to much memory would be great. At the moment I am using IrfanView and just shell invoking it with arguments but I would like to find somet...
TITLE: Large Image resizing libraries QUESTION: Does anyone know of any good image resizing libraries that will handling resizing large images(~7573 x ~9485). Something that is fast and doesn't chew to much memory would be great. At the moment I am using IrfanView and just shell invoking it with arguments but I would ...
[ ".net", "image", "resize", "image-manipulation" ]
2
5
1,519
4
0
2008-09-22T04:13:42.317000
2008-09-22T04:24:18.547000
113,150
113,155
What is the cost of using a pointer to member function vs. a switch?
I have the following situation: class A { public: A(int whichFoo); int foo1(); int foo2(); int foo3(); int callFoo(); // cals one of the foo's depending on the value of whichFoo }; In my current implementation I save the value of whichFoo in a data member in the constructor and use a switch in callFoo() to decide which...
How sure are you that calling a member function via a pointer is slower than just calling it directly? Can you measure the difference? In general, you should not rely on your intuition when making performance evaluations. Sit down with your compiler and a timing function, and actually measure the different choices. You...
What is the cost of using a pointer to member function vs. a switch? I have the following situation: class A { public: A(int whichFoo); int foo1(); int foo2(); int foo3(); int callFoo(); // cals one of the foo's depending on the value of whichFoo }; In my current implementation I save the value of whichFoo in a data me...
TITLE: What is the cost of using a pointer to member function vs. a switch? QUESTION: I have the following situation: class A { public: A(int whichFoo); int foo1(); int foo2(); int foo3(); int callFoo(); // cals one of the foo's depending on the value of whichFoo }; In my current implementation I save the value of whi...
[ "c++", "function-pointers" ]
14
12
6,352
12
0
2008-09-22T04:15:52.420000
2008-09-22T04:18:45.237000
113,170
113,219
What are the Python equivalents of the sighold and sigrelse functions found in C?
It appears the Python signal module doesn't have anything similar to the sighold and sigrelse functions found in C, using signal.h. Are there Python equivalents of any sort? Many thanks!
There are no direct bindings for this in Python. Accessing them through ctypes is easy enough; here is an example. import ctypes, signal libc = ctypes.cdll.LoadLibrary("libc.so.6") libc.sighold(signal.SIGKILL) libc.sigrelse(signal.SIGKILL) I'm not familiar with the use of these calls, but be aware that Python's signal ...
What are the Python equivalents of the sighold and sigrelse functions found in C? It appears the Python signal module doesn't have anything similar to the sighold and sigrelse functions found in C, using signal.h. Are there Python equivalents of any sort? Many thanks!
TITLE: What are the Python equivalents of the sighold and sigrelse functions found in C? QUESTION: It appears the Python signal module doesn't have anything similar to the sighold and sigrelse functions found in C, using signal.h. Are there Python equivalents of any sort? Many thanks! ANSWER: There are no direct bind...
[ "python", "signals" ]
3
2
787
2
0
2008-09-22T04:25:22.943000
2008-09-22T04:47:24.980000
113,189
113,225
Hidden markov models implementation in .net?
Does anyone know of any HMM implementation in.net? I've some stuff that I did that was basicly reverse engineered from what little knowledge that I have regarding the subject and some c++ code of a very domain specific application that one of my professors did. I want to improve it somewhat and having another's work th...
A quick Google search returned this C# implementation of what appears to be a Hidden Markov Model (they said it was an n-gram, but the implementation appears to be an HMM).
Hidden markov models implementation in .net? Does anyone know of any HMM implementation in.net? I've some stuff that I did that was basicly reverse engineered from what little knowledge that I have regarding the subject and some c++ code of a very domain specific application that one of my professors did. I want to imp...
TITLE: Hidden markov models implementation in .net? QUESTION: Does anyone know of any HMM implementation in.net? I've some stuff that I did that was basicly reverse engineered from what little knowledge that I have regarding the subject and some c++ code of a very domain specific application that one of my professors ...
[ ".net", "hidden-markov-models" ]
3
5
2,479
2
0
2008-09-22T04:32:03.600000
2008-09-22T04:51:43.940000
113,206
113,331
Create a small 'window-form' application that runs anywhere
I work in the embedded world, using mainly C and no GUI at all (because there is no display screen). Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the common p...
I have both worked with PyQt and wxPython extensively. PyQt is better designed and comes with very good UI designer so that you can quickly assemble your UI wxPython has a very good demo and it can do pretty much anything which PyQT can do, I would anyday prefer PyQt but it may bot be free for commercial purpose but wx...
Create a small 'window-form' application that runs anywhere I work in the embedded world, using mainly C and no GUI at all (because there is no display screen). Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simp...
TITLE: Create a small 'window-form' application that runs anywhere QUESTION: I work in the embedded world, using mainly C and no GUI at all (because there is no display screen). Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for ...
[ "windows", "linux", "macos", "programming-languages", "widget" ]
3
1
2,473
9
0
2008-09-22T04:37:35.160000
2008-09-22T05:40:44.713000
113,233
113,242
How to release .Net apps without bundling .Net framework?
I have a strange requirement to ship an application without bundling.Net framework (to save memory footprint and bandwidth). Is this possible? Customers may or may not have.Net runtime installed on their systems. Will doing Ngen take care of this problem? I was looking for something like the good old ways of releasing ...
One option without using Ngen may be to release using the.Net Framework 3.5 SP1 "Client Profile". This is a sub-set of the.Net Framework used for building client applications which can be downloaded as a separate, much smaller, package. See details from the BCL Team Blog here and Scott Guthrie here.
How to release .Net apps without bundling .Net framework? I have a strange requirement to ship an application without bundling.Net framework (to save memory footprint and bandwidth). Is this possible? Customers may or may not have.Net runtime installed on their systems. Will doing Ngen take care of this problem? I was ...
TITLE: How to release .Net apps without bundling .Net framework? QUESTION: I have a strange requirement to ship an application without bundling.Net framework (to save memory footprint and bandwidth). Is this possible? Customers may or may not have.Net runtime installed on their systems. Will doing Ngen take care of th...
[ ".net", "linker" ]
1
3
1,218
7
0
2008-09-22T04:54:12.547000
2008-09-22T04:58:57.917000
113,253
113,268
Centered background image is off by 1px
My web page sits in a DIV that is 960px wide, I center this DIV in the middle of the page by using the code: html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;} #container{background-color:#ffffff;width:960px;text-align:left;margin:0 auto 0 auto;} I need the background image...
Yeah, it's known issue. Unfortunately you only can fix div and image width, or use script to dynamically change stye.backgroundPosition property. Another trick is to put expression to the CSS class definition.
Centered background image is off by 1px My web page sits in a DIV that is 960px wide, I center this DIV in the middle of the page by using the code: html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;} #container{background-color:#ffffff;width:960px;text-align:left;margin:0 a...
TITLE: Centered background image is off by 1px QUESTION: My web page sits in a DIV that is 960px wide, I center this DIV in the middle of the page by using the code: html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;} #container{background-color:#ffffff;width:960px;text-ali...
[ "html", "css", "background-image" ]
3
3
4,529
6
0
2008-09-22T05:03:46.423000
2008-09-22T05:08:00.313000
113,267
113,373
VB.NET - Should a Finalize method be added when implementing IDisposable?
In Visual Studio, when I type the line " Implements IDisposable ", the IDE automatically adds: a disposedValue member variable a Sub Dispose() Implements IDisposable.Dispose a Sub Dispose(ByVal disposing As Boolean) The Dispose() should be left alone, and the clean up code should be put in Dispose(disposing). However t...
If you actually are holding non-managed resources that will not be automatically cleaned up by the garbage collector and cleaning those up in your Dispose(), then yes, you should do the same in Finalize(). If you're implementing IDisposable for some other reason, implementing Finalize() isn't required. The basic questi...
VB.NET - Should a Finalize method be added when implementing IDisposable? In Visual Studio, when I type the line " Implements IDisposable ", the IDE automatically adds: a disposedValue member variable a Sub Dispose() Implements IDisposable.Dispose a Sub Dispose(ByVal disposing As Boolean) The Dispose() should be left a...
TITLE: VB.NET - Should a Finalize method be added when implementing IDisposable? QUESTION: In Visual Studio, when I type the line " Implements IDisposable ", the IDE automatically adds: a disposedValue member variable a Sub Dispose() Implements IDisposable.Dispose a Sub Dispose(ByVal disposing As Boolean) The Dispose(...
[ "vb.net", "dispose", "idisposable", "destructor", "finalize" ]
7
11
11,988
4
0
2008-09-22T05:07:43.217000
2008-09-22T05:59:04.357000
113,275
114,776
How do I remove duplication in shoulda tests?
Here is what I have: context "Create ingredient from string" do context "1 cups butter" do setup do @ingredient = Ingredient.create(:ingredient_string => "1 cups butter") end should "return unit" do assert_equal @ingredient.unit, 'cups' end should "return amount" do assert_equal @ingredient.amount, 1.0 end should "...
Here's a solution to your specific problem. The idea is to create a class method (like Shoulda's context, setup and should). Encapsulate the repetition in a class method accepting all varying parts as arguments like this: def self.should_get_unit_amount_and_name_from_string(unit, amount, name, string_to_analyze) contex...
How do I remove duplication in shoulda tests? Here is what I have: context "Create ingredient from string" do context "1 cups butter" do setup do @ingredient = Ingredient.create(:ingredient_string => "1 cups butter") end should "return unit" do assert_equal @ingredient.unit, 'cups' end should "return amount" do asse...
TITLE: How do I remove duplication in shoulda tests? QUESTION: Here is what I have: context "Create ingredient from string" do context "1 cups butter" do setup do @ingredient = Ingredient.create(:ingredient_string => "1 cups butter") end should "return unit" do assert_equal @ingredient.unit, 'cups' end should "retu...
[ "ruby-on-rails", "unit-testing", "shoulda" ]
2
4
590
4
0
2008-09-22T05:12:57.510000
2008-09-22T13:12:45.530000
113,277
113,296
Maintaining Multiple Databases Across Several Platforms
What's the best way to maintain a multiple databases across several platforms (Windows, Linux, Mac OS X and Solaris) and keep them in sync with one another? I've tried several different programs and nothing seems to work!
I think you should ask yourself why you have to go through the hassle of maintaining multiple databases across several platforms and have them in sync with one another. Sounds like there's a lot of redundancy there. Why not just have one instance of that database, since I'm sure it can be made accessible (e.g. via SOA ...
Maintaining Multiple Databases Across Several Platforms What's the best way to maintain a multiple databases across several platforms (Windows, Linux, Mac OS X and Solaris) and keep them in sync with one another? I've tried several different programs and nothing seems to work!
TITLE: Maintaining Multiple Databases Across Several Platforms QUESTION: What's the best way to maintain a multiple databases across several platforms (Windows, Linux, Mac OS X and Solaris) and keep them in sync with one another? I've tried several different programs and nothing seems to work! ANSWER: I think you sho...
[ "windows", "database", "linux", "macos", "solaris" ]
1
3
369
2
0
2008-09-22T05:15:04.040000
2008-09-22T05:22:27.363000
113,286
113,303
Do you create your own code generators?
The Pragmatic Programmer advocates the use of code generators. Do you create code generators on your projects? If yes, what do you use them for?
Code generators if used widely without correct argumentation make code less understandable and decrease maintainability (the same with dynamic SQL by the way). Personally I'm using it with some of ORM tools, because their usage here mostly obvious and sometimes for things like searcher-parser algorithms and grammatic a...
Do you create your own code generators? The Pragmatic Programmer advocates the use of code generators. Do you create code generators on your projects? If yes, what do you use them for?
TITLE: Do you create your own code generators? QUESTION: The Pragmatic Programmer advocates the use of code generators. Do you create code generators on your projects? If yes, what do you use them for? ANSWER: Code generators if used widely without correct argumentation make code less understandable and decrease main...
[ "code-generation" ]
31
9
6,427
26
0
2008-09-22T05:19:49.710000
2008-09-22T05:24:39.277000
113,288
113,294
Multiple services from the same executable
I've written a small service (plain Win32) and I'd like to know if it's possible to run multiple instances of it when multiple users are logged on. Basically, let's say we've got UserA and UserB for UserA the service would log on as "domain\UserA" and for UserB the service would log on as "domain\UserB" - this is from ...
Win32 services are designed to be system-wide, and start running before any user is logged in. If you want something to run on a per-user basis, it's probably better to design it as a regular application and run it from the user's Startup group.
Multiple services from the same executable I've written a small service (plain Win32) and I'd like to know if it's possible to run multiple instances of it when multiple users are logged on. Basically, let's say we've got UserA and UserB for UserA the service would log on as "domain\UserA" and for UserB the service wou...
TITLE: Multiple services from the same executable QUESTION: I've written a small service (plain Win32) and I'd like to know if it's possible to run multiple instances of it when multiple users are logged on. Basically, let's say we've got UserA and UserB for UserA the service would log on as "domain\UserA" and for Use...
[ "c++", "winapi", "service" ]
3
2
1,997
11
0
2008-09-22T05:20:02.033000
2008-09-22T05:22:06.880000
113,293
113,301
Is the host localhost always available for the own system?
Is it always possible to ping localhost and it resolves to 127.0.0.1? I know Windows Vista, XP, Ubuntu and Debian do it but does everyone do it?
Any correct implementation of TCP/IP will reserve the address 127.0.0.1 to refer to the local machine. However, the mapping of the name "localhost" to that address is generally dependent on the system hosts file. If you were to remove the localhost entry from hosts, then the localhost name may no longer resolve properl...
Is the host localhost always available for the own system? Is it always possible to ping localhost and it resolves to 127.0.0.1? I know Windows Vista, XP, Ubuntu and Debian do it but does everyone do it?
TITLE: Is the host localhost always available for the own system? QUESTION: Is it always possible to ping localhost and it resolves to 127.0.0.1? I know Windows Vista, XP, Ubuntu and Debian do it but does everyone do it? ANSWER: Any correct implementation of TCP/IP will reserve the address 127.0.0.1 to refer to the l...
[ "localhost", "ping" ]
5
17
5,214
10
0
2008-09-22T05:21:51.780000
2008-09-22T05:24:00.073000
113,341
114,114
Python-passing variable between classes
I'm trying to create a character generation wizard for a game. In one class I calculate the attributes of the character. In a different class, I'm displaying to the user which specialties are available based on the attributes of the character. However, I can't remember how to pass variables between different classes. H...
You may have "Class" and "Instance" confused. It's not clear from your example, so I'll presume that you're using a lot of class definitions and don't have appropriate object instances of those classes. Classes don't really have usable attribute values. A class is just a common set of definitions for a collection of ob...
Python-passing variable between classes I'm trying to create a character generation wizard for a game. In one class I calculate the attributes of the character. In a different class, I'm displaying to the user which specialties are available based on the attributes of the character. However, I can't remember how to pas...
TITLE: Python-passing variable between classes QUESTION: I'm trying to create a character generation wizard for a game. In one class I calculate the attributes of the character. In a different class, I'm displaying to the user which specialties are available based on the attributes of the character. However, I can't r...
[ "python", "oop", "variables", "wxpython" ]
3
8
24,176
5
0
2008-09-22T05:49:00.997000
2008-09-22T10:12:50.783000
113,349
469,697
Flex AdvancedDataGrid: How do I style the summary rows?
I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code:
in the past when I have need to do this I had to put a condition in my style function to try and determine if it is a summary row or not. public function dataGrid_styleFunction (data:Object, column:AdvancedDataGridColumn): Object { var output:Object; if ( data.children!= null ) { output = {color:0x081EA6, fontWeight:"...
Flex AdvancedDataGrid: How do I style the summary rows? I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code:
TITLE: Flex AdvancedDataGrid: How do I style the summary rows? QUESTION: I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code: ANSWER: in the past when I have need to do this I had to put a condition in my style function to try and dete...
[ "apache-flex" ]
2
3
13,218
5
0
2008-09-22T05:51:32.863000
2009-01-22T15:55:49.797000
113,352
118,622
OpenGL: projecting mouse click onto geometry
I have this view set: glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective and I get a screen position (sx, sy) from a mouse click. Given a value of z, how can I calculate x and y in 3d-space from sx and sy?
You should use gluUnProject: First, compute the "unprojection" to the near plane: GLdouble modelMatrix[16]; GLdouble projMatrix[16]; GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); glGetDoublev(GL_PROJECTION_MATRIX, projMatrix); GLdouble x, y, z; gluUnProject(s...
OpenGL: projecting mouse click onto geometry I have this view set: glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective and I get a screen position (sx, sy) from a mouse click. Given a value of z, how can I calculate x and y in 3d-space from sx and sy?
TITLE: OpenGL: projecting mouse click onto geometry QUESTION: I have this view set: glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective and I get a screen position (sx, sy) from a mouse click. Given a value of z, how can I calculate x and y in 3d-space from...
[ "opengl", "graphics" ]
9
11
8,409
1
0
2008-09-22T05:52:50.957000
2008-09-23T01:24:42.153000
113,365
113,377
How do you get the Eclipse Package Explorer to show files whose names begins with a . (period)?
When a folder in the Eclipse Package Explorer (one which is linked to a directory somewhere in the filesystem) contains files whose names begin with a. (period), those files do not appear. Can Eclipse be configured to show these files, and if so, how?
Click the down-arrow in the package explorer (next to the editor linker). Then you just change the filters. Unmark the box that says '.*' resources.
How do you get the Eclipse Package Explorer to show files whose names begins with a . (period)? When a folder in the Eclipse Package Explorer (one which is linked to a directory somewhere in the filesystem) contains files whose names begin with a. (period), those files do not appear. Can Eclipse be configured to show t...
TITLE: How do you get the Eclipse Package Explorer to show files whose names begins with a . (period)? QUESTION: When a folder in the Eclipse Package Explorer (one which is linked to a directory somewhere in the filesystem) contains files whose names begin with a. (period), those files do not appear. Can Eclipse be co...
[ "eclipse", "package-explorer" ]
2
6
7,879
1
0
2008-09-22T05:57:22.833000
2008-09-22T06:00:41
113,376
113,814
Character Limit in HTML
How do you impose a character limit on a text input in HTML?
There are 2 main solutions: The pure HTML one: The JavaScript one (attach it to a onKey Event): function limitText(limitField, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); } } But anyway, there is no good solution. You can not adapt to every client's ...
Character Limit in HTML How do you impose a character limit on a text input in HTML?
TITLE: Character Limit in HTML QUESTION: How do you impose a character limit on a text input in HTML? ANSWER: There are 2 main solutions: The pure HTML one: The JavaScript one (attach it to a onKey Event): function limitText(limitField, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitFie...
[ "html", "character-limit" ]
96
134
184,739
6
0
2008-09-22T05:59:59.893000
2008-09-22T08:35:34.230000
113,384
113,461
How do I determine the value of a generic parameter on my class instance
I have a marker interface defined as public interface IExtender { } I have a class that implements IExtender public class UserExtender: IExtender At runtime I recieve the UserExtender type as a parameter to my evaluating method public Type Evaluate(Type type) // type == typeof(UserExtender) How do I make my Evaluate me...
I went this way based on some of the tidbits provided. It could be made more robust to handle multiple generic arguments on the interface.... but I didn't need it to;) private static Type SafeGetSingleGenericParameter(Type type, Type interfaceType) { if (!interfaceType.IsGenericType || interfaceType.GetGenericArguments...
How do I determine the value of a generic parameter on my class instance I have a marker interface defined as public interface IExtender { } I have a class that implements IExtender public class UserExtender: IExtender At runtime I recieve the UserExtender type as a parameter to my evaluating method public Type Evaluat...
TITLE: How do I determine the value of a generic parameter on my class instance QUESTION: I have a marker interface defined as public interface IExtender { } I have a class that implements IExtender public class UserExtender: IExtender At runtime I recieve the UserExtender type as a parameter to my evaluating method p...
[ "c#", "generics", "reflection" ]
1
1
384
3
0
2008-09-22T06:04:02.567000
2008-09-22T06:27:08.220000
113,385
113,399
Declare an object even before that class is created
Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class. I realize that you may think I might get into an infinit...
You can't do something like this: class A { B b; }; class B { A a; }; The most obvious problem is the compiler doesn't know how to large it needs to make class A, because the size of B depends on the size of A! You can, however, do this: class B; // this is a "forward declaration" class A { B *b; }; class B { A a; }; D...
Declare an object even before that class is created Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class. I re...
TITLE: Declare an object even before that class is created QUESTION: Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the...
[ "c++", "class", "object", "instantiation" ]
12
44
16,552
5
0
2008-09-22T06:04:39.007000
2008-09-22T06:08:41.930000
113,392
113,515
Dynamically added controls in Asp.Net
I'm trying to wrap my head around asp.net. I have a background as a long time php developer, but I'm now facing the task of learning asp.net and I'm having some trouble with it. It might very well be because I'm trying to force the framework into something it is not intended for - so I'd like to learn how to do it "the...
I agree with the other points made here "If you can get out of creating controls dynamically, then do so..." (by @ Jesper Blad Jenson aka ) but here is a trick I worked out with dynamically created controls in the past. The problem becomes chicken and the egg. You need your ViewState to create the control tree and you ...
Dynamically added controls in Asp.Net I'm trying to wrap my head around asp.net. I have a background as a long time php developer, but I'm now facing the task of learning asp.net and I'm having some trouble with it. It might very well be because I'm trying to force the framework into something it is not intended for - ...
TITLE: Dynamically added controls in Asp.Net QUESTION: I'm trying to wrap my head around asp.net. I have a background as a long time php developer, but I'm now facing the task of learning asp.net and I'm having some trouble with it. It might very well be because I'm trying to force the framework into something it is n...
[ "asp.net", "web-user-controls" ]
11
9
9,503
9
0
2008-09-22T06:07:53.760000
2008-09-22T06:55:57.387000
113,395
113,466
How can I test for an expected exception with a specific exception message from a resource file in Visual Studio Test?
Visual Studio Test can check for expected exceptions using the ExpectedException attribute. You can pass in an exception like this: [TestMethod] [ExpectedException(typeof(CriticalException))] public void GetOrganisation_MultipleOrganisations_ThrowsException() You can also check for the message contained within the Expe...
Just an opinion, but I would say the error text: is part of the test, in which case getting it from the resource would be 'wrong' (otherwise you could end up with a consistantly mangled resource), so just update the test when you change the resource (or the test fails) is not part of the test, and you should only care ...
How can I test for an expected exception with a specific exception message from a resource file in Visual Studio Test? Visual Studio Test can check for expected exceptions using the ExpectedException attribute. You can pass in an exception like this: [TestMethod] [ExpectedException(typeof(CriticalException))] public vo...
TITLE: How can I test for an expected exception with a specific exception message from a resource file in Visual Studio Test? QUESTION: Visual Studio Test can check for expected exceptions using the ExpectedException attribute. You can pass in an exception like this: [TestMethod] [ExpectedException(typeof(CriticalExce...
[ "visual-studio", "unit-testing", "exception", "internationalization" ]
39
7
37,570
7
0
2008-09-22T06:08:15.553000
2008-09-22T06:28:54.457000
113,423
113,432
Good Secure Backups Developers at Home
What is a good, secure, method to do backups, for programmers who do research & development at home and cannot afford to lose any work? Conditions: The backups must ALWAYS be within reasonably easy reach. Internet connection cannot be guaranteed to be always available. The solution must be either FREE or priced within ...
usb hard disk + rsync works for me (see here for a Win32 build)
Good Secure Backups Developers at Home What is a good, secure, method to do backups, for programmers who do research & development at home and cannot afford to lose any work? Conditions: The backups must ALWAYS be within reasonably easy reach. Internet connection cannot be guaranteed to be always available. The solutio...
TITLE: Good Secure Backups Developers at Home QUESTION: What is a good, secure, method to do backups, for programmers who do research & development at home and cannot afford to lose any work? Conditions: The backups must ALWAYS be within reasonably easy reach. Internet connection cannot be guaranteed to be always avai...
[ "security", "backup" ]
36
12
3,827
23
0
2008-09-22T06:16:04.473000
2008-09-22T06:19:04.870000
113,424
113,442
Converting Reverse Polish Notation
Is there any way to interpret Reverse Polish Notation into "normal" mathematical notation when using either C++ or C#? I work for an engineering firm, so they use RPN occasionally and we need a way to convert it. Any suggestions?
Yes. Think of how a RPN calculator works. Now, instead of calculating the value, instead you add the operation to the tree. So, for example, 2 3 4 + *, when you get to the +, then rather than putting 7 on the stack, you put (+ 3 4) on the stack. And similarly when you get to the * (your stack will look like 2 (+ 3 4) *...
Converting Reverse Polish Notation Is there any way to interpret Reverse Polish Notation into "normal" mathematical notation when using either C++ or C#? I work for an engineering firm, so they use RPN occasionally and we need a way to convert it. Any suggestions?
TITLE: Converting Reverse Polish Notation QUESTION: Is there any way to interpret Reverse Polish Notation into "normal" mathematical notation when using either C++ or C#? I work for an engineering firm, so they use RPN occasionally and we need a way to convert it. Any suggestions? ANSWER: Yes. Think of how a RPN calc...
[ "c#", "c++", "rpn" ]
9
15
12,761
7
0
2008-09-22T06:16:10.573000
2008-09-22T06:22:55.877000
113,427
113,473
How to clear the scrollback in the screen command?
I use the screen command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore?
This thread has the following suggestion: In the window whose scrollback you want to delete, set the scrollback to zero, then return it to its normal value (in your case, 15000). If you want, you can bind this to a key: bind / eval "scrollback 0" "scrollback 15000" You can issue the scrollback 0 command from the sessio...
How to clear the scrollback in the screen command? I use the screen command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore?
TITLE: How to clear the scrollback in the screen command? QUESTION: I use the screen command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore? ANSWER: This thr...
[ "linux", "command-line", "gnu-screen" ]
36
61
32,364
7
0
2008-09-22T06:18:09.163000
2008-09-22T06:32:29.893000
113,437
113,488
iPhone application : is-it possible to use a "double" slider to select a price range
I'm working on an iphone application (not web app) and I'd like to build a form asking a user to indicate a price range. Instead of using two text fields, I would prefer to use a double slider to set the minimum and the maximum price. I know that it is possible de use a simple slider (sound control for exemple) but i'v...
This is not possible without creating a custom control. You'll need to inherit from UIControl or UIView and provide a custom drawRect method. You'll also need to respond to touch and drag events to update the state of the control. I have not done this myself, but I would be prepared for a fairly significant amount of w...
iPhone application : is-it possible to use a "double" slider to select a price range I'm working on an iphone application (not web app) and I'd like to build a form asking a user to indicate a price range. Instead of using two text fields, I would prefer to use a double slider to set the minimum and the maximum price. ...
TITLE: iPhone application : is-it possible to use a "double" slider to select a price range QUESTION: I'm working on an iphone application (not web app) and I'd like to build a form asking a user to indicate a price range. Instead of using two text fields, I would prefer to use a double slider to set the minimum and t...
[ "iphone", "user-interface", "slider" ]
5
4
2,084
3
0
2008-09-22T06:21:49.123000
2008-09-22T06:39:51.933000
113,440
113,448
Displaying code in blog posts
What libraries and/or packages have you used to create blog posts with code blocks? Having a JavaScript library that would support line numbers and indentation is ideal.
The GeSHi text highlighter is pretty awesome. If you're using WordPress, there's a plugin for you already
Displaying code in blog posts What libraries and/or packages have you used to create blog posts with code blocks? Having a JavaScript library that would support line numbers and indentation is ideal.
TITLE: Displaying code in blog posts QUESTION: What libraries and/or packages have you used to create blog posts with code blocks? Having a JavaScript library that would support line numbers and indentation is ideal. ANSWER: The GeSHi text highlighter is pretty awesome. If you're using WordPress, there's a plugin for...
[ "javascript", "syntax-highlighting" ]
9
7
671
9
0
2008-09-22T06:21:57.250000
2008-09-22T06:24:40.677000
113,464
113,882
Java User Interface Specification
Java supplies standard User Interface guidelines for applications built using Java Swing. The basic guidelines are good, but I really feel the look and feel is really boring and outdated. Is anyone aware of a publicly available Java User Interface Guide that has better look & feel guidelines than the Sun provided guide...
Along the line of Chii's answer, I would recommend taking a look at the Windows Vista User Experience Guidelines for general tips on making user interfaces. Although the name ("Windows Vista User Experience Guidelines") and source (Microsoft) may suggest that it only contains Windows-centric tips and advice, it does of...
Java User Interface Specification Java supplies standard User Interface guidelines for applications built using Java Swing. The basic guidelines are good, but I really feel the look and feel is really boring and outdated. Is anyone aware of a publicly available Java User Interface Guide that has better look & feel guid...
TITLE: Java User Interface Specification QUESTION: Java supplies standard User Interface guidelines for applications built using Java Swing. The basic guidelines are good, but I really feel the look and feel is really boring and outdated. Is anyone aware of a publicly available Java User Interface Guide that has bette...
[ "java", "swing", "user-interface" ]
3
3
2,036
4
0
2008-09-22T06:28:12.477000
2008-09-22T08:56:31.030000
113,479
113,521
When to enable/disable Viewstate
I generaly disable viewstate for my ASP.net controls unless I explicitly know I am going to require view state for them. I have found that this can significantly reduce the page size of the HTML generated. Is this good practice? When should be enabled or disabled?
Yes it is a very good idea. One could argue that it should have been disabled by default by Microsoft, just like caching. To see how bad Viewstate is in terms of size increased you can use a tool called Viewstate Analyzer. This is particularly useful when you have an existing application developed with Viewstate enable...
When to enable/disable Viewstate I generaly disable viewstate for my ASP.net controls unless I explicitly know I am going to require view state for them. I have found that this can significantly reduce the page size of the HTML generated. Is this good practice? When should be enabled or disabled?
TITLE: When to enable/disable Viewstate QUESTION: I generaly disable viewstate for my ASP.net controls unless I explicitly know I am going to require view state for them. I have found that this can significantly reduce the page size of the HTML generated. Is this good practice? When should be enabled or disabled? ANS...
[ "asp.net", "web-user-controls" ]
17
20
3,694
6
0
2008-09-22T06:35:13.273000
2008-09-22T06:57:12.690000
113,489
128,895
Getting IIS6 to play nice with WordPress Pretty Permalinks
I've got a WordPress powered blog that I'm trying to get setup on our IIS6 server and everything works besides the permalink structure which I'm having a big headache with. After googling around/wordpress codex I learned that it's because IIS6 doesn't have the equivalent of Apache's mod_rewrite which is required for th...
I just came across the following answer on another question: Pretty URLs for search pages Hope that helps!
Getting IIS6 to play nice with WordPress Pretty Permalinks I've got a WordPress powered blog that I'm trying to get setup on our IIS6 server and everything works besides the permalink structure which I'm having a big headache with. After googling around/wordpress codex I learned that it's because IIS6 doesn't have the ...
TITLE: Getting IIS6 to play nice with WordPress Pretty Permalinks QUESTION: I've got a WordPress powered blog that I'm trying to get setup on our IIS6 server and everything works besides the permalink structure which I'm having a big headache with. After googling around/wordpress codex I learned that it's because IIS6...
[ "wordpress", "mod-rewrite", "iis-6", "permalinks" ]
2
1
5,082
5
0
2008-09-22T06:40:21.387000
2008-09-24T18:23:54.423000
113,504
113,514
Bad reference to an object already freed
Is there a way to be sure we hold a useable reference to an object i.e. being sure it has not been already freed leaving that non nil reference dangling.
If you're using FastMM4 as your Memory Manager, you can check that the class is not TFreeObject. Or, in a more standard case, use a routine that will verify that your object is what it says it is by checking the class VMT. There have been such ValidateObj functions hannging around for some time (by Ray Lischner and Hal...
Bad reference to an object already freed Is there a way to be sure we hold a useable reference to an object i.e. being sure it has not been already freed leaving that non nil reference dangling.
TITLE: Bad reference to an object already freed QUESTION: Is there a way to be sure we hold a useable reference to an object i.e. being sure it has not been already freed leaving that non nil reference dangling. ANSWER: If you're using FastMM4 as your Memory Manager, you can check that the class is not TFreeObject. O...
[ "delphi" ]
6
6
2,261
7
0
2008-09-22T06:49:24.720000
2008-09-22T06:55:07.157000
113,507
210,769
Including a WebService reference in a control
I've written a control in C# that overrides the built-in DropDownList control. For this I need a javascript resource included, which I'm including as an embedded resource then adding the WebResource attribute, which works fine. However, I also need to reference a webservice, which I would normally include in the script...
You can add a ScriptManagerProxy in the code or the markup of your control and add the service reference through it. The settings in the ScriptManagerProxy are merged with the "real" ScriptManager at compile time.
Including a WebService reference in a control I've written a control in C# that overrides the built-in DropDownList control. For this I need a javascript resource included, which I'm including as an embedded resource then adding the WebResource attribute, which works fine. However, I also need to reference a webservice...
TITLE: Including a WebService reference in a control QUESTION: I've written a control in C# that overrides the built-in DropDownList control. For this I need a javascript resource included, which I'm including as an embedded resource then adding the WebResource attribute, which works fine. However, I also need to refe...
[ "c#", ".net", "javascript", "ajax", "web-services" ]
0
2
703
3
0
2008-09-22T06:52:21.983000
2008-10-17T00:46:39.180000
113,511
113,600
Best implementation for hashCode method for a collection
How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly)?
The best implementation? That is a hard question because it depends on the usage pattern. A for nearly all cases reasonable good implementation was proposed in Josh Bloch 's Effective Java in Item 8 (second edition). The best thing is to look it up there because the author explains there why the approach is good. A sho...
Best implementation for hashCode method for a collection How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly)?
TITLE: Best implementation for hashCode method for a collection QUESTION: How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly)? ANSWER: The best implementation? That is a hard question because it depends on the usage pattern. A f...
[ "java", "hash", "equals", "hashcode" ]
327
475
280,718
20
0
2008-09-22T06:53:35.333000
2008-09-22T07:22:13.707000
113,526
113,606
Potential legal issues with storing Social Security/Insurance Numbers (SSNs/SINs)?
A client using our system has requested that we store the SSNs/SINs of the end users in our database. Currently, we store minimal information about users (name, email address, and optionally, country), so I'm not overly concerned about a security breach - however, I have a suspicion there could be legal issues about st...
The baseline recommendation would be to: Inform the user that you are storing their SSN before they use your site/application. Since the request appears to be to collect the information after the fact, the users should have a way to opt out of your system before they log in or before they put in their SSN Issue a legal...
Potential legal issues with storing Social Security/Insurance Numbers (SSNs/SINs)? A client using our system has requested that we store the SSNs/SINs of the end users in our database. Currently, we store minimal information about users (name, email address, and optionally, country), so I'm not overly concerned about a...
TITLE: Potential legal issues with storing Social Security/Insurance Numbers (SSNs/SINs)? QUESTION: A client using our system has requested that we store the SSNs/SINs of the end users in our database. Currently, we store minimal information about users (name, email address, and optionally, country), so I'm not overly...
[ "security" ]
7
4
7,899
6
0
2008-09-22T06:59:12.963000
2008-09-22T07:23:22.440000
113,531
113,570
Running SQL Server on the Web Server
Is it good, bad, or indifferent to run SQL Server on your webserver? I'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question.
For small sites, it doesn't make a bit of a difference. As the load grows, though, this scales really badly, and quicker than you think: Database servers are built on the premise they "own" the server. They trade memory for speed and they easily use all available RAM for internal caching. Once resources start to be sca...
Running SQL Server on the Web Server Is it good, bad, or indifferent to run SQL Server on your webserver? I'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question.
TITLE: Running SQL Server on the Web Server QUESTION: Is it good, bad, or indifferent to run SQL Server on your webserver? I'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question. ANSWER: For small sites, it doesn't make a bit of a difference. As the load grows, though, this scales ...
[ "sql-server", "optimization", "webserver" ]
4
13
6,934
7
0
2008-09-22T07:01:18.780000
2008-09-22T07:13:23.743000
113,534
113,555
Is there a function in Python to split a string without ignoring the spaces?
Is there a function in Python to split a string without ignoring the spaces in the resulting list? E.g: s="This is the string I want to split".split() gives me >>> s ['This', 'is', 'the', 'string', 'I', 'want', 'to', 'split'] I want something like ['This',' ','is',' ', 'the',' ','string', ' ',.....]
>>> import re >>> re.split(r"(\s+)", "This is the string I want to split") ['This', ' ', 'is', ' ', 'the', ' ', 'string', ' ', 'I', ' ', 'want', ' ', 'to', ' ', 'split'] Using the capturing parentheses in re.split() causes the function to return the separators as well.
Is there a function in Python to split a string without ignoring the spaces? Is there a function in Python to split a string without ignoring the spaces in the resulting list? E.g: s="This is the string I want to split".split() gives me >>> s ['This', 'is', 'the', 'string', 'I', 'want', 'to', 'split'] I want something ...
TITLE: Is there a function in Python to split a string without ignoring the spaces? QUESTION: Is there a function in Python to split a string without ignoring the spaces in the resulting list? E.g: s="This is the string I want to split".split() gives me >>> s ['This', 'is', 'the', 'string', 'I', 'want', 'to', 'split']...
[ "python", "split" ]
12
41
18,730
4
0
2008-09-22T07:02:04.830000
2008-09-22T07:08:04.677000
113,542
113,584
How can I uninstall an application using PowerShell?
Is there a simple way to hook into the standard ' Add or Remove Programs ' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed?
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Software Name" } $app.Uninstall() Edit: Rob found another way to do it with the Filter parameter: $app = Get-WmiObject -Class Win32_Product ` -Filter "Name = 'Software Name'"
How can I uninstall an application using PowerShell? Is there a simple way to hook into the standard ' Add or Remove Programs ' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed?
TITLE: How can I uninstall an application using PowerShell? QUESTION: Is there a simple way to hook into the standard ' Add or Remove Programs ' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed? ANSWER: $app = Get-WmiObject -Class Win32_Product | Where-O...
[ "windows", "powershell", "windows-installer", "uninstallation" ]
150
178
419,717
15
0
2008-09-22T07:04:06.977000
2008-09-22T07:17:01.330000
113,543
113,607
Role Based Access Control
Is there any open-source, PHP based, role-based access control system that can be used for CodeIgniter?
Brandon Savage gave a presentation on his PHP package " ApplicationACL " that may or may not accomplish role-based access. PHPGACL might work as well, but I can't tell you for sure. What I can tell you, however, is the Zend_ACL component of the Zend Framework will do role-based setups (however you'll have to subclass t...
Role Based Access Control Is there any open-source, PHP based, role-based access control system that can be used for CodeIgniter?
TITLE: Role Based Access Control QUESTION: Is there any open-source, PHP based, role-based access control system that can be used for CodeIgniter? ANSWER: Brandon Savage gave a presentation on his PHP package " ApplicationACL " that may or may not accomplish role-based access. PHPGACL might work as well, but I can't ...
[ "php", "codeigniter", "access-control" ]
26
12
45,567
11
0
2008-09-22T07:04:12.033000
2008-09-22T07:23:25.730000
113,565
113,577
Why Re-throw Exceptions?
I've seen the following code many times: try {... // some code } catch (Exception ex) {... // Do something throw new CustomException(ex); // or // throw; // or // throw ex; } Can you please explain the purpose of re-throwing an exception? Is it following a pattern/best practice in exception handling? (I've read somew...
Rethrowing the same exception is useful if you want to, say, log the exception, but not handle it. Throwing a new exception that wraps the caught exception is good for abstraction. e.g., your library uses a third-party library that throws an exception that the clients of your library shouldn't know about. In that case,...
Why Re-throw Exceptions? I've seen the following code many times: try {... // some code } catch (Exception ex) {... // Do something throw new CustomException(ex); // or // throw; // or // throw ex; } Can you please explain the purpose of re-throwing an exception? Is it following a pattern/best practice in exception h...
TITLE: Why Re-throw Exceptions? QUESTION: I've seen the following code many times: try {... // some code } catch (Exception ex) {... // Do something throw new CustomException(ex); // or // throw; // or // throw ex; } Can you please explain the purpose of re-throwing an exception? Is it following a pattern/best pract...
[ "language-agnostic", "exception" ]
37
44
15,015
13
0
2008-09-22T07:11:16.680000
2008-09-22T07:15:12.193000
113,582
116,735
Attaching Informix .dat and .idx files
We are trying to duplicate one of our informix database on a test server, but without Informix expertise in house we can only guess what we need to do. I am learning this stuff on the fly myself and nowhere near the expertise level needed to operate Informix efficiently or even inefficiently. Anyhow... We managed to co...
You've asked a pretty complicated question without realizing it. Informix is architected as a shared everything database engine, meaning all resources available to the instance are available to every database in that instance. This means that more than one database can store data in any given dbspace,.dat or.idx file i...
Attaching Informix .dat and .idx files We are trying to duplicate one of our informix database on a test server, but without Informix expertise in house we can only guess what we need to do. I am learning this stuff on the fly myself and nowhere near the expertise level needed to operate Informix efficiently or even in...
TITLE: Attaching Informix .dat and .idx files QUESTION: We are trying to duplicate one of our informix database on a test server, but without Informix expertise in house we can only guess what we need to do. I am learning this stuff on the fly myself and nowhere near the expertise level needed to operate Informix effi...
[ "import", "export", "informix" ]
1
1
7,079
4
0
2008-09-22T07:16:40.847000
2008-09-22T18:49:46.580000
113,592
113,623
Getting user name/password of the logged in user in Windows
Is there any API to get the currently logged in user's name and password in Windows? Thank you in advance.
Password: No, this is not retained for security reasons - it's used, then discarded. You could retrieve the encrypted password for this user from the registry, given sufficient privileges, then decrypt it using something like rainbow tables, but that's extremely resource intensive and time consuming using current metho...
Getting user name/password of the logged in user in Windows Is there any API to get the currently logged in user's name and password in Windows? Thank you in advance.
TITLE: Getting user name/password of the logged in user in Windows QUESTION: Is there any API to get the currently logged in user's name and password in Windows? Thank you in advance. ANSWER: Password: No, this is not retained for security reasons - it's used, then discarded. You could retrieve the encrypted password...
[ "winapi", "visual-c++", "mfc" ]
10
30
85,172
10
0
2008-09-22T07:18:49.970000
2008-09-22T07:29:41.427000
113,609
113,648
Why is ENUM better than INT
I just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs). And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically static and won't change in the future, but if they ...
Put simply, it's because it's indexed in a different way. In this case, ENUM says "It's one of these 13 values" whereas INT is saying "It could be any integer." This means that indexing is easier, as it doesn't have to take into account indexing for those integers you don't use "just in case" you ever use them. It's al...
Why is ENUM better than INT I just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs). And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically static and won't change...
TITLE: Why is ENUM better than INT QUESTION: I just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs). And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically stati...
[ "mysql" ]
24
29
10,098
5
0
2008-09-22T07:24:08.287000
2008-09-22T07:38:30.843000
113,640
113,667
Which CSS tag creates a box like this with title?
I want to create a box like this with title: Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?
I believe you are looking for the fieldset HTML tag, which you can then style with CSS. E.g., title Text within the box Etc
Which CSS tag creates a box like this with title? I want to create a box like this with title: Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?
TITLE: Which CSS tag creates a box like this with title? QUESTION: I want to create a box like this with title: Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style? ANSWER: I believe you are looking for the fieldset HTML tag, which you can then style with CS...
[ "html", "css", "fieldset", "legend" ]
59
76
78,904
7
0
2008-09-22T07:35:51.753000
2008-09-22T07:42:46.697000
113,644
114,181
Property Grid Object failing on combo box selection but OK when combobox scrolled or double clicked
I have a Property Grid in C#, loading up a 'PropertyAdapter' object (a basic wrapper around one of my objects displaying relevant properties with the appropriate tags) I have a TypeConverter on one of the properties (DataType, that returns an enumeration of possible values) as I want to limit the values available to th...
When selected from the combo box drop down, the value is returned as string. I am not sure why that is, but I've seen in happen before. I think that basically double clicking or scrolling the mousewheel changes values from the value collection, while selecting from the drop down is like editing the field value as a str...
Property Grid Object failing on combo box selection but OK when combobox scrolled or double clicked I have a Property Grid in C#, loading up a 'PropertyAdapter' object (a basic wrapper around one of my objects displaying relevant properties with the appropriate tags) I have a TypeConverter on one of the properties (Dat...
TITLE: Property Grid Object failing on combo box selection but OK when combobox scrolled or double clicked QUESTION: I have a Property Grid in C#, loading up a 'PropertyAdapter' object (a basic wrapper around one of my objects displaying relevant properties with the appropriate tags) I have a TypeConverter on one of t...
[ "c#", "winforms", "propertygrid" ]
1
3
2,350
1
0
2008-09-22T07:36:53.687000
2008-09-22T10:38:34.140000
113,645
129,966
VS 2003 CrystalReports - details section issue
I have 2 detail sections on my report (details a and details b). Fields in both sections can grow up to 10 lines. How do I force the Crystal Report to print both sections on one page? Currently the report on bottom page print section "details a", but section "details b" prints on next page. How do I prevent this behavi...
You does not need an extra group. You can set on the detail area (node over the sections) the flag keep together.
VS 2003 CrystalReports - details section issue I have 2 detail sections on my report (details a and details b). Fields in both sections can grow up to 10 lines. How do I force the Crystal Report to print both sections on one page? Currently the report on bottom page print section "details a", but section "details b" pr...
TITLE: VS 2003 CrystalReports - details section issue QUESTION: I have 2 detail sections on my report (details a and details b). Fields in both sections can grow up to 10 lines. How do I force the Crystal Report to print both sections on one page? Currently the report on bottom page print section "details a", but sect...
[ "crystal-reports", "visual-studio-2003" ]
0
0
512
2
0
2008-09-22T07:37:39.160000
2008-09-24T21:03:30.967000
113,655
113,662
Is there a function in python to split a word into a list?
Is there a function in python to split a word into a list of single letters? e.g: s = "Word to Split" to get wordlist = ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
>>> list("Word to Split") ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
Is there a function in python to split a word into a list? Is there a function in python to split a word into a list of single letters? e.g: s = "Word to Split" to get wordlist = ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
TITLE: Is there a function in python to split a word into a list? QUESTION: Is there a function in python to split a word into a list of single letters? e.g: s = "Word to Split" to get wordlist = ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't'] ANSWER: >>> list("Word to Split") ['W', 'o', 'r', 'd', '...
[ "python", "function", "split" ]
120
263
376,074
7
0
2008-09-22T07:40:50.853000
2008-09-22T07:42:15.607000
113,682
113,703
Hiding toolbar / status bar with javascript in CURRENT browser window?
Is there some way to hide the browser toolbar / statusbar etc in current window via javascript? I know I can do it in a popup with window.open() but I need to do it this way. Is it possible at all?
As per the previous answer, this isn't possible to my knowledge and is best avoided anyway. Even if a solution can be found, bear in mind that most browsers these days allow the user to prevent Javascript from interfering with their browser settings and window chrome, even when using window.open. So you've got absolute...
Hiding toolbar / status bar with javascript in CURRENT browser window? Is there some way to hide the browser toolbar / statusbar etc in current window via javascript? I know I can do it in a popup with window.open() but I need to do it this way. Is it possible at all?
TITLE: Hiding toolbar / status bar with javascript in CURRENT browser window? QUESTION: Is there some way to hide the browser toolbar / statusbar etc in current window via javascript? I know I can do it in a popup with window.open() but I need to do it this way. Is it possible at all? ANSWER: As per the previous answ...
[ "javascript", "user-interface" ]
0
3
12,710
6
0
2008-09-22T07:47:33.753000
2008-09-22T07:55:13.487000
113,696
113,709
How not to repeat yourself across projects and/or languages
I'm working on several distinct but related projects in different programming languages. Some of these projects need to parse filenames written by other projects, and expect a certain filename pattern. This pattern is now hardcoded in several places and in several languages, making it a maintenance bomb. It is fairly e...
Creating a Domain Specific Language, then compile that into the code for each of the target languages that you are using would be the best solution (and most elegant). Its not difficult to make a DSL - wither embed it in something (like inside Ruby since its the 'in' thing right now, or another language like LISP/Haske...
How not to repeat yourself across projects and/or languages I'm working on several distinct but related projects in different programming languages. Some of these projects need to parse filenames written by other projects, and expect a certain filename pattern. This pattern is now hardcoded in several places and in sev...
TITLE: How not to repeat yourself across projects and/or languages QUESTION: I'm working on several distinct but related projects in different programming languages. Some of these projects need to parse filenames written by other projects, and expect a certain filename pattern. This pattern is now hardcoded in several...
[ "dry", "maintainability" ]
1
1
356
5
0
2008-09-22T07:53:47.670000
2008-09-22T07:56:58.503000
113,702
113,740
How do I add a "last" class on the last <li> within a Views-generated list?
How do I add a "last" class on the last within a Views-generated list?
You could use the last-child pseudo-class on the li element to achieve this IE Firefox Safari There is also a first-child pseudo class available. I am not sure the last-child element works in IE though.
How do I add a "last" class on the last <li> within a Views-generated list? How do I add a "last" class on the last within a Views-generated list?
TITLE: How do I add a "last" class on the last <li> within a Views-generated list? QUESTION: How do I add a "last" class on the last within a Views-generated list? ANSWER: You could use the last-child pseudo-class on the li element to achieve this IE Firefox Safari There is also a first-child pseudo class available. ...
[ "css", "drupal" ]
5
9
28,741
4
0
2008-09-22T07:55:08.807000
2008-09-22T08:06:28.420000
113,712
113,752
LocBaml include previous translations
Is there a way to combine a previous translation when extracting the csv file from an application? Or any other tool that could do this job for me? I can’t really see how could i use locbaml if i had to translate everything from scratch every time i add a new control in my application.
You might consider using something like WinMerge to merge the existing file with the old one.
LocBaml include previous translations Is there a way to combine a previous translation when extracting the csv file from an application? Or any other tool that could do this job for me? I can’t really see how could i use locbaml if i had to translate everything from scratch every time i add a new control in my applicat...
TITLE: LocBaml include previous translations QUESTION: Is there a way to combine a previous translation when extracting the csv file from an application? Or any other tool that could do this job for me? I can’t really see how could i use locbaml if i had to translate everything from scratch every time i add a new cont...
[ "wpf" ]
0
0
162
2
0
2008-09-22T07:57:47.147000
2008-09-22T08:12:31.917000
113,723
113,727
Simple database application for Windows
I need to build a simple, single user database application for Windows. Main requirements are independence from windows version and installed software. What technologies (language/framework) would you recommend? My preference for language is the Visual Basic. EDIT: What about VB.Net and SQL Server Compact Edition?
I would recommend Sqlite. It's completely self-contained, and public domain so there are no license issues at all.
Simple database application for Windows I need to build a simple, single user database application for Windows. Main requirements are independence from windows version and installed software. What technologies (language/framework) would you recommend? My preference for language is the Visual Basic. EDIT: What about VB....
TITLE: Simple database application for Windows QUESTION: I need to build a simple, single user database application for Windows. Main requirements are independence from windows version and installed software. What technologies (language/framework) would you recommend? My preference for language is the Visual Basic. ED...
[ "windows", "database", "embedded-database" ]
13
18
20,267
20
0
2008-09-22T08:01:42.517000
2008-09-22T08:03:02.530000
113,728
113,774
PHP webpage doesn't launch unix command even after updated sudoers
Basically I am trying to restart a service from a php web page. Here is the code: But, in /var/log/httpd/error_log, I get unable to change to sudoers gid: Operation not permitted and in /var/log/messages, I get Sep 22 15:01:56 ri kernel: audit(1222063316.536:777): avc: denied { getattr } for pid=4851 comm="sh" name="va...
The problem is not with sudo at the moment, but with SELinux, which is (reasonably) set to deny the HTTPD from gaining root privileges. You will need to either explicitly allow this (you can use audit2allow for this), or set SELinux to be permissive instead. I'd suggest the former.
PHP webpage doesn't launch unix command even after updated sudoers Basically I am trying to restart a service from a php web page. Here is the code: But, in /var/log/httpd/error_log, I get unable to change to sudoers gid: Operation not permitted and in /var/log/messages, I get Sep 22 15:01:56 ri kernel: audit(122206331...
TITLE: PHP webpage doesn't launch unix command even after updated sudoers QUESTION: Basically I am trying to restart a service from a php web page. Here is the code: But, in /var/log/httpd/error_log, I get unable to change to sudoers gid: Operation not permitted and in /var/log/messages, I get Sep 22 15:01:56 ri kerne...
[ "php", "exec", "sudo" ]
2
11
13,183
4
0
2008-09-22T08:03:05.027000
2008-09-22T08:20:10.913000
113,730
113,762
How do I run a script when ip-address changes (most likely using a dhclient hook) on a (Ubuntu) Linux machine?
I have a script which contacts a few sources and tell them "the IP-address XXX.XXX.XXX.XXX is my current one". My test web server has a dynamic IP-address through DHCP and amongst other things it needs to update a DDNS entry when its IP-address changes. However it's not the only thing it does, so I will need to run my ...
I would recommend to put the script into dhclient-exit-hooks.d. Because you should just change the DDNS entry, if the address change has been finished. However, I am not sure if dhclient-exit-hooks are called, if assigning an address fails. Edit: The man pages (man dhclient-script) says, that the exit-hooks script will...
How do I run a script when ip-address changes (most likely using a dhclient hook) on a (Ubuntu) Linux machine? I have a script which contacts a few sources and tell them "the IP-address XXX.XXX.XXX.XXX is my current one". My test web server has a dynamic IP-address through DHCP and amongst other things it needs to upda...
TITLE: How do I run a script when ip-address changes (most likely using a dhclient hook) on a (Ubuntu) Linux machine? QUESTION: I have a script which contacts a few sources and tell them "the IP-address XXX.XXX.XXX.XXX is my current one". My test web server has a dynamic IP-address through DHCP and amongst other thing...
[ "linux", "unix", "hook", "dhcp" ]
3
5
3,468
1
0
2008-09-22T08:03:27.443000
2008-09-22T08:15:25.857000
113,731
113,759
CruiseControl.NET post-build actions
We have CC.NET setup on our ASP.NET app. When we build the project, the ASP.NET app is pre-compiled and copied to a network share, from which a server runs the application. The server is a bit different from development box'es, and the next server in our staging environment differs even more. The difference is specific...
You have to use NAnt for those kind of stuff. Here is the Task Reference of Nant..
CruiseControl.NET post-build actions We have CC.NET setup on our ASP.NET app. When we build the project, the ASP.NET app is pre-compiled and copied to a network share, from which a server runs the application. The server is a bit different from development box'es, and the next server in our staging environment differs ...
TITLE: CruiseControl.NET post-build actions QUESTION: We have CC.NET setup on our ASP.NET app. When we build the project, the ASP.NET app is pre-compiled and copied to a network share, from which a server runs the application. The server is a bit different from development box'es, and the next server in our staging en...
[ "cruisecontrol.net" ]
0
0
3,520
4
0
2008-09-22T08:03:53.667000
2008-09-22T08:14:24.530000
113,737
140,989
How do I use PowerShell to stop and start a clustered "Generic Service"?
How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software?
You can also use WMI. You can get all the Generic Services with: $services = Get-WmiObject -Computer "Computer" -namespace 'root\mscluster' ` MSCluster_Resource | Where {$_.Type -eq "Generic Service"} To stop and start a service: $timeout = 15 $services[0].TakeOffline($timeout) $services[0].BringOnline($timeout)
How do I use PowerShell to stop and start a clustered "Generic Service"? How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software?
TITLE: How do I use PowerShell to stop and start a clustered "Generic Service"? QUESTION: How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software? ANSWER: You can also use WMI. You can get all the Generic Services with: $services = Get-WmiObject -Compute...
[ "powershell" ]
2
5
4,135
2
0
2008-09-22T08:05:19.890000
2008-09-26T17:57:42.807000
113,755
114,484
Programmatically add an application to Windows Firewall
I have an application that is installed and updated via ClickOnce. The application downloads files via FTP, and therefore needs to be added as an exception to the windows firewall. Because of the way that ClickOnce works, the path to the EXE changes with every update, so the exception needs to change also. What would b...
I found this article, which has a complete wrapper class included for manipulating the windows firewall. Adding an Application to the Exception list on the Windows Firewall /// /// Allows basic access to the windows firewall API. /// This can be used to add an exception to the windows firewall /// exceptions list, so ...
Programmatically add an application to Windows Firewall I have an application that is installed and updated via ClickOnce. The application downloads files via FTP, and therefore needs to be added as an exception to the windows firewall. Because of the way that ClickOnce works, the path to the EXE changes with every upd...
TITLE: Programmatically add an application to Windows Firewall QUESTION: I have an application that is installed and updated via ClickOnce. The application downloads files via FTP, and therefore needs to be added as an exception to the windows firewall. Because of the way that ClickOnce works, the path to the EXE chan...
[ "c#", "windows", "firewall" ]
29
18
61,701
8
0
2008-09-22T08:13:38.200000
2008-09-22T12:11:27.193000
113,765
114,528
Is there any way to inherit the existing TLD definition for particular JSP Tag?
I am planning to extend the basic html input tag provided by Spring to incorporate more features into it. I did similar kind of exercise in past for Struts too. At that point of time I had to create a tld file with the attributes that I introduced plus all the attributes available in the parent tag. This is bit tiresom...
I don't think there is an option to inherit a TLD definition. The shortest solution, i think, will be to inherit the tag class and change the tld to your new (derived) class.
Is there any way to inherit the existing TLD definition for particular JSP Tag? I am planning to extend the basic html input tag provided by Spring to incorporate more features into it. I did similar kind of exercise in past for Struts too. At that point of time I had to create a tld file with the attributes that I int...
TITLE: Is there any way to inherit the existing TLD definition for particular JSP Tag? QUESTION: I am planning to extend the basic html input tag provided by Spring to incorporate more features into it. I did similar kind of exercise in past for Struts too. At that point of time I had to create a tld file with the att...
[ "jsp", "tags" ]
5
3
725
1
0
2008-09-22T08:16:40.267000
2008-09-22T12:25:11.887000
113,780
114,030
JavaScript curry: what are the practical applications?
I don’t think I’ve grokked currying yet. I understand what it does, and how to do it. I just can’t think of a situation I would use it. Where are you using currying in JavaScript (or where are the main libraries using it)? DOM manipulation or general application development examples welcome. One of the answers mentions...
@Hank Gay In response to EmbiggensTheMind's comment: I can't think of an instance where currying —by itself—is useful in JavaScript; it is a technique for converting function calls with multiple arguments into chains of function calls with a single argument for each call, but JavaScript supports multiple arguments in a...
JavaScript curry: what are the practical applications? I don’t think I’ve grokked currying yet. I understand what it does, and how to do it. I just can’t think of a situation I would use it. Where are you using currying in JavaScript (or where are the main libraries using it)? DOM manipulation or general application de...
TITLE: JavaScript curry: what are the practical applications? QUESTION: I don’t think I’ve grokked currying yet. I understand what it does, and how to do it. I just can’t think of a situation I would use it. Where are you using currying in JavaScript (or where are the main libraries using it)? DOM manipulation or gene...
[ "javascript", "function", "currying", "partial-application" ]
191
37
49,553
17
0
2008-09-22T08:22:06.183000
2008-09-22T09:47:20.220000
113,803
113,858
MySQL foreign keys - how to enforce one-to-one across tables?
If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enforce the one-to-one relationship between the derived table and the base table, or ...
To make sure that a product is or a cd or a dvd I would add a type column and make it part of the primary key. In the derived column you add a check constraint for the type. In the example I set cd to 1 and you could make dvd = 2 and so on for each derived table. CREATE TABLE IF NOT EXISTS `product` ( `product_id` int(...
MySQL foreign keys - how to enforce one-to-one across tables? If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enforce the one-to-one ...
TITLE: MySQL foreign keys - how to enforce one-to-one across tables? QUESTION: If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enfor...
[ "mysql" ]
6
3
18,926
6
0
2008-09-22T08:29:30.283000
2008-09-22T08:49:07.677000
113,818
113,879
Class library with support for several persistence strategies
I am developing a C++ class library containing domain model classes, and I would like to add support for instantiating these classes from various persistence mechanisms, i.e. databases and file. The user of the class library should be given an interface(?) against which to program a class that can transfer the data fro...
C++ supports multiple inheritance so you can have a generic persistence API and inherit a persistence mechanism. This would still have to use introspection to get out the class metadata, but you would still have this issue with any persistence layer. Alternatively you could do something similar but use the metadata to ...
Class library with support for several persistence strategies I am developing a C++ class library containing domain model classes, and I would like to add support for instantiating these classes from various persistence mechanisms, i.e. databases and file. The user of the class library should be given an interface(?) a...
TITLE: Class library with support for several persistence strategies QUESTION: I am developing a C++ class library containing domain model classes, and I would like to add support for instantiating these classes from various persistence mechanisms, i.e. databases and file. The user of the class library should be given...
[ "c++", "design-patterns", "persistence" ]
2
1
715
4
0
2008-09-22T08:37:34.977000
2008-09-22T08:54:55.777000
113,830
113,843
Performance penalty for working with interfaces in C++?
Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?
Short Answer: No. Long Answer: It is not the base class or the number of ancestors a class has in its hierarchy that affects it speed. The only thing is the cost of a method call. A non virtual method call has a cost (but can be inlined) A virtual method call has a slightly higher cost as you need to look up the method...
Performance penalty for working with interfaces in C++? Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?
TITLE: Performance penalty for working with interfaces in C++? QUESTION: Is there a runtime performance penalty when using interfaces (abstract base classes) in C++? ANSWER: Short Answer: No. Long Answer: It is not the base class or the number of ancestors a class has in its hierarchy that affects it speed. The only ...
[ "c++", "performance", "abstract-class", "virtual-functions" ]
50
50
17,856
16
0
2008-09-22T08:41:37.150000
2008-09-22T08:45:47.107000
113,845
113,887
insert data from database into word according to the table format in the word
now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the code, is it possible to do this without word process start?if not are there any template engine...
You may want to look at a custom document writer, rather than using the COM Wrapped API from Microsoft. I have heard good things about OfficeWriter. It's not free, but speed never is. It doesn't require Word on the server. http://officewriter.softartisans.com/officewriter-59.aspx
insert data from database into word according to the table format in the word now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the code, is it possi...
TITLE: insert data from database into word according to the table format in the word QUESTION: now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the...
[ "database", "ms-word" ]
4
0
5,333
4
0
2008-09-22T08:46:11.583000
2008-09-22T08:58:27.157000
113,859
113,868
SVN ignore versioned on update
I have this setup where in my development copy I can commit changes on a certain file to the repository. Then in my production copy, which does checkouts only, I would normally edit this file because this contains references which are environment independent. Is there any way I can ignore this file on the subsequent ch...
I would suggest renaming the file in the repository from config.php to config.php.sample. This is the file that you would edit to change the default options. For deployment, either to your development environment or to the production server, you would copy config.php.sample to config.php and edit it without worrying ab...
SVN ignore versioned on update I have this setup where in my development copy I can commit changes on a certain file to the repository. Then in my production copy, which does checkouts only, I would normally edit this file because this contains references which are environment independent. Is there any way I can ignore...
TITLE: SVN ignore versioned on update QUESTION: I have this setup where in my development copy I can commit changes on a certain file to the repository. Then in my production copy, which does checkouts only, I would normally edit this file because this contains references which are environment independent. Is there an...
[ "svn" ]
3
9
2,241
3
0
2008-09-22T08:49:14.247000
2008-09-22T08:52:10.620000
113,860
154,559
How to check if an OLEDB driver is installed on the system?
How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendly. There are probably a nice little function that returns all i...
Each provider has a GUID associated with its class. To find the guid, open regedit and search the registry for the provider name. For example, search for "Microsoft Jet 4.0 OLE DB Provider". When you find it, copy the key (the GUID value) and use that in a registry search in your application. function OleDBExists: bool...
How to check if an OLEDB driver is installed on the system? How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendly. ...
TITLE: How to check if an OLEDB driver is installed on the system? QUESTION: How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always th...
[ "delphi", "oledb", "ado" ]
19
3
78,023
6
0
2008-09-22T08:50:08.860000
2008-09-30T19:26:24.137000
113,866
114,077
What does "Optimize Code" option really do in Visual Studio?
Name of the option tells something but what Visual Studio/compiler really do and what are the real consequences? Edit: If you search google you can find this address, but that is not really I am looking for. I wonder the real things happening. For example why do the loops get less time, etc.
Without optimizations the compiler produces very dumb code - each command is compiled in a very straightforward manner, so that it does the intended thing. The Debug builds have optimizations disabled by default, because without the optimizations the produced executable matches the source code in a straightforward mann...
What does "Optimize Code" option really do in Visual Studio? Name of the option tells something but what Visual Studio/compiler really do and what are the real consequences? Edit: If you search google you can find this address, but that is not really I am looking for. I wonder the real things happening. For example why...
TITLE: What does "Optimize Code" option really do in Visual Studio? QUESTION: Name of the option tells something but what Visual Studio/compiler really do and what are the real consequences? Edit: If you search google you can find this address, but that is not really I am looking for. I wonder the real things happenin...
[ "visual-studio", "optimization" ]
84
67
57,129
3
0
2008-09-22T08:51:29.870000
2008-09-22T10:00:40.907000
113,873
113,891
Extending ControlCollection in VB.NET
I want to extend the basic ControlCollection in VB.NET so I can just add images and text to a self-made control, and then automaticly convert them to pictureboxes and lables. So I made a class that inherits from ControlCollection, overrided the add method, and added the functionality. But when I run the example, it giv...
Why not inherit from UserControl to define a custom control that has properties like Text and Image?
Extending ControlCollection in VB.NET I want to extend the basic ControlCollection in VB.NET so I can just add images and text to a self-made control, and then automaticly convert them to pictureboxes and lables. So I made a class that inherits from ControlCollection, overrided the add method, and added the functionali...
TITLE: Extending ControlCollection in VB.NET QUESTION: I want to extend the basic ControlCollection in VB.NET so I can just add images and text to a self-made control, and then automaticly convert them to pictureboxes and lables. So I made a class that inherits from ControlCollection, overrided the add method, and add...
[ "vb.net", "inheritance", "overriding" ]
0
3
1,442
3
0
2008-09-22T08:52:57.170000
2008-09-22T08:59:08.107000
113,883
113,885
How do I determine the collation of a database in SQL 2005?
How do you determine the collation of a database in SQL 2005, for instance if you need to perform a case-insensitive search/replace?
Use the following SQL determines the collation of a database: SELECT DATABASEPROPERTYEX('{database name}', 'Collation') SQLCollation;
How do I determine the collation of a database in SQL 2005? How do you determine the collation of a database in SQL 2005, for instance if you need to perform a case-insensitive search/replace?
TITLE: How do I determine the collation of a database in SQL 2005? QUESTION: How do you determine the collation of a database in SQL 2005, for instance if you need to perform a case-insensitive search/replace? ANSWER: Use the following SQL determines the collation of a database: SELECT DATABASEPROPERTYEX('{database n...
[ "sql", "collation" ]
0
1
6,227
4
0
2008-09-22T08:57:03.900000
2008-09-22T08:57:43.537000
113,886
113,900
How to recursively download a folder via FTP on Linux
I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files.
You could rely on wget which usually handles ftp get properly (at least in my own experience). For example: wget -r ftp://user:pass@server.com/ You can also use -m which is suitable for mirroring. It is currently equivalent to -r -N -l inf. If you've some special characters in the credential details, you can specify th...
How to recursively download a folder via FTP on Linux I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files.
TITLE: How to recursively download a folder via FTP on Linux QUESTION: I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files. ANSWER: You could rely on wget which usually handles ftp get properly (at least in my own experience). For example: ...
[ "linux", "command-line", "ftp" ]
347
677
592,927
12
0
2008-09-22T08:57:59.950000
2008-09-22T09:01:46.213000
113,899
113,933
Transparent form on the desktop
I want to create a c# application with multiple windows that are all transparent with some text on. The tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible?
Just making the window transparent is very straight forward: this.BackColor = Color.Fuchsia; this.TransparencyKey = Color.Fuchsia; You can do something like this to make it so you can still interact with the desktop or anything else under your window: public const int WM_NCHITTEST = 0x84; public const int HTTRANSPARENT...
Transparent form on the desktop I want to create a c# application with multiple windows that are all transparent with some text on. The tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible?
TITLE: Transparent form on the desktop QUESTION: I want to create a c# application with multiple windows that are all transparent with some text on. The tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible? ANSWER: Just making the window transparent is very straigh...
[ "c#", "winforms", "window", "desktop" ]
1
4
2,220
3
0
2008-09-22T09:01:42.063000
2008-09-22T09:10:29.653000
113,901
113,909
How do I perform a case-sensitive search and replace in SQL 2000/2005?
In order to perform a case-sensitive search/replace on a table in a SQL Server 2000/2005 database, you must use the correct collation. How do you determine whether the default collation for a database is case-sensitive, and if it isn't, how to perform a case-sensitive search/replace?
SELECT testColumn FROM testTable WHERE testColumn COLLATE Latin1_General_CS_AS = 'example' SELECT testColumn FROM testTable WHERE testColumn COLLATE Latin1_General_CS_AS = 'EXAMPLE' SELECT testColumn FROM testTable WHERE testColumn COLLATE Latin1_General_CS_AS = 'eXaMpLe' Don't assume the default collation will be ca...
How do I perform a case-sensitive search and replace in SQL 2000/2005? In order to perform a case-sensitive search/replace on a table in a SQL Server 2000/2005 database, you must use the correct collation. How do you determine whether the default collation for a database is case-sensitive, and if it isn't, how to perfo...
TITLE: How do I perform a case-sensitive search and replace in SQL 2000/2005? QUESTION: In order to perform a case-sensitive search/replace on a table in a SQL Server 2000/2005 database, you must use the correct collation. How do you determine whether the default collation for a database is case-sensitive, and if it i...
[ "sql", "sql-server-2005", "sql-server-2000", "collation" ]
18
22
30,059
7
0
2008-09-22T09:02:10.797000
2008-09-22T09:05:04.253000
113,906
113,984
Which GUI toolkit would you use for a touchscreen interface?
The only experience I have so far with a touchscreen interface was one where everything was custom drawn, and I get the feeling it's not the most efficient way of doing it (even the most basic layout change is hell to make). I know plenty of GUI toolkits intended at keyboard & mouse interfaces, but can you advise somet...
Check out the Windows Presentation Foundation ( WPF ). It uses XML ( XAML ) to define the interface and it is therefore quite easy to create an interface which would be easy to use with the touchscreen..NET 3.0 required.
Which GUI toolkit would you use for a touchscreen interface? The only experience I have so far with a touchscreen interface was one where everything was custom drawn, and I get the feeling it's not the most efficient way of doing it (even the most basic layout change is hell to make). I know plenty of GUI toolkits inte...
TITLE: Which GUI toolkit would you use for a touchscreen interface? QUESTION: The only experience I have so far with a touchscreen interface was one where everything was custom drawn, and I get the feeling it's not the most efficient way of doing it (even the most basic layout change is hell to make). I know plenty of...
[ "windows", "cross-platform", "touchscreen", "gui-toolkit" ]
3
2
2,291
3
0
2008-09-22T09:04:07.657000
2008-09-22T09:34:09.583000
113,915
113,924
Getting java.lang.ClassCastException: javax.swing.KeyStroke when creating a JSplitPane
I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.KeyStroke at java.util.TreeMap.compare(TreeMap.java:1093) at java.util.Tree...
After doing some searching in the Java Bug Database, this looks like this might be a JDK bug that was only fixed in JDK 6. See JDK-6434148: ClassCastException thrown while running SwingSet2 demo.
Getting java.lang.ClassCastException: javax.swing.KeyStroke when creating a JSplitPane I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: ...
TITLE: Getting java.lang.ClassCastException: javax.swing.KeyStroke when creating a JSplitPane QUESTION: I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time: Exception in thread "AWT-EventQueue-0" java.lang.Cl...
[ "java", "swing", "java-5", "jsplitpane" ]
1
2
4,380
3
0
2008-09-22T09:06:08.183000
2008-09-22T09:08:47.147000
113,916
118,419
How do I find out what collations are available in SQL 2000/2005
If I need to choose a collation mode to work with, how do I know what collations are available?
select distinct COLLATION_NAME from INFORMATION_SCHEMA.COLUMNS order by 1
How do I find out what collations are available in SQL 2000/2005 If I need to choose a collation mode to work with, how do I know what collations are available?
TITLE: How do I find out what collations are available in SQL 2000/2005 QUESTION: If I need to choose a collation mode to work with, how do I know what collations are available? ANSWER: select distinct COLLATION_NAME from INFORMATION_SCHEMA.COLUMNS order by 1
[ "sql", "collation" ]
2
2
1,588
2
0
2008-09-22T09:07:05.577000
2008-09-23T00:30:52.140000
113,928
113,948
Can I return the 'id' field after a LINQ insert?
When I enter an object into the DB with Linq-to-SQL can I get the id that I just inserted without making another db call? I am assuming this is pretty easy, I just don't know how.
After you commit your object into the db the object receives a value in its ID field. So: myObject.Field1 = "value"; // Db is the datacontext db.MyObjects.InsertOnSubmit(myObject); db.SubmitChanges(); // You can retrieve the id from the object int id = myObject.ID;
Can I return the 'id' field after a LINQ insert? When I enter an object into the DB with Linq-to-SQL can I get the id that I just inserted without making another db call? I am assuming this is pretty easy, I just don't know how.
TITLE: Can I return the 'id' field after a LINQ insert? QUESTION: When I enter an object into the DB with Linq-to-SQL can I get the id that I just inserted without making another db call? I am assuming this is pretty easy, I just don't know how. ANSWER: After you commit your object into the db the object receives a v...
[ "c#", ".net", "linq", "linq-to-sql" ]
190
277
114,463
3
0
2008-09-22T09:10:02.417000
2008-09-22T09:15:39.563000
113,930
113,971
Get Performance Counter Instance Name (w3wp#XX) from ASP.NET worker process ID
I would like to display some memory statistics (working set, GCs etc.) on a web page using the.NET/Process performance counters. Unfortunately, if there are multiple application pools on that server, they are differentiated using an index (#1, #2 etc.) but I don't know how to match a process ID (which I have) to that #...
The first hit on Google: Multiple CLR performance counters appear that have names that resemble "W3wp#1" When multiple ASP.NET worker processes are running, Common Language Runtime (CLR) performance counters will have names that resemble "W3wp#1" or "W3sp#2"and so on. This was remedied in.NET Framework 2.0 to include a...
Get Performance Counter Instance Name (w3wp#XX) from ASP.NET worker process ID I would like to display some memory statistics (working set, GCs etc.) on a web page using the.NET/Process performance counters. Unfortunately, if there are multiple application pools on that server, they are differentiated using an index (#...
TITLE: Get Performance Counter Instance Name (w3wp#XX) from ASP.NET worker process ID QUESTION: I would like to display some memory statistics (working set, GCs etc.) on a web page using the.NET/Process performance counters. Unfortunately, if there are multiple application pools on that server, they are differentiated...
[ "asp.net", "iis-6", "performancecounter" ]
15
11
20,283
5
0
2008-09-22T09:10:09.017000
2008-09-22T09:26:59.880000
113,972
115,517
Trouble Ticket in Microsoft CRM
I'm working on customizing a Microsoft Dynamics CRM (4.0) system for my university as a thesis. My teacher would like to know if it is possible to implement a ticketing system in the CRM so that the users (not the clients) could generate a trouble ticket. For example if their computer doesn't work properly. I had a loo...
CRM contains all the functionality you would need to build a ticket business object and have the user create a new ticket, assign the ticket to a developer or support tech for work, and resolve the ticket (with notes) when the work has been completed. External software would not be required.
Trouble Ticket in Microsoft CRM I'm working on customizing a Microsoft Dynamics CRM (4.0) system for my university as a thesis. My teacher would like to know if it is possible to implement a ticketing system in the CRM so that the users (not the clients) could generate a trouble ticket. For example if their computer do...
TITLE: Trouble Ticket in Microsoft CRM QUESTION: I'm working on customizing a Microsoft Dynamics CRM (4.0) system for my university as a thesis. My teacher would like to know if it is possible to implement a ticketing system in the CRM so that the users (not the clients) could generate a trouble ticket. For example if...
[ "dynamics-crm", "dynamics-crm-4", "ticket-system" ]
0
1
2,279
1
0
2008-09-22T09:27:22.437000
2008-09-22T15:28:07.267000
113,977
114,470
How can I immediately play a sound when another sound ends using XNA/XACT?
This question borders between the world of the audio designer and the programmer. While this question might have to be partially answered by that domain of an audio designer, it is sure a problem for the programmer. In our project, we want to loop a sound (background music) while the game timer is greater than one minu...
I think I've solved it now Here's how I did it. Select the Cue which you want to change sound after it has been stopped in XACT. Set Playlist Type to Interactive. Open Cue Transitions. Select View by Destination. Select the Cue in the (stop) node visible in the tree view. In Transition Properties at the right side of t...
How can I immediately play a sound when another sound ends using XNA/XACT? This question borders between the world of the audio designer and the programmer. While this question might have to be partially answered by that domain of an audio designer, it is sure a problem for the programmer. In our project, we want to lo...
TITLE: How can I immediately play a sound when another sound ends using XNA/XACT? QUESTION: This question borders between the world of the audio designer and the programmer. While this question might have to be partially answered by that domain of an audio designer, it is sure a problem for the programmer. In our proj...
[ "c#", "audio", "xna", "xact" ]
1
4
2,740
1
0
2008-09-22T09:30:06.177000
2008-09-22T12:08:35.967000
113,989
114,003
Test if a Font is installed
Is there an easy way (in.Net) to test if a Font is installed on the current machine?
string fontName = "Consolas"; float fontSize = 12; using (Font fontTester = new Font( fontName, fontSize, FontStyle.Regular, GraphicsUnit.Pixel)) { if (fontTester.Name == fontName) { // Font exists } else { // Font doesn't exist } }
Test if a Font is installed Is there an easy way (in.Net) to test if a Font is installed on the current machine?
TITLE: Test if a Font is installed QUESTION: Is there an easy way (in.Net) to test if a Font is installed on the current machine? ANSWER: string fontName = "Consolas"; float fontSize = 12; using (Font fontTester = new Font( fontName, fontSize, FontStyle.Regular, GraphicsUnit.Pixel)) { if (fontTester.Name == fontName...
[ ".net", "windows", "fonts" ]
32
31
26,669
7
0
2008-09-22T09:35:03.293000
2008-09-22T09:39:17.213000
113,991
114,023
What is the fastest way (in theory at least) to sort a heap?
A heap is a list where the following applies: l[i] <= l[2*i] && l[i] <= [2*i+1] for 0 <= i < len(list) I'm looking for in-place sorting.
Well you are half way through a Heap Sort already, by having your data in a heap. You just need to implement the second part of the heap sort algorithm. This should be faster than using quicksort on the heap array. If you are feeling brave you could have a go at implementing smoothsort, which is faster than heapsort fo...
What is the fastest way (in theory at least) to sort a heap? A heap is a list where the following applies: l[i] <= l[2*i] && l[i] <= [2*i+1] for 0 <= i < len(list) I'm looking for in-place sorting.
TITLE: What is the fastest way (in theory at least) to sort a heap? QUESTION: A heap is a list where the following applies: l[i] <= l[2*i] && l[i] <= [2*i+1] for 0 <= i < len(list) I'm looking for in-place sorting. ANSWER: Well you are half way through a Heap Sort already, by having your data in a heap. You just need...
[ "sorting", "heap" ]
2
1
1,024
6
0
2008-09-22T09:35:51.420000
2008-09-22T09:46:08.117000
114,010
132,589
Create anonymous object by Reflection in C#
Is there any way to create C# 3.0 anonymous object via Reflection at runtime in.NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically. edited later to clarify the use case An extra constraint is that I will be running all of it inside a Silverlight app, so ext...
Here is another way, seems more direct. object anon = Activator.CreateInstance(existingObject.GetType());
Create anonymous object by Reflection in C# Is there any way to create C# 3.0 anonymous object via Reflection at runtime in.NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically. edited later to clarify the use case An extra constraint is that I will be runnin...
TITLE: Create anonymous object by Reflection in C# QUESTION: Is there any way to create C# 3.0 anonymous object via Reflection at runtime in.NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically. edited later to clarify the use case An extra constraint is tha...
[ "c#", "silverlight", "reflection", "anonymous-objects" ]
10
4
9,041
6
0
2008-09-22T09:42:11.123000
2008-09-25T10:55:33.793000
114,011
114,036
How do I get the current size of a matrix stack in OpenGL?
How do I get the current size of a matrix stack (GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE) in OpenGL? I want this so that I can do some error checking to ensure that in certain parts of the code I can check that the matrix stacks have been left in the original condition.
Try: GLint depth; glGetIntegerv (GL_MODELVIEW_STACK_DEPTH, &depth); The enums for the other stacks are: GL_MODELVIEW_STACK_DEPTH GL_PROJECTION_STACK_DEPTH GL_TEXTURE_STACK_DEPTH If you use multi-texturing, you have more than one texture matrix stack to query. To do so, set the current texture-unit via glActiveTexture()...
How do I get the current size of a matrix stack in OpenGL? How do I get the current size of a matrix stack (GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE) in OpenGL? I want this so that I can do some error checking to ensure that in certain parts of the code I can check that the matrix stacks have been left in the original c...
TITLE: How do I get the current size of a matrix stack in OpenGL? QUESTION: How do I get the current size of a matrix stack (GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE) in OpenGL? I want this so that I can do some error checking to ensure that in certain parts of the code I can check that the matrix stacks have been left...
[ "c", "opengl", "graphics", "matrix" ]
10
15
3,325
1
0
2008-09-22T09:43:14.757000
2008-09-22T09:47:54.323000
114,024
114,044
Modal popups - usability
What are the cases where you'd use a modal popup? Does it interrupt the user's flow, if it all of a sudden opens up in his face? Would you avoid modal popups in general? or when should one be careful of using them? Edit: To be a bit more specific, the situation here is this: I have a menu on the right, (VisualStudio st...
From Wikipedia: Frequent uses of modal windows include: drawing attention to vital pieces of information. This use has been criticised as ineffective. blocking the application flow until information required to continue is entered, as for example a password in a login process. collecting application configuration optio...
Modal popups - usability What are the cases where you'd use a modal popup? Does it interrupt the user's flow, if it all of a sudden opens up in his face? Would you avoid modal popups in general? or when should one be careful of using them? Edit: To be a bit more specific, the situation here is this: I have a menu on th...
TITLE: Modal popups - usability QUESTION: What are the cases where you'd use a modal popup? Does it interrupt the user's flow, if it all of a sudden opens up in his face? Would you avoid modal popups in general? or when should one be careful of using them? Edit: To be a bit more specific, the situation here is this: I...
[ "usability", "modalpopups" ]
0
6
2,817
8
0
2008-09-22T09:46:23
2008-09-22T09:50:07.250000
114,029
114,143
Dynamic LINQ and Dynamic Lambda expressions?
What is the best way of dynamically writing LINQ queries and Lambda expressions? I am thinking of applications where the end user can design business logic rules, which then must be executed. I am sorry if this is a newbie question, but it would be great to get best practices out of experience.
I cannot recommend higher than you reading through the postings of Bart De Smet ( http://community.bartdesmet.net/blogs/bart/ ), he is really brilliant when it comes to Lambda. His recent series covered dynamic Lambda, starting with http://community.bartdesmet.net/blogs/bart/archive/2008/08/26/to-bind-or-not-to-bind-dy...
Dynamic LINQ and Dynamic Lambda expressions? What is the best way of dynamically writing LINQ queries and Lambda expressions? I am thinking of applications where the end user can design business logic rules, which then must be executed. I am sorry if this is a newbie question, but it would be great to get best practice...
TITLE: Dynamic LINQ and Dynamic Lambda expressions? QUESTION: What is the best way of dynamically writing LINQ queries and Lambda expressions? I am thinking of applications where the end user can design business logic rules, which then must be executed. I am sorry if this is a newbie question, but it would be great to...
[ "linq", ".net-3.5", "dynamic", "lambda" ]
14
11
26,821
6
0
2008-09-22T09:47:20.033000
2008-09-22T10:22:56.470000
114,081
114,100
Common Causes of Operating System Crashes
I am interested to learn: what are the most common technical causes (from the perspective of operating system programming) of an operating system crash (not limited to Windows crashes)? I'm looking for an answer not like "too many apps open", but what specifically happens when too many apps are open that causes the cra...
In my opinion Bad drivers Kernel bugs Hardware failure End of resources A modern operating system will not let a mere application crash it.
Common Causes of Operating System Crashes I am interested to learn: what are the most common technical causes (from the perspective of operating system programming) of an operating system crash (not limited to Windows crashes)? I'm looking for an answer not like "too many apps open", but what specifically happens when ...
TITLE: Common Causes of Operating System Crashes QUESTION: I am interested to learn: what are the most common technical causes (from the perspective of operating system programming) of an operating system crash (not limited to Windows crashes)? I'm looking for an answer not like "too many apps open", but what specific...
[ "windows", "linux", "macos", "unix", "operating-system" ]
3
6
17,438
8
0
2008-09-22T10:02:49.450000
2008-09-22T10:07:35.773000
114,085
114,102
Fast String Hashing Algorithm with low collision rates with 32 bit integer
I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The entire set of names is unknown (and changes over time). What is a fast string hashing algorithm t...
One of the FNV variants should meet your requirements. They're fast, and produce fairly evenly distributed outputs.
Fast String Hashing Algorithm with low collision rates with 32 bit integer I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The entire set of names is...
TITLE: Fast String Hashing Algorithm with low collision rates with 32 bit integer QUESTION: I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The enti...
[ "c++", "algorithm", "string", "hash" ]
70
30
104,719
14
0
2008-09-22T10:03:50.947000
2008-09-22T10:08:32.340000
114,095
114,111
Generate docs in automated build
Is there any way to generate project docs during automated builds? I'd like to have a single set of source files (HTML?) with the user manual, and from them generate: PDF document CHM help HTML version of the help The content would be basically the same in all three formats. Currently I'm using msbuild and CCNET, but I...
Yes! Use SandCastle to build CHM/HTM documentation of the APIs. Use DocBook + FOP and other tools to produce other kinds of documentation in PDF, RTF, HTML etc... They can be easily integrated with CruiseControl.NET through NAnt.
Generate docs in automated build Is there any way to generate project docs during automated builds? I'd like to have a single set of source files (HTML?) with the user manual, and from them generate: PDF document CHM help HTML version of the help The content would be basically the same in all three formats. Currently I...
TITLE: Generate docs in automated build QUESTION: Is there any way to generate project docs during automated builds? I'd like to have a single set of source files (HTML?) with the user manual, and from them generate: PDF document CHM help HTML version of the help The content would be basically the same in all three fo...
[ "build-process", "build-automation", "documentation" ]
8
7
437
6
0
2008-09-22T10:06:44.963000
2008-09-22T10:11:43.173000
114,108
114,139
ASP.NET MVC Preview 5 - Html.Image helper has moved namespace
We've just updated ASP.NET from Preview 3 to Preview 5 and we've run into a problem with the Html.Image HtmlHelper in our aspx pages. It seems that Html.Image has moved from System.Web.Mvc into Microsoft.Web.Mvc, and the only way we've found to access the helper now is to add an import statement to every.aspx page that...
You can add the namespace to pages in System.Web in you web config.
ASP.NET MVC Preview 5 - Html.Image helper has moved namespace We've just updated ASP.NET from Preview 3 to Preview 5 and we've run into a problem with the Html.Image HtmlHelper in our aspx pages. It seems that Html.Image has moved from System.Web.Mvc into Microsoft.Web.Mvc, and the only way we've found to access the he...
TITLE: ASP.NET MVC Preview 5 - Html.Image helper has moved namespace QUESTION: We've just updated ASP.NET from Preview 3 to Preview 5 and we've run into a problem with the Html.Image HtmlHelper in our aspx pages. It seems that Html.Image has moved from System.Web.Mvc into Microsoft.Web.Mvc, and the only way we've foun...
[ "asp.net-mvc", "web-config", "html-helper" ]
5
10
5,696
1
0
2008-09-22T10:10:24.597000
2008-09-22T10:21:30.637000
114,148
115,043
Encoding user input for emails
On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same but is there any special cases for emails ...
You should definitely HTML encode before assigning posted content to the HTML body of an email. Your code should already be rejecting content such as '
Encoding user input for emails On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same but is ther...
TITLE: Encoding user input for emails QUESTION: On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do th...
[ "javascript", "email" ]
1
0
644
5
0
2008-09-22T10:25:31.207000
2008-09-22T14:09:14.677000
114,149
114,809
"const correctness" in C#
The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when you break constness from within a const function, or try to use a non-const function of a const object. So without copying the const approach, is th...
I've come across this issue a lot of times too and ended up using interfaces. I think it's important to drop the idea that C# is any form, or even an evolution of C++. They're two different languages that share almost the same syntax. I usually express 'const correctness' in C# by defining a read-only view of a class: ...
"const correctness" in C# The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when you break constness from within a const function, or try to use a non-const function of a const object. So without copying...
TITLE: "const correctness" in C# QUESTION: The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when you break constness from within a const function, or try to use a non-const function of a const object. ...
[ "c#", "theory", "const-correctness" ]
84
64
17,727
7
0
2008-09-22T10:25:31.487000
2008-09-22T13:19:36.140000