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
185,624
189,162
What happens to static variables in inline functions?
I have a function that is declared and defined in a header file. This is a problem all by itself. When that function is not inlined, every translation unit that uses that header gets a copy of the function, and when they are linked together there are duplicated. I've "fixed" that by making the function inline, but I'm ...
I guess you're missing something, here. static function? Declaring a function static will make it "hidden" in its compilation unit. A name having namespace scope (3.3.6) has internal linkage if it is the name of — a variable, function or function template that is explicitly declared static; 3.5/3 - C++14 (n3797) When a...
What happens to static variables in inline functions? I have a function that is declared and defined in a header file. This is a problem all by itself. When that function is not inlined, every translation unit that uses that header gets a copy of the function, and when they are linked together there are duplicated. I'v...
TITLE: What happens to static variables in inline functions? QUESTION: I have a function that is declared and defined in a header file. This is a problem all by itself. When that function is not inlined, every translation unit that uses that header gets a copy of the function, and when they are linked together there a...
[ "c++", "header", "linker", "inline-functions" ]
100
128
39,363
9
0
2008-10-09T01:43:08.383000
2008-10-09T20:51:02.370000
185,634
187,556
Query Analyzer VS. Query Profiler Reads, Writes, and Duration Discrepencies
I'm using MS Sql Server 2000, and for many queries when I run a query in Query Analyzer, with the statistics turned on, the numbers reported in the statistics tab are extremely different from the values shown in the Query Profiler. When the profiler and the analyzer are running at the same time, some queries report 200...
These two utilities do different things: SQL Profiler watches what's happening and reports on it. Query Analyzer looks at the SQL code and figures out how to run it. Query Analyzer uses statistics to figure out what it's going to do, but the results are an action plan, even if statistics are shown. SQL Profiler reports...
Query Analyzer VS. Query Profiler Reads, Writes, and Duration Discrepencies I'm using MS Sql Server 2000, and for many queries when I run a query in Query Analyzer, with the statistics turned on, the numbers reported in the statistics tab are extremely different from the values shown in the Query Profiler. When the pro...
TITLE: Query Analyzer VS. Query Profiler Reads, Writes, and Duration Discrepencies QUESTION: I'm using MS Sql Server 2000, and for many queries when I run a query in Query Analyzer, with the statistics turned on, the numbers reported in the statistics tab are extremely different from the values shown in the Query Prof...
[ "sql-server", "sql-server-profiler" ]
2
1
3,296
1
0
2008-10-09T01:49:49.757000
2008-10-09T14:37:14.623000
185,638
185,655
Optimizations for a Write heavy Oracle application?
What are some useful Oracle optimizations one can use for an Application that mostly writes (updates) to an Oracle database? The general usage pattern here is not web-serving or logging, as is most cases, but instead to persist complex state of a system, so the only times reading is needed is when the system starts up,...
Monitoring of the system health using statspack (9i) or AWR (10g+) would be the best method of identifying bottlenecks. In particular: lookout for redo waits. The redo log is critical in maintaining a high write rate Use bind variables Use bulk operations wherever possible. Watch for index contention where multiple pro...
Optimizations for a Write heavy Oracle application? What are some useful Oracle optimizations one can use for an Application that mostly writes (updates) to an Oracle database? The general usage pattern here is not web-serving or logging, as is most cases, but instead to persist complex state of a system, so the only t...
TITLE: Optimizations for a Write heavy Oracle application? QUESTION: What are some useful Oracle optimizations one can use for an Application that mostly writes (updates) to an Oracle database? The general usage pattern here is not web-serving or logging, as is most cases, but instead to persist complex state of a sys...
[ "database", "performance", "oracle", "database-design" ]
4
5
2,518
4
0
2008-10-09T01:50:37.760000
2008-10-09T01:59:51.390000
185,648
186,973
Dispose of Image in WPF in Listbox (memory leak)
I have a ListBox with a bunch of images in it (done through a datatemplate). The images are created by setting the items source: and then they are cleared by using the listbox's Items.Clear() method. New Images are added by using the Items.Add method of the listbox. However, memory usage just starts moving up and up an...
Unless you are doing anything unusual when loading the images (like using homebrewed image loaders or something) then the GC should wipe them out for you when nothing is referencing them anymore. Are you holding on to references to the data anywhere? Remember that events and event handlers can sometimes "trick" the gar...
Dispose of Image in WPF in Listbox (memory leak) I have a ListBox with a bunch of images in it (done through a datatemplate). The images are created by setting the items source: and then they are cleared by using the listbox's Items.Clear() method. New Images are added by using the Items.Add method of the listbox. Howe...
TITLE: Dispose of Image in WPF in Listbox (memory leak) QUESTION: I have a ListBox with a bunch of images in it (done through a datatemplate). The images are created by setting the items source: and then they are cleared by using the listbox's Items.Clear() method. New Images are added by using the Items.Add method of...
[ "c#", "wpf", "memory-management" ]
5
4
7,038
2
0
2008-10-09T01:55:01.930000
2008-10-09T12:08:48.557000
185,661
186,080
RFC timestamp in Flash/AS3
I'd like to know if Flash/AS3 has any nice way to convert an AS3 'Date' object to/from rfc-850 timestamp format (as used by HTTP date and last-modified). This question is very similar to this question about rfc 3339, except it's specific to AS3 and rfc-850. RFC-850 is like: Thu, 09 Oct 2008 01:09:43 GMT
Alright, so here's a couple of functions to do RFC-802/ Date conversion in Flash. I learned that the Date object doesn't really have any notion of a timezone, and assumes that it is in the local timezone. If you pass an RFC-802 date to the Date() constructor, it parses it everything except the "GMT" timezone token at t...
RFC timestamp in Flash/AS3 I'd like to know if Flash/AS3 has any nice way to convert an AS3 'Date' object to/from rfc-850 timestamp format (as used by HTTP date and last-modified). This question is very similar to this question about rfc 3339, except it's specific to AS3 and rfc-850. RFC-850 is like: Thu, 09 Oct 2008 0...
TITLE: RFC timestamp in Flash/AS3 QUESTION: I'd like to know if Flash/AS3 has any nice way to convert an AS3 'Date' object to/from rfc-850 timestamp format (as used by HTTP date and last-modified). This question is very similar to this question about rfc 3339, except it's specific to AS3 and rfc-850. RFC-850 is like: ...
[ "flash", "actionscript-3", "date" ]
3
3
6,309
2
0
2008-10-09T02:02:45.347000
2008-10-09T06:05:22.940000
185,664
185,869
Templated ASP.NET user control
I'm trying to create a user control that allows users to make something like the following:...etc There are only certain controls I would allow, in addition to the fact that you can have many of any type. I can picture this in XSD, but I'm not entirely sure for ASP.NET. My ASP.NET voodoo is drawing a blank right now.. ...
The PersistenceMode.InnerProperty is what you want.. Here are the MSDN docs. Doing something like this will get you what you want: [PersistenceMode(PersistenceMode.InnerProperty)] public ListItem Items { get; set; } and then you'll be able to use it like this: You can create your own custom classes to use in there as w...
Templated ASP.NET user control I'm trying to create a user control that allows users to make something like the following:...etc There are only certain controls I would allow, in addition to the fact that you can have many of any type. I can picture this in XSD, but I'm not entirely sure for ASP.NET. My ASP.NET voodoo ...
TITLE: Templated ASP.NET user control QUESTION: I'm trying to create a user control that allows users to make something like the following:...etc There are only certain controls I would allow, in addition to the fact that you can have many of any type. I can picture this in XSD, but I'm not entirely sure for ASP.NET. ...
[ "asp.net", "controls" ]
0
2
1,194
3
0
2008-10-09T02:04:42.910000
2008-10-09T03:44:43.737000
185,673
190,088
How do I sync application data between an iPhone and another computer?
I'm working on an iPhone application that would allow viewing and editing of data that I want to keep in sync with a desktop application. I don't see anything in the SDK that directly addresses data synchronization, nor can I find anything that allows my to "hook" into the iTunes sync process. I could do something klud...
The two popular methods are: Sync with a desktop app directly via WiFi (using Bonjour etc. to discover the iPhone/desktop app endpoints as others have suggested here). The other option is to sync with a shared file location - either FTP, MobileMe, WebDAV, web services on another server, etc. So the iPhone and desktop a...
How do I sync application data between an iPhone and another computer? I'm working on an iPhone application that would allow viewing and editing of data that I want to keep in sync with a desktop application. I don't see anything in the SDK that directly addresses data synchronization, nor can I find anything that allo...
TITLE: How do I sync application data between an iPhone and another computer? QUESTION: I'm working on an iPhone application that would allow viewing and editing of data that I want to keep in sync with a desktop application. I don't see anything in the SDK that directly addresses data synchronization, nor can I find ...
[ "iphone" ]
13
5
13,856
7
0
2008-10-09T02:13:07.837000
2008-10-10T04:05:32.977000
185,679
185,686
User Persistence: asp.net caching:
I'm working with caching and persistence for the first time. I have a user object that handles all my user data. Persisting this from page to page I'm planning on using a cookie with a token that then returns the user-object from the cache. What's the best way to implement this. The two ideas/solutions that appear to m...
Why not just use the session storage built into ASP.NET? Cookies are best when persisting some token/marker in the user's browser so that when the browser gets closed and the user revisits your site later, your web site can still retrieve that token/marker and identify the user (or rehydrate the user's session data).
User Persistence: asp.net caching: I'm working with caching and persistence for the first time. I have a user object that handles all my user data. Persisting this from page to page I'm planning on using a cookie with a token that then returns the user-object from the cache. What's the best way to implement this. The t...
TITLE: User Persistence: asp.net caching: QUESTION: I'm working with caching and persistence for the first time. I have a user object that handles all my user data. Persisting this from page to page I'm planning on using a cookie with a token that then returns the user-object from the cache. What's the best way to imp...
[ "c#", "asp.net", "caching", "persistence" ]
1
6
636
1
0
2008-10-09T02:17:07.830000
2008-10-09T02:20:14.063000
185,690
187,953
How to inflate a file with zlib.NET?
I'm using the zlib.NET library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing: zlib.ZInputStream zinput = new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAccess.Read)); while (stopByte!= (data = zinput.ReadByte())) { // check data here } zinput.Close(); ...
It appears I made the mistake of assuming all virtual methods were overridden, which wasn't the case. I was using zlib.ZInputStream.ReadByte(), which is just the inherited Stream.ReadByte(), which doesn't do any inflate. I used zlib.ZInputStream.Read() instead, and it worked like it should.
How to inflate a file with zlib.NET? I'm using the zlib.NET library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing: zlib.ZInputStream zinput = new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAccess.Read)); while (stopByte!= (data = zinput.ReadByte())) { /...
TITLE: How to inflate a file with zlib.NET? QUESTION: I'm using the zlib.NET library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing: zlib.ZInputStream zinput = new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAccess.Read)); while (stopByte!= (data = zinpu...
[ "c#", ".net", "compression", "zlib" ]
6
7
22,290
6
0
2008-10-09T02:21:46.057000
2008-10-09T16:02:18.367000
185,698
185,785
How do I copy files using Windows Batch?
I have a directory with several subdirectories with files. How can I copy all files in the subdirectories to a new location? Edit: I do not want to copy the directories, just the files... As this is still on XP, I chose the below solution: for /D %S IN ("src\*.*") DO @COPY "%S\" "dest\" Thanks!
Ok. With your edit that says you don't want the directory structure, i think you're going to want to use something like this: for /F "usebackq" %s IN (`DIR /B /S /A-D SrcDir`) DO @( XCOPY %s DestDir\%~nxs )
How do I copy files using Windows Batch? I have a directory with several subdirectories with files. How can I copy all files in the subdirectories to a new location? Edit: I do not want to copy the directories, just the files... As this is still on XP, I chose the below solution: for /D %S IN ("src\*.*") DO @COPY "%S\"...
TITLE: How do I copy files using Windows Batch? QUESTION: I have a directory with several subdirectories with files. How can I copy all files in the subdirectories to a new location? Edit: I do not want to copy the directories, just the files... As this is still on XP, I chose the below solution: for /D %S IN ("src\*....
[ "copy", "batch-file", "cmd" ]
5
6
27,149
6
0
2008-10-09T02:24:21.857000
2008-10-09T03:01:24.433000
185,706
185,722
Winform Caching
Is there a Winform caching library out there? I need to pass a few datasets aroung in a Winform Application, and probably persist to storage upon close. I've seen some samples around via Google, using System.Web. What's the recommendation and where can I get some details. I am using VS 2008 for 2.0. 3.0 Framework. Than...
Starting with.NET 2.0 you can use the System.Web.Caching.Cache class with non-ASP.NET apps. The Microsoft recommended approach these days though is to use the Enterprise Library Caching Application Block.
Winform Caching Is there a Winform caching library out there? I need to pass a few datasets aroung in a Winform Application, and probably persist to storage upon close. I've seen some samples around via Google, using System.Web. What's the recommendation and where can I get some details. I am using VS 2008 for 2.0. 3.0...
TITLE: Winform Caching QUESTION: Is there a Winform caching library out there? I need to pass a few datasets aroung in a Winform Application, and probably persist to storage upon close. I've seen some samples around via Google, using System.Web. What's the recommendation and where can I get some details. I am using VS...
[ "winforms", "caching" ]
2
2
1,557
2
0
2008-10-09T02:27:03.723000
2008-10-09T02:33:11.650000
185,709
185,734
IE Chopping off left of DIV
In IE6 the left of the #right-content DIV is cut off. I've been playing with it and can't get it to display properly. http://philzit.com/services
The cause is the -60px margin on the #right-content div. You can try adding position:realtive zoom:1 As these often solve these kinds of problems for me.
IE Chopping off left of DIV In IE6 the left of the #right-content DIV is cut off. I've been playing with it and can't get it to display properly. http://philzit.com/services
TITLE: IE Chopping off left of DIV QUESTION: In IE6 the left of the #right-content DIV is cut off. I've been playing with it and can't get it to display properly. http://philzit.com/services ANSWER: The cause is the -60px margin on the #right-content div. You can try adding position:realtive zoom:1 As these often sol...
[ "jsp", "html", "menu", "slider" ]
1
4
210
1
0
2008-10-09T02:27:14.597000
2008-10-09T02:36:47.540000
185,741
188,831
Is BitmapSource the only type can be used in Image Source?
We can use Bitmapsource object as the content of a Image control, However if I only have Bitmap object, can I use it directly, if I convert Bitmap to Bitmapsouce using the following method: Bitmap bitmap = imageObjToBeConvert; IntPtr HBitmap = bitmap.GetHbitmap(); result = Imaging.CreateBitmapSourceFromHBitmap (HBitmap...
No, you cannot use Bitmap directly. This is because System.Drawing.Bitmap is a GDI+ bitmap, while classes like BitmapImage in System.Windows.Media.Imaging are D3D/DirectX. Regarding memory usage, you can't release it directly, but there is usually some sort of caching that goes in the background. There are ways that yo...
Is BitmapSource the only type can be used in Image Source? We can use Bitmapsource object as the content of a Image control, However if I only have Bitmap object, can I use it directly, if I convert Bitmap to Bitmapsouce using the following method: Bitmap bitmap = imageObjToBeConvert; IntPtr HBitmap = bitmap.GetHbitmap...
TITLE: Is BitmapSource the only type can be used in Image Source? QUESTION: We can use Bitmapsource object as the content of a Image control, However if I only have Bitmap object, can I use it directly, if I convert Bitmap to Bitmapsouce using the following method: Bitmap bitmap = imageObjToBeConvert; IntPtr HBitmap =...
[ "wpf", "bitmap", "bitmapsource" ]
2
1
3,282
2
0
2008-10-09T02:42:06.173000
2008-10-09T19:31:13.873000
185,747
185,774
How can I turn an int into three bytes in Java?
I am trying to convert an int into three bytes representing that int (big endian). I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it. For example: int myInt; // some code byte b1, b2, b3; // b1 is most significant, then b2 then b3. *Note, I am aware that a...
To get the least significant byte: b3 = myInt & 0xFF; The 2nd least significant byte: b2 = (myInt >> 8) & 0xFF; And the 3rd least significant byte: b1 = (myInt >> 16) & 0xFF; Explanation: Bitwise ANDing a value with 0xFF (11111111 in binary) will return the least significant 8 bits (bits 0 to 7) in that number. Shiftin...
How can I turn an int into three bytes in Java? I am trying to convert an int into three bytes representing that int (big endian). I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it. For example: int myInt; // some code byte b1, b2, b3; // b1 is most signif...
TITLE: How can I turn an int into three bytes in Java? QUESTION: I am trying to convert an int into three bytes representing that int (big endian). I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it. For example: int myInt; // some code byte b1, b2, b3; //...
[ "java", "bit-manipulation", "byte", "bit-shift" ]
3
15
8,616
5
0
2008-10-09T02:45:40.020000
2008-10-09T02:56:41.337000
185,761
185,771
Access HTTP response headers in for flash.net.URLLoader object?
Is there a way to access the response headers from an HTTP result when using Flash/Flex's URLLoader? Setting the request headers is possible, as is accessing the response code, but getting a hold of the actual response headers seems to be conspicuously lacking... Specifically, I would like to get a hold of the Last-Mod...
Oops. Answering my own question here, but AIR introduces the URLLoader.httpResponseStatus event which includes a responseHeaders property (plus a responseURL property for brownie points). Thankfully my question was for an AIR application, so that solves my problem. It's still a bit shocking that non-AIR flash/flex appl...
Access HTTP response headers in for flash.net.URLLoader object? Is there a way to access the response headers from an HTTP result when using Flash/Flex's URLLoader? Setting the request headers is possible, as is accessing the response code, but getting a hold of the actual response headers seems to be conspicuously lac...
TITLE: Access HTTP response headers in for flash.net.URLLoader object? QUESTION: Is there a way to access the response headers from an HTTP result when using Flash/Flex's URLLoader? Setting the request headers is possible, as is accessing the response code, but getting a hold of the actual response headers seems to be...
[ "apache-flex", "flash", "actionscript-3", "http-headers", "urlloader" ]
17
14
11,065
1
0
2008-10-09T02:49:42.880000
2008-10-09T02:54:09.317000
185,778
1,145,375
How to get proper line number when using trigger_error in PHP?
I am using trigger_error to "throw" errors in a custom class. My problem is that trigger_error prints out the line number where trigger_error was called. For example, given the following code: 01 doSubAction(); 05 } 06 07 function doSubAction() { 08 if(true) 09 trigger_error('Custom error', E_USER_WARNING); 10 } 11 } 1...
Alright, for those of you who are interested in my final solution, I integrated the following piece of code in our framework which returns the correct line number in all the cases that we could of tested. We are using it in production. ErrorHandler class It catches uncaught PHP exceptions, PHP errors and PEAR::Error s....
How to get proper line number when using trigger_error in PHP? I am using trigger_error to "throw" errors in a custom class. My problem is that trigger_error prints out the line number where trigger_error was called. For example, given the following code: 01 doSubAction(); 05 } 06 07 function doSubAction() { 08 if(true...
TITLE: How to get proper line number when using trigger_error in PHP? QUESTION: I am using trigger_error to "throw" errors in a custom class. My problem is that trigger_error prints out the line number where trigger_error was called. For example, given the following code: 01 doSubAction(); 05 } 06 07 function doSubAct...
[ "php", "error-handling" ]
2
1
5,095
6
0
2008-10-09T02:58:16.873000
2009-07-17T19:59:16.607000
185,780
186,104
Modifying NSDate to represent 1 month from today
I'm adding repeating events to a Cocoa app I'm working on. I have repeat every day and week fine because I can define these mathematically (3600*24*7 = 1 week). I use the following code to modify the date: [NSDate dateWithTimeIntervalSinceNow:(3600*24*7*(weeks))] I know how many months have passed since the event was r...
(Almost the same as this question.) From the documentation: Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS release after Mac OS X v10.5. For calendrical calculations, you should use suitable combinations of NSCalendar, NSDate, and NSDateComponents, as descri...
Modifying NSDate to represent 1 month from today I'm adding repeating events to a Cocoa app I'm working on. I have repeat every day and week fine because I can define these mathematically (3600*24*7 = 1 week). I use the following code to modify the date: [NSDate dateWithTimeIntervalSinceNow:(3600*24*7*(weeks))] I know ...
TITLE: Modifying NSDate to represent 1 month from today QUESTION: I'm adding repeating events to a Cocoa app I'm working on. I have repeat every day and week fine because I can define these mathematically (3600*24*7 = 1 week). I use the following code to modify the date: [NSDate dateWithTimeIntervalSinceNow:(3600*24*7...
[ "objective-c", "cocoa", "nsdate" ]
16
37
22,484
5
0
2008-10-09T03:00:30.207000
2008-10-09T06:20:02.847000
185,781
185,920
Finding the LCM of a range of numbers
I read an interesting DailyWTF post today, "Out of All The Possible Answers..." and it interested me enough to dig up the original forum post where it was submitted. This got me thinking how I would solve this interesting problem - the original question is posed on Project Euler as: 2520 is the smallest number that can...
This problem is interesting because it doesn't require you to find the LCM of an arbitrary set of numbers, you're given a consecutive range. You can use a variation of the Sieve of Eratosthenes to find the answer. def RangeLCM(first, last): factors = range(first, last+1) for i in range(0, len(factors)): if factors[i]!=...
Finding the LCM of a range of numbers I read an interesting DailyWTF post today, "Out of All The Possible Answers..." and it interested me enough to dig up the original forum post where it was submitted. This got me thinking how I would solve this interesting problem - the original question is posed on Project Euler as...
TITLE: Finding the LCM of a range of numbers QUESTION: I read an interesting DailyWTF post today, "Out of All The Possible Answers..." and it interested me enough to dig up the original forum post where it was submitted. This got me thinking how I would solve this interesting problem - the original question is posed o...
[ "algorithm", "math", "lcm" ]
23
12
27,931
14
0
2008-10-09T03:00:30.440000
2008-10-09T04:14:07.313000
185,782
332,911
Apache: Caching a DEFLATE'd file
It seems redundant to have zlib compress a web page during every request. It is also the bottleneck of my files' response times. Is there a way to cache the zlib'd file so that it is compressed only once at each modification? Or should I just keep wishing?
If you want a quick and lazy solution, just make gzipped copies of your most used files and turn MultiViews on for them. This still has CPU overhead to calculate the right file to send but it's less than a gzip every time. If you want to take it further you can create static type-map files. Also you could consider usin...
Apache: Caching a DEFLATE'd file It seems redundant to have zlib compress a web page during every request. It is also the bottleneck of my files' response times. Is there a way to cache the zlib'd file so that it is compressed only once at each modification? Or should I just keep wishing?
TITLE: Apache: Caching a DEFLATE'd file QUESTION: It seems redundant to have zlib compress a web page during every request. It is also the bottleneck of my files' response times. Is there a way to cache the zlib'd file so that it is compressed only once at each modification? Or should I just keep wishing? ANSWER: If ...
[ "apache", "caching", "compression", "mod-deflate" ]
2
4
2,398
2
0
2008-10-09T03:00:39.503000
2008-12-02T03:01:30.093000
185,825
185,829
What, exactly, distinguishes between private and protected (in Flex)?
In Flex (and many other languages) a function/method of a class can be declared private or protected (or public). What's the difference? I have the impression it has something to do with the relationship to child classes and how things are inherited or can be called, but I'm not sure what, exactly.
In general: Private members can only be accessed by the class itself. Protected members can only be accessed by the class itself and its descendants. Public members are accessible by everyone. Thus, visibility increases as you go from private to protected to public. In C++, you can control how the visibility of members...
What, exactly, distinguishes between private and protected (in Flex)? In Flex (and many other languages) a function/method of a class can be declared private or protected (or public). What's the difference? I have the impression it has something to do with the relationship to child classes and how things are inherited ...
TITLE: What, exactly, distinguishes between private and protected (in Flex)? QUESTION: In Flex (and many other languages) a function/method of a class can be declared private or protected (or public). What's the difference? I have the impression it has something to do with the relationship to child classes and how thi...
[ "apache-flex", "oop", "scope" ]
2
11
2,430
1
0
2008-10-09T03:22:46.497000
2008-10-09T03:25:17.130000
185,836
185,856
Equivalent of Class Loaders in .NET
Does anyone know if it possible to define the equivalent of a "java custom class loader" in.NET? To give a little background: I am in the process of developing a new programming language that targets the CLR, called "Liberty". One of the features of the language is its ability to define "type constructors", which are m...
The answer is yes, but the solution is a little tricky. The System.Reflection.Emit namespace defines types that allows assemblies to be generated dynamically. They also allow the generated assemblies to be defined incrementally. In other words it is possible to add types to the dynamic assembly, execute the generated c...
Equivalent of Class Loaders in .NET Does anyone know if it possible to define the equivalent of a "java custom class loader" in.NET? To give a little background: I am in the process of developing a new programming language that targets the CLR, called "Liberty". One of the features of the language is its ability to def...
TITLE: Equivalent of Class Loaders in .NET QUESTION: Does anyone know if it possible to define the equivalent of a "java custom class loader" in.NET? To give a little background: I am in the process of developing a new programming language that targets the CLR, called "Liberty". One of the features of the language is ...
[ ".net", "compiler-construction", "programming-languages", "clr", "language-features" ]
44
52
14,297
2
0
2008-10-09T03:31:03.437000
2008-10-09T03:39:09.350000
185,842
186,566
How to Write a "Fake" ListBox
I use ListBox to show Images. However I found if the Listbox contain more than 1000 Image Items, It is really slow if I want to zoom the thumbnails. I asked the qestion in In a WPF ListBox with more than 1000 Image Items the Zoom Images become slow And tried lots of method, however I can't solve the problem by simply c...
Read my response here. You need to implement a VirtualizingWrapPanel!
How to Write a "Fake" ListBox I use ListBox to show Images. However I found if the Listbox contain more than 1000 Image Items, It is really slow if I want to zoom the thumbnails. I asked the qestion in In a WPF ListBox with more than 1000 Image Items the Zoom Images become slow And tried lots of method, however I can't...
TITLE: How to Write a "Fake" ListBox QUESTION: I use ListBox to show Images. However I found if the Listbox contain more than 1000 Image Items, It is really slow if I want to zoom the thumbnails. I asked the qestion in In a WPF ListBox with more than 1000 Image Items the Zoom Images become slow And tried lots of metho...
[ "wpf", "image", "listbox", "resize" ]
1
3
707
2
0
2008-10-09T03:33:05.507000
2008-10-09T09:42:55.387000
185,844
185,848
How to initialize private static data members in a header file
What is the best way to initialize a private, static data member in C++? I tried this in my header file, but it gives me weird linker errors: class foo { private: static int i; }; int foo::i = 0; I'm guessing this is because I can't initialize a private member from outside the class. So what's the best way to do this?
The class declaration should be in the header file, or in the source file, if the class is not used in other files. // foo.h class foo { private: static int i; }; However, the initialization should be in the source file. // foo.cpp int foo::i = 0; If the initialization is in the header file, then each file that include...
How to initialize private static data members in a header file What is the best way to initialize a private, static data member in C++? I tried this in my header file, but it gives me weird linker errors: class foo { private: static int i; }; int foo::i = 0; I'm guessing this is because I can't initialize a private me...
TITLE: How to initialize private static data members in a header file QUESTION: What is the best way to initialize a private, static data member in C++? I tried this in my header file, but it gives me weird linker errors: class foo { private: static int i; }; int foo::i = 0; I'm guessing this is because I can't initi...
[ "c++", "initialization", "header-files", "static-members" ]
637
672
674,544
18
0
2008-10-09T03:34:35.193000
2008-10-09T03:36:11.197000
185,862
185,913
New project: I am having troubles picking a language to use
I am starting my first independent for profit venture. I am having a hard time deciding what language to use. I want to write my app in Perl, but I don't think it will be simple enough to compile. If I don't write it in Perl I will write it in C++. The application will have many features, including wxwidgets interface,...
Why not use a hybrid of both? It's generally the way a lot of development is going these days. I'd suggest a Lua/C++ or a Python/C++ combo (I'm not sure how well a Perl/C++ combo works, but that may be a good option too). Personally I've done a bunch with the Lua/C++ combo and it's pretty fantastic.
New project: I am having troubles picking a language to use I am starting my first independent for profit venture. I am having a hard time deciding what language to use. I want to write my app in Perl, but I don't think it will be simple enough to compile. If I don't write it in Perl I will write it in C++. The applica...
TITLE: New project: I am having troubles picking a language to use QUESTION: I am starting my first independent for profit venture. I am having a hard time deciding what language to use. I want to write my app in Perl, but I don't think it will be simple enough to compile. If I don't write it in Perl I will write it i...
[ "c++", "perl", "wxwidgets", "packaging" ]
6
9
690
8
0
2008-10-09T03:41:29.657000
2008-10-09T04:10:17.820000
185,883
185,921
Qt: difference between moc output in debug and release?
Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be identical. On the other hand when adding a UI class, the uic.exe generated...
My guess would be that separate debug and release versions are needed because the moc output is generated from user-defined source code. So the moc output might be different between debug and release builds if the preprocessed class source differs between debug and release (for example, a signal that exists only in the...
Qt: difference between moc output in debug and release? Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be identical. On the ...
TITLE: Qt: difference between moc output in debug and release? QUESTION: Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be ...
[ "c++", "visual-studio", "qt" ]
4
8
2,868
2
0
2008-10-09T03:53:40.350000
2008-10-09T04:14:19.980000
185,893
185,955
How do I analyze a .hprof file?
I have a production server running with the following flag: - XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information from it. Any ideas?
If you want a fairly advanced tool to do some serious poking around, look at the Memory Analyzer project at Eclipse, contributed to them by SAP. Some of what you can do is mind-blowingly good for finding memory leaks etc -- including running a form of limited SQL (OQL) against the in-memory objects, i.e. SELECT toStrin...
How do I analyze a .hprof file? I have a production server running with the following flag: - XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information ...
TITLE: How do I analyze a .hprof file? QUESTION: I have a production server running with the following flag: - XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any u...
[ "java", "profiling", "heap-memory" ]
272
249
445,688
8
0
2008-10-09T04:04:03.480000
2008-10-09T04:41:31.313000
185,896
185,909
Deleting Visual Studio binary output folders automatically?
I just got through manually removing the bin\ and obj\ folders from around 30 VS projects getting them ready for an initial SVN commit. Yeah, I know, I should have done it alot sooner, but these are personal project on my home PC, and I only installed a SVN server locally today. Anyway, it occurs to me that there must ...
You can use svn:ignore to avoid committing unnecessary files...
Deleting Visual Studio binary output folders automatically? I just got through manually removing the bin\ and obj\ folders from around 30 VS projects getting them ready for an initial SVN commit. Yeah, I know, I should have done it alot sooner, but these are personal project on my home PC, and I only installed a SVN se...
TITLE: Deleting Visual Studio binary output folders automatically? QUESTION: I just got through manually removing the bin\ and obj\ folders from around 30 VS projects getting them ready for an initial SVN commit. Yeah, I know, I should have done it alot sooner, but these are personal project on my home PC, and I only ...
[ "visual-studio-2008", "svn" ]
0
4
615
4
0
2008-10-09T04:05:14.540000
2008-10-09T04:09:41.283000
185,898
188,062
Localization / internationalization tool
I'm looking to add localization to a web site (asp.net /c# if that makes a difference) with a minimum of effort. I've looked at tools like wiztom multilizer and I am curious as to others experience with them. Have you used tools like these successfully and if so, what would you do differently?
From my experience with making localized applications I can say that there really isn't an easy, shrink-wrapped solution to this problem. Your best bet is to do a lot of reading on the topic (Google is your friend) and figure out a solution that works best in your specific instance. I think you'll have an issue with th...
Localization / internationalization tool I'm looking to add localization to a web site (asp.net /c# if that makes a difference) with a minimum of effort. I've looked at tools like wiztom multilizer and I am curious as to others experience with them. Have you used tools like these successfully and if so, what would you ...
TITLE: Localization / internationalization tool QUESTION: I'm looking to add localization to a web site (asp.net /c# if that makes a difference) with a minimum of effort. I've looked at tools like wiztom multilizer and I am curious as to others experience with them. Have you used tools like these successfully and if s...
[ "c#", "asp.net", "localization" ]
2
1
1,362
4
0
2008-10-09T04:05:36.457000
2008-10-09T16:27:21.733000
185,899
185,903
What is the difference between a symbolic link and a hard link?
Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one.
Underneath the file system, files are represented by inodes. (Or is it multiple inodes? Not sure.) A file in the file system is basically a link to an inode. A hard link, then, just creates another file with a link to the same underlying inode. When you delete a file, it removes one link to the underlying inode. The in...
What is the difference between a symbolic link and a hard link? Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one.
TITLE: What is the difference between a symbolic link and a hard link? QUESTION: Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one. ANSWER: Underneath the...
[ "unix", "symlink", "hardlink" ]
1,097
1,089
521,310
23
0
2008-10-09T04:05:41.840000
2008-10-09T04:07:48.293000
185,934
185,939
How do I create a copy of an object in PHP?
It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: b = "after"; } $a = new A(); $a->b = "before"; $c = $a; //i would especially expect this to create a copy. set_b($a); print $a->b; //i would expect th...
In PHP 5+ objects are passed by reference. In PHP 4 they are passed by value (that's why it had runtime pass by reference, which became deprecated). You can use the 'clone' operator in PHP5 to copy objects: $objectB = clone $objectA; Also, it's just objects that are passed by reference, not everything as you've said in...
How do I create a copy of an object in PHP? It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: b = "after"; } $a = new A(); $a->b = "before"; $c = $a; //i would especially expect this to create a copy. ...
TITLE: How do I create a copy of an object in PHP? QUESTION: It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: b = "after"; } $a = new A(); $a->b = "before"; $c = $a; //i would especially expect this t...
[ "php", "copy", "clone", "shallow-copy" ]
207
341
169,460
9
0
2008-10-09T04:21:03.523000
2008-10-09T04:24:09.790000
185,936
185,941
How to delete the contents of a folder?
How can I delete the contents of a local folder in Python? The current project is for Windows, but I would like to see *nix also.
import os, shutil folder = '/path/to/folder' for filename in os.listdir(folder): file_path = os.path.join(folder, filename) try: if os.path.isfile(file_path) or os.path.islink(file_path): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) except Exception as e: print('Failed to delete %s. Reas...
How to delete the contents of a folder? How can I delete the contents of a local folder in Python? The current project is for Windows, but I would like to see *nix also.
TITLE: How to delete the contents of a folder? QUESTION: How can I delete the contents of a local folder in Python? The current project is for Windows, but I would like to see *nix also. ANSWER: import os, shutil folder = '/path/to/folder' for filename in os.listdir(folder): file_path = os.path.join(folder, filename)...
[ "python", "file" ]
821
697
1,019,936
28
0
2008-10-09T04:22:33.817000
2008-10-09T04:27:21.357000
185,937
185,942
Overriding the java equals() method - not working?
I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to track down. Just for completeness, I wasn't using an IDE or debugger - just good old fashioned text editor and System.out'...
In Java, the equals() method that is inherited from Object is: public boolean equals(Object other); In other words, the parameter must be of type Object. This is called overriding; your method public boolean equals(Book other) does what is called overloading to the equals() method. The ArrayList uses overridden equals(...
Overriding the java equals() method - not working? I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to track down. Just for completeness, I wasn't using an IDE or debugger - ...
TITLE: Overriding the java equals() method - not working? QUESTION: I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to track down. Just for completeness, I wasn't using an ...
[ "java", "equals", "overriding" ]
154
335
260,967
9
0
2008-10-09T04:22:57.543000
2008-10-09T04:27:54.103000
185,947
185,969
Ruby: define_method vs. def
As a programming exercise, I've written a Ruby snippet that creates a class, instantiates two objects from that class, monkeypatches one object, and relies on method_missing to monkeypatch the other one. Here's the deal. This works as intended: class Monkey def chatter puts "I am a chattering monkey!" end def method_...
define_method is a (private) method of the object Class. You are calling it from an instance. There is no instance method called define_method, so it recurses to your method_missing, this time with:define_method (the name of the missing method), and:screech (the sole argument you passed to define_method ). Try this ins...
Ruby: define_method vs. def As a programming exercise, I've written a Ruby snippet that creates a class, instantiates two objects from that class, monkeypatches one object, and relies on method_missing to monkeypatch the other one. Here's the deal. This works as intended: class Monkey def chatter puts "I am a chatteri...
TITLE: Ruby: define_method vs. def QUESTION: As a programming exercise, I've written a Ruby snippet that creates a class, instantiates two objects from that class, monkeypatches one object, and relies on method_missing to monkeypatch the other one. Here's the deal. This works as intended: class Monkey def chatter put...
[ "ruby", "metaprogramming" ]
67
140
38,757
3
0
2008-10-09T04:31:47.310000
2008-10-09T04:58:17.037000
185,953
455,080
Can I pass a sharepoint security context value to a reporting services report parameter?
I'm considering using reporting services 05 SP2 with share point integration on a new reporting project. In this project's reports users can only see records they own. I was thinking a simple userId parameter on the report would allow me to filter the report's results to only these "owned" records. I'm curious: Can I p...
The sharepoint UserID = the one RS will use and detect. This is defined by UserID global in RS and picked up form the login token. You can hide the parameter (Report) or just specify it at the dataset level (SQL).
Can I pass a sharepoint security context value to a reporting services report parameter? I'm considering using reporting services 05 SP2 with share point integration on a new reporting project. In this project's reports users can only see records they own. I was thinking a simple userId parameter on the report would al...
TITLE: Can I pass a sharepoint security context value to a reporting services report parameter? QUESTION: I'm considering using reporting services 05 SP2 with share point integration on a new reporting project. In this project's reports users can only see records they own. I was thinking a simple userId parameter on t...
[ "sql-server", "sharepoint", "reporting-services" ]
0
2
1,210
2
0
2008-10-09T04:37:52.100000
2009-01-18T12:56:16.110000
185,962
186,047
How do I send an alert to a blackberry from an Excel 2007 spreadsheet?
I've been asked to find a way to send an alert to a blackberry when certain conditions are met on an Excel 2007 spreadsheet. The alert can be an SMS (preferred) or an email. The cell values are changing throughout the day from a DDE feed. What are the typical solutions that people use to solve this?
I know next to nothing on the specifics of Excel or Office programming, but I can think of a few ways to solve the problem generically. I'm also assuming that the solution can be.Net based since Excel is available. hook into the update process to test the conditions at the end of the update. Office interop if you wante...
How do I send an alert to a blackberry from an Excel 2007 spreadsheet? I've been asked to find a way to send an alert to a blackberry when certain conditions are met on an Excel 2007 spreadsheet. The alert can be an SMS (preferred) or an email. The cell values are changing throughout the day from a DDE feed. What are t...
TITLE: How do I send an alert to a blackberry from an Excel 2007 spreadsheet? QUESTION: I've been asked to find a way to send an alert to a blackberry when certain conditions are met on an Excel 2007 spreadsheet. The alert can be an SMS (preferred) or an email. The cell values are changing throughout the day from a DD...
[ "events", "excel-2007", "notifications" ]
0
1
650
2
0
2008-10-09T04:48:54.887000
2008-10-09T05:52:01.407000
185,965
186,508
Rails: How to change the title of a page?
What is the best way to create a custom title for pages in a Rails app without using a plug-in?
In your views do something like this: <% content_for:title, "Title for specific page" %> <%= content_for(:title, "Title for specific page") %> The following goes in the layout file: <%= yield(:title) %> <%= yield(:title) %> It's also possible to encapsulate the content_for and yield(:title) statements in helper methods...
Rails: How to change the title of a page? What is the best way to create a custom title for pages in a Rails app without using a plug-in?
TITLE: Rails: How to change the title of a page? QUESTION: What is the best way to create a custom title for pages in a Rails app without using a plug-in? ANSWER: In your views do something like this: <% content_for:title, "Title for specific page" %> <%= content_for(:title, "Title for specific page") %> The followin...
[ "ruby-on-rails", "ruby" ]
173
265
91,089
17
0
2008-10-09T04:53:04.927000
2008-10-09T09:19:37.010000
185,966
186,018
How to select a range of elements in jQuery
.................. If you wanted to select the 2nd, 3rd and 4th a tags in the above example, how would you do that? The only thing I can think of is: $("#myDiv a:eq(1), #myDiv a:eq(2), #myDiv a:eq(3)") But that doesn't look to be very efficient or pretty. I guess you could also select ALL the a s and then do run.each o...
jQuery slice() function taking indexes of the first and the last needed elements selects a subset of the matched elements. Note what it doesn't include last element itself. In your particular case you should use $("#myDiv a").slice(1, 4)
How to select a range of elements in jQuery .................. If you wanted to select the 2nd, 3rd and 4th a tags in the above example, how would you do that? The only thing I can think of is: $("#myDiv a:eq(1), #myDiv a:eq(2), #myDiv a:eq(3)") But that doesn't look to be very efficient or pretty. I guess you could al...
TITLE: How to select a range of elements in jQuery QUESTION: .................. If you wanted to select the 2nd, 3rd and 4th a tags in the above example, how would you do that? The only thing I can think of is: $("#myDiv a:eq(1), #myDiv a:eq(2), #myDiv a:eq(3)") But that doesn't look to be very efficient or pretty. I ...
[ "javascript", "jquery" ]
62
127
52,796
3
0
2008-10-09T04:53:08.887000
2008-10-09T05:32:46.313000
185,967
185,988
Generate an E-R Diagram by reverse-engineering a database
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations. Querying PostgreSQL data dictionary for foreign-keys and relationship between tables is very straightforward, but how can I use that information t...
Dot is part of the graphviz package, which is a pretty damn cool/useful tool. Of course, you'll need something to generate the dot files for graphviz. I've used SchemaSpy once or twice in the past, and it works pretty well, provided you have the relationships defined in the database.
Generate an E-R Diagram by reverse-engineering a database Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations. Querying PostgreSQL data dictionary for foreign-keys and relationship between tables is ...
TITLE: Generate an E-R Diagram by reverse-engineering a database QUESTION: Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations. Querying PostgreSQL data dictionary for foreign-keys and relationship ...
[ "database", "diagram", "entity-relationship" ]
18
14
44,645
5
0
2008-10-09T04:53:23.130000
2008-10-09T05:16:28
185,972
188,235
How do I create a heterogeneous Array in Scala?
In javascript, we can do: ["a string", 10, {x: 1}, function() {}].push("another value"); What is the Scala equivalent?
Arrays in Scala are very much homogeneous. This is because Scala is a statically typed language. If you really need pseudo-heterogeneous features, you need to use an immutable data structure that is parametrized covariantly (most immutable data structures are). List is the canonical example there, but Vector is also an...
How do I create a heterogeneous Array in Scala? In javascript, we can do: ["a string", 10, {x: 1}, function() {}].push("another value"); What is the Scala equivalent?
TITLE: How do I create a heterogeneous Array in Scala? QUESTION: In javascript, we can do: ["a string", 10, {x: 1}, function() {}].push("another value"); What is the Scala equivalent? ANSWER: Arrays in Scala are very much homogeneous. This is because Scala is a statically typed language. If you really need pseudo-het...
[ "arrays", "scala" ]
28
41
29,844
4
0
2008-10-09T05:00:50.307000
2008-10-09T17:08:54.143000
185,983
191,395
Configuring IIS on Windows Vista Home Edition
My friend accidentally bought a laptop with Windows Vista Home Basic Edition. He figured out how to install IIS on it, but it doesn't seem to have either the management console or the admin tools. Is there any way for him to configure a site or import an IIS 6 config file? EDIT: "Windows Vista Home Edition" --> "Window...
Not entirely certain here, but start the IIS console on another machine and tell it to connect to the laptop? The normal management console snap-ins all support remote operation.
Configuring IIS on Windows Vista Home Edition My friend accidentally bought a laptop with Windows Vista Home Basic Edition. He figured out how to install IIS on it, but it doesn't seem to have either the management console or the admin tools. Is there any way for him to configure a site or import an IIS 6 config file? ...
TITLE: Configuring IIS on Windows Vista Home Edition QUESTION: My friend accidentally bought a laptop with Windows Vista Home Basic Edition. He figured out how to install IIS on it, but it doesn't seem to have either the management console or the admin tools. Is there any way for him to configure a site or import an I...
[ "iis", "windows-vista" ]
1
1
11,265
5
0
2008-10-09T05:09:58.543000
2008-10-10T13:57:59.540000
185,987
186,003
What open source .Net utility projects or code libraries do you use?
I use log4net in just about every code project. I was wondering what other generally useful code projects are available?
Rhino.Mocks NUnit NHibernate Spring.NET Castle My own somewhat eclectic MiscUtil PostSharp
What open source .Net utility projects or code libraries do you use? I use log4net in just about every code project. I was wondering what other generally useful code projects are available?
TITLE: What open source .Net utility projects or code libraries do you use? QUESTION: I use log4net in just about every code project. I was wondering what other generally useful code projects are available? ANSWER: Rhino.Mocks NUnit NHibernate Spring.NET Castle My own somewhat eclectic MiscUtil PostSharp
[ ".net", "open-source", "utility" ]
3
5
372
8
0
2008-10-09T05:16:22.290000
2008-10-09T05:26:17.340000
185,993
186,013
MVP examples for Windows Forms
Is there good example code or a test project for explaining the Model–view–presenter (MVP) pattern. There are a lot of explanation links, but I want to have some good example code to show others without reinventing the wheel.
Jeremy Miller's "Build your own CAB" series is fantastic. You get a nice dose of MVP (along with some other smart client patterns such as Pub/Sub). http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx
MVP examples for Windows Forms Is there good example code or a test project for explaining the Model–view–presenter (MVP) pattern. There are a lot of explanation links, but I want to have some good example code to show others without reinventing the wheel.
TITLE: MVP examples for Windows Forms QUESTION: Is there good example code or a test project for explaining the Model–view–presenter (MVP) pattern. There are a lot of explanation links, but I want to have some good example code to show others without reinventing the wheel. ANSWER: Jeremy Miller's "Build your own CAB"...
[ "c#", ".net", "winforms", "mvp" ]
40
24
46,100
2
0
2008-10-09T05:19:53.577000
2008-10-09T05:30:40.043000
186,015
186,020
What's the best way to find a string/regex match in files recursively? (UNIX)
I have had to do this several times, usually when trying to find in what files a variable or a function is used. I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.
grep -r REGEX. Replace. with whatever directory you want to search from.
What's the best way to find a string/regex match in files recursively? (UNIX) I have had to do this several times, usually when trying to find in what files a variable or a function is used. I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.
TITLE: What's the best way to find a string/regex match in files recursively? (UNIX) QUESTION: I have had to do this several times, usually when trying to find in what files a variable or a function is used. I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways. ANSW...
[ "linux", "unix", "recursion", "grep" ]
34
43
42,408
8
0
2008-10-09T05:31:27.063000
2008-10-09T05:33:55.873000
186,035
186,189
Is it possible to print a DIV that is hidden by jQuery's "slideUp" function
I have a simple "accordion" type page containing a list of H3 headers and DIV content boxes (each H3 is followed by a DIV). On this page I start with all DIVs hidden. When a H3 is clicked the DIV directly below (after) is revealed with jQuery's "slideDown" function while all other DIVs are hidden with the "slideUp" fun...
You can use the!important clause in CSS. This will override the inline style. So if you setup a print media stylesheet - you can do something like div.accordian { display:block!important; }
Is it possible to print a DIV that is hidden by jQuery's "slideUp" function I have a simple "accordion" type page containing a list of H3 headers and DIV content boxes (each H3 is followed by a DIV). On this page I start with all DIVs hidden. When a H3 is clicked the DIV directly below (after) is revealed with jQuery's...
TITLE: Is it possible to print a DIV that is hidden by jQuery's "slideUp" function QUESTION: I have a simple "accordion" type page containing a list of H3 headers and DIV content boxes (each H3 is followed by a DIV). On this page I start with all DIVs hidden. When a H3 is clicked the DIV directly below (after) is reve...
[ "jquery", "css" ]
7
11
9,382
5
0
2008-10-09T05:40:21.493000
2008-10-09T06:49:09.637000
186,044
186,058
Is it considered bad practice to use absolute positioning?
I was developing a web page, where I was laying out a board for a Chess-like game, along with a couple of piece trays. It's all done using HTML (with jQuery for dynamic updating as the game is played). Somewhere I'd got the notion that using absolute positioning of elements within a page was considered a bad practice, ...
For a chess like game such as you are developing, there is nothing inherently wrong with using absolute positioning. As you said, relative positioning and normal flow layout make this sort of task quite difficult. Of course, if you were developing a more standard website, such as a site providing some public service, a...
Is it considered bad practice to use absolute positioning? I was developing a web page, where I was laying out a board for a Chess-like game, along with a couple of piece trays. It's all done using HTML (with jQuery for dynamic updating as the game is played). Somewhere I'd got the notion that using absolute positionin...
TITLE: Is it considered bad practice to use absolute positioning? QUESTION: I was developing a web page, where I was laying out a board for a Chess-like game, along with a couple of piece trays. It's all done using HTML (with jQuery for dynamic updating as the game is played). Somewhere I'd got the notion that using a...
[ "html", "css" ]
76
92
39,796
12
0
2008-10-09T05:48:35.437000
2008-10-09T05:56:54.813000
186,062
1,349,318
Can an ASP.NET MVC controller return an Image?
Can I create a Controller that simply returns an image asset? I would like to route this logic through a controller, whenever a URL such as the following is requested: www.mywebsite.com/resource/image/topbanner The controller will look up topbanner.png and send that image directly back to the client. I've seen examples...
Use the base controllers File method. public ActionResult Image(string id) { var dir = Server.MapPath("/Images"); var path = Path.Combine(dir, id + ".jpg"); //validate the path for security or use other means to generate the path. return base.File(path, "image/jpeg"); } As a note, this seems to be fairly efficient. I d...
Can an ASP.NET MVC controller return an Image? Can I create a Controller that simply returns an image asset? I would like to route this logic through a controller, whenever a URL such as the following is requested: www.mywebsite.com/resource/image/topbanner The controller will look up topbanner.png and send that image ...
TITLE: Can an ASP.NET MVC controller return an Image? QUESTION: Can I create a Controller that simply returns an image asset? I would like to route this logic through a controller, whenever a URL such as the following is requested: www.mywebsite.com/resource/image/topbanner The controller will look up topbanner.png an...
[ "asp.net", "asp.net-mvc", "image", "controller" ]
483
556
274,489
20
0
2008-10-09T05:58:17.603000
2009-08-28T20:58:45
186,073
186,414
What are some good DirectX resources for a beginner?
I'm learning DirectX as part of a hobby project. I've been looking for some good online resources for DirectX9 (using C++, if that distinction matters), but haven't found anything that's a) great for a beginner and b) up to date. Any recommendations?
When I started using DirectX I found this to be the best resource around for basic stuff: http://www.directxtutorial.com/ When you start reaching an intermediate level they want you to pay a subscription but all the good basic stuff is free. Tutorials are clear and literally step-by-step. This is website is not bad at ...
What are some good DirectX resources for a beginner? I'm learning DirectX as part of a hobby project. I've been looking for some good online resources for DirectX9 (using C++, if that distinction matters), but haven't found anything that's a) great for a beginner and b) up to date. Any recommendations?
TITLE: What are some good DirectX resources for a beginner? QUESTION: I'm learning DirectX as part of a hobby project. I've been looking for some good online resources for DirectX9 (using C++, if that distinction matters), but haven't found anything that's a) great for a beginner and b) up to date. Any recommendations...
[ "c++", "resources", "directx" ]
9
4
5,493
4
0
2008-10-09T06:02:40.697000
2008-10-09T08:30:36.453000
186,077
186,098
How do I create a sparse file programmatically, in C, on Mac OS X?
I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible?
As in other Unixes, it's a feature of the filesystem. Either the filesystem supports it for ALL files or it doesn't. Unlike Win32, you don't have to do anything special to make it happen. Also unlike Win32, there is no performance penalty for using a sparse file. On MacOS, the default filesystem is HFS+ which does not ...
How do I create a sparse file programmatically, in C, on Mac OS X? I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible?
TITLE: How do I create a sparse file programmatically, in C, on Mac OS X? QUESTION: I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible? ANSWER: As in other Unixes, it's a feature of the filesystem. Either the filesystem supports it for...
[ "c", "macos", "filesystems" ]
9
6
9,899
7
0
2008-10-09T06:03:32.460000
2008-10-09T06:18:26.470000
186,082
186,155
Initializing static objects - Code design question
In my webapplication (C#,.Net 3.5), made up of a core class library (containing the business logic, data layer and a couple of utility classes), a windows service project, a webservice project and the website project, I have a couple of static classes in the core library used by all other projects. These classes (for e...
I would try to avoid static classes for things which will require initialization. Make your Log class a normal class, and perhaps have a separate factory class to create instances or a single instance. You might want to use dependency injection to avoid having any statics, although this could get painful for something ...
Initializing static objects - Code design question In my webapplication (C#,.Net 3.5), made up of a core class library (containing the business logic, data layer and a couple of utility classes), a windows service project, a webservice project and the website project, I have a couple of static classes in the core libra...
TITLE: Initializing static objects - Code design question QUESTION: In my webapplication (C#,.Net 3.5), made up of a core class library (containing the business logic, data layer and a couple of utility classes), a windows service project, a webservice project and the website project, I have a couple of static classes...
[ "c#", "design-patterns", "architecture", "static" ]
0
6
1,459
5
0
2008-10-09T06:06:50.767000
2008-10-09T06:34:30.353000
186,096
186,102
Regex Search and Replace Program
Is there a simple and lightweight program to search over a text file and replace a string with regex?
For searching: grep - simple and fast. Included with Linux, here 's a Windows version, not sure about Mac. For replacing: sed. Here 's a Windows version, not sure about Mac. Of course, if you want to actually open up a file and see its contents while you search and replace, you can use emacs for that. Or ConTEXT. Or vi...
Regex Search and Replace Program Is there a simple and lightweight program to search over a text file and replace a string with regex?
TITLE: Regex Search and Replace Program QUESTION: Is there a simple and lightweight program to search over a text file and replace a string with regex? ANSWER: For searching: grep - simple and fast. Included with Linux, here 's a Windows version, not sure about Mac. For replacing: sed. Here 's a Windows version, not ...
[ "regex", "search" ]
4
7
2,523
10
0
2008-10-09T06:17:48.203000
2008-10-09T06:19:40.663000
186,099
189,327
How do you handle the "Too many files" problem when working in Bash?
I many times have to work with directories containing hundreds of thousands of files, doing text matching, replacing and so on. If I go the standard route of, say grep foo * I get the too many files error message, so I end up doing for i in *; do grep foo $i; done or find../path/ | xargs -I{} grep foo "{}" But these ar...
In newer versions of findutils, find can do the work of xargs (including the glomming behavior, such that only as many grep processes as needed are used): find../path -exec grep foo '{}' + The use of + rather than; as the last argument triggers this behavior.
How do you handle the "Too many files" problem when working in Bash? I many times have to work with directories containing hundreds of thousands of files, doing text matching, replacing and so on. If I go the standard route of, say grep foo * I get the too many files error message, so I end up doing for i in *; do grep...
TITLE: How do you handle the "Too many files" problem when working in Bash? QUESTION: I many times have to work with directories containing hundreds of thousands of files, doing text matching, replacing and so on. If I go the standard route of, say grep foo * I get the too many files error message, so I end up doing f...
[ "bash", "unix", "shell" ]
7
10
10,754
5
0
2008-10-09T06:18:44.130000
2008-10-09T21:43:42.653000
186,108
186,124
How do you use environment variables in vxWorks?
In a vxWorks Real-Time process, you can pass environment variables as one of the parameter of the main routine. How do you use the environment variables in the kernel context?
Call this directly from the VxWorks shell: putenv " = " replace with your environment variable name and with the value you want to set it to.
How do you use environment variables in vxWorks? In a vxWorks Real-Time process, you can pass environment variables as one of the parameter of the main routine. How do you use the environment variables in the kernel context?
TITLE: How do you use environment variables in vxWorks? QUESTION: In a vxWorks Real-Time process, you can pass environment variables as one of the parameter of the main routine. How do you use the environment variables in the kernel context? ANSWER: Call this directly from the VxWorks shell: putenv " = " replace with...
[ "vxworks" ]
1
2
6,075
2
0
2008-10-09T06:22:21.190000
2008-10-09T06:27:34.300000
186,118
186,753
Eclipse fonts and background color
I have been trying to change the background color of Eclipse's windows to black and customize the font colors. There doesn't seem to be a way to do this, at least not in an obvious way. I am using version 3.3. How do I do this or are there any plugin's that might be able to assist in doing this?
To change background colour Open menu *Windows → Preferences → General → Editors → Text Editors Browse Appearance color options Select background color options, uncheck default, change to black Select background color options, uncheck default, change to colour of choice To change text colours Open Java → Editor → Synta...
Eclipse fonts and background color I have been trying to change the background color of Eclipse's windows to black and customize the font colors. There doesn't seem to be a way to do this, at least not in an obvious way. I am using version 3.3. How do I do this or are there any plugin's that might be able to assist in ...
TITLE: Eclipse fonts and background color QUESTION: I have been trying to change the background color of Eclipse's windows to black and customize the font colors. There doesn't seem to be a way to do this, at least not in an obvious way. I am using version 3.3. How do I do this or are there any plugin's that might be ...
[ "eclipse", "configuration", "eclipse-plugin", "eclipse-3.3" ]
258
299
461,743
11
0
2008-10-09T06:26:09.823000
2008-10-09T11:01:21.797000
186,128
186,154
What to do if I don't have Visual Basic 6.0 and need to compile a VB6 project?
A client wants me to do some maintenance work to a VB 6.0 application (migration to.NET is also in the pipeline), but he doesn't have the development tools because he received just the source code and running application from the original programmer, who is no longer available. Microsoft doesn't sell Visual Studio 6.0,...
From what I recall the Visual Studio 6.0 is available for MSDN Subscribers.
What to do if I don't have Visual Basic 6.0 and need to compile a VB6 project? A client wants me to do some maintenance work to a VB 6.0 application (migration to.NET is also in the pipeline), but he doesn't have the development tools because he received just the source code and running application from the original pr...
TITLE: What to do if I don't have Visual Basic 6.0 and need to compile a VB6 project? QUESTION: A client wants me to do some maintenance work to a VB 6.0 application (migration to.NET is also in the pipeline), but he doesn't have the development tools because he received just the source code and running application fr...
[ "visual-studio", "vb6", "devtools" ]
10
16
11,387
6
0
2008-10-09T06:28:02.300000
2008-10-09T06:34:26.687000
186,131
186,295
Extracting unique items from a list of mappings
He're an interesting problem that looks for the most Pythonic solution. Suppose I have a list of mappings {'id': id, 'url': url}. Some id s in the list are duplicate, and I want to create a new list, with all the duplicates removed. I came up with the following function: def unique_mapping(map): d = {} for res in map: ...
Your example can be rewritten slightly to construct the first dictionary using a generator expression and to remove necessity of construction of another mappings. Just reuse the old ones: def unique_mapping(mappings): return dict((m['id'], m) for m in mappings).values() Although this came out as a one-liner, I still th...
Extracting unique items from a list of mappings He're an interesting problem that looks for the most Pythonic solution. Suppose I have a list of mappings {'id': id, 'url': url}. Some id s in the list are duplicate, and I want to create a new list, with all the duplicates removed. I came up with the following function: ...
TITLE: Extracting unique items from a list of mappings QUESTION: He're an interesting problem that looks for the most Pythonic solution. Suppose I have a list of mappings {'id': id, 'url': url}. Some id s in the list are duplicate, and I want to create a new list, with all the duplicates removed. I came up with the fo...
[ "python", "unique", "duplicate-data" ]
2
4
425
3
0
2008-10-09T06:28:26.823000
2008-10-09T07:47:09.597000
186,142
187,299
MVC data design problem with Zend framework
If I have a class representing access to one table in my database in a class:table relationship, so I can hide table details in one class. But as any useful application I have to query several tables. How can I accomodate this using the class:table design?
There's a couple of different ways you can achieve this, however, which one you choose really depends on your circumstances. 1) Break the connection between your objects and your database Write your objects to have no connection with your database tables. First normalise your database tables, then, look at how the user...
MVC data design problem with Zend framework If I have a class representing access to one table in my database in a class:table relationship, so I can hide table details in one class. But as any useful application I have to query several tables. How can I accomodate this using the class:table design?
TITLE: MVC data design problem with Zend framework QUESTION: If I have a class representing access to one table in my database in a class:table relationship, so I can hide table details in one class. But as any useful application I have to query several tables. How can I accomodate this using the class:table design? ...
[ "php", "database", "zend-framework" ]
2
2
1,097
1
0
2008-10-09T06:31:40.950000
2008-10-09T13:43:37.087000
186,160
186,221
How do I add to a list with Linq to SQL?
I have a table in the database that I'm retrieving using LINQ to SQL, and as a part of my processing I want to add to this list, then update the database with the new items + any changes I've made. What I thought I could do was this: var list = (from item in db.Table select item).ToList(); [do processing where I modif...
The List is meaningless. It's just happens to hold objects that the DataContext knows about. We need to make sure that the DataContext knows about the new ones. The important thing is that they don't have to be complete when we alert the DataContext to them: Item item; if (needNewOne) { item = new Item(); db.InsertOnSu...
How do I add to a list with Linq to SQL? I have a table in the database that I'm retrieving using LINQ to SQL, and as a part of my processing I want to add to this list, then update the database with the new items + any changes I've made. What I thought I could do was this: var list = (from item in db.Table select item...
TITLE: How do I add to a list with Linq to SQL? QUESTION: I have a table in the database that I'm retrieving using LINQ to SQL, and as a part of my processing I want to add to this list, then update the database with the new items + any changes I've made. What I thought I could do was this: var list = (from item in db...
[ "c#", ".net", "sql", "linq", "linq-to-sql" ]
2
5
6,134
4
0
2008-10-09T06:36:26.853000
2008-10-09T07:07:55.077000
186,190
417,221
SQL 2005 Full-Text Catalog is randomly sloooowww
I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are lightning fast. Has anyone experienced this issue ...
It could also be caused by this Sql Server 'feature' which we've experienced. You may experience a 45-second delay when you run a full-text query in an instance of SQL Server 2005 that is running on a server without Internet access http://support.microsoft.com/default.aspx/kb/915850
SQL 2005 Full-Text Catalog is randomly sloooowww I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are l...
TITLE: SQL 2005 Full-Text Catalog is randomly sloooowww QUESTION: I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subseq...
[ "sql-server-2005", "full-text-search" ]
4
2
1,318
5
0
2008-10-09T06:49:57.483000
2009-01-06T16:32:34.023000
186,202
186,464
What is the best way to open a file for exclusive access in Python?
What is the most elegant way to solve this: open a file for reading, but only if it is not already opened for writing open a file for writing, but only if it is not already opened for reading or writing The built-in functions work like this >>> path = r"c:\scr.txt" >>> file1 = open(path, "w") >>> print file1 >>> file2 ...
I don't think there is a fully crossplatform way. On unix, the fcntl module will do this for you. However on windows (which I assume you are by the paths), you'll need to use the win32file module. Fortunately, there is a portable implementation ( portalocker ) using the platform appropriate method at the python cookboo...
What is the best way to open a file for exclusive access in Python? What is the most elegant way to solve this: open a file for reading, but only if it is not already opened for writing open a file for writing, but only if it is not already opened for reading or writing The built-in functions work like this >>> path = ...
TITLE: What is the best way to open a file for exclusive access in Python? QUESTION: What is the most elegant way to solve this: open a file for reading, but only if it is not already opened for writing open a file for writing, but only if it is not already opened for reading or writing The built-in functions work lik...
[ "python", "file", "locking" ]
56
31
74,665
7
0
2008-10-09T06:58:54.907000
2008-10-09T09:00:09.717000
186,207
250,116
Visual Studio 6 Processor Pack compatibility
I've seen that a Processor Pack is available for Visual Studio 6, however it appears to only be available for users with SP5 and I am already using SP6: In addition, the Visual C++ Processor Pack (VCPP) was removed from Service Pack 6. If you have the VCPP installed, installing SP6 will remove it from your machine. If ...
It looks like the clue was in the question: In addition, the Visual C++ Processor Pack (VCPP) was removed from Service Pack 6. If you have the VCPP installed, installing SP6 will remove it from your machine. If you wish to continue using the VCPP, you will need to stay with SP5 or migrate to Visual Studio 2002 or 2003 ...
Visual Studio 6 Processor Pack compatibility I've seen that a Processor Pack is available for Visual Studio 6, however it appears to only be available for users with SP5 and I am already using SP6: In addition, the Visual C++ Processor Pack (VCPP) was removed from Service Pack 6. If you have the VCPP installed, install...
TITLE: Visual Studio 6 Processor Pack compatibility QUESTION: I've seen that a Processor Pack is available for Visual Studio 6, however it appears to only be available for users with SP5 and I am already using SP6: In addition, the Visual C++ Processor Pack (VCPP) was removed from Service Pack 6. If you have the VCPP ...
[ "performance", "intel", "visual-c++-6", "amd-processor", "visual-studio-6" ]
5
2
5,085
3
0
2008-10-09T07:00:53.933000
2008-10-30T13:08:34.257000
186,208
186,452
Latex styles - what do you use and where to find them
What Latex styles do you use and where do you find them? The reason I'm asking this is that it seems that some 99.9999% of all styles on the internet are copies of each other and of a physics exam paper However, when you try to find a style for a paper like this one... Good luck, you are never going to find it. Creatin...
LaTeX was originally designed as a reasonably flexible system on which a few standard classes were distributed — that were themselves rather in flexible. In the current state of affairs, if you want a custom layout, you need to write a few amount of supporting code yourself. How else would it happen? It's not like HTML...
Latex styles - what do you use and where to find them What Latex styles do you use and where do you find them? The reason I'm asking this is that it seems that some 99.9999% of all styles on the internet are copies of each other and of a physics exam paper However, when you try to find a style for a paper like this one...
TITLE: Latex styles - what do you use and where to find them QUESTION: What Latex styles do you use and where do you find them? The reason I'm asking this is that it seems that some 99.9999% of all styles on the internet are copies of each other and of a physics exam paper However, when you try to find a style for a p...
[ "latex", "styles" ]
18
10
15,154
3
0
2008-10-09T07:01:12.797000
2008-10-09T08:51:31.963000
186,211
186,243
Run time error in ASP.Net 1.1
I am using Windows 2003. I have mapped a web application into a virtual directory. This is built on framework 1.1 When i try to browse to the default page i get a error as Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error deta...
Line 198 of the standard machine.Config contains the line: which I assume is loading all assemblies from your local bin directory. It seems this directory contains an assembly Interop.MSDASC, and that IIS is unable to load this assembly because of an "Access Denied" error. Some things to check: does the account under w...
Run time error in ASP.Net 1.1 I am using Windows 2003. I have mapped a web application into a virtual directory. This is built on framework 1.1 When i try to browse to the default page i get a error as Description: An error occurred during the processing of a configuration file required to service this request. Please ...
TITLE: Run time error in ASP.Net 1.1 QUESTION: I am using Windows 2003. I have mapped a web application into a virtual directory. This is built on framework 1.1 When i try to browse to the default page i get a error as Description: An error occurred during the processing of a configuration file required to service thi...
[ "asp.net", "asp.net-1.1" ]
0
0
687
2
0
2008-10-09T07:03:01.327000
2008-10-09T07:21:51.863000
186,217
186,235
In WPF Style, How can Trigger access a son Element of the Element it is attatched
The following is a Simple Style for ListBoxItem, ListBoxItem has a son Border. Border has a Padding property with value of 8, I want to change the value to 0, when the item is selected. How can I write the trigger????? <----How Can I do this?
Try giving the Border a name (using, for example, x:Name="border1") then using the TargetName property of Setter, like this: Not sure if it'll work in a control template like that, but give it a go.
In WPF Style, How can Trigger access a son Element of the Element it is attatched The following is a Simple Style for ListBoxItem, ListBoxItem has a son Border. Border has a Padding property with value of 8, I want to change the value to 0, when the item is selected. How can I write the trigger????? <----How Can I do t...
TITLE: In WPF Style, How can Trigger access a son Element of the Element it is attatched QUESTION: The following is a Simple Style for ListBoxItem, ListBoxItem has a son Border. Border has a Padding property with value of 8, I want to change the value to 0, when the item is selected. How can I write the trigger????? <...
[ "wpf", "triggers" ]
2
6
3,322
1
0
2008-10-09T07:06:47.137000
2008-10-09T07:17:48.440000
186,222
186,445
Is EPiServer threadsafe?
I can't find any information about this on either www.episerver.com or world.episerver.com, anyone knows?
thread safe is a nebulous concept. In this particular case, if you are sharing data between different requests, it is not. Otherwise by the nature of web requests it is.
Is EPiServer threadsafe? I can't find any information about this on either www.episerver.com or world.episerver.com, anyone knows?
TITLE: Is EPiServer threadsafe? QUESTION: I can't find any information about this on either www.episerver.com or world.episerver.com, anyone knows? ANSWER: thread safe is a nebulous concept. In this particular case, if you are sharing data between different requests, it is not. Otherwise by the nature of web requests...
[ "c#", "asp.net", "multithreading", "episerver" ]
5
6
633
3
0
2008-10-09T07:08:12.593000
2008-10-09T08:47:02.987000
186,229
186,242
NHibernate bidirectional many-to-many association
I have a class with following description: public class Customer { public ISet Contacts { get; protected set;} } I want to map Contacts property onto following table: CREATE TABLE user_contacts ( user1 uuid NOT NULL, user2 uuid NOT NULL ) I want it to map bidirectionally, i.e. when Customer1 added to Customer2's Contac...
Take a look at this link on what hibernate calls unidirectional many-to-many associations. In Castle ActiveRecord I make use of HasAndBelongsToMany links, but I am not sure how exactly it is mapped in nhibernate. Though taking a look at your question a little deeper, it looks like you will be linking bidirectionally fr...
NHibernate bidirectional many-to-many association I have a class with following description: public class Customer { public ISet Contacts { get; protected set;} } I want to map Contacts property onto following table: CREATE TABLE user_contacts ( user1 uuid NOT NULL, user2 uuid NOT NULL ) I want it to map bidirectionall...
TITLE: NHibernate bidirectional many-to-many association QUESTION: I have a class with following description: public class Customer { public ISet Contacts { get; protected set;} } I want to map Contacts property onto following table: CREATE TABLE user_contacts ( user1 uuid NOT NULL, user2 uuid NOT NULL ) I want it to ...
[ "nhibernate" ]
5
2
2,931
1
0
2008-10-09T07:12:52.757000
2008-10-09T07:21:19.947000
186,232
186,834
Exporting DLL C++ Class , question about .def file
I want to use implicit linking in my project, and nmake really wants a.def file. The problem is, that this is a class, and I don't know what to write in the exports section. Could anyone point me in the right direction? The error message is the following: NMAKE: U1073: don't know how to make 'DLLCLASS.def' P.S: I'm try...
You can always find the decorated name for the member function by using dumpbin /symbols myclass.obj in my case class A { public: A( int ){} }; the dumpbin dump showed the symbol??0A@@QAE@H@Z (public: __thiscall A::A(int)) Putting this symbol in the.def file causes the linker to create the A::A(int) symbol in the expor...
Exporting DLL C++ Class , question about .def file I want to use implicit linking in my project, and nmake really wants a.def file. The problem is, that this is a class, and I don't know what to write in the exports section. Could anyone point me in the right direction? The error message is the following: NMAKE: U1073:...
TITLE: Exporting DLL C++ Class , question about .def file QUESTION: I want to use implicit linking in my project, and nmake really wants a.def file. The problem is, that this is a class, and I don't know what to write in the exports section. Could anyone point me in the right direction? The error message is the follow...
[ "c++", "build", "windows-ce", "nmake", "function" ]
2
4
13,955
4
0
2008-10-09T07:13:54.797000
2008-10-09T11:32:08.693000
186,234
1,801,006
Easy IIS install of php
Are there any "all-in-one" installers for php + mysql on iis? Preferably with a gui configuration interface.
The PHP part is easy with Web Platform Installer: http://php.iis.net/ MySQL is a breeze to install on Windows: http://dev.mysql.com/downloads/mysql/5.1.html#win32
Easy IIS install of php Are there any "all-in-one" installers for php + mysql on iis? Preferably with a gui configuration interface.
TITLE: Easy IIS install of php QUESTION: Are there any "all-in-one" installers for php + mysql on iis? Preferably with a gui configuration interface. ANSWER: The PHP part is easy with Web Platform Installer: http://php.iis.net/ MySQL is a breeze to install on Windows: http://dev.mysql.com/downloads/mysql/5.1.html#win...
[ "php", "iis" ]
4
2
1,254
4
0
2008-10-09T07:17:34.837000
2009-11-26T01:00:09.483000
186,237
186,285
Program only crashes as release build -- how to debug?
I've got a "Schroedinger's Cat" type of problem here -- my program (actually the test suite for my program, but a program nonetheless) is crashing, but only when built in release mode, and only when launched from the command line. Through caveman debugging (ie, nasty printf() messages all over the place), I have determ...
In 100% of the cases I've seen or heard of, where a C or C++ program runs fine in the debugger but fails when run outside, the cause has been writing past the end of a function local array. (The debugger puts more on the stack, so you're less likely to overwrite something important.)
Program only crashes as release build -- how to debug? I've got a "Schroedinger's Cat" type of problem here -- my program (actually the test suite for my program, but a program nonetheless) is crashing, but only when built in release mode, and only when launched from the command line. Through caveman debugging (ie, nas...
TITLE: Program only crashes as release build -- how to debug? QUESTION: I've got a "Schroedinger's Cat" type of problem here -- my program (actually the test suite for my program, but a program nonetheless) is crashing, but only when built in release mode, and only when launched from the command line. Through caveman ...
[ "c++", "debugging" ]
111
158
91,089
29
0
2008-10-09T07:18:42.980000
2008-10-09T07:41:26.583000
186,244
186,279
What does it mean that Javascript is a prototype based language?
One of the major advantages with Javascript is said to be that it is a prototype based language. But what does it mean that Javascript is prototype based, and why is that an advantage?
Prototypal inheritance is a form of object-oriented code reuse. Javascript is one of the only [mainstream] object-oriented languages to use prototypal inheritance. Almost all other object-oriented languages are classical. In classical inheritance, the programmer writes a class, which defines an object. Multiple objects...
What does it mean that Javascript is a prototype based language? One of the major advantages with Javascript is said to be that it is a prototype based language. But what does it mean that Javascript is prototype based, and why is that an advantage?
TITLE: What does it mean that Javascript is a prototype based language? QUESTION: One of the major advantages with Javascript is said to be that it is a prototype based language. But what does it mean that Javascript is prototype based, and why is that an advantage? ANSWER: Prototypal inheritance is a form of object-...
[ "javascript", "oop", "inheritance", "prototype-programming" ]
283
323
67,920
8
0
2008-10-09T07:22:57.540000
2008-10-09T07:38:11.193000
186,277
186,294
How do you organize your release tests?
In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before. The automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you can imagine this results in a lot of different files to be...
You could use combination of a bug tracker (JIRA, Mantis, Bugzilla) and test case management tool like testlink
How do you organize your release tests? In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before. The automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you can imagine this r...
TITLE: How do you organize your release tests? QUESTION: In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before. The automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you ...
[ "testing" ]
2
4
524
3
0
2008-10-09T07:37:38.337000
2008-10-09T07:46:58.413000
186,291
186,298
.NET partial class' accessibility over multiple files
If I have the core of a class defined in one file as "public partial" and I wish to create additions to this in another file, what is the difference between defining "public partial" again in my second file or just defining "partial"? What happens if I define "private partial" in my second file?
You can duplicate the class modifiers or leave them out in one file, but you'll get a compiler error if they're specified in different files as different access levels. From The C# Programming Guide: The following keywords on a partial-type definition are optional, but if present on one partial-type definition, cannot ...
.NET partial class' accessibility over multiple files If I have the core of a class defined in one file as "public partial" and I wish to create additions to this in another file, what is the difference between defining "public partial" again in my second file or just defining "partial"? What happens if I define "priva...
TITLE: .NET partial class' accessibility over multiple files QUESTION: If I have the core of a class defined in one file as "public partial" and I wish to create additions to this in another file, what is the difference between defining "public partial" again in my second file or just defining "partial"? What happens ...
[ "c#", ".net", "partial-classes" ]
2
8
801
1
0
2008-10-09T07:44:31.943000
2008-10-09T07:48:18.490000
186,311
186,480
Best way to find date nearest to target in a list of dates?
I have a list of Date objects, and a target Date. I want to find the date in the list that's nearest to the target date, but only dates that are before the target date. Example: 2008-10-1 2008-10-2 2008-10-4 With a target date of 2008-10-3, I want to get 2008-10-2 What is the best way to do it?
Sietse de Kaper solution assumes a reverse sorted list, definitely not the most natural thing to have around The natural sort order in java is following the ascending natural ordering. (see Collection.sort http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#sort(java.util.List) documentation) From your e...
Best way to find date nearest to target in a list of dates? I have a list of Date objects, and a target Date. I want to find the date in the list that's nearest to the target date, but only dates that are before the target date. Example: 2008-10-1 2008-10-2 2008-10-4 With a target date of 2008-10-3, I want to get 2008-...
TITLE: Best way to find date nearest to target in a list of dates? QUESTION: I have a list of Date objects, and a target Date. I want to find the date in the list that's nearest to the target date, but only dates that are before the target date. Example: 2008-10-1 2008-10-2 2008-10-4 With a target date of 2008-10-3, I...
[ "java", "date" ]
6
7
13,428
6
0
2008-10-09T07:53:05.250000
2008-10-09T09:07:51.510000
186,313
196,688
How to create nestable draggables in Scriptaculous?
I'm using the Scriptaculous library to slap an appealing UI on an application which helps an enduser build lists. Let's say its for pizza creation. To fill out an order, you drag a size of pizza from the pizza palette into the orders droppable. Once it is put in there, it gets replaced with a new div which is both drag...
It turns out, after a few days of banging my heads into various walls, that Scriptaculous will happily nest things by default. The issue is when your call to draggable_element looks like this <% draggable_element blah blah blah blah blah blah blah%> instead of <%= draggable_element blah blah blah blah blah blah blah %>...
How to create nestable draggables in Scriptaculous? I'm using the Scriptaculous library to slap an appealing UI on an application which helps an enduser build lists. Let's say its for pizza creation. To fill out an order, you drag a size of pizza from the pizza palette into the orders droppable. Once it is put in there...
TITLE: How to create nestable draggables in Scriptaculous? QUESTION: I'm using the Scriptaculous library to slap an appealing UI on an application which helps an enduser build lists. Let's say its for pizza creation. To fill out an order, you drag a size of pizza from the pizza palette into the orders droppable. Once ...
[ "javascript", "drag-and-drop", "scriptaculous", "draggable" ]
3
3
1,714
2
0
2008-10-09T07:53:25.280000
2008-10-13T04:08:25.203000
186,316
189,452
Python - How to use Conch to create a Virtual SSH server
I'm looking at creating a server in python that I can run, and will work as an SSH server. This will then let different users login, and act as if they'd logged in normally, but only had access to one command. I want to do this so that I can have a system where I can add users to without having to create a system wide ...
When you write a Conch server, you can control what happens when the client makes a shell request by implementing ISession.openShell. The Conch server will request IConchUser from your realm and then adapt the resulting avatar to ISession to call openShell on it if necessary. ISession.openShell 's job is to take the tr...
Python - How to use Conch to create a Virtual SSH server I'm looking at creating a server in python that I can run, and will work as an SSH server. This will then let different users login, and act as if they'd logged in normally, but only had access to one command. I want to do this so that I can have a system where I...
TITLE: Python - How to use Conch to create a Virtual SSH server QUESTION: I'm looking at creating a server in python that I can run, and will work as an SSH server. This will then let different users login, and act as if they'd logged in normally, but only had access to one command. I want to do this so that I can hav...
[ "python", "twisted" ]
5
7
2,293
2
0
2008-10-09T07:54:12.033000
2008-10-09T22:30:29.813000
186,328
186,363
.NET Fastest way to iterate through rows in a datatable?
Which is generally fastest when reading/comparing row info from a DataTable? 'assume dt as datatable' 'method 1' dim i as int32 for i = 0 to dt.rows.count - 1.... next 'method 2' dim row as datarow for each row in dt.rows.... next And if there's a difference, in what circumstances does it pay to use one over the othe...
The compiler expands For Each to a short while loop. for each row in dt.rows // expands to: IEnumerator e = dt.rows.GetEnumerator() while e.MoveNext() row = e.Current So you pay a small amount of overhead. But for clarities sake, I'd still stick with For Each if you're only working on one row, and you aren't modifying ...
.NET Fastest way to iterate through rows in a datatable? Which is generally fastest when reading/comparing row info from a DataTable? 'assume dt as datatable' 'method 1' dim i as int32 for i = 0 to dt.rows.count - 1.... next 'method 2' dim row as datarow for each row in dt.rows.... next And if there's a difference, i...
TITLE: .NET Fastest way to iterate through rows in a datatable? QUESTION: Which is generally fastest when reading/comparing row info from a DataTable? 'assume dt as datatable' 'method 1' dim i as int32 for i = 0 to dt.rows.count - 1.... next 'method 2' dim row as datarow for each row in dt.rows.... next And if there...
[ ".net", "performance", "ado.net", "datatable", "iteration" ]
0
8
16,940
6
0
2008-10-09T07:58:55.753000
2008-10-09T08:11:07.553000
186,338
186,386
Why is require_once so bad to use?
Everything I read about better PHP coding practices keeps saying don't use require_once because of speed. Why is this? What is the proper/better way to do the same thing as require_once? If it matters, I'm using PHP 5.
require_once and include_once both require that the system keeps a log of what's already been included/required. Every *_once call means checking that log. So there's definitely some extra work being done there but enough to detriment the speed of the whole app?... I really doubt it... Not unless you're on really old h...
Why is require_once so bad to use? Everything I read about better PHP coding practices keeps saying don't use require_once because of speed. Why is this? What is the proper/better way to do the same thing as require_once? If it matters, I'm using PHP 5.
TITLE: Why is require_once so bad to use? QUESTION: Everything I read about better PHP coding practices keeps saying don't use require_once because of speed. Why is this? What is the proper/better way to do the same thing as require_once? If it matters, I'm using PHP 5. ANSWER: require_once and include_once both requ...
[ "php", "performance", "require-once" ]
147
116
75,581
14
0
2008-10-09T08:03:02.717000
2008-10-09T08:20:31.480000
186,340
186,352
onClose Event in ASP.NET
Is there an event like onLoad? just at closing the Site (onClose)?
Not in the sense that I suspect you're thinking. All your code in ASP.net runs on the server which doesn't inherently "know" when the site is closed by the user. To achieve what you're after, you'd need to use Javascript to handle the window.onunload / window.onbeforeunload events and trigger some form of request to th...
onClose Event in ASP.NET Is there an event like onLoad? just at closing the Site (onClose)?
TITLE: onClose Event in ASP.NET QUESTION: Is there an event like onLoad? just at closing the Site (onClose)? ANSWER: Not in the sense that I suspect you're thinking. All your code in ASP.net runs on the server which doesn't inherently "know" when the site is closed by the user. To achieve what you're after, you'd nee...
[ "asp.net", ".net", "events" ]
0
2
6,563
5
0
2008-10-09T08:03:47.707000
2008-10-09T08:07:18.340000
186,345
3,098,090
How can I auto filter a HTML selectlist?
I have a HTML select list with quite a few (1000+) names. I have a javascript in place which will select the first matching name if someone starts typing. This matching looks at the start of the item: var optionsLength = dropdownlist.options.length; for (var n=0; n < optionsLength; n++) { var optionText = dropdownlist....
use this filter script http://www.barelyfitz.com/projects/filterlist/
How can I auto filter a HTML selectlist? I have a HTML select list with quite a few (1000+) names. I have a javascript in place which will select the first matching name if someone starts typing. This matching looks at the start of the item: var optionsLength = dropdownlist.options.length; for (var n=0; n < optionsLeng...
TITLE: How can I auto filter a HTML selectlist? QUESTION: I have a HTML select list with quite a few (1000+) names. I have a javascript in place which will select the first matching name if someone starts typing. This matching looks at the start of the item: var optionsLength = dropdownlist.options.length; for (var n=...
[ "javascript", "asp.net", "autosuggest", "autofilter" ]
2
1
8,789
4
0
2008-10-09T08:05:20.060000
2010-06-23T00:12:56.423000
186,351
186,354
How to reimplement jQuery's default helper in a custom helper
I'm creating a custom drag helper (in jQuery): $('.dragme', element).draggable({ appendTo: 'body', helper: custom_drag_helper, opacity: 0.5 }); I'm doing this because I want to sometimes clone and sometimes do the default functionality, i.e. drag the original element. function custom_drag_helper() { if (/*criteria on w...
Ok, when typing up this question I did a bit more source diving and discovered this little line: if (this.options.helper == 'original' &&!(/^(?:r|a|f)/).test(this.element.css("position"))) this.element[0].style.position = 'relative'; which I didn't find in the day I spent trying to solve this problem. Adding this.style...
How to reimplement jQuery's default helper in a custom helper I'm creating a custom drag helper (in jQuery): $('.dragme', element).draggable({ appendTo: 'body', helper: custom_drag_helper, opacity: 0.5 }); I'm doing this because I want to sometimes clone and sometimes do the default functionality, i.e. drag the origina...
TITLE: How to reimplement jQuery's default helper in a custom helper QUESTION: I'm creating a custom drag helper (in jQuery): $('.dragme', element).draggable({ appendTo: 'body', helper: custom_drag_helper, opacity: 0.5 }); I'm doing this because I want to sometimes clone and sometimes do the default functionality, i.e...
[ "javascript", "jquery" ]
2
5
3,519
1
0
2008-10-09T08:06:51.430000
2008-10-09T08:07:48.340000
186,369
186,382
DB: To use identity column or not?
While designing a table my colleague here says that I should avoid identity column as it is specific to SQL Server and MS Access, But I differ with his views as it makes my coding simpler. Should I use identity column or not? If not what is best way to create the identity columns from application code?
You can't completely divorce an application from the database vendor. If you do you won't be able to take advantages of whatever features your database provides you. I'd say use the identity column. If you move over to Oracle (for example), you can use a Sequence. Hardly a big change. I don't know what technology you'r...
DB: To use identity column or not? While designing a table my colleague here says that I should avoid identity column as it is specific to SQL Server and MS Access, But I differ with his views as it makes my coding simpler. Should I use identity column or not? If not what is best way to create the identity columns from...
TITLE: DB: To use identity column or not? QUESTION: While designing a table my colleague here says that I should avoid identity column as it is specific to SQL Server and MS Access, But I differ with his views as it makes my coding simpler. Should I use identity column or not? If not what is best way to create the ide...
[ "database", "design-patterns" ]
7
10
5,855
4
0
2008-10-09T08:14:42.303000
2008-10-09T08:18:42.017000
186,385
325,578
Best Timer approach in C# console batch application
Which is the best timer approach for a C# console batch application that has to process as follows: Connect to datasources process batch until timeout occurs or processing complete. "Do something with datasources" stop console app gracefully. related question: How do you add a timer to a C# console application
Sorry for this being an entire console app... but here's a complete console app that will get you started. Again, I appologize for so much code, but everyone else seems to be giving a "oh, all you have to do is do it" answer:) using System; using System.Collections.Generic; using System.Threading; namespace ConsoleApp...
Best Timer approach in C# console batch application Which is the best timer approach for a C# console batch application that has to process as follows: Connect to datasources process batch until timeout occurs or processing complete. "Do something with datasources" stop console app gracefully. related question: How do ...
TITLE: Best Timer approach in C# console batch application QUESTION: Which is the best timer approach for a C# console batch application that has to process as follows: Connect to datasources process batch until timeout occurs or processing complete. "Do something with datasources" stop console app gracefully. related...
[ "c#", "batch-file", "console", "timer" ]
3
5
9,537
3
0
2008-10-09T08:20:20.203000
2008-11-28T11:47:41.733000
186,387
186,399
Deploying web apps that use cron
What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates,...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the crontab? I know that the actual cron files are stored in...
You can (on most Linux distributions) put files in /etc/cron.d instead of an individual user's crontab. They can be run by whatever user you want (you need to be root, obviously). If you build your web app into a RPM (debian pkg, etc), then it can drop the files into /etc/cron.d and have the jobs run. Just load the sam...
Deploying web apps that use cron What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates,...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the crontab? I know that th...
TITLE: Deploying web apps that use cron QUESTION: What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates,...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the cront...
[ "linux", "deployment", "cron" ]
1
4
297
1
0
2008-10-09T08:21:27.080000
2008-10-09T08:24:53.843000
186,392
186,975
How do you document your database structure?
Many database systems don't allow comments or descriptions of tables and fields, so how do you go about documenting the purpose of a table/field apart from the obvious of having good naming conventions? (Let's assume for now that "excellent" table and field names are not enough to document the full meaning of every tab...
MySQL allows comments on tables and rows. PostgreSQL does as well. From other answers, Oracle and MSSQL have comments too. For me, a combination of UML diagram for a quick refresher on field names, types, and constraints, and an external document (TeX, but could be any format) with extended description of everything da...
How do you document your database structure? Many database systems don't allow comments or descriptions of tables and fields, so how do you go about documenting the purpose of a table/field apart from the obvious of having good naming conventions? (Let's assume for now that "excellent" table and field names are not eno...
TITLE: How do you document your database structure? QUESTION: Many database systems don't allow comments or descriptions of tables and fields, so how do you go about documenting the purpose of a table/field apart from the obvious of having good naming conventions? (Let's assume for now that "excellent" table and field...
[ "sql", "database", "documentation", "relational" ]
31
11
32,890
12
0
2008-10-09T08:23:02.397000
2008-10-09T12:09:27.557000
186,396
186,602
How to display a VRML model with .NET?
I have a request to display VRML models within a.NET application. Does someone know an easy way, maybe with standard.NET components, to achieve this? What are the issues I maybe have to face when representing VRML within an application?
Get yourself a VRML ActveX control an insert that into your.NET app, you should be able to find one at www.web3d.org
How to display a VRML model with .NET? I have a request to display VRML models within a.NET application. Does someone know an easy way, maybe with standard.NET components, to achieve this? What are the issues I maybe have to face when representing VRML within an application?
TITLE: How to display a VRML model with .NET? QUESTION: I have a request to display VRML models within a.NET application. Does someone know an easy way, maybe with standard.NET components, to achieve this? What are the issues I maybe have to face when representing VRML within an application? ANSWER: Get yourself a VR...
[ ".net", "3d", "visualization", "vrml" ]
5
1
3,718
3
0
2008-10-09T08:24:27.590000
2008-10-09T09:59:26.367000
186,403
186,424
What is the size limit for a varchar2 PL/SQL subprogram argument in Oracle?
When you create a procedure (or a function) in Oracle PL/SQL, you cannot specify the maximum length of the varchar2 arguments, only the datatype. For example create or replace procedure testproc(arg1 in varchar2) is begin null; end; Do you know the maximum length of a string that you can pass as the arg1 argument to th...
In PL/SQL procedure it may be up to 32KB Futher information here: http://it.toolbox.com/blogs/oracle-guide/learn-oracle-sql-and-plsql-datatypes-strings-10804
What is the size limit for a varchar2 PL/SQL subprogram argument in Oracle? When you create a procedure (or a function) in Oracle PL/SQL, you cannot specify the maximum length of the varchar2 arguments, only the datatype. For example create or replace procedure testproc(arg1 in varchar2) is begin null; end; Do you know...
TITLE: What is the size limit for a varchar2 PL/SQL subprogram argument in Oracle? QUESTION: When you create a procedure (or a function) in Oracle PL/SQL, you cannot specify the maximum length of the varchar2 arguments, only the datatype. For example create or replace procedure testproc(arg1 in varchar2) is begin null...
[ "oracle", "plsql" ]
14
16
59,523
3
0
2008-10-09T08:26:10.113000
2008-10-09T08:35:34.227000
186,431
186,478
Calculating days of week given a week number
Given a week number, e.g. date -u +%W, how do you calculate the days in that week starting from Monday? Example rfc-3339 output for week 40: 2008-10-06 2008-10-07 2008-10-08 2008-10-09 2008-10-10 2008-10-11 2008-10-12
PHP $week_number = 40; $year = 2008; for($day=1; $day<=7; $day++) { echo date('m/d/Y', strtotime($year."W".$week_number.$day))."\n"; } Below post was because I was an idiot who didn't read the question properly, but will get the dates in a week starting from Monday, given the date, not the week number.. In PHP, adapted...
Calculating days of week given a week number Given a week number, e.g. date -u +%W, how do you calculate the days in that week starting from Monday? Example rfc-3339 output for week 40: 2008-10-06 2008-10-07 2008-10-08 2008-10-09 2008-10-10 2008-10-11 2008-10-12
TITLE: Calculating days of week given a week number QUESTION: Given a week number, e.g. date -u +%W, how do you calculate the days in that week starting from Monday? Example rfc-3339 output for week 40: 2008-10-06 2008-10-07 2008-10-08 2008-10-09 2008-10-10 2008-10-11 2008-10-12 ANSWER: PHP $week_number = 40; $year =...
[ "php", "date" ]
30
64
72,373
14
0
2008-10-09T08:42:11.377000
2008-10-09T09:07:03.523000
186,443
186,811
What options are available for connecting to a Microsoft SQL Server database from an Oracle database?
At the moment I pull data from remote MS SQL Server databases using custom-built JDBC connectors. This works fine but doesn't feel like the way to do it. I feel I should be able to put a JDBC connection string into tnsnames on the server and have it "just work". I've looked around a little for this functionality but it...
Generic Connectivity is what you are after, it will let you setup a remote database link against MS SQL Server, so you can do queries like select * from mytable@my_ms_sql_server; I've only used it in Oracle 9i against mysql, and found, that in our cases, it didn't work very well, as it ended up using up MASSIVE amounts...
What options are available for connecting to a Microsoft SQL Server database from an Oracle database? At the moment I pull data from remote MS SQL Server databases using custom-built JDBC connectors. This works fine but doesn't feel like the way to do it. I feel I should be able to put a JDBC connection string into tns...
TITLE: What options are available for connecting to a Microsoft SQL Server database from an Oracle database? QUESTION: At the moment I pull data from remote MS SQL Server databases using custom-built JDBC connectors. This works fine but doesn't feel like the way to do it. I feel I should be able to put a JDBC connecti...
[ "sql-server", "oracle", "jdbc", "tnsnames" ]
1
4
535
2
0
2008-10-09T08:45:55.703000
2008-10-09T11:23:04.403000
186,456
194,337
What is the best practice to use ExtJS with Asp.net and WCF in .NET 3.5?
How do you save data from ExtJS form? Load data from the business layer into form or grid?
Most likely I found the best solution http://developmentalmadness.blogspot.com/2008/07/using-extjs-with-wcf.html
What is the best practice to use ExtJS with Asp.net and WCF in .NET 3.5? How do you save data from ExtJS form? Load data from the business layer into form or grid?
TITLE: What is the best practice to use ExtJS with Asp.net and WCF in .NET 3.5? QUESTION: How do you save data from ExtJS form? Load data from the business layer into form or grid? ANSWER: Most likely I found the best solution http://developmentalmadness.blogspot.com/2008/07/using-extjs-with-wcf.html
[ "javascript", "asp.net-ajax", "extjs" ]
2
0
10,160
6
0
2008-10-09T08:56:26.197000
2008-10-11T17:19:20.070000
186,467
2,308,033
Have you noticed stray hits to your web pages that have no parameters?
We have a web application that passes parameters in the url along the lines of this: www.example.com/ViewCustomer?customer=3945 Reasonably often, we will see attempts to access just: www.example.com/ViewCustomer Or system logs this as invalid and sends back a "An error has occurred, contact support with trace number XX...
I now think this was actually a tomcat bug getParameter() fails on POST with transfer-encoding: chunked.
Have you noticed stray hits to your web pages that have no parameters? We have a web application that passes parameters in the url along the lines of this: www.example.com/ViewCustomer?customer=3945 Reasonably often, we will see attempts to access just: www.example.com/ViewCustomer Or system logs this as invalid and se...
TITLE: Have you noticed stray hits to your web pages that have no parameters? QUESTION: We have a web application that passes parameters in the url along the lines of this: www.example.com/ViewCustomer?customer=3945 Reasonably often, we will see attempts to access just: www.example.com/ViewCustomer Or system logs this...
[ "firefox", "ssl", "parameters", "browser", "get" ]
2
1
228
6
0
2008-10-09T09:01:47.543000
2010-02-22T00:01:50.943000
186,472
186,813
'from X import a' versus 'import X; X.a'
I've seen some Python programmers use the following style fairly consistently (we'll call it style 1): import some_module # Use some_module.some_identifier in various places. For support of this style, you can cite the "explicit is better than implicit" maxim. I've seen other programmers use this style (style 2): from ...
There are uses for both cases, so I don't think this is an either-or issue. I'd consider using from module import x,y,z when: There are a fairly small number of things to import The purpose of the functions imported is obvious when divorced from the module name. If the names are fairly generic, they may clash with othe...
'from X import a' versus 'import X; X.a' I've seen some Python programmers use the following style fairly consistently (we'll call it style 1): import some_module # Use some_module.some_identifier in various places. For support of this style, you can cite the "explicit is better than implicit" maxim. I've seen other pr...
TITLE: 'from X import a' versus 'import X; X.a' QUESTION: I've seen some Python programmers use the following style fairly consistently (we'll call it style 1): import some_module # Use some_module.some_identifier in various places. For support of this style, you can cite the "explicit is better than implicit" maxim. ...
[ "python", "python-import", "maintainability", "duck-typing" ]
10
6
3,237
9
0
2008-10-09T09:04:34.217000
2008-10-09T11:24:46.773000
186,475
186,479
Remove binding in WPF using code
I would like to use databinding when displaying data in a TextBox. I'm basically doing like: public void ShowRandomObject(IRandomObject randomObject) { Binding binding = new Binding {Source = randomObject, Path = new PropertyPath("Name")}; txtName.SetBinding(TextBox.TextProperty, binding); } I can't seem to find a way ...
When available BindingOperations.ClearBinding(txtName, TextBox.TextProperty) For older SilverLight versions, but not reliable as stated in comments: txtName.SetBinding(TextBox.TextProperty, null); C# 6.0 features enabled this.btnFinish.ClearBinding(ButtonBase.CommandProperty);
Remove binding in WPF using code I would like to use databinding when displaying data in a TextBox. I'm basically doing like: public void ShowRandomObject(IRandomObject randomObject) { Binding binding = new Binding {Source = randomObject, Path = new PropertyPath("Name")}; txtName.SetBinding(TextBox.TextProperty, bindin...
TITLE: Remove binding in WPF using code QUESTION: I would like to use databinding when displaying data in a TextBox. I'm basically doing like: public void ShowRandomObject(IRandomObject randomObject) { Binding binding = new Binding {Source = randomObject, Path = new PropertyPath("Name")}; txtName.SetBinding(TextBox.Te...
[ "c#", "wpf" ]
62
52
49,159
4
0
2008-10-09T09:05:28.660000
2008-10-09T09:07:20.653000
186,477
187,577
In C++/CLI, how do I declare and call a function with an 'out' parameter?
I have a function which parses one string into two strings. In C# I would declare it like this: void ParseQuery(string toParse, out string search, out string sort) {... } and I'd call it like this: string searchOutput, sortOutput; ParseQuery(userInput, out searchOutput, out sortOutput); The current project has to be do...
C++/CLI itself doesn't support a real 'out' argument, but you can mark a reference as an out argument to make other languages see it as a real out argument. You can do this for reference types as: void ReturnString([Out] String^% value) { value = "Returned via out parameter"; } // Called as String^ result; ReturnStrin...
In C++/CLI, how do I declare and call a function with an 'out' parameter? I have a function which parses one string into two strings. In C# I would declare it like this: void ParseQuery(string toParse, out string search, out string sort) {... } and I'd call it like this: string searchOutput, sortOutput; ParseQuery(user...
TITLE: In C++/CLI, how do I declare and call a function with an 'out' parameter? QUESTION: I have a function which parses one string into two strings. In C# I would declare it like this: void ParseQuery(string toParse, out string search, out string sort) {... } and I'd call it like this: string searchOutput, sortOutpu...
[ ".net", "c++-cli", "pass-by-reference" ]
52
92
50,091
3
0
2008-10-09T09:06:34.460000
2008-10-09T14:43:27.603000
186,493
193,971
How do I code a Mono Daemon
I'm trying to write a Mono C# daemon for linux. I'd like to do a starts and stops of it when its done processing instead of just killing the process. Does anyone have any examples of this? Edit: I figured out how to use start-stop-daemon --background in debian, so I think I'll just use that for now. Edit: I'm implement...
You should implement a service and use mono-service. Google for it and you'll find several examples.
How do I code a Mono Daemon I'm trying to write a Mono C# daemon for linux. I'd like to do a starts and stops of it when its done processing instead of just killing the process. Does anyone have any examples of this? Edit: I figured out how to use start-stop-daemon --background in debian, so I think I'll just use that ...
TITLE: How do I code a Mono Daemon QUESTION: I'm trying to write a Mono C# daemon for linux. I'd like to do a starts and stops of it when its done processing instead of just killing the process. Does anyone have any examples of this? Edit: I figured out how to use start-stop-daemon --background in debian, so I think I...
[ "c#", "linux", "mono", "daemon", "mono-service" ]
52
19
21,632
7
0
2008-10-09T09:12:51.627000
2008-10-11T11:18:29.020000
186,494
186,505
if(str1==str2) versus if(str1.length()==str2.length() && str1==str2)
I've seen second one in another's code and I suppose this length comparison have been done to increase code productivity. It was used in a parser for a script language with a specific dictionary: words are 4 to 24 letters long with the average of 7-8 lettets, alphabet includes 26 latin letters plus "@","$" and "_". Len...
In your random test the strings might have been long enough to show the gain while in your real case you may deal with shorter strings and the constant factor of two comparison is not offset by any gain in not performing the string comparison part of the test.
if(str1==str2) versus if(str1.length()==str2.length() && str1==str2) I've seen second one in another's code and I suppose this length comparison have been done to increase code productivity. It was used in a parser for a script language with a specific dictionary: words are 4 to 24 letters long with the average of 7-8 ...
TITLE: if(str1==str2) versus if(str1.length()==str2.length() && str1==str2) QUESTION: I've seen second one in another's code and I suppose this length comparison have been done to increase code productivity. It was used in a parser for a script language with a specific dictionary: words are 4 to 24 letters long with t...
[ "c++", "performance", "stl", "stdstring" ]
2
4
3,640
9
0
2008-10-09T09:12:57.240000
2008-10-09T09:19:06.510000
186,496
186,535
Can I list the resources in a given package?
Lets assume my classes are loaded from a compressed.war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader? Is there a library out there that does something like ...
No, you can't list resources in a package because the JVM simply doesn't know what resources are in what package. See this question.
Can I list the resources in a given package? Lets assume my classes are loaded from a compressed.war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader? Is there ...
TITLE: Can I list the resources in a given package? QUESTION: Lets assume my classes are loaded from a compressed.war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current clas...
[ "java", "list", "resources", "war" ]
18
7
20,213
4
0
2008-10-09T09:15:11.137000
2008-10-09T09:34:22.970000
186,507
186,837
Flexible Decorator Pattern?
I was looking for a pattern to model something I'm thinking of doing in a personal project and I was wondering if a modified version of the decorator patter would work. Basicly I'm thinking of creating a game where the characters attributes are modified by what items they have equiped. The way that the decorator stacks...
To be honest, it sounds like you're really trying to fit a pattern where you don't really need one, just for the sake of using a pattern. Don't be that guy. Now, if the weapons gave the character some extra strength/stam/hp or whatever, then it might be worth considering. But it doesn't sound like you're going to be mo...
Flexible Decorator Pattern? I was looking for a pattern to model something I'm thinking of doing in a personal project and I was wondering if a modified version of the decorator patter would work. Basicly I'm thinking of creating a game where the characters attributes are modified by what items they have equiped. The w...
TITLE: Flexible Decorator Pattern? QUESTION: I was looking for a pattern to model something I'm thinking of doing in a personal project and I was wondering if a modified version of the decorator patter would work. Basicly I'm thinking of creating a game where the characters attributes are modified by what items they h...
[ "design-patterns", "decorator" ]
2
2
2,067
8
0
2008-10-09T09:19:26.387000
2008-10-09T11:32:41.017000
186,520
186,552
PHP's file_get_contents not returning until remote servers' keep-alive limit is exceeded
From one apache server file_get_contents returns the contents of a url straight away. On another apache server file_get contents won't return the contents of the same url until the keep-alive limit of the server hosting that url has been expired. The 2 php servers are retrieving the same url but through different netwo...
Does using fopen manually work faster? Rather than spending hours working out why file_get_contents doesn't work, you might be better-off swapping it out. If fopen isn't any faster, there's probably a config or filesystem issue. If it is faster, it's likely a php.ini issue.
PHP's file_get_contents not returning until remote servers' keep-alive limit is exceeded From one apache server file_get_contents returns the contents of a url straight away. On another apache server file_get contents won't return the contents of the same url until the keep-alive limit of the server hosting that url ha...
TITLE: PHP's file_get_contents not returning until remote servers' keep-alive limit is exceeded QUESTION: From one apache server file_get_contents returns the contents of a url straight away. On another apache server file_get contents won't return the contents of the same url until the keep-alive limit of the server h...
[ "php", "html", "apache", "networking" ]
0
2
1,513
2
0
2008-10-09T09:23:28.903000
2008-10-09T09:40:45.920000
186,522
186,596
Better way to profile?
Is there a better way to profile code then: $start1 = microtime(TRUE); for($i=0;$i
Xdebug or Zend Debugger if you have some difficulty to install Xdebug. Their profiler will time everything for you without any modification of your code. http://www.xdebug.org/ http://www.zend.com/en/community/pdt http://devzone.zend.com/article/2899-Profiling-PHP-Applications-With-xdebug - a serie of tutorials about x...
Better way to profile? Is there a better way to profile code then: $start1 = microtime(TRUE); for($i=0;$i
TITLE: Better way to profile? QUESTION: Is there a better way to profile code then: $start1 = microtime(TRUE); for($i=0;$i ANSWER: Xdebug or Zend Debugger if you have some difficulty to install Xdebug. Their profiler will time everything for you without any modification of your code. http://www.xdebug.org/ http://www...
[ "php", "profile" ]
0
2
206
2
0
2008-10-09T09:25:38.667000
2008-10-09T09:56:48.057000
186,523
186,539
What is the maximum length of a C#/CLI identifier?
Which other restrictions are there on names (beside the obvious uniqueness within a scope)? Where are those defined?
From the PDF of ECMA-335, Partition II, section 22: Metadata preserves name strings, as created by a compiler or code generator, unchanged. Essentially, it treats each string as an opaque blob. In particular, it preserves case. The CLI imposes no limit on the length of names stored in metadata and subsequently processe...
What is the maximum length of a C#/CLI identifier? Which other restrictions are there on names (beside the obvious uniqueness within a scope)? Where are those defined?
TITLE: What is the maximum length of a C#/CLI identifier? QUESTION: Which other restrictions are there on names (beside the obvious uniqueness within a scope)? Where are those defined? ANSWER: From the PDF of ECMA-335, Partition II, section 22: Metadata preserves name strings, as created by a compiler or code generat...
[ "c#", ".net", "clr", "language-features", "command-line-interface" ]
32
26
21,288
6
0
2008-10-09T09:26:23.487000
2008-10-09T09:36:02.857000
186,525
302,791
Mapstraction as a library to access Google maps
Do you suggest Mapstraction (library) as a layer to access Google maps? Is it an actively maintained project? Do I stand to again/ lose anything by using this library apart from the primary reason that its provider independent?
Have used this for a pretty major product, easy to use and extend. Well recommended so that mapping product can be swapped out in the future if needs be. Cheers, Rob
Mapstraction as a library to access Google maps Do you suggest Mapstraction (library) as a layer to access Google maps? Is it an actively maintained project? Do I stand to again/ lose anything by using this library apart from the primary reason that its provider independent?
TITLE: Mapstraction as a library to access Google maps QUESTION: Do you suggest Mapstraction (library) as a layer to access Google maps? Is it an actively maintained project? Do I stand to again/ lose anything by using this library apart from the primary reason that its provider independent? ANSWER: Have used this fo...
[ "google-maps", "mapping", "maps", "gis" ]
4
4
1,648
3
0
2008-10-09T09:27:06.683000
2008-11-19T17:58:57.257000