Something like an SQL Paradox
I love philosophical problems translated into computer programs. And while reading SQL Cookbook, I thought I had come across another—a form of Russell’s Paradox.
Russell’s Paradox: a Review
You probably remember from logic class that Russell’s Paradox pointed out something very disturbing about naive set theory, namely that it is unclear whether or not the set of all sets not members of themselves are members of themselves. Or maybe you simply remember something about Barbers who shave only men who don’t shave themselves.
Oh, yeah!!! How does that go again?
Imagine a town, Russelltown, where there is a barber whoDoes the Barber of Russelltown shave himself?
By 1, the Barber has to shave himself, but by 2, the Barber cannot shave himself.
So, it would seem that Russelltown has a barber who is not a man—an untenable solution. Where did we go wrong? Something must be wrong with our logic.
The general thought is that something is wrong with our axiomatic system.
SQL Groups as Sets
In SQL Cookbook, the author notes that a paradox arises for SQL groups.
What is a SQL group? A SQL group is a non-empty, distinct set. If you think about any SQL query that uses group by, this should be self evident. SQL groups can’t be empty otherwise it doesn’t really make much sense to call it a group—any nothing could be a group if empty groups are groups. SQL groups must be distinct otherwise we would say that our the database has not identified two sets of rows as similar.
The real problem arises for SQL groups when you consider the two facts about SQL groups in conjunction:By 1, SQL groups cannot be empty, but by 2, SQL groups must be empty. Let’s take a closer look….
Consider the following table:
select * from femaleLogicians
Name
penelope maddy
ruth barcan marcus
susan haack
Consider that we insert several NULLs into the table like this…
insert into femaleLogicians values (NULL);insert into femaleLogicians values (NULL);insert into femaleLogicians values (NULL)
Given this table and the two facts above, what would you expect the following query to return?
select coalesce(name, 'NULL') as name,count(name) from femaleLogiciansgroup by name;
The query would actually return something like this…
This difficulty doesn’t arise by the definition of a SQL group alone; it arises by the definition of a SQL group and through the requirement that NULL values are valid SQL group components. Pretty cool, huh!! I’ll leave the work around solution as an exercise for the reader.
So, this SQL group “paradox” isn’t Russell’s paradox, but the similarity between a SQL group and a set makes one wonder whether it would be possible to create a group of all groups that do not contain themselves in SQL. I don’t believe syntatically something like that won’t work, but supposed your could rewrite the ISO SQL standard to accept such a syntax. Could you, with or without SQL, implement Russell’s paradox as a computer program? At very least, it appears that the problem can (like the problem of substitution into intensional contexts) be implemented using web pages in some way… maybe that will have to be fleshed out in another post.
A Ticklr File
I’ve been playing around with Google App Engine to create something that resembles a Tickler File.
What’s a Tickler File?
“A tickler file is a collection of date-labeled file folder organized in a way that allows time-sensitive documents to be filed according to the future date on which each document needs action.”
Things you can do with a tickler file:An interesting part of GAE has been the Task Queues which come in pretty handy when scheduling things.
TaskOptions taskOptions = TaskOptions.Builder.url("/emailDaylog")
.param("address", user.getEmail())
.param("content", daylog.getContent());
Queue queue = QueueFactory.getDefaultQueue();
queue.add(taskOptions.countdownMillis(DEFAULT_REMINDER_WAIT));
Digg-Style Pagination in Java
public ArrayList getPagingLinks(){
ArrayList pages = new ArrayList();
if (pageCount < (7 + (adjacents * 2))){
for(int i=1; i<=pageCount; i++){
pages.add(i);
}
} else if(currentPage < ((adjacents * 3) + 1)){
for(int i=1; i<=(4 + (adjacents * 2)); i++){
pages.add(i);
}
pages.add("e");
pages.add(pageCount);
} else if(((pageCount - (adjacents * 2)) > currentPage) && (currentPage > (adjacents * 2))){
pages.add(1);
pages.add("e");
for(int i=currentPage -adjacents; i<=currentPage +adjacents; i++){
pages.add(i);
}
pages.add("e");
pages.add(pageCount);
} else{
pages.add(1);
pages.add("e");
for(int i=pageCount - (adjacents *3); i<=pageCount; i++){
pages.add(i);
}
}
return pages;
}
Basically, it creates a list of links to pages determined by the displayCount. If the page number equals the current page or the page number is greater than the page count, then no link will be added, only the page number.
The Passionate Programmer: a review
Creating a Remarkable career in Software Development
by Chad Fowler
![[image]](http://mowser.com/img?url=http%3A%2F%2Fjessirae.com%2Fblog%2Ffiles%2Fpassionate_programmer.jpg)
My own journey as a software developer has been fairly traditional. I’ve spent almost 100% of my career working in j2ee/java, mostly on web applications. One of my own personal goals is to be a java expert/ninja, and so, even outside of work, I do a lot of java related development. A book like The Passionate Programmer is great find for someone like me who is risking putting all of their eggs in one basket by working in a single area. The book is full of suggestions for getting out of your comfort zone, researching alternative career growth areas and growing a career outside of your 9-to-5 job. You may be familiar with a previous edition of the book, unfortunately named My Job Went to India: 52 Ways to Save Your Job.
My favorite part of the book was the “Act on It!” sections that give you suggestions for things you can do now to act on the concepts introduced in the chapter. If you are looking for a springboard of ideas on how to enliven and improve your career as a software developer, this book gives you over 50 concrete actions to move in that direction.
I am so excited about using these suggestions in my life; I have already started with some of them. Of the 50 or so suggestions shared in the book, the following are the ones that really stood out to me.
I definitely recommend the book; it is inspiring and will silence even the whiniest of developers. While reading, you will want to take notes while you are reading or keep a to do list handy.
The Passionate Programmer: Creating a Remarkable Career in Software Development (Pragmatic Life)
Django: first impressions
A month or so ago I was anticipating a move into Django. I started on some of the Hello World tutorials on the django site, and I wanted to share the few observations from my very brief encounter with Python via Django.
Overall, I would be interested in working more with Django.
506 tar xzvf Django-1.1.1.tar.gz 507 cd Django-1.1.1/ 508 sudo python setup.py install 509 python 510 ls -al 511 vi INSTALL 513 django-admin.py startproject Test 514 cd Test/ 515 ls -al 516 python manage.py runserver 517 python manage.py syncdb 518 python manage.py startapp polls 519 cd polls 520 python manage.py sql polls 521 cd .. 522 python manage.py sql polls 523 python manage.py syncdb
Code Reviewing
I wrote this a few months ago when I was doing a lot of code reviewing. There are a number of criticisms of the Code Review, and certainly, a number of review mechanisms that can and should be used in conjunction with some type of human review, such as static code analysis and performance analysis. In this post, I won’t be comparing or contrasting the Code Review to any of these.
Strategies, Questions to Ask and Things to look for
Some code review questions…Tools
My experience with code reviewing tools is limited. The Jupiter eclipse plugin seemed to require too much work on the developers part—generating the request for review, checking in the .jupiter file and review files slowed development down. Monitoring svn check-ins seemed to work moderately well, although it required more work on the reviewer end.
When to do the code review
Ideally, code reviews shouldn’t uncover any larger architectural issues that need addressing. They should expose overlooking coding mistakes. So, ideally there should be no timing problem, that is, you shouldn’t find some large refactor that needs to be done before the code is released. Code should be reviewed after development is finished, but before the functionality is ready for qa.
Double Time
There are several different ways that code reviews can go: the code reviewer(s) can monitor check-ins, developers can request that code reviews be done on their code or the dev team can get together as a group and go over the code line by line etc etc. One thing that has worked for me is employing more than one of these methods. So, developers submit requests for review and I also monitor check-ins.
10 tools every web developer should know
I know, I know – this title sounds like link bait, but I realized the other day that many of the suggestions I make to my fellow developers on how to troubleshoot/debug “stuff” begins by recommending a tool. The underlying theme among all of these tools is that they help you verify, verify, verify!!
So here are some useful things to know how to do as web developer…
1. how to debug with firebugKnowing how to debug with firebug will help you when you want to verify that some piece of javascript is being executed by the browser, when you need to know if a style is actually being applied to a class or that your browser is actually loading a fresh version of some file every page load.
2. how to use tamper data (or another packet sniffer like charles or wireshark/ethereal) :Basically, if you are unsure that the request contains some information, you can verify that using tamper data or wireshark.
3. how to create cookies with web developerKnowing how to set cookies and verify that a cookie exists and that it has some value and applies to some domain is, of course, essential when working with cookies.
4. how to test for multiple user agentsSometimes development and test environments are publicly accessible, which can be a real problem for test from a mobile device without access to your companies intranet. And although testing for multiple browsers may best be done in the actual browsers themselves, problems can expose themselves here.
5. how to navigate your way around jQuery, prototype, yui, moo tools or some other javascript frameworks, including “third party” javascript apis (like video, twitter, url shortner apis)
It is important to know how to use documentation from some javascript framework to confirm that you are writing what you think you are writing.
6. how to write or use an automated functional testing suite, such as Selenium, Quick Test Pro or some home-made solutionThe idea behind all of these tools is to capture some record of page quests and html/css/js on the page and match this up to some pre-recorded (potentially somewhat dynamic) set of html/css/js values.
7. how to configure your ide to help you spot javascript/css/html errorsThe easiest thing you can do for yourself is verify that there aren’t errors in your code before you start testing it.
8. how to test your regexsYou won’t be able to test every possibility, but if you identify the cases that might occur you can test those out
9. how to put your “stuff” in version control easilyIf you aren’t seeing your changes in an environment, it is always good to check and see if those changes are really there.
10. how to troubleshoot client-side performance problemsBasically, the end result of these tools from a very high level perspective is to know where the performance problem is (or is not). For instance, if your page weight is small and there is little javascript “action” on your page, it might be plausible to think slowness isn’t “on the front end”, but is being cause by slowness on the server side.
Remembering what you've written
I have folks at work ask me details about code I’ve written and how it works. Almost always, I have to go back and at least look at what I’ve written before I can even say for sure that I wrote or worked on the code. Isn’t that sad?
This forgetfulness with regard to what I have written is annoying. And I’d like to brainstorm some ideas here about how someone with the same problem might move around it.
WikiWhat other options have I missed here? What, in your experience, has been the best way to document what you have written?
Devchix Task List Android App
This post is to basically explain how the Devchix to do list android app that Nola and I have been working on works. Currently, we are working on Iteration 1 of our plan. Here’s how I understand what we have working so far: In our app, users can switch between 2 activities using the menu option, “Add Task”.
When our app is first opened the first activity that is rendered is the ViewTasks activity. We first start with some setup steps…. we inflate our layout, create our task database and open a connection to that database. We create a cursor that will just represent all tasks that we have put in our database and we call the startManagingCursor method, so that we do not have to do that ourselves.
We get a ListView from our ListActivity; this ListView will be our list of tasks. In our ViewTask activity, we have a subclass class called TaskAdapter, that will help us get data out of our cursor and into our list view. Lastly, we set our TaskAdapter as an adapter on the ListView we just created.
When the user clicks on the menu button, we will see the two menu options whose names we grabbed out of our strings.xml. And because we have implemented the onMenuItemSelected to detect which option the user selects, we the user selects the Add Task option, our second activity will be started where users can enter the name of the task and save the task to the tasks database.
If there are already Tasks in the task database, then TaskAdapter will inflate a new row from the records we get back from our query and then have the TaskWrapper place the contents of the cursor into a Task object. The task object represents has getters and setters for setting the various task fields, which may be overkill right now because we don’t have many fields but as our application grows and expands to do more complex things with task information this may make our code more modular.
Other than creating the table, I don’t believe the methods we have in the TasksDbAdapter class are currently being used. Depending on how we want to clean the code up, we may be able to refactor this class—either move the db creation into the ViewTask activity or move the other queries out into the TasksDbAdapter.
Here’s the link to the Devchix Task List Android App on Google Code.
Atlanta Linux Fest 2009
I attended the Atlanta Linux Fest last Saturday. I only got to stay for two talks, but what I saw was great!
From the Ubuntu Kernel talk given by Pete Graner of Canonical, I learned a couple of interesting things about Ubuntu…
Canonical has teams that work on things other than the ubuntu kernel, including integration for OEMs like Dell and HP, maintaining LaunchPad, and distributing install cds. They are able to maintain a 6 month release cycle for Ubuntu by deciding to only fix those bugs that are truly critical and focusing on the goals decided at the Ubuntu Developer Summit.
Ubuntu One allows you to back up any number of systems into the cloud.
The folks at Canonical have created a version of android that runs on Ubuntu Notebook Remix. It sounded like android uses some of its own version of libraries so a unique version of android had to be compiled to use those libs.
I also saw Kirrily Robert give her Standing Out in the Crowd talk. If you missed OSCon 2009 or the Atlanta Linux Fest, you can check out her talk here.

![[image]](http://mowser.com/img?url=http%3A%2F%2Ffutureperfectradio.com%2Felements%2Fbanners%2FFPR_300250_1.jpg)