Wednesday, November 30, 2011

Installing Advent Vega ModdedStock 1.10 v2

Checklist:
  1. Computer with USB port. (of course)
  2. USB Cable male to male (you have it already)
  3. USB Drivers from Advent Vega or From POV Mobii
  4. Vega Moddedstock 1.10 v2
You need to install Moddedstock 1.10 v2 to be successfully install vegacomb 3.2 build 9. Here is how:
  1. Charge your tablet, make sure it turned off.
  2. Install USB Drivers on your computer. You need administrative privilege to accomplish this.
  3. Connect the USB cable from your tablet to your computer.
  4. Hold "Back" button, for 2 second then, press the "Power" button 2 second and release, still hold the "Back" button 2 second after. Your tablet will enter recovery mode. You'll hear notification sound on the Computer, and a bubble saying new device found. Wait until driver installation complete, bubble "your device is ready to use".
  5. Run the Vega Moddedstock 1.10 v2. Your tablet will display "Entering nvflash recovery mode / nv3p server", just wait until the flashing complete, your vega will reboot and turned itself off.
  6. Remove your charger if you like, and turn on your vega with the modded stock installed.

Wednesday, July 13, 2011

iframe - ing the facebook dialog display

There is at least 3 kind of display for the facebook dialog:

  • page. the dialog will display with facebook header and footer taking all area of the page.
  • popup. the dialog rendered in a window.
  • iframe. we can render the dialog in an iframe element.

For the last display mode, we cannot find anywhere in the documentation, a good example. But, i think we can do this.

First as the documentation said, iframe display mode require an access_token. You must have this code in hand.

facebook application php SDK: Automatic Authorization

when user of facebook open your application for the first time, the SDK will authenticate the user and request for authorization.

the typical SDK suggestion is:

redirection method is up to the programmer. From the documentation, they use the login button or a link to the login page. The login url was constructed using the SDK function getLoginUrl().

if ($user) {
    $logoutUrl = facebook->getLogoutUrl();
} else {
   $loginUrl = facebook->getLoginUrl();
   echo "<a href='" . $loginUrl . "'>login</a>";
}

So user must click the login hyperlink. But using header function from PHP, we can change the code:

if ($user) {
    $logoutUrl = facebook->getLogoutUrl();
} else {
   $loginUrl = facebook->getLoginUrl();
   header("Location: $loginUrl") //remember to use double quote as we enclosed a variable
}

this code work fine, until you use it in facebook application canvas. In the canvas, it will redirect you to the facebook logo, and again user must click the "go to facebook" link.

I think there is no serverside solution for this, so our option is javascript:

if ($user) {
    $logoutUrl = facebook->getLogoutUrl();
} else {
   $loginUrl = facebook->getLoginUrl();
   echo "<script> top.location.href='" . $loginUrl . "'</script>";
}

this will entirely redirect the browser to the login or authorization dialog. So you think we done already. Not quite...

Tuesday, July 12, 2011

Note On Using header function in PHP

When using header function to redirect a request, make sure you are using double quotes in the parameter that you supply. Example:

header("Location: http://blogmodif.blogspot.com/2011/07/note-on-using-header-function-in-php.html")

and not like this:

header('Location: http://blogmodif.blogspot.com/2011/07/note-on-using-header-function-in-php.html')

which is using single quote. On both the above example, they will work though. But, when you want to use variable to set the URL, for example:

$myURL= "http://blogmodif.blogspot.com/2011/07/note-on-using-header-function-in-php.html"

and then do:

header('Location: $myURL');

will cause an error because php didn't evaluate the variable between the single quote. Only when you wrap them in the double quote, then the variable will be evaluated:

header("Location: $myURL");

will redirect to this post.
I hope this is usefull.

Sunday, July 10, 2011

Writing Your second PHP page

In our previous lesson, we saw only a single line of code

echo "this is my PHP enabled page";

What is done by this code? It simply display the text "this is my PHP enabled page" to the browser.

Now that we have learn the "echo" thing, we are ready to do something more advanced.


PHP Variable

What is variable?? If you something like $var or $name or $pass, that how variables looks like in PHP. Variable stores data in your program. For example, we want to store a name "John", we could say:


$myName="John";


$myName which is a variable, store the text for latter use. Now to display the content of the variable, we say:

 

echo "Hi, my name is ".$myName;

Thursday, July 7, 2011

Writing your first php page

So you want to know how to create web pages with PHP.
But first, you must already familiar about HTML language. I will not discuss about HTML in this paper. Readers are advised to learn about this through a lot of material available in books or the internet.

Escaping from HTML
Lets have a look at some of the following lines:

<?php
echo "this is my php enabled page";
?>

You are looking at a very simple line of PHP code I'll explain in the next lesson

Saturday, June 18, 2011

Coding PHP DOM, designing blogger template offline

This is my current project. I'm creating some PHP code to be able to design and review the blogger template on my PC offline.