May 8, 2010 Posted Under: Uncategorized   Read More

JDSF Getting Started

Overview

Almost every programmer has got to the point where he worked with more than one thread, and then started synchronizing them. Today’s applications become not only multi threaded but also distributed, that is, an application can run on different processors and even different computers. Synchronizing such application is a very difficult task, and that is where our new project comes handy.

We provide a one class Monitor object that provides distributed getLock, releaseLock as well as wait-notify functionality.

Configuration

  • Add jdsf.jar into your classpath.
  • This API is based on JMS. Use the jms.provider JVM property to state the JMSLoader class being used (fully qualified name is needed)
  • Synchronizing

    Use org.jdsf.dl.LockObject to perform distributed synchronization.

  • To lock a critical section use LockObject.getLock(“your string”) at the beginning of the section.
  • To release a critical section use LockObject.releaseLock(“your string”) at the end of the section.
  • Please note that the lock can be created only on String objects at this time.

    Wait-notify

    Use org.jdsf.dl.LockObject to perform distributed wait-notify.

  • To wait for a notification use the LockObject.waitFor(“your string”);
  • To notify a single instance use the LockObject.notifyFor(“your string”);
  • To notify all instances use the LockObject.notifyAllFor(“your string”);
  • Please note that at the current version the wait and notify method do not lock/release the distributed monitor.

    An example use of JDSF can be found in the current release under the examples folder.

    Each String creates a lock only for the relevant String value, in this way multiple Distributed lock can be created.

    May 8, 2010 Posted Under: Uncategorized   Read More

    Making Java web development easier

    After a very long time of infrastructure development I have taken some time to get myself familiar again with web development and web frameworks. I did not keep my search contained to the Java domain but I kept coming back to Java because I like java and because Java provided me with everything I needed.

    Well almost anything….

    Most people interact with applications via graphical user interface. Graphical user interface (such as web interface) exposes the functionality of the application; it should be easy to use, nice to look at, personalized and customized to meet all the end-user needs. This is a very hard task as is and should not be made more complex by cumbersome web frameworks. The main problem in J2EE was that developers must face 100 percent of Java EE’s complexity even if they only need 20 percent of the services.

    To address these issues, several simpler frameworks, all intended to help developers, were created. One of the most promising and best known to date is Spring- a simple-to-use application framework that provides programmers with the same Java EE functionality they need, but with a fraction of the complexity and cumbersomeness. I have worked a little with Spring MVC web framework and I enjoyed developing with it.

    But, at the risk of sounding greedy, this is not enough. It should be simpler and easier to develop a well-structured, MVC, web applications.

    One way of doing so would be with the help of graphical tools (an eclipse plug-in…)

    These tools should help developers:

  • Automatically create and wire MVC components.
  • Define web application flows.
  • Generate automatic validation.
  • Wire data components with their graphical presentation.
  • Prevent excessive configuration and configuration errors
  • May 8, 2010 Posted Under: Uncategorized   Read More

    Towards a fully distributed queue (a new idea is born) – Revisited

    Not so long ago I have posted a blog in which I talked about my thesis, more precisely about its beginning. My original idea to study and hopefully come up with a reasonable implementation of a fully distributed queue has taken a slight detour (as these things sometimes do). Instead of studying only distributed queues I ended up looking at the relationship between mutual exclusion algorithms or as they are sometimes called, locking algorithms, and various distributed data structures such as queues, stacks, linked lists and even shared counters. Some types of data structures, such as the shared counters, had more than one implementation, and some of the more complex data structures made use of lower data structures as their building blocks. For example a distributed queue made use of a shared counter.

    My thesis work consisted of both theoretical and practical aspects. My analysis of the data structures’ behavior and relationships was based on a complex testing framework which I have developed. The framework, which made use of various open source projects and in particular MantaRay, allowed me to test the performance of various distributed data structures using any of the locking algorithms I implemented.

    My supervisor, Prof. Gadi Taubenfeld, suggested that I start with implementing known / existing locking algorithms in order to get some preliminary numbers. Having thoroughly read and researched papers which dealt with distributed mutual exclusion, I have decided to stick to the basics and implement 3 of the more well known and respected algorithms in the field. The algorithms I implemented were Suzuki-Kasami’s Token-based Algorithm, Ricart-Agrawala Permission-based Algorithm and Maekawa’s Permission-based Algorithm.

    One of the most challenging aspects of designing and implementing a locking algorithm or a distributed data structure is making sure that the implementation is ‘correct’ and scales well under load. In my next blog I will shade some light on this simple statement which turns out to be a hell of a lot harder than one might expect

    May 8, 2010 Posted Under: Uncategorized   Read More

    Why I choose Drupal and not joomla / mambo

    I figured that for 16bytes.com I would do a new research on open source CMS. I used Drupal for my last site but was determined to keep an open mind.

    After a quick search in Google I decided to install mambo / joomla. My first reaction was “WOW, these guys know how to do CMS”. The GUI was great and it looked like a feature-full CMS.

    Well, I came to my senses after two days of tedious configuration, rigid and complex management and a few explorer crashes. Reading a few blogs made it all clear, Mambo / joomla have great marketing people but they are still wanting in many CMS aspects. And while Drupal has something to learn about marketing and professional UI (the default user-interface of Drupal should be as good as mambo / joomla and currently it is not), they certainly hit the spot when it comes to CMS.

    There are some things that are still missing from Drupal but I can certainly say – Drupal rocks!

    May 8, 2010 Posted Under: Uncategorized   Read More

    Tweaking FacesIDE Eclipse Plugin for Easier JSF Development with Tomcat

    FacesIDE plugin comes in very handy when you need to develop JSF applications.

    However, when put into work, there are two changes you need to make by hand to the web.xml file it creates in the project structure.

    This blog shows how to tweak the plugin so you don’t need to make those changes manually every time you create a new JSF project.

    1. Open your eclipse’s plugins directory (In my installation eclipse is installed directly under c:\ so the plugins directory is c:\eclipse\plugins).Find FacesIDE plugin’s directory – c:\eclipse\plugins\tk.eclipse.plugin.jsf_2.0.2\myfaces-1.1.3\conf (the version number might change depending on the version of the plugin you have installed).
    2. Find web.xml and open it in an editor.
    3. Towards the end of the file you will find the following section:
      <!-- virtual path mapping -->
      <!--
          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>/faces/*</url-pattern>
      
          </servlet-mapping>
      -->
      

      The virtual path mapping allows for the JSF Servlet to grab all requests for JSF pages.

      Remove the comment surrounding the servlet-mapping tag and save the file. You will no longer have to do it manually for every JSF project you create.

    4. There’s one more thing you can do in this file, so you won’t have to change the filter attribute manually for Tomcat.Find the section starting with :
          <!-- Extensions Filter -->
      

      In the filter-class tag, change the original content of org.apache.myfaces.component.html.util.ExtensionsFilter to read org.apache.myfaces.webapp.filter.ExtensionsFilter

      Don’t forget to save the file.

    That’s it. The next JSF project you create using this plugin will have those two changes ready out-of-the-box for you, and save you some work.

    Explanation:

    The FacesIDE plugin creates a file structure for a JSF application inside your eclipse project. One of the files that the plugin creates is the web.xml file.

    What you did just now changes the original web.xml file used by the plugin, and so, the next time the plugin is used, the altered version will be used.

    May 8, 2010 Posted Under: Uncategorized   Read More

    How to fix live msn messenger 8.0 when it hangs while “signing in”

    I have several accounts in my msn messenger. Yesterday one of my accounts just wouldn’t sign-in.

    My live messenger kept trying to sign-in forever, setting a false password returned an error message and I had no problem sign-in with my other msn account.
    After spending two hours on this problem and in the spirit of 16bytes, I decided to post the solution to this problem.

    I found two solutions on the web, one did not work, but maybe it will be helpful for others.
    The solution that did not work for me:
    “To correct this, click Start, then Run, then type:
    %appdata%\microsoft
    and click OK.
    Right-click the MSN Messenger folder and choose Delete. After all this, restart Messenger
    and see if the problem has been corrected.”

    Here it is source of this solution

    It toke me quite a while to find the other solution, it looked risky because it involved regedit, but it did the trick.
    The solution that worked:
    “1. Hit “run” in the start menu
    2. Type “regedit”
    3. Open “HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger”
    4. Delete the folder called MSN Messenger
    5. After this MSN Messenger Live will login as normal.”

    Here it is source of this solution

    The second solution involves playing with the computer registry so be careful and “do not try this at home” if you do not know what your doing.

    May 8, 2010 Posted Under: Uncategorized   Read More

    Build your own Geo-Locating solution

    Many websites use Geo-Locating services to provide location aware content, so users will get the content in their language and currency, and will “enjoy” from some targeted adverts.

    Geo-location is also required when providing content that is protected by DRM (Digital Rights Management) and has some geographical constraints.
    On top of that, webmasters can benefit from Geo-Locating logs to analysis their web traffic.

    This article explains how to build your own GeoLocating solution by translating IP address to Country.
    At the end of this article, I’ll show an example of simple Java implementation of IP-to-Country Geo-Locating tool.

    Who manage the IP address allocation space?

    There are five Regional Internet Registries (RIR) operating worldwide. Each one of these not-for-profit organisations is responsible to manage all internet number resources in its region, as specified at the following table:

    Registry IPv4 Allocations* Region
    AfriNIC 1% Africa
    APNIC 32% Asia Pacific
    ARIN 30% Canada, United States and several islands in the Caribbean Sea and North Atlantic Ocean
    LACNIC 4% Latin America, Caribbean
    RIPE NCC 33% Europe, the Middle East and parts of Central Asia

    * As stated on NRO (Number Resource Organisation) report from September 2006. NRO is the organisation which is responsible for the joint activities of all Regional Internet Registries.

    Historical assignments which are not under Regional Internet Registry management are still maintained by IANA

    How do I get RIR database?
    Each one of the Regional Internet Registries is managing its own database, and providing access to the database through a dedicated whois server.
    Since hitting the whois servers every time our application is willing to get some IP information is not a good idea, it makes more sense to download their entire database.
    Each RIR has a different format and a different way to download their entire database which contains many details as company’s name. In addition, that detailed data is protected by some restricted terms and conditions.
    However, since all we want is to get the country for a given IP addresses, we can just download files in a simplified format called “Standard Statistics Exchange Format”. These files are used by all regional internet registries, produced daily, and can be downloaded by saving the following links:

    ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest
    ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest
    ftp://ftp.arin.net/pub/stats/arin/delegated-arin-latest
    ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest

    ftp://ftp.ripe.net/ripe/stats/delegated-ripencc-latest
    ftp://ftp.apnic.net/pub/stats/iana/delegated-iana-latest

    How do I use RIR Statistics Exchange files?
    The full specification of the RIR statistics exchange file format can be found here.

    The following Java class provides geo-locating solution by using RIR statistics exchange files.
    Take a look at the main() method to see an example of how to use this class.

    
    /*
     * @(#)GeoLocator.java    1.00 15/10/06
     *
     * Copyright 2006 16Bytes.
     *
     */
    package com.sixteenbytes.geolocator;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.util.List;
    import java.util.NoSuchElementException;
    import java.util.StringTokenizer;
    import java.util.TreeMap;
    import java.util.Vector;
    
    /**
     * The GeoLocator class allows applications to support
     * Real Time Geo-Locating solution by using IP allocation database.
     * Before calling the getCountry() method, be sure you loaded
     * all IP ranges by calling addIPRanges().
     *
     * @author  Alon Schreibman
     * @version 1.00, 15/10/06
     */
    
    public class GeoLocator {
    
        private TreeMap<Long, List<Object>> map = new TreeMap<Long, List<Object>>();
    
        /**
         * Parse the ipAddress string, and transform it into a single long value
         *
         * @param    ipAddress     a string contains the ip address.
         * @return    the ipAddress in a long format
         */
        protected long ipToLong(String ipAddress)
        {
            StringTokenizer st1 = new StringTokenizer(ipAddress,".");
            long byte1 = Short.parseShort(st1.nextToken());
            long byte2 = Short.parseShort(st1.nextToken());
            long byte3 = Short.parseShort(st1.nextToken());
            long byte4 = Short.parseShort(st1.nextToken());
    
            return byte1 * 256 * 256 * 256
                    + byte2 * 256 * 256
                    + byte3 * 256
                    + byte4;
        }
    
        /**
         * Convert IPv4 InetAddress into a single long value
         *
         * @param    ipAddress     a string contains the ip address.
         * @return    the ipAddress in a long format
         */
        protected long ipToLong(InetAddress addr)
        {
    
            byte[] addrBytes = addr.getAddress();
            long byte1 = (addrBytes[0] < 0 ? addrBytes[0] + 256 : addrBytes[0]);
            long byte2 = (addrBytes[1] < 0 ? addrBytes[1] + 256 : addrBytes[1]);
            long byte3 = (addrBytes[2] < 0 ? addrBytes[2] + 256 : addrBytes[2]);
            long byte4 = (addrBytes[3] < 0 ? addrBytes[2] + 256 : addrBytes[2]);
    
            return byte1 * 256 * 256 * 256
                    + byte2 * 256 * 256
                    + byte3 * 256
                    + byte4;
        }
    
        /**
         * Load RIR Statistics Exchange Format file into memory.
         * It is possible to load multiple RIR Statistics Exchange
         * from different registries.
         *
         * @param   fileName     a string to be parsed.
         * @exception FileNotFoundException
         * @exception IOException
         */
        public void addIPRanges(String fileName) throws FileNotFoundException, IOException
        {
            File f = new File(fileName);
            BufferedReader r = new BufferedReader(new FileReader(f));
    
            r.readLine();
            List<Object> list;
            // for each line in the file
    
            for (String str = r.readLine(); str != null; str = r.readLine()) {
    
                // get all tokens
    
                StringTokenizer st = new StringTokenizer(str, "|");
    
                if (st.countTokens() == 7) {
    
                    list = new Vector<Object>(7);
                    list.add(st.nextToken());
                    list.add(st.nextToken());
                    list.add(st.nextToken());
                    // if it's IPv4 record
                    if (list.get(2).equals("ipv4")) {
                        // Create a long which represents the beginning of the IP range
                        Long lIp = new Long(ipToLong(st.nextToken()));
                        list.add(lIp);
                        list.add(new Long(Long.parseLong(st.nextToken())
                                + ((Long) list.get(3)).longValue()));
                        list.add(st.nextToken());
                        list.add(st.nextToken());
                        // use the IP as the index
                        map.put(lIp, list);
                    }
                }
            }
            r.close();
        }
    
        /**
         * Returns a two-letter country code for a givven IPv4 InetAddress
         *
         * @param   addr     string to be parsed.
         * @return the two-letter country code.
         */
        public String getCountry(InetAddress addr) {
            long ipAddress = ipToLong(addr);
    
            try {
                Object key = map.headMap(new Long(ipAddress + 1)).lastKey();
                List resultRecord = (List) map.get(key);
                if (((Long) resultRecord.get(4)).longValue() >= ipAddress)
                    return (String) resultRecord.get(1);
            } catch (NoSuchElementException e) {
    //            e.printStackTrace();
            }
            return null;
        }
    
        public static void main(String[] args) {
            try {
    
                GeoLocator geoLocator = new GeoLocator();
                geoLocator.addIPRanges("/RIR/delegated-arin-latest.txt");
                geoLocator.addIPRanges("/RIR/delegated-apnic-latest.txt");
                geoLocator.addIPRanges("/RIR/delegated-lacnic-latest.txt");
                geoLocator.addIPRanges("/RIR/delegated-ripencc-latest.txt");
                geoLocator.addIPRanges("/RIR/delegated-afrinic-latest.txt");
                geoLocator.addIPRanges("/RIR/delegated-iana-latest.txt");
    
                System.out.println(geoLocator.getCountry
                   (InetAddress.getByName("80.178.75.155")));
                System.out.println(geoLocator.getCountry
                   (InetAddress.getByName("16bytes.com")));
    
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    
    }
    
    
    May 8, 2010 Posted Under: Uncategorized   Read More

    Configure FacesIDE, Tomcat and Eclipse for JSF Development

    This blog shows you how to configure an entirely open-source JSF development and test platform.

    Eclipse can be easily set up to support JSF development with FacesIDE and Tomcat. The process is quite easy – if you have the right plugins.
    In Eclipse architecture, plugins are additions to the basic platform. Actually, when you install eclipse, many plugins are already there for you under the hood. They serve as extensions, builts on the basic functionality provided by the platform.
    If you want the basic eclipse to serve as a JSF development workbench, a good choice would be to add the FacesIDE plugin to it.
    FacesIDE is an open source eclipse plugin designed for JSF development. It contains some functions that allow you to easily make your eclipse project a JSF project and code away without having to focus on JSF’s tidbits.
    What you need:

    1. An eclipse installation.
      You may have some problems configuring the FacesIDE plugin on eclipse level lower than 3.2. I prefer using a Callisto distribution but a simple eclipse should suffice. You may download it from IBM’s site (internal links there tend to change a lot, so just go to IBM site and search for ‘callisto’, Select the Java EE project bundle).
    2. Tomcat.
      I use Tomcat 5.5 but any other will do.
      You can download Tomcat from here and installation is quite straightforward
    3. Additionally, you may use SysDEO’s Tomact plugin to ease deploying and testing your application. It is downloadable here. make sure that you download the version that supports your version of eclipse.
    4. The FacesIDE plugin.
      These are actually two plugins that you need. Both are downloadable from here.You need both EclipseHTMLEditor and FacesIDE plugins.

    You are now ready to set up your environment.

    1. If you haven’t got eclipse installed already, extract the archive that you downloaded. You can extract it anywhere, but for this tutorial I assume that it is extracted into c:\.
    2. Install Tomcat if you haven’t done it yet.
    3. Eclipse’s file structure is simple. You have a directory called c:\eclipse. Under this directory you have a plugins directory. This directory holds all the plugins that you have installed. You will now add the three plugins there.
      Extract both EclipseHTMLEditor and FacesIDE archives to c:\eclipse. The archives contatin a \plugins directory, and therefore the contents will be extracted to c:\eclipse\plugins, where plugins should reside.
    4. Install Sysdeo Tomcat plugin under eclipse.Unzip the plugin’s archive under c:\eclipse\plugins (this archive does not contain a \plugins directory, so you need to extract it there yourself).
    5. Configure Eclipse
      If you already used this eclipse, you may have to restart it using –clean attribute on the command (right click the shortcut for eclipse, and select properties. Enter ‘-clean’ at the ‘Target’ textbox). Remember to remove the -clean attribute after you verify that the plugins are active.
    6. Confirm that the plugins are installed : Before we can start, we must confirm that eclipse registered the three new plugins.
      1. In eclipse, go to the Help menu, and select ‘About Eclipse SDK’.
      2. A pop-up window opens. Click on the button labeled ‘Plug-in Details’. This should display a list of all the plugins installed.
      3. Scroll down to the bottom of the list. You should see the following:Click here for a full screen image.
        Make sure that the FacesIDE, FacesIDE Visual page designer, the HTML/JSP/XML Editor and the SYSDEO plugins are listed. (They are shown on the bottom of the list).
      4. If the plugins are not found there, close this list, and click the ‘Configuration Details’ button. Check the error log there to see what went wrong.
    7. In eclipse’s main toolbar you should see Tomcat’s buttons and menu item. If they are not present, you will need to do the following:
      1. From eclipse main menu select Window->Customize Perspective->Commands.
      2. Check the box next to Tomcat in the commands tab and click OK.Click here for a full screen image.
    8. Before you can use Tomcat from eclipse, you need to set Tomcat’s properties.
      1. In eclipse’s menu select Window->preferences.Under Tomcat, set the tomcat version you use and Tomcat’s home.

        Click here for a full screen image.
        In this example I am using Tomcat 5.5, so ‘version 5.x’ is selected. Tomcat home points to the containing directory of Tomcat’s installation.

      2. If you are using Tomcat version 5.5.12 and above, make sure that the context declaration mode is ‘Context files’.
      3. Inside the archive for Tomcat’s plugin there’s another archive named DevLoader.zip. extract this archive under %Tomcat’s home%\server\classes (On my computer this will be C:\Program Files\Apache Software Foundation\Tomcat 5.5\server\classes)
      4. The plugin points Tomcat to eclipse’s default JRE, however, this must be a JDK and not a JRE (Think: you need to be able to compile JSP’s). So, you must make sure that the default runtime for eclipse is indeed a JDK (Open Window->Preferences, and expand the Java node. Under there, check Installed JREs, to make sure that you are indeed using a JDK as the default one for eclipse).
        Check that the configuration is correct by starting Tomcat from eclipse toolbar. You should see the server starting in the console with no exceptions :Click here for a full screen image.

      Creating a Tomcat/JSF project
      The last part of this blog describes how to create a Tomcat-ready JSF project in the configuration you just completed. In the next blog I will show how to create a simple JSF application and deploy it to Tomcat from within eclipse.

      1. A project in eclipse is a container for your code, and it’s the first thing you need to create for your JSF application (or any application for that matter).
        1. In eclipse menu, select File->New->Project
        2. In the wizard you see, expand ‘Java’ and select ‘Tomcat Project’ underneath it. Click on Next.
        3. Enter a name for your project and click Next.
        4. In the next screen you see the ‘Context Name’ of your application. This is the place inside Tomcat that your application will be deployed. It defaults to the project name.
          Additionally you see a ‘Subdirectory to set as web application root’ text box. it defaults to ‘/’ – which means the top level of your project file-structure. I usually prefer to set it to ‘/webcontent’ and work from there. Click Finish.
      2. Eclipse creates a new project. It is Tomcat-ready, and you can see it in the Project Explorer view on the left of the eclipse window (workbench).Inside the project structure it has all the jars and definitions needed for Tomcat (you can see them in project properties, under Tomcat section). However, you now need to configure it for JSF development. (That is: tell eclipse that this is actually a JSF project and not an ordinary one).
        To achieve this, you need to create the file-structure for this project, and add JSF support. The plugins that you installed previously make this an easy task.

        1. The project contains a ‘webcontent’ folder inside (since we asked for this on project creation). Right click webcontent folder and create a new folder under it. This new folder will hold the JSF pages that you develop. Give this folder a meaningful name.
        2. Now we use the FacesIDE plugin to add JSF support to the project.
          Right click the project name in the Package Explorer, and select New->Other. In the wizard that you see, expand Amateras node and select ‘Add JSF Support’.Click Next.
          In the next wizard screen you need to supply the Web Application root. Notice that the wizard defaults to the name of your project, but this will not do.

          The Amateras plugin can not guess where your application root resides, so you need to manually enter it.
          Click the Browse button, and navigate to the root (webcontent folder). Select it and click on OK.

          Make sure that the three checkboxes are checked, and click Finish.
          Note: It is possible to create the web root of the application (webcontent in the example) directly under the project’s top directory. In my opinion, though, it is more manageable to divide the files in a certain directory structure.
          Moreover, keeping the structure this way, will ease deployment into Tomcat later on.

        3. Verify that the application web root is set.
          Right click your project, and select properties. In the screen that you see, select the Amateras node. See that the Root points to your web rootClick here for a full screen image.
        4. You need to manually change web.xml for Tomcat to use the correct listener class for the JSF project.
          Open web.xml file under webcontent/WEB-INF and find the listener section inside it.
          change the listener-class tag to point to org.apache.myfaces.webapp.filter.ExtensionsFilter.

      You now have a JSF-oriented eclipse project under your hand. In the next blog we will use all the setup done here to develop and deploy a JSF application to Tomcat.

    May 8, 2010 Posted Under: Uncategorized   Read More

    How to turn off the user Account Control in Vista

    Windows Vista, Microsoft’s new operating system, brings many new cool features. It seems the new look and feel gets all the attention, the famous aero glass transparency and the amazing new windows browsing 3D effect (pressing the keyboard’s “Windows” button + TAB) provide a killer user experience and a better way for us humans to communicate with our computer.

    However, Vista has also provides many more other features besides User Experience, features such as Search and Organization, enhanced networking capabilities, speech recognition and off course, the best secured version of Windows yet.

    The rigorous security includes a very cool User Account Control which isolates “regular” users from “admin” users. This feature checks whether a given user has enough permissions before executing certain activities on the OS or before launching / installing an applications. For example, one can’t register a new DLL , regsvr32 command,  if he has no admin permissions. Non administrator users can NOT change the date and time, the same applies for configuring the network and other various tasks. Vista takes the User Account Control a step further. Even if you are logged-in as administrator, any application you launch is launched under regular user permissions, unless you specifically indicate you want to run this application as administrator. Only when you right clicking on the executable and choose “Run as administrator”, the application will run / installed under administrator permissions, assuming the user really has administrator permissions.

    This is great for standard users whom are afraid to harm their computer by mistakes. How many times did you have to fix your father computer after all he did was installing something he downloaded from the WEB? User Account Control feature protects your Vista from harmful actions performed by non professional users, this feature simply limits the amount of damage a non administrator user can inflict on the OS to a minimum.

    But for professional users and IT Pros, this extra security, when logged as admin, is too much of a hassle. Therefore one can turn off this feature.

    To turn off the User Account Control:

    1. Click Start –> in the search text box simply write users –>in the search results choose User Accounts. You can also do it the old way, click Start –> Control Panel –> choose User Accounts.

    2. In the User Accounts windows, choose “Turn User Account Control on or off”, when the “Windows needs you permission to continue” windows pops-up to insure that you, who is already logged as administrator, allow this application to launch by pressing Continue.

    3. Check out the “User Account Control (UAC) to help protect your computer” checkbox.

    4. Click OK

    5. You will need to restart your computer in order for the change to affect your setting.

    Please note: removing this protection may place you computer in harm, and it is recommended only for IT Pros and professional users – DO NOT try this at home.

    May 8, 2010 Posted Under: Uncategorized   Read More

    How to install PHP5 to run with Apache 2.2 and MySQL 5 on Windows

    I just installed from scratch PHP5 (PHP version 5) to run with MySQL and Apache HTTP server. Despite the popularity of this configuration, I spent few hours straggling to set it up. The main reason it was not straight forward is that most of the “how-to” articles I found on the net were not up-to-date and just didn’t work with the latest version of Apache, PHP and MySQL.

    Nowadays, most of the low cost hosting packages come with PHP and MySQL. PHP became very popular, with many free scripts available to download, and writing new PHP scripts is a fast and easy way to build dynamic and stable web sites.

    Installing PHP on your local machine makes testing your PHP scripts much easier.
    Save time on debugging, without the need of uploading your test files to the server for every minor change you’ve done on your test scripts.

    • Install and configure Apache 2.2
      1. Download the latest release of Apache HTTP Server from http://httpd.apache.org/download.cgi
      2. During installation, you will be asked about your domain name, server name and e-mail address. Set the domain name and server name to “localhost”, and enter any e-mail address you want. All these settings and many others can be altered later by editing the configuration file C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
      3. If you are a Windows XP user, you will find the Apache icon on your taskbar. You can start/stop/restart the service from there, or, alternatively, you can do it through the Control Panel -> Administrative Tools -> Services.
      4. If you don’t want to use the default port (port 80), you should open the configuration file C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf, search for “Listen 80”, if it is commented, uncomment it by removing the “#” and set it to your desired port.
      5. To make these changes take affect, don’t forget to restart the Apache server.
      6. Test it by going to http://localhost:80 through your browser.
      7. Place your web content under C:\Program Files\Apache Software Foundation\Apache2.2\htdocs
    • Install MySQL
      It’s really simple to install MySQL. All you have to do is to download the current release of MySQL for Windows from http://dev.mysql.com/downloads/ , run the executable and follow the simple instructions.
    • Install and configure PHP5 (PHP Version 5.2)
      1. Go to http://snaps.php.net/ and download a zip file with the latest stable version of PHP for Win32 package. At the time I wrote this, the latest version was PHP 5.2.
      2. Extract all the files to c:\php or any folder you choose. Ensure that php5apache2_2.dll is there. Previous versions of PHP5 come only with the old php5apache2.dll, and this one doesn’t work with the latest Apache HTTP server (version 2.2).
      3. Add “C:\php\” and “C:\php\ext\” to the system path variable. You can do it by going to Control Panel -> System. Click on “Environment Variables” which is located on the “Advanced” tab, and edit your “Path” variable. You should append “;C:\php\;C:\php\ext\” to the end of the path variable value.
      4. Copy c:\php\libmysql.dll to C:\WINDOWS\system32.
      5. Rename c:\php\php.ini-dist to php.ini and edit it with text editor as notepad. It is recommended to backup it before making the following changes:
        • Set doc_root = “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs”. the path should be the same one used by DocumentRoot property in Apache httpd.conf
        • Set extension_dir = “C:\php\ext”
        • Uncomment by removing the ‘;’ from extension=php_mysqli.dll – if it doesn’t exist than add it just before extension=php_mysql.dll.
        • Uncomment extension=php_mysql.dll
      6. Edit Apache configuration file httpd.conf, and add the following lines right after the last LoadModule property:

        LoadModule php5_module "c:/php/php5apache2_2.dll"
        AddType application/x-httpd-php .php .php5
        PHPIniDir "c:/php"
      7. In the same file, add to the end of “DirectoryIndex” property “ index.php5 index.php”.
      8. Create a new file called phptest.php with the following script. Replace ‘rootpassword’ with your actual MySQL root password, and place the file in your apache htdocs folder. Test the Apache-PHP-MySQL configuration by going to http://localhost:80/phptest.php

        <?php

        $mysqli = new mysqli(‘localhost’,'root’,'rootpassword’);
        $mysqli->select_db(‘information_schema’);

        $result = $mysqli->query(“SELECT * FROM SCHEMATA”);

        while($row = $result->fetch_assoc()) {
        print $row['SCHEMA_NAME'] . ‘ – ‘ . $row['DEFAULT_CHARACTER_SET_NAME'] . ‘<br/>’;

        }

        $result->close();

        ?>

      9. If you can get this page, it means that you’ve successfully installed everything! However, if this script doesn’t work, try to run a more simple script that doesn’t use MySQL, but provides you with information about your PHP setup:

        <?php
        phpinfo();
        ?>