Write about
* Importing emial to thunderbird
* ps pic
A Blog of random stuff, to improve writing skill.
* Importing emial to thunderbird
* ps pic
As the saying goes, time flies when your having fun. Well that is true of course, and everyone loves to have fun, but isn’t this far worse; time flies when your working hard. But wait a minute, everyone tells me I must work hard most of the time. I even feel like I must work hard most of the time, so does this mean time is going to fly most of the time?
Well yes it does, that’s exactly what it means. When I concentrate a lot I almost completely loose track of time passing. The result of this is hours, days, weeks passing by really quickly. The more we notice time passing, the slower time seems to go by. This isn’t a great scenario because when we’re noticing time pass, we tend to not be working, and not be eating.
Feeling bored? Feel like procrastinating the day or night away? Feel like doing something with almost absolutely no point for hours on end? Feel like working on something for hours that adds no real value to your life or existence in any way what so ever? (Wow, that sounds like…… Wow)
Well then thisissand.com is just what you need. You can create all sorts of wonderful designs, provided they are comprised of strange pyramid shapes and you don’t mind it having a sandy texture. I do find it quite amusing though, the way the little granules of sand tumble down my monolithic grand sand pile. I must say I have created some rather awesome pyramids, consisting of many psychedelic stripes and colours.
The aspect of thisissand.com that intrigues me the most the is scripting going on behind the scenes, I’d like to have a look at that Action Script! The way people recreate physics on objects using programming interests me greatly.
End.
I found some pretty kewl free open source mind mapping software. I am quite the fan of mind mapping, I like to keep track of what I am thinking on a subject and to allow me to reiterate on my ideas and thoughts. This is what mind mapping allows.
The software I found is called Freemind. Its really simple to use, it allows you to focus your thoughts on the actual idea or problem you are trying to map.
I had been looking for free software that would allow me to draw lovely diagrams and flow chart type things, to aid me in my software and project planning adventures. Well I found something that is usable. It’s called Dia.
Dia is “A program for drawing structured diagrams.” Its open source, which is awesome. It could do a better job at anti-aliasing.. but otherwise it’s quite impressive. Now I have no idea what a diagram drawing application, at it’s best, can be. That is to say I have never used Microsoft Visio. So my views may be slightly primitive. Dia does seem to do what I need it to though, I can edit the squares and arrows and stuff all I need to, draw custom shapes and draw nice curving arrows too! There are tons of other diagram sheets, for making all kinds of diagrams!
Anyway, if you are looking for a nice diagram application that is free try out Dia
At this time, I believe the most common used resolution on the internet is 1024×768 (I hope that changes… soon). And I have read the best website width for a website designed for 1024×768 is 960px, which seems pretty good to me!
So how is this easily done? How can I create the 960 px wide block and center it in 2 steps?
You can now add guides to show you where your websites boundaries are.
Are you one of the many many geek types who think Notepad is awesome? You should try Notepad++ it is even more awesome!
You can use Notepad++ for everything you used normal Notepad for, some of the great things about it include; tons of plug-ins, syntax highlighting for just about any programming or scripting language you can think of, and one of my favourites; the FTP plug-in! This plug-in is awesome, you can login to an FTP server and start to edit files as you please, the files are stored locally in a temp location and the remote version is updated on save.. AWESOME!
For a project I am currently working on I wanted to write code to plot items in a circle. I knew I needed to use trigonometry I just didnt know how to use it.. at all. I left school before (bad idea) I learnt trigonometry. I was also under the impression that it would be really difficult, however this is most certainly not the case.
I did a quick google search on trigonometry and action script, within 2 seconds I had found the perfect article; Trigonometry and Flash. This article told me everything I wanted to know, within an hour I had created the code in my application that I needed.
I reccomend this article to anyone, it’s awesome. Trigonometry and Flash
Sometimes it can be difficult to debug AJAX applications, because it is asynchronous in nature the response is not normally displayed unless you provide provisions otherwise. Creating debugging systems such as debugging code, places to display the debugging information, etc, can be time consuming and detracts focus from the job at hand.
The method described below does not only apply to AJAX but to Flash and Flex as-well, it can be very helpful any time you are sending and receiving HTTP requests, synchronously or asynchronously.
A really simple and easy way to get debugging information; is to monitor the HTTP requests coming and going when you are sending your AJAX requests. So what’s the easiest way to do this? Why install Firebug of-course!
The NET tab in Firebug allows for monitoring of the coming and going requests in real time. When sending a POST request you can view the post data being sent, you can also view the server response. For instance if your request called hi.php and sent the post data; “say hi” then hi.php replied with the data “Hi from hi.php!”, Firebug would display the “say hi” post data and also the “Hi from hi.php!” response.
Firebug also offers excellent and intricate benchmarking facilities which allow you to optimize your web pages to a great extent. Anyone who doesnt use Firebug should start to use it right now!
This is how I create a Singleton class in PHP.
A Singleton class can only be instantiated once. There can only ever be one copy of the class in existence in your program at one time. That is to say, there can only be one object of the type of the Singleton class, in your program.
Static class vs Singleton class
A Singletons member methods or properties can still be accessed via the -> operator, however a static member can only be accessed using the :: operator. The reason behind this is because a Singletons class is still instantiated, the new keyword is still used, with a static class it is never instantiated you just access the methods and properties.
A static class has no initialization, a static class behaves more like a library of methods then an actual object created from a class.
Below is a very simple Singleton class, to instantiate it you call $obj = ClassName::instance() . This will assign the single object to the $obj variable, the instance method returns the object.
You can still initialize data within the class because you can still use the constructor. The instance() method calls the constructor.
class ClassName
{
private $VarName;
/*
* The reason the constructor is a private method is to
* stop a new copy of the class being instantiated.
*/
private function __construct()
{
}
/*
* Creates a single instance of the class and then returns it
* if an instance already exists in the static $instance var then it returns that instead
*/
public static function instance()
{
/* When a variable is declared as static it will retain its value even after the function
* where it was defined, goes out of scope.
*/
static $instance;
if ($instance == NULL)
{
$instance = new ClassName;
return $instance;
}
else
{
return $instance;
}
}
private SomeFunction()
{
}
}
I have been thinking about ways to create fast and responsive RIA’s and AJAX doesn’t seem to be able to cut it. Therefore I have been checking out Adobe Flex, it does seem very impressive. I read something about expensive server extensions, I’m hoping I can plugin our own backend to work nicely with Flex otherwise I may have to stick with AJAX.
One awesome thing I read about is the ability to open Sockets with Action Script, and transfer data in any format over TCP without using HTTP, even compressed data. I wonder what advantage that would give exactly.
I upgraded my N80’s firmware recently from version 4.x to version 5.x the upgrade was painless using the Nokia Software Updater. I couldn’t reinstall the programs I had been using before, I was using S60 Spot On and NSysInfo, I think I’ll have to re download them.
But anyway I’ll try list some of the changes I have noticed:
While there are not many new apps or new features, the usability has improved. This firmware is definitely worth upgrading to.
For quite a while now I have been having problems browsing various websites. I have had the most trouble browsing sites related to Google. I am not exactly sure what the problem is my router doesn’t loose sync, it doesn’t loose connection the the gateway either.
The problems are not restricted to Google sites, but 99% of the time it is international sites, this might have something to do with the fact that I mostly browse international sites though. Google Analytics and Google Maps are a nightmare to use, a page will just sit loading for ages with nothing happening, the activity light on my router doesn’t flash but just sits there happily and steadily glowing green. I have to click on what ever I last clicked on again and hope that the page will load this time round. This is beyond irritating I assure you.
I did a Line Quality test at DSL Reports. I saw something interesting, on the 2 IPs closest to my IP there was 4-5% packet loss. Another interesting thing is that whenever I ping Google, I normally end up with 1 packet being lost. If I flood ping with 100 packets, I get 1 packet lost, if I flood ping with 20 packets, I get one packet lost. Sometimes I get a lot higher packet loss (60-80%) but most of the time I get this 1 packet being lost, would this be enough of break a request sent by my browser? Would this single packet being lost be the reason my browser sits ‘transferring from google.com’ for 10 mins to infinity and my router’s activity light sits completely not blinking? If so how can I find this out?
Anyway one of the support staff at the ISP I use said I have high noise on my line and my connection keeps dropping due to port errors. This does seem like it could be the problem, I think this because of what I saw on the DSL Reports Line Quality test. Specifically on the ping plot, all the lines will be full, then all of a sudden one will be empty, then the next one is full again. Maybe this is where my line has dropped. Maybe this is where my request is being broken. Maybe. I have logged an ADSL fault with Telkom so I will have to see how that turns out, I hope they send a technician out sometime soon. I did log it online as I didn’t feeling like sitting on the phone listening to the same sample of the same 3 songs for 30 mins, and then going through the whole unplugging and plugging in again of my router and telling them where the power is plugged into (?) and telling them where the phone line is plugged in and what lights are on etc etc.
And this is the end of my completely uninteresting post on my current ADSL problems!
I thought a nice sliding accordion type menu would be nice to use on one of my sites. So I decided to use jQuery seeing as I think jQuery is rather kewl. I checked out a jQuery demo I found (http://jquery.com/blog/2006/11/14/expandable-sidebar-menu-screencast/). I liked what I saw and liked how simple it was, so I decided to base my menu on it.
So here we go, I created the definition list in just the same way, created some CSS for it and pretty much copy n pasted the code, and I was away, I had a working menu.
There was a problem though, I wanted my menu to animate alot faster, I noticed that the opening element and the closing element didn’t open and close at the exact same speed so it had a strange shuddering effect. This was unacceptable. I then decided it would be in my better interest to create my own animation using the setInterval() function, which is what I did.
I still used jQuery for its browser abstraction and ease of use, I just didn’t use animate().
// Variables are declared here so they are available in the function and in document.ready
var fullWidth; // the full width the 'slides' must be set to (When they are this width they are fully open)
var closedPage; // the slide that is currently close and is going to be opened
var openPage; // the slide that is currently opened and is going to be closed
var int;
var running = 0;
var step = 35; // the amount of pixels to increase or decrease the width of the slides by every milisecond
var fstep;
function slide()
{
// If the width of the slide that is busying opening + the step amount is larger then the full width
// find the difference between the opening page width and the full width and then add that to the opening page width so it equals the full width
if ( (closedPage.width() + fstep) > fullWidth ) // Makes sure the slides width always ends at the exact value of fullWidth
{
diff = fullWidth - closedPage.width();
openPage.css('width', openPage.width()-diff+'px');
closedPage.css('width', closedPage.width()+diff+'px');
}
else
{
// The slide that is opening + the step is not larger then the full width so continue adding the step as usual
openPage.css('width', openPage.width()-fstep+'px');
closedPage.css('width', closedPage.width()+fstep+'px');
}
// If the opening slides width is larger or equal to the full width, this means the slide is now fully open and the other slide is full closed
// So clear the interval and set running to 0 so the whole process can start again
if (closedPage.width() >= fullWidth)
{
int = clearInterval(int);
running = 0
}
}
$(document).ready(function() {
// Width needs to be calculated depending on the number of children items, I use this code in a CMS solution so the 'Slides' are added dynamicly
// and can vary in number
fullWidth = Math.round($('.slide-tabs').width() - ( ($('.slide-tabs dt').width()) * $('.slide-tabs dl').children('dt').length ));
fullWidth = fullWidth - 1; // This makes it all fit nicely
$('.slide-tabs dd .dddiv').css('width', fullWidth+'px');
$('.slide-tabs dd:first').css('width', fullWidth+'px'); // First 'Slide' is open on when page is loaded
$('.slide-tabs dt').bind('mouseover', function() {
if (!running) // Waits for timer to exit before starting a new one
{
// The line below finds the open 'Slide' I want this code to be fast and efficient
// so I only want one slide to open and one to close.
openPage = $('.slide-tabs dl').children('dd').filter( function(i) { if ($(this).width() > 0) return 1; } );
closedPage = $(this).next();
fstep = step;
int = self.setInterval('slide()',1);
running = 1;
}
});
});
Sometimes I find using {$node|attribute(’show’)} isn’t really quick enough so here are some links to some common return types.
The object that represents Nodes
( ezcontentobjecttreenode ) (3.10)
( ezcontentobjecttreenode ) (4.x)
The object that represents Objects
( ezcontentobject ) (3.10)
( ezcontentobject ) (4.x)
The object that represents Attributes
( ezcontentobjectattribute ) (3.10)
( ezcontentobjectattribute ) (4.x)
Here are some Debug settings for ezPublish when you want to see the debug info for a live site without other users seeing it, and without loging in.
These settings go in a site.ini.append.php config file, siteaccess or override doesn’t really matter.
[DebugSettings]
DebugOutput=enabled
DebugByIP=enabled
DebugIPList[]=000.000.000.000
DebugRedirection=disabled
These are some reminders and notes to make developing extensions abit easier in ezPublish. It should help in coding common tasks and getting common info from ezPublish. Ofcourse the ezPublish community server is also a very valuable resource
To get data about the logged in user:
$currentUser =& eZUser::currentUser();
To get the users name:
$userContentObject =& eZContentObject::fetch( $currentUser->ContentObjectID );
$currentUserName = $userContentObject->Name;
Information about module.php syntax
Policy Functions in module.php
HOWTO REDIRECT
You need to module’s object
$Module =& $Params["Module"];
then you can do a redirect using the redirect method from the module class or you can use the redirect manager which uses the module class neway
eZRedirectManager::redirectTo($Module, false);
Content Object and Node Info
Contact Object class = eZContentObject
Node class = eZContentObjectTreeNode
HOWTO to get user group info when you don’t have access to the user section
$allUsers = eZUser::fetchContentList(); // GET LIST OF ALL USERS
foreach ( $allUsers as $k => $v ) // LOOP THROUGH THE LIST OF ALL THE USERS
{
$groups = eZUser::groups(true, $v['id']); // GET THE GROUPS FOR EACH USER
foreach( $groups as $k2 => $v2 ) // LOOP THROUGH GROUPS
{
if ( $v2->Name == “GroupName” ) // I AM LOOKING FOR USER IN THE GROUP: “GroupName”
{
$inter = ezUser::fetch($v['id']);
// IF THIS USER BELONGS TO THE “GroupName” GROUP ADD IT TO THE MAIN USER ARRAY
$users[] = $inter;
}
}
}
$users is now an array of all the user within the specified group!
Remove index.php and the siteaccess name from your ezPublish URLS while using a shared hosting account, even free hosting. All your need is for .htaccess config to be supported.
First of all you need to tell ezPublish to use virtual host mode for the URLS:
In the override site.ini config file in the [SiteAccessSettings] section add the following
MatchOrder=host
HostMatchType=map
HostMatchMapItems[]=example.com;example_siteaccess
HostMatchMapItems[]=www.example.com;example_siteaccess
HostMatchMapItems[]=admin.example.com;example_siteaccess_admin
ForceVirtualHost=true
RemoveSiteAccessIfDefaultAccess=enabled
The above settings will instruct ezPublish to choose a siteaccess based on the domain name used in the URL, for example;
When the URL is http://example.com or http://www.example.com, ezPublish will display example_siteaccess, which would be your main siteaccess.
However if the URL is http://admin.example.com then ezPublish will display example_siteaccess_admin which would be your admin interface.
Now that ezPublish knows what todo we need the web server to direct anything after the domain name to index.php, for example;
http://www.example.com/products, by default /products would point to a folder called products in your root directory but if we add some rewrite rules in a .htaccess file /products can point to http://www.example.com/index.php/products or http://www.example.com/index.php?/products.
So add the following to a file called .htaccess in your root directory, if one doesnt exist your need to create it.
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^webdav\..*
RewriteRule ^(.*) webdav.php [L]
RewriteCond %{HTTP_HOST} ^soap\..*
RewriteRule ^(.*) soap.php [L]
RewriteRule content/treemenu/?$ /index_treemenu.php [L]
RewriteRule ^var/cache/debug.html.* - [L]
RewriteRule ^var/[^/]+/cache/debug.html.* - [L]
Rewriterule ^var/storage/.* - [L]
Rewriterule ^var/[^/]+/storage/.* - [L]
RewriteRule ^var/cache/texttoimage/.* - [L]
RewriteRule ^var/[^/]+/cache/texttoimage/.* - [L]
Rewriterule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^share/icons/.* - [L]
Rewriterule ^extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
Rewriterule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteCond %{SCRIPT_FILENAME} !.+\.pdf$
RewriteRule .* index.php
These Rewrite rules are default ezPublish rules and may be a-bit edited.