He is how to connect a USB drive to a DNS-323.

Essentially,

  • wget usb-storage.ko
  • insmod usb-storage.ko
  • mkdir /mnt/usb1
  • mount -t ext3 /dev/sdb2 /mnt/usb1

You can find out what device was attached by looking in dmesg after plugging in the device.

# Build Notes

If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:

https://github.com/mxcl/homebrew/issues/issue/2510

To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:

http://www.postgresql.org/docs/9.2/static/install-procedure.html

# Create/Upgrade a Database

If this is your first install, create a database with:
initdb /usr/local/var/postgres -E utf8

To migrate existing data from a previous major version (pre-9.2) of PostgreSQL, see:

http://www.postgresql.org/docs/9.2/static/upgrading.html

# Start/Stop PostgreSQL

If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.2.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
cp /usr/local/Cellar/postgresql/9.2.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Or start manually with:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

And stop with:
pg_ctl -D /usr/local/var/postgres stop -s -m fast

# Loading Extensions

By default, Homebrew builds all available Contrib extensions. To see a list of all
available extensions, from the psql command line, run:
SELECT * FROM pg_available_extensions;

To load any of the extension names, navigate to the desired database and run:
CREATE EXTENSION [extension name];

For instance, to load the tablefunc extension in the current database, run:
CREATE EXTENSION tablefunc;

For more information on the CREATE EXTENSION command, see:

http://www.postgresql.org/docs/9.2/static/sql-createextension.html

For more information on extensions, see:

http://www.postgresql.org/docs/9.2/static/contrib.html

# Other

Some machines may require provisioning of shared memory:

http://www.postgresql.org/docs/9.2/static/kernel-resources.html#SYSVIPC

To install postgresql (and ossp-uuid) in 32-bit mode:
brew install postgresql –32-bit

If you want to install the postgres gem, including ARCHFLAGS is recommended:
env ARCHFLAGS=”-arch x86_64″ gem install pg

I ran into a stubborn little problem with an nginx, uWSGI, Flask stack. We needed to support sending requests to the application using either the FQDN (fully qualified domain name) or just the sub-domain name. For example, sending a GET request to the absolute domain name at http://myserver.mydomain.com/ vs. the relative domain name at http://myserver/. Both of these should work if you are within a network that can resolve myserver to myserver.mydomain.com.

The problem is that Werkzeug which handles Flask’s routing request URLs to views, is very particular. The request hostname must match the SERVER_NAME configuration in Flask. As a result, if you have the SERVER_NAME set to ‘myserver.mydomain.com’ it will throw a 404 if you send your request to http://myserver/, even though the application successfully gets the request because the network, nginx and uWSGI are all smart enough to know that they are the same thing.

Digging through the Werkzeug source I found the following:

    if 'HTTP_X_FORWARDED_HOST' in environ:
        return environ['HTTP_X_FORWARDED_HOST']
    elif 'HTTP_HOST' in environ:
        return environ['HTTP_HOST']
    result = environ['SERVER_NAME']
    if (environ['wsgi.url_scheme'], environ['SERVER_PORT']) not \
       in (('https', '443'), ('http', '80')):
        result += ':' + environ['SERVER_PORT']
    return result

At first I was trying to set the SERVER_NAME WSGI param in nginx but as you can see from the above, it falls down through HTTP_X_FORWARDED_HOST, HTTP_POST, and then finally SERVER_NAME.

Here is the new server section of my nginx config:

    server {
        listen 80;

        server_name myserver.mydomain.com;
        charset utf-8;
        index index;

        location / {
            uwsgi_pass  unix:///tmp/uwsgi.sock;
            include     uwsgi_params;
            uwsgi_param SCRIPT_NAME '';
            uwsgi_param HTTP_HOST $server_name;
            uwsgi_intercept_errors on; # let nginx serve error_page
        }
    }

Now everything works. I can request using either the sub-domain or the FQDN.

This is yet another outline of how to setup vim to be a world class editor for professional development. If done right, vim is more powerful, faster, and will make you more productive than any feature laden IDE.

This repeats much of what can already be found on many sites on the internet but this is my attempt at writing down the steps to setup vim for my liking so that I can repeat it. Also, this is very much a work in progress and a living document.

  • install the latest of MacVim or gvim if a Linux user (and ensure that python and ruby support is compiled in for later plugins by adding the following switches to configure: –enable-pythoninterp –enable-rubyinterp. MacVim will come with these out of the box.)
  • install pathogen to manage all subsequent plugins
    Now you can just cd into .vim/bundle and clone things from git. For example cd ~/.vim/bundle
    git clone git://github.com/tpope/vim-fugitive.git
  • install fugative for git integration
  • install command-t for easy file opening (notes: requires ruby support – see notes above. Also, once git cloned you must read the README.txt file because the files must be compiled. Finally, I find this to be a faster way to open files on disk than a filesystem explorer like NERDTree)
  • install ack.vim to have access to ack directly in vim (see Ag below … it is superior)
  • install ag.vim to have access to ag directly in vim (need to first install ag via brew install the_silver_searcher)
  • install vim-javascript for better auto indentation
  • install jslint.vim if you are doing javascript
  • install taglist.vim (requires exuberant ctags – brew install ctags-exuberant – this will allow you to press ctrl-p to do command completion as well as :TlistToggle to get a code structure viewer – but I couldn’t get it to work)
  • install the colour scheme vividchalk.vim (a black background theme)
  • install the colour scheme mayansmoke (a pale, less harsh on tired eyes theme)
  • install flake8 for syntax checking and PEP8 gestapo-ing (note requires python support – see note above and you must first pip install flake8)
  • install powerline for the most kick ass status line (must do brew install fontforge) – read the fontpatcher/README.rst file to get the proper font – note that I have had a hell of a time installing fontforge on OS X Mountain Lion. And if you want a super nice font try Source Code Pro. You can find a Powerline version of this font in github. It is an Adobe font and they give instructions on how to install on Mac OS X. On Linux just git clone the powerline compiled version from github into your ~/.fonts directory. You can find out the official name of it in Linux’s character map utility

Overall this is a good list from over on Quora

After reading Dave McClure‘s blog post, late bloomer, not a loser. (I hope), I couldn’t help but feel that it was a little like reading a supermodel complain about feeling fat and ugly. Nobody wants to hear a supermodel complain about feeling fat and ugly, with the exception of maybe other supermodels (hence Josh Stein’s tweet of the post.)

I don’t know Dave McClure personally but wikipedia describes him as “a prominent angel investor based in the San Francisco Bay Area.” That description and the mere fact that Dave McClure has a wikipedia page suggests that he is a pretty damn successful guy. Therefore, his post bemoaning his lack of accomplishments comes across as disingenuous. Given his age, the post is obviously his reflection on the first half of his life and his admission that he has not lived up to his own internal expectations. I can respect that. He is my contemporary and I have had those very same feelings. But I found the tone of his post horribly off.

I am guessing that my net worth is considerably less than Dave’s and I would never write a post saying I have only made “a little bit of money.” Even at my net worth (read not zero) I know that I am extremely fortunate in comparison to the vast majority of people on this planet. But I don’t live in Silicon Valley. It must be hard to have perspective when your neighbours are Mark Zuckerberg and the like. Dave is still maintaining that he is not rich but I have a hard time believing him.

I don’t begrudge Dave his ambition and nor do I want him to “settle” for what he has already accomplished (which is a hell of a lot.) And I definitely don’t hate him. If he ever comes to Vancouver I would gladly buy him a beer (apparently he likes beer.)

I understand that great things only come from people pushing themselves to become great. We should all strive to be our very best but some perspective wouldn’t hurt either. Therefore, I can’t wish Dave luck. I would like to reserve my luck wishing to those who truly need it.

Here is a way to test if your startup’s idea/product is viable:

- can you describe it one very short and succinct sentence?
- can you describe the value it provides users/society in one very short succinct sentence?
- stripped of all fluff (bells, whistles, and whiz-bang things that are purely there for marketing purposes) is it still valuable?
- stripped of all fluff can you differentiate it from competitors? (again, in a very short, succinct sentence)

I am a believer in minimum viable product (MVP). Valuable ideas and or products can express themselves in minimal viable product form. Others can not. And that is it’s essence.

I have heard the argument that minimal products can not compete because, in general, the bar has been raised too high for web applications. The argument against MVP follows that a product must have polish to be successful. Yes, a product must have polish to be widely accepted, but what we are searching for is merely a viable product. This is the proof that it provides value. Therefore, don’t waste your time trying to build the Taj Mahal because you may very well just be putting lipstick on a pig.

Far too often people go about creating a startup simply because they want to create a startup, not because they actually think they have an idea that is viable. Now, I don’t actually have anything against this approach, and in fact, I encourage it if you have the time and have nothing to lose. However, do it to learn how to create a startup, not because you think you will become the next Mark Zuckerberg. And here is the formula:

  1. throw something against the wall
  2. see if it sticks
  3. goto 1

Well, it looks like the final nail in Microsoft’s coffin is not far off. They are now resorting to suing their competition rather than say, oh, out-competing. Brian Proffitt’s article on IT World offers up the gory details.

I loved this quote from one of Microsoft’s weasels councils:

Their refusals to take licenses leave us no choice but to bring legal action to defend our innovations and fulfill our responsibility to our customers, partners, and shareholders to safeguard the billions of dollars we invest each year to bring great software products and services to market.

I took the liberty to translate the double-speak into English:

Their refusals to be extorted into buying meaningless licenses leaves us no choice but to use our ill gotten gains from years of monopoly rule to financially punish them by dragging out meaningless legal claims in the courts until such time that they relent into paying us for nothing or we bankrupt them. We must defend our lack of innovation so that we can continue to stifle technological advances and continue to sell our shitty software under long-since-dead per-seat pricing models to the unsuspecting corporate yes-men and slack-jawed middle managers that are our life’s blood.

The D-Link DNS 323 is an extremely affordable SAN solution for a home or small business network.  And since Bonjour support has been cooked into firmware version 1.09 it is now even more useful for Mac users.  However, out of the box it still cannot be recognized by TimeMachine as a valid backup drive.  Infuriating to say the least, however, with a bit of time and perceverance it is possible.

Firstly, you will need to fun plug your DNS 323.  Excellent instructions are found at the DNS323 Wiki site which is an excellent resource for all your DNS 323 hackery needs.

Secondly, you need to add AFP support.

Lastly, do the following command on the command line to get TimeMachine to recognize network drives which it does not do by default (really Apple?  Why?!?):


defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

That’s it.  You should be able to point TimeMachine at your DNS 323 and you are good to go!

Note that you used to have to trick the Mac into using the SAN as a backup drive but I did not find this to be the case with my latest setup, but if you are having trouble, read A Poor Man’s Apple Time Capsule.

UPDATE:

Lion breaks the capability to use Time Machine with the DNS-323 apparently due to some incompatibilities with the versions of AFP. However, if you upgrade your fun_plug to version 0.7 (the latest at the time of this writing) it has the latest version of netatalk (2.2.x) which is suppose to support Time Machine in Mountain Lion. Note, however, that the version of dbd that comes with fun_plug 0.7 is a bad build and will cause segmentation faults. It is explained in this post and there is a link to a version of DB5 that does not cause problems.

And all of the above will just allow you to connect via Command-K to the server but still won’t expose it to TimeMachine. For that you have to do all the twiddly bit explained here.

Here are some gory details of Mountain Lion breaking Time Machine with DNS-323

 

 

 

 

 

 

 

 

 

 

© 2013 rootsmith blog Suffusion theme by Sayontan Sinha