Blog2Works

This is the blog of freelance website designer and developer Ben Johnson, with thoughts on design, programming, frameworks, jquery and the latest technology.
Viewing entries posted in February 2011
  • Jquery Simple Convinous Hover

    Author: Ben Johnson

    Tags: ,

    This is a example of a simple few lines of jQuery magic to produce a contious action. var hoverInterval; function doStuff() {     // Set button's background to a random color     $("#button").css("background", "#" + Math.floor(Math.random() * 16777215).toString(16)); } $(function() {     $("#button").hover(         function() {             // call doStuff every 100 milliseconds             hoverInterval = setInterval(doStuff, 100);         },         function() {             // stop calling doStuff             clearInterval(hoverInterval);         }     ); })


  • Sending emails with Wamp on Windows using SMTP

    Author: Ben Johnson

    Tags: , ,

    Ok assuming you already have WAMP installed on your local computer start by downloading the Fake Sendmail. sendmail.exe inside the Fake Sendmail folder, is a simple windows console application that emulates sendmail's "-t" option to deliver emails. Extract the sendmail.zip file and move the folder here: "C:\wamp\sendmail". We need to use either your ISP SMTP server name or using an SMTP email account because sendmail.exe requires an smtp server to perform the actual delivery of the messages. Next configure the settings in the sendmail.ini file located here: "c:\wamp\sendmail". [sendmail]; you must change mail.mydomain.com to your smtp server, or to IIS's "pickup" directory.  (generally C:\Inetpub\mailroot\Pickup) emails delivered via IIS's pickup directory cause sendmail to run quicker, but you won't get error messages back to the calling application.smtp_server=mail.domain.co.uk; smtp port (normally 25)smtp_port=25; SMTPS (SSL) supportsmtp_ssl=auto; the default domain for this server will be read from the registry this will be appended to email addresses when one isn't provided if you want to override the value in the registry, uncomment and modify;default_domain=mydomain.com; log smtp errors to error.log (defaults to same directory as sendmail.exe) uncomment to enable loggingerror_logfile=error.log; create debug log as debug.log (defaults to same directory as sendmail.exe) uncomment to enable debuggingdebug_logfile=debug.log; if your smtp server requires authentication, modify the following two linesauth_username=mail@domain.co.ukauth_password=password; if your smtp server uses pop3 before smtp authentication, modify the following three lines.  do not enable unless it is required.;pop3_server=;pop3_username=;pop3_password=; force the sender to always be the following email address this will only affect the "MAIL FROM" command, it won't modify  the "From: " header of the message content;force_sender=; force the sender to always be the following email address this will only affect the "RCTP TO" command, it won't modify the "To: " header of the message content;force_recipient=; sendmail will use your hostname and your default_domain in the ehlo/helo smtp greeting. You can manually set the ehlo/helo name if requiredhostname= yourdomain.co.uk There are a few lines that need to be commented out/uncommented. Only one step left and that’s to make a change in the php.ini. Search for sendmail_path and set it to "c:\wamp\sendmail\sendmail.exe –t".


  • New Apple Macbook Pro

    Author: Ben Johnson

    Tags: , ,

    Apple's new MacBook Pros now come with next-gen processors, graphics and Intel’s I/O technology called Thunderbolt. Thunderbolt is a new interface that will let users connect peripheral devices that need to move a lot of data quickly, such as an array of disk drives, or an external device that requires very high-speed connections via USB or FireWire. More details on this new high-speed connection tech here. Sandy Bridge across the board: Intel's latest 32-nanometer Core i series processor makes it into all models. That's good news for consumers, of course. These Core i5 and i7 processors offer both improved power efficiency and better performance. A mainstream dual-core Core i5 Sandy Bridge processor, for example, runs at a speed of 2.3GHz but can jump to a higher speed, when necessary, of close to 3GHz. 13-MacBook Pro/Intel graphics chip only: Apple has gone with graphics silicon built directly onto the Sandy Bridge processor for the 13-inch MacBook Pro, as CNET reported last year. Nvidia, and its chipset based on GeForce 320M graphics, is out. This likely presages changes to new MacBook AIr models expected later this year. 15- and 17-inch MacBook Pro/AMD graphics: AMD (formerly ATI) "discrete" graphics silicon is now offered in the larger, more powerful MBPs. As in previous MacBook Pros, the discrete graphics chip is only fired up when heavy lifting is needed. When power savings is paramount or high-end graphics processing is not necessary, the system defaults to Intel's graphics. All in all, an array of technology that makes these new MacBooks pretty irresistible.


  • Update Zend Framework in Zend Studio

    To simple update the Zend Framework library in Zend Studio: Download and extract the Zend Framework package Create a new ZF project and fill in the first page. Click Next - You will see a reference for FRAMEWORK_HOME to the location under Eclipse package Remove the pre-configured ZF_HOME variable - it usually defaults to %INSTALL_PATH%/ZendStudioForEclipse-6.0.0/plugins/com.zend.php.framework.resource_6.0.0.v20080107/resources/ZendFramework Add a new external folder that points to the ZF directory you downloaded on step #1. The directory should include the 'Zend' library, in ZF 1.11.1 it is the directory 'library' Your new project should include ZF 1.11.1.


  • GEO IP

    Install the Apache Module - libapache2-mod-geoip How it work: By looking up the IP address of the user then sets two environment variables, GEOIP_COUNTRY_CODE and GEOIP_COUNTRY_NAME accessable via the _SERVER variables. Install - Linux: apt-get install libapache2-mod-geoip


  • Installing Memcache

    Author: Ben Johnson

    Tags:

    Installing Memcache for Windows Operting system. Web2works CMS uses Memcache for all backend caching to increase the speed and performance of the data retrieval. Pre Install Windows users download http://dev.web2works.co.uk/resources/php_memcache.dll place in /php/ext Install Memcache via the downloading http://dev.web2works.co.uk/resources/memcached-1.2.6-win32-bin.zip and extract to desided location Run -> CMDc:\Memcached\memcached.exe -d installc:\Memcached\memcached.exe -d startc:\Memcached\memcached.exe -d runservice -m 512 Non WAMP users Add to your php.ini extension=php_memcache.dll Wamp users Instead of modifying the php.ini file, start the apache mem_cache_module and the php_memcache service. Restart Apache Complete


  • Spider Web

    Author: Ben Johnson

    Tags: , ,

    At the moment Spider Web is in beta stage and currently in progress of going out in the real DNS world instead of my localhost. You probably thinking what Spider Web is all about. This has been an on going project over the past year, it started with a few test scripts as reference tools and over time I have into an adaptable web application. Quick list of the features: Create pages, edit and delete Edit the navigation User Login and Register Google Sitemap Spider Web uses Zend Framework as it core functionality. I choose this Framework mainly because it has been ahily erccomended at every PHP conferenc I have attended and its built by the guys who create PHP so its the best. You can think of Spider Web as a simplified version of a fully blown content manage system, weighing in at 1.9 MB (1,139,240 bytes) of 326 files its simple and fast. To speed things up even more I have confirgured Zend_Cache Frontends and Zend_Cache Backends along with Smarty to cache the HTML.


  • Macports

    Author: Ben Johnson

    Tags: , ,

    Simple update run the following command. sudo port -d selfupdate Search by: port search rrd Shows the dependicies of a port port deps apache2 Install a port sudo port install nmap Uninstalla port port uninstall vile (For uninstall port -f uninstall vile) View all installed port installed


  • Subversion

    Author: Ben Johnson

    Tags:

    Create new Repositry Location svnadmin create --fs-type fsfs /var/svn-repos/project_wombat Add new users to the Repositry useradd -gwww-data -Gsubversion -d/var/www ed Fix permissons chown -R www-data:subversion /var/svn/* chmod -R 770 /var/svn/* svnlook tree /var/svn/project_wombat/ htpasswd /etc/apache2/dav_svn.passwd john Edit the vhost file - restart apache List Users cat /etc/passwd | cut -d: -f1 List Groups less /etc/group


  • Install PHP Curl on Mac via Macports

    Author: Ben Johnson

    Tags: , ,

    Fatal error: Call to undefined function curl_init() The famous error of PHP giving up. This is due to PHP Curl not being enabled. To install it via macports you can use it to build and then install php5 curl with the command sudo port install php5-curl You must also have Apple Developer tools (X Code) installed for mac ports to work. X Code can be downloaded free from Apple.



1 2