Xanax onlineAdderall onlineLevitraviagra without prescriptionadderall onlineadderall without prescriptionPhentermine onlinetramadol onlinevalium online
Dec08

Tab stops on selects and checkboxes on a Mac

By default when you’re tabbing through a form a Mac won’t stop on selects or checkboxes. To fix this open system preferences, and go to the keyboard section under hardware. Click “Keyboard Shortcuts” on the top. On the bottom of that page there is an option for “Full Keyboard Access”. Set it to all controls.

Nov22

Wordpress as a CMS

This tutorial is aimed at developers who just want wordpress to function as a lightweight CMS, that is wordpress will only be used for editing page content.

First install wordpress in whatever directory you want the admin to live. I chose /admin.

Any page that needs to use wordpress functionality you must add this:

require('/path/to/wp-blog-header.php');

This gives you access to wordpress functions that we need:

  • get_page – Get the page data from the database
  • wpautop – Automatically add paragraph tags to page content

To get page content:

$page_data = get_page( 4 ); // Where 4 is the page ID in wordpress

There is a bug in certain versions of php, if you get the error:

Fatal error: Only variables can be passed by reference…

Then use this format instead:

$page_id = 4;
$page_data = get_page( $page_id );

$page_data now contains all of the info for that page, and is ready for use in your templates/views. Check the function reference to see the data you have available to you.

To display post_content use the wp function wpautop.

<?= wpautop($page_data->post_content) ?>

It’s simple!

Oct17

Make the home and end keys work on a Mac

Finally, a way to make the home and end keys work on my mac (only cocoa apps) as they do on my pc. Put this file in /Library/KeyBindings/. Create the folder if it doesn’t exist. The keys will work the next time you open an application.

Oct16

Adding custom tabs to your facebook fan page

I recently had to do some work on a client’s facebook page. They wanted tabs created on their facebook fan page to hold some custom content. Here’s how to do it…

  1. Log in to the account that has admin rights to the fan page and do a facebook search for “fbml”
  2. Click “Add to page” on the top left
  3. In the box that pops up select the fan page you want it added to.
  4. On your fan page, hit “edit page”, located under your photo.
  5. Click the pencil next to the fbml application and choose “edit”
  6. Add your content (you can use normal html) and click “save changes”
  7. To add it as a tab, go back to the “edit page” screen and click the pencil next to your fbml application. Click “applications settings”, and finally “add” next to the tab option
Oct15

Finding a decent text editor for Mac

I recently bought a Mac Mini in hopes of learning to develop for the iphone. I decided to do all my web development work on my new mac for a while, to try and get used to the new OS. On my PC i use notepad++. It has everything I need: built-in ftp, tabbed files, save all open documents, search/replace in all open documents…and it’s free!!! Fine, I can do without built-in ftp, but even after removing that from my required list I still can’t find a decent Mac text editor.

Here’s my rundown:

Coda ($99)

  • No save all open documents
  • No search/replace in all documents

Textmate ($60)

  • no tabs?
  • no tabs? really? No I’m not starting a project!

SubEthaEdit ($43)

  • No search/replace in all documents
  • No save all open documents

BBEdit ($125)

  • Drawer is annoying, tabs are much better
  • No save all open documents
  • No search/replace in all documents

I miss notepad++.

Sep25

Marking mail as unread in the iPhone mail application

Now that gmail offers push for the iphone via google sync I am trying out iPhone’s mail app instead of gmail’s website. An important feature I require is the mark as unread option so I can read certain emails when I get home. I couldn’t find it forever, but finally found it in the dumbest spot. Instead of a menu option you have to open the mail and click the details link on the top right, and then hit “Mark Unread”

Sep09

MySQL custom sort order

Here is a way to return results from a table in a custom order

select id from products where id in (4,5,6,7,8,9) order by field(id,4,7,6,5,9,8)
Jul15

Ridiculous IE6 bugs – Double margin & Disappearing position:absolute near float

Today while working on a layout I encountered 2 of IE’s more ridiculous bugs: Double margin & Disappearing position:absolute near float.

Double Margin Bug

This occurs when you have a left-margin on a left-floated element, or a right margin on a right-floated element. The margin will randomly double for whatever reason. Simplest way to fix it is to put display:inline on the float

Disapearing position:absolute near float

I’m not sure of the exact circumstances for this bug, but if you have absolutely positioned elements disappearing and they are near floats you’ve probably stumbled onto it. I can’t find a non-markup fix for this unfortunately. The best fix I’ve found is to add an element between the absolutely positioned elements and the floats.

Jul05

Downloading torrents at home from anywhere with your iphone

Today i’m going to tell you how to set up your computer so you can easily manage your torrents from anywhere using your iphone.

Download utorrent and enable web ui

Download utorrent if you don’t already have it. In utorrent go to Options > Preferences > Web UI. Enable Web UI. Set a username/password. Check “Alternative listening port”. I set my port to 8080. If you have a router you will have to open up that port to the public. PortForward.com can help you if you don’t know how to do that.

Get a dyndns account

This makes it so you can go to a url like name.dyndns.org to go to your computer instead of having to go to your ip (which can change).

Sign up for an account at http://www.dyndns.com. When you get the activation email click the “Create a dynamic DNS host within our Free domains” link. Hit “get started” and add a new host.

If your router doesn’t support dyndns, you’ll have to download the client so that your computer updates dyndns with IP changes.

Visit your domain on your iphone

Go to domain:port/gui with your iphone (replacing domain and port with your information). You should be presented with a login screen. Input the username/password you chose in the web ui configuration.

That’s it!!!

For a better iphone interface go to http://www.davidraso.com/utorrent-iphone/ and follow the directions

Jun21

Learning Python – Day 2

I’m excited about my new admin interface. Page 2 on the tutorial goes into how to customize the admin. I don’t care about that at the moment so I go to page 3.

Page 3 is about URLs. Django uses a sequence of tuples populated with regular expression -> url maps. Great, this is how I did things in PHP. I add a couple of URLs and move on.

Next it’s time to create my views. I write my first view which simple prints “Hi!”. It works, great. I see that the basics of the template language used in Django are very similar to how I do it in PHP. I port my view from my PHP template to the template in Django.

{% foreach company in category.company.all() %}

Unfortunately this doesn’t work. It’s not looping over my categories/companies/videos. I think it’s because it’s having trouble going backwards with my foreign key relationships.

I find that in order to go backwards you have to do this

{% for company in category.company_set.all() %}

You have to use _set to access foreign key items. This doesn’t work either! I give up on this route and I try the method I use in PHP… creating a giant multi-dimensional array and then looping over that.

This is where I hit a wall. I quickly find out that Python’s version of arrays, called dictionaries, can’t be created like they can in PHP. I don’t like that one bit.

Python doesn’t have a version of

$video['company_id']['category_id']['video_id']['name'] = 'Video Name';

I find some custom classes via google, but Django won’t iterate over them. A couple hours later I figure I need help. I ask a couple of places and everyone suggests that it is possible with Django’s ORM, I just need to remove the ()

I find that you have to do this!

{% for company in category.company_set.all %}

You have to remove the () for functions that have no arguments. Works like a champ. Two minutes later I have all categories/companies/videos displayed correctly. I’m still using Django’s development server though so I have no styles/images, just black test on a white background.

I read somewhere that I should be using mod_wsgi instead of mod_python (I can’t find the source). Using this I get it working with Django pretty quickly.


Good:Django’s ORM

Bad: Python’s dictionary handling not my favorite. I enjoy the way PHP has implemented arrays and how they can be used as lists, dictionaries, stacks, etc. Django’s documentation is thorough, but I get lost in the maze of versions it has.

Notes: I don’t know why I didn’t think of this, but it’s been pointed out to me that you can do this:

a = dict()
a['foo'] = dict()
a['foo']['bar'] = {'this works': 'yes it does'}

That probably would have solved my problem.