Archive for the ‘php’ Category

Life and Tech – Choices, Decisions and Options

A couple of weeks ago Friday, I shared lessons from my life in technology with a team of upcoming software developers, Life in the Tech Lane, and I got a number of follow-up questions like the one below. On reading the questions, it spurred this post as the responses needed to be long form

For that matter I got a number of questions that I would like you to address that I couldn’t easily ask yesterday. These are the questions that I have:

How did you know that software delivery is your thing, amongst all the various options?

My first taste of technology related work was in my S.6 vacation at an email service firm where I helped develop UNIX training materials, setup & troubleshoot modems for email services, and my initial foray into server scripting. I worked on this through my undergraduate course, even when I worked in a civil engineering consultancy it was all software related work. I was hooked, to the problem solving, creation of digital solutions & learning that came along with the work, making my life very interesting.

Over time, I have embraced the challenges of having to develop solutions quickly, train users, support them as products evolve, which has kept me in the line of work.

I also tried management, and found out it was not for me thus came back in the trenches. However I come with a lot more value, I understand the needs of executives in a sector, can put myself in the eyes/place of a user and have a good handle on technology.

Overall it seems like software delievery chose me, I am still engaged 20+ years later, and see a future as an older software developer/engineer by evolving myself and skillsets to maintain relevance

 Why PHP and not the other languages, I mean there is a number of new technologies and spaces being created everyday, why stick to the”old” one PHP?

I started programming in UNIX shell scripting, Turbo Pascal, Visual Basic 6 and Visual Basic for Applications (for Excel), Java 1.1 & 1.2. At the time of Java we were building enterprise web applications, however deployment was a challenge which was how one of the clients introduced us to PHP.

This is a language made for the web, with lots of libraries through PHP Classes, Stack Overflow and other sites. The frameworks, Symfony, Code Igniter, Yii simplified the process of building and maintaining custom web applications. Addoitional solutions, such as CMSes (Joomla, Xoops, WordPress) were the foundation for website development.

I used PHP for over a decade, during which I became familar with the language, quirks (that were reduced in versions 5.6 and the 7.x series), thus it became a familiar tool which I can keep using within the space for my current and future work.

I have also learnt and used Python, Ruby on Rails, Java 8 (which I use in my day job), however I find the PHP language my tool of choice to provide technology solutions as it aligns with how I solve problems. This has been made easier with the Laravel framework, which provides a great eco-system with alot of existing tools & solutions, so I can focus on business problems rather than tech and tooling.

What advice would you give me as a young profession who is in the early days of formal employment in the tech industry. I have a challenge about my career path or direction. I want and I feel more joy when doing data science/analytics work but I have failed to get the opportunity of pursuing that space and it’s for that reason that I have taken on the software development path as these are the opportunities that have been available, it’s not that I don’t enjoy it, I do but my utmost passion is data science. What advice would you give me regarding that?

  1. The best way to predict the future is to create it. A future in technology is easier to create leveraging opensource tools and technologies – thus if you want to do data science, I would suggest picking a problem you are passionate about and spend your personal development time growing it, working on it, writing about it (you need to share your lessons and paths) so that you keep growing
  2. Find opportunities within your current employer for the data science/analytics work – if opportunities do not exist, create them by talking to your colleagues, taking part in meetings/discussions or even starting the discussions on leveraging data science/analytics within your organization
  3. Take time to get better at the role you are hired to do, as that can provide the basis to growth and opportunites being taken on you
  4. Join local meetups and activities around data science/analytics to grow your network
  5. Take courses on your chosen path to ensure you are ready to take up any opportunities that come up
  6. Be persistent in finding opportunities along your chosen, do not give up it may take longer than expected

Voice of the ElePHPant Podcast – PHP, Technology Journey, Opensource, Java

I am excited to have been hosted on the Voices of the Elephant podcast by Cal Evans

https://voicesoftheelephpant.com/2020/06/23/interview-with-stephen-s-musoke/

Talking about my technology journey, opensource, Java, PHP (of course) and what I am doing with it in Uganda and Africa

My first Symfony 2 Web Application – The Journey – Installation

Happy New Year, 2013, its finally here … Well in 2012, I should say I had Symfony 2 envy, almost akin to a high school crush, so after suffering in silence for so long I have finally decided to jump in with both feet.

I am developing a simple website which is esentially a set of utilities for my home country Uganda, and the idea is that I can learn a bit more advanced PHP but also opensource it later to use as a teaching tool for other local developers (oh yes, I want to share my knowledge too). This will also give me the chance to see if I still got it in me because I do not touch code in my day job, akin to Neo in the matrix hacker by night.

So what I have I used, well an evaluation copy of Zend Studio 9 (used to use an older version at my work place), Symfony 2 (latest distribution), Twitter Bootstrap, JQuery, Git (I am using a private Bitbucket repo) and well an open Google tab. My first words are wow!! Alot has changed in the world of PHP since I last used it, Composer, Less, Sass which requires Ruby … But hey here goes

BTW I am running all this through a WAMP (http://www.wampserver.com/en/) install again the fastest I could get things to work, you could use XAMPP too but I have never done so. I am using PHP 5.3.13 with MySQL 5.5 on Windows 7 64bit. One question I may receive: As a newbie why are you going for the whole enchilada (Symfony2, Composer, Bootstrap Integration etc) – since this is a clean break I am trying to also get an understanding of the different tools that have been developed, how to use them and what they mean for the “average” web developer to answer the question – are they worth it?

  1. So first step was installing composer, which I did following the instructions here http://getcomposer.org/doc/01-basic-usage.md after which I installed it globally so that I could call it anywhere following the instructions in the answer http://stackoverflow.com/questions/12059397/is-there-any-way-to-install-composer-globally-on-windows  
  2. Next was to install Git using Git for Windows (http://msysgit.github.com/) needed even for local staging
  3. Being a git newbie, I could not get things to work properly to create the project I followed the workflow below: (I stand to be educated on a better workflow)
    • Created a new Git project on Bitbucket
    • Created a new PHP project from Git within Zend Studio – which gets everything configured well
    • Downloaded the Symfony 2 standard edition and copied the files into the new project
    • Followed the instructions here to commit it …
  4. Integrated Twitter Bootstrap using the Mopa Bootrap Bundle ( https://github.com/phiamo/MopaBootstrapBundle) however this required me to install Ruby for the LESS integration using Ruby gems while I initially run into a couple of problems with the installation of mopa/composer-bridge it was probably a connection issue. Also note the following:
    • Running the composer update command requires a console with administrator privileges to be able to create the symbolic links
    • The lessc.bat file in the Ruby install folder needs to be updated to use absolute paths to ruby.exe other than the relative paths in the file
    • Well after a lot of troubleshooting I found out that the ruby gem for Less was depreacted so I ended up using LessPHP (PHP compiler for less in pure PHP) following the instructions at http://isometriks.com/using-less-with-symfony2

Now the initial installation is done, I have my Symfony2 project running with Twitter Bootstrap integrated, it has been about 10 hours of work, but totally worth it as a learning experience

Uganda Web Developer Workshops: Rotary Style – Idea looking for Partners and Direction

This is an idea that has been growing in my mind, and I seem to finally have a handle on it. I have been a professional PHP web developer for the last 12 years, and have gone through the learning and transition cycles from learning a new language from Visual Basic 6 and MS Access to Java/JSP/Servlets to PHP, and developing in the language from direct database access using mysql_query through a custom developed database class into Zend Framework for 2 years with Doctrine 1 and 2 ORMs.

My biggest challenge has to do with the fact that there are no places to go and talk code, PHP/Javascript/Database in Uganda, along with the experiences and challenges facing web development with “need-to-have” practices like:

  1. Refactoring
  2. MVC design for web applications
  3. Version control – branching, merging, version tagging and management
  4. Testing – unit and functional testing, load testing
  5. API development (okay this is pushing the enveloper)
  6. Continuous integration, code quality metrics – complexity, modular development, cyclomatic complexity
  7. Team Style development – PSR 0 and PSR 1 compatibility
  8. Frameworks – Symfony, Zend Framework, Kohana, JQuery, Twitter Bootstrap
  9. Advanced CSS and HTML 5 – style guides, browser targetting, mobile development

I am also looking at doing this Rotary style, 1 hour developer meetings once in 2 weeks, then later once a week, same night, same location.

The bottom line is that we develop the quality of the available pool of web developers by growing a community, having role models, to also put a brighter face on the industry, improve perceptions and make it clear that this is an area that has professional practices. It is a win-win for all involved

Any ideas who has done this before, what were your challenges and trials, who would like to partner on this?

Display Contents of Different File Formats Word/Excel/Powerpoint/PDF/RTF as HTML

This is a typical problem which I also raised on Stack Overflow (http://stackoverflow.com/questions/11061929/php-extract-text-from-different-file-formats-word-excel-powerpoint-pdf-rtf#comment14475398_11061929), but there seemed no single resource around the web to solve this particular problem, so since I have solved it I thought it would make sense to provide an approach and a solution, it can be refined better with time

Problem: We have a web application that allows different users to upload different files to share with others, the file types are limited. However just before downloading a file, the user needs to see a preview of the file contents, which is where it becomes tricky since each  file type is different.

Approach:

1. Identify the extension of each file

2. Display the text or HMTL from each file using the appropriate library for the file type, since there is no unified library

The base class is https://gist.github.com/2941076 which requires the path to the file and the extension (since the extension is already stored in the database I do not try to extract it from the file)

The libraries used for the different types of files are the key to the solution:

1. MS Word Documents – LiveDocx Service within Zend Framework (http://www.phplivedocx.org/2009/08/13/convert-docx-doc-rtf-to-html-in-php/) the steps are:

– Create a Mail Merge Document using the word document as a template

– Connect to the LiveDocx service (here you need SOAP and SSL enabled on your local LAMP installation)

– Save the generated document, and render it as HTML

2. MS Excel – PHPExcel from Codeplex so simple its scary (http://phpexcel.codeplex.com)

– Create a PHP Excel class to read the file

– Create an HTML writer to render the HTML

– Save the HTML to a file and read its contents

3. PDF text extract – http://pastebin.com/hRviHKp1 

– Create an instance of the PDF2Text class holding a reference to the PDF file

– Decode the PDF which extracts the text out of the file

d) Powerpoint – Work in Progress to be added later

More as I work in the power point extractions