Skip to main content

Posts

Showing posts with the label php

Running phpinfo to test Kubernetes ingress and Let's Encrypt certificate

For new cluster, I usually deploy a simple phpinfo app to test that the happy-path works as expected. The PHP service and deployment is pretty simple: The Docker image is basically a php:apache image with a single index.php file . Next, setup the ingress and issuer (I'm using ingress-nginx and cert-manager FYI): And voila.

Trying HHVM

So I was trying HHVM on a VPS when I encountered the error "list sub-command REMOVE_AT requires list to be present". Having no idea of what it is, I tried a Google search and ended up with a page of results (5 or something with half of them in Chinese) and no pointer at all... The full stack is like this CMake Error at CMake/EXTFunctions.cmake:8 (list):   list sub-command REMOVE_AT requires list to be present. Call Stack (most recent call first):   hphp/runtime/ext/imagick/config.cmake:12 (HHVM_LINK_LIBRARIES)   hphp/runtime/ext/CMakeLists.txt:24 (include) So I went in... vi CMake/EXTFunctions.cmake Found some macro definitions and some function declarations. The two things that caused error are both macro so I change them to function and it works! See the edited file here . At least CMAKE worked and now I'm running MAKE. I will update this post when I got HHVM running. So HHVM has been compiled and ran smoothly on my box. I submitted a pull req...

XenForo WordPress bridge (again)

A long long time ago, I started working on WordPress 3 Bridge for XenForo . I think it was one of the first work that I have done, the idea back then was pretty simple: find XenForo directory, load the session then find the connected WordPress user... It worked for awhile but because loading XenForo bootstrap code is slow and the two system architectures are different from each other (XenForo is MVC while WordPress is still procedure), there was a lot of bugs. It took hours to make it work nicely with other WordPress plugins. When XenForo moved to Resource Manager for add-ons, the plugin thread is locked at 37 pages. I haven't work on it since then. In the meantime, a few other solutions popped up but for some reason they died relatively quick... Enter [bd] API , it exposes XenForo data in a systematic way and uses OAuth 2 to authenticate users. Quite powerful. I have developed a bridge solution to connect two XenForo installation and it worked well so this time I went to develop...

IMAP module for PHP in Mac OS X Mountain Lion

So here it comes again. I have recently upgraded to Mountain Lion and for whatever reason, Apple decided to nuked all my previous PHP (among other things) configurations so I have to setup IMAP in PHP again. A simple Google search may point you to this post with detailed instruction for Lion however, some steps have been changed a bit... Step 1: Install prerequisites You may choose to download Xcode ( FREE ) from the App Store then go to menu Xcode > menu item Preferences > tab Downloads, select to install Command Line Tools OR you can go to Apple Developer  to get it, you may need to login. Step 2: Compile IMAP Get the IMAP source code from University of Washington website . Please do me a favor and check that website for the latest version, it's good practice. If you that laz y , try to click the "y" to get direct link to 2007f version. Extract the package and open the Terminal to the new directory before executing these command: make osx EXTRACFLAG...

Announcing Vietnames Input Method for XenForo

(tiếng Việt ở dưới) Today I'm announcing the release of Vietnamese Input Method for XenForo as an extremely easy to use add-on. The add-on package can be downloaded here:  xfrocks.com The source is available also on github. The source tree is merged from the  mudim Google Code tree This add-on does not just insert a simple <script /> tag into every page of your site. It went far than that and create a few additional option in account/preferences page so logged in users will be able to configure their typing preferences once and for all (so if a user uses multiple machine, it still works as expected). **** Add-on này tích hợp bộ gõ mudim cho XenForo. Hỗ trợ trình soạn thảo WYSIWYG trên máy tính để bàn cũng như trình soạn thảo chuẩn cho các thiết bị di động (Android, iOS,...). Sau khi cài đặt thành viên có thể vào trang account/preferences để cấu hình bộ gõ theo mong muốn, các lần đăng nhập sau hệ thống sẽ tự động cấu hình bộ gõ (như vậy nếu có ai sử dụng nhi...

YAFB has been updated to use Facebook OAuth 2.0

Facebook requires every site to switch to OAuth 2.0 and no later than October. I have updated my most appreciated masterpiece. Current version is 5.0.4b, download is available here . The add-on is rewritten completely (hell, the old structure is a mess, hahah). Actually I don't plan to update this anymore but the guy from Zynga contacted me a week ago and asked if I can help him move the Zynga forums to OAuth 2.0. He contacted me a few times before and I offered to lend him a helping hand and it was a pleasure assist him and Zynga's community. I always try my best and on this occasion the outcome was great. You can now head over to http://forums.zynga.com/ and click the Connect to Facebook link, I hope it works for everyone out there.

Introducing Unicoder

This is a PHP library which is quite good in dealing with Vietnamese unicode string / text. Feel free to fork it and use it. I'm unaware of any licensing details and formalities. So, you use this at your own risk. Know yourself out and thanks. https://github.com/daohoangson/Unicoder

vBulletin 4 .XML Converter

It's really inconvenient to develop plugins for vBulletin these days since the 2 systems (vBulletin 3 and vBulletin 4) use different template engines (or so called). After a lot of frustrations, I finally made a converter which will "read" your old .xml product file and make it vBulletin 4 compatible. Please note that it doesn't magically make the plugins work in vBulletin 4 (which involves a lot of things), it just makes sure the template will be parsed correctly in vBulletin 4's system just like how it's supposed to be done in vBulletin 3's. Changes are made under several aspects Variable accessing Array accessing will be updated to the new way. No more $array[key], it should be {vb:raw array.key} StyleVar accessing (via vb:stylevar) Phrasing (support both simple phrases and compound ones) IF/ELSE condition in template The new .xml file will be saved in the same directory with the suffix _vb4. Okie, here is the code (in PHP, obviously) You ma...

YAFB 3.3.1 is out

After a long time being busy at a lot of personal things, finally I managed to release a maintenance version of YAFB to make it work with vBulletin 3. Also, as vBulletin 4.0.3 now has a built-in Facebook integration, many users want to migrate their Facebook users from YAFB to that integration. Hmm, it's obviously not a good move for YAFB but I decided to build the migration tool and it's available right away in this 3.3.1 release. The super-thread for YAFB is still located here , happy facebooking!

OAuth with Google, Twitter and... Facebook!

This is sick! Just a few days ago, I ran into OAuth as I want to get my GMail feed based on Google Data API . I succeeded. With a little help of an OAuth open source ( here , available in several programming languages). Then I remember that I once heard that Twitter also uses OAuth as an authentication option so I turned into Twitter and had a good read. Finally, I found out that they are basically the same (hehe, it's obvious since OAuth 1.0 is a worldwide standard). I had an idea of writing a universal class which can handle both Google and Twitter OAuth functionalities. It's not too hard. I took most of the idea from the PHP example ( here , PHP only). I also made a small script which accepts URI to send and intercept response from Google & Twitter servers. At that moment, I was so excited with all the ideas but actually it has no real world benefit so I just left it there... Until today, in the F8 (says "fate") conference of Facebook, I was stunned fin...

Lazy developer

Have you ever heard a joke about developers? Actually it's not a joke since I personally think it's true (at least to me) but it's always fun to hear: Developers are very lazy. (Oh yeah, I'm). They can't afford to finish a 15-minute job at all. (Oops). They will spend 3 hours coding to be able to finish that job in 1 minute. (Uh oh, that's 14-minute laziness. LOL) I have an example here: got an exercise in discrete mathematics which involve using the Dijkstra algorithm to find the shortest way between a vertex to another in a graph. There are enough vertex in the graph that made me lazy (5, LMAO). Oops, I have just opened up the source code and found out it's about Hamiltonian path , anyway, I was lazy and finally came up with this PHP script to solve the problem quickly (hundreds millisecond is considered quick, isn't it?) The script is intelligent enough to sort out all duplicated paths. Lazy meeee!