Thursday, February 28, 2013

ALViC-0.1.2 Release

Centre for Development of Advanced Computing (CDAC) is very glad to inform you all that ALViC- Accessible Linux for Visually Challenged version0.1.2 is released on 11th February, 2013 in New Delhi, India. ALViC is a complete desktop environment which provides a comprehensive solution for Visually Challenged users. This is a GNU/Linux distribution based on Ubuntu 10.04; and uses Orca 3.2.0 xdesktop screen reader as the main interaction mechanism for visually challenged users. They can use it out of the box because accessibility features suitable for fully blind as well as for partially blind users are enabled by default.

Main Features of ALViC-0.1.2:

  • Free and open source desktop environment
  • Enhanced Orca with skim read, sentence navigation, list shortcut and structural navigation of text documents
  • PDF documents made accessible in Linux environment
  • Easy navigation and search facility on Desktop icon view
  • Accessible login for visually challenged users
  • Suitable desktop themes for partial blind
  • Other assistive tools like OCRFeeder, Audio book converter, Emerson DAISY reader, sound converter etc. useful for visually challenged users are also included.
For more details, visit the link ALViC-0.1.2.


We request all to try out ALViC-0.1.2 and send your feedback and suggestions on ossd[at]cdac[dot]in

Thanks and regards
For Accessibility Team
CDAC, Mumbai
022-27565303

Java Robot Class for Automatic Typing & Mouse Control

Java Robot class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed. The primary purpose of Robot is to facilitate automated testing of Java platform implementations.

     Now lets write a small java program, where we use robot class for automatic typing of "i am reni" in gedit and to move mouse pointer to Top-left corner.











//RobotClassDemo.java
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;

public class RobotClassDemo{

        public static void main(String[] args) {
            
             try {
                 // using Runtime to open gedit
                 Runtime.getRuntime().exec("gedit");
               
                 Robot robot = new Robot();

                 // Creates the delay of 5 sec to open gedit
                 robot.delay(5000);
                
                // Then Robot start writing "i am reni"in gedit 
     
                 robot.keyPress(KeyEvent.VK_I);
                 robot.keyRelease(KeyEvent.VK_I);
                
                 robot.keyPress(KeyEvent.VK_SPACE);
                 robot.keyRelease(KeyEvent.VK_SPACE);
                
                 robot.keyPress(KeyEvent.VK_A);
                 robot.keyRelease(KeyEvent.VK_A);
                
                 robot.keyPress(KeyEvent.VK_M);
                 robot.keyRelease(KeyEvent.VK_M);
                
                 robot.keyPress(KeyEvent.VK_SPACE);
                 robot.keyRelease(KeyEvent.VK_SPACE);
                
                 robot.keyPress(KeyEvent.VK_R);
                 robot.keyRelease(KeyEvent.VK_R);
                
                 robot.keyPress(KeyEvent.VK_E);
                 robot.keyRelease(KeyEvent.VK_E);
                
                 robot.keyPress(KeyEvent.VK_N);
                 robot.keyRelease(KeyEvent.VK_N);
                
                 robot.keyPress(KeyEvent.VK_I);
                 robot.keyRelease(KeyEvent.VK_I);
                
                 // Robot moves mouse pointer to TOP-LEFT corner
                 robot.mouseMove(0, 0);
                  
             } catch (AWTException e) {
                 e.printStackTrace();
             } catch (IOException e) {
                e.printStackTrace();
            }
         }
     } 

Use following command to run RobotClassDemo.java

#javac RobotClassDemo.java
#java RobotClassDemo

Wednesday, February 27, 2013

IPC Using PIPE Mechanism

IPC - Stands for Inter Process Communication

PIPE - There are different mechanisms to achieve IPC, one of them is PIPE. Other IPC mechanisms are Message passing, shared Memory and semaphores. To understand PIPE concept please see the following pic.



Fork()- This function is used to create parent and child process. Fork returns 2 times. 1st time it returns 0 in child process, 2nd time it returns 1 in parent process.

See the following code where child and parent process do IPC using PIPE concept. The child process waits for a key press, and then informs the parent process about it. The parent process waits for this information and then exits.


/* program to demonstrate usage of pipes */

#include <stdio.h>
// unistd.h is needed in C++ compilers
#ifdef __cplusplus
#include <unistd.h>
#endif

void main()
{

 int pfd[2]; // pfd - Pipe File Descriptor

 if(pipe(pfd) < 0)
    printf("\n Pipe error");

if(!fork())
{
   //child process
   char reni;
   printf("\n Enter any character to Exit:");
   scanf("%c", &reni);
   // writing to pipe
   write(pfd[1], &reni, 1);
   //child exit
  printf("\n Child Exiting..!");
  exit(0);
}
else
{
  // parent process
  char sam;
  // reading from pipe
  read(pfd[0], &sam, 1);
  printf("\n Parent Received %c from Child", sam);
  printf("\n Parent Exiting..!");
  exit(0);
}

}

Sunday, February 24, 2013

Curious Q's of C-Langunage

NOTE: These all are tested/executed on  GCC compiler


Q-34-----------------------------
This program will run or not?
#include <stdio.h>
int (SQUARE)(int x)
{
return x*x;
}
void main()
{
printf("square of 5 is %d", SQUARE(5));
}
A-34
Yes it will run. It will print
square of 5 is 25



Q-33-----------------------------
Write a simple C program to print your name on console without using semi-colon, if, for, switch, while, do-while, char, int, float?
A-33
#include <stdio.h>
#define PRINT printf("I am Bramha")
#define FUNC S[PRINT]
void main(void* FUNC) {}



Q-32-----------------------------
What is the output of following code snippet?
#include <stdio.h>
void main()
{
int array[5]= {[2]=25};
int i=0;
for(i=0;i < 5 ; i++)
printf("%d ", array[i]);
}
A-32
0 0 25 0 0
if we intialize array like this, defaultly it initializes all others to 0.




Q-31-----------------------------
In GCC sizeof(AnyFunct­ionName) or sizeof(void)?
A-31
1 byte


Q-30-----------------------------
write a C code to find whether given number is power of 2 or not?
A-30
#include <stdio.h>
void main()
{
   int reni;
   scanf("%d", &reni);
   if(reni & (reni-1)) // Binary AND
     printf("\n Not power of 2");
   else
     printf("\n power of 2");
}


Q-29-----------------------------
What is the output of following code snippet?
#include <stdio.h>
void main()
{
   int reni;
   for(reni=0;reni < 5 ; reni++)   {
       printf("%d ", reni??!??!reni);
   }
}
A-29
It is using trigraphs. to run this use 'gcc filename.c - trigraphs'
in trigraphs ??!??! == ||
so out put is 0 1 1 1 1



Q-28-----------------------------
What is the output of following code snippet?
#include <stdio.h>
void main(void)
{
  int r, s;
  for (r = 0; r < 5; r++)
  {
       s = r &&& r;
       printf("%d ", s);
  }
}
A-28
0 1 1 1 1 ( 'r &&& r' is equal to 'r && (&r)' )



Q-27-----------------------------
What is the output of following code snippet?
#include<stdio.h>
void main() {
    int reni = 777;
    sizeof(reni++);
    printf("%d\n", reni);
}
A-27
777 (sizeof is compile time operator so it's operand is replaced by value)



Q-26-----------------------------
Why a[7]=7[a] in C? where 'a' is array
A-26
Becoz array access is defined in terms of pointers. a[7] will become *(a+7) which is commutative



Q-25-----------------------------
difference between gets and fgets functions?
A-25
gets won't do array bound checking which causes buffer overflow. fgets do array bound checking.



Q-24-----------------------------
Write a program to add 2 non-zero positive integers without using any operator?
A-24
#include <stdio.h>
void main()
{
 int a, b;
 scanf("%d%d",&a, &b);
 printf("\n saum is =%d", printf("%*c%*c", a, '\r', b, '\r'));
}



Q-23-----------------------------
what is the output of following code snippet?
#include <stdio.h>
void main()
{
   char arr[] = "reni"; // terminated with '\0'
   char arr1[4] = "reni"; // not terminated with '\0'
   char arr2[] = { 'r', 'e', 'n', 'i'}; \\ not terminated with '\0'
   printf("%d %d %d", sizeof(arr),sizeof(arr1), sizeof(arr2) );
}
A-23
5 4 4



Q-22-----------------------------
what is the output of following code snippet?
#include <stdio.h>
int main()
{
  int a, b;
  ++a = 10;
  b++ = 20;
  printf("\n a=%d, b=%d", a, b);
  return 0;
}
A-22
Compilation error. In C Pre and post-increments can't be used as l-value. In C++ only post-increment can't be used as l-value.



Q-21-----------------------------
what is the output of following code snippet?
#include <stdio.h>
int main()
{
  int j=7;
  printf("j = %d", ++(-j));
  return 0;
}
21-A
gives compilation error, Becoz -j returns r-value where we need l-value to store that. In other way -(++j) works fine.



Q-20-----------------------------
What is the output of following code(coma operator)?
#include <stdio.h>
int main()
{
  int i, j;
  (i, j) = 30;
  printf("j = %d", j);
  return 0;
}
A-20
compilation error. Becoz result of coma operator can not use as l-value in C but in C++(g++) it will work.



Q-19-----------------------------
What is the output of following code(coma operator)?
#include <stdio.h>
void main()
{
    int var= 1, 3, 7;
    printf("%d", var);
}
A-19
Compilation error



Q-18-----------------------------
What is the output of following code(coma operator)?
#include <stdio.h>
void main()
{
    int var;
    var = 1, 3, 7;
    printf("%d", var);
}
A-18
1



Q-17-----------------------------
What is the output of following code(coma operator)?
#include <stdio.h>
void main()
{
    int var;
    var = (1, 3, 7);
    printf("%d", var);
}
A-17
7



Q-16-----------------------------
What is the output of following code?
#include <stdio.h>
void main()
{
  int val;
  printf("Reni%nSam", &val);
  printf("\n%d", val);
}
A-16
ReniSam
4 (number of characters before %n will load into 'val' variable)



Q-15-----------------------------
Following code snippet will work or not?
#include <stdio.h>
int staticValue()
{
    return 50;
}
void main()
{
    static int sam = staticValue();
    printf("\n Value of sam =%d", sam);
}
A-15
It flashes "initializer element is not constant" error. Becoz static variables intialize before main execution and staticValue function called after main only.



Q-14-----------------------------
what is the difference between following 2 statements?
extern int sam;
int reni;
A-14
1st one is a declaration
2nd one is definition



Q-13-----------------------------
Explain volatile qualifier in C?
A-13
Volatile variable is omitted from compiler optimization because their values can be changed by code outside the scope of current code at any time. For example Global variables modified by an interrupt service routine outside the scope.



Q-12---------------------------------------
what is the output of following code snippet?
#include <stdio.h>
void main()
{
  printf("\n%d", func());
}
int func()
{
  printf("\nRen");
}
A-12
Ren
4
Here 4 is the size of string with including '\0', which is a string terminator.



Q-11---------------------------------------
following declarations will work or not?
short i;
static j;
unsigned k;
const l;
volatile m;
A-11
Yes, All above declarations will work becoz default  datatype of all above declarations are Integer.



Q-10-----------------------------------------------
How global and local static variables with same name are differentiate in data-segment?
#include <stdio.h>
static int IntSam;
 void main()
{
   static int IntSam;
}  
10-A
local static int IntSam is appended with '.' and some integer number to differentiate from global static int IntSam. To check this, run above code snippet. Open generated object file in VI editor and look for IntSam in that.



Q-9------------------------------------------------
How to find the size of any datatype without using sizeof operator?

A-9
#include <stdio.h>
void main()
{
   int *intptr =0;
   float *floatptr =0;
   char *charptr=0;
   // union student *stdUnion = 0;
   // struct student *stdStruct = 0;
   intptr++;
   floatptr++;
   charptr++;
   //stdUnion++;
   // stdStruct++;
    printf("\n size of integer = %d", intptr);
    printf("\n size of Float = %d", floatptr);
    printf("\n size of char = %d", charptr);
   // printf("\n size of Union = %d", stdUnion);
   // printf("\n size of Struct = %d", stdStruct);
}
 


Q-8------------------------------------------------
Write 2 functions in such a way that one function will called before main function and another will called after main function.
A-8
#include <stdio.h>
void beforeMain(void) __attribute__((constructor));
void afterMain(void) __attribute__((destructor));
void main()
{
   printf("\n In Main");
}
 void beforeMain(void)
{
  printf("\n Before Main");
}
void afterMain(void)
{
  printf("\n After Main");
}



Q-7------------------------------------------------

Following code snippet will work? If yes what is the output?
#include <stdio.h>
int main()
{
  printf("\n%.*d", 4, 7);
  return 0;
}
A-7
Yes above code snippet will work. In above printf '*' is replaced by 4 and %.*d will become %.4d. Out put is 0007.



Q-6------------------------------------------------
What is the output of following code snippet?

#include <stdio.h>
struct num{
int sam:3;
};
int main(){
struct num n={-6};
printf("%d",n.sam);
return 0;
}

A-6
Binary value of 6: 00000110
Binary value of -6: 11111001+1=11111010
Select last 3 bits only becoz only 3 bits allocated = 010 = 2
Output is: 2



Q-5------------------------------------------------
What is  short-circuiting in C expressions?
A-5
In C expression the right hand side of the expression is not evaluated if the left hand side determines the outcome and vice verse. For example the left hand side is true for || or false for &&, the right hand side is not evaluated.



Q-4------------------------------------------------
following code will work or not?

#include <stdio.h>
void main()
{
  int a;
  printf("%d\n", sizeof a);
}

A-4
Yes, it will work becoz, sizeof is a operator not a function.



Q-3------------------------------------------------
 Write C function to decide whether given machine is big or little Endian 
A-3
#include <stdio.h>
void main()
{
union {
int reni;
char sam[sizeof(int)];
} endian;

endian.reni = 1;
if(endian.sam[0] == 1)
printf("\n Your machine is Little_endian");
else
printf("\n Your machine is Big_endian");





Q-2------------------------------------------------
What the following function will do?

#include <stdio.h>
void main()
{
     write(1,"\33[H\33[2J", 7);
}
A-2 it clears console and moves cursor to home in command prompt.




Q-1------------------------------------------------
What is the data type of Var, Var1 in the following function

void main()
{
     __typeof(1.0) var;
     __typeof(1.0) var1;
}
A-1
Var- Integer
Var1- Float

Monday, February 18, 2013

CDAC Mumbai Products At TechConclave-New Delhi

As humans we all are here on earth to experience the life. Where does technology comes in picture then? It's to make this experience better! At Centre for Development of Advanced Computing (CDAC) we are working on Language, Accessibility, Education and many other technologies to achieve the same.

On 11th and 12th February 2013 CDAC is showcasing some of its significant technology creations in a conclave at Delhi. This CDAC Technology Conclave will be held at India Habitat Centre, Lodhi Road, New Delhi.

CDAC Mumbai is showcasing its products related to areas Accessibility, Educational Technology, Language Technology, E-Security, etc at this conclave.

Look at for our products at the stalls viz. “E-Education & FOSS”, “Education & Training”, “E-Security”, “Language & Heritage Computing”, “ICT for social Welfare”etc. We invite you to come, meet us there, get to know more about our products and get a handson experience of our products.

For more information visit: http://www.techshow.cdac.in/Techshow/

Looking forward to see you there!

Venue:
India Habitat Centre, Lodhi Road, New Delhi.

Dates:
11th and 12th Feb, 2013


RUPANTAR: 


ALViC- Accessible Linux for Visually Challenged:

ALViC

 XLIT:
 PARIKSHAK:



ALViC - Accessible Linux for Visually Challenged - 0.1.2



ALViC - Accessible Linux for Visually Challenged – 0.1.2

ALViC is a GNU/Linux distribution created specially for visually challenged users. It is based on Ubuntu 10.04; and uses Orca 3.2.0 xdesktop screen reader. Visually challenged users can use it out of the box because accessibility settings required by them are already enabled. Special accessibility features of this distribution are briefly described below. These features have been added as part of the project 'Enhancing Accessibility of FOSS Desktops' at CDAC, Mumbai. This project is funded by the Department of Information Technology, Ministry of IT, under the NRCFOSS-Phase II project.

For More Details Visit: www.cdacmumbai.in/accessibility.

 
1. List keyboard shortcuts
Orca uses a large number of keyboard shortcuts. New users find it difficult to remember them. List Shortcuts feature enables a user to list all available Orca shortcuts. The new feature was accepted in May 2010, and is a default feature in Orca v2.31.2 and later. It works like this. The user enters 'List Shortcuts' mode by pressing Orca + h (double click). Pressing '1' lists Orca's default shortcuts. Pressing '2' lists Orca's shortcuts for the current application. The user can navigate and hear the listed shortcuts by pressing 'Up/ Down', can toggle to the other group of shortcuts by pressing '1' or '2', or can exit by pressing 'Escape'. For more details about the enhancement, visit the link https://bugzilla.gnome.org/show_bug.cgi?id=616820
 
2. Skim Reading
Before reading a document containing a large quantity of text, the user may first want a quick overview. Or, having already read the document once, may want to navigate quickly to a specific point. The sayAll command in Orca reads the document from the current cursor position to the end. Orca provides another way of moving through the text, by using the Up/ Down arrow keys. Both these methods read each line encountered along the way. So they are not useful in quickly accessing a specific portion of the text. The skim read feature meets the above requirement. When a user issues "Skim Read' command (Ctrl + KP_Add in desktop, Orca + Ctrl + semicolon in laptop), Orca skims through the entire document. It starts at the current line/ sentence, and then reads only the first line/ sentence of each subsequent paragraph. Whether it reads the lines or sentences depends on the Say All By setting. If the user presses the Ctrl key, then skim reading stops at the line/ sentence just read. The feature works with Libre/Open Office Word Processor, Gedit text editor and Firefox web browser. For more details about the enhancement, visit the link https://bugzilla.gnome.org/show_bug.cgi?id=577481
 
3. Navigation by sentence
This feature provides navigation by sentence in Libre/Open Office Word Processor documents and text documents. To read the current sentence, press Windows+m. To read the previous sentence, press Windows+comma. To read the next sentence, press Windows+period. For more details about the enhancement, visit the link https://bugzilla.gnome.org/show_bug.cgi?id=520591

4. Structural navigation in Libre/Open Office Word Processor documents
This feature enables a user to navigate a Word processor document by heading, table or other document element by pressing a single key. Turn on structural navigation by pressing Orca+z. When structural navigation is on, pressing h takes the user to next heading and pressing Shift+h to the previous heading. Pressing a key corresponding to n (1 <= n <=6) takes the user to the next heading at levl n, and pressing Shift+n takes him to the previous heading at level n. For more details about the enhancement, visit the link https://bugzilla.gnome.org/show_bug.cgi?id=652105

5. Accessing a pdf document
Press Ctrl+Alt+p to launch the access pdf script. Choose the pdf file to open and click on OK button. This invokes Poppler library command pdftohtml which converts the pdf content to html format. The html content is opened with Firefox web browser. Orca can access the content just like a web page. For more details about the enhancement, visit the linkhttp://live.gnome.org/Orca/Acroread#Use_pdftohtml.

6. Easier navigation of icons on desktop
Usually it is quite difficult for a visually disabled user to navigate all icons on the desktop using arrow keys on the keyboard. He may get stuck at the end of a row or a column. He may miss some icons. This new feature enhances the file manager and makes it very easy to navigate icons on the desktop. Just by repeatitively pressing the down/ right arrow key, the user can navigate from the first to the last icon without missing any. Also, existing item search facility for desktop icon view is modified to suit visually challenged persons. For more details about the enhancement, visit the link https://bugzilla.gnome.org/show_bug.cgi?id=613111.

7. Other Assistive Tools
Other assistive tools included in the distribution are:
OCRFeeder: A free software OCR suite, converts document images to text files.
Audiobook converter: Creates MP3 audiobooks from text files.
Sound converter: Leading audio file converter for the GNOME Desktop.
Emerson: A cross-platform EPUB and DAISY reader.

8. Dark and light colour themes
There are a number of dark themes suitable for partially sighted users, and light themes suitable for sighted users. The themes can be quickly changed using keyboard shortcuts.

9. Keyboard shortcuts
Press Ctrl+Alt+k to open the complete list of keybindings. It includes keybindings for Orca screen reader, Gnome desktop and Compiz window manager.
Press Ctrl+Alt+q to read answers to frequently asked questions.
Press Ctrl+Alt+i to read the installation manual.
Known issues about this distribution are listed in the Release Notes.

Friday, February 8, 2013

PARAM YUVA -II India's Fastest Super Computer By CDAC

Today CDAC is inaugurating PARAM Yuva II Super Computer by the hands of Shri J. Satyanarayana, Secretary, Department of Electronics and Information Technology (DeitY), Govt of India at NPSF, Pune today. PARAM Yuva – II is the new 500 TeraFlop version of CDAC's earlier PARAM Yuva. This by itself is a huge achievement for C-DAC as we are the first to cross the 500 TF milestone in the country. This also means that PARAM Yuva II is the fastest supercomputer in the country as of date.


Thursday, February 7, 2013

InfoSec 2013

InfoSec 2013 
7th - 8th March 2013
at Jawaharlal Nehru Auditorium, JNTU, Hyderabad
A Two Day Conference For Pursuing Graduates & Faculty.

Penetration of Internet & World Wide Web has made it an indispensable part of our lives. Web has revolutionized the way in which we interact with each other and also in carrying out our day-to-day activities. It is providing a wide range of services which include the critical services like online banking,e-commerce etc. It has expanded in size, functions & utilities from passive static pages to sophisticated web applications. Web has also become the most dangerous place and many web based attacks are now prevalent and it is a serious threat. These attacks target sensitive data or inject malicious functionality and most of these attacks are launched by exploiting the vulnerabilities in web. Keeping this in view we bring to you, InfoSec 2013 with a vision to dive into the deep aura of information security and related aspects. This one of its kind initiative, strives to bring in, an enlightment on security concepts and advancements in the Cyber Security arena, aiming to bring together an amalgamation of industry experts and academicians for graduates, under graduate students and faculty. 


CDAC Technology Conclave-II

As Every one know that CDAC Technology Conclave-I held at Hyderabad, India during October, 2012. Now the Second version of CDAC Technology Conclave is going to held at New Delhi, India during 11-12 February, 2013 . This technology conclave arranged because CDAC is completed 25 years in R&D activities in IT and education. For more Details visit:

http://www.techshow.cdac.in/Techshow/