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
42,468
42,474
How do I measure bytes in/out of an IP port used for .NET remoting?
I am using.NET remoting to retrieve periodic status updates from a Windows service into a 'controller' application which is used to display some live stats about what the service is doing. The resulting network traffic is huge - many times the size of the data for the updates - so clearly I have implemented the remotin...
Wireshark is one of the best tools for capturing and analyzing IP traffic. [Edit] Sort of lame that you answered first and didn't get the check mark. I didn't mean to snake you. +1 as a consolation.
How do I measure bytes in/out of an IP port used for .NET remoting? I am using.NET remoting to retrieve periodic status updates from a Windows service into a 'controller' application which is used to display some live stats about what the service is doing. The resulting network traffic is huge - many times the size of ...
TITLE: How do I measure bytes in/out of an IP port used for .NET remoting? QUESTION: I am using.NET remoting to retrieve periodic status updates from a Windows service into a 'controller' application which is used to display some live stats about what the service is doing. The resulting network traffic is huge - many ...
[ ".net", "windows", "networking", "remoting" ]
10
6
858
2
0
2008-09-03T20:12:28.127000
2008-09-03T20:14:21.867000
42,482
43,364
Best way to extract text from a Word doc without using COM/automation?
Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.) Antiword seems like it might be a reasonable option, but it seems like it might be abandoned. A Python solu...
I use catdoc or antiword for this, whatever gives the result that is the easiest to parse. I have embedded this in python functions, so it is easy to use from the parsing system (which is written in python). import os def doc_to_text_catdoc(filename): (fi, fo, fe) = os.popen3('catdoc -w "%s"' % filename) fi.close() re...
Best way to extract text from a Word doc without using COM/automation? Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.) Antiword seems like it might be a re...
TITLE: Best way to extract text from a Word doc without using COM/automation? QUESTION: Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.) Antiword seems lik...
[ "python", "ms-word" ]
25
16
77,055
13
0
2008-09-03T20:18:47.363000
2008-09-04T08:52:01.170000
42,483
42,540
Simulated OLAP
We have a client that has Oracle Standard, and a project that would be ten times easier addressed using OLAP. However, Oracle only supports OLAP in the Enterprise version. Migration to enterprise is not possible I'm thinking of doing some manual simulation of OLAP, creating relational tables to simulate the technology....
You can simulate OLAP functionality using client side tools pointed at a relational database. Personally I think the best tool for the job is probably Tableau Desktop. This is an amazingly sophisticated front end analytics tool that will make your relational data look multidimensional without much effort, and the tool ...
Simulated OLAP We have a client that has Oracle Standard, and a project that would be ten times easier addressed using OLAP. However, Oracle only supports OLAP in the Enterprise version. Migration to enterprise is not possible I'm thinking of doing some manual simulation of OLAP, creating relational tables to simulate ...
TITLE: Simulated OLAP QUESTION: We have a client that has Oracle Standard, and a project that would be ten times easier addressed using OLAP. However, Oracle only supports OLAP in the Enterprise version. Migration to enterprise is not possible I'm thinking of doing some manual simulation of OLAP, creating relational t...
[ "oracle", "olap", "cubes" ]
9
10
2,810
6
0
2008-09-03T20:19:30.280000
2008-09-03T20:44:28.097000
42,489
42,532
How to implement a "related" degree measure algorithm?
I was going to Ask a Question earlier today when I was presented to a surprising functionality in Stackoverflow. When I wrote my question title stackoverflow suggested me several related questions and I found out that there was already two similar questions. That was stunning! Then I started thinking how I would implem...
One such way to implement such an algorithm would involve ranking the questions as per a heuristic function which assigns a 'relevance' weight factor using the following steps: Apply a noise filter to the 'New' question to remove words that are common across a large number of objects such as: 'the', 'and', 'or', etc. G...
How to implement a "related" degree measure algorithm? I was going to Ask a Question earlier today when I was presented to a surprising functionality in Stackoverflow. When I wrote my question title stackoverflow suggested me several related questions and I found out that there was already two similar questions. That w...
TITLE: How to implement a "related" degree measure algorithm? QUESTION: I was going to Ask a Question earlier today when I was presented to a surprising functionality in Stackoverflow. When I wrote my question title stackoverflow suggested me several related questions and I found out that there was already two similar...
[ "algorithm", "indexing", "full-text-search" ]
8
3
414
4
0
2008-09-03T20:21:04.957000
2008-09-03T20:39:45.160000
42,490
42,553
TFS - Branching for experimental development: Solution fails to load
Disclaimer: I'm stuck on TFS and I hate it. My source control structure looks like this: /dev /releases /branches /experimental-upgrade I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to experimental-upgrade. Somehow TFS complained that I had changes in both ...
@Ben You can actually do a full delete in TFS, but it is highly not recommended unless you know what you are doing. You have to do it from the command line with the command tf destroy tf destroy [/keephistory] itemspec1 [;versionspec] [itemspec2...itemspecN] [/stopat:versionspec] [/preview] [/startcleanup] [/noprompt] ...
TFS - Branching for experimental development: Solution fails to load Disclaimer: I'm stuck on TFS and I hate it. My source control structure looks like this: /dev /releases /branches /experimental-upgrade I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to exp...
TITLE: TFS - Branching for experimental development: Solution fails to load QUESTION: Disclaimer: I'm stuck on TFS and I hate it. My source control structure looks like this: /dev /releases /branches /experimental-upgrade I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev...
[ "version-control", "tfs" ]
1
2
2,056
6
0
2008-09-03T20:21:14.660000
2008-09-03T20:51:26.177000
42,499
1,701,994
asp:UpdateProgress - suppressing the line-break
I've started working with ASP.net AJAX (finally ☺). and I've got an update panel together with a asp:UpdateProgress. My Problem: The UpdateProgress always forces a line-break, because it renders out as a div-tag. Is there any way to force it being a span instead? I want to display it on the same line as some other cont...
I just blogged about my own solution to this problem. http://www.joeaudette.com/solving-the-aspnet-updateprogress-div-problem.aspx What I did was borrow the UpdateProgress control from the Mono project and modified it to render as a span instead of a div. I also copied an modifed the ms-ajax javascript associated with ...
asp:UpdateProgress - suppressing the line-break I've started working with ASP.net AJAX (finally ☺). and I've got an update panel together with a asp:UpdateProgress. My Problem: The UpdateProgress always forces a line-break, because it renders out as a div-tag. Is there any way to force it being a span instead? I want t...
TITLE: asp:UpdateProgress - suppressing the line-break QUESTION: I've started working with ASP.net AJAX (finally ☺). and I've got an update panel together with a asp:UpdateProgress. My Problem: The UpdateProgress always forces a line-break, because it renders out as a div-tag. Is there any way to force it being a span...
[ "asp.net", "asp.net-ajax" ]
9
2
6,793
8
0
2008-09-03T20:25:47.690000
2009-11-09T16:07:02.593000
42,505
42,551
Thread-safe use of a singleton's members
I have a C# singleton class that multiple classes use. Is access through Instance to the Toggle() method thread-safe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it? public class MyClass { private static readonly MyClass instance = new MyClass(); public static MyClass Instance { get { return ...
Is access through 'Instance' to the 'Toggle()' class threadsafe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it? No, it's not threadsafe. Basically, both threads can run the Toggle function at the same time, so this could happen // thread 1 is running this code if(value == 0) { value = 1; // R...
Thread-safe use of a singleton's members I have a C# singleton class that multiple classes use. Is access through Instance to the Toggle() method thread-safe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it? public class MyClass { private static readonly MyClass instance = new MyClass(); publi...
TITLE: Thread-safe use of a singleton's members QUESTION: I have a C# singleton class that multiple classes use. Is access through Instance to the Toggle() method thread-safe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it? public class MyClass { private static readonly MyClass instance = new...
[ "c#", ".net", "multithreading", "singleton", "thread-safety" ]
15
30
8,403
9
0
2008-09-03T20:29:15.793000
2008-09-03T20:49:28.723000
42,512
1,568,232
Deleting a Google App Engine application
Is it possible to delete an GAE application after it has been created? I made a mistake while typing the name and now have a dummy application that I haven't been able to remove.
With the new Google Cloud console, you can still disable GAE applications as before (App Engine --> Settings --> Disable). They cannot currently be deleted. If you are sure that you aren't using the project for anything else, you can delete the entire project by going to IAM --> Settings --> Shut Down. This button is i...
Deleting a Google App Engine application Is it possible to delete an GAE application after it has been created? I made a mistake while typing the name and now have a dummy application that I haven't been able to remove.
TITLE: Deleting a Google App Engine application QUESTION: Is it possible to delete an GAE application after it has been created? I made a mistake while typing the name and now have a dummy application that I haven't been able to remove. ANSWER: With the new Google Cloud console, you can still disable GAE applications...
[ "google-app-engine" ]
136
112
118,617
12
0
2008-09-03T20:32:21.263000
2009-10-14T18:48:17.043000
42,515
42,549
Dealing with Latency in Networked Games
I'm thinking about making a networked game. I'm a little new to this, and have already run into a lot of issues trying to put together a good plan for dead reckoning and network latency, so I'd love to see some good literature on the topic. I'll describe the methods I've considered. Originally, I just sent the player's...
Check out how Valve does it in the Source Engine: http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking If it's for a first person shooter you'll probably have to delve into some of the topics they mention such as: prediction, compensation, and interpolation.
Dealing with Latency in Networked Games I'm thinking about making a networked game. I'm a little new to this, and have already run into a lot of issues trying to put together a good plan for dead reckoning and network latency, so I'd love to see some good literature on the topic. I'll describe the methods I've consider...
TITLE: Dealing with Latency in Networked Games QUESTION: I'm thinking about making a networked game. I'm a little new to this, and have already run into a lot of issues trying to put together a good plan for dead reckoning and network latency, so I'd love to see some good literature on the topic. I'll describe the met...
[ "networking", "latency", "dead-reckoning" ]
30
21
10,685
5
0
2008-09-03T20:32:26.037000
2008-09-03T20:48:14.780000
42,519
42,535
How do you rotate a two dimensional array?
Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff. [1][2][3][4] [5][6][7][8] [9][0][1][2] [3][4][5][6] Becomes: [3][9][5][1] [4][0][6][2] [5][1][7][3] [6][2][8][4] ...
Here it is in C# int[,] array = new int[4,4] { { 1,2,3,4 }, { 5,6,7,8 }, { 9,0,1,2 }, { 3,4,5,6 } }; int[,] rotated = RotateMatrix(array, 4); static int[,] RotateMatrix(int[,] matrix, int n) { int[,] ret = new int[n, n]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { ret[i, j] = matrix[n - j - 1, i]; } ...
How do you rotate a two dimensional array? Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff. [1][2][3][4] [5][6][7][8] [9][0][1][2] [3][4][5][6] Becomes: [3][9][5]...
TITLE: How do you rotate a two dimensional array? QUESTION: Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff. [1][2][3][4] [5][6][7][8] [9][0][1][2] [3][4][5][6] ...
[ "algorithm", "matrix", "multidimensional-array" ]
366
165
407,102
64
0
2008-09-03T20:34:33.783000
2008-09-03T20:41:10.790000
42,531
42,544
How do I call ::CreateProcess in c++ to launch a Windows executable?
Looking for an example that: Launches an EXE Waits for the EXE to finish. Properly closes all the handles when the executable finishes.
Something like this: STARTUPINFO info={sizeof(info)}; PROCESS_INFORMATION processInfo; if (CreateProcess(path, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo)) { WaitForSingleObject(processInfo.hProcess, INFINITE); CloseHandle(processInfo.hProcess); CloseHandle(processInfo.hThread); }
How do I call ::CreateProcess in c++ to launch a Windows executable? Looking for an example that: Launches an EXE Waits for the EXE to finish. Properly closes all the handles when the executable finishes.
TITLE: How do I call ::CreateProcess in c++ to launch a Windows executable? QUESTION: Looking for an example that: Launches an EXE Waits for the EXE to finish. Properly closes all the handles when the executable finishes. ANSWER: Something like this: STARTUPINFO info={sizeof(info)}; PROCESS_INFORMATION processInfo; i...
[ "c++", "windows", "winapi" ]
64
87
212,298
10
0
2008-09-03T20:39:21.527000
2008-09-03T20:45:53.117000
42,550
42,752
Extract Address Information from a Web Page
I need to take a web page and extract the address information from the page. Some are easier than others. I'm looking for a firefox plugin, windows app, or VB.NET code that will help me get this done. Ideally I would like to have a web page on our admin (ASP.NET/VB.NET) where you enter a URL and it scraps the page and ...
If you know the format of the page (for instance, if they're all like that ashnha.com page) then it's fairly easy to write VB.NET code that does this: Create a System.Net.WebRequest and read the response into a string. Then create a System.Text.RegularExpressions.Regex and iterate over the collection of Matches between...
Extract Address Information from a Web Page I need to take a web page and extract the address information from the page. Some are easier than others. I'm looking for a firefox plugin, windows app, or VB.NET code that will help me get this done. Ideally I would like to have a web page on our admin (ASP.NET/VB.NET) where...
TITLE: Extract Address Information from a Web Page QUESTION: I need to take a web page and extract the address information from the page. Some are easier than others. I'm looking for a firefox plugin, windows app, or VB.NET code that will help me get this done. Ideally I would like to have a web page on our admin (ASP...
[ "vb.net", "screen-scraping", "street-address" ]
3
1
6,769
4
0
2008-09-03T20:49:26.790000
2008-09-03T22:28:21.793000
42,554
42,602
Can't get my event to fire
When loading a page for the first time (!IsPostback), I am creating a button in code and adding it to my page, then adding an event handler to the click event. However, when clicking the button, after the page reloads, my event handler does not fire. Can anyone explain why?
@Brad: Your answer isn't complete; he's most likely doing it too late in the page lifecycle, during the Page_Load event. Okay, here's what you're missing. ASP.NET is stateless. That means, after your page is rendered and sent to the browser, the page object and everything on it is destroyed. There is no link that remai...
Can't get my event to fire When loading a page for the first time (!IsPostback), I am creating a button in code and adding it to my page, then adding an event handler to the click event. However, when clicking the button, after the page reloads, my event handler does not fire. Can anyone explain why?
TITLE: Can't get my event to fire QUESTION: When loading a page for the first time (!IsPostback), I am creating a button in code and adding it to my page, then adding an event handler to the click event. However, when clicking the button, after the page reloads, my event handler does not fire. Can anyone explain why? ...
[ "asp.net" ]
0
4
1,125
4
0
2008-09-03T20:51:49.467000
2008-09-03T21:09:30.800000
42,566
42,923
Getting the Hostname or IP in Ruby on Rails
I'm in the process of maintaining a Ruby on Rails app and am looking for an easy way to find the hostname or IP address of the box I'm on (since it's a VM and new instances may have different hostnames or IP addresses). Is there a quick and easy way to do this in Ruby on Rails? Edit: The answer below is correct but the...
From coderrr.wordpress.com: require 'socket' def local_ip orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily UDPSocket.open do |s| s.connect '64.233.187.99', 1 s.addr.last end ensure Socket.do_not_reverse_lookup = orig end # irb:0> local_ip # => "192...
Getting the Hostname or IP in Ruby on Rails I'm in the process of maintaining a Ruby on Rails app and am looking for an easy way to find the hostname or IP address of the box I'm on (since it's a VM and new instances may have different hostnames or IP addresses). Is there a quick and easy way to do this in Ruby on Rail...
TITLE: Getting the Hostname or IP in Ruby on Rails QUESTION: I'm in the process of maintaining a Ruby on Rails app and am looking for an easy way to find the hostname or IP address of the box I'm on (since it's a VM and new instances may have different hostnames or IP addresses). Is there a quick and easy way to do th...
[ "ruby", "networking" ]
88
51
104,064
12
0
2008-09-03T20:56:07.010000
2008-09-04T00:37:30.987000
42,575
42,734
Troubleshoot Java Lucene ignoring Field
We're currently using Lucene 2.1.0 for our site search and we've hit a difficult problem: one of our index fields is being ignored during a targeted search. Here is the code for adding the field to a document in our index: // Add market_local to index contactDocument.add( new Field( "market_local", StringUtils.objectTo...
For debugging Lucene, the best tool to use is Luke, which lets you poke around in the index itself to see what got indexed, carry out searches, etc. I recommend downloading it, pointing it at your index, and seeing what's in there.
Troubleshoot Java Lucene ignoring Field We're currently using Lucene 2.1.0 for our site search and we've hit a difficult problem: one of our index fields is being ignored during a targeted search. Here is the code for adding the field to a document in our index: // Add market_local to index contactDocument.add( new Fie...
TITLE: Troubleshoot Java Lucene ignoring Field QUESTION: We're currently using Lucene 2.1.0 for our site search and we've hit a difficult problem: one of our index fields is being ignored during a targeted search. Here is the code for adding the field to a document in our index: // Add market_local to index contactDoc...
[ "java", "lucene" ]
3
7
1,357
4
0
2008-09-03T20:59:10.073000
2008-09-03T22:17:54.020000
42,581
42,597
Python re.sub with a flag does not replace all occurrences
The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string... So what's going on when I get the following unexpected result? >>> ...
Look at the definition of re.sub: re.sub(pattern, repl, string[, count, flags]) The 4th argument is the count, you are using re.MULTILINE (which is 8) as the count, not as a flag. Either use a named argument: re.sub('^//', '', s, flags=re.MULTILINE) Or compile the regex first: re.sub(re.compile('^//', re.MULTILINE), ''...
Python re.sub with a flag does not replace all occurrences The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string... So what'...
TITLE: Python re.sub with a flag does not replace all occurrences QUESTION: The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the ...
[ "python", "regex" ]
75
150
49,330
3
0
2008-09-03T21:00:33.863000
2008-09-03T21:08:02.767000
42,587
42,656
Double dispatch in C#?
I have heard/read the term but don't quite understand what it means. When should I use this technique and how would I use it? Can anyone provide a good code sample?
The visitor pattern is a way of doing double-dispatch in an object-oriented way. It's useful for when you want to choose which method to use for a given argument based on its type at runtime rather than compile time. Double dispatch is a special case of multiple dispatch. When you call a virtual method on an object, th...
Double dispatch in C#? I have heard/read the term but don't quite understand what it means. When should I use this technique and how would I use it? Can anyone provide a good code sample?
TITLE: Double dispatch in C#? QUESTION: I have heard/read the term but don't quite understand what it means. When should I use this technique and how would I use it? Can anyone provide a good code sample? ANSWER: The visitor pattern is a way of doing double-dispatch in an object-oriented way. It's useful for when you...
[ "c#", "design-patterns", "language-features", "double-dispatch" ]
69
58
26,275
5
0
2008-09-03T21:03:51.593000
2008-09-03T21:38:54.177000
42,620
42,639
SQL Server Views, blessing or curse?
I once worked with an architect who banned the use of SQL views. His main reason was that views made it too easy for a thoughtless coder to needlessly involve joined tables which, if that coder tried harder, could be avoided altogether. Implicitly he was encouraging code reuse via copy-and-paste instead of encapsulatio...
There are some very good uses for views; I have used them a lot for tuning and for exposing less normalized sets of information, or for UNION-ing results from multiple selects into a single result set. Obviously any programming tool can be used incorrectly, but I can't think of any times in my experience where a poorly...
SQL Server Views, blessing or curse? I once worked with an architect who banned the use of SQL views. His main reason was that views made it too easy for a thoughtless coder to needlessly involve joined tables which, if that coder tried harder, could be avoided altogether. Implicitly he was encouraging code reuse via c...
TITLE: SQL Server Views, blessing or curse? QUESTION: I once worked with an architect who banned the use of SQL views. His main reason was that views made it too easy for a thoughtless coder to needlessly involve joined tables which, if that coder tried harder, could be avoided altogether. Implicitly he was encouragin...
[ "sql", "sql-server" ]
29
35
7,595
13
0
2008-09-03T21:17:17.300000
2008-09-03T21:28:34.747000
42,627
42,681
Best practices for portable C#
I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code. Project mono has some great porting resources. What are the best practices for portable C#?
I've actually used winforms and it was fine. It was BUTT UGLY, but it worked. Obviously, don't use P/Invoke, or any win32 stuff like the registry. Also be aware of any third party DLL's. For example, we use a third party SQLite dll which actually contains native code in it which we have to swap out if we want to run on...
Best practices for portable C# I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code. Project mono has some great porting resources. What are the best practices for portable C#?
TITLE: Best practices for portable C# QUESTION: I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code. Project mono has some great porting resources. What are the best practices for portable C#? ANSWER: I've actually used winforms and it was f...
[ "c#", "mono", "cross-platform" ]
20
14
3,141
9
0
2008-09-03T21:21:30.177000
2008-09-03T21:48:56.727000
42,643
45,501
Scripting the Visual Studio IDE
I'd like to create a script that will configure the Visual Studio IDE the way I like it. Nothing vastly complicated, just a few Tools/Options settings, adding some External Tools, that kind of thing. I know that this can be done inside VS with Import/Export Settings, but I'd like to be able to automate it from outside ...
Answering my own question, in two ways: In VS2005/8, the things I mentioned (Tools/Options, External Tools) are all stored in the CurrentSettings.vssettings file, in the folder "Visual Studio 200{5|8}\Settings". This file is just XML, and it can be edited programmatically by anything that knows how to parse XML. You ca...
Scripting the Visual Studio IDE I'd like to create a script that will configure the Visual Studio IDE the way I like it. Nothing vastly complicated, just a few Tools/Options settings, adding some External Tools, that kind of thing. I know that this can be done inside VS with Import/Export Settings, but I'd like to be a...
TITLE: Scripting the Visual Studio IDE QUESTION: I'd like to create a script that will configure the Visual Studio IDE the way I like it. Nothing vastly complicated, just a few Tools/Options settings, adding some External Tools, that kind of thing. I know that this can be done inside VS with Import/Export Settings, bu...
[ "visual-studio", "ide", "scripting" ]
9
2
8,209
3
0
2008-09-03T21:30:20.560000
2008-09-05T10:13:53.040000
42,648
42,655
How to get the identity of an inserted row?
How can I get the IDENTITY of an inserted row? I know about @@IDENTITY and IDENT_CURRENT and SCOPE_IDENTITY, but don't understand the implications or impacts attached to each. How do these differ, and when would each be used?
@@IDENTITY returns the last identity value generated for any table in the current session, across all scopes. You need to be careful here, since it's across scopes. You could get a value from a trigger, instead of your current statement. SCOPE_IDENTITY() returns the last identity value generated for any table in the cu...
How to get the identity of an inserted row? How can I get the IDENTITY of an inserted row? I know about @@IDENTITY and IDENT_CURRENT and SCOPE_IDENTITY, but don't understand the implications or impacts attached to each. How do these differ, and when would each be used?
TITLE: How to get the identity of an inserted row? QUESTION: How can I get the IDENTITY of an inserted row? I know about @@IDENTITY and IDENT_CURRENT and SCOPE_IDENTITY, but don't understand the implications or impacts attached to each. How do these differ, and when would each be used? ANSWER: @@IDENTITY returns the ...
[ "sql", "sql-server", "t-sql" ]
1,371
1,717
1,216,355
15
0
2008-09-03T21:32:02.587000
2008-09-03T21:38:23.863000
42,649
42,724
Can you recommend a database that scales horizontally?
Generally the database server is the biggest, most expensive box we have to buy as scaling vertically is the only option. Are there any databases that scale well horizontally (i.e. across multiple commodity machines) and what are the limitations in this approach?
Don't worry, good solutions are coming! Couchdb and Hypertable are open source and still in alpha, but they are clearly designed to make scaling on commodity software simple. They work pretty well, and may change how you think about databases. Also, if it's okay to let someone else do the distributing for you, Google A...
Can you recommend a database that scales horizontally? Generally the database server is the biggest, most expensive box we have to buy as scaling vertically is the only option. Are there any databases that scale well horizontally (i.e. across multiple commodity machines) and what are the limitations in this approach?
TITLE: Can you recommend a database that scales horizontally? QUESTION: Generally the database server is the biggest, most expensive box we have to buy as scaling vertically is the only option. Are there any databases that scale well horizontally (i.e. across multiple commodity machines) and what are the limitations i...
[ "database", "performance", "scalability" ]
13
4
6,591
13
0
2008-09-03T21:32:49.010000
2008-09-03T22:11:56.187000
42,690
61,734
Which Dynamic .NET language makes more sense to learn, Iron Ruby or Iron Python?
I'd like to take some time to learn more about dynamic languages built on top of the DLR and I'm not sure which language would be better to learn. Having limited time, I really only have time to look learn one of them. Any opinions on which of the two (Iron Ruby or Iron Python) would be more useful in the long run?
If this is 'Which language runs better on the CLR,' then right now, IronPython wins hands down. For the long term though, 'which language will teach me more, and serve me better in my career as a programmer', I would definitely say IronRuby (this would be true of CPython vs CRuby also) Ruby will expose you to more 'con...
Which Dynamic .NET language makes more sense to learn, Iron Ruby or Iron Python? I'd like to take some time to learn more about dynamic languages built on top of the DLR and I'm not sure which language would be better to learn. Having limited time, I really only have time to look learn one of them. Any opinions on whic...
TITLE: Which Dynamic .NET language makes more sense to learn, Iron Ruby or Iron Python? QUESTION: I'd like to take some time to learn more about dynamic languages built on top of the DLR and I'm not sure which language would be better to learn. Having limited time, I really only have time to look learn one of them. An...
[ ".net", "ironpython", "ironruby", "dynamic-language-runtime", "dynamic-languages" ]
5
4
1,239
6
0
2008-09-03T21:52:50.197000
2008-09-14T23:54:10.060000
42,703
42,728
sp_send_dbmail attachment encoding
I am using sp_send_dbmail in SQL2005 to send an email with the results in an attachment. When the attachment is sent it is UCS-2 Encoded, I want it to be ANSI or UTF-8. Here is the SQL EXEC msdb.dbo.sp_send_dbmail @recipients = 'temp@example.com', @query = 'DECLARE @string_to_trim varchar(60);SET @string_to_trim = ''12...
I think the only way to get around what you are seeing is to use BCP to dump the data to a flat file and then attach that file. Sorry I couldn't be more help.:(
sp_send_dbmail attachment encoding I am using sp_send_dbmail in SQL2005 to send an email with the results in an attachment. When the attachment is sent it is UCS-2 Encoded, I want it to be ANSI or UTF-8. Here is the SQL EXEC msdb.dbo.sp_send_dbmail @recipients = 'temp@example.com', @query = 'DECLARE @string_to_trim var...
TITLE: sp_send_dbmail attachment encoding QUESTION: I am using sp_send_dbmail in SQL2005 to send an email with the results in an attachment. When the attachment is sent it is UCS-2 Encoded, I want it to be ANSI or UTF-8. Here is the SQL EXEC msdb.dbo.sp_send_dbmail @recipients = 'temp@example.com', @query = 'DECLARE @...
[ "sp-send-dbmail" ]
4
0
12,907
3
0
2008-09-03T21:58:03.863000
2008-09-03T22:12:59.727000
42,706
42,717
Dependency Injection Addiction?
Is there a down side? I feel almost dependent on it now. Whenever a project gets past a certain size almost feel an allergic reaction to standard patterns and immediately re-wire it with a Dependency Injection framework. The largest issue I've found is it can be confusing for other developers who are just learning it. ...
I've taken a stab at describing some of the possible downsides in a blog post here: http://kevin-berridge.blogspot.com/2008/06/ioc-and-di-complexity.html
Dependency Injection Addiction? Is there a down side? I feel almost dependent on it now. Whenever a project gets past a certain size almost feel an allergic reaction to standard patterns and immediately re-wire it with a Dependency Injection framework. The largest issue I've found is it can be confusing for other devel...
TITLE: Dependency Injection Addiction? QUESTION: Is there a down side? I feel almost dependent on it now. Whenever a project gets past a certain size almost feel an allergic reaction to standard patterns and immediately re-wire it with a Dependency Injection framework. The largest issue I've found is it can be confusi...
[ "dependency-injection" ]
12
13
1,666
9
0
2008-09-03T22:00:05.497000
2008-09-03T22:07:05.107000
42,710
67,913
Efficient synthesis of a 4-to-1 function in Verilog
I need to implement a 4-to-1 function in Veriog. The input is 4 bits, a number from 0-15. The output is a single bit, 0 or 1. Each input gives a different output and the mapping from inputs to outputs is known, but the inputs and outputs themselves are not. I want vcs to successfully optimizing the code and also have i...
What you have is fine. A case statement would also work equally well. It's just a matter of how expressive you wish to be. Your solution, indexing, works fine if the select encodings don't have any special meaning (a memory address selector for example). If the select encodings do have some special semantic meaning to ...
Efficient synthesis of a 4-to-1 function in Verilog I need to implement a 4-to-1 function in Veriog. The input is 4 bits, a number from 0-15. The output is a single bit, 0 or 1. Each input gives a different output and the mapping from inputs to outputs is known, but the inputs and outputs themselves are not. I want vcs...
TITLE: Efficient synthesis of a 4-to-1 function in Verilog QUESTION: I need to implement a 4-to-1 function in Veriog. The input is 4 bits, a number from 0-15. The output is a single bit, 0 or 1. Each input gives a different output and the mapping from inputs to outputs is known, but the inputs and outputs themselves a...
[ "logic", "verilog", "synthesis", "version-control" ]
3
5
997
5
0
2008-09-03T22:02:50.390000
2008-09-15T23:23:26.850000
42,732
585,825
How to catch unhandled exceptions when using .NET Remoting
I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary. I think I have to use a custom channel sync, but can anyone confirm this and/or have any other advic...
After finding Eliyahu Baker's helpful blog post and reading chapter 12 of Rammer's Advanced.NET Remoting I wrote a custom channel sink that does what I want. This intercepts any exception and logs it locally before sending it on to the client. Ideally, I'd like to log the exception and raise a more generic one for the ...
How to catch unhandled exceptions when using .NET Remoting I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary. I think I have to use a custom channel sy...
TITLE: How to catch unhandled exceptions when using .NET Remoting QUESTION: I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary. I think I have to use a...
[ "c#", "error-handling", "remoting" ]
1
0
2,076
2
0
2008-09-03T22:16:21.793000
2009-02-25T12:40:57.410000
42,740
42,759
What is WCF in simple terms?
What is WCF in simple terms? It's hard to distill the meaning from the Wikipedia page.
WCF - Windows Communication Framework - is Microsoft's framework to make inter-process communication easier. It let's you do this communication through various means, plain old asmx web services, Remoting, MS Message Queuing, and a couple more. It let's you talk with other.NET apps, or non-Microsoft technologies (like ...
What is WCF in simple terms? What is WCF in simple terms? It's hard to distill the meaning from the Wikipedia page.
TITLE: What is WCF in simple terms? QUESTION: What is WCF in simple terms? It's hard to distill the meaning from the Wikipedia page. ANSWER: WCF - Windows Communication Framework - is Microsoft's framework to make inter-process communication easier. It let's you do this communication through various means, plain old ...
[ ".net", "wcf" ]
33
29
23,330
5
0
2008-09-03T22:20:15.793000
2008-09-03T22:33:01.627000
42,749
1,534,595
Does the Iphone 1/2 have a compass inside?
Can one be simulated by periodicly syncing with GPS and in the meen while working with the accelerometer? I know for example that the N95 accelerometer is invarient to rotation on the Y axis (while beeing face up/down).
The original iPhone and the iPhone 3G use GPS to calculate the heading, however the iPhone 3GS now has a 3-dimensional magnetometer compass in it. This can only be done taking two GPS coordinates (while moving) and determining the direction from point A to B.
Does the Iphone 1/2 have a compass inside? Can one be simulated by periodicly syncing with GPS and in the meen while working with the accelerometer? I know for example that the N95 accelerometer is invarient to rotation on the Y axis (while beeing face up/down).
TITLE: Does the Iphone 1/2 have a compass inside? QUESTION: Can one be simulated by periodicly syncing with GPS and in the meen while working with the accelerometer? I know for example that the N95 accelerometer is invarient to rotation on the Y axis (while beeing face up/down). ANSWER: The original iPhone and the iP...
[ "iphone", "gps", "n95" ]
0
3
1,660
3
0
2008-09-03T22:26:55.463000
2009-10-07T22:30:42.170000
42,762
42,776
How can I get markdown to format this code properly?
Here is some code I could not get to format properly in markdown, this is straight C code, pasted into the text box with the '4 spaces' format to denote code: #define PRINT(x, format,...) \ if ( x ) { \ if ( debug_fd!= NULL ) { \ fprintf(debug_fd, format, ##__VA_ARGS__); \ } \ else { \ fprintf(stdout, format, ##__VA_AR...
You can also use the HTML tags in succession. I find this easier for pasting code into the window. #define PRINT(x, format,...) if ( x ) { if ( debug_fd!= NULL ) { fprintf(debug_fd, format, ##VA_ARGS); } else { fprintf(stdout, format, ##VA_ARGS); } }
How can I get markdown to format this code properly? Here is some code I could not get to format properly in markdown, this is straight C code, pasted into the text box with the '4 spaces' format to denote code: #define PRINT(x, format,...) \ if ( x ) { \ if ( debug_fd!= NULL ) { \ fprintf(debug_fd, format, ##__VA_ARGS...
TITLE: How can I get markdown to format this code properly? QUESTION: Here is some code I could not get to format properly in markdown, this is straight C code, pasted into the text box with the '4 spaces' format to denote code: #define PRINT(x, format,...) \ if ( x ) { \ if ( debug_fd!= NULL ) { \ fprintf(debug_fd, f...
[ "c", "formatting", "markdown" ]
1
2
465
3
0
2008-09-03T22:36:51.667000
2008-09-03T22:51:27.900000
42,763
42,766
Is there a max number of options (values) in HTML drop down control?
Does anyone know how many options a drop down list can have? Is it unlimited? How many before performance degrades?
Does anyone know how many options a drop down list can have? Is it unlimited? I imagine it is unlimited in theory, obviously not in practice as a computer's RAM and the specific browser's limitations come into play. How many before performance degrades? Again, this would depend on a few factors, at the least the specif...
Is there a max number of options (values) in HTML drop down control? Does anyone know how many options a drop down list can have? Is it unlimited? How many before performance degrades?
TITLE: Is there a max number of options (values) in HTML drop down control? QUESTION: Does anyone know how many options a drop down list can have? Is it unlimited? How many before performance degrades? ANSWER: Does anyone know how many options a drop down list can have? Is it unlimited? I imagine it is unlimited in t...
[ "html", "drop-down-menu", "html-select" ]
29
27
60,002
6
0
2008-09-03T22:37:47.950000
2008-09-03T22:40:04.857000
42,770
42,806
Writing/Using C++ Libraries
I am looking for basic examples/tutorials on: How to write/compile libraries in C++ (.so files for Linux,.dll files for Windows). How to import and use those libraries in other code.
The code r.cc: #include "t.h" int main() { f(); return 0; } t.h: void f(); t.cc: #include #include "t.h" void f() { std::cout << "OH HAI. I'M F." << std::endl; } But how, how, how?! ~$ g++ -fpic -c t.cc # get t.o ~$ g++ -shared -o t.so t.o # get t.so ~$ export LD_LIBRARY_PATH="." # make sure t.so is found when dynami...
Writing/Using C++ Libraries I am looking for basic examples/tutorials on: How to write/compile libraries in C++ (.so files for Linux,.dll files for Windows). How to import and use those libraries in other code.
TITLE: Writing/Using C++ Libraries QUESTION: I am looking for basic examples/tutorials on: How to write/compile libraries in C++ (.so files for Linux,.dll files for Windows). How to import and use those libraries in other code. ANSWER: The code r.cc: #include "t.h" int main() { f(); return 0; } t.h: void f(); t.cc: ...
[ "c++" ]
10
18
8,170
1
0
2008-09-03T22:46:45.167000
2008-09-03T23:18:37.463000
42,774
42,807
How can I disable a hotkey in GreaseMonkey while editing?
I'm using Ctrl + Left / Ctrl + Right in a GreaseMonkey script as a hotkey to turn back / forward pages. It seems to works fine, but I want to disable this behavior if I'm in a text edit area. I'm trying to use document.activeElement to get the page active element and test if it's an editable area, but it always returns...
document.activeElement works for me in FF3 but the following also works (function() { var myActiveElement; document.onkeypress = function(event) { if ((myActiveElement || document.activeElement || {}).tagName!= 'INPUT') // do your magic }; if (!document.activeElement) { var elements = document.getElementsByTagName('in...
How can I disable a hotkey in GreaseMonkey while editing? I'm using Ctrl + Left / Ctrl + Right in a GreaseMonkey script as a hotkey to turn back / forward pages. It seems to works fine, but I want to disable this behavior if I'm in a text edit area. I'm trying to use document.activeElement to get the page active elemen...
TITLE: How can I disable a hotkey in GreaseMonkey while editing? QUESTION: I'm using Ctrl + Left / Ctrl + Right in a GreaseMonkey script as a hotkey to turn back / forward pages. It seems to works fine, but I want to disable this behavior if I'm in a text edit area. I'm trying to use document.activeElement to get the ...
[ "firefox", "greasemonkey" ]
1
2
403
2
0
2008-09-03T22:49:29.263000
2008-09-03T23:18:44.747000
42,778
43,065
Which Perl database interface should I use?
Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options?
If you're just looking for low-level database access—you feed it any SQL string (optionally with place-holders and bind values) and it runs your query and gives you back the results—then yes, DBI is your best bet, by far. If you want a higher-level interface (i.e., one that requires little or no use of raw SQL in your ...
Which Perl database interface should I use? Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options?
TITLE: Which Perl database interface should I use? QUESTION: Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options? ANSWER: If you're just looking for low-level database access—you feed it any SQL string (optionally with place-holders and bind values) and it ru...
[ "perl", "dbi", "cpan" ]
16
29
2,371
11
0
2008-09-03T22:53:42.763000
2008-09-04T02:06:00.460000
42,785
42,787
How do you retrofit unit tests into a code base?
Do you have any strategies for retrofitting unit tests onto a code base that currently has no unit tests?
Read Working Effectively With Legacy Code by Feathers. Jimmy Bogard has a good blog series on SOC.
How do you retrofit unit tests into a code base? Do you have any strategies for retrofitting unit tests onto a code base that currently has no unit tests?
TITLE: How do you retrofit unit tests into a code base? QUESTION: Do you have any strategies for retrofitting unit tests onto a code base that currently has no unit tests? ANSWER: Read Working Effectively With Legacy Code by Feathers. Jimmy Bogard has a good blog series on SOC.
[ "unit-testing", "language-agnostic" ]
11
10
2,110
7
0
2008-09-03T23:01:59.157000
2008-09-03T23:03:23.100000
42,804
42,866
Chrome tabs and processes
I was reading googlebooks on chrome, where they talk about why they decided to spin up a process to host browser tab, every time you created a new tab.' So 2 tabs = 2 chrome processes 3 tabs = 3 chrome processes and so on.. right?? But i opened up some 20 or so tabs, but in task manager, i could only find 3 chrome proc...
it's being hosted in the first process. open up chrome. you'll see 2 processes (manager and initial tab). then open 10 more tabs, you'll notice the second process's memory jump a lot. then type in google.com or something into the first tab, and you'll see a new process get spawned. also notice, if you do shift+esc and ...
Chrome tabs and processes I was reading googlebooks on chrome, where they talk about why they decided to spin up a process to host browser tab, every time you created a new tab.' So 2 tabs = 2 chrome processes 3 tabs = 3 chrome processes and so on.. right?? But i opened up some 20 or so tabs, but in task manager, i cou...
TITLE: Chrome tabs and processes QUESTION: I was reading googlebooks on chrome, where they talk about why they decided to spin up a process to host browser tab, every time you created a new tab.' So 2 tabs = 2 chrome processes 3 tabs = 3 chrome processes and so on.. right?? But i opened up some 20 or so tabs, but in t...
[ "resources", "google-chrome" ]
5
6
4,472
4
0
2008-09-03T23:18:01.677000
2008-09-03T23:52:17.520000
42,822
42,837
"Out of Band" Processing Techiniques for asp.net applications
Jeff has previously blogged about using the cache to perform "out of band" processing on his websites, however I was wondering what other techniques people are using to process these sorts of tasks?
Years ago, I saw Rob Howard describe a way to use an HttpModule to process tasks in the background. It doesn't seem as slick as using the Cache, but it might be better for certain circumstances. This blog post has the details, and there are many others that capture the same information if you look around.
"Out of Band" Processing Techiniques for asp.net applications Jeff has previously blogged about using the cache to perform "out of band" processing on his websites, however I was wondering what other techniques people are using to process these sorts of tasks?
TITLE: "Out of Band" Processing Techiniques for asp.net applications QUESTION: Jeff has previously blogged about using the cache to perform "out of band" processing on his websites, however I was wondering what other techniques people are using to process these sorts of tasks? ANSWER: Years ago, I saw Rob Howard desc...
[ "asp.net", "background", "scheduled-tasks", "out-of-band" ]
12
7
1,121
9
0
2008-09-03T23:25:47.490000
2008-09-03T23:32:28.020000
42,826
42,878
Where to start with Entity Framework
Anyone know a good book or post about how to start in EF? I have seen the DnrTV any other place?
Mike Taulty's Blog: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx A great EF intro deck: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/03/13/10235.aspx And these ADO.NET Data Services screencasts are nice too: http://mtaulty.com/CommunityServer/blogs/mik...
Where to start with Entity Framework Anyone know a good book or post about how to start in EF? I have seen the DnrTV any other place?
TITLE: Where to start with Entity Framework QUESTION: Anyone know a good book or post about how to start in EF? I have seen the DnrTV any other place? ANSWER: Mike Taulty's Blog: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx A great EF intro deck: http://mtaulty.com/CommunitySe...
[ ".net", "entity-framework", ".net-3.5" ]
9
14
4,064
4
0
2008-09-03T23:27:07.177000
2008-09-04T00:03:31.410000
42,828
63,883
Mixing jsp and jsf
I will elaborate somewhat. Jsf is kind-of extremely painful for working with from designer's perspective, somewhat in the range of trying to draw a picture while having hands tied at your back, but it is good for chewing up forms and listing lots of data. So sites we are making in my company are jsf admin pages and jsp...
To solve this one I'd probably create a JSF fragment that only includes your form, then use a tag to include it in my JSF page. That solution is probably a little fragile depending on your environment though. EDIT: See Chris Hall's answer, FacesContext is not available outside the FacesServlet.
Mixing jsp and jsf I will elaborate somewhat. Jsf is kind-of extremely painful for working with from designer's perspective, somewhat in the range of trying to draw a picture while having hands tied at your back, but it is good for chewing up forms and listing lots of data. So sites we are making in my company are jsf ...
TITLE: Mixing jsp and jsf QUESTION: I will elaborate somewhat. Jsf is kind-of extremely painful for working with from designer's perspective, somewhat in the range of trying to draw a picture while having hands tied at your back, but it is good for chewing up forms and listing lots of data. So sites we are making in m...
[ "java", "jsp", "jsf" ]
4
1
8,929
5
0
2008-09-03T23:27:56.533000
2008-09-15T15:21:33.043000
42,830
42,858
Setting Focus with ASP.NET AJAX Control Toolkit
I'm using the AutoComplete control from the ASP.NET AJAX Control Toolkit and I'm experiencing an issue where the AutoComplete does not populate when I set the focus to the assigned textbox. I've tried setting the focus in the Page_Load, Page_PreRender, and Page_Init events and the focus is set properly but the AutoComp...
We had exactly the same problem. What we had to do is write a script at the bottom of the page that quickly blurs then refocuses to the textbox. You can have a look at the (terribly hacky) solution here: http://www.drive.com.au The textbox id is MainSearchBox_SearchTextBox. Have a look at about line 586 & you can see w...
Setting Focus with ASP.NET AJAX Control Toolkit I'm using the AutoComplete control from the ASP.NET AJAX Control Toolkit and I'm experiencing an issue where the AutoComplete does not populate when I set the focus to the assigned textbox. I've tried setting the focus in the Page_Load, Page_PreRender, and Page_Init event...
TITLE: Setting Focus with ASP.NET AJAX Control Toolkit QUESTION: I'm using the AutoComplete control from the ASP.NET AJAX Control Toolkit and I'm experiencing an issue where the AutoComplete does not populate when I set the focus to the assigned textbox. I've tried setting the focus in the Page_Load, Page_PreRender, a...
[ "asp.net" ]
5
3
7,023
5
0
2008-09-03T23:29:43.583000
2008-09-03T23:44:06.137000
42,833
42,838
How do I avoid having the database password stored in plaintext in sourcecode?
In the web-application I'm developing I currently use a naive solution when connecting to the database: Connection c = DriverManager.getConnection("url", "username", "password"); This is pretty unsafe. If an attacker gains access to the sourcecode he also gains access to the database itself. How can my web-application ...
You can store the connection string in Web.config or App.config file and encrypt the section that holds it. Here's a very good article I used in a previous project to encrypt the connection string: http://www.ondotnet.com/pub/a/dotnet/2005/02/15/encryptingconnstring.html
How do I avoid having the database password stored in plaintext in sourcecode? In the web-application I'm developing I currently use a naive solution when connecting to the database: Connection c = DriverManager.getConnection("url", "username", "password"); This is pretty unsafe. If an attacker gains access to the sour...
TITLE: How do I avoid having the database password stored in plaintext in sourcecode? QUESTION: In the web-application I'm developing I currently use a naive solution when connecting to the database: Connection c = DriverManager.getConnection("url", "username", "password"); This is pretty unsafe. If an attacker gains ...
[ "language-agnostic", "passwords", "database-connection" ]
28
17
5,163
6
0
2008-09-03T23:30:48.230000
2008-09-03T23:32:35.090000
42,876
42,885
PHP, Arrays, and References
Why does the following code not work as I was expecting? Expected result: Array( [Area1] => Array( [Section1] => Array( [0] => Location1 ) ) [Area2] => Array( [Section2] => Array( [0] => Location2 ) ) ) Actual result: Array( [Area1] => Array( [Section2] => Array( [0] => Location2 ) ) [Area2] => Array( [Section2] => Arr...
If you modify your code on two lines as follows: $area = array(); $section = array(); to this: unset($area); $area = array(); unset($section); $section = array(); it will work as expected. In the first version, $area and $section are acting as "pointers" to the value inside the $root array. If you reset the values fi...
PHP, Arrays, and References Why does the following code not work as I was expecting? Expected result: Array( [Area1] => Array( [Section1] => Array( [0] => Location1 ) ) [Area2] => Array( [Section2] => Array( [0] => Location2 ) ) ) Actual result: Array( [Area1] => Array( [Section2] => Array( [0] => Location2 ) ) [Area2]...
TITLE: PHP, Arrays, and References QUESTION: Why does the following code not work as I was expecting? Expected result: Array( [Area1] => Array( [Section1] => Array( [0] => Location1 ) ) [Area2] => Array( [Section2] => Array( [0] => Location2 ) ) ) Actual result: Array( [Area1] => Array( [Section2] => Array( [0] => Loc...
[ "php", "arrays", "reference" ]
5
3
364
2
0
2008-09-04T00:02:21.383000
2008-09-04T00:08:53.287000
42,894
42,979
HTML blockquote vs div
Is there any benefit in using a element over a? I was looking at a website's markup to learn CSS and I couldn't figure out why the was being used. EDIT: Yeah sorry I didn't clarify, it was used to hold the tag with username as 'text' and an input tag. There was clearly no quote.
In theory, HTML should be as "semantic" as possible - meaning that every element should indicate something about its content. s should enclose the most important headline; s should surround paragraphs; should indicate emphasis, etc. That way the code makes sense when you - or a screen reader, or whatever - look at it. ...
HTML blockquote vs div Is there any benefit in using a element over a? I was looking at a website's markup to learn CSS and I couldn't figure out why the was being used. EDIT: Yeah sorry I didn't clarify, it was used to hold the tag with username as 'text' and an input tag. There was clearly no quote.
TITLE: HTML blockquote vs div QUESTION: Is there any benefit in using a element over a? I was looking at a website's markup to learn CSS and I couldn't figure out why the was being used. EDIT: Yeah sorry I didn't clarify, it was used to hold the tag with username as 'text' and an input tag. There was clearly no quote....
[ "html", "css" ]
1
9
4,389
7
0
2008-09-04T00:20:58.420000
2008-09-04T01:13:59.510000
42,899
42,902
RDMS for C language newbie?
What database should a beginner use in the C language? Can I use MySQL? Thanks
You can use SQLite, MySQL, PostgreSQL, or any other DBMS with a C language binding. SQLite In 5 Minutes Or Less MySQL C API PostgreSQL C API
RDMS for C language newbie? What database should a beginner use in the C language? Can I use MySQL? Thanks
TITLE: RDMS for C language newbie? QUESTION: What database should a beginner use in the C language? Can I use MySQL? Thanks ANSWER: You can use SQLite, MySQL, PostgreSQL, or any other DBMS with a C language binding. SQLite In 5 Minutes Or Less MySQL C API PostgreSQL C API
[ "mysql", "sql", "c", "database" ]
3
6
377
4
0
2008-09-04T00:23:28.477000
2008-09-04T00:25:50.157000
42,908
42,912
Where is the chink in Google Chrome's armor?
While browsing with Chrome, I noticed that it responds extremely fast (in comparison with IE and Firefox on my laptop) in terms of rendering pages, including JavaScript heavy sites like gmail. This is what googlebook on Chrome has to say tabs are hosted in process rather than thread. compile javascript using V8 engine ...
Chrome's approach is difficult to write, and requires forethought from the developers. IE and Firefox are both attempting to move to a process-per-tab model, but due to backwards compatibility are not able to transition quickly. Chrome, being an entirely new browser build on a clean rendering engine (WebKit), was easie...
Where is the chink in Google Chrome's armor? While browsing with Chrome, I noticed that it responds extremely fast (in comparison with IE and Firefox on my laptop) in terms of rendering pages, including JavaScript heavy sites like gmail. This is what googlebook on Chrome has to say tabs are hosted in process rather tha...
TITLE: Where is the chink in Google Chrome's armor? QUESTION: While browsing with Chrome, I noticed that it responds extremely fast (in comparison with IE and Firefox on my laptop) in terms of rendering pages, including JavaScript heavy sites like gmail. This is what googlebook on Chrome has to say tabs are hosted in ...
[ "google-chrome" ]
18
24
2,054
13
0
2008-09-04T00:26:55.300000
2008-09-04T00:30:14.263000
42,936
43,135
Load readonly database tables into memory
In one of my applications I have a 1gb database table that is used for reference data. It has a huge amounts of reads coming off that table but there are no writes ever. I was wondering if there's any way that data could be loaded into RAM so that it doesn't have to be accessed from disk? I'm using SQL Server 2005
If you have enough RAM, SQL will do an outstanding job determining what to load into RAM and what to seek on disk. This question is asked a lot and it reminds me of people trying to manually set which "core" their process will run on -- let the OS (or in this case the DB) do what it was designed for. If you want to ver...
Load readonly database tables into memory In one of my applications I have a 1gb database table that is used for reference data. It has a huge amounts of reads coming off that table but there are no writes ever. I was wondering if there's any way that data could be loaded into RAM so that it doesn't have to be accessed...
TITLE: Load readonly database tables into memory QUESTION: In one of my applications I have a 1gb database table that is used for reference data. It has a huge amounts of reads coming off that table but there are no writes ever. I was wondering if there's any way that data could be loaded into RAM so that it doesn't h...
[ "sql-server", "sql-server-2005", "caching" ]
1
5
3,738
4
0
2008-09-04T00:47:00.043000
2008-09-04T03:21:51.950000
42,937
42,974
URL Rewrite Module for IIS 7
Does anyone have experience using the URL Rewrite Module (see here )? Can it be used to do reverse proxy?
No it can not. You have to use a tool like.NET URL Rewriter and Reverse Proxy http://codeplex.com/urlrewriter It also supports IIS 6.0, and is accomplished completely through the.NET Framework.
URL Rewrite Module for IIS 7 Does anyone have experience using the URL Rewrite Module (see here )? Can it be used to do reverse proxy?
TITLE: URL Rewrite Module for IIS 7 QUESTION: Does anyone have experience using the URL Rewrite Module (see here )? Can it be used to do reverse proxy? ANSWER: No it can not. You have to use a tool like.NET URL Rewriter and Reverse Proxy http://codeplex.com/urlrewriter It also supports IIS 6.0, and is accomplished co...
[ "iis-7", "reverse-proxy" ]
2
2
3,292
3
0
2008-09-04T00:47:45.313000
2008-09-04T01:11:55.677000
42,950
43,663
Get the last day of the month
Is there a way using Python's standard library to easily determine (i.e. one function call) the last day of a given month? If the standard library doesn't support that, does the dateutil package support this?
calendar.monthrange provides this information: calendar. monthrange (year, month) Returns weekday of first day of the month and number of days in month, for the specified year and month. >>> import calendar >>> calendar.monthrange(2002, 1) (1, 31) >>> calendar.monthrange(2008, 2) # leap years are handled correctly (4, ...
Get the last day of the month Is there a way using Python's standard library to easily determine (i.e. one function call) the last day of a given month? If the standard library doesn't support that, does the dateutil package support this?
TITLE: Get the last day of the month QUESTION: Is there a way using Python's standard library to easily determine (i.e. one function call) the last day of a given month? If the standard library doesn't support that, does the dateutil package support this? ANSWER: calendar.monthrange provides this information: calenda...
[ "python", "date" ]
901
1,479
708,873
45
0
2008-09-04T00:54:44.533000
2008-09-04T12:44:12.970000
42,954
42,983
Backward Converting SQL Databases
Does anyone know of any free tools that can assist in converting an SQL2005 database back to SQL2000 format? I know that you can script all the objects and then do a dump of the data, but this is a lot of work to do manually.
Reviewing some other related questions I just found Microsoft's Database Publishing Wizard. It does most of what I need, although I have used nVarChar(max) in a couple of places and it simply fails to handle those cases and bombs out without generating anything.
Backward Converting SQL Databases Does anyone know of any free tools that can assist in converting an SQL2005 database back to SQL2000 format? I know that you can script all the objects and then do a dump of the data, but this is a lot of work to do manually.
TITLE: Backward Converting SQL Databases QUESTION: Does anyone know of any free tools that can assist in converting an SQL2005 database back to SQL2000 format? I know that you can script all the objects and then do a dump of the data, but this is a lot of work to do manually. ANSWER: Reviewing some other related ques...
[ "sql-server", "database", "sql-server-2005" ]
1
1
119
2
0
2008-09-04T00:57:42.030000
2008-09-04T01:18:20.437000
42,966
45,067
Google Suggestish text box (autocomplete)
What would be the best way to develop a text box that remembers the last x number of entries that were put into it. This is a standalone app written with C#.
@Ethan I forgot about the fact that you would want to save that so it wasn't a per session only thing:P But yes, you are completely correct. This is easily done, especially since it's just basic strings, just write out the contents of AutoCompleteCustomSource from the TextBox to a text file, on separate lines. I had a ...
Google Suggestish text box (autocomplete) What would be the best way to develop a text box that remembers the last x number of entries that were put into it. This is a standalone app written with C#.
TITLE: Google Suggestish text box (autocomplete) QUESTION: What would be the best way to develop a text box that remembers the last x number of entries that were put into it. This is a standalone app written with C#. ANSWER: @Ethan I forgot about the fact that you would want to save that so it wasn't a per session on...
[ "c#", "winforms", "autocomplete" ]
5
3
3,915
3
0
2008-09-04T01:06:51.260000
2008-09-05T01:17:21.957000
42,973
274,781
Debugging DLL Called With CeRapiInvoke
I'm trying to debug into a C dll that is invoked on a Windows Mobile device using CeRapiInvoke() (Technically RAPI.Invoke() from OpenNETCF) from a Windows box. I'm very familiar with attaching to a process that is already running to debug a loaded dll (I've done it many time with Windows Mobile services) but I can't se...
rapiclnt.exe is the process which loads the RAPI dlls. Read this for more on debugging RAPI dlls. http://knowledgepointer.wordpress.com/2008/11/08/debugging-rapi-dlls/
Debugging DLL Called With CeRapiInvoke I'm trying to debug into a C dll that is invoked on a Windows Mobile device using CeRapiInvoke() (Technically RAPI.Invoke() from OpenNETCF) from a Windows box. I'm very familiar with attaching to a process that is already running to debug a loaded dll (I've done it many time with ...
TITLE: Debugging DLL Called With CeRapiInvoke QUESTION: I'm trying to debug into a C dll that is invoked on a Windows Mobile device using CeRapiInvoke() (Technically RAPI.Invoke() from OpenNETCF) from a Windows box. I'm very familiar with attaching to a process that is already running to debug a loaded dll (I've done ...
[ "dll", "windows-mobile", "rapi" ]
1
2
1,067
1
0
2008-09-04T01:11:18.050000
2008-11-08T14:33:29.977000
42,984
42,994
How do you add a web reference through a proxy/firewall?
I'm behind a firewall at work at the moment and I was testing something that I had deployed to my website, and the work proxy seems to be blocking it somewhat. Basically I am getting a message of: Operation is not valid due to the current state of the object I've got it down to my proxy interferring, but I can't see an...
Edit, I forgot to write this part in the answer: You may need to add the web reference url to the safe list for your proxy. I am not sure what proxy you are using or if you have control of it, but this should solve your problem. If you don't have access to change the proxy, then I put a quick work around right below. H...
How do you add a web reference through a proxy/firewall? I'm behind a firewall at work at the moment and I was testing something that I had deployed to my website, and the work proxy seems to be blocking it somewhat. Basically I am getting a message of: Operation is not valid due to the current state of the object I've...
TITLE: How do you add a web reference through a proxy/firewall? QUESTION: I'm behind a firewall at work at the moment and I was testing something that I had deployed to my website, and the work proxy seems to be blocking it somewhat. Basically I am getting a message of: Operation is not valid due to the current state ...
[ ".net", "proxy", "web-reference" ]
3
6
9,706
2
0
2008-09-04T01:18:50.467000
2008-09-04T01:23:52.433000
42,987
257,969
.NET IPC without having a service mediator
I have two unrelated processes that use.NET assemblies as plugins. However, either process can be started/stopped at any time. I can't rely on a particular process being the server. In fact, there may be multiple copies running of one of the processes, but only one of the other. I initially implemented a solution based...
Using shared memory is tougher because you'll have to manage the size of the shared memory buffer (or just pre-allocate enough). You'll also have to manually manage the data structures that you put in there. Once you have it tested and working though, it will be easier to use and test because of its simplicity. If you ...
.NET IPC without having a service mediator I have two unrelated processes that use.NET assemblies as plugins. However, either process can be started/stopped at any time. I can't rely on a particular process being the server. In fact, there may be multiple copies running of one of the processes, but only one of the othe...
TITLE: .NET IPC without having a service mediator QUESTION: I have two unrelated processes that use.NET assemblies as plugins. However, either process can be started/stopped at any time. I can't rely on a particular process being the server. In fact, there may be multiple copies running of one of the processes, but on...
[ "c#", ".net", "windows", "remoting", "ipc" ]
0
1
2,264
5
0
2008-09-04T01:20:39.243000
2008-11-03T05:07:29.603000
42,990
43,017
Regex to match against something that is not a specific substring
I am looking for a regex that will match a string that starts with one substring and does not end with a certain substring. Example: // Updated to be correct, thanks @Apocalisp ^foo.*(? Should match anything that starts with "foo" and doesn't end with "bar". I know about the [^...] syntax, but I can't find anything tha...
I think in this case you want negative lookbehind, like so: foo.*(?
Regex to match against something that is not a specific substring I am looking for a regex that will match a string that starts with one substring and does not end with a certain substring. Example: // Updated to be correct, thanks @Apocalisp ^foo.*(? Should match anything that starts with "foo" and doesn't end with "b...
TITLE: Regex to match against something that is not a specific substring QUESTION: I am looking for a regex that will match a string that starts with one substring and does not end with a certain substring. Example: // Updated to be correct, thanks @Apocalisp ^foo.*(? Should match anything that starts with "foo" and d...
[ "c#", "java", "regex", "regex-negation" ]
16
9
11,382
4
0
2008-09-04T01:22:58.677000
2008-09-04T01:37:42.200000
42,996
43,042
ASP.NET MVC and Spring.NET
Starting a new project and would like to use one of the MVC framworks. ASP.NET MVC is still in preview but Spring.net is in production and has a history with Java. I'd like to know the general lowdown between the two. Current questions.. What are the major feature differences? What about deployment/hosting issues? Futu...
I am a little confused by the question. Spring.Net is a dependency injection framework that you can use in ASP.NET MVC. I kind of based my answer off what you are actually asking though. The difference between ASP.NET MVC and another MVC framework that runs in ASP.NET. If you are worried about using ASP.NET MVC in prod...
ASP.NET MVC and Spring.NET Starting a new project and would like to use one of the MVC framworks. ASP.NET MVC is still in preview but Spring.net is in production and has a history with Java. I'd like to know the general lowdown between the two. Current questions.. What are the major feature differences? What about depl...
TITLE: ASP.NET MVC and Spring.NET QUESTION: Starting a new project and would like to use one of the MVC framworks. ASP.NET MVC is still in preview but Spring.net is in production and has a history with Java. I'd like to know the general lowdown between the two. Current questions.. What are the major feature difference...
[ "asp.net-mvc", "frameworks", "spring.net" ]
5
4
5,274
3
0
2008-09-04T01:26:23.707000
2008-09-04T01:53:54.267000
43,006
43,031
Transmiting data throught the Serial Port
I'm working with the SerialPort class in the Compact Framework, but I can't recive more than 2047 bytes. Exists any limit for the amount of bytes that I can recive? or How can I setup the object? I was trying with the WriteBufferSize and ReadBufferSize properties but they didn't work.
My guess is that it is either a processor or platform limitation. This post from the MSDN forums seems to confirm my suspicions.
Transmiting data throught the Serial Port I'm working with the SerialPort class in the Compact Framework, but I can't recive more than 2047 bytes. Exists any limit for the amount of bytes that I can recive? or How can I setup the object? I was trying with the WriteBufferSize and ReadBufferSize properties but they didn'...
TITLE: Transmiting data throught the Serial Port QUESTION: I'm working with the SerialPort class in the Compact Framework, but I can't recive more than 2047 bytes. Exists any limit for the amount of bytes that I can recive? or How can I setup the object? I was trying with the WriteBufferSize and ReadBufferSize propert...
[ "compact-framework", "serial-port" ]
1
1
367
2
0
2008-09-04T01:30:11.640000
2008-09-04T01:47:37.527000
43,019
43,032
What does VS 2008's "Convert to Website" mean?
I have upgraded a MS Visual Studio Application from VS 2003 to VS 2008 (Targeting.NET 2.0). As part of the conversion process the wizard said I needed to take the additional step of Converting my Project to a Website by Right-Clicking and blah blah blah... I didn't follow directions and the web application seems to be ...
There are two types of web applications in ASP.NET: The Web Site and Web Application Project. The difference between the two are discussed here: Difference between web site and web applications in Visual Studio 2005 Convert to Website allows you to convert a Web Application Project to a Web Site. Visual Studio 2003 use...
What does VS 2008's "Convert to Website" mean? I have upgraded a MS Visual Studio Application from VS 2003 to VS 2008 (Targeting.NET 2.0). As part of the conversion process the wizard said I needed to take the additional step of Converting my Project to a Website by Right-Clicking and blah blah blah... I didn't follow ...
TITLE: What does VS 2008's "Convert to Website" mean? QUESTION: I have upgraded a MS Visual Studio Application from VS 2003 to VS 2008 (Targeting.NET 2.0). As part of the conversion process the wizard said I needed to take the additional step of Converting my Project to a Website by Right-Clicking and blah blah blah.....
[ "visual-studio-2008", "web-applications" ]
10
8
4,767
5
0
2008-09-04T01:38:19.373000
2008-09-04T01:48:34.433000
43,021
43,029
How do you get the index of the current iteration of a foreach loop?
Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop? For instance, I currently do something like this depending on the circumstances: int i = 0; foreach (Object o in collection)...
The foreach is for iterating over collections that implement IEnumerable. It does this by calling GetEnumerator on the collection, which will return an Enumerator. This Enumerator has a method and a property: MoveNext() Current Current returns the object that Enumerator is currently on, MoveNext updates Current to the ...
How do you get the index of the current iteration of a foreach loop? Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop? For instance, I currently do something like this depend...
TITLE: How do you get the index of the current iteration of a foreach loop? QUESTION: Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop? For instance, I currently do somethin...
[ "c#", "foreach" ]
1,308
671
1,543,877
37
0
2008-09-04T01:38:39.357000
2008-09-04T01:46:08.323000
43,044
43,235
Algorithm to randomly generate an aesthetically-pleasing color palette
I'm looking for a simple algorithm to generate a large number of random, aesthetically pleasing colors. So no crazy neon colors, colors reminiscent of feces, etc. I've found solutions to this problem but they rely on alternative color palettes than RGB. I would rather just use straight RGB than mapping back and forth. ...
You could average the RGB values of random colors with those of a constant color: (example in Java) public Color generateRandomColor(Color mix) { Random random = new Random(); int red = random.nextInt(256); int green = random.nextInt(256); int blue = random.nextInt(256); // mix the color if (mix!= null) { red = (red +...
Algorithm to randomly generate an aesthetically-pleasing color palette I'm looking for a simple algorithm to generate a large number of random, aesthetically pleasing colors. So no crazy neon colors, colors reminiscent of feces, etc. I've found solutions to this problem but they rely on alternative color palettes than ...
TITLE: Algorithm to randomly generate an aesthetically-pleasing color palette QUESTION: I'm looking for a simple algorithm to generate a large number of random, aesthetically pleasing colors. So no crazy neon colors, colors reminiscent of feces, etc. I've found solutions to this problem but they rely on alternative co...
[ "algorithm", "colors" ]
330
456
154,430
16
0
2008-09-04T01:54:12.283000
2008-09-04T06:00:39.977000
43,051
43,074
C# numeric constants
I have the following C# code: byte rule = 0;... rule = rule | 0x80; which produces the error: Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?) [Update: first version of the question was wrong... I misread the compiler output] Adding the cast doesn't fix the problem...
int rule = 0; rule |= 0x80; http://msdn.microsoft.com/en-us/library/kxszd0kx.aspx The | operator is defined for all value types. I think this will produced the intended result. The "|=" operator is an or then assign operator, which is simply shorthand for rule = rule | 0x80. One of the niftier things about C# is that i...
C# numeric constants I have the following C# code: byte rule = 0;... rule = rule | 0x80; which produces the error: Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?) [Update: first version of the question was wrong... I misread the compiler output] Adding the cast do...
TITLE: C# numeric constants QUESTION: I have the following C# code: byte rule = 0;... rule = rule | 0x80; which produces the error: Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?) [Update: first version of the question was wrong... I misread the compiler output] ...
[ "c#", "casting" ]
19
6
13,193
10
0
2008-09-04T01:57:53.023000
2008-09-04T02:10:47.860000
43,099
43,172
How can I get a commit message from a bzr post-commit hook?
I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of post_commit(local, master, old_revno, old_revid, new_revno, mew_revid) How can I extract the commit message for the branch from this with bzrlib in Python?
And the answer is like so: def check_commit_msg(local, master, old_revno, old_revid, new_revno, new_revid): branch = local or master revision = branch.repository.get_revision(new_revid) print revision.message local and master are Branch objects, so once you have a revision, it's easy to extract the message.
How can I get a commit message from a bzr post-commit hook? I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of post_commit(local, master, old_revno, old_revid, new_revno, mew_revid) How can I extract the commit message for the branch from this with bzrlib in...
TITLE: How can I get a commit message from a bzr post-commit hook? QUESTION: I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of post_commit(local, master, old_revno, old_revid, new_revno, mew_revid) How can I extract the commit message for the branch from t...
[ "python", "dvcs", "bazaar" ]
5
5
709
1
0
2008-09-04T02:34:41.750000
2008-09-04T04:09:00.010000
43,111
43,254
LINQ to SQL for self-referencing tables?
I have a self referencing Categories table. Each Category has a CategoryID, ParentCategoryID, CategoryName, etc. And each category can have any number of sub categories, and each of those sub categories can have any number of sub categories, and so and and so forth. So basically the tree can be X levels deep. Then Prod...
I don't think linq-to-sql has a good answer to this problem. Since you are using sql server 2005 you can use CTEs to do hierarchical queries. Either a stored procedure or an inline query (using DataContext.ExecuteQuery) will do the trick.
LINQ to SQL for self-referencing tables? I have a self referencing Categories table. Each Category has a CategoryID, ParentCategoryID, CategoryName, etc. And each category can have any number of sub categories, and each of those sub categories can have any number of sub categories, and so and and so forth. So basically...
TITLE: LINQ to SQL for self-referencing tables? QUESTION: I have a self referencing Categories table. Each Category has a CategoryID, ParentCategoryID, CategoryName, etc. And each category can have any number of sub categories, and each of those sub categories can have any number of sub categories, and so and and so f...
[ "database", "linq-to-sql" ]
5
3
5,125
4
0
2008-09-04T02:58:16.640000
2008-09-04T06:42:52.107000
43,116
43,120
How can I run an external program from C and parse its output?
I've got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spits out a series of strings, and this is supposed to be portable across Mac/Window...
For simple problems in Unix-ish environments try popen(). From the man page: The popen() function opens a process by creating a pipe, forking and invoking the shell. If you use the read mode this is exactly what you asked for. I don't know if it is implemented in Windows. For more complicated problems you want to look ...
How can I run an external program from C and parse its output? I've got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spits out a series of...
TITLE: How can I run an external program from C and parse its output? QUESTION: I've got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spi...
[ "c", "external-process" ]
90
60
87,679
9
0
2008-09-04T03:01:25.820000
2008-09-04T03:04:36.560000
43,126
43,141
IList.Cast<typeof(T)>() returns error, syntax looks ok
public static IList LoadObjectListAll () { ISession session = CheckForExistingSession(); var cfg = new NHibernate.Cfg.Configuration().Configure(); var returnList = session.CreateCriteria(typeof(T)); var list = returnList.List(); var castList = list.Cast (); return castList; } So, I'm getting a build error where I am ca...
T is not a type nor a System.Type. T is a type parameter. typeof(T) returns the type of T. The typeof operator does not act on an object, it returns the Type object of a type. http://msdn.microsoft.com/en-us/library/58918ffs.aspx @John is correct in answering your direct question. But the NHibernate code there is a lit...
IList.Cast<typeof(T)>() returns error, syntax looks ok public static IList LoadObjectListAll () { ISession session = CheckForExistingSession(); var cfg = new NHibernate.Cfg.Configuration().Configure(); var returnList = session.CreateCriteria(typeof(T)); var list = returnList.List(); var castList = list.Cast (); return ...
TITLE: IList.Cast<typeof(T)>() returns error, syntax looks ok QUESTION: public static IList LoadObjectListAll () { ISession session = CheckForExistingSession(); var cfg = new NHibernate.Cfg.Configuration().Configure(); var returnList = session.CreateCriteria(typeof(T)); var list = returnList.List(); var castList = lis...
[ "c#", ".net", "nhibernate", ".net-3.5", "syntax" ]
4
7
4,807
11
0
2008-09-04T03:08:51.760000
2008-09-04T03:26:21.377000
43,134
43,146
Is there a difference between :: and . when calling class methods in Ruby?
Simple question, but one that I've been curious about...is there a functional difference between the following two commands? String::class String.class They both do what I expect -- that is to say they return Class -- but what is the difference between using the:: and the.? I notice that on those classes that have cons...
The. operator basically says "send this message to the object". In your example it is calling that particular member. The:: operator "drills down" to the scope defined to the left of the operator, and then calls the member defined on the right side of operator. When you use:: you have to be referencing members that are...
Is there a difference between :: and . when calling class methods in Ruby? Simple question, but one that I've been curious about...is there a functional difference between the following two commands? String::class String.class They both do what I expect -- that is to say they return Class -- but what is the difference ...
TITLE: Is there a difference between :: and . when calling class methods in Ruby? QUESTION: Simple question, but one that I've been curious about...is there a functional difference between the following two commands? String::class String.class They both do what I expect -- that is to say they return Class -- but what ...
[ "ruby", "syntax" ]
26
36
1,764
2
0
2008-09-04T03:21:31.467000
2008-09-04T03:31:31.083000
43,180
45,684
What are some resources for getting started in operating system development?
One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done). I'm having a hard time finding resources/guides that take you past writing a simple "Hello World" OS. I know lots of people will probabl...
There are a lot of links after this brief overview of what is involved in writing an OS for the X86 platform. The link that appears to be most promising (www.nondot.org/sabre/os/articles) is no longer available, so you'll need to poke through the Archive.org version to read it. At the end of the day the bootloader take...
What are some resources for getting started in operating system development? One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done). I'm having a hard time finding resources/guides that take y...
TITLE: What are some resources for getting started in operating system development? QUESTION: One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done). I'm having a hard time finding resources/...
[ "operating-system", "kernel", "osdev" ]
610
99
125,754
28
0
2008-09-04T04:28:09.230000
2008-09-05T12:38:38.060000
43,194
43,304
Mixing C/C++ Libraries
Is it possible for gcc to link against a library that was created with Visual C++? If so, are there any conflicts/problems that might arise from doing so?
Some of the comments in the answers here are slightly too generalistic. Whilst no, in the specific case mentioned gcc binaries won't link with a VC++ library (AFAIK). The actual means of interlinking code/libraries is a question of the ABI standard being used. An increasingly common standard in the embedded world is th...
Mixing C/C++ Libraries Is it possible for gcc to link against a library that was created with Visual C++? If so, are there any conflicts/problems that might arise from doing so?
TITLE: Mixing C/C++ Libraries QUESTION: Is it possible for gcc to link against a library that was created with Visual C++? If so, are there any conflicts/problems that might arise from doing so? ANSWER: Some of the comments in the answers here are slightly too generalistic. Whilst no, in the specific case mentioned g...
[ "c++", "visual-studio", "gcc", "linker" ]
7
4
1,580
5
0
2008-09-04T04:56:39.443000
2008-09-04T07:46:12.703000
43,199
47,149
Internationalized page properties in Tapestry 4.1.2
The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as: áéíóú...an inspection of the return value of getPassword() (the abstract method for t...
I found the problem. Tomcat was mangling the parameters before Tapestry or my page class even had a crack at it. Creating a servlet filter that enforced the desired character encoding fixed it. CharacterEncodingFilter.java package mycode; import java.io.IOException; import javax.servlet.*; /** * Allows you to enforc...
Internationalized page properties in Tapestry 4.1.2 The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as: áéíóú...an inspection of the retu...
TITLE: Internationalized page properties in Tapestry 4.1.2 QUESTION: The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as: áéíóú...an insp...
[ "java", "internationalization", "tapestry" ]
5
2
1,134
2
0
2008-09-04T05:00:49.183000
2008-09-06T01:09:43.103000
43,218
43,222
How do I reference a javascript file?
I'm working on a C#/ASP.NET project that has all the javascript files in a /Javascript folder. If I refer to the JS file using this syntax: src="/Javascript/jsfile.js" then the file is correctly picked up if the project is deployed to the root of the URL. However, if this "web site" is deployed to a sub-folder of the m...
If you reference the JS-file in a section that is "runat=server" you could write src="~/Javascript/jsfile.js" and it will always work. You could also do this in your Page_Load (In your masterpage): Page.ClientScript.RegisterClientScriptInclude("myJsFile", Page.ResolveClientUrl("~/Javascript/jsfile.js"))
How do I reference a javascript file? I'm working on a C#/ASP.NET project that has all the javascript files in a /Javascript folder. If I refer to the JS file using this syntax: src="/Javascript/jsfile.js" then the file is correctly picked up if the project is deployed to the root of the URL. However, if this "web site...
TITLE: How do I reference a javascript file? QUESTION: I'm working on a C#/ASP.NET project that has all the javascript files in a /Javascript folder. If I refer to the JS file using this syntax: src="/Javascript/jsfile.js" then the file is correctly picked up if the project is deployed to the root of the URL. However,...
[ "asp.net", "javascript" ]
10
12
5,312
5
0
2008-09-04T05:33:14.580000
2008-09-04T05:36:24.107000
43,224
43,239
How do I calculate a trendline for a graph?
Google is not being my friend - it's been a long time since my stats class in college...I need to calculate the start and end points for a trendline on a graph - is there an easy way to do this? (working in C# but whatever language works for you)
Given that the trendline is straight, find the slope by choosing any two points and calculating: (A) slope = (y1-y2)/(x1-x2) Then you need to find the offset for the line. The line is specified by the equation: (B) y = offset + slope*x So you need to solve for offset. Pick any point on the line, and solve for offset: (...
How do I calculate a trendline for a graph? Google is not being my friend - it's been a long time since my stats class in college...I need to calculate the start and end points for a trendline on a graph - is there an easy way to do this? (working in C# but whatever language works for you)
TITLE: How do I calculate a trendline for a graph? QUESTION: Google is not being my friend - it's been a long time since my stats class in college...I need to calculate the start and end points for a trendline on a graph - is there an easy way to do this? (working in C# but whatever language works for you) ANSWER: Gi...
[ "c#", "math", "graph" ]
52
19
137,628
13
0
2008-09-04T05:41:07.370000
2008-09-04T06:07:00.727000
43,249
43,767
T-SQL stored procedure that accepts multiple Id values
Is there a graceful way to handle passing a list of ids as a parameter to a stored procedure? For instance, I want departments 1, 2, 5, 7, 20 returned by my stored procedure. In the past, I have passed in a comma delimited list of ids, like the below code, but feel really dirty doing it. SQL Server 2005 is my only appl...
Erland Sommarskog has maintained the authoritative answer to this question for the last 16 years: Arrays and Lists in SQL Server. There are at least a dozen ways to pass an array or list to a query; each has their own unique pros and cons. Table-Valued Parameters. SQL Server 2008 and higher only, and probably the close...
T-SQL stored procedure that accepts multiple Id values Is there a graceful way to handle passing a list of ids as a parameter to a stored procedure? For instance, I want departments 1, 2, 5, 7, 20 returned by my stored procedure. In the past, I have passed in a comma delimited list of ids, like the below code, but feel...
TITLE: T-SQL stored procedure that accepts multiple Id values QUESTION: Is there a graceful way to handle passing a list of ids as a parameter to a stored procedure? For instance, I want departments 1, 2, 5, 7, 20 returned by my stored procedure. In the past, I have passed in a comma delimited list of ids, like the be...
[ "sql-server", "t-sql", "stored-procedures" ]
148
240
151,983
5
0
2008-09-04T06:27:26.807000
2008-09-04T13:32:34.507000
43,290
43,312
How to generate urls in django
In Django's template language, you can use {% url [viewname] [args] %} to generate a URL to a specific view with parameters. How can you programatically do the same in Python code? What I need is to create a list of menu items where each item has name, URL, and an active flag (whether it's the current page or not). Thi...
If you need to use something similar to the {% url %} template tag in your code, Django provides the django.core.urlresolvers.reverse(). The reverse function has the following signature: reverse(viewname, urlconf=None, args=None, kwargs=None) https://docs.djangoproject.com/en/dev/ref/urlresolvers/ At the time of this e...
How to generate urls in django In Django's template language, you can use {% url [viewname] [args] %} to generate a URL to a specific view with parameters. How can you programatically do the same in Python code? What I need is to create a list of menu items where each item has name, URL, and an active flag (whether it'...
TITLE: How to generate urls in django QUESTION: In Django's template language, you can use {% url [viewname] [args] %} to generate a URL to a specific view with parameters. How can you programatically do the same in Python code? What I need is to create a list of menu items where each item has name, URL, and an active...
[ "python", "django", "url", "django-urls" ]
38
47
42,175
4
0
2008-09-04T07:36:39.277000
2008-09-04T07:54:57.923000
43,291
43,295
Setting Variable Types in PHP
I know that I can do something like $int = (int)99; //(int) has a maximum or 99 To set the variable $int to an integer and give it a value of 99. Is there a way to set the type to something like LongBlob in MySQL for LARGE Integers in PHP?
No. PHP does what is called automatic type conversion. In your example $int = (int)123; the "(int)" just assures that at that exact moment 123 will be handled as an int. I think your best bet would be to use a class to provide some sort of type safety.
Setting Variable Types in PHP I know that I can do something like $int = (int)99; //(int) has a maximum or 99 To set the variable $int to an integer and give it a value of 99. Is there a way to set the type to something like LongBlob in MySQL for LARGE Integers in PHP?
TITLE: Setting Variable Types in PHP QUESTION: I know that I can do something like $int = (int)99; //(int) has a maximum or 99 To set the variable $int to an integer and give it a value of 99. Is there a way to set the type to something like LongBlob in MySQL for LARGE Integers in PHP? ANSWER: No. PHP does what is ca...
[ "php", "variable-types" ]
5
5
359
2
0
2008-09-04T07:36:48.310000
2008-09-04T07:42:13.663000
43,315
43,331
Can I write native iPhone apps using Python?
Using PyObjC, you can use Python to write Cocoa applications for OS X. Can I write native iPhone apps using Python and if so, how?
Not currently, currently the only languages available to access the iPhone SDK are C/C++, Objective C and Swift. There is no technical reason why this could not change in the future but I wouldn't hold your breath for this happening in the short term. That said, Objective-C and Swift really are not too scary... 2016 ed...
Can I write native iPhone apps using Python? Using PyObjC, you can use Python to write Cocoa applications for OS X. Can I write native iPhone apps using Python and if so, how?
TITLE: Can I write native iPhone apps using Python? QUESTION: Using PyObjC, you can use Python to write Cocoa applications for OS X. Can I write native iPhone apps using Python and if so, how? ANSWER: Not currently, currently the only languages available to access the iPhone SDK are C/C++, Objective C and Swift. Ther...
[ "iphone", "python", "cocoa-touch" ]
97
38
175,545
14
0
2008-09-04T07:59:57.490000
2008-09-04T08:21:31.230000
43,320
43,567
NHibernate ISession Flush: Where and when to use it, and why?
One of the things that get me thoroughly confused is the use of session.Flush,in conjunction with session.Commit, and session.Close. Sometimes session.Close works, e.g., it commits all the changes that I need. I know I need to use commit when I have a transaction, or a unit of work with several creates/updates/deletes,...
Briefly: Always use transactions Don't use Close(), instead wrap your calls on an ISession inside a using statement or manage the lifecycle of your ISession somewhere else. From the documentation: From time to time the ISession will execute the SQL statements needed to synchronize the ADO.NET connection's state with th...
NHibernate ISession Flush: Where and when to use it, and why? One of the things that get me thoroughly confused is the use of session.Flush,in conjunction with session.Commit, and session.Close. Sometimes session.Close works, e.g., it commits all the changes that I need. I know I need to use commit when I have a transa...
TITLE: NHibernate ISession Flush: Where and when to use it, and why? QUESTION: One of the things that get me thoroughly confused is the use of session.Flush,in conjunction with session.Commit, and session.Close. Sometimes session.Close works, e.g., it commits all the changes that I need. I know I need to use commit wh...
[ ".net", "session", "nhibernate", "flush" ]
190
239
84,162
4
0
2008-09-04T08:04:04.017000
2008-09-04T11:58:27.247000
43,321
43,340
Worth switching to zsh for casual use?
The default shell in Mac OS X is bash, which I'm generally happy to be using. I just take it for granted. It would be really nice if it auto-completed more stuff, though, and I've heard good things about zsh in this regard. But I don't really have the inclination to spend hours fiddling with settings to improve my comm...
For casual use you are probably better off sticking with bash and just installing bash completion. Installing it is pretty easy, grab the bash-completion-20060301.tar.gz from http://www.caliban.org/bash/index.shtml#completion and extract it with tar -xzvf bash-completion-20060301.tar.gz then copy the bash_completion/ba...
Worth switching to zsh for casual use? The default shell in Mac OS X is bash, which I'm generally happy to be using. I just take it for granted. It would be really nice if it auto-completed more stuff, though, and I've heard good things about zsh in this regard. But I don't really have the inclination to spend hours fi...
TITLE: Worth switching to zsh for casual use? QUESTION: The default shell in Mac OS X is bash, which I'm generally happy to be using. I just take it for granted. It would be really nice if it auto-completed more stuff, though, and I've heard good things about zsh in this regard. But I don't really have the inclination...
[ "bash", "shell", "zsh" ]
193
70
72,167
6
0
2008-09-04T08:04:37.493000
2008-09-04T08:28:02.617000
43,322
43,325
What's safe for a C++ plug-in system?
Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compilers to create plug-ins for a host application using a si...
Dr Dobb's Journal has an article Building Your Own Plugin Framework: Part 1 which is pretty good reading on the subject. It is the start of a series of articles which covers the architecture, development, and deployment of a C/C++ cross-platform plugin framework.
What's safe for a C++ plug-in system? Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compilers to create plug...
TITLE: What's safe for a C++ plug-in system? QUESTION: Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compil...
[ "c++", "api", "plugins", "compiler-construction" ]
49
26
24,446
8
0
2008-09-04T08:04:45.637000
2008-09-04T08:11:53.327000
43,324
237,682
Can I put an ASP.Net session ID in a hidden form field?
I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net website to allow users to upload files. For those unfamiliar, the uploader works by using a Flash applet to give me more control over the FileOpen dialog. I can specify a filter for file types, allow multiple files to be selected, etc. It's great...
Here is a post from the maintainer of SWFUpload which explains how to load the session from an ID stored in Request.Form. I imagine the same thing would work for the Yahoo component. Note the security disclaimers at the bottom of the post. By including a Global.asax file and the following code you can override the miss...
Can I put an ASP.Net session ID in a hidden form field? I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net website to allow users to upload files. For those unfamiliar, the uploader works by using a Flash applet to give me more control over the FileOpen dialog. I can specify a filter for file typ...
TITLE: Can I put an ASP.Net session ID in a hidden form field? QUESTION: I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net website to allow users to upload files. For those unfamiliar, the uploader works by using a Flash applet to give me more control over the FileOpen dialog. I can specify a f...
[ "c#", "asp.net", "session", "yui" ]
11
7
19,956
4
0
2008-09-04T08:08:40.340000
2008-10-26T07:12:50.483000
43,349
43,360
What are options available to get cron's results and how to set them up?
I know that default cron's behavior is to send normal and error output to cron's owner local email box. Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on)?
You could chuck file redirection onto either the command shown or the actual command in the crontab for both stdout and stderr - like command > /tmp/log.txt 2>&1. If you want several users to receive this log, you could insert a MAILTO=nameofmailinglist at the top of you cron file.
What are options available to get cron's results and how to set them up? I know that default cron's behavior is to send normal and error output to cron's owner local email box. Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on)?
TITLE: What are options available to get cron's results and how to set them up? QUESTION: I know that default cron's behavior is to send normal and error output to cron's owner local email box. Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and...
[ "linux", "unix", "batch-file", "cron" ]
11
5
8,469
5
0
2008-09-04T08:35:16.767000
2008-09-04T08:45:17.630000
43,354
43,735
How do you reference a bitmap on the stage in actionscript?
How do you reference a bitmap on the stage in flash using actionscript 3? I have a bitmap on the stage in flash and at the end of the movie I would like to swap it out for the next in the sequence before the movie loops. in my library i have 3 images, exported for actionscript, with the class name img1/img2/img3. here ...
To reference something on the stage, you need to give the stage instance a name - not give the symbol in the library a class name. Click on the item on the stage and look at the properties panel. There should be a text entry box just above the entry boxes for the item's dimensions. Enter a name there. Elsewhere in your...
How do you reference a bitmap on the stage in actionscript? How do you reference a bitmap on the stage in flash using actionscript 3? I have a bitmap on the stage in flash and at the end of the movie I would like to swap it out for the next in the sequence before the movie loops. in my library i have 3 images, exported...
TITLE: How do you reference a bitmap on the stage in actionscript? QUESTION: How do you reference a bitmap on the stage in flash using actionscript 3? I have a bitmap on the stage in flash and at the end of the movie I would like to swap it out for the next in the sequence before the movie loops. in my library i have ...
[ "flash", "actionscript-3" ]
4
3
4,914
4
0
2008-09-04T08:41:43.363000
2008-09-04T13:17:18.693000
43,374
3,069,175
Is there a better way of writing a git pre-commit hook to check any php file in a commit for parse errors?
What I have so far is #!/bin/sh php_syntax_check() { retval=0 for i in $(git-diff-index --name-only --cached HEAD -- | grep -e '\.php$'); do if [ -f $i ]; then output=$(php -l $i) retval=$? if [ $retval -gt 0 ]; then echo "==============================================================================" echo "Unstaging ...
If the commit is a partial commit (not all the changes in the working tree are committed), then this make give incorrect results since it tests the working copy and not the staged copy. One way to do this could be: git diff --cached --name-only --diff-filter=ACMR | xargs git checkout-index --prefix=$TMPDIR/ -- find $TM...
Is there a better way of writing a git pre-commit hook to check any php file in a commit for parse errors? What I have so far is #!/bin/sh php_syntax_check() { retval=0 for i in $(git-diff-index --name-only --cached HEAD -- | grep -e '\.php$'); do if [ -f $i ]; then output=$(php -l $i) retval=$? if [ $retval -gt 0 ]; ...
TITLE: Is there a better way of writing a git pre-commit hook to check any php file in a commit for parse errors? QUESTION: What I have so far is #!/bin/sh php_syntax_check() { retval=0 for i in $(git-diff-index --name-only --cached HEAD -- | grep -e '\.php$'); do if [ -f $i ]; then output=$(php -l $i) retval=$? if [...
[ "php", "git", "version-control" ]
9
2
2,054
4
0
2008-09-04T08:59:31.137000
2010-06-18T11:23:56.073000
43,400
43,410
Is there a standard HTML layout with multiple CSS styles available?
When it comes to web-design, I am horrible at producing anything remotely good looking. Thankfully there are a lot of free sources for design templates. However, a problem with these designs is that they just cover a single page, and not many use cases. If you take a look at CSS Zen Gardens, they have 1 single HTML fil...
I've used Bluprint CSS, it's easy and useful as you'll see. It also has some ruby scripts that allow you to change the number of columns and the distance between them. By default it's 950px for a span-24 element.
Is there a standard HTML layout with multiple CSS styles available? When it comes to web-design, I am horrible at producing anything remotely good looking. Thankfully there are a lot of free sources for design templates. However, a problem with these designs is that they just cover a single page, and not many use cases...
TITLE: Is there a standard HTML layout with multiple CSS styles available? QUESTION: When it comes to web-design, I am horrible at producing anything remotely good looking. Thankfully there are a lot of free sources for design templates. However, a problem with these designs is that they just cover a single page, and ...
[ "html", "css" ]
7
1
1,650
4
0
2008-09-04T09:25:09.610000
2008-09-04T09:35:24.967000
43,422
43,444
Is there any way to see the progress of an ALTER TABLE statement in MySQL?
For example, I issued an ALTER TABLE statement to create an index on a MEDIUMTEXT field in an InnoDB table that has 134k rows where the size of the index was 255 bytes and the average size of the data in the field is 30k. This command has been running for the last 15 minutes or so (and is the only thing running on the ...
This is a pretty common request apparently - requested as far back as 2005 on bugs.mysql.com. It exists in Oracle already, and is listed as useful, but "it is not a simple thing to do, so don't expect it to be implemented soon.". Although that was 2005:) That said, the chap who asked the original question later release...
Is there any way to see the progress of an ALTER TABLE statement in MySQL? For example, I issued an ALTER TABLE statement to create an index on a MEDIUMTEXT field in an InnoDB table that has 134k rows where the size of the index was 255 bytes and the average size of the data in the field is 30k. This command has been r...
TITLE: Is there any way to see the progress of an ALTER TABLE statement in MySQL? QUESTION: For example, I issued an ALTER TABLE statement to create an index on a MEDIUMTEXT field in an InnoDB table that has 134k rows where the size of the index was 255 bytes and the average size of the data in the field is 30k. This ...
[ "mysql" ]
26
3
25,278
9
0
2008-09-04T09:48:16.730000
2008-09-04T10:13:01.633000
43,427
44,711
How to set up a robot.txt which only allows the default page of a site
Say I have a site on http://example.com. I would really like allowing bots to see the home page, but any other page need to blocked as it is pointless to spider. In other words http://example.com & http://example.com/ should be allowed, but http://example.com/anything and http://example.com/someendpoint.aspx should be ...
So after some research, here is what I found - a solution acceptable by the major search providers: google, yahoo & msn (I could on find a validator here): User-Agent: * Disallow: /* Allow: /?okparam= Allow: /$ The trick is using the $ to mark the end of URL.
How to set up a robot.txt which only allows the default page of a site Say I have a site on http://example.com. I would really like allowing bots to see the home page, but any other page need to blocked as it is pointless to spider. In other words http://example.com & http://example.com/ should be allowed, but http://e...
TITLE: How to set up a robot.txt which only allows the default page of a site QUESTION: Say I have a site on http://example.com. I would really like allowing bots to see the home page, but any other page need to blocked as it is pointless to spider. In other words http://example.com & http://example.com/ should be all...
[ "web-crawler", "bots", "robots.txt", "googlebot", "slurp" ]
23
54
12,845
5
0
2008-09-04T09:51:50.543000
2008-09-04T20:34:05.150000
43,455
43,468
How do I serialize a DOM to XML text, using JavaScript, in a cross browser way?
I have an XML object (loaded using XMLHTTPRequest 's responseXML ). I have modified the object (using jQuery) and would like to store it as text in a string. There is apparently a simple way to do it in Firefox et al: var xmlString = new XMLSerializer().serializeToString( doc ); (from rosettacode ) But how does one do ...
You can use doc.xml in internet exlporer. You'll get something like this: function xml2Str(xmlNode) { try { // Gecko- and Webkit-based browsers (Firefox, Chrome), Opera. return (new XMLSerializer()).serializeToString(xmlNode); } catch (e) { try { // Internet Explorer. return xmlNode.xml; } catch (e) { //Other browsers ...
How do I serialize a DOM to XML text, using JavaScript, in a cross browser way? I have an XML object (loaded using XMLHTTPRequest 's responseXML ). I have modified the object (using jQuery) and would like to store it as text in a string. There is apparently a simple way to do it in Firefox et al: var xmlString = new XM...
TITLE: How do I serialize a DOM to XML text, using JavaScript, in a cross browser way? QUESTION: I have an XML object (loaded using XMLHTTPRequest 's responseXML ). I have modified the object (using jQuery) and would like to store it as text in a string. There is apparently a simple way to do it in Firefox et al: var ...
[ "javascript", "xml", "dom", "serialization" ]
28
35
26,570
1
0
2008-09-04T10:28:33.840000
2008-09-04T10:42:02.857000
43,459
43,600
Kerberos user authentication in Apache
can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos. Background reading on Kerberos would also be useful Thanks Peter
mod_auth_kerb is a good start: http://modauthkerb.sourceforge.net/. If you need Active Directory support, look here: http://support.microsoft.com/?id=555092.
Kerberos user authentication in Apache can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos. Background reading on Kerberos would also be useful Thanks Peter
TITLE: Kerberos user authentication in Apache QUESTION: can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos. Background reading on Kerberos would also be useful Thanks Peter ANSWER: mod_auth_kerb is a good start: http://modauthkerb.sourceforge.net/. If you need Ac...
[ "apache", "authentication", "kerberos" ]
5
4
9,168
4
0
2008-09-04T10:32:16.563000
2008-09-04T12:17:30.413000
43,466
43,479
What't the best solution for creating subsets of a set of characters?
I know 'best' is subjective, so according to you, what is the best solution for the following problem: Given a string of length n (say "abc"), generate all proper subsets of the string. So, for our example, the output would be {}, {a}, {b}, {c}, {ab}, {bc}, {ac}. {abc}. What do you think?
You want the power set. It can be calculated recursively and inductively.;-)
What't the best solution for creating subsets of a set of characters? I know 'best' is subjective, so according to you, what is the best solution for the following problem: Given a string of length n (say "abc"), generate all proper subsets of the string. So, for our example, the output would be {}, {a}, {b}, {c}, {ab}...
TITLE: What't the best solution for creating subsets of a set of characters? QUESTION: I know 'best' is subjective, so according to you, what is the best solution for the following problem: Given a string of length n (say "abc"), generate all proper subsets of the string. So, for our example, the output would be {}, {...
[ "algorithm" ]
2
5
5,121
6
0
2008-09-04T10:41:16.573000
2008-09-04T10:50:49.187000
43,500
43,505
Is there a built-in method to compare collections?
I would like to compare the contents of a couple of collections in my Equals method. I have a Dictionary and an IList. Is there a built-in method to do this? Edited: I want to compare two Dictionaries and two ILists, so I think what equality means is clear - if the two dictionaries contain the same keys mapped to the s...
Enumerable.SequenceEqual Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer(T). You can't directly compare the list & the dictionary, but you could compare the list of values from the Dictionary with the list
Is there a built-in method to compare collections? I would like to compare the contents of a couple of collections in my Equals method. I have a Dictionary and an IList. Is there a built-in method to do this? Edited: I want to compare two Dictionaries and two ILists, so I think what equality means is clear - if the two...
TITLE: Is there a built-in method to compare collections? QUESTION: I would like to compare the contents of a couple of collections in my Equals method. I have a Dictionary and an IList. Is there a built-in method to do this? Edited: I want to compare two Dictionaries and two ILists, so I think what equality means is ...
[ "c#", ".net", "collections" ]
198
208
103,553
15
0
2008-09-04T11:17:57.747000
2008-09-04T11:22:19.127000
43,503
43,519
is it possible to detect if a flash movie also contains (plays) sound?
Is there a way to detect if a flash movie contains any sound or is playing any music? It would be nice if this could be done inside a webbrowser (actionscript from another flash object, javascript,..) and could be done before the flash movie starts playing. However, I have my doubts this will be possible altogether, so...
Yes, on the server side for sure. Client side? I don't know. (I'm a serverside kind of guy.) On the server side, one would have to parse the file, read the header and/or look for audio frames. (I've ported a haskel FLV parser to Java for indexing purposes myself, and there are other parsing utilities out there. It is p...
is it possible to detect if a flash movie also contains (plays) sound? Is there a way to detect if a flash movie contains any sound or is playing any music? It would be nice if this could be done inside a webbrowser (actionscript from another flash object, javascript,..) and could be done before the flash movie starts ...
TITLE: is it possible to detect if a flash movie also contains (plays) sound? QUESTION: Is there a way to detect if a flash movie contains any sound or is playing any music? It would be nice if this could be done inside a webbrowser (actionscript from another flash object, javascript,..) and could be done before the f...
[ "flash", "audio" ]
3
3
955
3
0
2008-09-04T11:21:41.360000
2008-09-04T11:31:42.333000
43,504
43,514
SQL Server 2005 One-way Replication
In the business I work for we are discussion methods to reduce the read load on our primary database. One option that has been suggested is to have live one-way replication from our primary database to a slave database. Applications would then read from the slave database and write directly to the primary database. So....
A few cons: 2 points of failure Application logic will have to take into account the delay between writing something and then reading it, since it won't be available immediately from the secondary database A strategy I have used is to send key reporting data to a secondary database nightly, de-normalizing it on the way...
SQL Server 2005 One-way Replication In the business I work for we are discussion methods to reduce the read load on our primary database. One option that has been suggested is to have live one-way replication from our primary database to a slave database. Applications would then read from the slave database and write d...
TITLE: SQL Server 2005 One-way Replication QUESTION: In the business I work for we are discussion methods to reduce the read load on our primary database. One option that has been suggested is to have live one-way replication from our primary database to a slave database. Applications would then read from the slave da...
[ "sql-server", "replication" ]
4
2
1,965
2
0
2008-09-04T11:21:41.373000
2008-09-04T11:29:15.100000
43,507
43,628
How sophisticated should my Ajax code be?
I have seen simple example Ajax source codes in many online tutorials. What I want to know is whether using the source code in the examples are perfectly alright or not? Is there anything more to be added to the code that goes into a real world application? What all steps are to be taken to make the application more ro...
The code you posted is missing one important ingredient: the function stateChanged. If you don't quite understand the code you posted yourself, then what happens is when the call to getchats.php is complete, a function "stateChanged" is called and that function will be responsible for handling the response. Since the s...
How sophisticated should my Ajax code be? I have seen simple example Ajax source codes in many online tutorials. What I want to know is whether using the source code in the examples are perfectly alright or not? Is there anything more to be added to the code that goes into a real world application? What all steps are t...
TITLE: How sophisticated should my Ajax code be? QUESTION: I have seen simple example Ajax source codes in many online tutorials. What I want to know is whether using the source code in the examples are perfectly alright or not? Is there anything more to be added to the code that goes into a real world application? Wh...
[ "ajax" ]
2
3
213
3
0
2008-09-04T11:23:13.103000
2008-09-04T12:32:23.747000
43,509
43,513
What happened to the .Net Framework Configuration tool?
Older versions of the.Net Framework used to install "Microsoft.NET Framework v1.0 / v1.1 / v2.0 Configuration" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality now hiding somewhere else, or do I have to use the command-line tools ins...
The.NET Framework versions 3.0 and 3.5 have been built incrementally on the.NET Framework version 2.0. This version can be used to manage code access security policy for the.NET Framework 3.0, 3.5, and later versions as well.
What happened to the .Net Framework Configuration tool? Older versions of the.Net Framework used to install "Microsoft.NET Framework v1.0 / v1.1 / v2.0 Configuration" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality now hiding somewh...
TITLE: What happened to the .Net Framework Configuration tool? QUESTION: Older versions of the.Net Framework used to install "Microsoft.NET Framework v1.0 / v1.1 / v2.0 Configuration" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality...
[ ".net", "visual-studio", ".net-3.5" ]
3
1
5,389
4
0
2008-09-04T11:26:27.883000
2008-09-04T11:28:50.920000
43,511
43,516
Can I prevent an inherited virtual method from being overridden in subclasses?
I have some classes layed out like this class A { public virtual void Render() { } } class B: A { public override void Render() { // Prepare the object for rendering SpecialRender(); // Do some cleanup } protected virtual void SpecialRender() { } } class C: B { protected override void SpecialRender() { // Do some cool...
You can seal individual methods to prevent them from being overridable: public sealed override void Render() { // Prepare the object for rendering SpecialRender(); // Do some cleanup }
Can I prevent an inherited virtual method from being overridden in subclasses? I have some classes layed out like this class A { public virtual void Render() { } } class B: A { public override void Render() { // Prepare the object for rendering SpecialRender(); // Do some cleanup } protected virtual void SpecialRender...
TITLE: Can I prevent an inherited virtual method from being overridden in subclasses? QUESTION: I have some classes layed out like this class A { public virtual void Render() { } } class B: A { public override void Render() { // Prepare the object for rendering SpecialRender(); // Do some cleanup } protected virtual ...
[ "c#", "polymorphism" ]
22
36
7,796
6
0
2008-09-04T11:27:34.183000
2008-09-04T11:30:56.250000
43,525
43,540
Images not displaying in WebKit based browsers
For some strange, bizarre reason, my images in my website just will not display on webkit based languages (such as safari and chrome). This is the image tag Not only does it not display in the website, it wont display when accessed directly at http://kilkin.massiveatom.com/kilkin/images/dukkah.jpg...Why?
Imagemagick reports that this particular image is saved in CMYK colorspace instead of the more standard RGB. Try converting it, it should be more compatible with the webkit rendering engine. Imagemagick is available for download from http://www.imagemagick.org/script/index.php - it's available for windows and *NIX syst...
Images not displaying in WebKit based browsers For some strange, bizarre reason, my images in my website just will not display on webkit based languages (such as safari and chrome). This is the image tag Not only does it not display in the website, it wont display when accessed directly at http://kilkin.massiveatom.com...
TITLE: Images not displaying in WebKit based browsers QUESTION: For some strange, bizarre reason, my images in my website just will not display on webkit based languages (such as safari and chrome). This is the image tag Not only does it not display in the website, it wont display when accessed directly at http://kilk...
[ "html", "webkit" ]
4
2
1,474
7
0
2008-09-04T11:34:38.333000
2008-09-04T11:41:13.777000
43,533
43,586
Embedding flv (flash) player in windows forms
I'm trying to the the flv Flash player from here in a windows forms application. I currently have it playing 1.flv file with no problems but I really need to be able to play multiple files. Has anyone had experienace of using the playlists that this control offers or is there a better way to do this?
Can you get the control to run the way you want it in a webpage/browser? If yes (and the problem is with winforms, I'd just embed it in a browser control. If no, I'd as the creators directly.
Embedding flv (flash) player in windows forms I'm trying to the the flv Flash player from here in a windows forms application. I currently have it playing 1.flv file with no problems but I really need to be able to play multiple files. Has anyone had experienace of using the playlists that this control offers or is the...
TITLE: Embedding flv (flash) player in windows forms QUESTION: I'm trying to the the flv Flash player from here in a windows forms application. I currently have it playing 1.flv file with no problems but I really need to be able to play multiple files. Has anyone had experienace of using the playlists that this contro...
[ "c#", "winforms", "flash", "flv", "embedded-flashplayer" ]
2
1
5,706
4
0
2008-09-04T11:38:47.247000
2008-09-04T12:11:10.803000
43,536
43,544
Dynamic Form Controls
Using C# 2.0 what is the best way to implement dynamic form controls? I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way?
You can use panels with automatic layout such as FlowLayoutPanel and TableLayoutPanel. Unfortunately there are only 2 panels with automatic layout out of box but you can create custom layout panel. I would recommend you to read following articles: How to: Create a Resizable Windows Form for Data Entry Walkthrough: Crea...
Dynamic Form Controls Using C# 2.0 what is the best way to implement dynamic form controls? I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way?
TITLE: Dynamic Form Controls QUESTION: Using C# 2.0 what is the best way to implement dynamic form controls? I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way? ANSWER: You can use panels with automatic layout su...
[ "c#", ".net", "winforms" ]
8
8
8,733
5
0
2008-09-04T11:39:39.193000
2008-09-04T11:43:29.247000
43,569
43,571
Max length for HTML <textarea>
How to restrict the maximum number of characters that can be entered into an HTML? I'm looking for a cross-browser solution.
The TEXTAREA tag does not have a MAXLENGTH attribute the way that an INPUT tag does, at least not in most standard browsers. A very simple and effective way to limit the number of characters that can be typed into a TEXTAREA tag is: Note: onKeyPress, is going to prevent any button press, any button including the backsp...
Max length for HTML <textarea> How to restrict the maximum number of characters that can be entered into an HTML? I'm looking for a cross-browser solution.
TITLE: Max length for HTML <textarea> QUESTION: How to restrict the maximum number of characters that can be entered into an HTML? I'm looking for a cross-browser solution. ANSWER: The TEXTAREA tag does not have a MAXLENGTH attribute the way that an INPUT tag does, at least not in most standard browsers. A very simpl...
[ "javascript", "html", "cross-browser", "textarea" ]
17
21
19,001
3
0
2008-09-04T11:59:41.237000
2008-09-04T12:02:01.073000
43,580
2,753,385
How to find the mime type of a file in python?
Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/viewer. Assumption: The browser figures out which application/viewer to use by the mime-type (content-type?) header in th...
The python-magic method suggested by toivotuo is outdated. Python-magic's current trunk is at Github and based on the readme there, finding the MIME-type, is done like this. # For MIME types import magic mime = magic.Magic(mime=True) mime.from_file("testdata/test.pdf") # 'application/pdf'
How to find the mime type of a file in python? Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/viewer. Assumption: The browser figures out which application/viewer to us...
TITLE: How to find the mime type of a file in python? QUESTION: Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/viewer. Assumption: The browser figures out which applic...
[ "python", "mime" ]
270
308
291,461
19
0
2008-09-04T12:07:27.037000
2010-05-02T12:02:45.380000
43,584
175,102
"undefined handler" from prototype.js line 3877
A very niche problem: I sometimes (30% of the time) get an 'undefined handler' javascript error on line 3877 of the prototype.js library (version 1.6.0.2 from google: http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js ). Now on this page I have a Google Map and I use the Prototype Window library. The p...
I just found out this error also occurs if you accidentally leave on the parenthesis on your observer call: Event.observe(document, 'myapp:application_ready', myapp.MyClass.initApp()); instead of Event.observe(document, 'myapp:application_ready', myapp.MyClass.initApp);
"undefined handler" from prototype.js line 3877 A very niche problem: I sometimes (30% of the time) get an 'undefined handler' javascript error on line 3877 of the prototype.js library (version 1.6.0.2 from google: http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js ). Now on this page I have a Google M...
TITLE: "undefined handler" from prototype.js line 3877 QUESTION: A very niche problem: I sometimes (30% of the time) get an 'undefined handler' javascript error on line 3877 of the prototype.js library (version 1.6.0.2 from google: http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js ). Now on this page...
[ "javascript", "google-maps", "prototypejs" ]
7
5
7,381
4
0
2008-09-04T12:09:20.730000
2008-10-06T16:41:50.177000
43,589
43,610
In PHP, is there an easy way to get the first and last date of a month?
I need to get the first and last day of a month in the format YYYY-MM-DD given only the month and year. Is there a good, easy way to do this?
$first = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year)); $last = date('Y-m-t', mktime(0, 0, 0, $month, 1, $year)); See date() in PHP documentation.
In PHP, is there an easy way to get the first and last date of a month? I need to get the first and last day of a month in the format YYYY-MM-DD given only the month and year. Is there a good, easy way to do this?
TITLE: In PHP, is there an easy way to get the first and last date of a month? QUESTION: I need to get the first and last day of a month in the format YYYY-MM-DD given only the month and year. Is there a good, easy way to do this? ANSWER: $first = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year)); $last = date('Y-m-t'...
[ "php" ]
35
64
26,484
12
0
2008-09-04T12:12:45.837000
2008-09-04T12:22:07.767000