Friday, October 10, 2014

Screen Capture tutorial with FFMPEG on Windows

Beautiful tutorial video.
Links: 
https://trac.ffmpeg.org/wiki/Capture/Desktop
http://antumdeluge.wordpress.com/2014/02/19/recording-screen-windows-desktop-using-ffmpeg/

Sunday, September 14, 2014

SQLite 3.7.9 notes

In this post I will share my thoughts about SQLite database engine. You can search the net for tutorials and info and it seems lot of sites copy most of the documentation from the original site, so therefore in this post there will be my experiences with it.
  • You cannot output create statements with ".schema" command on attached database. It is only possible on the main and temp databases. So therefore you have to exit sqlite prompt and then enter it again using a line: "sqlite3 your-db-name.db" so that your database is now the main database.
  • You cannot use ALTER sql command to change a column in a table. It is only possible to rename a table and to add new column to an existing table. DROP COLUMN and ADD CONSTRAINT sql commands are also not supported.
  • RIGHT OUTER JOIN and FULL OUTER JOIN are not supported. Only LEFT OUTER JOIN is implemented.
  • SQLite database is CASE SENSITIVE. For example GLOB and glob have different meaning in SQLite statements.
  • The data type of a value is associated with the value itself, not with its container. Each value stored in SQlite database has its "Storage class": NULL, INTEGER, REAL, TEXT, BLOB.
  • SQLite, technically, has no data types, there are storage classes in a manifest typing system. Everything, internally, is stored as text. 
  • SQLite supports the concept of type affinity on columns. Type affinities: TEXT, NUMERIC, INTEGER, REAL, NONE.
  • Comments can be added with double hyphen "--" in front of a line of text or using C-like comment blocks with /* some text here */
  • Dot commands should not be terminated with semicolon (;)
  • Autoincrement keyword can be applied to a column only if that column is of type INTEGER
  • Any column in an SQLite version 3 database, except an INTEGER PRIMARY KEY column, may be used to store a value of any storage class.
  • SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).
  • The type affinity of a column is the recommended type for data stored in that column. The important idea here is that the type is recommended, not required.
  • Sorting of data types is achieved like this: (NULL < NULL or NULL < any other type),  (INTEGER or REAL) < (TEXT or BLOB), (between INTEGER and REAL types a numerical comparison is used), (TEXT < BLOB), (between TEXT values a collating sequence is used),  between two BLOBs a memcmp() function is used
  • Use this SQL construct to insert multiple rows into a table in one go: INSERT INTO 'tablename' ('column1', 'column2') SELECT 'data1' AS 'column1', 'data2' AS 'column2' UNION SELECT 'data3', 'data4' UNION SELECT 'data5', 'data6' UNION SELECT 'data7', 'data8';
  • Use ".header on", ".mode column" and ".width" dot commands to refine the output of the queries.
  • Use this command: select sql from sqlite_master where type='table' and tbl_name='table_name'; to select schema of the specified table. Much like ".schema" command shows create statements for the whole database, this shows only give table.
  • sqlite_master table contains 5 columns named in order: type, name, tbl_name, rootpage and sql
  • GLOB is a logical operator used to compare value to similar values using wild card operators. Also it is case sensitive unlike the LIKE comparison operator. GLOB uses "?" for one character and "*" from many, while LIKE uses "_" and "%" wild-cards correspondingly.
  • || operator adds two different strings and make new one aka concatenate.
  • Bitwise binary operators are: & (AND), | (OR), ~ (complement), << (left shift) and >> (right shift)
  • Values NULL, 0.0, 0, 'english' and '0' are all considered to be false. Values 1, 1.0, 0.1, -0.1 and '1english' are considered to be true. 
  • The IS and IS NOT operators work like = and != except when one or both of the operands are NULL.  
  • To use a string in a query you should use single quotes as the SQL standard specifies. Check image 4, using text="text" is identical to saying select * from proba where text=text; which is always true, so all rows will be returned. 
  • To escape a single quote in a string use another single quote, like this insert into table_name (my_string) values ('it is nine o''clock');
  • In the docs I couldn't find nor using .help command told me how to see current sqlite version. I however tried command .version which worked. Check image 5.
sqlite_master table
1. sqlite_master table contents after some sql coding. Mode is column and header is on

deleting column from existing table with temporary table in sqlite
2. Deleting a column from existing table using sqlite transation and temporary table to save the data
sqlite round function
3. I tried round(X,Y) function with value 9.95 and without Y parameter it gave correct result

sqlite - double vs single quote
4. To use a string in a query you should use single quotes as the SQL standard specifies
sqlite .version command
5. Use .version dot command to check current sqlite version

Friday, August 29, 2014

WebRTC: A conversation Between Chrome and Firefox, using WebRTC framework

I just found this google page that explains how WebRTC works. You can enable streaming between browsers without using browser plugins or installments.
http://www.webrtc.org/reference/architecture
demo link:
http://apprtc.appspot.com



Thursday, July 31, 2014

SEO basic notes, Onpage | Offpage optimizations, White | Black hat SEO

I this post I plan to share what I have learned by reading a SEO book.

There are onpage and offpage optimizations.

Onpage optimizations include: 

  • using your main keywords in <h1> tag, 
  • using secondary most important keywords in <h2> tag. 
  • Put several of your main keywords to construct the <title> tag usually separated with | sign. 
  • Avoid repeating same keywords in the title tag because Google may detect it as spamming and ban your site. 
  • Every <image> tag in your site should contain alt attribute with your main keywords plus the word image or picture. It is meant for blind people and to give additional info when the image was not fetched properly. 
  • Put your site url and main keywords in a footer of every of your site pages
  • Usually it is always better to let Google read first your body text then continue with navigational links if they stand in a left hand sided panel. Put an empty cell or row above your navigational panel so the page parsing could start with the body text
  • Use Google Trends or WordTracker or other tool to find best keywords for your website. Avoid using keywords that are used by many websites because the competition will be very fierce and you will achieve nothing. 
  • Google does NOT use keyword metatag for calculating your page rank. Check this page: http://googlewebmastercentral.blogspot.com/2009/09/google-does-not-use-keywords-meta-tag.html
  • Google may use description metatag if it finds it is something useful and show it as a snippet in the search result. Yes you should always try to describe your website within description metatag or your <header> tag.
  • You should also bold and or italicize keywords at some place if you think it looks appropriate for the website design. It will help in the search results.
  • Avoid using hidden text, because Google can see it and if there is keyword spamming it may ban your site. 
  • Avoid image tag spamming, meta tag stuffing, and title tag stuffing with keywords. You will surely get banned. 
  • Keep good inner website structure, aka every webpage should be linked to some hub page where we all can easily find it. This is commonly known as a site map. Google checks this and it doesn't like orphan pages.
  • If you want to use keywords in your url you should separate them with hyphen, not with underscore. And yes Google, MSN and Yahoo index pages that contain keywords in their url however smaller search engines may or may not use this information to index your page. Check this page: http://www.webrankinfo.com/english/seo-news/keywords-in-url.php

Offpage optimizations include: 

  •  Onpage optimization is what you should do, however offpage is what really brings traffic to your website.
  • Do NOT use Google, MSN or Yahoo submit pages to submit your site to their index. It is worthless and may give worse results than leaving search engines to index your page by them selves.
  • You site may appear in Google's index in 1 or 2 days without effort on your side. 
  • You can purchase reciprocial links to your site from link directory sites like http://www.textlinkbrokers.com/
  • One site of PR 5 pointing to your site may increase traffic several times in difference with several sites with PR 2 or 3.
  • Google and other well known search engines use several criteria to evaluate your website. That include: Which websites point to your site, the number of sites pointing to your site, PR value of sites pointing to our site, page title of websites pointing to your site, anchor text used in the link linking to them, the number and type of links linking to your site, the number of sites linking to sites that link to your site, are these sites deemed as authority sites by Google, the IP address of sites linking to your site (are they all on same IP address).
  • You should use "link" keyword in Google to check all sites that contain that url address. Example: type in Google: link: http://www.domainname.com
  • Google checks IP address of sites linking to your site and it cannot be tricked by pages pointing to your site that lay on same IP address.
  • You can search link directories for link exchange using this technique, type in Google: keyword "Please also suggest my link to the linkpartners.com directory". Replace keyword with your own keyword. I have tried this, it brings some results but not much what I expected. You can contact sites with a submit form for link exchange. 
  • Avoid linking to site that doesn link back to your site. You PR value suffers.
  • Use SEO Elite to check for sites with PR 0 whether they are banned by Google. If yes, they don't exist in Google's index than you may NOT want to link them anymore, because your site will get penailzed or banned too.
  • You should create link hub pages with up to 25 reciprocial links to other sites withing your website. 
  • You can calculate your page rank with a formula. Check this wiki page: http://en.wikipedia.org/wiki/PageRank, this also may come in handy http://checkpagerank.net You can also use some of the GoodKeywords tools to check your page rank, or Google's toolbar.
 There are two types of SEO techniques, White hat SEO and Black hat SEO.

 Black hat SEO is more concentrated on search engines and for short term financial return.That means using agressive techniques like keyword stuffing and spamming, that leads to fast financial return but for sure your site will get banned by search engines sooner or later.

White hat SEO includes using SEO techniques according to search engine guidlines. It means doing all things that will not harm your site's page rank, for a long term results and meant for real people. Wirting human readable articles, onpage/offpage optimisations, without using keyword stuffing or spamming. Maintaining goot site structure, recirprocial links etc...

You may want to recall to this post http://tunephp.blogspot.com/2014/07/search-engine-optimization-made-easy-by.html

"Search Engine Optimization made easy" by Brad Callen - book review

In this post I will share my thoughts on a book called "Search Engine Optimization made easy" by Brad Callen. I don't know when it was published because it is not stated in it, nor I could find on the Internet. There are some PDFs circling around for free :)
This book is more like a beginner’s guide to SEO. It gives a glimpse into all necessary things that optimizing a web site may include. It gives general strategies how and where to start optimizing your web site and it is a good tool if you don't have time to read large books like 300 to 600 pages. But some aspects of SEO are not thoroughly covered with theory so some things may be still unclear even if you read the book twice without using information from Internet. For example there is explanation how to calculate Google's page rank and it mentions some iterations of the same formula with different values but I couldn't figure out how those different values are calculated.
Also some of the tools/links recommended in the book are obsolete and do not exist anymore, so you may have to search some things by yourself. For example the tool GoodKeywords mentioned for searching keywords related to a given keyword directly from Google doesn't exist anymore, or I simply couldn't figure out how today’s GoodKeywords software works. I used Google Trends instead.
The book however contains good exercises how to manually search info about specific websites and optimize yours better that those sites. There is a software called SEO Elite which does lot of work for you, and of course it is not free but may save you some time. However you can do all the job manually which is recommended as a practice. 
There are 10 chapters in about 90 pages and those include:
  1. searching good keywords for your site/brand. Installing Google toolbar. Analyzing competitor's website's html code. 
  2. Onpage optimiziation for your website, using <h1>, <h2>, alt image tag attribute, bolding, italicizing etc...
  3. Getting started with offpage optimization. Never use Google's page submit form, neither MSN, Yahoo, Altavista, Alltheweb submit forms. Buying text links that point to your website. 
  4. Offpage optimization criteria basics. Collecting useful information from Internet about competitor's SEO strategy. Using SEO Elite.
  5. Contacting link sites for link sharing, using SEO Elite to contact 1000 link directory websites at once. Create link page withing your website. 
  6. What things to consider so that you don't get banned by Google. Using hidden text, alt image tag spamming, meta tag stuffing, title tag stuffing.
  7. Is your website linking banned websites aka bad neighbours? Make sure you don't link to bad neighbours so that your site don't get banned too by Google. Use SEO Elite to check for sites with PR 0. Using submit forms to link directory websites. 
  8. Exercise chapter. Find out why Adobe's site is closely related to keyword: "click me" though you may think, isn't Adobe related to graphics design software, Photoshop etc...
  9. Using alt image tag attribute to maintain good website structure. 
  10. What Google's Page Rank is all about. Calculating formula for Page Rank. How do you calculate yours website page rank. Do not link websites that don't have reciprocal link to your website. Your page rank will suffer because of this.
As I mentioned earlier, it a very well made book and it works good if you are a SEO beginner. But because of not enough theory coverage some things may stay unclear. Therefore I give 3.7/5

Useful links:

http://www.keywordlocator.com/kwl/specials.html
http://www.wordtracker.com/
http://www.textlinkbrokers.com/
http://www.linkadage.com/
http://www.matomyseo.com/
http://www.webrankinfo.com/english/
http://www.mikes-marketing-tools.com/
http://www.linkhub.info/submit.php
http://www.google.com/analytics/
http://www.seobook.com/

Next good read: http://www.amazon.com/SEO-Books-2013-2014-Optimization/lm/R2ZJ80G4COWMSZ


Monday, July 21, 2014

"Selenium 2 Testing Tools" - book review

In this post I will do a book review about a book called "Selenium 2 Testing Tools" written by David Burns. It is a beginners guide for Selenium 2 published 2012 by Packt © Publishing.

It is fairly new and it covers basic information about all aspects  of Selenium 2.
In 11 chapters and two appendices it manages to help reader get basic understanding about Selenium using code examples and little chapter quizzes. First of all you need to install necessary software like Java jdk, InteliJ Idea, selenium - server standalone, selenium IDE plugin for Firefox, Firebug and Firefinder.

Chapters:
  1. Getting started with Selenuim IDE, where you get the basics of using Selenium IDE Firefox plugin. Recording your own test case and test suites. Adding test comments. Asserting and verifying tests with Selenium commands. Using multiple windows and testing Ajax applications.
  2.  Locators, where you learn basic HTML element locating methods. Searching tag elements by ID, name, CSS selector, XPath, DOM and text link again using Selenium IDE. 
  3. Overview of Selenium WebDriver, where you get introductory text about creation of Selenium tools and how it is structured. 
  4. Design Patterns, where you use Page Object and Page Factory patterns to code your selenium tests. Also using LoadableComponents in your tests
  5. Finding Elements, where you use Java code, junit testing frameworks and Selenium WebDriver run tests for finding html elements by ID, name, XPath, CSS, DOM and link text. In Selenium API you find one html element or you can find a list of elements that cover certain criteria.
  6. Working with WebDriver, where you get know all basic drivers for each of the most popular browsers, Firefox, IE, Chrome, Opera and you do some basic Java tests. In this chapter I found that FirefoxDriver is part of Selenium WebDriver while IE and Chrome need additional libraries to run from selenium. As for Opera there is a library that covers only versions up until Opera 12.x built on presto engine. For newer versions there is still no support by Opera team(not sure, have to check). Libraries: selenium downloads, IE driver, IE driver downloadsChrome driver, Opera driver
  7. Mobile devices, where you get to test web applications that run in Android, iPhone and Opera Mobile browsers. Libraries: Selendroid (replacement for the obsolete AndroidDriver).
  8. Getting started with Selenium Grid, where you get to understand how to make selenium tests that run in parallel on several machines and on several browsers at the same time. Also on different operating systems, like Windows and Linux. So basically selenium server can be run as a grid hub, but also as a node. 
  9. Advanced user interactions, where you use selenium webdriver to run keyboard and mouse based tests. Also you will use Actions java class for performing sequence of mouse/keyboard actions which is handy. 
  10. Working with HTML5. In this chapter you are visiting application cache, browser connections (online/offline), WebStorage (local and session storage).
  11. Advanced topics. In this chapter you will learn, how to capture screenshots when error appears with selenium webdriver, use XVFB buffer to test application without interference with the tests (works only on Linux) and Browsermob Proxy to monitor web application traffic.
  12. Appendix A, Migrating from Remote Control to WebDriver
  13. Appendix B, Pop quiz answers
Some useful links:

http://www.packtpub.com/selenium-2-testing-tools-beginners-guide/book
http://book.theautomatedtester.co.uk/
http://docs.seleniumhq.org/
https://code.google.com/p/windowlicker/
http://bmp.lightbody.net/
https://media.readthedocs.org/pdf/browsermob-proxy-py/latest/browsermob-proxy-py.pdf
https://github.com/webmetrics/browsermob-proxy
http://stackoverflow.com/questions/944086/is-there-anything-like-xvfb-or-xnest-for-windows
http://en.wikipedia.org/wiki/Xvfb

According to my experience, it does what is meant to be, aka introducing selenium 2 trough examples and information. Apart from some code errors and obsolete tools like AndroidDriver which today is replaced by SelendroidDriver it is very well made book. If you are just starting with selenium 2 testing tools this is the book to choose. I give it 4.5/5

Perhaps this is the next good read, Selenium testing tools Cookbook,
Selenium WebDriver Practical Guide

Friday, July 11, 2014

"Ext JS 4 First Look" and "Mastering Ext JS" - book review

Hello. In this post I shall explain my thoughts on two books, Ext JS 4 First Look and Mastering Ext JS written by loiane Groner.

Ext JS 4 First Look

It is an intruductory book for Ext JS 4 framework, specifically version 4.2. You can find lot of comments and posts across the Internet about previous version of Ext JS 4, 4.0 and 4.1, it is said that were buggy. So my advice is use Ext JS 4.2 for your future projects. Not sure about Ext JS 5, it is a new release.

In about 300 pages Loiane managed to cover all aspects of Ext JS 4 framework. It has lot of useful information and you can get a general understanding about the framework's capabilities. However is a bit techincal, so I recommend reading each chapter at least twice. It also a good practice to try and write the code from the book on the a real machine and see how it works. From this point of view I think it needs more code examples. So if you want to learn Ext JS 4 framework, I think this book is a good start. 4/5

Mastering Ext JS

In this second book about Ext JS 4 you get to develop real world Ext JS 4 based application (using sakila sample database). It has lot of code and reading it is a bit dificult task since you need to understand what the code does. While reading it I set up my working environment and started coding from the book. It begins ok, all things that were necessary were covered in the book. However when you get deep into it like 150 pages which is middle of the book, you can clearly see that some application modules are not finished, or a code is missing. I managed to find code base here. It easens up things a little, if you copy code form github. But I also found that some php files had commented code and weren't working. It has a bit of inconsistency with the book. You get the feeling it is not made for beginner web developer :) I managed to find solutions to most of the problems while developing my practice app here: http://masteringextjs-practices.rhcloud.com/ but that was the case because I already knew PHP 5, firebug, MVC architecture, Aptana, JavaScript basics, html etc...

- still in development. Use vlado as user and 123456 as password to log in. You can change to different language, now English US and MK(Macedonian) available. If you get loading errors or it doesn't want to show up, refresh the tab. Still things to be done. 

Notes: 
  • Some php file had commented code out in the github package. Why should I bother understanding what the php code does when I learn Ext JS?
  • It happened to build a production version of the app and when uploaded to server it doesn't work as it works locally. Charts aren't drawn, login window stays after loging in, loading notification stays forever.  Not sure why it does that, a testing is neccesarry. Ok I set up Siesta as mentioned in chapter 12 - Debugging and Testing, I run the test from the book and get error Application.js not found in Firebug. :) Ok I deployed (prebuild app) masteringextjs4 zip package from github to my server and try the tests, some strange error appears, "j is undefined" :D So now I cannot test even the prebuilt application. Maybe I have missed to read some guide or whatever, but overall I am a bit lost as Ext JS beginner.
I give points for ingenuity. Really good use of available learning resources like Sakila sample database. You will get to work with MySQL db, MySQL Workbench, exporting/importing data. Also PhpMyAdmin which is a really good admin tool.

All in all it is a good book, but you will not learn much if you don't code the code yourself and try to debug yourself. It is very techincal and as I said cover each chapter twice. Once reading, once, coding. It contains lot of general information about Ext JS 4 and lot of advices about tools to develop. According to my experience reading it I give it 3.75/5