As a programmer, there are no real problems but challenges...ones that we need to overcome. This means that there is a solution for all challenges that one may face. For all the challenges that I have faced, I will share them and their solutions.
Tuesday, March 17, 2009
Limewire 5 for Ubuntu
I tried it, its pretty cool. I like the interface.
Its a torrent file. So just go to http://btjunkie.org/torrent/LimeWire-5-0-11-Pro-Linux-Ubuntu-Debian-HeartBug/41146c4054941a2493fd226f491e870560d5ec67851b and download the limewire for Ubuntu.
I use gnutella. I mostly download files using torrents. My favourite sites, isohunt.com, mininova.org and btjunkie.org.
Enjoy!!!
Friday, March 13, 2009
Past data between a popup and mask while popup is open
the code is below:
class popup_horses extends P4A_Mask {
var $selected_horses;
var $p4a;
function popup_horses(){
parent::p4a_mask();
$this->selected_horses = array();
$this->p4a = & p4a::singleton();
$this->checkIfHorsesWerePreviouslyAdded();
$page = & $this->showPage();
$this->intercept($this->Tbl->rows, 'afterClick', 'validatedSelectedHorse');
$this->display('main', $page);
}
function addPreviouslySelectedHorseNamesToArray(){
$horse_names = $this->getAllPreviouslyAddedHorseNames();
$temp_array = explode(',', $horse_names);
foreach ($temp_array as $temp){
array_push($this->selected_horses, trim($temp));
}
}
function checkIfHorsesWerePreviouslyAdded(){
if($this->isHorseAreasEmpty() == false){
$this->addPreviouslySelectedHorseNamesToArray();
}
}
function getAllPreviouslyAddedHorseNames(){
return $this->p4a->masks->parent_mask->taHorses->getNewValue();
}
function addSelectedHorseToArray($horse_name){
array_push($this->selected_horses, $horse_name);
}
function addSingleHorseToArea($horse_name){
$p4a = & p4a::singleton();
$p4a->masks->youtube_channel_archive->taHorses->setNewValue($horse_name);
}
function addHorseToAreaWithSeparator($horse_name){
$p4a = & p4a::singleton();
$horse_area_value = & $p4a->masks->parent_mask->taHorses->getNewValue();
$horse_area_value .= ", $horse_name";
$p4a->masks->parent_mask->taHorses->setNewValue($horse_area_value);
}
function validatedSelectedHorse(){
if(in_array($this->fields->horse_name->getNewValue(),$this->selected_horses)){
$this->showMessage("Horse already added", "warning");
} else {
$this->addSelectedHorseToArray($this->fields->horse_name->getNewValue());
if($this->isHorseAreasEmpty()){
$this->addSingleHorseToArea($this->fields->horse_name->getNewValue());
} else {
$this->addHorseToAreaWithSeparator($this->fields->horse_name->getNewValue());
}
}
}
function isHorseAreasEmpty(){
$p4a = & p4a::singleton();
if($p4a->masks->parent_mask->taHorses->getNewValue() == ""){
return true;
} else {
return false;
}
}
function validateForm(){
if(!p4a_validate::notempty($this->fields->distance->getNewValue())){
$errorMsg = "Please enter distance for race
";
}
if(!empty($errorMsg)){
$this->showMessage($errorMsg, 'warning');
} else {
$this->updateTableData();
}
}
function updateTableData(){
$track_record = & p4a::singleton('tract_record');
$this->saveRow();
if($this->setLastUpdated()){
$track_record->closePopup();
} else {
//$this->showMessage("Table data NOT modified!", "error");
}
}
function setLastUpdated(){
$dbObj = & p4a_db::singleton();
$today = & date('Y-m-d h:i:s');
$record_id = & $this->fields->distance_id->getNewValue();
//echo
$update = "
update race_distance
set date_modified = '$today'
where distance_id = $record_id;
";
if($dbObj->query($update)){
return true;
} else {
return false;
}
}
function createTable() {
$Tbl = & $this->build('p4a_table', 'Tbl');
$Tbl->setSource($this->createDBSource());
$Tbl->setVisibleCols(array('horse_name'));
$Tbl->showNavigationBar();
$Tbl->setWidth(400);
$Tbl->setTitle('Horse Name');
return $Tbl;
}
function createDBSource() {
$limit = 13;
$Src = & $this->build('p4a_db_source', 'Src');
$Src->setFields(array(
'horse.*'=>'*'
));
$Src->setTable('horse');
$Src->setWhere("");
$Src->setPk('horse_id');
$Src->addOrder('horse_name');
$Src->setPageLimit($limit);
$Src->load();
$this->setSource($Src);
return $Src;
}
function doReloadParentMask(){
$p4a = & p4a::singleton();
$parent = & p4a::singleton('track_record');
$parent->destroy();
$p4a->openMask('track_record');
}
function createEditor(){
$distance = & $this->fields->distance;
$btnAdd = & $this->build('p4a_button', 'btnAdd');
$btnAdd->setLabel('Add distance');
$this->intercept($btnAdd, 'onClick', 'validateForm');
$fsEditor = & $this->build('p4a_fieldset', 'fsEditor');
$fsEditor->anchor($distance);
$fsEditor->anchor($btnAdd);
$fsEditor->setWidth(350);
$fsEditor->setTitle('Race Distance Information');
return $fsEditor;
}
function doRefreshOriginalPage(){
$p4a = & p4a::singleton();
$this->destroy();
$p4a->openPopup($this->getName());
}
function showMessage($message, $icon){
$this->message->setValue($message);
$this->message->setIcon($icon);
$this->message->setWidth(500);
}
function showPage(){
$message = & $this->build('p4a_message', 'message');
$this->createDBSource();
$tableData = & $this->createTable();
$leftSide = & $this->build('p4a_frame', 'frmLeft');
$leftSide->anchor($tableData);
$frmPage = & $this->build('p4a_frame', 'frmPage');
$frmPage->anchorCenter($message);
$frmPage->anchor($leftSide);
$frmPage->setWidth(450);
return $frmPage;
}
}
?>
hope someone was able to understand this and it was what someone wanted to do what they wanted to do.
Solved!!!!!!!!!! Reload mask from popup
after i saved the record, i was trying to reload the mask that called the other mask and it wouldnt work. I figured that that was because it was the parent mask and it was still active - the child mask was still open. so i saved the record, closed the child mask and then reload the parent mask. i didnt see it that way before.
Code snippet
$this->saveRow();
if($this->setLastUpdated()){
$this->p4a->closePopup();
$this->destroy();
$this->p4a->masks->records->doRefreshOriginalPage();
}
i think i have published the code for the doRefreshOriginalPage some time ago on my blog.
it works!!!!!
Thursday, March 12, 2009
cp: omitting directory
If you are having this problem, this is how the command should look:
sudo cp -R [directory you are copying from] [space] [directory you are copying to]
Error: SAFE MODE Restriction in effect. Ubuntu Intrepid Ibex
So after going through all the things I thought I had done to cause that error, nothing worked so I went to my bed. When I was walking to work the next day, it hit me "safe mode". So after reaching work, the first thing I did was look for the php.ini file and check to see if safe_mode was on. Did I mention I was using ubuntu intrepid ibex? I am. :) It was. I turned it off and the error went. For those people who do not know where the php.ini file it, it is located here: /etc/php5/apache/. After turning safe_mode on or off, you will need to restart your apache apache. The commands to stop, start and restart your apache server are as follows: sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 restart.
Hope that solves someone's problem.
Sunday, March 8, 2009
My resume
Jerome A. Bailey
Objective
To be employed in a dynamic organization as an application developer and/or web developer.
Summary
Excellent written and verbal communication skills
Over 1 year’s experience in web development
Strong back end developer with wide skill set
Object Oriented PHP 5 web developer
PHP, MySQL, Linux, MVC, Zend, P4A, WAMP, and LAMP toolset
Skills
Professional
Web development / Programming, Database Design, Content Management System (CMS) Design.
Technologies
Linux (Ubuntu 8.10 - Intrepid Ibex, 8.04 - Hardy Heron), Windows (95-98, 2000, xp, vista), Java, C, C++, Prolog, SQL, VB .NET, MySQL, ASP .NET, PHP (3, 4 and 5), CSS, XML, WML, AJAX, DHTML, and JavaScript, Zend Framework, MVC (Model, View, Control) P4A (Php for Application), Adobe Photoshop, GIMP.
Applications
Zend Studio Editor, Microsoft FrontPage, Adobe Dreamweaver, Microsoft Excel, Microsoft Word, Microsoft Visio, Microsoft Access, Microsoft Publisher, Notepad.
Professional experience
Contract PHP Application / Web Developer
Chrysalis Communications
November 2008 - Present
Gained and applied knowledge and experience in the building of dynamic websites and applications of various sizes and levels of difficulty. Includes front end web site design, database design, backend development using open source toolset (PHP, MySQL, Linux), front end development with HTML, CSS, AJAX and JavaScript.
PHP Application / Web Developer
au Fait eSolutions
May 2007 – September 2008
Gained a lot of knowledge and experience designing dynamic web sites with the use of PHP, MySQL, HTML, DHTML, CSS and JavaScript. I also assisted with the design of customizable client databases and Content Management Systems (CMS). Designed dynamic web applications with the use of the Zend Framework, and P4A (PHP for Applications).
Education
BA in Computing and Information Technology, 2007
The University of Technology, Jamaica
Additional information
Hobbies include Basketball, Badminton, Chess, playing bass guitar and drums.
References
References can be made available upon request.
Tuesday, March 3, 2009
Reload mask from popup
Monday, March 2, 2009
Informatin Management System created by Me using the P4A framework!!!
Refresh Button with custom code for P4A Applications
I added the code to refresh the mask here: https://sourceforge.net/forum/message.php?msg_id=6595951 but I have included it below.
The function to create the toolbar is below:
function createToolBar() {
$toolbar = & $this->build('p4a_simple_toolbar', 'toolbar');
//$toolbar = & $this->build('p4a_simple_toolbar', 'toolbar');
$toolbar->buttons->save->setLabel('Save');
//$toolbar->addLabel($toolbar->buttons->save, 'Save Content');
//$toolbar->buttons->save->setTitle('Save Content');
$toolbar->buttons->new->setLabel('New');
$toolbar->buttons->delete->setLabel('Delete');
$toolbar->buttons->print->setLabel('Print Information');
$toolbar->buttons->cancel->setLabel('Cancel');
$toolbar->addSeparator('left');
$refreshMaskDefault = & $toolbar->addButton('refreshMaskDefault', 'reload', 'left');
$refreshMaskDefault->setLabel('Refresh Page');
$this->intercept($refreshMaskDefault, 'onClick', 'doRefreshOriginalPage');
$toolbar->setMask($this);
return $toolbar;
}
The function to refresh the maks is below:
function doRefreshOriginalPage(){
$p4a = & p4a::singleton();
$this->destroy();
$p4a->openMask($this->getName());
}
Anyone can add their image to the button but just use the code and refresh the mask without clearing the cookies. If there are any modifications to the code you can let me know. :) I am open to it.