Monday 8 December 2014

Yeah My Life Sucks: Ze Programmer Saga

After spending one week around this firms infographist, I realise programming really does suck doesn't it? I mean in comparison to let day illustrating stuff. I mean seriously. Here I am, stuck with having to build this Android application that requires me to read so much documentation in between, and I only have 6 hours to deliver it? GoD my life sucks...

It feels to me like programming is like this vicious circle where you start, you get stuck, you read the documentation _ cause duhhh! you didn't write the fucking tools you're using, and even if you did you probably wouldn't know them by heart _, you get code examples, go through CPMT (Copy Paste Modify Test), until you're stuck again.

I see you coming at me like "pfff, noob, just pick one language and master it, that's it". Right, try doing your android apps with C++, or even try javascript for Windows Desktop apps, or maybe use use flash/actionscript for all your website _ lol, and get your websites totally ignored by search engines no?

Soon enough you'll know a programmer doesn't just opt to stick with one language or tool no matter what. Which is why my life sucks!!!

Tuesday 30 September 2014

What if I wasn't skilled enough?

"When you go to a job interview how do you show them you are actually that skilled?
By telling them about projects you did on your own? without supervision?
Who cares?
What matters I your cursus on the paper and actual work experience; A client paying you for work well done and giving you a written recommendation.
All these small garage projects you do are irrelevant to employers.

You will never be skilled enough. The learning never ends. There are myriads of topics worth learning out there. Right now though, what matters is getting a job, relevant work experience.
" Jacques MOULOT, my father, told me something in these lines.

Sometimes when faced with the harsh job market, even a recent graduate and honor student gets to doubt his own skills and fall into the vicious circle of endless training, and garage projects. I am one of those, and if you too are, well, what do you think after hearing the words from a doctor in electronics and professional for more than 30 years. I kind of feel like saying fuck that, this is b*llshit, Apple was a garage venture, Facebook was a dorm venture, Linux was a student's project. My mother hates seeing me in my old man's office the whole day, typing stuff she doesn't understand so she taunts me, and when I ignore the taunts she involves my old man, who always has the right words to make me quit. So anyways, I will not confront my old man cause I live on his turf.

My last job interview
I am a recent graduate. Well that is if you can call a year recent. A few weeks ago, I went to a job interview, it was a Business Intelligence firm, for an intern position and they basically wanted me to know enough to be put in the front line of a BI project. It sucked! Four long hours of barely satisfying answers. I knew the theory, I recited it, I kept insisting that it wasn't realistic to expect a recent graduate to tell them anecdote about successfully implemented BI projects cause, hey, I had never been in a team working on such heavy weight projects before. I mean even Linus did not produce an OS in just weeks now did he? And I can't do heavy projects, I'm building a portfolio and running out of time, see!

Regardless I blamed myself for my lack of knowledge and went on to plan some heavy weight projects on various topics I though I out to know better, refresh all the theory and implement mini versions of. Then my father confronted me that answer. Translate to english, he wants me to stop doing small projects and get paid for my work already. Now I need to find a job I guess. I was enjoying my garage projects though!


Monday 29 September 2014

Building a Joomla wysiwyg module

29-September-2014:
My first commercial Joomla! project felt a bit like a disaster. I did everything right; pimped the template, customized the modules, made a custom admin console page, wrote the documentation yet. The client was "Meh" about the whole thing... Kind of like the admin console was too complex. I figure what the client needed was a secretary. Anyways he never used the site; Never even notice a few people registered, nor did he notice when the site got defaced (because Joomla 2.5.9 apparently). Well I wasn't getting paid extra for maintenance, in fact I wasn't at all getting paid (The client's is family; got to hate family business). So I just let the site to the graveyard. I closed this project with the bitter task of failure in my mouth, and a bad start for my career as a joomla developer.

Joomla!'s administrator interface is horribly busy
First time I saw the interface, I paniced, not a lot, not until I tried to figure out how to make an article, by creating a category for the article, a module to display it, a menu to contain the menu item, and a menu item with the actual link to the article. Try explainingall that to your client. Anyways I exagerating, truth is I just want to make that wysiwyg editor cause I figured it would be a cool addition to my future joomla sites. So there you have it.

The specifics
Goal 1: Users have to be able to edit the module positions by just dragging them from one position to the other.

Where I'm at
Done 1: Figured I could use jquery-ui to make html elements draggable and self sorting. Tried html5 draggable="true" at first but changed my mind after I read some pretty horrible things about it.
I also read this css-tricks articles that demonstrated how to produce certain drag and drop effects.

Done 2: Found out the positions information are stored in the #__module table. So I won't need a jplatform call, just some Ajax fairy dust to keep the action in the frontend.

Stuck 1: Figured I would get modules positions by reading the templateDetails.xml positions section and then set the div's around these positions to droppable and each module's div to draggable...
This is where I am stuck; Do I read the templateDetails.xml for the selected template or is there a JPlatform call that could handle that for me?
Do I have to parse the index.php in order to find module positions? Is there a way to set all modules to a common class name so I can parse with javascript and the DOM?

30-September-2014:
Task 1: List the positions
I could either use the #__module table or the templateDetails.xml

Task 2:  Get the template's index file
I might be able to get it using
<?php JPATH_ROOT . "templates/" . $this template . '/index.php' ?>
Then look for the parts that have jdoc:include statements. How do I render it though? Do I add an attribute to the module? Do I just render it with a new class without modifying the template itself? Do I simply search the rendered templates for joomla generated core css classes and manipulate them with javascript?

I discovered then that Joomla 2.5.x gave every module a class moduletable; that looked promising. I couldn't find a list of core classes for Joomla 3.x though. Apparently they are different that version 2.5.x and use bootstrap classe names. I already feel I may have to abandon the fully frontend module initiative.

While looking for a way to customize jdoc statement  (the <jdoc:includes />) I discovered the concept of Joomla module chromes : a techique to render custom classes. Noticed however that it only worked with templates, when I wanted to work with modules.

03-October-2014:
I abandoned the idea of using Joomla's core classes. Templates are not required to use them and may have their own classe names for modules. In the end I'll have to do some php and jplatform acrobatics on the joomla files. I am thinking of getting some clues on how to render custom joomla pages from the renderer files in /libraries/joomla/document/html/renderer/ folder. From a quick google search I found out I may also be able to render custom views using the MVC architecture of joomla.

04-October-2014:
Finally I found a easier way to get content displayed in completly customizable view: Joomla components.

07-October-2014:
Found the JPlatform class that should allow me to read template index files: JInput. Found it in the Joomla developer manual . Now that I can read templates files all that's left to do is parse them, find the jdoc statements, get the position names from their name attribute, and get the class and id of the divs surrounding them so as to know what to manipulate in my javascript. Now what will I use for parsing: javascript or php? Javascript has the DOM... PHP will probably be faster though since it runs on the server side, but I don't know how to parse with PHP yet so...
Dude took me just 5 minutes to google it and it seems php dom xml parser will do...

10-October-2014:
Feels like I made some real progress today; Retrieved the path to the currently used template, and read it...

Retrieving the path of the currently used template:
Queried the #__template_styles table for the name of the template where the following attributes:
- client_id = 0 (client-side template = 0, admin templates = 1)
- home = 1 (default/currently used = 1, not default = 0)

once the name of the template found, simply created the template directory string using JPATH_ROOT:
$template_dir = JPATH_ROOT .  '/templates' . $template_name . '/'

Current issues 1: Saving to file using JFile or fopen
My first attempts failed for some reason.

Current issues 2: Parsing the retrieved file with PHP DOM
My goal is to get the elements that contain jdoc statements.

To be continued...

Saturday 20 September 2014

Schedule

Went to #Africtalent yesterday. Was quite the busy place, and fun too! Well would have been if they'd actualy let me in... My CV was too "green" apparently, bummer!
Anyways, I'm planning to launch my artistic portfolio soon... on behance! Then move on to more serious stuff... coding projects mainly. Need to be on the move... chap!!
Have you read this article about how in fact small entities in the busines world need to iterate more than the giants, at least until they launch a successful product? Well I take that advice to heart...

My schedule today:
- finishing some masterpiece for my artist portfolio, then advertising it to my network
- reviewing some java exercises I had had to practice for the Masters in Mobile Technology scholarship interview. Interview which I never attended because I was back home I don't have the means to pay for a trip back to Kenya.
- Get some work done on that joomla template I wanna be making
- Finish setting up my private #hadoop cluster... Hadoop hey?! Yeh heard the hype wanted to try my hands at it...
That's it!

Monday 6 January 2014

Footer always at bottom of page no overlapping

Strait to the point:
This is what worked for me:

What worked: "Margin-bottom: -10px"

    footer
    {

        clear: both;
        margin-bottom: -10px; /*keep overlapping footer hidden*/
        height: 400px; /*height of footer: make it as big as wanted*/
    }

What failed:


    html {
        position: relative;
        min-height: 100%;
    }
    body {
        margin: 0 0 100px; /* bottom = footer height */
    }
    footer {
        position: absolute;
        left: 0;
        bottom: 0; /* MAIN PROBLEM */
        height: 100px;
        width: 100%;
     }

This code I got from some site failed mainly because of the argument: "bottom: 0". In fact it would just stick and the bottom of the screen (good so far) even when I zoomed in, thus overlapping with the rest of the page (yak!!!)