Friday, December 30, 2011

Creating Dynamic PDF files using PHP

Here, we are going to study on converting HTML 2 PDF using PHP. Here we are going to use free open source PHP scripts to accomplish this file conversion. So we will be using FPDF for this, as all Libraries are already written for this And well Optimize also in terms of PDF generation time & size.

FPDF: The PDF Generator


The first and the main base for this file conversion is FPDF library. FPDF is a pure PHP class to generate PDF files on the fly. Let us start the PDF generation with a simple Hello world display.



<?php
require('fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>

To generate a pdf file, first we need to include library file fpdf.php. Then we need to create an FPDF object using the default constructor FPDF(). This constructor can be passed three values namely page orientation (portrait or landscape), measure unit, and page size (A4, A5, etc.,). By default pages are in A4 portrait and the measure unit is millimeter. It could have been specified explicitly with:
$pdf=new FPDF('P','mm','A4');

It is possible to use landscape (L), other page formats (such as Letter and Legal) and measure units (pt, cm, in).


Then we have added a page to our pdf document with AddPage(). The origin is at the upper-left corner and the current position is by default placed at 1 cm from the borders; the margins can be changed with the function SetMargins().


To print a text, we need to first select a font with SetFont(). Let us select Arial bold 16:



$pdf->SetFont('Arial','B',16);

We use Cell() function to output a text. A cell is a rectangular area, possibly framed, which contains some text. It is output at the current position. We specify its dimensions, its text (centered or aligned), if borders should be drawn, and where the current position moves after it (to the right, below or to the beginning of the next line). To add a frame, we would do this:



$pdf->Cell(40,10,'Hello World !',1);

Finally, the document is closed and sent to the browser with Output(). We could have saved it in a file by passing the desired file name.There are lot more functions in FPDF and we cannot cover all those in this article.
To learn FPDF, please browse http://www.fpdf.org.

Tuesday, December 20, 2011

1974: Build Your Own Computer at Home!

1974: The Altair 8800 microcomputer goes on sale. It doesn’t offer much, but it’s the small start of a big trend toward small things.

A small New Mexico company — with the big name of Micro Instrumentation and Telemetry Systems and the small name of MITS — manufactured the Altair as a do-it-yourself kit. At its heart was the Intel 8080 microprocessor, with the remarkable capacity of 8 bits, or 1 byte. (Later models used the 8080A.)

The kit offered a 256-byte memory, just about enough to contain one sentence of text. The Altair’s open, 100-line bus structure evolved into the S-100 standard.

Keyboard? Dream on. That was a few years in the future. Input was accomplished through the “Sense Switches” (I/O address 255), eight toggle switches on the left side of the front panel.

Display? More dreaming. Output was accomplished through LEDs on the front panel. LEDs, 1974: high tech, kiddo.

The Altair 8800 kit sold for just under $400 (about $1,900 in today’s money). If you wanted to forgo the case, you could get the kit for under $300. Or you could order the whole deal fully assembled: Old-Computers.com quotes a $595 price.

If you wanted to soup the thing up, MITS offered a few peripherals: a video card, a serial card for connecting to a terminal, a 64-KB RAM-expansion card and an 8-inch floppy drive. The floppies stored 300 KB each. Those were the days.

MITS founder Ed Roberts got the name Altair from the stellar destination in a Star Trek episode. The idea came from the young daughter of a Popular Electronics magazine editor.

Popular Electronics heralded the amazing gadget on its January 1975 cover. Right away, orders started pouring in.

News of the Altair 8800 excited Paul Allen and Bill Gates, who wrote the first microcomputer Basic for the 8800 and, within months, went on to found Microsoft together.

MITS sold more than 2,000 Altairs by the end of 1975, beyond Roberts’ wildest expectations. IMS Associates, which sold the remarkably similar IMSAI 8080 microcomputer, shipped 50 that year.

But the Altair inspired more than knockoffs. The Commodore PET, complete with keyboard and monitor, debuted in early 1977. The Apple II came out later that year.

MITS sold out to Pertec in 1977. Pertec kept making Altairs through 1978.

Microsoft and Intel are still around. You noticed?

Source: Various

Saturday, December 17, 2011

Facebook Timeline: 8 things to know

Social networking site Facebook's latest service Timeline has been globally rolled out. The company said Timeline had so far been available only to a few people, but now it had made it available to everybody. Timeline was announced by Facebook CEO Mark Zuckerberg at the f8 conference in September. Here's all you need to know about Facebook Timeline.

What is Timeline
Timeline allows users to compile and let others see everything they have shared so far, from photos, stories to shared videos and music. Some of the things a user can do on Timeline are: edit his basic info, jump to the past, view his activity log, check highlights from each month, star stories he wants to highlight, add life events, update his status, view and add photos and share his app activity.

How it is different from your current profile
Presently, only latest pictures or posts of users are visible, while large part of the previous posts are hidden. The only way to retrieve them is to scroll down and click on "More Stories". Timeline on the other hand retains a user's older posts, photos etc and also groups them datewise making it easy and convenient for viewing.

Activating Timeline
To get Timeline, a user needs to simply go to the Introducing Timeline page and click on 'Get It Now'. Or he can wait till he receives an announcement at the top of his profile.

How it works
Once a user upgrades to Timeline, he will get seven days to review everything that appears on his Timeline before anyone else can see it. You can also choose to publish your Timeline at any time during the review period. If a user decides to wait, his timeline will automatically go live after seven days.

His new Timeline will replace his profile, however, all his stories and photos will remain there. Users, who want to see how their Timeline would appear to other people, can click on the 'gear menu' at the top of their Timeline, and select "View As." This shows them how their timeline will appear to a specific friend or public.

Friends List
For those who always keep their Friends List private, Timeline is a curse as it prominently displays just how 'popular' you are on Facebook and who all are connected with you. There is no apparent way to turn it off, unlike earlier settings. This may be a major put-off for those who do not want to share their Friends List with all and sundry for various reasons.

Life out in the open
Timeline puts your life out in the open like never before. Unlike the earlier single webpage design where older content - shares, status updates, notes, likes, comments, photos and notes - kept getting buried under labyrinths of time, Timeline's scrapbook interface has now given an excellent tool to people to determine others' Facebook.

This may not be such a great news for those not keen on sharing each and everything from their life with everyone. So before rushing to publish your Timeline, it is advisable to spend hours and hours reviewing what content you don't want to share, and delete or remove from Timeline. You get a week before Timeline will automatically go live on December 23, even if you decide not to publish.

Activity Log
Activity Log is a place where users can review all their posts and activity, from today back to when they first started using Facebook. Only users will be able to see their activity log.

A user will be able to see two dropdown menus next to each story in their activity log. The first is to see and adjust the privacy of a post. The second one is to allow a user to decide if he actually wants a post to appear on his timeline. Users can feature, hide or delete any of their posts.

As for how to find a certain story, post or photo, all a user needs to do is click the "All" dropdown at the top of his activity log and select what he is looking for.

Timeline on my mobile
Apart from making Timeline available on Web, Facebook has also launched Timeline on Android and m.facebook.com.

Mobile Timeline starts with a user's unique cover photo. As a user scrolls down, he will see his posts, photos and life events as they happened.

Photo albums and other posts are horizontally swipeable, so that one can view multiple photos or posts inline without leaving timeline. A user can also swipe through the views at the top of his timeline to navigate to your map, photos, subscribers and more.

Monday, December 12, 2011

How to Install Windows 7 Or Windows 8 From USB Drive

In case your DVD-Rom is not working & you have a usb drive of capacity at-least 4 GB, & Windows7 or Windows8 DVD image we can still install OS on our Machine without a Disk. For this follow these steps.

Requirements:

*USB Flash Drive (Minimum 4GB)

*Windows 7 or Windows 8 installation files.

Follow the below steps to create bootable Windows 7/Windows 8 USB drive using which you can install Windows 7 or Windows 8 easily.

Procedure:

1. Plug-in your USB flash drive to USB port and move all the contents from USB drive to a safe location on your system.

2. Open Command Prompt with admin rights. Use any of the below methods to open Command Prompt with admin rights.

*Type cmd in Start menu search box and hit Ctrl+ Shift+ Enter.

Or

*Go to Start menu > All programs > Accessories, right click on Command Prompt and select Run as administrator.

3. You need to know about the USB drive a little bit. Type in the following commands in the command prompt:

First type DISKPART and hit enter to see the below message.



Next type LIST DISK command and note down the Disk number (ex: Disk 1) of your USB flash drive. In the below screenshot my Flash Drive Disk no is Disk 1.

4. Next type all the below commands one by one. Here I assume that your disk drive no is “Disk 1”.If you have Disk 2 as your USB flash drive then use Disk 2.Refer the above step to confirm it.

So below are the commands you need to type and execute one by one:

SELECT DISK 1

CLEAN

CREATE PARTITION PRIMARY

SELECT PARTITION 1

ACTIVE

Now for formatting we can use any of these two methods

FORMAT FS=FAT32

if you choose to use ntfs, you'll later have to run the "Bootsect.exe /nt60 G:" command to put boot manager compatible files onto your USB flash drive to make it a bootable device. Now i am choosing ntfs

FORMAT FS=NTFS

(Format process may take few seconds)

ASSIGN

EXIT


Don’t close the command prompt as we need to execute one more command at the next step. Just minimize it.




Note: Doing this much steps through command prompt will take around 20-30 minute, So we can save time using graphical way i.e. Right click on USB drive Select format option & use quick format it will save our 20-30 minute. and then we can continue with further procedure of installing Boot-loader .


5. Next insert your Windows7/Windows 8 DVD into the optical drive and check the drive letter of the DVD drive. In this guide I will assume that your DVD drive letter is “F” and USB drive letter is “H” (open my computer to know about it).

6. Maximize the minimized Command Prompt in the 4th step.Type  the following command now:

D: CD BOOT and hit enter.Where “F” is your DVD drive letter.

CD BOOT and hit enter to see the below message.

7. Type another command given below to update the USB drive with BOOTMGR compatible code.

BOOTSECT.EXE /NT60 H:



Where “H” is your USB drive letter. Once you enter the above command you will see the below message.

8. Copy your Windows 7 or Windows 8 DVD contents to the USB flash drive.

9. Your USB drive is ready to boot and install Windows 7 or Windows 8. Only thing you need to change the boot priority at the BIOS to USB from the HDD or CD ROM drive. I won’t explain it as it’s just the matter the changing the boot priority or enabling the USB boot option in the BIOS.