What you need:
putty (not the putty.exe but the whole installer as you need pageant, plink and puttygen :D)
subversion
Step 1: Install PUTTY
Step 2: Install subversion
Step 3: Create a profile for your server (indicate port, user, etc.) using putty (be sure not to overwrite Default Profile) (i.e. profile name is MyServer)
Step 4: using puttygen, create a private key and a public key
Step 5: copy the public key ( in the puttygen window ) to the .ssh/authorized_keys (located in your home directory) on your server
Step 6: load your private key using pageant
Step 7: the url for your repository will be svn+ssh://MyServer/path/to/your/repository
You're Done!
17.8.09
20.6.09
PHP5 RRD Module in Ubuntu/Debian Lenny missing!
Today, I started reading about using RRDTool in replacement for the flash-based reports that I was using for a pet project. What stunned me later was to finding out that php bindings for this nifty little tool is absent in my toolkit!
I am here now to tell you how I did it, well, sort of, :D
1.) be sure to download http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
2.) apt-get (or I use aptitude in ubuntu) install librrd-dev php5-dev
3.) extract php_rrdtool.tar.gz (tar zxvf php_rrdtool.tar.gz
4.) enter the directory created by extraction then run phpize
5.) run ./configure then make to compile the module
6.) inside the created modules directory lies two files: rrdtool.so and rrdtool.la. copy both files to your extension_dir (which you can find out if you open the php.ini that is being called by your apache web server) I saved mine in /usr/lib/php5/20060613+lfs which is the default for debian lenny
7.) add this line:
extension=rrdtool.so
in any of your php.ini file (in debian lenny's or ubuntu's case, you can create a new .ini file in /etc/php5/apache2/conf.d and put that line in there )
8.) restart your apache webserver
9.) create a phpinfo(); file and see if these lines exists:
rrdtool
rrdtool Version 1.2.x extension
rrdtool support enabled
10.) you're done!
I am here now to tell you how I did it, well, sort of, :D
1.) be sure to download http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
2.) apt-get (or I use aptitude in ubuntu) install librrd-dev php5-dev
3.) extract php_rrdtool.tar.gz (tar zxvf php_rrdtool.tar.gz
4.) enter the directory created by extraction then run phpize
5.) run ./configure then make to compile the module
6.) inside the created modules directory lies two files: rrdtool.so and rrdtool.la. copy both files to your extension_dir (which you can find out if you open the php.ini that is being called by your apache web server) I saved mine in /usr/lib/php5/20060613+lfs which is the default for debian lenny
7.) add this line:
extension=rrdtool.so
in any of your php.ini file (in debian lenny's or ubuntu's case, you can create a new .ini file in /etc/php5/apache2/conf.d and put that line in there )
8.) restart your apache webserver
9.) create a phpinfo(); file and see if these lines exists:
rrdtool
rrdtool Version 1.2.x extension
rrdtool support enabled
10.) you're done!
24.5.09
Symfony EDITOR :D
I come to realize that I can never leave without VIM. I've been hooked to it till kingdom come and I can never switch to any editor anymore. Most specially now that I have found this. Presenting (drum rolls). The VIM symfony plugin.
I would not give away the details. The thing is, I have been looking for this in almost all the editors that I have used so far. And for me, finding this thing off of the internet is a great surprise.
It does nothing more than take you to the template file of the current action that you are editing. For me this is a big thing as I don't have to leave vi just to go back and forth between the action and the template. It automatically opens it. If only komodo has this feature :D
I think that's all for now, have to get back to coding :D
http://www.vim.org/scripts/script.php?script_id=2128
Renz Out
I would not give away the details. The thing is, I have been looking for this in almost all the editors that I have used so far. And for me, finding this thing off of the internet is a great surprise.
It does nothing more than take you to the template file of the current action that you are editing. For me this is a big thing as I don't have to leave vi just to go back and forth between the action and the template. It automatically opens it. If only komodo has this feature :D
I think that's all for now, have to get back to coding :D
http://www.vim.org/scripts/script.php?script_id=2128
Renz Out
24.4.09
Upgraded to Jaunty Jackalope
Wow! I just installed Ubuntu 9.04 Jaunty Jackalope and was really amazed on how fast the thing booted up.
Also, the install experience was really really nice. I just went through 7 steps and after a restart, here I am.
Try it now. It's very stable, so far so good, considering that I already "hacked" the system compiling things that I have had in the last linux that I used.
Peace!
Also, the install experience was really really nice. I just went through 7 steps and after a restart, here I am.
Try it now. It's very stable, so far so good, considering that I already "hacked" the system compiling things that I have had in the last linux that I used.
Peace!
12.3.09
Adding gmail SMTP to symfony 1.0
PHPMailer is already included in symfony, so why add one yourself?
The thing is, I never get PHPMailer that is bundled with symfony to work with my gmail account so I decided to find something that can be done.
1.) Create a file myMailer.class.php inside your lib directory (either in apps/app_name/lib or in your root lib directory)
2.) Put these codes in there:
3.) In your controller, you can now use it this way:
$mail = myMailer(“username@gmail.com”, “thisshouldbeaveryhardpassword!@#$!@#$!@#$”, “From Me!”);
if($mail->send(“spam_victim@somewhere.com”, “This Is Spam”, “<div style=’font-size:300px’>GET THIS</div>”)) echo “Mail Sent!”;
else echo “Mail is not sent!”;
And you’re done!
The thing is, I never get PHPMailer that is bundled with symfony to work with my gmail account so I decided to find something that can be done.
1.) Create a file myMailer.class.php inside your lib directory (either in apps/app_name/lib or in your root lib directory)
2.) Put these codes in there:
class myMailer {
public function __construct($username, $password, $user_alias) {
$this->from = $username;
$this->password = $password;
$this->user_alias = $user_alias;
}
public function send($to, $subject, $body) {
$eol = "\r\n";
$host = 'gmail-smtp.l.google.com';
$port = 465; $fname = $this->user_alias;
$data = 'Date: ' . date ( 'r', time () ) . $eol;
$data .= 'From: "' . $this->from . $eol;
$data .= 'Subject: ' . $subject . $eol;
$data .= 'To: "' . $to . '" <' . $to . '>' .
$eol; $data .= 'X-Priority: 1 (High)' . $eol;
// you can comment this one out if you want a normal email.
$data .= 'X-Mailer:' . $eol;
$data .= 'MIME-Version: 1.0' . $eol;
$data .= 'Content-Type: text/plain; charset="ISO-8859-1"' . $eol;
$data .= 'Content-Transfer-Encoding: 8bit' . $eol . $eol;
$data .= $body . $eol;
$has_error = false;
if ( ( $smtp = fsockopen ( 'ssl://' . $host, $port, $errno, $errstr, 5 ) ) ) {
fputs ( $smtp, 'HELO ' . $host . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) { $
has_error = true;
}
sleep(2);
fputs ( $smtp, 'AUTH LOGIN' . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
sleep(2);
fputs ( $smtp, base64_encode ( $this->from ) . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
sleep(2);
fputs ( $smtp, base64_encode ( $this->password ) . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
sleep(2);
fputs ( $smtp, 'MAIL From: <' . $this->from . '>' . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
} sleep(2);
fputs ( $smtp, 'RCPT To: <' . $to . '>' . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
sleep(2);
fputs ( $smtp, 'DATA' . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
sleep(2);
fputs ( $smtp, $data . $eol . '.' . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
sleep(2);
fputs ( $smtp, 'QUIT' . $eol );
if ( ! $this->test_return ( $smtp, $error ) ) {
$has_error = true;
}
fclose ( $smtp );
}
return !$has_error;
}
function test_return ( $res, &$error ) {
$out = fread ( $res, 1 );
$len = socket_get_status ( $res );
if ( $len > 0 ) {
$out .= fread ( $res, $len['unread_bytes'] );
}
//echo $out;
if ( preg_match ( "/^5/", $out ) ) {
$error = $out;
return false;
}
return true;
}
}
3.) In your controller, you can now use it this way:
$mail = myMailer(“username@gmail.com”, “thisshouldbeaveryhardpassword!@#$!@#$!@#$”, “From Me!”);
if($mail->send(“spam_victim@somewhere.com”, “This Is Spam”, “<div style=’font-size:300px’>GET THIS</div>”)) echo “Mail Sent!”;
else echo “Mail is not sent!”;
And you’re done!
8.3.09
Sending HTTP Posts through JAVA
I found this truly helpful tip :D
http://www.javaworld.com/javatips/jw-javatip34.html?page=1
From the site:
URL url;
URLConnection urlConn;
DataOutputStream printout;
DataInputStream input;
// URL of CGI-Bin script.
url = new URL (getCodeBase().toString() + "env.tcgi");
// URL connection channel.
urlConn = url.openConnection();
// Let the run-time system (RTS) know that we want input.
urlConn.setDoInput (true);
// Let the RTS know that we want to do output.
urlConn.setDoOutput (true);
// No caching, we want the real thing.
urlConn.setUseCaches (false);
// Specify the content type.
urlConn.setRequestProperty
("Content-Type", "application/x-www-form-urlencoded");
// Send POST output.
printout = new DataOutputStream (urlConn.getOutputStream ());
String content =
"name=" + URLEncoder.encode ("Buford Early") +
"&email=" + URLEncoder.encode ("buford@known-space.com");
printout.writeBytes (content);
printout.flush ();
printout.close ();
// Get response data.
input = new DataInputStream (urlConn.getInputStream ());
String str;
while (null != ((str = input.readLine())))
{
System.out.println (str);
textArea.appendText (str + "\n");
}
input.close ();
Thanks to the person who posted this :D
http://www.javaworld.com/javatips/jw-javatip34.html?page=1
From the site:
URL url;
URLConnection urlConn;
DataOutputStream printout;
DataInputStream input;
// URL of CGI-Bin script.
url = new URL (getCodeBase().toString() + "env.tcgi");
// URL connection channel.
urlConn = url.openConnection();
// Let the run-time system (RTS) know that we want input.
urlConn.setDoInput (true);
// Let the RTS know that we want to do output.
urlConn.setDoOutput (true);
// No caching, we want the real thing.
urlConn.setUseCaches (false);
// Specify the content type.
urlConn.setRequestProperty
("Content-Type", "application/x-www-form-urlencoded");
// Send POST output.
printout = new DataOutputStream (urlConn.getOutputStream ());
String content =
"name=" + URLEncoder.encode ("Buford Early") +
"&email=" + URLEncoder.encode ("buford@known-space.com");
printout.writeBytes (content);
printout.flush ();
printout.close ();
// Get response data.
input = new DataInputStream (urlConn.getInputStream ());
String str;
while (null != ((str = input.readLine())))
{
System.out.println (str);
textArea.appendText (str + "\n");
}
input.close ();
Thanks to the person who posted this :D
11.2.09
Signing Jar Files
Compared to most Java programmers, I can still call myself a newbie.
I just learned how to sign java jars to be able to maximize the potential of applets.
1.) First of all you need to create your keystore. A keystore file (usually named .keystore in your home directory) contains your private and public keys. .keystore is stored in a binary jks format (Java Key Store) similar to PKCS #12 containing both public and private keys, protected by a passphrase. The first four signature bytes of a Sun .keystore file in hex are FEEDFEED. ( http://mindprod.com/jgloss/keystore.html)
To create your keystore, you need the keytool which you can get with most java jdk. At the command line, you type something:
keytool –genkey –alias alias_to_be_used
you need to specify alias_to_be_used as this will be the alias that you will be using for the jarsigner command later.
2.) You can save your .keystore file if you are going to transfer to other machines or reformat the machine that you are going to be using. You just have to remember to put it at your home directory.
3.) You can now create your jar file. After which you can issue the command:
jarsigner –storepass yourpassword –keypass yourpassword jarfile.jar alias_to_be_used
you have to specify yourpassword for both the storepass and keypass as they could be different passwords (as you will be prompted in the keytool to be able to do so). Also don’t forget to change jarfile.jar for the filename of your jarfile and alias_to_be_used for the alias you supplied to keytool.
4.) That’s it you have a jar signed file.
Enough for now, back to work...
I just learned how to sign java jars to be able to maximize the potential of applets.
1.) First of all you need to create your keystore. A keystore file (usually named .keystore in your home directory) contains your private and public keys. .keystore is stored in a binary jks format (Java Key Store) similar to PKCS #12 containing both public and private keys, protected by a passphrase. The first four signature bytes of a Sun .keystore file in hex are FEEDFEED. ( http://mindprod.com/jgloss/keystore.html)
To create your keystore, you need the keytool which you can get with most java jdk. At the command line, you type something:
keytool –genkey –alias alias_to_be_used
you need to specify alias_to_be_used as this will be the alias that you will be using for the jarsigner command later.
2.) You can save your .keystore file if you are going to transfer to other machines or reformat the machine that you are going to be using. You just have to remember to put it at your home directory.
3.) You can now create your jar file. After which you can issue the command:
jarsigner –storepass yourpassword –keypass yourpassword jarfile.jar alias_to_be_used
you have to specify yourpassword for both the storepass and keypass as they could be different passwords (as you will be prompted in the keytool to be able to do so). Also don’t forget to change jarfile.jar for the filename of your jarfile and alias_to_be_used for the alias you supplied to keytool.
4.) That’s it you have a jar signed file.
Enough for now, back to work...
3.2.09
Now: Java
Hi,
It's been a while since I posted here and a lot of things happened already. Tonight, I will be posting of a different thing as I have been re-learning JAVA. Yes, the old programming paradigm that I once rubbed off my shoulder was once again at the doorsteps, knocking at ME to learn about it.
Now that JAVA is OpenSource, I am still a bit skeptic about what can be done with it.
There must be a reason why I am now shifting most of my time to JAVA and not with Python,PHP and C++ which is what I commonly use.
Just to keep you hanging and of course, not to spoil the company's plan, I would not discuss the details of what I have been doing the last 2 months. I have a month more of development for this so I'm going to keep my fingers shut until it is the time to divulge the great secret.
After which, I will be blogging about the pain, the hardships and all the fuzz that happened before, during and after development.
Thanks for reading.
It's been a while since I posted here and a lot of things happened already. Tonight, I will be posting of a different thing as I have been re-learning JAVA. Yes, the old programming paradigm that I once rubbed off my shoulder was once again at the doorsteps, knocking at ME to learn about it.
Now that JAVA is OpenSource, I am still a bit skeptic about what can be done with it.
There must be a reason why I am now shifting most of my time to JAVA and not with Python,PHP and C++ which is what I commonly use.
Just to keep you hanging and of course, not to spoil the company's plan, I would not discuss the details of what I have been doing the last 2 months. I have a month more of development for this so I'm going to keep my fingers shut until it is the time to divulge the great secret.
After which, I will be blogging about the pain, the hardships and all the fuzz that happened before, during and after development.
Thanks for reading.
Subscribe to:
Posts (Atom)