Use Simple Terms – Otherwise you are just talking to yourself

I was reading TIMES on an article about IMF chief Christine Lagarde.

Lagarde is a lawyer by training, and it is kind of misfit for a lady to work in the finance industry, with so many men. But it is not just about her background or gender.

At times, she cannot understand the opaque language that the ministry of finance, or the central-bank governor, or whoever is using.

It turned out to be an advantage for her.

She said this to them:

“Stop it. You’ve lost me. You have to use simple terms that people out on the street will understand, otherwise you are just talking to yourselves.”

children talk tin can

How true is that.

Applying the concept to product development, we have to write content in simple language that most people can understand, otherwise we are just writing for ourselves, not the users.

Posted in whatever

Google April Fools Joke 2013

Google takes April Fools day very seriously.

This year, they joked on Google Nose, Treasure Map, shutting down of Youtube, and website visitors from outer space.

Google Analytics ISS

 

Posted in Interesting

New Blog Theme

After 4 years since Just2us.com appeared in the blogosphere, I updated the (WordPress) theme today!

It’s a long overdue update, considering that the Internet moves at such tremendous speed. What I see as a nice blog template 4 years ago, it’s unfortunately out of fashion after a mere months.

A reminiscent of the old days:

Deniart theme

I selected this Responsive theme.

Posted in News

2013 Jan Posts from samwize.com

These are recent posts from samwize.com:

  1. How to replicate iOS Crash feedback from Apple

  2. iOS Developer Tips 2013

  3. It takes 18 weeks to build a mobile app

  4. iOS Devices Cheat Sheet

  5. 7 iOS Custom Popup Views

  6. Phewtick API – Message to any user you want

  7. How to migrate SVN to Git

  8. Tips on making iOS App Icons

  9. Create Async Test with GHUnit

  10. App Engine Unused Discounted Instance Hour

  11. WARNING: Do not use Base Internationalization in iOS 5

  12. GAE or Dotcloud?

  13. iOS Adhoc Distribution with the new Xcode

  14. Which Ad Network to use in iOS?

  15. Python Unit Testing with nosetests

  16. My Custom Localization and genstrings

  17. What is Python’s Lambda and Closure

  18. iOS Accessibility Guide for Developers

  19. The Mythical Team-Month

Grand Total Posts Count: 32 + 19 = 51

Posted in whatever

October Posts in samwize.com

 

Total Posts Count: 17!

Common Git Usage


 

Posted in whatever

This blog has migrated to samwize.com

I have started a new blog at samwize.com, powered by a new, nicer & better blogging framework.

Read on why I made the switch: http://samwize.com/2012/09/10/switched-from-wordpress-to-octopress/

Most of my blog posts will be published on samwize.com from now on. As for just2us.com, I will find another purpose (but existing posts will remain here).

What’s posted on samwize.com in the last 2 weeks:

Posted in News

setuptools – Python tool to distribute and install your SDK/package

setuptools is a tool to download, build, install, upgrade, and uninstall Python packages — easily!

If you just need to install other people’s packages, this is NOT for you. All you need is pypi and knowing the command

pip install some-package

setuptools is for the other way round. It is for developers who want to distribute their SDK/library/packages to those “pip install” developers. There are 2 steps.

 

Step 1) setup.py

Install setuptools. For Mac, it basically downloading and running the egg.

Afterwhich, create a setup.py in the root of your Python project.  A basic template looks like this:

import os
from setuptools import setup, find_packages
 
setup(
    name = "just2us",
    version = "0.0.1",
    author = "Junda Ong",
    author_email = "junda@just2us.com",
    description = "Python SDK for Just2us",
    license = "MIT",
    keywords = "awesome stuff",
    url = "http://www.just2us.com",
    install_requires = ["requests"],
    packages = find_packages(),
    classifiers = [
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2.7",
        "Topic :: Software Development :: Libraries :: Python Modules",
    ],
)

As you can see, setup() basically describes various things about your package, such as:

  • meta eg. author email
  • required dependencies
  • classifiers

With that, you can install your Python package. This is usually what you do when you manually install from source.

python setup.py install

 

Step 2) Upload to Python CheeseShop

But instead of setting up manually, you could make use of Python CheeseShop (pipy) to distribute and setup your package for the Python community. This is the part which connects to pip install.

Firstly, register an account. (Take note: I failed registration a few times, without receiving the validation email. I think that is because of password too short/weak.) The registration is command line based:

python setup.py register

The Python Cheese Shop provides an example of a pypi project to be uploaded.

bdist_egg upload --identity="Andrew Carter" --sign --quiet
bdist_wininst --target-version=2.4 register upload --identity="Andrew Carter" --sign --quiet
sdist upload --identity="Andrew Carter" --sign

 

Versioning

As a bonus, you might want to understand the difference on prerelease and postrelease versions:

  • prerelease
    • 1.2rc1 (same as 1.2c1)
    • 1.2rc < 1.2
  • postrelease
    • 1.2-r2943 (as in revision 2943)
    • 1.2-r2943 > 1.2
Posted in whatever

Sphinx – Documentation for Python

Python is a wonderful language also because of the awesome tools that are available.

One of which is Sphinx. It is like markdown, but even more powerful, with cross referencing of pages and autogeneration of doc for python code.

Start with installing Sphinx.

$ sudo easy_install -U Sphinx

Create sphinx docs in your project.

$ cd /path/to/project/docs/
$ sphinx-quickstart

Write your documentation (eg. quick start guide) in your index.rst. Sphinx uses reStructured Text (a kind of text formatting).  Refer to this quick tutorial and a handy cheatsheet.

Cross reference your documentation. You can across to arbitrary location with :ref:`my-label-name ` or across files with :doc:`my-doc-name`

.. _my-reference-label:
 
Section to cross-reference
--------------------------
 
This is the text of the section.
 
It refers to the section itself, see :ref:`my-reference-label`.

Finally, generate the HTML files.

make html

Lastly, Sphinx can automatically generate your module and classes, using your docstrings. That way, you can write your documentation in your python files (and not again in Sphinx doc). To do that, you have to edit Sphinx conf.py to add the path to your modules to sys.path.

# Load the source for autodoc
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '..')))

With that, you can automatically generate doc for a class.

.. automodule:: mymodule.something
 
.. autoclass:: MyClass
    :members:

This is a short introduction guide to Sphinx. There’s obviously more, with cases of authors writing books using Sphinx!

Tagged with:
Posted in Development

Tips for Developers Upgrading to Mountain Lion

If you are a developer using Python for any purposes (warning: you could be using without knowing), do take heed.

Mountain Lion Kills Python

As discussed in my previous post, upgrading to Mountain Lion will cause many of Python packages not to work. I have found out that /Library/Python/2.7/site-packages/ was cleared! The site-packages directory stores all the third party libraries that you have installed eg. virtualenv, django, pip, mysql, etc..

I have yet to understand the reason for Apple doing that warehouse clearance..

However, a tip for you:

If you are upgrading to Mountain Lion, backup /Library/Python/2.7/site-packages/ to Desktop first. After upgrading, you can copy site-packages back.

 

UPDATE:

I also encountered missing path to mysql and mysql_config commands. Somehow PATH got altered. Here’s the fix:

export PATH=$PATH:/usr/local/mysql/bin/
Tagged with: ,
Posted in Development, How-to

Mountain Lion kills my Python

I upgraded my Mac OS X to Mountain Lion (10.8) shortly after it was released.

Although I don’t believe it is worth upgrading, I still decided to be on ‘technology edge’.

Everything seems fine after about 2 hours of downloading and installing.. until the first kill.

I was working on Python and ran some commands. I did a pip install, and I got an error:

pkg_resources.DistributionNotFound: pip==1.1

And virtualenv is also throwing error:

ImportError: No module named virtualenvwrapper.hook_loader

After some googling, it can be easily fixed (thanks god) with:

sudo easy_install pip
sudo pip install virtualenv virtualenvwrapper

It seems like the Python site-packages were all gone too..

Tagged with: , ,
Posted in whatever
Archives