instruction
stringlengths
0
30k
RSS isn't "push", which means that you need to have something that polls the website. It's much less traffic than getting the whole site or front page (for instance, you can say "Give me all articles newer than the last time I asked"), but it's traffic nonetheless. It's generally understood you shouldn't have a ref...
I've used [Pingie][1] in the past to send me an SMS when a new items appears in an RSS feed. Perhaps that would be useful for you if you have a cell phone text messaging plan. [1]: http://www.pingie.com
I enabled compression following similar articles to those posted above. The key to accessing the ViewState before the application sends it was overriding this method; protected override void SavePageStateToPersistenceMedium(object viewState) You can call the base method within this override and then add whate...
[RSS2mail][1] is a simple python script which I used extensively a few years back. As Matthew stated you really shouldn't bother an RSS feed more than the producer allows but you can use http headers to check for changes in a very light way which is something rss2email does quite well. [1]: http://exo.org.uk/co...
I would also mock the database, and check that the queries are what you expected. There is the risk that the test checks the wrong sql, but this would be detected in the integration tests
I blogged about this a while back, quoting on [Todd Snyder's excellent post on the difference between the two][1]. > Here are the key differences between > the patterns: > > MVP Pattern > > - View is more loosely coupled to the model. The presenter is > responsible for binding the model to > the view. > - ...
You could always knock something up yourself... I've done it in the past and it really isn't too difficult a job to write an RSS parser. Of course, as others have mentioned, there's an etiquette question as to how much of the website's valuable bandwidth you want to hog for yourself in RSS request traffic. That's ...
Both of these frameworks aim to seperate concerns - for instance, interaction with a data source (model), application logic (or turning this data into useful information) (Controller/Presenter) and display code (View). In some cases the model can also be used to turn a data source into a higher level abstraction as we...
Both of these frameworks aim to seperate concerns - for instance, interaction with a data source (model), application logic (or turning this data into useful information) (Controller/Presenter) and display code (View). In some cases the model can also be used to turn a data source into a higher level abstraction as we...
MVP = Model-View-Presenter MVC = Model-View-Controller 1. Both presentation patterns. They separate the dependencies between a Model (think Domain objects), your screen/web page (the View), and how your UI is supposed to behave (Presenter/Controller) 2. They are fairly similar in concept, folks initialize the P...
- MVP = Model-View-Presenter - MVC = Model-View-Controller 1. Both presentation patterns. They separate the dependencies between a Model (think Domain objects), your screen/web page (the View), and how your UI is supposed to behave (Presenter/Controller) 2. They are fairly similar in concept, folks initialize...
The problem I experienced when unit testing persistence, especially without an ORM and thus mocking your database (connection), is that you don't really know if your queries succeed. It could be that you your queries are specifically designed for a particular database version and only succeed with that version. You'll ...
If you have access to Microsoft Outlook 2007 or Thunderbird, these email clients allow you to add RSS feeds in the same way you would add an email account. I use Google Reader generally but when I want to keep up-to-date with something specific, I add the RSS feed to Outlook and it arrives in my inbox as if it was a...
For NHibernate, I'd definitely advocate just mocking out the NHibernate API for unit tests -- trust the library to do the right thing. If you want to ensure that the data actually goes to the DB, do an integration test.
I've been using Copy Handler. The nicest thing about it is that it queues up its jobs like a download manager. It has a shell extension so you can either rightclick drag, or just set copy with copyhandler as the default action.
Technically unit tests of persistance are not Unit tests the are Integration tests. With C# using mbUnit, you simply use the SqlRestoreInfo and RollBack attributes [TestFixture] [SqlRestoreInfo(<connectionsting>, <name>,<backupLocation>] public class Tests { ...
Technically unit tests of persistance are not Unit tests they are Integration tests. With C# using mbUnit, you simply use the SqlRestoreInfo and RollBack attributes [TestFixture] [SqlRestoreInfo(<connectionsting>, <name>,<backupLocation>] public class Tests { ...
i built myself a pc with 4gb ram, dual core 1.8ghz 40gb pata drive primary, and 250gb sata drive secondary and installed vista business edition. when i had to copy 120gb of data from my old pata disk, vista failed miserably and kept crashing. i definately recommend teracopy free edition.
I would definitely prefer: 1) [Teracopy][1] - GUI based, replaces the default Windows copy/move UI and adds itself to context menu. Basic version is free (for home use I guess). 2) [Robocopy][2] - CLI based, useful when scripting. Free tool from MS and is included in Vista/Windows 2008. MS Technet has a GUI f...
You say you have enough trouble getting one cube to display... so I am not sure if you have got one to display or not. Basically... put your code for writing a cube in one function, then just call that function 100 times. void DrawCube() { //code to draw the cube } void DisplayCubes(...
You say you have enough trouble getting one cube to display... so I am not sure if you have got one to display or not. Basically... put your code for writing a cube in one function, then just call that function 100 times. void DrawCube() { //code to draw the cube } void DisplayCubes(...
The .Net 2.0 framework namespace System.IO.Compression supports GZip and Deflate algorithms. Here are two methods that compress and decompress a byte stream which you can get from your file object. You can subsitute GZipStream for DefaultStream in the methods below to use that algorithm. This still leaves the problem o...
No, because while you thought LINQ is really just syntactic sugar, it actually heavily used expression trees -- a feature absent in .NET 2.0. That being said .NET 3.5 only builds up on top of .NET 2.0, and that's the reason why the IL doesn't look "different" or "special". I do not see a reason why you shouldn't ...
There are some "Hacks" that involve using a System.Core.dll from the 3.5 Framework to make it run with .net 2.0, but personally I would not want use such a somewhat shaky foundation. See here: [http://weblogs.asp.net/fmarguerie/archive/2007/09/05/linq-support-on-net-2-0.aspx][1] > 1. Create a new console applic...
In theory yes, provided you distribute the LINQ specific assemblies and any dependencies. However that is in violation of Microsoft's licensing. Scott Hanselman wrote a blog post about [Deploying ASP.NET MVC on ASP.NET 2.0][1] which is similar to what you are wanting to do. [1]: http://www.hanselman.com/blog/Dep...
If you correctly markup your HTML code, there is no need for javascript. The following code will allow the user to click on the label text to tick the checkbox. <label for="surname">Surname</label> <input type="checkbox" name="surname" id="surname" /> The *for* attribute on the label element links to the...
If you correctly markup your HTML code, there is no need for javascript. The following code will allow the user to click on the label text to tick the checkbox. <label for="surname">Surname</label> <input type="checkbox" name="surname" id="surname" /> The *for* attribute on the label element links to the...
As far as I know the LINQ library is only available since the framework 3.0. If you want to use something similar in the framework 2.0, you would need to rewritte it yourself :) or find a similar third-party library. I only found a bit of information [here][1] but it didn't convinced me either. [1]: http://webl...
You can wrap your checkbox in the label: <label style="display: block; padding: 50px 0 0 50px; background-color: pink; width: 80px; height: 80px"> <input type="checkbox" name="surname"> </label>
You can accomplish this with Section Handlers. There is a basic overview of how to write one at [http://www.codeproject.com/KB/aspnet/ConfigSections.aspx][1] however it refers to app.config which would be pretty much the same as writing one for use in web.config. This will allow you to essentially have your own XML tre...
Assuming you have the correct assemblies and a C# compiler you in theory can use whatever you want to edit the code and then just run the compiler by hand or using a build script. That being said it is a real pain doing .NET development without Visual Studio/SharpEdit/Monodevelop in my opinion.
Ronnie, If you wanted to enclose the label text and checkbox inside a wrapper element, you could do the following: <label for="surname"> Surname <input type="checkbox" name="surname" id="surname" /> </label>
I haven't done SWING development since my early CS classes but if it wasn't built in you could just inherit javax.swing.AbstractButton and create your own. Should be pretty simple to wire something together with their existing framework.
Wrapping with the label still doesn't allow clicking 'anywhere in the box' - still just on the text! This does the job for me: <div onclick="dob.checked=!dob.checked" class="checkbox"><input onclick="checked=!checked" id="dob" type="checkbox"/>Date of birth entry must be completed</div> but unfortunately has...
The JITter will sometimes use non-virtual calls to methods in sealed classes since there is no way they can be extended further. There are complex rules regarding calling type, virtual/nonvirtual, and I don't know them all so I can't really outline them for you, but if you google for sealed classes and virtual metho...
The JITter will sometimes use non-virtual calls to methods in sealed classes since there is no way they can be extended further. There are complex rules regarding calling type, virtual/nonvirtual, and I don't know them all so I can't really outline them for you, but if you google for sealed classes and virtual metho...
Sealed classes *should* provide a performance improvement. Since a sealed class cannot be derived, any virtual members can be turned into non-virtual members. Of course, we're talking really small gains. I wouldn't mark a class as sealed just to get a performance improvement unless profiling revealed it to be a prob...
Normally you'd copy it to svn+ssh://host.example.com/repos/project/branches/mybranch so that you can keep several branches in the repository, but your syntax is valid. Here's some advice on [how to set up your repository layout][1]. [1]: http://svnbook.red-bean.com/en/1.1/ch04s07.html
If you even plan on merging your branch, I highly suggest you look at this: [http://www.orcaware.com/svn/wiki/Svnmerge.py][1] I hear Subversion 1.5 builds more of the merge tracking in, I have no experience with that. My project is on 1.4.x and svnmerge.py is a life saver! [1]: http://www.orcaware.com/svn/...
I believe you are talking about a content management system. The way I have delt with this situation in the past is to either: 1. Allow a page/content to define an extra custom stylesheet or 2. Allow a page/content to define inline style tags
This will allow you to pass a weight of 0 and still work properly. Notice the === operator, this checks to see if weight matches "null" in both value and type (as opposed to ==, which is just value, so 0 == null == false). PHP: public function createShipment($startZip, $endZip, $weight=null){ if ($w...
What's the best way to implement BDD/TDD in .NET 2.0?
|c#|.net|testing|tdd|bdd|
I'm looking to add a testing suite to my application, however I can't move to the newer testing frameworks for .NET 3.5. Does anyone have a suggestion about good testing frameworks to use?
How do I make a checkbox toggle from clicking on the text label as well?
|html|checkbox|
Checkboxes in html forms don't have implicit labels with them. Adding an explicit label (some text) next to it doesn't toggle the checkbox.
|html|checkbox|
Thxm, Mc! http://asm.objectweb.org/ is another one. _Excellent_ documentation on byte code instrumentation, but nothing "directly" aimed at writing a coverage tool - just some hints or ideas.
Quick'n Dirty: First create your **ConfigurationSection** and **ConfigurationElement** classes: public class MyStuffSection : ConfigurationSection { ConfigurationProperty _MyStuffElement; public MyStuffSection() { _MyStuffElement = new ConfigurationProperty("MySt...
You could always try the Synth look & feel. You provide an xml file that acts as a sort of stylesheet, along with any images you want to use. The code might look like this: try { SynthLookAndFeel synth = new SynthLookAndFeel(); Class aClass = MainFrame.class; InputStream stream = aClas...
You could always try the Synth look & feel. You provide an xml file that acts as a sort of stylesheet, along with any images you want to use. The code might look like this: try { SynthLookAndFeel synth = new SynthLookAndFeel(); Class aClass = MainFrame.class; InputStream stream = aClas...
NUnit is always a favorite of mine. However if you are using TFS as your source control I suggest you stick with the Microsoft Stack.
Set the CSS "display" property for the label to be a block element and use that instead of your div - it keeps the semantic meaning of a label while allowing whatever styling you like. For example <label for="test" style="width: 100px; height: 100px; display: block; background-color: #e0e0ff;"> A tic...
Yes, this is possible. One of the main pros for using Swing is the ease with which the abstract controls can be created and manipulates. Here is a quick and dirty way to extend the existing JButton class to draw a circle to the right of the text. package test; import java.awt.Color; import jav...
For a Mock Object library, I've found the BSD-licensed [Rhino.Mocks][1] to be rather pleasing. [1]: http://ayende.com/projects/rhino-mocks.aspx
NUnit is available at <http://www.nunit.org> I would suggest this even when working on the MS stack - the support for non-MS frameworks is happening in the MVC previews which shows a definate movement in the right direction to allow us all to customise our stacks to fit.
in 1.x there used to be things DataTables couldn't do which DataSets could (don't remember exactly what). All that was changed in 2.x. My guess is that's why a lot of examples still use DataSets. DataTables should be quicker as they are more lightweight. If you're only pulling a single resultset, its your best choice...
It really depends on the sort of data you're bringing back. Since a DataSet is (in effect) just a collection of DataTable objects, you can return multiple distinct sets of data into a single, and therefore more manageable, object. Performance-wise, you're more likely to get innefficiency from unoptimised queries ...
One feature of the DataSet is that if you can call multiple select statements in your stored procedures, the DataSet will have one DataTable for each.
How to filter and combine 2 datasets in C#
|c#|.net|
I am building a web page to show a customer what software they purchased and to give them a link to download said software. Unfortunately, the data on what was purchased and the download information are in separate databases so I can't just take care of it with joins in a query. The common item is SKU. I'll be pul...
From the [Python FAQ][1]: > Lists and tuples, while similar in many respects, are generally used in fundamentally different ways. Tuples can be thought of as being similar to Pascal records or C structs; they're small collections of related data which may be of different types which are operated on as a group. For e...
Add Custom Tag to Visual Studio Validation
|visual-studio|
How can I add rules to Visual Studio (2005 and up) for validating property markup (HTML) for a vendor's proprietary controls? My client uses a control which requires several properties to be set as tags in the aspx file which generates something like 215 validation errors on each build. It's not preventing me from b...
Definitely not a ruby expert, but I'll give it a shot. $ irb system "echo Hi" Hi => true You should also be able to do things like... cmd = 'ls' system(cmd)
I am thinking off the top of my head here. If you load both as Data Tables in the same Data Sets, and define a relation between the two over SKU, and then run a query on the Data Set which produces the desired result.
Thanks Adhip, this is what I came up with: In the page load function: HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("default_body"); body.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#2E6095"); Where default_body = the id of the body tag.
<p>if its .net on both sides:</p> <p>think you should use binary serialization and send the byte[] result.</p> <p>trusting your struct to be fully blittable can be trouble.</p> <p>you will pay in some overhead (both cpu and network) but will be safe.</p>
ASP.NET Display SVN Revision Number
|asp.net|svn|
I see in the Stack Overflow footer that the SVN Revision number is displayed. Is this automated and if so, how does one implement it in ASP.NET? *(Solutions in other languages are acceptable)*
Subversion doesn't really support branches or tags. What it allows instead is a very very light and efficient copying facility. Branching and Tagging are, effectively the same. Just copy a whole folder in the repository to somewhere else in the repository. Basically this means that it is by convention what copyin...
File size differences after copying a file to a server vía FTP
|python|
I had an PHP script to update the webserver from a local directory. I'm migrating the script into Python, it works almost OK but after a PUT command the size of the file in the server isn't the same as the local file. Once I download again the file from the FTP server, the only difference is the CR/LF mark. It annoy...
How do I build a collection in classic ASP?
|vbscript|asp|
I want to be able to do: For Each thing In things End For
|asp|vbscript|
I want to be able to do: For Each thing In things End For CLASSIC ASP - NOT .NET!
Whatever your [things] are need to be written outside of VBScript. In VB6, [you can write a Custom Collection class][1], then you'll need to compile to an ActiveX DLL and register it on your webserver to access it. [1]: http://www.vb-helper.com/howto_custom_collection_with_for_each.html
Do you need to open the locfile in binary using "rb"? f = open (locfile, "rb")
Well if you go under the properties of your file in Windows or a *nix environment, you will notice two sizes. One is the sector size, and one is the actual size. The sector size is the number of sectors in bytes that are used up on your hard disk. That is because two files cannot be in the same sector with most mode...
Make sure that the file has svn:keywords "Rev Id" and then put $Rev$ somewhere in there. See [this question and the answers to it][1]. [1]: http://stackoverflow.com/questions/163/how-do-i-sync-the-svn-revision-number-with-my-aspnet-web-site
If you need to populate each member variable by hand you can generalize it a bit as far as the primitives are concerned by using FormatterServices to retrieve in order the list of variable types associated with an object. I've had to do this in a project where I had a lot of different message types coming off the strea...
As long as the two databases are on the same physical server (assuming MSSQL) and the username/password being used in the connection string has rights to both DBs, then you should be able to perform a join across the two databases. Example: select p.Date, p.Amount, d.SoftwareName, ...
Right-click on the Source view of an HTML / ASP page and select "Formatting and Validation". Click "Tag Specific Options". Expand "Client HTML Tags" and select the heading. Click "New Tag...". And just fill it in!
Right-click on the Source view of an HTML / ASP page and select "Formatting and Validation". 1. Click "Tag Specific Options". 2. Expand "Client HTML Tags" and select the heading. 3. Click "New Tag...". 4. And just fill it in! I wish that I could add custom CSS values as well.
How do I turn on line numbers by default in TextWrangler on the Mac?
|macos|textwrangler|
I am fed up having to turn them on every time I open the application.
Go to TextWrangler > Preferences. Choose Text Status Display in the category pane, then check the option "Show line numbers" and close the preferences. This should now be on by default when you open existing documents.
You can also use the backtick operators (`), similar to Perl: directoryListing = `ls /` puts directoryListing # prints the contents of the root directory Handy if you need something simple. Which method you want to use depends on exactly what you're trying to accomplish; check the docs for more detail...
There is nothing VS specific with the MVC framework - it is just a bunch of DLLs that you can use. The wizards in VS just build you a quick-start framework. ASP.NET MVC is "bin-deployable" - there is nothing too clever to set up on the server either - just point the wildcard ISAPI filter to ASP.NET
How do I use (n)curses in Ruby?
|ruby|unix|curses|
I'd like to create a progress bar to indicate the status of an a batch job in Ruby. I've read some [tutorials][1] / [libraries][2] on using ncurses, none of which were particularly helpful in explaining how create an "animated" progress bar in the terminal or using curses with Ruby. I'm already aware of using a separat...