lunes, 29 de agosto de 2016

Ionic and camera plugin bug

Some years ago people bought mobile phones to communicate, now they look for other features as the camera.

The camera is a important part of the cell phones so important that a lot of mobile aplication used it for work.


Ionic and camera Plugin

Ionic is a framework that used javascript to make android and apple applications. It has a integration with cell phone components, in this opportunity I'm talking is about the camera. For install the plugin you only need to run this command in NodeJS

cordova plugin add cordova-plugin-camera

You can find how implement the plugin in this site


Bug!BUG!

Yes, Ionic lets you use the device camera in our applications, but have a problem in the android
device, when the camare return the control to our application it back to the first screen, in other word the application crash. So, this bug happend because android put the app on hold, so the gargabe collector kill the app. 

The best way to solve the problem is installing the following plugin in this way

cordova plugin add https://github.com/mWater/cordova-plugin-wezka-nativecamera


The plugin not use the camera application of the device instead it simulated a camera so the application not on hold and gargabe collector not kill it.

domingo, 14 de agosto de 2016

Ionic Framework

Ionic is a framework based in HTML 5, the purpose of it is created a hybrid mobile app using the web technology like AngularJS.

How did you start using?

Ionic is simple to use, you only need to  install the following dependence in NodeJS:
  • npm install -g cordova
  • npm install -g ionic
Cordova, is which take the application and convert it in mobile application. When the npm finish to install the dependence you must provide the platform to be used with the command ionic platform add "platform" where platform should be android or ios.

How make application?

In back end is easy, because you make it with AngularJS, but the Front End you can visit this link http://ionicframework.com/docs/, in it you can find all the information about Ionic Desing.



Why used it?

The reasons why you should use it are:
  • Only need programming for one platform, because you can set up a new project with a different platform but using the same code.
  • You can view better the size of the back end in all the device size, because the browser has the option to see the responsive of a web page.
  • You can use variety of frameworks in the back end.
  • You can re-use a code of a web page and convert in mobile app.
So, take a risk and used it.







 


viernes, 29 de julio de 2016

Simple solution for simple error


The most interesting thing in the software develop is the ease with which error occurs. In some
occasion the error is for a bad code, other because the person forgot programing some exception and in stranger case the cause is stranger
In some moment of this two weeks I discover the cause of a stranger error in a gulp task. But, before to explain the error and the steps to resolve this I explain you how is a gulp


Gulp

Gulp is a JavaScript task runner La principal idea of it is that you can programing a predefined task, for example:

  • Insert the localization of important files in the index.
  • Review the syntax of the program
  • Start a server to run an application.

The mysterious error in a gulp task

The first time that I execute the gulp task I found an interesting error in the console when the task for the review of the syntax has executed




The information of the error is very simple but no have sense. I discovered that my project not have an important file for the task: .jscsrc. If you search in Google this file you discover that is a file configuration with rules for the syntax. This file you can created yourself or use a predefine rules.

Resolve the error

So, you need file. How create this files? Simple, you need to follow the next steps:
1. Install this package npm install jscs –g
2. Run this command to generate JSCS configuration jscs --auto-configure path. Where path is the folder of you have the scripts.
3. When the command finally, you see something that it :

The number are the type of rules that you can choose. In the case for my project I use grunt, but you can use anything. When you choose the best option for you, the console inform that you have a .jscsrc file create.

If you run again your task, it have to works. This technique is utile if your report of error is different of the report of other members in your team, because it update de .jscs file.

jueves, 14 de julio de 2016

Unit Test How start with it?

All the programmers have a technique to test the software than they made.
In some cases this technique is print in console the result of a things or test the functionality with examples in the interfaces, but this method cannot be effective.
For our lucky, in some language we have a very effective method, during this two week I discover a very effective method, the Unit Test.
The unit test is a good method to test the functionality of the class methods in your program. So, I have some important points that you need to know if it is your first time with unit test. So go ahead.


Correct Configuration


The magic of the unit test is the correct configuration of the necessary files, if you don’t have it, the test is going to fail, even if the sentences that you can test is simple. For example, test that the true sentence is true or compare a simple string. When it happen you need to review the dependence of your project. Try to change the angular dependence mock and animate, for the same version of angular. It resolve the problem with the fail test without reason.

Know how testing

This is an interesting topic, because, how do know what you need to testing? So, it’s really easy, only what you need is to know what your module do and test what do you need that the methods in the module do. If you have problems with this you can use the coverage of PhantomJS, it is very effective to see the percentage of the functionality test and to know how is not testing yet


Using Spy

Yes, nobody like to be spy, but in this situation is good. The spy option of jasmine allow you see what the object methods do and permit to test if it is called. So, use it with trust. In this case the SpyOn method in Jasmine is your friend.

Create Mocks

Angular have a library special to create a false function or data to be testing, this is usefel when you need test a service that is used in the controller o when you have your data in a database. Tne name of the library is ngMocks,is important to remember when installe the ngMocks is that the version have been the same version of Angular. You can configure this in your karma file.


All this things are simple and necessary to be a unit tester. If you need to learn more about it, you need to practice and search information about unit testing, for your lucky, the web have more information about it.

martes, 28 de junio de 2016

The importance of asking time

During this two weeks, I learned the importance of asking. Ask when you not know how make the things and ask where I am not sure of something.
This lesson was learned when a coworker correct me about the way I had used boostrap for the design of the login page. I know about my weakness in css, because I have used it less, so when I see the comment in the pull request I searched about boostrap and implement it seemed to me right. But I had problems with the background of the page, then I asked my co-worker and he sat down with me and explained how to solve the problem, At that moment I understood that if I had asked from the start how to do , I could do other activities.

Finally, I like to quote a Peter Drucker “My greatest strength as a consultant is to be ignorant and ask a few questions.”



martes, 14 de junio de 2016

Two week in project

In these two week, I started to work in a project, in other words I learned about the procedures to follow when a project starts, for example :

  • Meetings to explain the project to team members
  • Create a repository in a control version site. In the case of the project that I work is Github.
  • Create a project in Taiga, because in this site you can implement scrum.

This is to set-up the project, but when you start the project, you need to considered the time for meetings,the standard used to write the code,in the case of this project is the style guide for AngularJS John Papa Styleguide and the most important thing is  work in team,because we must remember, we are not alone and always solve a problem is faster if we ask a other person how to solve it.

Finally , this is a new experience for me and I'll have more challenges to face , but I want to keep learning more about projects and gain experience to become an excellent professional






domingo, 29 de mayo de 2016

Angular JS. What to do in error case

Angular JS is a web framework based in MVC(Model View Controller). I know, in the web you can find all about Angular, so, What are you here? Well, I have a good tips when angular throw a error and yes the first tip is keep calm, and do any of the followings things:


  • Verify that the server is running ( Yes , it is obvious but check it)
  • The browser console is our friend, used it when the page not load(Trust me, probably you have an error)
  • Always verify the routes and the controller names. If you put a name bad, all will be wrong.
  • Verify you server status, in some situation it can save your time, because  your error can be caused for invalid route.
  • If you have sure that all the things are correct and angular not working,you can ask for help  a Google or a good friend. Google always have a answer and your friend, maybe too.
After finish remeber this things about Angular:


  1.  -Angular is relatively simple, when you understand the structure.
  2. -Angular is great in testing. Accept testing with karma and protactor.
  3. Angular have a lot information and you can find tutorial about it.
  4. Angular run in a lot of server. You can used Node JS, .NET or other.