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
32,338
32,670
Are there similar tools to Clone Detective for other languages/IDEs?
I just saw Clone Detective linked on YCombinator news, and the idea heavily appeals to me. It seems like it would be useful for many languages, not just C#, but I haven't seen anything similar elsewhere. Edit: For those who don't want to follow the link, Clone Detective scans the codebase for duplicate code that may wa...
Java has a few - some of the most popular static analysis tools have this built in along with many other useful rules. Ones I have used, in the (purely subjective) order that I was happiest with: PMD - comes with CPD - their copy and paste detector Checkstyle - specific rules to look for duplicate code Findbugs - the d...
Are there similar tools to Clone Detective for other languages/IDEs? I just saw Clone Detective linked on YCombinator news, and the idea heavily appeals to me. It seems like it would be useful for many languages, not just C#, but I haven't seen anything similar elsewhere. Edit: For those who don't want to follow the li...
TITLE: Are there similar tools to Clone Detective for other languages/IDEs? QUESTION: I just saw Clone Detective linked on YCombinator news, and the idea heavily appeals to me. It seems like it would be useful for many languages, not just C#, but I haven't seen anything similar elsewhere. Edit: For those who don't wan...
[ "c#", "language-agnostic" ]
4
2
264
2
0
2008-08-28T14:09:25.880000
2008-08-28T16:06:28.360000
32,343
32,348
How do I spawn threads on different CPU cores?
Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread on each core. So, when I run the program ...
Don't bother doing that. Instead use the Thread Pool. The thread pool is a mechanism (actually a class) of the framework that you can query for a new thread. When you ask for a new thread it will either give you a new one or enqueue the work until a thread get freed. In that way the framework is in charge on deciding w...
How do I spawn threads on different CPU cores? Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding t...
TITLE: How do I spawn threads on different CPU cores? QUESTION: Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spi...
[ "c#", ".net", "windows", "multithreading" ]
69
65
68,729
10
0
2008-08-28T14:11:20.523000
2008-08-28T14:13:41.920000
32,360
32,394
1:1 Foreign Key Constraints
How do you specify that a foreign key constraint should be a 1:1 relationship in transact sql? Is declaring the column UNIQUE enough? Below is my existing code.! CREATE TABLE [dbo].MyTable( [MyTablekey] INT IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [OtherTableKey] INT NOT NULL UNIQUE CONSTRAINT [FK_MyTable_OtherTable...
A foreign key column with the UNIQUE and NOT NULL constraints that references a UNIQUE, NOT NULL column in another table creates a 1:(0|1) relationship, which is probably what you want. If there was a true 1:1 relationship, every record in the first table would have a corresponding record in the second table and vice-v...
1:1 Foreign Key Constraints How do you specify that a foreign key constraint should be a 1:1 relationship in transact sql? Is declaring the column UNIQUE enough? Below is my existing code.! CREATE TABLE [dbo].MyTable( [MyTablekey] INT IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [OtherTableKey] INT NOT NULL UNIQUE CONST...
TITLE: 1:1 Foreign Key Constraints QUESTION: How do you specify that a foreign key constraint should be a 1:1 relationship in transact sql? Is declaring the column UNIQUE enough? Below is my existing code.! CREATE TABLE [dbo].MyTable( [MyTablekey] INT IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [OtherTableKey] INT NOT...
[ "sql", "sql-server" ]
9
9
9,870
5
0
2008-08-28T14:16:15.520000
2008-08-28T14:24:12.113000
32,364
32,466
Assert action redirected to correct action/route?
How do I exercise an action to ensure it redirects to the correct action or route?
public ActionResult Foo() { return RedirectToAction("Products", "Index"); } [Test] public void foo_redirects_to_products_index() { var controller = new BarController(); var result = controller.Foo() as RedirectToRouteResult; if(result == null) Assert.Fail("should have redirected"); Assert.That(result.RouteData.Value...
Assert action redirected to correct action/route? How do I exercise an action to ensure it redirects to the correct action or route?
TITLE: Assert action redirected to correct action/route? QUESTION: How do I exercise an action to ensure it redirects to the correct action or route? ANSWER: public ActionResult Foo() { return RedirectToAction("Products", "Index"); } [Test] public void foo_redirects_to_products_index() { var controller = new BarCont...
[ "asp.net-mvc", "unit-testing" ]
6
10
1,242
1
0
2008-08-28T14:17:11.477000
2008-08-28T14:47:08.113000
32,366
32,392
What are the key considerations when creating a web crawler?
I just started thinking about creating/customizing a web crawler today, and know very little about web crawler/robot etiquette. A majority of the writings on etiquette I've found seem old and awkward, so I'd like to get some current (and practical) insights from the web developer community. I want to use a crawler to w...
Obey robots.txt (and not too aggressive like has been said already). You might want to think about your user-agent string - they're a good place to be up-front about what you're doing and how you can be contacted.
What are the key considerations when creating a web crawler? I just started thinking about creating/customizing a web crawler today, and know very little about web crawler/robot etiquette. A majority of the writings on etiquette I've found seem old and awkward, so I'd like to get some current (and practical) insights f...
TITLE: What are the key considerations when creating a web crawler? QUESTION: I just started thinking about creating/customizing a web crawler today, and know very little about web crawler/robot etiquette. A majority of the writings on etiquette I've found seem old and awkward, so I'd like to get some current (and pra...
[ "web-crawler" ]
11
9
3,241
9
0
2008-08-28T14:17:35.780000
2008-08-28T14:24:01.757000
32,369
32,386
Disable browser 'Save Password' functionality
One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes peo...
I'm not sure if it'll work in all browsers but you should try setting autocomplete="off" on the form. The easiest and simplest way to disable Form and Password storage prompts and prevent form data from being cached in session history is to use the autocomplete form element attribute with value "off". From https://deve...
Disable browser 'Save Password' functionality One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, finan...
TITLE: Disable browser 'Save Password' functionality QUESTION: One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal informat...
[ "security", "browser", "autocomplete", "passwords" ]
464
339
330,592
36
0
2008-08-28T14:18:09.150000
2008-08-28T14:23:22.913000
32,385
32,402
Programmatically editing Python source
This is something that I think would be very useful. Basically, I'd like there to be a way to edit Python source programmatically without requiring human intervention. There are a couple of things I would like to do with this: Edit the configuration of Python apps that use source modules for configuration. Set up a "te...
Python's standard library provides pretty good facilities for working with Python source; note the tokenize and parser modules.
Programmatically editing Python source This is something that I think would be very useful. Basically, I'd like there to be a way to edit Python source programmatically without requiring human intervention. There are a couple of things I would like to do with this: Edit the configuration of Python apps that use source ...
TITLE: Programmatically editing Python source QUESTION: This is something that I think would be very useful. Basically, I'd like there to be a way to edit Python source programmatically without requiring human intervention. There are a couple of things I would like to do with this: Edit the configuration of Python app...
[ "python", "file-io" ]
12
7
2,683
3
0
2008-08-28T14:23:00.247000
2008-08-28T14:27:37.410000
32,397
32,399
Popularity algorithm
On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
My understanding is that it is approximately the following from another Jeff Atwood post t = (time of entry post) - (Dec 8, 2005) x = upvotes - downvotes y = {1 if x > 0, 0 if x = 0, -1 if x < 0) z = {1 if x < 1, otherwise x} log(z) + (y * t)/45000
Popularity algorithm On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
TITLE: Popularity algorithm QUESTION: On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine. ANSWER: My understanding is that it is approximately...
[ "c#", "algorithm", "math" ]
14
11
3,941
2
0
2008-08-28T14:24:21.303000
2008-08-28T14:26:05.777000
32,404
32,440
How do you run a Python script as a service in Windows?
I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to access the objects through that service. I am currently ai...
Yes you can. I do it using the pythoncom libraries that come included with ActivePython or can be installed with pywin32 (Python for Windows extensions). This is a basic skeleton for a simple service: import win32serviceutil import win32service import win32event import servicemanager import socket class AppServerSvc (...
How do you run a Python script as a service in Windows? I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to ac...
TITLE: How do you run a Python script as a service in Windows? QUESTION: I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the ot...
[ "python", "windows", "cross-platform" ]
346
301
455,082
14
0
2008-08-28T14:28:04.493000
2008-08-28T14:39:04.763000
32,414
32,427
How can I force clients to refresh JavaScript files?
We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client br...
As far as I know a common solution is to add a? to the script's src link. For instance: I assume at this point that there isn't a better way than find-replace to increment these "version numbers" in all of the script tags? You might have a version control system do that for you? Most version control systems have a way ...
How can I force clients to refresh JavaScript files? We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push o...
TITLE: How can I force clients to refresh JavaScript files? QUESTION: We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is th...
[ "javascript", "caching", "versioning" ]
711
616
619,737
30
0
2008-08-28T14:30:26.233000
2008-08-28T14:34:12.870000
32,428
37,379
How do I resolve a System.Security.SecurityException with custom code in SSRS?
I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work). Here is the error that is thrown by the custom code I've written. System.Security.SecurityException: Request for the permission of type 'S...
This is how I was able to solve the issue: strongly sign the custom assembly in question modify the rssrvpolicy.config file to add permissions for the assembly Side note: here is a great way to get the public key blob of your assembly VS trick for obtaining the public key token and blob of a signed assembly.
How do I resolve a System.Security.SecurityException with custom code in SSRS? I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work). Here is the error that is thrown by the custom code I've wr...
TITLE: How do I resolve a System.Security.SecurityException with custom code in SSRS? QUESTION: I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work). Here is the error that is thrown by the c...
[ "reporting-services", "securityexception" ]
13
9
73,693
4
0
2008-08-28T14:34:26.020000
2008-09-01T02:16:49.710000
32,433
32,465
Creating a LINQ select from multiple tables
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op).SingleOrDefault(); I get a new type with my 'op' fields. Now I want to retrieve my 'pg' fields as well, but select op, pg).SingleOrDefau...
You can use anonymous types for this, i.e.: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select new { pg, op }).SingleOrDefault(); This will make pageObject into an IEnumerable of an anonymous type so AFAIK you won't...
Creating a LINQ select from multiple tables This query works great: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op).SingleOrDefault(); I get a new type with my 'op' fields. Now I want to retrieve my 'pg' fiel...
TITLE: Creating a LINQ select from multiple tables QUESTION: This query works great: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op).SingleOrDefault(); I get a new type with my 'op' fields. Now I want to ret...
[ "c#", "linq" ]
54
91
201,987
5
0
2008-08-28T14:35:50.637000
2008-08-28T14:46:40.437000
32,448
37,293
Which 4.x version of gcc should one use?
The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are however very scared of c-compiler bugs (f...
The best quality control for gcc is the linux kernel. GCC is the compiler of choice for basically all major open source C/C++ programs. A released GCC, especially one like 4.3.X, which is in major linux distros, should be pretty good. GCC 4.3 also has better support for optimizations on newer cpus.
Which 4.x version of gcc should one use? The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are ...
TITLE: Which 4.x version of gcc should one use? QUESTION: The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tes...
[ "c", "gcc" ]
6
4
1,741
6
0
2008-08-28T14:41:23.150000
2008-09-01T00:10:42.493000
32,458
32,631
Random data in Unit Tests?
I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value. I've given him a number of different reasons against this, the main one...
There's a compromise. Your coworker is actually onto something, but I think he's doing it wrong. I'm not sure that totally random testing is very useful, but it's certainly not invalid. A program (or unit) specification is a hypothesis that there exists some program that meets it. The program itself is then evidence of...
Random data in Unit Tests? I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value. I've given him a number of different reasons...
TITLE: Random data in Unit Tests? QUESTION: I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value. I've given him a number of...
[ "unit-testing", "tdd", "mocking" ]
185
91
69,937
21
0
2008-08-28T14:45:26.807000
2008-08-28T15:46:31.963000
32,462
32,522
Pulling limited tagged photos from Flickr
So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches, I might get results numbering in the thousands. Requirements: I want to display between 10-20 pictures but I want to randomize the photos each time. I don'...
I would suggest moving the code that selects, randomizes, downloads and caches photos to separate service. It could be locally accessible REST application. Keep your core code clean and don't clutter it with remote operations and retention policy. Build tags-to-images map and store it locally, in file or database. Rand...
Pulling limited tagged photos from Flickr So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches, I might get results numbering in the thousands. Requirements: I want to display between 10-20 pictures but I want...
TITLE: Pulling limited tagged photos from Flickr QUESTION: So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches, I might get results numbering in the thousands. Requirements: I want to display between 10-20 p...
[ "php", "tags", "flickr" ]
0
1
255
2
0
2008-08-28T14:46:04.247000
2008-08-28T15:09:08.310000
32,493
32,543
Advice on how to be graphically creative
I've always felt that my graphic design skills have lacked, but I do have a desire to improve them. Even though I'm not the worlds worst artist, it's discouraging to see the results from a professional designer, who can do an amazing mockup from a simple spec in just a few hours. I always wonder how they came up with t...
Most of artistic talent comes from putting in the time. However, as in most skills, practicing bad habits doesn't help you progress. You need to learn basic drawing skills (form, mainly) and practice doing them well and right (which means slowly). As you practice correctly, you'll improve much faster. This is the kind ...
Advice on how to be graphically creative I've always felt that my graphic design skills have lacked, but I do have a desire to improve them. Even though I'm not the worlds worst artist, it's discouraging to see the results from a professional designer, who can do an amazing mockup from a simple spec in just a few hours...
TITLE: Advice on how to be graphically creative QUESTION: I've always felt that my graphic design skills have lacked, but I do have a desire to improve them. Even though I'm not the worlds worst artist, it's discouraging to see the results from a professional designer, who can do an amazing mockup from a simple spec i...
[ "graphics" ]
8
4
962
8
0
2008-08-28T14:56:09.073000
2008-08-28T15:14:42.617000
32,494
42,043
Visual Studio identical token highlighting
I coded a Mancala game in Java for a college class this past spring, and I used the Eclipse IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all other references to that token on your scre...
In a different question on SO ( link ), someone mentioned the VS 2005 / VS 2008 add-in "RockScroll". It seems to provide the "error bar" feature I was inquiring about in my question above. RockScroll EDIT: RockScroll also does the identical token highlighting that I was looking for! Great!
Visual Studio identical token highlighting I coded a Mancala game in Java for a college class this past spring, and I used the Eclipse IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all ...
TITLE: Visual Studio identical token highlighting QUESTION: I coded a Mancala game in Java for a college class this past spring, and I used the Eclipse IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatica...
[ "visual-studio", "visual-studio-2008", "visual-studio-2005" ]
68
11
37,229
11
0
2008-08-28T14:56:55.810000
2008-09-03T16:17:47.787000
32,513
32,794
Write files to App_Data under medium trust hack?
Is there any way to Write files to App_Data under medium trust hack? Im sure I've heard about some hack, is that true?
I don't have access to the server itself, so I can't check that. I can only chmod files and folder from my FTP client. I think my hosting provider needs to grant write permission to the network service account on the App_Data folder.
Write files to App_Data under medium trust hack? Is there any way to Write files to App_Data under medium trust hack? Im sure I've heard about some hack, is that true?
TITLE: Write files to App_Data under medium trust hack? QUESTION: Is there any way to Write files to App_Data under medium trust hack? Im sure I've heard about some hack, is that true? ANSWER: I don't have access to the server itself, so I can't check that. I can only chmod files and folder from my FTP client. I thin...
[ "asp.net", "trust" ]
1
0
960
2
0
2008-08-28T15:05:28.177000
2008-08-28T16:54:08.043000
32,519
32,707
List in JScrollPane painting outside the viewport
I have a list, each item of which has several things in it, including a JProgressBar which can be updated a lot. Each time one of the items updates its JProgressBar, the ListDataListener on the list tries to scroll it to the visible range using /* * This makes the updating content item automatically scroll * into view ...
Have you tried explicitly enabling double-buffering on the JList and/or the components that it is drawing over? (with: setDoubleBuffered(boolean aFlag) ) Another thought is that you might need to exit the function immediately after delegating to the EDT. The way your code is written, it looks like the update will happe...
List in JScrollPane painting outside the viewport I have a list, each item of which has several things in it, including a JProgressBar which can be updated a lot. Each time one of the items updates its JProgressBar, the ListDataListener on the list tries to scroll it to the visible range using /* * This makes the updat...
TITLE: List in JScrollPane painting outside the viewport QUESTION: I have a list, each item of which has several things in it, including a JProgressBar which can be updated a lot. Each time one of the items updates its JProgressBar, the ListDataListener on the list tries to scroll it to the visible range using /* * Th...
[ "java", "swing", "jscrollpane" ]
3
3
1,146
1
0
2008-08-28T15:08:47.547000
2008-08-28T16:17:19.207000
32,529
32,549
How do I restrict JFileChooser to a directory?
I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitrary directory. How should I go about doing that?
You can probably do this by setting your own FileSystemView.
How do I restrict JFileChooser to a directory? I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitrary directory. How should I go about doing that?
TITLE: How do I restrict JFileChooser to a directory? QUESTION: I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitrary directory. How should I go about doing that? ANSWER: You can probably do this by setting your own FileSystemView.
[ "java", "swing", "jfilechooser" ]
26
14
15,938
4
0
2008-08-28T15:11:45.277000
2008-08-28T15:15:28.793000
32,533
32,553
How do you write code that is both 32 bit and 64 bit compatible?
What considerations do I need to make if I want my code to run correctly on both 32bit and 64bit platforms? EDIT: What kind of areas do I need to take care in, e.g. printing strings/characters or using structures?
Options: Code it in some language with a Virtual Machine (such as Java) Code it in.NET and don't target any specific architecture. The.NET JIT compiler will compile it for you to the right architecture before running it.
How do you write code that is both 32 bit and 64 bit compatible? What considerations do I need to make if I want my code to run correctly on both 32bit and 64bit platforms? EDIT: What kind of areas do I need to take care in, e.g. printing strings/characters or using structures?
TITLE: How do you write code that is both 32 bit and 64 bit compatible? QUESTION: What considerations do I need to make if I want my code to run correctly on both 32bit and 64bit platforms? EDIT: What kind of areas do I need to take care in, e.g. printing strings/characters or using structures? ANSWER: Options: Code ...
[ "language-agnostic", "compatibility", "32bit-64bit" ]
0
2
2,527
9
0
2008-08-28T15:12:15.290000
2008-08-28T15:17:48.397000
32,537
32,686
What is the best way to use a console when developing?
For scripting languages, what is the most effective way to utilize a console when developing? Are there ways to be more productive with a console than a "compile and run" only language? Added clarification: I am thinking more along the lines of Ruby, Python, Boo, etc. Languages that are used for full blown apps, but al...
I am thinking more along the lines of Ruby,... Well for Ruby the irb interactive prompt is a great tool for "practicing" something simple. Here are the things I'll mention about the irb to give you an idea of effective use: Automation. You are allowed a.irbrc file that will be automatically executed when launching irb....
What is the best way to use a console when developing? For scripting languages, what is the most effective way to utilize a console when developing? Are there ways to be more productive with a console than a "compile and run" only language? Added clarification: I am thinking more along the lines of Ruby, Python, Boo, e...
TITLE: What is the best way to use a console when developing? QUESTION: For scripting languages, what is the most effective way to utilize a console when developing? Are there ways to be more productive with a console than a "compile and run" only language? Added clarification: I am thinking more along the lines of Ru...
[ "scripting", "console" ]
2
2
328
5
0
2008-08-28T15:13:20.157000
2008-08-28T16:11:07.473000
32,540
32,594
Alternative "architectural" approaches to javaScript client code?
How is your javaScript code organized? Does it follow patterns like MVC, or something else? I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with jQuery, however, the logic on the page is growing to a p...
..but Javascript has many facets that are OO. Consider this: var Vehicle = jQuery.Class.create({ init: function(name) { this.name = name; } }); var Car = Vehicle.extend({ fillGas: function(){ this.gas = 100; } }); I've used this technique to create page-level javascript classes that have their own state, this helps ke...
Alternative "architectural" approaches to javaScript client code? How is your javaScript code organized? Does it follow patterns like MVC, or something else? I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm stic...
TITLE: Alternative "architectural" approaches to javaScript client code? QUESTION: How is your javaScript code organized? Does it follow patterns like MVC, or something else? I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. R...
[ "javascript", "model-view-controller", "architecture", "client", "ria" ]
19
7
1,401
7
0
2008-08-28T15:13:57.533000
2008-08-28T15:29:51.863000
32,541
33,036
How can you clone a WPF object?
Anybody have a good example how to deep clone a WPF object, preserving databindings? The marked answer is the first part. The second part is that you have to create an ExpressionConverter and inject it into the serialization process. Details for this are here: http://www.codeproject.com/KB/WPF/xamlwriterandbinding.aspx...
The simplest way that I've done it is to use a XamlWriter to save the WPF object as a string. The Save method will serialize the object and all of its children in the logical tree. Now you can create a new object and load it with a XamlReader. ex: Write the object to xaml (let's say the object was a Grid control): stri...
How can you clone a WPF object? Anybody have a good example how to deep clone a WPF object, preserving databindings? The marked answer is the first part. The second part is that you have to create an ExpressionConverter and inject it into the serialization process. Details for this are here: http://www.codeproject.com/...
TITLE: How can you clone a WPF object? QUESTION: Anybody have a good example how to deep clone a WPF object, preserving databindings? The marked answer is the first part. The second part is that you have to create an ExpressionConverter and inject it into the serialization process. Details for this are here: http://ww...
[ "c#", "wpf", "binding", "clone" ]
42
65
49,107
4
0
2008-08-28T15:14:29.967000
2008-08-28T18:38:06.887000
32,570
32,577
How to make 'pretty urls' work in php hosted in IIS?
Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in a Windows hosted PHP server?
This is how I did it with WordPress on IIS 6.0 http://www.coderjournal.com/2008/02/url-rewriter-reverse-proxy-iis-wordpress/ However it all depends on what version of IIS you are using. If you are lucky enough to use IIS 7.0 you don't really have to worry about pretty urls because everything is supported out of the box...
How to make 'pretty urls' work in php hosted in IIS? Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in a Windows hosted PHP server?
TITLE: How to make 'pretty urls' work in php hosted in IIS? QUESTION: Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in a Windows hosted PHP server? ANSWER: This is how I did it with WordPress on IIS 6.0 http://www.coderjournal.com/2008/02/url-rewriter-re...
[ "php", "iis" ]
1
1
1,737
5
0
2008-08-28T15:23:53.500000
2008-08-28T15:25:17.553000
32,596
34,771
Odd behaviour for rowSpan in Flex
I am experiencing some oddities when working with a Grid component in flex, I have the following form that uses a grid to align the fields, as you can see, each GridRow has a border. My problem is that the border is still visible through GridItems that span multiple rows (observe the TextArea that spans 4 rows, the Gri...
I think the problem is that when the Grid is drawn, it draws each row from top to bottom, and within each row the items left to right. So the row-spanned item is drawn first extending down into the area of the 2 next rows, which get drawn after and on top. The quickest way around I can see would be to draw the row bord...
Odd behaviour for rowSpan in Flex I am experiencing some oddities when working with a Grid component in flex, I have the following form that uses a grid to align the fields, as you can see, each GridRow has a border. My problem is that the border is still visible through GridItems that span multiple rows (observe the T...
TITLE: Odd behaviour for rowSpan in Flex QUESTION: I am experiencing some oddities when working with a Grid component in flex, I have the following form that uses a grid to align the fields, as you can see, each GridRow has a border. My problem is that the border is still visible through GridItems that span multiple r...
[ "apache-flex" ]
0
1
2,334
1
0
2008-08-28T15:30:27.040000
2008-08-29T17:12:05.327000
32,597
39,208
Installing Team Foundation Server
What are the best practices in setting up a new instance of TFS 2008 Workgroup edition? Specifically, the constraints are as follows: Must install on an existing Windows Server 2008 64 bit TFS application layer is 32 bit only Should I install SQL Server 2008, Sharepoint and the app layer in a virtual instance of Window...
This is my recipe for installing TFS 2008 SP1. There is no domain controller in this scenario, we are only a couple of users. If I was to do it again, I would consider changing our environement to use a active directory domain. Host Server running Windows Server 2008 with 8GB RAM and quad processor Fresh install of Win...
Installing Team Foundation Server What are the best practices in setting up a new instance of TFS 2008 Workgroup edition? Specifically, the constraints are as follows: Must install on an existing Windows Server 2008 64 bit TFS application layer is 32 bit only Should I install SQL Server 2008, Sharepoint and the app lay...
TITLE: Installing Team Foundation Server QUESTION: What are the best practices in setting up a new instance of TFS 2008 Workgroup edition? Specifically, the constraints are as follows: Must install on an existing Windows Server 2008 64 bit TFS application layer is 32 bit only Should I install SQL Server 2008, Sharepoi...
[ "visual-studio", "visual-studio-2008", "version-control", "tfs", "hyper-v" ]
3
8
2,741
4
0
2008-08-28T15:30:34.280000
2008-09-02T10:46:29.697000
32,598
32,626
Any disadvantages in accessing Subversion repositories through file:// for a solo developer?
If you have Subversion installed on your development machine and you don't work in a team, is there any reason why you should use the svn protocol instead of file?
If you are working by yourself on a single machine, then in my experience using the file:// protocol works fine. Even when my team was using Subversion off a remote server, I would set up a local file-based repository for my own personal projects. If you get to the point where you need to access it from a different mac...
Any disadvantages in accessing Subversion repositories through file:// for a solo developer? If you have Subversion installed on your development machine and you don't work in a team, is there any reason why you should use the svn protocol instead of file?
TITLE: Any disadvantages in accessing Subversion repositories through file:// for a solo developer? QUESTION: If you have Subversion installed on your development machine and you don't work in a team, is there any reason why you should use the svn protocol instead of file? ANSWER: If you are working by yourself on a ...
[ "svn" ]
6
8
4,359
12
0
2008-08-28T15:30:37.727000
2008-08-28T15:43:48.507000
32,612
33,622
Best way to manage session in NHibernate?
I'm new to NHibernate (my 1st big project with it). I had been using a simple method of data access by creating the ISession object within a using block to do my grab my Object or list of Objects, and in that way the session was destroyed after exiting the code block. This doesn't work in a situation where lazy-loading...
Session management: http://code.google.com/p/dot-net-reference-app/source/browse/trunk/src/Infrastructure/Impl/HybridSessionBuilder.cs Session per request: http://code.google.com/p/dot-net-reference-app/source/browse/trunk/src/Infrastructure/Impl/NHibernateSessionModule.cs
Best way to manage session in NHibernate? I'm new to NHibernate (my 1st big project with it). I had been using a simple method of data access by creating the ISession object within a using block to do my grab my Object or list of Objects, and in that way the session was destroyed after exiting the code block. This does...
TITLE: Best way to manage session in NHibernate? QUESTION: I'm new to NHibernate (my 1st big project with it). I had been using a simple method of data access by creating the ISession object within a using block to do my grab my Object or list of Objects, and in that way the session was destroyed after exiting the cod...
[ "c#", ".net", "nhibernate" ]
5
6
6,654
4
0
2008-08-28T15:34:09.467000
2008-08-28T23:20:08.207000
32,617
32,627
Is there a way to do "intraWord" text navigation in Visual Studio?
On Windows, Ctrl+Right Arrow will move the text cursor from one "word" to the next. While working with Xcode on the Mac, they extended that so that Option+Right Arrow will move the cursor to the beginning of the next subword. For example, if the cursor was at the beginning of the word myCamelCaseVar then hitting Option...
ReSharper has a " Camel Humps " feature that lets you do this.
Is there a way to do "intraWord" text navigation in Visual Studio? On Windows, Ctrl+Right Arrow will move the text cursor from one "word" to the next. While working with Xcode on the Mac, they extended that so that Option+Right Arrow will move the cursor to the beginning of the next subword. For example, if the cursor ...
TITLE: Is there a way to do "intraWord" text navigation in Visual Studio? QUESTION: On Windows, Ctrl+Right Arrow will move the text cursor from one "word" to the next. While working with Xcode on the Mac, they extended that so that Option+Right Arrow will move the cursor to the beginning of the next subword. For examp...
[ "visual-studio", "keyboard" ]
1
2
143
1
0
2008-08-28T15:37:32.720000
2008-08-28T15:44:03.093000
32,621
67,303
How do I find the the exact lat/lng coordinates of a birdseye scene in Virtual Earth?
I'm trying to find the latitude and longitude of the corners of my map while in birdseye view. I want to be able to plot pins on the map, but I have hundreds of thousands of addresses that I want to be able to limit to the ones that need to show on the map. In normal view, VEMap.GetMapView().TopLeftLatLong and.BottomRi...
Here's the code for getting the Center Lat/Long point of the map. This method works in both Road/Aerial and Birdseye/Oblique map styles. function GetCenterLatLong() { //Check if in Birdseye or Oblique Map Style if (map.GetMapStyle() == VEMapStyle.Birdseye || map.GetMapStyle() == VEMapStyle.BirdseyeHybrid) { //IN Birdse...
How do I find the the exact lat/lng coordinates of a birdseye scene in Virtual Earth? I'm trying to find the latitude and longitude of the corners of my map while in birdseye view. I want to be able to plot pins on the map, but I have hundreds of thousands of addresses that I want to be able to limit to the ones that n...
TITLE: How do I find the the exact lat/lng coordinates of a birdseye scene in Virtual Earth? QUESTION: I'm trying to find the latitude and longitude of the corners of my map while in birdseye view. I want to be able to plot pins on the map, but I have hundreds of thousands of addresses that I want to be able to limit ...
[ "javascript", "virtual-earth" ]
4
2
2,051
5
0
2008-08-28T15:38:42.577000
2008-09-15T21:44:18.257000
32,633
1,330,776
How can I set breakpoints in an external JS script in Firebug
I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing external JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this without having to 'explore' my way into the script? @Jason: This is a good point, but in my case I do not have easy ...
To view and access external JavaScript files (*.js) from within Firebug: Click on the 'Script' tab. Click on the 'all' drop down in the upper left hand corner above the script code content window. Select 'Show Static Scripts'. Click on the dropdown button just to the right of what now says 'static' (By default, it shou...
How can I set breakpoints in an external JS script in Firebug I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing external JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this without having to 'explore' my way into the script? @J...
TITLE: How can I set breakpoints in an external JS script in Firebug QUESTION: I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing external JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this without having to 'explore' my way i...
[ "javascript", "debugging", "firebug" ]
28
21
19,824
5
0
2008-08-28T15:48:03.083000
2009-08-25T20:28:36.300000
32,637
32,648
Easiest way to convert a URL to a hyperlink in a C# string?
I am consuming the Twitter API and want to convert all URLs to hyperlinks. What is the most effective way you've come up with to do this? from string myString = "This is my tweet check it out http://tinyurl.com/blah"; to This is my tweet check it out http://tinyurl.com/>blah
Regular expressions are probably your friend for this kind of task: Regex r = new Regex(@"(https?://[^\s]+)"); myString = r.Replace(myString, " $1 "); The regular expression for matching URLs might need a bit of work.
Easiest way to convert a URL to a hyperlink in a C# string? I am consuming the Twitter API and want to convert all URLs to hyperlinks. What is the most effective way you've come up with to do this? from string myString = "This is my tweet check it out http://tinyurl.com/blah"; to This is my tweet check it out http://ti...
TITLE: Easiest way to convert a URL to a hyperlink in a C# string? QUESTION: I am consuming the Twitter API and want to convert all URLs to hyperlinks. What is the most effective way you've come up with to do this? from string myString = "This is my tweet check it out http://tinyurl.com/blah"; to This is my tweet chec...
[ "c#", "regex", "string", "hyperlink" ]
18
24
18,180
5
0
2008-08-28T15:49:32.690000
2008-08-28T15:54:16.923000
32,640
32,672
Mocking Asp.net-mvc Controller Context
So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET". I've seen some examples/helpers out on the nets, but some are dated. Fi...
Using MoQ it looks something like this: var request = new Mock (); request.Expect(r => r.HttpMethod).Returns("GET"); var mockHttpContext = new Mock (); mockHttpContext.Expect(c => c.Request).Returns(request.Object); var controllerContext = new ControllerContext(mockHttpContext.Object, new RouteData(), new Mock ().Objec...
Mocking Asp.net-mvc Controller Context So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET". I've seen some examples/helpers ...
TITLE: Mocking Asp.net-mvc Controller Context QUESTION: So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET". I've seen some...
[ "asp.net-mvc", "unit-testing", "mocking", "moq", "rhino-mocks" ]
70
66
49,845
7
0
2008-08-28T15:50:35.543000
2008-08-28T16:06:37.890000
32,642
32,653
Beginning ASP.NET MVC with VB.net 2008
Where can I find a good tutorial on learning ASP.NET MVC using VB.net 2008 as the language? Most in-depth tutorials that I found in searching the web were written in C#.
Have you tried adding the word "VB" to your searches?? http://www.myvbprof.com/2007_Version/MVC_Intro_Tutorial.aspx http://www.asp.net/learn/mvc/tutorial-07-vb.aspx < Link >
Beginning ASP.NET MVC with VB.net 2008 Where can I find a good tutorial on learning ASP.NET MVC using VB.net 2008 as the language? Most in-depth tutorials that I found in searching the web were written in C#.
TITLE: Beginning ASP.NET MVC with VB.net 2008 QUESTION: Where can I find a good tutorial on learning ASP.NET MVC using VB.net 2008 as the language? Most in-depth tutorials that I found in searching the web were written in C#. ANSWER: Have you tried adding the word "VB" to your searches?? http://www.myvbprof.com/2007_...
[ "asp.net-mvc", "vb.net", "visual-studio-2008", "model-view-controller", ".net-3.5" ]
3
3
6,311
2
0
2008-08-28T15:50:49.927000
2008-08-28T15:57:10.003000
32,643
34,311
Automatic image rotation based on a logo
We're looking for a package to help identify and automatically rotate faxed TIFF images based on a watermark or logo. We use libtiff for rotation currently, but don't know of any other libraries or packages I can use for detecting this logo and determining how to rotate the images. I have done some basic work with Open...
You are in the right place using OpenCV, it is an excellent utility. For example, this guy used it for template matching, which is fairly similar to what you need to do. Also, the link Roddy specified looks similar to what you want to do. I feel that OpenCV is the best library out there for this kind of development. @B...
Automatic image rotation based on a logo We're looking for a package to help identify and automatically rotate faxed TIFF images based on a watermark or logo. We use libtiff for rotation currently, but don't know of any other libraries or packages I can use for detecting this logo and determining how to rotate the imag...
TITLE: Automatic image rotation based on a logo QUESTION: We're looking for a package to help identify and automatically rotate faxed TIFF images based on a watermark or logo. We use libtiff for rotation currently, but don't know of any other libraries or packages I can use for detecting this logo and determining how ...
[ "opencv", "tiff", "watermark", "image-rotation" ]
3
1
1,477
3
0
2008-08-28T15:50:57.133000
2008-08-29T10:07:59.507000
32,649
32,705
Data Conflict in LINQ
When making changes using SubmitChanges(), LINQ sometimes dies with a ChangeConflictException exception with the error message Row not found or changed, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another user has changed some data in that row. Is...
Here's a way to see where the conflicts are (this is an MSDN example, so you'll need to heavily customize): try { db.SubmitChanges(ConflictMode.ContinueOnConflict); } catch (ChangeConflictException e) { Console.WriteLine("Optimistic concurrency error."); Console.WriteLine(e.Message); Console.ReadLine(); foreach (Object...
Data Conflict in LINQ When making changes using SubmitChanges(), LINQ sometimes dies with a ChangeConflictException exception with the error message Row not found or changed, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another user has changed som...
TITLE: Data Conflict in LINQ QUESTION: When making changes using SubmitChanges(), LINQ sometimes dies with a ChangeConflictException exception with the error message Row not found or changed, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another us...
[ "c#", "linq", "linq-to-sql" ]
19
24
10,942
7
0
2008-08-28T15:54:56.047000
2008-08-28T16:16:19.787000
32,668
32,692
How to remember in CSS that margin is outside the border, and padding inside
I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does anyone have a good way of remembering this? A little mnemonic, a good explanation as to why the n...
When working with CSS finally drives you mad the padded cell that they will put you in has the padding on the inside of the walls.
How to remember in CSS that margin is outside the border, and padding inside I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does anyone have a good w...
TITLE: How to remember in CSS that margin is outside the border, and padding inside QUESTION: I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does an...
[ "css", "padding", "margin", "mnemonics" ]
35
153
15,686
15
0
2008-08-28T16:06:04.803000
2008-08-28T16:13:09.030000
32,689
32,714
In MS SQL Server 2005, is there a way to export, the complete maintenance plan of a database as a SQL Script?
Currently, if I want to output a SQL script for a table in my database, in Management Studio, I can right click and output a create script. Is there an equivalent to output an SQL script for a database's maintenance plan?# Edit The company I work for has 4 servers, 3 servers and no sign of integration, each one running...
You can't export them as scripts, but if your intention is to migrate them between server instances then you can import and export them as follows: Connect to Integration Services and expand Stored Packages>MSDB>Maintenance Plans. You can then right click on the plan and select import or export
In MS SQL Server 2005, is there a way to export, the complete maintenance plan of a database as a SQL Script? Currently, if I want to output a SQL script for a table in my database, in Management Studio, I can right click and output a create script. Is there an equivalent to output an SQL script for a database's mainte...
TITLE: In MS SQL Server 2005, is there a way to export, the complete maintenance plan of a database as a SQL Script? QUESTION: Currently, if I want to output a SQL script for a table in my database, in Management Studio, I can right click and output a create script. Is there an equivalent to output an SQL script for a...
[ "sql", "sql-server", "sql-server-2005" ]
3
2
2,203
2
0
2008-08-28T16:12:06.427000
2008-08-28T16:20:07.843000
32,709
32,778
Isn't Func<T, bool> and Predicate<T> the same thing after compilation?
Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing Func vs. Predicate I would imagine there is no difference as both take a generic parameter and return bool?
They share the same signature, but they're still different types.
Isn't Func<T, bool> and Predicate<T> the same thing after compilation? Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing Func vs. Predicate I would imagine there is no difference as both take a generic parameter and return bool?
TITLE: Isn't Func<T, bool> and Predicate<T> the same thing after compilation? QUESTION: Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing Func vs. Predicate I would imagine there is no difference as both take a generic parameter and return bool...
[ "c#", ".net", "predicate", "func" ]
21
18
3,434
4
0
2008-08-28T16:17:52.090000
2008-08-28T16:48:26.357000
32,715
32,812
Is there a way to get images to display with ASP.NET and app_offline.htm?
When using the app_offline.htm feature of ASP.NET, it only allows html, but no images. Is there a way to get images to display without having to point them to a different url on another site?
Yes, it just can't come from the site that has the app_offline.htm file. The image would have to be hosted elsewhere.
Is there a way to get images to display with ASP.NET and app_offline.htm? When using the app_offline.htm feature of ASP.NET, it only allows html, but no images. Is there a way to get images to display without having to point them to a different url on another site?
TITLE: Is there a way to get images to display with ASP.NET and app_offline.htm? QUESTION: When using the app_offline.htm feature of ASP.NET, it only allows html, but no images. Is there a way to get images to display without having to point them to a different url on another site? ANSWER: Yes, it just can't come fro...
[ "asp.net", "iis-6" ]
18
14
12,687
6
0
2008-08-28T16:20:19.387000
2008-08-28T17:03:27.160000
32,717
188,237
Out-of-place builds with C#
I just finished setting up an out-of-place build system for our existing C++ code using inherited property sheets, a feature that seems to be specific to the Visual C++ product. Building out-of-place requires that many of the project settings be changed, and the inherited property sheets allowed me to change all the ne...
I'm not quite sure what an "out-of-place" build system is, but if you just need the ability to copy the compiled files (or other resources) to other directories you can do so by tying into the MSBuild build targets. In our projects we move the compiled dlls into lib folders and put the files into the proper locations a...
Out-of-place builds with C# I just finished setting up an out-of-place build system for our existing C++ code using inherited property sheets, a feature that seems to be specific to the Visual C++ product. Building out-of-place requires that many of the project settings be changed, and the inherited property sheets all...
TITLE: Out-of-place builds with C# QUESTION: I just finished setting up an out-of-place build system for our existing C++ code using inherited property sheets, a feature that seems to be specific to the Visual C++ product. Building out-of-place requires that many of the project settings be changed, and the inherited p...
[ "c#", "msbuild", "build-process" ]
4
3
1,286
3
0
2008-08-28T16:21:03.800000
2008-10-09T17:09:15.907000
32,718
32,743
Setting time zone remotely in C#
How do you set the Windows time zone on the local machine programmatically in C#? Using an interactive tool is not an option because the remote units have no user interface or users. The remote machine is running.NET 2.0 and Windows XP Embedded and a local app that communicates with a central server (via web service) f...
SetTimeZoneInformation should do what you need. You'll need to use P/Invoke to get at it. Note also that you'll need to possess and enable the SE_TIME_ZONE_NAME privilege.
Setting time zone remotely in C# How do you set the Windows time zone on the local machine programmatically in C#? Using an interactive tool is not an option because the remote units have no user interface or users. The remote machine is running.NET 2.0 and Windows XP Embedded and a local app that communicates with a c...
TITLE: Setting time zone remotely in C# QUESTION: How do you set the Windows time zone on the local machine programmatically in C#? Using an interactive tool is not an option because the remote units have no user interface or users. The remote machine is running.NET 2.0 and Windows XP Embedded and a local app that com...
[ "c#", ".net", "windows", "localization", "timezone" ]
3
3
8,122
6
0
2008-08-28T16:21:21.973000
2008-08-28T16:34:55.950000
32,733
32,807
.NET : Double-click event in TabControl
I would like to intercept the event in a.NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it). Do you have any idea of how I can do that?
The MouseDoubleClick event of the TabControl seems to respond just fine to double-clicking. The only additional step I would do is set a short timer after the TabIndexChanged event to track that a new tab has been selected and ignore any double-clicks that happen outside the timer. This will prevent double-clicking on ...
.NET : Double-click event in TabControl I would like to intercept the event in a.NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it). Do you have any idea of how I can do that?
TITLE: .NET : Double-click event in TabControl QUESTION: I would like to intercept the event in a.NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it). Do you have any idea of how I can do that? ANSWER: The MouseDoubleClick event of the TabControl ...
[ "c#", ".net", "vb.net", "winforms", "tabcontrol" ]
5
3
3,268
3
0
2008-08-28T16:28:25.280000
2008-08-28T16:58:31.870000
32,744
32,776
What protocols and servers are involved in sending an email, and what are the steps?
For the past few weeks, I've been trying to learn about just how email works. I understand the process of a client receiving mail from a server using POP pretty well. I also understand how a client computer can use SMTP to ask an SMTP server to send a message. However, I'm still missing something... The way I understan...
The SMTP server at Gmail (which accepted the message from Thunderbird) will route the message to the final recipient. It does this by using DNS to find the MX (mail exchanger) record for the domain name part of the destination email address (hotmail.com in this example). The DNS server will return an IP address which t...
What protocols and servers are involved in sending an email, and what are the steps? For the past few weeks, I've been trying to learn about just how email works. I understand the process of a client receiving mail from a server using POP pretty well. I also understand how a client computer can use SMTP to ask an SMTP ...
TITLE: What protocols and servers are involved in sending an email, and what are the steps? QUESTION: For the past few weeks, I've been trying to learn about just how email works. I understand the process of a client receiving mail from a server using POP pretty well. I also understand how a client computer can use SM...
[ "email", "smtp", "pop3" ]
15
18
3,922
7
0
2008-08-28T16:35:52.143000
2008-08-28T16:47:51.113000
32,747
32,749
How do I get today's date in C# in mm/dd/yyyy format?
How do I get today's date in C# in mm/dd/yyyy format? I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time. BTW: I'm in the US so M/dd would be correct, e.g. September 11th is 9/11. Note: an answer from kronoz ...
DateTime.Now.ToString("M/d/yyyy"); http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
How do I get today's date in C# in mm/dd/yyyy format? How do I get today's date in C# in mm/dd/yyyy format? I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time. BTW: I'm in the US so M/dd would be correct, e.g...
TITLE: How do I get today's date in C# in mm/dd/yyyy format? QUESTION: How do I get today's date in C# in mm/dd/yyyy format? I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time. BTW: I'm in the US so M/dd wou...
[ "c#", "date" ]
116
228
407,711
8
0
2008-08-28T16:37:10.860000
2008-08-28T16:37:44.680000
32,750
32,841
How can I take a byte array of a TIFF image and turn it into a System.Drawing.Image object?
I have a byte[] array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the BinaryWriter object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for later manipulation (feeding into a multipage...
Edit: The assumption below is not correct, I had a chance to fire up my IDE later and tested with and without Write and both populated the MemoryStream correctly. I think you need to write to your MemeoryStream first. As if my memory (no pun intended) serves me correctly this: MemoryStream ms = new MemoryStream(byteArr...
How can I take a byte array of a TIFF image and turn it into a System.Drawing.Image object? I have a byte[] array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the BinaryWriter object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a Syste...
TITLE: How can I take a byte array of a TIFF image and turn it into a System.Drawing.Image object? QUESTION: I have a byte[] array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the BinaryWriter object, it forms a perfectly valid TIFF file) and I'm trying to tu...
[ "c#", ".net", "image", "tiff" ]
6
2
13,332
3
0
2008-08-28T16:38:10.827000
2008-08-28T17:15:42.530000
32,766
32,865
generation of designer file failed
Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario: The aspx page has a reference to a custom user control (inheriting UserControl) which references another assembly in the backend. There ...
We've had similar problems before, unfortunately I don't remember the exact solution. If your using a "Web Site" project (no project file) then start by checking that both your page and your control both set the ClassName property in the first line of your aspx/ascx file and that you specify the full name of the class ...
generation of designer file failed Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario: The aspx page has a reference to a custom user control (inheriting UserControl) which references anot...
TITLE: generation of designer file failed QUESTION: Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario: The aspx page has a reference to a custom user control (inheriting UserControl) whi...
[ "visual-studio", "visual-studio-2008" ]
7
9
4,216
4
0
2008-08-28T16:42:42.797000
2008-08-28T17:27:42.517000
32,777
32,785
What is the best and most complete implementation of Unix system commands for Windows?
I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm going to use Cygwin for my Unix commands on Windows, but I'm not sure how well that's goi...
These work very well for me: http://unxutils.sourceforge.net/. Cygwin is not so good on Vista or 64 bit, so I stopped using it a while back.
What is the best and most complete implementation of Unix system commands for Windows? I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm go...
TITLE: What is the best and most complete implementation of Unix system commands for Windows? QUESTION: I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decisi...
[ "windows", "unix", "command-line" ]
15
5
3,282
9
0
2008-08-28T16:48:23.843000
2008-08-28T16:50:57.113000
32,780
32,797
Restrict the server access from LAN only
Recently we got a new server at the office purely for testing purposes. It is set up so that we can access it from any computer. However today our ip got blocked from one of our other sites saying that our ip has been suspected of having a virus that sends spam emails. we learned this from the cbl http://cbl.abuseat.or...
I assume that this server is behind a router? You should be able to block WAN connections to the server on the router and still leave it open to accepting LAN connection. Or you could restrict the IPs that can connect to the server to the development machines on the network.
Restrict the server access from LAN only Recently we got a new server at the office purely for testing purposes. It is set up so that we can access it from any computer. However today our ip got blocked from one of our other sites saying that our ip has been suspected of having a virus that sends spam emails. we learne...
TITLE: Restrict the server access from LAN only QUESTION: Recently we got a new server at the office purely for testing purposes. It is set up so that we can access it from any computer. However today our ip got blocked from one of our other sites saying that our ip has been suspected of having a virus that sends spam...
[ "server", "router", "lan", "wan" ]
1
1
1,350
1
0
2008-08-28T16:48:46.930000
2008-08-28T16:54:44.903000
32,790
33,008
Alternatives to System.exit(1)
For various reasons calling System.exit is frowned upon when writing Java Applications, so how can I notify the calling process that not everything is going according to plan? Edit: The 1 is a standin for any non-zero exit code.
The use of System.exit is frowned upon when the 'application' is really a sub-application (e.g. servlet, applet) of a larger Java application (server): in this case the System.exit could stop the JVM and hence also all other sub-applications. In this situation, throwing an appropriate exception, which could be caught a...
Alternatives to System.exit(1) For various reasons calling System.exit is frowned upon when writing Java Applications, so how can I notify the calling process that not everything is going according to plan? Edit: The 1 is a standin for any non-zero exit code.
TITLE: Alternatives to System.exit(1) QUESTION: For various reasons calling System.exit is frowned upon when writing Java Applications, so how can I notify the calling process that not everything is going according to plan? Edit: The 1 is a standin for any non-zero exit code. ANSWER: The use of System.exit is frowned...
[ "java", "process" ]
26
33
22,647
9
0
2008-08-28T16:52:44.067000
2008-08-28T18:25:27.760000
32,814
32,996
ASP.NET Validators inside an UpdatePanel
I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a ASP.NET Validator inside of an update panel does not work. Is there a trick to make these work, or do I need to use the ValidatorCallOut control that comes with the AJAX toolkit?
I suspect you are running the original release (RTM) of.NET 2.0. Until early 2007 validator controls were not compatible with UpdatePanels. This was resolved with the SP1 of the.NET Framework. The source of the problem is that UpdatePanel can detect markup changes in your page, but it has no way to track scripts correc...
ASP.NET Validators inside an UpdatePanel I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a ASP.NET Validator inside of an update panel does not work. Is there a trick to make these work, or do I need to use the ValidatorCallOut control that comes with the AJAX toolkit?
TITLE: ASP.NET Validators inside an UpdatePanel QUESTION: I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a ASP.NET Validator inside of an update panel does not work. Is there a trick to make these work, or do I need to use the ValidatorCallOut control that comes with the AJAX toolkit? ...
[ "asp.net", "asp.net-ajax", "updatepanel" ]
14
21
8,942
4
0
2008-08-28T17:03:59.610000
2008-08-28T18:20:00.923000
32,824
34,004
Why does HttpCacheability.Private suppress ETags?
While writing a custom IHttpHandler I came across a behavior that I didn't expect concerning the HttpCachePolicy object. My handler calculates and sets an entity-tag (using the SetETag method on the HttpCachePolicy associated with the current response object). If I set the cache-control to public using the SetCacheabil...
I think you need to use HttpCacheability.ServerAndPrivate That should give you cache-control: private in the headers and let you set an ETag. The documentation on that needs to be a bit better. Edit: Markus found that you also have call cache.SetOmitVaryStar(true) otherwise the cache will add the Vary: * header to the ...
Why does HttpCacheability.Private suppress ETags? While writing a custom IHttpHandler I came across a behavior that I didn't expect concerning the HttpCachePolicy object. My handler calculates and sets an entity-tag (using the SetETag method on the HttpCachePolicy associated with the current response object). If I set ...
TITLE: Why does HttpCacheability.Private suppress ETags? QUESTION: While writing a custom IHttpHandler I came across a behavior that I didn't expect concerning the HttpCachePolicy object. My handler calculates and sets an entity-tag (using the SetETag method on the HttpCachePolicy associated with the current response ...
[ "c#", "asp.net", "http", "caching" ]
25
17
7,224
3
0
2008-08-28T17:08:58.990000
2008-08-29T05:25:27.503000
32,835
32,859
XNA Unit Testing
So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic:-)
I would that this question is geared more toward the approach of unit testing in game development. I mean, XNA is a framework. Plug in NUnit, and begin writing test cases while you develop. Here is a post on SO about unit testing a game. It'll give you a little insight into how you need to think while progressing.
XNA Unit Testing So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic:-)
TITLE: XNA Unit Testing QUESTION: So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic:-) ANSWER: I would that this question is geared more toward the appro...
[ "unit-testing", "xna" ]
10
2
4,854
6
0
2008-08-28T17:12:57.887000
2008-08-28T17:25:52.333000
32,845
32,995
Creating System Restore Points - Thoughts?
Is it "taboo" to programatically create system restore points? I would be doing this before I perform a software update. If there is a better method to create a restore point with just my software's files and data, please let me know. I would like a means by which I can get the user back to a known working state if eve...
Is it "taboo" to programatically create system restore points? No. That's why the API is there; so that you can have pseudo-atomic updates of the system.
Creating System Restore Points - Thoughts? Is it "taboo" to programatically create system restore points? I would be doing this before I perform a software update. If there is a better method to create a restore point with just my software's files and data, please let me know. I would like a means by which I can get th...
TITLE: Creating System Restore Points - Thoughts? QUESTION: Is it "taboo" to programatically create system restore points? I would be doing this before I perform a software update. If there is a better method to create a restore point with just my software's files and data, please let me know. I would like a means by ...
[ "system-restore" ]
5
5
1,630
6
0
2008-08-28T17:16:54.650000
2008-08-28T18:19:49.850000
32,851
72,557
Multicasting, Messaging, ActiveMQ vs. MSMQ?
I'm working on a messaging/notification system for our products. Basic requirements are: Fire and forget Persistent set of messages, possibly updating, to stay there until the sender says to remove them The libraries will be written in C#. Spring.NET just released a milestone build with lots of nice messaging abstracti...
I'm kinda biased as I work on ActiveMQ but pretty much all of benefits listed for MSMQ above also apply to ActiveMQ really. Some more benefits of ActiveMQ include great support for cross language client access and multi protocol support excellent support for enterprise integration patterns a ton of advanced features li...
Multicasting, Messaging, ActiveMQ vs. MSMQ? I'm working on a messaging/notification system for our products. Basic requirements are: Fire and forget Persistent set of messages, possibly updating, to stay there until the sender says to remove them The libraries will be written in C#. Spring.NET just released a milestone...
TITLE: Multicasting, Messaging, ActiveMQ vs. MSMQ? QUESTION: I'm working on a messaging/notification system for our products. Basic requirements are: Fire and forget Persistent set of messages, possibly updating, to stay there until the sender says to remove them The libraries will be written in C#. Spring.NET just re...
[ "msmq", "messaging", "activemq-classic" ]
20
22
18,002
5
0
2008-08-28T17:21:21.627000
2008-09-16T14:00:06.540000
32,871
32,980
How can I resize a swf during runtime to have the browser create html scrollbars?
I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in actionscript (very much like http://www.nike.com/nikeskateboarding/v3/...) I did have a look at the s...
I've never done it that way around but I think swffit might be able to pull it off.
How can I resize a swf during runtime to have the browser create html scrollbars? I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in actionscript (very ...
TITLE: How can I resize a swf during runtime to have the browser create html scrollbars? QUESTION: I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in a...
[ "javascript", "apache-flex", "actionscript-3", "flash" ]
7
1
4,512
5
0
2008-08-28T17:31:13.960000
2008-08-28T18:15:32.527000
32,875
3,980,775
Browsers' default CSS stylesheets
Are there any lists of default CSS stylesheets for different browsers? (browser stylesheets in tabular form) I want to know the default font of text areas across all browsers for future reference.
Not tabular, but the source CSS may be helpful if you're looking for something specific: Firefox default HTML stylesheet WebKit default HTML stylesheet You're on your own with IE and Opera though.
Browsers' default CSS stylesheets Are there any lists of default CSS stylesheets for different browsers? (browser stylesheets in tabular form) I want to know the default font of text areas across all browsers for future reference.
TITLE: Browsers' default CSS stylesheets QUESTION: Are there any lists of default CSS stylesheets for different browsers? (browser stylesheets in tabular form) I want to know the default font of text areas across all browsers for future reference. ANSWER: Not tabular, but the source CSS may be helpful if you're looki...
[ "css", "browser", "fonts", "stylesheet", "default" ]
53
41
38,203
6
0
2008-08-28T17:36:29.080000
2010-10-20T17:48:40.120000
32,877
33,312
How to remove "VsDebuggerCausalityData" data from SOAP message?
I've got a problem where incoming SOAP messages from one particular client are being marked as invalid and rejected by our XML firewall device. It appears extra payload data is being inserted by Visual Studio; we're thinking the extra data may be causing a problem b/c we're seeing "VsDebuggerCausalityData" in these mes...
A quick google reveals that this should get rid of it, get them to add it to the web.config or app.config for their application. The information is debug information that the receiving service can use to help trace things back to the client. (maybe, I am guessing a little) I have proposed a follow up question to determ...
How to remove "VsDebuggerCausalityData" data from SOAP message? I've got a problem where incoming SOAP messages from one particular client are being marked as invalid and rejected by our XML firewall device. It appears extra payload data is being inserted by Visual Studio; we're thinking the extra data may be causing a...
TITLE: How to remove "VsDebuggerCausalityData" data from SOAP message? QUESTION: I've got a problem where incoming SOAP messages from one particular client are being marked as invalid and rejected by our XML firewall device. It appears extra payload data is being inserted by Visual Studio; we're thinking the extra dat...
[ "visual-studio", "web-services", "soap" ]
20
11
14,970
5
0
2008-08-28T17:38:07.907000
2008-08-28T20:27:38.450000
32,897
32,916
Do Java multi-line comments account for strings?
This question would probably apply equally as well to other languages with C-like multi-line comments. Here's the problem I'm encountering. I'm working with Java code in Eclipse, and I wanted to comment out a block of code. However, there is a string that contains the character sequence "*/", and Eclipse thinks that th...
Eclipse is correct. There is no interpretation context inside a comment (no escaping, etc). See JLS §3.7.
Do Java multi-line comments account for strings? This question would probably apply equally as well to other languages with C-like multi-line comments. Here's the problem I'm encountering. I'm working with Java code in Eclipse, and I wanted to comment out a block of code. However, there is a string that contains the ch...
TITLE: Do Java multi-line comments account for strings? QUESTION: This question would probably apply equally as well to other languages with C-like multi-line comments. Here's the problem I'm encountering. I'm working with Java code in Eclipse, and I wanted to comment out a block of code. However, there is a string th...
[ "java", "eclipse", "comments" ]
5
9
1,551
6
0
2008-08-28T17:47:56.570000
2008-08-28T17:54:34.947000
32,899
32,939
How do you generate dynamic (parameterized) unit tests in Python?
I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this: import unittest l = [["foo", "a", "a",], ["bar", "a", "b"], ["lee", "b", "b"]] class TestSequence(unittest.TestCase): def testsample(self): for name, a,b in l: print "test", name self.assertEqual(a,b) if...
This is called "parametrization". There are several tools that support this approach. E.g.: pytest's decorator parameterized The resulting code looks like this: from parameterized import parameterized class TestSequence(unittest.TestCase): @parameterized.expand([ ["foo", "a", "a",], ["bar", "a", "b"], ["lee", "b", "b"...
How do you generate dynamic (parameterized) unit tests in Python? I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this: import unittest l = [["foo", "a", "a",], ["bar", "a", "b"], ["lee", "b", "b"]] class TestSequence(unittest.TestCase): def testsample(self)...
TITLE: How do you generate dynamic (parameterized) unit tests in Python? QUESTION: I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this: import unittest l = [["foo", "a", "a",], ["bar", "a", "b"], ["lee", "b", "b"]] class TestSequence(unittest.TestCase): de...
[ "python", "unit-testing", "parameterized-unit-test" ]
376
301
225,311
25
0
2008-08-28T17:49:02.293000
2008-08-28T18:02:33.027000
32,914
32,936
Is there a way to render svg data in a swf at runtime?
I'd like to render to svg data in a swf at runtime (not in Flex - not using degrafa) - how would I go about doing that?
The Ajaxian blog had a post about this today. http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer
Is there a way to render svg data in a swf at runtime? I'd like to render to svg data in a swf at runtime (not in Flex - not using degrafa) - how would I go about doing that?
TITLE: Is there a way to render svg data in a swf at runtime? QUESTION: I'd like to render to svg data in a swf at runtime (not in Flex - not using degrafa) - how would I go about doing that? ANSWER: The Ajaxian blog had a post about this today. http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash...
[ "actionscript-3", "flash", "svg" ]
3
1
4,912
2
0
2008-08-28T17:54:10.957000
2008-08-28T18:00:42.873000
32,930
58,758
What is a good dvd burning component for Windows or .Net?
I'd like to add dvd burning functionality to my.Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned that Microsoft has created an IMAPI2 upgrade for Windows X...
I've used the code from the codeproject article and it works pretty well. It's a nice wrapper around the IMAPI2, so as longs as IMAPI2 supports what you need to do, the.NET wrapper will do it.
What is a good dvd burning component for Windows or .Net? I'd like to add dvd burning functionality to my.Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned ...
TITLE: What is a good dvd burning component for Windows or .Net? QUESTION: I'd like to add dvd burning functionality to my.Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions o...
[ ".net", "windows", "components", "dvd" ]
8
2
1,610
4
0
2008-08-28T17:59:11.567000
2008-09-12T11:45:42.620000
32,937
33,234
Shorthand conditional in C# similar to SQL 'in' keyword
In C# is there a shorthand way to write this: public static bool IsAllowed(int userID) { return (userID == Personnel.JohnDoe || userID == Personnel.JaneDoe...); } Like: public static bool IsAllowed(int userID) { return (userID in Personnel.JohnDoe, Personnel.JaneDoe...); } I know I could also use switch, but there are ...
How about this? public static class Extensions { public static bool In (this T testValue, params T[] values) { return values.Contains(testValue); } } Usage: Personnel userId = Personnel.JohnDoe; if (userId.In(Personnel.JohnDoe, Personnel.JaneDoe)) { // Do something } I can't claim credit for this, but I also can't rem...
Shorthand conditional in C# similar to SQL 'in' keyword In C# is there a shorthand way to write this: public static bool IsAllowed(int userID) { return (userID == Personnel.JohnDoe || userID == Personnel.JaneDoe...); } Like: public static bool IsAllowed(int userID) { return (userID in Personnel.JohnDoe, Personnel.JaneD...
TITLE: Shorthand conditional in C# similar to SQL 'in' keyword QUESTION: In C# is there a shorthand way to write this: public static bool IsAllowed(int userID) { return (userID == Personnel.JohnDoe || userID == Personnel.JaneDoe...); } Like: public static bool IsAllowed(int userID) { return (userID in Personnel.JohnDo...
[ "c#", "lambda", "conditional-statements", "if-statement" ]
11
13
2,569
8
0
2008-08-28T18:01:42.763000
2008-08-28T19:51:51.407000
32,941
344,461
SQL Server 2008 Reporting Services Control
Is the Sql Server 2008 control available for download? Does it yet support the 2008 RDL schema?
The ReportViewer control, http://www.microsoft.com/downloads/details.aspx?FamilyID=cc96c246-61e5-4d9e-bb5f-416d75a1b9ef&DisplayLang=en, supports 2005 RDL using LocalMode (ReportViewer.LocalReport) and 2008 from a Server (ReportViewer.ServerReport).
SQL Server 2008 Reporting Services Control Is the Sql Server 2008 control available for download? Does it yet support the 2008 RDL schema?
TITLE: SQL Server 2008 Reporting Services Control QUESTION: Is the Sql Server 2008 control available for download? Does it yet support the 2008 RDL schema? ANSWER: The ReportViewer control, http://www.microsoft.com/downloads/details.aspx?FamilyID=cc96c246-61e5-4d9e-bb5f-416d75a1b9ef&DisplayLang=en, supports 2005 RDL ...
[ "sql-server", "reporting-services" ]
1
0
516
3
0
2008-08-28T18:03:36.097000
2008-12-05T16:47:25.180000
32,964
32,976
Should a wireless network be open?
Obviously there are security reasons to close a wireless network and it's not fun if someone is stealing your bandwidth. That would be a serious problem? To address the first concern: Does a device on the same wireless network have any special privileges or access that an other device on the internet has? Assumptions: ...
Bruce Schneier is famous for running an open wireless network at home ( see here ). He does it for two reasons: To be neighborly (you'd let your neighbor borrow a cup of sugar, wouldn't you? Why not a few megabits?) To keep away from the false sense of security that a firewall gives you. In other words, it forces him t...
Should a wireless network be open? Obviously there are security reasons to close a wireless network and it's not fun if someone is stealing your bandwidth. That would be a serious problem? To address the first concern: Does a device on the same wireless network have any special privileges or access that an other device...
TITLE: Should a wireless network be open? QUESTION: Obviously there are security reasons to close a wireless network and it's not fun if someone is stealing your bandwidth. That would be a serious problem? To address the first concern: Does a device on the same wireless network have any special privileges or access th...
[ "security", "networking", "wireless" ]
10
16
1,714
16
0
2008-08-28T18:11:55.343000
2008-08-28T18:14:48.473000
32,986
33,256
NSEnumerator performance vs for loop in Cocoa
I know that if you have a loop that modifies the count of the items in the loop, using the NSEnumerator on a set is the best way to make sure your code blows up, however I would like to understand the performance tradeoffs between the NSEnumerator class and just an old school for loop
Using the new for (... in...) syntax in Objective-C 2.0 is generally the fastest way to iterate over a collection because it can maintain a buffer on the stack and get batches of items into it. Using NSEnumerator is generally the slowest way because it often copies the collection being iterated; for immutable collectio...
NSEnumerator performance vs for loop in Cocoa I know that if you have a loop that modifies the count of the items in the loop, using the NSEnumerator on a set is the best way to make sure your code blows up, however I would like to understand the performance tradeoffs between the NSEnumerator class and just an old scho...
TITLE: NSEnumerator performance vs for loop in Cocoa QUESTION: I know that if you have a loop that modifies the count of the items in the loop, using the NSEnumerator on a set is the best way to make sure your code blows up, however I would like to understand the performance tradeoffs between the NSEnumerator class an...
[ "objective-c", "cocoa", "nsenumerator" ]
19
28
7,070
3
0
2008-08-28T18:16:54.443000
2008-08-28T19:59:48.500000
33,034
33,059
How do banks remember "your computer"?
As many of you probably know, online banks nowadays have a security system whereby you are asked some personal questions before you even enter your password. Once you have answered them, you can choose for the bank to "remember this computer" so that in the future you can login by only entering your password. How does ...
In fact they most probably use cookies. An alternative for them would be to use " flash cookies " (officially called " Local Shared Objects "). They are similar to cookies in that they are tied to a website and have an upper size limit, but they are maintained by the flash player, so they are invisible to any browser t...
How do banks remember "your computer"? As many of you probably know, online banks nowadays have a security system whereby you are asked some personal questions before you even enter your password. Once you have answered them, you can choose for the bank to "remember this computer" so that in the future you can login by...
TITLE: How do banks remember "your computer"? QUESTION: As many of you probably know, online banks nowadays have a security system whereby you are asked some personal questions before you even enter your password. Once you have answered them, you can choose for the bank to "remember this computer" so that in the futur...
[ "https", "onlinebanking", "sessiontracking" ]
24
20
13,064
10
0
2008-08-28T18:37:07.513000
2008-08-28T18:45:05.903000
33,042
33,071
How can I measure CppUnit test coverage (on win32 and Unix)?
I have a very large code base that contains extensive unit tests (using CppUnit). I need to work out what percentage of the code is exercised by these tests, and (ideally) generate some sort of report that tells me on a per-library or per-file basis, how much of the code was exercised. Here's the kicker: this has to ru...
Which tool should I use? This article describes another developers frustrations searching for C++ code coverage tools. The author's final solution was Bullseye Coverage. Bullseye Coverage features: Cross Platform Support (win32, unix, and embedded), (supports linux gcc compilers and MSVC6) Easy to use (up and running i...
How can I measure CppUnit test coverage (on win32 and Unix)? I have a very large code base that contains extensive unit tests (using CppUnit). I need to work out what percentage of the code is exercised by these tests, and (ideally) generate some sort of report that tells me on a per-library or per-file basis, how much...
TITLE: How can I measure CppUnit test coverage (on win32 and Unix)? QUESTION: I have a very large code base that contains extensive unit tests (using CppUnit). I need to work out what percentage of the code is exercised by these tests, and (ideally) generate some sort of report that tells me on a per-library or per-fi...
[ "c++", "unit-testing", "cross-platform", "code-coverage", "cppunit" ]
21
14
22,912
5
0
2008-08-28T18:40:00.033000
2008-08-28T18:49:37.500000
33,048
130,114
How would you test observers with rSpec in a Ruby on Rails application?
Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications - how do you test this observer with rSpec?
You are on the right track, but I have run into a number of frustrating unexpected message errors when using rSpec, observers, and mock objects. When I am spec testing my model, I don't want to have to handle observer behavior in my message expectations. In your example, there isn't a really good way to spec "set_statu...
How would you test observers with rSpec in a Ruby on Rails application? Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications - how do you test this observer with rSpec?
TITLE: How would you test observers with rSpec in a Ruby on Rails application? QUESTION: Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications - how do you test this observer with rSpec? ANSWER: You are on the right track, but I have run into a number of frustrating unexpected message e...
[ "ruby-on-rails", "ruby", "activerecord", "rspec", "observer-pattern" ]
38
35
13,192
4
0
2008-08-28T18:41:21.920000
2008-09-24T21:32:48.650000
33,055
33,064
SVN repository backup strategies
What methods are available for backing up repositories in a Windows environment?
You could use something like (Linux): svnadmin dump repositorypath | gzip > backupname.svn.gz Since Windows does not support GZip it is just: svnadmin dump repositorypath > backupname.svn
SVN repository backup strategies What methods are available for backing up repositories in a Windows environment?
TITLE: SVN repository backup strategies QUESTION: What methods are available for backing up repositories in a Windows environment? ANSWER: You could use something like (Linux): svnadmin dump repositorypath | gzip > backupname.svn.gz Since Windows does not support GZip it is just: svnadmin dump repositorypath > backup...
[ "windows", "svn", "backup" ]
197
181
145,424
19
0
2008-08-28T18:43:59.480000
2008-08-28T18:46:35.447000
33,063
33,112
Looking for Regex to find quoted newlines in a big string (for C#)
I have a big string (let's call it a CSV file, though it isn't actually one, it'll just be easier for now) that I have to parse in C# code. The first step of the parsing process splits the file into individual lines by just using a StreamReader object and calling ReadLine until it's through the file. However, any given...
Since this isn't a true CSV file, does it have any sort of schema? From your example, it looks like you have: int, int, int, int, string, bool, bool, int With that making up your record / object. Assuming that your data is well formed (I don't know enough about your source to know how valid this assumption is); you cou...
Looking for Regex to find quoted newlines in a big string (for C#) I have a big string (let's call it a CSV file, though it isn't actually one, it'll just be easier for now) that I have to parse in C# code. The first step of the parsing process splits the file into individual lines by just using a StreamReader object a...
TITLE: Looking for Regex to find quoted newlines in a big string (for C#) QUESTION: I have a big string (let's call it a CSV file, though it isn't actually one, it'll just be easier for now) that I have to parse in C# code. The first step of the parsing process splits the file into individual lines by just using a Str...
[ "c#", "regex" ]
2
3
2,503
4
0
2008-08-28T18:46:24.417000
2008-08-28T19:00:02.280000
33,073
33,085
Ignore Emacs auto-generated files in a diff
How do I make diff ignore temporary files like foo.c~? Is there a configuration file that will make ignoring temporaries the default? More generally: what's the best way to generate a "clean" patch off a tarball? I do this rarely enough (submitting a bug fix to an OSS project by email) that I always struggle with it......
This doesn't strictly answer your question, but you can avoid the problem by configuring Emacs to use a specific directory to keep the backup files in. There are different implementations for Emacs or XEmacs. In GNU Emacs (defvar user-temporary-file-directory (concat temporary-file-directory user-login-name "/")) (make...
Ignore Emacs auto-generated files in a diff How do I make diff ignore temporary files like foo.c~? Is there a configuration file that will make ignoring temporaries the default? More generally: what's the best way to generate a "clean" patch off a tarball? I do this rarely enough (submitting a bug fix to an OSS project...
TITLE: Ignore Emacs auto-generated files in a diff QUESTION: How do I make diff ignore temporary files like foo.c~? Is there a configuration file that will make ignoring temporaries the default? More generally: what's the best way to generate a "clean" patch off a tarball? I do this rarely enough (submitting a bug fix...
[ "emacs", "backup", "diff", "patch", "autosave" ]
4
4
1,954
4
0
2008-08-28T18:50:31.383000
2008-08-28T18:55:05.333000
33,076
33,714
Pattern recognition algorithms
In the past I had to develop a program which acted as a rule evaluator. You had an antecedent and some consecuents (actions) so if the antecedent evaled to true the actions where performed. At that time I used a modified version of the RETE algorithm (there are three versions of RETE only the first being public) for th...
The TREAT algorithm is similar to RETE, but doesn't record partial matches. As a result, it may use less memory than RETE in certain situations. Also, if you modify a significant number of the known facts, then TREAT can be much faster because you don't have to spend time on retractions. There's also RETE* which balanc...
Pattern recognition algorithms In the past I had to develop a program which acted as a rule evaluator. You had an antecedent and some consecuents (actions) so if the antecedent evaled to true the actions where performed. At that time I used a modified version of the RETE algorithm (there are three versions of RETE only...
TITLE: Pattern recognition algorithms QUESTION: In the past I had to develop a program which acted as a rule evaluator. You had an antecedent and some consecuents (actions) so if the antecedent evaled to true the actions where performed. At that time I used a modified version of the RETE algorithm (there are three ver...
[ "algorithm", "pattern-recognition" ]
9
5
11,075
1
0
2008-08-28T18:51:32.097000
2008-08-29T00:42:18.040000
33,080
33,147
Setting the height of a DIV dynamically
In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window. I need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom of the browser screen. I have a max height for the contai...
Try this simple, specific function: function resizeElementHeight(element) { var height = 0; var body = window.document.body; if (window.innerHeight) { height = window.innerHeight; } else if (body.parentElement.clientHeight) { height = body.parentElement.clientHeight; } else if (body && body.clientHeight) { height = bod...
Setting the height of a DIV dynamically In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window. I need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom of the browser sc...
TITLE: Setting the height of a DIV dynamically QUESTION: In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window. I need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom...
[ "javascript", "html", "css" ]
33
40
169,728
8
0
2008-08-28T18:52:53.060000
2008-08-28T19:11:28.617000
33,086
33,100
ensuring uploaded files are safe
My boss has come to me and asked how to enure a file uploaded through web page is safe. He wants people to be able to upload pdfs and tiff images (and the like) and his real concern is someone embedding a virus in a pdf that is then viewed/altered (and the virus executed). I just read something on a procedure that coul...
I'd recommend running your uploaded files through antivirus software such as ClamAV. I don't know about scrubbing files to remove viruses, but this will at least allow you to detect and delete infected files before you view them.
ensuring uploaded files are safe My boss has come to me and asked how to enure a file uploaded through web page is safe. He wants people to be able to upload pdfs and tiff images (and the like) and his real concern is someone embedding a virus in a pdf that is then viewed/altered (and the virus executed). I just read s...
TITLE: ensuring uploaded files are safe QUESTION: My boss has come to me and asked how to enure a file uploaded through web page is safe. He wants people to be able to upload pdfs and tiff images (and the like) and his real concern is someone embedding a virus in a pdf that is then viewed/altered (and the virus execut...
[ "security", "antivirus" ]
10
4
3,154
6
0
2008-08-28T18:55:06.177000
2008-08-28T18:58:09.773000
33,103
33,130
How Do Sites Suppress Pasting Text?
I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item?
Probably using the onpaste event, and either return false from it or use e.preventDefault() on the Event object. Note that onpaste is non standard, don't rely on it for production sites, because it will not be there forever. $(document).on("paste",function(e){ console.log("paste") e.preventDefault() return false; }...
How Do Sites Suppress Pasting Text? I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item?
TITLE: How Do Sites Suppress Pasting Text? QUESTION: I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item? ANSWER: Probably using the o...
[ "javascript", "browser", "web-applications", "clipboard" ]
7
10
431
2
0
2008-08-28T18:58:36.090000
2008-08-28T19:04:28.167000
33,104
33,123
Communicating between websites (using Javascript or ?)
Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions. At the moment, website A opens a modal window containing website B using a jQuery plu...
My best suggestion would be to create a webservice on each site that the other could call with the information that needs to get passed. If security is necessary, it's easy to add an SSL-like authentication scheme (or actual SSL even, if you like) to this system to ensure that only the two servers are able to talk to t...
Communicating between websites (using Javascript or ?) Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions. At the moment, website A opens...
TITLE: Communicating between websites (using Javascript or ?) QUESTION: Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions. At the momen...
[ "javascript", "jquery", "web", "xss" ]
10
5
2,137
4
0
2008-08-28T18:58:39.990000
2008-08-28T19:02:25.580000
33,113
33,290
Is there any way to override the drag/drop or copy/paste behavior of an existing app in Windows?
I would like to extend some existing applications' drag and drop behavior, and I'm wondering if there is any way to hack on drag and drop support or changes to drag and drop behavior by monitoring the app's message loop and injecting my own messages. It would also work to monitor for when a paste operation is executed,...
If you're willing to do in-memory diddling while the application is loaded, you could probably finagle that. But if you're looking for an easy way to just inject code you want into another window's message pump, you're not going to find it. The skills required to accomplish something like this are formidable (unless so...
Is there any way to override the drag/drop or copy/paste behavior of an existing app in Windows? I would like to extend some existing applications' drag and drop behavior, and I'm wondering if there is any way to hack on drag and drop support or changes to drag and drop behavior by monitoring the app's message loop and...
TITLE: Is there any way to override the drag/drop or copy/paste behavior of an existing app in Windows? QUESTION: I would like to extend some existing applications' drag and drop behavior, and I'm wondering if there is any way to hack on drag and drop support or changes to drag and drop behavior by monitoring the app'...
[ "windows", "detours" ]
0
0
378
3
0
2008-08-28T19:00:40.547000
2008-08-28T20:12:24.603000
33,117
33,343
Building a custom Linux Live CD
Can anyone point me to a good tutorial on creating a bootable Linux CD from scratch? I need help with a fairly specialized problem: my firm sells an expansion card that requires custom firmware. Currently we use an extremely old live CD image of RH7.2 that we update with current firmware. Manufacturing puts the cards i...
One key piece of advice I can give is that most LiveCDs use a compressed filesystem called squashfs to cram as much data on the CD as possible. Since you don't need compression, you could run the mksquashfs step (present in most tutorials) with -noDataCompression and -noFragmentCompression to save on decompression time...
Building a custom Linux Live CD Can anyone point me to a good tutorial on creating a bootable Linux CD from scratch? I need help with a fairly specialized problem: my firm sells an expansion card that requires custom firmware. Currently we use an extremely old live CD image of RH7.2 that we update with current firmware...
TITLE: Building a custom Linux Live CD QUESTION: Can anyone point me to a good tutorial on creating a bootable Linux CD from scratch? I need help with a fairly specialized problem: my firm sells an expansion card that requires custom firmware. Currently we use an extremely old live CD image of RH7.2 that we update wit...
[ "linux" ]
23
3
19,591
6
0
2008-08-28T19:01:03.290000
2008-08-28T20:38:27.440000
33,144
33,267
Windows Mobile 6 Development, alternatives to visual studio?
I am looking to start writing apps for my Windows Mobile 6.1 professional device (Sprint Mogul/HTC Titan). I use the copy of Visual Studio 2003 that I bought in college for all of my current contracting work, (all of my day job work is done on a company laptop). From what I can tell from MSDN in order to develop using ...
I looked into more affordable ways to do back in the VS 2003 days, but couldn't find anything. My guess is that you still need VS to do it. @MartinHN You CAN NOT use version older than 2005 or less then Pro for Windows Mobile 5/6 device development.
Windows Mobile 6 Development, alternatives to visual studio? I am looking to start writing apps for my Windows Mobile 6.1 professional device (Sprint Mogul/HTC Titan). I use the copy of Visual Studio 2003 that I bought in college for all of my current contracting work, (all of my day job work is done on a company lapto...
TITLE: Windows Mobile 6 Development, alternatives to visual studio? QUESTION: I am looking to start writing apps for my Windows Mobile 6.1 professional device (Sprint Mogul/HTC Titan). I use the copy of Visual Studio 2003 that I bought in college for all of my current contracting work, (all of my day job work is done ...
[ "windows-mobile" ]
8
1
12,538
8
0
2008-08-28T19:10:51.317000
2008-08-28T20:06:44.630000
33,150
33,179
How to pass method name to custom server control in asp.net?
I am working on a Customer Server Control that extends another control. There is no problem with attaching to other controls on the form. in vb.net: Parent.FindControl(TargetControlName) I would like to pass a method to the control in the ASPX markup. for example: So, I tried using reflection to access the given method...
If you want to be able to pass a method in the ASPX markup, you need to use the Browsable attribute in your code on the event. VB.NET Public Event InitializeStuffCallback C# [Browsable(true)] public event EventHandler InitializeStuffCallback; Reference: Design-Time Attributes for Components and BrowsableAttribute Class...
How to pass method name to custom server control in asp.net? I am working on a Customer Server Control that extends another control. There is no problem with attaching to other controls on the form. in vb.net: Parent.FindControl(TargetControlName) I would like to pass a method to the control in the ASPX markup. for exa...
TITLE: How to pass method name to custom server control in asp.net? QUESTION: I am working on a Customer Server Control that extends another control. There is no problem with attaching to other controls on the form. in vb.net: Parent.FindControl(TargetControlName) I would like to pass a method to the control in the AS...
[ "c#", "asp.net", "vb.net", "custom-server-controls", "web-controls" ]
1
2
2,446
5
0
2008-08-28T19:11:34.217000
2008-08-28T19:24:26.793000
33,166
33,170
How do I keep my Login.aspx page's ReturnUrl parameter from overriding my ASP.NET Login control's DestinationPageUrl property?
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are accessable to only Anonymous users. When I click my login link from such a page, the login page has a ReturnUrl parameter in the address bar: htt...
I found the answer on Velocity Reviews. I handled the LoggedIn event to force a redirection to the DestinationPageUrl page. Public Partial Class Login Inherits System.Web.UI.Page Protected Sub Login1_LoggedIn(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Login1.LoggedIn 'overrides ReturnUrl page param...
How do I keep my Login.aspx page's ReturnUrl parameter from overriding my ASP.NET Login control's DestinationPageUrl property? I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are accessable to only...
TITLE: How do I keep my Login.aspx page's ReturnUrl parameter from overriding my ASP.NET Login control's DestinationPageUrl property? QUESTION: I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are ...
[ "asp.net", "forms-authentication" ]
12
14
6,176
1
0
2008-08-28T19:18:33.407000
2008-08-28T19:19:29.877000
33,174
33,235
Accessing Sharepoint from outside the WebUI
Is it possible to access the database backend of a sharepoint server? My company uses Sharepoint to store data and pictures of various assets. Ideally I would be able to access the data and display it in my application to allow users both methods of access. Before I go talk to the IT department I would like to find out...
Agree with Adam. Querying the Sharepoint Database is a big no-no, as Microsoft does not guarantee that the Schema is in any way stable. Only access the database if there is really no other way. As for Sharepoint, usually the Lists.asmx Web Service is what you want to look at first. http://www.c-sharpcorner.com/UploadFi...
Accessing Sharepoint from outside the WebUI Is it possible to access the database backend of a sharepoint server? My company uses Sharepoint to store data and pictures of various assets. Ideally I would be able to access the data and display it in my application to allow users both methods of access. Before I go talk t...
TITLE: Accessing Sharepoint from outside the WebUI QUESTION: Is it possible to access the database backend of a sharepoint server? My company uses Sharepoint to store data and pictures of various assets. Ideally I would be able to access the data and display it in my application to allow users both methods of access. ...
[ "sql-server", "ruby-on-rails", "ruby", "sharepoint" ]
1
3
1,248
4
0
2008-08-28T19:20:38.737000
2008-08-28T19:52:22.293000
33,199
33,208
What's the "condition" in C interview test?
Would it be possible to print Hello twice using single condition? if "condition" printf ("Hello"); else printf("World");
if ( printf("Hello") == 0 ) printf ("Hello"); else printf ("World");:-)
What's the "condition" in C interview test? Would it be possible to print Hello twice using single condition? if "condition" printf ("Hello"); else printf("World");
TITLE: What's the "condition" in C interview test? QUESTION: Would it be possible to print Hello twice using single condition? if "condition" printf ("Hello"); else printf("World"); ANSWER: if ( printf("Hello") == 0 ) printf ("Hello"); else printf ("World");:-)
[ "c", "conditional-statements" ]
30
85
11,871
30
0
2008-08-28T19:37:33.343000
2008-08-28T19:41:32.740000
33,204
33,246
When to commit changes?
Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process. Soon the update frequency will increase by an order of magnitude (maybe two). Someone suggested that committing every N updates in...
A commit results in Oracle writing stuff to the disk - i.e. in the redo log file so that whatever the transaction being commited has done can be recoverable in the event of a power failure, etc. Writing in file is slower than writing in memory so a commit will be slower if performed for many operations in a row rather ...
When to commit changes? Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process. Soon the update frequency will increase by an order of magnitude (maybe two). Someone suggested that commi...
TITLE: When to commit changes? QUESTION: Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process. Soon the update frequency will increase by an order of magnitude (maybe two). Someone su...
[ "sql", "oracle", "commit" ]
5
4
3,602
6
0
2008-08-28T19:40:55.193000
2008-08-28T19:55:51.023000
33,207
33,236
What is the best way to unit test Objective-C code?
What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Apple Xcode.
Xcode includes XCTest, which is similar to OCUnit, an Objective-C unit testing framework, and has full support for running XCTest-based unit tests as part of your project's build process. Xcode's unit testing support is described in the Xcode Overview: Using Unit Tests. Back in the Xcode 2 days, I wrote a series of web...
What is the best way to unit test Objective-C code? What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Apple Xcode.
TITLE: What is the best way to unit test Objective-C code? QUESTION: What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Apple Xcode. ANSWER: Xcode includes XCTest, which is similar to OCUnit, an Objective-C unit testing framework, and has full support for running...
[ "objective-c", "cocoa", "unit-testing", "xcode" ]
333
317
76,485
17
0
2008-08-28T19:41:30.307000
2008-08-28T19:52:25.617000
33,217
33,221
How can you implement trackbacks on a custom-coded blog (written in C#)?
How can you implement trackbacks on a custom-coded blog (written in C#)?
The TrackBack specification was created by Six Apart back in the day for their Movable Type blogging system. After some corporate changes it seems to be no longer available, but here's an archived version: http://web.archive.org/web/20081228043036/http://www.sixapart.com/pronet/docs/trackback_spec
How can you implement trackbacks on a custom-coded blog (written in C#)? How can you implement trackbacks on a custom-coded blog (written in C#)?
TITLE: How can you implement trackbacks on a custom-coded blog (written in C#)? QUESTION: How can you implement trackbacks on a custom-coded blog (written in C#)? ANSWER: The TrackBack specification was created by Six Apart back in the day for their Movable Type blogging system. After some corporate changes it seems ...
[ "c#", "blogs", "trackback" ]
0
2
453
3
0
2008-08-28T19:45:03.543000
2008-08-28T19:46:39.610000
33,222
950,946
Compact Framework - Lightweight GUI Framework?
Winform on CF is a bit heavy, initialising a lot of windows handles takes serious time and memory. Another issue is the lack of inbuilt double buffering and lack of control you have over the UI rendering means that during processor intensive operations the UI might leave the user staring at a half rendered screen. Nice...
I ran across this the other day, which might be helpful at least as a starting point: Fuild - Windows Mobile.NET Touch Controls. The look and feel is nice, but there is no design time support. I don't know too much about memory footprint, etc but everything is double buffered and the performance appears to be pretty go...
Compact Framework - Lightweight GUI Framework? Winform on CF is a bit heavy, initialising a lot of windows handles takes serious time and memory. Another issue is the lack of inbuilt double buffering and lack of control you have over the UI rendering means that during processor intensive operations the UI might leave t...
TITLE: Compact Framework - Lightweight GUI Framework? QUESTION: Winform on CF is a bit heavy, initialising a lot of windows handles takes serious time and memory. Another issue is the lack of inbuilt double buffering and lack of control you have over the UI rendering means that during processor intensive operations th...
[ "compact-framework", "gdi+", "windows-ce" ]
4
2
2,619
4
0
2008-08-28T19:47:24.710000
2009-06-04T14:26:46.510000
33,223
33,243
Is elegant, semantic CSS with ASP.Net still a pipe dream?
I know Microsoft has made efforts in the direction of semantic and cross-browser compliant XHTML and CSS, but it still seems like a PitA to pull off elegant markup. I've downloaded and tweaked the CSS Friendly Adapters and all that. But I still find myself frustrated with bloated and unattractive code. Is elegant, sema...
The easiest way to generate elegant HTML and CSS is to use MVC framework, where you have much more control over HTML generation than with Web Forms.
Is elegant, semantic CSS with ASP.Net still a pipe dream? I know Microsoft has made efforts in the direction of semantic and cross-browser compliant XHTML and CSS, but it still seems like a PitA to pull off elegant markup. I've downloaded and tweaked the CSS Friendly Adapters and all that. But I still find myself frust...
TITLE: Is elegant, semantic CSS with ASP.Net still a pipe dream? QUESTION: I know Microsoft has made efforts in the direction of semantic and cross-browser compliant XHTML and CSS, but it still seems like a PitA to pull off elegant markup. I've downloaded and tweaked the CSS Friendly Adapters and all that. But I still...
[ "asp.net", "css", "xhtml", "semantics" ]
9
13
831
8
0
2008-08-28T19:47:58.187000
2008-08-28T19:54:02.727000
33,226
33,285
In SQL Server 2000, is there a sysobjects query that will retrieve user views and not system views?
Assuming such a query exists, I would greatly appreciate the help. I'm trying to develop a permissions script that will grant "select" and "references" permissions on the user tables and views in a database. My hope is that executing the "grant" commands on each element in such a set will make it easier to keep permiss...
select * from information_schema.tables WHERE OBJECTPROPERTY(OBJECT_ID(table_name),'IsMSShipped') =0 Will exclude dt_properties and system tables add where table_type = 'view' if you just want the view
In SQL Server 2000, is there a sysobjects query that will retrieve user views and not system views? Assuming such a query exists, I would greatly appreciate the help. I'm trying to develop a permissions script that will grant "select" and "references" permissions on the user tables and views in a database. My hope is t...
TITLE: In SQL Server 2000, is there a sysobjects query that will retrieve user views and not system views? QUESTION: Assuming such a query exists, I would greatly appreciate the help. I'm trying to develop a permissions script that will grant "select" and "references" permissions on the user tables and views in a data...
[ "sql-server-2000", "sysobjects" ]
5
6
11,126
3
0
2008-08-28T19:48:49.527000
2008-08-28T20:11:35.087000
33,233
33,247
Integrating a custom gui framework with the VS designer
Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework, so please don't argue with "whys"). One of the main disadvantages of developing such a framework is that you lose compatability with the winform designer. So my question is to all of you who know a lot about VS customisatio...
I recently watched a video of these guys who built a WoW AddOn designer for Visual Studio. They overcame the task of getting their completely custom controls to render correctly in the designer. I'm not sure if this is exactly what you need, but might be worth looking at. It's open-source: http://www.codeplex.com/Warcr...
Integrating a custom gui framework with the VS designer Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework, so please don't argue with "whys"). One of the main disadvantages of developing such a framework is that you lose compatability with the winform designer. So my questi...
TITLE: Integrating a custom gui framework with the VS designer QUESTION: Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework, so please don't argue with "whys"). One of the main disadvantages of developing such a framework is that you lose compatability with the winform desi...
[ "visual-studio", "gui-designer" ]
1
1
314
2
0
2008-08-28T19:51:37.617000
2008-08-28T19:56:48.337000
33,250
39,091
Caching Active Directory Data
In one of my applications, I am querying active directory to get a list of all users below a given user (using the "Direct Reports" thing). So basically, given the name of the person, it is looked up in AD, then the Direct Reports are read. But then for every direct report, the tool needs to check the direct reports of...
In order to take control over the properties that you want to be cached you can call 'RefreshCache()' passing the properties that you want to hang around: System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry(); // Push the property values from AD back to cache. entry.RefreshCach...
Caching Active Directory Data In one of my applications, I am querying active directory to get a list of all users below a given user (using the "Direct Reports" thing). So basically, given the name of the person, it is looked up in AD, then the Direct Reports are read. But then for every direct report, the tool needs ...
TITLE: Caching Active Directory Data QUESTION: In one of my applications, I am querying active directory to get a list of all users below a given user (using the "Direct Reports" thing). So basically, given the name of the person, it is looked up in AD, then the Direct Reports are read. But then for every direct repor...
[ "c#", "asp.net", "active-directory" ]
4
3
5,615
4
0
2008-08-28T19:58:10.597000
2008-09-02T09:26:14.133000
33,252
34,465
Getting files and their version numbers from sharepoint
As a temporary stopgap until all the designers are in place we are currently hand-cranking a whole bunch of xml configuration files at work. One of the issues with this is file-versioning because people forget to update version numbers when updating the files (which is to be expected as humans generally suck at perfect...
There is a way to do it thru web services, but I have done more with implementing custom event handlers. Here is a bit of code that will do what you want. Keep in mind, you can only execute this from the server, so you may want to wrap this up in a web service to allow access from your embedded devices. Also, you will ...
Getting files and their version numbers from sharepoint As a temporary stopgap until all the designers are in place we are currently hand-cranking a whole bunch of xml configuration files at work. One of the issues with this is file-versioning because people forget to update version numbers when updating the files (whi...
TITLE: Getting files and their version numbers from sharepoint QUESTION: As a temporary stopgap until all the designers are in place we are currently hand-cranking a whole bunch of xml configuration files at work. One of the issues with this is file-versioning because people forget to update version numbers when updat...
[ "sharepoint", "versioning" ]
1
1
1,924
2
0
2008-08-28T19:58:58.673000
2008-08-29T15:35:09.350000
33,262
33,283
How do I load an org.w3c.dom.Document from XML in a string?
I have a complete XML document in a string and would like a Document object. Google turns up all sorts of garbage. What is the simplest solution? (In Java 1.5) Solution Thanks to Matt McMinn, I have settled on this implementation. It has the right level of input flexibility and exception granularity for me. (It's good ...
This works for me in Java 1.5 - I stripped out specific exceptions for readability. import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import java.io.ByteArrayInputStream; public Document loadXMLFromString(String xml) throws Exception { DocumentBuild...
How do I load an org.w3c.dom.Document from XML in a string? I have a complete XML document in a string and would like a Document object. Google turns up all sorts of garbage. What is the simplest solution? (In Java 1.5) Solution Thanks to Matt McMinn, I have settled on this implementation. It has the right level of inp...
TITLE: How do I load an org.w3c.dom.Document from XML in a string? QUESTION: I have a complete XML document in a string and would like a Document object. Google turns up all sorts of garbage. What is the simplest solution? (In Java 1.5) Solution Thanks to Matt McMinn, I have settled on this implementation. It has the ...
[ "java", "xml", "document", "w3c" ]
108
83
140,234
4
0
2008-08-28T20:03:19.477000
2008-08-28T20:11:00.160000
33,265
33,391
What's the false operator in C# good for?
There are two weird operators in C#: the true operator the false operator If I understand this right these operators can be used in types which I want to use instead of a boolean expression and where I don't want to provide an implicit conversion to bool. Let's say I have a following class: public class MyType { public...
You can use it to override the && and || operators. The && and || operators can't be overridden, but if you override |, &, true and false in exactly the right way the compiler will call | and & when you write || and &&. For example, look at this code (from http://ayende.com/blog/1574/nhibernate-criteria-api-operator-ov...
What's the false operator in C# good for? There are two weird operators in C#: the true operator the false operator If I understand this right these operators can be used in types which I want to use instead of a boolean expression and where I don't want to provide an implicit conversion to bool. Let's say I have a fol...
TITLE: What's the false operator in C# good for? QUESTION: There are two weird operators in C#: the true operator the false operator If I understand this right these operators can be used in types which I want to use instead of a boolean expression and where I don't want to provide an implicit conversion to bool. Let'...
[ "c#", ".net", "syntax" ]
108
66
11,298
5
0
2008-08-28T20:06:01.840000
2008-08-28T21:02:48.333000
33,288
33,295
Protecting API Secret Keys in a Thick Client application
Within an application, I've got Secret Keys uses to calculate a hash for an API call. In a.NET application it's fairly easy to use a program like Reflector to pull out information from the assembly to include these keys. Is obfuscating the assembly a good way of securing these keys?
Probably not. Look into cryptography and Windows' built-in information-hiding mechanisms (DPAPI and storing the keys in an ACL-restricted registry key, for example). That's as good as you're going to get for security you need to keep on the same system as your application. If you are looking for a way to stop someone p...
Protecting API Secret Keys in a Thick Client application Within an application, I've got Secret Keys uses to calculate a hash for an API call. In a.NET application it's fairly easy to use a program like Reflector to pull out information from the assembly to include these keys. Is obfuscating the assembly a good way of ...
TITLE: Protecting API Secret Keys in a Thick Client application QUESTION: Within an application, I've got Secret Keys uses to calculate a hash for an API call. In a.NET application it's fairly easy to use a program like Reflector to pull out information from the assembly to include these keys. Is obfuscating the assem...
[ "web-services", "security", "api" ]
4
8
2,329
4
0
2008-08-28T20:11:54.867000
2008-08-28T20:14:55.063000
33,301
33,440
Call onresize from ASP.NET content page
I have a JavaScript method that I need to run on one of my pages, in particular, the onresize event. However, I don't see how I can set that event from my content page. I wish I could just put it on my master page, but I don't have the need for the method to be called on all pages that use that master page. Any help wo...
Place the following in your content page: That code should give you the basic idea of what you need to do. Hopefully you are using a library that already has code to help you write up event handlers and such.
Call onresize from ASP.NET content page I have a JavaScript method that I need to run on one of my pages, in particular, the onresize event. However, I don't see how I can set that event from my content page. I wish I could just put it on my master page, but I don't have the need for the method to be called on all page...
TITLE: Call onresize from ASP.NET content page QUESTION: I have a JavaScript method that I need to run on one of my pages, in particular, the onresize event. However, I don't see how I can set that event from my content page. I wish I could just put it on my master page, but I don't have the need for the method to be ...
[ "asp.net", "javascript", "master-pages", "onresize" ]
4
4
6,815
3
0
2008-08-28T20:24:04.887000
2008-08-28T21:25:35.003000
33,306
33,313
C++ STL question: allocators
I have a (potentially dumb) question about the C++ STL. When I make a container (vector, set, map, etc), is it allocated on the stack or on the heap? If I make a set and put 5 million strings, will I have to worry about a stack overflow?
STL classes by default allocate their internal buffers from the heap, although these classes also allow custom allocators that allow a user to specify an alternate location to allocate from - e.g. a shared memory pool.
C++ STL question: allocators I have a (potentially dumb) question about the C++ STL. When I make a container (vector, set, map, etc), is it allocated on the stack or on the heap? If I make a set and put 5 million strings, will I have to worry about a stack overflow?
TITLE: C++ STL question: allocators QUESTION: I have a (potentially dumb) question about the C++ STL. When I make a container (vector, set, map, etc), is it allocated on the stack or on the heap? If I make a set and put 5 million strings, will I have to worry about a stack overflow? ANSWER: STL classes by default all...
[ "c++", "stl" ]
6
9
1,480
3
0
2008-08-28T20:26:14.193000
2008-08-28T20:28:13.177000
33,334
33,683
How do you find what debug switches are available? Or given a switch find out what is being disabled?
In this question the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user generated and does not list any switches. What I would like to know is where the value "Remote.Disable" comes from and ho...
As you suspected, Remote.Disable stops the app from attaching debug info to remote requests. It's defined inside the.NET framework methods that make the SOAP request. The basic situation is that these switches can be defined anywhere in code, you just need to create a new System.Diagnostics.BooleanSwitch with the name ...
How do you find what debug switches are available? Or given a switch find out what is being disabled? In this question the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user generated and does ...
TITLE: How do you find what debug switches are available? Or given a switch find out what is being disabled? QUESTION: In this question the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user g...
[ ".net", "app-config" ]
4
2
3,125
2
0
2008-08-28T20:35:07.060000
2008-08-28T23:57:57.460000