Spiga

‘ Programing ’ category archive

Access Dropbox.com behind corporate / company firewall

May 19, 10 by Gabi Solomon

If you find yourself one morning with your dropbox client not connecting to the server, and you trace the problem to the company/ISP ( or country if your in China :-p ) firewall then you can put the kind words for them to the side a little and try the following.
Most of the firewalls block the main IP for dropbox.com 174.36.30.70 but the alternate IP is open :D

So add this to your hosts:
174.36.30.71 www.dropbox.com

Hope it works for you.

php adwords api library

December 25, 09 by Gabi Solomon

Recently i posted on google code a library we developed to interact with Adwords Api from php.
Php Adwords API Library was developed by Hyperactive team for an internal project, since we didn’t like options available and felt we could do something that would be easier to work with, at least for us. We made it public so that others looking for a php library to interact with adwords api would have more options to chose from ( plus free testing for us :-p ).

The project can be found here:
http://code.google.com/p/php-adwords-api/

It is still a work in progress and does not yet support all the services and functions of the API, but we hope to add more services as soon as possible. And if you need a certain service or function please dont hesitate to add a ticket on google code and request it.

You will find examples of usage in the folder examples of the library.

PDF Generation with Zend Framework

November 07, 09 by Gabi Solomon
Jonathan MaronGuest Post by:
Jonathan Maron has been working in the web application conceptualization and development space since 1996. His current position is with an international company, specialized in the production of word processing components. Being an advocate of the FOSS movement, Jonathan promotes the use of Open Source software and rejects the notion of reinventing the wheel, preferring to develop with established frameworks.

Generating print-ready well-formatted PDF documents with PHP is not an easy task. Traditionally, there are two main approaches to PDF generation with PHP. Given sufficient time and patience, both partially get the job done, but still leave a lot to be desired:

HTML-to-PDF: This approach is widely used in mainstream applications. Here an HTML document is programmatically created and converted to a PDF, using one of the many open source libraries 1. Since HTML, however, is not a page-oriented format (as is PDF), it is impossible to perform a 1-to-1 mapping between HTML and PDF. Typical word processing file format features, such as header and footers, orphans and widows or even page numbers can simply not be represented in HTML.
Read the rest of this entry »

Replication / Mirroring as Master-master with Subversion using svnsync

June 26, 09 by Gabi Solomon

For me it all started when my VPS had an error and all my SVN repos were lost. Plus even though i had purchased a backup system from the hosting company that was suppose to do a full server backup automatic and incrementally, i only had a backup from 20 days earlier because the system failed at that point in time and didnt run since.

But enough with my problems, at that point i decided to make a copy of my repos from the remote server to my local machine.
And i would commit into the local one and it should automaticly sync to the remote one. Plus it would need to do this both ways and in real time since i had some external people commiting in the remote server. Easier said then done i camed to find out.

The reasons why

Well for me there are 3 main reasons:
1. as a backup system ( dont want to be put in the 20 days old backup situation again )
2. for faster commits and updates
3. independent of the internet connection ( it hasnt failed in quite a while, but just in case, or for the times its a bit slow )

The alternatives

It seems that this topic is a bit popular, and there are a few places on the internet where people are interested in this. You can check out this question on stackoverflow for one.

1. Git-SVN
This is one alternative that a lot of people have been recommended. The benefits they are you get the best out of both worlds, you can still use the Subversion in the main repo, but you get the power of GIT for your local copy.
Although this sounds very cool, i am more of a GUI guy and really enjoy the subversion integration in my IDE ( Netbeans ) so i would have to pass this options.

2. SVK

svk is a decentralized version control system built with the robust Subversion filesystem. It supports repository mirroring, disconnected operation, history-sensitive merging, and integrates with other version control systems, as well as popular visual merge tools.

At first i read this article about SVK and it seemed to be what i was looking for. But after playing with it for a while i saw that i would need to have a single repo where all my comits would go and that would be synced to several outside repos. But i was looking for a way to have the exact replica of what it is on the remote server so in the case of a failure i could restore them from my backup.

If you are still interested in this you can also read this and this.

3. svnsync + webdav proxy
I knew about svnsync but it only supports read-only copies of your repo. But after reading a small comment on stackoverflow i started looking and find out you can have read-write copies using svnsync and webdav proxy.
What is basicly happening is that your local copy handles the read operations and it forwards the commits to the main repo.

There are a few tricky parts on this solution, that involve the locks and updating of all the replicas of the main repo. This are done by a series of hooks in the main repo.
If youre interested in this solution you can find information about implementing it in this articles:
Subversion transparent proxy with svnsync + webdav proxy
subversion diy write through proxy
Subversion on-the-fly replication

conclusion

Honestly i don’t have one yet :( , but i plant to try using svnsnyc and see how that goes.
I hope you got a big picture of what your options are and now you can decide what suits you best.

Cheers

Optimizing Zend Routing

May 06, 09 by Gabi Solomon

After playing with zend framework for a while, and reading left and right, i came to the conclusion that i need to find a way to optimize the Routing in my application.
If you havent notice by now, the routing in Zend takes quite a while, and it increases with the number of routes you have, and with the number of routes that use Regular Expressions.

The easiest way to optimise it would be to reduce the number of rules that use regular expressions and the number of rules all together. But for SEO reasons that is not always possible.

Read the rest of this entry »

MySQL Database versioning strategy

April 14, 09 by Gabi Solomon

IF you just got into versioning your code then you are probably really happy with your acomplishment.
But do you have your database versioned ? This is the questioned asked in this here by Jeff Atwood and also asked by a lot of users on stackoverflow.

After reading a lot on this topic i decided on a strategy on how to keep my database under version control.
As a warning it isn’t the most easy strategy and it really takes some discipline from all the developers.
Read the rest of this entry »

Current Zend View Path Helper

March 29, 09 by Gabi Solomon

Many times when i use Zend_View i have to include view files that are in the same directory, and i am forced to type in the same path over again. Which is and isnt so much work, but during development i often have to place those files in a different folder or rename one of the folders. In witch case i would be forced to change those path i gave in the view file.

This is why i wrote a small View_Helper to return the current view folder.
Unfortunately this will not work on a Zend framework out of the box, it will require some modifications to Zend_View_Abstract.

I have placed the code on ZF Snippets website, a project that i really like, and i would ask you to place any comments and suggestions for this helper on that webpage.

[ZF Snippets code]

Cheers

Cron jobs in Zend Framework

March 12, 09 by Gabi Solomon

Recently i had to implement a cronjob for a website that was build with zend framework, and to be honest i haven’t done this before. I did some googling and as a lot of times with zend framework there arent to many resources about this topic.

I did find some topics on stackoverflow.com about it ( found out about zend cli proposal wich sounds interesting ) but not really an answer. So i decided to go ahead and try a solution on my own. Read the rest of this entry »

Minify css in ZendFramework

March 11, 09 by Gabi Solomon

After coming across Matthew Turland Minify Filter for Zend Framework i decided to implement the minify app to also minify the css and javascript external files.

But i only did the implementation for the stylesheets for now, and i wanted to share it :) .
Read the rest of this entry »

mysql error : Incorrect information in file: ./table.frm

by Gabi Solomon

After tinkering with my VPS settings to optimize it ( it was having some low memory problems ) and after restarting the server, just when i tought everything was ok i noticed that i managed to break some websites.

they all got this error:

mysql error : Incorrect information in file: ./table.frm

After a bit of googling i found the problem … apparently it could be because there is no support for InnoDB … oops. In my quest for optimization i disabled the support for InnoDB tables thinking that there werent any InnoDB tables in the websites hosted on that VPS .. apparently they were :( .

Hope you get here faster then i found the solution.
Cheers