Blogs
Recently, with my blog ‘A look at mobile websites’, I gave a insight about the growth of use of smart mobile devices. These devices, which are glued to human hands, ears and eyes for more hours in the day than ever before, run on mobile operating systems, like iOS, Android, Symbian, Windows 7, etc.
I thought it would be beneficial to dedicate this blog to introduce you to the fastest-growing mobile operating system in Google's Android.
What is Android?
Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android OS can be used as an operating system for cellphones, netbooks and tablets, including the Dell Streak, Samsung Galaxy Tab and other devices.
Skills you’ll need to dive into Android programming:
- For technical and programming skills, knowing Java will make you more comfortable. Also understanding of common, object-oriented languages like C++ and C# will make someone pick things up quickly, as apps you develop in Android are heavily dependent on the said frameworks.
- Some experience with a tag-based view technology like HTML or Adobe's Flex will makes the views very familiar.
Difficulties you’ll encounter:
- Layouts would be the hardest initial things to overcome as an Android developer. It required digging into the source code to make things look the way you wanted. There were things that were just not skinnable, or required making a completely new component, or changing the design.
- Taking full-size pictures in the app and using those pictures is harder than it should be.
- Another thing that is almost unbelievable is how much of a pain it is to work with maps. It requires signing up for an API key per computer to even see maps. Compare that to iPhone map development with Google maps, where you don't have to do any of that. They just work.
Tools you should have on hand:
- You need the Android software development kit, which comes with the emulator. Most developers prefer Eclipse for Java development, and the Android Developer Tools work with Eclipse.
- It also really helps to have a device, especially when doing things with location or with the camera.
Things you need to consider as you are creating Android-based apps for multiple devices:
- The big one is layout. If you fudge a layout to just get it working on a single device, it's going to get you later. You'll also need to prepare for different APIs not being supported, like the camera for instance. Designing the application well is going to make you think harder about the core functionality and use cases you want to support.
Best support resources for Android programmers:
- The Android Developers site would be a great help. It has all the associated documents, code and the Google groups.
- And as Android is open source, you can easily run searches and see what Google engineers did to make the core apps do what they do.
But did you know that double-digit percentage optimisation results can be achieved with a few simple steps?
Having optimally-running software is quite a bit of challenge. The main difficulty in achieving maximum speed lays in small implementation details, that, if not treated properly on time, build up and often are difficult to track down.
In a nutshell, writing a fast program means coding the same logic in fewer steps required for the computer to perform.
The following are several simple hints for programmers related with the well-known statements.
Program codes seldom follow a unidirectional path if statements are probably the most used statements of all. The syntax of the statement is:
if <condition holds true> then <do something with THEN (TRUE) caluse>
otherwise <do something with ELSE (FALSE) clause>
Firstly, some sign legends:
- == - EQUALS TO
- != - NOT EQUALS TO
- && - AND clause
- || - OR clause
- ! - NOT (NEGATION) clause
Usually, the condition of the if statement is comprised of multiple atomic (unbreakable into simpler pieces) conditions with optional NOT negation clause that are joint together with AND or OR clauses.
Example:
1. (a == b) && (c != d)
2. (a != b) && (c != d)
are both valid if conditions. Let's analyse the number of steps needed to gain a result.
(a == b) && (c != d) - in human language this means that to perform THEN clause a and b must be the same and c and d must be different.
This condition is equivalent to (a == b) && !(c == d). So
- Check if a is equal to b
- Check if c is equal to d
- Negate the result of 2.
- Output TRUE if 1. and 3. are TRUE
(a != b) && (c != d) - in human language this means that to perform THEN clause a and b must be different and so must c and d.
This condition is equivalent to !(a == b) && !(c == d). So
- Check if a is equal to b
- Negate the result of 1.
- Check if c is equal to d
- Negate the result of 3.
- Output TRUE if 2. and 4. are TRUE
Disjunctive Normal Forms (DNF) and Conjunctive Normal Forms (CNF) are methods to transform a condition into an equivalent condition (which may result to better performance in computer terms).
DNFs contain atomic conditions that are related to each other with OR clauses.
CNFs contain atomic conditions that are related to each other with AND clauses.
Following are statements that we will use to figure out how to optimise conditions of if statements.
1.
DNFs result to TRUE value if at least one of its conditions is TRUE,
CNFs result to TRUE value if and only if all of its conditions are TRUE.
Likewise,
CNFs result to FALSE value if at least one of its conditions is FALSE,
DNFs result to FALSE value if and only if all of its conditions are FALSE.
2.
DNFs can be converted into CNFs and vice versa using the following rules. I will use <==> sign to mark equivalency.
- A || B <==> !(!A && !B)
- A && B <==> !(!A || !B)
Having the two statements above we can deduct that the (a != b) && (c != d) condition can be performed faster by performing less steps. Really,
- (a != b) && (c != d) <==> !(a == b) && !(c == d) ,
- which by the DNF to CNF interconversion rule <==> !( !(!(a == b)) || !(!(c == d)) ).
- ! applied twice neutralises itself thus we have !( (a == b) || (c == d) ).
Analysing the result we have the following steps
- Check if a is equal to b
- Check if c is equal to d
- Take TRUE if either 1. or 2. or both are TRUE
- Take the negated result of 3.
So instead of 5 steps we managed to do the same thing in 4 steps. Taking a close look at both versions
!(a == b) && !(c == d) and !( (a == b) || (c == d) )
we can clearly see that the optimum one has less NEGATION clause. So the verdict is:
- NEGATION clauses can be trimmed
- Excessive NEGATION clauses can slow down the code.
Modern programming languages are going one extra step to optimise the code further by making good use of the 1. statement about DNFs and CNFs:
- For DNFs if the code encounters a TRUE atomic clause it disregards the rest of the clauses as they will not influence the final result,
- For CNFs if the code encounters a FALSE atomic clause it disregards the rest of the clauses as they will not influence the final result.
- For DNFs put the likely TRUE clauses before the rest of the clauses,
- For CNFs put the likely FALSE clauses before the rest of the clauses.
Let's consider !( (a == b) || (c == d) ) again.
- Check if a is equal to b
- If 1. is TRUE negate 1. and take the result as an answer (2 STEPS ONLY), otherwise If 1. is FALSE Check if c is equal to d
- Take TRUE if either 1. or 2. or both are TRUE
- Take the negated result of 3.
Considering that 2. has 50/50 chance to be TRUE or FALSE we finally have that on average the whole statement can be performed in ( 2 + 4 ) / 2 = 3 steps.
So we gained approximately 40% performance improvement in obtaining a result for the condition (a != b) && (c != d).
Additionally, if an
if (condition) then else
can be transformed into an equivalent
if (condition) then
form then the code will avoid an unnecessary calculation which is also an optimisation measure.
Further to come,
1. Does unary operators have underwater reefs.
2. Memory usage versus quick execution, an example.
First of all, the answer to the question is you cannot. Why?
Because $_GET and $_POST (and a few others) are HTTP variables. Meaning they can only be accessed if you are running the PHP file behind a web server. If you are trying to run a PHP file via CLI(command Line Interface), you'll not get those $_GET and $_POST variables.
But all is not lost. There is a work around to handle that problem and that is to use $argc and $argv variables.
$argc is the number of parameters passed in the command line while $argv holds the actual parameters stored in a zero based index array.
Example:
[ian@mycomputer]$ /usr/bin/php myscript.php hello world
$argc value will be 3. $argv will be an array of 3 strings containing "myscript.php", "hello" and "world."
Now back to our problem. To solve it, we will be using $argc and $argv to fill up the $_GET or $_POST variable. How?
Using a browser, to fill up the $_GET variable, you add the data by appending text to the URL.
Example:
http://test.com/myscript.php?name=ian&age=16
$_GET variable will contain the index 'name' with value 'ian' and index 'age' with value '16'.
To get the same thing using CLI, we use the following code:
function ArgsToGet($argv)
{
$gets = explode('&', $argv[1]);
foreach($gets as $g)
{
$g = explode('=', $g);
$_GET[$g[0]] = $g[1];
}
}
var_dump($argv);
ArgsToGet($argv);
var_dump($_GET);
?>
Example:
[ian@mycomputer]$ /usr/bin/php myscript.php 'name=ian&age=16'
Using the code above, the command will output will be
array(2) {
[0]=>
string(8) "test.php"
[1]=>
string(15) "name=ian&age=16"
}
array(2) {
["name"]=>
string(3) "ian"
["age"]=>
string(2) "16"
}
The variable $_GET will have the values same as it was when using a browser.
I don't know what issues Adobe and Apple currently have, but Jobs' statements have no basis, and I think he has at best been mislead.
Below I am going to state Jobs' words and give a detailed answer of what he misses.
1.
Steve Jobs:
Adobe’s Flash products are 100% proprietary. They are only available from Adobe, and Adobe has sole authority as to their future enhancement, pricing, etc.
While Adobe’s Flash products are widely available, this does not mean they are open, since they are controlled entirely by Adobe and available only from Adobe. By almost any definition, Flash is a closed system.
My answer:
What is Flash? And what is Visual Studio?
This is a software design and development environment which allows a software engineer to visually design GUI (graphic user interface) and incorporate functionality to the GUI later.
What does Visual Studio do is to generate the code for the Engineer, who would otherwise have to write that himself/herself?
Visual Studio is a proprietary property of Microsoft. One has to have a license to use it, and produce his/her own programs. So the consumer of Visual Studio is the Software Engineer. The result of the software engineer's work would be an executable project which can be distributed to the final consumers. WHO WILL NOT NEED VISUAL STUDIO?
This is the same as Adobe Flash. Flash is the richest GUI engineering tool to date, which allows to build all sorts of crazy designs someone can come up with. People are often in a confusion that Flash is an animation tool. While one can create cartoons in Flash, that would be the 5% of the entire capability Flash is able to deliver.
What a designer or a developer does in the authoring tool is actually converted to ActionScript code. So the language behind Flash is the fully object oriented programming language ActionScript.
Now with his statement Steve Jobs is blaming Adobe that Adobe is the only party who is allowed to develop the ActionScript language itself.
ActionScript is not an open tool, neither was it supposed to be. However, the solutions based upon ActionScript are open and available to the general software engineers.
So 1 point to Flash, 0 to Apple for stating misleading information.
2.
Steve Jobs:
Apple has many proprietary products too. Though the operating system for the iPhone, iPod and iPad is proprietary, we strongly believe that all standards pertaining to the web should be open. Rather than use Flash, Apple has adopted HTML5, CSS and JavaScript – all open standards.
Apple’s mobile devices all ship with high performance, low power implementations of these open standards. HTML5, the new web standard that has been adopted by Apple, Google and many others, lets web developers create advanced graphics, typography, animations and transitions without relying on third party browser plug-ins (like Flash).
My answer:
The last time I tested HTML 5 performance (which was 1 month ago) was this: An animation of a cube (12 straight lines in a nutshell). Processor level 100% (2.0GHz intel core 2 duo), supported only on FF3.5 and up (and Safary which is only usable on MACs, so I don't generally mention it), consumed memory: 70MB (way too much).
I think before putting HTML 5 on the table, Steve Jobs has to make sure it is practically usable. The fastest mobile devices I have seen so far are equipped with 1GHz processors. If a laptop struggles with HTML 5 animation, the mobile devices will simply hault.
Jobs indirectly refers to thin client users who don't have or don't want to install third party plugins onto their systems, thus having only HTML available on the browser to view sites. So let me just remind what a thin client user is. That is a user who is limited in both hardware or software capabilities (NOT just software).
HTML 5 may theoretically have a lot of advantageous features, but right at the moment, HTML 5 is not a tool I will be keen on using to deliver software to my clients. Plus, Flash natively supports 3D animations now, how about that?
HTML 5 is another 5 years away from becoming a practical development tool.
So 1 point to Flash and 0 to Apple for discrediting Flash while not offering a ready substitute.
3.
Steve Jobs:
Apple even creates open standards for the web. For example, Apple began with a small open source project and created WebKit, a complete open-source HTML5 rendering engine that is the heart of the Safari web browser used in all our products. WebKit has been widely adopted.
Google uses it for Android’s browser, Palm uses it, Nokia uses it, and RIM (Blackberry) has announced they will use it too. Almost every smartphone web browser other than Microsoft’s uses WebKit. By making its WebKit technology open, Apple has set the standard for mobile web browsers.
My answer:
The standard should be IT wide not just Apple-wide. Jobs quite carefully uses the word "almost" - almost every smartphone - which is correct. Well Standards assume complete coverage as opposed to almost.
I think it is quite a bit early to say HTML 5 is a standard. The vast majority of web users have Microsoft's systems. Unless Jobs squeezes Microsoft out of the market, I don't see how it would be possible to set a standard leaving Microsoft out of it.
So 1 point to Flash and 0 to Apple for claiming something they don't yet have.
4.
Steve Jobs:
Adobe has repeatedly said that Apple mobile devices cannot access “the full web” because 75% of video on the web is in Flash. What they don’t say is that almost all this video is also available in a more modern format, H.264, and viewable on iPhones, iPods and iPads.
YouTube, with an estimated 40% of the web’s video, shines in an app bundled on all Apple mobile devices, with the iPad offering perhaps the best YouTube discovery and viewing experience ever.
Add to this video from Vimeo, Netflix, Facebook, ABC, CBS, CNN, MSNBC, Fox News, ESPN, NPR, Time, The New York Times, The Wall Street Journal, Sports Illustrated, People, National Geographic, and many, many others. iPhone, iPod and iPad users aren’t missing much video.
My answer:
H.264 is a broader understanding than just a single video format. While mp4 video extension is commonly appled to H.264 format, it can also be of other formats that comply with H.264 standard - DivX for example.
The last time I tested Apple's handheld devices for video formats was about 6 weeks ago. iPod family supports only Lo Complexity SD H.264 format, which is perhaps 20% of what an H.264 stream can contain. I think it is a bit early for Apple to claim their support of H.264 media.
Flash however has the library to FULLY SUPPORT H.264, and a lot more formats, which can be found in Flash Video Encoder's list.
Video is now treading over the HD era. How about supporting HD on Apple's handheld devices? Samsung was the pioneer of 720p full H.264 video support. If Apple wants to have a nice media support ask Samsung.
Again 1 point to Flash and 0 to Apple for assigning themselves qualities which they don't yet have.
5.
Steve Jobs:
Another Adobe claim is that Apple devices cannot play Flash games. This is true.
My answers:
1 point to Apple for being honest here.
6.
Steve Jobs:
Fortunately, there are over 50,000 games and entertainment titles on the App Store, and many of them are free. There are more games and entertainment titles available for iPhone, iPod and iPad than for any other platform in the world.
My answer:
Let's not forget that to build an iPhone app, one has to have Object C programming language insight, which I would say is not one of the easiest programming languages to learn.
Flash on the other hand has a great GUI integration so even a designer who does not have a programming experience can pull toghether a useful piece of software.
About the iPhone apps being vastly free - not in the ITunes store it isn't.
So 1 point to Flash for being a creator-friendly and creativity-boosting environment and 0 to Apple.
7.
Steve Jobs:
Symantec recently highlighted Flash for having one of the worst security records in 2009. We also know first hand that Flash is the number one reason Macs crash. We have been working with Adobe to fix these problems, but they have persisted for several years now. We don’t want to reduce the reliability and security of our iPhones, iPods and iPads by adding Flash.
My answer:
Before I read this I didn't know Macs can crash. What's true that's true. Apple does have a good piece of equipment. So Macs crash while PCs don't? Perhaps Apple should look inside the house to see what the problem is. At least provide full support before blaming Flash for crashing Macs.
As with other programming languages it is true that ActionScript is a programming language. It is not the fault of the programming language that security holes exist, rather it is the level of the programmers' competency. Think of a hammer. One can gently build a statue or can wreck it with a hard hit. Will you blame the hammer for this?
True that different programming languages have different approaches to the security issues, but they deal with it appropriately.
So 1 point to Flash and 0 to Apple, for making false accusations.
8.
Steve Jobs:
In addition, Flash has not performed well on mobile devices. We have routinely asked Adobe to show us Flash performing well on a mobile device, any mobile device, for a few years now. We have never seen it.
Adobe publicly said that Flash would ship on a smartphone in early 2009, then the second half of 2009, then the first half of 2010, and now they say the second half of 2010. We think it will eventually ship, but we’re glad we didn’t hold our breath.
My answer:
Flash is performing quite well on Samsung Jet phones - year 2009. Mobile devices are genuinely slow, so don't expect them to run as dedicated servers.
Having a third party software running nicely on your moblie device as a producer is your responsibility NOT the other way around. Flash gives an executable environment, if one wants to integrate it into a moblie device he/she has to comply with Flash's requirements.
1 point to Adobe and 0 to Apple, for not knowing what they want.
9.
Steve Jobs:
To achieve long battery life when playing video, mobile devices must decode the video in hardware; decoding it in software uses too much power. Many of the chips used in modern mobile devices contain a decoder called H.264 – an industry standard that is used in every Blu-ray DVD player and has been adopted by Apple, Google (YouTube), Vimeo, Netflix and many other companies.
My answer:
IT industry upgrades at a fast pace. If H.264 upgrades, the owner will have to get another device. That's a pretty expensive change compared to simple software upgrade over the internet. While fast performance for video decoding is nice to have it is not a mandatory requirement. Again I have to bring Samsung's example. The Samsung phones can play HD content for 5 hours straight. Isn't that enough time to waste focusing on to just a tiny screen?
10.
Steve Jobs:
When websites re-encode their videos using H.264, they can offer them without using Flash at all. They play perfectly in browsers like Apple’s Safari and Google’s Chrome without any plugins whatsoever, and look great on iPhones, iPods and iPads.
My answer:
A video cannot play without a decoder be it software or hardware. Browsers Jobs is refering to use Quick Time to play videos. Quick Time is a software - a codec. Neither Safari nor Chrome can play H.264 without it. Moreover on PCs any browser can play H.264 if they have Quick Time or DivX codecs.
-1 point to Apple for false statements.
11.
Steve Jobs:
Flash was designed for PCs using mice, not for touch screens using fingers.
Answer to this:
Flash is not designed for specific systems. As long as the operating system supports it Flash will run regardless of the underlying hardware.
-1 pont to Apple for not knowing the topic they tread into.
12.
Steve Jobs:
Many Flash websites rely on “rollovers”, which pop up menus or other elements when the mouse arrow hovers over a specific spot. Apple’s revolutionary multi-touch interface doesn’t use a mouse, and there is no concept of a rollover. Most Flash websites will need to be rewritten to support touch-based devices. If developers need to rewrite their Flash websites, why not use modern technologies like HTML5, CSS and JavaScript?
My answer:
I don't see how HTML5 is going to solve the rollover issue on touch devices (not just multitouch). Touch technology lacks the rollover capability wich is very useful for example for tooltips. Jobs is effectively saying that it is Flash's fault that the rollover functionality isn't in the touch technology.
Please kindly provide an alternative to the mouse over event and all the web content will run as before. Again before a reasonable software engineer will use HTML5, they should be sure that HTML5 complies with the usability, performance, scalability, and portability requirements.
1 point to Flash to comply with all the software engineering requirements and 0 to Apple.
13.
Steve Jobs:
Even if iPhones, iPods and iPads ran Flash, it would not solve the problem that most Flash websites need to be rewritten to support touch-based devices.
My answer:
Flash websites do not need to be rewritten. It's not their responsibility to provide rollover substitute for touch devices. The rest of the human interaction interface is already there.
-1 Point to Steve jobs for putting their responsibility on others.
14.
Steve Jobs:
We know from painful experience that letting a third party layer of software come between the platform and the developer ultimately results in sub-standard apps and hinders the enhancement and progress of the platform. If developers grow dependent on third party development libraries and tools, they can only take advantage of platform enhancements if and when the third party chooses to adopt the new features. We cannot be at the mercy of a third party deciding if and when they will make our enhancements available to our developers.
My answer:
While a third layer is capable of putting constraints over the underlying system, it is not a major problem if Adobe and Apple cooperated and combined all the best features that both have. I think cooperation would be of mutual benefit for both sides. So instead of guarding themselves against the ways Adobe can restrict them, Apple could think of supprting Adobe. Both are powerful and quality software and hardware companies. Imagine the user experience from their cooperation.
-1 point to Jobs for being so shortsighted.
15.
Steve Jobs:
This becomes even worse if the third party is supplying a cross platform development tool. The third party may not adopt enhancements from one platform unless they are available on all of their supported platforms. Hence developers only have access to the lowest common denominator set of features. Again, we cannot accept an outcome where developers are blocked from using our innovations and enhancements because they are not available on our competitor’s platforms.
My answer:
Cross platform support. This can be achieved by having libraries like every other programming language - Java, C#, ....
While the core of a platform can run on all devices, the libraries are not supposed to run everywhere, because not all devices can handle the commands that a library may make. Java has three platforms - for mobiles (J2ME), the standard (J2SE), and the enterprise (for servers) (J2EE) editions.
A developer is educated enough to target a device before choosing the edition. The same is true for Flash.
If Jobs wants to apply the same HTML5 for all sorts of devices, than he has a very narrow perspective of what software engineering is and what are its challenges.
I would give another penalty point to Jobs but he is way below 0 now.
16.
Steve Jobs:
Flash is a cross platform development tool. It is not Adobe’s goal to help developers write the best iPhone, iPod and iPad apps. It is their goal to help developers write cross platform apps.
My answer:
It has never been anyone's (including Adobe's and Apple's) goal to provide a platform for best applications. What is a best application by definition by the way? There exists a platform, which in case of Flash is quite superb, and the responsibility of building a quality product, or even the best product, is the responsibility and the competence of the software engineer.
The target customers will decide if that's the best application. I agree that Flash has had the goal of cross platform support as is Java, AND HTML5.
-1 point to Steve Jobs for saying how nice is HTML5 to be a cross platform tool, then blaming Flash for being a cross-platfrom tool, in other words - for contradicting himself.
17.
Steve Jobs:
Our motivation is simple – we want to provide the most advanced and innovative platform to our developers, and we want them to stand directly on the shoulders of this platform and create the best apps the world has ever seen. We want to continually enhance the platform so developers can create even more amazing, powerful, fun and useful applications. Everyone wins – we sell more devices because we have the best apps, developers reach a wider and wider audience and customer base, and users are continually delighted by the best and broadest selection of apps on any platform.
My answer:
I very much hope so, and expect so. While doing that please also solve the problem with TimeCapsule not connecting nicely with PCs and if possible make its lifespan a bit longer than 18 months.
18.
Steve Jobs:
New open standards created in the mobile era, such as HTML5, will win on mobile devices (and PCs too). Perhaps Adobe should focus more on creating great HTML5 tools for the future, and less on criticizing Apple for leaving the past behind.
Answer to this:
Whatever you do, make sure not to throw mud on each other in vain. We love both Apple and Adobe. Don't make us choose among you.
When websites began, they contained very little movement, if any at all. Now, with a program called ActionScript, programmers and web designers are able to add an unprecedented amount of movement via animation.
ActionScript is a scripting language based on ECMAScript. It is used primarily for the development of websites and software using the Adobe Flash Player platform (in the form of SWF files embedded into web pages), but is also used in some database applications (such as Alpha Five), and in basic robotics, as with the Make Controller Kit.
Originally developed by Macromedia, the language is now owned by Adobe (which acquired Macromedia in 2005). ActionScript was initially designed for controlling simple 2D vector animations made in Adobe Flash (formerly Macromedia Flash). Later versions added functionality allowing for the creation of web-based games and rich Internet applications with streaming media (such as video and audio).
Some websites contain sections of front-end ActionScript, while others choose to develop their entire website using the technology. The aim is to attract a visitor's attention with the increased movement, and also to develop an interactivity.
The disadvantage is, as with other Flash files, it s made up of images rather than text, hence making it more difficult for Google and other search engines to navigate the content within.
Attention programmers; a new open source programming language called Go has been launched by none other than those innovators at Google. Why?
Because no significant language has come to the fore in the last decade, while many changes have occurred on the web during that time. Google are known to prefer Python and Javascript, therefore Go is expected to resemble a combination of both, as well as its own flavour.
The video below is a one-hour long Google introduction on Go Programming Language:
Please click here for an online tutorial for the Go Programming Language!
Developer tools are now rising allowing programmers to now choose software they are comfortable with to assist them during the development and testing process. I highlight some for you below.
Recently, I used a tool called PhoneGap, which combines a focus on pure JavaScript and HTML for phones.
If your business is building large-scale applications in which plenty of data will be processed, the Hadoop framework is equipped to process this together with Hive, which is file system that executes the SQL-like queries.
Eclipse is a fine IDE for building and debugging java applications, and can be used while building a website.
The NetBeans IDE, which works fast and well with multiple languages, expands its C/C++ capabilities with some new features and enables unit testing in PHP.
OpenStreetMap is open source version of popular mapping services.
With these developer tools, programmers can do more to achieve top software or websites with minimal effort.
Every self-respecting geek would tell you that what he would like in a friend are one, that he's very rich, two, he's able to keep up with the intellectual barter that happens whenever technology or any intelligent conversations would come up. Lastly, he should really be good with the ladies, considering that majority of us geeks are female free (since birth).
If you feel the same way as millions of other geeks in the world, there's only one person in the entire universe that has to be your friend; Tony Stark, also known as Iron Man.
As the head of Stark Industries, he commands a fleet of engineers and scientists to develop the ultra-cool defence and ammunition systems that can literally "blow" enemies away. As a side project, he developed this ultra cool "hot rod red and yellow" inspired armour that wreaks havoc anywhere and to anyone he wishes. In short, the perfect war armour.
As the literature says (meaning comic books), Iron Man is nothing more than a pigment of one artist's imagination, or is he?
Somewhere across Utah, Steve Jacobsen is already building the first (and hopefully not the last because I really want a cool armor) of many armour that's going to be used by the U.S. Military in the coming future.
Enter the XOS Skeleton.
The XOS Skeleton, like it's counterpart in the comic books, gives the wearer that oh so good light feeling and "enhanced" human strength. As Rex Jameson, pilot of the first ever "wearable" enhancement is demonstrating on the XOS Skeleton, he can lift quite heavy objects seamlessly as the armour gives its wearers the extra boost of strength that you need.
The original creator of the XOS Skeleton is Sacros, which has been purchased by a bigger defence company Raytheon. Being funded by the Pentagon's Defence Advanced Research Projects (DARPA), they're turning the military's 40-year old fantasy of "mechanically enhanced" humans for war into reality.
Personally, I think that the way it works is that there are pneumatic actuators or pistons built into the armour that's helping with the load of doing heavy stuff (imagine a car jack that can be commanded and can react fast to commands to go up and down), not to mention if you got hit by a punch coming from a guy wearing the armour, you'd likely be missing a couple of ribs if ever you'll be alive to even be interviewed. As far as tests go, the pilot can throw jabs seamlessly wearing the 150 pound skeleton, lift 200 pounds (not sure, maybe a rumour).
The exoskeleton definitely needs a good battery pack though, as you can see on the picture, the pilot is still wired (since it's just the initial stages), and I think the battery pack wouldn't last long for the missions intended to those who will use it.
Adi Granov, one of the illustrators of Iron Man and a consultant on the Iron Man films, saw the XOS at work and he can't believe that Sacros is almost close to the comic book counter part. "I knew that's where we were heading, but I didn't realise we were this close," Granov told Popular Science. Aside from the lack of flight and weapons, he adds, "that's Iron Man".
I can't wait till I see the first of those armours go into battle. It would really be moment to remember seeing a fleet of "Iron Men" rolling out and doing skirmishes on a desert somewhere. Just give it a good battery pack, and a tricked out shell, it could possibly pass for Iron Man armour.
When searching content using keywords, I have noticed some programmers still use the "LIKE %keyphrase%" technique.
This is not the best way to go about it since the user will achieve optimal results by limiting the words in his/her keyphrase to one. Additionally, if multiple words are submitted, the results returned are relevant only to the keyphrase as a whole rather than to the words within the phrase itself, thus the user is returned less results, if any at all... not to say the results would not be ordered by relevance.
The solution for this is to employ Boolean Full-Text Searches.
MySQL can perform boolean full-text searches using the
IN BOOLEAN MODEmodifier:
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);+----+-----------------------+-------------------------------------+| id | title | body |+----+-----------------------+-------------------------------------+| 1 | MySQL Tutorial | DBMS stands for DataBase ... || 2 | How To Use MySQL Well | After you went through a ... || 3 | Optimizing MySQL | In this tutorial we will show ... || 4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... || 6 | MySQL Security | When configured properly, MySQL ... |+----+-----------------------+-------------------------------------+
The
+and-operators indicate that a word is required to be present or absent, respectively, for a match to occur. Thus, this query retrieves all the rows that contain the word “MySQL” but that do not contain the word “YourSQL”.
Note
In implementing this feature, MySQL uses what is sometimes referred to as implied Boolean logic, in which
·
+stands forAND·
-stands forNOT· [no operator] implies
OR
Boolean full-text searches have these characteristics:
· They do not use the 50% threshold.
· They do not automatically sort rows in order of decreasing relevance. You can see this from the preceding query result: The row with the highest relevance is the one that contains “MySQL” twice, but it is listed last, not first.
· They can work even without a
FULLTEXTindex, although a search executed in this fashion would be quite slow.· The minimum and maximum word length full-text parameters apply.
· The stopword list applies.
The boolean full-text search capability supports the following operators:
·
+A leading plus sign indicates that this word must be present in each row that is returned.
·
-A leading minus sign indicates that this word must not be present in any of the rows that are returned.
Note: The
-operator acts only to exclude rows that are otherwise matched by other search terms. Thus, a boolean-mode search that contains only terms preceded by-returns an empty result. It does not return “all rows except those containing any of the excluded terms.”· (no operator)
By default (when neither
+nor-is specified) the word is optional, but the rows that contain it are rated higher. This mimics the behavior ofMATCH() ... AGAINST()without theIN BOOLEAN MODEmodifier.·
> <These two operators are used to change a word's contribution to the relevance value that is assigned to a row. The
>operator increases the contribution and the<operator decreases it. See the example following this list.·
( )Parentheses group words into subexpressions. Parenthesized groups can be nested.
·
~A leading tilde acts as a negation operator, causing the word's contribution to the row's relevance to be negative. This is useful for marking “noise” words. A row containing such a word is rated lower than others, but is not excluded altogether, as it would be with the
-operator.·
*The asterisk serves as the truncation (or wildcard) operator. Unlike the other operators, it should be appended to the word to be affected. Words match if they begin with the word preceding the
*operator.If a stopword or too-short word is specified with the truncation operator, it will not be stripped from a boolean query. For example, a search for
'+word +stopword*'will likely return fewer rows than a search for'+word +stopword'because the former query remains as is and requiresstopword*to be present in a document. The latter query is transformed to+word.·
"A phrase that is enclosed within double quote (“
"”) characters matches only rows that contain the phrase literally, as it was typed. The full-text engine splits the phrase into words, performs a search in theFULLTEXTindex for the words. Prior to MySQL 5.0.3, the engine then performed a substring search for the phrase in the records that were found, so the match must include non-word characters in the phrase. As of MySQL 5.0.3, non-word characters need not be matched exactly: Phrase searching requires only that matches contain exactly the same words as the phrase and in the same order. For example,"test phrase"matches"test, phrase"in MySQL 5.0.3, but not before.If the phrase contains no words that are in the index, the result is empty. For example, if all words are either stopwords or shorter than the minimum length of indexed words, the result is empty.
The following examples demonstrate some search strings that use boolean full-text operators:
·
'apple banana'Find rows that contain at least one of the two words.
·
'+apple +juice'Find rows that contain both words.
·
'+apple macintosh'Find rows that contain the word “apple”, but rank rows higher if they also contain “macintosh”.
·
'+apple -macintosh'Find rows that contain the word “apple” but not “macintosh”.
·
'+apple ~macintosh'Find rows that contain the word “apple”, but if the row also contains the word “macintosh”, rate it lower than if row does not. This is “softer” than a search for
'+apple -macintosh', for which the presence of “macintosh” causes the row not to be returned at all.·
'+apple +(>turnover'Find rows that contain the words “apple” and “turnover”, or “apple” and “strudel” (in any order), but rank “apple turnover” higher than “apple strudel”.
·
'apple*'Find rows that contain words such as “apple”, “apples”, “applesauce”, or “applet”.
·
'"some words"'Find rows that contain the exact phrase “some words” (for example, rows that contain “some words of wisdom” but not “some noise words”). Note that the “
"” characters that enclose the phrase are operator characters that delimit the phrase. They are not the quotes that enclose the search string itself.
For more information, feel free to visit these links:
http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
PHP5's Object Oriented features has enabled programmers to use advanced programming techniques like Design patterns.
What are Design Patterns?
From wikipedia, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
If you have been programming long enough, I am sure you have used one or more of them..
Here are a few Design Patters that are commonly used:
- Factory - Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
- Singleton - Ensure a class only has one instance, and provide a global point of access to it.
- Registry - Provides a mechanism for storing data globally in a well managed fashion, helping to prevent global meltdown.
- Strategy - Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
- Observer - Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
- Specification - Recombinable business logic in a boolean fashion.
When should it be used?
It should only be used if and only if the situation requires it and your . You should not use design pattern in small projects which only requires a simple designs.
Through the years, programmers have been catalogueing them in books. The most notable are Martin Fowler's Patterns of Enterprise Application Architecture and Gang of Four's (Gof) Design Patterns: Elements of Reusable Object-Oriented Software. These books are great references when studying Design Patterns.





