skoop.dev

  • About
  • @skoop@phpc.social
  • Setting iTerm tab names

    January 26, 2012
    automation, bash, iterm2, osx, shell scripting

    Being lazy and forgetful, I decided to write a simple bash script to execute this command. What I wanted to be able to do is enter a command with a title, which would then become the tab title. Something like this:

    itermtabname leftontheweb

    This is of course a very simple thing to do, but I have never done any shell scripting. So with a bit of Google Fu I found out how to do this. It is indeed very simple:

    I’ve also added this script to my toolbox.

  • Installing the Geoip PECL package for Zend Server on OSX

    January 11, 2012
    community, geoip, i386, osx, pecl, php, re2c, zend server

    Note: I am using Zend Server Enterprise on my local machine. While I don’t think the steps will be different for Zend Server CE, you might want to check to make sure.

    Starting out

    When you try to just install the Geoip package using pecl install, the installation will fail. Initially, the errors might seem a bit cryptic, but if you look back a bit in the log of what the installation did, you’ll notice a couple of things. First thing is a missing ‘re2c’.

    re2c

    I simply downloaded the source package and compiled re2c using the simple commands:

    ./configure
    make
    sudo make install
    

    This worked for me. Next time I tried pecl install geoip, the log shows it found re2c. BAM!

    Geoip

    The next error was slightly more cryptic:

    checking for geoip files in default path... not found
    configure: error: Please reinstall the geoip distribution

    After some searching a bit of help from my current colleagues, I found out this refers to the MaxMind GeoIP API package. I downloaded the source for that, checked the README.OSX and found a nice shell script which will do most of the work for you. So I issued:

    sh README.OSX
    sudo make install
    

    I got no errors at all during the installation, so I assumed the installation went fine. And indeed, running pecl install geoip now worked!

    Enabling the extension

    Last step left now is to enable the extension. Lazy as I am, I used the Zend Server control panel. I went to the Server Setup tab, to the extensions option. The listing now included the geoip extension. I clicked the “turn on” link, then “restart PHP” (whoever thought of the term “restart PHP” should seriously consider another carreer 😉 ). Unfortunately, “The system could not load this extension”.

    Building for the right architecture

    Trying to Google for this error, I didn’t really get much further. The error is too generic to really find any useful information. Asking around on Twitter, I luckily got some useful information that I could use in the search. Alvaro mentioned the files might not be built for the right architecture. Being on OSX Lion, I would assume everything was built for 64bit. And indeed, I could confirm this with:

    file /usr/local/zend/lib/php_extensions/geoip.so 
    /usr/local/zend/lib/php_extensions/geoip.so: Mach-O 64-bit bundle x86_64
    

    Next step was to check whether Zend Server perhaps was not 64bit, and indeed, this was the case!

    file /usr/local/zend/bin/php
    /usr/local/zend/bin/php: Mach-O executable i386
    

    So apparently, I had to build the geoip extension for i386 instead! Again, I had to ask around a bit to do this, and Jeroen hinted me to the CFLAGS. Of course, I had to use this both on the GeoIP API and on the PECL extension. So, I had to reissue the commands. Note: just rebuilding the Maxmind GeoIP API didn’t do the trick for me. I had to remove the directory and unpack the tgz again for this to work.

    Before building the MaxMind GeoIP API, I opened the README.OSX file that contained the installscript. I updated it to be as follows:

    export GEOIP_ARCH='-arch i386'
    export MACOSX_DEPLOYMENT_TARGET=10.7
    export LDFLAGS=$GEOIP_ARCH
    export CFLAGS="-g -mmacosx-version-min=10.7 -isysroot /Developer/SDKs/MacOSX10.7.sdk $GEOIP_ARCH"
    ./configure --disable-dependency-tracking
    perl -i.bak -pe'/^archive_cmds=/ and !/\bGEOIP_ARCH\b/ and s/-dynamiclib\b/-dynamiclib \\\$(GEOIP_ARCH)/' ./libtool
    make
    

    Not that I didn’t just change the GEOIP_ARCH, but I also updated the version numbers in the SDK line. Then I ran the script and ran make install.

    Reinstalling the PECL extension

    Then I uninstalled the PECL geoip package to remove the old version:

    sudo pecl uninstall geoip
    

    After doing that, I reinstalled the package again, but specifying i386:

    sudo CFLAGS="-arch i386" bin/pecl install geoip
    

    I then restarted Apache, refreshed the extensions page in the Zend Server control panel, and lo and behold: It said the extension was loaded and ready to use. Then I ran the script I needed to work on, and it didn’t error out anymore on the geoip functions missing. It worked!

    One thing to note

    In the above, for all PECL commands I did, I used the PECL binary in /usr/local/zend/bin/pecl. It is important to use this version if you’re using Zend Server, because it is the same build as the other stuff, with the right configuration. I don’t know if it would work with another PECL installation, but better be safe, right?

  • Looking back at 2011

    December 31, 2011
    php, symfony, year

    January

    The biggest thing for me in January was of course the news that I became an official Sensio training partner. I very much like to deliver training, and being able to deliver the official symfony training is of course awesome! After a slow start early in the year, it took off some more after the release of Symfony2 stable (not surprising).

    A blogpost that many people appreciated was my blogpost about barcodes and QR codes. I am clearly not the only one that needs to work with those, so the response was quite good. I’m very happy that so many people felt this was a useful blogpost. I’ve since then moved on to other projects already, so I don’t use this anymore myself, but I will be referring to it myself as well if I ever need it again.

    February

    Another popular blogpost (and sparked some discussion on Twitter as well) was my blogpost about the future of magazines. After getting our first iPad, my eyes opened to the possibilities that devices like this are opening for digital magazines.

    March

    In March, a discussion started about how Drupal could or could not work for government websites. I gave my opinion on this which gave a nice discussion in the comments and on Twitter. I’ve said it before and I’ll keep saying: Don’t discard any tool by default. Each tool has it’s own place in the PHP world, and Drupal’s spot might be growing for years to come.

    April

    In April, I wrote a HOWTO on using DocBlox with Jenkins, and though it got no comments aside from spam comments, I’ve gotten a lot of feedback from people that they found it quite useful, which is always good to hear.

    May

    In May, I started a new series of articles. And though I still have some topics that I want to write about in this series, I already think the whole series might be useful for people. The first article I wrote in this series was about PHPStorm, the center of my workday.

    June

    In June, after some controversy about a fork of PHP, I wrote what I thought the PHP project and the PHP community needs. This was again a contribution to a bigger discussion, and it’s good to see that some of the points I and some others tried to make got picked up.

    July

    Looking back like this makes me realize that quite a few of my blogposts were on discussions and controversies. In July, it was about whether conferences ask speakers to pay for a ticket, even though they are speaking. Simply said, I think it’s OK if they do that, as long as they communicate this upfront.

    October

    In October I decided to open source LinkTuesday.com, a website I built for getting a quick overview of the links that are being shared as part of Link Tuesday. Since then, I’ve already gotten a couple of pull requests, so I believe it has been a good decision to do this.

    I also wrote about my first real experience with Silex, the PHP5 microframework based on Symfony. I really liked this a lot, and actually I’m doing a workshop on Silex in January out of the new Techademy I started with Joshua Thijssen.

    And then there was the news that Drupal is going to be using some Symfony2 components in their project, which is great for interoperability and will improve both Symfony2 and Drupal.

    November

    New conferences are always fun. I was at the first Dutch PHP Conference, the first PHPBenelux Conference, the first 4Developers conference and in November I was happy to announce that I will be speaking at the new D-Day Conference in Helsinki, Finland.

    And of course November was the month of Joshua Thijssen and myself launching Techademy, a new training concept to inspire developers, to let them expand their knowledge on two different topics in a single day.

    December

    And this month, I launched a new small Symfony2 bundle that allows one to easily embed an old symfony 1 project inside a Symfony2 project: IngewikkeldWrapperBundle. I’m using it myself now on one project and it works quite nice.

    2011

    2011 was a good year in some aspects, a bad year in others. Basically, like any other year. But I’m looking forward to seeing what 2012 will bring. There’s big plans and ideas, let’s see if that will get off the ground. Happy new year everyone!

  • Support the global community

    December 29, 2011
    kiva, micro-financing, pfcongres, php, symfony

    This is the reason I give to charity a lot. But since 2008, I also support entrepreneurs worldwide by micro-financing loans they need for starting or expanding their business. I’ve been doing this through Kiva. Looking at my stats, since 2008 I’ve made 11 loans to a variety of countries (Cambodia, Senegal, Philippines, Paraguay, Ukraine, Uganda, Mexico, Bolivia and Kenya) for a variety of different purposes (Restaurant, Farming, Crafts, Food Production/Sales, Food Market, Furniture Making, Musical Performance and Sewing). Funny detail: The currency for Philippines is PHP.

    The concept of Kiva is that several users of Kiva support a project by all lending $25 (or more). The entrepreneur gets the money, can use it for the purpose for which it was lent, and then repay it over a certain period with monthly repayments. All lenders get an occasional update on the status of their loan, and as soon as a repayment has been made, you get it back into your Kiva account. Once repaid, you can make another loan to another person.

    As I mentioned above, I think we who live in wealthy countries have a responsibility to support those people in their efforts to improve their own life. And that’s why, at the end of a beautiful 2011, I want to ask everyone in the PHP community to look beyond the PHP community to our global community. Consider creating a Kiva account, put in $25 (or more of course) and make a loan. Help other people, this time not by answering questions or writing some code, but by lending them your money. And of course, if you do, feel free to join the PHPeople or Symfony team.

    Supporting the global community is also why we purchased Kiva gift cards as speaker gifts for PFCongres 2011. The response from speakers to this was quite good, so I’m happy we made this choice. Now I hope other people will make the choice to support Kiva and the global community.

    I wish you all a very happy 2012, and hope to meet many of you at your local conference of choice 🙂

  • Introducing IngewikkeldWrapperBundle

    December 21, 2011
    bundle, migration, open source, php, symfony, Symfony2

    The IngewikkeldWrapperBundle adds a fallback route: Any URL not caught by your Symfony2 code will be forwarded to your old symfony 1 project. This allows for gradual migration to Symfony2. For an explanation of the thought behind all this, please check this post on the Leaseweb Labs blog, where I’ve guest-posted about this way of migrating from symfony 1 to Symfony 2.

    The IngewikkeldWrapperBundle is currently in a proof of concept-phase, but works already for one of my sites. I welcome any feedback and contributions 🙂

  • We just launched Techademy!

    November 29, 2011
    git, ingewikkeld, php, spl, techademy, training

    The idea of Techademy is simple: Every month we organize a training day during which attendees attend two workshops. There is a different set of workshops during each trainingday. And for a relatively low fee (currently set at 150 euro), you get a full day of training by experts! Obviously, it won’t be as in-depth as the expert training sessions I mentioned earlier (there’s only so much time in half-day workshops), but that’s not the purpose of the these days: The idea is to inspire and get attendees started on the subjects of the workshops, allowing them to continue learning about it during their regular job or in their spare time.

    I am quite excited about this idea and it fits well within my plan to start delivering more training sessions. It also gives me a perfect excuse to work together again with my friend Joshua on a topic that we are both passionate about, sharing our knowledge and experience with others.

    To celebrate the launch of this new venture, Joshua and I decided to donate the full proceeds of the first training day to charity. The charity we picked is the “Serious Request” campaign of Dutch national radio station 3FM, who will raise money in the period approaching Christmas for the Red Cross. I’m hoping for a full house during this training session!

  • Git resources

    November 24, 2011
    blogs, documentation, drupal, git, joomla, training

    Think Like A Git

    This one I came by first through #linktuesday. The site was started to make learning Git a lot easier, and I’m thinking they’re succeeding. If you’re new to Git (and even if you’re not), this one might well be very useful to you.

    Pro Git

    I guess everyone who ever looked into Git has already seen Pro Git, but I need to share this one if I’m talking about Git resources. It’s still my default Git resource when I need to look something up.

    Starting With Git: Cheat Sheet

    Cheat sheets are always good, but this one is special. It’s not just a listing of the Git commands, but actually contains some explanations as well, making it extra useful. I refer to this one in every single training I deliver on Git.

    Building a Drupal site with Git

    The company I deliver most of my Git sessions for is one of the leading development and maintenance shops for Drupal and Joomla! projects in The Netherlands, so I’ve been digging into specific documentation for working with Git in combination with those projects. It turns out that Drupal already has excellent documentation on the topic!

    How to track your Joomla! project with Git

    It looks like Joomla! is a bit behind on the Git bandwagon, but I learned today from one of my students that Joomla! has actually finalized the decision to fully move to Git, so I’m guessing more documentation will follow soon for Joomla!, right now there is already some third-party blogs that have published some stuff, like the article by howtojoomla.net on how to manage your Joomla! project with Git.

    Let me know!

    If you know of any other resources on using Git, let me know, I’m always happy to include more links in my training sessions!

  • D-Day is coming to Finland

    November 3, 2011
    conferences, d-day, finland, php, symfony, symfonylive

    The conference, taking place on February 6th in Helsinki, is a new conference focussing on “Design, Development & Digital business”. It’s not a pure PHP conference, which is what I really like. The current list of announced speakers is quite nice already, I’m looking forward to seeing who else will be speaking.

    As for my talk: “Don’t use a screw when you need a nail” is a talk I’ve done before twice, and the most important thing people should get from this talk is to not be afraid of tools not written in your favorite language, but look beyond that. For many of those tools you don’t need any or just a little bit of knowledge of the language to use it. During my talk, I will mention quite a few tools from different categories that developers could look at.

    I realize that it can be quite cold in Finland in February, but I’m really looking forward to this conference. Perhaps I’ll see you there?

  • Drupal just got a whole lot more compatible

    October 25, 2011
    components, drupal, integration, open source, php, phpbb, PSR-0, symfony, Symfony2

    Drupal is, independant of how you measure it, the leading PHP-based CMS. Whether you look at the amount of websites using it or the size of it, Drupal rocks it all. One thing that has kept me, and I guess many others, so far from seriously working with Drupal is the lack of object orientation (most of Drupal is (or was) procedural code). And while this is simply another approach, and one that has worked well for Drupal all these years, it does keep many people from seriously adopting the software. With Drupal moving now towards reusing existing components and integrating those, just like phpBB last year, Drupal now is opening up to a new community.

    One thing why I’m so excited about this is that on a regular basis I run into projects which have a part that is typically well-suited for a standard CMS, and then another part that (in my view) would be better suited being built as custom code on top of a framework such as Symfony2. So far, I had to make a choice between either one approach because integrating it would take me a lot of time. Now, with Drupal adopting some Symfony2 components, this integration is looking to become a whole lot easier. Given that HttpFoundation is now in Drupal, I’m sure true session integration, for instance, is not that far away anymore. And with that, easily sending requests back and forth between Drupal and custom Symfony2 code will become a whole lot easier.

    The adoption of PSR-0, the naming/autoloading standard using by (amongst others) Symfony2 for the core of Drupal also makes other things possible. It will also be a lot easier to start using other PSR-0 libraries into Drupal and Drupal projects. Specifically, I’m thinking about Zend Framework here, which has a lot of very useful components as well. And not just for core, also for projects. Having PSR-0 integrated into Drupal just made development for any Drupal developer a whole lot easier.

    I guess the rest of my phpBB/Symfony2 blogpost also applies to this situation: There’s new opportunities rising up from this, making developers that have worked on Symfony2 available to the Drupal project, and skilled Drupal developers available to the Symfony2 community. Drupal will be building on top of a strong, tested base while for Symfony2, this is another great use case of how Symfony2 and it’s components can be used. But also: Both communities should embrace eachother, and start working together to make this integration a success, and perhaps (this is at least my hope) allow Drupal to integrate even more Symfony2 components to make it even easier to combine the two products in a project.

    Welcome Drupal community to the Symfony2 community. I am excited to become part of yours!

  • A URL shortener in a couple of hours

    October 14, 2011
    microframework, php, prototype, silex, symfony, Symfony2

    About Silex

    Silex is one of the many microframeworks we’ve seen pop up recently. Contrary to most other microframeworks, however, Silex is built on top of an existing open source project: Symfony2. A microframework is a very small framework which basically does nothing more than bootstrap and handle your request and response. Though the microframeworks cater to a very specific need, I really like the approach of not needing a full framework for a project that clearly is simple enough not to need one.

    Some things I really like about Silex are:

    • Built on top of existing open source components
    • Packaged in a phar package
    • Extensible: There are extensions available to the Silex core, and I can extend it even more

    Sitting down

    This morning, I sat down to have a look at Silex and see how it works. I simply downloaded the phar, set up my basic project, and started working on setting up what I had in mind. Every time I got stuck or needed some info, I just Googled the topic to find the answer.

    And this is where the first “problem” arose. I followed the steps in one of the pages I found on the official Silex and ran into an error telling me Silex\Extension\TwigExtension could not be loaded. Thanks to @Stof70, however, I found out that actually, I was looking at an old version of the documentation, and Extensions had been renamed to ServiceProviders. After changing my code, everything was working again!

    Using this approach, it only took me a couple of hours to get a working version of my URL shortener. I did this by a constant refactoring, starting off with a very simple version and then constantly improving this code up to a point where I had what I wanted. Quite nice. Now it’s time for some real-life testing 🙂

    When Silex

    What I’ve found is that Silex (or any other microframework for that matter) is an excellent approach for small projects where you start with an idea of what you want to build and then improve on your existing code. It is very tempting to put in hackish solutions, which is OK if you keep on improving your code but you have to actually do that and not keep the hackish solution.

    Another great situation where you might want to use a microframework is for quick prototyping, if you want to build a quick prototype for a customer to show them what can be done, and have the opportunity of rebuilding it later for the final version, a microframework will give you everything you need for the basic setup. Quite nice! So try it! Just take a couple of hours and an idea of a simple site or app you want to build, and start building. Even if you never use it later on, you’ll have learned something new, which is always good.

Previous Page
1 … 15 16 17 18 19 … 61
Next Page

skoop.dev

  • Bandcamp
  • Mastodon
  • Bandcamp