question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
35,286
35,386
DOS filename escaping for use with *nix commands
I want to escape a DOS filename so I can use it with sed. I have a DOS batch file something like this: set FILENAME=%~f1 sed 's/Some Pattern/%FILENAME%/' inputfile (Note: %~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt ) I found that the backslashes in %FILENAME% are just escaping the next lette...
This will work. It's messy because in BAT files you can't use set var=`cmd` like you can in unix. The fact that echo doesn't understand quotes is also messy, and could lead to trouble if Some Pattern contains shell meta characters. set FILENAME=%~f1 echo s/Some Pattern/%FILENAME%/ | sed -e "s/\\/\\\\/g" >sedcmd.tmp sed...
DOS filename escaping for use with *nix commands I want to escape a DOS filename so I can use it with sed. I have a DOS batch file something like this: set FILENAME=%~f1 sed 's/Some Pattern/%FILENAME%/' inputfile (Note: %~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt ) I found that the backslash...
TITLE: DOS filename escaping for use with *nix commands QUESTION: I want to escape a DOS filename so I can use it with sed. I have a DOS batch file something like this: set FILENAME=%~f1 sed 's/Some Pattern/%FILENAME%/' inputfile (Note: %~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt ) I found ...
[ "scripting", "shell", "dos" ]
3
2
1,091
3
0
2008-08-29T20:56:02.807000
2008-08-29T21:58:36.340000
35,301
35,314
What is the difference between the | and || or operators?
I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: |. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable?
Just like the & and && operator, the double Operator is a "short-circuit" operator. For example: if(condition1 || condition2 || condition3) If condition1 is true, condition 2 and 3 will NOT be checked. if(condition1 | condition2 | condition3) This will check conditions 2 and 3, even if 1 is already true. As your condit...
What is the difference between the | and || or operators? I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: |. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable?
TITLE: What is the difference between the | and || or operators? QUESTION: I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: |. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable?...
[ "c#", "php", "operators" ]
380
581
216,238
11
0
2008-08-29T21:11:17.543000
2008-08-29T21:17:18.340000
35,304
35,791
FlexUnit component testing patterns: use addAsync or manually initialize?
We've been using Flex for about 6 months here at work, and I found that my first batches of FlexUnit tests involving custom components would tend to follow this sort of pattern: import mx.core.Application; import mx.events.FlexEvent; import flexunit.framework.TestCase; public class CustomComponentTest extends TestCase...
I see nothing wrong with using the async version. I can agree that the second version is shorter, but I'm not sure that I think it's easier to follow. The test does a lot of things that you wouldn't normally do, whereas the first example is more true to how you would use the component outside the test environment. Also...
FlexUnit component testing patterns: use addAsync or manually initialize? We've been using Flex for about 6 months here at work, and I found that my first batches of FlexUnit tests involving custom components would tend to follow this sort of pattern: import mx.core.Application; import mx.events.FlexEvent; import flexu...
TITLE: FlexUnit component testing patterns: use addAsync or manually initialize? QUESTION: We've been using Flex for about 6 months here at work, and I found that my first batches of FlexUnit tests involving custom components would tend to follow this sort of pattern: import mx.core.Application; import mx.events.FlexE...
[ "apache-flex", "unit-testing" ]
1
1
1,580
1
0
2008-08-29T21:13:57.290000
2008-08-30T08:47:12.397000
35,315
83,262
How do you combine multiple result sets in SSRS?
What's the best way to combine results sets from disparate data sources in SSRS? In my particular example, I need to write a report that pulls data from SQL Server and combines it with another set of data that comes from a DB2 database. In the end, I need to join these separate data sets together so I have one combined...
We had to do something similar (i.e. inner join 2 data sources from different servers). I believe the best way is to write your own custom Data Extension. It's not very difficult and it would give you the ability to do this and more.
How do you combine multiple result sets in SSRS? What's the best way to combine results sets from disparate data sources in SSRS? In my particular example, I need to write a report that pulls data from SQL Server and combines it with another set of data that comes from a DB2 database. In the end, I need to join these s...
TITLE: How do you combine multiple result sets in SSRS? QUESTION: What's the best way to combine results sets from disparate data sources in SSRS? In my particular example, I need to write a report that pulls data from SQL Server and combines it with another set of data that comes from a DB2 database. In the end, I ne...
[ "reporting-services" ]
9
6
27,679
5
0
2008-08-29T21:17:26.033000
2008-09-17T13:34:51.020000
35,317
35,387
Why does Vista complain about a dead process when I use Cygwin X11 ssh and how do I get it to shut up?
When I log into a remote machine using ssh X11 forwarding, Vista pops up a box complaining about a process that died unexpectedly. Once I dismiss the box, everything is fine. So I really don't care if some process died. How do I get Vista to shut up about it? Specifically, the message reads: sh.exe has stopped working ...
Well, I don't know what the original problem was, but when I update Cygwin recently the error message stopped popping up. My guess it that rebasing was necessary.
Why does Vista complain about a dead process when I use Cygwin X11 ssh and how do I get it to shut up? When I log into a remote machine using ssh X11 forwarding, Vista pops up a box complaining about a process that died unexpectedly. Once I dismiss the box, everything is fine. So I really don't care if some process die...
TITLE: Why does Vista complain about a dead process when I use Cygwin X11 ssh and how do I get it to shut up? QUESTION: When I log into a remote machine using ssh X11 forwarding, Vista pops up a box complaining about a process that died unexpectedly. Once I dismiss the box, everything is fine. So I really don't care i...
[ "windows-vista", "ssh", "cygwin", "x11", "openssh" ]
0
0
1,158
5
0
2008-08-29T21:18:41.443000
2008-08-29T21:59:20.270000
35,320
35,557
How do you get the last record generated in a recursive CTE?
In the code below I am using a recursive CTE(Common Table Expression) in SQL Server 2005 to try and find the top level parent of a basic hierarchical structure. The rule of this hierarchy is that every CustID has a ParentID and if the CustID has no parent then the ParentID = CustID and it is the highest level. DECLARE ...
If you just want want the highest recursion depth couldn't you do something like this?Then, when you actually query the CTE just look for the row with max(Depth)? Like so: DECLARE @LookupID int --Our test value SET @LookupID = 1; WITH cteLevelOne (ParentID, CustID, Depth) AS ( SELECT a.ParentID, a.CustID, 1 FROM tblC...
How do you get the last record generated in a recursive CTE? In the code below I am using a recursive CTE(Common Table Expression) in SQL Server 2005 to try and find the top level parent of a basic hierarchical structure. The rule of this hierarchy is that every CustID has a ParentID and if the CustID has no parent the...
TITLE: How do you get the last record generated in a recursive CTE? QUESTION: In the code below I am using a recursive CTE(Common Table Expression) in SQL Server 2005 to try and find the top level parent of a basic hierarchical structure. The rule of this hierarchy is that every CustID has a ParentID and if the CustID...
[ "sql", "sql-server", "recursion", "common-table-expression" ]
5
3
7,828
3
0
2008-08-29T21:19:24.093000
2008-08-30T01:42:45.613000
35,322
35,516
Bypass Forms Authentication auto redirect to login, How to?
I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually when a user tries to access a resource without proper authorization I want them to be redirected to a login page. FormsAuth does this for me easy enough. Problem: Now I have an action being accessed by a console app. Whats t...
Ok, I worked around this. I made a custom ActionResult (HttpForbiddenResult) and custom ActionFilter (NoFallBackAuthorize). To avoid redirection, HttpForbiddenResult marks responses with status code 403. FormsAuthentication doesn't catch responses with this code so the login redirection is effectively skipped. The NoFa...
Bypass Forms Authentication auto redirect to login, How to? I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually when a user tries to access a resource without proper authorization I want them to be redirected to a login page. FormsAuth does this for me easy enough. Problem: N...
TITLE: Bypass Forms Authentication auto redirect to login, How to? QUESTION: I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually when a user tries to access a resource without proper authorization I want them to be redirected to a login page. FormsAuth does this for me easy ...
[ "asp.net", "asp.net-mvc", "forms-authentication" ]
6
5
9,705
5
0
2008-08-29T21:20:38.723000
2008-08-30T00:36:31.093000
35,333
35,477
Compiler Error C2143 when using a struct
I'm compiling a simple.c in visual c++ with Compile as C Code (/TC) and i get this compiler error error C2143: syntax error: missing ';' before 'type' on a line that calls for a simple struct struct foo test; same goes for using the typedef of the struct. error C2275: 'FOO': illegal use of this type as an expression
I forgot that in C you have to declare all your variables before any code.
Compiler Error C2143 when using a struct I'm compiling a simple.c in visual c++ with Compile as C Code (/TC) and i get this compiler error error C2143: syntax error: missing ';' before 'type' on a line that calls for a simple struct struct foo test; same goes for using the typedef of the struct. error C2275: 'FOO': ill...
TITLE: Compiler Error C2143 when using a struct QUESTION: I'm compiling a simple.c in visual c++ with Compile as C Code (/TC) and i get this compiler error error C2143: syntax error: missing ';' before 'type' on a line that calls for a simple struct struct foo test; same goes for using the typedef of the struct. error...
[ "c", "visual-c++" ]
3
6
4,652
5
0
2008-08-29T21:24:52.130000
2008-08-29T23:52:27.797000
35,357
35,408
Minimalistic Database Administration
I am a developer. An architect on good days. Somehow I find myself also being the DBA for my small company. My background is fair in the DB arts but I have never been a full fledged DBA. My question is what do I have to do to ensure a realiable and reasonably functional database environment with as little actual effort...
Who else is involved in the database? Are you the only person making schema changes (creating new objects, releasing new stored procedures, permissioning new users)? Make sure that the number of users doing anything that could impact performance is reduced to as close to zero as possible, ideally including you. Make su...
Minimalistic Database Administration I am a developer. An architect on good days. Somehow I find myself also being the DBA for my small company. My background is fair in the DB arts but I have never been a full fledged DBA. My question is what do I have to do to ensure a realiable and reasonably functional database env...
TITLE: Minimalistic Database Administration QUESTION: I am a developer. An architect on good days. Somehow I find myself also being the DBA for my small company. My background is fair in the DB arts but I have never been a full fledged DBA. My question is what do I have to do to ensure a realiable and reasonably funct...
[ "database", "administration", "task" ]
3
5
305
3
0
2008-08-29T21:36:27.093000
2008-08-29T22:19:20.017000
35,366
35,369
What are the main performance differences between varchar and nvarchar SQL Server data types?
I'm working on a database for a small web app at my school using SQL Server 2005. I see a couple of schools of thought on the issue of varchar vs nvarchar: Use varchar unless you deal with a lot of internationalized data, then use nvarchar. Just use nvarchar for everything. I'm beginning to see the merits of view 2. I ...
Always use nvarchar. You may never need the double-byte characters for most applications. However, if you need to support double-byte languages and you only have single-byte support in your database schema it's really expensive to go back and modify throughout your application. The cost of migrating one application fro...
What are the main performance differences between varchar and nvarchar SQL Server data types? I'm working on a database for a small web app at my school using SQL Server 2005. I see a couple of schools of thought on the issue of varchar vs nvarchar: Use varchar unless you deal with a lot of internationalized data, then...
TITLE: What are the main performance differences between varchar and nvarchar SQL Server data types? QUESTION: I'm working on a database for a small web app at my school using SQL Server 2005. I see a couple of schools of thought on the issue of varchar vs nvarchar: Use varchar unless you deal with a lot of internatio...
[ "sql-server", "sql-server-2005", "storage", "varchar", "nvarchar" ]
248
131
188,249
14
0
2008-08-29T21:41:57.267000
2008-08-29T21:44:41.600000
35,372
67,345
How can I change the way my Drupal theme displays the front page
I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page. My question is: how can I edit the theme's css so it changes the way that block of static content is displayed? For reference, here's the link to the site (in portuguese, a...
The main css file that drives your content is the styles.css file located in your currently selected theme. In your case that means that most of your site styling is driven by this file: /aroda/roda/themes/garland/style.css with basic coloring effects handled by this file: /aroda/roda/files/color/garland-d3985506/style...
How can I change the way my Drupal theme displays the front page I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page. My question is: how can I edit the theme's css so it changes the way that block of static content is displa...
TITLE: How can I change the way my Drupal theme displays the front page QUESTION: I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page. My question is: how can I edit the theme's css so it changes the way that block of static...
[ "drupal", "drupal-theming" ]
5
3
9,494
3
0
2008-08-29T21:48:22.633000
2008-09-15T21:49:13.190000
35,373
35,384
Best practices for signing .NET assemblies?
I have a solution consisting of five projects, each of which compile to separate assemblies. Right now I'm code-signing them, but I'm pretty sure I'm doing it wrong. What's the best practice here? Sign each with a different key; make sure the passwords are different Sign each with a different key; use the same password...
If your only objective is to stop FxCop from yelling at you, then you have found the best practice. The best practice for signing your assemblies is something that is completely dependent on your objectives and needs. We would need more information like your intended deployment: For personal use For use on corporate ne...
Best practices for signing .NET assemblies? I have a solution consisting of five projects, each of which compile to separate assemblies. Right now I'm code-signing them, but I'm pretty sure I'm doing it wrong. What's the best practice here? Sign each with a different key; make sure the passwords are different Sign each...
TITLE: Best practices for signing .NET assemblies? QUESTION: I have a solution consisting of five projects, each of which compile to separate assemblies. Right now I'm code-signing them, but I'm pretty sure I'm doing it wrong. What's the best practice here? Sign each with a different key; make sure the passwords are d...
[ ".net", "assemblies", "signing" ]
46
44
14,527
5
0
2008-08-29T21:48:32.603000
2008-08-29T21:56:56.983000
35,402
35,421
Encapsulate multiple properties at once using Resharper 4.0
When using Resharper to encapsulate a class's properties, is there a way to get it to do more than one property at a time?
You might or might not already know this (R# does suffer from a lack of discoverability, unless you get the one-page key-shortcut page printed out), but ALT-INS opens a box which can at least mass-generate properties for fields. Not sure if that's any use - it's not the same as a retrospective encapsulation.
Encapsulate multiple properties at once using Resharper 4.0 When using Resharper to encapsulate a class's properties, is there a way to get it to do more than one property at a time?
TITLE: Encapsulate multiple properties at once using Resharper 4.0 QUESTION: When using Resharper to encapsulate a class's properties, is there a way to get it to do more than one property at a time? ANSWER: You might or might not already know this (R# does suffer from a lack of discoverability, unless you get the on...
[ "visual-studio", "resharper" ]
5
9
1,002
2
0
2008-08-29T22:10:02.333000
2008-08-29T22:33:42.790000
35,420
35,438
How do I oversee my MySQL replication server?
I've had a tough time setting up my replication server. Is there any program (OS X, Windows, Linux, or PHP no problem) that lets me monitor and resolve replication issues? (btw, for those following, I've been on this issue here, here, here and here ) My production database is several megs in size and growing. Every tim...
To monitor the servers we use the free tools from Maatkit... simple, yet efficient. The binary replication is available in 5.1, so I guess you've got some balls. We still use 5.0 and it works OK, but of course we had our share of issues with it. We use a Master-Master replication with a MySql Proxy as a load-balancer i...
How do I oversee my MySQL replication server? I've had a tough time setting up my replication server. Is there any program (OS X, Windows, Linux, or PHP no problem) that lets me monitor and resolve replication issues? (btw, for those following, I've been on this issue here, here, here and here ) My production database ...
TITLE: How do I oversee my MySQL replication server? QUESTION: I've had a tough time setting up my replication server. Is there any program (OS X, Windows, Linux, or PHP no problem) that lets me monitor and resolve replication issues? (btw, for those following, I've been on this issue here, here, here and here ) My pr...
[ "mysql" ]
2
3
441
2
0
2008-08-29T22:30:03.033000
2008-08-29T22:49:44.140000
35,429
35,433
nmake, visualstudio, and .mak files
I was given a C++ project that was compiled using MS Visual Studio.net 2003 C++ compiler, and a.mak file that was used to compile it. I am able to build it from the command line using nmake project.mak, but the compiler complains that afxres.h was not found. I did a little searching around and the afxres.h is in the Vi...
There should be an icon in your Start menu under Programs that opens a cmd.exe instance with all the correct MSVS environment variables set up for command line building.
nmake, visualstudio, and .mak files I was given a C++ project that was compiled using MS Visual Studio.net 2003 C++ compiler, and a.mak file that was used to compile it. I am able to build it from the command line using nmake project.mak, but the compiler complains that afxres.h was not found. I did a little searching ...
TITLE: nmake, visualstudio, and .mak files QUESTION: I was given a C++ project that was compiled using MS Visual Studio.net 2003 C++ compiler, and a.mak file that was used to compile it. I am able to build it from the command line using nmake project.mak, but the compiler complains that afxres.h was not found. I did a...
[ "visual-studio", "nmake" ]
1
4
4,153
2
0
2008-08-29T22:42:01.290000
2008-08-29T22:48:10.213000
35,432
35,441
How can I point Visual Studio 2008 to a new path for projects?
I didn't see the option to point the workspace (or it's VS equivalent, I'm still learning the terminology for Visual Studio, but it is called a workspace in Eclipse) to My Documents/Programming instead of -- well -- wherever it is now.
What Craig said, plus if you do want to change the default it's in Tools -> Options -> Projects And Solutions. I've never changed the default and never created a solution/project in the default location, which might tell you something about how relevant it is...
How can I point Visual Studio 2008 to a new path for projects? I didn't see the option to point the workspace (or it's VS equivalent, I'm still learning the terminology for Visual Studio, but it is called a workspace in Eclipse) to My Documents/Programming instead of -- well -- wherever it is now.
TITLE: How can I point Visual Studio 2008 to a new path for projects? QUESTION: I didn't see the option to point the workspace (or it's VS equivalent, I'm still learning the terminology for Visual Studio, but it is called a workspace in Eclipse) to My Documents/Programming instead of -- well -- wherever it is now. AN...
[ "visual-studio" ]
1
1
242
3
0
2008-08-29T22:47:47.953000
2008-08-29T22:52:16.507000
35,479
47,221
Exception in Web Service locks DLL and prevents publishing. Workaround?
I'm using a native DLL (FastImage.dll) in a C# ASP.NET Web Service that sometimes locks (can't delete it---says access denied); this requires stopping IIS to delete the DLL. The inability to delete this DLL in the bin folder of my published Web Service prevents me from publishing successfully (even though it thinks it ...
Using the IISReset command line tool will only restart IIS on the local machine, not on a remote server to which you are publishing. Assuming that you are publishing to a Windows 2003 server, I'd suggest trying the slightly less drastic step of stopping and restarting the IIS AppPool in the web site or virtual folder i...
Exception in Web Service locks DLL and prevents publishing. Workaround? I'm using a native DLL (FastImage.dll) in a C# ASP.NET Web Service that sometimes locks (can't delete it---says access denied); this requires stopping IIS to delete the DLL. The inability to delete this DLL in the bin folder of my published Web Ser...
TITLE: Exception in Web Service locks DLL and prevents publishing. Workaround? QUESTION: I'm using a native DLL (FastImage.dll) in a C# ASP.NET Web Service that sometimes locks (can't delete it---says access denied); this requires stopping IIS to delete the DLL. The inability to delete this DLL in the bin folder of my...
[ "c#", "asp.net", "visual-studio", "web-services", "iis" ]
2
2
1,124
2
0
2008-08-29T23:55:09.350000
2008-09-06T03:09:26.077000
35,480
35,529
How can I clear Class::DBI's internal cache?
I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old between times that it is accessed. From the man pages I found two options...
The " common problems " page on the Class::DBI wiki has a section on this subject. The simplest solution is to disable the live object index entirely using: $Class::DBI::Weaken_Is_Available = 0;
How can I clear Class::DBI's internal cache? I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old between times that it is acc...
TITLE: How can I clear Class::DBI's internal cache? QUESTION: I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old between ti...
[ "perl", "class-dbi" ]
2
5
1,569
4
0
2008-08-29T23:56:27.303000
2008-08-30T00:54:08.477000
35,485
35,738
Linux: What is the best way to estimate the code & static data size of program?
I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will objdump & readelf help?
"size" is the traditional tool. "readelf" has a lot of options. $ size /bin/sh text data bss dec hex filename 712739 37524 21832 772095 bc7ff /bin/sh
Linux: What is the best way to estimate the code & static data size of program? I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will objdump & readelf he...
TITLE: Linux: What is the best way to estimate the code & static data size of program? QUESTION: I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will ob...
[ "c++", "linux", "unix" ]
2
5
1,459
4
0
2008-08-30T00:03:39.253000
2008-08-30T06:24:05.780000
35,486
35,609
Fluid rounded corners with jQuery
What is the best way to create fluid width/height rounded corners with jQuery? That plugin doesn't keep the height the same. I have a 10px high div that I want to round the corners on, when I use that script it adds about 10px onto whats there.
I use: Jquery-roundcorners-canvas it handles borders, and keeps things the same size, in fact you have to pad in a bit to keep from having letters live in the crease. Its pretty fast, unless you are on ie 6. Same pretty syntax of the other corner packs, but just prettier in general. Edited to add new link for jQuery Ro...
Fluid rounded corners with jQuery What is the best way to create fluid width/height rounded corners with jQuery? That plugin doesn't keep the height the same. I have a 10px high div that I want to round the corners on, when I use that script it adds about 10px onto whats there.
TITLE: Fluid rounded corners with jQuery QUESTION: What is the best way to create fluid width/height rounded corners with jQuery? That plugin doesn't keep the height the same. I have a 10px high div that I want to round the corners on, when I use that script it adds about 10px onto whats there. ANSWER: I use: Jquery-...
[ "jquery" ]
15
9
15,516
4
0
2008-08-30T00:04:38.440000
2008-08-30T02:35:18.110000
35,490
65,385
Spread vs MPI vs zeromq?
In one of the answers to Broadcast like UDP with the Reliability of TCP, a user mentions the Spread messaging API. I've also run across one called ØMQ. I also have some familiarity with MPI. So, my main question is: why would I choose one over the other? More specifically, why would I choose to use Spread or ØMQ when t...
MPI was deisgned tightly-coupled compute clusters with fast, reliable networks. Spread and ØMQ are designed for large distributed systems. If you're designing a parallel scientific application, go with MPI, but if you are designing a persistent distributed system that needs to be resilient to faults and network instabi...
Spread vs MPI vs zeromq? In one of the answers to Broadcast like UDP with the Reliability of TCP, a user mentions the Spread messaging API. I've also run across one called ØMQ. I also have some familiarity with MPI. So, my main question is: why would I choose one over the other? More specifically, why would I choose to...
TITLE: Spread vs MPI vs zeromq? QUESTION: In one of the answers to Broadcast like UDP with the Reliability of TCP, a user mentions the Spread messaging API. I've also run across one called ØMQ. I also have some familiarity with MPI. So, my main question is: why would I choose one over the other? More specifically, why...
[ "api", "networking", "messaging", "distributed", "cluster-computing" ]
48
57
14,429
3
0
2008-08-30T00:07:41.770000
2008-09-15T18:22:19.567000
35,491
35,694
Mac OS X: What is the best way to estimate the code & static data size of program?
I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will otool help?
"size" is the traditional tool and works on all unix flavors. "otool" has a bit finer grain control and has a lot of options.. $ size python __TEXT __DATA __OBJC others dec hex 860160 159744 0 2453504 3473408 350000
Mac OS X: What is the best way to estimate the code & static data size of program? I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will otool help?
TITLE: Mac OS X: What is the best way to estimate the code & static data size of program? QUESTION: I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will...
[ "macos", "mach-o" ]
3
8
2,474
2
0
2008-08-30T00:09:38.817000
2008-08-30T05:12:31.397000
35,494
35,596
Is there anyway to run Ruby on Rails applications on a Windows box?
I'm looking to run Redmine, a Ruby on Rails app, on a VPS windows box. The only thing I can really think of is running a virtual Linux machine and hosting it from there. If that is my only option, am I going to run into problems running a virtual machine inside of a virtual machine? Also, this will be an internal app, ...
Windows is not the usual place to deploy production Rails apps, but there are people who do it. Mongrel was originally written to give better deployment options for Windows. As it turned out the UNIX deployment options weren't that good either.:) Start with the Ruby One Click installer so you have a sane installation o...
Is there anyway to run Ruby on Rails applications on a Windows box? I'm looking to run Redmine, a Ruby on Rails app, on a VPS windows box. The only thing I can really think of is running a virtual Linux machine and hosting it from there. If that is my only option, am I going to run into problems running a virtual machi...
TITLE: Is there anyway to run Ruby on Rails applications on a Windows box? QUESTION: I'm looking to run Redmine, a Ruby on Rails app, on a VPS windows box. The only thing I can really think of is running a virtual Linux machine and hosting it from there. If that is my only option, am I going to run into problems runni...
[ "ruby-on-rails", "windows", "ruby" ]
8
8
2,112
7
0
2008-08-30T00:10:12.480000
2008-08-30T02:18:30.957000
35,499
35,513
Chat application AJAX polling
In the project I am currently working on, we have the need to develop a web chat application, not a very complex chat, just a way to connect two people to talk about a very specific topic, we don't need any kind of authentication for one of the two users, we don't have to support emoticons, avatars, or stuff like that....
You might also want to look into Comet. It's used by GTalk, Meebo, and many other chat applications. A few years ago when I was experimenting with it, there weren't very many libraries or details about server architecture to implement it, but it looks like there is a lot more stuff out now. Have a look at the cometd pr...
Chat application AJAX polling In the project I am currently working on, we have the need to develop a web chat application, not a very complex chat, just a way to connect two people to talk about a very specific topic, we don't need any kind of authentication for one of the two users, we don't have to support emoticons...
TITLE: Chat application AJAX polling QUESTION: In the project I am currently working on, we have the need to develop a web chat application, not a very complex chat, just a way to connect two people to talk about a very specific topic, we don't need any kind of authentication for one of the two users, we don't have to...
[ "php", "ajax", "chat" ]
14
7
6,092
12
0
2008-08-30T00:14:19.227000
2008-08-30T00:29:37.490000
35,507
234,746
Changing default file structure in a Java Struts App
I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity.vm files), configs (struts.xml, persistence.xml) from main WAR file. I have all in default structure like: application |-- META-INF -- Some configs are here |-- WEB-INF -- others here | |-- classe...
If I understood your question about Struts config files right, they are specified in web.xml. Find the Struts servlet config param. The param-value can be a list of comma separated list of XML files to load. Eg: action org.apache.struts.action.ActionServlet config WEB-INF/config/struts-config.xml, WEB-INF/config/struts...
Changing default file structure in a Java Struts App I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity.vm files), configs (struts.xml, persistence.xml) from main WAR file. I have all in default structure like: application |-- META-INF -- Some con...
TITLE: Changing default file structure in a Java Struts App QUESTION: I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity.vm files), configs (struts.xml, persistence.xml) from main WAR file. I have all in default structure like: application |-- ME...
[ "java", "templates", "struts", "configuration-files" ]
3
1
1,021
3
0
2008-08-30T00:19:14.877000
2008-10-24T18:27:11.583000
35,522
35,524
looping and average in c++
Programming Student here...trying to work on a project but I'm stuck. The project is trying to find the miles per gallon per trip then at the end outputting total miles and total gallons used and averaging miles per gallon How do I loop back up to the first question after the first set of questions has been asked. Also...
You will have to tell us the type of data you are given. As per your last question: remember that an average can be calculated in real time by either storing the sum and the number of data points (two numbers), or the current average and the number of data points (again, two numbers). For instance: class Averager { dou...
looping and average in c++ Programming Student here...trying to work on a project but I'm stuck. The project is trying to find the miles per gallon per trip then at the end outputting total miles and total gallons used and averaging miles per gallon How do I loop back up to the first question after the first set of que...
TITLE: looping and average in c++ QUESTION: Programming Student here...trying to work on a project but I'm stuck. The project is trying to find the miles per gallon per trip then at the end outputting total miles and total gallons used and averaging miles per gallon How do I loop back up to the first question after th...
[ "c++" ]
0
2
1,218
1
0
2008-08-30T00:44:43.180000
2008-08-30T00:47:12.377000
35,530
35,531
What Are High-Pass and Low-Pass Filters?
Graphics and audio editing and processing software often contain functions called "High-Pass Filter" and "Low-Pass Filter". Exactly what do these do, and what are the algorithms for implementing them?
Wikipedia: High-pass filter Low-pass filter Band-pass filter These "high", "low", and "band" terms refer to frequencies. In high-pass, you try to remove low frequencies. In low-pass, you try to remove high. In band pass, you only allow a continuous frequency range to remain. Choosing the cut-off frequency depends upon ...
What Are High-Pass and Low-Pass Filters? Graphics and audio editing and processing software often contain functions called "High-Pass Filter" and "Low-Pass Filter". Exactly what do these do, and what are the algorithms for implementing them?
TITLE: What Are High-Pass and Low-Pass Filters? QUESTION: Graphics and audio editing and processing software often contain functions called "High-Pass Filter" and "Low-Pass Filter". Exactly what do these do, and what are the algorithms for implementing them? ANSWER: Wikipedia: High-pass filter Low-pass filter Band-pa...
[ "algorithm", "graphics", "audio", "photoshop", "signal-processing" ]
27
22
86,821
6
0
2008-08-30T00:55:26.053000
2008-08-30T00:58:00.027000
35,537
35,665
Zoom for a windows form in C#
Is there an easy way to set the zoom level for a windows form in C#? In VBA there was a zoom property of the form.
There is no way (that I know of) to do what you ask with typical WinForms. If you're doing custom painting/drawing, you can zoom that by using a zoom transform, but so far as I know there is no "Zoom" property for the form in the entire world of.NET and native Windows/C++ APIs combined. You could probably rig something...
Zoom for a windows form in C# Is there an easy way to set the zoom level for a windows form in C#? In VBA there was a zoom property of the form.
TITLE: Zoom for a windows form in C# QUESTION: Is there an easy way to set the zoom level for a windows form in C#? In VBA there was a zoom property of the form. ANSWER: There is no way (that I know of) to do what you ask with typical WinForms. If you're doing custom painting/drawing, you can zoom that by using a zoo...
[ "c#", "winforms" ]
11
0
36,456
3
0
2008-08-30T01:11:46.937000
2008-08-30T03:55:38.413000
35,538
35,543
Validate (X)HTML in Python
What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app.
XHTML is easy, use lxml. from lxml import etree from StringIO import StringIO etree.parse(StringIO(html), etree.HTMLParser(recover=False)) HTML is harder, since there's traditionally not been as much interest in validation among the HTML crowd (run StackOverflow itself through a validator, yikes). The easiest solution ...
Validate (X)HTML in Python What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app.
TITLE: Validate (X)HTML in Python QUESTION: What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app. ANSWER: XHTML is easy, use lxml. from ...
[ "python", "html", "validation", "xhtml" ]
45
19
30,074
9
0
2008-08-30T01:15:32.370000
2008-08-30T01:20:52.157000
35,541
145,362
Are there any good programs for actionscript/flex that'll count lines of code, number of functions, files, packages,etc
Doug McCune had created something that was exactly what I needed ( http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/ ) but alas - it was for AIR beta 2. I just would like some tool that I can run that would provide some decent metrics...any idea's?
There is a Code Metrics Explorer in the Enterprise Flex Plug-in below: http://www.deitte.com/archives/2008/09/flex_builder_pl.htm
Are there any good programs for actionscript/flex that'll count lines of code, number of functions, files, packages,etc Doug McCune had created something that was exactly what I needed ( http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/ ) but alas - it was for AIR beta 2. I just...
TITLE: Are there any good programs for actionscript/flex that'll count lines of code, number of functions, files, packages,etc QUESTION: Doug McCune had created something that was exactly what I needed ( http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/ ) but alas - it was for ...
[ "apache-flex", "actionscript-3", "code-analysis" ]
2
3
4,170
6
0
2008-08-30T01:17:52.100000
2008-09-28T06:39:07.227000
35,548
35,592
Make source with two targets
I use this tool called Lazy C++ which breaks a single C++.lzz file into a.h and.cpp file. I want Makepp to expect both of these files to exist after my rule for building.lzz files, but I'm not sure how to put two targets into a single build line.
I've never used Makepp personally, but since it's a drop-in replacement for GNU Make, you should be able to do something like: build: foo.h foo.cpp g++ $(CFLAGS) foo.cpp -o $(LFLAGS) foo foo.h foo.cpp: foo.lzz lzz foo.lzz Also not sure about the lzz invocation there, but that should help. You can read more about this ...
Make source with two targets I use this tool called Lazy C++ which breaks a single C++.lzz file into a.h and.cpp file. I want Makepp to expect both of these files to exist after my rule for building.lzz files, but I'm not sure how to put two targets into a single build line.
TITLE: Make source with two targets QUESTION: I use this tool called Lazy C++ which breaks a single C++.lzz file into a.h and.cpp file. I want Makepp to expect both of these files to exist after my rule for building.lzz files, but I'm not sure how to put two targets into a single build line. ANSWER: I've never used M...
[ "build-process", "makefile", "lazy-c++" ]
2
3
448
2
0
2008-08-30T01:26:42.203000
2008-08-30T02:10:19.930000
35,551
35,556
Excluding Code Analysis rule in source
In a project I'm working on FxCop shows me lots of (and I mean more than 400) errors on the InitializeComponent() methods generated by the Windows Forms designer. Most of those errors are just the assignment of the Text property of labels. I'd like to suppress those methods in source, so I copied the suppression code g...
You've probably got the right code, but you also need to add CODE_ANALYSIS as a precompiler defined symbol in the project properties. I think those SuppressMessage attributes are only left in the compiled binaries if CODE_ANALYSIS is defined.
Excluding Code Analysis rule in source In a project I'm working on FxCop shows me lots of (and I mean more than 400) errors on the InitializeComponent() methods generated by the Windows Forms designer. Most of those errors are just the assignment of the Text property of labels. I'd like to suppress those methods in sou...
TITLE: Excluding Code Analysis rule in source QUESTION: In a project I'm working on FxCop shows me lots of (and I mean more than 400) errors on the InitializeComponent() methods generated by the Windows Forms designer. Most of those errors are just the assignment of the Text property of labels. I'd like to suppress th...
[ "visual-studio", "code-analysis", "fxcop", "suppression", "initializecomponent" ]
19
18
6,722
3
0
2008-08-30T01:29:05.617000
2008-08-30T01:37:11.273000
35,559
35,578
How far does SQL Server Express Edition scale?
Wikipedia says SQL Server Express Edition is limited to "one processor, 1 GB memory and 4 GB database files". Does anyone have practical experience with how well this scales?
It's a regular sql server, it just has a limit. SharePoint by default uses the sql server express if that gives you any idea. We have our entire office (80+) people running on that instance.
How far does SQL Server Express Edition scale? Wikipedia says SQL Server Express Edition is limited to "one processor, 1 GB memory and 4 GB database files". Does anyone have practical experience with how well this scales?
TITLE: How far does SQL Server Express Edition scale? QUESTION: Wikipedia says SQL Server Express Edition is limited to "one processor, 1 GB memory and 4 GB database files". Does anyone have practical experience with how well this scales? ANSWER: It's a regular sql server, it just has a limit. SharePoint by default u...
[ "sql-server-express" ]
2
5
1,348
4
0
2008-08-30T01:44:34.347000
2008-08-30T02:00:04.700000
35,560
36,348
Lazy Loading with a WCF Service Domain Model?
I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup. Any suggestions when taking this approach? when I implemented this technique and step into my app, just before the server returns my list it hits the get of each property that i...
As for any remoting architecture, you'll want to avoid loading a full object graph "down the wire" in an uncontrolled way (unless you have a trivially small number of objects). The Wikipedia article has the standard techniques pretty much summarised (and in C#. too!). I've used both ghosts and value holders and they wo...
Lazy Loading with a WCF Service Domain Model? I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup. Any suggestions when taking this approach? when I implemented this technique and step into my app, just before the server returns m...
TITLE: Lazy Loading with a WCF Service Domain Model? QUESTION: I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup. Any suggestions when taking this approach? when I implemented this technique and step into my app, just before th...
[ "wcf", "web-services", "domain-driven-design" ]
6
3
3,799
3
0
2008-08-30T01:46:19.630000
2008-08-30T21:16:51.627000
35,563
464,168
How do I make bash reverse-search work in Terminal.app without it displaying garbled output?
Using Terminal.app on OS X 10.5, often you see the commands get garbled when you do a reverse-search with Bash. Is there some kind of termcap or perhaps a bash shopt command that can fix this? It is very annoying. Steps to reproduce: Open Terminal.app, reverse-search to a longish command. Hit -E once you've found the c...
I was able to set my TERM to xterm instead of xterm-color and it solves the problem. (export TERM=xterm).
How do I make bash reverse-search work in Terminal.app without it displaying garbled output? Using Terminal.app on OS X 10.5, often you see the commands get garbled when you do a reverse-search with Bash. Is there some kind of termcap or perhaps a bash shopt command that can fix this? It is very annoying. Steps to repr...
TITLE: How do I make bash reverse-search work in Terminal.app without it displaying garbled output? QUESTION: Using Terminal.app on OS X 10.5, often you see the commands get garbled when you do a reverse-search with Bash. Is there some kind of termcap or perhaps a bash shopt command that can fix this? It is very annoy...
[ "macos", "bash" ]
9
11
4,292
7
0
2008-08-30T01:48:42.260000
2009-01-21T05:24:25.750000
35,569
35,582
Why does Python's iter() on a mapping return iterkeys() instead of iteritems()?
It seems like if you want to get the keys of a mapping, you ask for them; otherwise, give me the whole mapping (constituted by a set of key-value pairs). Is there a historical reason for this?
Check out this thread for a discussion on the reasons behind this behavior (including that Guido likes it, and it's not likely to change ).
Why does Python's iter() on a mapping return iterkeys() instead of iteritems()? It seems like if you want to get the keys of a mapping, you ask for them; otherwise, give me the whole mapping (constituted by a set of key-value pairs). Is there a historical reason for this?
TITLE: Why does Python's iter() on a mapping return iterkeys() instead of iteritems()? QUESTION: It seems like if you want to get the keys of a mapping, you ask for them; otherwise, give me the whole mapping (constituted by a set of key-value pairs). Is there a historical reason for this? ANSWER: Check out this threa...
[ "python", "mapping", "iteration" ]
13
13
849
1
0
2008-08-30T01:51:05.187000
2008-08-30T02:01:57.143000
35,615
35,632
What is a good online resource for css 'design patterns'?
Can anyone out there recommend a good online resource for CSS 'design patterns'? I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, clean solutions to common problems / tasks. An example of such a resource wou...
I refer to A List Apart articles all the time for those sorts of things. They do a lot of trial-and-error research to come up with really creative ways to handle those common CSS problems in the cleanest most portable way possible.
What is a good online resource for css 'design patterns'? Can anyone out there recommend a good online resource for CSS 'design patterns'? I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, clean solutions to ...
TITLE: What is a good online resource for css 'design patterns'? QUESTION: Can anyone out there recommend a good online resource for CSS 'design patterns'? I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, c...
[ "html", "css", "design-patterns", "xhtml" ]
20
3
10,687
5
0
2008-08-30T02:42:38.560000
2008-08-30T03:01:03.867000
35,634
35,635
Ruby "is" equivalent
Is there a Ruby equivalent for Python's "is"? It tests whether two objects are identical (i.e. have the same memory location).
Use a.equal? b http://www.ruby-doc.org/core/classes/Object.html Unlike ==, the equal? method should never be overridden by subclasses: it is used to determine object identity (that is, a.equal?(b) iff a is the same object as b).
Ruby "is" equivalent Is there a Ruby equivalent for Python's "is"? It tests whether two objects are identical (i.e. have the same memory location).
TITLE: Ruby "is" equivalent QUESTION: Is there a Ruby equivalent for Python's "is"? It tests whether two objects are identical (i.e. have the same memory location). ANSWER: Use a.equal? b http://www.ruby-doc.org/core/classes/Object.html Unlike ==, the equal? method should never be overridden by subclasses: it is used...
[ "python", "ruby" ]
9
13
507
2
0
2008-08-30T03:04:54.527000
2008-08-30T03:06:02.310000
35,646
35,690
Do you continue development in a branch or in the trunk?
Suppose you're developing a software product that has periodic releases. What are the best practices with regard to branching and merging? Slicing off periodic release branches to the public (or whomever your customer is) and then continuing development on the trunk, or considering the trunk the stable version, tagging...
I have tried both methods with a large commercial application. The answer to which method is better is highly dependent on your exact situation, but I will write what my overall experience has shown so far. The better method overall (in my experience): The trunk should be always stable. Here are some guidelines and ben...
Do you continue development in a branch or in the trunk? Suppose you're developing a software product that has periodic releases. What are the best practices with regard to branching and merging? Slicing off periodic release branches to the public (or whomever your customer is) and then continuing development on the tr...
TITLE: Do you continue development in a branch or in the trunk? QUESTION: Suppose you're developing a software product that has periodic releases. What are the best practices with regard to branching and merging? Slicing off periodic release branches to the public (or whomever your customer is) and then continuing dev...
[ "version-control" ]
171
152
48,583
20
0
2008-08-30T03:26:11.450000
2008-08-30T05:01:59.847000
35,669
35,692
Windows Home Server versus Vista Backup and Restore Center
I've been using Window Home Server for my backups here at home for most of a year now, and I'm really pleased with it. It's far better than the software I was using previously (Acronis). I'm thinking about a backup strategy for my work machine and I'd like to know how WHS compares with Vista's built-in backup and resto...
Chris, They're different beasts. WHS backup is pretty much automatic and uses deltas - Vista's is manual and I don't believe offers incremental updates. While your solution (Vista + network copy) would preserve your data it has two problems I an see; Your documents will only have the latest revision. If you find someth...
Windows Home Server versus Vista Backup and Restore Center I've been using Window Home Server for my backups here at home for most of a year now, and I'm really pleased with it. It's far better than the software I was using previously (Acronis). I'm thinking about a backup strategy for my work machine and I'd like to k...
TITLE: Windows Home Server versus Vista Backup and Restore Center QUESTION: I've been using Window Home Server for my backups here at home for most of a year now, and I'm really pleased with it. It's far better than the software I was using previously (Acronis). I'm thinking about a backup strategy for my work machine...
[ "backup", "windows-vista" ]
1
4
1,980
4
0
2008-08-30T04:01:53.860000
2008-08-30T05:05:39.137000
35,670
35,672
How do I begin using SVN?
I am ready to start using SVN, but I have NO (as in the money required for free beer) experience with source control. I have installed subversion on my server (that was easy, 'apt-get install subversion') but now I don't know what to do, how to configure it, or how to use it. What suggestions do you have, and where can...
Eric Sink has an excellent series on source code control aimed at beginners. For Subversion specifics, including setting up and administering a server, the Subversion book is a great resource, and includes a section with examples of a typical session with Subversion (checkout, commit, merging and updating basics). Upda...
How do I begin using SVN? I am ready to start using SVN, but I have NO (as in the money required for free beer) experience with source control. I have installed subversion on my server (that was easy, 'apt-get install subversion') but now I don't know what to do, how to configure it, or how to use it. What suggestions ...
TITLE: How do I begin using SVN? QUESTION: I am ready to start using SVN, but I have NO (as in the money required for free beer) experience with source control. I have installed subversion on my server (that was easy, 'apt-get install subversion') but now I don't know what to do, how to configure it, or how to use it....
[ "svn" ]
17
17
3,866
8
0
2008-08-30T04:01:55.263000
2008-08-30T04:04:35.197000
35,677
36,212
What is the best architecture to bridge to XMPP?
If I have a separate system with its own concept of users and presence, what is the most appropriate architecture for creating a bridge to an XMPP server network? As far as I can tell there are three primary ways: Act as a server. This creates one touchpoint, but I fear it has implications for compatibility, and potent...
The XMPP gateway protocol you've heard of is most likely to do with transports. A transport is a server that connects to both a XMPP server and a non-XMPP server. By running a transport, I can use my Jabber client to talk to someone using, say, MSN Messenger. A transport typically connects once to the remote network fo...
What is the best architecture to bridge to XMPP? If I have a separate system with its own concept of users and presence, what is the most appropriate architecture for creating a bridge to an XMPP server network? As far as I can tell there are three primary ways: Act as a server. This creates one touchpoint, but I fear ...
TITLE: What is the best architecture to bridge to XMPP? QUESTION: If I have a separate system with its own concept of users and presence, what is the most appropriate architecture for creating a bridge to an XMPP server network? As far as I can tell there are three primary ways: Act as a server. This creates one touch...
[ "networking", "architecture", "xmpp" ]
9
4
4,369
5
0
2008-08-30T04:11:35.070000
2008-08-30T17:59:05.407000
35,699
1,842,279
On a two-column page, how can I grow the left div to the same height of the right div using CSS or Javascript?
I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. Here's a paired down example of my template to illustrate the problem. nav1 nav2 nav3 nav4 Lorem ipsum dolor sit ame...
Use jQuery for this problem; just call this function in your ready function: function setHeight(){ var height = $(document).height(); //optionally, subtract some from the height $("#leftDiv").css("height", height + "px"); }
On a two-column page, how can I grow the left div to the same height of the right div using CSS or Javascript? I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. Here'...
TITLE: On a two-column page, how can I grow the left div to the same height of the right div using CSS or Javascript? QUESTION: I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot...
[ "javascript", "html", "css" ]
16
3
6,525
11
0
2008-08-30T05:28:40.483000
2009-12-03T19:24:24.997000
35,700
35,715
Writing cross-platform apps in C
What things should be kept most in mind when writing cross-platform applications in C? Targeted platforms: 32-bit Intel based PC, Mac, and Linux. I'm especially looking for the type of versatility that Jungle Disk has in their USB desktop edition ( http://www.jungledisk.com/desktop/download.aspx ) What are tips and "go...
I maintained for a number of years an ANSI C networking library that was ported to close to 30 different OS's and compilers. The library didn't have any GUI components, which made it easier. We ended up abstracting out into dedicated source files any routine that was not consistent across platforms, and used #defines w...
Writing cross-platform apps in C What things should be kept most in mind when writing cross-platform applications in C? Targeted platforms: 32-bit Intel based PC, Mac, and Linux. I'm especially looking for the type of versatility that Jungle Disk has in their USB desktop edition ( http://www.jungledisk.com/desktop/down...
TITLE: Writing cross-platform apps in C QUESTION: What things should be kept most in mind when writing cross-platform applications in C? Targeted platforms: 32-bit Intel based PC, Mac, and Linux. I'm especially looking for the type of versatility that Jungle Disk has in their USB desktop edition ( http://www.jungledis...
[ "c", "cross-platform", "32-bit" ]
14
10
8,437
8
0
2008-08-30T05:30:24.333000
2008-08-30T05:48:56.537000
35,707
35,710
Decision making in distributed applications
With a distributed application, where you have lots of clients and one main server, should you: Make the clients dumb and the server smart: clients are fast and non-invasive. Business rules are needed in only 1 place Make the clients smart and the server dumb: take as much load as possible off of the server Additional ...
You should do as much client-side processing as possible. This will enable your application to scale better than doing processing server-side. To solve your temperamental user problem, you could look into making your client processes run at a very low priority so there's no noticeable decrease in performance on the par...
Decision making in distributed applications With a distributed application, where you have lots of clients and one main server, should you: Make the clients dumb and the server smart: clients are fast and non-invasive. Business rules are needed in only 1 place Make the clients smart and the server dumb: take as much lo...
TITLE: Decision making in distributed applications QUESTION: With a distributed application, where you have lots of clients and one main server, should you: Make the clients dumb and the server smart: clients are fast and non-invasive. Business rules are needed in only 1 place Make the clients smart and the server dum...
[ "distributed" ]
2
3
798
3
0
2008-08-30T05:41:38.677000
2008-08-30T05:44:31.273000
35,709
35,735
How do I change my Active Sound Card on the Fly?
I currently have speakers set up both in my office and in my living room, connected to my PC via two sound cards, and would like to switch the set of speakers I'm outputting to on the fly. Anyone know an application or a windows API call that I can use to change the default sound output device? It is currently a bit of...
That topic is covered in depth here Easily Change or Switch the Default Audio Sound Output in Vista or XP. Note that sound management was changed in Vista significantly. On a side note, I believe SnapStream is/was working on an application to allo multi-channel sound cards to output to different rooms (sets of speakers...
How do I change my Active Sound Card on the Fly? I currently have speakers set up both in my office and in my living room, connected to my PC via two sound cards, and would like to switch the set of speakers I'm outputting to on the fly. Anyone know an application or a windows API call that I can use to change the defa...
TITLE: How do I change my Active Sound Card on the Fly? QUESTION: I currently have speakers set up both in my office and in my living room, connected to my PC via two sound cards, and would like to switch the set of speakers I'm outputting to on the fly. Anyone know an application or a windows API call that I can use ...
[ "windows", "audio", "hardware" ]
5
7
1,961
1
0
2008-08-30T05:43:56.830000
2008-08-30T06:21:06.537000
35,721
35,723
Seeking code highlighter recommendation for WordPress
Can anybody recommend a reliable and decently documented code highlighter for WordPress 2.6.1? I have tried Code Snippet by Roman Roan and Developer Formatter by Gilberto Saraiva. But they don't seem to work as described in the documentation and are mangling the code snippets instead of prettifying them.
I use WP-Syntax and it's worked very well for me. It's supported every language I've thrown at it so far, and the colors can be customized for a particular theme (though the defaults look just fine too)
Seeking code highlighter recommendation for WordPress Can anybody recommend a reliable and decently documented code highlighter for WordPress 2.6.1? I have tried Code Snippet by Roman Roan and Developer Formatter by Gilberto Saraiva. But they don't seem to work as described in the documentation and are mangling the cod...
TITLE: Seeking code highlighter recommendation for WordPress QUESTION: Can anybody recommend a reliable and decently documented code highlighter for WordPress 2.6.1? I have tried Code Snippet by Roman Roan and Developer Formatter by Gilberto Saraiva. But they don't seem to work as described in the documentation and ar...
[ "php", "wordpress", "codehighlighter", "geshi" ]
10
6
529
5
0
2008-08-30T05:57:20.167000
2008-08-30T05:58:33.173000
35,745
35,756
Are there any tools to visualize template/class methods and their usage?
I have taken over a large code base and would like to get an overview how and where certain classes and their methods are used. Is there any good tool that can somehow visualize the dependencies and draw a nice call tree or something similar? The code is in C++ in Visual Studio if that helps narrow down any selection.
Here are a few options: CodeDrawer CC-RIDER Doxygen The last one, doxygen, is more of an automatic documentation tool, but it is capable of generating dependency graphs and inheritance diagrams. It's also licensed under the GPL, unlike the first two which are not free.
Are there any tools to visualize template/class methods and their usage? I have taken over a large code base and would like to get an overview how and where certain classes and their methods are used. Is there any good tool that can somehow visualize the dependencies and draw a nice call tree or something similar? The ...
TITLE: Are there any tools to visualize template/class methods and their usage? QUESTION: I have taken over a large code base and would like to get an overview how and where certain classes and their methods are used. Is there any good tool that can somehow visualize the dependencies and draw a nice call tree or somet...
[ "visualization" ]
3
1
791
5
0
2008-08-30T06:51:07.103000
2008-08-30T07:17:17.697000
35,748
35,908
Is it possible to list named events in Windows?
I would like to create events for certain resources that are used across various processes and access these events by name. The problem seems to be that the names of the events must be known to all applications referring to them. Is there maybe a way to get a list of names events in the system? I am aware that I might ...
Do not mix up the user mode ZwOpenDirectoryObject with the kernel mode ZwOpenDirectoryObject -- the kernel mode API ( http://msdn.microsoft.com/en-us/library/ms800966.aspx ) indeed seems to available as of XP only, but the user mode version should be available at least since NT 4. Anyway, I would not recommend using Zw...
Is it possible to list named events in Windows? I would like to create events for certain resources that are used across various processes and access these events by name. The problem seems to be that the names of the events must be known to all applications referring to them. Is there maybe a way to get a list of name...
TITLE: Is it possible to list named events in Windows? QUESTION: I would like to create events for certain resources that are used across various processes and access these events by name. The problem seems to be that the names of the events must be known to all applications referring to them. Is there maybe a way to ...
[ "windows", "events" ]
1
1
4,260
3
0
2008-08-30T06:56:31.507000
2008-08-30T11:58:22.887000
35,753
259,591
Is Python good for big software projects (not web based)?
Right now I'm developing mostly in C/C++, but I wrote some small utilities in Python to automatize some tasks and I really love it as language (especially the productivity). Except for the performances (a problem that could be sometimes solved thanks to the ease of interfacing Python with C modules), do you think it is...
We've used IronPython to build our flagship spreadsheet application (40kloc production code - and it's Python, which IMO means loc per feature is low) at Resolver Systems, so I'd definitely say it's ready for production use of complex apps. There are two ways in which this might not be a useful answer to you:-) We're u...
Is Python good for big software projects (not web based)? Right now I'm developing mostly in C/C++, but I wrote some small utilities in Python to automatize some tasks and I really love it as language (especially the productivity). Except for the performances (a problem that could be sometimes solved thanks to the ease...
TITLE: Is Python good for big software projects (not web based)? QUESTION: Right now I'm developing mostly in C/C++, but I wrote some small utilities in Python to automatize some tasks and I really love it as language (especially the productivity). Except for the performances (a problem that could be sometimes solved ...
[ "python", "ide" ]
29
34
30,003
13
0
2008-08-30T07:08:22.587000
2008-11-03T19:05:14.623000
35,762
35,770
Linux GUI development
I have a large GUI project that I'd like to port to Linux. What is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective Or is better to use something more generic other than X? I feel like if I chose one of Gnome or KDE, I'm closing the mar...
Your best bet may be to port it to a cross-platform widget library such as wxWidgets, which would give you portability to any platform wxWidgets supports. It's also important to make the distinction between Gnome libraries and GTK, and likewise KDE libraries and Qt. If you write the code to use GTK or Qt, it should wor...
Linux GUI development I have a large GUI project that I'd like to port to Linux. What is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective Or is better to use something more generic other than X? I feel like if I chose one of Gnome or KD...
TITLE: Linux GUI development QUESTION: I have a large GUI project that I'd like to port to Linux. What is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective Or is better to use something more generic other than X? I feel like if I chose ...
[ "c++", "linux", "user-interface", "gnome", "kde-plasma" ]
15
15
8,745
4
0
2008-08-30T07:51:26.977000
2008-08-30T08:12:06.957000
35,772
40,188
How to embed user-specific data in .NET windows setup app at setup download time?
I'd like to have a link in my ASP.NET web site that authenticated users click to download a windows app that is already pre-configured with their client ID and some site config data. My goal is no typing required for the user during the client app install, both for the user friendliness, and to avoid config errors from...
The way the FogBugz screenshot setup tool does this is that it appends a 256 byte block at the end of the setup program at the moment it is downloaded. In other words, the download script spits out all the bytes from setup.exe and then an extra 256 with the url for the FogBugz server, plus any padding. Windows ignores ...
How to embed user-specific data in .NET windows setup app at setup download time? I'd like to have a link in my ASP.NET web site that authenticated users click to download a windows app that is already pre-configured with their client ID and some site config data. My goal is no typing required for the user during the c...
TITLE: How to embed user-specific data in .NET windows setup app at setup download time? QUESTION: I'd like to have a link in my ASP.NET web site that authenticated users click to download a windows app that is already pre-configured with their client ID and some site config data. My goal is no typing required for the...
[ ".net", "windows", "installation", "fogbugz" ]
2
2
237
3
0
2008-08-30T08:16:37.553000
2008-09-02T18:12:57.987000
35,782
35,784
Formatting tabular data using unicode characters
I need to produce a calculation trace file containing tabular data showing intermediate results. I am currently using a combination of the standard ascii pipe symbols (|) and dashes (-) to draw the table lines: E.g. Numerator | Denominator | Result ----------|-------------|------- 6 | 2 | 3 10 | 5 | 2 Are there any uni...
There are Unicode box drawing characters (look for Box Drawing under Geometrical Symbols - the chart itself is a PDF). I don't have any idea how widely supported those characters are, though.
Formatting tabular data using unicode characters I need to produce a calculation trace file containing tabular data showing intermediate results. I am currently using a combination of the standard ascii pipe symbols (|) and dashes (-) to draw the table lines: E.g. Numerator | Denominator | Result ----------|-----------...
TITLE: Formatting tabular data using unicode characters QUESTION: I need to produce a calculation trace file containing tabular data showing intermediate results. I am currently using a combination of the standard ascii pipe symbols (|) and dashes (-) to draw the table lines: E.g. Numerator | Denominator | Result ----...
[ "unicode", "format", "special-characters", "non-ascii-characters" ]
3
3
2,054
3
0
2008-08-30T08:26:43.630000
2008-08-30T08:31:22.933000
35,785
35,821
XML serialization in Java?
What is the Java analogue of.NET's XML serialization?
2008 Answer The "Official" Java API for this is now JAXB - Java API for XML Binding. See Tutorial by Oracle. The reference implementation lives at http://jaxb.java.net/ 2018 Update Note that the Java EE and CORBA Modules are deprecated in SE in JDK9 and to be removed from SE in JDK11. Therefore, to use JAXB it will eit...
XML serialization in Java? What is the Java analogue of.NET's XML serialization?
TITLE: XML serialization in Java? QUESTION: What is the Java analogue of.NET's XML serialization? ANSWER: 2008 Answer The "Official" Java API for this is now JAXB - Java API for XML Binding. See Tutorial by Oracle. The reference implementation lives at http://jaxb.java.net/ 2018 Update Note that the Java EE and CORBA...
[ "java", "xml", "serialization" ]
108
84
149,222
11
0
2008-08-30T08:33:01.133000
2008-08-30T09:31:57.530000
35,798
35,803
Techniques to detect Polymorphic and Metamorphic viruses?
What techniques can be applied to detect Polymorphic and Metamorphic viruses? How difficult is to implement these techniques? Are these techniques being applied in modern day anti-virus softwares?
I thought most of the virus scanners nowadays use sandbox techniques to check for "bad" behavior. Therefore the polymorphic virusses will also be detected. of course these detection techniques are also known to virus creators, and can easily be bypassed using a bunch of random, unharmfull, code executions before the ac...
Techniques to detect Polymorphic and Metamorphic viruses? What techniques can be applied to detect Polymorphic and Metamorphic viruses? How difficult is to implement these techniques? Are these techniques being applied in modern day anti-virus softwares?
TITLE: Techniques to detect Polymorphic and Metamorphic viruses? QUESTION: What techniques can be applied to detect Polymorphic and Metamorphic viruses? How difficult is to implement these techniques? Are these techniques being applied in modern day anti-virus softwares? ANSWER: I thought most of the virus scanners n...
[ "antivirus", "virus" ]
3
2
1,984
2
0
2008-08-30T08:55:43.543000
2008-08-30T09:11:31.713000
35,805
35,823
Why is my instance variable not in __dict__?
If I create a class A as follows: class A: def __init__(self): self.name = 'A' Inspecting the __dict__ member looks like {'name': 'A'} If however I create a class B: class B: name = 'B' __dict__ is empty. What is the difference between the two, and why doesn't name show up in B 's __dict__?
B.name is a class attribute, not an instance attribute. It shows up in B.__dict__, but not in b = B(); b.__dict__. The distinction is obscured somewhat because when you access an attribute on an instance, the class dict is a fallback. So in the above example, b.name will give you the value of B.name.
Why is my instance variable not in __dict__? If I create a class A as follows: class A: def __init__(self): self.name = 'A' Inspecting the __dict__ member looks like {'name': 'A'} If however I create a class B: class B: name = 'B' __dict__ is empty. What is the difference between the two, and why doesn't name show up i...
TITLE: Why is my instance variable not in __dict__? QUESTION: If I create a class A as follows: class A: def __init__(self): self.name = 'A' Inspecting the __dict__ member looks like {'name': 'A'} If however I create a class B: class B: name = 'B' __dict__ is empty. What is the difference between the two, and why does...
[ "python" ]
39
47
5,928
2
0
2008-08-30T09:12:41.367000
2008-08-30T09:33:00.990000
35,817
35,857
How to escape os.system() calls?
When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash. I'm currently doing the following, but am sure there must be a library function f...
This is what I use: def shellquote(s): return "'" + s.replace("'", "'\\''") + "'" The shell will always accept a quoted filename and remove the surrounding quotes before passing it to the program in question. Notably, this avoids problems with filenames that contain spaces or any other kind of nasty shell metacharacter...
How to escape os.system() calls? When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash. I'm currently doing the following, but am sure t...
TITLE: How to escape os.system() calls? QUESTION: When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash. I'm currently doing the follow...
[ "python", "shell", "escaping" ]
145
90
119,456
10
0
2008-08-30T09:27:24.640000
2008-08-30T10:13:11.503000
35,837
35,845
What is the Difference Between Mercurial and Git?
I've been using git for some time now on Windows (with msysGit) and I like the idea of distributed source control. Just recently I've been looking at Mercurial (hg) and it looks interesting. However, I can't wrap my head around the differences between hg and git. Has anyone made a side-by-side comparison between git an...
These articles may help: Git vs. Mercurial: Please Relax (Git is MacGyver and Mercurial is James Bond) The Differences Between Mercurial and Git Edit: Comparing Git and Mercurial to celebrities seems to be a trend. Here's one more: Git is Wesley Snipes, Mercurial is Denzel Washington
What is the Difference Between Mercurial and Git? I've been using git for some time now on Windows (with msysGit) and I like the idea of distributed source control. Just recently I've been looking at Mercurial (hg) and it looks interesting. However, I can't wrap my head around the differences between hg and git. Has an...
TITLE: What is the Difference Between Mercurial and Git? QUESTION: I've been using git for some time now on Windows (with msysGit) and I like the idea of distributed source control. Just recently I've been looking at Mercurial (hg) and it looks interesting. However, I can't wrap my head around the differences between ...
[ "git", "version-control", "mercurial", "comparison", "dvcs" ]
726
345
655,544
25
0
2008-08-30T09:48:27.520000
2008-08-30T09:57:01.963000
35,842
35,885
How can a Java program get its own process ID?
How do I get the id of my Java process? I know there are several platform-dependent hacks, but I would prefer a more generic solution.
There exists no platform-independent way that can be guaranteed to work in all jvm implementations. ManagementFactory.getRuntimeMXBean().getName() looks like the best (closest) solution, and typically includes the PID. It's short, and probably works in every implementation in wide use. On linux+windows it returns a val...
How can a Java program get its own process ID? How do I get the id of my Java process? I know there are several platform-dependent hacks, but I would prefer a more generic solution.
TITLE: How can a Java program get its own process ID? QUESTION: How do I get the id of my Java process? I know there are several platform-dependent hacks, but I would prefer a more generic solution. ANSWER: There exists no platform-independent way that can be guaranteed to work in all jvm implementations. ManagementF...
[ "java", "pid" ]
427
422
359,347
22
0
2008-08-30T09:53:25.420000
2008-08-30T11:11:17.277000
35,849
35,892
What logging is good logging for your app?
So we've discussed logging in passing at my place of work and I was wondering if some of you guys here could give me some ideas of your approaches? Typically our scenario is, no logging really at all, and mostly.NET apps, winforms/WPF clients talking through web services or direct to a db. So, the real question is, whe...
The key thing for logging is good planning. I would suggest that you look into the enterprise library exception and logging application block ( http://msdn.microsoft.com/en-us/library/cc467894.aspx ). There is a wee bit of a learning curve but it does work quite well. The approach I favour at the moment is to define 4 ...
What logging is good logging for your app? So we've discussed logging in passing at my place of work and I was wondering if some of you guys here could give me some ideas of your approaches? Typically our scenario is, no logging really at all, and mostly.NET apps, winforms/WPF clients talking through web services or di...
TITLE: What logging is good logging for your app? QUESTION: So we've discussed logging in passing at my place of work and I was wondering if some of you guys here could give me some ideas of your approaches? Typically our scenario is, no logging really at all, and mostly.NET apps, winforms/WPF clients talking through ...
[ ".net", "logging", "client-applications" ]
12
10
1,797
7
0
2008-08-30T10:02:20.063000
2008-08-30T11:20:54.727000
35,853
35,873
P/Invoke in Mono
What's the current status of Mono 's Platform Invoke implementation on Linux and on Solaris?
Working, usable and stable. It's well tested since quite a lot of mono's own low-level functionality has to be marshaled through it to the underlying operating system. There are some P/Invoke extensions when compared to Microsoft.Net implementation (after all they deal with a single OS family and three architectures at...
P/Invoke in Mono What's the current status of Mono 's Platform Invoke implementation on Linux and on Solaris?
TITLE: P/Invoke in Mono QUESTION: What's the current status of Mono 's Platform Invoke implementation on Linux and on Solaris? ANSWER: Working, usable and stable. It's well tested since quite a lot of mono's own low-level functionality has to be marshaled through it to the underlying operating system. There are some ...
[ ".net", "linux", "mono", "pinvoke", "solaris" ]
21
29
4,010
1
0
2008-08-30T10:04:55.407000
2008-08-30T10:45:40.393000
35,870
35,872
Comparison of Lat, Long Coordinates
I have a list of more than 15 thousand latitude and longitude coordinates. Given any X,Y coordinates, what is the fastest way to find the closest coordinates on the list?
You will want to use a geometric construction called a Voronoi diagram. This divides up the plane into a number of areas, one for each point, that encompass all the points that are closest to each of your given points. The code for the exact algorithms to create the Voronoi diagram and arrange the data structure lookup...
Comparison of Lat, Long Coordinates I have a list of more than 15 thousand latitude and longitude coordinates. Given any X,Y coordinates, what is the fastest way to find the closest coordinates on the list?
TITLE: Comparison of Lat, Long Coordinates QUESTION: I have a list of more than 15 thousand latitude and longitude coordinates. Given any X,Y coordinates, what is the fastest way to find the closest coordinates on the list? ANSWER: You will want to use a geometric construction called a Voronoi diagram. This divides u...
[ "sorting", "comparison" ]
12
6
5,903
13
0
2008-08-30T10:34:05.383000
2008-08-30T10:41:35.147000
35,879
35,891
Base64 Encoding Image
I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have? I am only familiar with PHP
As far as I remember there is an xml element for the image data. You can use this website to encode a file (use the upload field). Then just copy and paste the data to the XML element. You could also use PHP to do this like so: Use Mozilla's guide for help on creating OpenSearch plugins. For example, the icon element i...
Base64 Encoding Image I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have? I am only familiar with PHP
TITLE: Base64 Encoding Image QUESTION: I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have? I am only familiar with PHP ANSWER: As far as I remember there is an xml element for the image data. You can use this website to encode a f...
[ "php", "encoding", "base64", "opensearch" ]
65
81
143,645
5
0
2008-08-30T11:01:31.887000
2008-08-30T11:20:50.513000
35,893
83,939
Grid controls compatible with .NET and Mono?
Do you know any grid control compatible with.NET and Mono? DataGridView seems to be quite buggy on Mono, and GTK# controls depends on GTK+ so you need to install it in windows machines where, usually, it's not present.
You might want to try out the preview of Mono 2.0. DataGridView is vastly better in this version, though there are still several places where it is still lacking. http://mono.ximian.com/monobuild/preview/download-preview/
Grid controls compatible with .NET and Mono? Do you know any grid control compatible with.NET and Mono? DataGridView seems to be quite buggy on Mono, and GTK# controls depends on GTK+ so you need to install it in windows machines where, usually, it's not present.
TITLE: Grid controls compatible with .NET and Mono? QUESTION: Do you know any grid control compatible with.NET and Mono? DataGridView seems to be quite buggy on Mono, and GTK# controls depends on GTK+ so you need to install it in windows machines where, usually, it's not present. ANSWER: You might want to try out the...
[ "c#", "datagrid", "controls", "mono" ]
10
4
4,797
5
0
2008-08-30T11:22:42.677000
2008-09-17T14:39:32.113000
35,896
36,050
How can I play compressed sound files in C# in a portable way?
Is there a portable, not patent-restricted way to play compressed sound files in C# /.Net? I want to play short "jingle" sounds on various events occuring in the program. System.Media.SoundPlayer can handle only WAV, but those are typically to big to embed in a downloadable apllication. MP3 is protected with patents, s...
I finally revisited this topic, and, using help from BrokenGlass on writing WAVE header, updated csvorbis. I've added an OggDecodeStream that can be passed to System.Media.SoundPlayer to simply play any (compatible) Ogg Vorbis stream. Example usage: using (var file = new FileStream(oggFilename, FileMode.Open, FileAcces...
How can I play compressed sound files in C# in a portable way? Is there a portable, not patent-restricted way to play compressed sound files in C# /.Net? I want to play short "jingle" sounds on various events occuring in the program. System.Media.SoundPlayer can handle only WAV, but those are typically to big to embed ...
TITLE: How can I play compressed sound files in C# in a portable way? QUESTION: Is there a portable, not patent-restricted way to play compressed sound files in C# /.Net? I want to play short "jingle" sounds on various events occuring in the program. System.Media.SoundPlayer can handle only WAV, but those are typicall...
[ "c#", ".net", "mono", "audio", "oggvorbis" ]
19
8
10,759
9
0
2008-08-30T11:33:55.787000
2008-08-30T15:41:12.307000
35,905
35,924
How do I autorun an application in a terminal in Ubuntu?
I've created a few autorun script files on various USB devices that run bash scripts when they mount. These scripts run "in the background", how do I get them to run in a terminal window? (Like the "Application in Terminal" gnome Launcher type.)
Run them as a two stage process with your "autorun" script calling the second script in a new terminal eg gnome-terminal -e top --title Testing Would run the program "top" in a new gnome terminal window with the title "Testing" You can add additional arguments like setting the geometry to determine the size and locatio...
How do I autorun an application in a terminal in Ubuntu? I've created a few autorun script files on various USB devices that run bash scripts when they mount. These scripts run "in the background", how do I get them to run in a terminal window? (Like the "Application in Terminal" gnome Launcher type.)
TITLE: How do I autorun an application in a terminal in Ubuntu? QUESTION: I've created a few autorun script files on various USB devices that run bash scripts when they mount. These scripts run "in the background", how do I get them to run in a terminal window? (Like the "Application in Terminal" gnome Launcher type.)...
[ "bash", "ubuntu", "gnome", "autorun" ]
1
5
7,058
2
0
2008-08-30T11:53:01.777000
2008-08-30T12:23:17.307000
35,914
35,930
Launch a file with command line arguments without knowing location of exe?
Here's the situation: I am trying to launch an application, but the location of the.exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like: Process.Start("Sample.xls"); However, I need to pass some command line arguments as well. I couldn't get this to work Process p = new...
Using my code from this answer you can get command associated with xls extension. Then you can pass this command to Process.Start method.
Launch a file with command line arguments without knowing location of exe? Here's the situation: I am trying to launch an application, but the location of the.exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like: Process.Start("Sample.xls"); However, I need to pass some ...
TITLE: Launch a file with command line arguments without knowing location of exe? QUESTION: Here's the situation: I am trying to launch an application, but the location of the.exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like: Process.Start("Sample.xls"); However, I ...
[ "c#", ".net", "vb.net" ]
5
4
1,210
2
0
2008-08-30T12:10:50.580000
2008-08-30T12:29:30.643000
35,943
35,961
Logging in a PHP webapp
I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed. Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup. Is there a third (or fourth etc) option that I'm not aw...
You will almost certainly want to use a database for flexible, record based access and to take advantage of the database's ability to handle concurrent data access. If you need to track information that may need to be undone, having it in a structured format is a benefit, as is having the ability to update a row indica...
Logging in a PHP webapp I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed. Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup. Is there a third (or fourth etc...
TITLE: Logging in a PHP webapp QUESTION: I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed. Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup. Is there a th...
[ "php", "logging" ]
3
5
1,368
5
0
2008-08-30T13:08:07.697000
2008-08-30T13:49:27.973000
35,948
50,425
Django templates and variable attributes
I'm using Google App Engine and Django templates. I have a table that I want to display the objects look something like: Object Result: Items = [item1,item2] Users = [{name='username',item1=3,item2=4},..] The Django template is: user {% for item in result.items %} {{item}} {% endfor %} {% for user in result.users %} {{...
I found a "nicer"/"better" solution for getting variables inside Its not the nicest way, but it works. You install a custom filter into django which gets the key of your dict as a parameter To make it work in google app-engine you need to add a file to your main directory, I called mine django_hack.py which contains th...
Django templates and variable attributes I'm using Google App Engine and Django templates. I have a table that I want to display the objects look something like: Object Result: Items = [item1,item2] Users = [{name='username',item1=3,item2=4},..] The Django template is: user {% for item in result.items %} {{item}} {% en...
TITLE: Django templates and variable attributes QUESTION: I'm using Google App Engine and Django templates. I have a table that I want to display the objects look something like: Object Result: Items = [item1,item2] Users = [{name='username',item1=3,item2=4},..] The Django template is: user {% for item in result.items...
[ "python", "django", "google-app-engine" ]
38
34
30,330
6
0
2008-08-30T13:20:02.740000
2008-09-08T19:01:24.353000
35,950
35,965
I don't understand std::tr1::unordered_map
I need an associative container that makes me index a certain object through a string, but that also keeps the order of insertion, so I can look for a specific object by its name or just iterate on it and retrieve objects in the same order I inserted them. I think this hybrid of linked list and hash map should do the j...
Boost documentation of unordered containers The difference is in the method of how you generate the look up. In the map/set containers the operator< is used to generate an ordered tree. In the unordered containers, an operator( key ) => index is used. See hashing for a description of how that works.
I don't understand std::tr1::unordered_map I need an associative container that makes me index a certain object through a string, but that also keeps the order of insertion, so I can look for a specific object by its name or just iterate on it and retrieve objects in the same order I inserted them. I think this hybrid ...
TITLE: I don't understand std::tr1::unordered_map QUESTION: I need an associative container that makes me index a certain object through a string, but that also keeps the order of insertion, so I can look for a specific object by its name or just iterate on it and retrieve objects in the same order I inserted them. I ...
[ "c++", "tr1", "unordered-map" ]
4
4
15,720
7
0
2008-08-30T13:20:42.643000
2008-08-30T13:53:56.120000
35,954
36,055
How do you full-text search multiple criteria on left-joined tables in SQL Server?
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber, cacc.AccountNumber, ca.Line1, ca.CityName, ca.PostalCode from dbo.Customer as c left join dbo.CustomerAddress as ca on ca.CustomerId = c.Id left join dbo.CustomerAccount as cacc on cacc.CustomerId = c.Id where c.Countr...
Run it through the query analyzer and see what the query plan is. My guess would be that the double root (ie. %ae%) searches are causing it do do a table scan when looking for the matching rows. Double root searches are inherently slow, as you can't use any kind of index to match them usually.
How do you full-text search multiple criteria on left-joined tables in SQL Server? I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber, cacc.AccountNumber, ca.Line1, ca.CityName, ca.PostalCode from dbo.Customer as c left join dbo.CustomerAddress as ca on ca.CustomerId = ...
TITLE: How do you full-text search multiple criteria on left-joined tables in SQL Server? QUESTION: I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber, cacc.AccountNumber, ca.Line1, ca.CityName, ca.PostalCode from dbo.Customer as c left join dbo.CustomerAddress as ca o...
[ "sql-server", "full-text-search" ]
0
1
1,408
3
0
2008-08-30T13:31:17.423000
2008-08-30T15:47:34.040000
35,973
36,075
Add predefined data for typedef enums in C
What is the best approach to define additional data for typedef enums in C? Example: typedef enum { kVizsla = 0, kTerrier = 3, kYellowLab = 10 } DogType; Now I would like to define names for each, for example kVizsla should be "vizsla". I currently use a function that returns a string using a large switch block.
@dmckee: I think the suggested solution is good, but for simple data (e.g. if only the name is needed) it could be augmented with auto-generated code. While there are lots of ways to auto-generate code, for something as simple as this I believe you could write a simple XSLT that takes in an XML representation of the en...
Add predefined data for typedef enums in C What is the best approach to define additional data for typedef enums in C? Example: typedef enum { kVizsla = 0, kTerrier = 3, kYellowLab = 10 } DogType; Now I would like to define names for each, for example kVizsla should be "vizsla". I currently use a function that returns ...
TITLE: Add predefined data for typedef enums in C QUESTION: What is the best approach to define additional data for typedef enums in C? Example: typedef enum { kVizsla = 0, kTerrier = 3, kYellowLab = 10 } DogType; Now I would like to define names for each, for example kVizsla should be "vizsla". I currently use a func...
[ "c", "enums", "typedef" ]
5
2
2,095
4
0
2008-08-30T14:13:17.557000
2008-08-30T16:12:23.120000
35,974
166,446
Embed Images in emails created using SQL Server Database Mail
I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a.net app to generate & send the emails but, unfortunately, all I have is SQL ...
Yes, what you need to do is include the images as attachments and then they can be referenced within the HTML. Use the @file_attachment parameter of sp_send_dbmail
Embed Images in emails created using SQL Server Database Mail I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a.net app to gen...
TITLE: Embed Images in emails created using SQL Server Database Mail QUESTION: I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were usin...
[ "sql-server", "database", "email" ]
6
1
14,141
3
0
2008-08-30T14:14:44.043000
2008-10-03T11:41:30.410000
35,983
36,063
Rolling back bad changes with svn in Eclipse
Let's say I have committed some bad changes to Subversion repository. Then I commit good changes, that I want to keep. What would be easiest way to roll back those bad changes in Eclipse, and keep the good changes? Assuming that files relating to bad changes are not same as those relating to the good changes. How thing...
You have two choices to do this. The Quick and Dirty is selecting your files (using ctrl ) in Project Explorer view, right-click them, choose Replace with... and then you choose the best option for you, from Latest from Repository, or some Branch version. After getting those files you modify them (with a space, or fix ...
Rolling back bad changes with svn in Eclipse Let's say I have committed some bad changes to Subversion repository. Then I commit good changes, that I want to keep. What would be easiest way to roll back those bad changes in Eclipse, and keep the good changes? Assuming that files relating to bad changes are not same as ...
TITLE: Rolling back bad changes with svn in Eclipse QUESTION: Let's say I have committed some bad changes to Subversion repository. Then I commit good changes, that I want to keep. What would be easiest way to roll back those bad changes in Eclipse, and keep the good changes? Assuming that files relating to bad change...
[ "eclipse", "svn", "subclipse", "subversive" ]
83
30
105,461
7
0
2008-08-30T14:22:55.083000
2008-08-30T15:54:19.717000
35,991
186,996
Altering database tables in Django
I'm considering using Django for a project I'm starting (fyi, a browser-based game) and one of the features I'm liking the most is using syncdb to automatically create the database tables based on the Django models I define (a feature that I can't seem to find in any other framework). I was already thinking this was to...
As noted in other answers to the same topic, be sure to watch the DjangoCon 2008 Schema Evolution Panel on YouTube. Also, two new projects on the map: Simplemigrations and Migratory.
Altering database tables in Django I'm considering using Django for a project I'm starting (fyi, a browser-based game) and one of the features I'm liking the most is using syncdb to automatically create the database tables based on the Django models I define (a feature that I can't seem to find in any other framework)....
TITLE: Altering database tables in Django QUESTION: I'm considering using Django for a project I'm starting (fyi, a browser-based game) and one of the features I'm liking the most is using syncdb to automatically create the database tables based on the Django models I define (a feature that I can't seem to find in any...
[ "database", "django" ]
62
17
33,048
7
0
2008-08-30T14:36:39.030000
2008-10-09T12:16:02.317000
36,001
36,011
SQL Server 2005 Auto Updated DateTime Column - LastUpdated
I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed? CREATE TABLE dbo.Profiles ( UserName varchar(100) NOT NULL, LastUpdate datetime NOT NULL CONSTRAINT DF_Profiles_LastUpdate DEFAULT (getdate()), FullN...
A default constraint only works on inserts; for an update use a trigger.
SQL Server 2005 Auto Updated DateTime Column - LastUpdated I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed? CREATE TABLE dbo.Profiles ( UserName varchar(100) NOT NULL, LastUpdate datetime NOT NULL C...
TITLE: SQL Server 2005 Auto Updated DateTime Column - LastUpdated QUESTION: I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed? CREATE TABLE dbo.Profiles ( UserName varchar(100) NOT NULL, LastUpdate d...
[ "sql-server", "database", "timestamp", "sql-update" ]
13
4
20,985
5
0
2008-08-30T14:48:38.767000
2008-08-30T14:55:17.923000
36,014
41,208
Why is .NET exception not caught by try/catch block?
I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it and instea...
I believe I understand the problem. The exception is being caught, the issue is confusion over the debugger's behavior and differences in the debugger settings among each person trying to repro it. In the 3rd case from your repro I believe you are getting the following message: "NoViableAltException was unhandled by us...
Why is .NET exception not caught by try/catch block? I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not a...
TITLE: Why is .NET exception not caught by try/catch block? QUESTION: I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in...
[ "c#", ".net", "exception", "antlr" ]
56
32
75,005
25
0
2008-08-30T14:57:13.050000
2008-09-03T05:27:31.937000
36,019
48,247
Deleting messages from Exchange IMAP mailbox on iPhone
I have a secondary Exchange mailbox configured on my iPhone using IMAP. This all appears to work fine except when a message is deleted on the phone, it still shows normally in Outlook. It does not seem to matter what I set the "remove deleted messages" setting to on the phone. I understand this is due to a combination ...
I can wholeheartedly recommend writing such a process with a simple Perl client using the Mail::MAPClient module. #!/usr/bin/perl -w use strict; use Mail::IMAPClient; # returns an unconnected Mail::IMAPClient object: my $imap = Mail::IMAPClient->new( Server => $host, User => $id, Password=> $pass, ) or die "Cannot con...
Deleting messages from Exchange IMAP mailbox on iPhone I have a secondary Exchange mailbox configured on my iPhone using IMAP. This all appears to work fine except when a message is deleted on the phone, it still shows normally in Outlook. It does not seem to matter what I set the "remove deleted messages" setting to o...
TITLE: Deleting messages from Exchange IMAP mailbox on iPhone QUESTION: I have a secondary Exchange mailbox configured on my iPhone using IMAP. This all appears to work fine except when a message is deleted on the phone, it still shows normally in Outlook. It does not seem to matter what I set the "remove deleted mess...
[ "ios", "exchange-server", "imap" ]
2
2
2,401
1
0
2008-08-30T15:00:37.270000
2008-09-07T08:19:57.493000
36,028
36,234
How to assign a method's output to a textbox value without code behind
How do I assign a method's output to a textbox value without code behind? <%@ Page Language="VB" %> Test Page <%=TextFromString%> <%=TextFromMethod%> it was mostly so the designer guys could use it in the aspx page. Seems like a simple thing to push a variable value into a textbox to me. It's also confusing to me why <...
There's a couple of different expression types in.ASPX files. There's: <%= TextFromMethod %> which simply reserves a literal control, and outputs the text at render time. and then there's: <%# TextFromMethod %> which is a databinding expression, evaluated when the control is DataBound(). There's also expression builder...
How to assign a method's output to a textbox value without code behind How do I assign a method's output to a textbox value without code behind? <%@ Page Language="VB" %> Test Page <%=TextFromString%> <%=TextFromMethod%> it was mostly so the designer guys could use it in the aspx page. Seems like a simple thing to push...
TITLE: How to assign a method's output to a textbox value without code behind QUESTION: How do I assign a method's output to a textbox value without code behind? <%@ Page Language="VB" %> Test Page <%=TextFromString%> <%=TextFromMethod%> it was mostly so the designer guys could use it in the aspx page. Seems like a si...
[ "asp.net", "vb.net" ]
1
2
3,653
2
0
2008-08-30T15:09:06.610000
2008-08-30T18:32:57.993000
36,030
36,059
Yaws uses old config file
I'm developing a web app on Yaws 1.65 (installed through apt) running on Debian etch on a VPS with UML. Whenever I do /etc/init.d/yaws restart or a stop/start, it initializes according to an old version of the config file (/etc/yaws/yaws.conf). I know this because I changed the docroot from the default to another direc...
I'm completely inexperienced with yaws, but I have a troubleshooting suggestion: What happens if you remove the config file completely? If it still starts yaws without a config file, that could be a clear sign that something is being cached. For what it's worth, with a quick 5 minutes of googling, I found no mention of...
Yaws uses old config file I'm developing a web app on Yaws 1.65 (installed through apt) running on Debian etch on a VPS with UML. Whenever I do /etc/init.d/yaws restart or a stop/start, it initializes according to an old version of the config file (/etc/yaws/yaws.conf). I know this because I changed the docroot from th...
TITLE: Yaws uses old config file QUESTION: I'm developing a web app on Yaws 1.65 (installed through apt) running on Debian etch on a VPS with UML. Whenever I do /etc/init.d/yaws restart or a stop/start, it initializes according to an old version of the config file (/etc/yaws/yaws.conf). I know this because I changed t...
[ "yaws" ]
1
1
298
1
0
2008-08-30T15:15:01.090000
2008-08-30T15:50:55.030000
36,039
36,080
Templates spread across multiple files
C++ seems to be rather grouchy when declaring templates across multiple files. More specifically, when working with templated classes, the linker expect all method definitions for the class in a single compiler object file. When you take into account headers, other declarations, inheritance, etc., things get really mes...
Are there any general advice or workarounds for organizing or redistributing templated member definitions across multiple files? Yes; don't. The C++ spec permits a compiler to be able to "see" the entire template (declaration and definition) at the point of instantiation, and (due to the complexities of any implementat...
Templates spread across multiple files C++ seems to be rather grouchy when declaring templates across multiple files. More specifically, when working with templated classes, the linker expect all method definitions for the class in a single compiler object file. When you take into account headers, other declarations, i...
TITLE: Templates spread across multiple files QUESTION: C++ seems to be rather grouchy when declaring templates across multiple files. More specifically, when working with templated classes, the linker expect all method definitions for the class in a single compiler object file. When you take into account headers, oth...
[ "c++", "templates" ]
23
27
14,177
3
0
2008-08-30T15:27:34.960000
2008-08-30T16:19:04.570000
36,054
78,591
Anyone have experience with Sphinx speech recognition?
Has anyone used the Sphinx speech recognition stack to build IVR applications? I am looking for open source alternatives to the expensive and somewhat limiting choices from MSFT and others. I have not been able to find a comprehensive package that ties open source speech/voip applications together.
Last I looked at Sphinx, it had issues with 8khz audio which resulted in really poor performance. There's not a lot of people talking about successful deployments of Sphinx in real environments, but you might be able to get it to work with some trailblazing effort. See here for more info: http://www.voip-info.org/wiki-...
Anyone have experience with Sphinx speech recognition? Has anyone used the Sphinx speech recognition stack to build IVR applications? I am looking for open source alternatives to the expensive and somewhat limiting choices from MSFT and others. I have not been able to find a comprehensive package that ties open source ...
TITLE: Anyone have experience with Sphinx speech recognition? QUESTION: Has anyone used the Sphinx speech recognition stack to build IVR applications? I am looking for open source alternatives to the expensive and somewhat limiting choices from MSFT and others. I have not been able to find a comprehensive package that...
[ "speech-recognition", "ivr", "cmusphinx" ]
3
1
4,212
2
0
2008-08-30T15:46:09.703000
2008-09-17T00:14:57.060000
36,064
36,209
What is the replacement of Controller.ReadFromRequest in ASP.NET MVC?
I am attempting to update a project from ASP.NET MVC Preview 3 to Preview 5 and it seems that Controller.ReadFromRequest(string key) has been removed from the Controller class. Does anyone know of any alternatives to retrieving information based on an identifier from a form?
Looks like they've added controller.UpdateModel to address this issue, signature is: UpdateModel(object model, string[] keys) I haven't upgraded my app personally, so I'm not sure of the actual usage. I'll be interested to find out about this myself, as I'm using controller.ReadFromRequest as well.
What is the replacement of Controller.ReadFromRequest in ASP.NET MVC? I am attempting to update a project from ASP.NET MVC Preview 3 to Preview 5 and it seems that Controller.ReadFromRequest(string key) has been removed from the Controller class. Does anyone know of any alternatives to retrieving information based on a...
TITLE: What is the replacement of Controller.ReadFromRequest in ASP.NET MVC? QUESTION: I am attempting to update a project from ASP.NET MVC Preview 3 to Preview 5 and it seems that Controller.ReadFromRequest(string key) has been removed from the Controller class. Does anyone know of any alternatives to retrieving info...
[ "c#", "asp.net-mvc", ".net-3.5", "entity-framework-ctp5" ]
5
3
990
3
0
2008-08-30T15:55:19.683000
2008-08-30T17:57:16.973000
36,077
60,140
Finding out the source of an exception in C++ after it is caught?
I'm looking for an answer in MS VC++. When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I actually want. Example in pseudo code: FunctionB() {... throw e;... } FunctionA() {... FunctionB()... } try { Function A(...
If you are just interested in where the exception came from, you could just write a simple macro like #define throwException(message) \ { \ std::ostringstream oss; \ oss << __FILE __ << " " << __LINE__ << " " \ << __FUNC__ << " " << message; \ throw std::exception(oss.str().c_str()); \ } which will add the file name, l...
Finding out the source of an exception in C++ after it is caught? I'm looking for an answer in MS VC++. When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I actually want. Example in pseudo code: FunctionB() {... t...
TITLE: Finding out the source of an exception in C++ after it is caught? QUESTION: I'm looking for an answer in MS VC++. When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I actually want. Example in pseudo code: ...
[ "c++", "visual-studio", "winapi", "exception", "visual-c++" ]
13
12
6,865
14
0
2008-08-30T16:16:32.207000
2008-09-12T23:15:34.693000
36,079
36,279
PHP mail using Gmail
In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done?
Gmail's SMTP-server requires a very specific configuration. From Gmail help: Outgoing Mail (SMTP) Server (requires TLS) - smtp.gmail.com - Use Authentication: Yes - Use STARTTLS: Yes (some clients call this SSL) - Port: 465 or 587 Account Name: your full email address (including @gmail.com) Email Address: your email ad...
PHP mail using Gmail In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done?
TITLE: PHP mail using Gmail QUESTION: In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done? ANSWER: Gmail's SMTP-server requires a very specific configuration. From Gmail help: Outgoing Mail (SMTP) Server (requires...
[ "php", "email", "gmail" ]
11
10
26,853
2
0
2008-08-30T16:18:35.260000
2008-08-30T19:22:42.540000
36,081
36,097
How to Catch an exception in a using block with .NET 2.0?
I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally... any code samples to point me in the right direction? Edit: The question was modified after readi...
I don't really understand the question - you throw an exception as you normally would. If MyThing implements IDisposable, then: using ( MyThing thing = new MyThing() ) {... throw new ApplicationException("oops"); } And thing.Dispose will be called as you leave the block, as the exception's thrown. If you want to combin...
How to Catch an exception in a using block with .NET 2.0? I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally... any code samples to point me in the ri...
TITLE: How to Catch an exception in a using block with .NET 2.0? QUESTION: I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally... any code samples to ...
[ "exception", "ado.net", ".net-2.0", "error-handling" ]
4
7
3,945
3
0
2008-08-30T16:19:22.387000
2008-08-30T16:32:01.327000
36,093
36,171
Subversion or Adobe Version CUE 3 for Photoshop/Illustrator Files
This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version). I was all set to try Subversion to handle all of our files my text (code) files and their photoshop/illustrator a...
I have used Subversion for this exact thing, and Theo is right, you have to remember to lock your files. I am on CS2 and so have not used Version Cue, but I have not been able to find a whole lot online about other folks using it either, for some reason. The other problem I had using Subversion related to disk space. S...
Subversion or Adobe Version CUE 3 for Photoshop/Illustrator Files This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version). I was all set to try Subversion to handle all o...
TITLE: Subversion or Adobe Version CUE 3 for Photoshop/Illustrator Files QUESTION: This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version). I was all set to try Subversi...
[ "svn", "versioning", "photoshop" ]
5
1
5,898
6
0
2008-08-30T16:27:14.333000
2008-08-30T17:20:02.273000
36,101
36,131
How do I set the name of a window in ROR?
How do I "name" a browser window in ROR, such that I can open a page in it later, from another (popup) window (using the target="name" html parameter)
You have to use JavaScript for this: Of course you could easily package this up into a Rails helper method. For example, in app/helpers/application_helper.rb add a new method: def window_name(name) content_for(:window_name) do " " end end Next, in your layout file, add this line somewhere within the HTML element: <%= y...
How do I set the name of a window in ROR? How do I "name" a browser window in ROR, such that I can open a page in it later, from another (popup) window (using the target="name" html parameter)
TITLE: How do I set the name of a window in ROR? QUESTION: How do I "name" a browser window in ROR, such that I can open a page in it later, from another (popup) window (using the target="name" html parameter) ANSWER: You have to use JavaScript for this: Of course you could easily package this up into a Rails helper ...
[ "javascript", "html", "ruby-on-rails", "ruby" ]
4
5
346
2
0
2008-08-30T16:37:31.330000
2008-08-30T16:55:17.993000
36,106
36,311
What are some alternatives to a bit array?
I have an information retrieval application that creates bit arrays on the order of 10s of million bits. The number of "set" bits in the array varies widely, from all clear to all set. Currently, I'm using a straight-forward bit array ( java.util.BitSet ), so each of my bit arrays takes several megabytes. My plan is to...
Unless the data is truly random and has a symmetric 1/0 distribution, then this simply becomes a lossless data compression problem and is very analogous to CCITT Group 3 compression used for black and white (i.e.: Binary) FAX images. CCITT Group 3 uses a Huffman Coding scheme. In the case of FAX they are using a fixed ...
What are some alternatives to a bit array? I have an information retrieval application that creates bit arrays on the order of 10s of million bits. The number of "set" bits in the array varies widely, from all clear to all set. Currently, I'm using a straight-forward bit array ( java.util.BitSet ), so each of my bit ar...
TITLE: What are some alternatives to a bit array? QUESTION: I have an information retrieval application that creates bit arrays on the order of 10s of million bits. The number of "set" bits in the array varies widely, from all clear to all set. Currently, I'm using a straight-forward bit array ( java.util.BitSet ), so...
[ "data-structures", "information-retrieval" ]
8
16
3,464
7
0
2008-08-30T16:39:01.137000
2008-08-30T20:05:37.723000
36,108
36,741
How to get controls in WPF to fill available space?
Some WPF controls (like the Button ) seem to happily consume all the available space in its' container if you don't specify the height it is to have. And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more worried about just taking the space necessary to fit their contents, an...
Each control deriving from Panel implements distinct layout logic performed in Measure() and Arrange(): Measure() determines the size of the panel and each of its children Arrange() determines the rectangle where each control renders The last child of the DockPanel fills the remaining space. You can disable this behavi...
How to get controls in WPF to fill available space? Some WPF controls (like the Button ) seem to happily consume all the available space in its' container if you don't specify the height it is to have. And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more worried about just ...
TITLE: How to get controls in WPF to fill available space? QUESTION: Some WPF controls (like the Button ) seem to happily consume all the available space in its' container if you don't specify the height it is to have. And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more w...
[ "wpf", "user-interface", "layout" ]
356
176
335,455
5
0
2008-08-30T16:39:28.423000
2008-08-31T10:04:15.150000
36,109
42,005
Quoting command-line arguments in shell scripts
The following shell script takes a list of arguments, turns Unix paths into WINE/Windows paths and invokes the given executable under WINE. #! /bin/sh if [ "${1+set}"!= "set" ] then echo "Usage; winewrap EXEC [ARGS...]" exit 1 fi EXEC="$1" shift ARGS="" for p in "$@"; do if [ -e "$p" ] then p=$(winepath -w $p) fi A...
I you do want to have the assignment to CMD you should use eval $CMD instead of just $CMD in the last line of your script. This should solve your problem with spaces in the paths, I don't know what to do about the "\t" problem.
Quoting command-line arguments in shell scripts The following shell script takes a list of arguments, turns Unix paths into WINE/Windows paths and invokes the given executable under WINE. #! /bin/sh if [ "${1+set}"!= "set" ] then echo "Usage; winewrap EXEC [ARGS...]" exit 1 fi EXEC="$1" shift ARGS="" for p in "$@";...
TITLE: Quoting command-line arguments in shell scripts QUESTION: The following shell script takes a list of arguments, turns Unix paths into WINE/Windows paths and invokes the given executable under WINE. #! /bin/sh if [ "${1+set}"!= "set" ] then echo "Usage; winewrap EXEC [ARGS...]" exit 1 fi EXEC="$1" shift ARGS=...
[ "unix", "shell", "wine" ]
3
1
5,356
4
0
2008-08-30T16:39:42.913000
2008-09-03T16:02:40.363000
36,114
36,246
Variable Holding data in a while statement
I know I must be missing something, but in a while statement how does the variable hold the data, when it finishes the first pass and goes into the second pass? { int num1 = 0; int num2 = 0; int num3 = 0; while (num1 < 10) {cout << "enter your first number: "; cin >> num1; cout << "Enter your second number: "; cin >...
Is num1 the variable you're having trouble with? This line: cin >> num1; is setting num1 to the value input by the user. So the value calculated for it in the previous run through the loop is being overwritten each time by the new input.
Variable Holding data in a while statement I know I must be missing something, but in a while statement how does the variable hold the data, when it finishes the first pass and goes into the second pass? { int num1 = 0; int num2 = 0; int num3 = 0; while (num1 < 10) {cout << "enter your first number: "; cin >> num1; ...
TITLE: Variable Holding data in a while statement QUESTION: I know I must be missing something, but in a while statement how does the variable hold the data, when it finishes the first pass and goes into the second pass? { int num1 = 0; int num2 = 0; int num3 = 0; while (num1 < 10) {cout << "enter your first number:...
[ "c++" ]
0
2
344
4
0
2008-08-30T16:43:28.943000
2008-08-30T18:47:48.317000
36,122
177,740
What is the most efficient way to keep track of a specific character's index in a string?
Take the following string as an example: "The quick brown fox" Right now the q in quick is at index 4 of the string (starting at 0) and the f in fox is at index 16. Now lets say the user enters some more text into this string. "The very quick dark brown fox" Now the q is at index 9 and the f is at index 26. What is the...
Let's say that you have a string and some of its letters are interesting. To make things easier let's say that the letter at index 0 is always interesting and you never add something before it—a sentinel. Write down pairs of (interesting letter, distance to the previous interesting letter). If the string is "+the very ...
What is the most efficient way to keep track of a specific character's index in a string? Take the following string as an example: "The quick brown fox" Right now the q in quick is at index 4 of the string (starting at 0) and the f in fox is at index 16. Now lets say the user enters some more text into this string. "Th...
TITLE: What is the most efficient way to keep track of a specific character's index in a string? QUESTION: Take the following string as an example: "The quick brown fox" Right now the q in quick is at index 4 of the string (starting at 0) and the f in fox is at index 16. Now lets say the user enters some more text int...
[ "algorithm", "string", "optimization" ]
2
2
460
4
0
2008-08-30T16:45:44.633000
2008-10-07T09:22:39.627000
36,127
38,474
Any recommended VC++ settings for better PDB analysis on release builds
Are there any VC++ settings I should know about to generate better PDB files that contain more information? I have a crash dump analysis system in place based on the project crashrpt. Also, my production build server has the source code installed on the D:\, but my development machine has the source code on the C:\. I ...
"Are there any VC++ settings I should know about" Make sure you turn off Frame pointer ommision. Larry osterman's blog has the historical details about fpo and the issues it causes with debugging. Symbols are loaded successfully. It shows the callstack, but double clicking on an entry doesn't bring me to the source cod...
Any recommended VC++ settings for better PDB analysis on release builds Are there any VC++ settings I should know about to generate better PDB files that contain more information? I have a crash dump analysis system in place based on the project crashrpt. Also, my production build server has the source code installed o...
TITLE: Any recommended VC++ settings for better PDB analysis on release builds QUESTION: Are there any VC++ settings I should know about to generate better PDB files that contain more information? I have a crash dump analysis system in place based on the project crashrpt. Also, my production build server has the sourc...
[ "visual-studio", "visual-c++", "pdb-files", "crashrpt" ]
12
5
3,014
7
0
2008-08-30T16:51:03.730000
2008-09-01T21:41:59.600000
36,129
36,167
What are some real life examples of Design Patterns used in software
I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world. If you know of a good example of design pattern usage (preferably in a OSS program so we can have a look:) then please list it below.
An ah-ha moment for me for the observer pattern was to realize how closely associated it is with events. Consider a Windows program that needs to acheive loosely communications between two forms. That can easily be accomplished with the observer pattern. The code below shows how Form2 fires an event and any other class...
What are some real life examples of Design Patterns used in software I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world. If you know of a good example of design pattern usage (preferably in a OSS program so ...
TITLE: What are some real life examples of Design Patterns used in software QUESTION: I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world. If you know of a good example of design pattern usage (preferably in...
[ "design-patterns" ]
7
3
21,557
10
0
2008-08-30T16:51:19.220000
2008-08-30T17:17:25.913000
36,139
36,156
How to sort a list of strings?
What is the best way of creating an alphabetically sorted list in Python?
Basic answer: mylist = ["b", "C", "A"] mylist.sort() This modifies your original list (i.e. sorts in-place). To get a sorted copy of the list, without changing the original, use the sorted() function: for x in sorted(mylist): print x However, the examples above are a bit naive, because they don't take locale into accou...
How to sort a list of strings? What is the best way of creating an alphabetically sorted list in Python?
TITLE: How to sort a list of strings? QUESTION: What is the best way of creating an alphabetically sorted list in Python? ANSWER: Basic answer: mylist = ["b", "C", "A"] mylist.sort() This modifies your original list (i.e. sorts in-place). To get a sorted copy of the list, without changing the original, use the sorted...
[ "python", "string", "sorting" ]
493
582
688,241
11
0
2008-08-30T17:03:09.350000
2008-08-30T17:10:12.687000
36,152
36,165
How do you unsubscribe from a ubiquity command
I can't seem to find details on how to unsubscribe from ubiquity commands. The command list page only seems to have information about the installed commands and there are no links to deleting them. Am I missing something?
Go to about:ubiquity in Firefox. Under the section "subscribed feeds" there should be an option to unsubscribe to command feeds you no longer desire. Also, if you clear your entire browser history, it will delete all command feeds (this will be fixed by 0.2)
How do you unsubscribe from a ubiquity command I can't seem to find details on how to unsubscribe from ubiquity commands. The command list page only seems to have information about the installed commands and there are no links to deleting them. Am I missing something?
TITLE: How do you unsubscribe from a ubiquity command QUESTION: I can't seem to find details on how to unsubscribe from ubiquity commands. The command list page only seems to have information about the installed commands and there are no links to deleting them. Am I missing something? ANSWER: Go to about:ubiquity in ...
[ "ubiquity" ]
2
2
842
3
0
2008-08-30T17:09:16.823000
2008-08-30T17:16:39.083000
36,182
36,397
How expensive is ST_GeomFromText
In postgis, is the ST_GeomFromText call very expensive? I ask mostly because I have a frequently called query that attempts to find the point that is nearest another point that matches some criteria, and which is also within a certain distance of that other point, and the way I currently wrote it, it's doing the same S...
I don't believe ST_GeomFromText() is particularly expensive, although in the past I've optimized PostGIS queries by creating a function, declaring a variable and then assigning the result of ST_GeomFromText to the variable. Have you tried checking the execution plan for you query with a variety of different parameters ...
How expensive is ST_GeomFromText In postgis, is the ST_GeomFromText call very expensive? I ask mostly because I have a frequently called query that attempts to find the point that is nearest another point that matches some criteria, and which is also within a certain distance of that other point, and the way I currentl...
TITLE: How expensive is ST_GeomFromText QUESTION: In postgis, is the ST_GeomFromText call very expensive? I ask mostly because I have a frequently called query that attempts to find the point that is nearest another point that matches some criteria, and which is also within a certain distance of that other point, and ...
[ "gis", "postgis" ]
1
1
986
2
0
2008-08-30T17:25:40.870000
2008-08-30T22:16:10.093000
36,183
36,191
Replacing the nth instance of a regex match in Javascript
I'm trying to write a regex function that will identify and replace a single instance of a match within a string without affecting the other instances. For example, I have this string: 12||34||56 I want to replace the second set of pipes with ampersands to get this string: 12||34&&56 The regex function needs to be able...
here's something that works: "23||45||45||56||67".replace(/^((?:[0-9]+\|\|){n})([0-9]+)\|\|/,"$1$2&&") where n is the one less than the nth pipe, (of course you don't need that first subexpression if n = 0) And if you'd like a function to do this: function pipe_replace(str,n) { var RE = new RegExp("^((?:[0-9]+\\|\\|){"...
Replacing the nth instance of a regex match in Javascript I'm trying to write a regex function that will identify and replace a single instance of a match within a string without affecting the other instances. For example, I have this string: 12||34||56 I want to replace the second set of pipes with ampersands to get t...
TITLE: Replacing the nth instance of a regex match in Javascript QUESTION: I'm trying to write a regex function that will identify and replace a single instance of a match within a string without affecting the other instances. For example, I have this string: 12||34||56 I want to replace the second set of pipes with a...
[ "javascript", "regex" ]
29
20
17,575
4
0
2008-08-30T17:26:09.230000
2008-08-30T17:40:39.960000
36,186
619,713
Best Versioning Tools to use for Photoshop/Illustrator and related binary files?
I previously asked about Version Cue 3 vs Subversion. I think this is a better question and someone suggested http://www.gridironsoftware.com/Flow/ I hope this question will allow others to join in and suggest other tools or give specific recommendation to using Version Que versus other tools.
Take a look at this article comparing Subversion, Mercurial, Git and Bazaar for managing the files in a home directory, including image files and large Photoshop files that are being edited and versioned. EDIT: The link is dead and I can't find the article, however the information in the article is now severely outdate...
Best Versioning Tools to use for Photoshop/Illustrator and related binary files? I previously asked about Version Cue 3 vs Subversion. I think this is a better question and someone suggested http://www.gridironsoftware.com/Flow/ I hope this question will allow others to join in and suggest other tools or give specific ...
TITLE: Best Versioning Tools to use for Photoshop/Illustrator and related binary files? QUESTION: I previously asked about Version Cue 3 vs Subversion. I think this is a better question and someone suggested http://www.gridironsoftware.com/Flow/ I hope this question will allow others to join in and suggest other tools...
[ "versioning", "photoshop" ]
10
4
18,680
5
0
2008-08-30T17:31:20.030000
2009-03-06T17:33:47.833000