instruction
stringlengths
0
30k
That's a great question but may lead to quite a bit of discussion as the answers could be very varied. It depends on - how much effort are you willing to put into this? - could some answers genuinely differ by +/-20% or whatever test you invent? so will there always be need for some human intervention? - and ...
Yes, that works fine. If you install the Team Foundation Client from the TFS 2008 DVD on your VS machine, you can connect to both TFS 2005 and TFS 2008 servers. If you don't have access to a TFS 2008 DVD (note that the trial should be fine), installing the 2005 client on VS 2008 should also work, but I've never persona...
From http://blog.blogupp.com/2008/06/get-openid-fied-and-discover-new-web.html <link rel="openid.server" href="http://technorati.com/openid/"
Is WebRequest The Right C# Tool For Interacting With Websites?
|c#|
I'm writing a small tool in C# which will need to send and receive data to/from a website using POST and json formatting. I've never done anything like this before in C# (or any language really) so I'm struggling to find some useful information to get me started. I've found some information on the WebRequest class ...
Microsoft leave it to 3rd parties to fill in the gaps regarding missing controls in the toolbox. I imagine time and cost would feature in their rationale. In this case, however, I think that the [FilteredTextBox][1] provides the functionality you describe. [1]: http://www.asp.net/ajax/ajaxcontroltoolkit/Sampl...
Instead of calling containsKey() it is faster just to call map.get and check if the returned value is null or not. Integer count = map.get(word); if(count == null){ count = 0; } map.put(word, count + 1);
Generic Method Type Safety
|java|generics|
I have the concept of `NodeType`s and `Node`s. A `NodeType` is a bunch of meta-data which you can create `Node` instances from (a lot like the whole Class / Object relationship). I have various NodeType implementations and various Node implementations. In my AbstractNodeType (top level for NodeTypes) I have ab a...
PhpEdit has a built in debugger, but I usually end up using echo(); and print_r(); the old fashioned way!!
@nickf (wish I had the rep to just comment, but I've only just found this site) My point is that there is confusion here between named/anonymous functions and the use case of executing + compiling in an iteration. As I illustrated, the difference between anon+named is negligible in itself - I'm saying it's the us...
The Java language always promotes arguments of arithmetic operators to int, long, float or double. So take the expression: a + b where a and b are of type byte. This is shorthand for: (int)a + (int)b This expression is of type int. It clearly makes sense to give an error when assigning an int value ...
Depending on your needs, you can just have an options table that has a list identifier and a list value as the primary key. select optionDesc from Options where 'MyList' = optionList You can then extend it with an order column, etc. If you have an ID field, that is how you can reference your answers back... o...
I've seen different "Regional and Language Options" on XP cause this sort of behavior. Do these match on both machines? Start | Settings | Control Panel | Regional and Language Options...
If you don't mind using strings for the actual values, you can simply give each list a different list_id in value and populate a single table with : item_id: int list_id: int text: varchar(50) Seems easiest unless you need multiple things per list item
We actually created entities to handle **simple** pick lists. We created a Lookup table, that holds all the available pick lists, and a LookupValue table that contains all the name/value records for the Lookup. Works great for us when we need it to be **simple**.
I've done this in two different ways: 1) unique tables per list 2) a master table for the list, with views to give specific ones I tend to prefer the initial option as it makes updating lists easier (at least in my opinion).
If that's the stacktrace, its comingn from databinding, not from the line you posted. Is it possible that you have some really large data set? I've seen a 6000-page GridView overflow an Int16, although it seems pretty unlikely you'd actually overflow an Int32... Check to make sure you're passing in sane data into, s...
We have followed the pattern of a new table for each pick list. For example: Table FRUIT has columns ID, NAME, and DESCRIPTION. Values might include: 15000, Apple, Red fruit 15001, Banana, yellow and yummy ... If you have a need to reference FRUIT in another table, you would call the column FRUIT_I...
Try turning the question around. Why do you need to pull it from the database? Isn't the data part of your model but you really want to persist it in the database? You could use an OR mapper like linq2sql or nhibernate (assuming you're in the .net world) or depending on the data you could store it manually in a table e...
Why are you using a build server anyways, for C# code, if I may ask? The build times for C# when I was using it were hardly noticable (<2s). Is the app really that big?
I have a couple questions - do both machines have identical regional settings and where are your error logs? I would hope ;-) you have exceptions being handled and written to disk, event logs .. something to help with problems like this. Where does the date come from that is being parsed? If it is in your db maybe y...
In addition to the suggestions already mentioned, close any projects that you have open that you are not using. Rich click on the Project in the Navigator view and select "Close Unrelated Projects". Depending on how many projects you have open, this can lead to a significant improvements in compile time, as well ...
[Disclaimer: I am still trying to fully grok monads. The following is just what I have understood so far. If it’s wrong, hopefully someone knowledgeable will call me on the carpet.] Arnar [wrote](#71697): > Monads are simply a way to wrapping things and provide methods to do operations on the wrapped stuff withou...
Another way is to use aspirin (http://aspirin.dev.java.net/) like this: MailQue.queMail(MimeMessage message) ..after having constructed your mimemessage as above. Aspirin **is** an smtp 'server' so you don't have to configure it. But note that sending email to a broad set of recipients isnt as simple as it...
It appears that your usage of has_one :through is correct. The problem you're seeing has to do with saving objects. For an association to work, the object that is being referenced needs to have an id to populate the `model_id` field for the object. In this case, `PackReleaseItems` have a `pack_id` and a `release_ite...
Dynamic languages are a different way to think and sometimes the practices you learn from a dynamic or functional language can transfer to the more statically typed languages but if you never take the time to learn different languages, you'll never get the benefit of having a knew way to think when you are coding.
Yes, YUI Loader is reliable on all A-grade browsers. For a list of which browsers Yahoo! considers A-grade, check out the [Graded Browser Support Chart][1]. [1]: http://developer.yahoo.com/yui/articles/gbs/
Why do you do UpdateJobMaster on a new instance ? Shouldn't it be InsertOnSubmit ? JobMaster newJobToCreate = new JobMaster(); newJobToCreate.JobID = 9999 newJobToCreate.ProjectID = "New Project"; this.InsertOnSubmit(newJobToCreate); this.SubmitChanges();
I think the <code>-f</code> option to <code>curl</code> does what you want.
85% would be a good starting place for checkin criteria. I'd probably chose a variety of higher bars for shipping criteria - depending on the criticality of the subsystems/components being tested.
First use an analysis tool to try and determine your typically "light" traffic times. Depending on the site and your location in the world in comparison to most of your users, it could be 4am, it could be 1pm, who knows. Then, once you have a good timeframe nailed down, make sure to have your deployment process as au...
def unique(list): s = {} output = [] for x in list: count = 1 if(s.has_key(x)): count = s[x] + 1 s[x] = count for x in list: count = s[x] if(count > 0): s[x] = 0 output.append(x) return output ...
has_key in python is O(1). Insertion and retrieval from a hash is also O(1). Loops through n items twice, so O(n). def unique(list): s = {} output = [] for x in list: count = 1 if(s.has_key(x)): count = s[x] + 1 s[x] = count for x in list:...
|c#|.net|webrequest|
Checking if a directory contains files
|unix|bash|shell|
How do I check if a directory contains files? Something similar to this: if [ -e /some/dir/* ]; then echo "huzzah"; fi; but which works if the directory contains one or several files (the above one only works with exactly 0 or 1 files).
As others have said, I would expect a burndown to be up and down. Stuff happens! You should use the "up and down" bits as fodder for your retrospectives. Make sure everyone is clear on what "being done" means, and use that joint understanding to help drive your planning sessions. Often having a list of what const...
Tables are not *in general* easier or more maintanable than CSS, Howere there are a few *specific* layout-problems where tables are indeed the simplest and most flexible solution. In cases where CSS and presentational markup supports the same kind of design, CSS is clearly preferable. No-one in their right mind woul...
Tables are not *in general* easier or more maintanable than CSS, Howere there are a few *specific* layout-problems where tables are indeed the simplest and most flexible solution. CSS is clearly preferable in cases where presentational markup and CSS supports the same kind of design, No-one in their right mind would...
You could use [DATE_FORMAT][1] to extract the day and month parts of the birthday dates. EDIT: sorry i didn't see that he wasn't using MySQL. [1]: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
Me.ClientScript.IsStartupScriptRegistered("clientScript")
If I understand right, you're trying to pass a list as a SQL parameter. Some folks have attempted this before with limited success: [Passing Arrays to Stored Procedures][1] [Arrays and Lists in SQL 2005][2] [Passing Array of Values to SQL Server without String Manipulation][3] [Using MS SQL 2005's XML ca...
This error can occur in MSIE when a child window tries to communicate with a parent window which is no longer open. (Not exactly the most helpful error message text in the world.)
Communication is key. In a relationship with a client, it must be clear to them that when a plan is created with a set of features, that is the set of features. It is only the fault of those interacting with the client who are either misleading the client or are somehow intimidated by the client. As for developers c...
I would concur on the [Trac](http://trac.edgewall.org) suggestion. I use it both for an open source project and for an internal project. It has decent issue tracking and integration with Subversion which allows links between tickets and subversion checkins. It also has an integrated wiki, which can be of some use fo...
I'm afraid it's the best solution that I can think of. But you can use reserve() to pre-allocate the minimum required memory in advance to speed up things a bit. You'll end up with a new string that will probably be shorter but that takes up the same amount of memory, but you'll avoid reallocations. EDIT: I'm an idi...
I'm afraid it's the best solution that I can think of. But you can use reserve() to pre-allocate the minimum required memory in advance to speed up things a bit. You'll end up with a new string that will probably be shorter but that takes up the same amount of memory, but you'll avoid reallocations. EDIT: Depending ...
If you want to pass the list as a string in a parameter, you could just build the query dynamically. DECLARE @query varchar(500) SET @query = 'SELECT blah blah WHERE blahblah in (' + @list + ')' EXECUTE(@query)
Sorry I don't know mysql, but with oracle I would always explicity state the format that I was expecting the format to be in, eg: 'DD-MM-YYYY', to avoid (regional) date format problems
Michael Abrash The Zen of Assembly Language
Have you tried [XML for SCRIPT][1]. I have to admit, that I have never used it personally, but I have heard/read a few good things about it. Give it a try and maybe share your experience here? [1]: http://xmljs.sourceforge.net/
I used to have the same problem, I think there is now way to do this directly over the ADO.NET API. You might consider inserting the words into a temptable (plus a queryid or something) and then refering to that temptable from the query. Or dynamically creating the query string and avoid sql injection by other measu...
What you are trying to do is possible but not using your current approach. This is a very common problem with all possible solutions prior to SQL Server 2008 having trade offs related to performance, security and memory usage. [This link shows some approaches for SQL Server 2000/2005][1] [SQL Server 2008 suppor...
If your XML is in a simple format you may look at [jQuery][1] and the [XML to JSON plugin][2] or the [xmlObjectifier][3]. For a straight parser you may want to look at [XML for &lt;SCRIPT&gt;][4]. [1]: http://jquery.com [2]: http://plugins.jquery.com/project/xml2json [3]: http://plugins.jquery.com/proje...
Here's my _programmer's answer_ from a [simliar thread][1] **semantics 101** First take a look at this code and think about what's wrong here... class car { int wheels = 4; string engine; } car mybike = new car(); mybike.wheels = 2; mybike.engine = null; The probl...
I've used raiseerror to return from the depths of multiple nested stored procedures, but the final layer of stored procedure always catches the exception prior to being raised to the calling language (in our case Java via JDBC). The stored procedure catch in the outer most layer is transformed into an XML message to b...
Well, F# is based on OCaml and OCaml has a rather [extensive macro system][1]. Given the syntactic and semantic similarities of F# and OCaml you may be able to port over the Ocaml macro system to F#. Other than sealing Ocaml's macro system I'm unaware of a canned macro system for F#. [1]: http://www.ocaml-tuto...
In Perl, you can use [MP3::Tag][1] or [MP3::Info][2] [1]: http://search.cpan.org/author/ILYAZ/MP3-Tag/Tag.pm [2]: http://search.cpan.org/author/DANIEL/MP3-Info-1.23/Info.pm
Yes, you can do it with a Macro assigned to a breakpoint. This works in VS 2005, I assume 2008 will work as well. I assume you don't want a sound on EVERY breakpoint, or the other answer will work fine. THere is probably a way to play that specific sound, but I didn't dig that hard. Here are the steps: **Add A N...
Yes, you can do it with a Macro assigned to a breakpoint. This works in VS 2005, I assume 2008 will work as well. I assume you don't want a sound on EVERY breakpoint, or the other answer will work fine. There is probably a way to play a specific sound, but I didn't dig that hard. Here are the basic steps: **Add ...
You may have to truncate the table and reset the ID field back to 0 if you need the inserted rows to have the same ID. If not, just truncate and it should be fine.
How to know whether given client side startup script is already registered or not in asp.net page?
|asp.net|startupscript|
I have a asp.net page, and would like to know whether "script1" is already registerd as startup script or not?
How to know whether a given client-side startup script is already registered in an asp.net page?
I have a asp.net page, and would like to know whether "script1" is already registered as a startup script or not?
I would use LDAP and the DirectorySearcher Class: http://msdn.microsoft.com/en-us/library/system.directoryservices.directorysearcher.aspx
I concur with imjorge's answer and add that there's a C/C++ version of the Axis2 framework (a more flexible, extensible Axis) that does SOAP via RPC and all sorts of stuff including a bunch of the WS-* specs. [http://ws.apache.org/axis2/c/][1] [1]: http://ws.apache.org/axis2/c/
Here is mine. Give it a try. public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // Using an incorrect SMTP server SmtpClient client = new SmtpClient(@"smtp.nowhere.private"); // Specify the ...
@neouser99: That's the right solution, however the part that is missed is that when overriding the equality operator (the operator ==) you should also override the Equals function and simply make the operator call the function. Not all .NET languages support operator overloading, hence the reason for overriding the Equ...
Change .xla File with MSBuild
|msbuild|excel|vba|build-automation|
I'm trying to create a build script for my current project, which includes an Excel Add-in. The Add-in contains a VBProject with a file modGlobal with a variable version_Number. This number needs to be changed for every build. The exact steps: 1. Open XLA document with Excel. 2. Switch to VBEditor mode. (Alt+F1...
|excel|vba|msbuild|build-automation|xla|
Beware the afore-mentioned slowquerylog in mysql. It should only be used when trying to figure out why some queries are slow. It has the side-effect of making ALL your queries slow while it's enabled. :P It's intended for debugging, not logging. Think 'passive monitoring' whenever possible. For instance, sniff the ...
Here are some ideas to get design more simpler: * read some programming books and articles, and then **apply** them in your work and write code * read lots of code (good and bad) written by other people (like Open Source projects) and learn to see what works and what does not * build safety nets (unit tests) to e...
Generating a PDF document based on a Microsoft Word Template
|c#|.net|asp.net|pdf|pdf-generation|
I need to take a Word document that is a template of sorts...collect user input to populate specific fields in that template..then generate a PDF file that includes the completed template as well as a few other document types. Does anyone have a good suggestion on a component to achieve this? Preferably one that does n...
The [CONVERT()][1] function can do this as well, depending on what style you use. [1]: http://msdn.microsoft.com/en-us/library/ms187928.aspx
It's always a good idea to look at the [Google Collections Library][1] for this kind of thing. In this case a [Multiset][2] will do the trick: Multiset bag = Multisets.newHashMultiset(); String word = "foo"; bag.add(word); bag.add(word); System.out.println(bag.count(word)); // Prints 2 The...
It's always a good idea to look at the [Google Collections Library][1] for this kind of thing. In this case a [Multiset][2] will do the trick: Multiset bag = Multisets.newHashMultiset(); String word = "foo"; bag.add(word); bag.add(word); System.out.println(bag.count(word)); // Prints 2 The...
Most common cause of "java.lang.NullPointerException" when dealing with XMLs?
|xml|dtd|dom|parsing|element|
My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions?
|java|xml|parsing|dom|dtd|
Visual Studio (VC++) users definitely need to exclude the **.ncb** files
go to TOOLS -> Change Delete Date , you can put any number of days to change the default delete date of selected email.
If you can catch it as soon as it's committed, the svnadmin dump/load technique isn't too painful. Suppose someone just accidentally committed gormundous-raw-image.psd in Revision 3849. You could do this: svnadmin dump /var/repos -r 1:3848 > ~/repos_dump That would create a dump file containing everything u...
Stored procedures a no-go in the php/mysql world?
|php|mysql|stored-procedures|
I'm quoting part of an answer which I received for another question of mine: > In the PHP/MySQL world I would say > stored procedures are no-go I would like to know: Is that so? Why? Why not?
I'm quoting part of an answer which I received for [another question of mine][1]: > In the PHP/MySQL world I would say > stored procedures are no-go I would like to know: Is that so? Why? Why not? [1]: http://stackoverflow.com/questions/83088/phpmysql-regular-recalcuation-of-benchmark-values-as-new-users-...
I'm quoting part of an answer which I received for [another question of mine][1]: > In the PHP/MySQL world I would say > stored procedures are no-go I would like to know: Is that so? Why? Why not? [edit]I mean this as a general question without a specific need in mind[/edit] [1]: http://stackoverflow.c...
The Postscript Type-1 specification was created from Adobe back in 1985 or so. Type-1 fonts are vector based. You can find the spec [here][1]. True Type fonts were defined by Apple a couple of years earlier so True Type and Postscript were competitors in the 90s. Microsoft picked up True Type for the native Windows ...
You could use the `DAYOFYEAR` function but be careful when you want to look for January birthdays in December. I think you'll be fine as long as the date range you're looking for doesn't span the New Year.