Monthly Archives: March 2008

Easily Create MP3s for Your Phone with ToneShop (iPhone Included) [Featured Windows Download]

toneshop.pngWindows only: Freeware application ToneShop creates ringtones from a variety of formats, for a variety of formats supported by most popular mobile phones (including the iPhone). To use it, just point ToneShop to the WAV, WMA, M4A, or MP3 file you want to use as your source, and then use ToneShop’s simple editing tools to choose the start and end time of your ringtone. Choose the output format supported by your cell phone, hit convert, and voilà—you’ve got a new ringtone. ToneShop could use a bit of polish on the interface, but as young as it is, it still makes it dead simple to create ringtones for your phone in just a few clicks. ToneShop is freeware, Windows only. If you’ve got a preferred ringtone tool that puts ToneShop to shame, let’s hear about it in the comments.

ToneShop [via FreewareGenius]


Add Quick Access to Your Filesystem with Direct Folders [Featured Windows Download]

direct-folders2.pngWindows only: Freeware application Direct Folders jumps quickly to any folder on your filesystem (and then some) for quick navigation through regular Explorer windows or save dialogs. After installing Direct Folders, double-click any free space on an Explorer window to bring up the Direct Folder menu. From there you can choose one of your favorite folders (or even apps), add new favorites, or access recent folders. With a lot more time-saving functionality worth using (like automatic folder resizing), Direct Folders seems almost magical. For a full run-down of everything it can do, check out the demo screencast. Direct Folders is freeware, Windows only (a pro version is available for a price, but most of the marquee features are available to the freeware version). If Direct Folders isn’t quite what you’re looking for (but close), check out previously mentioned FindeXer and PlacesBar.

Direct Folders [Code Sector]


Protect Your Privacy When Downloading [Feature]Lifehacker


Earlier this week, a Lifehacker reader caught downloading copyrighted material using BitTorrent told us about the scary warning letter she received from her ISP after a big media company filed a complaint. Fact is, whether you’re downloading copyrighted material or not, no one likes to have their activities online monitored. Let’s take a look at ways you can protect your downloading and file sharing privacy, and prevent the big media companies and other anti-P2P organizations from spying on your file sharing habits.

NOTE: It would be irresponsible to assure you that all of the methods highlighted below are foolproof. However, each method can do a lot to increase your privacy and security when you’re downloading.

How You Get Caught Sharing Files with BitTorrent

bittorrent-schema.pngWhen you download a file using BitTorrent, you’re connecting to several peers who are distributing chunks of the file you’re downloading. In order to send data back and forth, you and your peers exchange IP addresses. (IP addresses are like mailing addresses for sending data over the vastness of the internet.) When you’re downloading copyrighted material, sometimes disingenuous organizations will join in the download and log your information, like your home IP address. Once they have your address, they can find out who your ISP is and contact them to complain about copyright-infringing activity.

There are a few methods you can employ to protect yourself from this sort of tracking when you're sharing files with BitTorrent, thus setting up a layer of protection between you and those who might track you and report you. Below I'll cover a couple: PeerGuardian2 and proxies—particularly a new proxy service called BTGuard.

Keep Anti-P2P Trackers Away from Your BitTorrent Downloads with PeerGuardian2

IP-blocking application PeerGuardian2 (PG2) uses a constantly updated blacklist of IP addresses known to track your activity. I mentioned PG2 in my intermediate guide to BitTorrent, but it bears refreshing. Here’s how it works:

who-to-block.pngThe first time you run PeerGuardian2 after you install it, you’ll have to go through a setup wizard to tell PeerGuardian what kind of blacklists to download and block. By default, PG2 already has Anti-P2P organizations checked. For our purposes, that’s really all you need, but PG2 is capable of blocking more IPs if you have other privacy concerns beyond P2P that you want to address.

update-schedule.pngOn the next window of the PG2 setup wizard, you need to set your automatic update preferences. Since your privacy is only as good as your blacklists, you want to ensure that you’ve always got the latest and greatest lists available, so I’d recommend choosing to check automatic updates every day.

Now you’re done setting up PG2. On the last window of the setup wizard, you’ll notice a disclaimer similar to the disclaimer I made above. Remember, PG2 is not and cannot be 100% effective, but it will provide a good deal more protection than downloading without.

donwloading-list.pngWhen you click finish on the wizard, PG2 will run its first check for updates, downloading the blacklist for Anti-P2P organizations. With PG2 running, you’ll never connect to the IP addresses on the Anti-P2P blacklist, meaning that those organization can’t log your IP and your participation in a copyrighted download.

Obscure Yourself from Anti-P2P Trackers with a Proxy

When it comes to privacy on the internet, no solution is better than a good proxy—whether we're talking about no-hassle proxy solutions like previously mentioned Vidalia (which makes setting up a proxy through the Tor project a breeze) or techier solutions, like rolling your own SSH proxy.


If we're talking about file sharing, a proxy protects you by routing all of your traffic through another server when it leaves your computer and before it comes back to you. That means that when you're downloading data using a peer-to-peer protocol like BitTorrent, your peers can only see the proxy IP address, not your home IP address—so even if they are tracking your activity, they're not actually tracking your address at all.

There are a number of proxy servers out there, including the well known The Onion Router network (Tor). The catch is, Tor is a proxy project that’s already choked for servers and speed, and using Tor to download via BitTorrent is considered poor form. However, there are other proxy servers out there, including one made specifically for BitTorrent routing called BTGuard.

Located in Canada, BTGuard is a subscription service (about $7/month) that promises anonymous BitTorrent connections, unlimited speeds, and that it can bypass your ISP’s bandwidth throttling (if your ISP throttles BitTorrent).

The main catch when sending your BitTorrent traffic through proxies is that you’ll most likely see a speed drop, and sometimes it’s a very significant drop. According to the TorrentFreak weblog, though, BitTorrent transfers with BTGuard are almost equal to a direct connection—meaning you get all the protection of a proxy without any of the nasty slowdown.


To set up a proxy in the popular BitTorrent client, uTorrent, just go to the uTorrent preferences, click on Connection in the sidebar, and then find the Proxy Server section. From there, choose your proxy server type (Socks4/5, HTTP or HTTPS), enter in the address and port of your proxy server, and include any login information if your proxy uses it. (If you’re using BTGuard, for example, you’ll be given a username and password when you sign up.) Finally, be sure to tick the checkbox labeled “Use proxy server for peer-to-peer connections,” which is the whole reason you’re setting it up to begin with.


Anecdotes of folks who’ve been caught downloading copyrighted material are always a little scary. Despite the legal issues involved, don't forget that BitTorrent is only a protocol, and you choose how to use it. BitTorrent isn't synonymous with copyright infringement—there are plenty of legal uses and legal downloads going on with BitTorrent applications every day.

Whether or not you’re using your BitTorrent client to download copyrighted materials, no one likes being spied on. If you’re really serious about protecting your privacy, a proxy solution is probably the best. There are several drawbacks to proxies, most notably speed issues, but also difficulty in finding reliable free proxies or the cost of a service like BTGuard.

PeerGuardian2 is freeware, easy to use, and will never slow down your downloads. However, it’s much more susceptible to holes than proxies, since an IP-blocker is only as good as its blacklist, and those lists have to change and update regularly to keep up with the Anti-P2P addresses.

If you practice safe(r) BitTorrenting using one of these methods or an entirely different approach, share your experience in the comments. Alternately, if you throw caution to the wind, downloading copyrighted material with impunity, we’d love to hear your thoughts as well.

Lastly, for the sake of curiousity, we’re wondering:

Gawker Media polls require Javascript; if you’re viewing this in an RSS reader, click through to view in your Javascript-enabled web browser.

For those of you who are still new to BitTorrent, check out our beginner and intermediate guides.

Adam Pash is a senior editor for Lifehacker who encourages safe downloading. His special feature Hack Attack appears regularly on Lifehacker. Subscribe to the Hack Attack RSS feed to get new installments in your newsreader.




Using jQuery to Consume ASP.NET JSON Web ServicesEncosia

In response to many of the articles here, I receive feedback asking how to achieve the same results without using ASP.NET AJAX. As much as I’m a fan of ASP.NET AJAX, I must agree that its JavaScript payload can certainly be a drawback in some situations.

My recent deferred content loading post is an excellent example of that. I was using jQuery for presentational effects, and using a ScriptManager to call a web service. Loading the JavaScript for both frameworks was a bit counterproductive, since the whole point was to improve initial load time.

In this post, I intend to correct that.

First, I’ll cover the two requirements necessary when calling an ASMX web service that’s being JSON serialized by the ASP.NET AJAX extensions. Then, I’ll show you how to do this with jQuery. Finally, I’ll update the deferred content loading example accordingly.

Additional security when calling JSON serialized services

A security feature of ASP.NET web services that are JSON serialized through the ASP.NET AJAX extensions is that they must be requested in a specific way. This is an important deterrent against your services being used in XSS attacks. Scott Guthrie has a great post providing detailed information on the particulars. It boils down to is two things:

  • The request must be an HTTP POST request
  • The request’s content-type must be: “application/json; charset=utf-8″

When you register and call a web service through ASP.NET AJAX’s ScriptManager, you may safely enjoy blissful ignorance of these requirements. The framework transparently handles everything for you.

However, if you want to use a third party AJAX framework to request the JSON serialized output, you may run into trouble due to these security features.

How to make jQuery jump through these hoops

The solution is a bit less intuitive than using the ScriptManager or what you would normally expect from jQuery. Using jQuery’s getJSON() would make sense, but it unfortunately meets neither of the above security criteria.

The most reliable way that I’ve found is to use jQuery.ajax() as follows:

$.ajax({   type: "POST",   url: "WebService.asmx/WebMethodName",   beforeSend: function(xhr) {     xhr.setRequestHeader("Content-type",                          "application/json; charset=utf-8");   },   dataType: "json" });

Setting the request type to POST is self explanatory.

The beforeSend option is the key. It allows you to handle a jQuery event very similar to the PageRequestManager’s InitializeRequest event. The function is called with a reference to the actual XmlHttpRequest object about to be used in the AJAX call. This allows us to set its content-type to what the ASP.NET AJAX framework requires, just before the request is made.

Note: jQuery.ajax() does have a contentType option, but it will be ignored if there is no data included in the POST. For read-only requests, this will cause the call to unexpectedly fail. To maintain consistent usage across implementations, I prefer to always set it up explicitly with the beforeSend event handler.

Putting it all together

Now that we know how to call the web service, appropriately modifying the original example is easy. Here’s the new ASPX code:

<div id="Container">   <div id="RSSBlock">     <div id="RSSContent" class="loading"></div>   </div>    <div id="Content">     <p>Lorem ipsum dolor sit amet, consectetuer adipiscing...</p>   </div> </div> </form>  <script type="text/javascript" src="jquery-1.2.3.min.js"></script> <script type="text/javascript" src="Default.js"></script>

Notice that I’ve placed the JavaScript references below the rest of the page’s content. Since browsers block while requesting, loading, and executing JavaScript, it makes sense to defer that until as late as possible. This will serve to further boost the page’s perceived performance.

Finally, the jQuery code to call the web service and appropriately handle its result:

$(document).ready(function() {   $.ajax({     type: "POST",     url: "RSSReader.asmx/GetRSSReader",     beforeSend: function(xhr) {       xhr.setRequestHeader("Content-type",                            "application/json; charset=utf-8");     },     dataType: "json",     success: function(msg) {       // Hide the fake progress indicator graphic.       $('#RSSContent').removeClass('loading');        // Insert the returned HTML into the <div>.       $('#RSSContent').html(msg.d);     }   }); });

Conclusion: Is it worth it?

By using jQuery to call the web service directly, we’ve eliminated over 100 KB of JavaScript and three extra HTTP requests. The ASP.NET AJAX client side framework accounted for over half of the original example’s total download size, and those three extra HTTP requests unnecessarily delayed the progress indicator.

That may not sound like much, but it’s significant. When it comes to loading speed and responsiveness, users do not perceive changes linearly. Fractions of a second make the difference between a site that feels sluggish and one that appears responsive.

A word about web services

Web services are great tools that afford you substantial flexibility. It’s important not to overlook them.

You’ve no doubt seen many AJAX examples that involve using the XmlHttpRequest to request the output of a specially designed page, resulting in CSV or otherwise arbitrarily formatted data instead of HTML. For instance, I’ve noticed that a lot of the auto-complete plugins for jQuery expect this sort of kludge.

I believe that to be a short-sighted and counterproductive way to do things.

Web services have often been maligned in the past, due to the XML bloat associated with SOAP. However, JSON makes this drawback a thing of the past. JSON is very lightweight, making it ideal for structured AJAX communication. With the inefficiencies of SOAP neutralized, I think the power and flexibility of web services cannot be overstated.

For example, if I decide to move my sites from WebForms to MVC, there is a large amount of functionality encapsulated in web services that I won’t have to worry about recoding or redesigning. It’s a great feeling to have that flexibility and ease of reuse.

When used well, I think web services are to WebForms what object oriented programming was to procedural and functional programming.

Try it for yourself: download the source

The full example’s source code (ASP.NET 3.5 required):

Download source: jQuery-JSON-call.zip (33kb)

Originally posted at: Encosia.

Web-разработка: Баннер на скорую руку в режиме онлайнХабрахабр: Web-разработка / Блог / Захабренные

Untitled-1

У многих начинающих веб-мастеров и просто пользователей интернета, зачастую возникает потребность — разрекламировать свой сайт или товар, обычно это начинают с изготовления рекламного баннера, но что делать если нет не времени, не средств(читать как: програмного обеспечения) — в этом вам поможет отличный веб-сервис с очень даже говорящим названием — «Banner fans».
Читать дальше →

Sorting with Silverlight 2’s DataGrid ControlMatt Berseth

So I am just starting to get my feet wet with Silverlight 2.  I have gained some confidence over the past few days, but on the crawl, walk, run scale it feels like I am still crawling.  Beginner or not, I figured I would take a shot at getting Silverlight's DataGrid control to support sorting.  Nothing too complicated – just the standard click on the column header to sort the data.  Surprisingly, I didn't see much on MSDN talking about how to implement sorting using the DataGrid.  I know the documentation is still in the works so I am sure it is coming, but I was a little bit concerned about how to get started.  No worries though, it turned out to be a breeze.  If you are interested in the details, I have a quick description of what I did just beneath the following screen shot.

Live Demo | Download

image

Creating Some Data

If you follow my blog, you may have noticed that I am partial to the Northwind data set.  This example is no different – my grid is filled with the rows from the customers table.  And I cheated a bit and hard-coded my data so I could focus on the sorting interface and not worry about fetching them from the database.  I figure I can work on the web service part later.

I added a Customer class to my application that contains a handful of the attributes defined by the customer table.  Then I added a static Get method to the Customer class that loads the Customer list if it hasn't been loaded already and returns it.  It looks something like this …

image

And just as a side note, I didn't actually key in all 91 Add statements.  I used a bit of SQL to generate these based on the rows in the customer table.  If you give a lot of presentations, demos or just need to create some test data – don't forget about SQL Server.  It can be very handy as a crude code generation tool when you need something quick. 

image

Defining the DataGrid’s Columns

Like ASP.NET 2.0's GridView, the Silverlight DataGrid can infer what column's need to be displayed based on the properties that are found on the data source.  The AutoGenerateColumns property is what controls this behavior.  When it is set to true, the DataGrid automatically adds the columns when the ItemSource property is set.  To be honest though, when working with the GridView I usually don't set the AutoGenerateColumns property to true.  I always want to control the order of the columns, the name (Company Name instead of CompanyName) and often times I do not want to show all of the properties my data source makes available.        

To get this type of behavior, you can use the DataGrid’s Columns collection to define the order, header text and type for each of the columns you want displayed.  Like the GridView, you can create different type of column elements based on the data type you are binding to the column to.  Right now it looks like the DataGrid has a DataGridTextBoxColumn for text content, a DataGridCheckBoxColumn for tri-state (Yes/No/Unknown) content and of course a very flexible DataGridTemplateColumn that supports templating. 

Below is a sample where I am explicitly defining the contents of the Columns property using the markup.

image

Adding HyperlinkButton’s for the Column Header

If you notice in the above screen shot, I have specified each column's header text using the DataGridTextBoxColumn.Header attribute.  Well it turns out the XAML programming model is pretty darn flexible.  And I could have used the property element syntax to specify the header title by setting the Header property to a TextBlock like so …

image

And if I replace the TextBlock control with a HyperlinkButton (which exposes a Click event) things start coming together for my sorting scenario.  Now the XAML for the Customer's ID DataGridTextBoxColumn takes on the following form.  Notice I have attached an event handler to the Click event and assigned the Tag attribute to the property I want to sort by.

image

And because I am using the Tag attribute to let me know what property to sort by I can attach all of the column header Click events to the same event handler.  Giving use something like this.

image

Implementing the Click Event Handler

And now for the easy part.  Our Sort_Click event handler will determine what property to sort the Customers collection by from looking at the value of the Tag attribute.  So I have setup a switch statement that orders the in-memory Customers list by the property that corresponds to the column header that was clicked.  One thing to note is that because the DataGrid control doesn't maintain the sort state, I have to keep track of the last sort property and direction to determine how to order the collection (ASC or DESC) if the same header is clicked twice.   

image

That's it.  Enjoy!

Podcast #33: Quick & Easy JoineryWoodworking Online

If I had the time, I’d build every project with hand-cut mortise and tenon or dovetail joinery. But that’s not a very realistic goal, nor is it necessary. There are plenty of joinery methods out there that can be made both quickly and easily. During the seminar podcast, I’ll talk about three of my favorite “quick and easy” joinery methods.

One of the most “traditional” methods is the lap joint. It’s easy to cut with just one setup on the table saw. And it provides plenty of face grain gluing surface as well as a good amount of mechanical strength.

For a couple of “modern” joinery techniques that are especially quick and easy, you’ll have to purchase specialized machinery to produce them. I’m talking about biscuit joints and pocket hole joinery. Both of these methods get their mechanical strength from distinctive fastener’s — biscuits or pocket screws. But the best part is that each can be setup and cut in seconds.

Be sure to check out the Woodsmith Podcast Store for links to a few products that I used during this seminar.

Protect Files from Deletion or Moving with fsLock [Featured Windows Download]Lifehacker


Windows only: Sweeping through your system and deleting unnecessary files feels great—until you realize you've just permanently wiped your master contact spreadsheet. Avoid that kind of over-zealous deletion with fsLock, a free Windows tray utility that prevents a list of files from being deleted, moved, renamed, modified, or otherwise touched. The utility has to be running to work, of course, and it used about 8K of memory on my Vista laptop, but I couldn't mess with my chosen files inside Windows. It's not a privacy or security tool, as you can get to the files through another OS or before booting, but it keeps your files safe from the casual destruction of "Select All->Delete." fsLock is a free download for Windows systems only.




SAM will not start on HP-UX

If you cannot start sam on HP-UX and see in samlog message like below than this article is for you.

An infrastructural error message for [error code 80054, location ../prod4/Ros
eville/intermed/arch_scan.C:721] was not found in the   internal error table.Lo
cation: arch_err_handler.C:256Error Code: 5000

#cd /etc/sam
#mv reg_da.db reg_da.db.old
#mv reg_files.db reg_files.db.old
#mv reg_tm.db reg_tm.db.old
#cp -p /usr/newconfig/etc/sam/reg* /etc/sam

Then try running sam…..

Add Custom Options to the Windows AutoPlay Dialog [Windows Tip]Lifehacker

dvd-rip-autoplay.pngThe Windows AutoPlay feature is the bane of many-a-PC user, particularly because of nasty DRM histories and other intrusive business, but what about when you actually want to use the AutoPlay feature? For example, let’s say you’re a fan of Lifehacker’s very own DVD-ripping tool, DVD Rip, and you want your computer to automatically start ripping DVDs as soon as you put one in (making the simple one-click solution even simpler). Here’s how it works.

First, if you don’t have it already, you’ll need to go download the most beloved of Windows PowerToys, TweakUI. Once it's installed, fire up TweakUI and then head to My Computer -> AutoPlay -> Handlers.

add-autoplay.pngWe’re looking to add a new option to the AutoPlay, so hit the Create button. You’ll see a new window that allows you to define the new AutoPlay handler. To start, enter a description (like “Rip the DVD to your hard drive”) and followed by the name of the program you’re using in the next textbox (e.g., “DVD Rip”). Next you need to point TweakUI to the program that will run when you insert the media, so click the Change program… button and point it to the application you want to run (in our example, that’s DVD Rip.exe). Finally, tick the boxes next to the media you want your new AutoPlay options to show up with.

When you’re finished, click OK, apply your changes, and you’re done. In our example, next time you insert a DVD, DVD Rip should be included in your AutoPlay options. If you want it to automatically run every time you insert a DVD, tick the box labeled Always do the selected action and hit OK.

What about Vista?

Now for the bad news: As far as I can tell, so far there isn’t a comparably good and simple solution to add a new entry to the AutoPlay menu in Vista. Vista does have a great AutoPlay tool for selecting your options, but it doesn’t offer an option to add programs, and the old TweakUI doesn’t work for Vista. If you’re aware of a method for doing the same for Vista, let’s hear about it in the comments.


WP Like Button Plugin by Free WordPress Templates