photo 117_zps5ce27ade.gif
MY THOUGHTS...Short Stories And Poems.

Ongoing work at journalhome

Posted by JournalHome.com

We have been working hard in the background, (well kind of), to bring you some updates.

Things we are working on are

  • New better and cleaner templates.
  • Statistics, who visited, when, where and from where.
  • More stability of our system in general, we admit that we don't always scale very well.
  • A more 2015 home page and less 2005 home page.
  • Adding ssl, (secure website). This is more and more of a requirement.
    • For Facebook
    • For Twitter
    • For <whatever new fancy social site appears> ...

As a reminder, all the work we do here is unpaid and volunteer work, so we are sorry if things take a little bit longer than they really should.

Share |

05h50 - 11/26/2014 - comments {1}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Twitter is back up and running

Posted by JournalHome.com

After a long, long, long delay I have finally re-enabled twitter login. I am still having some issues but I am working hard to iron them out.

For the technically minded amongst us, Twitter has moved to a new version of their API sometime ago, I am the one to blame for not moving to the new version sooner. Thankfully the changes were minimal, (they only moved from 1.0 to 1.1).

Please let me know if you find any issues, (but I am still working on the one or two problems already reported).

Share |

7:13 AM - 8/31/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

SimpleTest vs PHPUnit

Posted by JournalHome.com

When it comes to Unit testing for PHP you have 2 choices. SimpleTest or PHPUnit, (yes I know there others, ...apparently). Both of those are really good at what they do, and I am not going to compare the various features, that has been done already.
What I will do is tell you my story and why I ultimately chose to use PHPUnit.

When I first started upgrading this site I had no unit tests at all, so I chose SimpleTest because it is really simple to use. You need to include a header file and your tests are good to go.
And this was the way it worked for a few months, I had +600 tests and I was very proud of myself.

But as time went by, I had to do more and more 'difficult' tests, like those using mocking, (admit it, when you start from scratch you always leave mocking to the end).

The other issue I have with SimpleTest is the fact that it has not been updated for well over a year, (at the time of writing this of course). PHPUnit on the other hand is updated all the time.
While I am the first to say that updates all the time is not necessarily a good sign, but no updates at all is also not very good, (and might be an issue as newer version of PHP are eventually released).

Also, phpunit has code coverage, this is a big plus for me :), it allows me to spot potential issues, (where I have no tests at all!), and also where I missed something.

So in short, I would say, go for PHPUnit, it is a little bit more of a learning curve at first, but in the long run you will have better tests that are easier to maintain.

Share |

6:08 AM - 4/4/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Eclipse slow/broken DLTK index

Posted by JournalHome.com

I use Elcipse 4.2.x for developing my php websites.
But from time to time it re-indexes the workspace, sometimes it never end 're-indexing'.

An easy solution is to look for a folder in your workspace called "../workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2", (if you don't know where it is, just search for the folder "org.eclipse.dltk.core.index.sql.h2").

Make sure you close Eclipse, rename the folder "org.eclipse.dltk.core.index.sql.h2.old" and restart Eclipse.

The index will be re-created, but once it is done it should be faster.

Share |

5:50 PM - 3/27/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Added instagram shortcode

Posted by JournalHome.com

When you find an image on instagram.com copy the url of the image and you can now add it in your own posts, simply type:

[instagram url=http://instagr.am/p/Ma3ji4OP2d/ size=large] or simply [instagram:http://instagr.am/p/Ma3ji4OP2d/], (you can also use the longer instagram.com url as well if that tickles your fancy).

[instagram:http://instagr.am/p/Ma3ji4OP2d/ size=small] [instagram:http://instagr.am/p/NGnxY2OPyR size=small]

The sizes available are , 'small', 'medium' or 'large', the default value is 'medium'.

Images are automatically linked, but you can add "linkback='false'" if you want to remove the link back.

Share |

6:38 AM - 2/3/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Getting Premature end of script headers in Apache?

Posted by JournalHome.com

The other day I was working on a php script, and, for debugging purposes I placed it in a new folder.
Everything was working fine on the dev machines, but on the live server, it was not working at all.

I kept getting a "Error 500 - Internal server error", I even though there might be something wrong with my script, (you start to believe anything, no mater how improbable it might be :)), so I created a new simple script to rule out any code issues.

  1. // simple code
  2. exit( 'hello');

But even that was not working at all... (so at least I knew it wasn't my code).

I knew that nothing had changed on the server, so it had to be something I just did. I created a new folder and I copied a new script into it.
In the end, the answer turned out to be something fairly straight forward, the directory I had created was created with 0777 permissions, (full permissions to do everything!).
My server itself is setup by default not to entertain scripts with such permissions, hence the 500 error.

Change the permission to 0755 and create a very simple script, (like the one above), if that does not help then your issue might be somewhere else...

Don't get me wrong, that might not always be the issue, (there are many other reasons for Internal server errors), but it is worth it to check the folder/file permissions before you start open heart surgery on your server.

Share |

3:34 PM - 1/20/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Cosmetic changes

Posted by JournalHome.com

I made some small cosmetic changes to your manager section, the 'comments', 'pings' and the 'social' settings, (although I am tempted to move the social settings to its own plugin as this is really what it is...).

Also some of you that want to create a new weblog, (and if you are allowed to Smile), it is now easier and does not throw a bunch of errors as it used to Embarassed.

As usual, I am slowly making my way through some of the cosmetic issues. I have a tentative deadline of June where I want it all done and I want to re-launch the site and there is still a lot of work to do.

If you see anything that is out of place, or you think I need to pay more attention to it, give me a shout...

Share |

5:49 AM - 1/12/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Windows 'Zombie files' that will give you weird errors.

Posted by JournalHome.com

The other day I learned something new about the legacy windows file system. There are still some files/folder that you simply cannot create, files like "COM1, COM2, ..., or LPT1, LPT2, CON, AUX, PRN, and NUL", there might be more.
If you try and create/rename the files to one of those name, you will get a cryptic error like "the specified device name is invalid", "The file name already exists" on other programs like SVN you might even mess-up your repo if you try to force one of those name, (SVN will allow the name and windows will give you the finger if you try to update/clean up the file).

The beauty of those files is that it does not matter what the extension might be, in my case I was trying to create a php file, called "cron.php", but that file name is not allowed, (because of the 'cron').

I found a site that has a pseudo-regex you can use to check for valid files "/com\d(\..*)?, /lpt\d(\..*)?, /con(\..*)?, /aux(\..*)?, /prn(\..*)?, or /nul(\..*)?".

In the end it might not be a big issue, but it is something to bear in mind...

Share |

5:49 AM - 1/3/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Happy new year!

Posted by JournalHome.com

Happy new year to all, I wish you all a blessed and wonderful 2013.

At the time of writing this entry I think there are only a few countries left around the world that are still in 2012, but for the most part we made it!

Personally, 2012 was a great year, full of happy memories, (with a few ups and downs), and I can only hope that 2013 will be even better.

For Journalhome, 2012 was not so great, we had a lot issues with the servers, not that many new features added and no new templates were added at all. But that does not mean that I was doing nothing, (I promise). I have stabilized the code a lot more and 2013 should see a lot more new features that should enhance your stay here. Unfortunatly the background work has to be done before all the 'pretty' stuff can be done.

But, in the end, we all made it, the end of the world came and went, so 2013 can only be better from now on!

 

Share |

10h12 - 1/1/2013 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Merry Christmas everybody!

Posted by JournalHome.com

Just a small note to wish you all a merry and blessed Christmas. I hope you have a great day with friends and family or even relaxing on your own.

If you are travelling, please have a safe journey and enjoy the trip.

I look forward to hearing all your holiday stories when you get back. Myself, I am spending the day with family and friends at home.

Share |

06h04 - 12/26/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Remove duplicate rows in MySQL using php

Posted by JournalHome.com

In some cases you might want to remove duplicate rows in a table, (to create a long forgotten UNIQUE index for example).
There are some tricks you can do using a script.

  1. ALTER IGNORE TABLE yourtable ADD UNIQUE INDEX idx_name (some_col );

This does not always work because you might have an older version of MySQL and also, it could lock your table for ages...

An easier way is to use php to remove duplicates but first you need to do a few things

  1. Backup your database.
  2. Remove all codes that create the duplicate rows in the first place.

Create a script, "duplicates.php"

Create the query and fetch the rows

  1. // connect
  2. $mysqli = new mysqli( ... );
  3.  
  4. // prepare the query
  5. $query = <<<EOT
  6.   SELECT count( * ) cnt, link
  7.   FROM yourtable
  8.   GROUP BY some_col
  9.   HAVING cnt >1
  10.   ORDER BY cnt DESC
  11.   LIMIT 100
  12. EOT;

Then loop around and remove all the duplicates, keep going around until you have nothing else to remove.
We only to 100 items at a time, this is to make sure we don't waste all our execution time getting data.

If the code times out, you can just start it again and again until you see the 'done' message.

  1. for(;;)
  2. {
  3. // (re)prepare the query
  4. if( $result = $mysqli->query($query) )
  5. {
  6. $rows = array();
  7.  
  8. // fetch the rows
  9. while ($row = $result->fetch_assoc())
  10. {
  11. $rows[] = $row;
  12. }
  13.  
  14. // free the result.
  15. $result->free();
  16. }
  17.  
  18. // delete all the values
  19. foreach( $rows as $row )
  20. {
  21. // delete one row less than the total number of rows.
  22. $query2 = "DELETE FROM yourtable WHERE somecol='{$row['somecol']}' LIMIT " .((int)$row['cnt'] - 1));
  23. $mysqli->query($query2 );
  24. }
  25. }
  26.  
  27. // clean up
  28. ...
  29.  
  30. echo 'Done!';


If the code times out then simply re-run it, you will not delete more that duplicates and you will not lock the table, (well not too much).

Share |

5:32 PM - 12/3/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Does session_start() slow my script?

Posted by JournalHome.com

The short answer is , yes, no, and maybe :).

By default sessions are saved in a file in your temp directory, (check out the value session.save_handler and session.save_path in your php.ini file).
This works great for most small to medium site, when a user visits your site a session file is created and/or the data is updated.

The problem comes when the site gets busier and busier, more and more users are trying to create sessions files. The OS is trying to read/write/delete hundreds of files. And in any case, the OS only allows access to one file at a time, so they run sequentially, not in parallel (*).

So, what is the solution?

  1. Don't use sessions unless you have to, calling session_start() every time will cause issues, (check out session.auto_start).

  2. On really big sites, use database, (or something similar), to manage your sessions.

  3. Even if you think you need sessions, think again...

  4. With social sites like OpenID, LinkedIn, Facebook and so on, sessions are used a lot, so don't think you can create a site with no sessions ...

(*) Most of the time you want it to run sequentially, because if both scripts update the $_SESSION data it is not possible to get/set the data to be shared by both, (Well, not without using a database or something similar).

You can handle sessions yourself using session_set_save_handler.

Share |

9:15 PM - 11/28/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Moved to a new server

Posted by JournalHome.com

I made the decision to move to a new server this week, the old one was just too small, (by small I mean not enough memory!).

I could have spent some time trying to optimise the scripts and database but at the rate we are growing I was fighting a loosing battle. I also think there was something seriously wrong with the old server, but my host was not very helpful in that matter.

The down side of it all is the monthly cost of such a server, currently this is coming straight out of my pocket and it will not be long before it start hurting the pocket :). I don't mind doing it a bit longer, I enjoy the work, it is fun... but expensive.

I am looking for a template developer to re-design the site, (this one is 7 years old already!), this will probably cost a lot of money, but with a bit of luck I will find someone who can do it for free. I might even throw in some free advertising or something.
I think with the right design we will get a lot of new blogers.

I also need to design a new 'mobile' site as more and more of our visitors are mobile users.

Share |

6:18 PM - 11/28/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Add cache control to dynamic content in php

Posted by JournalHome.com

Cache control enables you to tell the browser if the contents have changed since the last time they visited.
If nothing changed, then the browser will use whatever data it has in cache and that will save your users a few milliseconds, (and they will a cheer loudly).

For a website like this one, it is important because we have many pages that will no longer change, (archive pages for example, old pages from users that will never return).

First we need to set the cache limiter, the default is to have 'nocache'so you might want to change the value to something like 'public' or 'private'. Read up about the various options before you set it.

  1. // make the data fairly private
  2.  
  3. // start the session.

Now you can go ahead and create your page as you would normally. Don't echo anything out to the browser, rather save it all to a single string.

  1. // create the page
  2. $output = get_my_dynamic_page();
  3.  
  4. // get the time the page was last modified.
  5. // as this is a dynamic page we need to know when last the content changed.
  6. $modified = get_last_modified();
  7.  
  8. // then we need to create a tag for this, (we will use it later).
  9. // create the etag using the output
  10. $eTag = "'".md5($output)."'";
  11.  
  12. // send it to the browser.
  13. header("Etag: ".$eTag);
  14.  
  15. // add the date
  16. $date = gmdate('D, d M Y H:i:s', $last_modified_time);
  17.  
  18. // send the tag+header
  19. header('Last-Modified: '.$date.' GMT');
  20.  
  21. // first we check the check if the etag matches.
  22. if( isset($_SERVER['HTTP_IF_NONE_MATCH']) && $eTag == $_SERVER['HTTP_IF_NONE_MATCH'])
  23. {
  24. // then we check that the modified time matches our own time.
  25. if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time)
  26. {
  27. // tell the browser that nothing changed.
  28. header("HTTP/1.0 304 Not Modified");
  29. header('Content-Length: 0');
  30.  
  31. // no need to go any further.
  32. return;
  33. }// modified time match or no modified time was given.
  34. }// etag match
  35.  
  36. // Tell the browser which size the content
  37. header('Content-Length: ' . strlen($output));
  38.  
  39. // if we made it here, echo to the browser.
  40. echo $output;


The code above should be self explanatory,
First, you create your page based on whatever data you might have, be sure to have a date of some sort so you know when it was changed.
Next you create a unique kind id or code to identify if the page that the browser has on record matches the one you have just created.
Finally, if everything matches, then you are golden and you can tell the browser that everything matches.

Be warned, caching is not the magic bullet you think it is, it will not save you a major amount of time, and you need to support cache for your css/js scripts as well as images.

Also, there are many tools going around telling you what the response headers might be, some of them will keep returning 200 because this is the cache response.
I found that Firebug does return the true response header, (what php developer doesn't use Firebug anyway?)

One final word, if you are playing with

 

Share |

12:55 PM - 11/22/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Catch the fatal error: Maximum execution time of 30 seconds exceeded in PHP

Posted by JournalHome.com

I was looking at an issue this morning where the code was timeout in certain situation.
While I could understand the reason for the timeout I was wondering if my code could catch if/when it happens.

Using php5 I can easily test if the error is caught.

  1. // the function that will handle the shutdown
  2. function shutdown()
  3. {
  4. if($a==null)
  5. echo "No errors";
  6. else
  7. print_r($a);
  8. }
  9.  
  10. // Register for shutdown, called when there are no errors and/or there is a timeout issue, (or any fatal issues).
  11.  
  12. // change to 1, default is 30 seconds.
  13. ini_set("max_execution_time",1 );
  14.  
  15. // do nothing for longer than 1 second.
  16. sleep(3);

I then went one step further and logged the error to the database without any problems.

So it seems that the timeout does allow you to catch the execution timeout then do some work.

NB: If you get "No errors" it means that changing the timeout did not work. This is not impossible as certain hosts do not allow certain ini_set values.

Share |

1:56 PM - 11/21/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Automatically close comments after ... days

Posted by JournalHome.com

Hi,

I added a new option to close comments after a certain amount of days.

Comment options.

Go to your weblog and select > Comment settings, toward the bottom you can now select to close your comments after xyz days.

Because of the number of blogs we currently have I had to choose a default behavior, so now all comments will close after 14 days of been published.

You can of course change those settings.

Let me know if you have any issues.

Thanks

Share |

9:06 AM - 11/8/2012 - comments {1}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

New update happening

Posted by JournalHome.com

Hi all,

I just did a major update, (version 3.38 if you must know). It gets rid of the last of the 'bad' code that was left behind from the original developers.
It has been quite an uphill battle to keep the site up and running while getting rid of all that legacy code.

I can now proceed with the 'look' of the site. I have 3 major projects and 1 ongoing one, that I can now concentrate on

  1. Create a new template for this site, the current look of the site is 7 years old. It has to go.
  2. Create a 'mobile' template for mobile visitors.
  3. Add new templates, (I still want to use the hundreds of free-to-use that are lying around).
  4. Add more features to the current blogs.

Unfortunately #3 is probably take the longest to implement.

I'll spend the week-end pouring over the logs to see any errors reported, but if you see something wrong, just drop me a note and I will update it asap.

Share |

6:05 PM - 11/3/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Database issues/down [resolved]

Posted by JournalHome.com

Hi, 

Yesterday we had a small issue with the database, (the cached data to be exact).

This caused the site to missbehave for over an hour as it could not cache any data, but this has now been resolved. For about an hour after that, while the cache was been rebuilt, the site was running a bit slow.

All should be back to normal, but please let me know if you can still see an issue.

Sorry about that,

FFMG

Share |

5:56 AM - 10/20/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Login to Journalhome using foursquare

Posted by JournalHome.com

I just added a new way or login-in or creating an account, if you have an foursquare.com account then you can simply link to it by pressing the “Connect to foursquare” button.

 

If you already have an account here, fear not, just log-in as usual and then click on the button and, (after you authorise Journalhome.com), we will link both accounts and you will be good to go.

 

So you can now login via, Twitter, Facebook, Foursquare and Linkedin.

 

As always, if you have any issues, please let me know.

Share |

10:36 AM - 7/21/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

Updated template "Midnight Snack"

Posted by JournalHome.com

Midnight SnackI updated the Midnight Snack template. This is a very simple template with no plugins and no calendars.

Have a look at the example site and tell me what you think Smile

Share |

4:49 AM - 4/29/2012 - comments {0}

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
Last Page Next Page
Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Description

Hello I am a wife and a Mother of two adult children and a Grand-Mother of four beautiful Grand-Children.I have been married 47 years. I like to paint, read, do crosswords and dabble with my pen, writing my thoughts in a journal and trying to write the odd poem or prose.

A MOTTO I LIKE TO LIVE BY IS...

LOVE ALL, SERVE ALL, HURT NEVER, HELP EVER.

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting


Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting


Home
User Profile
Archives
Friends
My Wall
IFAW
G J DESIGNS
DAWN_EE
DAWNIE
THE CELTIC CONNECTION
THE PAGANS PATH.
RELIGIOUS TOLERENCE.
Religions, Faith Groups, and Ethical Systems
TOLERANCE ORG: .........WHAT IS ISLAM?
MARTHA WAINWRIGHT
John Williamson, Aussie Singer song writer
Dinakara rao. CO.UK BLOG.
Dinakara rao. TAG WORLD.
ASPHODELIA, Office Troll.
ASPHODELIA, Office Troll.
Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting



Recent Entries
- Give Me Daisies...
- SPOKEN BY A WISE MAN!
- THE VENTRILOQUIST AND THE BLONDE...
- AH! SCHOOL TESTS...
- WORDS OF THE DAY...
Photobucket - Video and Image Hosting

Photobucket - Video and Image Hosting


Friends
- <%FriendUsername%>