Tuesday, August 18, 2015

First Adruino program worked. fixed "adruino due is not listed in board list"

It is an Amazing experience with Adruino DUE,
I faced the issue of not finding Adruino DUE in board list,
Just used teh following link, which solved the issue
http://blog.startingelectronics.com/cant-find-arduino-due-in-board-list-of-ide

Thanks www.blog.startingelectronics.com

Publishing my Embedded Experiements @ http://facebook.com/EmbeddedClubQatar

Thursday, May 14, 2015

A Collection Framework in Java Script

Hi,
I just created a Collection framework in javascript.

please find the code in https://github.com/askeralim/Collection.js


Asker Ali M

Tuesday, August 26, 2014

Drawing a self reference directed edge in graph

I come across a requirement to draw a self-reference edge in my graph on Raphael Graph.

The edge from inDirect to Direct is drawn using Bezier curve,
For the selef refernce edge as welli used the same Bazier curve,


Here P1 & P4 can be easily calculated as center point of each sides. and P2 & P3 are assumed to be the part of a square,
other wise we can get better value using angle and two point mathematical calculation in Geometry.

Hope it will help you draw better graphs and edges using Raphael and Mathematics.

Best,
Asker

Thursday, June 26, 2014

Installing OS in Raspberry Pi

As a fun project, I just purchased Raspberry Pi from Amazon costing $39.
Its look wonderful MicroController to do the All the automation project without having much knowledge in Electronic Circuits and designs, It is all about Software and programming with the documents from website.

For OS Installation you can refer to :

You can download OS NOODLE from following link.


As a Startup it looks better to use NOODLE as OS and you can specifically install any OS Inside.

Once you completed the Installation it will getback with command prompt:  startx

Wow the Screen Looks Awesome.
How to shutdown Pi :
You can Logoff in the UI and will get back to Command prompt:
There you can enter the follwoing command: sudo shutdown -h now


Thursday, May 15, 2014

How to check whether scrollbar available Using JQuery

In my Example I have a DIV contains some data Table.


As the application looks like Excel, I have to check whether the div have horizontal or Vertical Scrollbar present to set the size of other Div.




JQuery Code is as folows:

       if($('div.dataTableDiv').width()<$('#dataTable').width())
             console.log('Horizontal Scrollbar Present');
       else
             console.log('Horizontal Scrollbar NOT Present');


For Vertical Scrollbar:


       if($('div.dataTableDiv').height()<$('#dataTable').height())
             console.log('Vertical Scrollbar Present');
       else
             console.log('Vertical Scrollbar NOT Present');

Wednesday, November 6, 2013

ReplaceAll Function in Javascript

Replace All Function in Javascript : Implemented through Recursion
 function replaceAll(word, text, newWord){
  var pos = text.search(word);
  if(pos == -1)
   return text;
  var str1 = text.substr(0, pos);
  var str2 = replaceAll(word, text.substr(pos+word.length), newWord);
  return str1+newWord+str2;
 }

Sunday, October 6, 2013

Prolog - XSB Execute Prolog in Command Line and drop result in file.

Here I would like to discuss on How to execute a Prolog Expression, and store the result in a file,
Also Execute the prolog Expression through Comand line,

Solution:
For implementing the Prolog, I have chosen XSB:
Once the XSB is installed, I kept the XSB/bin folder in System variables, so that I can execute from command line from any locations.

WRITE Operation in Prolog:
For writing the content to a file, Similar to any Streams in programming Language we can set the Streams here as follows.

open('RESULT_1380695160492.txt', write, H),
    tell(H),
    write('Hello World'),
    told.

First we open a file and assigned to a Handler H.
Method tell(H) : it will change the Stram to the provided Handler H.
told: Works as Stream writing is completed, and it will close the file.

Example : Evaluation of recursive Expression to a File.

Find the indirect paths from the provided direct paths.
Expression:

File Name : direct.P
direct(a,b).
direct(b,c).
direct(c,d).
direct(d,e).
indirect(X,Y):-direct(X,Y).
indirect(X,Y):-direct(X,Z), indirect(Z,Y).

calc :- open('TEST_RESULT_FILE.text', write, H),
tell(H),
calcResult,
told,halt.

calcResult :- indirect(X,Y),
    write(X),write('   '), write(Y),nl,
    fail.

calcResult.

To execute this program from command line, Execute the following command.

xsb -e [direct], calc.    //Here direct is teh file name.

It will Execute the Command and store the result in the file Called : TEST_RESULT_FILE.text

The result is as follows.
a   b
b   c
c   d
d   e
a   c
a   d
a   e
b   d
b   e
c   e

Regards
Asker Ali M