Posts Tagged coding
In my previous post I started a project/experiment to create a simple Java Rest client. I immediately found that I would need a simple service that didn’t do much in order to test it properly. So that is leading to another part of the project, the simple PHP service. I started writing what I thought would be a pretty simple generic PHP service, then it hit me…I suck at PHP. No really, I haven’t done it in a while, and even then I wasn’t highly proficient. So I scrapped the whole idea and decided that someone out there in the interweb must have created a simple PHP rest service thinger. As it turns out, I was right
This project was super simple and did everything I needed it to do. Predefined service routes and responses. Yes, I could shoe-horn it into doing a lot more, but I don’t need that. Just something easy to create and modify service responses to test my simple client with.
I guess after all this I have to say that the old mantra of Unix coding is really starting to die out. “Make each program do one thing well” It seems everyone is so concerned with creating programs that do everything for everyone, they don’t do anything very well.
I have a new hobby taking up what little free time I have these days. I tried for a couple of years to get into Java games, I created a couple of my own but I never really finished anything because I would run into issue that I wasn’t sure how to overcome. They eventually became show-stoppers for the game and I eventually lost interest. Most of the issues were around desktop performance and Java GUI programming, both subjects I have little exposure to in my 12 years of client/server based development. I suppose I could have buckled down and learned it but in all honesty I wasn’t very interested in learning Swing or AWT.
I have big plans for my game idea, but I think first I am going to create some little one-off games to get my feet under me.
I just finished the Google CSE article I started a couple of weeks back. It was an interesting project, mostly due to the fact that I have never worked with the Google search API before and it was enjoyable to learn something new.
Hopefully you find it useful. When I was putting the code together, I found there to be a distinct lack of articles or documentation on the Custom Search Engines. Hopefully this helps someone. Then again, Google will probably EOL the JS CSE API in the next few months and I will have written the article for my own benefit. Ah well..
If you know me you probably know that I like me some techno when I code. I dunno why, guilty pleasure I suppose, sort of like how I like to listen to hardcore when I drive. Yeah…don’t ask, I don’t have an answer for you.
Anyway, I like to listen to something on my headphones when I code since I am able to narrow down the number of distractions that way and really concentrate on what I am doing. Which is odd, its like I need one distraction rather than a bunch since I am able to ignore one thing as opposed to multiple. Anyway, again, I heard Ducktoy by Hampenberg, and had to laugh. They/he/she, bases a techno soung around a duck toy squeaker. Its annoying at first, but gets kinda catchy, then become annoying again. I found this YouTube music video for the song, not sure i like the idea of bikini clad women dancing in unison whilst squeezing duck toys, that is sure to give me some funky mental images in the days to come. Oh man, I have had too much coffee today..
I have been working to implement a Google custom search engine into a clients website. I have had to pour through the documentation to fully understand how it works and I am both impressed and revolted simultaneously. I keep getting the feeling that this stuff was originally developed by people that are obscenely smarter than I am. Its obviously brilliant, but like any brilliance, its usually offset by some other glaring omission.
First off, the search API from Google. Why is the primary search API deprecated and the recommended replacement not even out of labs yet? So let me get this straight, I can either use the API that will EOL’d at some unknown time by Google without warning, or I can use the unstable labs API that could and most likely will change in the future. Sounds like a call from the client complaining that their site is broken just waiting to happen.
Second, the API is written in a way that leaves massive holes of undocumented functionality. Usually when you document an API you include ALL the functionality so people can fully utilize all the features. So I am continually finding blogs and other bastions of literary excellence revealing ‘hidden’ features of the Google search API. I have implemented a fair amount of the code I have found on these sites and I am still flabbergasted as to why Google would just leave this stuff out of their documentation.
I am going to be writing up an article on implementing a Google custom search engine over the next few days, one, so I can remember if I have to do it again in the future, good documentation is sparse on this subject, and two so others can refer to it and hopefully avoid some of the frustration I have gone through to get this to work.
I have been coding for over a decade now and one thing about other coders has never ceased to annoy me. In defense of my rant, I present two snippets of HTML code, see if you can pick out the difference and the source of my exasperation, I’ll leave it up to you to make the determination as to which is the good and which is bad:
<div id="content"> <div id="content-wrapper"> <h1 class="layout-indent">Page Title</h1> <div class="separator thick-separator"> <div class="thick-separator-cap thick-separator-left-cap"> </div> <div class="thick-separator-cap thick-separator-right-cap"> </div> </div> <div class="layout-indent"> <div class="yui3-g"> <div class="yui3-u-1-3"> <a href="#" class="link action-link ">Filler Text....<br /> <img class="link-arrow" src="img.png" alt="" /> </a> <div class="clear"> </div> </div> </div> </div> </div> </div>
<div id="content"><div id="content-wrapper"> <h1 class="layout-indent">Page Title</h1> <div class="separator thick-separator"> <div class="thick-separator-cap thick-separator-left-cap"> </div> <div class="thick-separator-cap thick-separator-right-cap"> </div></div><div class="layout-indent"> <div class="yui3-g"><div class="yui3-u-1-3"> <a href="#" class="link action-link ">Filler Text.... <br /><img class="link-arrow" src="img.png" alt="" /></a> <div class="clear"> </div></div></div></div></div></div>
The structure of these snippets is identical, they probably layout the same between browsers too. I guarantee you that if anyone ever had to make a change, the first one would be far and away easier to change. So why do people still insist on editing spaghetti code? This isn’t just an HTML issue, it happens in every coding language I have ever encountered. I just want to say to people, “Would it kill you to use the tab and enter key from time to time?”, its as if not indenting their code will somehow make them work faster. “Look boss, I saved 2.78 seconds last week, by not formatting my code!!” In my opinion it really shows that someone [programmer] has pride in their work if they spend the extra few minutes documenting and formatting their code.