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
146,704
146,716
Is _VERSION the only global variable left in Lua 5.1?
Puzzled by the Lua 5.0 documentation references to things like _LOADED, LUA_PATH, _ALERT and so on (that I could not use in Lua 5.1), I discovered all of those have been removed and the functionality put elsewhere. Am I right in thinking that the only one global variable left in Lua 5.1 is _VERSION?
The docs seem to think that's almost the case.... _G A global variable (not a function) that holds the global environment (that is, _G._G = _G). Lua itself does not use this variable; changing its value does not affect any environment, nor vice-versa. (Use setfenv to change environments.) It looks like there's also _PR...
Is _VERSION the only global variable left in Lua 5.1? Puzzled by the Lua 5.0 documentation references to things like _LOADED, LUA_PATH, _ALERT and so on (that I could not use in Lua 5.1), I discovered all of those have been removed and the functionality put elsewhere. Am I right in thinking that the only one global var...
TITLE: Is _VERSION the only global variable left in Lua 5.1? QUESTION: Puzzled by the Lua 5.0 documentation references to things like _LOADED, LUA_PATH, _ALERT and so on (that I could not use in Lua 5.1), I discovered all of those have been removed and the functionality put elsewhere. Am I right in thinking that the o...
[ "lua" ]
2
3
1,223
2
0
2008-09-28T20:44:28.677000
2008-09-28T20:51:07.630000
146,730
146,809
Development with a tablet, not a mouse
Lifehacker had a post a couple days ago asking people about the best mouse you've ever had and it appears some people have traded their mouse for a tablet. I'm curious if anyone here has traded their mouse in for a tablet? Does it work well for development? Looking for pros and cons from people who have tried it or are...
I used a small Wacom tablet as my primary "mouse" for a couple years. I found the tablet to be very natural, and even got used to typing while holding the stylus in between my fingers. (I don't type the "correct fingers on home row" way anyway, so it wasn't that big of an adjustment) I did find that I got MUCH better a...
Development with a tablet, not a mouse Lifehacker had a post a couple days ago asking people about the best mouse you've ever had and it appears some people have traded their mouse for a tablet. I'm curious if anyone here has traded their mouse in for a tablet? Does it work well for development? Looking for pros and co...
TITLE: Development with a tablet, not a mouse QUESTION: Lifehacker had a post a couple days ago asking people about the best mouse you've ever had and it appears some people have traded their mouse for a tablet. I'm curious if anyone here has traded their mouse in for a tablet? Does it work well for development? Looki...
[ "ergonomics" ]
3
1
929
5
0
2008-09-28T21:04:39.237000
2008-09-28T21:41:59.787000
146,732
146,761
Should I go with SSIS or multithreaded C# application to load flat files in to database?
Within SQL Server Integration Services (SSIS) there is the ability to setup a connection to a flat file that can hold millions of records and have that data pushed to a SQL DB. Furthermore, this process can be called from a C# app by referencing and using the Microsoft.SqlServer.Dts.Runtime namespace. Would a flat file...
I can only speak for myself and my experience. I would go with SSIS, since this is one of those cases where you might be re-inventing the wheel unnecessarily. This is a repetitive task that has already been solved by SSIS. I have about 57 jobs (combination of DTS and SSIS) that I manage on a daily basis. Four of those ...
Should I go with SSIS or multithreaded C# application to load flat files in to database? Within SQL Server Integration Services (SSIS) there is the ability to setup a connection to a flat file that can hold millions of records and have that data pushed to a SQL DB. Furthermore, this process can be called from a C# app ...
TITLE: Should I go with SSIS or multithreaded C# application to load flat files in to database? QUESTION: Within SQL Server Integration Services (SSIS) there is the ability to setup a connection to a flat file that can hold millions of records and have that data pushed to a SQL DB. Furthermore, this process can be cal...
[ "sql-server", "ssis", "bulkinsert" ]
2
6
5,743
3
0
2008-09-28T21:05:22.527000
2008-09-28T21:16:02.657000
146,737
153,361
Closures in PHP... what, precisely, are they and when would you need to use them?
So I'm programming along in a nice, up to date, object oriented fashion. I regularly make use of the various aspects of OOP that PHP implements but I am wondering when might I need to use closures. Any experts out there that can shed some light on when it would be useful to implement closures?
PHP will support closures natively in 5.3. A closure is good when you want a local function that's only used for some small, specific purpose. The RFC for closures gives a good example: function replace_spaces ($text) { $replacement = function ($matches) { return str_replace ($matches[1], ' ', ' ').' '; }; return preg_...
Closures in PHP... what, precisely, are they and when would you need to use them? So I'm programming along in a nice, up to date, object oriented fashion. I regularly make use of the various aspects of OOP that PHP implements but I am wondering when might I need to use closures. Any experts out there that can shed some...
TITLE: Closures in PHP... what, precisely, are they and when would you need to use them? QUESTION: So I'm programming along in a nice, up to date, object oriented fashion. I regularly make use of the various aspects of OOP that PHP implements but I am wondering when might I need to use closures. Any experts out there ...
[ "php", "oop", "closures" ]
90
89
31,114
8
0
2008-09-28T21:06:09.390000
2008-09-30T14:41:40.093000
146,743
146,751
How do you store an Integer and Boolean key value pair in an un-ordered collection?
I need to store a list of key value pairs of (integer, boolean) in.NET When I use a dictionary it re-orders them. Is there a built in collection that will handle this.
List > l = new List >(); l.Add(new KeyValuePair (1, false));
How do you store an Integer and Boolean key value pair in an un-ordered collection? I need to store a list of key value pairs of (integer, boolean) in.NET When I use a dictionary it re-orders them. Is there a built in collection that will handle this.
TITLE: How do you store an Integer and Boolean key value pair in an un-ordered collection? QUESTION: I need to store a list of key value pairs of (integer, boolean) in.NET When I use a dictionary it re-orders them. Is there a built in collection that will handle this. ANSWER: List > l = new List >(); l.Add(new KeyVal...
[ ".net" ]
1
8
3,180
7
0
2008-09-28T21:10:14.747000
2008-09-28T21:12:49.920000
146,745
146,883
Why are user created namespaces not being recognized by Visual Studio 2008?
For some reason when I create a new namespace in Visual Studio 2008 its not being recognized. I'm using asp.net mvc, I don't know if that has anything to do with it. Has anyone come across this before?...and how do you fix it? Also is there a way to force Visual Studio to maybe re-examine new namespaces? Answer: I figu...
Not sure how this happened but the build property for this class file was set to "content". The compiler didn't see the new namespace. As soon as I set it to "compile", it worked fine. Weird!
Why are user created namespaces not being recognized by Visual Studio 2008? For some reason when I create a new namespace in Visual Studio 2008 its not being recognized. I'm using asp.net mvc, I don't know if that has anything to do with it. Has anyone come across this before?...and how do you fix it? Also is there a w...
TITLE: Why are user created namespaces not being recognized by Visual Studio 2008? QUESTION: For some reason when I create a new namespace in Visual Studio 2008 its not being recognized. I'm using asp.net mvc, I don't know if that has anything to do with it. Has anyone come across this before?...and how do you fix it?...
[ "visual-studio-2008" ]
2
8
4,365
3
0
2008-09-28T21:11:36.567000
2008-09-28T22:18:03.197000
146,750
146,776
Any reason to have SQL Server 2005 and 2008 installed on same machine?
I'm setting up a new development server and want to install the latest version of SQL Server 2008 Express. Will our existing sql2005 databases work with 2008 without modification? If so is there any reason to install both versions on the same server?
I haven't actually tried migrating a 2005 database to 2008, but generally SQL handles this cleanly and without difficulty. The simplest way to do it would be to make a backup of your database from SQL 2005 and then restore that backup with SQL 2008. If you want to keep the SQL 2005 copy around and online until you know...
Any reason to have SQL Server 2005 and 2008 installed on same machine? I'm setting up a new development server and want to install the latest version of SQL Server 2008 Express. Will our existing sql2005 databases work with 2008 without modification? If so is there any reason to install both versions on the same server...
TITLE: Any reason to have SQL Server 2005 and 2008 installed on same machine? QUESTION: I'm setting up a new development server and want to install the latest version of SQL Server 2008 Express. Will our existing sql2005 databases work with 2008 without modification? If so is there any reason to install both versions ...
[ "sql-server-2005", "sql-server-2008", "installation", "compatibility" ]
5
4
7,414
6
0
2008-09-28T21:12:35.927000
2008-09-28T21:23:26.900000
146,766
146,894
What SNMP library for .NET makes traps, sets or gets simple?
What are the best SNMP libraries to use with.NET? Specifically for listening for traps or sending set or get requests.
I am using the Sharp SNMP Suite (#SNMP): LGPL, Mono compatible, developed in C# 3.0, has very good API.
What SNMP library for .NET makes traps, sets or gets simple? What are the best SNMP libraries to use with.NET? Specifically for listening for traps or sending set or get requests.
TITLE: What SNMP library for .NET makes traps, sets or gets simple? QUESTION: What are the best SNMP libraries to use with.NET? Specifically for listening for traps or sending set or get requests. ANSWER: I am using the Sharp SNMP Suite (#SNMP): LGPL, Mono compatible, developed in C# 3.0, has very good API.
[ ".net", "networking", "network-protocols", "snmp" ]
15
9
10,479
4
0
2008-09-28T21:18:16.053000
2008-09-28T22:25:11.010000
146,777
146,837
In what namespace should you put interfaces relative to their implementors?
Specifically, when you create an interface/implementor pair, and there is no overriding organizational concern (such as the interface should go in a different assembly ie, as recommended by the s# architecture) do you have a default way of organizing them in your namespace/naming scheme? This is obviously a more opinio...
The answer depends on your intentions. If you intend the consumer of your namespaces to use the interfaces over the concrete implementations, I would recommend having your interfaces in the top-level namespace with the implementations in a child namespace If the consumer is to use both, have them in the same namespace....
In what namespace should you put interfaces relative to their implementors? Specifically, when you create an interface/implementor pair, and there is no overriding organizational concern (such as the interface should go in a different assembly ie, as recommended by the s# architecture) do you have a default way of orga...
TITLE: In what namespace should you put interfaces relative to their implementors? QUESTION: Specifically, when you create an interface/implementor pair, and there is no overriding organizational concern (such as the interface should go in a different assembly ie, as recommended by the s# architecture) do you have a d...
[ "oop", "interface", "namespaces" ]
14
21
6,073
10
0
2008-09-28T21:23:55.713000
2008-09-28T21:55:21.907000
146,789
146,833
In Django, where is the best place to put short snippets of HTML-formatted data?
This question is related to (but perhaps not quite the same as): Does Django have HTML helpers? My problem is this: In Django, I am constantly reproducing the basic formatting for low-level database objects. Here's an example: I have two classes, Person and Address. There are multiple Addresses for each Person, setup l...
Sounds like an inclusion tag is what you're looking for. You could have a template and tag for each major variation and use the tag's arguments to customise the context for each template as required. Basic tag definition: @register.inclusion_tag('person/address.html') def display_address(address): return {'address': ad...
In Django, where is the best place to put short snippets of HTML-formatted data? This question is related to (but perhaps not quite the same as): Does Django have HTML helpers? My problem is this: In Django, I am constantly reproducing the basic formatting for low-level database objects. Here's an example: I have two c...
TITLE: In Django, where is the best place to put short snippets of HTML-formatted data? QUESTION: This question is related to (but perhaps not quite the same as): Does Django have HTML helpers? My problem is this: In Django, I am constantly reproducing the basic formatting for low-level database objects. Here's an exa...
[ "python", "django", "model-view-controller", "design-patterns" ]
9
13
706
3
0
2008-09-28T21:31:21.887000
2008-09-28T21:53:27.140000
146,794
1,412,194
Any way to un-register a WPF dependency property?
I'm running into an unusual problem in my unit tests. The class I'm testing creates a dependency property dynamically at runtime and the type of that dependency property can vary depending on the circumstances. While writing my unit tests, I need to create the dependency property with different types and that leads to ...
I had similar issue just yesterday when trying to test my own DependencyProperty creating class. I came across this question, and noticed there was no real solution to unregister dependency properties. So I did some digging using Red Gate.NET Reflector to see what I could come up with. Looking at the DependencyProperty...
Any way to un-register a WPF dependency property? I'm running into an unusual problem in my unit tests. The class I'm testing creates a dependency property dynamically at runtime and the type of that dependency property can vary depending on the circumstances. While writing my unit tests, I need to create the dependenc...
TITLE: Any way to un-register a WPF dependency property? QUESTION: I'm running into an unusual problem in my unit tests. The class I'm testing creates a dependency property dynamically at runtime and the type of that dependency property can vary depending on the circumstances. While writing my unit tests, I need to cr...
[ ".net", "wpf", "dependency-properties" ]
10
9
8,210
6
0
2008-09-28T21:35:24.797000
2009-09-11T17:13:56.540000
146,795
146,932
How to read config file entries from an INI file
I can't use the Get*Profile functions because I'm using an older version of the Windows CE platform SDK which doesn't have those. It doesn't have to be too general. [section] name = some string I just need to open the file, check for the existence of "section", and the value associated with "name". Standard C++ is pref...
What I came up with: std::wifstream file(L"\\Windows\\myini.ini"); if (file) { bool section=false; while (!file.eof()) { WCHAR _line[256]; file.getline(_line, ELEMENTS(_line)); std::wstringstream lineStm(_line); std::wstring &line=lineStm.str(); if (line.empty()) continue; switch (line[0]) { // new header case L'[': {...
How to read config file entries from an INI file I can't use the Get*Profile functions because I'm using an older version of the Windows CE platform SDK which doesn't have those. It doesn't have to be too general. [section] name = some string I just need to open the file, check for the existence of "section", and the v...
TITLE: How to read config file entries from an INI file QUESTION: I can't use the Get*Profile functions because I'm using an older version of the Windows CE platform SDK which doesn't have those. It doesn't have to be too general. [section] name = some string I just need to open the file, check for the existence of "s...
[ "c++", "parsing", "ini" ]
0
2
4,317
2
0
2008-09-28T21:35:25.480000
2008-09-28T22:47:28.787000
146,801
146,831
How do I rename a SharePoint virtual machine
I am using virtual machines for development,but each time I need a new VM, I copy the file and create a new server, but I need a new name for the server to add it to our network. After renaming the server, the Sharepoint sites have many errors and do not run.
Here is a Technet article that might be helpful: http://technet.microsoft.com/en-us/library/cc261986.aspx If you are going to uninstall SharePoint check this article for more details about SQL Server rename: http://technet.microsoft.com/en-us/library/ms143799.aspx
How do I rename a SharePoint virtual machine I am using virtual machines for development,but each time I need a new VM, I copy the file and create a new server, but I need a new name for the server to add it to our network. After renaming the server, the Sharepoint sites have many errors and do not run.
TITLE: How do I rename a SharePoint virtual machine QUESTION: I am using virtual machines for development,but each time I need a new VM, I copy the file and create a new server, but I need a new name for the server to add it to our network. After renaming the server, the Sharepoint sites have many errors and do not ru...
[ "sharepoint", "moss", "rename", "virtual-machine" ]
5
1
2,480
3
0
2008-09-28T21:39:52.070000
2008-09-28T21:52:58.747000
146,805
146,822
Googlebot + IFrames?
How does googlebot treat iframes? Does it follow the src attribute like a link? Is the iframe content analyzed as if it was part of the page where it is included?
IFrames are sometimes used to display content on web pages. Content displayed via iFrames may not be indexed and available to appear in Google's search results. We recommend that you avoid the use of iFrames to display content. If you do include iFrames, make sure to provide additional text-based links to the content t...
Googlebot + IFrames? How does googlebot treat iframes? Does it follow the src attribute like a link? Is the iframe content analyzed as if it was part of the page where it is included?
TITLE: Googlebot + IFrames? QUESTION: How does googlebot treat iframes? Does it follow the src attribute like a link? Is the iframe content analyzed as if it was part of the page where it is included? ANSWER: IFrames are sometimes used to display content on web pages. Content displayed via iFrames may not be indexed ...
[ "iframe", "seo" ]
3
6
3,355
2
0
2008-09-28T21:40:29.790000
2008-09-28T21:44:41.277000
146,815
147,316
Struts2 Annotation-Validators for Invalid Chars
While using Struts2, I am using several annotations to do my validations inside the Model class, in the set() methods, like: @RequiredStringValidator(message = "Name is required") @StringLengthFieldValidator(message = "Name must be between 5 and 60 characters", minLength = "5", maxLength = "60") public void setName(Str...
I found it finally: Just adding the already existent @RegexFieldValidator gave me the Validator I needed: @RegexFieldValidator(message = "Use only Letters or numbers", expression = "^[a-zA-Z0-9]+$") Thanks anyway guys!
Struts2 Annotation-Validators for Invalid Chars While using Struts2, I am using several annotations to do my validations inside the Model class, in the set() methods, like: @RequiredStringValidator(message = "Name is required") @StringLengthFieldValidator(message = "Name must be between 5 and 60 characters", minLength ...
TITLE: Struts2 Annotation-Validators for Invalid Chars QUESTION: While using Struts2, I am using several annotations to do my validations inside the Model class, in the set() methods, like: @RequiredStringValidator(message = "Name is required") @StringLengthFieldValidator(message = "Name must be between 5 and 60 chara...
[ "struts2", "annotations", "validation", "invalid-characters" ]
0
2
1,835
1
0
2008-09-28T21:43:07.553000
2008-09-29T02:25:57.607000
146,835
146,895
The exec family
I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help. int ret; ret = execl ("/bin/ls", "...
The code you wrote works for me in a simple test program that does nothing else. Remember, when you call execl, the process retains all of the old file handles. So whatever stdout was when you call execl, it will be the same when the new binary is loaded. If you just want the output to go to the terminal, just make sur...
The exec family I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help. int ret; ret = exe...
TITLE: The exec family QUESTION: I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help. ...
[ "c", "process", "exec" ]
4
2
939
2
0
2008-09-28T21:53:50.210000
2008-09-28T22:25:17.967000
146,839
146,861
Comprehensive server-side validation
I currently have a fairly robust server-side validation system in place, but I'm looking for some feedback to make sure I've covered all angles. Here is a brief outline of what I'm doing at the moment: Ensure the input is not empty, or is too long Escape query strings to prevent SQL injection Using regular expressions ...
You shouldn't need to "Escape" query strings to prevent SQL injection - you should be using prepared statements instead. Ideally your input filtering will happen before any other processing, so you know it will always be used. Because otherwise you only need to miss one spot to be vulnerable to a problem. Don't forget ...
Comprehensive server-side validation I currently have a fairly robust server-side validation system in place, but I'm looking for some feedback to make sure I've covered all angles. Here is a brief outline of what I'm doing at the moment: Ensure the input is not empty, or is too long Escape query strings to prevent SQL...
TITLE: Comprehensive server-side validation QUESTION: I currently have a fairly robust server-side validation system in place, but I'm looking for some feedback to make sure I've covered all angles. Here is a brief outline of what I'm doing at the moment: Ensure the input is not empty, or is too long Escape query stri...
[ "php", "regex", "validation", "sql-injection", "server-side" ]
3
8
505
5
0
2008-09-28T21:56:16.257000
2008-09-28T22:06:48.993000
146,841
147,278
Why does my "out of the box" SharePoint Navigation look like it is leaking memory
My site has quite a deep navigation structure and quite often it looks like the out of the box navigation is leaking memory, especially the SPWeb objects. The log message looks like Potentially excessive number of SPRequest objects (14) currently unreleased on thread 5. Ensure that this object or its parent (such as an...
Stefan Goßner's blog post seems to answer the question. The issue is not that the SPWeb objects are not being closed, but that once a certain threshold (defaults to 8) of allocations are hit, the warning is created in the log. Depending on your site structure the number that will be created will vary.
Why does my "out of the box" SharePoint Navigation look like it is leaking memory My site has quite a deep navigation structure and quite often it looks like the out of the box navigation is leaking memory, especially the SPWeb objects. The log message looks like Potentially excessive number of SPRequest objects (14) c...
TITLE: Why does my "out of the box" SharePoint Navigation look like it is leaking memory QUESTION: My site has quite a deep navigation structure and quite often it looks like the out of the box navigation is leaking memory, especially the SPWeb objects. The log message looks like Potentially excessive number of SPRequ...
[ "sharepoint", "memory-leaks", "moss", "navigation" ]
3
4
887
1
0
2008-09-28T21:57:11.717000
2008-09-29T02:04:56.707000
146,850
146,886
Is D a credible alternative to Java and C++?
Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing? The main reason I ask is that with the new C++ standard (c++0x) almost here, it's clear to me that the language has gone well past the point of no retu...
What determines the success and popularity of a programming language for real-world software development is only partially related to the quality of the language itself. As a pure language, D arguably has many advantages over C++ and Java. At the very least it is a credible alternative as a pure language, all other thi...
Is D a credible alternative to Java and C++? Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing? The main reason I ask is that with the new C++ standard (c++0x) almost here, it's clear to me that the lan...
TITLE: Is D a credible alternative to Java and C++? QUESTION: Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing? The main reason I ask is that with the new C++ standard (c++0x) almost here, it's clear ...
[ "java", "c++", "c", "d" ]
165
127
45,991
13
0
2008-09-28T22:00:33.470000
2008-09-28T22:20:34.920000
146,873
147,031
How does the UTF-8 support of TinyXML work?
I'm using TinyXML to parse/build XML files. Now, according to the documentation this library supports multibyte character sets through UTF-8. So far so good I think. But, the only API that the library provides (for getting/setting element names, attribute names and values,... everything where a string is used) is throu...
First, utf-8 is stored in const char * strings, as @quinmars said. And it's not only a superset of 7-bit ASCII (code points <= 127 always encoded in a single byte as themselves), it's furthermore careful that bytes with those values are never used as part of the encoding of the multibyte values for code points >= 128. ...
How does the UTF-8 support of TinyXML work? I'm using TinyXML to parse/build XML files. Now, according to the documentation this library supports multibyte character sets through UTF-8. So far so good I think. But, the only API that the library provides (for getting/setting element names, attribute names and values,......
TITLE: How does the UTF-8 support of TinyXML work? QUESTION: I'm using TinyXML to parse/build XML files. Now, according to the documentation this library supports multibyte character sets through UTF-8. So far so good I think. But, the only API that the library provides (for getting/setting element names, attribute na...
[ "c++", "unicode", "utf-8", "tinyxml" ]
12
8
5,354
3
0
2008-09-28T22:12:20.620000
2008-09-28T23:49:50.633000
146,893
264,036
Key concepts to learn in Assembly
I am a firm believer in the idea that one of the most important things you get from learning a new language is not how to use a new language, but the knowledge of concepts that you get from it. I am not asking how important or useful you think Assembly is, nor do I care if I never use it in any of my real projects. Wha...
I think assembly language can teach you lots of little things, as well as a few big concepts. I'll list a few things I can think of here, but there is no substitute for going and learning and using both x86 and a RISC instruction set. You probably think that integer operations are fastest. If you want to find an intege...
Key concepts to learn in Assembly I am a firm believer in the idea that one of the most important things you get from learning a new language is not how to use a new language, but the knowledge of concepts that you get from it. I am not asking how important or useful you think Assembly is, nor do I care if I never use ...
TITLE: Key concepts to learn in Assembly QUESTION: I am a firm believer in the idea that one of the most important things you get from learning a new language is not how to use a new language, but the knowledge of concepts that you get from it. I am not asking how important or useful you think Assembly is, nor do I ca...
[ "theory", "assembly" ]
8
6
3,373
9
0
2008-09-28T22:25:00.137000
2008-11-05T00:49:31.933000
146,896
161,301
How can I access UserId in ASP.NET Membership without using Membership.GetUser()?
How can I access UserId in ASP.NET Membership without using Membership.GetUser(username) in ASP.NET Web Application Project? Can UserId be included in Profile namespace next to UserName ( System.Web.Profile.ProfileBase )?
I decided to write authentication of users users on my own (very simple but it works) and I should done this long time ago. My original question was about UserId and it is not available from: System.Web.HttpContext.Current.User.Identity.Name
How can I access UserId in ASP.NET Membership without using Membership.GetUser()? How can I access UserId in ASP.NET Membership without using Membership.GetUser(username) in ASP.NET Web Application Project? Can UserId be included in Profile namespace next to UserName ( System.Web.Profile.ProfileBase )?
TITLE: How can I access UserId in ASP.NET Membership without using Membership.GetUser()? QUESTION: How can I access UserId in ASP.NET Membership without using Membership.GetUser(username) in ASP.NET Web Application Project? Can UserId be included in Profile namespace next to UserName ( System.Web.Profile.ProfileBase )...
[ "asp.net", "asp.net-membership", "membership" ]
19
4
48,763
11
0
2008-09-28T22:25:27.467000
2008-10-02T08:10:21.577000
146,897
146,925
Error with bindParam overwriting in PHP
This is a bit of a weird one, and I could well be coding this completely wrong - hence why I've hit the same error twice in two days, in completely different parts of a script. The code I'm using is below: public function findAll( $constraints = array() ) { // Select all records $SQL = 'SELECT * FROM '. $this->tableNa...
That's because bindParam works by binding to a variable, and you are re-using the variable ( $value ) for multiple values. Try with bindValue instead. Or even better yet; Pass the values as an array to execute instead. This makes the statement stateless, which is generally a good thing in programming.
Error with bindParam overwriting in PHP This is a bit of a weird one, and I could well be coding this completely wrong - hence why I've hit the same error twice in two days, in completely different parts of a script. The code I'm using is below: public function findAll( $constraints = array() ) { // Select all records...
TITLE: Error with bindParam overwriting in PHP QUESTION: This is a bit of a weird one, and I could well be coding this completely wrong - hence why I've hit the same error twice in two days, in completely different parts of a script. The code I'm using is below: public function findAll( $constraints = array() ) { // ...
[ "php", "pdo" ]
2
10
1,513
2
0
2008-09-28T22:25:27.747000
2008-09-28T22:43:30.623000
146,901
147,024
How to correctly write dynamic files to an FTP server?
I'm using C# and i have written a locally installed application that dynamically generates files which need to be on an FTP server. Do i generate them to disk then upload them to the FTP server? or is there a way to open a stream to an FTP server and write the files directly?
Check the code sample I gave in this answer, doesn't rely on writing to files. It's not SQL specific and was just a suggestion on how to use SQL CLR integration assemblies to upload output from sql queries to an FTP server. The for loop in the method is just to demonstrate writing to the FTP stream. You should be able ...
How to correctly write dynamic files to an FTP server? I'm using C# and i have written a locally installed application that dynamically generates files which need to be on an FTP server. Do i generate them to disk then upload them to the FTP server? or is there a way to open a stream to an FTP server and write the file...
TITLE: How to correctly write dynamic files to an FTP server? QUESTION: I'm using C# and i have written a locally installed application that dynamically generates files which need to be on an FTP server. Do i generate them to disk then upload them to the FTP server? or is there a way to open a stream to an FTP server ...
[ "c#", "ftp" ]
1
1
1,945
4
0
2008-09-28T22:28:29.643000
2008-09-28T23:43:38.513000
146,906
146,926
Top & httpd - demystifying what is actually running
I often use the "top" command to see what is taking up resources. Mostly it comes up with a long list of Apache httpd processes, which is not very useful. Is there any way to see a similar list, but such that I could see which PHP scripts etc. those httpd processes are actually running?
If you're concerned about long running processes (i.e. requests that take more than a second or two to execute), you'll be able to get an idea of them using Apache's mod_status. See the documentation, and an example of the output (from www.apache.org). This isn't unique to PHP, but applies to anything running inside an...
Top & httpd - demystifying what is actually running I often use the "top" command to see what is taking up resources. Mostly it comes up with a long list of Apache httpd processes, which is not very useful. Is there any way to see a similar list, but such that I could see which PHP scripts etc. those httpd processes ar...
TITLE: Top & httpd - demystifying what is actually running QUESTION: I often use the "top" command to see what is taking up resources. Mostly it comes up with a long list of Apache httpd processes, which is not very useful. Is there any way to see a similar list, but such that I could see which PHP scripts etc. those ...
[ "process", "apache" ]
3
4
4,459
4
0
2008-09-28T22:31:11.043000
2008-09-28T22:43:44.553000
146,914
146,933
What is MySQL mostly doing?
Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL?
Yes, mysql can create a slow query log. You'll need to start mysqld with the --log-slow-queries flag: mysqld --log-slow-queries=/path/to/your.log Then you can parse the log using mysqldumpslow: mysqldumpslow /path/to/your.log More info is here ( http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html ).
What is MySQL mostly doing? Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL?
TITLE: What is MySQL mostly doing? QUESTION: Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL? ANSWER: Yes, mysql can create a slow query log. You'll need to start mysqld with the --log-slow-queries flag: mysqld --log-slow-queries=/path/to/your.log Then you can...
[ "mysql" ]
2
5
446
3
0
2008-09-28T22:36:55.537000
2008-09-28T22:47:36.337000
146,916
146,928
Javascript Events: Getting notified of changes in an <input> control value
I have the following problem: I have an HTML textbox ( ) whose contents are modified by a script I cannot touch (it is my page, but i'm using external components). I want to be notified in my script every time the value of that textbox changes, so I can react to it. I've tried this: txtStartDate.observe('change', funct...
As you've implied, change (and other events) only fire when the user takes some action. A script modifying things won't fire any events. Your only solution is to find some hook into the control that you can hook up to your listener. Here is how I would do it: basicDatePicker.selectDate = basicDatePicker.selectDate.wrap...
Javascript Events: Getting notified of changes in an <input> control value I have the following problem: I have an HTML textbox ( ) whose contents are modified by a script I cannot touch (it is my page, but i'm using external components). I want to be notified in my script every time the value of that textbox changes, ...
TITLE: Javascript Events: Getting notified of changes in an <input> control value QUESTION: I have the following problem: I have an HTML textbox ( ) whose contents are modified by a script I cannot touch (it is my page, but i'm using external components). I want to be notified in my script every time the value of that...
[ "javascript", "html", "events" ]
8
5
14,688
6
0
2008-09-28T22:37:35.147000
2008-09-28T22:44:41.663000
146,924
146,934
How can I tell if a given path is a directory or a file? (C/C++)
I'm using C and sometimes I have to handle paths like C:\Whatever C:\Whatever\ C:\Whatever\Somefile Is there a way to check if a given path is a directory or a given path is a file?
Call GetFileAttributes, and check for the FILE_ATTRIBUTE_DIRECTORY attribute.
How can I tell if a given path is a directory or a file? (C/C++) I'm using C and sometimes I have to handle paths like C:\Whatever C:\Whatever\ C:\Whatever\Somefile Is there a way to check if a given path is a directory or a given path is a file?
TITLE: How can I tell if a given path is a directory or a file? (C/C++) QUESTION: I'm using C and sometimes I have to handle paths like C:\Whatever C:\Whatever\ C:\Whatever\Somefile Is there a way to check if a given path is a directory or a given path is a file? ANSWER: Call GetFileAttributes, and check for the FILE...
[ "c++", "c", "winapi" ]
54
35
104,255
8
0
2008-09-28T22:42:10.250000
2008-09-28T22:47:41.890000
146,931
150,366
Should I not subclass by type of object if there are many types?
I am working with a log of events where there are about 60 different "types" of events. Each event shares about 10 properties, and then there are subcategories of events that share various extra properties. How I work with these events does depend on their type or what categorical interfaces they implement. But it seem...
It depends on if each type of event inherently has different behavior that the event itself can execute. Do your Event objects need methods that behave differently per type? If so, use inheritance. If not, use an enum to classify the event type.
Should I not subclass by type of object if there are many types? I am working with a log of events where there are about 60 different "types" of events. Each event shares about 10 properties, and then there are subcategories of events that share various extra properties. How I work with these events does depend on thei...
TITLE: Should I not subclass by type of object if there are many types? QUESTION: I am working with a log of events where there are about 60 different "types" of events. Each event shares about 10 properties, and then there are subcategories of events that share various extra properties. How I work with these events d...
[ "java", "design-patterns", "inheritance" ]
1
0
544
6
0
2008-09-28T22:46:52.923000
2008-09-29T19:54:12.580000
146,936
146,951
What can you do to a legacy codebase that will have the greatest impact on improving the quality?
As you work in a legacy codebase what will have the greatest impact over time that will improve the quality of the codebase? Remove unused code Remove duplicated code Add unit tests to improve test coverage where coverage is low Create consistent formatting across files Update 3rd party software Reduce warnings generat...
Read Michael Feather's book "Working effectively with Legacy Code" This is a GREAT book. If you don't like that answer, then the best advice I can give would be: First, stop making new legacy code[1] [1]: Legacy code = code without unit tests and therefore an unknown Changing legacy code without an automated test suite...
What can you do to a legacy codebase that will have the greatest impact on improving the quality? As you work in a legacy codebase what will have the greatest impact over time that will improve the quality of the codebase? Remove unused code Remove duplicated code Add unit tests to improve test coverage where coverage ...
TITLE: What can you do to a legacy codebase that will have the greatest impact on improving the quality? QUESTION: As you work in a legacy codebase what will have the greatest impact over time that will improve the quality of the codebase? Remove unused code Remove duplicated code Add unit tests to improve test covera...
[ "refactoring", "legacy", "legacy-code" ]
39
37
4,875
11
0
2008-09-28T22:49:46.317000
2008-09-28T22:57:03.757000
146,943
147,169
Help improve this INI parsing code
This is something simple I came up with for this question. I'm not entirely happy with it and I saw it as a chance to help improve my use of STL and streams based programming. std::wifstream file(L"\\Windows\\myini.ini"); if (file) { bool section=false; while (!file.eof()) { std::wstring line; std::getline(file, line);...
// what if the name = value does not have white space? // what if the value is enclosed in quotes? I would use boost::regex to match for every different type of element, something like: boost::smatch matches; boost::regex name_value("(\S+)\s*=\s*(\S+)"); if(boost::regex_match(line, matches, name_value)) { name = matche...
Help improve this INI parsing code This is something simple I came up with for this question. I'm not entirely happy with it and I saw it as a chance to help improve my use of STL and streams based programming. std::wifstream file(L"\\Windows\\myini.ini"); if (file) { bool section=false; while (!file.eof()) { std::wstr...
TITLE: Help improve this INI parsing code QUESTION: This is something simple I came up with for this question. I'm not entirely happy with it and I saw it as a chance to help improve my use of STL and streams based programming. std::wifstream file(L"\\Windows\\myini.ini"); if (file) { bool section=false; while (!file....
[ "c++", "stl", "stream", "ini" ]
1
3
1,743
3
0
2008-09-28T22:52:41.537000
2008-09-29T01:18:10.283000
146,963
147,148
Should I be extending this class? (PHP)
I'm creating an ORM in PHP, and I've got a class 'ORM' which basically creates an object corresponding to a database table (I'm aiming for similar to/same functionality as an ActiveRecord pattern.) ORM itself extends 'Database', which sets up the database connection. So, I can call: $c = new Customer(); $c->name = 'Joh...
I agree with the other answers here - put the additional methods into a descendant class. I'd also add an asterisk to that though: each time you extend the class with extra methods, think about what you are trying to achieve with the extension, and think about whether or not it can be generalised and worked back into t...
Should I be extending this class? (PHP) I'm creating an ORM in PHP, and I've got a class 'ORM' which basically creates an object corresponding to a database table (I'm aiming for similar to/same functionality as an ActiveRecord pattern.) ORM itself extends 'Database', which sets up the database connection. So, I can ca...
TITLE: Should I be extending this class? (PHP) QUESTION: I'm creating an ORM in PHP, and I've got a class 'ORM' which basically creates an object corresponding to a database table (I'm aiming for similar to/same functionality as an ActiveRecord pattern.) ORM itself extends 'Database', which sets up the database connec...
[ "php", "oop", "orm", "activerecord" ]
2
3
1,129
8
0
2008-09-28T23:04:02.477000
2008-09-29T01:04:17.883000
146,970
146,978
Can SQLExpress 2005 and 2008 be installed on same machine without issue?
I would like to install SQLExpress2005 as an instance "SQLExpress" and install SQLExpresss2008 as "SQLExpress2008" instance. Is there any problem with doing this on the same machine?
As Long as you give them distinct names, there shouldn't be any problems. The binaries are stored in directories based on version, and you can (and should) point their filegroups at different locations. This should also apply to the Full versions.
Can SQLExpress 2005 and 2008 be installed on same machine without issue? I would like to install SQLExpress2005 as an instance "SQLExpress" and install SQLExpresss2008 as "SQLExpress2008" instance. Is there any problem with doing this on the same machine?
TITLE: Can SQLExpress 2005 and 2008 be installed on same machine without issue? QUESTION: I would like to install SQLExpress2005 as an instance "SQLExpress" and install SQLExpresss2008 as "SQLExpress2008" instance. Is there any problem with doing this on the same machine? ANSWER: As Long as you give them distinct nam...
[ "sql-server-2005", "sql-server-2008", "installation" ]
3
1
6,166
3
0
2008-09-28T23:08:22.560000
2008-09-28T23:14:58.190000
146,973
147,006
Powershell script to download file, having trouble setting up a secure connection
I'm making an automated script to read a list from a site posting the latest compiled code. That's the part I've already figured out. The next part of the script is to grab that compiled code from a server with an Untrusted Cert. This is how I'm going about grabbing the file: $web = new-object System.Net.WebClient $web...
You need to write a callback handler for ServicePointManager.ServerCertificateValidationCallback.
Powershell script to download file, having trouble setting up a secure connection I'm making an automated script to read a list from a site posting the latest compiled code. That's the part I've already figured out. The next part of the script is to grab that compiled code from a server with an Untrusted Cert. This is ...
TITLE: Powershell script to download file, having trouble setting up a secure connection QUESTION: I'm making an automated script to read a list from a site posting the latest compiled code. That's the part I've already figured out. The next part of the script is to grab that compiled code from a server with an Untrus...
[ "powershell" ]
10
3
9,538
4
0
2008-09-28T23:10:03.663000
2008-09-28T23:35:08.627000
146,980
147,004
Search Engines Inexact Counting (about xxx results)
When you search in Google (i'm almost sure that Altavista did the same thing) it says "Results 1-10 of about xxxx"... This has always amazed me... What does it mean "about"? How can they count roughly? I do understand why they can't come up with a precise figure in a reasonable time, but how do they even reach this "ap...
Most likely it's similar to the sort of estimated row counts used by most SQL systems in their query planning; a number of rows in the table (known exactly as of the last time statistics were collected, but generally not up-to-date), multiplied by an estimated selectivity (usually based on a sort of statistical distrib...
Search Engines Inexact Counting (about xxx results) When you search in Google (i'm almost sure that Altavista did the same thing) it says "Results 1-10 of about xxxx"... This has always amazed me... What does it mean "about"? How can they count roughly? I do understand why they can't come up with a precise figure in a ...
TITLE: Search Engines Inexact Counting (about xxx results) QUESTION: When you search in Google (i'm almost sure that Altavista did the same thing) it says "Results 1-10 of about xxxx"... This has always amazed me... What does it mean "about"? How can they count roughly? I do understand why they can't come up with a pr...
[ "algorithm", "search-engine", "information-retrieval", "counting" ]
2
2
1,982
5
0
2008-09-28T23:19:02.737000
2008-09-28T23:34:26.490000
146,986
147,027
What #defines are set up by Xcode when compiling for iPhone
I'm writing some semi-portable code and want to be able to detect when I'm compiling for iPhone. So I want something like #ifdef IPHONE_SDK.... Presumably Xcode defines something, but I can't see anything under project properties, and Google isn't much help.
It's in the SDK docs under "Compiling source code conditionally" The relevant definitions are TARGET_OS_IPHONE (and he deprecated TARGET_IPHONE_SIMULATOR), which are defined in /usr/include/TargetConditionals.h within the iOS framework. On earlier versions of the toolchain, you had to write: #include "TargetConditional...
What #defines are set up by Xcode when compiling for iPhone I'm writing some semi-portable code and want to be able to detect when I'm compiling for iPhone. So I want something like #ifdef IPHONE_SDK.... Presumably Xcode defines something, but I can't see anything under project properties, and Google isn't much help.
TITLE: What #defines are set up by Xcode when compiling for iPhone QUESTION: I'm writing some semi-portable code and want to be able to detect when I'm compiling for iPhone. So I want something like #ifdef IPHONE_SDK.... Presumably Xcode defines something, but I can't see anything under project properties, and Google ...
[ "ios", "xcode", "macos", "conditional-compilation" ]
67
116
33,659
3
0
2008-09-28T23:25:34.187000
2008-09-28T23:47:20.047000
147,033
147,042
When creating a web control should you override OnLoad or implement Page_Load
When you create a new web user control in visual studio it by default adds the Page_Load event. What is the advantage to using this rather than overriding the base OnLoad event on the control? Is it just that the Page_Load event fires before OnLoad?
The OnLoad method should be the place where the Load event is raised. I personally always try to handle the event unless I need to do extra processing around raising the event. I recommend handling the event itself under normal circumstances.
When creating a web control should you override OnLoad or implement Page_Load When you create a new web user control in visual studio it by default adds the Page_Load event. What is the advantage to using this rather than overriding the base OnLoad event on the control? Is it just that the Page_Load event fires before ...
TITLE: When creating a web control should you override OnLoad or implement Page_Load QUESTION: When you create a new web user control in visual studio it by default adds the Page_Load event. What is the advantage to using this rather than overriding the base OnLoad event on the control? Is it just that the Page_Load e...
[ ".net", "asp.net", "web-controls" ]
9
5
8,462
7
0
2008-09-28T23:54:56.347000
2008-09-29T00:06:20.220000
147,040
147,043
Automatically adding specified text at beginning of files in VS 2008
Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.
I assume you'd like to modify the class file templates. They're in: %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033 More specific details here
Automatically adding specified text at beginning of files in VS 2008 Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.
TITLE: Automatically adding specified text at beginning of files in VS 2008 QUESTION: Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me....
[ "visual-studio", "visual-studio-2008" ]
3
4
263
2
0
2008-09-29T00:03:52.630000
2008-09-29T00:06:36.320000
147,049
147,682
Is it correct to use inheritance instead of name aliasing in c#?
In other words, is it correct to use: public class CustomerList: System.Collections.Generic.List { /// supposed to be empty } instead of: using CustomerList = System.Collections.Generic.List I'd rather use the first approach because I'd just define CustomerList once, and every time I needed a customer list I'd always u...
Don't do it. When people read: List they immediately understand it. When they read: CustomerList they have to go and figure out what a CustomerList is, and that makes your code harder to read. Unless you are the only one working on your codebase, writing readable code is a good idea.
Is it correct to use inheritance instead of name aliasing in c#? In other words, is it correct to use: public class CustomerList: System.Collections.Generic.List { /// supposed to be empty } instead of: using CustomerList = System.Collections.Generic.List I'd rather use the first approach because I'd just define Custom...
TITLE: Is it correct to use inheritance instead of name aliasing in c#? QUESTION: In other words, is it correct to use: public class CustomerList: System.Collections.Generic.List { /// supposed to be empty } instead of: using CustomerList = System.Collections.Generic.List I'd rather use the first approach because I'd ...
[ "c#", "inheritance", "alias", "typedef" ]
6
7
1,186
9
0
2008-09-29T00:12:16.697000
2008-09-29T06:09:13.420000
147,052
147,059
REGEX: Grabbing everything until a specific word
ex: example data in here I want everything inside the a tag, to the end / ([^<]*)<\/a>/ It works when there are no additional tags within the tag, but what if there are? I want to know if you can tell it to grab everything up to [^ ] instead of [^<] only. Doing it with / (.*)<\/a>/ doesn't work well. Sometimes I get ev...
/ (.*?)<\/a>/ should work. The? makes it lazy, so it grabs as little as possible before matching the part. but using. will mean that it matches everything until it finds. If you want to be able to match across lines, you can use the following if with preg_match / (.*?)<\/a>/s The "s" at the end puts the regular express...
REGEX: Grabbing everything until a specific word ex: example data in here I want everything inside the a tag, to the end / ([^<]*)<\/a>/ It works when there are no additional tags within the tag, but what if there are? I want to know if you can tell it to grab everything up to [^ ] instead of [^<] only. Doing it with /...
TITLE: REGEX: Grabbing everything until a specific word QUESTION: ex: example data in here I want everything inside the a tag, to the end / ([^<]*)<\/a>/ It works when there are no additional tags within the tag, but what if there are? I want to know if you can tell it to grab everything up to [^ ] instead of [^<] onl...
[ "php", "html", "regex" ]
32
79
45,989
1
0
2008-09-29T00:14:39.547000
2008-09-29T00:17:36.620000
147,062
147,127
Does iPhone support XML-RPC?
Does iPhone support XML-RPC, Is their any open source framework which I can use?
Checkout the source for the wordpress app. They might be using XML-RPC.:) http://iphone.wordpress.org/
Does iPhone support XML-RPC? Does iPhone support XML-RPC, Is their any open source framework which I can use?
TITLE: Does iPhone support XML-RPC? QUESTION: Does iPhone support XML-RPC, Is their any open source framework which I can use? ANSWER: Checkout the source for the wordpress app. They might be using XML-RPC.:) http://iphone.wordpress.org/
[ "iphone", "xml-rpc" ]
6
15
9,562
3
0
2008-09-29T00:19:56.240000
2008-09-29T00:52:39.237000
147,083
147,090
How can a service control its own state?
I have a standard windows server that inherits from the ServiceBase class. On the OnStart method I want to check for certain conditions before I get to the main purpose of what my service does. For example: protected override void OnStart(string[] args) { if (condition == false) { EventLog.WriteEntry("Pre-condition not...
Throw an Exception. This will cause the services MMC to get an error - and the exception message and stack will automatically be logged to the event log. I use ApplicationException in this case. In addition, the service will return to the "not running" state. If you need to stop later on, you can call the Stop method o...
How can a service control its own state? I have a standard windows server that inherits from the ServiceBase class. On the OnStart method I want to check for certain conditions before I get to the main purpose of what my service does. For example: protected override void OnStart(string[] args) { if (condition == false)...
TITLE: How can a service control its own state? QUESTION: I have a standard windows server that inherits from the ServiceBase class. On the OnStart method I want to check for certain conditions before I get to the main purpose of what my service does. For example: protected override void OnStart(string[] args) { if (c...
[ "c#" ]
0
0
251
2
0
2008-09-29T00:30:29.460000
2008-09-29T00:32:45.820000
147,084
147,099
How are permissions inherited on an Ubuntu Server?
Sorry for the second newbie question, I'm a developer not a sysadmin so this is all quite new to me. I hope I can explain myself clearly! Here goes. Here's what I did: Logged into the root account Created the accounts 'richard' and 'austin' Created the group 'developers', and added 'richard' and 'austin' to it Created ...
Looks like you want to use "chmod g+s" or "chmode 2775" to get the SetGID bit set on the directory, that should preserve the group if I remember my permission modes properly.
How are permissions inherited on an Ubuntu Server? Sorry for the second newbie question, I'm a developer not a sysadmin so this is all quite new to me. I hope I can explain myself clearly! Here goes. Here's what I did: Logged into the root account Created the accounts 'richard' and 'austin' Created the group 'developer...
TITLE: How are permissions inherited on an Ubuntu Server? QUESTION: Sorry for the second newbie question, I'm a developer not a sysadmin so this is all quite new to me. I hope I can explain myself clearly! Here goes. Here's what I did: Logged into the root account Created the accounts 'richard' and 'austin' Created th...
[ "ubuntu", "system-administration" ]
0
4
1,583
4
0
2008-09-29T00:30:34.890000
2008-09-29T00:36:27.077000
147,100
147,113
Are there any free ways to turn an html page into an image with .net
I want to take html, including the text and images and turn it into one image containing everything. Is there a free way to do it? This is using.net 3.5. See also: Server Generated web screenshots? What is the best way to create a web page thumbnail?
You might check out this project or this page. Hope that helps.
Are there any free ways to turn an html page into an image with .net I want to take html, including the text and images and turn it into one image containing everything. Is there a free way to do it? This is using.net 3.5. See also: Server Generated web screenshots? What is the best way to create a web page thumbnail?
TITLE: Are there any free ways to turn an html page into an image with .net QUESTION: I want to take html, including the text and images and turn it into one image containing everything. Is there a free way to do it? This is using.net 3.5. See also: Server Generated web screenshots? What is the best way to create a we...
[ ".net", "rendering", "screenshot", "html" ]
8
8
1,627
2
0
2008-09-29T00:36:29.820000
2008-09-29T00:43:27.823000
147,104
147,167
What's a solid, full-featured open rich text representation usable on the Web?
I'm looking for an internal representation format for text, which would support basic formatting (font face, size, weight, indentation, basic tables, also supporting the following features: Bidirectional input (Hebrew, Arabic, etc.) Multi-language input (i.e. UTF-8) in same text field Anchored footnotes (i.e. a supersc...
FCKeditor has a great API, supports several programming languages (considering it is javascript this isn't hard to achieve), can be loaded through HTML or instantiated in code; but most of all, allows easy access to the underlying form field, so having a jQuery or prototype ajax buffer shouldn't be terribly difficult t...
What's a solid, full-featured open rich text representation usable on the Web? I'm looking for an internal representation format for text, which would support basic formatting (font face, size, weight, indentation, basic tables, also supporting the following features: Bidirectional input (Hebrew, Arabic, etc.) Multi-la...
TITLE: What's a solid, full-featured open rich text representation usable on the Web? QUESTION: I'm looking for an internal representation format for text, which would support basic formatting (font face, size, weight, indentation, basic tables, also supporting the following features: Bidirectional input (Hebrew, Arab...
[ "editor", "wysiwyg", "richtext" ]
8
5
885
5
0
2008-09-29T00:37:51.610000
2008-09-29T01:17:15.730000
147,125
512,239
Why do discussions of "swappiness" act like information can only be in one place at a time?
I've been reading up on Linux's "swappiness" tuneable, which controls how aggressive the kernel is about swapping applications' memory to disk when they're not being used. If you Google the term, you get a lot of pages like this discussing the pros and cons. In a nutshell, the argument goes like this: If your swappines...
According to this 1 that is exactly what Linux does. I'm still trying to make sense of a lot of this, so any authoritative links would be appreciated.
Why do discussions of "swappiness" act like information can only be in one place at a time? I've been reading up on Linux's "swappiness" tuneable, which controls how aggressive the kernel is about swapping applications' memory to disk when they're not being used. If you Google the term, you get a lot of pages like this...
TITLE: Why do discussions of "swappiness" act like information can only be in one place at a time? QUESTION: I've been reading up on Linux's "swappiness" tuneable, which controls how aggressive the kernel is about swapping applications' memory to disk when they're not being used. If you Google the term, you get a lot ...
[ "linux", "memory", "operating-system", "performance" ]
4
0
1,785
4
0
2008-09-29T00:49:49.553000
2009-02-04T16:57:09.167000
147,129
147,407
c# downcasting when binding to and interface
Is there a better way of binding a list of base class to a UI other than downcasting e.g: static void Main(string[] args) { List list = new List (); Pig p = new Pig(5); Dog d = new Dog("/images/dog1.jpg"); list.Add(p); list.Add(d); foreach (Animal a in list) { DoPigStuff(a as Pig); DoDogStuff(a as Dog); } } static vo...
When faced with this type of problem, I follow the visitor pattern. interface IVisitor { void DoPigStuff(Piggy p); void DoDogStuff(Doggy d); } class GuiVisitor: IVisitor { void DoPigStuff(Piggy p) { label1.Text = String.Format("The pigs tail is {0}", p.TailLength); } void DoDogStuff(Doggy d) { Image1.src = d.Image; }...
c# downcasting when binding to and interface Is there a better way of binding a list of base class to a UI other than downcasting e.g: static void Main(string[] args) { List list = new List (); Pig p = new Pig(5); Dog d = new Dog("/images/dog1.jpg"); list.Add(p); list.Add(d); foreach (Animal a in list) { DoPigStuff(a a...
TITLE: c# downcasting when binding to and interface QUESTION: Is there a better way of binding a list of base class to a UI other than downcasting e.g: static void Main(string[] args) { List list = new List (); Pig p = new Pig(5); Dog d = new Dog("/images/dog1.jpg"); list.Add(p); list.Add(d); foreach (Animal a in list...
[ "c#", "casting", "oop" ]
3
6
3,532
6
0
2008-09-29T00:53:02.323000
2008-09-29T03:29:47.907000
147,130
147,137
Why doesn't C++ have a garbage collector?
I'm not asking this question because of the merits of garbage collection first of all. My main reason for asking this is that I do know that Bjarne Stroustrup has said that C++ will have a garbage collector at some point in time. With that said, why hasn't it been added? There are already some garbage collectors for C+...
Implicit garbage collection could have been added in, but it just didn't make the cut. Probably due to not just implementation complications, but also due to people not being able to come to a general consensus fast enough. A quote from Bjarne Stroustrup himself: I had hoped that a garbage collector which could be opti...
Why doesn't C++ have a garbage collector? I'm not asking this question because of the merits of garbage collection first of all. My main reason for asking this is that I do know that Bjarne Stroustrup has said that C++ will have a garbage collector at some point in time. With that said, why hasn't it been added? There ...
TITLE: Why doesn't C++ have a garbage collector? QUESTION: I'm not asking this question because of the merits of garbage collection first of all. My main reason for asking this is that I do know that Bjarne Stroustrup has said that C++ will have a garbage collector at some point in time. With that said, why hasn't it ...
[ "c++", "garbage-collection", "c++11" ]
306
182
220,403
16
0
2008-09-29T00:53:20.733000
2008-09-29T00:58:30.970000
147,154
156,224
Easy way to scroll overflow text on a button?
Does anyone have any examples or resources where i might find information on scrolling text which is too long to display in a button control? I'm thinking something along these lines. Display as much text will fit within the current rect with a '...' at the end to signify overflow. Pause for say 1 second then slowly sc...
Here's an idea: instead of ellipses (...), use a gradient on each side, so the extra text fades away into the background color. Then you could do this with three CALayers: one for the text and two for fade effect. The fade masks would just be rectangles with a gradient that goes from transparent to the background color...
Easy way to scroll overflow text on a button? Does anyone have any examples or resources where i might find information on scrolling text which is too long to display in a button control? I'm thinking something along these lines. Display as much text will fit within the current rect with a '...' at the end to signify o...
TITLE: Easy way to scroll overflow text on a button? QUESTION: Does anyone have any examples or resources where i might find information on scrolling text which is too long to display in a button control? I'm thinking something along these lines. Display as much text will fit within the current rect with a '...' at th...
[ "iphone", "cocoa", "animation", "core-animation" ]
2
2
2,329
5
0
2008-09-29T01:08:04.567000
2008-10-01T04:18:54.077000
147,172
184,287
What is the benefit of global resource URIs (i.e. addressability)?
What is the benefit of referencing resources using globally-unique URIs (as REST does) versus using a proprietary id format? For example: http://host.com/student/5 http://host.com/student?id=5 In the first approach the entire URL is the ID. In the second approach only the 5 is the ID. What is the practical benefit of t...
I will answer my own question: 1) Why are URIs important? I'll quote from RESTful Web Services by Leonard Richardson and Sam Ruby (ISBN: 978-0-596-52926-0): Consider a real URI that names a resource in the genre “directory of resources about jellyfish”: http://www.google.com/search?q=jellyfish. That jellyfish search is...
What is the benefit of global resource URIs (i.e. addressability)? What is the benefit of referencing resources using globally-unique URIs (as REST does) versus using a proprietary id format? For example: http://host.com/student/5 http://host.com/student?id=5 In the first approach the entire URL is the ID. In the secon...
TITLE: What is the benefit of global resource URIs (i.e. addressability)? QUESTION: What is the benefit of referencing resources using globally-unique URIs (as REST does) versus using a proprietary id format? For example: http://host.com/student/5 http://host.com/student?id=5 In the first approach the entire URL is th...
[ "rest", "uri" ]
3
1
522
7
0
2008-09-29T01:21:42.160000
2008-10-08T18:52:36.823000
147,173
147,176
`testl` eax against eax?
I am trying to understand some assembly. The assembly as follows, I am interested in the testl line: 000319df 8b4508 movl 0x08(%ebp), %eax 000319e2 8b4004 movl 0x04(%eax), %eax 000319e5 85c0 testl %eax, %eax 000319e7 7407 je 0x000319f0 I am trying to understand that point of testl between %eax and %eax? I think the spe...
It tests whether eax is 0, or above, or below. In this case, the jump is taken if eax is 0.
`testl` eax against eax? I am trying to understand some assembly. The assembly as follows, I am interested in the testl line: 000319df 8b4508 movl 0x08(%ebp), %eax 000319e2 8b4004 movl 0x04(%eax), %eax 000319e5 85c0 testl %eax, %eax 000319e7 7407 je 0x000319f0 I am trying to understand that point of testl between %eax ...
TITLE: `testl` eax against eax? QUESTION: I am trying to understand some assembly. The assembly as follows, I am interested in the testl line: 000319df 8b4508 movl 0x08(%ebp), %eax 000319e2 8b4004 movl 0x04(%eax), %eax 000319e5 85c0 testl %eax, %eax 000319e7 7407 je 0x000319f0 I am trying to understand that point of t...
[ "assembly", "x86", "instructions" ]
129
97
94,340
8
0
2008-09-29T01:22:57.010000
2008-09-29T01:23:43.687000
147,181
147,233
How can I convert my Java program to an .exe file?
If I have a Java source file (*.java) or a class file (*.class), how can I convert it to a.exe file? I also need an installer for my program.
javapackager The Java Packager tool compiles, packages, and prepares Java and JavaFX applications for distribution. The javapackager command is the command-line version. – Oracle's documentation The javapackager utility ships with the JDK. It can generate.exe files with the -native exe flag, among many other things. Wi...
How can I convert my Java program to an .exe file? If I have a Java source file (*.java) or a class file (*.class), how can I convert it to a.exe file? I also need an installer for my program.
TITLE: How can I convert my Java program to an .exe file? QUESTION: If I have a Java source file (*.java) or a class file (*.class), how can I convert it to a.exe file? I also need an installer for my program. ANSWER: javapackager The Java Packager tool compiles, packages, and prepares Java and JavaFX applications fo...
[ "java", "installation", "exe" ]
583
377
518,071
16
0
2008-09-29T01:23:59.487000
2008-09-29T01:42:12.813000
147,182
263,530
Low Friction Minimal Requirements Gathering
How can our team gather requirements from our "Product Owner" in as low friction yet useable of a way as possible? Now here's the guidelines- No posts that it can't be done or that the business needs to make a decision that it cares about quality, yada yada. The product I work for is a small group that has been success...
Although the concept of "product owner" is a littl ambiguous to me, I think I am working in very similar circumstances: the customer is extremely buzy and always is a bottleneck in developing requirements. On the surface, what we try to do in this situation is quite obvious and seemingly simple: we try to make sure tha...
Low Friction Minimal Requirements Gathering How can our team gather requirements from our "Product Owner" in as low friction yet useable of a way as possible? Now here's the guidelines- No posts that it can't be done or that the business needs to make a decision that it cares about quality, yada yada. The product I wor...
TITLE: Low Friction Minimal Requirements Gathering QUESTION: How can our team gather requirements from our "Product Owner" in as low friction yet useable of a way as possible? Now here's the guidelines- No posts that it can't be done or that the business needs to make a decision that it cares about quality, yada yada....
[ "requirements", "process-management", "product-management" ]
0
5
523
3
0
2008-09-29T01:24:19.923000
2008-11-04T21:35:38.703000
147,187
147,195
Why do we need anything more than HTTP GET, PUT, POST?
What is the practical benefit of using HTTP GET, PUT, DELETE, POST, HEAD? Why not focus on their behavioral benefits (safety and idempotency), forgetting their names, and use GET, PUT or POST depending on which behavior we want? Why shouldn't we only use GET, PUT and POST (and drop HEAD, DELETE)?
The [REST][1] approach uses POST, GET, PUT and DELETE to implement the CRUD rules for a web resource. It's a simple and tidy way to expose objects to requests on the web. It's web services without the overheads. Just to clarify the semantic differences. Each operation is rather different. The point is to have nice HTTP...
Why do we need anything more than HTTP GET, PUT, POST? What is the practical benefit of using HTTP GET, PUT, DELETE, POST, HEAD? Why not focus on their behavioral benefits (safety and idempotency), forgetting their names, and use GET, PUT or POST depending on which behavior we want? Why shouldn't we only use GET, PUT a...
TITLE: Why do we need anything more than HTTP GET, PUT, POST? QUESTION: What is the practical benefit of using HTTP GET, PUT, DELETE, POST, HEAD? Why not focus on their behavioral benefits (safety and idempotency), forgetting their names, and use GET, PUT or POST depending on which behavior we want? Why shouldn't we o...
[ "rest" ]
12
22
5,001
14
0
2008-09-29T01:25:13.230000
2008-09-29T01:30:17.180000
147,207
147,299
Transactions in REST?
I'm wondering how you'd implement the following use-case in REST. Is it even possible to do without compromising the conceptual model? Read or update multiple resources within the scope of a single transaction. For example, transfer $100 from Bob's bank account into John's account. As far as I can tell, the only way to...
Consider a RESTful shopping basket scenario. The shopping basket is conceptually your transaction wrapper. In the same way that you can add multiple items to a shopping basket and then submit that basket to process the order, you can add Bob's account entry to the transaction wrapper and then Bill's account entry to th...
Transactions in REST? I'm wondering how you'd implement the following use-case in REST. Is it even possible to do without compromising the conceptual model? Read or update multiple resources within the scope of a single transaction. For example, transfer $100 from Bob's bank account into John's account. As far as I can...
TITLE: Transactions in REST? QUESTION: I'm wondering how you'd implement the following use-case in REST. Is it even possible to do without compromising the conceptual model? Read or update multiple resources within the scope of a single transaction. For example, transfer $100 from Bob's bank account into John's accoun...
[ "rest" ]
165
93
95,194
13
0
2008-09-29T01:33:52.820000
2008-09-29T02:13:30.790000
147,208
147,216
How to hide table rows without resizing overall width?
Is there a way to hide table rows without affecting the overall table width? I've got some javascript that shows/hides some table rows, but when the rows are set to display: none;, the table with shrinks to fit the contents of the visible rows.
If you are looking to preserve the overall width of the table, you can check it prior to hiding a row, and explicitly set the width style property to this value: table.style.width = table.clientWidth + "px"; table.rows[3].style.display = "none"; However, this may cause the individual columns to reflow when you hide the...
How to hide table rows without resizing overall width? Is there a way to hide table rows without affecting the overall table width? I've got some javascript that shows/hides some table rows, but when the rows are set to display: none;, the table with shrinks to fit the contents of the visible rows.
TITLE: How to hide table rows without resizing overall width? QUESTION: Is there a way to hide table rows without affecting the overall table width? I've got some javascript that shows/hides some table rows, but when the rows are set to display: none;, the table with shrinks to fit the contents of the visible rows. A...
[ "javascript", "html", "css", "xhtml", "html-table" ]
10
9
7,707
5
0
2008-09-29T01:33:58.777000
2008-09-29T01:36:17.087000
147,210
147,356
How can I reseed an identity column in a T-SQL table variable?
I have a T-SQL table variable (not a table) which has an auto incrementing identity column. I want to clear all data from this variable and reset the identity column value to 1. How can this be done?
If you're using a table variable, you can't do it. If it were a table, you could truncate it or use DBCC CHECKIDENT. But, if you have to use a table variable, you have to use something other than an identity column. Or, more accurately, use the identity column in your table variable but output using ROWNUMBER: DECLARE ...
How can I reseed an identity column in a T-SQL table variable? I have a T-SQL table variable (not a table) which has an auto incrementing identity column. I want to clear all data from this variable and reset the identity column value to 1. How can this be done?
TITLE: How can I reseed an identity column in a T-SQL table variable? QUESTION: I have a T-SQL table variable (not a table) which has an auto incrementing identity column. I want to clear all data from this variable and reset the identity column value to 1. How can this be done? ANSWER: If you're using a table variab...
[ "sql-server", "t-sql", "table-variable" ]
37
38
69,902
5
0
2008-09-29T01:34:17.933000
2008-09-29T02:57:12.820000
147,240
147,251
Ruby isPrime Method
('1' * N)!~ /^1?$|^(11+?)\1+$/ On the net, I found this piece of Ruby code that works for N >= 0 that determines whether or not N is a prime. From what I can tell, it looks like play with regex but I have no idea how it works. Could someone tell me how it works?
You can find a lengthy explanation of this code here: http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/
Ruby isPrime Method ('1' * N)!~ /^1?$|^(11+?)\1+$/ On the net, I found this piece of Ruby code that works for N >= 0 that determines whether or not N is a prime. From what I can tell, it looks like play with regex but I have no idea how it works. Could someone tell me how it works?
TITLE: Ruby isPrime Method QUESTION: ('1' * N)!~ /^1?$|^(11+?)\1+$/ On the net, I found this piece of Ruby code that works for N >= 0 that determines whether or not N is a prime. From what I can tell, it looks like play with regex but I have no idea how it works. Could someone tell me how it works? ANSWER: You can fi...
[ "ruby", "regex", "primes" ]
23
24
6,698
7
0
2008-09-29T01:47:29.137000
2008-09-29T01:53:14.253000
147,245
661,510
How can I remotely (via web services) determine date format of SharePoint 2003 site, for use in Versions.asmx returned XML?
The GetVersions() call to the Versions.asmx web service in SharePoint 2003 returns a localised date format, with no way of determining what the format is. It's the site regional setting of date format, but I can't find a way to get even that out of SharePoint 2003. Locally, it looks like SPRegionalSettings can be used ...
Unfortunately, the parameter that asks for the values in UTC is not supported for this call. I've just had to look for a month greater than 12 and use that as the hint to switch date formats. It'll mess up some dates, but I can't see a way around that. The code is at http://sourceforge.net/projects/splistcp/ if anyone ...
How can I remotely (via web services) determine date format of SharePoint 2003 site, for use in Versions.asmx returned XML? The GetVersions() call to the Versions.asmx web service in SharePoint 2003 returns a localised date format, with no way of determining what the format is. It's the site regional setting of date fo...
TITLE: How can I remotely (via web services) determine date format of SharePoint 2003 site, for use in Versions.asmx returned XML? QUESTION: The GetVersions() call to the Versions.asmx web service in SharePoint 2003 returns a localised date format, with no way of determining what the format is. It's the site regional ...
[ "web-services", "sharepoint", "locale", "regional", "date-format" ]
1
0
899
2
0
2008-09-29T01:51:02.263000
2009-03-19T09:13:01.570000
147,260
151,582
Can I have non-measure codes mixed with measures in my fact table?
We're doing a complex bit of data accumulation. Our customer sends us some stuff that includes two dimensions (time and a business unit). Time is mostly year-month. The business unit dimension has just a few attributes: a name, and a few categories to which BU's can belong for reporting and analysis purposes. The stuff...
Only put things in the fact table if they are degenerate (causing a high-cardinality/uniqueness problems in your dimension where it takes the dimension to a 1-1 relationship to the fact table). Kimball recommends avoiding the temptation to put anything but degenerate dimensions in with the facts (unique order number, f...
Can I have non-measure codes mixed with measures in my fact table? We're doing a complex bit of data accumulation. Our customer sends us some stuff that includes two dimensions (time and a business unit). Time is mostly year-month. The business unit dimension has just a few attributes: a name, and a few categories to w...
TITLE: Can I have non-measure codes mixed with measures in my fact table? QUESTION: We're doing a complex bit of data accumulation. Our customer sends us some stuff that includes two dimensions (time and a business unit). Time is mostly year-month. The business unit dimension has just a few attributes: a name, and a f...
[ "database", "database-design", "data-warehouse" ]
0
3
894
3
0
2008-09-29T01:58:01.077000
2008-09-30T02:50:19.727000
147,264
147,291
jQuery - Triggering Events from Clicking on a Link Issue
I'd like to trigger an event when a link is clicked both by clicking on it normally or by opening it in a new tab (e.g., middle click, ctrl + click, etc) I've tried the following so far: $('a').click(myfunc) Doesn't capture middle clicks. $('a').mousedown(myfunc) works, but it seems to be preventing the link from being...
Try returning true from your handler function. Returning nothing can be interpreted by the browser as a void return and thus prevent the default action from being carried out.
jQuery - Triggering Events from Clicking on a Link Issue I'd like to trigger an event when a link is clicked both by clicking on it normally or by opening it in a new tab (e.g., middle click, ctrl + click, etc) I've tried the following so far: $('a').click(myfunc) Doesn't capture middle clicks. $('a').mousedown(myfunc)...
TITLE: jQuery - Triggering Events from Clicking on a Link Issue QUESTION: I'd like to trigger an event when a link is clicked both by clicking on it normally or by opening it in a new tab (e.g., middle click, ctrl + click, etc) I've tried the following so far: $('a').click(myfunc) Doesn't capture middle clicks. $('a')...
[ "javascript", "jquery", "firefox", "events" ]
7
6
3,435
1
0
2008-09-29T01:59:17.827000
2008-09-29T02:11:15.367000
147,267
147,283
Easy way to use variables of enum types as string in C?
Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function that would do a switch case similar to the following: char num_str[10]; int process_numbers_str(Numbers num) { switch(num) { case ONE: case TWO: case THREE: { strcpy(num_str, num); //some way to get the symbolic con...
There's no built-in solution. The easiest way is with an array of char* where the enum's int value indexes to a string containing the descriptive name of that enum. If you have a sparse enum (one that doesn't start at 0 or has gaps in the numbering) where some of the int mappings are high enough to make an array-based ...
Easy way to use variables of enum types as string in C? Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function that would do a switch case similar to the following: char num_str[10]; int process_numbers_str(Numbers num) { switch(num) { case ONE: case TWO: case THREE: { ...
TITLE: Easy way to use variables of enum types as string in C? QUESTION: Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function that would do a switch case similar to the following: char num_str[10]; int process_numbers_str(Numbers num) { switch(num) { case ONE: case T...
[ "c", "enums", "c-preprocessor" ]
96
16
122,940
20
0
2008-09-29T02:00:24.800000
2008-09-29T02:06:34.533000
147,298
147,465
Multithreaded Memory Allocators for C/C++
I currently have heavily multi-threaded server application, and I'm shopping around for a good multi-threaded memory allocator. So far I'm torn between: Sun's umem Google's tcmalloc Intel's threading building blocks allocator Emery Berger's hoard From what I've found hoard might be the fastest, but I hadn't heard of it...
I've used tcmalloc and read about Hoard. Both have similar implementations and both achieve roughly linear performance scaling with respect to the number of threads/CPUs (according to the graphs on their respective sites). So: if performance is really that incredibly crucial, then do performance/load testing. Otherwise...
Multithreaded Memory Allocators for C/C++ I currently have heavily multi-threaded server application, and I'm shopping around for a good multi-threaded memory allocator. So far I'm torn between: Sun's umem Google's tcmalloc Intel's threading building blocks allocator Emery Berger's hoard From what I've found hoard migh...
TITLE: Multithreaded Memory Allocators for C/C++ QUESTION: I currently have heavily multi-threaded server application, and I'm shopping around for a good multi-threaded memory allocator. So far I'm torn between: Sun's umem Google's tcmalloc Intel's threading building blocks allocator Emery Berger's hoard From what I'v...
[ "c++", "c", "memory", "malloc", "allocation" ]
38
17
15,333
8
0
2008-09-29T02:13:02.817000
2008-09-29T04:01:01.157000
147,307
159,683
.NET : How to set user information in an EventLog Entry?
The System.Diagnostics.EventLog class provides a way to interact with a windows event log. I use it all the time for simple logging... System.Diagnostics.EventLog.WriteEntry("MyEventSource", "My Special Message") Is there a way to set the user information in the resulting event log entry using.NET?
Toughie... I looked for a way to fill the user field with a.NET method. Unfortunately there is none, and you must import the plain old Win32 API [ReportEvent function]( http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx) with a DLLImportAttribute You must also redeclare the function with the right types, as P...
.NET : How to set user information in an EventLog Entry? The System.Diagnostics.EventLog class provides a way to interact with a windows event log. I use it all the time for simple logging... System.Diagnostics.EventLog.WriteEntry("MyEventSource", "My Special Message") Is there a way to set the user information in the ...
TITLE: .NET : How to set user information in an EventLog Entry? QUESTION: The System.Diagnostics.EventLog class provides a way to interact with a windows event log. I use it all the time for simple logging... System.Diagnostics.EventLog.WriteEntry("MyEventSource", "My Special Message") Is there a way to set the user i...
[ "c#", ".net", "vb.net", "event-log" ]
6
5
5,520
3
0
2008-09-29T02:21:49.117000
2008-10-01T20:53:30.907000
147,315
147,337
MySQL Row Format: Difference between fixed and dynamic?
MySQL specifies the row format of a table as either fixed or dynamic, depending on the column data types. If a table has a variable-length column data type, such as TEXT or VARCHAR, the row format is dynamic; otherwise, it's fixed. My question is, what's the difference between the two row formats? Is one more efficient...
The difference really only matters for MyISAM, other storage engines do not care about the difference. EDIT: Many users commented that InnoDB does care: link 1 by steampowered, link 2 by Kaan. With MyISAM with fixed width rows, there are a few advantages: No row fragmentation: It is possible with variable width rows to...
MySQL Row Format: Difference between fixed and dynamic? MySQL specifies the row format of a table as either fixed or dynamic, depending on the column data types. If a table has a variable-length column data type, such as TEXT or VARCHAR, the row format is dynamic; otherwise, it's fixed. My question is, what's the diffe...
TITLE: MySQL Row Format: Difference between fixed and dynamic? QUESTION: MySQL specifies the row format of a table as either fixed or dynamic, depending on the column data types. If a table has a variable-length column data type, such as TEXT or VARCHAR, the row format is dynamic; otherwise, it's fixed. My question is...
[ "mysql", "table-structure" ]
51
61
64,659
5
0
2008-09-29T02:25:28.107000
2008-09-29T02:37:48.187000
147,323
149,352
CScrollView and window size
(MFC Question) What's the best way to determine the current displayed client area in a CScrollView? I only need the size of the visible portion, so GetClientRect() won't work here.
You do need to use GetClientRect(), but I think you're asking the wrong question. It is not so that in a scrolled view there is a very big client window that is physically scrolled. Instead, when you scroll, the DC's viewportext and mapping mode are adjusted, which make it seem like your view is bigger than it actually...
CScrollView and window size (MFC Question) What's the best way to determine the current displayed client area in a CScrollView? I only need the size of the visible portion, so GetClientRect() won't work here.
TITLE: CScrollView and window size QUESTION: (MFC Question) What's the best way to determine the current displayed client area in a CScrollView? I only need the size of the visible portion, so GetClientRect() won't work here. ANSWER: You do need to use GetClientRect(), but I think you're asking the wrong question. It...
[ "c++", "winapi", "mfc" ]
0
2
1,229
3
0
2008-09-29T02:29:14.543000
2008-09-29T15:58:14.113000
147,328
170,398
Accepting form fields via HTTP Post in WCF
I need to accept form data to a WCF-based service. Here's the interface: [OperationContract] [WebInvoke(UriTemplate = "lead/inff", BodyStyle = WebMessageBodyStyle.WrappedRequest)] int Inff(Stream input); Here's the implementation (sample - no error handling and other safeguards): public int Inff(Stream input) { Stream...
I remember speaking to you about this at DevLink. Since you have to support form fields the mechanics of getting those (what you are currently doing) don't change. Something that might be helpful, especially if you want to reuse your service for new applications that don't require the form fields is to create a channel...
Accepting form fields via HTTP Post in WCF I need to accept form data to a WCF-based service. Here's the interface: [OperationContract] [WebInvoke(UriTemplate = "lead/inff", BodyStyle = WebMessageBodyStyle.WrappedRequest)] int Inff(Stream input); Here's the implementation (sample - no error handling and other safeguard...
TITLE: Accepting form fields via HTTP Post in WCF QUESTION: I need to accept form data to a WCF-based service. Here's the interface: [OperationContract] [WebInvoke(UriTemplate = "lead/inff", BodyStyle = WebMessageBodyStyle.WrappedRequest)] int Inff(Stream input); Here's the implementation (sample - no error handling a...
[ "wcf", "http-post", "webinvoke" ]
7
5
6,188
2
0
2008-09-29T02:31:16.427000
2008-10-04T14:15:54.090000
147,351
147,538
Converting Win16 C code to Win32
In general, what needs to be done to convert a 16 bit Windows program to Win32? I'm sure I'm not the only person to inherit a codebase and be stunned to find 16-bit code lurking in the corners. The code in question is C.
The meanings of wParam and lParam have changed in many places. I strongly encourage you to be paranoid and convert as much as possible to use message crackers. They will save you no end of headaches. If there is only one piece of advice I could give you, this would be it. As long as you're using message crackers, also ...
Converting Win16 C code to Win32 In general, what needs to be done to convert a 16 bit Windows program to Win32? I'm sure I'm not the only person to inherit a codebase and be stunned to find 16-bit code lurking in the corners. The code in question is C.
TITLE: Converting Win16 C code to Win32 QUESTION: In general, what needs to be done to convert a 16 bit Windows program to Win32? I'm sure I'm not the only person to inherit a codebase and be stunned to find 16-bit code lurking in the corners. The code in question is C. ANSWER: The meanings of wParam and lParam have ...
[ "c", "windows", "winapi", "16-bit" ]
16
19
4,308
6
0
2008-09-29T02:48:47.630000
2008-09-29T04:44:24.577000
147,362
147,368
What is the best way to test a stored procedure?
Like many companies that require all access be through stored procedures, we seem to have a lot of business logic locked away in sprocs. These things are just plain hard to test, and some of them have become silly long. Does anyone out there have a set of best practices that can make it a little easier to confidently t...
A colleague swears by the TSQLUnit testing framework. May be worth a look for your needs.
What is the best way to test a stored procedure? Like many companies that require all access be through stored procedures, we seem to have a lot of business logic locked away in sprocs. These things are just plain hard to test, and some of them have become silly long. Does anyone out there have a set of best practices ...
TITLE: What is the best way to test a stored procedure? QUESTION: Like many companies that require all access be through stored procedures, we seem to have a lot of business logic locked away in sprocs. These things are just plain hard to test, and some of them have become silly long. Does anyone out there have a set ...
[ "sql-server" ]
33
13
63,916
8
0
2008-09-29T02:59:32.877000
2008-09-29T03:05:26.360000
147,364
148,216
Totaling a GridView in ASP.NET
In one of my ASP.NET Web Applications, I am using a BulkEditGridView (a GridView which allows all rows to be edited at the same time) to implement an order form. In my grid, I have a column which calculates the total for each item (cost x quantity) and a grand total field at the bottom of the page. Currently, however, ...
If your calculations can be reproduced in JavaScript the easiest method would be using jQuery to get all the items like this: $("#myGridView input[type='text']").each(function(){ this.change(function(){ updateTotal(this.value); }); }); Or if your calculations are way too complex to be done in JavaScript (or time restra...
Totaling a GridView in ASP.NET In one of my ASP.NET Web Applications, I am using a BulkEditGridView (a GridView which allows all rows to be edited at the same time) to implement an order form. In my grid, I have a column which calculates the total for each item (cost x quantity) and a grand total field at the bottom of...
TITLE: Totaling a GridView in ASP.NET QUESTION: In one of my ASP.NET Web Applications, I am using a BulkEditGridView (a GridView which allows all rows to be edited at the same time) to implement an order form. In my grid, I have a column which calculates the total for each item (cost x quantity) and a grand total fiel...
[ "asp.net", "javascript", "ajax", "gridview" ]
2
3
2,407
2
0
2008-09-29T03:01:48.753000
2008-09-29T10:37:56.130000
147,372
147,374
How does this C++ function use memoization?
#include std::vector as; long int a(size_t n){ if(n==1) return 1; if(n==2) return -2; if(as.size() The above code sample using memoization to calculate a recursive formula based on some input n. I know that this uses memoization, because I have written a purely recursive function that uses the same formula, but this o...
if (as[n] <= 0) is the check. If valid values can be negative like you say, then you need a different sentinel to check against. Can valid values ever be zero? If not, then just make the test if (as[n] == 0). This makes your code easier to write, because by default vectors of int s are filled with zeroes.
How does this C++ function use memoization? #include std::vector as; long int a(size_t n){ if(n==1) return 1; if(n==2) return -2; if(as.size() The above code sample using memoization to calculate a recursive formula based on some input n. I know that this uses memoization, because I have written a purely recursive fun...
TITLE: How does this C++ function use memoization? QUESTION: #include std::vector as; long int a(size_t n){ if(n==1) return 1; if(n==2) return -2; if(as.size() The above code sample using memoization to calculate a recursive formula based on some input n. I know that this uses memoization, because I have written a pu...
[ "c++", "dynamic-programming", "memoization" ]
4
6
1,456
5
0
2008-09-29T03:07:26.433000
2008-09-29T03:08:31.017000
147,378
225,281
Options for refactoring bits of code away from native C++?
So, one commonly heard comment when talking about performance is that you write your code with whatever language gets the job done fastest. If performance in specific areas is a problem, then rewrite those bits in C/C++. But, what if you're starting with a native C++ app? What options do you have if you want to write t...
As Aaron Fischer suggests, try recompiling your C++ application with the /clr option turned on and then start leveraging the.Net platform. CLI/C++ is pretty easy to pick up if you know C# and C++ already and it provides the bridge between the.Net world and native C++. If your current C++ code can't compile cleanly with...
Options for refactoring bits of code away from native C++? So, one commonly heard comment when talking about performance is that you write your code with whatever language gets the job done fastest. If performance in specific areas is a problem, then rewrite those bits in C/C++. But, what if you're starting with a nati...
TITLE: Options for refactoring bits of code away from native C++? QUESTION: So, one commonly heard comment when talking about performance is that you write your code with whatever language gets the job done fastest. If performance in specific areas is a problem, then rewrite those bits in C/C++. But, what if you're st...
[ "c++", "performance", "refactoring", "native" ]
2
2
551
5
0
2008-09-29T03:11:00.447000
2008-10-22T11:10:28.263000
147,391
147,406
Using boost::random as the RNG for std::random_shuffle
I have a program that uses the mt19937 random number generator from boost::random. I need to do a random_shuffle and want the random numbers generated for this to be from this shared state so that they can be deterministic with respect to the mersenne twister's previously generated numbers. I tried something like this:...
In C++03, you cannot instantiate a template based on a function-local type. If you move the rand class out of the function, it should work fine (disclaimer: not tested, there could be other sinister bugs). This requirement has been relaxed in C++0x, but I don't know whether the change has been implemented in GCC's C++0...
Using boost::random as the RNG for std::random_shuffle I have a program that uses the mt19937 random number generator from boost::random. I need to do a random_shuffle and want the random numbers generated for this to be from this shared state so that they can be deterministic with respect to the mersenne twister's pre...
TITLE: Using boost::random as the RNG for std::random_shuffle QUESTION: I have a program that uses the mt19937 random number generator from boost::random. I need to do a random_shuffle and want the random numbers generated for this to be from this shared state so that they can be deterministic with respect to the mers...
[ "c++", "stl", "boost-random" ]
11
11
7,398
4
0
2008-09-29T03:24:14.910000
2008-09-29T03:29:36.160000
147,408
147,499
Performance challenge: NAL Unit Wrapping
From what I've seen in the past, StackOverflow seems to like programming challenges, such as the fast char to string exercise problem which got dozens of responses. This is an optimization challenge: take a very simple function and see if you can come up with a smarter way of doing it. I've had a function that I've wan...
Hmm...how about something like this? #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) while( likely(src < end) ) { //Copy non-zero run int runlen = strlen( src ); if( unlikely(src+runlen >= end) ) { memcpy( dest, src, end-src ); dest += end-src; src = end; break; } memcpy( dest, s...
Performance challenge: NAL Unit Wrapping From what I've seen in the past, StackOverflow seems to like programming challenges, such as the fast char to string exercise problem which got dozens of responses. This is an optimization challenge: take a very simple function and see if you can come up with a smarter way of do...
TITLE: Performance challenge: NAL Unit Wrapping QUESTION: From what I've seen in the past, StackOverflow seems to like programming challenges, such as the fast char to string exercise problem which got dozens of responses. This is an optimization challenge: take a very simple function and see if you can come up with a...
[ "c", "performance", "optimization" ]
3
4
945
7
0
2008-09-29T03:30:14.553000
2008-09-29T04:21:34.273000
147,416
147,436
Copy collection items to another collection in .NET
In.NET (VB), how can I take all of the items in one collection, and add them to a second collection (without losing pre-existing items in the second collection)? I'm looking for something a little more efficient than this: For Each item As Host In hostCollection1 hostCollection2.Add(item) Next My collections are generi...
You can use AddRange: hostCollection2.AddRange(hostCollection1).
Copy collection items to another collection in .NET In.NET (VB), how can I take all of the items in one collection, and add them to a second collection (without losing pre-existing items in the second collection)? I'm looking for something a little more efficient than this: For Each item As Host In hostCollection1 host...
TITLE: Copy collection items to another collection in .NET QUESTION: In.NET (VB), how can I take all of the items in one collection, and add them to a second collection (without losing pre-existing items in the second collection)? I'm looking for something a little more efficient than this: For Each item As Host In ho...
[ ".net", "vb.net", "collections" ]
18
43
59,587
10
0
2008-09-29T03:31:49.213000
2008-09-29T03:41:00.173000
147,420
147,526
What is the best way to set-up authentication in a tomcat webapp?
I have a self built JSP webapp and at the moment I'm using tomcats built in admin pannel to manage user accounts (that are stored in tomcats config xml files) but this is limited because i can not create new accounts from within the web-app (eg. I can not have a sign up website) and need to manually create the accounts...
Set up a database realm in Tomcat, either a simple JDBC realm or a DataSource realm that will allow for connection pooling. Then adding users is a very simple CRUD web application, possibly combined with some confirmation emails.
What is the best way to set-up authentication in a tomcat webapp? I have a self built JSP webapp and at the moment I'm using tomcats built in admin pannel to manage user accounts (that are stored in tomcats config xml files) but this is limited because i can not create new accounts from within the web-app (eg. I can no...
TITLE: What is the best way to set-up authentication in a tomcat webapp? QUESTION: I have a self built JSP webapp and at the moment I'm using tomcats built in admin pannel to manage user accounts (that are stored in tomcats config xml files) but this is limited because i can not create new accounts from within the web...
[ "java", "authentication", "jsp", "tomcat" ]
0
2
471
2
0
2008-09-29T03:34:41.157000
2008-09-29T04:39:33.700000
147,437
147,791
Difflib.SequenceMatcher isjunk optional parameter query: how to ignore whitespaces, tabs, empty lines?
I am trying to use Difflib.SequenceMatcher to compute the similarities between two files. These two files are almost identical except that one contains some extra whitespaces, empty lines and other doesn't. I am trying to use s=difflib.SequenceMatcher(isjunk,text1,text2) ratio =s.ratio() for this purpose. So, the quest...
If you match all whitespaces the similarity is better: difflib.SequenceMatcher(lambda x: x in " \t\n", doc1, doc2).ratio() However, difflib is not ideal to such a problem because these are two nearly identical documents, but typos and such produce differences for difflib where a human wouldn't see many. Try reading up ...
Difflib.SequenceMatcher isjunk optional parameter query: how to ignore whitespaces, tabs, empty lines? I am trying to use Difflib.SequenceMatcher to compute the similarities between two files. These two files are almost identical except that one contains some extra whitespaces, empty lines and other doesn't. I am tryin...
TITLE: Difflib.SequenceMatcher isjunk optional parameter query: how to ignore whitespaces, tabs, empty lines? QUESTION: I am trying to use Difflib.SequenceMatcher to compute the similarities between two files. These two files are almost identical except that one contains some extra whitespaces, empty lines and other d...
[ "python", "lambda", "difflib" ]
3
7
3,283
4
0
2008-09-29T03:41:45.507000
2008-09-29T07:17:02.400000
147,449
150,016
Writing Color Calibration Data to a TIFF or PNG file
My custom homebrew photography processing software, running on 64 bit Linux/GNU, writes out PNG and TIFF files. These are to be sent to a quality printing shop to be made into fine art. Working with interior designers - it's important to get the colors just right! The print shops usually have no trouble with TIFF and P...
Take a look at LittleCMS http://www.littlecms.com/ This page has the code for applying it to TIFF http://www.littlecms.com/newutils.htm The basic thing you need to know is that Color profile data is something you need to store in the meta-data of the file itself.
Writing Color Calibration Data to a TIFF or PNG file My custom homebrew photography processing software, running on 64 bit Linux/GNU, writes out PNG and TIFF files. These are to be sent to a quality printing shop to be made into fine art. Working with interior designers - it's important to get the colors just right! Th...
TITLE: Writing Color Calibration Data to a TIFF or PNG file QUESTION: My custom homebrew photography processing software, running on 64 bit Linux/GNU, writes out PNG and TIFF files. These are to be sent to a quality printing shop to be made into fine art. Working with interior designers - it's important to get the col...
[ "linux", "image", "graphics", "image-processing", "color-management" ]
4
2
803
3
0
2008-09-29T03:51:26.247000
2008-09-29T18:32:21.933000
147,451
147,467
What are valid characters for creating a multipart form boundary?
In an HTML form post what are valid characters for creating a multipart boundary?
According to RFC 2046, section 5.1.1: boundary:= 0*69 bcharsnospace bchars:= bcharsnospace / " " bcharsnospace:= DIGIT / ALPHA / "'" / "(" / ")" / "+" / "_" / "," / "-" / "." / "/" / ":" / "=" / "?" So it can be between 1 and 70 characters long, consisting of alphanumeric, and the punctuation you see in the list. Spa...
What are valid characters for creating a multipart form boundary? In an HTML form post what are valid characters for creating a multipart boundary?
TITLE: What are valid characters for creating a multipart form boundary? QUESTION: In an HTML form post what are valid characters for creating a multipart boundary? ANSWER: According to RFC 2046, section 5.1.1: boundary:= 0*69 bcharsnospace bchars:= bcharsnospace / " " bcharsnospace:= DIGIT / ALPHA / "'" / "(" / ")...
[ "boundary", "multipartform-data" ]
14
16
8,915
2
0
2008-09-29T03:53:13.593000
2008-09-29T04:01:31.560000
147,454
147,461
Why is using a wild card with a Java import statement bad?
It is much more convenient and cleaner to use a single statement like import java.awt.*; than to import a bunch of individual classes import java.awt.Panel; import java.awt.Graphics; import java.awt.Canvas;... What is wrong with using a wildcard in the import statement?
The only problem with it is that it clutters your local namespace. For example, let's say that you're writing a Swing app, and so need java.awt.Event, and are also interfacing with the company's calendaring system, which has com.mycompany.calendar.Event. If you import both using the wildcard method, one of these three ...
Why is using a wild card with a Java import statement bad? It is much more convenient and cleaner to use a single statement like import java.awt.*; than to import a bunch of individual classes import java.awt.Panel; import java.awt.Graphics; import java.awt.Canvas;... What is wrong with using a wildcard in the import s...
TITLE: Why is using a wild card with a Java import statement bad? QUESTION: It is much more convenient and cleaner to use a single statement like import java.awt.*; than to import a bunch of individual classes import java.awt.Panel; import java.awt.Graphics; import java.awt.Canvas;... What is wrong with using a wildca...
[ "java", "import", "wildcard" ]
595
722
264,498
18
0
2008-09-29T03:55:51.417000
2008-09-29T03:58:50.553000
147,459
159,946
Proper build reports in TFS with multiple products under a project
Underneath one "Project" in TFS we have multiple products. This is because for us, a project is a business unit and they each can have many applications that we develop for them. Each one has its own folder in source control(under the TFS project) and each one has its own TeamBuild set up. The issue I have is that when...
The best solution would to to modify the Workspace Mapping for the Team Build Definition to include the Solution Root path instead of the Team Project Root. In TFS2008, Right click the Team Build Definition and choose 'Edit Build Definition' Select the 'Workspace' tab Remove the existing mapping: $/TeamProjectName Add ...
Proper build reports in TFS with multiple products under a project Underneath one "Project" in TFS we have multiple products. This is because for us, a project is a business unit and they each can have many applications that we develop for them. Each one has its own folder in source control(under the TFS project) and e...
TITLE: Proper build reports in TFS with multiple products under a project QUESTION: Underneath one "Project" in TFS we have multiple products. This is because for us, a project is a business unit and they each can have many applications that we develop for them. Each one has its own folder in source control(under the ...
[ "tfs", "tfsbuild" ]
2
2
1,168
1
0
2008-09-29T03:58:04.890000
2008-10-01T21:56:48.243000
147,460
147,474
Can you recommend a .cvsignore file for a Visual C#.NET solution?
I've developed a Visual C#.NET 2008 Express Edition solution containing three projects. I am cleaning it up to commit it into a CVS repository. There are several files that are created during the build process that are not necessary to be placed in the repository since they will be regenerated automatically. The questi...
Typically these are the only things that you have to commit:.sln files.cs files.csproj files.config files External DLLs and corresponding XML/config files that you are referencing other non-generated files that your application uses All the rest are to be ignored, including:.suo files.csproj.user files /bin folder and ...
Can you recommend a .cvsignore file for a Visual C#.NET solution? I've developed a Visual C#.NET 2008 Express Edition solution containing three projects. I am cleaning it up to commit it into a CVS repository. There are several files that are created during the build process that are not necessary to be placed in the r...
TITLE: Can you recommend a .cvsignore file for a Visual C#.NET solution? QUESTION: I've developed a Visual C#.NET 2008 Express Edition solution containing three projects. I am cleaning it up to commit it into a CVS repository. There are several files that are created during the build process that are not necessary to ...
[ "c#", ".net", "visual-studio", "visual-studio-2008", "cvs" ]
1
5
674
2
0
2008-09-29T03:58:30.147000
2008-09-29T04:06:22.530000
147,462
147,498
When memory is allocated for a program?
I need to know when the memory will be allocated for a particular program. How can i view where the memory is allocated.
You'll need to be more specific with the OS, and perhaps language if it's interpreted or run time compiled (ie, PHP, JAVA,.NET, etc). However, in general: Static and global variables are allocated when the program is loaded into memory. Local variables are allocated on the stack (sometimes heap, depending on compiler) ...
When memory is allocated for a program? I need to know when the memory will be allocated for a particular program. How can i view where the memory is allocated.
TITLE: When memory is allocated for a program? QUESTION: I need to know when the memory will be allocated for a particular program. How can i view where the memory is allocated. ANSWER: You'll need to be more specific with the OS, and perhaps language if it's interpreted or run time compiled (ie, PHP, JAVA,.NET, etc)...
[ ".net", "asp.net" ]
1
5
759
4
0
2008-09-29T03:58:53.953000
2008-09-29T04:21:32.447000
147,468
147,495
Why should the interface for a Java class be preferred?
PMD would report a violation for: ArrayList list = new ArrayList (); The violation was "Avoid using implementation types like 'ArrayList'; use the interface instead". The following line would correct the violation: List list = new ArrayList (); Why should the latter with List be used instead of ArrayList?
Using interfaces over concrete types is the key for good encapsulation and for loose coupling your code. It's even a good idea to follow this practice when writing your own APIs. If you do, you'll find later that it's easier to add unit tests to your code (using Mocking techniques), and to change the underlying impleme...
Why should the interface for a Java class be preferred? PMD would report a violation for: ArrayList list = new ArrayList (); The violation was "Avoid using implementation types like 'ArrayList'; use the interface instead". The following line would correct the violation: List list = new ArrayList (); Why should the latt...
TITLE: Why should the interface for a Java class be preferred? QUESTION: PMD would report a violation for: ArrayList list = new ArrayList (); The violation was "Avoid using implementation types like 'ArrayList'; use the interface instead". The following line would correct the violation: List list = new ArrayList (); W...
[ "java", "collections", "interface" ]
81
86
31,942
10
0
2008-09-29T04:02:55.957000
2008-09-29T04:20:12.810000
147,486
147,497
XPath query searching for an element with specific text
Given the following XML structure Test: Text2 Test: Text3 Test: Text5 What is the best XPath query to locate any span with text that starts with Test?
//span[starts-with(.,'Test')] References: http://www.w3.org/TR/xpath/#function-starts-with https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/starts-with
XPath query searching for an element with specific text Given the following XML structure Test: Text2 Test: Text3 Test: Text5 What is the best XPath query to locate any span with text that starts with Test?
TITLE: XPath query searching for an element with specific text QUESTION: Given the following XML structure Test: Text2 Test: Text3 Test: Text5 What is the best XPath query to locate any span with text that starts with Test? ANSWER: //span[starts-with(.,'Test')] References: http://www.w3.org/TR/xpath/#function-starts-...
[ "xml", "xpath" ]
18
24
11,645
2
0
2008-09-29T04:14:57.267000
2008-09-29T04:20:38.050000
147,500
147,508
Is it possible to include one CSS file in another?
Is it possible to include one CSS file in another?
Yes: @import url("base.css"); Note: The @import rule must precede all other rules (except @charset ). Additional @import statements require additional server requests. As an alternative, concatenate all CSS into one file to avoid multiple HTTP requests. For example, copy the contents of base.css and special.css into ba...
Is it possible to include one CSS file in another? Is it possible to include one CSS file in another?
TITLE: Is it possible to include one CSS file in another? QUESTION: Is it possible to include one CSS file in another? ANSWER: Yes: @import url("base.css"); Note: The @import rule must precede all other rules (except @charset ). Additional @import statements require additional server requests. As an alternative, conc...
[ "css" ]
881
1,214
580,733
17
0
2008-09-29T04:23:10.667000
2008-09-29T04:29:34.580000
147,507
147,541
How does one do the equivalent of "import * from module" with Python's __import__ function?
Given a string with a module name, how do you import everything in the module as if you had called: from module import * i.e. given string S="module", how does one get the equivalent of the following: __import__(S, fromlist="*") This doesn't seem to perform as expected (as it doesn't import anything).
Please reconsider. The only thing worse than import * is magic import *. If you really want to: m = __import__ (S) try: attrlist = m.__all__ except AttributeError: attrlist = dir (m) for attr in attrlist: globals()[attr] = getattr (m, attr)
How does one do the equivalent of "import * from module" with Python's __import__ function? Given a string with a module name, how do you import everything in the module as if you had called: from module import * i.e. given string S="module", how does one get the equivalent of the following: __import__(S, fromlist="*")...
TITLE: How does one do the equivalent of "import * from module" with Python's __import__ function? QUESTION: Given a string with a module name, how do you import everything in the module as if you had called: from module import * i.e. given string S="module", how does one get the equivalent of the following: __import_...
[ "python", "python-import" ]
22
37
15,960
5
0
2008-09-29T04:28:41.137000
2008-09-29T04:45:07.447000
147,515
147,523
Least common multiple for 3 or more numbers
How do you calculate the least common multiple of multiple numbers? So far I've only been able to calculate it between two numbers. But have no idea how to expand it to calculate 3 or more numbers. So far this is how I did it LCM = num1 * num2 / gcd ( num1, num2 ) With gcd is the function to calculate the greatest comm...
You can compute the LCM of more than two numbers by iteratively computing the LCM of two numbers, i.e. lcm(a,b,c) = lcm(a,lcm(b,c))
Least common multiple for 3 or more numbers How do you calculate the least common multiple of multiple numbers? So far I've only been able to calculate it between two numbers. But have no idea how to expand it to calculate 3 or more numbers. So far this is how I did it LCM = num1 * num2 / gcd ( num1, num2 ) With gcd is...
TITLE: Least common multiple for 3 or more numbers QUESTION: How do you calculate the least common multiple of multiple numbers? So far I've only been able to calculate it between two numbers. But have no idea how to expand it to calculate 3 or more numbers. So far this is how I did it LCM = num1 * num2 / gcd ( num1, ...
[ "algorithm", "math", "lcm" ]
184
214
173,777
32
0
2008-09-29T04:33:16.087000
2008-09-29T04:37:31.660000
147,528
579,123
How do I force a DIV block to extend to the bottom of a page even if it has no content?
In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical border still appears down the page even if there isn't any content to display. Here is my DEMO: body { fon...
Your problem is not that the div is not at 100% height, but that the container around it is not.This will help in the browser I suspect you are using: html,body { height:100%; } You may need to adjust padding and margins as well, but this will get you 90% of the way there.If you need to make it work with all browsers y...
How do I force a DIV block to extend to the bottom of a page even if it has no content? In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical border still appea...
TITLE: How do I force a DIV block to extend to the bottom of a page even if it has no content? QUESTION: In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical ...
[ "css", "html", "border" ]
224
123
453,978
18
0
2008-09-29T04:40:24.290000
2009-02-23T20:09:13.557000
147,530
147,612
Real HLSL IDE/debugger
Are there any IDE's for developing HLSL code? The three key features I want are: 1) syntax highlighting 2) auto-complete 3) interaction debugging Visual Studio doesn't do any of these things, and it doesn't seem that RenderMonkey or FX Composer do either. Is there some IDE that I'm not aware of, or does one of these th...
Have you actually tried ATI's RenderMoney or NVidia's FX Composer? Both actually provide syntax highlighting. Futher more, NVidia's Cg toolkits actually allows you to enable syntaxhightling in Visual Studio with some custom setting. As for auto-completion, I don't think it's much needed as compare to our normal program...
Real HLSL IDE/debugger Are there any IDE's for developing HLSL code? The three key features I want are: 1) syntax highlighting 2) auto-complete 3) interaction debugging Visual Studio doesn't do any of these things, and it doesn't seem that RenderMonkey or FX Composer do either. Is there some IDE that I'm not aware of, ...
TITLE: Real HLSL IDE/debugger QUESTION: Are there any IDE's for developing HLSL code? The three key features I want are: 1) syntax highlighting 2) auto-complete 3) interaction debugging Visual Studio doesn't do any of these things, and it doesn't seem that RenderMonkey or FX Composer do either. Is there some IDE that ...
[ "ide", "3d", "hlsl" ]
8
3
7,174
6
0
2008-09-29T04:40:32.293000
2008-09-29T05:16:35.497000
147,533
147,591
Best place to save user information for Windows XP and Vista applications
I need to save a user's login information in encrypted form for this application I'm building, but I'm not sure of the best place to save the file. I don't want to save it into the program application folder as I want it per user. So what is the best folder (or way) to save it into? Edit: Using C++.
Seems like C:\Documents and Settings\%username%\Local Settings\Application Data may be the appropriate place according to Wikipedia. The article says this location is used for "User-specific and computer-specific application settings". Edit: Cruizer pointed out in the comments (I'd reply there but I can't comment yet) ...
Best place to save user information for Windows XP and Vista applications I need to save a user's login information in encrypted form for this application I'm building, but I'm not sure of the best place to save the file. I don't want to save it into the program application folder as I want it per user. So what is the ...
TITLE: Best place to save user information for Windows XP and Vista applications QUESTION: I need to save a user's login information in encrypted form for this application I'm building, but I'm not sure of the best place to save the file. I don't want to save it into the program application folder as I want it per use...
[ "file", "windows-vista", "windows-xp", "save" ]
3
3
2,973
6
0
2008-09-29T04:43:12.693000
2008-09-29T05:07:21.510000
147,551
148,661
Is Silverlight the 'same' as jQuery?
Could Silverlight be used for the same things as jQuery, or are they intended for different things? For example, vb.net could be used for the same stuff as C# while C# is intended for different things than what JavaScript is. Is Silverlight and jQuery like vb.net and C#, or more like C# and JavaScript?
Silverlight can be used to create rich interactive media, and is more akin to Flash than anything else. jQuery is a javascript library.
Is Silverlight the 'same' as jQuery? Could Silverlight be used for the same things as jQuery, or are they intended for different things? For example, vb.net could be used for the same stuff as C# while C# is intended for different things than what JavaScript is. Is Silverlight and jQuery like vb.net and C#, or more lik...
TITLE: Is Silverlight the 'same' as jQuery? QUESTION: Could Silverlight be used for the same things as jQuery, or are they intended for different things? For example, vb.net could be used for the same stuff as C# while C# is intended for different things than what JavaScript is. Is Silverlight and jQuery like vb.net a...
[ "jquery", "silverlight", "rich-internet-application" ]
11
14
4,786
11
0
2008-09-29T04:50:41.427000
2008-09-29T13:34:49.217000
147,557
148,117
Error logging in C#
I am making my switch from coding in C++ to C#. I need to replace my C++ error logging/reporting macro system with something similar in C#. In my C++ source I can write LOGERR("Some error"); or LOGERR("Error with inputs %s and %d", stringvar, intvar); The macro & supporting library code then passes the (possibly vararg...
Lots of log4net advocates here so I'm sure this will be ignored, but I'll add my own preference: System.Diagnostics.Trace This includes listeners that listen for your Trace() methods, and then write to a log file/output window/event log, ones in the framework that are included are DefaultTraceListener, TextWriterTraceL...
Error logging in C# I am making my switch from coding in C++ to C#. I need to replace my C++ error logging/reporting macro system with something similar in C#. In my C++ source I can write LOGERR("Some error"); or LOGERR("Error with inputs %s and %d", stringvar, intvar); The macro & supporting library code then passes ...
TITLE: Error logging in C# QUESTION: I am making my switch from coding in C++ to C#. I need to replace my C++ error logging/reporting macro system with something similar in C#. In my C++ source I can write LOGERR("Some error"); or LOGERR("Error with inputs %s and %d", stringvar, intvar); The macro & supporting library...
[ "c#", "error-reporting", "error-logging" ]
75
74
94,911
15
0
2008-09-29T04:53:55.007000
2008-09-29T09:41:56.560000
147,572
147,589
Will the below code cause memory leak in c++
class someclass {}; class base { int a; int *pint; someclass objsomeclass; someclass* psomeclass; public: base() { objsomeclass = someclass(); psomeclass = new someclass(); pint = new int(); throw "constructor failed"; a = 43; } } int main() { base temp(); } In the above code, the constructor throws. Which objects wi...
Yes it will leak memory. When the constructor throws, no destructor will be called (in this case you don't show a destructor that frees the dynamically allocated objects, but lets assume you had one). This is a major reason to use smart pointers - since the smart poitners are full fledged objects, they will get destruc...
Will the below code cause memory leak in c++ class someclass {}; class base { int a; int *pint; someclass objsomeclass; someclass* psomeclass; public: base() { objsomeclass = someclass(); psomeclass = new someclass(); pint = new int(); throw "constructor failed"; a = 43; } } int main() { base temp(); } In the above c...
TITLE: Will the below code cause memory leak in c++ QUESTION: class someclass {}; class base { int a; int *pint; someclass objsomeclass; someclass* psomeclass; public: base() { objsomeclass = someclass(); psomeclass = new someclass(); pint = new int(); throw "constructor failed"; a = 43; } } int main() { base temp()...
[ "c++", "exception", "memory-leaks", "constructor" ]
20
41
14,058
7
0
2008-09-29T04:58:34.183000
2008-09-29T05:04:45.167000
147,583
147,590
Determining if the window is in help mode
Developing a.NET WinForms application: how can I check if the window is in Help mode (i.e. after clicking the "?" button in the title bar)? The problem I have is that my System.Windows.Forms.ToolStripItem objects do not have a HelpRequested event (because they do not inherit from Control) so in the Click event handler,...
I believe that the Form.HelpButtonClicked event is what you want, since it's in your namespace.
Determining if the window is in help mode Developing a.NET WinForms application: how can I check if the window is in Help mode (i.e. after clicking the "?" button in the title bar)? The problem I have is that my System.Windows.Forms.ToolStripItem objects do not have a HelpRequested event (because they do not inherit fr...
TITLE: Determining if the window is in help mode QUESTION: Developing a.NET WinForms application: how can I check if the window is in Help mode (i.e. after clicking the "?" button in the title bar)? The problem I have is that my System.Windows.Forms.ToolStripItem objects do not have a HelpRequested event (because they...
[ "c#", ".net", "winforms" ]
3
1
154
1
0
2008-09-29T05:00:40.030000
2008-09-29T05:06:02.560000
147,626
147,667
Regexp matching of list of quotes strings - unquoted
in Javascript, the following: var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.match(/".*?"/g); alert(result); yields "the quick","brown fox","jumps over","the lazy dog" I want each matched element to be unquoted: the quick,brown fox,jumps over,the lazy dog what regexp will do this?
This seems to work: var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.match(/[^"]+(?=(" ")|"$)/g); alert(result); Note: This doesn't match empty elements (i.e. ""). Also, it won't work in browsers that don't support JavaScript 1.5 (lookaheads are a 1.5 feature). See http://www.javascri...
Regexp matching of list of quotes strings - unquoted in Javascript, the following: var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.match(/".*?"/g); alert(result); yields "the quick","brown fox","jumps over","the lazy dog" I want each matched element to be unquoted: the quick,brown fo...
TITLE: Regexp matching of list of quotes strings - unquoted QUESTION: in Javascript, the following: var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.match(/".*?"/g); alert(result); yields "the quick","brown fox","jumps over","the lazy dog" I want each matched element to be unquoted: ...
[ "javascript", "regex", "actionscript-3" ]
10
7
19,557
7
0
2008-09-29T05:24:35.557000
2008-09-29T05:55:10.553000
147,627
147,687
Django VMware appliance
Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do.
Configure and build your appliance at Elastic Server On-Demand.
Django VMware appliance Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do.
TITLE: Django VMware appliance QUESTION: Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do. ANSWER: Configure and build your appliance at Elastic Server On-Demand.
[ "python", "django", "vmware" ]
4
7
3,455
5
0
2008-09-29T05:25:00.830000
2008-09-29T06:11:05.243000
147,636
147,765
Best way to detect when a user leaves a web page?
What is the best way to detect if a user leaves a web page? The onunload JavaScript event doesn't work every time (the HTTP request takes longer than the time required to terminate the browser). Creating one will probably be blocked by current browsers.
Try the onbeforeunload event: It is fired just before the page is unloaded. It also allows you to ask back if the user really wants to leave. See the demo onbeforeunload Demo. Alternatively, you can send out an Ajax request when he leaves.
Best way to detect when a user leaves a web page? What is the best way to detect if a user leaves a web page? The onunload JavaScript event doesn't work every time (the HTTP request takes longer than the time required to terminate the browser). Creating one will probably be blocked by current browsers.
TITLE: Best way to detect when a user leaves a web page? QUESTION: What is the best way to detect if a user leaves a web page? The onunload JavaScript event doesn't work every time (the HTTP request takes longer than the time required to terminate the browser). Creating one will probably be blocked by current browsers...
[ "javascript" ]
234
244
255,656
11
0
2008-09-29T05:30:46.383000
2008-09-29T07:02:06.493000
147,646
147,656
Solution for overloaded operator constraint in .NET generics
What would I do if I want to have a generic method that only accepts types that have overloaded an operator, for instance the subtraction operator. I tried using an interface as a constraint but interfaces can't have operator overloading. What is the best way to achieve this?
There is no immediate answer; operators are static, and cannot be expressed in constraints - and the existing primatives don't implement any specific interface (contrast to IComparable[ ] which can be used to emulate greater-than / less-than). However; if you just want it to work, then in.NET 3.5 there are some options...
Solution for overloaded operator constraint in .NET generics What would I do if I want to have a generic method that only accepts types that have overloaded an operator, for instance the subtraction operator. I tried using an interface as a constraint but interfaces can't have operator overloading. What is the best way...
TITLE: Solution for overloaded operator constraint in .NET generics QUESTION: What would I do if I want to have a generic method that only accepts types that have overloaded an operator, for instance the subtraction operator. I tried using an interface as a constraint but interfaces can't have operator overloading. Wh...
[ "c#", "generics", "operator-overloading", "constraints" ]
39
54
21,177
4
0
2008-09-29T05:37:19.317000
2008-09-29T05:46:02.743000
147,649
298,227
CakePHP hasAndBelogsToMany using save() vs. saveAll()
I am using a very intrinsic database with a CakePHP application and so far my multi-models views and controllers are working fine. I have a singular table ( Entity ) that have it's id on several other tables as the Foreign Key entity_id Some tables are one to one relations (Like a Company is one Entity ) and some are o...
This is fixed if you download the nightly. Be careful though, something else might break.
CakePHP hasAndBelogsToMany using save() vs. saveAll() I am using a very intrinsic database with a CakePHP application and so far my multi-models views and controllers are working fine. I have a singular table ( Entity ) that have it's id on several other tables as the Foreign Key entity_id Some tables are one to one re...
TITLE: CakePHP hasAndBelogsToMany using save() vs. saveAll() QUESTION: I am using a very intrinsic database with a CakePHP application and so far my multi-models views and controllers are working fine. I have a singular table ( Entity ) that have it's id on several other tables as the Foreign Key entity_id Some tables...
[ "cakephp", "entity-relationship", "has-and-belongs-to-many" ]
1
1
6,041
2
0
2008-09-29T05:40:55.737000
2008-11-18T09:19:10.223000