instruction
stringlengths
0
30k
Take a look at [Ampache][1]. It is a Web-based Open Source Audio file manager. It is implemented with MySQL, and PHP. It allows you to view, edit, and play your audio files via the web. [1]: http://ampache.org/
If all you make is simple little web pages, then do whatever. Or better yet learn PHP.
If all you make is simple little web pages, then do whatever. Or better yet learn PHP. Most of the response you are going to get are from people who make web applications, and for that asp.net blows the pants off of classic asp in power and maintainability though.
Just looking for the first step basic solution here that keeps the honest people out. Thanks, Mike
Maybe the way to go is something like [Clutter][1] or [Allegro][2]. If you check in this [article][3] at ArsTechnica what they are using Clutter for, you might get an idea how to use it. I don't know for sure if it works on Windows, but I'm pretty sure it does, considering it only depends on libraries that are supported under Windows. [1]: http://clutter-project.org/ [2]: http://www.allegro.cc/ [3]: http://arstechnica.com/news.ars/post/20080604-hands-on-with-the-ubuntu-netbook-remix.html
You're already using [SqlBulkCopy](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx), which is a good start. However, just using the SqlBulkCopy class does not necessarily mean that SQL will perform a bulk copy. In particular, there are a few requirements that must be met for SQL Server to perform an efficient bulk insert. Further reading: * [Prerequisites for Minimal Logging in Bulk Import](http://msdn.microsoft.com/en-us/library/ms190422.aspx) * [Optimizing Bulk Import Performance](http://msdn.microsoft.com/en-us/library/ms190421.aspx) Out of curiosity, why is your index set up like that? It seems like ContainerId/BinId/Sequence is **much** better suited to be a nonclustered index. Is there a particular reason you wanted this index to be clustered?
You could try <a href="http://www.wxwidgets.org/">wxWidgets</a> (it has wxBitmapButton) or try to implement your own solution using <a href="http://www.libsdl.org/">SDL</a> for all of the graphics.
I think the real answer is, like all approaches in programming, is that it depends on which one is better. Generally, a set based language is going to be more efficient, because that is what it was designed to do. There are two places where a cursor is at an advantage: <br/>1. You are updating a large data set in a database where locking rows is not acceptable (during production hours maybe). A set based update has a possibility of locking a table for several seconds (or minutes), where a cursor (if written correctly) does not. The cursor can meander through the rows updating one at a time and you don't have to worry about affecting anything else. <br/>2. The advantage to using SQL is that the bulk of the work for optimization is handled by the database engine in most cicrumstances. With the enterprise class db engines the designers have gone to painstaking lengths to make sure the system is efficient at handling data. The drawback is that SQL is a set based language. You have to be able to define a set of data to use it. Although this sounds easy, in some circumstances it is not. A query can be so complex that the internal optimizers in the engine can't effectively create an execution path and guess what happens.......your super powerful box with 32 processors uses a single thread to execute the query because it doesn't know how to do anything else, so you waste processor time on the database server which generally there is only one of as opposed to multiple application servers (so back to reason 1, you run into resource contentions with other things needing to run on the database server). With a row based language (C#, PHP, JAVA etc.), You have more control as to what happens. You can retrieve a data set and force it to execute the way you want it to. (Seperate the data set out to run on multiple threads etc). Most of the time, it still isn't going to be efficient as running it on the database engine, because it will still have to access the engine to update the row, but when you have to do 1000+ calculations to update a row (and lets say you have a million rows), a database server can start to have problems.
And bear in mind that all this stuff about the *projects* being compatible between 2005 and 2008 is NOT true for C/C++ projects.
The best practice, as others have said, is to place each class in its own translation unit from a code maintenance and understandability perspective. However on large scale systems this is sometimes not advisable - see the section entitled "Make Those Source Files Bigger" in [this article][1] by Bruce Dawson for a discussion of the tradeoffs. [1]: http://www.cygnus-software.com/papers/precompiledheaders.html
experience with java clustering ?
|terracotta|jgroups|java|clustering|
Would like to hear from people about their experience with java clustering (ie. implementing HA solutions). aka . terracotta, jgroups etc. It doesn't have to be web apps. Experience writing custom stand alone servers would be great also.
Would like to hear from people about their experience with java clustering (ie. implementing HA solutions). aka . terracotta, jgroups etc. It doesn't have to be web apps. Experience writing custom stand alone servers would be great also. UPDATE - I will be a bit more specific -> not that interested in Web App clustering (unless it can be pulled out and run standalone). I know it works. But we need a bit more than just session clustering. Examining solutions in terms of ease of programing, supported topologies (ie. single data center versus over the WAN ), number of supported nodes. Issues faced, work arounds. At the moment I am doing some POC (Proof of concept) work on Terracotta and JGroups to see if its worth the effort for out app (which is stand alone, outside of a web container).
|java|clustering|terracotta|jgroups|
Would like to hear from people about their experience with java clustering (ie. implementing HA solutions). aka . terracotta, jgroups etc. It doesn't have to be web apps. Experience writing custom stand alone servers would be great also. UPDATE - I will be a bit more specific -> not that interested in Web App clustering (unless it can be pulled out and run standalone). I know it works. But we need a bit more than just session clustering. Examining solutions in terms of ease of programing, supported topologies (ie. single data center versus over the WAN ), number of supported nodes. Issues faced, work arounds. At the moment I am doing some POC (Proof of concept) work on Terracotta and JGroups to see if its worth the effort for our app (which is stand alone, outside of a web container).
I've heard of [AutoDisconnect][1] causing similar issues (even if the device isn't idle). You may want to try disabling that on the server. [1]: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q138365
A reinstall of Ruby sorted this issue out. It's not what I wanted; I wanted to know why I was getting the issue, but it's all sorted out.
@Dominic, I'm almost positive that putting that in the route will cause routing issues. @Ricky, Until MVC has support for this, you can be a little more "old school" about how you make your routes. For example, you can convert: <%= Html.ActionLink("Home", "Index") %> into: <a href='<%= Url.Action("Index") %>#2345'>Home</a> Or you can write your own helper that does essentially the same thing.
I have a two dimensional array that I need to load data into. I know the width of the data (22 values) but I do not know the height (estimated around 4000 records, but variable). I have it declared as follows: float[,] _calibrationSet; .... int calibrationRow = 0; While (recordsToRead) { for (int i = 0; i < SensorCount; i++) { _calibrationSet[calibrationRow, i] = calibrationArrayView.ReadFloat(); } calibrationRow++; } This causes a NullReferenceException, so when I try to initialize it like this: _calibrationSet = new float[,]; I get an "Array creation must have array size or array initializer." Thank you, Keith
Depending on your application you could use the [Diffie-Hellman][1] method for two parties to securely agree on a symmetric key. After an initial, secure exchange, the key is agreed upon and the rest of the session (or a new session) can use this new symmetric key. [1]: http://en.wikipedia.org/wiki/Diffie-Hellman
If you are using a http endpoint, you can use a secure transport such as https.
As was previously answered, you can cast back and forth between signed and unsigned without a problem. The border case for signed integers is -1 (0xFFFFFFFF). Try adding and subtracting from that and you'll find that you can cast back and have it be correct. However, if you are going to be casting back and forth, I would strongly advise naming your variables such that it is clear what type they are, eg: int iValue, iResult; unsigned int uValue, uResult; It is far too easy to get distracted by more important issues and forget which variable is what type if they are named without a hint. You don't want to cast to an unsigned and then use that as an array index.
The most useful tool I've found for monitoring a server while performing a test such as JMeter on it is [dstat][1]. It not only gives you a range of stats from the server, it outputs to csv for easy import into a spreadsheet and lets you extend the tool with modules written in Python. [1]: http://dag.wieers.com/home-made/dstat/.
Finally blocks permit you, as a developer, to tidy up after yourself, regardless of the actions of preceeding code in the try{} block encountered errors, and have others have pointed out this, is falls mainly under the umbrella of freeing resources - closing pointers / sockets / result sets, returning connections to a pool etc. @mats is very correct that there is always the potential for "hard" failures - finally blocks shouldn't include mission critical code, which should always be done transactionally inside the try{} @mats again - The real beauty is that it allows you throw exceptions back out of your own methods, and still guarantee that you tidy up: try { StreamReader stream = new StreamReader("foo.bar"); mySendSomethingToStream(stream); } catch(noSomethingToSendException e) { //Swallow this logger.error(e.getMessage()); } catch(anotherTypeOfException e) { //More serious, throw this one back throw(e); } finally { stream.close(); } So, we can catch many types of exception, process them differently (the first allows execution for anything beyond the try{}, the second effectively returns), but always neatly and tidily clear up.
@yapiskan, C# is a strong typed language Foo< X> != Foo. So if you need to catch some exception, provide *exact* type in *catch* clause. You can learn more on exception handling reading [this][1] MSDN article. [1]: http://msdn.microsoft.com/en-us/library/ms229005.aspx
I like [this explanation][1]. Basically, you should use tuples when there's a constant structure (the 1st position always holds one type of value and the second another, and so forth), and lists should be used for lists of homogeneous values. Of course there's always exceptions, but this is a good general guideline. [1]: http://jtauber.com/blog/2006/04/15/python_tuples_are_not_just_constant_lists/
Hitchhiker, If you're willing to spend some money, TOAD has "compare schemas" functionality which should do what you're after. It'll report the differences and produce a migration script to bring one into line with the other. I've never used the script, so I can't vouch for it, but I have used it to make sure our build scripts are complete.
This is a quick and dirty method that may be useful: select * from mytbl where "," + ltrim(rtrim(@keylist)) + "," like "%," + ltrim(rtrim(name)) + ",%"
What are the best resources to get started with Eclipse plugin development?
|eclipse|books|tutorials|plugin-development|sites|
I'm interested in writing eclipse plugins where do I start? What resources have helped you? I'm looking for: 1. Tutorials 2. Sites devoted to plugin development 3. Books
What's the best tool to graphically display memory layout from a .map file?
|c++|c|embedded|linker|
My build (gcc) toolchain produces a .map file. Is there a tool to analyze the memory map graphically?
What is a good online resource for css 'design patterns'?
|html|css|xhtml|
Can anyone out there recommend a good online resource for CSS 'design patterns'? I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, clean solutions to common problems / tasks. An example of such a resource would be [this list of table designs][1], this gives you all you really need to know about how to make tables look nice using a set of CSS techniques. Other examples of common problems which could have nice set solutions would be things like rounded corners on divs, highly usable form layouts etc. [1]: http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/
|html|css|design-patterns|xhtml|
The mount point is usually "\Storage Card" but can be localized into other languages or modified by OEMs (some devices use "\SD Card" or other mount points, and some devices support mounting multiple storage media). The best way to enumerate the available cards is to use FindFirstFlashCard and FindNextFlashCard. Both functions fill in a WIN32_FIND_DATA structure. The most important field is cFileName, which will contain the path to the card's mount point (e.g. "\Storage Card"). Note that the device's internal memory will also be enumerated by these functions. If you only care about external volumes, ignore the case where cFileName is an empty string (""). Using these functions require you to #include &lt;projects.h&gt; and link with note_prj.lib. Both are included in the Windows Mobile SDKs for WM 2000 and later.
How do I group in memory lists?
|c#|.net|linq|lambda|
I have a list of Foo. Foo has properties Bar and Lum. Some Foos have identical values for Bar. How can I use lambda/linq to group my Foos by Bar so I can iterate over each grouping's Lums?
File format for generating dynamic reports in applications
|pdf|reporting|adobe|
We generate dynamic reports in all of our business web applications written for .Net and J2EE. On the server side we use ActiveReports.Net and JasperReports to generate the reports. We then export them to PDF to send down to the browser. Our clients all use Adobe Reader. We have endless problems with the different versions of Adobe Reader and how they are setup on the client. What file format/readers are others using for their dynamic reports? We need something that allows for precise layout as many of the reports are forms that are printed with data from out systems. HTML is not expressive enough.
add with (rowlock) to your SQL query [SQL Server Performance article][1] [1]: http://www.sql-server-performance.com/articles/per/lock_contention_nolock_rowlock_p1.aspx
add with (rowlock) to your SQL query [SQL Server Performance article][1] **EDIT:** ok, I misunderstood the question. What you want is transaction isolation. +1 to Joel :) [1]: http://www.sql-server-performance.com/articles/per/lock_contention_nolock_rowlock_p1.aspx
Without the PDB symbols for that application you're going to have a tough time making heads or tails of what is going on and where. I think any source code information is going to be only in that PDB file that was created when whoever built that application. This is assuming that the PDB file was EVER created for this application - which is not the default configuration for release mode VC++ projects I think. Since you're asserting, I guessing this is a debug configuration?
What is the best approach to moving a preexisting project from Flash 7/AS2 to Flex/AS3?
|apache-flex|flash|actionscript-3|porting|
I have a large codebase that targetted Flash 7, with a *lot* of AS2 classes. I'm hoping that I'll be able to use Flex for any new projects, but a lot of new stuff in our roadmap is additions to the old code. The syntax for AS2 and AS3 is generally the same, so I'm starting to wonder how hard it would be to port the current codebase to Flex/AS3. I know all the UI-related stuff would be iffy (currently the UI is generated at runtime with a lot of createEmptyMovieClip() and attachMovie() stuff), but the UI and controller/model stuff is mostly separated. Has anyone tried porting a large codebase of AS2 code to AS3? How difficult is it? What kinds of pitfalls did you run into? Any recommendations for approaches to doing this kind of project?
For all submit buttons, via JQuery, it'd be: $('input[type=submit]').click(function() { this.disabled = true; }); Or it might be more useful to do so on form submission: $('form').submit(function() { $('input[type=submit]', this).attr("disabled","disabled"); }); But I think we could give a better answer to your question if we knew a bit more about the context. If this is an ajax request, then you'll need to make sure you enable submit buttons again on either success or failure. If this is a standard HTTP form submission (aside from disabling the button with javascript) and you're doing this to safe guard from multiple submissions of the same form, then you ought to have some sort of control in the code that deals with the submitted data, because disabling a button with javascript might not prevent multiple submissions.
I don't, but there's a Java port called [jchronic][1]. If nothing else, it could provide a good jumping-off point for your own. Or perhaps some knowledgeable person out there could help with a semi-automatic Java to C# translator. [1]: https://jchronic.dev.java.net/
I don't, but there's a Java port called [jchronic][1]. If nothing else, it could provide a good jumping-off point for your own. Or perhaps you could use a semi-automatic Java to C# translator like [Octopus][2] to help translate it. (Or something better, if anyone knows of anything.) [1]: https://jchronic.dev.java.net/ [2]: http://www.remotesoft.com/octopus/try.html
I don't, but there's a Java port called [jchronic][1]. If nothing else, it could provide a good jumping-off point for your own. Or perhaps you could use a semi-automatic Java to C# translator like [Octopus][2] to help translate it. (Or something better, if anyone knows of anything.) Okay, another possible avenue: could you use the chronic code using [IronRuby][3]? [1]: https://jchronic.dev.java.net/ [2]: http://www.remotesoft.com/octopus/try.html [3]: http://www.ironruby.net/
I pretty much always use a power of 2 unless there is a good reason not to, such as a customer facing interface where some other number has special meaning to the customer. If you stick to powers of 2 it keeps you within a limited set of common sizes, which itself is a good thing, and it makes it easier to guess the size of unknown objects you may encounter. I see a fair number of other people doing this, and there is something aesthetically pleasing about it. It generally gives me a good feeling when I see this, it means the designer was thinking like an engineer or mathemetician. Though I'd probably be concerned if only prime numbers were used.
I pretty much always use a power of 2 unless there is a good reason not to, such as a customer facing interface where some other number has special meaning to the customer. If you stick to powers of 2 it keeps you within a limited set of common sizes, which itself is a good thing, and it makes it easier to guess the size of unknown objects you may encounter. I see a fair number of other people doing this, and there is something aesthetically pleasing about it. It generally gives me a good feeling when I see this, it means the designer was thinking like an engineer or mathemetician. Though I'd probably be concerned if only prime numbers were used. :)
I don't understand what you are trying to do here. Are you trying to execute a Python script that generates a C# file and then compile that with the project? Or are you trying to compile a Python script to C#?
I have created a SQL Server User Defined Function to calculate someone's age, given their birthdate. This is useful when you need it as part of a query: using System; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; public partial class UserDefinedFunctions { [SqlFunction(DataAccess = DataAccessKind.Read)] public static SqlInt32 CalculateAge(string strBirthDate) { DateTime dtBirthDate = new DateTime(); dtBirthDate = Convert.ToDateTime(strBirthDate); DateTime dtToday = DateTime.Now; // get the difference in years int years = dtToday.Year - dtBirthDate.Year; // subtract another year if we're before the // birth day in the current year if (dtToday.Month < dtBirthDate.Month || (dtToday.Month == dtBirthDate.Month && dtToday.Day < dtBirthDate.Day)) years--; int intCustomerAge = years; return intCustomerAge; } };
Use traditional encryption of the data that you are placing inside the WCF container. Maybe something like the following: [http://www.obviex.com/samples/EncryptionWithSalt.aspx][1] [1]: http://www.obviex.com/samples/EncryptionWithSalt.aspx
There are several things that make a finally block useful: 1. If you return from the try or catch blocks, the finally block is still executed, right before control is given back to the calling function 2. If an exception occurs within the catch block, or an uncaught type of exception occurs in the try block, the code in the finally block is still executed. These make finally blocks excellent for closing file handles or sockets.
Multiline ddl Custom Control
|c#|asp.net|custom-controls|
One of the guys I work with needs a custom control that would work like a multiline ddl since such a thing does not exist as far as we have been able to discover does anyone have any ideas or have created such a thing before we have a couple ideas but they involve to much database usage
One of the guys I work with needs a custom control that would work like a multiline ddl since such a thing does not exist as far as we have been able to discover does anyone have any ideas or have created such a thing before we have a couple ideas but they involve to much database usage We prefer that it be FREE!!!
If you are catpuring logging information for future searching and anaylsis perhaps a database would be a better answer. As for your solution. Flat files do not scale well at all where as a database scale much better. I wouldn't split the files either, that just compounds the scalability issue. If you have to use a flat file I would probably try keeping the meta data in a csv (less over head) and the data in a series of files indexed by the csv file. That way all the data doesn't impact your index file. Just my thoughts.
I highly recommend [Test-Driven Development by Kent Beck (ISBN-10: 0321146530)][1]. It wasn't written specifically for PHP, but the concepts are there and should be easily translatable to PHP. [1]: http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530
G'day, Definitely do the logging in flat file and add munge scripts to turn it into XMl later. First suggestion would be to make sure that all date/time strings are in ISO 8601 format, namely YYYY-MM-DD hh:mm:ss. Second is to make your categories, e.g. exception, fatal, error, warning, info, etc. really stand out in your logs. Then aybe look at some of the vim syntax files and create a new syntax for your log format so that important log entries really stand out. It's not really that hard to take one of the standard syntax files and modify it to handle your log strings. HTH. cheers, Rob
It might not be the most fully-featured, but [FLTK][1] is an incredibly simple cross-platform GUI library. [1]: http://www.fltk.org
It might lack some features, but [FLTK][1] is an incredibly simple cross-platform GUI library. [1]: http://www.fltk.org
Assuming you don't have any heuristics, a variation of [dijkstra's algorithm][1] should suffice pretty well. Every time you consider a new edge, store information about its "ancestors". Then, check for the invariant (only one direction change), and backtrack if it is violated. I'll post some pseudocode later. [1]: http://en.wikipedia.org/wiki/Dijkstra's_algorithm
Assuming you don't have any heuristics, a variation of [dijkstra's algorithm][1] should suffice pretty well. Every time you consider a new edge, store information about its "ancestors". Then, check for the invariant (only one direction change), and backtrack if it is violated. The ancestors here are all the edges that were traversed to get to the current node, along the shortest path. One good way to store the ancestor information would be as a pair of numbers. If U is up, and D is down, a particular edge's ancestors could be `UUUDDDD`, which would be the pair `3, 4`. You will not need a third number, because of the invariant. Since we have used dijkstra's algorithm, finding multiple shortest paths is already taken care of. [1]: http://en.wikipedia.org/wiki/Dijkstra's_algorithm
I'll advocate the use of source control here. Especially if the development team uses branching to deal with structured releases. That way, whatever CSS is checked into the production branch is what should be deployed ... and if it is updated mid-stream, it's the responsibility of the person (designer?) that updates it to promote that code using whatever system your company uses to promote changes to production.
The fancy name is "Content Delivery Network" [(Wikipedia)](http://en.wikipedia.org/wiki/Content_Delivery_Network). We store our CSS files in a database, and then have a separate website that does nothing but serve CSS resources. We implemented this in May 2007 for 1000+ websites in 30+ countries. It has worked flawlessly for the last 15 months. Static images and even JavaScript files are handled the same way.
Do this: list.ForEach(i => Console.Write("{0}\t", i)); ---------- EDIT: To others that have responded - he wants them all on the same line, with tabs between them. :)
List<int> a = new List<int>() { 1, 2, 3, 4, 5 }; a.ForEach(p => Console.WriteLine(p)); edit: ahhh he beat me to it.
list.ForEach(x=>Console.WriteLine(x));
I can't offer an existing tool for it, but I would expect that you can get a lot of this information from you build tools (with some effort, probably). Typically you can at least let the build tool print the commands it would run, without actually running them. (E.g. the `-n` option of `make` and `bjam` does this.) From it you should be able to extract at least the used source files. With the `-MM` of `g++` you can get all the non-system header files for the given source files. The output is in the form of a `make` rule, but with some filtering this shouldn't be a problem. I don't know if this helps; it's just what I would try in your situation.
Detecting if an IDataReader contains a certain field before iteration.
<http://regexlib.com/REDetails.aspx?regexp_id=610> > ^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$ > ---------- > This RE validates both dates and/or > times patterns. Days in Feb. are also > validated for Leap years. Dates: in > dd/mm/yyyy or d/m/yy format between > 1/1/1600 - 31/12/9999. Leading zeroes > are optional. Date separators can be > either matching dashes(-), slashes(/) > or periods(.) Times: in the hh:MM:ss > AM/PM 12 hour format (12:00 AM - > 11:59:59 PM) or hh:MM:ss military time > format (00:00:00 - 23:59:59). The 12 > hour time format: 1) may have a > leading zero for the hour. 2) Minutes > and seconds are optional for the 12 > hour format 3) AM or PM is required > and case sensitive. Military time 1) > must have a leading zero for all hours > less than 10. 2) Minutes are > manditory. 3) seconds are optional. > Datetimes: combination of the above > formats. A date first then a time > separated by a space. ex) dd/mm/yyyy > hh:MM:ss ---------- **Edit**: Make sure you copy the RegEx from the regexlib.com website as StackOverflow sometimes removes/destroys special chars.
[According to Microsoft][1], other websites do not inherit settings from the Default Website. Do you mean you are editing the default web.config which is located in the same folder as the machine.config? [1]: http://msdn.microsoft.com/en-us/library/ms178685.aspx
@Espo: I just have to say that regex is incredible. I'd hate to have to write the code that did something useful with the matches, such as if you wanted to actually find out what date and time the user typed. It seems like Tom's solution would be more tenable, as it is about a zillion times simpler and with the addition of some parentheses you can easily get at the values the user typed: (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) If you're using perl, then you can get the values out with something like this: $year = $1; $month = $2; $day = $3; $hour = $4; $minute = $5; $second = $6; Other languages will have a similar capability. Note that you will need to make some minor mods to the regex if you want to accept values such as single-digit months.
HTML time-savers are useful, but they're only useful when they're intuitive and easy-to-understand. Having to instantiate a `new Draw` just doesn't sound very natural. Furthermore, `wideHeaderBox` and `left` will only have significance to someone who intimately knows the system. And what if there *is* a redesign, like your co-worker muses? What if the `wideHeaderBox` becomes very narrow? Will you change the markup (and styles, presumable) generated by the PHP method but leave a very inaccurate method name to call the code? If you guys just *have* to use HTML generation, you should use it interspersed in view files, and you should use it where it's really necessary/useful, such as something like this: HTML::link("Wikipedia", "http://en.wikipedia.org"); HTML::bulleted_list(array( HTML::list_item("Dogs"), HTML::list_item("Cats"), HTML::list_item("Armadillos") )); In the above example, the method names actually make sense to people who aren't familiar with your system. They'll also make more sense to you guys when you go back into a seldom-visited file and wonder what the heck you were doing.
There are a lot of benefits: - You get immediate feedback on if your code is working, so you can find bugs faster - By seeing the test go from red to green, you know that you have both a working regression test, and working code - You gain confidence to refactor existing code, which means you can clean up code without worrying what it might break - At the end you have a suite of regression tests that can be run during automated builds to give you greater confidence that your codebase is solid The best way to start is to just start. There is a great [book by Kent Beck][1] all about Test Driven Development. Just start with new code, don't worry about old code... whenever you feel you need to refactor some code, write a test for the existing functionality, then refactor it and make sure the tests stay green. Also, read [this great article][2]. [1]: http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1?ie=UTF8&s=books&qid=1218076464&sr=8-1 [2]: http://devver.net/blog/2008/07/tips-for-unit-testing/
**Benefits** 1. You figure out how to compartmentalize your code 2. You figure out exactly what you want your code to do 3. You know how it supposed to act and, down the road, if refactoring breaks anything 4. Gets you in the habit of making sure your code always knows what it is supposed to do **Getting Started** Just do it. Write a test case for what you want to do, and then write code that should pass the test. If you pass your test, great, you can move on to writing cases where your code will always fail (2+2 should not equal 5, for example). Once all of your tests pass, write your actual business logic to do whatever you want to do. If you are starting from scratch make sure you find a good testing suite that is easy to use. I like PHP so PHPUnit or SimpleTest work well. Almost all of the popular languages have some xUnit testing suite available to help build and automate testing.
try the following var names = (from dr in dataTable.Rows select (string)dr["Name"]).Distinct().OrderBy(name => name); this should work for what you need
What is Object Mocking and when do I need it?
|testing|mocking|
Many people use Mock Objects when they are writing unit tests. What is a **Mock Object**? Why would I ever need one? Do I need a Mock Object Framework?
I agree with the second part of Patrick's answer. Even if in some tests it seems to keep insertion order, the documentation (and normal behavior for dictionaries and hashes) explicitly states the ordering is unspecified. You're just asking for trouble depending on the ordering of the keys. Add your own bookkeeping (as Patrick said, just a single variable for the last added key) to be sure. Also, don't be tempted by all the methods such as Last and Max on the dictionary as those are probably in relation to the key comparator (I'm not sure about that).
It allows you to test how one part of your project interacts with the rest, without building the entire thing and potentially missing a vital part. EDIT: Great example from wikipedia: It allows you to test out code beforehand, like a car designer uses a crash test dummy to test the behavior of a car during an accident.
As Ubiguchi points out TFS is not a version control product. Buying TFS with the intention of only using it for Version Control would clearly be a waste of money. TFS is an integrated suite of tools to automate all aspects of Application Lifecycle Management (and pretty much geared to "The Enterprise". Also per Ben S's post - I don't understand your comment about locks. Locks aren't required in TFS at all. Administrators can configure TFS to work like VSS (features demanded by some "unwise" customers) to "Get-Latest on Checkout" which I believe also does a check-out lock. But through "normal" use of TFS a "check-out" prompts a user for the lock type - and the default should be "none". A user CAN select a check-out (or a check-in lock) - but it is not required. If you don't want locks, don't use them. TFS does track which users have check-outs on the server for various both performance reasons (make get-latest faster) and project management (I like to see what developers have files checked out and how long their check-outs are). I'm not real familiar with SVN (I've never used it) - so I can't comment that "mergeing is worse with TFS" - and haven't hit the merge bug Ben S reported - but I've had great success with branching and merging using TFS. One use case I know TFS is still pretty weak at is for users who are regularly "offline". TFS is a "Server Product" that assumes the users are connected the majority of the time. The offline experience improved in the 2008 release (it was dismal in 2005) but still has a long way to go. If you have developers who need (or want) to often be disconnected from the network for long periods of time - you are likely better off with SVN. Another feature to consider for SVN fans who are using TFS is the [SVN Bridge][1] a codeplex which allows users to use TortiseSVN to connect to TFS. I good friend and colleague of mine uses it extensively and loves it. Also the comment about a lack of command line surprises me - the command line tools are extensive (although many require a seperate download of [TFS Power Tools][2] I suspect Ben's comments are based on an eval of the 2005 release which was clearly a "Microsoft V1.0" product. The product is currently in 2.1 with Version 3 coming in the near future. [1]: http://www.codeplex.com/SvnBridge [2]: http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx
Here's all the books available for developing Eclipse Plugins: [http://www.eclipseplugincentral.com/books-index-req-view_subcat-sid-4.html][1] [1]: http://www.eclipseplugincentral.com/books-index-req-view_subcat-sid-4.html
I have done quite a bit with an RCP application that made use of multiple plug-ins. This book helped me tremendously in all fronts: RCP framework and plug-in development: http://www.amazon.com/Eclipse-Rich-Client-Platform-Applications/dp/0321334612 The book walks you through the development of a IM chat client using RCP and plug-in development. Also the eclipse site and IBM have some pretty good tutorials, here is one: http://www.ibm.com/developerworks/library/os-ecplug/
The real problem with subforums comes when you guess wrong about which topics have enough interest to get their own subforums. While some topics end up with their own vibrant subcommunities others end up as empty ghettos, with little activity or feeling of community. Topics that might flourish as occasional subjects in a larger forum end up fragmented among many subforums, none of which has the critical mass of people necessary to have an active, vibrant community.
Select existing data from database to create test data
|sql-server|database|
I have a SqlServer database that I've manually filled with some test data. Now I'd like to extract this test data as insert statements and check it in to source control. The idea is that other team members should be able to create the same database, run the created insert scripts and have the same data to test and develop on. Is there a good tool out there to do this? I'm **not** looking for a tool to generate data as discussed [here][1]. [1]: http://stackoverflow.com/questions/16317/creating-test-data-in-a-database
EMS DB Extract for SQL Server ([http://www.sqlmanager.net/en/products/mssql/extract][1]) seems to do what you want, and it seems to be free. Hope this helps, Robin [1]: http://www.sqlmanager.net/en/products/mssql/extract