Question:
Alternative Hostname for an IIS web site for internal access only | I'm using IIS in Windows 2003 Server for a SharePoint intranet.
External incoming requests will be using the host header `portal.mycompany.com` and be forced to use SSL.

I was wondering if there's a way to set up an alternate host header such as
`http://internalportal/`
which only accepts requests from the internal network, but doesn't force the users to use SSL.

Any recommendations for how to set this up?


Question:
How to render a control to look like ComboBox with Visual Styles enabled? | I have a control that is modelled on a **ComboBox**. I want to render the control so that the control **border** looks like that of a standard **Windows ComboBox**. Specifically, I have followed the MSDN documentation and all the rendering of the control is correct except for rendering when the control is disabled.

Just to be clear, this is for a system with **Visual Styles** enabled. Also, all parts of the control render properly except the border around a disabled control, which does not match the disabled **ComboBox border** colour.

I am using the **VisualStyleRenderer** class. MSDN suggests using the `VisualStyleElement.TextBox` element for the **TextBox** part of the **ComboBox** control but a standard disabled **TextBox** and a standard disabled **ComboBox** draw slightly differently (one has a light grey border, the other a light blue border).

How can I get correct rendering of the control in a disabled state?


Question:
How to extend project properties page? | Is it possible to add a custom tab to a project properties page in the Visual Studio 2008?
What I want to do is to be able to add a custom tab to properties page for the projects created from default project templates (WPF Application, WPF custom controls library, etc).


Question:
SoapException: Root element is missing occurs when .NET web service called from Flex | I have a .net web application that has a Flex application embedded within a page. This flex application calls a .net webservice. I can trace the execution proccess through the debugger and all looks great until I get the response:

```

soap:ReceiverSystem.Web.Services.Protocols.SoapException: Server was unable to process request

. ---> System.Xml.XmlException: Root element is missing.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

   at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)

   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

   at System.Xml.XmlTextReaderImpl.Read()

   at System.Xml.XmlTextReader.Read()

   at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read()

   at System.Xml.XmlReader.MoveToContent()

   at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.MoveToContent()

   at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement()

   at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()

   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)

   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()

   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest

 request, HttpResponse response, Boolean& abortProcessing)

   --- End of inner exception stack trace ---

```

The call from flex looks good, the execution through the webservice is good, but this is the response I capture via wireshark, what is going on here?

I have tried several web methods, from "Hello World" to paramatized methods...all comeback with the same response...

I thought it may have something to do with encoding with the "---&gt", but I'm unsure how to control what .net renders as the response.


Question: SQL 2008 Dialect Support for NHibernate | Is anyone working on or know if there exists a SQL 2k8 Dialect for NHibernate?


Question:
Lucene exact ordering | I've had this long term issue in not quite understanding how to implement a decent Lucene sort or ranking. Say I have a list of cities and their populations. If someone searches "new" or "london" I want the list of prefix matches ordered by population, and I have that working with a prefix search and an sort by field reversed, where there is a population field, IE New Mexico, New York; or London, Londonderry.

However I also always want the exact matching name to be at the top. So in the case of "London" the list should show "London, London, Londonderry" where the first London is in the UK and the second London is in Connecticut, even if Londonderry has a higher population than London CT.

Does anyone have a single query solution?


Question:
Asynchronous Remoting calls | We have a remoting singleton server running in a separate windows service (let's call her RemotingService). The clients of the RemotingService are ASP.NET instances (many many).

Currently, the clients remoting call RemotingService and blocks while the RemotingService call is serviced. However, the remoting service is getting complicated enough (with more RPC calls and complex algorithms) that the asp.net worker threads are blocked for a significantly long time (4-5 seconds).

According to [this msdn article](http://msdn.microsoft.com/en-us/magazine/cc164128.aspx), doing this will not scale well because an asp.net worker thread is blocked for each remoting RPC. It advises switching to async handlers to free up asp.net worker threads.

>
> The purpose of an asynchronous handler
>  is to free up an ASP.NET thread pool
>  thread to service additional requests
>  while the handler is processing the
>  original request.
>
>
>

This seems fine, except the remoting call still takes up a thread from the thread pool.
Is this the same thread pool as the asp.net worker threads?

**How should I go about turning my remoting singleton server into an async system such that I free up my asp.net worker threads?**

I've probably missed out some important information, please let me know if there is anything else you need to know to answer the question.


Question: Enabling OpenGL in wxWidgets | I installed the wxWidgets source code, compiled it and am linking the libraries thus obtained with my application code. Now I need to use OpenGL in my wxWidgets application. How do I enable this?


Question: Where can I get the Windows Workflow "wca.exe" application? | I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't find that file. I thought it would be in the latest .NET 3.5 SDK, but I just downloaded and fully installed, and it's not there. Also, some MSDN forum posts had links posted that just go to 404s. So, where can I find wca.exe?


Question:
Making code work with register_globals turned off | I have inherited some legacy PHP code what was written back when it was standard practice to use [`register_globals`](http://php.net/register_globals) (As of PHP 4.2.0, this directive defaults to off, released 22. Apr 2002).

We know now that it is bad for security to have it enabled. The problem is how do I find all the places in the code where I need to use `$_GET` or `$_POST`? My only thought was to set the error reporting to warn about uninitialized variables and then test each part of the site. Is there an easier way? Will I have to test each code path in the site or will PHP give a warning on a file basis?


Question:
Is there a method for handling errors from COM objects in RDML? | Is there a method for handling errors from COM objects in RDML? For instance, when calling Word VBA methods like `PasteSpecial`, an error is returned and the LANSA application crashes. I cannot find anything in the documentation to allow handling of these errors.

Actually, error handling in general is a weak-point for LANSA and RDML, but that's another topic.


Question:
GUI Automation testing - Window handle questions | Our company is currently writing a GUI automation testing tool for compact framework applications. We have initially searched many tools but none of them was right for us.

By using the tool you can record test-cases and group them together to test-suites. For every test-suite there is generated an application, which launches the application-under-test and simulates user-input.

In general the tool works fine, but as we are using **window handles** for simulation user input, you can't do very many things. For example it is impossible for us to get the name of a control (we just get the caption).

Another problem using window handles is checking for a change. At the moment we simulate a click on a control and depending on the result we know if the application has gone to the next step.

Is there any other (simpler) way for doing such things (for example the message queue or anything else)?


Question:
What is the worst database accident that happened to you in production? | For example: Updating all rows of the customer table because you forgot to add the where clause.

1. What was it like, realizing it and reporting it to your coworkers or customers?
2. What were the lessons learned?


Question:
How to include PHP files that require an absolute path? | I have a directory structure like the following;

>
> script.php
>
>
> inc/include1.php
>
>  inc/include2.php
>
>
> objects/object1.php
>
>  objects/object2.php
>
>
> soap/soap.php
>
>
>

Now, I use those objects in both `script.php` and `/soap/soap.php`, I could move them, but I want the directory structure like that for a specific reason. When executing `script.php` the include path is `inc/include.php` and when executing `/soap/soap.php` it's `../inc`, absolute paths work, `/mnt/webdev/[project name]/inc/include1.php...` But it's an ugly solution if I ever want to move the directory to a different location.

So is there a way to use relative paths, or a way to programmatically generate the `"/mnt/webdev/[project name]/"`?


Question:
How do I index a database column | Hopefully, I can get answers for each database server.

For an outline of how indexing works check out: [How does database indexing work?](https://stackoverflow.com/questions/1108/how-does-database-indexing-work)


Question:
Document or RPC based web services | My gut feel is that document based web services are preferred in practice - is this other peoples experience? Are they easier to support? (I noted that SharePoint uses Any for the "document type" in its WSDL interface, I guess that makes it Document based).

Also - are people offering both WSDL and Rest type services now for the same functionality? WSDL is popular for code generation, but for front ends like PHP and Rails they seem to prefer rest.


Question:
Best format for displaying rendered time on a webpage | I've started to add the time taken to render a page to the footer of our internal web applications. Currently it appears like this

>
> Rendered in 0.062 seconds
>
>
>

Occasionally I get rendered times like this

>
> Rendered in 0.000 seconds
>
>
>

Currently it's only meant to be a guide for users to judge whether a page is quick to load or not, allowing them to quickly inform us if a page is taking 17 seconds rather than the usual 0.5. My question is what format should the time be in? At which point should I switch to a statement such as

>
> Rendered in less than a second
>
>
>

I like seeing the tenths of a second but the second example above is of no use to anyone, in fact it just highlights the limits of the calculation I use to find the render time. I'd rather not let the users see that at all! Any answers welcome, including whether anything should be included on the page.


Question:
Preferred way to use favicons? | I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a `favicon.ico` file in the root of the website.

I found this nice little guide: [How to Add a Favicon](http://www.w3.org/2005/10/howto-favicon). However, the preferred method did not work in IE (7) and the second method is the old fashioned way (which I resigned myself to use).

Is there a third method that works across all the most popular browsers?


Question:
What are real life applications of yield? | I know what `yield` does, and I've seen a few examples, but I can't think of real life applications, have you used it to solve some specific problem?

(Ideally some problem that cannot be solved some other way)


Question: ASP/VBScript - Int() vs CInt() | What is the difference in ASP/VBScript between `Int()` and `CInt()`?


Question: Non Public Members for C# Interfaces | In C#, when you implement an interface, all members are implicitly public. Wouldn't it be better if we could specify the accessibility modifier (`protected`, `internal`, except `private` of course), or should we just use an abstract class instead?


Question: Learning Regular Expressions | I don't really understand regular expressions. Can you explain them to me in an easy-to-follow manner? If there are any online tools or books, could you also link to them?


Question:
String literals and escape characters in postgresql | Attempting to insert an escape character into a table results in a warning.

For example:

```
create table EscapeTest (text varchar(50));

insert into EscapeTest (text) values ('This is the first part \n And this is the second');

```

Produces the warning:

```
WARNING:  nonstandard use of escape in a string literal

```

(*Using PSQL 8.2*)

Anyone know how to get around this?


Question:
VS.NET Application Diagrams | Have you used VS.NET Architect Edition's Application and System diagrams to start designing a solution?

If so, did you find it useful?
Did the "automatic implementation" feature work ok?


Question:
Parse usable Street Address, City, State, Zip from a string | Problem: I have an address field from an Access database which has been converted to SQL Server 2005. This field has everything all in one field. I need to parse out the address's individual sections into their appropriate fields in a normalized table. I need to do this for approximately 4,000 records, and it needs to be repeatable.

Assumptions:

1. Assume an address in the US (for now)
2. assume that the input string will sometimes contain an addressee (the person being addressed) and/or a second street address (i.e. Suite B)
3. states may be abbreviated
4. zip code could be standard 5 digits or zip+4
5. there are typos in some instances

UPDATE: In response to the questions posed, standards were not universally followed; I need need to store the individual values, not just geocode and errors means typo (corrected above)

Sample Data:

* A. P. Croll & Son 2299 Lewes-Georgetown Hwy, Georgetown, DE 19947
* 11522 Shawnee Road, Greenwood DE 19950
* 144 Kings Highway, S.W. Dover, DE 19901
* Intergrated Const. Services 2 Penns Way Suite 405 New Castle, DE 19720
* Humes Realty 33 Bridle Ridge Court, Lewes, DE 19958
* Nichols Excavation 2742 Pulaski Hwy Newark, DE 19711
* 2284 Bryn Zion Road, Smyrna, DE 19904
* VEI Dover Crossroads, LLC 1500 Serpentine Road, Suite 100 Baltimore MD 21
* 580 North Dupont Highway Dover, DE 19901
* P.O. Box 778 Dover, DE 19903


Question: How to generate a core dump in Linux on a segmentation fault? | I have a process in Linux that's getting a segmentation fault. How can I tell it to generate a core dump when it fails?


Question:
How to wait for thread complete before continuing? | I have some code for starting a thread on the .NET CF 2.0:

```
ThreadStart tStart = new ThreadStart(MyMethod);
Thread t = new Thread(tStart);
t.Start();

```

If I call this inside a loop the items completely out of order. How do introduce a wait after `t.Start()`, so that the work on the thread completes before the code continues? Will BeginInvoke/EndInvoke be a better option for this than manually creating threads?


Question:
Can a proxy server cache SSL GETs? If not, would response body encryption suffice? | Can a (||any) proxy server cache content that is requested by a client over https? As the proxy server can't see the querystring, or the http headers, I reckon they can't.

I'm considering a desktop application, run by a number of people behind their companies proxy. This application may access services across the internet and I'd like to take advantage of the in-built internet caching infrastructure for 'reads'. If the caching proxy servers can't cache SSL delivered content, would simply encrypting the content of a response be a viable option?

I am considering all GET requests that we wish to be cachable be requested over http with the body encrypted using asymmetric encryption, where each client has the decryption key. Anytime we wish to perform a GET that is not cachable, or a POST operation, it will be performed over SSL.


Question:
What was the <XMP> tag used for? | Does anyone remember the `XMP` tag?

What was it used for and why was it deprecated?


Question: RSS Feeds in ASP.NET MVC | How would you reccommend handling RSS Feeds in ASP.NET MVC? Using a third party library? Using the RSS stuff in the BCL? Just making an RSS view that renders the XML? Or something completely different?


Question:
UrlEncode through a console application? | Normally I would just use:

```
HttpContext.Current.Server.UrlEncode("url");

```

But since this is a console application, `HttpContext.Current` is always going to be `null`.

Is there another method that does the same thing that I could use?


Question:
In Cocoa do you prefer NSInteger or int, and why? | `NSInteger`/`NSUInteger` are Cocoa-defined replacements for the regular built-in types.

Is there any benefit to using the NS\* types over the built-ins? Which do you prefer and why? Are `NSInteger` and `int` the same width on 32-bit / 64-bit platforms?


Question:
Debugging: IE6 + SSL + AJAX + post form = 404 error | **The Setting:**

The program in question tries to post form data via an AJAX call to a target procedure contained in the same package as the caller. This is done for a site that uses a secure connection (HTTPS). The technology used here is [PLSQL](http://www.orafaq.com/wiki/PL/SQL_FAQ) and the [DOJO](http://dojotoolkit.org/) JavaScript library. The development tool is [basically a text editor](http://www.allroundautomations.nl/plsqldev.html).

**Code Snippet:**

```
> function testPost() {
>>    dojo.xhrPost( {
             url: ''dr_tm_w_0120.test_post'',
             form: ''orgForm'',
             load: testPostXHRCallback,
             error: testPostXHRError
            });
      }

> function testPostXHRCallback(data,ioArgs) {
>>          alert(''post callback'');
          try{
          dojo.byId("messageDiv").innerHTML = data;
          }
          catch(ex){
                if(ex.name == "TypeError")
                {
                  alert("A type error occurred.");
                }
          }
          return data;
       }
>
function testPostXHRError(data, ioArgs) {
>>          alert(data);
          alert(''Error when retrieving data from the server!'');
          return data;
       }

```

**The Problem:**

When using IE6 (which the entire user-base uses), the response sent back from the server is a 404 error.

**Observations:**

The program works fine in Firefox.

The calling procedure cannot target any procedures within the same package.

The calling procedure can target outside sites (both http, https).

The other AJAX calls in the package that are not posts of form data work fine.

I've searched the *internets* and consulted with senior-skilled team members and haven't discovered anything that satisfactorily addresses the issue.

\*Tried [Q&A](http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/xhrpost-firefox-fine-ie-not-so-much) over at Dojo support forums.

**The Questions:**

What troubleshooting techniques do you recommend?

What troubleshooting tools do you recommend for HTTPS analyzing?

Any hypotheses on what the issue might be?

Any ideas for workarounds that aren't total (bad) hacks?

**Ed. The Solution**

lomaxx, thx for the [fiddler](http://www.orafaq.com/wiki/PL/SQL_FAQ) tip. you have no idea how awesome it was to get that and use it as a debugging tool. after starting it up this is what i found and how i fixed it (at least in the short term):

```
> ef Fri, 8 Aug 2008 14:01:26 GMT dr_tm_w_0120.test_post: SIGNATURE (parameter names) MISMATCH VARIABLES IN FORM NOT IN PROCEDURE: SO1_DISPLAYED_,PO1_DISPLAYED_,RWA2_DISPLAYED_,DD1_DISPLAYED_ NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM: 0

```

After seeing that message from the server, I kicked around Fiddler a bit more to see what else I could learn from it. Found that there's a WebForms tab that shows the values in the web form. Wouldn't you know it, the "`xxx_DISPLAYED_`" fields above were in it.

I don't really understand yet why these fields exist, because I didn't create them explicitly in the web `PLSQL` code. But I do understand now that the target procedure has to include them as parameters to work correctly. Again, this is only in the case of `IE6` for me, as Firefox worked fine.

Well, that the short term answer and hack to fix it. Hopefully, a little more work in this area will lead to a better understanding of the fundamentals going on here.


Question:
Pylons error - 'MySQL server has gone away' | I'm using Pylons (a python framework) to serve a simple web application, but it seems to die from time to time, with this in the error log: `(2006, 'MySQL server has gone away')`

I did a bit of checking, and saw that this was because the connections to MySQL were not being renewed. This shouldn't be a problem though, because the `sqlalchemy.pool_recycle` in the config file should automatically keep it alive. The default was `3600`, but I dialed it back to `1800` because of this problem. It helped a bit, but `3600` *should* be fine according to the docs. The errors still happen semi-regularly. I don't want to lower it too much though and DOS my own database :).

Maybe something in my MySQL config is goofy? Not sure where to look exactly.

Other relevant details:

```
  Python 2.5
  Pylons: 0.9.6.2 (w/ sql_alchemy)
  MySQL: 5.0.51

```


Question:
Calculate DateTime Weeks into Rows | I am currently writing a small calendar in ASP.Net C#. Currently to produce the rows of the weeks I do the following for loop:

```
var iWeeks = 6;
for (int w = 0; w < iWeeks; w++) {

```

This works fine, however, some month will only have 5 weeks and in some rare cases, 4.

How can I calculate the number of rows that will be required for a particular month?

This is an example of what I am creating:

![enter image description here](https://i.stack.imgur.com/NkxN7.png)

As you can see for the above month, there are only 5 rows required, however. Take the this month (August 2008) which started on a Saturday and ends on a Monday on the 6th Week/Row.

***Image found on google***

---

This is an example of what I am creating:

![enter image description here](https://i.stack.imgur.com/NkxN7.png)

As you can see for the above month, there are only 5 rows required, however. Take the this month (August 2008) which started on a Saturday and ends on a Monday on the 6th Week/Row.

***Image found on google***


Question:
Displaying ad content from Respose.WriteFile()/ Response.ContentType | How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request.

This would allow people to hit a url to the type <http://www.foo.com?Image=test.jpg> and have the image display in their browser. So as you may know this revolves around the use of Response.ContentType.

By using

```
Response.ContentType = "application/octet-stream";

```

I am able to display images of type gif/jpeg/png (all i have tested so far), bit trying to display .swf or .ico files gives me a nice little error.

using

```
Response.ContentType = "application/x-shockwave-flash";

```

I can get flash files to play, but then the images are messed.

So how do i **easily** choose the contenttype?


Question: Call Project Server Interface web method from an msi installer | I'm using a Visual Studio web setup project to install an application that extends the functionality of Project Server. I want to call a method from the PSI ( Project Server Interface ) from one of the custom actions of my setup project, but every time a get a "401 Unauthorized access" error. What should I do to be able to access the PSI? The same code, when used from a Console Application, works without any issues.


Question:
Choosing a new development machine | I'm not sure how this question will be recieved here but lets give it a shot...

It's time for me to get a new dev PC. What's the best choice these days?

I typically have 2-3 Visual Studios open along with mail and all that stuff. Ideally I would imagine 2+ GB of RAM would be nice as my current XP box is dying. =)

I hopped on the Dell site (my days of building PC's are behind me. I just need something that gets the job done.) and started browsing around only to be confused from all the processor choices. What does a typical dev box need these days? Duo? Quad?

Is it worth going to 64 bit Vista as well?

It's been a while since I got a new machine so I'm just looking for some guidance.

Thanks


Question:
ASP.NET Proxy Application | Let me try to explain what I need. I have a server that is visible from the internet. What I need is to create a ASP.NET application that get the request of a web Site and send to a internal server, then it gets the response and publish the the info. For the client this should be totally transparent.

For different reasons I cannot redirect the port to the internal server. What I can do but no know how - maybe the answer is there - is to create a new Web Site that its host in the other server.


Question:
SQL Client for Mac OS X that works with MS SQL Server | How can I connect to a remote SQL server using Mac OS X? I don't really need a GUI, but it would be nice to have for the color coding and resultset grid. I'd rather not have to use a VM.

Is there a SQL client for Mac OS X that works with MS SQL Server?


Question:
GUI system development resources? | Could someone recommend any good resources for creating Graphics User Interfaces, preferably in C/C++?

Currently my biggest influence is [3DBuzz.com](http://www.3dbuzz.com)'s [C++/OpenGL VTMs](http://www.3dbuzz.com/xcart/product.php?productid=30&cat=12&page=1) (Video Training Modules). While they are very good, they cover a large area of graphics programming, so only skim the surface of GUI programming.

This question does relate to "[How do I make a GUI?](https://stackoverflow.com/questions/7489/how-do-i-make-a-gui)", where there is also a rough outline of my current structure.

Any response would be appreciated.

**Edit:**
I've just read some of the answers and spotted that I've missed some points. I had to type the question twice as I caught the wrong button and lost it.

I missed two important points, first: This will be used cross platform including homebrew on a Sony PSP. Second: I want to create a GUI system not use an existing one.

**Edit 2:** I think some of you are missing the point, I don't what to **use** an existing GUI system I want to build one.

Qt in it's current form is not portable to the PSP, never mind the overkill of such a task.

That said I've decided to create an IM-GUI, and have started to prototype the code.


Question:
How to setup site-wide variables in php? | I want to define something like this in *php*:

```
$EL = "\n<br />\n";

```

and then use that variable as an "endline" marker all over my site, like this:

```
echo "Blah blah blah{$EL}";

```

How do I define $EL once (in only 1 file), include it on every page on my site, and *not* have to reference it using the (strangely backwards) `global $EL;` statement in every page function?


Question: Limit size of Queue<T> in .NET? | I have a Queue<T> object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items. Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class?


Question: In Cocoa do I need to remove an Object from receiving KVO notifications when deallocating it? | When I've registered an object **foo** to receive KVO notifications from another object **bar** (using addObserver:...), if I then deallocate **foo** do I need to send a `removeObserver:forKeyPath:` message to **bar** in -dealloc?


Question:
Multiple choice on WinForms | What's the best way of implementing a multiple choice option in Windows Forms? I want to enforce a single selection from a list, starting with a default value.

It seems like a ComboBox would be a good choice, but is there a way to specify a non-blank default value?

I could just set it in the code at some appropriate initialisation point, but I feel like I'm missing something.


Question:
How do you set your LAMP testing server? | I am using xampp on Windows, but I would like to use something closer to my server setup.

[Federico Cargnelutti tutorial](http://phpimpact.wordpress.com/2008/05/24/virtual-appliances-lamp-development-made-easy/) explains how to setup LAMP VMWARE appliance; it is a great introduction to VMware appliances, but one of the commands was not working and it doesn't describe how to change the keyboard layout and the timezone.

ps: the commands are easy to find but I don't want to look for them each time I reinstall the server. I am using this question as a reminder.


Question:
Is there a real benefit of using J#? | I just saw a [comment of suggesting J#](https://stackoverflow.com/questions/5516/what-happened-to-all-of-the-java-developers-how-can-i-get-started-in-net#5522), and it made me wonder... is there a real, beneficial use of J# over Java? So, my feeling is that the only reason you would even consider using J# is that management has decreed that the company should jump on the Java bandwagon... and the .NET bandwagon. If you use J#, you are effectively losing the biggest benefit of picking Java... rich cross platform support. Sure there is Mono, but it's not as richly supported or as full featured right? I remember hearing Forms are not fully (perhaps at all) supported.

I'm not trying to bash .NET here, I'm just saying, if you are going to go the Microsoft route, why not just use C#? If you are going to go the Java route, why would J# enter the picture?

I'm hoping to find some real world cases here, so please especially respond if you've ACTUALLY used J# in a REAL project, and why.


Question:
When should a multi-module project to split into separate repository trees? | Currently we have a project with a standard subversion repository layout of:

./trunk

./branches

./tags

However, as we're moving down the road of OSGi and a modular project, we've ended up with:

./trunk/bundle/main

./trunk/bundle/modulea

./trunk/bundle/moduleb
./tags/bundle/main-1.0.0

./tags/bundle/main-1.0.1

./tags/bundle/modulea-1.0.0

The 'build' is still quite monolithic in that it builds all modules in sequence, though I'm starting to wonder if we should refactor the build/repository to something more like:

./bundle/main/trunk

./bundle/main/tags/main-1.0.0

./bundle/main/tags/main-1.0.1

./bundle/modulea/trunk

./bundle/modulea/tags/modulea-1.0.0

In this pattern I would imagine each module building itself, and storing its binary in a repository (maven, ivy, or another path of the subversion repository itself).

Are there guidelines or 'best-practices' over project layouts once one goes modular?


Question:
High availability | Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster.

Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to redirect traffic to the failover server. Not too bothered about losing messages. I'd just prefer not to write the code to handle re-routing.


Question:
Where can I find some good WS-Security introductions and tutorials? | Can anyone point me to some decent introductions to WS-Security?

I'm looking for tutorials or something that provide a fairly gentle introduction to the subject, though I don't mind if it assumes basic knowledge of web services and SOAP. Most of the stuff I've seen so far is very technical and you need a lot of complex, detailed background knowledge to understand it properly.

We have to implement a web service in PHP and one or more clients in .NET, so resources covering both would be much appreciated.


Question:
Remove Quotes and Commas from a String in MySQL | I'm importing some data from a `CSV` file, and numbers that are larger than `1000` get turned into `1,100` etc.

What's a good way to remove both the quotes and the comma from this so I can put it into an `int` field?

**Edit:**

The data is actually already in a MySQL table, so I need to be able to this using SQL. Sorry for the mixup.


Question:
C/C++ library for reading MIDI signals from a USB MIDI device | I want to write C/C++ programs that take input from a MIDI device.

The MIDI device connects to my PC using a USB connector.

I'm looking for a (C/C++ implemented) library that I can use to read the MIDI signals from the MIDI device through the USB port.

I'm happy manipulating the MIDI data once I get it, I just don't want to have to implement the code for its capture.

I'm planning on writing my code using the Bloodshed Dev-C++ IDE on Windows XP.


Question:
What is the value-binding syntax in xaml? | I'm getting all learned up about binding in WPF. I'm having a lot of trouble debugging the parse errors in my xaml, though. Can somebody pretty please tell me what's wrong with this little piece? :

```
<Border Name="TrackBackground"
    Margin="0"
    CornerRadius="2"
    Grid.Row="1"
    Grid.Column="1"
    Background="BlanchedAlmond"
    BorderThickness="1"
    Height="{TemplateBinding Height}">

    <Canvas Name="PART_Track" Background="DarkSalmon" Grid.Row="1" Grid.Column="1">
        <Thumb Name="ThumbKnob" Height="{Binding ElementName=Part_Track, Path=Height, Mode=OneWay}" />
    </Canvas>
</Border>

```

It's the databinding that breaks. I get an `InvalidAttributeValue` exception for ThumbKnob.Height when I try to run this. I know I must be missing something fundamental. So fill me in, stackers, and my gratitude will be boundless.

---

Changing the ElementName didn't help. There must me something else I'm not getting.

I should mention that I'm testing this in Silverlight. The exact message I'm getting out of Internet Explorer is:

`XamlParseException: Invalid attribute value for property Height.`

This whole thing is inside a ControlTemplate. I'm making a slider control just to teach myself the concepts.


Question:
best practice for releasing Microsoft dll's in setup | I'm working on a setup which *wants to include the Microsoft.Web.Services3 (WSE 3.0) DLL*. However, I typically do not like including Microsoft DLL's in our installs except by way of Microsoft's redistributables. There is both a developer and a redist install package available from Microsoft.

So, as a best practice, should I include the single DLL in my install or refer them to one of the WSE 3.0 installs (assuming they do not already have it installed)?


Question:
Validate Enum Values | I need to validate an integer to know if is a valid enum value.

What is the best way to do this in C#?


Question:
Playing wave file ends immediately (C++, Windows) | I have got the following situation. On a machine there is a **Fritz ISDN** card. There is a process that is responsible for playing a certain wave file on this device's wave out (**ISDN** connection is made at startup and made persistent). The scenario is easy, whenever needed the process calls `waveOutWrite()` on the previously opened wave device (everything initialized without any problems of course) and a callback function waits for `MM_WOM_DONE` msg to know that the playback has been finished.

Since a few days however (nothing changed neither in the process nor the machine) the `MM_WOM_DONE` message has been coming immediately after calling `waveOutWrite()` even though the wave lasts a couple of seconds. Again no error is reported, it looks like the file was played but had zero length (which is not the case). I am also sure that `waveOutReset()` was not called by my process (it would also trigger sending the mentioned message). I have already used to have some strange problems in the past that where solved simply by reinstalling **TAPI** drivers. This time for some reason it is problematic for me to perform that once again and I am trying more analytical approach :). Any suggestions what might cause such a behavior? Maybe something on the other end of the **ISDN** line?


Question:
SQL Server 2005 - Export table programmatically (run a .sql file to rebuild it) | I have a database with a table Customers that have some data

I have another database in the office that everything is the same, but my table Customers is empty

How can I create a sql file in SQL Server 2005 (T-SQL) that takes everything on the table Customers from the first database, creates a, let's say, buildcustomers.sql, I zip that file, copy it across the network, execute it in my SQL Server and voila! my table Customers is full

How can I do the same for a whole database?


Question:
How to stop an animation in C# / WPF? | I have something like this:

```

barProgress.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation(
    barProgress.Value, dNextProgressValue,
    new Duration(TimeSpan.FromSeconds(dDuration)));

```

Now, how would you stop that animation (the `DoubleAnimation`)? The reason I want to do this, is because I would like to start new animations (this seems to work, but it's hard to tell) and eventually stop the last animation...


Question:
Pass by reference or pass by value? | When learning a new programming language, one of the possible roadblocks you might encounter is the question whether the language is, by default, *pass-by-value or pass-by-reference*.

So here is my question to all of you, in your favorite language, *how* is it actually done? And what are the *possible pitfalls*?

Your favorite language can, of course, be anything you have ever played with: [popular](http://www.ruby-lang.org/en/), [obscure](http://www.devtopics.com/a-obscure-programming-language-of-the-month/), [esoteric](http://en.wikipedia.org/wiki/Brainfuck), [new](http://www.nvidia.com/object/cuda_get.html), [old](http://en.wikipedia.org/wiki/FORTRAN)...


Question:
Best practise to authorize all users for just one page | What is the best way to authorize all users to one single page in a asp.net website.

For except the login page and one other page, I deny all users from viewing pages in the website.

How do you make this page accessible to all users?


Question:
why are downloads sometimes tagged md5, sha1 and other hash indicators? | I've seen this all over the place:

>
> Download here! SHA1 =
>  8e1ed2ce9e7e473d38a9dc7824a384a9ac34d7d0
>
>
>

What does it mean? How does a hash come into play as far as downloads and... What use can I make of it? Is this a legacy item where you used to have to verify some checksum after you downloaded the whole file?


Question:
Creation Date of Compiled Executable (VC++ 2005) | The creation date of an executable linked in VS2005 is not set to the real creation-date of the `.exe` file. Only a complete re-build will set the current date, a re-link will not do it. Obviously the file is set to some date, which is taken from one of the project-files.

So: is there a way to force the linker to set the creation-date to the real link-date?


Question:
What is the best way to handle multiple permission types? | I often encounter the following scenario where I need to offer many different types of permissions. I primarily use ASP.NET / VB.NET with SQL Server 2000.

**Scenario**

I want to offer a dynamic permission system that can work on different parameters. Let's say that I want to give either a department or just a specific person access to an application. And pretend that we have a number of applications that keeps growing.

In the past, I have chosen one of the following two ways that I know to do this.

1. Use a single permission table with special columns that are used for
determining a how to apply the parameters. The special columns in
this example are `TypeID` and `TypeAuxID`. The SQL would look something
like this.

```
SELECT COUNT(PermissionID)
FROM application_permissions
WHERE
(TypeID = 1 AND TypeAuxID = @UserID) OR
(TypeID = 2 AND TypeAuxID = @DepartmentID)
AND ApplicationID = 1

```
2. Use a mapping table for each type of permission, then joining them
all together.

```
SELECT COUNT(perm.PermissionID)
FROM application_permissions perm
LEFT JOIN application_UserPermissions emp
ON perm.ApplicationID = emp.ApplicationID
LEFT JOIN application_DepartmentPermissions dept
ON perm.ApplicationID = dept.ApplicationID
WHERE q.SectionID=@SectionID
  AND (emp.UserID=@UserID OR dept.DeptID=@DeptID OR
 (emp.UserID IS NULL AND dept.DeptID IS NULL)) AND ApplicationID = 1
ORDER BY q.QID ASC

```

**My Thoughts**

I hope that the examples make sense. I cobbled them together.

The first example requires less work, but neither of them feel like the best answer. Is there a better way to handle this?


Question:
How do I get rid of the "multiple describeType entries" warning? | Does anyone know why when using BindingUtils on the selectedItem property of a ComboBox you get the following warning? Any ideas how to resolve the issue?

The binding still works properly, but it would be nice to get rid of the warning.

```
warning: multiple describeType entries for 'selectedItem' on type 'mx.controls::ComboBox':
<accessor name="selectedItem" access="readwrite" type="Object" declaredBy="mx.controls::ComboBase">
  <metadata name="Bindable">
    <arg key="" value="valueCommit"/>
  </metadata>

```


Question:
How can I deploy artifacts from a Maven build to the SourceForge File Release System? | I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I have come across some old postings on other forums suggesting that the only approach is to write a Wagon specifically for SourceForge.

Has anybody had any recent experience with this?


Question:
Automating VMWare or VirtualPC | I'm currently experimenting with build script, and since I have an ASP.net Web Part under source control, my build script should do that at the end:

1. Grab the "naked" Windows 2003 IIS VMWare or Virtual PC Image from the Network
2. Boot it up
3. Copy the Files from the Build Folder to the Server
4. Install it
5. Do whatever else is needed

I have never tried automating a Virtual Machine, but I saw that both VMWare and Virtual Server offer automation facilities. While I cannot use Virtual Server (Windows XP Home :-(), Virtual PC works.

Does anyone here have experience with either VMWare Server or Virtual PC 2007 SP1 in terms of automation?

Which one is better suited (I run windows, so the Platform-independence of VMWare does not count) and easier to automate?


Question: GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT errors | I'm using [FBO](http://en.wikipedia.org/wiki/Framebuffer_Object)s in my OpenGL code and I'm seeing compilation errors on `GL\_FRAMEBUFFER\_INCOMPLETE\_DUPLICATE\_ATTACHMENT\_EXT`. What's the cause of this and how do I fix it?


Question: Format string to title case | How do I format a string to [title case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm)?


Question:
Asynchronous multi-direction server-client communication over the same open socket? | I have a client-server app where the client is on a Windows Mobile 6 device, written in C++ and the server is on full Windows and written in C#.

Originally, I only needed it to send messages from the client to the server, with the server only ever sending back an acknowledgment that it received the message. Now, I would like to update it so that the server can actually send a message to the client to request data. As I currently have it set up so the client is only in receive mode after it sends data to the server, this doesn't allow for the server to send a request at any time. I would have to wait for client data. My first thought would be to create another thread on the client with a separate open socket, listening for server requests...just like the server already has with respect to the client. Is there a way, within the same thread and using the same socket, for all the servers to send requests at any time?

Can you use something to the effect of `WaitForMultipleObjects()` and pass it a receive buffer and an event that tells it there is data to be sent?


Question:
How do I do a string replacement in a PowerShell function? | How do I convert function input parameters to the right type?

I want to return a string that has part of the URL passed into it removed.

**This works, but it uses a hard-coded string:**

```
function CleanUrl($input)
{
    $x = "http://google.com".Replace("http://", "")
    return $x
}

$SiteName = CleanUrl($HostHeader)
echo $SiteName

```

**This fails:**

```
function CleanUrl($input)
{
    $x = $input.Replace("http://", "")
    return $x
}

Method invocation failed because [System.Array+SZArrayEnumerator] doesn't contain a method named 'Replace'.
At M:\PowerShell\test.ps1:13 char:21
+     $x = $input.Replace( <<<< "http://", "")

```


Question:
Programmatically talking to a Serial Port in OS X or Linux | I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial .

When i do this everything seems to be hunky-dory:

```
stty -f /dev/cu.usbserial
speed 9600 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost -onlcr -oxtabs
cflags: cs8 -parenb

```

Everything also works when I use the [serial port tool](http://www.versiontracker.com/dyn/moreinfo/macosx/24024) to talk to it.

If I run this piece of code while the above mentioned serial port tool, everthing also works. But as soon as I disconnect the tool the connection gets lost.

```
#!/usr/bin/python

import serial

ser = serial.Serial('/dev/cu.usbserial', 9600, timeout=10)
ser.write("<ID01><PA> \r\n")
read_chars = ser.read(20)
print read_chars

ser.close()

```

So the question is, what magicks do I need to perform to start talking to the serial port without the serial port tool? Is that a permissions problem? Also, what's the difference between /dev/cu.usbserial and /dev/tty.usbserial?

---

Nope, no serial numbers. The thing is, the problem persists even with sudo-running the python script, and the only thing that makes it go through if I open the connection in the gui tool that I mentioned.


Question:
How to attach a ChangeEvent handler to an inherited dependency property? | How would you attach a propertychanged callback to a property that is inherited? Like such:

```
class A {
  DependencyProperty prop;
}

class B : A {
   //...
   prop.AddListener(PropertyChangeCallback);
}

```


Question: Merge Sort a Linked List | I was recently brushing up on some fundamentals and found merge sorting a linked list to be a pretty good challenge. If you have a good implementation then show it off here.


Question:
How would I get started writing my own firewall? | There is previous little on the google on this subject other than people asking this very same question.

How would I get started writing my own firewall?

I'm looking to write one for the windows platform but I would also be interested in this information for other operating systems too.


Question:
Can I access ASP.NET Development server in an intranet? | Im testing an ASP.NEt site. When I execute it, it starts the ASP.NET Development Server and opens up a page.

Now I want to test it in the intranet I have.

1. Can I use this server or I need to configure IIS in this machine?
2. Do I need to configure something for it to work?

I've changed the localhost to the correct IP and I opened up the firewall.

Thanks


Question:
How can I refactor HTML markup out of my property files? | I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the JSP files look like:

```
<p>
    <bean:message key="alert" />
</p>

```

and the properties files look like:

```
messages.properties
alert=Please update your <a href="/address.do">address</a> and <a href="/contact.do">contact information</a>.

```

with the appropriate translations in N other languages (messages\_fr.properties, etc).

Problems:

1. ***DRY violation*** - I have N references to my Struts action URLs instead of 1, which makes refactoring action URLs error-prone.
2. ***Mixed concerns*** - My application's markup is now in more than just my JSP files, making it difficult for a web specialist to tweak the markup (using CSS, etc).
3. ***Post-translation markup*** - Anytime I receive newly-translated text, I must decide what to surround with the `<a>...</a>` markup. Easy for English but less so for unfamiliar languages.

I've considered adding placeholders in the messages file, like:

```
alert=Please update your {0} and {1}.

```

but then the words "address" and "contact information" would somehow need to be localized, wrapped with markup, and passed to my message tag - and I can't see an easy way to do it.

What can I do to improve this?


Question:
Browser Sync across many machines | Everyone remembers google browser sync right? I thought it was great. Unfortunately Google decided not to upgrade the service to Firefox 3.0. Mozilla is developing a replacement for google browser sync which will be a part of the Weave project. I have tried using Weave and found it to be very very slow or totally inoperable. Granted they are in a early development phase right now so I can not really complain.

This specific problem of browser sync got me to thinking though. What do all of you think of Mozilla or someone making a server/client package that we, the users, could run on your 'main' machine? Now you just have to know your own IP or have some way to announce it to your client browsers at work or wherever.

There are several problems I can think of with this: non static IPs, Opening up ports on your local comp etc. It just seems that Mozilla does not want to handle this traffic created by many people syncing their browsers. There is not a way for them to monetize this traffic since all the data uploaded must be encrypted.


Question:
When should assertions stay in production code? | There's a [discussion](http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/8e0235d58c8635c2 "assertions: does it matter that they are disabled in production?") going on over at comp.lang.c++.moderated about whether or not assertions, which in C++ only exist in debug builds by default, should be kept in production code or not.

Obviously, each project is unique, so my question here is **not** so much **whether** assertions should be kept, **but in which cases** this is recommendable/not a good idea.

By assertion, I mean:

* A run-time check that tests a condition which, when false, reveals a bug in the software.
* A mechanism by which the program is halted (maybe after really minimal clean-up work).

I'm not necessarily talking about C or C++.

My own opinion is that if you're the programmer, but don't own the data (which is the case with most commercial desktop applications), you should keep them on, because a failing asssertion shows a bug, and you should not go on with a bug, with the risk of corrupting the user's data. This forces you to test strongly before you ship, and makes bugs more visible, thus easier to spot and fix.

What's your opinion/experience?

See related question [here](https://stackoverflow.com/questions/419406/are-assertions-good)

---

**Responses and Updates**

>
> An assertion is error, pure and simple and therefore should be handled like one.
> Since an error should be handled in release mode then you don't really need assertions.
>
>
>

That's why I prefer the word "bug" when talking about assertions. It makes things much clearer. To me, the word "error" is too vague. A missing file is an error, not a bug, and the program should deal with it. Trying to dereference a null pointer is a bug, and the program should acknowledge that something smells like bad cheese.

Hence, you should test the pointer with an assertion, but the presence of the file with normal error-handling code.

---

Slight off-topic, but an important point in the discussion.

As a heads-up, if your assertions break into the debugger when they fail, why not. But there are plenty of reasons a file could not exist that are completely outside of the control of your code: read/write rights, disk full, USB device unplugged, etc. Since you don't have control over it, I feel assertions are not the right way to deal with that.

---

Yes, I have Code Complete, and must say I strongly disagree with that particular advice.

Say your custom memory allocator screws up, and zeroes a chunk of memory that is still used by some other object. I happens to zero a pointer that this object dereferences regularly, and one of the invariants is that this pointer is never null, and you have a couple of assertions to make sure it stays that way. What do you do if the pointer suddenly is null. You just if() around it, hoping that it works?

Remember, we're talking about product code here, so there's no breaking into the debugger and inspecting the local state. This is a real bug on the user's machine.


Question:
What is the best way to store connection string in .NET DLLs? | The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection string needs to have a DB username and password. The DLL currently has the database connection string hard coded, but I don't want to do this when we launch as the assembly can be disassembled and the username and password would be right there in the open.

One of the requirements is that the password needs to be changed once every few months, so we would need to roll that out to our internal user base.

Is there a way to store the password encrypted in such a way we can easily distribute to the entire user base without storing it in the assembly?

UPDATE: Thanks to everyone who's answered. I'll try to answer some of the questions back to me... The data DLL is used by both ASP.NET WebForms and VB.NET WinForms. I understand that Applications can have their own config files, but I haven't seen anything on config files for DLLs. Unfortunately, I can't get to the Jon Galloway post at work so I can't judge if that will work. From a development standpoint, we don't want to use web services inhouse, but may be providing them to third parties sometime next year. I don't think impersonation will work because we can't authenticate the user through the firewall. As a user (or former user) can be an attacker, we're keeping it from everyone!


Question:
How do you impersonate an Active Directory user in Powershell? | I'm trying to run powershell commands through a web interface (ASP.NET/C#) in order to create mailboxes/etc on Exchange 2007. When I run the page using Visual Studio (Cassini), the page loads up correctly. However, when I run it on IIS (v5.1), I get the error "unknown user name or bad password". The biggest problem that I noticed was that Powershell was logged in as ASPNET instead of my Active Directory Account. How do I force my Powershell session to be authenticated with another Active Directory Account?

Basically, the script that I have so far looks something like this:

```
RunspaceConfiguration rc = RunspaceConfiguration.Create();
PSSnapInException snapEx = null;
rc.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapEx);

Runspace runspace = RunspaceFactory.CreateRunspace(rc);
runspace.Open();

Pipeline pipeline = runspace.CreatePipeline();
using (pipeline)
{
   pipeline.Commands.AddScript("Get-Mailbox -identity 'user.name'");
   pipeline.Commands.Add("Out-String");

   Collection<PSObject> results = pipeline.Invoke();

   if (pipeline.Error != null && pipeline.Error.Count > 0)
   {
       foreach (object item in pipeline.Error.ReadToEnd())
          resultString += "Error: " + item.ToString() + "\n";
   }

   runspace.Close();

   foreach (PSObject obj in results)
      resultString += obj.ToString();
}

return resultString;

```


Question:
Bandwith throttling in IIS 6 by IP Address | I am writing an application that downloads large files in the background. All clients are logged in locally, or through a VPN. When they are logged in locally, I do not want to throttle downloads. However, I would like to limit downloads to 10 KBps when the user is connected via VPN. I can differentiate between these users by IP Address range.

Since this is an AIR Application, I figure I will throttle via server-side since I can do it from either the server itself (IIS 6) or the web service (asp.net / C#).

Throttling through IIS 6 seems to work fine, but it seems like it has to be done across the entire web site. Is there anyway to do this via IP? Or will I have to rig this up in .NET?


Question: How do I find the high water mark (for sessions) on Oracle 9i | How can I find the high water mark (the historical maximum number of concurrent users) in an **oracle database (9i)**.


Question:
Trigger without a transaction? | Is it possible to create a trigger that will not be in a transaction?

I want to update data on a linked server with a trigger but due to firewall issues we can't create a distributed transaction between the two servers.


Question: What are the best solutions for flash charts and graphs? | I'm aware of [FusionCharts](http://www.fusioncharts.com/), are there other good solutions, or APIs, for creating charts in Adobe Flash?


Question:
Variable Bindings in WPF | I’m creating a UserControl for a rich TreeView (one that has context menus for renaming nodes, adding child nodes, etc.). I want to be able to use this control to manage or navigate any hierarchical data structures I will create. I currently have it working for any data structure that implements the following interface (the interface need not actually be implemented, however, only the presence of these members is required):

```
interface ITreeItem
{
    string Header { get; set; }
    IEnumerable Children { get; }
}

```

Then in my UserControl, I use templates to bind my tree to the data structure, like so:

```
<TextBlock x:Name="HeaderTextBlock" Text="{Binding Path=Header}" />

```

What I would like to do is define the name of each of these members in my RichTreeView, allowing it to adapt to a range of different data structures, like so:

```
class MyItem
{
    string Name { get; set; }
    ObservableCollection<MyItem> Items;
}

<uc:RichTreeView ItemSource={Binding Source={StaticResource MyItemsProvider}}
    HeaderProperty="Name" ChildrenProperty="Items" />

```

Is there any way to expose the Path of a binding inside a UserControl as a public property of that UserControl? Is there some other way to go about solving this problem?


Question:
C#.Net case-insensitive string | Why does C#.Net allow the declaration of the string object to be case-insensitive?

```
String sHello = "Hello";
string sHello = "Hello";

```

Both the lower-case and upper-case S of the word String are acceptable and this seems to be the only object that allows this.

Can anyone explain why?


Question:
What are the correct stencils for object relational diagramming in visio? | All of my Visio experience is with LAN/WAN documentation. I recently had a desire to visualize the relationship between [objects](http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html) in the [Nagios](http://www.nagios.org/) configuration and I realized I didn't know how to do it properly and moved on to something more important. I was reading the responses to [this thread](https://stackoverflow.com/questions/15446/documenting-program-archetecture) and realized this is something software developers must do a lot.

So this is probably a soft-pitch question, but what is the proper method for documenting object relationships in Visio? Is there a better template to use? What stencil collection is the proper stencil in?

In my probably naive view I imagine an object being a large box with a single "reception" connector and containing multiple smaller boxes, each of which represents an object member and having its own connector. So, each object member field would connect out to the "reception" connector on the object of the member's type. In and of itself those objects are fairly easy to build. The problem I ran into is that the connector lines didn't respect the objects and ran over the top of them, making an awful, unusable mess.

Thanks for any pointers.


Question:
Connect PHP to IBM i (AS/400) | I've got an upcoming project wherein I will need to connect our website (`PHP5/Apache 1.3/OpenBSD 4.1`) to our back-end system running on an iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks.

From what I've seen the DB2 extensions and DB2 software from IBM only run under Linux. I've tried compiling the extensions with all the software from IBM and even tried their precompiled ibm\_db2 extension with no luck. IBM only supports Linux so I turned on the Linux emulation in the kernel but that didn't seem to help anything.

If anyone has run across getting everything to run natively under OpenBSD that would be great, but what I think I may have to do is setting up a second server running CentOS with DB2 installed (most likely via ZendCore for IBM since it seems to do all this for me) and the driver so that I can set up a small transaction server that I can post against and get a JSON representation of the DB2 data that I need.

Does the second option seem overkill or does anyone else have any better ideas?


Question:
Implementing permissions in PHP | I've tried to do this several times with no luck. After reading [this post](https://stackoverflow.com/questions/1451/what-is-the-best-way-to-handle-multiple-permission-types#1477), it made me interested in doing this again. So can anyone tell me why the following doesn't work?

```
<?php

$guest = 1;
$editor = 2;
$admin = 4;

$user = $editor;

if( $user == ($editor | $admin) ) {
    echo "Test";
}

?>

```


Question:
How to specify javascript to run when ModalPopupExtender is shown | The ASP.NET AJAX **ModalPopupExtender** has `OnCancelScript` and `OnOkScript` properties, but it doesn't seem to have an `OnShowScript` property. I'd like to specify a javascript function to run each time the popup is shown.

In past situations, I set the `TargetControlID` to a dummy control and provide my own control that first does some JS code and then uses the JS methods to show the popup. But in this case, I am showing the popup from both client and server side code.

Anyone know of a way to do this?

BTW, I needed this because I have a textbox in the modal that I want to make a TinyMCE editor. But the TinyMCE init script doesn't work on invisible textboxes, so I had to find a way to run it at the time the modal was shown


Question:
Arrays of Arrays in Java | This is a nasty one for me... I'm a PHP guy working in Java on a JSP project. I know how to do what I'm attempting through too much code and a complete lack of finesse.

I'd prefer to do it right. Here is the situation:

I'm writing a small display to show customers what days they can water their lawns based on their watering group (ABCDE) and what time of year it is. Our seasons look like this:
Summer (5-1 to 8-31)
Spring (3-1 to 4-30)
Fall (9-1 to 10-31)
Winter (11-1 to 2-28)

An example might be:

If I'm in group A, here would be my allowed times:
Winter: Mondays only
Spring: Tues, Thurs, Sat
Summer: Any Day
Fall: Tues, Thurs, Sat

If I was writing this in PHP I would use arrays like this:

```
//M=Monday,t=Tuesday,T=Thursday.... etc
$schedule["A"]["Winter"]='M';
$schedule["A"]["Spring"]='tTS';
$schedule["A"]["Summer"]='Any';
$schedule["A"]["Fall"]='tTS';
$schedule["B"]["Winter"]='t';

```

I COULD make the days arrays (array("Tuesday","Thursday","Saturday")) etc, but it is not necessary for what I'm really trying to accomplish.

I will also need to setup arrays to determine what season I'm in:

```
$seasons["Summer"]["start"]=0501;
$seasons["Summer"]["end"]=0801;

```

Can anyone suggest a really cool way to do this? I will have today's date and the group letter. I will need to get out of my function a day (M) or a series of days (tTS), (Any).


Question:
How do you test/change untested and untestable code? | Lately I had to change some code on older systems where not all of the code has unit tests.

Before making the changes I want to write tests, but each class created a lot of dependencies and other anti-patterns which made testing quite hard.

Obviously, I wanted to refactor the code to make it easier to test, write the tests and then change it.

Is this the way you'd do it? Or would you spend a lot of time writing the hard-to-write tests that would be mostly removed after the refactoring will be completed?


Question:
Prevent WebBrowser control from swallowing exceptions | I'm using the `System.Windows.Forms.WebBrowser`, to make a view a-la Visual Studio Start Page. However, it seems the control is catching and handling all exceptions by silently sinking them! No need to tell this is a very unfortunate behaviour.

```
void webBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e)
{
    // WebBrowser.Navigating event handler
    throw new Exception("OMG!");
}

```

The code above will cancel navigation and swallow the exception.

```
void webBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e)
{
    // WebBrowser.Navigating event handler
    try
    {
        e.Cancel = true;
        if (actions.ContainsKey(e.Url.ToString()))
        {
            actions[e.Url.ToString()].Invoke(e.Url, webBrowser.Document);
        }
    }
    catch (Exception exception)
    {
        MessageBox.Show(exception.ToString());
    }
}

```

So, what I do (above) is catch all exceptions and pop a box, this is better than silently failing but still clearly far from ideal. I'd like it to redirect the exception through the normal application failure path so that it ultimately becomes unhandled, or handled by the application from the root.

Is there any way to tell the `WebBrowser` control to stop sinking the exceptions and just forward them the natural and expected way? Or is there some hacky way to throw an exception through native boundaries?


Question:
Windows C++: How can I redirect stderr for calls to fprintf? | I am wrapping existing C++ code from a **BSD** project in our own custom wrapper and I want to integrate it to our code with as few changes as possible. This code uses `fprintf` to print to **stderr** in order to log / report errors.

I want to redirect this to an alternative place within the same process. On **Unix** I have done this with a `socketpair` and a `thread`: one end of the socket is where I send **stderr** (via a call to `dup2`) and the other end is monitored in a thread, where I can then process the output.

This does not work on **Windows** though because a socket is not the same as a file handle.

All documents I have found on the web show how to redirect output from a child process, which is not what I want. How can I redirect **stderr** within the same process getting a callback of some sort when output is written? (and before you say so, I've tried `SetStdHandle` but cannot find any way to make this work)...


Question:
How to map a latitude/longitude to a distorted map? | I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map.

Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this?

At first I decided to create a system of linear equations for the three nearest lat/long points and compute a transformation from these, but this doesn't work well at all. Since that's a linear system, I can't use more nearby points either.

You can't assume North is up: all you have is the existing lat/long->x/y mappings.

EDIT: it's not a Mercator projection, or anything like that. It's arbitrarily distorted for readability (think subway map). I want to use only the nearest 5 to 10 mappings so that distortion on other parts of the map doesn't affect the mapping I'm trying to compute.

Further, the entire map is in a very small geographical area so there's no need to worry about the globe--flat-earth assumptions are good enough.


Question:
MySQL replication: if I don't specify any databases, will log_bin log EVERYTHING? | I'm setting up replication for a server which runs a bunch of databases (one per client) and plan on adding more all the time, on my.cnf, Instead of having:

```
binlog-do-db  = databasename 1
binlog-do-db  = databasename 2
binlog-do-db  = databasename 3
...
binlog-do-db  = databasename n

```

can I rather just have

```
binlog-ignore-db  = mysql
binlog-ignore-db  = informationschema

```

(and no database to log specified) and assume that everything else is logged?

EDIT: actually if I remove all my binlog-do-db entries, it seemingly logs everything (as you see the binary log file change position when you move the database), but on the slave server, nothing gets picked up! (perhaps, this is the case to use replicate-do-db? this would kill the idea; i guess I cant have MySQL automagically detect which databases to replicate).


Question:
.NET unit testing packages | I am getting back into a bit more .NET after a few-years of not using it full-time and am wondering what the good unit testing packages are these days.

I'm familiar with NUnit (a few years ago) and have played briefly around with [IronRuby](https://en.wikipedia.org/wiki/IronRuby), with the goal of getting something like [RSpec](https://en.wikipedia.org/wiki/RSpec) going, but I don't know much beyond that.

I realize I could google for this and call it a day, but I believe I'm likely to get a better and more informed response from asking a question here :-)

Suggestions?


Question: SQL Reporting Services viewer for webpage - can you move the View Report button? | Using the viewer control for display of SQL Reporting Services reports on web page (Microsoft.ReportViewer.WebForms), can you move the View Report button? It defaults to the very right side of the report, which means you have to scroll all the way across before the button is visible. Not a problem for reports that fit the window width, but on very wide reports that is quickly an issue.


Question:
Alpha blending sprites in Nintendo DS Homebrew | I'm trying to alpha blend sprites and backgrounds with [devkitPro](http://www.devkitpro.org/) (including libnds, libarm, etc).

Does anyone know how to do this?


Question:
Should DB layer members be static or instance? | I've seen projects where the classes in the DB layer have just static functions in them and other projects where those classes need to be instantiated to get access to the member functions.

>
> Which is "better" and why?
>
>
>


Question:
Domain Specific Language resources | I was just listening to some older .Net Rocks! episodes, and I [found #329 on DSLs](http://www.microsoft.com/downloads/details.aspx?FamilyID=D91887EA-5128-4BB1-B861-1DC1F9564941&displaylang=en) to be interesting. My problem is that I can't find any good online resources for people trying to learn this technology. I get the basics of the creating new designers, but the MS docs on the T4 engine used by the DSL tools and then how to integrate the templates with the DSL models are lacking.

Does anyone know of some good introductory resources for the MS DSL tools?


Question:
How can I create Debian install packages in Windows for a Visual Studio project? | I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do it by calling cygwin from a post-build event, but I was hoping for at best a Visual Studio plugin or at worst a more Windows-native way of doing it. It seems like the package format is fairly simple and this must be a common need.

edit: Re-asked question under other account due to duplicate login issue.


Question:
.NET - Excel ListObject autosizing on databind | I'm developing an Excel 2007 add-in using Visual Studio Tools for Office (2008). I have one sheet with several ListObjects on it, which are being bound to datatables on startup. When they are bound, they autosize correctly.

The problem comes when they are re-bound. I have a custom button on the ribbon bar which goes back out to the database and retrieves different information based on some criteria that the user inputs. This new data comes back and is re-bound to the ListObjects - however, this time they are not resized and I get an exception:

>
> ListObject cannot be bound because it
>  cannot be resized to fit the data. The
>  ListObject failed to add new rows.
>  This can be caused because of
>  inability to move objects below of the
>  list object.
>
>
>
> >
> > Inner exception: "Insert method of Range class failed"
> >
> >  Reason: Microsoft.Office.Tools.Excel.FailureReason.CouldNotResizeListObject
> >
> >
> >
>
>
>

I was not able to find anything very meaningful on this error on Google or MSDN. I have been trying to figure this out for a while, but to no avail.

Basic code structure:

```
//at startup
DataTable tbl = //get from database
listObj1.SetDataBinding(tbl);
DataTable tbl2 = //get from database
listObj2.SetDataBinding(tbl2);

//in buttonClick event handler
DataTable tbl = //get different info from database
//have tried with and without unbinding old source
listObj1.SetDataBinding(tbl);              <-- exception here
DataTable tbl2 = //get different info from database
listObj2.SetDataBinding(tbl2);

```

Note that this exception occurs even when the ListObject is shrinking, and not only when it grows.


Question:
Anyone know a good workaround for the lack of an enum generic constraint? | What I want to do is something like this: I have enums with combined flagged values.

```
public static class EnumExtension
{
    public static bool IsSet<T>( this T input, T matchTo )
        where T:enum //the constraint I want that doesn't exist in C#3
    {
        return (input & matchTo) != 0;
    }
}

```

So then I could do:

```
MyEnum tester = MyEnum.FlagA | MyEnum.FlagB

if( tester.IsSet( MyEnum.FlagA ) )
    //act on flag a

```

Unfortunately, C#'s generic where constraints have no enum restriction, only class and struct. C# doesn't see enums as structs (even though they are value types) so I can't add extension types like this.

Does anyone know a workaround?


Question: Accessing iSight programmatically? | Is it possible to access the iSight camera on a macbook programmatically? By this I mean I would like to be able to just grab still frames from the iSight camera on command and then do something with them. If so, is it only accessible using objective c, or could other languages be used as well?


Question:
How to Disable Alt + F4 closing form? | What is the best way to disable `Alt` + `F4` in a c# win form to prevent the user from closing the form?

I am using a form as a popup dialog to display a progress bar and I do not want the user to be able to close it.


Question:
Actionscript 3 - Fastest way to parse yyyy-mm-dd hh:mm:ss to a Date object? | I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings.

Does anyone know any faster ways of doing this or tips to speed up the methods?

```
castMethod1 takes 3673 ms
castMethod2 takes 3812 ms
castMethod3 takes 3931 ms

```

Code:

```
private function castMethod1(dateString:String):Date {
    if ( dateString == null ) {
        return null;
    }

    var year:int = int(dateString.substr(0,4));
    var month:int = int(dateString.substr(5,2))-1;
    var day:int = int(dateString.substr(8,2));

    if ( year == 0 && month == 0 && day == 0 ) {
        return null;
    }

    if ( dateString.length == 10 ) {
        return new Date(year, month, day);
    }

    var hour:int = int(dateString.substr(11,2));
    var minute:int = int(dateString.substr(14,2));
    var second:int = int(dateString.substr(17,2));

    return new Date(year, month, day, hour, minute, second);
}

```

-

```
private function castMethod2(dateString:String):Date {
    if ( dateString == null ) {
        return null;
    }

    if ( dateString.indexOf("0000-00-00") != -1 ) {
        return null;
    }

    dateString = dateString.split("-").join("/");

    return new Date(Date.parse( dateString ));
}

```

-

```
private function castMethod3(dateString:String):Date {
    if ( dateString == null ) {
        return null;
    }

    var mainParts:Array = dateString.split(" ");
    var dateParts:Array = mainParts[0].split("-");

    if ( Number(dateParts[0])+Number(dateParts[1])+Number(dateParts[2]) == 0 ) {
        return null;
    }

    return new Date( Date.parse( dateParts.join("/")+(mainParts[1]?" "+mainParts[1]:" ") ) );
}

```

---

No, Date.parse will not handle dashes by default. And I need to return null for date time strings like `"0000-00-00"`.


Question: How do you spawn another process in C? | How do you run an external program and pass it command line parameters using C? If you have to use operating system API, include a solution for Windows, Mac, and Linux.


Question:
Best Way To Determine If .NET 3.5 Is Installed | I need to programatically determine whether .NET 3.5 is installed. I thought it would be easy:

```
<% Response.Write(Environment.Version.ToString()); %>

```

Which returns "2.0.50727.1434" so no such luck...

In my research I have that there are some rather obscure registry keys I can look at but I'm not sure if that is the route to go. Does anyone have any suggestions?


Question:
Reliable timer in a console application | I am aware that in [.NET](http://en.wikipedia.org/wiki/.NET_Framework) there are three timer types (see *[Comparing the Timer Classes in the .NET Framework Class Library](http://msdn.microsoft.com/en-us/magazine/cc164015.aspx)*). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable.

The way this timer works in the control of the timer is put on another thread so it can always tick along with the work begin completed on the parent thread when it is not busy.

The issue with this timer in a console application is that while the timer is ticking along on another thread the main thread is not doing anything to the application closes.

I tried adding a `while true` loop, but then the main thread is too busy when the timer does go off.


Question:
Exact age calculation |
>
> **Possible Duplicate:**
>
> [How do I calculate someone's age in C#?](https://stackoverflow.com/questions/9/how-do-i-calculate-someones-age-in-c)
>
>
>

Maybe this could be silly but and I don't have issues with my age but sometimes it is good to calculate the exact age of someone, I have introduced my birthdate in my profile (01/12/1975) "dd/mm/yyyy" and it calculated 33 and I'm 32 actually still, isn't it better to calculate the exact age?

Maybe

```
DateTime dt1 = DateTime.Now;
TimeSpan dt2;
dt2 = dt1.Subtract(new DateTime(1975, 12, 01));
double year = dt2.TotalDays / 365;

```

The result of year is 32.77405678074

Could this code be OK?


Question:
What tools do you use to develop C++ applications on Linux? | I develop C++ applications in a Linux environment. The tools I use every day include Eclipse with the CDT plugin, gdb and valgrind.

What tools do other people use? Is there anything out there for Linux that rivals the slickness of Microsoft Visual Studio?


Question:
IsNothing versus Is Nothing | Does anyone here use VB.NET and have a strong preference for or against using `IsNothing` as opposed to `Is Nothing` (for example, `If IsNothing(anObject)` or `If anObject Is Nothing...`)? If so, why?

EDIT: If you think they're both equally acceptable, do you think it's best to pick one and stick with it, or is it OK to mix them?


Question:
Designing a Calendar system like Google Calendar | I have to create something similiar to Google Calendar, so I created an events table that contains all the events for a user.

The hard part is handling re-occurring events, the row in the events table has an event\_type field that tells you what kind of event it is, since an event can be for a single date only, OR a re-occuring event every x days.

**The main design challenge is handling re-occurring events.**

When a user views the calendar, using the month's view, how can I display all the events for the given month? The query is going to be tricky, so I thought it would be easier to create another table and create a row for each and every event, including the re-occuring events.

What do you guys think?


Question:
C# 2.0 code consuming assemblies compiled with C# 3.0 | This should be fine seeing as the CLR hasn't actually changed?

The boxes running the C# 2.0 code **have** had .NET 3.5 rolled out.

The background is that we have a windows service (.NET 2.0 exe built with VS2005, deployed to ~150 servers) that dynamically loads assemblies (almost like plug-ins) to complete various work items asked of it. Whenever we roll out a new version of the bus logic, we just drop the assemblies on an FTP server and the windows service knows how to check for, grab and store the latest versions. New assemblies are now built using VS2008 and targetting .NET 2.0, we know that works ok. However we'd like to start taking advantage of C# 3.0 language features such as LINQ and targetting the assemblies against .NET 3.5 without having to build and deploy a new version of the windows service.


Question:
How to setup Quality of Service? | I'm talking about <http://en.wikipedia.org/wiki/Quality_of_service>. With streaming stackoverflow podcasts and downloading the lastest updates to ubuntu, I would like to have QoS working so I can use stackoverflow without my http connections timing out or taking forever.

I'm using an iConnect 624 ADSL modem which has QoS built-in but I can't seem to get it to work. Is it even possible to control the downstream (ie. from ISP to your modem)?


Question:
Generic type checking | **Is there a way to enforce/limit the types that are passed to primitives?** *(bool, int, string, etc.)*

Now, I know you can limit the generic type parameter to a type or interface implementation via the *where* clause. However, this doesn't fit the bill for primitives (AFAIK) because they do not all have a common ground (apart from *object* before someone says! :P).

So, my current thoughts are to just grit my teeth and do a big *switch* statement and throw an *ArgumentException* on failure.

---

**EDIT 1:**

Just to clarify:

The code definition should be like this:

```
public class MyClass<GenericType> ....

```

And instantiation:

```
MyClass<bool> = new MyClass<bool>(); // Legal
MyClass<string> = new MyClass<string>(); // Legal
MyClass<DataSet> = new MyClass<DataSet>(); // Illegal
MyClass<RobsFunkyHat> = new MyClass<RobsFunkyHat>(); // Illegal (but looks awesome!)

```

---

**EDIT 2**

@Jon Limjap - Good point, and something I was already considering. I'm sure there is a generic method that can be used to determine if the type is of a value or reference type.

This could be useful in instantly removing a lot of the objects I don't want to deal with (but then you need to worry about the structs that are used such as *Size* ). Interesting problem no? :)

Here it is:

```
where T: struct

```

Taken from [MSDN](http://msdn.microsoft.com/en-us/library/d5x73970.aspx).

---

I'm curious. Could this be done in .NET 3.x using extension methods? Create an interface, and implement the interface in the extension methods (which would probably be cleaner than a bit fat switch). Plus if you then need to later extend to any lightweight custom types, they can also implement the same interface, with no changes required to the base code.

What do you guys think?

The sad news is I am working in Framework 2!! :D

---

**EDIT 3**

This was so simple following on from [Jon Limjaps Pointer](https://stackoverflow.com/questions/8941/generic-type-checking#8956).. So simple I almost want to cry, but it's great because the code works like a charm!

So here is what I did (you'll laugh!):

Code added to the generic class
-------------------------------

```
bool TypeValid()
{
    // Get the TypeCode from the Primitive Type
    TypeCode code = Type.GetTypeCode(typeof(PrimitiveDataType));

    // All of the TypeCode Enumeration refer Primitive Types
    // with the exception of Object and Empty (Null).
    // Since I am willing to allow Null Types (at this time)
    // all we need to check for is Object!
    switch (code)
    {
        case TypeCode.Object:
            return false;
        default:
            return true;
    }
}

```

Then a little utility method to check the type and throw an exception,

```
private void EnforcePrimitiveType()
{
    if (!TypeValid())
        throw new InvalidOperationException(
            "Unable to Instantiate SimpleMetadata based on the Generic Type of '" + typeof(PrimitiveDataType).Name +
            "' - this Class is Designed to Work with Primitive Data Types Only.");
}

```

All that then needs to be done is to call *EnforcePrimitiveType()* in the classes constructors. Job done! :-)

The only downside, it only throws an exception at runtime (obviously) rather than design time. But that's no big deal and could be picked up with utilities like [FxCop](http://en.wikipedia.org/wiki/FxCop) (which we don't use at work).

Special thanks to Jon Limjap on this one!


Question: Version detection with Silverlight | How can I efficiently and effectively detect the version and, for that matter, any available information about the instance of [Silverlight](http://silverlight.net/) currently running on the browser?


Question:
Visual Studio Error: The "GenerateResource" task failed unexpectedly | When building a VS 2008 solution with 19 projects I sometimes get:

```
The "GenerateResource" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.IO.MemoryStream.set_Capacity(Int32 value)
   at System.IO.MemoryStream.EnsureCapacity(Int32 value)
   at System.IO.MemoryStream.WriteByte(Byte value)
   at System.IO.BinaryWriter.Write(Byte value)
   at System.Resources.ResourceWriter.Write7BitEncodedInt(BinaryWriter store, Int32 value)
   at System.Resources.ResourceWriter.Generate()
   at System.Resources.ResourceWriter.Dispose(Boolean disposing)
   at System.Resources.ResourceWriter.Close()
   at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
   at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
   at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
   at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
   at Microsoft.Build.Tasks.GenerateResource.Execute()
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)   C:\Windows\Microsoft.NET\Framework\v3.5

```

Usually happens after VS has been running for about 4 hours; the only way to get VS to compile properly is to close out VS, and start it again.

I'm on a machine with 3GB Ram. TaskManager shows the devenv.exe working set to be 578060K, and the entire memory allocation for the machine is 1.78GB. It should have more than enough ram to generate the resources.


Question:
Best method of Textfile Parsing in C#? | I want to parse a config file sorta thing, like so:

```
[KEY:Value]
    [SUBKEY:SubValue]

```

Now I started with a `StreamReader`, converting lines into character arrays, when I figured there's gotta be a better way. So I ask you, humble reader, to help me.

One restriction is that it has to work in a Linux/Mono environment (1.2.6 to be exact). I don't have the latest 2.0 release (of Mono), so try to restrict language features to C# 2.0 or C# 1.0.


Question:
Aging Data Structure in C# | I want a data structure that will allow querying *how many items in last **X** minutes*. An item may just be a simple identifier or a more complex data structure, preferably the timestamp of the item will be in the item, rather than stored outside (as a hash or similar, wouldn't want to have problems with multiple items having same timestamp).

So far it seems that with LINQ I could easily filter items with timestamp greater than a given time and aggregate a count. Though I'm hesitant to try to work .NET 3.5 specific stuff into my production environment yet. Are there any other suggestions for a similar data structure?

The other part that I'm interested in is *aging* old data out, If I'm only going to be asking for counts of items less than 6 hours ago I would like anything older than that to be removed from my data structure because this may be a long-running program.


Question:
How do I use Java to read from a file that is actively being written to? | I have an application that writes information to file. This information is used post-execution to determine pass/failure/correctness of the application. I'd like to be able to read the file as it is being written so that I can do these pass/failure/correctness checks in real time.

I assume it is possible to do this, but what are the gotcha's involved when using Java? If the reading catches up to the writing, will it just wait for more writes up until the file is closed, or will the read throw an exception at this point? If the latter, what do I do then?

My intuition is currently pushing me towards BufferedStreams. Is this the way to go?


Question:
How do you do system integration? | I curious to how different people solve integration of systems. I have a feeling that the last years more and more work has gone into integrating systems and that this kind of work need will increase as well.

I wondering if you solve it developing your own small services that are then connected or if you use some sort of product (WebSphere, BizTalk, [Mule](http://mule.mulesource.org/display/MULE/Home) etc). I'd also think it'd be interesting to know how these kind of solutions are managed and maintained (how do you solve security, instrumentation etc, etc), what kind of problems have you experienced with your solution and so on.


Question: PHP Session Security | What are some guidelines for maintaining responsible session security with PHP? There's information all over the web and it's about time it all landed in one place!


Question:
C# Database Access: DBNull vs null | We have our own ORM we use here, and provide strongly typed wrappers for all of our db tables. We also allow weakly typed ad-hoc SQL to be executed, but these queries still go through the same class for getting values out of a data reader.

In tweaking that class to work with Oracle, we've come across an interesting question. Is it better to use DBNull.Value, or null? Are there any benefits to using DBNull.Value? It seems more "correct" to use null, since we've separated ourselves from the DB world, but there are implications (you can't just blindly `ToString()` when a value is null for example) so its definitely something we need to make a conscious decision about.


Question:
Compare a date string to datetime in SQL Server? | In SQL Server I have a `DATETIME` column which includes a time element.

Example:

```
'14 AUG 2008 14:23:019'

```

What is the **best** method to only select the records for a particular day, ignoring the time part?

Example: (Not safe, as it does not match the time part and returns no rows)

```
DECLARE  @p_date DATETIME
SET      @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 )

SELECT *
FROM   table1
WHERE  column_datetime = @p_date

```

*Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.*

---

**Update** Clarified example to be more specific.

---

**Edit** Sorry, But I've had to down-mod WRONG answers (answers that return wrong results).

@Jorrit: `WHERE (date>'20080813' AND date<'20080815')` will return the 13th and the 14th.

@wearejimbo: *Close, but no cigar!* badge awarded to you. You missed out records written at 14/08/2008 23:59:001 to 23:59:999 (i.e. Less than 1 second before midnight.)


Question:
String.indexOf function in C | Is there a C library function that will return the index of a character in a string?

So far, all I've found are functions like strstr that will return the found char \*, not it's location in the original string.


Question:
Simple MOLAP solution | To analyze lots of text logs I did some hackery that looks like this:

1. Locally import logs into Access
2. Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k)
3. Use Excel to visualize Cube (it is not big - up to milions raw entries)

My hackery is a succes and more people are demanding an access to my Tool. As you see I see more automating and easier deployment.

Do you now some tools/libraries that would give me the same but with easier deployment?
Kind of **embedded OLAP** service?

**Edit:** I heard of Mondrian but we don't do much with Java. Have you seen something similiar done for .Net/Win32 ? Comercial is also OK.


Question:
Federated (Synced) Subversion servers? | Is it possible to create "federated" Subversion servers?
As in one server at location A and another at location B that sync up their local versions of the repository automatically. That way when someone at either location interacts with the repository they are accessing their respective local server and therefore has faster response times.


Question:
Lucene Score results | In Lucene if you had multiple indexes that covered only one partition each. Why does the same search on different indexes return results with different scores? The results from different servers match exactly.

i.e. if I searched for :

* Name - John Smith
* DOB - 11/11/1934

**Partition 0** would return a score of 0.345

**Partition 1** would return a score of 0.337

Both match exactly on name and DOB.


Question:
Implementation of "Remember me" in a Rails application | My Rails-app has a sign in box with a "remember me" checkbox. Users who check that box should remain logged in even after closing their browser. I'm keeping track of whether users are logged in by storing their id in the user's session.

But sessions are implemented in Rails as session cookies, which are not persistent. I can *make* them persistent:

```
class ApplicationController < ActionController::Base
  before_filter :update_session_expiration_date

  private

  def update_session_expiration_date
    options = ActionController::Base.session_options
    unless options[:session_expires]
      options[:session_expires] = 1.year.from_now
    end
  end
end

```

But that seems like a hack, which is surprising for such common functionality. Is there any better way?

**Edit**

Gareth's answer is pretty good, but I would still like an answer from someone familiar with Rails 2 (because of it's unique `CookieSessionStore`).


Question: What OSS project should I look at if I need to do Spring friendly WorkFlow? | We need to add WorkFlow to our Spring managed application. Does anyone have any useful experience in using any of the myriad of OSS Work Flow solutions? Which one is best? Which one integrates with Spring best? Which ones should we avoid?


Question: What is the easiest way to parse an INI File in C++? | I'm trying to parse an INI file using C++. Any tips on what is the best way to achieve this? Should I use the Windows API tools for INI file processing (with which I am totally unfamiliar), an open-source solution or attempt to parse it manually?


Question:
How can I modify .xfdl files? (Update #1) | The `.XFDL` file extension identifies `XFDL` Formatted Document files. These belong to the XML-based document and template formatting standard. This format is exactly like the XML file format however, contains a level of encryption for use in secure communications.

I know how to view XFDL files using a file viewer I found [here](http://web.archive.org/web/20170903022252/http://www.e-publishing.af.mil:80/viewerdownload.asp). I can also modify and save these files by doing File:Save/Save As. I'd like, however, to modify these files on the fly. Any suggestions? Is this even possible?

Update #1: I have now successfully decoded and unziped a `.xfdl` into an XML file which I can then edit. Now, I am looking for a way to re-encode the modified XML file back into base64-gzip (using Ruby or the command line)


Question: How can I get Unicode characters to display properly for the tooltip for the IMG ALT in IE7? | I've got some Japanese in the ALT attribute, but the tooltip is showing me the ugly block characters in the tooltip. The rest of the content on the page renders correctly. So far, it seems to be limited to the tooltips.


Question:
What is the difference between oracle's 'yy' and 'rr' date mask? | Example:

```
select ename from emp where hiredate = todate('01/05/81','dd/mm/yy')

```

and

```
select ename from emp where hiredate = todate('01/05/81','dd/mm/rr')

```

return different results


Question:
How do you use #define? | I'm wondering about instances when it makes sent to use #define and #if statements. I've known about it for a while, but never incorporated it into my way of coding. How exactly does this affect the compilation?

>
> Is #define the only thing that determines if the code is included when compiled? If I have #define DEBUGme as a custom symbol, the only way to exclude it from compile is to remove this #define statement?
>
>
>