Sunday, May 1, 2016

How to setup raspberry pi with usb camera for streaming video

Found a lot of articles about how to setup USB Camera with raspberry Pi for streaming video. Everything went fine for except one thing, stream stops after 5-10 seconds. Camera indicator still on, but browser stops showing updates, just frozen picture. The problem was that by default motion saves video and snapshots to /var/lib/motion/ directory. And looks like motion doesn't have enough permissions to write into it. So the fix is very easy: sudo chmod 77 /var/lib/motion.

Configuration:
Raspberry Pi3, USB Camera Logictech C300, micro SD 4Gb

How to install motion:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install motion

In order to enable remote access and deamon, change these params: 

  • webcam_localhost off
  • daemon on

sudo nano /etc/motion/motion.conf

To setup daemon, open
sudo nano /etc/default/motion
and set start_motion_daemon=yes

Now you start and stop service by using these commands:
  • sudo service motion start
  • sudo service motion stop
If camera is on and off, everything is set and running. 
Camera can be access remotely via <raspberryIP_address>:8081

Motion FQA can be found here 







Tuesday, February 10, 2015

Free online learning resources

education.10gen.com - online learning platform run by 10gen (the MongoDB company) available to anyone in the world with an internet connection. Our free courses will teach you how to develop for and administer MongoDB quickly and efficiently.

http://www.udacity.com/ - digital university on a mission to democratize education. Udacity courses include lecture videos, quizzes and homework assignments. There are 18 courses currently opened. 

http://code.google.com/edu/ - sample course content and tutorials for Computer Science (CS) students and educators on current computing technologies and paradigms.

http://docs.webplatform.org - is a new community-driven site that aims to become a comprehensive and authoritative source for web developer documentation. 

https://developer.mozilla.org/en-US/learn - HTML, CSS, Java Script learning materials. 
http://www.html5rocks.com/ - Articles, tutorials, case studies, and demos that show you how to use HTML5 features.

http://thecodeplayer.com/ - Learn HTML5, CSS3, Javascript and more... Video style walkthroughs showing cool stuff being created from scratch

https://www.coursera.org/ - offers courses in a wide range of topics, spanning the Humanities, Medicine, Biology, Social Sciences, Mathematics, Business, Computer Science, and many others.

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/ - Electrical Engineering and Computer Science

http://www.codecademy.com - Codecademy is the easiest way to learn to code. It's interactive, fun, and you can do it with your friends.

http://www.khanacademy.org - The Khan Academy is an organization on a mission. We're a not-for-profit with the goal of changing education for the better by providing a free world-class education for anyone anywhere.

https://peepcode.com/ - Get the newest and hottest development resources from PeepCode first, well before they’re covered in books. Vet new approaches: our one-hour screencasts give you a deep but concise overview of tools.

http://eloquentjavascript.net/ - Eloquent JavaScript A Modern Introduction to Programming by Marijn Haverbeke

http://rubykoans.com/ - learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language.

http://learncodethehardway.org/ - Downloaded more than 500 thousand times, Learn Python The Hard Way is proving to be an effective and fun book for learning to code. If you've always wanted to learn programming but failed in the past, then this is your next book.

http://www.oreillyschool.com/courses/ - IT Career Training Begins with Self-Paced Distance Learning Courses. Whether you take them individually or with Certificate of Professional Development in mind, completing each of our online distance learning courses will earn you Continuing Education Units, and will count toward any Online Certificate Programs that include that course.

http://teamtreehouse.com/ - Treehouse is the best way to learn how to design and develop for the web and iOS.

http://www.udemy.com/ - Web Development, Entrepreneurship, Yoga, Photography

http://developer.android.com/index.html - android development resources

http://www.codeschool.com/ -

http://www.bloc.io/ -

https://developer.apple.com/ -

https://www.ai-class.com/ -

http://gotoandlearn.com/ -

http://venture-lab.org/ -

https://www.edx.org/courses/HarvardX/CS50x/2012/about/ -

A lot of link found on http://thenextweb.com

Monday, December 1, 2014

Look and feel test automation tools

dpdxt make continuous deployment safe by comparing before and after webpage screenshots for each release. depicted shows when any visual, perceptual differences are found
PhantomCSS visual/CSS regression testing with PhantomJS
Huxley testing system for catching visual regressions in Web applications
Applitools Eyes  testing of all the visual aspects of your application
CSS Critic  lightweight framework for regression testing of Cascading Style Sheets
Gemini utility for regression testing of web pages using screenshots
Needle automated tests for your CSS
Galen Framework supports both JavaScript and Java tests
Snap and Compare screenshot comparison tool used for CSS Visual Regression Testing
Specter  dead simple automated visual regression testing
WebdriverCSS regression testing tool for WebdriverIO
Grunt PhotoBox plugin for creating screenshots of any site and compare them
FBSnapshotTestCase snapshot view unit tests for iOS



Saturday, November 15, 2014

What google knows about you?

In case if you are using google account while browsing across endless internet there few things stored about you;)

Tuesday, October 7, 2014

How to send an email with Mandrill and jquery by submit contact form

It's easy to send notification email just by ajax request. Sure would be good to add some validation.
Create simple form contact.html
 <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"></link>  
 <form class="form-horizontal" id="contact">  
 <fieldset>  
 <!-- Form Name -->  
 <legend>Contact Us</legend>  
   
 <!-- Text input-->  
 <div class="form-group">  
  <label class="col-md-4 control-label" for="name">Name</label>   
  <div class="col-md-5">  
  <input id="name" name="name" type="text" placeholder="Your name*" class="form-control input-md" required="">       
  </div>  
 </div>  
   
 <!-- Text input-->  
 <div class="form-group">  
  <label class="col-md-4 control-label" for="email">Email</label>   
  <div class="col-md-5">  
  <input id="email" name="email" type="text" placeholder="Your email*" class="form-control input-md" required="">  
     
  </div>  
 </div>  
   
 <!-- Textarea -->  
 <div class="form-group">  
  <label class="col-md-4 control-label" for="message">Message</label>  
  <div class="col-md-4">             
   <textarea class="form-control" id="message" name="message" cols="6" rows="6"></textarea>  
  </div>  
 </div>  
   
 <!-- Button -->  
 <div class="form-group">  
  <label class="col-md-4 control-label" for="submit"></label>  
  <div class="col-md-4">  
   <button id="submit" name="submit" class="btn btn-primary">Send Message</button>  
  </div>  
 </div>  
   
 </fieldset>  
 </form>  
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script></code>  

And following ajax call:
 jQuery(function($)   
 {  
   $("#contact").submit(function()  
   {  
     var email = $("#email").val(); // get email field value  
     var name = $("#name").val(); // get name field value  
     var msg = $("#message").val(); // get message field value  
     $.ajax(  
     {  
       type: "POST",  
       url: "https://mandrillapp.com/api/1.0/messages/send.json",  
       data: {  
         'key': '#PUT_YOUR_MANDRILL_API_KEY_HERE',  
         'message': {  
           'from_email': email,  
           'from_name': name,  
           'headers': {  
             'Reply-To': email  
           },  
           'subject': 'Message from Contact form',  
           'text': message,  
           'to': [  
           {  
             'email': 'johndoe@email.com',  
             'name': 'John Doe',  
             'type': 'to'  
           }]  
         }  
       }  
     })  
     .done(function(response) {  
       alert('Your message has been sent successfully'); 
       //reset input fields after successful submission  
       $("#name").val('');  
       $("#email").val(''); 
       $("#message").val('');  
     })  
     .fail(function(response) {  
       alert('Error sending message.');  
     });  
     return false; // prevent page refresh  
   });  
 });  

Tuesday, May 20, 2014

Do we really need testers? or Don't do everything by youself

Recently we have had a conversation with colleagues about "Do we really need testers?" Why should we have someone dedicated to this role? Can't I do testing, documenting by myself or with a  help of another developer to get a different point of view? Code review and automation would be done faster by developers. They know product, architecture, they're experienced in development, unit testing, automation. And end-to-end testing could be done with a whole team including product owners and managers. So, why do we need them?

Of course we as engineers can do everything, but one person should not do everything! Developer or tester should be exited about what he/she is doing and it's very rare case when developers like to test thoroughly and waste their time writing test plans, thinking about test strategies, assuming customer point of view, spending time on a long discussions and so on. We are already doing a log of different tasks in today's software development era especially those engineers who are working withing DevOps model. I't not every time possible to do everything with the highest quality and that's basically why we should split our roles at some point. Testers becoming more technical, they're developing automation frameworks, supporting environments, deploying, maintaining and more responsibilities are coming all the time. Not only test plans, reporting and manual testing anymore. And are you still really want to do everything and more by yourself?

What to choose as an IDE for python development is up to you...

... It's your choice whether you develop in vim, Notepad++ or modern IDE. There are always pros and cons and every developer has his own preferences. I use several of them daily: Notepad++ if I need to write short script very fast, iPython command line if I need to check some expressions or object properties, Eclipse from historical reason for big projects, PyCharm for personal usage (and thinking to move from Eclipse to it), vim if I'm working in Linux. Didn't try sublime, but I'm satisfied with the tools above.

Wednesday, May 22, 2013

How to setup Jenkins for python for tests

How to configure jenkins to run python tests after every commit or by schedule:
Download and install java on your computer.
Download last stable version of jenkins for your operating system from the official site
Run with the following command:
java -jar jenkins.war
Assuming that you already have virtualenv and create your virtual environment
$virtualenv mytestenv
$source mytestenv/bin/activate
Install dependencies for python, in our case: nose and nosexunit (for writing and running tests),
pip install nose
pip install nosexunit
pip install selenium

open a browser and go to http://127.0.0.1:8080 jenkins web interface
install git plugin

Create new job and select run bash:
Put the path to your git working copy: /home/yourname/your_repository

And add the following script:
#!/bin/bash -ex
source /home/andrii/Downloads/mytestdir/bin/activate
nosetests tests.py --with-nosexunit

And add it for reporting:
target/NoseXUnit/core/*.xml

Tuesday, May 21, 2013

How to run webdriver remotely on virtual machine with python

To run webdriver remotely using Python + VBox we need to run selenium standalone server on each machines Master and Slaves with different roles.
Master(Hub)
Slave1(Node)
...
Slave1(Node)

Run selenium server on Master PC with a hub role
>java -jar selenium-server-standalone-2.28.0.jar -role hub
Run selenium instance on Slave VBox with webdriver or node role
>java -jar selenium-server-standalone-2.28.0.jar -role webdriver -hub http://<Hub IP address>:4444/grid/register -browser browserName=chrome, platform=WINDOWS
Run selenium instance on Slave VBox with webdriver or node role
>java -jar selenium-server-standalone-2.28.0.jar -role webdriver -hub http://<Hub IP address>:4444/grid/register -browser browserName=firefox, platform=LINUX
Run selenium instance on Slave VBox with webdriver or node role
>java -jar selenium-server-standalone-2.28.0.jar -role webdriver -hub http://<Hub IP address>:4444/grid/register -browser browserName=safari, platform=MAC
Run webdriver commands on Master PC
>from selenium import webdriver
>browser_win = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', desired_capabilities={'browserName':'firefox', 'platform':'WINDOWS'})
>browser_nix = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', desired_capabilities={'browserName':'firefox', 'platform':'LINUX'})
>browser_mac = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', desired_capabilities={'browserName':'firefox', 'platform':'MAC'})
>browser_nix.get('http://google.com')

Now we're able to write tests which can be executed on remote and/or virtual machines.

Saturday, February 23, 2013

Online tools

http://en.linoit.com/ - Sticky and Photo Sharing for you
https://www.guerrillamail.com/ - Disposable Temporary E-Mail Address
https://join.me/ - free screen sharing and online meetings
http://gyazo.com/en - screen grabbing tool
http://www.online-convert.com/ - Convert media files online from one format into another
http://caniuse.com - Compatibility tables for support of HTML5, CSS3, SVG and more in desktop and mobile browsers
http://www.ustream.tv - live streaming platform
http://new.livestream.com/ -  live streaming platform
http://www.online-stopwatch.com/ - Online Stopwatch tool
http://www.hidemyass.com/ - web proxy
http://goo.gl/ - Google URL Shortener
http://webwhiteboard.com - online whiteboard
http://qrcode.kaywa.com/ - QR code generator
http://2epub.com - converts various e-book formats.
http://2zip.org - allows to extract archives online and convert many 'exotic' formats to ZIP.
http://puzzleware.net/codehtmler/default.aspx - is a simple program that translates plain text code into a colorized HTML version of the code
http://www.diffchecker.com/ - online text diff

Online development tools


http://sandbox.onlinephpfunctions.com/ - php playground
http://jsbeautifier.org/ - javascript beautifier 
http://regex101.com/ - regexp playground
http://regexpal.com/ - a JavaScript regular expression tester
http://jsoneditoronline.org/ - json online editor
http://rubular.com/ - regexp playground
http://gskinner.com/RegExr/ - regexp playground
http://www.debuggex.com/ - regexp playground
http://www.regexper.com/ - regexp playground
http://regexponline.com/ - regexp playground
http://jsfiddle.net/ - online editor for snippets build from HTML, CSS and JavaScript
http://sqlfiddle.com/ - a tool for easy online testing and sharing of database problems and their solutions.
http://refiddle.com/ - regexp playground
https://koding.com/ - software development in the browser
http://codepen.io/ - is all about front end code inspiration and education through sharing
http://dabblet.com -  is an interactive playground for quickly testing snippets of CSS and HTML code.
http://cssdesk.com/ - css playground
http://jsdo.it/ - is an online editor where you can try running your codes as you write.
https://tinker.io/ -  is a quick and easy tool for writing and sharing code
http://tinkerbin.com/ - lets you play around with HTML, JavaScript and CSS without creating files or uploading to servers
https://thimble.webmaker.org/en-US/editor - makes it ridiculously simple to create your own web pages. Write and edit HTML and CSS right in your browser. Instantly preview your work. Then host and share your finished pages with a single click. Easy
http://liveweave.com - is a HTML5, CSS3 & JavaScript playground
http://code.google.com/apis/ajax/playground/ - Code Playground
https://compilr.com - online platform that allows developers to write and learn code all from the comfort of their web browser
https://c9.io/ - is an online platform for development; the code is open-sourced on GitHub, free to adapt and use for everyone, anywhere, anytime.
https://api.divshot.com - work easier with twitter Bootstrap
http://www.bestwebfonts.com/ - web fonts
http://editor.method.ac/ - SVG editor
http://cedvel.com/ - application for designing grid systems
http://cssdeck.com/ - is a place where you can quickly create some experiments (or testcases) that involves HTML, CSS, JS code.

Do you know some useful online tools?


Sunday, December 9, 2012

Safe escaping for HTML and URL


 >>> link = 'file.py?fname=a&lname=b&amp=c&sect=d&lt=e'  
 # escape for HTML   
 >>> import cgi  
 >>> cgi.escape(link)  
 'file.py?fname=a&amp;jlname=b&amp;amp=c&amp;sect=d&amp;lt=e'  
 # escape for URL   
 >>> import urllib.parse  
 >>> elink = urllib.parse.quote_plus(link)  
 >>> elink  
 'file.py%3Ffname%3Da%26lname%3Db%26amp%3Dc%26sect%3Dd%26lt%3De'  
 # URL satisfies HTML too: same   
 >>> cgi.escape(elink)  
 'file.py%3Ffname%3Da%26lname%3Db%26amp%3Dc%26sect%3Dd%26lt%3De'  

Monday, November 26, 2012

Configure vim for python

First important stuff after installation of ubuntu:
 sudo apt-get install vim python python-pip python-virtualenv git-core bash-completion  
Create in a home directory config for vim
 $touch ~/.vimrc  
or open global config to apply settings for all
 $sudo vim /etc/vim/vimrc  
and add the following parameters to this files.
 autocmd FileType python set omnifunc=pythoncomplete#Complete  
 autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS  
 autocmd FileType html set omnifunc=htmlcomplete#CompleteTags  
 autocmd FileType css set omnifunc=csscomplete#CompleteCSS  
 autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags  
 autocmd FileType php set omnifunc=phpcomplete#CompletePHP  
 autocmd FileType c set omnifunc=ccomplete#Complete  

Good how-to in russian 

Monday, November 5, 2012

Selenium with python

First of all ensure that python is installed on your PC.
Or you can download it from python.org, use v.2.7.
On ubuntu just run the following commands in terminal:
 $sudo apt-get install python python-setuptools  
 $sudo easy_install pip  
 $pip install selenium  
On windows install python and setup tools from windows installers:
python-2.7.3.msi
setuptools-0.6c11.win32-py2.7
Add PYTHONPATH to envirenmonet variables
 c:>easy_install pip  
 c:>pip install selenium  
Run python interpreter and check that all stuff was installed correctly:
 >python  
 >from selenium import webdriver #import selenium webdriver library  
 >browser = webdriver.Firefox() #start firefox  
 >browser.get('www.qa-notes.blogspot.com')  
You can explore all available methods by using the following command interactively:
 >for method in dir(webdriver): print(method)  
Then you can look at help by:
 >help(webdriver.<methodname>)  
Selenium Python API here selenium-python API
If you want to write robust and maintainable test, you can use 'unittest' module with webdriver
For example:
 import unittest  
 from selenium import webdriver  
 class firstTestSuiteTest(unittest.TestCase):  
   """initialize some stuff here"""  
   def setUp(self):  
     self.browser = webdriver.Firefox()  
   """clean some stuff here after each test"""  
   def tearDown(self):  
     self.browser.close()  
   """each test methods' name should be start with 'test_'"""  
   def test_PasswordValidation(self):  
     browser = self.browser  
     browser.get(URL + 'sing-up')  
     pwdbox = browser.find_element_by_id('passord')  
     pwdbox.sendkeys(pwdGenerator())  
     pwd.click()  
     self.assertIn "Incorrect passowrd", errorMessage  
 suite1 = unittest.TestLoader().loadTestsFromTestCase(firstTestSuiteTest)  
 suite2 = ....  
 suiteN = ....  
 """Prepare all suites all together"""  
 """  
 To skip some tests use anotations before method definition, e.g  
 @unittest.skip("demonstrating skipping")  
 def test_ThisTestWillBeSkipped(self):  
   Blah Blah Blah  
 """  
 fullTest = unittest.TestSuite([suite1, suite2, ..., suiteN])  
 unittest.TextTestRunner(verbosity=2).run(fullTest)  

Tuesday, October 30, 2012

Selenium headless with python

Headless selenium. Will be useful to integrate with CI

Install virtual display and python wrapper for it:
 $ sudo apt-get install xvfb xserver-xephyr  
 $ sudo pip install pyvirtualdisplay  
Usage example:
 from pyvirtualdisplay import Display  
 from selenium import webdriver  
 """visible=0, visible=1 for display or not virual display"""  
 display = Display(visible=0, size= (1024, 768))
 display.start()
 driver= webdriver.Chrome() 
 driver.get('http://www.qa-notes.blogspot.com')
 print 'The title of current page is: ', driver.title  
 driver.quit()
 display.stop()