IT buffet

Serve yourself with our ingenious recipes !

Friday, July 11, 2008

Refreshing bean properties in Netbeans

Hi all,

Long time since I posted here. Now I'm facing a Java project, which has a client GUI.

Well, of course I went through Netbeans for the basics, and I finally spent another 30 minutes trying to figure out something I will explain here =D

Well... I was following the JavaBeans tutorial from Sun, and I was having problems in the section that includes a new property title in the bean and then shows it up on the properties window.

The new property wasn't being shown in the properties window...

So I found how to do that without closing Netbeans or the form being edited:

** In the Inspector window, right click the form icon and choose "Reload Form" **

That does the trick =D

Friday, February 22, 2008

Installing PHP5 on Vista 64-bit (ISAPI)

This recipe will get you a fully working ISAPI PHP5 installation under IIS7.


  1. Download the zip package for Windows here;
  2. Extract the files to c:\php\;
  3. Copy the php.ini-dist file to php.ini;
  4. Open the newly created file in notepad and replace:


    ;extension=php_mysql.dll
    ;extension=php_mysqli.dll


    with this:

    extension=php_mysql.dll
    extension=php_mysqli.dll
    (i.e. remove the semicolons)

    And alter these variables:
    From

    extension_dir = "./"
    ;session.save_path = "/tmp"


    To

    extension_dir = "c:\php\ext\"
    session.save_path = "c:\php\tmp\"

  5. Run a command prompt in administrator mode
  6. Run the following commands (gray is input, green output):


    1. setx PHPRC c:\php /M

      SUCCESS: Specified value was saved.


    2. icacls c:\php\ /grant:r IUSR:RX /T

      Successfully processed XXX files; Failed processing 0 files


    3. mkdir c:\php\tmp


    4. icacls c:\php\tmp /grant:r IUSR:F /T

      Successfully processed XXX files; Failed processing 0 files


    5. appcmd set apppool "DefaultAppPool" /enable32BitAppOnWin64:"true"

      APPPOOL object "DefaultAppPool" changed


    6. APPCMD SET CONFIG -section:handlers -+[name='PHP',path='*.php',verb='GET,HEAD,POST',modules='IsapiModule',scriptProcessor='c:\php\php5isapi.dll',resourceType='Either']

      Applied configuration changes to section "system.webServer/handlers" for "MACHIN
      E/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"


    7. APPCMD SET CONFIG -section:isapiCgiRestriction -+[path='c:\php\php5isapi.dll',allowed='true',groupId='PHP',description='PHP5']

      Applied configuration changes to section "system.webServer/security/isapiCgiRest
      riction" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEB
      ROOT/APPHOST"


    8. net stop w3svc

      net start w3svc



That should do it. If you have problems with the above procedure, please share it so everyone can benefit of depuration. Thanks !

Labels: , , , , , , ,

Wednesday, February 20, 2008

Installing IIS7 on Vista 64-bit

1) Time to bring up the webserver !

1.1) Hit the windows key and type appwiz.cpl, then press Enter.
1.2) On the new screen click on Turn Windows features on or off. If the UAC confirmation window pops up, click on Confirm or OK.
1.3) In the "Windows Features" window, check the Internet Information Services node. With this we´re selecting default features that are marked in the subnodes.
Free Image Hosting at www.ImageShack.us
1.4) We need one more feature: Browse the Internet Information Services - World Wide Web Services - Application Development Features node and click the ASP.NET checkbox. If you have legacy ASP applications to run on IIS, also check ASP.
Free Image Hosting at www.ImageShack.us
1.5) That´s all the options we really need for this tutorial. Browse the nodes and decide if that´s enough for you. If it is, click OK to start the installation

Vista should tell you the server was successfully installed and you should see the welcome page at http://localhost/ after that !
Free Image Hosting at www.ImageShack.us

1.6) Now we´re after the FastCGI extension which seems to have a better perfomance than the ISAPI modules. For Vista 64-bit, go to this page, agree to the terms and conditions and download the zip file.
1.7) After unzipping the file to a directory of your preference, run the command prompt in administration mode.
1.8) Go to that directory and type fcgisetup /install. You should get a success message like this:
Free Image Hosting at www.ImageShack.us

That´s it, time to configure PHP !

Labels: , , , , , ,

Changing UAC prompt behavior without rebooting

Ok, so I was reading about PowerShell [1] and saw a particular script that called my attention: The registry key to change UAC prompt behavior.

I wondered if that could allow me to change that behavior without rebooting the machine. IT DID !

So here are the .reg files that allow this.:

Turn_off_UAC_prompt.reg

Turn_on_UAC_prompt.reg

References
[1] Blog on PowerShell

Labels: , , , , ,

Installing Mysql5 on Vista 64-bit

Well,

<short digression>
Thanks to the MUI packages available on Vista Ultimate, I was able to change OS idiom simply by installing one of them and logging off (near 400MB pack which exploded to 1,5GB). No reboots.

This was needed because my OS main language is Portuguese, so now my OS and this tutorial share the same idiom.
</short digression>

1) Let´s first install Mysql5:

1.1) I read somewhere [1] that Mysql 5 wasn´t ready for Vista 64-bit. Nevertheless, I decided to try the EM64T package, highly encouraged by my environment variable:

PROCESSOR_IDENTIFIER = EM64T Family 6 Model 15 Stepping 11, GenuineIntel

So, if you dare, choose the "Without installer (AMD64 / Intel EM64T)" download file from :

http://dev.mysql.com/downloads/mysql/5.0.html#winx64

1.2) Expand the zip file in c:\. Vista extractor will create a directory like mysql-x.x.xxx-winx64 there.
1.3) Rename the directory to mysql.
1.4)Run a command prompt in administrator mode
1.5)Run the following command:

setx PATH "%PATH%;c:\mysql\bin;" /M

Shoud return

SUCCESS: Specified value was saved.


2.0) In the mysql directory (c:\mysql if you´re following the recipe), copy the my-innodb-heavy-4G.ini to my.ini . This will be the configuration file. Yes, we´ll stick to InnoDB because of foreign key constraints.
2.1) Open the newly created file in notepad and replace the text:

# Table type which is used by default when creating new tables, if not
# specified differently during the CREATE TABLE statement.
default_table_type = MYISAM


with this:
# Table type which is used by default when creating new tables, if not
# specified differently during the CREATE TABLE statement.
default_table_type = InnoDB

#Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts
#them to lowercase on lookup. Name comparisons are not case sensitive
lower_case_table_names=2

2.2) Note: This configuration file is for machines which have 4GB of memory installed. If yours don´t, locate and find the following variable on my.ini:

Change from
innodb_buffer_pool_size = 2G
To (suitable for 1GB RAM)
innodb_buffer_pool_size = 512M

2.3) Save and close the file. Time to install the Mysql service.

3.0) Go to the commmand prompt you opened in the previous step and type:
mysqld --install
And then (to start the service):
net start mysql
Free Image Hosting at www.ImageShack.us

That´s it, you should have the service installed and running by now.

References
[1] http://dev.mysql.com/doc/refman/5.0/en/windows-installation.html

Labels: , , , , ,

Tuesday, February 19, 2008

Running a command prompt in administration mode

Hit the windows key, and type cmd. Right click on the found program and select Run as administrator. If you have user account control (UAC) turned on, click on Confirm or OK when asked by the confirmation window.
Free Image Hosting at www.ImageShack.us

Labels: , , , ,

Setting an environment system variable in Vista command prompt

Instead of going all the way to the Environment variables button on System control panel as we got used to do, in Vista I just found out there is an easier way:

  1. Run a command prompt in administrator mode
  2. Run the following command:

    setx VARIABLE_NAME VARIABLE_VALUE /M


The /M switch tells Vista this is a System env variable.

Same effect, but lesser work !

Labels: , , , ,