Have you tried to use the Bugzilla API and fell flat on the face unless you are using Python, Perl, C#, Java or anything but PHP (I still like PHP). Sadly I couldn't get any XMLRPC clients to work with the xmlrpc.cgi because prior to 3.6 versions of the API, Bugzilla authenticated via cookies. Zend Framework seems to support this but it also happens to be a lot of work just to create a ticket. Well fear not, I RTFM over and over and found this little note:
You can specify Bugzilla_login and Bugzilla_password as arguments to any WebService method, and you will be logged in as that user if your credentials are correct.
in http://www.bugzilla.org/docs/3.6/en/html/api/Bugzilla/WebService.html
Documented in a very obscure place and 3.6 documentation is not the first to come up on Google. Here is some code via Codeigniter that does the trick but I assume any XMLRPC client will do the job with this concept.
$this->load->library('xmlrpc');
$this->xmlrpc->server('http://bugzilla.yoursite.com/xmlrpc.cgi', 80);
$this->xmlrpc->method('User.login');
$request = array('Bugzilla_login'=>'user@example.com', 'Bugzilla_password'=>'your_password', 'product'=>'Your Product Name', 'component'=>'User Submitted', 'summary'=>'Test', 'version'=>'x.x', 'description'=>'asdas');
$this->xmlrpc->method('Bug.create');
$this->xmlrpc->request(array(array($request, 'struct')),'struct');
if(!$this->xmlrpc->send_request()) {
echo $this->xmlrpc->display_error();
}
// this returns ticket ID
print_r($this->xmlrpc->display_response());
Enjoy this, took me a while to figure it out.
B
Wednesday, February 2, 2011
Wednesday, January 19, 2011
Extend CKEditor Link Box
Found an awesome post on extending the link box of CKEditor.
http://blog.xoundboy.com/?p=393
Yes this would be for a custom CMS integration I am working on but it's part of a much bigger picture.
http://blog.xoundboy.com/?p=393
Yes this would be for a custom CMS integration I am working on but it's part of a much bigger picture.
Thursday, October 28, 2010
iPhone - Cocos2D + Lua - Part 1
New Apple licensing finally allows some interpreted code to be executed on the iPhone (http://www.appleoutsider.com/2010/06/10/hello-lua/). For most people this is an indifferent matter of keeping Flash of the iPhone. On the other hand, great projects like Unity and Corona are effectively prevented from delivering awesome solutions to the mobile world, seeing how they both rely on internal interpreters.
Now that we are over that hump I am glad I can finally start integrating Lua in all my games. Lua (http://lua.org) is a fantastic lightweight language, intended to be embedded and cross platform. There is entire Google on the benefits of this combination but in summary game logic can be implemented outside of the graphic engine (Cocos2D - http://www.cocos2d-iphone.org/ being my favorite). I've put together a quick demo of Cocos2D and Lua integration and I'll be working more on it as my game SnowRumble (http://snowrumble.com) rises out of ashes.
This post is a little short because I have to get some work done, but as soon as I get a chance I will write up more and try and explain exactly what's going on.
Git your code here: http://github.com/boriscosic/LuaCocos2D :)
B
Now that we are over that hump I am glad I can finally start integrating Lua in all my games. Lua (http://lua.org) is a fantastic lightweight language, intended to be embedded and cross platform. There is entire Google on the benefits of this combination but in summary game logic can be implemented outside of the graphic engine (Cocos2D - http://www.cocos2d-iphone.org/ being my favorite). I've put together a quick demo of Cocos2D and Lua integration and I'll be working more on it as my game SnowRumble (http://snowrumble.com) rises out of ashes.
This post is a little short because I have to get some work done, but as soon as I get a chance I will write up more and try and explain exactly what's going on.
Git your code here: http://github.com/boriscosic/LuaCocos2D :)
B
Monday, October 25, 2010
OS X + Dovecot + Postfix
Today I pointlessly spent 4 hours figuring out a local mail setup for Snow Leopard. This is all readily available in _every_ variation of Linux and it upset me greatly that I could not just send test email to myself. (NOTE: THIS IS NOT HOW YOU CONFIGURE A MAIL SERVER!!! THIS IS FOR DEV PURPOSES ONLY.)
Problem 1. Lack of imap server.
For that I just downloaded dovecot. Setup is pretty straight forward.
./configure --prefix=/usr/local/dovecot
make && make install
cp /usr/local/dovecot/share/doc/dovecot/example-config/dovecot.conf /usr/local/dovecot/etc/dovecot/
Make sure all the right permissions are there:
sudo dscl . -create /Users/_dovecot
sudo dscl . -create /Users/_dovecot UserShell /usr/bin/false
sudo dscl . -create /Users/_dovecot UniqueID 104
sudo dscl . -create /Users/_dovecot PrimaryGroupID 104
sudo dscl . -create /Users/_dovecot NFSHomeDirectory /var/empty
sudo dscl . -passwd /Users/_dovecot ''
Then I edited dovecot.conf and commented out these lines:
22: #!include conf.d/*.conf
Then added:
protocols = imap
ssl = no
default_login_user = _dovecot
default_internal_user = _dovecot
mail_location = mbox:/var/mail/folders/%u/:INBOX=/var/mail/%u
disable_plaintext_auth = no
passdb {
driver = pam
args = login
}
userdb {
driver = passwd
}
I seriously can't be bothered to setup an SSL for a localhost test mail account only but if you do need one Google is your friend.
Save and start dovecot via /usr/local/sbin/dovecot.
All your issues should be logged in /var/log/mail.log
Problem 2. Postfix.
Since my entry into Linux administration I loathed configuring mail servers. Thankfully you can do everything these days via Google Apps and some quick DNS changes. Dealing with spam, relay blocking, users setups, mail clients and etc was an ongoing pita. But to get started with OSX setup was pretty fast.
Create a file /etc/postfix/virtual if you don't have it.
Add something along these lines. All test emails that go to the domains are forwarded to your user account. It is a quick way of setting up multiple emails for testing and replace 'boris' with your osx username.
@whatever.localhost boris
@me.local boris
Generate a virtual.db via 'postmap virtual'
Save and close and start postfix: 'postfix start'
You can now setup your mail to point to localhost and everything should be working. Open terminal and type:
mail boris (or bee@me.local)
test
.
Don't forget the dot on a new line and change boris to your username. Everything should be delivered to your localhost account.
That should be it and if you have serious trouble http://diymacserver.com/ is an awesome reference.
It is also possible to relay everything to Gmail but you need a valid hostname in your postfix (Gmail rejects localhost). I also do a lot of offline development so I don't always have Gmail there to do my email testing. Local setup + Git is an awesome way to stay off the grid and get some work done.
B
Problem 1. Lack of imap server.
For that I just downloaded dovecot. Setup is pretty straight forward.
./configure --prefix=/usr/local/dovecot
make && make install
cp /usr/local/dovecot/share/doc/dovecot/example-config/dovecot.conf /usr/local/dovecot/etc/dovecot/
Make sure all the right permissions are there:
sudo dscl . -create /Users/_dovecot
sudo dscl . -create /Users/_dovecot UserShell /usr/bin/false
sudo dscl . -create /Users/_dovecot UniqueID 104
sudo dscl . -create /Users/_dovecot PrimaryGroupID 104
sudo dscl . -create /Users/_dovecot NFSHomeDirectory /var/empty
sudo dscl . -passwd /Users/_dovecot ''
Then I edited dovecot.conf and commented out these lines:
22: #!include conf.d/*.conf
Then added:
protocols = imap
ssl = no
default_login_user = _dovecot
default_internal_user = _dovecot
mail_location = mbox:/var/mail/folders/%u/:INBOX=/var/mail/%u
disable_plaintext_auth = no
passdb {
driver = pam
args = login
}
userdb {
driver = passwd
}
I seriously can't be bothered to setup an SSL for a localhost test mail account only but if you do need one Google is your friend.
Save and start dovecot via /usr/local/sbin/dovecot.
All your issues should be logged in /var/log/mail.log
Problem 2. Postfix.
Since my entry into Linux administration I loathed configuring mail servers. Thankfully you can do everything these days via Google Apps and some quick DNS changes. Dealing with spam, relay blocking, users setups, mail clients and etc was an ongoing pita. But to get started with OSX setup was pretty fast.
Create a file /etc/postfix/virtual if you don't have it.
Add something along these lines. All test emails that go to the domains are forwarded to your user account. It is a quick way of setting up multiple emails for testing and replace 'boris' with your osx username.
@whatever.localhost boris
@me.local boris
Generate a virtual.db via 'postmap virtual'
Save and close and start postfix: 'postfix start'
You can now setup your mail to point to localhost and everything should be working. Open terminal and type:
mail boris (or bee@me.local)
test
.
Don't forget the dot on a new line and change boris to your username. Everything should be delivered to your localhost account.
That should be it and if you have serious trouble http://diymacserver.com/ is an awesome reference.
It is also possible to relay everything to Gmail but you need a valid hostname in your postfix (Gmail rejects localhost). I also do a lot of offline development so I don't always have Gmail there to do my email testing. Local setup + Git is an awesome way to stay off the grid and get some work done.
B
Friday, August 6, 2010
My build scripts
Because I get tired of trying to find them on Google.
PHP5:
./configure --prefix=/usr/local/php-5.2.5 --with-apxs2=/usr/local/apache2/bin/apxs --with-imap-ssl --with-xsl --enable-sockets --with-config-file-path=/etc --with-mysql=/usr/local/mysql --with-pgsql=/opt/PostgreSQL/8.3 --enable-calendar --with-imap --with-kerberos --with-gd --with-zlib--with-gd --with-bz2 --enable-mbstring --with-xmlrpc --enable-soap --with-freetype-dir=/usr/include/freetype2 --with-pdo-mysql=/usr/local/mysql --with-pdo-pgsql=/opt/PostgreSQL/8.3 --with-curl --with-mcrypt
make && make install
Apache:
./configure --prefix=/usr/local/apache-2.2.17 --enable-cache --enable-proxy-ftp --enable-proxy-connect --enable-deflate --enable-ssl --enable-setenvif --enable-so --enable-cgi --enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic --enable-proxy --enable-proxy-http --with-mpm=prefork
ln -s /usr/local/apache-2.2.17 apache
make && make install
PostgreSQL 8.4:
./configure --prefix=/usr/local/postgresql-8.4.1
For 64bit (OSX Snow Leopard) use. If you don't psycopg2 doesn't work very well because 64bit python does not like 32bit postgres:
ARCH=x86_64 CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64"
make && make install
Link /usr/local/pgsql to the installation directory.
Create postgres user and do:
su postgres
/usr/local/pgsql/bin/initdb -E UTF8 -D /usr/local/pgsql/data/
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /usr/local/pgsq/data/postgresql.log start
To test:
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Shutdown and startup (as postgres):
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ stop
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /usr/local/pgsq/data/postgresql.log start
PHP5:
./configure --prefix=/usr/local/php-5.2.5 --with-apxs2=/usr/local/apache2/bin/apxs --with-imap-ssl --with-xsl --enable-sockets --with-config-file-path=/etc --with-mysql=/usr/local/mysql --with-pgsql=/opt/PostgreSQL/8.3 --enable-calendar --with-imap --with-kerberos --with-gd --with-zlib--with-gd --with-bz2 --enable-mbstring --with-xmlrpc --enable-soap --with-freetype-dir=/usr/include/freetype2 --with-pdo-mysql=/usr/local/mysql --with-pdo-pgsql=/opt/PostgreSQL/8.3 --with-curl --with-mcrypt
make && make install
Apache:
./configure --prefix=/usr/local/apache-2.2.17 --enable-cache --enable-proxy-ftp --enable-proxy-connect --enable-deflate --enable-ssl --enable-setenvif --enable-so --enable-cgi --enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic --enable-proxy --enable-proxy-http --with-mpm=prefork
ln -s /usr/local/apache-2.2.17 apache
make && make install
PostgreSQL 8.4:
./configure --prefix=/usr/local/postgresql-8.4.1
For 64bit (OSX Snow Leopard) use. If you don't psycopg2 doesn't work very well because 64bit python does not like 32bit postgres:
ARCH=x86_64 CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64"
make && make install
Link /usr/local/pgsql to the installation directory.
Create postgres user and do:
su postgres
/usr/local/pgsql/bin/initdb -E UTF8 -D /usr/local/pgsql/data/
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /usr/local/pgsq/data/postgresql.log start
To test:
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Shutdown and startup (as postgres):
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ stop
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /usr/local/pgsq/data/postgresql.log start
Thursday, July 1, 2010
Magento Annoyances
Great e-Commerce but the degree of separation between presentation and logic is about 10 folders from root (if you are a developer). I use vim for everything and it can get pretty annoying to work on Magento. So I present to you my .bashrc snippet:
alias pd=pushd
alias pop=popd
function cs() { cd `dirs -l +$1`; }
Go to code directory and do 'pd .' and go to templates directory and do 'pd .'. This will add presentation and logic folder to a linux directory stack which you can access via 'cs 1' or 'cs 2' or 'cs N' N being whatever folder is in the stack.
alias pd=pushd
alias pop=popd
function cs() { cd `dirs -l +$1`; }
Go to code directory and do 'pd .' and go to templates directory and do 'pd .'. This will add presentation and logic folder to a linux directory stack which you can access via 'cs 1' or 'cs 2' or 'cs N' N being whatever folder is in the stack.
Friday, April 9, 2010
File versioning the Git way
One of my favorite features of Git is the ability to create local repositories. Subversion can be a hassle for many multiple projects I go through. The repositories have to live on one central server which stays in constant sync with development. If you've ever tried to merge changes in Subversion with conflict code in repository no need to raise your hand. I can tell by the gray hairs who you are.
Additionally this will work with any file type and will not induce additional load on file server. All the versioning changes will be stored locally and if the need arises, can be pushed out to a central hosting server.
Getting started with Git on Mac/Linux is very easy: http://code.google.com/p/git-osx-installer/
Getting started with Git on Windows is not too bad: http://gitcasts.com/posts/git-on-windows
The basics are:
1) Make directory (mkdir project1)
2) Initialize with git to get started (git init)
3) Add your files in there (git add .)
4) Commit changes (git commit -a -m 'My first git project'). Do this as many times as you want after changes.
There you go, code versioning locally without subversion. Home page for Git and a great source of documentation can be found here: http://git-scm.com/
Subscribe to:
Posts (Atom)