CodeIgniter directory_map error during FusionInvoice install

I ran into an issue while installing FusionInvoice recently. I Googled the error  with no luck. It took me a bit longer than I’d like to admit to fix it so I hope I can make it easy for someone else.

FusionInvoice is a self hosted invoicing/tracking web app. I needed something simple to track the small amount of hosting I do on the side and this fit the bill perfectly.

While installing I kept getting blank options for the language list. I went in a started poking around in the code. I’ve never worked with CodeIgniter before but with it being a MVC framework, it was simple enough to find my way around. I set the languages variable by hand to get past that step, but more issues came up which were a result of the underlying problem.

On my Linux server by default I setup all directories for web apps with the permissions 711. Which means owner: read write execute, group: execute and other: execute. This allows a web app to access files in a directory and sub directories, but does not let them list the contents. A small security feature to make things a little harder if someone were to gain unauthorized access via a web vulnerability.

directory_map lists the directories in languages/, and it was failing because it didn’t have necessary permissions.

I haven’t ran into this before in other webapps, so while it is obvious now it was not at first. To resolve this issue change the permissions to 755. You can do this to all directories in the web app by running this in the document root:

find . -type d -exec chmod 755 {} \;

I hope to save at least one person 15 minutes.

No Comments

Symfony one to many relations (embedRelation)

In one of my recent gaming sites, I was trying to find a way to have one game fit in as many different categories.  I am still rather new at Symfony, and heck PHP programming in general, so the idea of setting this up myself was a bit overwhelming.  At least being able to manage it correctly in the backend.  The data structure, thanks to Doctrine, wasn’t that bad to setup.

Anyways, I found an awesome blog post talking about exactly what I wanted to do.  I followed this post step by step, doing slight modifications for my setup, and it worked perfectly!

Check it out here on di-side.com: http://di-side.com/di-side/symfony-embedrelation-one-to-many-doctrine-relations/

No Comments

Ignore URL parameters when caching in Symfony

Most of my new sites I run are running on top of the Symfony framework.  One small annoyance I run into is when caching pages, it will create a new cached file for a URL which includes a parameter that doesn’t affect which page is returned.

For example, on my flash game sites when I sponsor games I use URL parameters to track where traffic is coming from when people click my in game logos/links.  This creates a huge number of cache files that are really useless, as they contain the same info.  This slows down my page load as well, as it essentially ignores my cache and creates a new version each time if someone comes to my site from one of those logos.

I found a blog post by someone who has fixed this issue.  This is a perfect fix for this issue, and I thought I would share the link.

Check it out here: http://www.pyrkosz.pl/Symfony_Ignore_unused_GET_parameters_for_caching.html

No Comments

Good Wireframing Tool to Plan Website Layouts

Wow – that’s all I have to say about this latest discovery.  I have built plenty of websites in my days, and it’s always a struggle portraying what you want your layout to look like to a designer.  You can give them pages of descriptions, but they will always forget something, or not fully understand something you said.

I have discovered wireframing for websites.  I expect most experienced designers would have just laughed, as they have been using these for years.  But for someone like me it’s a great way to sit down, spend 20 minutes to hours deciding how you want your website to be laid out.

There are plenty of wireframing tools out there, which I’ve found out searching Google for a bit.  I wanted to work with a non web based solution, as I can save the output to a Dropbox share and work on it at work or at home.  I have settled on a cool and simple one called Pencil.

If there’s anyone like me who has a good feel for what kind of layout they want, suck with design, and have trouble explaining to designers exactly what you want…this is gift from above.

I hope this little tip for planning the layout of a new website helps you.

No Comments

Quick and Easy Web 2.0 Link

In SEO many times quick and easy is a sure way to get a penalty on your site.  This isn’t always the case though.  There are a few sites out there that provide value while offering a link back to your site.

The site I am talking about right now is AboutUs.org.  It’s a directory of websites where you simply talk about your site.  You can include things such as contact info and a brief overview.

Initially you will find that your link is NoFollow.  Which is the way you tell Google you don’t trust the link.  It’s good that they do this, as you don’t want directories linking dofollow to the many spammy sites out there.  The link can be changed to dofollow with a little bit of work though.

First, you will want to edit your page and update it to contain all the info you can.  A short description, title, tags, and contact info are a great way to start.  Follow these guidelines here: http://www.aboutus.org/How_to_improve_AboutUs_pages

Once you have updated your site you can read this page: http://www.aboutus.org/DoFollow to see what steps you need to take to get the links changed to dofollow.

An example of one of my most recent sites is here: http://www.aboutus.org/ParkingGames.com.  You can see it’s just a basic overview of the site, providing some contact info and a nice little image.

Quick and easy links back to your site are few and far between.  AboutUs.org is a good start to getting the word out about your website.

No Comments

New Parking Games Site Launched

Hello everyone!

I have just recently launched my latest and best gaming portal to date.  It’s dedicated to parking games.  I started with a descriptive domain and added a (IMO) very user friendly website – click here to check it out.  Parking games are a niche of car games, where the goal is to park cars, trucks and even boats.  It’s a pretty interesting niche.  It’s not for everyone, but what niche is?  I am very excited to build the go to spot for parking on the internet!

This site is built on top of the Symfony framework again.  I started with my platform for gaming sites over a year ago now and am very excited to continue to build and improve on it.  It’s fun watching my skills advance, and being able to add any features as I want as I launch more and more sites, and get more experience with the platform.  I’m a huge fan of Symfony and would recommend it to anyone who wants to build some PHP web apps.

I’d be happy to hear any feedback on the site.  And feel free to tell your friends (or kids who may possibly be more interesting playing these flash games) about ParkingGames.com.

No Comments

How to fix grub error after 2 disk failures in a raid1 in Debian

I was recently lucky enough to get two out of two raid1 disk failures on an important server running Debian. These two disks were the only disks in the machine. So I had to replace the two disks in a machine quickly…

I’m not sure if it was firmware or what, but these two SSDs went out at the same time. Which was lovely. One failed a bit harder than the other. I was lucky enough to be able to replace one, sync the raid, and then swap out the other. I had very little downtime and it could have gone a lot worse.

One symptom I found later while updating my system is that update-grub fails with the following error:

Generating grub.cfg ...
/usr/sbin/grub-probe: error: no such disk.

After doing a lot of digging on the net, I found out the solution to this is stupid easy. Simply reconfigure the package!

# dpkg-reconfigure grub-pc

I will admit I didn’t look into this enough to find out exactly what the problem was. I know it had to do with replacing both disks in the machine. I hope this simple solution helps someone else out there, and hopefully they won’t have to dig around for 20 minutes either.

No Comments

Resize ext3 partition on a VPS live!

Many times you will purchase a VPS and go with the lowest resources you think you can get away with.  As your website grows you may find you need to add more disk space.

This can be very easy to do with some basic tools in Linux.  I will show you how to quickly and easily do this in Debian – but you shouldn’t have issue doing this in any other distro that includes fdisk and resize2fs.

First, you will need to have your disk expanded in the backend.  This will have to be done by the VPS provider.  Once the disk has been expanded you will want to reboot the machine.  This will allow fdisk to see the larger disk.

Before reboot:

# fdisk -ls

Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c64d7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          12       96358+  83  Linux
/dev/sda2              13         498     3903795   82  Linux swap / Solaris
/dev/sda3             499       10443    79883212+  83  Linux

After reboot:

# fdisk -ls

Disk /dev/sda: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c64d7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          12       96358+  83  Linux
/dev/sda2              13         498     3903795   82  Linux swap / Solaris
/dev/sda3             499       10443    79883212+  83  Linux

The next step is to delete the current partition, and recreate it with the new larger size. Do not worry, the process of deleting a partition doesn’t actually remove any data, just the reference to the partition.

So run:

fdisk /dev/sda

Where sda is the disk in question.

The first command to run is: p which simply prints the current partition table.

Command (m for help): p

Disk /dev/sda: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c64d7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          12       96358+  83  Linux
/dev/sda2              13         498     3903795   82  Linux swap / Solaris
/dev/sda3             499       10443    79883212+  83  Linux

Make note of the start number for the partition you want to expand, which is sda3 and start #:499 in my case.

So next delete the partition:

Command (m for help): d
Partition number (1-4): 3

Next, create a new partition using the same starting cylinder, but change the end to be the size you want the disk to be. Which in my case is as big as it can get (or 19581):

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (499-19581, default 499): 
Using default value 499
Last cylinder, +cylinders or +size{K,M,G} (499-19581, default 19581): 
Using default value 19581

I just hit enter for the first and last cylinder, as it defaults to the next available one for the start, and the last for the end.

Next, you will have to reboot the machine. This lets the machine re-read the partition table.

reboot

Now that the partition has been expanded, it is time to resize the ext3 file system. This may work on ext4, but I haven’t tested it. This is a simple one line command:

# resize2fs /dev/sda3
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/sda3 is mounted on /; on-line resizing required
old desc_blocks = 5, new_desc_blocks = 10
Performing an on-line resize of /dev/sda3 to 38321049 (4k) blocks.
The filesystem on /dev/sda3 is now 38321049 blocks long.

This is pretty much magic in my book.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             144G   65G   73G  48% /
tmpfs                 1.5G     0  1.5G   0% /lib/init/rw
udev                  1.5G  104K  1.5G   1% /dev
tmpfs                 1.5G     0  1.5G   0% /dev/shm
/dev/sda1              92M   38M   49M  44% /boot

Beautiful and simple isn’t it? That’s all folks!

No Comments

Linking secondary Google AdSense domain to Analytics

I have recently started exploring the new Google Analytics interface and realized how powerful the AdSense integration into Analytics was.  I wanted to integrate AdSense and Analytics on all my properties.

I had no problems setting up the primary domain, but noticed any secondary domain would not report the correct revenue.  It seems it a fraction of the total, but per site the actual percentage was pretty much the same.  After making a post on the Analytics support form and digging around I finally have found a solution that works.  It turns out I was only seeing the earnings for the first ad unit on the page.

This thread here fixed the issue for me.  I hesitated to even try this solution, as the post is from 2009.  After running out of options I implemented the fix they suggested and it worked great. Let me explain the issue and fix in more detail.

When you setup secondary domains in Analytics you are instructed to add this code to the top of the page:

<script type="text/javascript">
window.google_analytics_uacct = "UA-XXXXXXX-XX";
</script>

What this does is tell AdSense what your Analytics profile is in order to properly report the data. It appears that the variable window.google_analytics_uacct is only applied to the first AdSense ad unit on the page, and after that it is reset.

The fix is to modify your every AdSense ad unit code on the page by adding the window.google_analytics_uacct = “UA-XXXXXXX-XX” code at the top. Here is an example of my ad unit:

<script type="text/javascript"><!--
window.google_analytics_uacct = "UA-XXXXXXX-XX";
google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX";
google_ad_slot = "XXXXXXXXXX";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

I’ve only tested this for a couple days, but everything seems to be working just fine.

I hope this helps anyone who is having issues as well.

3 Comments

Increase SERP visiblity in Google with stars

One thing a lot of search engine marketers are always pushing for is increased visibility in the search engine result page (SERP).  Increased visibility traditionally comes from simply increasing your rank.  Or if you’re already at the top site links help a lot.

I’ve started to see results on the SERP including stars by the result.  I looked into it and quickly discovered this happens when including microformats (hReview-aggregate) on pages that display a rating from users.

Here’s an example of what I’m talking about:

You can see this by going to page two of this search: ati radeon review or by following this link.

I’m not sure when Google start including these stars, but I’ve seen them show up quickly after adding them to your site.

You can find more details on the microformats.org site here: http://microformats.org/wiki/hreview-aggregate.

It’s pretty easy to implement these on your site if you’re familiar with coding.  Essentially you want to generate this output based on ratings.

<div>
<span>
<span>Item title</span>
</span>
<div>
<span id=”file_rating”>
This is where you want clickable stars where people can rate, and the rating is shown. Example:
<img src=”/images/star.png” id=”rate_1″ alt=”1.00″ /> <img src=”/images/star.png” id=”rate_2″ alt=”2.00″ /> <img src=”/images/star.png” id=”rate_3″ alt=”3.00″ /> <img src=”/images/star.png” id=”rate_4″ alt=”4.00″ /> <img src=”/images/star_half.png” id=”rate_5″ alt=”5.00″ />
</span>
</div>
<span>
<span>
Average rating here (Example 4.61)
</span>
</span> based on
<span>Total number of votes (Example 33)</span> votes.
</div>

 

Forgive the lack of any indentations, haven’t bothered figuring out a good way to put code in posts yet in wordpress.  Anyways, I hope this helps drive more clicks to your site.

 

Enjoy!

No Comments