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 sound smart? Note: For the purpose of this question ignore 'simple' design patterns like *Singleton*. I'm talking about designing your code so you can take advantage of *Model View Controller*, etc.
|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 object through the Invoke function. The first step is to GetIDsByName and call the function through Invoke and parameters to the function should be an array of VARIANTS in the Invoke formal parameter list. All is fine and dandy. But once you get to events its downhill from there. Windows application requires a message pump to fire events. On a console you don't have one. I went down the path to implement a EventNotifier for the events just like you implement a CallBack interface in classic C++ way. But the events doesn't get to your implemented interface. I am pretty sure this cannot be done on a console application. But I am really hoping someone out there will have a different take on events in a console application
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 and clear responsibilities (i.e. loosely coupled, highly cohesive code with a clear separation of concerns). I think where OO breaks down is when people create deeply nested class heirarchies. This can lead to complexity. However, factoring out common finctionality into a base class, then reusing that in other descendant classes is a deeply elegant thing, IMHO!
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 to test or test to production, we need to run the WSDL.exe command to point to the appropriate version of the web services. Is there a generally accepted way to automate this?
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 some customer (or xyz) management will massively benefit from using an ORM layer as there are not so many different views at the data and you can reduce the boilerplate CRUD code to a minimum. On the other hand, assume you have an application with a lot of concurrency and calculations that span a lot of tables and that has a fine-grained column-level security concept with locking and so on, you're probably better off doing stuff like that directly in the database. As mentioned before, it also depends on the variety of views you anticipate for your data. If there are many different combinations of columns and tables that need to be presented to the user, you may also be better off just handing back different result sets rather than map your objects one-by-one to another representation. After all, the database is good at dealing with sets, whereas OO code is good at dealing with single entities.
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_ writing stored procedures are: 1. Your database isn't great (think how SQL Server doesn't implement LIMIT and you have to work around that using a procedure. 2. You want to be able to change a behaviour by changing code in just one place without re-deploying your client applications. 3. The client machines have **big** calculation-power constraints (think small embedded devices). For most applications though, you should try to keep your code in the application where you can debug it, keep it under version control and fix it using all the tools provided to you by your language.
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 overflows, buffer underflows, etc.) - "Timing" issues If it's at all the first two but not the last, you should have caught it by now with either pageheap.exe. Which most likely means it is due to how the code is accessing shared memory. Unfortunately, tracking that down is going to be rather painful. Unsynchronized access to shared memory often manifests as weird "timing" issues. Things like not using acquire/release semantics for synchronizing access to shared memory with a flag, not using locks appropriately, etc. At the very least, it would help to be able to track allocations somehow, as was suggested earlier. At least then you can view what actually happened up until the heap corruption and attempt to diagnose from that. Also, if you can easily redirect allocations to multiple heaps, you might want to try that to see if that either fixes the problem or results in more reproduceable buggy behavior. When you were testing with VS2008, did you run with HeapVerifier with Conserve Memory set to Yes? That might reduce the performance impact of the heap allocator. (Plus, you have to run with it Debug->Start with Application Verifier, but you may already know that.) You can also try debugging with Windbg and various uses of the !heap command. MSN
@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 identifier which uniquely identifies the customer and you make sure that the identifier is known by the customer (in invoices), so that the customer and the customer service people have a common reference in case they need to communicate. To guarantee no duplicated customer records, you add a uniqueness-constraint to the table, either through a primary key on the customer identifier or via a NOT NULL + UNIQUE constraint on the customer identifier column. Next, for some reason (which I can't think of), you are asked to add a GUID column to the customer table and make that the primary key. If the customer identifier column is now left without a uniqueness-guarantee, you are asking for future trouble throughout the organization because the GUIDs will always be unique. Some "architect" might tell you that "oh, but we handle the _real_ customer uniqueness constraint in our app tier!". Right. Fashion regarding that general purpose programming languages and (especially) middle tier frameworks changes all the time, and will generally never out-live your database. And there is a very good chance that you will at some point need to access the database without going through the present application. == Trouble. (But fortunately, you and the "architect" are long gone, so you will not be there to clean up the mess.) In other words: Do maintain obvious constraints in the database (and in other tiers, as well, if you have the time). In other words: There may be good reasons to add GUID columns to tables, but please don't fall for the temptation to make that lower your ambitions for consistency within the _real_ (==non-GUID) information.
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. In other words, when possible, favor this style return a > 0 ? positively(a): negatively(a); over this if (a > 0) return positively(a); else return negatively(a); If you find yourself writing several layers of nested conditions, there's probably a way you can refactor that, using predicate list for example. If you find that your ifs and elses are far apart syntactically, you might want to break that down into smaller functions. A conditional block that spans more than a screenful of text is hard to read. There's no hard and fast rule that applies to every language. Something like having a single return statement won't make your code good. But good code will tend to allow you to write your functions that way.
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 correctly, or even understands how their language/tools utilize it. > Pointers is how you **think** not just write code. The framework and coding practices can be taught as tips and notes along the way. But failing to understand pointers when writing C code is just waiting to shoot yourself in the foot, if not the head.
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 a committed response passed in. This is an odd side effect of holding a reference. But I don't think it qualifies as a Tomcat bug. More likely a bug in ImageIO.createImageOutputStream() that I suspect is holding the reference.
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 digit will ensure that a single error will not result in a correct code. [1]: http://en.wikipedia.org/wiki/Check_digit
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 digit will ensure that a single error will not result in a correct code. **Edit:** Apparently I didn't fully read your request. Using a credit card number, you could perform a hash on it (MD5 or SHA1 or something similar). You then truncate at an appropriate spot (for example 9 characters) and convert to base 10. Then you add the check digit(s) and this should more or less work for your purposes. [1]: http://en.wikipedia.org/wiki/Check_digit
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 authentication inside CodeIgniter?
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 behavior based on the above - And so on.. The idea is that for certain data entities in a system, you'll be able to go to a form and set this criteria for a data field. Afterward, any time that data field for that type of data entity is entered, it will be validated against the regex. This seems like it could grow into a complex problem though, so I'm not expecting anyone to solve it as a whole. Any suggestions are much appreciated.
> 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 think there could be a growth in non-Turing complete-but-provable languages. For quite some time, SQL was in this category (it isn't any more), but this didn't really diminish its utility. There is certainly a place for such systems, I think.
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 either succeeds or your variable is initialized to null and you deal with that accordingly.
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.5 (build 3198) where I would have to manually update the major and minor versions, but the build number updates automatically. Even better, I don't want the build number to increment unless I am compiling in RELEASE mode. Anyone know if there is a way to do this -- and how?
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 below with most important at the top) or a [search engine][2] (don't think I need to say which US site you should compare that layout to). However, just as Arabic/Hebrew/etc right-to-left language users will expect left-to-right progression in some contexts (embedded English fragments and so on), there are situations, even on the web, where top-to-bottom layout is preferred. This is generally done by including an image with the text layout and font desired, or using flash. Internet Explorer has actually offered tb-rl layout with the CSS [writing-mode property][3] since version 5.5 however [none of the other browsers][4] have bothered implementing it (or ruby, which is useful for sites aimed at a young audience). IE 5.5 was released in 2000, so that's eight years of support, and there was a [W3C candidate recommendation][5] in 2003 but [text layout in CSS still being poked around][6]. As for your worries with text input and IMEs, as long as you're not doing something bogus like trying to manually translate the virtual keys given by keydown events into text strings, you're unlikely to run into problems. There are some additional issues you've not mentioned however. The minimum comfortably readable font size is larger than for languages written with the Latin script. Bold and italic for emphasis in flow are generally not appropriate. Han unification means to need to be picky about specifying the right fonts for the different CJK languages when working with unicode. You may want to provide both traditional and simplified interfaces for Chinese, depending on what audience you are expecting. I've been meaning to write up a more comprehensive guide along these lines for a while, if you need more information feel free to kick me. [1]: http://www.yomiuri.co.jp/ [2]: http://www.baidu.com/ [3]: http://msdn.microsoft.com/en-us/library/ms531187.aspx [4]: http://www.blooberry.com/indexdot/css/properties/intl/writingmode.htm [5]: http://www.w3.org/TR/2003/CR-css3-text-20030514/#Progression [6]: http://dev.w3.org/csswg/css3-text-layout/#writing-mode
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, that every class has. Erich Gamma mentions it in [this interview][2]. [1]: http://en.wikipedia.org/wiki/Gang_of_Four_(software) [2]: http://www.artima.com/lejava/articles/designprinciples2.html
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, that every class has. Erich Gamma mentions it in [this interview][2]. I think following all the rules and principles mechanically without thinking leads to a difficult to read, navigate, understand and maintain code-base. Remember: The simplest thing that could possibly work. [1]: http://en.wikipedia.org/wiki/Gang_of_Four_(software) [2]: http://www.artima.com/lejava/articles/designprinciples2.html
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 some languages, it is a better practice (C++) than in others (C).
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-Harvey-Paul-Deitel-Associates/dp/0136152503
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 they are more free-form text-based keys). In your tree view, you'll make the changes to your preferences model, it will then fire an event. In your other forms, you'll subscribe to the changes that you're interested in. In the event handler you use to subscribe to the property changes, you use this.InvokeRequired to see if you are on the right thread to make the UI call, if not, then use this.BeginInvoke to call the desired method to update the form.
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 (interface implementation vs. abstract class extension) to increase the flexibility of your design. In fact, you could argue that abstract classes give you slightly more, since they allow you to both require implementations to satisfy your code ("you MUST implement start()") and provide default implementations ("I have a standard paint() you can override if you want to") -- with interfaces, implementations must be provided, which over time can lead to brittle inheritance problems through interface changes. Fundamentally, though, I use interfaces mainly due to Java's single inheritance restriction. If my implementation MUST inherit from an abstract class to be used by calling code, that means I lose the flexibility to inherit from something else even though that may make more sense (e.g. for code reuse or object hierarchy).
@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. Database backups should include stored procedures. Those backup files might or might not be in your version control repository. But either way, you have backups of your stored procedures. [1]: http://www.15seconds.com/issue/050106.htm
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, faster and/or higher quality / fewer system dependencies... although i'm not aware of any implemented in managed code.
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 application context XML files. Anything that needs to go into the database has to be loaded using a script and I keep those scripts in version control.
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 reversed, where there is a population field, IE New Mexico, New York; or London, Londonderry. However I also always want the exact matching name to be at the top. So in the case of "London" the list should show "London UK, London CT, Londonderry" even if Londonderry has a higher population than London CT. Does anyone have a single searcher solution?
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 reversed, where there is a population field, IE New Mexico, New York; or London, Londonderry. However I also always want the exact matching name to be at the top. So in the case of "London" the list should show "London, London, Londonderry" where the first London is in the UK and the second London is in Connecticut, even if Londonderry has a higher population than London CT. Does anyone have a single query solution?
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 something similar. Is there a way to route all requests (similar to the way WordPress does it) to one page where central route processing is performed? I'm aware of the MVC framework for ASP.NET, but I'd like to take a stab at this myself as I'm tinkering around and learning. EDIT: BTW, my hosting provider runs IIS 6
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 declaration, the lack of true keywords. I don't know about the "performance enhancing improvements". I'd guess most of them are probably ineffective, as a couple of decades of compiler technology have made most hinting unnecessary. Unfortunately, you'll probably have to leave things the way they are, unless you're planning to do a massive rewrite. Anyway, the core scientific calculation code should be fairly readable. Any programming language using infix arithmetic would be good preparation for reading Fortran's arithmetic and assignment code.
@[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 wonder if the load event would fire too soon in that case. [1]: #30347
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/Comparison_of_Java_and_C%2B%2B#Templates_vs._Generics [3]: http://en.wikipedia.org/wiki/Generic_programming
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.sun.com/j2se/1.5.0/docs/guide/language/generics.html
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 (i.e. the host didn't respond at all), then report an error. To do this though, you'd need a pre-defined list of hosts to expect the responses back from.
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> <Style x:Key="{x:Type Label}" TargetType="Label"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Label"> <Border> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="False" /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Grid.Resources> <Label>_This is a test</Label> </Grid> </Page>
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").Value = Date End Sub You can reduce the problem of needing the user to accept macros each time by digitaly signing the template (in VBA IDE Tools | Digital Signature...) and select a digital certificate, however, you will need to get a certificate from a commercial certification authority (see http://msdn.microsoft.com/en-us/library/ms995347.aspx). The user will need to select to always trust this certificate the first time they run the template, but thereafter, they will not be prompted again.
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? I don't really feel like installing some extra shell to do this but if you have any other super simple suggestions that would accomplish just this, they're naturally appreciated aswell.
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/303/notmyself
|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 contents of the build, I only want to copy the DLL's and .aspx pages, I don't need the source code to get published. Does anyone know of a way to filter this, or do I need to setup a task to run a RoboCopy script instead?
|.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 project was dormant for awhile, but is recently back under development. I haven't updated my project to use the latest version, but you should check it out. It allows for using any True Type Font via the [FreeType][2] font library. [1]: http://sourceforge.net/projects/ftgl/ [2]: http://freetype.sourceforge.net/index2.html
@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 technically sound approaches (LSP being the obvious thing) make _hard to use_, but if we don't use such approaches it makes the code brittle and inextensible anyway (because we can no longer reason about it). And I think the counterintuitive results that OOP leads us to makes it unsurprising that people don't pick it up. More significantly, since software is already fundamentally too hard for normal humans to write reliably and accurately, should we really be extolling a technique that is consistently taught poorly and appears hard to learn? If the benefits were clear-cut then it might be worth persevering in spite of the difficulty, but that doesn't seem to be the case.
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. So I know I need to import the utils build file. <import file="../utils/build/build.xml" /> Which doesn't work because the import task, unlike almost every other ant taks, doesn't run from basedir, it runs from the pwd. So to get around that I have this little ditty, which does successfully import the build file <property name="baseDirUpOne" location=".." /> <import file="${baseDirUpOne}/utils/build/build.xml" /> So now that ive solved my import problem I need to call the task, well that should be easy right: <antcall target="utils.package" /> *note that in the above, utils is the project name of ../utils/build/build.xml* the problem I'm now running into is that ant call doesn't execute in ../utils/build so what I need, and cant find, is a runat property or something similar, essentially: <antcall target="utils.package" runat="../utils/build" /> The reason I need this is that in my utils build file the step to select which code to copy to the jar is based on relative paths so as to avoid hardcoding paths in my ant file. Any ideas?
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 implement bitmap indexing "manually", like digiguru suggests: It sounds like a complicated situation whenever new tags are added(?) But some DBMSes (including Oracle) offer bitmap indexes which may somehow be of use, because a built-in indexing system does away with the potential complexity of index maintenance; additionally, a DBMS offering bitmap indexes should be able to consider them in a proper when when performing the query plan. [1]: http://www.dbazine.com/ofinterest/oi-articles/celko1
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 command line programs while providing the same kind of guards against injection attacks as the IDbCommand objects do for databases. Right now, we're using a very primitive string substitution which I suspect is rather insufficient: > protected virtual string Escape(string value) > { > return value > .Replace(@"\", @"\\") > .Replace(@"$", @"\$") > .Replace(@"""", @"\""") > .Replace("`", "'") > ; > } What do you guys do to prevent command-line injection attacks? We're planning to implement a regex that is very strict and only allows a very small subset of characters through, but I was wondering if there was a better way.
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 command line programs while providing the same kind of guards against injection attacks as the IDbCommand objects do for databases. Right now, we're using a very primitive string substitution which I suspect is rather insufficient: > protected virtual string Escape(string value) > { > return value > .Replace(@"\", @"\\") > .Replace(@"$", @"\$") > .Replace(@"""", @"\""") > .Replace("`", "'") > ; > } What do you guys do to prevent command-line injection attacks? We're planning to implement a regex that is very strict and only allows a very small subset of characters through, but I was wondering if there was a better way. Some clarifications: * Some of these tools do not have APIs we can program against. If they did, we wouldn't be having this problem. * The users don't pick tools to execute, they enter meta-data which the tools we've chosen use (for example, injecting meta data such as copyright notices into target files).
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 that launched the parent application So now I just have to find out how to bring my dialog to the front. Thanks for the answers ;-)
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 could see where your going with it being difficult. The problem for me starting with Cocoa many years back is that it was so different from anything else that it had a little bit of a learning curve. Whereas many other systems are compile time oriented Cocoa is very dynamic and runtime oriented. Once you get past learning how actions hook up to classes it just becomes a matter of learning how the Cocoa frameworks work.
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 MSBuildCommunityTasks EMail task. Is there a way to force a TFS alert to be sent to a list of emails? Can you recommend of a way to send such status notifications?