Jaslabs: High performance Software

High Performance Software

Archive for February, 2006

using pear cache_lite for high performance

By Justin Silverton

What is cache lite?

Cache_lite is a php/pear caching module that is designed for high traffic sites. It is different than most caching systems because it has a built-in locking mechanism that will prevent cache corruption that can sometimes occur when there are a large amount of concurrent users trying to read and write to your cached data.

How to use it

Here is a simple example on how to cache your data:

//assign an id to the cache object
$cacheid = ‘589′;

$cache_options = array(
‘cacheDir’ =&gt ‘/cachetmp’, //this is the temp directory of the cache files
‘lifeTime =&gt 5000 //time, in seconds, of how long the cache will be valid
);

// Create a Cache_Lite object
$Cache_object = new Cache_Lite($cache_options);

// Test if thereis a valide cache for this id
if ($data = $Cache_object-&gtget($cacheid)) {

// data is in our cache, access it through $data

} else { // Not found in cache, it needs to be added

$Cache_Lite-&gtsave($data);

}

?>

Performance tip: Don’t include every package your page needs. Only load the modules you need when the page is not in the cache.

Example:

&lt?php
require_once(”Cache/Lite.php”);
// (…)
$cache_object = new Cache_Lite();
if ($data = $cache_object-&gtget($cache_id)) { // cache hit !
echo($data);
} else { // page has to be constructed
require_once(”…”)
require_once(”…”)
// (…)
$Cache_object-&gtsave($data);
}
?&gt

Downloading

Cache_lite is part of the free pear package, which is a large repository of modules available Here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
No comments

using paypal mass payment

By Justin Silverton

IntroductionMass Payment allows anyone with a Premier or Business account to send multiple payments instantly—saving time, money and the hassle of having to individually send funds to every payment recipient. Mass Payment allows anyone with a Premier or Business account to send multiple payments instantly—saving time, money and the hassle of having to individually send funds to every payment recipient.Click the links on the left of this page to learn more about Mass Payment.

Mass Payment allows anyone with a Premier or Business account to send multiple payments instantly—saving time, money and the hassle of having to individually send funds to every payment recipient.Click the links on the left of this page to learn more about Mass Payment.Mass Payment can be used for such things as:

Mass Payment allows anyone with a Premier or Business account to send multiple payments instantly—saving time, money and the hassle of having to individually send funds to every payment recipient.Click the links on the left of this page to learn more about Mass Payment.Mass Payment can be used for such things as:

  • Affiliate commissions
  • Customer rebates
  • Pay-to-surf rewards
  • Employee benefits
  • Lottery prizes
  • Survey incentives

File FormatYou must create a tab-delimited file containing your recipients’ information to send a Mass Payment file. A tab-delimited file can be generated from most spreadsheet applications, such as Excel.You must create a tab-delimited file containing your recipients’ information to send a Mass Payment file. A tab-delimited file can be generated from most spreadsheet applications, such as Excel.Column 1: recipients’ email addresses.
Column 2: the payment amounts for each recipient.
Column 3: the three-letter currency code for the currency of the payment (only one currency type is allowed for each Mass Payment file):
You must create a tab-delimited file containing your recipients’ information to send a Mass Payment file. A tab-delimited file can be generated from most spreadsheet applications, such as Excel.Column 1: recipients’ email addresses.Column 2: the payment amounts for each recipient.Column 3: the three-letter currency code for the currency of the payment (only one currency type is allowed for each Mass Payment file):

You must create a tab-delimited file containing your recipients’ information to send a Mass Payment file. A tab-delimited file can be generated from most spreadsheet applications, such as Excel.Column 1: recipients’ email addresses.Column 2: the payment amounts for each recipient.Column 3: the three-letter currency code for the currency of the payment (only one currency type is allowed for each Mass Payment file):

  • EUR for Euro
  • USD for U.S. Dollar
  • GBP for Pound Sterling
  • CAD for Canadian Dollar
  • JPY for Yen
  • AUD for Australian Dollar

Column 4 (optional): a unique identifier for each customer for easier overall record-keeping. The unique identifier must be equal to or less than 30 characters, and must not contain any spaces. Examples of name format: Pitel, John; John_Pitel; JohnPitel.

Column 5 (optional): customized notes about each customer.

How to export a table in comma delimited text format (using mysql):

Here is an example on how to export your mysql tables in the above format:

select field1,field2,’USD’ from paypal_payments into outfile ‘$export_long_name’ fields terminated by ‘\t’ lines terminated by ‘\r\n’”;

in mysql, when you are selecting data from a table, if you add a string in quotes ’string’, it will add on that string in a separate column for each record returned.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
3 comments

File downloads in PHP

By Justin Silverton

This is a simple code snippet. It will allow you to force the web-browser that is currently viewing your script to come up with a file-download box (and the a file on your system can be downloaded).

Here is the code:

//so only the data from the headers is sent
ob_start();
//dispable caching
header (”Cache-Control: must-revalidate, pre-check=0, post-check=0″);
header (”Content-Type: application/binary”);
header (”Content-Length: ” . filesize($export_long_name));
header (”Content-Disposition: attachment; filename=yourfile.ext”);
readfile($export_long_name);

A list of of mime types can be found Here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
No comments

The history of Apple

By Justin Silverton

Here is an interesting article I found on the history of apple.

Before Apple

John Sculley’s childhood was the antithesis of Steve Jobs’. His father was strict and had impossibly high standards for his son.

Sculley attended St. Marks, an exclusive private boarding school made up of blue blooded Northeasterners. While there, he succeeded socially and academically, becoming the captain of the soccer team and earning impeccable grades at the same time.
Being sociable was not easy for Sculley, however, and he feared it. He had to train himself to be sociable. He says in his autobiography, Odyssey, that he decided that he would overcome his stutter and become an inspiring speaker, and he did.

To learn appropriate body language during speaking, he went to movie after movie, studying the actors’ poses, committing them all to memory.

It worked. Throughout his career, his speaking skill would be commended, though it was not perfect. He was nervous in crowds and recoiled at being touched. He often sat by himself in the Apple cafeteria eating his peanut butter sandwich until some merciful employee joined him.
After St. Marks, Sculley studied at Wharton, and he eventually married the daughter of the chairman of PepsiCo, Don Kendall. The two soon divorced, though Sculley maintained a close relationship with his former father-in-law, who gave him a job managing PepsiCo’s struggling Brazilian snack division, which soon became the most profitable division in the southern hemisphere…

The rest can be found Here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
No comments

Bart’s preinstalled Environment (PE)

By Justin Silverton 

What is Bart’s PE?

PE Builder is not a Microsoft product and does not create Microsoft Windows Preinstallation Environment (”Windows PE”). Using PE Builder does not grant you a license to Microsoft Windows PE or to use the Windows XP or Server 2003 binaries in a manner other than stated in the End-User License Agreement included in your version of Microsoft Windows XP or Windows Server 2003. Microsoft has not reviewed or tested PE Builder and does not endorse its use.Please do not contact Microsoft for support on the preinstallation environment that has been created by PE Builder!Microsoft does not provide support for PE Builder or for the preinstallation environment created by PE Builder.The PE Builder program (pebuilder.exe) runs on Windows 2000/XP/2003/BartPE. It does not run on Windows NT4/ME/9x.To avoid any confusion, the bootable CD generated by PE Builder should be called by its nickname “BartPE”!

Differences between BartPE and Windows PE

  • Target - Microsoft sees Windows PE as an installation platform. Bart sees Windows PE as the next generation rescue platform.
  • Start-menu - Bart’s builder gives you a simple, dynamic and powerful start-menu (Nu2Menu, see screenshots). Microsoft’s builder does not give you a start-menu, it uses a command prompt.
  • Build from - Bart’s builder can also build from Windows XP Home Edition or from a preinstalled Windows XP version (without CD).
  • Plugins - With PE Builder you can easily add applications, drivers or tools using plugins. This makes PE Builder extremely powerful. The end user can even combine plugins from different software vendors into one CD image.
  • Network support - PE Builder includes its own network support tools (bartpe/penetcfg) to start TCP/IP and Microsoft Client. The TCP/IP settings like: dynamic/static ip-address, subnet-mask, default gateway, dns-servers computer-name, workgroup can be changed on-the-fly. You can create pre-defined profiles, that you can select. Microsoft Windows PE only supports DHCP or fixed settings using winbom.ini.
    Also there is a plugin (NwDskPe) created by Erwin Veermans that loads the Netware Client on BartPE (IP/IPX).
  • Fileshare - BartPE can start File Sharing support so you can connect to the system through a share.
  • VNC - Because of the File Sharing support you can also run UltraVNC.
  • Dos support - Bart’s builder has a plugin called “dospe”.
  • License - Microsoft Windows PE is only for Enterprise/OEM customers (see previous), BartPE is for everybody!
  • 64-Bit - Bart’s builder does not support Windows 64-bit editions.

Requirements

The files from your Windows Installation CD-Rom.Supported Windows versions are:
Windows XP Home Edition (must be slip streamed with Service Pack 1 or higher)
Windows XP Professional (must be slip streamed with Service Pack 1 or higher)
Windows Server 2003, Web Edition
Windows Server 2003, Standard Edition
Windows Server 2003, Enterprise Edition
PE Builder runs on Windows 2000/XP/2003/BartPE systems.
CD/DVD writer if you want to creat a bootable CD/DVD.

The Download is available Here

Another great project based on barts PE called the Ultimate Boot CD can be found Here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
4 comments

Next Page »