Pages

Friday, September 28, 2007

Oracle XE and PHP 5 on Windows

Even though most PHP applications use MySQL / SQLite / Postgres for database driven applications sometimes you need to integrate information from an Oracle database and you need PHP to do the talking. Oracle XE helped and encouraged developers to write applications using Oracle. So, there are several ways to connect to an Oracle:
  • using odbc
  • oci8 extension available for both PHP 4 and PHP 5
  • PDO (pdo_oci)
I will present some basic configuration for accesing Oracle [XE] database using OCI extension and PDO. PHP using OCI8 to access Oracle XE database First of all make sure the server (Oracle instance) is running and you have a valid user/password combination. Also make sure, the user is not locked. In php.ini uncomment:
extension=php_oci8.dll
Note: make sure extension_path is set correctly. php_oci8.dll depends on oci.dll. You can find oci.dll in oracle bin folder (something like \oraclexe\app\oracle\product\10.2.0\server\BIN). Copy oci.dll in %WINDIR%\system32. Now restart apache web server. Sample connection script:
$ora_conn =  oci_connect('hr','****','xe');
$sql = "SELECT * FROM EMPLOYEE";

$statement = oci_parse ($ora_conn, $sql);
oci_execute ($statement);
while ($row = oci_fetch_assoc($statement)) {
print_r($row);
}
oci_free_statement($statement);
And that's about it. PHP using PDO to access Oracle XE database Uncomment in php.ini the following lines:
extension=php_pdo.dll
;...
extension=php_pdo_oci.dll
Also, see above note referring to oci.dll. Restart Apache web server. Sample script using PDO:

try {
    $dbh = new PDO('oci:host=localhost;dbname=xe', 'hr', '*****');
    $rs = $dbh->query('SELECT * from EMPLOYEES WHERE ROWNUM<10');
    
    if($rs) {
        foreach ($rs as $row) {
            print_r($row);
        }
    } 

    $dbh = null;
    
} catch (PDOException $e) {
    print 'Error!: ' . $e->getMessage();
    die();
}
}

Sunday, July 01, 2007

Aptana IDE - Adobe AIR support

Aptana recently released a plugin to support Adobe AIR development. Aptana IDE + Adobe® AIR is beta for now. The plugin is very usefull for HTML/Javascript development using Adobe Integrated Runtime. How to Install Aptana provides an update tool for plugins, so installations it's easy. More details can be found watching the screencast: Aptana: Introduction to Adobe AIR Good luck developing Adobe AIR applications! PS: You can win the trip of a lifetime! All you need to do is develop and submit an application. More details cand be found on Adobe website: Airderby

Thursday, June 28, 2007

Installing Adobe AIR on Windows Vista


1. Download Adobe AIR SDK from Adobe labs



2. Extract the archive to a designated folder, in our case E:\AIR. (I am using 7-zip




3. You need to set PATH environment variable to your Adobe AIR bin folder (E:\AIR\bin). To do that, right click on "My Computer" and click on Properties:






4. Click on Advanced system settings and then on the new window click on Environment Variables:



Select "PATH" and click Edit...
Then, type: ;E:\AIR\bin



5. Press Ctrl + R and type cmd. Then type: adt. If a meessage like:

Too few arguments.
usage:
adt -package ...

comes up, then Adobe AIR is installed on your system.




6. Now, to really run something on AIR. Open on your browser: Adobe AIR sample applications.
.


Download Fresh, which is an rss reader built using HTML/javascript/ajax & co and unzip it to E:\AIR\samples\Fresh.
The contents of the folder should look something like this:



Now open a console (if you closed the previous one) and type: e: (go to drive E: or whatever drive you used to unzip Adobe AIR sdk) and then type: cd E:\AIR\samples\Fresh.
Now type: adl application.xml:


And now we have Fresh running on AIR:



Enjoy!

Monday, June 25, 2007

iPhoneDevCamp

First iPhoneDevCamp will take place between 6-8 July:

PhoneDevCamp is an upcoming gathering, inspired by BarCamp, SuperHappyDevHouse, and MacHack, to develop web-based applications and optimize web sites for iPhone. It is a non-commercial event, organized by volunteers, with attendance free to all. By the completion of the weekend event, a number of iPhone-ready web applications and web sites will be launched to the public. The event will be held at the San Francisco offices of Adobe, and out-of-town guests are welcome.

Attendees will include web designers, developers, testers, and iPhone owners, all working together over the weekend to improve the web experience for iPhone. Development projects will include both solo and team efforts. While some attendees will wish to work solo during the event, we encourage attendees to team up, based on expertise, to work in ad-hoc project development teams. All attendees should be prepared to work on a development project during the event. You do not need to own an iPhone to attend (although, a large number of iPhones at the event will make the development and testing process much easier).

Attendees will be able to:

  • Create new web applications for iPhone.
  • Optimize existing web applications for iPhone.
  • Migrate Dashboard Widgets to web-based widgets for iPhone.
  • Test and optimize web sites for iPhone.
The event is being held the week following the public release of iPhone, to allow prospective attendees some time to acquire an iPhone. This also allows early-acquirers the opportunity to do some experimentation before attending the event.

iPhoneDevCamp is not affiliated with Apple, Inc.

More details at: iPhoneDevCamp

Wednesday, June 20, 2007

iPhone SDK - Safari, iPhone Apps = Web 2.0

Steve Jobs announced that:
revolutionary iPhone™ will run applications created with Web 2.0 Internet standards when it begins shipping on June 29. Developers can create Web 2.0 applications which look and behave just like the applications built into iPhone, and which can seamlessly access iPhone’s services, including making a phone call, sending an email and displaying a location in Google Maps. Third-party applications created using Web 2.0 standards can extend iPhone’s capabilities without compromising its reliability or security.
Source: iPhone to Support Third-Party Web 2.0 Applications It's a very nice approach and a bold move. Basicly, now he have affordable internet access on mobile phones, so why not use that... I can't wait for iPhone to be available in Romania, too... Meanwhile you can track a list of iPhone applications: iphoneapplicationlist.com

Friday, March 30, 2007

Open-VPN on Windows Vista

Because I got a new laptop (Notebook Toshiba Satellite A100-599 Centrino Duo T7200, 2.0GHz, 1GB, 160GB, VISTA) with Windows Vista preinstalled, and I needed to use Open-VPN, I started searching for some info about how to use it. Download and install: Open-VPN GUI. Put your configs to C:\Program Files\OpenVPN\config. Add:
route-method exe
route-delay 2
to your *.ovpn file (client.ovpn) Run as Administrator (right click) C:\Program Files\OpenVPN\bin\openvpn-gui.exe. (If you don't run it with admin privileges, the TAP adapter won't work) And that's it..

Saturday, October 07, 2006

North Korea and nuclear tests

I don't post this kind of stuff, but I couldn't help it. I was reading on Google News this headline:
U.N. asks North Korea to cancel nuclear test
Source: Seattle Times The reaction: Oh no! Not now!
Japan's newly elected Prime Minister Shinzo Abe said Friday that the tests could come as early as this weekend. U.S. spy satellites have detected sustained activity at a suspected underground test site in the north. Abe will travel to Beijing on Sunday and Seoul, South Korea, on Monday to press for support in corralling North Korea's nuclear ambitions.
So, BigBrother is watching...
The source, who spoke on condition of anonymity, said a device would be detonated about 6,500 feet inside a mine near the border with China in the north of the country. North Korea has timed its military exercises to coincide with significant dates: it launched missiles July 4, despite international warnings. Monday is North Korea Workers' Party Day. [...] The Security Council statement said that a test would not bring Pyongyang closer to its goals. Rather it would "bring universal condemnation by the international community," the statement said. "The Security Council urges the DPRK not to undertake such a test and to refrain from any action that might aggravate tension," the statement added, using the acronym for the country's official name, the Democratic People's Republic of Korea. Chief U.S. delegate John Bolton said that the council takes the threat seriously, and the United States is prepared to push for international economic sanctions. "If they do test it, it will be a very different world the day after," he said before the meeting. "There would be another nuclear power. This would be proof positive of North Korea having a weapon." [...] Russian diplomats said they were "very concerned" about the possibility of a test.
Ok, US will take actions, and use UN also for their goal... So, after Afganistan, I was expecting a move on Iran, and leave DPRK alone, for some time... but it seems they are acting on 2 fronts: Middle East
LONDON — The United States and five other major powers agreed Friday to take the next step toward imposing sanctions on Iran for failing to comply with a U.N. resolution to prevent it from subverting its nuclear energy program to develop a nuclear weapon, according to U.S. and European officials. Source: chron.com
and DPRK (above quotes) ... One wrong step from any of these countries and war is closer than ever. What is the really scary thing is that nuclear weapons are at stake. In Afganistan the situation was different, war for oil, US gets a better position on world oil market, and a place at OPEC table. And God help us when someone will push the trigger.

Sunday, September 24, 2006

MySQL Front discontinued

I was surprised to see on Mysql-Front website this announcement:
MySQL-Front has been discontinued since MySQL AB forced us to remove this program from the market. Thanks a lot for all your help! Your MySQL-Front Team We hope the humanity will learn to work together instead of fighting another senseless...
Getting curious about this started to search on google... Lenz Grimmer clarified this for me:
Clarification: MySQL AB did not force the removal of MySQLFront Our web team informed me that we received a few comments from users about MySQL AB supposedly shutting down the development of the MySQLFront utility. I'’d just like to clarify that this was not the case at all we merely asked the developers to stop violating our trade mark as outlined in our Trade Mark Policy. As I wrote some time ago, our trade marks are a very important asset to us as a company and we need to take action, if our marks are being violated. We did not ask or force them to stop the development or to remove the program from the market completely– this was their very own decision. In fact, we actually encouraged them from the beginning of our discussion to continue the development of the product under a different name. The problem appeared resolved as the project was renamed to SQLFront and the old web site pointed to the new location - we regret that the developers decided to shut down the entire project shortly afterwards. We encourage and support every application that broadens the MySQL Ecosystem. Why would we want to completely shut off applications that support us?
Lenz Grimmer works MySQL AB as a member of the community relations team. The MYSQL AB Trademark policy provides the information related to authorized use of MySQL AB marks. The "problem" is caused by the usage of MySQL as a part of a commercial product name, that is not developed by MySQL. I still don't understand why they shut down the project and communicated that kind of message... Lack of funds and they found a way to close it and blame someone else? /Later edit MySQL Front development continues at Sourceforge under a new name HeidiSQL

Tuesday, September 19, 2006

Marketing on blogs

A Romanian online gift shop launched 2 days ago a campaign named “Blog this!” The main idea is to write an article on your blog which follows the rules: - the article must contain a link to Christmas Gifts category - the article must not look like and advertisement, but cannot be strongly negative nor defaming - after you publish the article send them an email with the link - the publisher must have at least 10 articles in his blog It’s a win-win situation. The problem is that one side wins more, other side less, exponentially less… This type of advertising can be included in the broadly defined guerrilla marketing, with some viral parts, also similar with a stealth campaign, buzz marketing & co (use of social networking – blogs, the prize – I doubt the actually paid for the ads they are offering, maybe it’s a joint-venture campaign )… The goal is obvious: achieve a better visibility for a category, create a buzz, get inboud links (from >100 blogs, with the condition to be indexed by google), increase number of visitors on the website, basicly promote the store using "word-of-mouth" and buzz. The effect: - in 2 days they got 27 winners ( and all the good or bad content and inbound links) - some good “Gossip” and buzz from Radu Ionescu, Zoso, Tudor Mateescu, Blogoree Blog and others It is nice to analyze the effect of the campaign in January 2007, maybe they will publish some figures… or not. At leat check google to see how many inbound links they got and from where, and position in google for some keywords (Christmas gifts :D ), number of visitors, referrals. What can I say more? it’s a campaign, and from the figures point of view I believe it is a profitable one. Moral and profit are not in the same league.

Wednesday, September 06, 2006

Adobe buys InterAKT

Adobe recently acquired the technology assets of InterAKT, maker of extensions for Macromedia® Dreamweaver® from Adobe. The acquisition further strengthens Adobe’s position as a leading provider of web design and development tools. For additional information, please read the F.A.Q. page on our website.
And the 1st question in FAQ:
Why did Adobe acquire InterAKT? A: Adobe acquired InterAKT to enhance existing product lines, including Macromedia Dreamweaver and Adobe Flex. The new development center will also provide Adobe with greater access to and expertise in the Eastern European market.
Anyway, Macromedia should have done that before, but, I don't think they studied the market that well. Most InterAKT client were not from Romania... And InterAKT extensions for Dreamweaver are popular in central/western Europe and USA. As the announcement states, the direction will be continuing the production line for Dreamweaver extensions, migrate existing products to Adobe technology (myfeedz will use Flex)
We expect that most current InterAKT employees will remain with Adobe following the integration.
:) We will see about that... InterAKT had 32 employees So basicly as I see it: - Adobe work style will be implemented - personnel migration is inevitable, the company will grow, but some employees will leave (foreced or by thieir own decision) - primary focus: dreamweaver extensions and improve Adobe Flex, or just build components for Adobe Flex. - MX Kollection is renamed to Kollection, and they cannot "kill" the product, because of its customers, so I think it will be refactored to use Flex, sell it in the future. They should be able to "catch" some projects with the government, because until now, MCTI website was the only website developed by a company that knows what is doing, and not made by some kid at 7th hand... Updates will be available after I find more information.

Tuesday, August 15, 2006

GWT Beta Version 1.1

Well, Google Web Toolkit beta version 1.1 has been released. On July 21st they said that the next release will have:
  • Localization Easily localize strings and formatted messages
  • XML classes An XML library based on the W3C DOM
  • JSON classes JSON is moving into gwt-user.jar, and it's much faster than the sample in 1.0.21
  • FileUpload widget The much-requested file upload widget
  • FormPanel widget Easily submit traditional HTML forms from GWT apps
  • RPC optimizations Speed improvements and a more compact wire format
  • JUnit enhancements Unit tests are much, much faster than in 1.0.21, and you can now test asynchronous things like RPCs and timers
Also, annouced that Maven is used for the building process. More features in current release:
  • Automatic resource injection Modules can contain references to external JavaScript and CSS files, causing them to be automatically loaded when the module itself is loaded.
  • gwt-servlet.jar Deploy this jar to add RPC to your servlet-based webapps without having to manually crack open gwt-user.jar to remove the servlet API classes.
  • Javadoc-style API documentation By popular demand :-)
  • An automatic mechanism to stop the browser from caching the .nocache.html file for your module.
I'm still waiting for a large scale app, built with GWT.

Sunday, August 13, 2006

Phalanger - PHP Compiler for .NET

The original description is:
The Phalanger is a complex solution giving web-application developers the ability to benefit from both the ease-of-use and effectiveness of the PHP language and the power and richness of the .NET platform. This solution enables developers to painlessly deploy and run existing PHP code on an ASP.NET web server and develop cross-platform extensions to such code taking profit from the best from both sides. Compatible with PHP 5.0, the object model in Phalanger enables to combine PHP objects with the .NET ones. It is possible to use a class written in PHP from a .NET application or even to import a .NET class (written for example in C# or Visual Basic .NET) into PHP scripts provided that this class respects the PHP object model implemented in the Phalanger. The Phalanger is the only existing PHP compiler which produces .NET Framework MSIL bytecode.
Some benchmarks were posted on the website with Phalanger 1.0 Beta 3, PHP 4.3.11, and PHP 5.0.4 with and without Zend Optimizer, and some php based popular apps: Nuke and phpBB compared. The tests were done on a Windows machine. Anyway, looking at the benchmarks Roadsend seems interesting too. The idea is that PHP for .NET is a viable solution, and compiled php is an improvment.

Tuesday, July 11, 2006

Creole Trac - Ticket spam

Well, spammers get better, after blog spamming, trac is vulnerable. Creole is using trac for development, and while browsing through tickets, found this: Public comments and new tickets seem to be suppresed now for anonymus users. Example: Ticket: MSSQL driver errors Edgewall is working on a spam filter, which will be released with 0.10 Milestone Until then, disable anonymus content or you can try experimental spam filter. A quick fix could be:
DELETE FROM ticket_change WHERE author = "spammer_name";
--update  ticket version and milestone, which is altered
UPDATE ticket SET version = '', milestone = '' WHERE version = 'HEAD' AND milestone = 'MILESTONE_NAME';

Monday, May 22, 2006

Database administrator Job Role

Even though I said to myself that I will not post on this blog anything that will be praise to myself... After passing the Oracle PL/SQL test, I have achieved the Database Administrator Job Role: So, from now on you can trust me on administrering your database... The last test for this job role: Oracle PL/SQL Programming :)

Thursday, March 09, 2006

Zend framework preview

Zend framework preview is out... after some quick fixes, the discussions started... Chris Shiflett wrote a tutorial for php|arch (in a big hurry it seems)... I consider the Model in an MVC framework a key component, while in this tutorial Chris uses a Database object, no ZActiveRecord ( I thought zend will find the Panacée for Active Record), no ORM library (Zend_Db_Table - Row Data Gateway, Zend_Db_Table_Row or any Zend_Db component). He explains that: "Because the database components of the Zend Framework are still relatively unstable, I use a class for storing and retrieving news entries and comments" ... Is understandable because this is just a preview release, but I was expecting more... The coding standards are not followed... (tabbed indented files, 2 spaces indented file)... It seems there is alot of work to be done.. Yesterday Zend Framework Preview 0.1.2 was released; important updates: unit tests and controller documentation :) For testing is used: PHPUnit2, not simpleTest, not Test::More... I hope that soon we will see a stable framework, that can be compared with Zope...

Saturday, November 12, 2005

Brainbench BCIP - Web Developer

Brainbench confirms some of my skills (I know I'm modest too..), I got the job role: I did't have enough time to finish some database programming test, so Database Administrator job role is delayed.... Anyway, my other Brainbench certifications: Again I'm dissapointed by most Romanian employers that have no idea what Brainbech is. It was a nice feeling to see the top scores and my name among them... But, theese are just some orange images, and what is important is the experience and skills applied.

Wednesday, August 24, 2005

PHP 4 constructor and destructor

Here is a way to have constructor and destructor functions in php4:
/*
*
* Because php 4 does not have a proper OOP implementation
* here is a way to have php4 destructor and constructor
*
*/
class demoClass
{
// {{{ constructor
/**
 * php4 class contructor
 *
 * @return object
 */
function demoClass()
{
 //destructor
 register_shutdown_function(array(&$this, '__destruct'));

 //constructor
 $argcv = func_get_args();
 call_user_func_array(array(&$this, '__construct'), $argcv);
}
// }}}

// {{{ __construct()
/*
* constructor function implementation
*/
function __construct()
{
 //code for constructor goes here
}
// }}}

//{{{ __destruct()
/*
* destructor function implementation
*/
function __destruct()
{
 //code for destructor goes here
}
//}}}
}

Thursday, August 18, 2005

Zend Certification Study Guide and Errata

Finally, after a week of waiting the Zend Certification Study Guide arrived. I was so eager to read it... Started reading the tests (I was really curious about the questions): chapter 1, page 15 first error: Discussed on phparch forum Jason Sweet cleared that out (printing error), but still, I believe it needed a better checking before releasing it on the market, and I bought the 2nd edition... After googleing, I found the Errata, and this discussion started by someone less patient than me... So, now I can continue my reading... And after that, I will take the test.

Tuesday, August 16, 2005

12th Brainbench badge

It's official, I know how to use Windows XP :D Well, I tested my skills in Computer Fundamentals (Win XP), and passed the test... Too many questions related to windows help system, I guess there were 10-12 question about how to use windows help, how to search, about the results and so on, and this is not my strong point, because I don't use windows help... Anyway, got this orange badge: Until now, my Brainbech Certifications, did not help me too much, here in Romania there are many employers that have no idea what Brainbench is... Sad

Tuesday, May 24, 2005

PySerial

A really nice module for Python that proved efficient and easy to use if pySerial... There are many devices that can comunicate with a PC through a serial port, so here is a script(listener) that uses pySerial to catch the output from such a device and store it in a file. Can be ajusted to handle a faster output from serial port...
import serial

#open second serial port, 0 for the first
ser=serial.Serial(1)

#loop forever
while 1:
  s=ser.readline()
  fileLog=open('serial_log.txt','a')
  fileLog.write('%s'%s)
  fileLog.close()
ser.close()