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
2,332
2,333
How do I turn on line numbers by default in TextWrangler on the Mac?
I am fed up having to turn them on every time I open the application.
Go to TextWrangler > Preferences. Choose Text Status Display in the category pane, then check the option "Show line numbers" and close the preferences. This should now be on by default when you open existing documents.
How do I turn on line numbers by default in TextWrangler on the Mac? I am fed up having to turn them on every time I open the application.
TITLE: How do I turn on line numbers by default in TextWrangler on the Mac? QUESTION: I am fed up having to turn them on every time I open the application. ANSWER: Go to TextWrangler > Preferences. Choose Text Status Display in the category pane, then check the option "Show line numbers" and close the preferences. Th...
[ "macos", "textwrangler" ]
23
28
4,736
1
0
2008-08-05T13:57:05.033000
2008-08-05T13:57:10.027000
2,348
2,393
What is the best way to iterate through an array in Classic Asp VBScript?
In the code below For i = LBound(arr) To UBound(arr) What is the point in asking using LBound? Surely that is always 0.
Why not use For Each? That way you don't need to care what the LBound and UBound are. Dim x, y, z x = Array(1, 2, 3) For Each y In x z = DoSomethingWith(y) Next
What is the best way to iterate through an array in Classic Asp VBScript? In the code below For i = LBound(arr) To UBound(arr) What is the point in asking using LBound? Surely that is always 0.
TITLE: What is the best way to iterate through an array in Classic Asp VBScript? QUESTION: In the code below For i = LBound(arr) To UBound(arr) What is the point in asking using LBound? Surely that is always 0. ANSWER: Why not use For Each? That way you don't need to care what the LBound and UBound are. Dim x, y, z x...
[ "arrays", "asp-classic", "vbscript" ]
42
64
84,690
6
0
2008-08-05T14:07:58.913000
2008-08-05T14:36:12.693000
2,349
2,360
How to tab focus onto a dropdown field in Mac OSX
In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields. It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. However, in Mac OSX, tab skips dropdown menus. Is there anyway to change this behavior, or access the above items mentioned...
Go to System Preferences > Keyboard and Mouse, then choose Keyboard Shortcuts. At the bottom, ensure Full Keyboard Access is set to "All controls". It's a long time since I turned it on but I think that's all you need to do
How to tab focus onto a dropdown field in Mac OSX In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields. It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. However, in Mac OSX, tab skips dropdown menus. Is there anyway to change ...
TITLE: How to tab focus onto a dropdown field in Mac OSX QUESTION: In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields. It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. However, in Mac OSX, tab skips dropdown menus. Is there...
[ "macos", "mouse", "keyboard-shortcuts" ]
22
28
5,803
4
0
2008-08-05T14:07:58.930000
2008-08-05T14:13:12.740000
2,432
2,462
Have you ever encountered a query that SQL Server could not execute because it referenced too many tables?
Have you ever seen any of there error messages? -- SQL Server 2000 Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (256) was exceeded. -- SQL Server 2005 Too many table names in the query. The maximum allowable is 256. If yes, what have you done? Given up? Con...
For SQL Server 2005, I'd recommend using table variables and partially building the data as you go. To do this, create a table variable that represents your final result set you want to send to the user. Then find your primary table (say the orders table in your example above) and pull that data, plus a bit of suppleme...
Have you ever encountered a query that SQL Server could not execute because it referenced too many tables? Have you ever seen any of there error messages? -- SQL Server 2000 Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (256) was exceeded. -- SQL Server 2005...
TITLE: Have you ever encountered a query that SQL Server could not execute because it referenced too many tables? QUESTION: Have you ever seen any of there error messages? -- SQL Server 2000 Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (256) was exceeded. ...
[ "sql-server", "database", "sql-server-2005", "sql-server-2000" ]
20
9
10,573
8
0
2008-08-05T14:54:03.470000
2008-08-05T15:19:41.187000
2,472
2,477
How can I tell if a web client is blocking advertisements?
What is the best way to record statistics on the number of visitors visiting my site that have set their browser to block ads?
Since programs like AdBlock actually never request the advert, you would have to look the server logs to see if the same user accessed a webpage but didn't access an advert. This is assuming the advert is on the same server. If your adverts are on a separate server, then I would suggest it's impossible to do so. The be...
How can I tell if a web client is blocking advertisements? What is the best way to record statistics on the number of visitors visiting my site that have set their browser to block ads?
TITLE: How can I tell if a web client is blocking advertisements? QUESTION: What is the best way to record statistics on the number of visitors visiting my site that have set their browser to block ads? ANSWER: Since programs like AdBlock actually never request the advert, you would have to look the server logs to se...
[ "browser", "analytics" ]
16
11
2,077
5
0
2008-08-05T15:30:42.617000
2008-08-05T15:34:18.583000
2,481
2,511
Best self-balancing BST for quick insertion of a large number of nodes
I've been able to find details on several self-balancing BST s through several sources, but I haven't found any good descriptions detailing which one is best to use in different situations (or if it really doesn't matter). I want a BST that is optimal for storing in excess of ten million nodes. The order of insertion o...
Red-black is better than AVL for insertion-heavy applications. If you foresee relatively uniform look-up, then Red-black is the way to go. If you foresee a relatively unbalanced look-up where more recently viewed elements are more likely to be viewed again, you want to use splay trees.
Best self-balancing BST for quick insertion of a large number of nodes I've been able to find details on several self-balancing BST s through several sources, but I haven't found any good descriptions detailing which one is best to use in different situations (or if it really doesn't matter). I want a BST that is optim...
TITLE: Best self-balancing BST for quick insertion of a large number of nodes QUESTION: I've been able to find details on several self-balancing BST s through several sources, but I haven't found any good descriptions detailing which one is best to use in different situations (or if it really doesn't matter). I want a...
[ "data-structures", "language-agnostic", "binary-search-tree" ]
11
4
1,464
4
0
2008-08-05T15:40:24.903000
2008-08-05T15:59:27.563000
2,482
2,513
What are some good resources for learning threaded programming?
With the rise of multicore CPUs on the desktop, multithreading skills will become a valuable asset for programmers. Can you recommend some good resources (books, tutorials, websites, etc.) for a programmer who is looking to learn about threaded programming?
Take a look at Herb Sutter's " The Free Lunch Is Over " and then his series of articles on Effective Concurrency.
What are some good resources for learning threaded programming? With the rise of multicore CPUs on the desktop, multithreading skills will become a valuable asset for programmers. Can you recommend some good resources (books, tutorials, websites, etc.) for a programmer who is looking to learn about threaded programming...
TITLE: What are some good resources for learning threaded programming? QUESTION: With the rise of multicore CPUs on the desktop, multithreading skills will become a valuable asset for programmers. Can you recommend some good resources (books, tutorials, websites, etc.) for a programmer who is looking to learn about th...
[ "multithreading", "language-agnostic", "concurrency" ]
36
19
12,013
17
0
2008-08-05T15:42:09.847000
2008-08-05T16:02:41.660000
2,483
2,487
Casting: (NewType) vs. Object as NewType
What is actually the difference between these two casts? SomeClass sc = (SomeClass)SomeObject; SomeClass sc2 = SomeObject as SomeClass; Normally, shouldn't they both be explicit casts to the specified type?
The former will throw an exception if the source type can't be cast to the target type. The latter will result in sc2 being a null reference, but no exception. [Edit] My original answer is certainly the most pronounced difference, but as Eric Lippert points out, it's not the only one. Other differences include: You can...
Casting: (NewType) vs. Object as NewType What is actually the difference between these two casts? SomeClass sc = (SomeClass)SomeObject; SomeClass sc2 = SomeObject as SomeClass; Normally, shouldn't they both be explicit casts to the specified type?
TITLE: Casting: (NewType) vs. Object as NewType QUESTION: What is actually the difference between these two casts? SomeClass sc = (SomeClass)SomeObject; SomeClass sc2 = SomeObject as SomeClass; Normally, shouldn't they both be explicit casts to the specified type? ANSWER: The former will throw an exception if the sou...
[ "c#", ".net" ]
92
88
11,837
12
0
2008-08-05T15:42:30.110000
2008-08-05T15:44:46.330000
2,486
2,514
What is Progressive Enhancement?
Jeff mentioned the concept of 'Progressive Enhancement' when talking about using JQuery to write stackoverflow. After a quick Google, I found a couple of high-level discussions about it. Can anyone recommend a good place to start as a programmer. Specifically, I have been writing web apps in PHP and would like to use Y...
See also Unobtrusive JavaScript which is the bedrock progressive enhancement is built.
What is Progressive Enhancement? Jeff mentioned the concept of 'Progressive Enhancement' when talking about using JQuery to write stackoverflow. After a quick Google, I found a couple of high-level discussions about it. Can anyone recommend a good place to start as a programmer. Specifically, I have been writing web ap...
TITLE: What is Progressive Enhancement? QUESTION: Jeff mentioned the concept of 'Progressive Enhancement' when talking about using JQuery to write stackoverflow. After a quick Google, I found a couple of high-level discussions about it. Can anyone recommend a good place to start as a programmer. Specifically, I have b...
[ "ajax", "progressive-enhancement" ]
24
10
2,515
7
0
2008-08-05T15:44:39.327000
2008-08-05T16:05:29.020000
2,488
2,495
Auto Generate Database Diagram MySQL
I'm tired of opening Dia and creating a database diagram at the beginning of every project. Is there a tool out there that will let me select specific tables and then create a database diagram for me based on a MySQL database? Preferably it would allow me to edit the diagram afterward since none of the foreign keys are...
Try MySQL Workbench, formerly DBDesigner 4: http://dev.mysql.com/workbench/ This has a "Reverse Engineer Database" mode: Database -> Reverse Engineer
Auto Generate Database Diagram MySQL I'm tired of opening Dia and creating a database diagram at the beginning of every project. Is there a tool out there that will let me select specific tables and then create a database diagram for me based on a MySQL database? Preferably it would allow me to edit the diagram afterwa...
TITLE: Auto Generate Database Diagram MySQL QUESTION: I'm tired of opening Dia and creating a database diagram at the beginning of every project. Is there a tool out there that will let me select specific tables and then create a database diagram for me based on a MySQL database? Preferably it would allow me to edit t...
[ "mysql", "database", "database-design", "diagram" ]
359
440
376,801
14
0
2008-08-05T15:45:02.930000
2008-08-05T15:48:11.707000
2,509
2,548
What are the primary differences between TDD and BDD?
Test Driven Development has been the rage in the.NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?
I understand BDD to be more about specification than testing. It is linked to Domain Driven Design (don't you love these *DD acronyms?). It is linked with a certain way to write user stories, including high-level tests. An example by Tom ten Thij: Story: User logging in As a user I want to login with my details So that...
What are the primary differences between TDD and BDD? Test Driven Development has been the rage in the.NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?
TITLE: What are the primary differences between TDD and BDD? QUESTION: Test Driven Development has been the rage in the.NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD? ANSWER: I understand BDD to be more about sp...
[ "unit-testing", "tdd", "bdd" ]
136
108
44,451
12
0
2008-08-05T15:58:08.473000
2008-08-05T16:36:53.840000
2,518
10,020
Using multiple SQLite databases at once
I have 2 SQLite databases, one downloaded from a server ( server.db ), and one used as storage on the client ( client.db ). I need to perform various sync queries on the client database, using data from the server database. For example, I want to delete all rows in the client.db tRole table, and repopulate with all row...
I just looked at the AIR SQL API, and there's an attach method on SQLConnection it looks exactly what you need. I haven't tested this, but according to the documentation it should work: var connection: SQLConnection = new SQLConnection(); connection.open(firstDbFile); connection.attach(secondDbFile, "otherDb"); var s...
Using multiple SQLite databases at once I have 2 SQLite databases, one downloaded from a server ( server.db ), and one used as storage on the client ( client.db ). I need to perform various sync queries on the client database, using data from the server database. For example, I want to delete all rows in the client.db ...
TITLE: Using multiple SQLite databases at once QUESTION: I have 2 SQLite databases, one downloaded from a server ( server.db ), and one used as storage on the client ( client.db ). I need to perform various sync queries on the client database, using data from the server database. For example, I want to delete all rows...
[ "actionscript-3", "apache-flex", "sqlite", "air", "adobe" ]
10
9
20,148
3
0
2008-08-05T16:09:12.570000
2008-08-13T16:16:12.450000
2,524
151,931
Visual Studio "Unable to start debugging on the web server. The web server did not respond in a timely manner."
I get the following error pretty regularly when compiling in Visual Studio and running my web application: "Unable to start debugging on the web server. The web server did not respond in a timely manner. This may be because another debugger is already attached to the web server." Normally this is after having debug the...
I find that this happens if I'm debugging with Firefox as my browser. When I exit Firefox the VS2005/8 debug session doesn't terminate. I have not found a solution for this (yet). If this is what's happening with you then a quicker solution than running iisreset is to hit Shift-F5 when in Visual Studio and this will te...
Visual Studio "Unable to start debugging on the web server. The web server did not respond in a timely manner." I get the following error pretty regularly when compiling in Visual Studio and running my web application: "Unable to start debugging on the web server. The web server did not respond in a timely manner. This...
TITLE: Visual Studio "Unable to start debugging on the web server. The web server did not respond in a timely manner." QUESTION: I get the following error pretty regularly when compiling in Visual Studio and running my web application: "Unable to start debugging on the web server. The web server did not respond in a t...
[ "asp.net", "visual-studio", "visual-studio-2008", "debugging", "iis" ]
56
22
78,949
31
0
2008-08-05T16:18:18.853000
2008-09-30T06:04:38.680000
2,525
8,739
.NET obfuscation tools/strategy
My product has several components: ASP.NET, Windows Forms App and Windows Service. 95% or so of the code is written in VB.NET. For Intellectual Property reasons, I need to obfuscate the code, and until now I have been using a version of dotfuscator which is now over 5 years old. I'm thinking it is time to move to a new...
Back with.Net 1.1 obfuscation was essential: decompiling code was easy, and you could go from assembly, to IL, to C# code and have it compiled again with very little effort. Now with.Net 3.5 I'm not at all sure. Try decompiling a 3.5 assembly; what you get is a long long way from compiling. Add the optimisations from 3...
.NET obfuscation tools/strategy My product has several components: ASP.NET, Windows Forms App and Windows Service. 95% or so of the code is written in VB.NET. For Intellectual Property reasons, I need to obfuscate the code, and until now I have been using a version of dotfuscator which is now over 5 years old. I'm thin...
TITLE: .NET obfuscation tools/strategy QUESTION: My product has several components: ASP.NET, Windows Forms App and Windows Service. 95% or so of the code is written in VB.NET. For Intellectual Property reasons, I need to obfuscate the code, and until now I have been using a version of dotfuscator which is now over 5 y...
[ ".net", "security", "obfuscation" ]
165
44
152,277
30
0
2008-08-05T16:20:37.773000
2008-08-12T12:19:13.800000
2,527
2,546
Find node clicked under context menu
How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. I can't use the TreeViews' SelectedNode property because the node is only been right-clicked and not selected.
You can add a mouse click event to the TreeView, then select the correct node using GetNodeAt given the mouse coordinates provided by the MouseEventArgs. void treeView1MouseUp(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { // Select the clicked node treeView1.SelectedNode = treeView1.GetNodeAt(...
Find node clicked under context menu How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. I can't use the TreeViews' SelectedNode property because the node is only been right-clicked and not selected.
TITLE: Find node clicked under context menu QUESTION: How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. I can't use the TreeViews' SelectedNode property because the node is only been right-clicked and not selected...
[ "c#", "winforms", "treeview", "contextmenu" ]
76
97
59,026
10
0
2008-08-05T16:21:14.120000
2008-08-05T16:36:43.463000
2,530
2,531
How do you disable browser autocomplete on web form field / input tags?
How do you disable autocomplete in the major browsers for a specific input (or form field)?
Firefox 30 ignores autocomplete="off" for passwords, opting to prompt the user instead whether the password should be stored on the client. Note the following commentary from May 5, 2014: The password manager always prompts if it wants to save a password. Passwords are not saved without permission from the user. We are...
How do you disable browser autocomplete on web form field / input tags? How do you disable autocomplete in the major browsers for a specific input (or form field)?
TITLE: How do you disable browser autocomplete on web form field / input tags? QUESTION: How do you disable autocomplete in the major browsers for a specific input (or form field)? ANSWER: Firefox 30 ignores autocomplete="off" for passwords, opting to prompt the user instead whether the password should be stored on t...
[ "html", "forms", "browser", "autocomplete" ]
3,223
2,889
1,417,408
104
0
2008-08-05T16:22:32.603000
2008-08-05T16:24:53.380000
2,540
2,697
Good STL-like library for C
What are good libraries for C with datastructures like vectors, deques, stacks, hashmaps, treemaps, sets, etc.? Plain C, please, and platform-independent.
The Glib library used on the Gnome project may also be some use. Moreover it is pretty well tested. IBM developer works has a good tutorial on its use: Manage C data using the GLib collections
Good STL-like library for C What are good libraries for C with datastructures like vectors, deques, stacks, hashmaps, treemaps, sets, etc.? Plain C, please, and platform-independent.
TITLE: Good STL-like library for C QUESTION: What are good libraries for C with datastructures like vectors, deques, stacks, hashmaps, treemaps, sets, etc.? Plain C, please, and platform-independent. ANSWER: The Glib library used on the Gnome project may also be some use. Moreover it is pretty well tested. IBM develo...
[ "c", "architecture", "data-structures" ]
49
39
8,708
5
0
2008-08-05T16:30:37.377000
2008-08-05T18:50:09.453000
2,543
2,564
What are the best solutions for flash charts and graphs?
I'm aware of FusionCharts, are there other good solutions, or APIs, for creating charts in Adobe Flash?
Is there a reason that you want it in Flash? If a plain, old PNG will work, try the Google Chart API.
What are the best solutions for flash charts and graphs? I'm aware of FusionCharts, are there other good solutions, or APIs, for creating charts in Adobe Flash?
TITLE: What are the best solutions for flash charts and graphs? QUESTION: I'm aware of FusionCharts, are there other good solutions, or APIs, for creating charts in Adobe Flash? ANSWER: Is there a reason that you want it in Flash? If a plain, old PNG will work, try the Google Chart API.
[ "flash", "graph" ]
16
7
5,202
10
0
2008-08-05T16:34:37.057000
2008-08-05T16:49:06.047000
2,550
2,560
What are effective options for embedding video in an ASP.NET web site?
A quick glance at the present-day internet would seem to indicate that Adobe Flash is the obvious choice for embedding video in a web page. Is this accurate, or are they other effective choices? Does the choice of ASP.NET as a platform influence this decision?
Flash is certainly the most ubiquitous and portable solution. 98% of browsers have Flash installed. Other alternatives are Quicktime, Windows Media Player, or even Silverlight (Microsoft's Flash competitor, which can be used to embed several video formats). I would recommend using Flash (and it's FLV video file format)...
What are effective options for embedding video in an ASP.NET web site? A quick glance at the present-day internet would seem to indicate that Adobe Flash is the obvious choice for embedding video in a web page. Is this accurate, or are they other effective choices? Does the choice of ASP.NET as a platform influence thi...
TITLE: What are effective options for embedding video in an ASP.NET web site? QUESTION: A quick glance at the present-day internet would seem to indicate that Adobe Flash is the obvious choice for embedding video in a web page. Is this accurate, or are they other effective choices? Does the choice of ASP.NET as a plat...
[ "asp.net", "flash", "video", "embed" ]
19
21
4,271
7
0
2008-08-05T16:39:04.507000
2008-08-05T16:44:01.157000
2,556
100,758
What's the best online payment processing solution?
Should be available to non-U.S. companies, easy to setup, reliable, cheap, customizable, etc. What are your experiences?
You can't really answer this kind of question with a "I like 'insert provide name here'" type answer because like so many things it is a balance and the reasons for choosing a payment processing solution tend to be complex. Volume / Value The most important factor in choosing a secure payment clearance service (the peo...
What's the best online payment processing solution? Should be available to non-U.S. companies, easy to setup, reliable, cheap, customizable, etc. What are your experiences?
TITLE: What's the best online payment processing solution? QUESTION: Should be available to non-U.S. companies, easy to setup, reliable, cheap, customizable, etc. What are your experiences? ANSWER: You can't really answer this kind of question with a "I like 'insert provide name here'" type answer because like so man...
[ "payment" ]
93
98
25,647
13
0
2008-08-05T16:41:50.413000
2008-09-19T09:37:18.453000
2,563
2,801
What is a good web-based Grid that accepts Excel clipboard data?
Any good recommendations for a platform agnostic (i.e. Javascript) grid control/plugin that will accept pasted Excel data and can emit Excel-compliant clipboard data during a Copy? I believe Excel data is formatted as CSV during "normal" clipboard operations. dhtmlxGrid looks promising, but the online demo's don't actu...
I'm currently using dhtmlxGrid and we have the Excel copy/paste functionality working. dhtmlXGrid is the most full featured javascript grid package that I've found. On their website, dhtmlXGrid claims to support Clipboard functionality in the Professional version. (However, I noticed the Sample on their site isn't work...
What is a good web-based Grid that accepts Excel clipboard data? Any good recommendations for a platform agnostic (i.e. Javascript) grid control/plugin that will accept pasted Excel data and can emit Excel-compliant clipboard data during a Copy? I believe Excel data is formatted as CSV during "normal" clipboard operati...
TITLE: What is a good web-based Grid that accepts Excel clipboard data? QUESTION: Any good recommendations for a platform agnostic (i.e. Javascript) grid control/plugin that will accept pasted Excel data and can emit Excel-compliant clipboard data during a Copy? I believe Excel data is formatted as CSV during "normal"...
[ "excel", "csv", "grid", "clipboard" ]
8
3
3,223
5
0
2008-08-05T16:47:28.873000
2008-08-05T20:27:23.810000
2,588
1,780,172
Appropriate Windows O/S pagefile size for SQL Server
Does any know a good rule of thumb for the appropriate pagefile size for a Windows 2003 server running SQL Server?
Irrelevant of the size of the RAM, you still need a pagefile at least 1.5 times the amount of physical RAM. This is true even if you have a 1 TB RAM machine, you'll need 1.5 TB pagefile on disk (sounds crazy, but is true). When a process asks MEM_COMMIT memory via VirtualAlloc/VirtualAllocEx, the requested size needs t...
Appropriate Windows O/S pagefile size for SQL Server Does any know a good rule of thumb for the appropriate pagefile size for a Windows 2003 server running SQL Server?
TITLE: Appropriate Windows O/S pagefile size for SQL Server QUESTION: Does any know a good rule of thumb for the appropriate pagefile size for a Windows 2003 server running SQL Server? ANSWER: Irrelevant of the size of the RAM, you still need a pagefile at least 1.5 times the amount of physical RAM. This is true even...
[ "sql-server", "windows" ]
19
13
35,600
8
0
2008-08-05T17:07:16.773000
2009-11-22T22:11:18.923000
2,630
64,636
What are your favorite Powershell Cmdlets?
I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?
As a programmer/hacker, Get-Member and Get-Command are the ones I use more than any others, but the ones I use to show off are Select-Control and Send-Keys from WASP, the PowerGadgets, and some of my own stuff written in WPF against CTP2 or PoshConsole;-)
What are your favorite Powershell Cmdlets? I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?
TITLE: What are your favorite Powershell Cmdlets? QUESTION: I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them? ANSWER: As a programmer/hacker, Get-...
[ "powershell", "powershell-cmdlet" ]
15
8
2,496
13
0
2008-08-05T18:01:32.547000
2008-09-15T16:51:56.900000
2,639
2,712
What are some web-based knowledge-base solutions?
I've used a WordPress blog and a Screwturn Wiki (at two separate jobs) to store private, company-specific KB info, but I'm looking for something that was created to be a knowledge base. Specifically, I'd like to see: Free/low cost Simple method for users to subscribe to KB (or just sections) to get updates Ability to d...
I second Luke's answer. I can Recommend Confluence and here is why: I tested extensively many commercial and free Wiki based solutions. Not a single one is a winner on all accounts, including confluence. Let me try to make your quest a little shorter by summarizing what I have learned to be a pain and what is important...
What are some web-based knowledge-base solutions? I've used a WordPress blog and a Screwturn Wiki (at two separate jobs) to store private, company-specific KB info, but I'm looking for something that was created to be a knowledge base. Specifically, I'd like to see: Free/low cost Simple method for users to subscribe to...
TITLE: What are some web-based knowledge-base solutions? QUESTION: I've used a WordPress blog and a Screwturn Wiki (at two separate jobs) to store private, company-specific KB info, but I'm looking for something that was created to be a knowledge base. Specifically, I'd like to see: Free/low cost Simple method for use...
[ "language-agnostic" ]
12
10
5,178
6
0
2008-08-05T18:07:26.213000
2008-08-05T19:09:08.213000
2,647
2,657
How do I split a delimited string so I can access individual items?
Using SQL Server, how do I split a string so I can access item x? Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"?
You may find the solution in SQL User Defined Function to Parse a Delimited String helpful (from The Code Project ). You can use this simple logic: Declare @products varchar(200) = '1|20|3|343|44|6|8765' Declare @individual varchar(20) = null WHILE LEN(@products) > 0 BEGIN IF PATINDEX('%|%', @products) > 0 BEGIN SET @...
How do I split a delimited string so I can access individual items? Using SQL Server, how do I split a string so I can access item x? Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"?
TITLE: How do I split a delimited string so I can access individual items? QUESTION: Using SQL Server, how do I split a string so I can access item x? Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"? ANSWER: You may find the solution in S...
[ "sql", "sql-server", "t-sql", "split" ]
533
194
952,236
46
0
2008-08-05T18:15:47.727000
2008-08-05T18:28:38.653000
2,649
2,653
What's the best way to determine if a temporary table exists in SQL Server?
When writing a T-SQL script that I plan on re-running, often times I use temporary tables to store temporary data. Since the temp table is created on the fly, I'd like to be able to drop that table only if it exists (before I create it). I'll post the method that I use, but I'd like to see if there is a better way.
IF Object_Id('TempDB..#TempTable') IS NOT NULL BEGIN DROP TABLE #TempTable END
What's the best way to determine if a temporary table exists in SQL Server? When writing a T-SQL script that I plan on re-running, often times I use temporary tables to store temporary data. Since the temp table is created on the fly, I'd like to be able to drop that table only if it exists (before I create it). I'll p...
TITLE: What's the best way to determine if a temporary table exists in SQL Server? QUESTION: When writing a T-SQL script that I plan on re-running, often times I use temporary tables to store temporary data. Since the temp table is created on the fly, I'd like to be able to drop that table only if it exists (before I ...
[ "sql-server" ]
22
30
4,187
4
0
2008-08-05T18:18:39.373000
2008-08-05T18:21:38.730000
2,658
2,668
Getting started with Version Control System
I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version control system. Given the situation, should I hold ...
The most important thing about version control is: JUST START USING IT Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it. It is very easy to convert from cvs<->svn<->git<->hg It doesn't matter which one you choose. Just pick the easiest one for...
Getting started with Version Control System I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version control...
TITLE: Getting started with Version Control System QUESTION: I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and comi...
[ "git", "svn", "version-control", "language-agnostic", "dvcs" ]
76
82
9,667
34
0
2008-08-05T18:29:14.283000
2008-08-05T18:34:44.350000
2,688
2,741
What do I need to escape when sending a query?
When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website. I usually just have a function escape_string(blah), which: Replaces escapes ( \ ) with double escapes ( \\ ). Replaces single quotes ( ' ) with an escaped single quote ( \' ). Is this adequate? Is there a ho...
For maximum security, performance, and correctness use prepared statements. Here's how to do this with lots of examples in different languages, including PHP: https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-sql-injection-attacks
What do I need to escape when sending a query? When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website. I usually just have a function escape_string(blah), which: Replaces escapes ( \ ) with double escapes ( \\ ). Replaces single quotes ( ' ) with an escaped singl...
TITLE: What do I need to escape when sending a query? QUESTION: When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website. I usually just have a function escape_string(blah), which: Replaces escapes ( \ ) with double escapes ( \\ ). Replaces single quotes ( ' ) wit...
[ "mysql", "oracle", "security" ]
21
8
3,591
11
0
2008-08-05T18:45:46.747000
2008-08-05T19:38:51.023000
2,702
2,736
How do I use T-SQL Group By
I know I need to have (although I don't know why) a GROUP BY clause on the end of a SQL query that uses any aggregate functions like count, sum, avg, etc: SELECT count(userID), userName FROM users GROUP BY userName When else would GROUP BY be useful, and what are the performance ramifications?
To retrieve the number of widgets from each widget category that has more than 5 widgets, you could do this: SELECT WidgetCategory, count(*) FROM Widgets GROUP BY WidgetCategory HAVING count(*) > 5 The "having" clause is something people often forget about, instead opting to retrieve all their data to the client and it...
How do I use T-SQL Group By I know I need to have (although I don't know why) a GROUP BY clause on the end of a SQL query that uses any aggregate functions like count, sum, avg, etc: SELECT count(userID), userName FROM users GROUP BY userName When else would GROUP BY be useful, and what are the performance ramification...
TITLE: How do I use T-SQL Group By QUESTION: I know I need to have (although I don't know why) a GROUP BY clause on the end of a SQL query that uses any aggregate functions like count, sum, avg, etc: SELECT count(userID), userName FROM users GROUP BY userName When else would GROUP BY be useful, and what are the perfor...
[ "sql", "sql-server", "group-by" ]
32
36
49,480
5
0
2008-08-05T18:55:35.963000
2008-08-05T19:32:03.360000
2,711
2,763
What sites offer free, quality web site design templates?
Let's aggregate a list of free quality web site design templates. There are a million of these sites out there, but most are repetitive and boring. I'll start with freeCSStemplates.org I also think other sites should follow some sort of standards, for example here are freeCSStemplates standards Released for FREE under ...
Check out: Open Source Web Designs CSS Remix Best Web Gallery CSS Based CSS Beauty CSS Genius
What sites offer free, quality web site design templates? Let's aggregate a list of free quality web site design templates. There are a million of these sites out there, but most are repetitive and boring. I'll start with freeCSStemplates.org I also think other sites should follow some sort of standards, for example he...
TITLE: What sites offer free, quality web site design templates? QUESTION: Let's aggregate a list of free quality web site design templates. There are a million of these sites out there, but most are repetitive and boring. I'll start with freeCSStemplates.org I also think other sites should follow some sort of standar...
[ "css", "templates" ]
26
12
7,351
5
0
2008-08-05T19:08:47.543000
2008-08-05T20:00:14.223000
2,714
2,715
I need to know how much disk space a table is using in SQL Server
I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.
CREATE TABLE #tmpSizeChar ( table_name sysname, row_count int, reserved_size varchar(50), data_size varchar(50), index_size varchar(50), unused_size varchar(50)) CREATE TABLE #tmpSizeInt ( table_name sysname, row_count int, reserved_size_KB int, data_size_KB int, index_size_KB int, unused_size_KB int) SET NOCOUNT ON ...
I need to know how much disk space a table is using in SQL Server I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.
TITLE: I need to know how much disk space a table is using in SQL Server QUESTION: I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks. ANSWER: CREATE TABLE #tmpSizeChar ( table_name sysname, row_count int, reserved_size varchar(50), data_size var...
[ "sql-server" ]
15
14
4,187
3
0
2008-08-05T19:10:52.327000
2008-08-05T19:11:11.453000
2,750
2,761
Data verifications in Getter/Setter or elsewhere?
I'm wondering if it's a good idea to make verifications in getters and setters, or elsewhere in the code. This might surprise you be when it comes to optimizations and speeding up the code, I think you should not make verifications in getters and setters, but in the code where you're updating your files or database. Am...
Well, one of the reasons why classes usually contain private members with public getters/setters is exactly because they can verify data. If you have a Number than can be between 1 and 100, i would definitely put something in the setter that validates that and then maybe throw an exception that is being caught by the c...
Data verifications in Getter/Setter or elsewhere? I'm wondering if it's a good idea to make verifications in getters and setters, or elsewhere in the code. This might surprise you be when it comes to optimizations and speeding up the code, I think you should not make verifications in getters and setters, but in the cod...
TITLE: Data verifications in Getter/Setter or elsewhere? QUESTION: I'm wondering if it's a good idea to make verifications in getters and setters, or elsewhere in the code. This might surprise you be when it comes to optimizations and speeding up the code, I think you should not make verifications in getters and sette...
[ "optimization", "setter", "getter", "verification" ]
11
15
3,414
8
0
2008-08-05T19:51:29.220000
2008-08-05T19:59:39.157000
2,765
2,774
Is there a keyboard shortcut to view all open documents in Visual Studio 2008
I am trying to learn the keyboard shortcuts in Visual Studio in order to be more productive. So I downloaded a document showing many of the default keybindings in Visual Basic when using the VS 2008 IDE from Microsoft. When I tried what they say is the keyboard shortcut to view all open documents ( CTRL + ALT + DOWN AR...
This is a conflict between your graphics driver and Visual Studio. Go to your driver settings page (Control panel) and disable the display rotation shortcuts. With this conflict removed, the shortcut will work in Visual Studio.
Is there a keyboard shortcut to view all open documents in Visual Studio 2008 I am trying to learn the keyboard shortcuts in Visual Studio in order to be more productive. So I downloaded a document showing many of the default keybindings in Visual Basic when using the VS 2008 IDE from Microsoft. When I tried what they ...
TITLE: Is there a keyboard shortcut to view all open documents in Visual Studio 2008 QUESTION: I am trying to learn the keyboard shortcuts in Visual Studio in order to be more productive. So I downloaded a document showing many of the default keybindings in Visual Basic when using the VS 2008 IDE from Microsoft. When ...
[ "visual-studio", "keyboard", "shortcut" ]
9
15
765
1
0
2008-08-05T20:01:31.057000
2008-08-05T20:08:23.490000
2,767
75,338
Recommended add-ons/plugins for Microsoft Visual Studio
Can anyone recommend any good add-ons or plugins for Microsoft Visual Studio? Freebies are preferred, but if it is worth the cost then that's fine.
SmartPaster - (FREE) Copy/Paste code generator for strings AnkhSvn - (FREE) SVN Source Control Integration for VS.NET VisualSVN Server - (FREE) Source Control ReSharper - IDE enhancement that helps with refactoring and productivity CodeRush - Code gen macros on steroids Refactor - Code refactoring aid CodeMaid (FREE) -...
Recommended add-ons/plugins for Microsoft Visual Studio Can anyone recommend any good add-ons or plugins for Microsoft Visual Studio? Freebies are preferred, but if it is worth the cost then that's fine.
TITLE: Recommended add-ons/plugins for Microsoft Visual Studio QUESTION: Can anyone recommend any good add-ons or plugins for Microsoft Visual Studio? Freebies are preferred, but if it is worth the cost then that's fine. ANSWER: SmartPaster - (FREE) Copy/Paste code generator for strings AnkhSvn - (FREE) SVN Source Co...
[ "visual-studio", "plugins", "add-on" ]
211
139
137,589
77
0
2008-08-05T20:02:33.033000
2008-09-16T18:17:49.600000
2,770
2,779
Global Exception Handling for winforms control
When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hosted IE control. What is the proper way to go about doing something like this?
You need to handle the System.Windows.Forms.Application.ThreadException event for Windows Forms. This article really helped me: http://bytes.com/forum/thread236199.html.
Global Exception Handling for winforms control When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hosted IE control. What is the proper way to go about doing something like t...
TITLE: Global Exception Handling for winforms control QUESTION: When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hosted IE control. What is the proper way to go about doin...
[ "winforms", "error-handling", "user-controls" ]
35
25
16,712
5
0
2008-08-05T20:05:22.077000
2008-08-05T20:11:45.340000
2,773
2,883
Can't get a Console to VMs
I've followed this otherwise excellent tutorial on getting Xen working with Ubuntu but am not able to get a console into my virtual machine (domU). I've got the extra = '2 console=xvc0' line in my /etc/xen/ hostname_here.cfg file like they say, but am not able to get a console on it. If I statically assign an IP to the...
I had followed a different tutorial on setting up my xen on ubuntu before 8.04 but now upgraded to 8.04. I used the extra line in my cfg as folows: extra = ' TERM=xterm xencons=tty console=tty1' It allows me to "xm console hostname" from dom0. I think this was from a problem with the xen setup in the version prior to 8...
Can't get a Console to VMs I've followed this otherwise excellent tutorial on getting Xen working with Ubuntu but am not able to get a console into my virtual machine (domU). I've got the extra = '2 console=xvc0' line in my /etc/xen/ hostname_here.cfg file like they say, but am not able to get a console on it. If I sta...
TITLE: Can't get a Console to VMs QUESTION: I've followed this otherwise excellent tutorial on getting Xen working with Ubuntu but am not able to get a console into my virtual machine (domU). I've got the extra = '2 console=xvc0' line in my /etc/xen/ hostname_here.cfg file like they say, but am not able to get a conso...
[ "ubuntu", "virtualization", "xen" ]
7
5
2,545
1
0
2008-08-05T20:06:18.673000
2008-08-05T21:27:45.763000
2,775
3,696,991
How to remove the time portion of a datetime value (SQL Server)?
Here's what I use: SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME) I'm thinking there may be a better and more elegant way. Requirements: It has to be as fast as possible (the less casting, the better). The final result has to be a datetime type, not a string.
SQL Server 2008 and up In SQL Server 2008 and up, of course the fastest way is Convert(date, @date). This can be cast back to a datetime or datetime2 if necessary. What Is Really Best In SQL Server 2005 and Older? I've seen inconsistent claims about what's fastest for truncating the time from a date in SQL Server, and ...
How to remove the time portion of a datetime value (SQL Server)? Here's what I use: SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME) I'm thinking there may be a better and more elegant way. Requirements: It has to be as fast as possible (the less casting, the better). The final result has to be a datetime type,...
TITLE: How to remove the time portion of a datetime value (SQL Server)? QUESTION: Here's what I use: SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME) I'm thinking there may be a better and more elegant way. Requirements: It has to be as fast as possible (the less casting, the better). The final result has to b...
[ "sql-server", "datetime", "date-conversion" ]
86
119
65,755
6
0
2008-08-05T20:08:38.653000
2010-09-12T22:57:35.493000
2,780
2,789
Converting ARBG to RGB with alpha blending
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. When this is painted on top of an existing color, the colors will blend. So when it is blended with white, the resulting color is Color.FromARGB(255, 162, 133, 255); The solution should work like this: Color blend = Colo...
It's called alpha blending. In psuedocode, assuming the background color (blend) always has 255 alpha. Also assumes alpha is 0-255. alpha=argb.alpha() r = (alpha/255)*argb.r() + (1 - alpha/255)*blend.r() g = (alpha/255)*argb.g() + (1 - alpha/255)*blend.g() b = (alpha/255)*argb.b() + (1 - alpha/255)*blend.b() note: you ...
Converting ARBG to RGB with alpha blending Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. When this is painted on top of an existing color, the colors will blend. So when it is blended with white, the resulting color is Color.FromARGB(255, 162, 133, 255); The solutio...
TITLE: Converting ARBG to RGB with alpha blending QUESTION: Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. When this is painted on top of an existing color, the colors will blend. So when it is blended with white, the resulting color is Color.FromARGB(255, 162, 133,...
[ "c#", "colors" ]
25
19
13,312
3
0
2008-08-05T20:12:20.487000
2008-08-05T20:16:03.583000
2,785
2,839
Setting Objects to Null/Nothing after use in .NET
Should you set all the objects to null ( Nothing in VB.NET) once you have finished with them? I understand that in.NET it is essential to dispose of any instances of objects that implement the IDisposable interface to release some resources although the object can still be something after it is disposed (hence the isDi...
Karl is absolutely correct, there is no need to set objects to null after use. If an object implements IDisposable, just make sure you call IDisposable.Dispose() when you're done with that object (wrapped in a try.. finally, or, a using() block). But even if you don't remember to call Dispose(), the finaliser method on...
Setting Objects to Null/Nothing after use in .NET Should you set all the objects to null ( Nothing in VB.NET) once you have finished with them? I understand that in.NET it is essential to dispose of any instances of objects that implement the IDisposable interface to release some resources although the object can still...
TITLE: Setting Objects to Null/Nothing after use in .NET QUESTION: Should you set all the objects to null ( Nothing in VB.NET) once you have finished with them? I understand that in.NET it is essential to dispose of any instances of objects that implement the IDisposable interface to release some resources although th...
[ "c#", ".net", "vb.net", "memory-management", "null" ]
196
78
115,345
16
0
2008-08-05T20:14:10.560000
2008-08-05T20:56:28.667000
2,786
2,944
What's the best setup for Mono development on Windows?
I started trying to play with Mono, mostly for fun at the moment. I first tried to use the Visual Studio plugin that will convert a csproj into a makefile, but there seemed to be no version available for Visual Studio 2005. I also read about the MonoDevelop IDE, which sounded nice. Unfortunately, there's no pre-fab Win...
I'd recommend getting VMWare Player and using the free Mono development platform image that is provided on the website. Download Mono Setup time for this will be minimal, and it will also allow you to get your code working in.NET and then focus on porting issues without a massive hassle of switching machines and the li...
What's the best setup for Mono development on Windows? I started trying to play with Mono, mostly for fun at the moment. I first tried to use the Visual Studio plugin that will convert a csproj into a makefile, but there seemed to be no version available for Visual Studio 2005. I also read about the MonoDevelop IDE, wh...
TITLE: What's the best setup for Mono development on Windows? QUESTION: I started trying to play with Mono, mostly for fun at the moment. I first tried to use the Visual Studio plugin that will convert a csproj into a makefile, but there seemed to be no version available for Visual Studio 2005. I also read about the M...
[ "windows", "mono" ]
33
15
7,822
10
0
2008-08-05T20:15:22.820000
2008-08-05T22:43:57.013000
2,798
2,803
Map Routing, a la Google Maps?
I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc? Update: I'm primarily looking for pointers as to how a map system is implemented (data structures, algorithms, etc).
Take a look at the open street map project to see how this sort of thing is being tackled in a truely free software project using only user supplied and licensed data and have a wiki containing stuff you might find interesting. A few years back the guys involved where pretty easy going and answered lots of questions I ...
Map Routing, a la Google Maps? I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc? Update: I'm primarily looking for pointers as to how a map system is implemented (data structures, algorithms, etc).
TITLE: Map Routing, a la Google Maps? QUESTION: I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc? Update: I'm primarily looking for pointers as to how a map system is implemented (data structures,...
[ "google-maps", "google-maps-api-3", "mapping", "gis" ]
24
15
11,055
9
0
2008-08-05T20:24:42.960000
2008-08-05T20:27:36.633000
2,804
2,808
How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox?
I have an application that displays an image inside of a Windows Forms PictureBox control. The SizeMode of the control is set to Zoom so that the image contained in the PictureBox will be displayed in an aspect-correct way regardless of the dimensions of the PictureBox. This is great for the visual appearance of the ap...
Depending on the scaling, the relative image pixel could be anywhere in a number of pixels. For example, if the image is scaled down significantly, pixel 2, 10 could represent 2, 10 all the way up to 20, 100), so you'll have to do the math yourself and take full responsibility for any inaccuracies!:-)
How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox? I have an application that displays an image inside of a Windows Forms PictureBox control. The SizeMode of the control is set to Zoom so that the image contained in the PictureBox will be displayed in an aspect-cor...
TITLE: How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox? QUESTION: I have an application that displays an image inside of a Windows Forms PictureBox control. The SizeMode of the control is set to Zoom so that the image contained in the PictureBox will be displaye...
[ "c#", "winforms", "picturebox" ]
21
2
4,731
2
0
2008-08-05T20:28:30.143000
2008-08-05T20:33:01.693000
2,809
2,842
SQL Server 2000: Is there a way to tell when a record was last modified?
The table doesn't have a last updated field and I need to know when existing data was updated. So adding a last updated field won't help (as far as I know).
SQL Server 2000 does not keep track of this information for you. There may be creative / fuzzy ways to guess what this date was depending on your database model. But, if you are talking about 1 table with no relation to other data, then you are out of luck.
SQL Server 2000: Is there a way to tell when a record was last modified? The table doesn't have a last updated field and I need to know when existing data was updated. So adding a last updated field won't help (as far as I know).
TITLE: SQL Server 2000: Is there a way to tell when a record was last modified? QUESTION: The table doesn't have a last updated field and I need to know when existing data was updated. So adding a last updated field won't help (as far as I know). ANSWER: SQL Server 2000 does not keep track of this information for you...
[ "sql-server" ]
11
5
2,842
5
0
2008-08-05T20:33:21.757000
2008-08-05T20:58:17.477000
2,811
2,825
SQL Server 2005 For XML Explicit - Need help formatting
I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345 long-guid-here 54321 To pass into another stored procedure, I need the XML to look like this: 12345 54321 The best I've been able to do so far was getting it like this: I'm using this SQL statement: SELECT 1 as tag, null a...
try SELECT 1 AS Tag, 0 AS Parent, AccountNumber AS [Root!1!AccountNumber!element] FROM Location.LocationMDAccount WHERE LocationID = 'long-guid-here' FOR XML EXPLICIT
SQL Server 2005 For XML Explicit - Need help formatting I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345 long-guid-here 54321 To pass into another stored procedure, I need the XML to look like this: 12345 54321 The best I've been able to do so far was getting it like thi...
TITLE: SQL Server 2005 For XML Explicit - Need help formatting QUESTION: I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345 long-guid-here 54321 To pass into another stored procedure, I need the XML to look like this: 12345 54321 The best I've been able to do so far was g...
[ "sql", "xml", "sql-server-2005", "formatting", "for-xml" ]
13
3
4,498
5
0
2008-08-05T20:35:56.150000
2008-08-05T20:51:03.547000
2,815
2,819
How to curl or wget a web page?
I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc. Unfortunately, I couldn't get the right set of cookies, etc, to make this work. Any ideas? Also, when the beta is finished, will my ...
Your status page is available now without logging in (click logout and try it). When the beta-cookie is disabled, there will be nothing between you and your status page. For wget: wget --no-cookies --header "Cookie: soba=(LookItUpYourself)" https://stackoverflow.com/users/30/myProfile.html
How to curl or wget a web page? I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc. Unfortunately, I couldn't get the right set of cookies, etc, to make this work. Any ideas? Also, whe...
TITLE: How to curl or wget a web page? QUESTION: I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc. Unfortunately, I couldn't get the right set of cookies, etc, to make this work. An...
[ "http", "curl" ]
19
9
8,259
5
0
2008-08-05T20:38:59.293000
2008-08-05T20:43:52.017000
2,840
2,843
Paging SQL Server 2005 Results
How do I page results in SQL Server 2005? I tried it in SQL Server 2000, but there was no reliable way to do this. I'm now wondering if SQL Server 2005 has any built in method? What I mean by paging is, for example, if I list users by their username, I want to be able to only return the first 10 records, then the next ...
You can use the Row_Number() function. Its used as follows: SELECT Row_Number() OVER(ORDER BY UserName) As RowID, UserFirstName, UserLastName FROM Users From which it will yield a result set with a RowID field which you can use to page between. SELECT * FROM ( SELECT Row_Number() OVER(ORDER BY UserName) As RowID, UserF...
Paging SQL Server 2005 Results How do I page results in SQL Server 2005? I tried it in SQL Server 2000, but there was no reliable way to do this. I'm now wondering if SQL Server 2005 has any built in method? What I mean by paging is, for example, if I list users by their username, I want to be able to only return the f...
TITLE: Paging SQL Server 2005 Results QUESTION: How do I page results in SQL Server 2005? I tried it in SQL Server 2000, but there was no reliable way to do this. I'm now wondering if SQL Server 2005 has any built in method? What I mean by paging is, for example, if I list users by their username, I want to be able to...
[ "sql", "sql-server-2005", "paging" ]
42
36
7,435
6
0
2008-08-05T20:57:00.787000
2008-08-05T20:59:21.563000
2,844
2,850
How do you format an unsigned long long int using printf?
#include int main() { unsigned long long int num = 285212672; //FYI: fits in 29 bits int normalInt = 5; printf("My number is %d bytes wide and its value is %ul. A normal number is %d.\n", sizeof(num), num, normalInt); return 0; } Output: My number is 8 bytes wide and its value is 285212672l. A normal number is 0. I ass...
Use the ll (el-el) long-long modifier with the u (unsigned) conversion. (Works in windows, GNU). printf("%llu", 285212672);
How do you format an unsigned long long int using printf? #include int main() { unsigned long long int num = 285212672; //FYI: fits in 29 bits int normalInt = 5; printf("My number is %d bytes wide and its value is %ul. A normal number is %d.\n", sizeof(num), num, normalInt); return 0; } Output: My number is 8 bytes wid...
TITLE: How do you format an unsigned long long int using printf? QUESTION: #include int main() { unsigned long long int num = 285212672; //FYI: fits in 29 bits int normalInt = 5; printf("My number is %d bytes wide and its value is %ul. A normal number is %d.\n", sizeof(num), num, normalInt); return 0; } Output: My num...
[ "c", "syntax", "printf", "format-specifiers", "long-long" ]
467
603
1,008,617
14
0
2008-08-05T20:59:29.330000
2008-08-05T21:02:35.237000
2,871
2,887
Reading a C/C++ data structure in C# from a byte array
What would be the best way to fill a C# struct from a byte[] array where the data was from a C/C++ struct? The C struct would look something like this (my C is very rusty): typedef OldStuff { CHAR Name[8]; UInt32 User; CHAR Location[8]; UInt32 TimeStamp; UInt32 Sequence; CHAR Tracking[16]; CHAR Filler[12]; } And would ...
From what I can see in that context, you don't need to copy SomeByteArray into a buffer. You simply need to get the handle from SomeByteArray, pin it, copy the IntPtr data using PtrToStructure and then release. No need for a copy. That would be: NewStuff ByteArrayToNewStuff(byte[] bytes) { GCHandle handle = GCHandle.Al...
Reading a C/C++ data structure in C# from a byte array What would be the best way to fill a C# struct from a byte[] array where the data was from a C/C++ struct? The C struct would look something like this (my C is very rusty): typedef OldStuff { CHAR Name[8]; UInt32 User; CHAR Location[8]; UInt32 TimeStamp; UInt32 Seq...
TITLE: Reading a C/C++ data structure in C# from a byte array QUESTION: What would be the best way to fill a C# struct from a byte[] array where the data was from a C/C++ struct? The C struct would look something like this (my C is very rusty): typedef OldStuff { CHAR Name[8]; UInt32 User; CHAR Location[8]; UInt32 Tim...
[ "c#", ".net", "data-structures", "marshalling" ]
95
129
62,844
5
0
2008-08-05T21:19:03.147000
2008-08-05T21:29:39.647000
2,872
2,901
Possible to "spin off" several GUI threads? (Not halting the system at Application.Run)
My Goal I would like to have a main processing thread (non GUI), and be able to spin off GUIs in their own background threads as needed, and having my main non GUI thread keep working. Put another way, I want my main non GUI-thread to be the owner of the GUI-thread and not vice versa. I'm not sure this is even possible...
Application.Run method displays one (or more) forms and initiates the standard message loop which runs until all the forms are closed. You cannot force a return from that method except by closing all your forms or forcing an application shutdown. You can, however, pass an ApplicationContext (instad of a new Form()) to ...
Possible to "spin off" several GUI threads? (Not halting the system at Application.Run) My Goal I would like to have a main processing thread (non GUI), and be able to spin off GUIs in their own background threads as needed, and having my main non GUI thread keep working. Put another way, I want my main non GUI-thread ...
TITLE: Possible to "spin off" several GUI threads? (Not halting the system at Application.Run) QUESTION: My Goal I would like to have a main processing thread (non GUI), and be able to spin off GUIs in their own background threads as needed, and having my main non GUI thread keep working. Put another way, I want my ma...
[ "c#", ".net", "winforms" ]
26
13
1,475
3
0
2008-08-05T21:19:37.280000
2008-08-05T21:45:17.663000
2,873
2,927
Choosing a static code analysis tool
I'm working on a project where I'm coding in C in a UNIX environment. I've been using the lint tool to check my source code. Lint has been around a long time (since 1979), can anyone suggest a more recent code analysis tool I could use? Preferably a tool that is free.
Don't overlook the compiler itself. Read the compiler's documentation and find all the warnings and errors it can provide, and then enable as many as make sense for you. Also make sure to tell your compiler to treat warnings like errors so you're forced to fix them right away ( -Werror on gcc). By the way, don't be foo...
Choosing a static code analysis tool I'm working on a project where I'm coding in C in a UNIX environment. I've been using the lint tool to check my source code. Lint has been around a long time (since 1979), can anyone suggest a more recent code analysis tool I could use? Preferably a tool that is free.
TITLE: Choosing a static code analysis tool QUESTION: I'm working on a project where I'm coding in C in a UNIX environment. I've been using the lint tool to check my source code. Lint has been around a long time (since 1979), can anyone suggest a more recent code analysis tool I could use? Preferably a tool that is fr...
[ "c", "unix", "testing" ]
69
35
58,297
15
0
2008-08-05T21:19:40.913000
2008-08-05T22:17:24.777000
2,898
2,905
Text Editor For Linux (Besides Vi)?
Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby. Doing a google search yielded outdated answers. Edit: Since there has been some concern about the 'merit' of this question. I...
Emacs is a wonderful text editor. It has huge power once you become a power user. You can access a shell, have as many files open as you want in as many sub-windows and an extremely powerful scripting support that lets you add all kinds of neat features. I have been using a ruby-mode which adds syntax highlighting and ...
Text Editor For Linux (Besides Vi)? Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby. Doing a google search yielded outdated answers. Edit: Since there has been some concern a...
TITLE: Text Editor For Linux (Besides Vi)? QUESTION: Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby. Doing a google search yielded outdated answers. Edit: Since there has b...
[ "linux", "editor" ]
50
43
130,816
34
0
2008-08-05T21:42:37.763000
2008-08-05T21:49:12.180000
2,900
2,975
MySQL/Apache Error in PHP MySQL query
I am getting the following error: Access denied for user 'apache'@'localhost' (using password: NO) When using the following code: Delete Story "; if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)){ echo ' '.$row[1].' Delete '; echo ' '.$row[2].' '; } } else { echo "No stories available."; }?> Th...
And if it matters at all, apache@localhost is not the name of the user account that I use to get into the database. I don't have any user accounts with the name apache in them at all for that matter. If it is saying 'apache@localhost' the username is not getting passed correctly to the MySQL connection. 'apache' is nor...
MySQL/Apache Error in PHP MySQL query I am getting the following error: Access denied for user 'apache'@'localhost' (using password: NO) When using the following code: Delete Story "; if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)){ echo ' '.$row[1].' Delete '; echo ' '.$row[2].' '; } } else ...
TITLE: MySQL/Apache Error in PHP MySQL query QUESTION: I am getting the following error: Access denied for user 'apache'@'localhost' (using password: NO) When using the following code: Delete Story "; if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)){ echo ' '.$row[1].' Delete '; echo ' '.$row...
[ "php", "mysql", "apache" ]
29
12
9,896
11
0
2008-08-05T21:45:11.033000
2008-08-06T00:05:34.790000
2,913
2,918
How to Test Web Code?
Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state? Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which may change over time). Do people usuall...
You should look into DBUnit, or try to find a PHP equivalent (there must be one out there). You can use it to prepare the database with a specific set of data which represents your test data, and thus each test will no longer depend on the database and some existing state. This way, each test is self contained and will...
How to Test Web Code? Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state? Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which may change over t...
TITLE: How to Test Web Code? QUESTION: Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state? Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which...
[ "database", "testing" ]
17
6
2,086
10
0
2008-08-05T21:58:51.927000
2008-08-05T22:03:29.750000
2,914
2,917
How can I detect if a browser is blocking a popup?
Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening. What methods can the calling window use to make sure the new window launched properly?
If you use JavaScript to open the popup, you can use something like this: var newWin = window.open(url); if(!newWin || newWin.closed || typeof newWin.closed=='undefined') { //POPUP BLOCKED }
How can I detect if a browser is blocking a popup? Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening. What methods can the calling window use to make sure the new window launched properly?
TITLE: How can I detect if a browser is blocking a popup? QUESTION: Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening. What methods can the calling window use to make sure the new window launched pro...
[ "javascript", "html", "popup" ]
165
207
143,178
9
0
2008-08-05T22:01:36.977000
2008-08-05T22:03:27.953000
2,933
2,937
Create a directly-executable cross-platform GUI app using Python
Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux. The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the ...
First you will need some GUI library with Python bindings and then (if you want) some program that will convert your python scripts into standalone executables. Cross-platform GUI libraries with Python bindings (Windows, Linux, Mac) Of course, there are many, but the most popular that I've seen in wild are: Tkinter - b...
Create a directly-executable cross-platform GUI app using Python Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux. The problem being I have no idea where to start or how to write a GUI ...
TITLE: Create a directly-executable cross-platform GUI app using Python QUESTION: Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux. The problem being I have no idea where to start or h...
[ "python", "user-interface", "deployment", "tkinter", "release-management" ]
311
315
224,710
14
0
2008-08-05T22:26:00.797000
2008-08-05T22:34:25.397000
2,968
2,985
What are the different methods to parse strings in Java?
For parsing player commands, I've most often used the split method to split a string by delimiters and then to then just figure out the rest by a series of if s or switch es. What are some different ways of parsing strings in Java?
I assume you're trying to make the command interface as forgiving as possible. If this is the case, I suggest you use an algorithm similar to this: Read in the string Split the string into tokens Use a dictionary to convert synonyms to a common form For example, convert "hit", "punch", "strike", and "kick" all to "hit"...
What are the different methods to parse strings in Java? For parsing player commands, I've most often used the split method to split a string by delimiters and then to then just figure out the rest by a series of if s or switch es. What are some different ways of parsing strings in Java?
TITLE: What are the different methods to parse strings in Java? QUESTION: For parsing player commands, I've most often used the split method to split a string by delimiters and then to then just figure out the rest by a series of if s or switch es. What are some different ways of parsing strings in Java? ANSWER: I as...
[ "java", "string", "parsing" ]
55
17
68,359
15
0
2008-08-05T23:49:53.560000
2008-08-06T00:42:00.817000
2,970
2,976
My website got hacked.. What should I do?
My dad called me today and said people going to his website were getting 168 viruses trying to download to their computers. He isn't technical at all, and built the whole thing with a WYSIWYG editor. I popped his site open and viewed the source, and there was a line of Javascript includes at the bottom of the source ri...
Try and gather as much information as you can. See if the host can give you a log showing all the FTP connections that were made to your account. You can use those to see if it was even an FTP connection that was used to make the change and possibly get an IP address. If you're using a prepacked software like Wordpress...
My website got hacked.. What should I do? My dad called me today and said people going to his website were getting 168 viruses trying to download to their computers. He isn't technical at all, and built the whole thing with a WYSIWYG editor. I popped his site open and viewed the source, and there was a line of Javascri...
TITLE: My website got hacked.. What should I do? QUESTION: My dad called me today and said people going to his website were getting 168 viruses trying to download to their computers. He isn't technical at all, and built the whole thing with a WYSIWYG editor. I popped his site open and viewed the source, and there was ...
[ "security", "cracking" ]
23
15
4,314
8
0
2008-08-05T23:55:25.700000
2008-08-06T00:16:07.797000
2,987
2,992
Bringing Window to the Front in C# using Win32 API
I am writing an application that needs to bring window of an external app to the foreground, and not necessarily steal focus (there is a setting the user can toggle to steal/not steal focus). What is the best way to go about this using the win32 API? I have tried SetForeground() but it always steals focus and does not ...
SetForegroundWindow is supposed to steal focus and there are certain cases where it will fail. The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window Try capturing the focus with SetCapture prior to making...
Bringing Window to the Front in C# using Win32 API I am writing an application that needs to bring window of an external app to the foreground, and not necessarily steal focus (there is a setting the user can toggle to steal/not steal focus). What is the best way to go about this using the win32 API? I have tried SetFo...
TITLE: Bringing Window to the Front in C# using Win32 API QUESTION: I am writing an application that needs to bring window of an external app to the foreground, and not necessarily steal focus (there is a setting the user can toggle to steal/not steal focus). What is the best way to go about this using the win32 API? ...
[ "c#", "winapi" ]
47
17
17,062
6
0
2008-08-06T00:55:48.277000
2008-08-06T01:06:45.197000
2,988
2,999
What problems can be solved, or tackled more easily, using graphs and trees?
What are the most common problems that can be solved with both these data structures? It would be good for me to have also recommendations on books that: Implement the structures Implement and explain the reasoning of the algorithms that use them
The first thing I think about when I read this question is: what types of things use graphs/trees? and then I think backwards to how I could use them. For example, take two common uses of a tree: The DOM File systems The DOM, and XML for that matter, resemble tree structures. It makes sense, too. It makes sense because...
What problems can be solved, or tackled more easily, using graphs and trees? What are the most common problems that can be solved with both these data structures? It would be good for me to have also recommendations on books that: Implement the structures Implement and explain the reasoning of the algorithms that use t...
TITLE: What problems can be solved, or tackled more easily, using graphs and trees? QUESTION: What are the most common problems that can be solved with both these data structures? It would be good for me to have also recommendations on books that: Implement the structures Implement and explain the reasoning of the alg...
[ "algorithm", "data-structures", "tree", "computer-science", "graph-theory" ]
17
17
5,999
10
0
2008-08-06T00:56:05.937000
2008-08-06T01:28:13.063000
2,993
5,544,777
Reverse DNS in Ruby?
I'm in an environment with a lot of computers that haven't been properly inventoried. Basically, no one knows which IP goes with which mac address and which hostname. So I wrote the following: # This script goes down the entire IP range and attempts to # retrieve the Hostname and mac address and outputs them # into a f...
Today I also needed reverse DNS lookup and I've found very simple standard solution: require 'resolv' host_name = Resolv.getname(ip_address_here) It seems it uses timeout which helps in rough cases.
Reverse DNS in Ruby? I'm in an environment with a lot of computers that haven't been properly inventoried. Basically, no one knows which IP goes with which mac address and which hostname. So I wrote the following: # This script goes down the entire IP range and attempts to # retrieve the Hostname and mac address and ou...
TITLE: Reverse DNS in Ruby? QUESTION: I'm in an environment with a lot of computers that haven't been properly inventoried. Basically, no one knows which IP goes with which mac address and which hostname. So I wrote the following: # This script goes down the entire IP range and attempts to # retrieve the Hostname and ...
[ "ruby", "sockets", "dns", "nslookup" ]
22
25
11,235
3
0
2008-08-06T01:07:52.933000
2011-04-04T21:52:07.477000
3,004
3,008
Using ASP.NET Dynamic Data / LINQ to SQL, how do you have two table fields have a relationship to the same foreign key?
I am using ASP.NET Dynamic Data for a project and I have a table that has two seperate fields that link to the same foreign key in a different table. This relationship works fine in SQL Server. However, in the LINQ to SQL model in the ASP.NET Dynamic Data model, only the first field's relationship is reflected. If I at...
The solution is to delete and re-add BOTH tables to the LINQ to SQL diagram, not just the one you have added the second field and keys to. Alternatively, it appears you can make two associations using the LINQ to SQL interface - just don't try and bundle them into a single association.
Using ASP.NET Dynamic Data / LINQ to SQL, how do you have two table fields have a relationship to the same foreign key? I am using ASP.NET Dynamic Data for a project and I have a table that has two seperate fields that link to the same foreign key in a different table. This relationship works fine in SQL Server. Howeve...
TITLE: Using ASP.NET Dynamic Data / LINQ to SQL, how do you have two table fields have a relationship to the same foreign key? QUESTION: I am using ASP.NET Dynamic Data for a project and I have a table that has two seperate fields that link to the same foreign key in a different table. This relationship works fine in ...
[ "asp.net", "dynamic-data" ]
14
5
2,271
1
0
2008-08-06T01:42:51.333000
2008-08-06T01:53:45.510000
3,017
3,029
How can we generate getters and setters in Visual Studio?
By "generate", I mean auto-generation of the code necessary for a particular selected (set of) variable(s). But any more explicit explication or comment on good practice is welcome.
Rather than using Ctrl + K, X you can also just type prop and then hit Tab twice.
How can we generate getters and setters in Visual Studio? By "generate", I mean auto-generation of the code necessary for a particular selected (set of) variable(s). But any more explicit explication or comment on good practice is welcome.
TITLE: How can we generate getters and setters in Visual Studio? QUESTION: By "generate", I mean auto-generation of the code necessary for a particular selected (set of) variable(s). But any more explicit explication or comment on good practice is welcome. ANSWER: Rather than using Ctrl + K, X you can also just type ...
[ "c#", "visual-studio", "setter", "getter" ]
261
336
577,809
16
0
2008-08-06T02:15:14.123000
2008-08-06T02:43:21.477000
3,033
3,360
What's the safest way to iterate through the keys of a Perl hash?
If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using each may in some way have unintended side effects. So, is that true, and is one of the two following methods best, or is there a better way? # Method 1 while (my ($key, $valu...
The rule of thumb is to use the function most suited to your needs. If you just want the keys and do not plan to ever read any of the values, use keys(): foreach my $key (keys %hash) {... } If you just want the values, use values(): foreach my $val (values %hash) {... } If you need the keys and the values, use each(): ...
What's the safest way to iterate through the keys of a Perl hash? If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using each may in some way have unintended side effects. So, is that true, and is one of the two following methods...
TITLE: What's the safest way to iterate through the keys of a Perl hash? QUESTION: If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using each may in some way have unintended side effects. So, is that true, and is one of the two...
[ "perl", "hash", "iteration", "each" ]
123
233
141,095
9
0
2008-08-06T02:53:13.033000
2008-08-06T13:22:14.620000
3,045
3,053
Linking two Office documents
Problem: I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B. Goal: A solution that would somehow link these...
So you mean that AD743 on spreadsheet B must be equal to AD743 on spreadsheet A? Try this: Open both spreadsheets on the same machine. Go to AD743 on spreadsheet B. Type =. Go to spreadsheed A and click on AD743. Press enter. You'll notice that the formula is something like ' [path-to-file+file-name].worksheet-name!AD7...
Linking two Office documents Problem: I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B. Goal: A solution ...
TITLE: Linking two Office documents QUESTION: Problem: I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B....
[ "office-2007", "office-2003" ]
14
5
554
2
0
2008-08-06T03:14:59.933000
2008-08-06T03:25:25.917000
3,049
3,054
How do I configure and communicate with a serial port?
I need to send and receive data over serial connections (RS-232 and RS-422). How do I set up and communicate with such a connection? How do I figure out what the configuration settings (e.g. baud rate) should be and how do I set them? In particular, I am looking to do this in Java, C/C++, or one of the major Unix shell...
Build a time machine and go back to 1987? Ho ho. Ok, no more snarky comments. How do I figure out what the configuration settings (e.g. baud rate) should be... Read the datasheet? Ok, ok. Seriously, last one. If you don't know the baud rate of the device you are trying to communicate with, you have two choices. Start g...
How do I configure and communicate with a serial port? I need to send and receive data over serial connections (RS-232 and RS-422). How do I set up and communicate with such a connection? How do I figure out what the configuration settings (e.g. baud rate) should be and how do I set them? In particular, I am looking to...
TITLE: How do I configure and communicate with a serial port? QUESTION: I need to send and receive data over serial connections (RS-232 and RS-422). How do I set up and communicate with such a connection? How do I figure out what the configuration settings (e.g. baud rate) should be and how do I set them? In particula...
[ "java", "c++", "windows", "unix" ]
49
31
13,949
10
0
2008-08-06T03:19:19.470000
2008-08-06T03:27:43.323000
3,057
3,062
Speed Comparisons - Procedural vs. OO in interpreted languages
In interpreted programming languages, such as PHP and JavaScript, what are the repercussions of going with an Object Oriented approach over a Procedural approach? Specifically what I am looking for is a checklist of things to consider when creating a web application and choosing between Procedural and Object Oriented a...
Maybe I'm crazy but worrying about speed in cases like this using an interpretive language is like trying to figure out what color to paint the shed. Let's not even get into the idea that this kind of optimization is entirely pre-mature. You hit the nail on the head when you said 'maintainability'. I'd choose the appro...
Speed Comparisons - Procedural vs. OO in interpreted languages In interpreted programming languages, such as PHP and JavaScript, what are the repercussions of going with an Object Oriented approach over a Procedural approach? Specifically what I am looking for is a checklist of things to consider when creating a web ap...
TITLE: Speed Comparisons - Procedural vs. OO in interpreted languages QUESTION: In interpreted programming languages, such as PHP and JavaScript, what are the repercussions of going with an Object Oriented approach over a Procedural approach? Specifically what I am looking for is a checklist of things to consider when...
[ "performance", "oop", "maintainability", "procedural", "interpreted-language" ]
22
17
9,938
7
0
2008-08-06T03:34:01.517000
2008-08-06T03:36:28.267000
3,058
3,140
What is Inversion of Control?
Inversion of Control (IoC) can be quite confusing when it is first encountered. What is it? Which problem does it solve? When is it appropriate to use and when not?
The Inversion-of-Control (IoC) pattern, is about providing any kind of callback, which "implements" and/or controls reaction, instead of acting ourselves directly (in other words, inversion and/or redirecting control to the external handler/controller). The Dependency-Injection (DI) pattern is a more specific version o...
What is Inversion of Control? Inversion of Control (IoC) can be quite confusing when it is first encountered. What is it? Which problem does it solve? When is it appropriate to use and when not?
TITLE: What is Inversion of Control? QUESTION: Inversion of Control (IoC) can be quite confusing when it is first encountered. What is it? Which problem does it solve? When is it appropriate to use and when not? ANSWER: The Inversion-of-Control (IoC) pattern, is about providing any kind of callback, which "implements...
[ "oop", "design-patterns", "language-agnostic", "inversion-of-control", "terminology" ]
2,316
1,998
707,592
40
0
2008-08-06T03:35:27.380000
2008-08-06T07:22:09.513000
3,061
3,071
Calling a function of a module by using its name (a string)
How do I call a function, using a string with the function's name? For example: import foo func_name = "bar" call(foo, func_name) # calls foo.bar()
Given a module foo with method bar: import foo bar = getattr(foo, 'bar') result = bar() getattr can similarly be used on class instance bound methods, module-level methods, class methods... the list goes on.
Calling a function of a module by using its name (a string) How do I call a function, using a string with the function's name? For example: import foo func_name = "bar" call(foo, func_name) # calls foo.bar()
TITLE: Calling a function of a module by using its name (a string) QUESTION: How do I call a function, using a string with the function's name? For example: import foo func_name = "bar" call(foo, func_name) # calls foo.bar() ANSWER: Given a module foo with method bar: import foo bar = getattr(foo, 'bar') result = bar...
[ "python", "object", "reflection" ]
2,429
2,922
1,162,529
18
0
2008-08-06T03:36:08.627000
2008-08-06T03:57:16.820000
3,075
3,084
Can ASP.NET AJAX partial rendering work inside a SharePoint 2007 application page?
I have a simple page with my ScriptManager and my UpdatePanel, and my ContentTemplate has one ListBox and one Label. I am just trying to catch its OnSelectionChanged so I can update the text in the Label. No matter what settings I try to tweak, I always get a full-page postback. Is this really not going to work, or am ...
You need to have Sharepoint 2007 service pack 1 -- or else there's no chance. (Sharepoint 2007 predates ajax 1.0 -- they built some support into service pack 1) Next, from a trouble shooting point of view, test that the exact same code functions as expected when hosted in a regular asp.net page. (Literally copy and pas...
Can ASP.NET AJAX partial rendering work inside a SharePoint 2007 application page? I have a simple page with my ScriptManager and my UpdatePanel, and my ContentTemplate has one ListBox and one Label. I am just trying to catch its OnSelectionChanged so I can update the text in the Label. No matter what settings I try to...
TITLE: Can ASP.NET AJAX partial rendering work inside a SharePoint 2007 application page? QUESTION: I have a simple page with my ScriptManager and my UpdatePanel, and my ContentTemplate has one ListBox and one Label. I am just trying to catch its OnSelectionChanged so I can update the text in the Label. No matter what...
[ "ajax", "sharepoint" ]
14
2
1,580
6
0
2008-08-06T04:20:41.920000
2008-08-06T04:43:31.267000
3,106
3,119
How can I create Debian install packages in Windows for a Visual Studio project?
I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do it by calling cygwin from a post-build event, but I was hoping for at best a Visual Studio plugin o...
I am not aware of any plugin that does it natively, especially since Mono users seem to prefer MonoDevelop. However, it should be possible to use Cygwin and a custom MSBuild Task or Batch file in order to achieve that by using the native.deb creation tools.
How can I create Debian install packages in Windows for a Visual Studio project? I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do it by calling cygw...
TITLE: How can I create Debian install packages in Windows for a Visual Studio project? QUESTION: I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do ...
[ "windows", "visual-studio", "mono", "cross-platform" ]
22
3
7,562
5
0
2008-08-06T05:36:49.770000
2008-08-06T06:06:45.607000
3,112
3,134
Can you force either a scalar or array ref to be an array in Perl?
I have a perl variable $results that gets returned from a service. The value is supposed to be an array, and $results should be an array reference. However, when the array has only one item in it, $results will be set to that value, and not a referenced array that contains that one item. I want to do a foreach loop on ...
im not sure there's any other way than: $result = [ $result ] if ref($result) ne 'ARRAY'; foreach.....
Can you force either a scalar or array ref to be an array in Perl? I have a perl variable $results that gets returned from a service. The value is supposed to be an array, and $results should be an array reference. However, when the array has only one item in it, $results will be set to that value, and not a referenced...
TITLE: Can you force either a scalar or array ref to be an array in Perl? QUESTION: I have a perl variable $results that gets returned from a service. The value is supposed to be an array, and $results should be an array reference. However, when the array has only one item in it, $results will be set to that value, an...
[ "perl", "arrays", "reference", "scalar" ]
28
26
14,585
6
0
2008-08-06T05:56:00.933000
2008-08-06T07:13:16.753000
3,136
3,139
How to setup a crontab to execute at specific time
How can I set up my crontab to execute X script at 11:59PM every day without emailing me or creating any logs? Right now my crontab looks something like this @daily /path/to/script.sh
When you do crontab -e, try this: 59 23 * * * /usr/sbin/myscript > /dev/null That means: At 59 Minutes and 23 Hours on every day (*) on every month on every weekday, execute myscript. See man crontab for some more info and examples.
How to setup a crontab to execute at specific time How can I set up my crontab to execute X script at 11:59PM every day without emailing me or creating any logs? Right now my crontab looks something like this @daily /path/to/script.sh
TITLE: How to setup a crontab to execute at specific time QUESTION: How can I set up my crontab to execute X script at 11:59PM every day without emailing me or creating any logs? Right now my crontab looks something like this @daily /path/to/script.sh ANSWER: When you do crontab -e, try this: 59 23 * * * /usr/sbin/my...
[ "cron", "settings" ]
18
11
1,255
3
0
2008-08-06T07:16:16.373000
2008-08-06T07:21:32.430000
3,143
880,219
Using MBUnit in TeamCity
I'm compiling a NAnt project on linux with TeamCity Continuous Integration server. I have been able to generate a test report by running NAnt on mono thru a Command Line Runner but don't have the options of using the report like a NAnt Runner. I'm also using MBUnit for the testing framework. How can I merge in the test...
Gallio now has an extension to output TeamCity service messages. Just use the included Gallio.NAntTasks.dll and enable the TeamCity extension. (this won't be necessary in the next release )
Using MBUnit in TeamCity I'm compiling a NAnt project on linux with TeamCity Continuous Integration server. I have been able to generate a test report by running NAnt on mono thru a Command Line Runner but don't have the options of using the report like a NAnt Runner. I'm also using MBUnit for the testing framework. Ho...
TITLE: Using MBUnit in TeamCity QUESTION: I'm compiling a NAnt project on linux with TeamCity Continuous Integration server. I have been able to generate a test report by running NAnt on mono thru a Command Line Runner but don't have the options of using the report like a NAnt Runner. I'm also using MBUnit for the tes...
[ "mono", "nant", "teamcity", "mbunit" ]
17
6
3,497
4
0
2008-08-06T07:41:11.937000
2009-05-18T23:07:43.877000
3,144
3,146
'Best' Diff Algorithm
I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms. Does anybody here know of a 'best' algorithm that I could implement?
Well I've used the c# version on codeproject and its really good for what I wanted... http://www.codeproject.com/KB/recipes/diffengine.aspx You can probably get this translated into VB.net via an online converter if you can't do it yourself...
'Best' Diff Algorithm I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms. Does anybody here know of a 'best' algorithm that I could implement?
TITLE: 'Best' Diff Algorithm QUESTION: I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms. Does anybody here know of a 'best' algorithm that I could implement? ANSWER: Wel...
[ "vb.net", "diff" ]
18
7
5,972
3
0
2008-08-06T07:42:33.947000
2008-08-06T07:49:32.407000
3,150
35,963
How to set up unit testing for Visual Studio C++
I'm having trouble figuring out how to get the testing framework set up and usable in Visual Studio 2008 for C++ presumably with the built-in unit testing suite. Any links or tutorials would be appreciated.
This page may help, it reviews quite a few C++ unit test frameworks: CppUnit Boost.Test CppUnitLite NanoCppUnit Unit++ CxxTest Check out CPPUnitLite or CPPUnitLite2. CPPUnitLite was created by Michael Feathers, who originally ported Java's JUnit to C++ as CPPUnit (CPPUnit tries mimic the development model of JUnit - bu...
How to set up unit testing for Visual Studio C++ I'm having trouble figuring out how to get the testing framework set up and usable in Visual Studio 2008 for C++ presumably with the built-in unit testing suite. Any links or tutorials would be appreciated.
TITLE: How to set up unit testing for Visual Studio C++ QUESTION: I'm having trouble figuring out how to get the testing framework set up and usable in Visual Studio 2008 for C++ presumably with the built-in unit testing suite. Any links or tutorials would be appreciated. ANSWER: This page may help, it reviews quite ...
[ "c++", "unit-testing", "testing", "visual-studio-2008", "frameworks" ]
94
57
62,191
12
0
2008-08-06T07:57:50.017000
2008-08-30T13:51:31.510000
3,157
4,449
.htaccess directives to *not* redirect certain URLs
In an application that heavily relies on.htaccess RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is: /appRoot/.htaccess app/ static/ By default, every request to /appRoot/* is being rewritten to be picked up by app/webr...
And the correct answer iiiiis... RewriteRule ^(a|bunch|of|old|directories).* - [NC,L] # all other requests will be forwarded to Cake RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] I still don't get why the index.php file in the root directory was called initially even with these directives in plac...
.htaccess directives to *not* redirect certain URLs In an application that heavily relies on.htaccess RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is: /appRoot/.htaccess app/ static/ By default, every request to /appR...
TITLE: .htaccess directives to *not* redirect certain URLs QUESTION: In an application that heavily relies on.htaccess RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is: /appRoot/.htaccess app/ static/ By default, ever...
[ "apache", ".htaccess", "mod-rewrite" ]
22
6
4,031
3
0
2008-08-06T08:15:28.233000
2008-08-07T06:09:54.337000
3,163
10,030
Actionscript 3 - Fastest way to parse yyyy-mm-dd hh:mm:ss to a Date object?
I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings. Does anyone know any faster ways of doing this or tips to speed up the methods? castMethod1 takes 3673 ms castMe...
I've been using the following snipplet to parse UTC date strings: private function parseUTCDate( str: String ): Date { var matches: Array = str.match(/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)Z/); var d: Date = new Date(); d.setUTCFullYear(int(matches[1]), int(matches[2]) - 1, int(matches[3])); d.setUTCHours(int(...
Actionscript 3 - Fastest way to parse yyyy-mm-dd hh:mm:ss to a Date object? I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings. Does anyone know any faster ways of ...
TITLE: Actionscript 3 - Fastest way to parse yyyy-mm-dd hh:mm:ss to a Date object? QUESTION: I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings. Does anyone know a...
[ "apache-flex", "actionscript-3" ]
24
18
33,994
7
0
2008-08-06T08:33:53.097000
2008-08-13T16:21:37.243000
3,164
3,218
Absolute path back to web-relative path
If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the fastest way to convert that absolute path back into a relative web path?
Perhaps this might work: String RelativePath = AbsolutePath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty); I'm using c# but could be adapted to vb.
Absolute path back to web-relative path If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the fastest way to convert that absolute path back into a relative web path?
TITLE: Absolute path back to web-relative path QUESTION: If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the fastest way to convert that absolute path back into a relative web path? ANSWER: Perhaps this might work: Stri...
[ "c#", "asp.net", ".net", "path", "mappath" ]
66
56
59,862
6
0
2008-08-06T08:34:13.983000
2008-08-06T09:28:50.940000
3,180
3,188
Anyone soloing using fogbugz?
Is there anyone working solo and using fogbugz out there? I'm interested in personal experience/overhead versus paper. I am involved in several projects and get pretty hammered with lots of details to keep track of... Any experience welcome. (Yes I know Mr. Joel is on the stackoverflow team... I still want good answers...
I use it, especially since the hosted Version of FugBugz is free for up to 2 people. I found it a lot nicer than paper as I'm working on multiple projects, and my paper tends to get rather messy once you start making annotations or if you want to re-organize and shuffle tasks around, mark them as complete only to see t...
Anyone soloing using fogbugz? Is there anyone working solo and using fogbugz out there? I'm interested in personal experience/overhead versus paper. I am involved in several projects and get pretty hammered with lots of details to keep track of... Any experience welcome. (Yes I know Mr. Joel is on the stackoverflow tea...
TITLE: Anyone soloing using fogbugz? QUESTION: Is there anyone working solo and using fogbugz out there? I'm interested in personal experience/overhead versus paper. I am involved in several projects and get pretty hammered with lots of details to keep track of... Any experience welcome. (Yes I know Mr. Joel is on the...
[ "fogbugz" ]
35
35
6,522
7
0
2008-08-06T08:47:45.423000
2008-08-06T08:52:51.980000
3,196
3,197
SQL query, count and group by
If I have data like this: Key Name 1 Dan 2 Tom 3 Jon 4 Tom 5 Sam 6 Dan What is the SQL query to bring back the records where Name is repeated 2 or more times? So the result I would want is Tom Dan
Couldn't be simpler... Select Name, Count(Name) As Count From Table Group By Name Having Count(Name) > 1 Order By Count(Name) Desc This could also be extended to delete duplicates: Delete From Table Where Key In ( Select Max(Key) From Table Group By Name Having Count(Name) > 1 )
SQL query, count and group by If I have data like this: Key Name 1 Dan 2 Tom 3 Jon 4 Tom 5 Sam 6 Dan What is the SQL query to bring back the records where Name is repeated 2 or more times? So the result I would want is Tom Dan
TITLE: SQL query, count and group by QUESTION: If I have data like this: Key Name 1 Dan 2 Tom 3 Jon 4 Tom 5 Sam 6 Dan What is the SQL query to bring back the records where Name is repeated 2 or more times? So the result I would want is Tom Dan ANSWER: Couldn't be simpler... Select Name, Count(Name) As Count From Tabl...
[ "sql" ]
26
40
23,484
3
0
2008-08-06T09:00:58.063000
2008-08-06T09:02:36.907000
3,213
3,267
Convert integers to written numbers
Is there an efficient method of converting an integer into the written numbers, for example: string Written = IntegerToWritten(21); would return "Twenty One". Is there any way of doing this that doesn't involve a massive look-up table?
This should work reasonably well: public static class HumanFriendlyInteger { static string[] ones = new string[] { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" }; static string[] teens = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "E...
Convert integers to written numbers Is there an efficient method of converting an integer into the written numbers, for example: string Written = IntegerToWritten(21); would return "Twenty One". Is there any way of doing this that doesn't involve a massive look-up table?
TITLE: Convert integers to written numbers QUESTION: Is there an efficient method of converting an integer into the written numbers, for example: string Written = IntegerToWritten(21); would return "Twenty One". Is there any way of doing this that doesn't involve a massive look-up table? ANSWER: This should work reas...
[ "c#", "integer" ]
62
70
49,024
11
0
2008-08-06T09:21:09.490000
2008-08-06T10:31:24.170000
3,224
3,225
How can I make the browser see CSS and Javascript changes?
CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well with a version control system such as Subversion. Some soluti...
I found that if you append the last modified timestamp of the file onto the end of the URL the browser will request the files when it is modified. For example in PHP: function urlmtime($url) { $parsed_url = parse_url($url); $path = $parsed_url['path']; if ($path[0] == "/") { $filename = $_SERVER['DOCUMENT_ROOT']. "/"....
How can I make the browser see CSS and Javascript changes? CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well wi...
TITLE: How can I make the browser see CSS and Javascript changes? QUESTION: CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution ...
[ "javascript", "css", "http", "caching" ]
64
30
7,885
5
0
2008-08-06T09:38:15.417000
2008-08-06T09:41:02.353000
3,230
10,141
How do you pack a visual studio c++ project for release?
I'm wondering how to make a release build that includes all necessary DLL files into the.exe so the program can be run on a non-development machine without having to install the Microsoft redistributable on the target machine. Without doing this you get the error message that the application configuration is not correc...
Choose Project -> Properties Select Configuration -> General In the box for how you should link MFC, choose to statically link it. Choose Linker -> Input. Under Additional Dependencies, add any libraries you need your app to statically link in.
How do you pack a visual studio c++ project for release? I'm wondering how to make a release build that includes all necessary DLL files into the.exe so the program can be run on a non-development machine without having to install the Microsoft redistributable on the target machine. Without doing this you get the error...
TITLE: How do you pack a visual studio c++ project for release? QUESTION: I'm wondering how to make a release build that includes all necessary DLL files into the.exe so the program can be run on a non-development machine without having to install the Microsoft redistributable on the target machine. Without doing this...
[ "c++", "visual-studio", "build" ]
38
18
34,680
6
0
2008-08-06T09:49:27.467000
2008-08-13T18:10:34.870000
3,231
842,632
C/C++ library for reading MIDI signals from a USB MIDI device
I want to write C/C++ programs that take input from a MIDI device. The MIDI device connects to my PC using a USB connector. I'm looking for a (C/C++ implemented) library that I can use to read the MIDI signals from the MIDI device through the USB port. I'm happy manipulating the MIDI data once I get it, I just don't wa...
PortMidi is another open source cross-platform MIDI I/O library worth checking out. On the other hand, if you are working on a sysex type of app, then direct Win32 works easily enough. Just came across another open source cross-platform framework that includes MIDI support: Juce. Also, I should note that there isn't an...
C/C++ library for reading MIDI signals from a USB MIDI device I want to write C/C++ programs that take input from a MIDI device. The MIDI device connects to my PC using a USB connector. I'm looking for a (C/C++ implemented) library that I can use to read the MIDI signals from the MIDI device through the USB port. I'm h...
TITLE: C/C++ library for reading MIDI signals from a USB MIDI device QUESTION: I want to write C/C++ programs that take input from a MIDI device. The MIDI device connects to my PC using a USB connector. I'm looking for a (C/C++ implemented) library that I can use to read the MIDI signals from the MIDI device through t...
[ "c++", "c", "signal-processing", "midi", "dev-c++" ]
31
22
31,022
3
0
2008-08-06T09:51:06.153000
2009-05-09T04:11:32.773000
3,234
14,496
Displaying ad content from Respose.WriteFile()/ Response.ContentType
How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request. This would allow people to hit a url to the type http://www.foo.com?Image=test.jpg and have the image display in ...
This is ugly, but the best way is to look at the file and set the content type as appropriate: switch ( fileExtension ) { case "pdf": Response.ContentType = "application/pdf"; break; case "swf": Response.ContentType = "application/x-shockwave-flash"; break; case "gif": Response.ContentType = "image/gif"; break; case "...
Displaying ad content from Respose.WriteFile()/ Response.ContentType How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request. This would allow people to hit a url to the ...
TITLE: Displaying ad content from Respose.WriteFile()/ Response.ContentType QUESTION: How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request. This would allow people to...
[ "c#" ]
21
10
19,034
4
0
2008-08-06T09:52:36.603000
2008-08-18T12:10:43.100000
3,255
4,852,666
Big O, how do you calculate/approximate it?
Most people with a degree in CS will certainly know what Big O stands for. It helps us to measure how well an algorithm scales. But I'm curious, how do you calculate or approximate the complexity of your algorithms?
I'll do my best to explain it here on simple terms, but be warned that this topic takes my students a couple of months to finally grasp. You can find more information on the Chapter 2 of the Data Structures and Algorithms in Java book. There is no mechanical procedure that can be used to get the BigOh. As a "cookbook",...
Big O, how do you calculate/approximate it? Most people with a degree in CS will certainly know what Big O stands for. It helps us to measure how well an algorithm scales. But I'm curious, how do you calculate or approximate the complexity of your algorithms?
TITLE: Big O, how do you calculate/approximate it? QUESTION: Most people with a degree in CS will certainly know what Big O stands for. It helps us to measure how well an algorithm scales. But I'm curious, how do you calculate or approximate the complexity of your algorithms? ANSWER: I'll do my best to explain it her...
[ "algorithm", "optimization", "complexity-theory", "big-o", "performance" ]
978
1,554
536,408
24
0
2008-08-06T10:18:16.067000
2011-01-31T15:33:54.120000
3,260
3,288
Peak detection of measured signal
We use a data acquisition card to take readings from a device that increases its signal to a peak and then falls back to near the original value. To find the peak value we currently search the array for the highest reading and use the index to determine the timing of the peak value which is used in our calculations. Th...
You could try signal averaging, i.e. for each point, average the value with the surrounding 3 or more points. If the noise blips are huge, then even this may not help. I realise that this was language agnostic, but guessing that you are using LabView, there are lots of pre-packaged signal processing VIs that come with ...
Peak detection of measured signal We use a data acquisition card to take readings from a device that increases its signal to a peak and then falls back to near the original value. To find the peak value we currently search the array for the highest reading and use the index to determine the timing of the peak value whi...
TITLE: Peak detection of measured signal QUESTION: We use a data acquisition card to take readings from a device that increases its signal to a peak and then falls back to near the original value. To find the peak value we currently search the array for the highest reading and use the index to determine the timing of ...
[ "algorithm", "language-agnostic" ]
60
10
63,004
9
0
2008-08-06T10:23:18.833000
2008-08-06T11:12:48.890000
3,272
5,101
Timer-based event triggers
I am currently working on a project with specific requirements. A brief overview of these are as follows: Data is retrieved from external webservices Data is stored in SQL 2005 Data is manipulated via a web GUI The windows service that communicates with the web services has no coupling with our internal web UI, except ...
Why not use a SQL Job instead of the Windows Service? You can encapsulate all of you db "trigger" code in Stored Procedures. Then your UI and SQL Job can call the same Stored Procedures and create the triggers the same way whether it's manually or at a time interval.
Timer-based event triggers I am currently working on a project with specific requirements. A brief overview of these are as follows: Data is retrieved from external webservices Data is stored in SQL 2005 Data is manipulated via a web GUI The windows service that communicates with the web services has no coupling with o...
TITLE: Timer-based event triggers QUESTION: I am currently working on a project with specific requirements. A brief overview of these are as follows: Data is retrieved from external webservices Data is stored in SQL 2005 Data is manipulated via a web GUI The windows service that communicates with the web services has ...
[ "sql", "web-services", "service", "triggers", "timer" ]
15
3
3,280
3
0
2008-08-06T10:43:16.720000
2008-08-07T18:24:09.863000
3,281
4,270
Mapping values from two array in Ruby
I'm wondering if there's a way to do what I can do below with Python, in Ruby: sum = reduce(lambda x, y: x + y, map(lambda x, y: x * y, weights, data)) I have two arrays of equal sizes with the weights and data but I can't seem to find a function similar to map in Ruby, reduce I have working.
@Michiel de Mare Your Ruby 1.9 example can be shortened a bit further: weights.zip(data).map(:*).reduce(:+) Also note that in Ruby 1.8, if you require ActiveSupport (from Rails) you can use: weights.zip(data).map(&:*).reduce(&:+)
Mapping values from two array in Ruby I'm wondering if there's a way to do what I can do below with Python, in Ruby: sum = reduce(lambda x, y: x + y, map(lambda x, y: x * y, weights, data)) I have two arrays of equal sizes with the weights and data but I can't seem to find a function similar to map in Ruby, reduce I ha...
TITLE: Mapping values from two array in Ruby QUESTION: I'm wondering if there's a way to do what I can do below with Python, in Ruby: sum = reduce(lambda x, y: x + y, map(lambda x, y: x * y, weights, data)) I have two arrays of equal sizes with the weights and data but I can't seem to find a function similar to map in...
[ "ruby", "maps", "reduce" ]
23
14
15,847
6
0
2008-08-06T11:02:20.597000
2008-08-07T01:29:05.777000
3,284
3,294
Why can't I have abstract static methods in C#?
I've been working with providers a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic, and it sort of made sense, but is there a nice clear explanation?
Static methods are not instantiated as such, they're just available without an object reference. A call to a static method is done through the class name, not through an object reference, and the Intermediate Language (IL) code to call it will call the abstract method through the name of the class that defined it, not ...
Why can't I have abstract static methods in C#? I've been working with providers a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic, and it sort of made sense, but is there a nice clear explanation?
TITLE: Why can't I have abstract static methods in C#? QUESTION: I've been working with providers a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic, and it sort of made sense, but is there a nice cl...
[ "c#", ".net", "language-design" ]
215
164
136,119
10
0
2008-08-06T11:04:33.587000
2008-08-06T11:30:07.093000
3,315
3,316
Can I have a method returning IEnumerator<T> and use it in a foreach loop?
I need to set the height of every textbox on my form, some of which are nested within other controls. I thought I could do something like this: private static IEnumerator FindTextBoxes(Control rootControl) { foreach (Control control in rootControl.Controls) { if (control.Controls.Count > 0) { // Recursively search for ...
As the compiler is telling you, you need to change your return type to IEnumerable. That is how the yield return syntax works.
Can I have a method returning IEnumerator<T> and use it in a foreach loop? I need to set the height of every textbox on my form, some of which are nested within other controls. I thought I could do something like this: private static IEnumerator FindTextBoxes(Control rootControl) { foreach (Control control in rootContr...
TITLE: Can I have a method returning IEnumerator<T> and use it in a foreach loop? QUESTION: I need to set the height of every textbox on my form, some of which are nested within other controls. I thought I could do something like this: private static IEnumerator FindTextBoxes(Control rootControl) { foreach (Control co...
[ "c#", "foreach", "ienumerable", "ienumerator" ]
22
14
13,369
5
0
2008-08-06T12:17:31.320000
2008-08-06T12:19:57.367000
3,319
3,321
How to set background color of HTML element using css properties in JavaScript
How can I set the background color of an HTML element using css in JavaScript?
In general, CSS properties are converted to JavaScript by making them camelCase without any dashes. So background-color becomes backgroundColor. function setColor(element, color) { element.style.backgroundColor = color; } // where el is the concerned element var el = document.getElementById('elementId'); setColor(el, ...
How to set background color of HTML element using css properties in JavaScript How can I set the background color of an HTML element using css in JavaScript?
TITLE: How to set background color of HTML element using css properties in JavaScript QUESTION: How can I set the background color of an HTML element using css in JavaScript? ANSWER: In general, CSS properties are converted to JavaScript by making them camelCase without any dashes. So background-color becomes backgro...
[ "javascript", "css", "background-color" ]
129
167
187,932
17
0
2008-08-06T12:23:22.413000
2008-08-06T12:25:54.920000
3,362
13,130
Capturing TAB key in text box
I would like to be able to use the Tab key within a text box to tab over four spaces. The way it is now, the Tab key jumps my cursor to the next input. Is there some JavaScript that will capture the Tab key in the text box before it bubbles up to the UI? I understand some browsers (i.e. FireFox) may not allow this. How...
Even if you capture the keydown / keyup event, those are the only events that the tab key fires, you still need some way to prevent the default action, moving to the next item in the tab order, from occurring. In Firefox you can call the preventDefault() method on the event object passed to your event handler. In IE, y...
Capturing TAB key in text box I would like to be able to use the Tab key within a text box to tab over four spaces. The way it is now, the Tab key jumps my cursor to the next input. Is there some JavaScript that will capture the Tab key in the text box before it bubbles up to the UI? I understand some browsers (i.e. Fi...
TITLE: Capturing TAB key in text box QUESTION: I would like to be able to use the Tab key within a text box to tab over four spaces. The way it is now, the Tab key jumps my cursor to the next input. Is there some JavaScript that will capture the Tab key in the text box before it bubbles up to the UI? I understand some...
[ "javascript", "user-interface" ]
110
115
180,443
6
0
2008-08-06T13:27:05.453000
2008-08-16T13:55:26.087000
3,385
10,747
MAC addresses in JavaScript
I know that we can get the MAC address of a user via IE (ActiveX objects). Is there a way to obtain a user's MAC address using JavaScript?
I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this directly from Javascript. There are two things I can think of: Using Java (with a signed applet) Using signed Javascript, which in FF (and Mozilla in general) gets higher privileges than normal JS (b...
MAC addresses in JavaScript I know that we can get the MAC address of a user via IE (ActiveX objects). Is there a way to obtain a user's MAC address using JavaScript?
TITLE: MAC addresses in JavaScript QUESTION: I know that we can get the MAC address of a user via IE (ActiveX objects). Is there a way to obtain a user's MAC address using JavaScript? ANSWER: I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this direc...
[ "javascript", "mac-address" ]
124
74
267,011
8
0
2008-08-06T13:43:44.983000
2008-08-14T06:21:12.150000
3,404
3,409
JavaScript Troubleshooting Tools in Internet Explorer
I use Firebug and the Mozilla JS console heavily, but every now and then I run into an IE-only JavaScript bug, which is really hard to locate (ex: error on line 724, when the source HTML only has 200 lines). I would love to have a lightweight JS tool ( a la firebug) for Internet Explorer, something I can install in sec...
You might find Firebug Lite useful for that. Its bookmarklet should be especially useful when debugging on a user's machine.
JavaScript Troubleshooting Tools in Internet Explorer I use Firebug and the Mozilla JS console heavily, but every now and then I run into an IE-only JavaScript bug, which is really hard to locate (ex: error on line 724, when the source HTML only has 200 lines). I would love to have a lightweight JS tool ( a la firebug)...
TITLE: JavaScript Troubleshooting Tools in Internet Explorer QUESTION: I use Firebug and the Mozilla JS console heavily, but every now and then I run into an IE-only JavaScript bug, which is really hard to locate (ex: error on line 724, when the source HTML only has 200 lines). I would love to have a lightweight JS to...
[ "javascript", "internet-explorer", "debugging" ]
44
30
7,212
7
0
2008-08-06T13:56:42.210000
2008-08-06T13:59:47.213000
3,408
166,705
Ruby On Rails with Windows Vista - Best Setup?
What do you think is the best set-up for RoR in a Win Vista environment? I've tried the radrails eclipse plug-in, and it just seemed too bulky for me, I've also started to just use Textpad and the command line, but I'm used to having somewhat of an IDE to work with.
I don't know about "best", because that's a subjective question, but I can tell you what setup I use and recommend: Editor: E Text Editor TextMate seems to be the editor of choice for Rails on Mac. E Text Editor is essentially TextMate for Windows. Its bundles are broadly compatible with TextMate's including the Rails ...
Ruby On Rails with Windows Vista - Best Setup? What do you think is the best set-up for RoR in a Win Vista environment? I've tried the radrails eclipse plug-in, and it just seemed too bulky for me, I've also started to just use Textpad and the command line, but I'm used to having somewhat of an IDE to work with.
TITLE: Ruby On Rails with Windows Vista - Best Setup? QUESTION: What do you think is the best set-up for RoR in a Win Vista environment? I've tried the radrails eclipse plug-in, and it just seemed too bulky for me, I've also started to just use Textpad and the command line, but I'm used to having somewhat of an IDE to...
[ "ruby-on-rails", "windows", "ruby", "ide" ]
17
14
4,390
11
0
2008-08-06T13:59:16.793000
2008-10-03T12:59:40.110000
3,432
3,466
Multiple Updates in MySQL
I know that you can insert multiple rows at once, is there a way to update multiple rows at once (as in, in one query) in MySQL? Edit: For example I have the following Name id Col1 Col2 Row1 1 6 1 Row2 2 2 3 Row3 3 9 5 Row4 4 16 8 I want to combine all the following Updates into one query UPDATE table SET Col1 = 1 WHER...
Yes, that's possible - you can use INSERT... ON DUPLICATE KEY UPDATE. Using your example: INSERT INTO table (id,Col1,Col2) VALUES (1,1,1),(2,2,3),(3,9,3),(4,10,12) ON DUPLICATE KEY UPDATE Col1=VALUES(Col1),Col2=VALUES(Col2);
Multiple Updates in MySQL I know that you can insert multiple rows at once, is there a way to update multiple rows at once (as in, in one query) in MySQL? Edit: For example I have the following Name id Col1 Col2 Row1 1 6 1 Row2 2 2 3 Row3 3 9 5 Row4 4 16 8 I want to combine all the following Updates into one query UPDA...
TITLE: Multiple Updates in MySQL QUESTION: I know that you can insert multiple rows at once, is there a way to update multiple rows at once (as in, in one query) in MySQL? Edit: For example I have the following Name id Col1 Col2 Row1 1 6 1 Row2 2 2 3 Row3 3 9 5 Row4 4 16 8 I want to combine all the following Updates i...
[ "mysql", "sql", "sql-update" ]
448
726
500,717
20
0
2008-08-06T14:12:09.903000
2008-08-06T14:33:41.560000
3,437
20,612
Options for Google Maps over SSL
We recently discovered that the Google Maps API does not play nicely with SSL. Fair enough, but what are some options for overcoming this that others have used effectively? Will the Maps API work over SSL (HTTPS)? At this time, the Maps API is not available over a secure (SSL) connection. If you are running the Maps AP...
I'd agree with the previous two answers that in this instance it may be better from a usability perspective to split the two functions into separate screens. You really want your users to be focussed on entering complete and accurate credit card information, and having a map on the same screen may be distracting. For t...
Options for Google Maps over SSL We recently discovered that the Google Maps API does not play nicely with SSL. Fair enough, but what are some options for overcoming this that others have used effectively? Will the Maps API work over SSL (HTTPS)? At this time, the Maps API is not available over a secure (SSL) connectio...
TITLE: Options for Google Maps over SSL QUESTION: We recently discovered that the Google Maps API does not play nicely with SSL. Fair enough, but what are some options for overcoming this that others have used effectively? Will the Maps API work over SSL (HTTPS)? At this time, the Maps API is not available over a secu...
[ "google-maps", "iframe", "ssl", "https" ]
20
15
15,432
7
0
2008-08-06T14:14:29.383000
2008-08-21T17:32:37.307000
3,448
3,492
Is it acceptable for invalid XHTML?
I've noticed a lot of sites, SO included, use XHTML as their mark-up language and then fail to adhere to the spec. Just browsing the source for SO there are missing closing tags for paragraphs, invalid elements, etc. So should tools (and developers) use the XHTML doctype if they are going to produce invalid mark up? An...
There are many reasons to use valid markup. My favorite is that it allows you to use validation as a form of regression testing, preventing the markup equivalent of "delta rot" from leading to real rendering problems once the errors reach some critical mass. And really, it's just plain sloppy to allow "lazy" errors lik...
Is it acceptable for invalid XHTML? I've noticed a lot of sites, SO included, use XHTML as their mark-up language and then fail to adhere to the spec. Just browsing the source for SO there are missing closing tags for paragraphs, invalid elements, etc. So should tools (and developers) use the XHTML doctype if they are ...
TITLE: Is it acceptable for invalid XHTML? QUESTION: I've noticed a lot of sites, SO included, use XHTML as their mark-up language and then fail to adhere to the spec. Just browsing the source for SO there are missing closing tags for paragraphs, invalid elements, etc. So should tools (and developers) use the XHTML do...
[ "xhtml", "markup" ]
22
16
2,094
14
0
2008-08-06T14:21:18.823000
2008-08-06T14:46:40.660000
3,452
34,153
SQL Client for Mac OS X that works with MS SQL Server
How can I connect to a remote SQL server using Mac OS X? I don't really need a GUI, but it would be nice to have for the color coding and resultset grid. I'd rather not have to use a VM. Is there a SQL client for Mac OS X that works with MS SQL Server?
Let's work together on a canonical answer. Native Apps SQLPro for MSSQL Navicat Valentina Studio TablePlus Java-Based Oracle SQL Developer (free) SQuirrel SQL (free, open source) Razor SQL DB Visualizer DBeaver (free, open source) SQL Workbench/J (free, open source) JetBrains DataGrip Metabase (free, open source) Netbe...
SQL Client for Mac OS X that works with MS SQL Server How can I connect to a remote SQL server using Mac OS X? I don't really need a GUI, but it would be nice to have for the color coding and resultset grid. I'd rather not have to use a VM. Is there a SQL client for Mac OS X that works with MS SQL Server?
TITLE: SQL Client for Mac OS X that works with MS SQL Server QUESTION: How can I connect to a remote SQL server using Mac OS X? I don't really need a GUI, but it would be nice to have for the color coding and resultset grid. I'd rather not have to use a VM. Is there a SQL client for Mac OS X that works with MS SQL Ser...
[ "sql-server", "macos" ]
484
373
714,735
25
0
2008-08-06T14:25:17.457000
2008-08-29T08:05:06.120000