SVN: Revert to a previous revision after a wrong update
Let’s say for example you accidentally ran “svn update” and your working copy got the updates that it shouldn’t have — unfinished patches, etc.
What you should do is check the logs using:
svn log | more
Look for the revision number then:
svn up -r 1234
*where 1234 is the previous revision number you want to go back to.
Zend_View Helper Tutorial
Zend DevZone has a new article up.
What is a View Helper?
A View Helper is simply a class that follows particular naming conventions, When attached to a view object, you can call the helper as if it were a method of the view object itself. The View object retains helper instances, which means that they retain states between calls.
Common use cases for view helpers include:
* Accessing models
* Performing complex or repeatable display logic
* Manipulating and formatting model data
* Persisting data between view scripts
Mixing PHP Variables with Javascript (Zend Framework and jQuery)
Sometimes, I “mix” PHP variables with Javascript. For example, I have something like this:
-
-
function deletenote(notes_id)
-
{
-
if(!confirm("Delete note? You will not be able to undo this action."))
-
return false;
-
-
$.post("< ?=$this->baseUrl?>/notes/deletenote",{
-
skeedl_notes_id: notes_id
-
}, function(data){
-
$(‘#notes_id’+data).fadeOut();
-
});
-
}
-
Note the $this->baseUrl, I need it like that. The thing is, I have that code in my view file (.phtml - in Zend Framework, this is parsed like a normal PHP file). If I remove all the Javascript in my view file and place it in a .js file, the $this->baseUrl will not be parsed. To go around this, I create a hidden input element in my view file with $this->baseUrl echoed as the value. Like this:
-
-
// … in my .phtml file …
-
// rest of the php and html code goes here
-
< input type="hidden" id="base_url" value="<?=$this->baseUrl?>" />
-
// rest of the php and html code goes here
-
Then in my .js file (assuming that you have already included this file in your header, or somewhere else), I have something like this:
-
-
//This is using jQuery, but you can use document.getElementById(’base_url’).value if you like
-
function deletenote(notes_id)
-
{
-
if(!confirm("Delete note? You will not be able to undo this action."))
-
return false;
-
-
$.post($(‘base_url’).val()+"/notes/deletenote",{
-
skeedl_notes_id: notes_id
-
}, function(data){
-
$(‘#notes_id’+data).fadeOut();
-
});
-
}
-
What it does is that jQuery gets the value of the hidden form element. The value of this hidden form element is from a PHP Variable.
So there you go, nothing special. Just something that works and I just wanted to share.
Zend Framework Blog Application Example / Tutorial
This is useful to those who are trying to kick start a Zend Framework application.
Starting any new application is like walking into a shop and being dazzled by the displays. You want everything but finally realise you only have so much resources to spend. So you isolate the specifics you must have, and focus on those. That’s why I bought a Classic iPod, and not the much flashier iTouch (crap all storage anyway).
If we drill down the typical blog application we get a very short list of must-haves.
1. Authentication for Authors
2. Authorisation to create/edit/delete/read entries
3. Methods for adding new entries, and modifying them
4. Publishing entries as RSS and Atom
5. Permalinks unique for each entry (SEO friendly of course)
6. Commenting system
7. Spam detection for new comments
8. Perhaps, trackback detection
Click here for the entire post. I haven’t read the entire post yet - I just wanted to share it but I am assuming that it uses the new ZF1.5 stuff like Zend_Form and other cool features.
UPDATE: Here is the second part of the tutorial.
UPDATE2: Today (4-25-2008) Pádraic Brady just announced the link to his Subversion repository for the series of Zend Framework Blog Application Example. The SVN link is found here.
OmniTI PHP Ninja
For those who don’t know, OmniTI is looking for a PHP Developer. I applied for the position a few days ago, then got an email for an interview. I had no intentions in looking for another job yet but I was struck by their job posting.
What You Give:
* PHP Expertise. You know PHP. Period. (You don’t have to be a rock star, but you need to be good.)
* Web Expertise. You’re pretty comfortable with all of the technologies people use to build web sites these days.
* Passion. We love what we do, and we love to have fun while doing it. If this sounds like you, you’ll fit right in.
Those lines alone makes we wanna drool over their working environment - I especially love being around with people who are better than me because I feel that I have so much to learn. I have always loved working with PHP. If it’s passion they are looking for, then I certainly have that. But what I don’t have is a US Visa
Tonight was supposed to be it (the interview), but it was canceled because OmniTI is looking for someone who is already eligible to work in the US
Still my hopes in working abroad and working on something really cool is still burning like the eternal flames of hell (hehe) — it’s just that those flames are being cooled down a bit by the not having a US Visa.
The bright side though is that I now know that I am already qualified (at least) to start applying for something else better than what I do right now — which really makes me happy.
This is the perfect opportunity for me to continue developing my “big idea” because tonight I also got confirmation that we found a small room for me and my friends for a “Dev House”. We are working on something really cool and hopefully will be used by people (ahem thousands of them) — no it’s not a clone of Friendster or Facebook
it’s something simpler and we will be releasing Beta sometime before August within this year.
MAMP and VMWare Fusion with WindowsXP: http://localhost:8888 access impossible?
I have been trying to figure out how to setup my VMware Fusion so that it will be able to access http://localhost:8888 on my Mac.
I have editted: c:\WINDOWS\system32\drivers\etc\hosts to something like this:
192.168.2.2 localhost
But still it won’t resolve to the MAMP pages. After doing some reading, I found out that I can’t use “localhost”. SO I re-editted the hosts file to something like this:
192.168.2.2 mylocalhost
Now, http://mylocalhost:8888 works! BUT I am not totally satisfied. In my applications, I have set a “cofig” variable for the web URL. Something like:
$web_url = "http://localhost:8888/myapp/index";
This would suck for me because I have VMWare Fusion to test CSS between browsers. By the looks of it, I would have to change my variable in order for my web app to work properly.
Do you guys have any ideas on how to use http://localhost from WindowsXP(VMWare) - so that my MAMP Pages will be accessible?
My Google App Engine Application
I just got this in my email:
Hello,
Thanks for signing up to try Google App Engine! Your account has been
activated, so you can begin building applications!To start creating applications with Google App Engine, simply follow
this link (you may need to sign in with your (snip)@gmail.com Google Account):http://appengine.google.com/
Thanks!
The Google App Engine Team
I can’t wait to use it. I didn’t expect the activation to be this quick though. I was expecting months ![]()
Anyways, here are some shots from the inside. Sorry, I can’t think of a good name for the app i will be making, so the screenshot is up to the second page only :
A good syntax highlighting scheme.
I am very picky when it comes to the syntax highlighting I use in my IDE while working. Right now I am using something like the Blackboard theme found in http://pastie.textmate.org/ but after reading Slashdot, I found this: Zenburn and I love it!
Zenburn was originally for Vim, but I can’t wait to use it on my Zend Studio!
I am also using Aptana, http://blog.ekini.net/2008/05/10/very-nice-syntax-highlighting-for-aptana/
Javascript Super Mario in 14kb Code
Here’s an experiment in keepings things small and confined to one Javascript file. There are no external image files or anything, everything is rendered with Javascript using either canvas elements or old fashioned div-making tactics (for IE). The sprites are stored in custom encoded strings in a format that only allows 4 colors for each sprite but in turn only takes up around 40-60 bytes per sprite.
We also have MIDI music embedded as base64-encoded data: URI’s. No music for IE, though, and it seems all the other browsers each have different, minor problems with it, but it sort of works.
It is by no means a complete clone or anything, it’s not even an entire level and several key things are missing, such as mushrooms, Koopas and stuff. It was merely done as a sort of proof-of-concept and to see how small it could get.
Performance varies somewhat between the different browsers, but Firefox, Opera, Safari and IE are all playable. The latest WebKit nightly seems to give Safari a speed boost.
Be sure to click the mouse on the game if Mario won’t move. When you die, you have to reload the page to start over. And yes, you can move left. Sorry.
I tried to download the Javascript file and simulate it in my local machine to see if it really works, and it does! Amazing!
- Ang Opon Gi-Online
- DASPRiDS
- Design Trance
- Devian
- Digital Filipino
- Hacker News
- jQuery Javascript Framework
- Mia Carmel’s Blog
- MindFock
- My Lyrics Finder
- naneau’s blog
- Phiweavers
- PHP User Group Philippines
- Rockman X
- Sigbin!!!!!
- SpotSec Networks
- Static Reanimations Blog
- Wiki Ekini on Zend Framework
- zed23
- Zend Framework



