instruction
stringlengths
0
30k
Two quick notes: 1. It goes without saying... So I'll say it twice. Verify that you have a valid backup. Verify that you have a valid backup. 2. @mk. Check out [Jeff's blog post][1] on database version control (if you haven't already) [1]: http://www.codinghorror.com/blog/archives/000743.html
The main thing is that VisualSVN uses TortoiseSVN for nearly all of its UI. So you only really have to set up one client (preferred diff viewer, etc), and you can take advantage of things like the same "Previous messages" button on the Commit dialog, whether you're committing from Explorer or Visual Studio.
Do you use design patterns?
|language-agnostic|designpatterns|
What's the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do they remain more of an academic concept? Do they actually provide actual value to your job? Or are they just something that people talk about to so...
|language-agnostic|design-patterns|
@orion thats so cool. Never thought of it that way. Well @jschroedl thats was fun indeed. Testing an activex in console app is fun. But I think its worth not trying down that path. You can call the methods or set and get the properties either through the way @jschroedl had explained or you can call the IDIspatch...
I have been writing OO code for the last 9 years or so. Other than using messaging, it's hard for me to imagine other approach. The main benefit I see totally in line with what CodingTheWheel said: modularisation. OO naturally leads me to construct my applications from modular components that have clean interfaces a...
Custom Build
|asp.net|buildprocess|wsdl|
I have a web application written in C# that consumes several internal web services. We have a development tier, a testing tier, and a production tier. Also, we use the WSDL.exe command to generate a Proxies.cs file for a given tier's web services. When we are ready to deploy our code up the stack from development ...
As another person just mentioned, it's a base64 encoded string. In the past, I've used this website to decode it: http://www.motobit.com/util/base64-decoder-encoder.asp
I'm coming from almost the same background and have heard the same arguments. I do understand that there are very valid reasons to put logic into the database. However, it depends on the type of application and the way it handles data which approach you should choose. In my experience, a typical data entry app like ...
You can ignore the URL field and simply paste the viewstate into the Viewstate string box. It does look like you have an old version; the serialisation methods changed in ASP.NET 2.0, so grab the [2.0 version][1] [1]: http://www.pluralsight.com/community/media/p/51688.aspx "2.x version"
Well, this one is difficult. As a programmer, you'll want to avoid TSQL and such "Database languages" as much as possible, because they are horrendous, difficult to debug, not extensible and there's nothing you can do with them that you won't be able to do using code on your application. The only reasons I see _for_...
So from the limited information you have, this can be a combination of one or more things: - Bad heap usage, i.e., double frees, read after free, write after free, setting the HEAP_NO_SERIALIZE flag with allocs and frees from multiple threads on the same heap - Out of memory - Bad code (i.e., buffer overflow...
@Matt Sheppard: Say you have a table of customers. Surely you don't want a customer to exist in the table more than once, or lots of confusion will happen throughout your sales and logistics departments (especially if the multiple rows about the customer contain different information). So you have a customer iden...
In a function that has no side-effects, there's no good reason to have more than a single return and you should write them in a functional style. In a method with side-effects, things are more sequential (time-indexed), so you write in an imperative style, using the return statement as a command to stop executing. I...
If you are going to put a lot of Java programmers _straight out of college_ to write production code, I'd say the first thing you should be concerning is pointers and memory management. Really, those who come directly from managed code rarely have the skills to debug pointer-related exception, let alone use it corre...
I have tried using Tomcat 6.16 and 6.18. This is definitely is the only filter in the chain. It seems that something is keeping a reference to the servlet outputStream. I wrapped the ServletOutputStream in my own OutputStream and then made sure the reference is destroyed. This fixed the issue so that I no longer see...
How to organize a complex Flash project
|flash|actionscript-3|organizing|
Let's compile a list of tips. (Understandably there will be some subjectivity involved, but some pointers would be useful to someone overwhelmed by tackling a large project within the Flash framework.)
For 1M combinations you'll need 6 digits. To make sure that there aren't any accidentally valid codes, I suggest 9 digits with a 1/1000 chance that a random code works. I'd also suggest using another digit (10 total) to perform an [integrity check][1]. As far as distribution patterns, random will suffice and the check ...
For 1M combinations you'll need 6 digits. To make sure that there aren't any accidentally valid codes, I suggest 9 digits with a 1/1000 chance that a random code works. I'd also suggest using another digit (10 total) to perform an [integrity check][1]. As far as distribution patterns, random will suffice and the check ...
I have run into this before an came to the same conclusion about cross database queries as you. What I ended up doing was using schemas to divide the table space that way I could keep the tables grouped but still query them all.
Can you access a model from inside another model in CodeIgniter?
|php|codeigniter|
I am writing a webapp using CodeIgniter that requires authentication. I created a model which handles all my authentication. However, I can't find a way to access this authentication model from inside another model. Is there a way to access a model from inside another model? or Is there a better way to handle ...
How to Dynamically Generate String Validation?
|php|regex|webforms|validation|
Does anyone know of a library (preferably php) or algorithm for auto-generating regex's from some common descriptions? For example, have a form with the possible options of: - Length (=x, between x & y, etc) - Starts with - Ends with - Character(s) x(yz) at index i - Specify one or more alternative ...
> Is solving the halting problem easier than people think? I think it is exactly as difficult as people think. > Will types become turing complete over time? [My dear, they already are!](http://en.wikipedia.org/wiki/C%2B%2B#Templates) > dependant types do seem like a good development? Very much so. I ...
I prefer the following syntax: Dim number as Integer = 1; Dim string as String = String.TryCast(number); If string Is Not Nothing Then
I prefer the following syntax: Dim number as Integer = 1 Dim string as String = String.TryCast(number) If string Is Not Nothing Then Hah you can tell I typically write code in C#. 8) The reason I prefer TryCast is you do not have to mess with the overhead of casting exceptions. Your cast e...
Custom Build Numbering in Visual Studio
|visual-studio|
I've inherited a .NET application that automatically updates it's version number with each release. The problem, as I see it, is in the verbosity of the version number: currently it is 3.5.3167.26981 which is a mouthful for the users to say when they are reporting bugs. What I would like is something more like this: 3....
The directionality question is easy to answer for East Asian languages: websites are left-to-right, top-to-bottom as per usual. In fact, the general web design layout principles much the same. Have a look at the websites of a [newspaper][1] (name top left, navigation bar under with "Home" on the left, headline links...
Use the [FindControl][1] method on each ListViewItem. var control = (MyControl)Item.FindControl("yourControlId"); [1]: http://msdn.microsoft.com/en-us/library/system.web.ui.control.findcontrol.aspx
I think one of the reasons abstract classes have largely been abandoned by developers might be a misunderstanding. When the [Gang of Four][1] wrote: > Program to an interface not an implementation. there was no such thing as a java or C# interface. They were talking about the object-oriented interface concept...
I think one of the reasons abstract classes have largely been abandoned by developers might be a misunderstanding. When the [Gang of Four][1] wrote: > Program to an interface not an implementation. there was no such thing as a java or C# interface. They were talking about the object-oriented interface concept...
The more return statements you have in a function, the higher complexity in that one method. If you find yourself wondering if you have to many return statements, you might want to ask yourself if you have too many lines of code in that function. But, not, there is nothing wrong with one/many return statements. In s...
I would spend a whole day discussing how to write a good class in C++. [Deitel & Deitel][1] may help as a reference. - When are constructors called? - When are assignment operators called? - When are destructors called? - What's the point for const int & a_foo? [1]: http://www.amazon.com/Program-Harv...
This looks like a prime candidate for separating the presentation from the data model. In this case, your preferences should be stored in a separate class that fires event updates whenever a particular property changes (look into INotifyPropertyChanged if your properties are a discrete set, or into a single event if t...
I would assume (with @eed3s9n) that it's to promote loose coupling. Also, without interfaces unit testing becomes much more difficult, as you can't mock up your objects.
In one sense, I think your question boils down to simply, "why use interfaces and not abstract classes?" Technically, you can achieve loose coupling with both -- the underlying implementation is still not exposed to the calling code, and you can use Abstract Factory pattern to return an underlying implementation (inter...
@DannySmurf: *It's not debuggable* Depending on your server, yes, they are debuggable. [This provides an example for SQL Server 2000][1]. I'm guessing the newer ones also have this. However, the free MySQL server does not have this (as far as I know). *It's not subject to source control* Yes, it is. Kind of...
Usable? Well, yes. To the extent that it ever was. It's always been horribly slow, text rendering has always been broken, and it's been apparent for some time now that it won't be The Next Official Graphics Layer for Windows. If you can't live with that, then there are plenty of other graphics libraries out there, f...
My personal preference is to try and keep as much logic and configuration out of the database as possible. I am heavily dependent on Spring and Hibernate these days so that makes it a lot easier. I tend to use Hibernate named queries instead of stored procedures and the static configuration information in Spring applic...
Lucene exact ordering
|lucene|
I've had this long term issue in not quite understanding how to implement a decent Lucene sort or ranking. Say I have a list of cities and their populations. If someone searches "new" or "london" I want the list of prefix matches ordered by population, and I have that working with a prefix search and an sort by field ...
I've had this long term issue in not quite understanding how to implement a decent Lucene sort or ranking. Say I have a list of cities and their populations. If someone searches "new" or "london" I want the list of prefix matches ordered by population, and I have that working with a prefix search and an sort by field ...
ASP.NET - Building your own routing system
|asp.net|routes|url-rewriting|
In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling in ASP.NET now, and I'm wondering if/how I might perform s...
Well, in one sense, you're lucky, 'cause Fortran doesn't have much in the way of subtle flow-of-control constructs or inheritance or the like. On the other, it's got some truly amazing gotchas, like the arithmetically-calculated branch-to-numeric-label stuff, the implicitly-typed variables which don't require declarat...
@[Alex][1] aw that's a bummer. What if in your `iframe` you had an html document that looked like: <html> <head> <meta http-equiv="refresh" content="0;url=/pdfs/somepdf.pdf" /> </head> <body> </body> </html> Definitely a hack, but it might work for Firefox. Although I...
Wikipedia has great write-ups comparing both [Java/C# generics][1] and [Java generics/C++][2] templates. The [main article on Generics][3] seems a bit cluttered but it does have some good info in it. [1]: http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java#Generics [2]: http://en.wikipedia.org/wiki/Co...
Anders Hejlsberg himself described the differences here "[Generics in C#, Java, and C++][1]". [1]: http://www.artima.com/intv/generics2.html
The biggest complaint is type erasure. In that, generics are not enforced at runtime. [Here's a link to some Sun docs on the subject][1]. > Generics are implemented by type > erasure: generic type information is > present only at compile time, after > which it is erased by the compiler. [1]: http://java....
For those seeing [::] in their netstat output, I'm betting your machine is running IPv6; that would be equivalent to 0.0.0.0, i.e. listen on any IPv6 address.
How to control layer ordering in Virtual Earth
|javascript|virtual-earth|
I have a mapping application that needs to draw a path, and then display icons on top of the path. I can't find a way to control the order of virtual earth layers, other than the order in which they are added. Does anyone know how to change the z index of Virtual Earth shape layers, or force a layer to the front?
You could implement your own TCP-like behaviour at the application layer. So for instance, you'd send out the UDP broadcast, but then expect a reply response from each host. If you didn't get a response within X seconds, then send another and so on until reaching some sort of threshold. If the threshold is reached ...
You could override the RecognizesAccessKey property of the ContentPresenter that is in the default template for the label. For example: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <Grid.Resources> ...
You could use the worksheet function =TODAY(), but obviously this would be updated to the current date whenever the workbook is recalculated. The only other method I can think of is, as 1729 said, to code the Workbook_Open event: Private Sub Workbook_Open() ThisWorkbook.Worksheets("Sheet1").Range("A1...
How do I increment a value in a textfile using the regular Windows command-line?
|windows|command-line|text-files|
I'd like to keep a "compile-counter" for one of my projects. I figured a quick and dirty way to do this would be to keep a textfile with a plain number in it, and then simply call upon a small script to increment this each time I compile. How would I go about doing this using the the regular Windows command-line? ...
At a previous company we did something like this by writing an Ant task to get the current Subversion changeset string, which we used as the build number, appended after the major, minor, and tertiary numbers. You could do something like this with Visual Studio as well.
How should I cast in VB.NET?
|vb.net|vb|cast|.net|
Are all of these equal? Under what circumstances should I choose each over the others? - var.ToString() - CStr(var) - CType(var, String) - DirectCast(var, String)
Are all of these equal? Under what circumstances should I choose each over the others? - var.ToString() - CStr(var) - CType(var, String) - DirectCast(var, String) ---------- *EDIT: Suggestion from **[NotMyself][1]**&hellip;* - TryCast(var, String) [1]: http://stackoverflow.com/users...
|asp.net|build-process|wsdl|
CruiseControl.Net Build Publisher - Only publish compiled files
|cruisecontrol.net|.net|buildprocess|
While setting up CruiseControl, I added a buildpublisher block to the publisher tasks: <buildpublisher> <sourceDir>C:\MyBuild\</sourceDir> <publishDir>C:\MyBuildPublished\</publishDir> <alwaysPublish>false</alwaysPublish> </buildpublisher> This works, but it copies the entire file c...
|.net|build-process|cruisecontrol.net|
You should also check out the [FTGL library][1]. > FTGL is a free cross-platform Open > Source C++ library that uses Freetype2 > to simplify rendering fonts in OpenGL > applications. FTGL supports bitmaps, > pixmaps, texture maps, outlines, > polygon mesh, and extruded polygon > rendering modes. This proj...
@CodingTheWheel > But to the extent that OOP has been a waste of time, I'd say it's because of lack of programmer training, compounded by the steep learning curve of learning a language specific OOP mapping. Some people "get" OOP and others never will. I dunno if that's really surprising, though. I think that tech...
Ant build scripts, antcall, dependancies, etc
|buildprocess|ant|
I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that I can ensure the utils jar is up to date....
About ANDing: It sounds like you are looking for the "relational division" operation. [This article][1] covers relational division in concise and yet comprehendible way. About performance: A bitmap-based approach intuitively sounds like it will suit the situation well. However, I'm not convinced it's a good idea to ...
Sounds like time for a full restore. The MOSS upgrade steps did explicitly ask for a restore, didn't it?
Preventing Command Line Injection Attacks
|security|command-line|hacks|injection|commandline|
We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools. Obviously, this is a big security nightmare waiting to happen. Unfortunately, we've not yet found any classes in the .NET Framework that execute com...
We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools. Obviously, this is a big security nightmare waiting to happen. Unfortunately, we've not yet found any classes in the .NET Framework that execute com...
I know in the first few years of high school we were 'taught' Logo, and strangely, HTML. After that, the progression went to macros in MS Office, followed by basic VBA, followed by Visual Basic.
It turns out I was mistaken: * If I create my dialog with a NULL parent then it is not displayed, and hangs the parent application * However if I create my dialog with ::GetConsoleWindow() as the parent then the dialog is displayed; it just fooled me because it was displayed behind the window of the application tha...
If you're like me and only swear by serifs try Kourier with a K, a somewhat more compact Courier .
@peter I don't know why you had trouble with getting a simple app working, right off the bat without doing anything your app gets a lot of benefits from the Cocoa framework. If you mean you were trying to do stuff like connect a button to an action and have it print a alert on screen or something like that then yes I c...
Whats the best way to deliver TFS build status notifications to the team?
|tfs|msbuild|build-automation|continuous-integration|
I like the status email sent by TFS's alerts mechanism when a build breaks. However I would like to send such an email to the entire team and not rely on the team to subscribe to the alert... Having a hard time producing a nice and detailed enough message by myself when overriding the "OnBuildBreak" and using the M...