instruction
stringlengths
0
30k
It's like saying you don't need explicit types in a dynamically-typed language. Why don't you make everything a "var" and document their types elsewhere? It's a restriction imposed on a programmer, by a programmer. It makes it harder for you to shoot yourself in the foot; gives you less room for error.
This is a tough situation to be in. Without knowing your particular situation (table size etc) I think that your best shot is to add an identity column, populate it and then delete according to it. You may remove the column later but I would suggest that you should keep it as it is really a good thing to have in the ta...
I apply logging with AOP using Castle Windsor DynamicProxies. I was already using Castle for it's IoC container, so using it for AOP was the path of least resistence for me. If you want more info let me know, I'm in the process of tidying the code up for releasing it as a blog post
I apply logging with AOP using Castle Windsor DynamicProxies. I was already using Castle for it's IoC container, so using it for AOP was the path of least resistence for me. If you want more info let me know, I'm in the process of tidying the code up for releasing it as a blog post Edit Ok, here's the basic ...
|windows|windows-vista|audio|mixer|shoutcast|
I have a problem (and have been having it for some time now) -- the new sound mixer stack in Vista features new cool things, but also re-invents the wheel. Many applications that used to use Volume Mixer on a Windows system to mix different voiced outputs into one input (for example Wave-out + Line-in --> Stereo Mix) h...
|windows|windows-vista|audio|shoutcast|mixer|
I have a problem (and have been having it for some time now) -- the new sound mixer stack in Vista features new cool things, but also re-invents the wheel. Many applications that used to use Volume Mixer on a Windows system to mix different voiced outputs into one input (for example Wave-out + Line-in --> Stereo Mix) h...
You have full access to change the xslt for the content query webpart. I reccomend exporting the webpart, saving the inline xslt into the style library and changing the webpart from using inline xslt to using a link to the file in the style library. This allows you to edit the xslt file using sharepoint designer which ...
You could start by comparing the distance between the bounding boxes. Testing the distance between rectangles is easier than testing the distance between polygons, and you can immediately eliminate any polygons that are more than nearest_rect + its_diagonal away (possibly you can refine that even more). Then, you can t...
The most important thing to understand is that IDs have to be unique: only one element with a given ID should exist within a page. Thus, if you're wanting to refer to a specific page element, that's often the best thing to use. If you have multiple elements that are in some way similar, you should use the elements c...
You probably need somethign to access the [exif][1] data. Google suggests [this library][2]. [1]: http://en.wikipedia.org/wiki/Exchangeable_image_file_format [2]: http://www.drewnoakes.com/code/exif/
You probably need something to access the [exif][1] data. Google suggests [this library][2]. [1]: http://en.wikipedia.org/wiki/Exchangeable_image_file_format [2]: http://www.drewnoakes.com/code/exif/
NHibernate, Count Query
|nhibernate|hql|querying|
If i have a simple named query defined, the preforms a count function, on one column: <query name="Activity.GetAllMiles"> <![CDATA[ select count(Distance)from Activity ]]> </query> How do I get the result of a count or any query that dont return of one the mapped en...
NHibernate, Sum Query
If i have a simple named query defined, the preforms a count function, on one column: <query name="Activity.GetAllMiles"> <![CDATA[ select sum(Distance) from Activity ]]> </query> How do I get the result of a sum or any query that dont return of one the mapped entit...
We're using [QF-Test](http://www.qfs.de/en/qftest/index.html) and are quite satisfied.
I think use of interfaces is determined more by how many people will be using your library. If it's just you, or a small team then documentation and convention will be fine and requiring interfaces will be an impediment. If it's a public library then interfaces are much more useful because they constrain people to prov...
Dim arrParts() As String Dim theDate As Date arrParts = Split(strOldFormat, ".") theDate = DateTime.DateSerial(parts(2), parts(1), parts(0)) strNewFormat = Format(theDate, "mm.dd.yyyy")
I think your on the right path with unit testing and its a great plan to improve reliability of your product. Though unit testing is not going to solve all your problems when converting your application to different platforms or even different operating systems. The reason for this, is the process unit testings goes...
What database privileges does a Wordpress Blog really need?
|mysql|wordpress|privileges|
I am setting up a few Wordpress blog sites. I have created a user in mysql that wordpress will use to access its database. The docs say to give this user all privileges on the database. Does it really need full privileges? I expect not, so does anyone know the min set of privileges that it really needs?
Depending on your SQL flavor the following could work: SELECT ColumnA as FieldA , ColumnB as FieldB , LEN(ColumnA) as FieldL FROM TableName ORDER BY L And then do SortExpression="FieldL"
JQuery does not support custom namespaces directly, but you can find the divs you are looking for by using filter function. // find all divs that have custom:attr $('div').filter(function() { return $(this).attr('custom:attr'); }).each(function() { // matched a div with custom::attr $(this).ht...
This is relative simple but a bit hard to explain since you haven't given us the way you represent your ellipse. There are so many ways to do it.. Anyway, the general principle goes like this: You can't calculate the axis aligned boundary box directly. You can however calculate the extrema of the ellipse in x and y...
Up until about May 2008 I was using Subclipse, but due to issues with some projects, I've switched over to Subversive and am using that with no issues. If you are doing something fancy like headless [Buckminster](http://wiki.eclipse.org/Buckminster) builds, then Subversive is definitely the one to go with.
I think the best way would be to inherit BaseValidator in a new class, and pass those IDs to your control as attributes. You should be able to resolve the IDs within your validator, without knowing the full client side ID that is generated at runtime. You should get the data validating on the server first, and on the...
well ive usually used: <pre>Ctl-Space (set the mark) move to end of line Ctl-K kill line Ctl-Y * 2 (yank the line back)</pre> there may be a much better way though :P
because i don't know, i'll start this round of golf with a slowball: ctrl-k, y, y
Using RAISERROR like this is really not a good idea. It's just like using Exceptions as flow control logic, which is generally frowned upon. Why not use an OUT parameter instead? That's exactly what they are for. I can't think of a database or a client API that doesn't support OUT parameters.
Depends. On the bugs, their severity and how much effort you think it will take to fix them. On the deadline and how much you think you can stretch it. On the rest of the code and how much the client can do with it.
MOSS 2007 SSL error when configuring Search Settings
Is there a pretty printer for python data?
|python|prettify|
Working with python interactively, it's sometimes necessary to display a result which is some arbitrarily complex data structure (like lists with embedded lists, etc.) The default way to display them is just one massive linear dump which just wraps over and over and you have to parse carefully to read it. Is there ...
There's two levels of escaping: one when your code is first parsed (e.g. in case you want to include a ' inside the string), and the second in the regexp engine. So you need two \s before the $ to make the regexp engine not treat it as a special character.
How to trace javascript events like onclick onblur?
|javascript|debugging|events|
Is there a way to debug/trace every javascript event in Internet Explorer 7? I have a bug that prevents scrolling after text-selecting, and I have no idea which event or action creates the bug. I really want to see which events are being triggered when I move the mouse for example.
|javascript|debugging|events|
Is there a way to debug/trace every javascript event in Internet Explorer 7? I have a bug that prevents scrolling after text-selecting, and I have no idea which event or action creates the bug. I really want to see which events are being triggered when I move the mouse for example. it's too much work to rewire t...
PostSharp - il weaving - thoughts
|c#|postsharp|logging|visual|studio|
I am considering using Postsharp framework to ease the burden of application method logging. It basically allows me to adorn methods with logging attribute and at compile time injects the logging code needed into the il. I like this solution as it keeps the noise out of the deign time code environment. Any thoughts, ...
|c#|postsharp|logging|visual-studio|aspect-oriented-programm|
|c#|visual-studio|logging|aop|postsharp|
@J D OConal is basically right, but you need to make sure that you dispose of your connections: string connString = "Data Source=..."; string sql = "..."; // your SQL query //this using block using( SqlConnection conn = new SqlConnection(connString) ) using( SqlCommand command = new SqlComm...
This is the dwell timer solution i used. Dwell just means "wait for a little bit". Timer changeDelayTimer = null; private void lvResults_SelectedIndexChanged(object sender, EventArgs e) { if (this.changeDelayTimer == null) { this.changeDelayTimer = new Timer(); ...
This is the dwell timer solution i used. Dwell just means "wait for a little bit". Timer changeDelayTimer = null; private void lvResults_SelectedIndexChanged(object sender, EventArgs e) { if (this.changeDelayTimer == null) { this.changeDelayTimer = new Timer(); ...
Create a UrlBuilder class with methods for each page like so: public class UrlBuilder { public static string BuildProductUrl(int id) { if (true) // replace with logic to determine if URL rewriting is enabled { return string.Format("~/Product/{0}",...
I suspect it cannot be done without javascript - when you hit enter, the browser submits the form - it doesn't submit what field had the focus. So unless you use JS to add that information to the form being submitted, you're out of luck.
If your running visual studios you may want to consider the following: #define _SECURE_SCL 0 #define _HAS_ITERATOR_DEBUGGING 0 That's just for iterators, what type of STL operations are you preforming? You may want to look at optimizing your memory operations; ie, using resize() to insert several element...
Without using Javascript, you just can't. That information is not conveyed from the client browser to the server.
How do I preserve line feeds, tabs, and spaces in data while still wrapping text?
It's all about broadening your horizons as a developer. If you limit yourself to only strong-typed languages, you may not end up the best programmer you could. As for tasks, Python/Lua/Ruby/Perl are great for small simple tasks, like finding some files and renaming them. They also work great when paired with a frame...
I think that using stored procedures can offer some abstraction in certain applications, as in any where you would use the same SQL code chunk to update or add the same data, you could then create the one sproc save_user($attr.....) rather that repeating yourself all over the place. Agreed the syntax is hairy and ...
Why learn Perl, Python, Ruby if the company is using C++, C# or Java as the application language?
|perl|python|ruby|java|c#|
I wonder why would a C++, C#, Java developer want to learn a dynamic language? Assuming the company won't switch its main development language from C++/C#/Java to a dynamic one what use is there for a dynamic language? What helper tasks can be done by the dynamic languages faster or better after only a few days o...
|c#|java|python|ruby|perl|
I wonder why would a C++, C#, Java developer want to learn a dynamic language? Assuming the company won't switch its main development language from C++/C#/Java to a dynamic one what use is there for a dynamic language? What helper tasks can be done by the dynamic languages faster or better after only a few days o...
They're useful for the "Quick Hack" that is for plugging a gap in your main language for a quick (and potentially dirty) fix faster than it would take to develop the same in your main language. An example: a simple script in perl to go through a large text file and replace all instances of an email address with another...
If you use a try/catch block a raiserror error number with severity 11-19 will cause execution to jump to the catch block. Any severity above 16 is a system error. To demonstrate the following code sets up a try/catch block and executes a stored procedure that we assume will fail: assume we have a table [dbo].[E...
I've used it in debug builds when the compiler insists on optimizing away a variable that I want to be able to see as I step through code.
*nix: you can intercept [SIGSEGV][1] (usualy this signal is raised before crashing) and keep the info into a file. (besides the core file which you can use to debug using gdb for example). win: Check [this][2] from msdn. You can also look at the google's chrome code to see how it handles crashes. It has a nice...
You can even simulate a queue using just one stack. The second (temporary) stack can be simulated by the call stack of recursive calls to the insert method. The principle stays the same when inserting a new element into the queue: - You need to transfer elements from one stack to another temporary stack, to r...
You can even simulate a queue using only one stack. The second (temporary) stack can be simulated by the call stack of recursive calls to the insert method. The principle stays the same when inserting a new element into the queue: - You need to transfer elements from one stack to another temporary stack, to r...
If the tests are simple, simply put them in the docstring -- most of the test frameworks for Python will be able to use that: >>> import module >>> module.method('test') 'testresult' For other more involved tests, I'd put them either in `../tests/test_module.py` or in `tests/test_module.py`.
Microsoft Visual Studio Express Edition of their C++ compiler is good
|moss2007|64-bit|sharepoint|
|sharepoint|64-bit|moss|
We’re getting the following error message when we click on “Search Settings” for a Shared Services Provider: “Authentication failed because the remote party has closed the transport stream.” This is a new server environment with two web front ends, one database server, and one index server, all running Windows 2003 ...
I would look into C# .NET development and its <a href="http://en.wikipedia.org/wiki/Windows_Forms">WinForms</a> API. It's much easier to program GUI desktop apps for Windows with that than with the Win32 API. You can always ease into Win32 API stuff later, if it's still relevant. For cross-platform solutions, look...
The SortExpression parameter specifies the name of the column to sort, followed by "ASC" or "DESC" to control the order. You could change the DataType property of the column to specifiy a user defined type whose comparer function compares string lengths. It won't be a trivial task. Skizz
I'm no Wordpress expert, but I would recommend it does actually have all privileges apart from GRANT. It will need to be able to create tables and insert/update etc. Several plugins use their own tables, which they create on the fly if they do not exist.
from pprint import pprint a = [0, 1, ['a', 'b', 'c'], 2, 3, 4] pprint(a) Note that for a short list like my example, pprint will in fact print it all on one line. However, for more complex structures it does a pretty good job of pretty printing data.
The idea of using EL itself outside of JEE was [advocated by Ed Burns][1] and [discussed on The Server Side][2]. Tomcats implementation [ships in a separate JAR][3] but I don't know if it can be used outside the server. [1]: http://weblogs.java.net/blog/edburns/archive/2006/08/the_case_for_el.html [2]: http:/...
If you **reaallly** have to do this... it'll take Reflection and quite some time to do this. Eventhandlers are managed in a Event to Delegate Map inside a Control. You would need to - reflect and obtain this map in the Control instance. - iterate for each event, get the Delegate - each delegate in turn co...
I have not used the new Motorola development studio mainly as my experience with Motorola's development tools has not been a joyous one. When working with Motorola devices I tend to stick to the standard emulator (or sometimes the Sony Ericsson emulators as those are the best I have worked with by far). The problem ...
I have not used the new Motorola development studio, because my experience with Motorola's development tools has not been a joyous one. When working with Motorola devices I tend to stick to the standard emulator (or sometimes the Sony Ericsson emulators as those are the best I have worked with by far). The problem w...
GCC is a good choice for simple things. Visual Studio Express edition is the free version of the major windows C++ compiler. If you are on Windows I would use VS. If you are on linux you should use GCC. *I say GCC for simple things because for a more complicated project the build process isn't so easy
Long term source code archiving: Is it possible?
|storage|longitude|version-control|
I'm curious about keeping source code around reliably and securely for several years. From my research/experience: 1. Optical media, such as burned DVD-R's lose bits of data over time. After a couple years, I don't get all the files off that I put on them. Read errors, etc. 2. Hard drives are mechanical and subje...
I'm curious about keeping source code around reliably and securely for several years. From my research/experience: 1. Optical media, such as burned DVD-R's lose bits of data over time. After a couple years, I don't get all the files off that I put on them. Read errors, etc. 2. Hard drives are mechanical and subje...
|version-control|storage|
I'm curious about keeping source code around reliably and securely for several years. From my research/experience: 1. Optical media, such as burned DVD-R's lose bits of data over time. After a couple years, I don't get all the files off that I put on them. Read errors, etc. 2. Hard drives are mechanical and subje...
You probably mean RRSIG ANY (otherwise, the order is wrong, the class needs to be after the type) >>> print myresolver.query('sources.org', 'RRSIG', 'ANY') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/site-packages/dns/resolver.py", line 664, ...
XML Serialize boolean as 0 and 1
|c#|xml|serialization|schema|constraints|
The XML Schema Part 2 specifies that an instance of a datatype that is defined as boolean can have the following legal literals {true, false, 1, 0}. The following XML, for example, when deserialized, sets the boolean property "Emulate" to `true`. <root> <emulate>1</emulate> </root> However, whe...
The HTML standard itself answers your question: No two objects may have the same ID, but an arbitrarily amount of objects may have the same class. So if you want to apply certain CSS style attributes to a single DIV only, that would be an ID. If you want certain style attributes to apply to multiple DIVs, that mu...
log4j log file names?
|java|logging|
We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate? Thanks<BR> Tom
|java|logging|log4j|
If you're supporting the table angle on this find a site with tables and then get yourself a screenreader - set off the screen reader and turn off your monitor Then try it with a nice semantically correct div layout site Youll see the difference Tables aren't evil if the data in it is tabular not to layout the...