PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
31,711
08/28/2008 05:23:30
2,785
08/25/2008 03:48:53
51
7
How to plot a long path with Virtual Earth
The obvious way to plot a path with virtual earth (VEMap.GetDirections) is limited to 25 points. When trying to plot a vehicle's journey this is extremely limiting. How can I plot a by-road journey of more than 25 points on a virtual earth map?
javascript
virtual-earth
null
null
null
null
open
How to plot a long path with Virtual Earth === The obvious way to plot a path with virtual earth (VEMap.GetDirections) is limited to 25 points. When trying to plot a vehicle's journey this is extremely limiting. How can I plot a by-road journey of more than 25 points on a virtual earth map?
0
31,722
08/28/2008 06:33:37
598
08/07/2008 02:49:41
596
28
Anyone have a diff algorithm for rendered HTML?
I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the *rendered* HTML.
diff
javascript
html
null
null
null
open
Anyone have a diff algorithm for rendered HTML? === I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the *rendered* HTML.
0
31,790
08/28/2008 07:28:17
831
08/09/2008 06:37:00
80
3
How many ServiceContracts can a WCF Service have?
Specifically, since a ServiceContract is an Attribute to an Interface, how many interfaces can I code into one WCF web service? Is it a one-to-one?
web-services
wcf
null
null
null
null
open
How many ServiceContracts can a WCF Service have? === Specifically, since a ServiceContract is an Attribute to an Interface, how many interfaces can I code into one WCF web service? Is it a one-to-one?
0
31,794
08/28/2008 07:31:48
2,121
08/20/2008 13:11:31
53
3
ConfigurationManager
In .net frameworks 1.1, I use `System.Configuration.ConfigurationSettings.AppSettings["name"];` for application settings. But in Frameworks 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this `System.Configuration.ConfigurationManager.AppSettings["name"];` The problem is, ConfigurationManager was not found in the System.Configuration namespace. I've been banging my head against the wall trying to figure out what I'm doing wrong. Anybody got any ideas?
.net
c#
null
null
null
null
open
ConfigurationManager === In .net frameworks 1.1, I use `System.Configuration.ConfigurationSettings.AppSettings["name"];` for application settings. But in Frameworks 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this `System.Configuration.ConfigurationManager.AppSettings["name"];` The problem is, ConfigurationManager was not found in the System.Configuration namespace. I've been banging my head against the wall trying to figure out what I'm doing wrong. Anybody got any ideas?
0
31,799
08/28/2008 07:36:40
832
08/09/2008 06:51:40
2,247
184
Preventing XML Serialization of IEnumerable and ICollection<T> & Inherited Types
**NOTE: _XMLIgnore_ is NOT the answer!** OK, so following on from my question on [XML Serialization and Inherited Types](http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types), I began integrating that code into my application I am working on, stupidly thinking all will go well.. I ran into problems with a couple of classes I have that implement _IEnumerable_ and _ICollection&lt;T&gt;_ The problem with these is that when the XMLSerializer comes to serialize these, it views them as an external property, and instead of using the property we would like it to (i.e. the one with our _AbstractXmlSerializer_ ) it comes here and falls over (due to the type mismatch), pretty much putting us back to square one. My current solution is to remove the interface implementation (in this current application, its no real big deal, just made the code prettier). **Do I need to swallow my pride on this one and accept it cant be done?** I know I have kinda pushed and got more out of the XmlSerializer than what was expected of it :) _ _ _ ###Edit I should also add, I am currently working in framework 2.
xml
serialization
inheritance
.net-2.0
null
null
open
Preventing XML Serialization of IEnumerable and ICollection<T> & Inherited Types === **NOTE: _XMLIgnore_ is NOT the answer!** OK, so following on from my question on [XML Serialization and Inherited Types](http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types), I began integrating that code into my application I am working on, stupidly thinking all will go well.. I ran into problems with a couple of classes I have that implement _IEnumerable_ and _ICollection&lt;T&gt;_ The problem with these is that when the XMLSerializer comes to serialize these, it views them as an external property, and instead of using the property we would like it to (i.e. the one with our _AbstractXmlSerializer_ ) it comes here and falls over (due to the type mismatch), pretty much putting us back to square one. My current solution is to remove the interface implementation (in this current application, its no real big deal, just made the code prettier). **Do I need to swallow my pride on this one and accept it cant be done?** I know I have kinda pushed and got more out of the XmlSerializer than what was expected of it :) _ _ _ ###Edit I should also add, I am currently working in framework 2.
0
31,800
08/28/2008 07:36:46
2,670
08/24/2008 10:03:28
31
9
How to respond to an alternate URI in a RESTful web service
I'm building a RESTful web service which has multiple URIs for one of its resources, because there is more than one unique identifier. Should the server respond to a GET request for an alternate URI by returning the resource, or should I send an HTTP 3xx redirect to the canonical URI? Is *HTTP 303 (see also)* the most appropriate redirect?
rest
http
language-agnostic
null
null
null
open
How to respond to an alternate URI in a RESTful web service === I'm building a RESTful web service which has multiple URIs for one of its resources, because there is more than one unique identifier. Should the server respond to a GET request for an alternate URI by returning the resource, or should I send an HTTP 3xx redirect to the canonical URI? Is *HTTP 303 (see also)* the most appropriate redirect?
0
31,812
08/28/2008 07:47:37
1,493
08/12/2008 06:55:12
141
5
Performance issues regarding Access 2003 and the OLE Object data type
In MS Access 2003 (I know, I know), I'm using the OLE Object data type to persist the sate of some objects that are marked as serializable (just using a IO.BinaryFormatter to serialize to a MemoryStream, and then saving that to the db as a Byte array). Does this work pretty much like a varbinary, or a blob? Are there any gotchas looming in the shadows that anyone knows about? Any performance advise or war stories? I'd profit from any advice.
ms-access
serialization
oledb
null
null
null
open
Performance issues regarding Access 2003 and the OLE Object data type === In MS Access 2003 (I know, I know), I'm using the OLE Object data type to persist the sate of some objects that are marked as serializable (just using a IO.BinaryFormatter to serialize to a MemoryStream, and then saving that to the db as a Byte array). Does this work pretty much like a varbinary, or a blob? Are there any gotchas looming in the shadows that anyone knows about? Any performance advise or war stories? I'd profit from any advice.
0
31,818
08/28/2008 07:54:27
3,353
08/28/2008 07:32:01
1
0
How to find out which Service Pack is installed on SQL Server?
the title says it all...
sql-server
null
null
null
null
null
open
How to find out which Service Pack is installed on SQL Server? === the title says it all...
0
31,826
08/28/2008 08:01:12
1,428
08/15/2008 15:27:39
81
9
Algorithmic complexity of XML parsers/validators
I need to know how the performance of different XML tools (parsers, validators, XPath expression evaluators, etc) is affected by the size and complexity of the input document. Are there resources out there that document how CPU time and memory usage are affected by... well, what? Document size in bytes? Number of nodes? And is the relationship linear, polynomial, or worse?
xml
algorithmic
complexity
null
null
null
open
Algorithmic complexity of XML parsers/validators === I need to know how the performance of different XML tools (parsers, validators, XPath expression evaluators, etc) is affected by the size and complexity of the input document. Are there resources out there that document how CPU time and memory usage are affected by... well, what? Document size in bytes? Number of nodes? And is the relationship linear, polynomial, or worse?
0
31,834
08/28/2008 08:12:42
2,644
08/23/2008 21:56:47
309
31
Generating random terrain in Blender3D
I tried finding a python script in google that will generate a random terrain when the game starts (or each time a the player advances to a new scene) but all the tools I found are for creating a terrain to render it, not for the game mode. Any idea how/where to find one? (I'm assuming that since Blender3D has game programming capabilities, it is OK for someone to ask in SO)
blender3d
null
null
null
null
null
open
Generating random terrain in Blender3D === I tried finding a python script in google that will generate a random terrain when the game starts (or each time a the player advances to a new scene) but all the tools I found are for creating a terrain to render it, not for the game mode. Any idea how/where to find one? (I'm assuming that since Blender3D has game programming capabilities, it is OK for someone to ask in SO)
0
31,837
08/28/2008 08:19:15
3,182
08/27/2008 09:11:40
121
8
Best books about TDD
I'd like to enhance my TDD knowledge and practice. What would you recommend to read?
tdd
book
null
null
null
09/15/2011 07:17:54
not constructive
Best books about TDD === I'd like to enhance my TDD knowledge and practice. What would you recommend to read?
4
31,840
08/28/2008 08:20:44
3,360
08/28/2008 08:20:44
1
0
Java Logging vs Log4J
is it still worth to add the log4j library to a Java 5 project just to log let's say some exceptions to a file with some nice rollover settings. Or will the standard util.logging facility do the job as well? What do you think? Thanks for sharing your thoughts! Okami
java
logging
null
null
null
null
open
Java Logging vs Log4J === is it still worth to add the log4j library to a Java 5 project just to log let's say some exceptions to a file with some nice rollover settings. Or will the standard util.logging facility do the job as well? What do you think? Thanks for sharing your thoughts! Okami
0
31,847
08/28/2008 08:30:27
2,964
08/26/2008 09:05:45
31
4
XML Schema construct for "Any number of these elements - in any order"
I need to create an XML schema that looks something like this: <xs:element name="wrapperElement"> <xs:complexType> <xs:sequence> <xs:element type="el1"> <xs:element type="el2"> </xs:sequence> <xs:WhatGoesHere?> <xs:element type="el3"> <xs:element type="el4"> <xs:element type="el5"> </xs:WhatGoesHere?> <xs:sequence> <xs:element type="el6"> <xs:element type="el7"> </xs:sequence> </xs:complexType> </xs:element> What I need is a replacement for "WhatGoesHere" such that any number of el3, el4 and el5 can appear in any order. For instance it could contain {el3, el3, el5, el3} Any idea on how to solve this?
xml
schema
xsd
null
null
null
open
XML Schema construct for "Any number of these elements - in any order" === I need to create an XML schema that looks something like this: <xs:element name="wrapperElement"> <xs:complexType> <xs:sequence> <xs:element type="el1"> <xs:element type="el2"> </xs:sequence> <xs:WhatGoesHere?> <xs:element type="el3"> <xs:element type="el4"> <xs:element type="el5"> </xs:WhatGoesHere?> <xs:sequence> <xs:element type="el6"> <xs:element type="el7"> </xs:sequence> </xs:complexType> </xs:element> What I need is a replacement for "WhatGoesHere" such that any number of el3, el4 and el5 can appear in any order. For instance it could contain {el3, el3, el5, el3} Any idea on how to solve this?
0
31,849
08/28/2008 08:34:09
3,023
08/26/2008 12:30:52
1
1
Capturing Cmd-C keyboard event from modular Flex application in browser or AIR.
It seems that it is impossible to capture the keyboard event normally used for copy when running a Flex application in the browser or as an AIR app, presumably because the browser or OS is intercepting it first. Is there a way to tell the browser or OS to let the event through? For example, on a AdvancedDataGrid I have set the keyUp event to handleCaseListKeyUp(event), which calls the following function: private function handleCaseListKeyUp(event:KeyboardEvent):void { var char:String = String.fromCharCode(event.charCode).toUpperCase(); if (event.ctrlKey && char == "C") { trace("Ctrl-C"); copyCasesToClipboard(); return; } if (!event.ctrlKey && char == "C") { trace("C"); copyCasesToClipboard(); return; } // Didn't match event to capture, just drop out. trace("charCode: " + event.charCode); trace("char: " + char); trace("keyCode: " + event.keyCode); trace("ctrlKey: " + event.ctrlKey); trace("altKey: " + event.altKey); trace("shiftKey: " + event.shiftKey); } When run, I can never get the release of the "C" key while also pressing the command key (which shows up as KeyboardEvent.ctrlKey). I get the following trace results: charCode: 0 char: keyCode: 17 ctrlKey: false altKey: false shiftKey: false As you can see, the only event I can capture is the release of the command key, the release of the "C" key isn't even sent. Has anyone successfully implemented standard copy and paste keyboard handling? Am I destined to just use the "C" key on it's own (as shown in the code example) or make a copy button available? Or do I need to create the listener manually at a higher level and pass the event down into my modular application's guts?
flex
air
null
null
null
null
open
Capturing Cmd-C keyboard event from modular Flex application in browser or AIR. === It seems that it is impossible to capture the keyboard event normally used for copy when running a Flex application in the browser or as an AIR app, presumably because the browser or OS is intercepting it first. Is there a way to tell the browser or OS to let the event through? For example, on a AdvancedDataGrid I have set the keyUp event to handleCaseListKeyUp(event), which calls the following function: private function handleCaseListKeyUp(event:KeyboardEvent):void { var char:String = String.fromCharCode(event.charCode).toUpperCase(); if (event.ctrlKey && char == "C") { trace("Ctrl-C"); copyCasesToClipboard(); return; } if (!event.ctrlKey && char == "C") { trace("C"); copyCasesToClipboard(); return; } // Didn't match event to capture, just drop out. trace("charCode: " + event.charCode); trace("char: " + char); trace("keyCode: " + event.keyCode); trace("ctrlKey: " + event.ctrlKey); trace("altKey: " + event.altKey); trace("shiftKey: " + event.shiftKey); } When run, I can never get the release of the "C" key while also pressing the command key (which shows up as KeyboardEvent.ctrlKey). I get the following trace results: charCode: 0 char: keyCode: 17 ctrlKey: false altKey: false shiftKey: false As you can see, the only event I can capture is the release of the command key, the release of the "C" key isn't even sent. Has anyone successfully implemented standard copy and paste keyboard handling? Am I destined to just use the "C" key on it's own (as shown in the code example) or make a copy button available? Or do I need to create the listener manually at a higher level and pass the event down into my modular application's guts?
0
31,854
08/28/2008 08:38:04
1,695
08/18/2008 02:49:06
226
26
How to marshal an array of structs - (.Net/C# => C++)
Disclaimer: Near zero with marshalling concepts.. I have a struct B that contains a string + an array of structs C. I need to send this across the giant interop chasm to a COM - C++ consumer. **What are the right set of attributes I need to decorate my struct definition ?** [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public struct A { public string strA public B b; } [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public struct B { public int Count; [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.Struct, SizeParamIndex=0)] public C [] c; } [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public struct C { public string strVar; }
.net
interop
null
null
null
null
open
How to marshal an array of structs - (.Net/C# => C++) === Disclaimer: Near zero with marshalling concepts.. I have a struct B that contains a string + an array of structs C. I need to send this across the giant interop chasm to a COM - C++ consumer. **What are the right set of attributes I need to decorate my struct definition ?** [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public struct A { public string strA public B b; } [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public struct B { public int Count; [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.Struct, SizeParamIndex=0)] public C [] c; } [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public struct C { public string strVar; }
0
31,865
08/28/2008 08:50:20
2,452
08/22/2008 11:19:16
61
6
Good reasons for not letting the browser launch local applications
I know this might be a no-brainer, but please read on. I also know it's generally not considered a good idea, maybe the worst, to let a browser run and interact with local apps, even in a intranet context. We use citrix for home-office, and people really like it. Now, they would like the same kind of environment at work, a nice page where every important application/document/folder is nicely arranged and classified in an orderly fashion. These folks are not particularly tech savvy; I don't even consider thinking that they could understand the difference between remote delivered applications and local ones. So, I've been asked if it's possible. Of course it is, with IE's good ol' ActiveX controls. And I even made a working prototype (that's where it hurts). But now, I doubt. Isn't it madness to allow such 'dangerous' ActiveX controls, even in the '*local intranet*' zone ? People will use the same browser to surf the web, can I fully trust IE ? Isn't there a risk that Microsoft would just disable those controls in future updates / versions ? What if a website, or any kind of malware, just puts another site in the trust list ? With that extent of control, you could as well uninstall every protection and just run amok 'till you got hanged by the IT dept. I'm about to confront my superiors with the fact that, even if they saw it is doable, it would be a very bad thing. So i'm desperately in need of good and strong arguments, because "*let's don't*" won't do it. Of course, if there is nothing to be scared of, that'll be nice too. But I strongly doubt that..
security
internet-explorer
activex
intranet
null
null
open
Good reasons for not letting the browser launch local applications === I know this might be a no-brainer, but please read on. I also know it's generally not considered a good idea, maybe the worst, to let a browser run and interact with local apps, even in a intranet context. We use citrix for home-office, and people really like it. Now, they would like the same kind of environment at work, a nice page where every important application/document/folder is nicely arranged and classified in an orderly fashion. These folks are not particularly tech savvy; I don't even consider thinking that they could understand the difference between remote delivered applications and local ones. So, I've been asked if it's possible. Of course it is, with IE's good ol' ActiveX controls. And I even made a working prototype (that's where it hurts). But now, I doubt. Isn't it madness to allow such 'dangerous' ActiveX controls, even in the '*local intranet*' zone ? People will use the same browser to surf the web, can I fully trust IE ? Isn't there a risk that Microsoft would just disable those controls in future updates / versions ? What if a website, or any kind of malware, just puts another site in the trust list ? With that extent of control, you could as well uninstall every protection and just run amok 'till you got hanged by the IT dept. I'm about to confront my superiors with the fact that, even if they saw it is doable, it would be a very bad thing. So i'm desperately in need of good and strong arguments, because "*let's don't*" won't do it. Of course, if there is nothing to be scared of, that'll be nice too. But I strongly doubt that..
0
31,867
08/28/2008 08:52:55
2,638
08/23/2008 20:10:14
291
20
Are there any examples where we *need* protected inheritance in C++
While I've seen rare cases where *private* inheritance was needed, I've never encountered a case where *protected* inheritance is needed. Does someone have an example?
language
c++
inheritance
null
null
null
open
Are there any examples where we *need* protected inheritance in C++ === While I've seen rare cases where *private* inheritance was needed, I've never encountered a case where *protected* inheritance is needed. Does someone have an example?
0
31,868
08/28/2008 08:53:00
3,362
08/28/2008 08:38:32
1
0
Upload a file to SharePoint through the built-in web services
What is the best way to upload a file to a Document Library on a SharePoint server through the built-in web services that version WSS 3.0 exposes?
sharepoint
wss
null
null
null
null
open
Upload a file to SharePoint through the built-in web services === What is the best way to upload a file to a Document Library on a SharePoint server through the built-in web services that version WSS 3.0 exposes?
0
31,870
08/28/2008 08:55:34
1,532
08/16/2008 12:19:36
88
8
using a html entity in xslt (e.g.  )
what is the best way to include a htlm entity in XSLT? <xsl:template match="/a/node"> <xsl:value-of select="."/> <xsl:text>&nbsp;</xsl:text> </xsl:template> this one returns a **XsltParseError**
xslt
null
null
null
null
null
open
using a html entity in xslt (e.g.  ) === what is the best way to include a htlm entity in XSLT? <xsl:template match="/a/node"> <xsl:value-of select="."/> <xsl:text>&nbsp;</xsl:text> </xsl:template> this one returns a **XsltParseError**
0
31,871
08/28/2008 08:59:07
3,263
08/27/2008 15:33:09
1
0
WSACancelBlockingCall exception
Ok, I have a strange exception thrown from my code that's been bothering me for ages. This is the code: TcpListener serverSocket= new TcpListener(new IPEndPoint(bindAddress, port)); serverSocket.Start(); (...) socket = serverSocket.AcceptTcpClient(); //Funny exception thrown from here And this is the exception: System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall at System.Net.Sockets.Socket.Accept() at System.Net.Sockets.TcpListener.AcceptTcpClient() MSDN isn't terribly helpfull on this : [http://msdn.microsoft.com/en-us/library/ms741547(VS.85).aspx][1] and I don't even know how to begin troubleshooting this one. It's only thrown 4 or 5 times a day, and never in our test enviroment. Only in production sites, and on ALL production sites. I've found plenty of posts asking about this exception, but no actual definitive answers on what is causing it, and how to handle or prevent it. [1]: http://msdn.microsoft.com/en-us/library/ms741547(VS.85).aspx
c#
sockets
null
null
null
null
open
WSACancelBlockingCall exception === Ok, I have a strange exception thrown from my code that's been bothering me for ages. This is the code: TcpListener serverSocket= new TcpListener(new IPEndPoint(bindAddress, port)); serverSocket.Start(); (...) socket = serverSocket.AcceptTcpClient(); //Funny exception thrown from here And this is the exception: System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall at System.Net.Sockets.Socket.Accept() at System.Net.Sockets.TcpListener.AcceptTcpClient() MSDN isn't terribly helpfull on this : [http://msdn.microsoft.com/en-us/library/ms741547(VS.85).aspx][1] and I don't even know how to begin troubleshooting this one. It's only thrown 4 or 5 times a day, and never in our test enviroment. Only in production sites, and on ALL production sites. I've found plenty of posts asking about this exception, but no actual definitive answers on what is causing it, and how to handle or prevent it. [1]: http://msdn.microsoft.com/en-us/library/ms741547(VS.85).aspx
0
31,875
08/28/2008 09:03:09
3,363
08/28/2008 08:41:45
11
1
Is there a simple, elegant way to define Singletons in Python?
There seem to be many ways to define Singletons in python. I was wondering if there is a consensus opinion on StackOverflow.
python
patterns
singleton
null
null
null
open
Is there a simple, elegant way to define Singletons in Python? === There seem to be many ways to define Singletons in python. I was wondering if there is a consensus opinion on StackOverflow.
0
31,882
08/28/2008 09:08:43
1,600
08/17/2008 13:46:47
669
54
(Why) should I use obfuscation?
It seems to me obfuscation is an idea that falls somewhere in the "security by obscurity" or "false sense of protection" camp. To protect intellectual property, there's copyright; to prevent security issues from being found, there's *fixing those issues*. In short, I regard it as a technical solution to a social problem. [Those almost never work.][1] However, I seem to be the only one in our dev team to feel that way, so I'm either wrong, or just need convincing arguments. Our product uses .NET, and one dev suggested .NET Reactor (which, incidentally, [was suggested in this SO thread as well][2]). >.NET Reactor completely stops any decompiling by mixing any pure .NET assembly (written in C#, VB.NET, Delphi.NET, J#, MSIL...) with native machine code. So, basically, you throw all advantages of bytecode away in one go? Are there good *engineering* benefits to obfuscation? [1]: http://www.ietf.org/mail-archive/web/ietf/current/msg22508.html [2]: http://stackoverflow.com/questions/2525/best-net-obfuscation-toolsstrategy#22990
.net
security
obfuscation
protection
null
null
open
(Why) should I use obfuscation? === It seems to me obfuscation is an idea that falls somewhere in the "security by obscurity" or "false sense of protection" camp. To protect intellectual property, there's copyright; to prevent security issues from being found, there's *fixing those issues*. In short, I regard it as a technical solution to a social problem. [Those almost never work.][1] However, I seem to be the only one in our dev team to feel that way, so I'm either wrong, or just need convincing arguments. Our product uses .NET, and one dev suggested .NET Reactor (which, incidentally, [was suggested in this SO thread as well][2]). >.NET Reactor completely stops any decompiling by mixing any pure .NET assembly (written in C#, VB.NET, Delphi.NET, J#, MSIL...) with native machine code. So, basically, you throw all advantages of bytecode away in one go? Are there good *engineering* benefits to obfuscation? [1]: http://www.ietf.org/mail-archive/web/ietf/current/msg22508.html [2]: http://stackoverflow.com/questions/2525/best-net-obfuscation-toolsstrategy#22990
0
31,885
08/28/2008 09:09:58
3,205
08/27/2008 13:06:13
11
5
Does Visual Studio Server Explorer support custom database providers?
I had used Server Explorer and related tools for graphical database development with Microsoft SQL Server in some of my learning projects - and it was a great experience. However, in my work I deal with Oracle DB and SQLite and my hobby projects use MySQL (because they are hosted on Linux). Is there a way to leverage the database-related tools in Visual Studio with other database providers?
c#
visual-studio
mysql
oracle
sqlite
null
open
Does Visual Studio Server Explorer support custom database providers? === I had used Server Explorer and related tools for graphical database development with Microsoft SQL Server in some of my learning projects - and it was a great experience. However, in my work I deal with Oracle DB and SQLite and my hobby projects use MySQL (because they are hosted on Linux). Is there a way to leverage the database-related tools in Visual Studio with other database providers?
0
31,906
08/28/2008 09:31:09
3,353
08/28/2008 07:32:01
8
0
How to efficiently archive older parts of a big (multi-GB) SQL Server database?
Right now I am working on a solution to archive older data from a big working database to a separate archive database with the same schema. I move the data using SQL scripts and SQL Server Management Objects (SMO) from a .Net executable written in C#. The archived data should still be accessible and even (occassionally) changeable, we just want it out of the way to keep the working database lean and fast. Hurling large portions of data around and managing the relations between tables has proven to be quite a challenge. I wonder if there is a better way to archive data with SQL Server. Any ideas?
sql
sql-server
null
null
null
null
open
How to efficiently archive older parts of a big (multi-GB) SQL Server database? === Right now I am working on a solution to archive older data from a big working database to a separate archive database with the same schema. I move the data using SQL scripts and SQL Server Management Objects (SMO) from a .Net executable written in C#. The archived data should still be accessible and even (occassionally) changeable, we just want it out of the way to keep the working database lean and fast. Hurling large portions of data around and managing the relations between tables has proven to be quite a challenge. I wonder if there is a better way to archive data with SQL Server. Any ideas?
0
31,913
08/28/2008 09:40:19
3,373
08/28/2008 09:40:18
1
0
a more generic visitor pattern
I'm sorry if my question is so long and technical but I think it's so important other people will be interested about it I was looking for a way to separate clearly some softwares internals from their representation in c++ I have a generic parameter class (to be later stored in a container) that can contain any kind of value with the the boost::any class I have a base class (roughly) of this kind (of course there is more stuff) class Parameter { public: Parameter() template typename<T> T GetValue() const { return any_cast<T>( _value ); } template typename<T> void SetValue(const T& value) { _value = value; } string GetValueAsString() const = 0; void SetValueFromString(const string& str) const = 0; private: boost::any _value; } There are two levels of derived classes: The first level defines the type and the conversion to/from string (for example ParameterInt or ParameterString) The second level defines the behaviour and the real creators (for example deriving ParameterAnyInt and ParameterLimitedInt from ParameterInt or ParameterFilename from GenericString) Depending on the real type I would like to add external function or classes that operates depending on the specific parameter type without adding virtual methods to the base class and without doing strange casts For example I would like to create the proper gui controls depending on parameter types: Widget* CreateWidget(const Parameter& p) Of course I cannot understand real Parameter type from this unless I use RTTI or implement it my self (with enum and switch case), but this is not the right OOP design solution, you know. The classical solution is the Visitor design pattern <http://en.wikipedia.org/wiki/Visitor_pattern> The problem with this pattern is that I have to know in advance which derived types will be implemented, so (putting together what is written in wikipedia and my code) we'll have sort of: struct Visitor { virtual void visit(ParameterLimitedInt& wheel) = 0; virtual void visit(ParameterAnyInt& engine) = 0; virtual void visit(ParameterFilename& body) = 0; }; Is there any solution to obtain this behaviour in any other way without need to know in advance all the concrete types and without deriving the original visitor? Thanks for your time
design-patterns
visitor
c++
null
null
null
open
a more generic visitor pattern === I'm sorry if my question is so long and technical but I think it's so important other people will be interested about it I was looking for a way to separate clearly some softwares internals from their representation in c++ I have a generic parameter class (to be later stored in a container) that can contain any kind of value with the the boost::any class I have a base class (roughly) of this kind (of course there is more stuff) class Parameter { public: Parameter() template typename<T> T GetValue() const { return any_cast<T>( _value ); } template typename<T> void SetValue(const T& value) { _value = value; } string GetValueAsString() const = 0; void SetValueFromString(const string& str) const = 0; private: boost::any _value; } There are two levels of derived classes: The first level defines the type and the conversion to/from string (for example ParameterInt or ParameterString) The second level defines the behaviour and the real creators (for example deriving ParameterAnyInt and ParameterLimitedInt from ParameterInt or ParameterFilename from GenericString) Depending on the real type I would like to add external function or classes that operates depending on the specific parameter type without adding virtual methods to the base class and without doing strange casts For example I would like to create the proper gui controls depending on parameter types: Widget* CreateWidget(const Parameter& p) Of course I cannot understand real Parameter type from this unless I use RTTI or implement it my self (with enum and switch case), but this is not the right OOP design solution, you know. The classical solution is the Visitor design pattern <http://en.wikipedia.org/wiki/Visitor_pattern> The problem with this pattern is that I have to know in advance which derived types will be implemented, so (putting together what is written in wikipedia and my code) we'll have sort of: struct Visitor { virtual void visit(ParameterLimitedInt& wheel) = 0; virtual void visit(ParameterAnyInt& engine) = 0; virtual void visit(ParameterFilename& body) = 0; }; Is there any solution to obtain this behaviour in any other way without need to know in advance all the concrete types and without deriving the original visitor? Thanks for your time
0
31,919
08/28/2008 09:43:42
578
08/06/2008 22:07:45
28
4
How to make the process of debugging an APS.NET application less time consuming?
I'm comparing it Java where you can start your application server in debug mode, then attach your IDE to the server. And you can change your code "on the fly" without restarting the serer. As long as your changes don't affect any method signatures or fields you can just hit recompile for a class and the application server (servlet container) will reload the class. I suppose this is impossible in ASP.NET since all classes are packed into assemblies and you cannot unload/reload assemblies, can you ? So when you have an .aspx page and an assembly deployed to GAC and your codebehind changes you have to redeploy the assembly and reset IIS. I'm talking about Sharepoint applications in particular and I'm not sure whether you have to do iisreset for private assemblies but I guess you have too. So the best way to debug aspx pages with code behind I guess would be to get rid of the codebehind for the time of active debugging and move into the page, then when it is more or less working move it back to codebehind. ( This would be applicable only for application pages in Sharepoint, site pages don't allow inline code ) How do you approach debugging of your ASP.NET applications to make it less time consuming?
asp.net
debugging
null
null
null
null
open
How to make the process of debugging an APS.NET application less time consuming? === I'm comparing it Java where you can start your application server in debug mode, then attach your IDE to the server. And you can change your code "on the fly" without restarting the serer. As long as your changes don't affect any method signatures or fields you can just hit recompile for a class and the application server (servlet container) will reload the class. I suppose this is impossible in ASP.NET since all classes are packed into assemblies and you cannot unload/reload assemblies, can you ? So when you have an .aspx page and an assembly deployed to GAC and your codebehind changes you have to redeploy the assembly and reset IIS. I'm talking about Sharepoint applications in particular and I'm not sure whether you have to do iisreset for private assemblies but I guess you have too. So the best way to debug aspx pages with code behind I guess would be to get rid of the codebehind for the time of active debugging and move into the page, then when it is more or less working move it back to codebehind. ( This would be applicable only for application pages in Sharepoint, site pages don't allow inline code ) How do you approach debugging of your ASP.NET applications to make it less time consuming?
0
31,930
08/28/2008 09:50:48
2,972
08/26/2008 09:20:36
30
4
Sending e-mail from a Custom SQL Server Reporting Services Delivery Extension
I've developed my own delivery extension for Reporting Services 2005, to integrate this with our SaaS marketing solution. It takes the subscription, and takes a snapshot of the report with a custom set of parameters. It then renders the report, sends an e-mail with a link and the report attached as XLS. Everything works fine, until mail delivery... Here's my code for sending e-mail: public static List<string> SendMail(SubscriptionData data, Stream reportStream, string reportName, string smptServerHostname, int smtpServerPort) { List<string> failedRecipients = new List<string>(); MailMessage emailMessage = new MailMessage(data.ReplyTo, data.To); emailMessage.Priority = data.Priority; emailMessage.Subject = data.Subject; emailMessage.IsBodyHtml = false; emailMessage.Body = data.Comment; if (reportStream != null) { Attachment reportAttachment = new Attachment(reportStream, reportName); emailMessage.Attachments.Add(reportAttachment); reportStream.Dispose(); } try { SmtpClient smtp = new SmtpClient(smptServerHostname, smtpServerPort); // Send the MailMessage smtp.Send(emailMessage); } catch (SmtpFailedRecipientsException ex) { // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List failedRecipients.Add(ex.FailedRecipient); } catch (SmtpFailedRecipientException ex) { // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List failedRecipients.Add(ex.FailedRecipient); } catch (SmtpException ex) { throw ex; } catch (Exception ex) { throw ex; } // Return the List of failed recipient e-mail addresses, so the client can maintain its list. return failedRecipients; } Values for SmtpServerHostname is localhost, and port is 25. I veryfied that I can actually send mail, by using Telnet. And it works. **Here's the error message I get from SSRS:** ReportingServicesService!notification!4!08/28/2008-11:26:17:: Notification 6ab32b8d-296e-47a2-8d96-09e81222985c completed. Success: False, Status: Exception Message: Failure sending mail. Stacktrace: at MyDeliveryExtension.MailDelivery.SendMail(SubscriptionData data, Stream reportStream, String reportName, String smptServerHostname, Int32 smtpServerPort) in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MailDelivery.cs:line 48 at MyDeliveryExtension.MyDelivery.Deliver(Notification notification) in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MyDelivery.cs:line 153, DeliveryExtension: My Delivery, Report: Clicks Development, Attempt 1 ReportingServicesService!dbpolling!4!08/28/2008-11:26:17:: NotificationPolling finished processing item 6ab32b8d-296e-47a2-8d96-09e81222985c **Could this have something to do with Trust/Code Access Security?** My delivery extension is granted full trust in rssrvpolicy.config: <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="MyDelivery_CodeGroup" Description="Code group for MyDelivery extension"> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin\MyDeliveryExtension.dll" /> </CodeGroup> Could trust be an issue here? Another theory: SQL Server and SSRS was installed in the security context of Local System. Am I right, or is this service account restricted access to any network resource? Even its own SMTP Server? I tried changing all SQL Server Services logons to Administrator - but still without any success. I also tried logging onto the SMTP server in my code, by proviiding: NetworkCredential("Administrator", "password") and also NetworkCredential("Administrator", "password", "MyRepServer") Can anyone help here, please?
c#
reporting-services
extension
null
null
null
open
Sending e-mail from a Custom SQL Server Reporting Services Delivery Extension === I've developed my own delivery extension for Reporting Services 2005, to integrate this with our SaaS marketing solution. It takes the subscription, and takes a snapshot of the report with a custom set of parameters. It then renders the report, sends an e-mail with a link and the report attached as XLS. Everything works fine, until mail delivery... Here's my code for sending e-mail: public static List<string> SendMail(SubscriptionData data, Stream reportStream, string reportName, string smptServerHostname, int smtpServerPort) { List<string> failedRecipients = new List<string>(); MailMessage emailMessage = new MailMessage(data.ReplyTo, data.To); emailMessage.Priority = data.Priority; emailMessage.Subject = data.Subject; emailMessage.IsBodyHtml = false; emailMessage.Body = data.Comment; if (reportStream != null) { Attachment reportAttachment = new Attachment(reportStream, reportName); emailMessage.Attachments.Add(reportAttachment); reportStream.Dispose(); } try { SmtpClient smtp = new SmtpClient(smptServerHostname, smtpServerPort); // Send the MailMessage smtp.Send(emailMessage); } catch (SmtpFailedRecipientsException ex) { // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List failedRecipients.Add(ex.FailedRecipient); } catch (SmtpFailedRecipientException ex) { // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List failedRecipients.Add(ex.FailedRecipient); } catch (SmtpException ex) { throw ex; } catch (Exception ex) { throw ex; } // Return the List of failed recipient e-mail addresses, so the client can maintain its list. return failedRecipients; } Values for SmtpServerHostname is localhost, and port is 25. I veryfied that I can actually send mail, by using Telnet. And it works. **Here's the error message I get from SSRS:** ReportingServicesService!notification!4!08/28/2008-11:26:17:: Notification 6ab32b8d-296e-47a2-8d96-09e81222985c completed. Success: False, Status: Exception Message: Failure sending mail. Stacktrace: at MyDeliveryExtension.MailDelivery.SendMail(SubscriptionData data, Stream reportStream, String reportName, String smptServerHostname, Int32 smtpServerPort) in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MailDelivery.cs:line 48 at MyDeliveryExtension.MyDelivery.Deliver(Notification notification) in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MyDelivery.cs:line 153, DeliveryExtension: My Delivery, Report: Clicks Development, Attempt 1 ReportingServicesService!dbpolling!4!08/28/2008-11:26:17:: NotificationPolling finished processing item 6ab32b8d-296e-47a2-8d96-09e81222985c **Could this have something to do with Trust/Code Access Security?** My delivery extension is granted full trust in rssrvpolicy.config: <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="MyDelivery_CodeGroup" Description="Code group for MyDelivery extension"> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin\MyDeliveryExtension.dll" /> </CodeGroup> Could trust be an issue here? Another theory: SQL Server and SSRS was installed in the security context of Local System. Am I right, or is this service account restricted access to any network resource? Even its own SMTP Server? I tried changing all SQL Server Services logons to Administrator - but still without any success. I also tried logging onto the SMTP server in my code, by proviiding: NetworkCredential("Administrator", "password") and also NetworkCredential("Administrator", "password", "MyRepServer") Can anyone help here, please?
0
31,931
08/28/2008 09:50:48
916
08/10/2008 11:21:51
77
5
What's the simplest way to decremement a date in Javascript by 1 day?
I need to decrement a Javascript date by 1 day, so that it rolls back across months/years correctly. That is, if I have a date of 'Today', I want to get the date for 'Yesterday'. It always seems to take more code than necessary when I do this, so I wonder if there's a simple way. What's the simplest way of doing this?
javascript
browser
null
null
null
null
open
What's the simplest way to decremement a date in Javascript by 1 day? === I need to decrement a Javascript date by 1 day, so that it rolls back across months/years correctly. That is, if I have a date of 'Today', I want to get the date for 'Yesterday'. It always seems to take more code than necessary when I do this, so I wonder if there's a simple way. What's the simplest way of doing this?
0
31,935
08/28/2008 09:53:22
3,099
08/26/2008 16:23:14
1
0
ASP.NET AJAX: Firing an UpdatePanel after the page load is complete
I'm sure this is easy but I can't figure it out: I have an ASP.NET page with some UpdatePanels on it. I want the page to *completely* load with some 'Please wait' text in the UpdatePanels. Then once the page is *completely loaded* I want to call a code-behind function to update the UpdatePanel. Any ideas as to what combination of Javascript and code-behind I need to implement this idea? SAL PS: I've tried putting my function call in the Page_Load but then code is run *before* the page is delivered and, as the function I want to run takes some time, the page simply takes too long to load up.
asp.net
javascript
ajax
null
null
null
open
ASP.NET AJAX: Firing an UpdatePanel after the page load is complete === I'm sure this is easy but I can't figure it out: I have an ASP.NET page with some UpdatePanels on it. I want the page to *completely* load with some 'Please wait' text in the UpdatePanels. Then once the page is *completely loaded* I want to call a code-behind function to update the UpdatePanel. Any ideas as to what combination of Javascript and code-behind I need to implement this idea? SAL PS: I've tried putting my function call in the Page_Load but then code is run *before* the page is delivered and, as the function I want to run takes some time, the page simply takes too long to load up.
0
31,982
08/28/2008 10:25:00
2,797
08/25/2008 07:48:49
1
3
Looking for a good book to learn SQL
I'm looking for a good and short book to learn SQL in general, and good modern SQL practices. Any suggestions? Thanks!
sql
books
null
null
null
null
open
Looking for a good book to learn SQL === I'm looking for a good and short book to learn SQL in general, and good modern SQL practices. Any suggestions? Thanks!
0
32,000
08/28/2008 10:37:39
1,344
08/14/2008 16:03:00
1,319
98
C# - SQLClient - Simplest INSERT
Before someone gets in a tizzy because this was answered elsewhere (not sure if it was,but...), the 5 "related questions" shown right now do not match what I'm looking for, and I searched the string "sql insert" and did not find quite what I was looking for. So I'm basically trying to figure out the simplest way to perform your basic insert operation in C#.NET using the SqlClient namespace. I'm using SqlConnection for my db link, I've already had success executing some reads, and I want to know the simplest way to insert data. I'm finding what seem to be pretty verbose methods when I google.
sql
t-sql
query
sql-server
c#
null
open
C# - SQLClient - Simplest INSERT === Before someone gets in a tizzy because this was answered elsewhere (not sure if it was,but...), the 5 "related questions" shown right now do not match what I'm looking for, and I searched the string "sql insert" and did not find quite what I was looking for. So I'm basically trying to figure out the simplest way to perform your basic insert operation in C#.NET using the SqlClient namespace. I'm using SqlConnection for my db link, I've already had success executing some reads, and I want to know the simplest way to insert data. I'm finding what seem to be pretty verbose methods when I google.
0
32,001
08/28/2008 10:38:03
142
08/02/2008 12:41:43
160
13
Resettable Java Timer
I'd like to have a java.utils.Timer with a resettable time in java. E.g. the timer should be able to do something like: Timer timer = new Timer(); timer.schedule(timerTask, 5000); //Timer starts in 5000 ms //At some point between 0 and 5000 ms... setNewTime(timer, 8000); //timerTask will fire in 8000ms from NOW. I don't see a way to do this using the utils timer, as if you call cancel() you cannot schedule it again. The only way I've come close to replicating this behavior is by using javax.swing.Timer and involves stopping the origional timer, and creating a new one. i.e.: timer.stop(); timer = new Timer(8000, ActionListener); timer.start(); Is there an easier way??
java
timer
null
null
null
null
open
Resettable Java Timer === I'd like to have a java.utils.Timer with a resettable time in java. E.g. the timer should be able to do something like: Timer timer = new Timer(); timer.schedule(timerTask, 5000); //Timer starts in 5000 ms //At some point between 0 and 5000 ms... setNewTime(timer, 8000); //timerTask will fire in 8000ms from NOW. I don't see a way to do this using the utils timer, as if you call cancel() you cannot schedule it again. The only way I've come close to replicating this behavior is by using javax.swing.Timer and involves stopping the origional timer, and creating a new one. i.e.: timer.stop(); timer = new Timer(8000, ActionListener); timer.start(); Is there an easier way??
0
32,003
08/28/2008 10:47:38
1,462
08/15/2008 17:26:18
46
6
Tool for commandline "bookmarks" on windows?
Im searching a tool which allows me to specify some folders as "bookmarks" and than access them on the commandline (on Windows XP) via a keyword. Something like: C:\> go home D:\profiles\user\home\> go svn-project1 D:\projects\project1\svn\branch\src\> I'm currently using a bunch of batch files, but editing them by hand is a daunting task. On Linux there is [cdargs][1] or [shell bookmarks][2] but I haven't found something on windows. [1]: http://www.skamphausen.de/software/cdargs/ [2]: http://kore-nordmann.de/blog/shell_bookmarks.html
commandline
null
null
null
null
null
open
Tool for commandline "bookmarks" on windows? === Im searching a tool which allows me to specify some folders as "bookmarks" and than access them on the commandline (on Windows XP) via a keyword. Something like: C:\> go home D:\profiles\user\home\> go svn-project1 D:\projects\project1\svn\branch\src\> I'm currently using a bunch of batch files, but editing them by hand is a daunting task. On Linux there is [cdargs][1] or [shell bookmarks][2] but I haven't found something on windows. [1]: http://www.skamphausen.de/software/cdargs/ [2]: http://kore-nordmann.de/blog/shell_bookmarks.html
0
32,010
08/28/2008 10:55:17
1,384,652
08/01/2008 12:01:23
1,518
74
RegexOptions.IgnoreCase
[Source][1] > RegexOptions.IgnoreCase is more expensive than I would have thought (eg, should be barely measurable) Assuming that this applies to PHP, Python, Perl, Ruby etc as well as C# (which is what I assume Jeff was using), how much of a slowdown is it and will I incur a similar penalty with "/[a-zA-z]/" as I will with "/[a-z]/i" ? [1]: http://twitter.com/codinghorror/statuses/901272685
regex
null
null
null
null
null
open
RegexOptions.IgnoreCase === [Source][1] > RegexOptions.IgnoreCase is more expensive than I would have thought (eg, should be barely measurable) Assuming that this applies to PHP, Python, Perl, Ruby etc as well as C# (which is what I assume Jeff was using), how much of a slowdown is it and will I incur a similar penalty with "/[a-zA-z]/" as I will with "/[a-z]/i" ? [1]: http://twitter.com/codinghorror/statuses/901272685
0
32,020
08/28/2008 11:23:44
1,417
08/15/2008 15:13:33
1
0
Is soapUI the best web services testing tool/client/framework?
I have been working on a web services related project for about the last year. Our team found [soapUI][1] near the start of our project and we have been satisfied with it (the free version, that is). My question is: are there other tools/clients/frameworks that you have used/currently use for web services testing and would recommend? [1]: http://www.soapui.org
web-services
testing
null
null
null
null
open
Is soapUI the best web services testing tool/client/framework? === I have been working on a web services related project for about the last year. Our team found [soapUI][1] near the start of our project and we have been satisfied with it (the free version, that is). My question is: are there other tools/clients/frameworks that you have used/currently use for web services testing and would recommend? [1]: http://www.soapui.org
0
32,027
08/28/2008 11:35:12
3,024
08/26/2008 12:30:57
31
5
NAnt and dual platform build - best way to build on Windows AND Mono/Linux
I'm new to NAnt but have some experience with Ant and CruiseControl. What I want to do is have my SVN project include all tools needed (like NUnit and Mocks etc) so I can check out onto a fresh machine and build. This strategy is outlined by J.P Boodhoo [here.][1] So far so good if I only want to run on Windows, but I want to be able to check out onto Linux and build/test/run against Mono too. I want no dependencies external to the SVN project. I don't mind having two sets of tools in the project but want only one NAnt build file This must be possible - but how? what are the tricks / 'traps for young players' [1]: http://blog.jpboodhoo.com/NAntStarterSeries.aspx
.net
linux
build-process
mono
nant
null
open
NAnt and dual platform build - best way to build on Windows AND Mono/Linux === I'm new to NAnt but have some experience with Ant and CruiseControl. What I want to do is have my SVN project include all tools needed (like NUnit and Mocks etc) so I can check out onto a fresh machine and build. This strategy is outlined by J.P Boodhoo [here.][1] So far so good if I only want to run on Windows, but I want to be able to check out onto Linux and build/test/run against Mono too. I want no dependencies external to the SVN project. I don't mind having two sets of tools in the project but want only one NAnt build file This must be possible - but how? what are the tricks / 'traps for young players' [1]: http://blog.jpboodhoo.com/NAntStarterSeries.aspx
0
32,034
08/28/2008 11:36:52
2,993
08/26/2008 10:45:59
275
12
In C#, isn't the observer pattern already implemented using Events?
After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework?
c#
design-patterns
null
null
null
null
open
In C#, isn't the observer pattern already implemented using Events? === After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework?
0
32,041
08/28/2008 11:40:58
1,772
08/18/2008 14:05:29
21
6
How to remove debug statements from production code in Java
Is it possible for the compiler to remove statements used for debugging purposes (such as logging) from production code? The debug statements would need to be marked somehow, maybe using annotations. It's easy to set a property (debug = true) and check it at each debug statement, but this can reduce performance. It would be nice if the compiler would simply make the debug statements vanish.
performance
java
debugging
null
null
null
open
How to remove debug statements from production code in Java === Is it possible for the compiler to remove statements used for debugging purposes (such as logging) from production code? The debug statements would need to be marked somehow, maybe using annotations. It's easy to set a property (debug = true) and check it at each debug statement, but this can reduce performance. It would be nice if the compiler would simply make the debug statements vanish.
0
32,044
08/28/2008 11:43:10
3,154
08/27/2008 02:48:03
1
0
How can I render a tree structure (recursive) using a django template?
I have a tree structure in memory that I would like to render in HTML using a Django template. class Node(): name = "node name" children = [] There will be some object `root` that is a `Node`, and `children` is a list of `Node`s. `root` will be passed in the content of the template. I have found [this][1] one discussion of how this might be achieved, but the poster suggests this might not be good in a production environment. Does anybody know of a better way? [1]: http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/
python
django
null
null
null
null
open
How can I render a tree structure (recursive) using a django template? === I have a tree structure in memory that I would like to render in HTML using a Django template. class Node(): name = "node name" children = [] There will be some object `root` that is a `Node`, and `children` is a list of `Node`s. `root` will be passed in the content of the template. I have found [this][1] one discussion of how this might be achieved, but the poster suggests this might not be good in a production environment. Does anybody know of a better way? [1]: http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/
0
32,058
08/28/2008 11:52:34
3,379
08/28/2008 10:27:56
1
0
How do I extract the inner exception from a soap exception in ASP.NET?
I have a simple web service operation like this one: [WebMethod] public string HelloWorld() { throw new Exception("HelloWorldException"); return "Hello World"; } And then I have a client application that consumes the web service and then calls the operation. Obviously it will throw an exception :-) try { hwservicens.Service1 service1 = new hwservicens.Service1(); service1.HelloWorld(); } catch(Exception e) { Console.WriteLine(e.ToString()); } In my catch-block, what I would like to do is extract the Message of the actual exception to use it in my code. The exception caught is a `SoapException`, which is fine, but it's `Message` property is like this... System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: HelloWorldException at WebService1.Service1.HelloWorld() in C:\svnroot\Vordur\WebService1\Service1.asmx.cs:line 27 --- End of inner exception stack trace --- ...and the `InnerException` is `null`. What I would like to do is extract the `Message` property of the `InnerException` (the `HelloWorldException` text in my sample), can anyone help with that? If you can avoid it, please don't suggest parsing the `Message` property of the `SoapException`.
.net
asp.net
web-services
exception
soap
null
open
How do I extract the inner exception from a soap exception in ASP.NET? === I have a simple web service operation like this one: [WebMethod] public string HelloWorld() { throw new Exception("HelloWorldException"); return "Hello World"; } And then I have a client application that consumes the web service and then calls the operation. Obviously it will throw an exception :-) try { hwservicens.Service1 service1 = new hwservicens.Service1(); service1.HelloWorld(); } catch(Exception e) { Console.WriteLine(e.ToString()); } In my catch-block, what I would like to do is extract the Message of the actual exception to use it in my code. The exception caught is a `SoapException`, which is fine, but it's `Message` property is like this... System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: HelloWorldException at WebService1.Service1.HelloWorld() in C:\svnroot\Vordur\WebService1\Service1.asmx.cs:line 27 --- End of inner exception stack trace --- ...and the `InnerException` is `null`. What I would like to do is extract the `Message` property of the `InnerException` (the `HelloWorldException` text in my sample), can anyone help with that? If you can avoid it, please don't suggest parsing the `Message` property of the `SoapException`.
0
32,059
08/28/2008 11:54:02
2,138
08/20/2008 14:23:45
27
1
How to get number of occurrences in a SQL IN clause
Let say i have four tables PAGE, USER, TAG and PAGE-TAG PAGE has fields ID, CONTENT ... TAG has fields ID, NAME ... USER has fields ID, NAME ... PAGE-TAG has fields ID, PAGE-ID, TAG-ID, USER-ID Let say i have four pages PAGE#1 'Content page 1' tagged with tag#1 by user1, tagged with tag#1 by user2 PAGE#2 'Content page 2' tagged with tag#3 by user2, tagged by tag#1 by user2, tagged by tag#8 by user1 PAGE#3 'Content page 3' tagged with tag#7 by user#1 PAGE#4 'Content page 4' tagged with tag#1 by user1, tagged with tag#8 by user1 I expect my query to look something like this: select page.content ? from page, page-tag where page.id = page-tag.pag-id and page-tag.tag-id in (1, 3, 8) order by ? desc I would like to get such an output: Content page 2, 3 Content page 4, 2 Content page 1, 1 thanks in advanced for the feedback.
sql
null
null
null
null
null
open
How to get number of occurrences in a SQL IN clause === Let say i have four tables PAGE, USER, TAG and PAGE-TAG PAGE has fields ID, CONTENT ... TAG has fields ID, NAME ... USER has fields ID, NAME ... PAGE-TAG has fields ID, PAGE-ID, TAG-ID, USER-ID Let say i have four pages PAGE#1 'Content page 1' tagged with tag#1 by user1, tagged with tag#1 by user2 PAGE#2 'Content page 2' tagged with tag#3 by user2, tagged by tag#1 by user2, tagged by tag#8 by user1 PAGE#3 'Content page 3' tagged with tag#7 by user#1 PAGE#4 'Content page 4' tagged with tag#1 by user1, tagged with tag#8 by user1 I expect my query to look something like this: select page.content ? from page, page-tag where page.id = page-tag.pag-id and page-tag.tag-id in (1, 3, 8) order by ? desc I would like to get such an output: Content page 2, 3 Content page 4, 2 Content page 1, 1 thanks in advanced for the feedback.
0
32,087
08/28/2008 12:32:43
184
08/03/2008 05:34:19
1,027
12
What all are the tools/languages for windows shell scripting?
I want to know what are the options to do some scripting jobs in windows platform. I need functionality like file manipulations, registry editing etc. Can files be edited using scripting tools? What other functionality does windows scripting tools offer? Can everything that can be done using the Windows GUI be done using a scripting language?
windows
scripting
null
null
null
null
open
What all are the tools/languages for windows shell scripting? === I want to know what are the options to do some scripting jobs in windows platform. I need functionality like file manipulations, registry editing etc. Can files be edited using scripting tools? What other functionality does windows scripting tools offer? Can everything that can be done using the Windows GUI be done using a scripting language?
0
32,100
08/28/2008 12:39:53
184
08/03/2008 05:34:19
1,027
12
What is the simplest SQL Query to find the second largest value?
What is the simplest SQL query to find the second largest integer value in a specific column? Of course there may be duplicate values in the column.
sql
puzzle
null
null
null
null
open
What is the simplest SQL Query to find the second largest value? === What is the simplest SQL query to find the second largest integer value in a specific column? Of course there may be duplicate values in the column.
0
32,103
08/28/2008 12:41:04
379
08/05/2008 10:03:38
151
14
how do you programatically invoke a listview label edit
in C# I'd like to invoke the label edit of a newly added item to a ListView. basically, if I have a *click here to add* scenario, as soon as the new item is added, I want the text label to be in a user editable state. Thanks!
c#
.net
winforms
gui
noob
null
open
how do you programatically invoke a listview label edit === in C# I'd like to invoke the label edit of a newly added item to a ListView. basically, if I have a *click here to add* scenario, as soon as the new item is added, I want the text label to be in a user editable state. Thanks!
0
32,123
08/28/2008 12:46:26
2,974
08/26/2008 09:39:16
201
22
procmail lockfile utility and NFS
G'day, Has anyone used the lockfile utility that ships with procmail in conjunction with NFS mounted directories? The lockfile man page states that "Lockfile is NFS-resistant and eight-bit clean." cheers, Rob
unix
nfs
procmail
lockfile
null
null
open
procmail lockfile utility and NFS === G'day, Has anyone used the lockfile utility that ships with procmail in conjunction with NFS mounted directories? The lockfile man page states that "Lockfile is NFS-resistant and eight-bit clean." cheers, Rob
0
32,133
08/28/2008 12:50:16
3,018
08/26/2008 12:12:23
208
16
How can I introduce code reviews to my group/company?
My group is made up of very competent programmers. I work for the company's research team, which is pretty selective in hiring. Having said that, we all tend to work on different projects, so it is very easy to cut corners because no one is watching. I know that I have done it when time crunched. Every now and then, I have to work on someone else's project. Whenever this happens, I inevitably see a couple strange pieces of code that really should be improved upon. On the other side of the coin, before joining this team, I worked for another team that was comprised mostly of people that had never written one line of code prior to joining the team. This team had NO code review system. What kinds of things can I do to implement code reviews? I'm not a manager, in fact, I'm the newest person on my team, but I'd like my team to improve our code.
codereview
code-review
teamwork
null
null
11/08/2011 17:10:08
off topic
How can I introduce code reviews to my group/company? === My group is made up of very competent programmers. I work for the company's research team, which is pretty selective in hiring. Having said that, we all tend to work on different projects, so it is very easy to cut corners because no one is watching. I know that I have done it when time crunched. Every now and then, I have to work on someone else's project. Whenever this happens, I inevitably see a couple strange pieces of code that really should be improved upon. On the other side of the coin, before joining this team, I worked for another team that was comprised mostly of people that had never written one line of code prior to joining the team. This team had NO code review system. What kinds of things can I do to implement code reviews? I'm not a manager, in fact, I'm the newest person on my team, but I'd like my team to improve our code.
2
32,144
08/28/2008 12:54:02
470
08/06/2008 02:58:55
80
13
Why can't SQL Server run on a Novell server?
I'm not sure whether I'm asking the question correctly, but I've been told SQL Server cannot run on a Novell server. Is this true? If yes, why not?
sql-server
novell
null
null
null
null
open
Why can't SQL Server run on a Novell server? === I'm not sure whether I'm asking the question correctly, but I've been told SQL Server cannot run on a Novell server. Is this true? If yes, why not?
0
32,145
08/28/2008 12:54:09
305
08/04/2008 14:04:19
961
64
Is this a reasonable way to handle getters/setters in a PHP class?
I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it. I didn't want to just dump a bunch of code in the question so I've posted the code for the class on refactormycode. **[base-class-for-easy-class-property-handling](http://www.refactormycode.com/codes/461-base-class-for-easy-class-property-handling)** My thought was that people can either post code snippets here or make changes on refactormycode and post links back to their refactorings. I'll make upvotes and accept an answer (assuming there's a clear "winner") based on that. At any rate, on to the class itself: I see a lot of debate about getter/setter class methods and is it better to just access simple property variables directly or should every class have explicit get/set methods defined, blah blah blah. I like the idea of having explicit methods in case you have to add more logic later. Then you don't have to modify any code that uses the class. However I hate having a million functions that look like this: public function getFirstName() { return $this->firstName; } public function setFirstName($firstName) { return $this->firstName; } Now I'm sure I'm not the first person to do this (I'm hoping that there's a better way of doing it that someone can suggest to me). Basically, the PropertyHandler class has a __call magic method. Any methods that come through __call that start with "get" or "set" are then routed to functions that set or retrieve values into an associative array. The key into the array is the name of the calling method **after** get or set. So, if the method coming into __call is "getFirstName", the array key is "FirstName". I liked using __call because it will automatically take care of the case where the subclass already has a "getFirstName" method defined. My impression (and I may be wrong) is that the __get & __set magic methods don't do that. So here's an example of how it would work: class PropTest extends PropertyHandler { public function __construct() { parent::__construct(); } } $props = new PropTest(); $props->setFirstName("Mark"); echo $props->getFirstName(); Notice that PropTest doesn't actually have "setFirstName" or "getFirstName" methods and neither does PropertyHandler. All that's doing is manipulating array values. The other case would be where your subclass is already extending something else. Since you can't have true multiple inheritance in PHP, you can make your subclass have a PropertyHandler instance as a private variable. You have to add one more function but then things behave in exactly the same way. class PropTest2 { private $props; public function __construct() { $this->props = new PropertyHandler(); } public function __call($method, $arguments) { return $this->props->__call($method, $arguments); } } $props2 = new PropTest2(); $props2->setFirstName('Mark'); echo $props2->getFirstName(); Notice how the subclass has a __call method that just passes everything along to the PropertyHandler __call method.
php
oop
null
null
null
null
open
Is this a reasonable way to handle getters/setters in a PHP class? === I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it. I didn't want to just dump a bunch of code in the question so I've posted the code for the class on refactormycode. **[base-class-for-easy-class-property-handling](http://www.refactormycode.com/codes/461-base-class-for-easy-class-property-handling)** My thought was that people can either post code snippets here or make changes on refactormycode and post links back to their refactorings. I'll make upvotes and accept an answer (assuming there's a clear "winner") based on that. At any rate, on to the class itself: I see a lot of debate about getter/setter class methods and is it better to just access simple property variables directly or should every class have explicit get/set methods defined, blah blah blah. I like the idea of having explicit methods in case you have to add more logic later. Then you don't have to modify any code that uses the class. However I hate having a million functions that look like this: public function getFirstName() { return $this->firstName; } public function setFirstName($firstName) { return $this->firstName; } Now I'm sure I'm not the first person to do this (I'm hoping that there's a better way of doing it that someone can suggest to me). Basically, the PropertyHandler class has a __call magic method. Any methods that come through __call that start with "get" or "set" are then routed to functions that set or retrieve values into an associative array. The key into the array is the name of the calling method **after** get or set. So, if the method coming into __call is "getFirstName", the array key is "FirstName". I liked using __call because it will automatically take care of the case where the subclass already has a "getFirstName" method defined. My impression (and I may be wrong) is that the __get & __set magic methods don't do that. So here's an example of how it would work: class PropTest extends PropertyHandler { public function __construct() { parent::__construct(); } } $props = new PropTest(); $props->setFirstName("Mark"); echo $props->getFirstName(); Notice that PropTest doesn't actually have "setFirstName" or "getFirstName" methods and neither does PropertyHandler. All that's doing is manipulating array values. The other case would be where your subclass is already extending something else. Since you can't have true multiple inheritance in PHP, you can make your subclass have a PropertyHandler instance as a private variable. You have to add one more function but then things behave in exactly the same way. class PropTest2 { private $props; public function __construct() { $this->props = new PropertyHandler(); } public function __call($method, $arguments) { return $this->props->__call($method, $arguments); } } $props2 = new PropTest2(); $props2->setFirstName('Mark'); echo $props2->getFirstName(); Notice how the subclass has a __call method that just passes everything along to the PropertyHandler __call method.
0
32,149
08/28/2008 12:55:58
3,203
08/27/2008 13:01:25
11
1
Does anyone have a good Proper Case algorithm
Does anyone have a trusted Proper Case or PCase algorithm (similar to a UCase or Upper)? I'm looking for something that takes a value such as "GEORGE BURDELL" or "george burdell" and turns it into "George Burdell". I have a simple one that handles the simple cases. The ideal would be to have something that can handle things such as "O'REILLY" and turn it into "O'Reilly", but I know that is tougher. I'm mainly focused on the English language if that simplifies things.
string
c#
algorithm
null
null
null
open
Does anyone have a good Proper Case algorithm === Does anyone have a trusted Proper Case or PCase algorithm (similar to a UCase or Upper)? I'm looking for something that takes a value such as "GEORGE BURDELL" or "george burdell" and turns it into "George Burdell". I have a simple one that handles the simple cases. The ideal would be to have something that can handle things such as "O'REILLY" and turn it into "O'Reilly", but I know that is tougher. I'm mainly focused on the English language if that simplifies things.
0
32,151
08/28/2008 12:57:11
3,396
08/28/2008 12:43:15
1
0
Best way to export html to Word without having MS Word installed?
Is there a way to export a simple html page to word (.doc format, not .docx) without having MSWord installed?
c#
html
word2003
null
null
null
open
Best way to export html to Word without having MS Word installed? === Is there a way to export a simple html page to word (.doc format, not .docx) without having MSWord installed?
0
32,168
08/28/2008 13:01:41
2,686
08/24/2008 14:42:08
11
6
C++ cast syntax styles
A question related to [Regular cast vs. static_cast vs. dynamic_cast][1]: What cast syntax style do you prefer in C++? - C-style cast syntax: `(int)foo` - C++-style cast syntax: `static_cast<int>(foo)` - constructor syntax: `int(foo)` They may not translate to exactly the same instructions (do they?) but their effect should be the same (right?). If you're just casting between the built-in numeric types, I find C++-style cast syntax too verbose. As a former Java coder I tend to use C-style cast syntax instead, but my local C++ guru insists on using constructor syntax. What do you think? [1]: http://stackoverflow.com/questions/28002
c++
code-style
casting
null
null
null
open
C++ cast syntax styles === A question related to [Regular cast vs. static_cast vs. dynamic_cast][1]: What cast syntax style do you prefer in C++? - C-style cast syntax: `(int)foo` - C++-style cast syntax: `static_cast<int>(foo)` - constructor syntax: `int(foo)` They may not translate to exactly the same instructions (do they?) but their effect should be the same (right?). If you're just casting between the built-in numeric types, I find C++-style cast syntax too verbose. As a former Java coder I tend to use C-style cast syntax instead, but my local C++ guru insists on using constructor syntax. What do you think? [1]: http://stackoverflow.com/questions/28002
0
32,173
08/28/2008 13:03:20
2,808
08/25/2008 10:24:10
1
1
Disable asp.net radiobutton with javascript
I'm trying to disable a bunch of controls with javascript (so that they postback values). All the controls work fine except for my radio buttons as they loose their value. In the below code which is called via a recursive function to disable all child controls the Second else (else if (control is RadioButton)) is never hit and the radiobutton control is identified as a Checkbox control. private static void DisableControl(WebControl control) { if (control is CheckBox) { ((CheckBox)control).InputAttributes.Add("disabled", "disabled"); } else if (control is RadioButton) { } else if (control is ImageButton) { ((ImageButton)control).Enabled = false; } else { control.Attributes.Add("readonly", "readonly"); } } 2 Questions:<pre> 1. How do I identify which control is a radiobutton 2. How do I disbable it so that it posts back it's value
c#
asp.net
null
null
null
null
open
Disable asp.net radiobutton with javascript === I'm trying to disable a bunch of controls with javascript (so that they postback values). All the controls work fine except for my radio buttons as they loose their value. In the below code which is called via a recursive function to disable all child controls the Second else (else if (control is RadioButton)) is never hit and the radiobutton control is identified as a Checkbox control. private static void DisableControl(WebControl control) { if (control is CheckBox) { ((CheckBox)control).InputAttributes.Add("disabled", "disabled"); } else if (control is RadioButton) { } else if (control is ImageButton) { ((ImageButton)control).Enabled = false; } else { control.Attributes.Add("readonly", "readonly"); } } 2 Questions:<pre> 1. How do I identify which control is a radiobutton 2. How do I disbable it so that it posts back it's value
0
32,175
08/28/2008 13:03:25
2,494
08/22/2008 14:29:22
25
8
Installing a .NET service using InstallUtil
I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm trying to integrate the service installation into a larger install and need the service installation to remain silent.
.net
windows-services
installutil
null
null
null
open
Installing a .NET service using InstallUtil === I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm trying to integrate the service installation into a larger install and need the service installation to remain silent.
0
32,220
08/28/2008 13:14:39
518
08/06/2008 14:07:17
85
14
any site with a good resume of Java related APIs and technologies?
Hello today in the [java Sun page][1] there is an [article][2] about JAXB technology wich helps on create XML schemas and create java objects instances from/to xml documents. This tech could help me if have known it before. The same happens to me with JPA. There are a lot of Java technologies and APIs and is difficult known all them and know for 'what' are them. Is there any site with a GOOD resumen of all this Java technologies with a summary for what is each tech and how use it [1]: http://java.sun.com [2]: http://blogs.sun.com/CoreJavaTechTips/entry/exchanging_data_with_xml_and
java
null
null
null
null
null
open
any site with a good resume of Java related APIs and technologies? === Hello today in the [java Sun page][1] there is an [article][2] about JAXB technology wich helps on create XML schemas and create java objects instances from/to xml documents. This tech could help me if have known it before. The same happens to me with JPA. There are a lot of Java technologies and APIs and is difficult known all them and know for 'what' are them. Is there any site with a GOOD resumen of all this Java technologies with a summary for what is each tech and how use it [1]: http://java.sun.com [2]: http://blogs.sun.com/CoreJavaTechTips/entry/exchanging_data_with_xml_and
0
32,227
08/28/2008 13:17:20
3,401
08/28/2008 13:04:02
1
0
Data model for a extensible web form
Suppose that I have a form that contains three 10 fields: field1..field10. I store the form data in one or more database tables, probably using 10 database columns. Now suppose a few months later that I want to add 3 more fields. And in the future I may add/delete fields from this form based on changing requirements. If I have a database column per form field, then I would have to make the corresponding changes to the database each time I change the form. This seems like a maintenance headache. There must be a more sophisticated way. So my question is, how do I design a data model that is loosely coupled with my UI? A concrete use case is a CRM system that is extensible/customizable by users.
database-design
forms
null
null
null
null
open
Data model for a extensible web form === Suppose that I have a form that contains three 10 fields: field1..field10. I store the form data in one or more database tables, probably using 10 database columns. Now suppose a few months later that I want to add 3 more fields. And in the future I may add/delete fields from this form based on changing requirements. If I have a database column per form field, then I would have to make the corresponding changes to the database each time I change the form. This seems like a maintenance headache. There must be a more sophisticated way. So my question is, how do I design a data model that is loosely coupled with my UI? A concrete use case is a CRM system that is extensible/customizable by users.
0
32,229
08/28/2008 13:17:26
290
08/04/2008 12:57:50
782
59
When do you stop testing?
What measure(s) do you use to know when it's time to stop testing an application and move it to production?
testing
lifecycle
measure
null
null
null
open
When do you stop testing? === What measure(s) do you use to know when it's time to stop testing an application and move it to production?
0
32,230
08/28/2008 13:17:42
3,382
08/28/2008 11:48:15
1
0
Tracking down where disk space has gone on Linux?
When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time before any results are returned. Also, this is usually successful in highlighting the worst offender but I've often found myself resorting to du without the sort in more subtle cases and then had to trawl through the output. I'd prefer a command line solution which relies on standard Linux commands since I have to administer quite a few systems and installing new software is a hassle (especially when out of disk space!)
linux
disk
command-line
unix
null
null
open
Tracking down where disk space has gone on Linux? === When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time before any results are returned. Also, this is usually successful in highlighting the worst offender but I've often found myself resorting to du without the sort in more subtle cases and then had to trawl through the output. I'd prefer a command line solution which relies on standard Linux commands since I have to administer quite a few systems and installing new software is a hassle (especially when out of disk space!)
0
32,231
08/28/2008 13:18:23
2,443
08/22/2008 10:53:30
69
15
Adaptive Database
Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities. For example, assuming an empty database (pseudo code): user1 = new User() // Creates the user table with a single id column user1.firstName = "Allain" // alters the table to have a firstName column as varchar(255) user2 = new User() // Reuses the table user2.firstName = "Bob" user2.lastName = "Loblaw" // Alters the table to have a last name column Since there are logical assumptions that can be made when dynamically creating the schema, and you could always override its choices by using your DB tools to tweak it later. Also, you could generate your schema by unit testing it this way. And obviously this is only for prototyping. Is there anything like this out there?
database
orm
null
null
null
null
open
Adaptive Database === Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities. For example, assuming an empty database (pseudo code): user1 = new User() // Creates the user table with a single id column user1.firstName = "Allain" // alters the table to have a firstName column as varchar(255) user2 = new User() // Reuses the table user2.firstName = "Bob" user2.lastName = "Loblaw" // Alters the table to have a last name column Since there are logical assumptions that can be made when dynamically creating the schema, and you could always override its choices by using your DB tools to tweak it later. Also, you could generate your schema by unit testing it this way. And obviously this is only for prototyping. Is there anything like this out there?
0
32,241
08/28/2008 13:23:07
1,075
08/12/2008 10:13:30
1,060
77
Algorithm to format text to Pascal or camel casing
[Using this question][1] as the base is there an alogrithm or coding example to change some text to Pascal or Camel casing. For example: mynameisfred becomes Camel: myNameIsFred Pascal: MyNameIsFred [1]: http://stackoverflow.com/questions/32149/does-anyone-have-a-good-proper-case-algorithm
algorithm
null
null
null
null
null
open
Algorithm to format text to Pascal or camel casing === [Using this question][1] as the base is there an alogrithm or coding example to change some text to Pascal or Camel casing. For example: mynameisfred becomes Camel: myNameIsFred Pascal: MyNameIsFred [1]: http://stackoverflow.com/questions/32149/does-anyone-have-a-good-proper-case-algorithm
0
32,243
08/28/2008 13:23:33
1,820
08/18/2008 18:06:03
721
29
Can PNG image transparency be preserved when using PHP's GDlib imagecopyresampled?
The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case. What's the best way to preserve the transparency in the resampled image? $uploadTempFile = $myField[ 'tmp_name' ] list( $uploadWidth, $uploadHeight, $uploadType ) = getimagesize( $uploadTempFile ); $srcImage = imagecreatefrompng( $uploadTempFile ); $targetImage = imagecreatetruecolor( 128, 128 ); imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, 128, 128, $uploadWidth, $uploadHeight );
php
gd
png
transparency
null
null
open
Can PNG image transparency be preserved when using PHP's GDlib imagecopyresampled? === The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case. What's the best way to preserve the transparency in the resampled image? $uploadTempFile = $myField[ 'tmp_name' ] list( $uploadWidth, $uploadHeight, $uploadType ) = getimagesize( $uploadTempFile ); $srcImage = imagecreatefrompng( $uploadTempFile ); $targetImage = imagecreatetruecolor( 128, 128 ); imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, 128, 128, $uploadWidth, $uploadHeight );
0
32,246
08/28/2008 13:24:09
2,947
08/26/2008 08:37:39
11
2
how to get the googlebot to get the correct GEOIPed content!?
OK. This problem is doing my head in. And I dont know if there even IS a definitive answer. We have a website, lets call it finalcog.com. It's a UK-based site, with UK based content. Google knows about it, and we have done a load of SEO on it. All is well. **Except**, we are about to relaunch **final cog, the GLOBAL brand**, so we now need finalcog.com/uk, finalcog.com/us, and finalcog.com/au, for the various countries local content. We are using GEOIP, so if someone from the US loads finalcog.com, they get redirected to finalcog.com/us etc. If someone isn't in one of those three countries (US, Australia, or UK) they get the UK site. This is all well and good, but we dont want to loose the rather large amount of google juice we have on finalcog.com! And worse, the google bot appears to be 100% based in the US, so the US site (which is pretty much out LEAST important one of the three) will appear to be the main one. **We have thought about detecting the bot**, and serving UK content, but it appears google may smack us for that. Has anyone else come across this situation, and have a solution?
google
seo
international
null
null
null
open
how to get the googlebot to get the correct GEOIPed content!? === OK. This problem is doing my head in. And I dont know if there even IS a definitive answer. We have a website, lets call it finalcog.com. It's a UK-based site, with UK based content. Google knows about it, and we have done a load of SEO on it. All is well. **Except**, we are about to relaunch **final cog, the GLOBAL brand**, so we now need finalcog.com/uk, finalcog.com/us, and finalcog.com/au, for the various countries local content. We are using GEOIP, so if someone from the US loads finalcog.com, they get redirected to finalcog.com/us etc. If someone isn't in one of those three countries (US, Australia, or UK) they get the UK site. This is all well and good, but we dont want to loose the rather large amount of google juice we have on finalcog.com! And worse, the google bot appears to be 100% based in the US, so the US site (which is pretty much out LEAST important one of the three) will appear to be the main one. **We have thought about detecting the bot**, and serving UK content, but it appears google may smack us for that. Has anyone else come across this situation, and have a solution?
0
32,260
08/28/2008 13:28:38
2,535
08/22/2008 17:36:15
21
2
Sending Email in C#.NET Through Gmail
Instead of relying on my host to send email, I was thinking of sending the messages though my gmail account. The emails are personalized emails to the bands I play on my show. Has anyone had success doing this?
c#
email
gmail
null
null
null
open
Sending Email in C#.NET Through Gmail === Instead of relying on my host to send email, I was thinking of sending the messages though my gmail account. The emails are personalized emails to the bands I play on my show. Has anyone had success doing this?
0
32,280
08/28/2008 13:34:40
3,295
08/27/2008 17:52:45
154
9
Passing null to a method
I am in the middle of reading the excellent [Clean Code](http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882) One discussion is regarding passing nulls into a method. public class MetricsCalculator { public double xProjection(Point p1, Point p2) { return (p2.x - p1.x) * 1.5; } } ... calculator.xProjection(null, new Point(12,13)); It represents different ways of handling this: public double xProjection(Point p1, Point p2) { if (p1 == null || p2 == null) { throw new IllegalArgumentException("Invalid argument for xProjection"); } return (p2.x - p1.x) * 1.5; } public double xProjection(Point p1, Point p2) { assert p1 != null : "p1 should not be null"; assert p2 != null : "p2 should not be null"; return (p2.x - p1.x) * 1.5; } I prefer the [assertions](http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html) approach, but I don't like the fact that assertions are turned off by default. The book finally states: > In most programming languages there is no good way to deal with a null that is passed by a caller accidentally. Because this is the case, the rational approach is to forbid passing null by default. It doesn't really go into how you would enforce this restriction? Do any of you have strong opinions either way.
java
null
assert
null
null
01/26/2012 13:34:32
not constructive
Passing null to a method === I am in the middle of reading the excellent [Clean Code](http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882) One discussion is regarding passing nulls into a method. public class MetricsCalculator { public double xProjection(Point p1, Point p2) { return (p2.x - p1.x) * 1.5; } } ... calculator.xProjection(null, new Point(12,13)); It represents different ways of handling this: public double xProjection(Point p1, Point p2) { if (p1 == null || p2 == null) { throw new IllegalArgumentException("Invalid argument for xProjection"); } return (p2.x - p1.x) * 1.5; } public double xProjection(Point p1, Point p2) { assert p1 != null : "p1 should not be null"; assert p2 != null : "p2 should not be null"; return (p2.x - p1.x) * 1.5; } I prefer the [assertions](http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html) approach, but I don't like the fact that assertions are turned off by default. The book finally states: > In most programming languages there is no good way to deal with a null that is passed by a caller accidentally. Because this is the case, the rational approach is to forbid passing null by default. It doesn't really go into how you would enforce this restriction? Do any of you have strong opinions either way.
4
32,282
08/28/2008 13:34:55
2,820
08/25/2008 11:37:16
40
4
Regex Testing Tools
I know of [The Regulator][1] for testing regular expressions. And there's also [RegExr][2] for testing regular expressions as well. Does anyone know of other regex testing tools? Do any of these tools allow you to specify which RE engine you're testing against? [1]: http://sourceforge.net/projects/regulator [2]: http://gskinner.com/RegExr/
regex
null
null
null
null
03/21/2012 11:02:29
not constructive
Regex Testing Tools === I know of [The Regulator][1] for testing regular expressions. And there's also [RegExr][2] for testing regular expressions as well. Does anyone know of other regex testing tools? Do any of these tools allow you to specify which RE engine you're testing against? [1]: http://sourceforge.net/projects/regulator [2]: http://gskinner.com/RegExr/
4
32,315
08/28/2008 13:46:23
648
08/07/2008 13:22:00
223
21
What is Web 3.0?
My boss asked me this yesterday just to gauge my response. Apparently, some of our clients are asking for "Web 3.0" I told him I really didn't know. He said when he's asked around the consensus is that it's microformats, etc. Frankly no one really knew either. (probably get a varied response now to "what is web 2.0?" still) I watched a demo video of [Mozilla's Ubiquity][1] this morning and thought to myself "wow this could possibly be what Web 3.0 is all about" What does Web 3.0 mean to you? How should we as developers prepare for the Web 3.0 world? [1]: http://www.43folders.com/2008/08/27/ubiquity
standards
mozilla
microformats
web3.0
null
null
open
What is Web 3.0? === My boss asked me this yesterday just to gauge my response. Apparently, some of our clients are asking for "Web 3.0" I told him I really didn't know. He said when he's asked around the consensus is that it's microformats, etc. Frankly no one really knew either. (probably get a varied response now to "what is web 2.0?" still) I watched a demo video of [Mozilla's Ubiquity][1] this morning and thought to myself "wow this could possibly be what Web 3.0 is all about" What does Web 3.0 mean to you? How should we as developers prepare for the Web 3.0 world? [1]: http://www.43folders.com/2008/08/27/ubiquity
0
32,332
08/28/2008 14:07:00
61
08/01/2008 14:21:00
742
60
Why don't the std::fstream classes take a std::string?
This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ `std::fstream` classes don't take a `std::string` in their constructor or open methods. Everyone loves code examples so: #include <iostream> #include <fstream> #include <string> int main() { std::string filename = "testfile"; std::ifstream fin; fin.open(filename.c_str()); // Works just fine. fin.close(); //fin.open(filename); // Error: no such method. //fin.close(); } This gets me all the time when working with files. Surely the C++ library would use `std::string` wherever possible?
c++
file-io
null
null
null
null
open
Why don't the std::fstream classes take a std::string? === This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ `std::fstream` classes don't take a `std::string` in their constructor or open methods. Everyone loves code examples so: #include <iostream> #include <fstream> #include <string> int main() { std::string filename = "testfile"; std::ifstream fin; fin.open(filename.c_str()); // Works just fine. fin.close(); //fin.open(filename); // Error: no such method. //fin.close(); } This gets me all the time when working with files. Surely the C++ library would use `std::string` wherever possible?
0
32,333
08/28/2008 14:07:15
1,190
08/13/2008 12:15:38
873
80
How can I program defensively in Ruby?
One thing that concerns me as a security professional is that Ruby doesn't have a parallel of Java's package-privacy. That is, this isn't valid Ruby: public module Foo public module Bar # factory method for new Bar implementations def self.new(...) SimpleBarImplementation.new(...) end def baz raise NotImplementedError.new('Implementing Classes MUST redefine #baz') end end private class SimpleBarImplementation include Bar def baz ... end end end It'd be really nice to be able to prevent monkey-patching of Foo::BarImpl. That way, people who rely on the library know that nobody has messed with it. Imagine if somebody changed the implementation of MD5 or SHA1 on you! I can call `freeze` on these classes, but I have to do it on a class-by-class basis, and other scripts might modify them before I finish securing my application if I'm not **very** careful about load order. Java provides lots of other tools for defensive programming, many of which are not possible in Ruby. (See Josh Bloch's book for a good list.) Is this really a concern? Should I just stop complaining and use Ruby for lightweight things and not hope for "enterprise-ready" solutions? (And no, core classes are not frozen by default in Ruby. See below:) require 'md5' # => true MD5.frozen? # => false
ruby
security
defensive-programming
null
null
null
open
How can I program defensively in Ruby? === One thing that concerns me as a security professional is that Ruby doesn't have a parallel of Java's package-privacy. That is, this isn't valid Ruby: public module Foo public module Bar # factory method for new Bar implementations def self.new(...) SimpleBarImplementation.new(...) end def baz raise NotImplementedError.new('Implementing Classes MUST redefine #baz') end end private class SimpleBarImplementation include Bar def baz ... end end end It'd be really nice to be able to prevent monkey-patching of Foo::BarImpl. That way, people who rely on the library know that nobody has messed with it. Imagine if somebody changed the implementation of MD5 or SHA1 on you! I can call `freeze` on these classes, but I have to do it on a class-by-class basis, and other scripts might modify them before I finish securing my application if I'm not **very** careful about load order. Java provides lots of other tools for defensive programming, many of which are not possible in Ruby. (See Josh Bloch's book for a good list.) Is this really a concern? Should I just stop complaining and use Ruby for lightweight things and not hope for "enterprise-ready" solutions? (And no, core classes are not frozen by default in Ruby. See below:) require 'md5' # => true MD5.frozen? # => false
0
32,338
08/28/2008 14:09:25
3,326
08/27/2008 23:34:17
3
1
Are there similar tools to Code Detective for Other languages/IDEs?
Just saw this linked on YCombinator news and the idea heavily appeals to me, and seems like it would be useful for many languages, not just c#, but haven't seen anything similar elsewhere. For reference: http://www.codeplex.com/CloneDetectiveVS edit: basic description of the tool for those who don't want to follow the link - It scans the codebase to find cases of duplicate code to help with refactoring things down to minimize duplication issues.
c#
alllanguages
null
null
null
null
open
Are there similar tools to Code Detective for Other languages/IDEs? === Just saw this linked on YCombinator news and the idea heavily appeals to me, and seems like it would be useful for many languages, not just c#, but haven't seen anything similar elsewhere. For reference: http://www.codeplex.com/CloneDetectiveVS edit: basic description of the tool for those who don't want to follow the link - It scans the codebase to find cases of duplicate code to help with refactoring things down to minimize duplication issues.
0
32,341
08/28/2008 14:10:52
2,490
08/22/2008 13:52:54
35
3
How do I list all Entries with a certain tag in Wordpress?
I may just be missing this functionality, but does anyone know if there is a widget available: I need to list the subject for all the entries that are associated with a given tag. For example: I have 5 articles tagged with "Tutorial", I'd like to see a list as follows: Tutorial 1 - Installing the app Tutorial 2 - Customizing Tutorial 3 - Advanced edits Tutorial 4 - User managment Does functionality like this exists in wordpress allready?
wordpress
widgets
null
null
null
null
open
How do I list all Entries with a certain tag in Wordpress? === I may just be missing this functionality, but does anyone know if there is a widget available: I need to list the subject for all the entries that are associated with a given tag. For example: I have 5 articles tagged with "Tutorial", I'd like to see a list as follows: Tutorial 1 - Installing the app Tutorial 2 - Customizing Tutorial 3 - Advanced edits Tutorial 4 - User managment Does functionality like this exists in wordpress allready?
0
32,360
08/28/2008 14:16:15
3,400
08/28/2008 13:02:35
1
0
1:1 Foreign Key Constraints
How do you specify that a foreign key constraint should be a 1:1 relationship in transact sql? Is declaring the column UNIQUE enough? Below is my existing code. Thanks in advance for the help! CREATE TABLE [dbo].MyTable( [MyTablekey] INT IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [OtherTableKey] INT NOT NULL UNIQUE CONSTRAINT [FK_MyTable_OtherTable] FOREIGN KEY REFERENCES [dbo].[OtherTable]([OtherTableKey]), ... CONSTRAINT [PK_MyTable] PRIMARY KEY CLUSTERED ( [MyTableKey] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
sql
null
null
null
null
null
open
1:1 Foreign Key Constraints === How do you specify that a foreign key constraint should be a 1:1 relationship in transact sql? Is declaring the column UNIQUE enough? Below is my existing code. Thanks in advance for the help! CREATE TABLE [dbo].MyTable( [MyTablekey] INT IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [OtherTableKey] INT NOT NULL UNIQUE CONSTRAINT [FK_MyTable_OtherTable] FOREIGN KEY REFERENCES [dbo].[OtherTable]([OtherTableKey]), ... CONSTRAINT [PK_MyTable] PRIMARY KEY CLUSTERED ( [MyTableKey] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
0
32,364
08/28/2008 14:17:11
1,946
08/19/2008 14:53:06
93
5
Assert action redirected to correct action/route?
How do I exercise an action to ensure it redirects to the correct action or route?
unit-testing
asp.net-mvc
null
null
null
null
open
Assert action redirected to correct action/route? === How do I exercise an action to ensure it redirects to the correct action or route?
0
32,366
08/28/2008 14:17:35
326
08/04/2008 16:59:58
158
11
What are the key considerations when creating a web crawler?
I just started thinking about creating/customizing a web crawler today, and know very little about web crawler/robot etiquette. A majority of the writings on etiquette I've found seem old and awkward, so I'd like to get some current (and practical) insights from the web developer community. I want to use a crawler to walk over "the web" for a super simple purpose - "does the markup of site XYZ meet condition ABC?". This raises a lot of questions for me, but I think the two main questions I need to get out of the way first are: - It feels a little "iffy" from the get go -- is this sort of thing acceptable? - What specific considerations should the crawler take to not upset people?
webcrawler
null
null
null
null
null
open
What are the key considerations when creating a web crawler? === I just started thinking about creating/customizing a web crawler today, and know very little about web crawler/robot etiquette. A majority of the writings on etiquette I've found seem old and awkward, so I'd like to get some current (and practical) insights from the web developer community. I want to use a crawler to walk over "the web" for a super simple purpose - "does the markup of site XYZ meet condition ABC?". This raises a lot of questions for me, but I think the two main questions I need to get out of the way first are: - It feels a little "iffy" from the get go -- is this sort of thing acceptable? - What specific considerations should the crawler take to not upset people?
0
32,369
08/28/2008 14:18:09
3,262
08/27/2008 15:30:29
8
2
Disable browser 'Save Password' functionality
One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes people get a little too jumpy. Case in point: One of our state customers recently found out that the browser provides the handy feature to save your password. We all know that it has been there for a while and is completely optional and is up to the end user to decide whether or not it is a smart decision to use or not. However, there is a bit of an uproar at the moment and we are being demanded to find a way to disable that functionality for our site. Question: Is there a way for a site to tell the browser not to offer to remember passwords? I've been around web development a long time but don't know that I have come across that before. Any help is appreciated. Thanks, Matt
security
browser
passwords
null
null
null
open
Disable browser 'Save Password' functionality === One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes people get a little too jumpy. Case in point: One of our state customers recently found out that the browser provides the handy feature to save your password. We all know that it has been there for a while and is completely optional and is up to the end user to decide whether or not it is a smart decision to use or not. However, there is a bit of an uproar at the moment and we are being demanded to find a way to disable that functionality for our site. Question: Is there a way for a site to tell the browser not to offer to remember passwords? I've been around web development a long time but don't know that I have come across that before. Any help is appreciated. Thanks, Matt
0
32,376
08/28/2008 14:21:10
1,553
08/16/2008 15:43:17
261
13
What is a good open source B-tree implementation in C?
I am looking for a lean and well constructed open source implementation of a B-tree library written in C. It needs to be under a non-GPL license so that it can be used in a commercial application. Ideally, this library supports the B-tree index to be stored/manipulated as a disk file so that large trees can be built using a configurable (ie: minimal) RAM footprint.
algorithm
data-structures
null
null
null
null
open
What is a good open source B-tree implementation in C? === I am looking for a lean and well constructed open source implementation of a B-tree library written in C. It needs to be under a non-GPL license so that it can be used in a commercial application. Ideally, this library supports the B-tree index to be stored/manipulated as a disk file so that large trees can be built using a configurable (ie: minimal) RAM footprint.
0
32,377
08/28/2008 14:21:11
2,494
08/22/2008 14:29:22
35
10
Test plans and how best to write them
We're trying to figure out the best way to write tests in our test plan. Specifically, when writing a test that is meant to be used by anyone including QA staff, should the steps in the test be very specific or more broad giving the tester more leeway in how the task can be accomplished. As a very simple example, if you're testing opening a document in word processing document, should the test read: 1. Using the mouse, open the file menu 2. Choose "Open File..." in the file menu 3. In the open file dialog that appears, navigate to x and double-click the document called y OR 1. Bring up the file open dialog 2. Open the file y Now I realize one answer is probably going to be "it depends on what you're trying to test" but I'm trying to answer a broader question here: If the test steps are too specific do we risk a) making the testing process to laborious and tedious and more importantly b) do we risk missing something because we wrote down too specific a path to achieve a goal. Alternatively, if we make it broad do we depend too much on the whims of the tester at the time and lose crucial testing of paths that are more common to customers/clients?
testing
null
null
null
null
null
open
Test plans and how best to write them === We're trying to figure out the best way to write tests in our test plan. Specifically, when writing a test that is meant to be used by anyone including QA staff, should the steps in the test be very specific or more broad giving the tester more leeway in how the task can be accomplished. As a very simple example, if you're testing opening a document in word processing document, should the test read: 1. Using the mouse, open the file menu 2. Choose "Open File..." in the file menu 3. In the open file dialog that appears, navigate to x and double-click the document called y OR 1. Bring up the file open dialog 2. Open the file y Now I realize one answer is probably going to be "it depends on what you're trying to test" but I'm trying to answer a broader question here: If the test steps are too specific do we risk a) making the testing process to laborious and tedious and more importantly b) do we risk missing something because we wrote down too specific a path to achieve a goal. Alternatively, if we make it broad do we depend too much on the whims of the tester at the time and lose crucial testing of paths that are more common to customers/clients?
0
32,385
08/28/2008 14:23:00
2,147
08/20/2008 15:14:13
433
48
Programmatically editing python source
This is something that I think would be very useful. Basically, I'd like there to be a way to edit python source programmatically without requiring human intervention. There are a couple of things I would like to do with this: 1) Edit the configuration of python apps that use source modules for configuration. 2) Set up a "template" so that I can customize a python source file on the fly. This way, I can set up a "project" system on an open source app I'm working on and allow certain files to be customized. I could probably write something that can do this myself, but I can see that opening up a lot of "devil's in the details" type issues. Are there any ways to do this currently, or am I just going to have to bite the bullet and implement it myself?
python
source-file
null
null
null
null
open
Programmatically editing python source === This is something that I think would be very useful. Basically, I'd like there to be a way to edit python source programmatically without requiring human intervention. There are a couple of things I would like to do with this: 1) Edit the configuration of python apps that use source modules for configuration. 2) Set up a "template" so that I can customize a python source file on the fly. This way, I can set up a "project" system on an open source app I'm working on and allow certain files to be customized. I could probably write something that can do this myself, but I can see that opening up a lot of "devil's in the details" type issues. Are there any ways to do this currently, or am I just going to have to bite the bullet and implement it myself?
0
32,395
08/28/2008 14:24:15
93
08/01/2008 18:23:58
320
11
XAML - Accessing static fields
How does one go about referencing a class's static properties in xaml? In other words, I want to do something like this: C# Class BaseThingy { public static readonly Style BaseStyle; ... } XAML <ResoureDictionary ...> <Style BasedOn="BaseThingy.Style" TargetType="BaseThingy" /> </ResourceDictionary> What is the syntax to do this in the BasedOn? I assumed it would involve using `StaticResource` to some degree, but I haven't gotten it to work for me.
c#
.net
wpf
silverlight
xaml
null
open
XAML - Accessing static fields === How does one go about referencing a class's static properties in xaml? In other words, I want to do something like this: C# Class BaseThingy { public static readonly Style BaseStyle; ... } XAML <ResoureDictionary ...> <Style BasedOn="BaseThingy.Style" TargetType="BaseThingy" /> </ResourceDictionary> What is the syntax to do this in the BasedOn? I assumed it would involve using `StaticResource` to some degree, but I haven't gotten it to work for me.
0
32,397
08/28/2008 14:24:21
1,942
08/19/2008 14:45:43
86
10
Popularity algorithm
On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
math
c#
null
null
null
null
open
Popularity algorithm === On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
0
32,401
08/28/2008 14:26:42
2,868
08/25/2008 16:43:06
38
3
Validate a UK phone number
How do I validate a UK phone number in C# using a regex?
c#
regex
regular-expression
null
null
null
open
Validate a UK phone number === How do I validate a UK phone number in C# using a regex?
0
32,404
08/28/2008 14:28:04
2,077
08/20/2008 07:26:21
149
4
Can I run a Python script as a service (in Windows)? How?
I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to access the objects through that service. I am currently aiming for Python and the Django framework as the technologies to implement that service with. I'm pretty sure I figure how to daemonize the Python program in Linux. However, it is an optional spec item that the system should support Windows. I have little experience with Windows programming and no experience at all with Windows services. Can I run Python programs as a Windows service (i. e. run it automatically without user login)? I won't necessarily have to implement this part, but I need a rough idea how it would be done in order to decide whether to design along these lines.
python
windows
crossplatform
null
null
null
open
Can I run a Python script as a service (in Windows)? How? === I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to access the objects through that service. I am currently aiming for Python and the Django framework as the technologies to implement that service with. I'm pretty sure I figure how to daemonize the Python program in Linux. However, it is an optional spec item that the system should support Windows. I have little experience with Windows programming and no experience at all with Windows services. Can I run Python programs as a Windows service (i. e. run it automatically without user login)? I won't necessarily have to implement this part, but I need a rough idea how it would be done in order to decide whether to design along these lines.
0
32,412
08/28/2008 14:29:59
2,577
08/23/2008 03:18:09
1
0
What's the best way of cleaning up after a SQL Injection?
I've been tasked with the the maintenance of a nonprofit website that recently fell victim to a SQL injection attack. Someone exploited a form on the site to add text to every available text-like field in the database (varchar, nvarchar, etc.) which, when rendered as HTML, includes and executes a JavaScript file. A Google search of the URL indicates that it's from email spammers based out of Romania or China, but that's not what's important right now. I went through and manually removed the information from the the text fields that render on most visible and popular pages on the site but I'm curious as to what would be the best programmatic way of removing the text from the other text fields on the site. Obviously there's more that needs to be done (hardening the site against SQL injections, using something like markdown instead of storing HTML, etc.) and I am working on those but for the time being what I really need is a good way to go in and programmatically remove the injected text. I know what the exact text is, it's the same every time, and it's always appended to the end of any text field. I can't afford to strip out all HTML in the database at this time and I don't know when this happened exactly so I can't just roll back to a backup. Also, the site is on shared hosting and I cannot connect to the database directly with SQL Server tools. I can execute queries against it though, so if there's any way of constructing a SQL update statement to the effect of "hey find all the text fields in all of the tables in the entire database and do this to clean them" that would be the best.
sql
sql-server
database
security
null
null
open
What's the best way of cleaning up after a SQL Injection? === I've been tasked with the the maintenance of a nonprofit website that recently fell victim to a SQL injection attack. Someone exploited a form on the site to add text to every available text-like field in the database (varchar, nvarchar, etc.) which, when rendered as HTML, includes and executes a JavaScript file. A Google search of the URL indicates that it's from email spammers based out of Romania or China, but that's not what's important right now. I went through and manually removed the information from the the text fields that render on most visible and popular pages on the site but I'm curious as to what would be the best programmatic way of removing the text from the other text fields on the site. Obviously there's more that needs to be done (hardening the site against SQL injections, using something like markdown instead of storing HTML, etc.) and I am working on those but for the time being what I really need is a good way to go in and programmatically remove the injected text. I know what the exact text is, it's the same every time, and it's always appended to the end of any text field. I can't afford to strip out all HTML in the database at this time and I don't know when this happened exactly so I can't just roll back to a backup. Also, the site is on shared hosting and I cannot connect to the database directly with SQL Server tools. I can execute queries against it though, so if there's any way of constructing a SQL update statement to the effect of "hey find all the text fields in all of the tables in the entire database and do this to clean them" that would be the best.
0
32,414
08/28/2008 14:30:26
2,176
08/20/2008 18:32:50
13
0
Force JavaScript file refresh on client
We are currently working in a private Beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client browsers still use the cached version of the file and they do not see the update. Obviously, on a support call, we can simply inform them to do a ctrl-F5 refresh to ensure that they get the up-to-date files from the server, but it would be preferable to handle this before that time. Our current thought is to simply attach a version number onto the name of the JavaScript files and then when changes are made, increment the version on the script and update all references. This definitely gets the job done, but updating the references on each release could get cumbersome. As I'm sure we're not the first ones to deal with this, I figured I would throw it out to the community. How are you ensuring clients update their cache when you update your code? If you're using the method described above, are you using a process that simplifies the change? TIA
javascript
caching
versioning
null
null
null
open
Force JavaScript file refresh on client === We are currently working in a private Beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client browsers still use the cached version of the file and they do not see the update. Obviously, on a support call, we can simply inform them to do a ctrl-F5 refresh to ensure that they get the up-to-date files from the server, but it would be preferable to handle this before that time. Our current thought is to simply attach a version number onto the name of the JavaScript files and then when changes are made, increment the version on the script and update all references. This definitely gets the job done, but updating the references on each release could get cumbersome. As I'm sure we're not the first ones to deal with this, I figured I would throw it out to the community. How are you ensuring clients update their cache when you update your code? If you're using the method described above, are you using a process that simplifies the change? TIA
0
32,428
08/28/2008 14:34:26
326
08/04/2008 16:59:58
163
11
How do I resolve a System.Security.SecurityException with custom code in SSRS?
I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work). Here is the error that is thrown by the custom code I've written. > System.Security.SecurityException: > Request for the permission of type > 'System.Security.Permissions.SecurityPermission, > mscorlib, Version=2.0.0.0, > Culture=neutral, > PublicKeyToken=b77a5c561934e089' > failed. at > System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken > permToken, CodeAccessPermission > demand, StackCrawlMark& stackMark, > Int32 unrestrictedOverride, Int32 > create) at > System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission > cap, StackCrawlMark& stackMark) at > System.Security.CodeAccessPermission.Assert() > at [Snipped Method Name] at > ReportExprHostImpl.CustomCodeProxy.[Snipped Method Name] The action that failed was: > Demand The type of the first > permission that failed was: > System.Security.Permissions.SecurityPermission > The Zone of the assembly that failed > was: MyComputer
reporting-services
null
null
null
null
null
open
How do I resolve a System.Security.SecurityException with custom code in SSRS? === I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work). Here is the error that is thrown by the custom code I've written. > System.Security.SecurityException: > Request for the permission of type > 'System.Security.Permissions.SecurityPermission, > mscorlib, Version=2.0.0.0, > Culture=neutral, > PublicKeyToken=b77a5c561934e089' > failed. at > System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken > permToken, CodeAccessPermission > demand, StackCrawlMark& stackMark, > Int32 unrestrictedOverride, Int32 > create) at > System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission > cap, StackCrawlMark& stackMark) at > System.Security.CodeAccessPermission.Assert() > at [Snipped Method Name] at > ReportExprHostImpl.CustomCodeProxy.[Snipped Method Name] The action that failed was: > Demand The type of the first > permission that failed was: > System.Security.Permissions.SecurityPermission > The Zone of the assembly that failed > was: MyComputer
0
32,433
08/28/2008 14:35:50
3,047
08/26/2008 13:36:37
17
4
Linq select * with multiple tables
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op).SingleOrDefault(); I get a new type with my 'op' fields. Now I want to retrieve my 'pg' fields as well, but select op, pg).SingleOrDefault(); doesn't work. How can I select everything from both tables so that they appear in my new pageObject type?
linq
null
null
null
null
null
open
Linq select * with multiple tables === This query works great: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op).SingleOrDefault(); I get a new type with my 'op' fields. Now I want to retrieve my 'pg' fields as well, but select op, pg).SingleOrDefault(); doesn't work. How can I select everything from both tables so that they appear in my new pageObject type?
0
32,448
08/28/2008 14:41:23
1,524
08/16/2008 10:18:37
1
0
Which 4.x version of gcc should one use?
The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are however _very_ scared of c-compiler bugs (for a good reason historically), and wonder if anyone has insight to which version we should upgrade to. Are people using 4.3.2 for large code-bases and feel that it works fine?
c
compiler
gcc
null
null
null
open
Which 4.x version of gcc should one use? === The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are however _very_ scared of c-compiler bugs (for a good reason historically), and wonder if anyone has insight to which version we should upgrade to. Are people using 4.3.2 for large code-bases and feel that it works fine?
0
32,454
08/28/2008 14:43:55
2,871
08/25/2008 16:56:00
1
1
Helpful snippits?
I'm a relatively new coder, and I'm looking to increase my snippits library. What are some of your most used snippits? I'm mainly looking for ones that I might not have thought about until I've had more experience, but will make me more productive. Have a snippit that is particularly clever? Post it!
code-snippets
null
null
null
null
04/19/2012 15:15:37
not constructive
Helpful snippits? === I'm a relatively new coder, and I'm looking to increase my snippits library. What are some of your most used snippits? I'm mainly looking for ones that I might not have thought about until I've had more experience, but will make me more productive. Have a snippit that is particularly clever? Post it!
4
32,458
08/28/2008 14:45:26
517
08/06/2008 14:01:37
239
17
Random data in Unit Tests?
I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value. I've given him a number of different reasons against this, the main ones being: - random values means the test isn't truly repeatable (which also means that if the test can randomly fail, it can do so on the build server and break the build) - if it's a random value and the test fails, we need to a) fix the object and b) force ourselves to test for that value every time, so we know it works, but since it's random we don't know what the value was Another coworker added: - If I am testing an exception, random values will not ensure that the test ends up in the expected state - random data is used for flushing out a system and load testing, not for unit tests Can anyone else add additional reasons I can give him to get him to stop doing this? (Or alternately, is this an acceptable method of writing unit tests, and I and my other coworker are wrong?)
unit-testing
null
null
null
null
null
open
Random data in Unit Tests? === I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value. I've given him a number of different reasons against this, the main ones being: - random values means the test isn't truly repeatable (which also means that if the test can randomly fail, it can do so on the build server and break the build) - if it's a random value and the test fails, we need to a) fix the object and b) force ourselves to test for that value every time, so we know it works, but since it's random we don't know what the value was Another coworker added: - If I am testing an exception, random values will not ensure that the test ends up in the expected state - random data is used for flushing out a system and load testing, not for unit tests Can anyone else add additional reasons I can give him to get him to stop doing this? (Or alternately, is this an acceptable method of writing unit tests, and I and my other coworker are wrong?)
0
32,460
08/28/2008 14:45:43
1,228
08/13/2008 13:58:55
861
61
Get the DefaultView DataRowView from a DataRow
Here's the situation: I need to bind a WPF FixedPage against a DataRow. Bindings don't work against DataRows; they work against DataRowViews. I need to do this in the most generic way possible, as I know nothing about and have no control over what is in the DataRow. What I need is to be able to get a DataRowView for a given DataRow. I can't use the Find() method on the DefaultView because that takes a key, and there is no guarantee the table will have a primary key set. Does anybody have a suggestion as to the best way to go around this?
wpf
dataset
binding
datarowview
defaultview
null
open
Get the DefaultView DataRowView from a DataRow === Here's the situation: I need to bind a WPF FixedPage against a DataRow. Bindings don't work against DataRows; they work against DataRowViews. I need to do this in the most generic way possible, as I know nothing about and have no control over what is in the DataRow. What I need is to be able to get a DataRowView for a given DataRow. I can't use the Find() method on the DefaultView because that takes a key, and there is no guarantee the table will have a primary key set. Does anybody have a suggestion as to the best way to go around this?
0
32,462
08/28/2008 14:46:04
2,863
08/25/2008 16:09:56
60
7
Pulling limited tagged photos from Flickr
So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches I might get results numbering in the thousands. Requirements: 1. I want to display between 10-20 pictures but I want to randomize the photos each time. 2. I don't want to hit Flickr every time a page request is made. 3. Not every Flickr photo with the same tags as my item will be relevant. The question is, How should I store that number of results and how would I determine which ones are relevant?
php
tags
flickr
null
null
null
open
Pulling limited tagged photos from Flickr === So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches I might get results numbering in the thousands. Requirements: 1. I want to display between 10-20 pictures but I want to randomize the photos each time. 2. I don't want to hit Flickr every time a page request is made. 3. Not every Flickr photo with the same tags as my item will be relevant. The question is, How should I store that number of results and how would I determine which ones are relevant?
0
32,474
08/28/2008 14:49:19
3,043
08/26/2008 13:24:14
364
48
Google using non-alphanumeric characters
So let's say I have an issue with some code and I want to use google to help find a solution. So I paste a code snippet into the search bar. Google will ignore any special characters like operators (especially the '.' operator), returning results that aren't as relevant as I'd like. This is true even when encasing it in double quotes. It's also annoying when trying to use something like 'C#' as part of a search. Does anyone know of a search engine that respects your special characters?
google
null
null
null
null
null
open
Google using non-alphanumeric characters === So let's say I have an issue with some code and I want to use google to help find a solution. So I paste a code snippet into the search bar. Google will ignore any special characters like operators (especially the '.' operator), returning results that aren't as relevant as I'd like. This is true even when encasing it in double quotes. It's also annoying when trying to use something like 'C#' as part of a search. Does anyone know of a search engine that respects your special characters?
0
32,493
08/28/2008 14:56:09
3,085
08/26/2008 15:02:28
18
1
Advice on how to be graphically creative
I've always felt that my graphic design skills have lacked, but I do have a desire to improve them. Even though I'm not the worlds worst artist, it's discouraging to see the results from a professional designer, who can do an amazing mockup from a simple spec in just a few hours. I always wonder how they came up with their design and more importantly, how they executed it so quickly. I'd like to think that all good artists aren't naturally gifted. I'm guessing that a lot of skill/talent comes from just putting in the time. Is there a recommended path to right brain nirvana for someone starting from scratch, a little later in life? I'd be interested in book recommendations, personal theories, or anything else that may shed some light on the best path to take. I have questions like should I read books about color theory, should I draw any chance I have, should I analyze shapes like an architect, etc... As far as my current skills go, I can make my way around Photoshop enough where I can do simple image manipulation... Thanks for any advice
creativity
graphics
design
null
null
null
open
Advice on how to be graphically creative === I've always felt that my graphic design skills have lacked, but I do have a desire to improve them. Even though I'm not the worlds worst artist, it's discouraging to see the results from a professional designer, who can do an amazing mockup from a simple spec in just a few hours. I always wonder how they came up with their design and more importantly, how they executed it so quickly. I'd like to think that all good artists aren't naturally gifted. I'm guessing that a lot of skill/talent comes from just putting in the time. Is there a recommended path to right brain nirvana for someone starting from scratch, a little later in life? I'd be interested in book recommendations, personal theories, or anything else that may shed some light on the best path to take. I have questions like should I read books about color theory, should I draw any chance I have, should I analyze shapes like an architect, etc... As far as my current skills go, I can make my way around Photoshop enough where I can do simple image manipulation... Thanks for any advice
0
32,494
08/28/2008 14:56:55
418
08/05/2008 14:46:44
68
2
Visual Studio identical token highlighting
I coded a Mancala game in Java for a college class this past spring, and I used the [Eclipse][1] IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all other references to that token on your screen. [Notepad++][2], my preferred Notepad replacement, also does this. Another neat and similar feature in Eclipse was the vertical "error bar" to the right of your code (not sure what to call it). It display little red boxes for all of the syntax errors in your document, yellow boxes for warnings like "variable declared but not used", and if you select a word, boxes appear in the bar for each occurance of the word in the document. A screenshot of these features in action: ![screenshot][3] After a half hour of searching, I've determined that Visual Studio cannot do this on its own, so my question is: does anyone know of any add-ins for 2005 or 2008 that can provide either one of the aforementioned features? Being able to highlight the current line your cursor is on would be nice too. I believe the add-in ReSharper can do this, but I'd prefer to use a free add-in rather than purchase one. [1]: http://www.eclipse.org "Eclipse" [2]: http://notepad-plus.sourceforge.net/uk/site.htm [3]: http://img.photobucket.com/albums/v519/dsteinweg/Misc/eclipse-highlighting.jpg
visual-studio
null
null
null
null
null
open
Visual Studio identical token highlighting === I coded a Mancala game in Java for a college class this past spring, and I used the [Eclipse][1] IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all other references to that token on your screen. [Notepad++][2], my preferred Notepad replacement, also does this. Another neat and similar feature in Eclipse was the vertical "error bar" to the right of your code (not sure what to call it). It display little red boxes for all of the syntax errors in your document, yellow boxes for warnings like "variable declared but not used", and if you select a word, boxes appear in the bar for each occurance of the word in the document. A screenshot of these features in action: ![screenshot][3] After a half hour of searching, I've determined that Visual Studio cannot do this on its own, so my question is: does anyone know of any add-ins for 2005 or 2008 that can provide either one of the aforementioned features? Being able to highlight the current line your cursor is on would be nice too. I believe the add-in ReSharper can do this, but I'd prefer to use a free add-in rather than purchase one. [1]: http://www.eclipse.org "Eclipse" [2]: http://notepad-plus.sourceforge.net/uk/site.htm [3]: http://img.photobucket.com/albums/v519/dsteinweg/Misc/eclipse-highlighting.jpg
0
32,505
08/28/2008 15:02:29
3,043
08/26/2008 13:24:14
364
48
XML Validation report parser
Most XML parsers will give up after the first error in a document. In fact, IIRC, that's actually part of the 'official' spec for parsers. I'm looking for something that will break that rule. It should take a given schema (assuming a valid schema) and an xml input and attempt to keep going after the first error and either raise an event for each error or return a list when finished, so I can use it to generate some kind of a report of the errors in the document. This requirement comes from above, so let's try to keep the purist _"but it wouldn't make sense to keep going"_ comments to a minimum. I'm looking for something that will evaluate both whether the document is well-formed _and_ whether or not it conforms to the schema. Ideally it would evaluate those as different classes of error. I'd prefer a .Net solution but I could use a standalone .exe as well. If you know of one that uses a different platform go ahead and post it because someone else might find it useful.
xml
xmlvalidation
null
null
null
null
open
XML Validation report parser === Most XML parsers will give up after the first error in a document. In fact, IIRC, that's actually part of the 'official' spec for parsers. I'm looking for something that will break that rule. It should take a given schema (assuming a valid schema) and an xml input and attempt to keep going after the first error and either raise an event for each error or return a list when finished, so I can use it to generate some kind of a report of the errors in the document. This requirement comes from above, so let's try to keep the purist _"but it wouldn't make sense to keep going"_ comments to a minimum. I'm looking for something that will evaluate both whether the document is well-formed _and_ whether or not it conforms to the schema. Ideally it would evaluate those as different classes of error. I'd prefer a .Net solution but I could use a standalone .exe as well. If you know of one that uses a different platform go ahead and post it because someone else might find it useful.
0
32,513
08/28/2008 15:05:28
2,972
08/26/2008 09:20:36
32
8
Write files to App_Data under medium trust hack?
Is there any way to work around this? Im sure I've heard about some hack, is that true?
asp.net
trust
null
null
null
null
open
Write files to App_Data under medium trust hack? === Is there any way to work around this? Im sure I've heard about some hack, is that true?
0
32,516
08/28/2008 15:07:01
1,137
08/12/2008 18:15:51
101
5
Getting Started with Ruby Development
What are some good online tutorials/quick starts/screencasts to get up to speed on Ruby development? I recently read Brad Wilson's Ruby article in the Sep/Oct 2008 issue of CoDe magazine and would like to continue down the Ruby/IronRuby path. (My background is mainly C# and .NET.)
ruby
tutorials
screencasts
ironruby
null
11/22/2011 16:40:30
not constructive
Getting Started with Ruby Development === What are some good online tutorials/quick starts/screencasts to get up to speed on Ruby development? I recently read Brad Wilson's Ruby article in the Sep/Oct 2008 issue of CoDe magazine and would like to continue down the Ruby/IronRuby path. (My background is mainly C# and .NET.)
4
32,519
08/28/2008 15:08:47
3,333
08/28/2008 00:32:00
1
2
List in JScrollPane painting outside the viewport
I have a list, each item of which has several things in it, including a JProgressBar which can be updating a lot. Each time one of the items updates its JProgressBar, the ListDataListener on the list tries to scroll it the visible range using /* * This makes the updating content item automatically scroll * into view if it is off the viewport. */ public void contentsChanged(final ListDataEvent evt) { if (!EventQueue.isDispatchThread()) { /** * Make sure the scrolling happens in the graphics "dispatch" thread. */ EventQueue.invokeLater(new Runnable() { public void run() { contentsChanged(evt); } }); } if (playbackInProgress) { int index = evt.getIndex0(); currentContentList.ensureIndexIsVisible(index); } } Note that I'm trying to make sure the scrolling is done in the dispatch thread, since I thought maybe the problem was it being scrolled while it was repainting. And yet, I still have a problem where if things are really active, some of the list items paint outside of the viewport, overwriting what's outside the JScrollPane. Forcing an exposure event will repaint those things, but it's annoying. Is there anything else I need to look out for to stop these things painting outside of their clipping area?
java
swing
null
null
null
null
open
List in JScrollPane painting outside the viewport === I have a list, each item of which has several things in it, including a JProgressBar which can be updating a lot. Each time one of the items updates its JProgressBar, the ListDataListener on the list tries to scroll it the visible range using /* * This makes the updating content item automatically scroll * into view if it is off the viewport. */ public void contentsChanged(final ListDataEvent evt) { if (!EventQueue.isDispatchThread()) { /** * Make sure the scrolling happens in the graphics "dispatch" thread. */ EventQueue.invokeLater(new Runnable() { public void run() { contentsChanged(evt); } }); } if (playbackInProgress) { int index = evt.getIndex0(); currentContentList.ensureIndexIsVisible(index); } } Note that I'm trying to make sure the scrolling is done in the dispatch thread, since I thought maybe the problem was it being scrolled while it was repainting. And yet, I still have a problem where if things are really active, some of the list items paint outside of the viewport, overwriting what's outside the JScrollPane. Forcing an exposure event will repaint those things, but it's annoying. Is there anything else I need to look out for to stop these things painting outside of their clipping area?
0
32,529
08/28/2008 15:11:45
2,443
08/22/2008 10:53:30
69
16
How do I restrict JFileChooser to a directory?
I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitraty directory. How should I go about doing that?
java
swing
jfilechooser
null
null
null
open
How do I restrict JFileChooser to a directory? === I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitraty directory. How should I go about doing that?
0
32,533
08/28/2008 15:12:15
381
08/05/2008 10:39:26
1,420
27
How do you write code that is both 32 bit and 64 bit compatible ?
What considerations do I need to make if I want my code to run correctly on both 32bit and 64bit platforms ?
language-agnostic
32bit
64bit
compatibility
null
null
open
How do you write code that is both 32 bit and 64 bit compatible ? === What considerations do I need to make if I want my code to run correctly on both 32bit and 64bit platforms ?
0
32,540
08/28/2008 15:13:57
3,436
08/28/2008 15:13:56
1
0
Alternative "architectural" approaches to javaScript client code?
I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with <a href="http://jquery.com">jQuery</a>, however, the logic on the page is growing to a point where some organization, or dare I say it, "architecture" is needed. My first approach is "MVC-ish": - The 'model' is very application specific, and is often updated "purely" with JSON from AJAX requests, etc - The view is basically the DOM - The controller is the object where I stick a lot of my event handling and kick off DOM adjustments I'm very interested, however, in how other people have built more substantial javaScript apps. I'm not interested in GWT, or other server-oriented approaches... just in the approach of "javaScript + &lt;generic web service-y thingy here&gt;" Because javaScript is not really OO, not really functional, I feel like I'm trying to force another paradigm on it with the MVC thing.
javascript
client
ria
architecture
mvc
null
open
Alternative "architectural" approaches to javaScript client code? === I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with <a href="http://jquery.com">jQuery</a>, however, the logic on the page is growing to a point where some organization, or dare I say it, "architecture" is needed. My first approach is "MVC-ish": - The 'model' is very application specific, and is often updated "purely" with JSON from AJAX requests, etc - The view is basically the DOM - The controller is the object where I stick a lot of my event handling and kick off DOM adjustments I'm very interested, however, in how other people have built more substantial javaScript apps. I'm not interested in GWT, or other server-oriented approaches... just in the approach of "javaScript + &lt;generic web service-y thingy here&gt;" Because javaScript is not really OO, not really functional, I feel like I'm trying to force another paradigm on it with the MVC thing.
0
32,541
08/28/2008 15:14:29
1,228
08/13/2008 13:58:55
861
62
How can you clone a WPF object?
Anybody have a good example how to deep clone a WPF object, presering databindings?
wpf
binding
clone
null
null
null
open
How can you clone a WPF object? === Anybody have a good example how to deep clone a WPF object, presering databindings?
0