SoundCloud is a great resource for interesting audio tracks audio tracks. I found this playlist that I wanted to download. Although the author is allowing download of tracks, I've to download each track manually, which is a time-consuming task. I searched for any tool to help me download the whole playlist, but I didn't find any. So I did what a great programmer should do: I made it myself.
Please don't use it to steal other people's audio tracks.
Yahoo added me to different marketing newsletters without my permissions. When I unsubscribed they told me that it will take 10 business days to take effect! This is the 3rd time I do this!
Yahoo, I know you want to make more money, but please respect my choices!
It makes me sad when I find out that a lot of people use bad tools, so here is a list of tools that I use almost everyday (as of May 2013). Most of them are great & some of them are acceptable. Feel free to suggest better tools.
Your life is miserable without these
There are 2 types of people:
People who try to open a movie with Windows Media Player, but find that they cannot open any movie with it, so they download the XviD codec & install it. Later, they try to open a movie with extension RMVB, then they find that they want another codec which conflicts with the 1st codec, so they remove the 1st codec & install the 2nd, but not all movies requiring XviD works, so they ask a friend who tells them about the Combined Community Codec Pack which plays all kind of videos except Real Media & QuickTime, but if you install Real Alternative & QuickTime Lite to play RM & MOV videos. Now they just need to install DirectVobSub for subtitles & they are finished. This is just for Windows.
The 2nd type of people installed VLC player & lived happily ever after.
So you want to search for files by their name or extension. You open Windows search & type the file name, then you wait, and wait, and wait, and ....
During this, I downloaded & installed Everything search engine, searched for the files I need, found them & already working on them.
Now, Windows just showed the results. Please remind me why I searched for these files?
Why install 48 MB slow application to view PDFs when you can install a 5MB lightning-fast application which can view PDF, MOBI & many different formats?
Which one you choose depends on you, but you should not use IE.
Swiss-army knife for raster image editing. What MS Paint is supposed to be.
Free Virtual CD program without ads. You won't find a better one.
Free & easy to use download manager.
Did you see James Shore series Let's Play TDD & wondered how you are going to download all of these videos to see them offline? youtube-dl can download from youtube & tens of other sites as well.
FFmpeg is a media conversion tool. I've mixed feelings against it. It's very powerful & fast, but also very hard to use. Each time I've to google how I can use it, but it's performance makes it practical than other conversion tools I tried.
The best crap cleaner & disk defragmenter.
For command-line gurus
It's a shell container which groups all your shells in a single window with multiple tabs, including putty.
A smarter shell for Windows. I like that when you press TAB it shows all the available options, instead of cycling through all the options. It also supports persistent history.
For the Ninja programmer
I used different programming languages, but Python is the swiss-army knife that I use when I've the choice, and it didn't fail me. I used it for small scripts, GUI apps, to high-performance web apps.
I wanted a powerful text editor (like VI or Emacs) but didn't need me to relearn how to use a text editor. I used Notepad++ for a long time, before I switch to Sublime.
SQLite is convenient for development, because it doesn't require installation of any kind.
I had nice experience with Postgres when I built rawa7.com. Installing PostGIS (Postgres GIS extension) with other GeoDjango dependencies on Windows is painful, but after this it's a joy to use.
It also supports compression, recursive queries, Multiversion concurrency control, custom types, table inheritance, regular expressions & other interesting features. DB choice is probably the hardest thing to change in an enterprise, but Postgres is worth a try.
Today was the 2nd joint event by dotnetworks and EGJUG. There was 2 sessions: Oracle ADF a practical experience (which I didn't attend, unfortunately), and dynamic languages on .net, by yours truely :). There were very few people who attended, about 15 people. They were very active and participating, and I believe they liked the session. The main goal of the session was introducing Python (specially IronPython) to the people, differences and similarities to C# & Java, and what to apply lessons learnt from Python to these languages. This is the presentation (which is very simple, because most of the session was practical)
Also you will find the DreamPie session (with the sample files used in the session). DreamPie is an excellent Python shell, which can integrate with CPython, IronPython and Jython, also giving you correct AutoComplete. As a bonus, this is also an example of using BeautifulSoup - a Python library for parsing badly-formatted HTML - from C# 4.0. BeautifulSoupUser.zip, 11.csv.zip, 11 - Copy.csv.zip, Python-Session-2011-01-22.html
MIX conference is my favorite conference. It is always full of surprises, and it is not restricted to Microsoft technologies. It has been a habit for me to grab the links to MIX videos since MIX 07, and I'm keeping this habit for this year too :). Here is the source code to the Python program which grabs the links. It generates two files: mix09_links.txt which contain only the links so you can import them in your favorite text editor, and mix09_title.txt which contain the title of every session and its URL, so you know the title of the session.
from urllib import urlopen import re links_file = open('mix09_links.txt', 'w') description_file = open('mix09_title.txt', 'w') try: for i in range(16): url = 'http://videos.visitmix.com/MIX09/page%s' % (i+1) print url # for tracking s = urlopen(url).read() links = re.findall(r'<h2 class="title" title="(.*?)"><a href="/MIX09/(.*?)">.*?</a></h2>', s) for link in links: links_file.write('http://mschannel9.vo.msecnd.net/o9/mix/09/wmv-hq/%s.wmv\\n' % link.lower()) description_file.write('%s\\nhttp://mschannel9.vo.msecnd.net/o9/mix/09/wmv-hq/%s.wmv\\n\\n' % (link.lower(), link)) finally: links_file.close() description_file.close()
A problem that we face everyday is creating CRUD interfaced for our databases. Creating a CRUD interface is always a boring and tedious job. Even if you want to initialize your data, you may break something by mistake if you use SQL Server Management Studio, because it doesn't know anything about your business rules. Django_ - A web framework for Python_ - gives you the solution. It has an application called "Django Admin" that provides a customizable, production-ready, nice-looking UI on top of your DB. If you want to see the final results, see the screenshots at the end of the post.
Setting the environment
- Install Python 2.5 or newer.
- Install Django 1.0 or newer.
- Download and install pyodbc. You should install the one that is compatible with your version of Python, e.g. if you installed Python 2.5, you should select pyodbc-2.0.58.win32-py2.5.exe.
- Checkout django-pyodbc from
http://django-pyodbc.googlecode.com/svn/trunk/ using a Subversion
client, then you should move the directory
Creating the Django project
A Django application is a complete component, including the DB model, views and templates. Good examples of Django application are user registration, tagging, search, etc. You can find a lot of reusable applications on http://www.djangopackages.com/. A Django project is a group of application that works together. Now you have the environment setup for Django. The next step is creating a new Django project. On the console, write this command
C:\Python25\Lib\site-packages\django\bin\django-admin.py startproject sqlserveradmin
Then create an application using this command:
manage.py startapp mydb
To add the application to the project. You must change
settings.py to include the app.
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'mydb', )
Setting the database
Now you have the project in place. You need to modify
point to your DB. Change these fields to be
DATABASE_ENGINE = 'sql_server.pyodbc' DATABASE_ODBC_DRIVER = 'SQL Native Client' DATABASE_NAME = 'db_name' DATABASE_USER = 'webapp' DATABASE_PASSWORD = 'sikrit' DATABASE_HOST = r'test_server\SQLEXPRESS'
Generating DB models
On the console, run the following command
manage.py inspectdb > inspected_models.py
This will generate Python models for your tables. Unfortunately, they are not arranged. To arrange them, use the script that I posted to http://www.djangosnippets.org/snippets/1203/.
rearrange_models.py inspected_models.py models.py
Use the new models.py to replace the old one in the folder mydb.
Installing the admin
To install the admin, you need to add the following line to
settings.py. It should look like
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'mydb', )
then run this command to add the tables necessary for the admin to work.
It will ask you to add a superuser. This superuser will allow you to access the admin.
You need to tell Django what models that you need to be viewed in the admin. For our case, we want to view all the tables. I will use a little bit of Python magic to add all the models to be viewed in the admin. Put the following code in a file called admin.py in your application folder.
from django.contrib import admin from django.db.models import Model import models # This is your models' module for m in dir(models): class_ = getattr(models, m, None) if class_ and isinstance(class_, type) and issubclass(class_,Model): admin.site.register(class_)
Congratulations. We are done.
What you can do more
- Change the templates used to view the UI.
- Customize the names of the models and fields, for example you can supply correct pluralization.
- For enums, you can specify the available choices, and the admin will view it as a drop down.
- You can add more users to the admin, and specify their permissions.
- And a lot more. See http://docs.djangoproject.com/en/dev/
I hope this wets your appetite for learning Django.
The home page. I had to remove everything that reveals the application. As you can see, Django admin also stores a history of changes.
This is the view for students. I customized it a little bit to view students' emails, but you can customize it more.
This is the form to change the student. The "UserId" is a foreign key to the "Users" table. Django admin is smart enough to grab them for your. If you want to add a new user, you can add it by clicking the small "+" sign beside the drop down list.
This shows the screen for users in the "Auth" application (which is added by Django itself). This shows a more advanced listing: you can select the columns that will be displayed, with sorting. You can add filters (on the right), and you can add search also.
This is the form for editing users.