Jump to content

User talk:Geetha nitc

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Geetha nitc (talk | contribs) at 11:17, 20 September 2013. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Jython did take one and a half day of my time to respond to applets

I figured a way out of it:

You have a file named lets say "Abc.py" and a html file called "ghi.html"

Now you run this command on the interpreter

    jythonc --deep --core --jar def.jar Abc.py
    mv jpywork/* .
    appletviewer ghi.html

Voila your applet runs in jython

Took me a long time to figure this out. But my students needed only 5 minutes to study these commands.

Work on XML

Starting to work on XML. But first web documentation.

So we did web documentation. Shall go into the details later. Surprisingly worked with servlets.

My Java and Jython servlets are working. Shall get to that also.

Geetha nitc (talk) 15:06, 16 February 2010 (UTC)[reply]


My Java and Jython servlets also worked. So now I have to upload the files where I saved it.

By the way I have to do a documentation of the servlet working.

Next up "beans". I find it funny that I am dealing with a lot of food related stuff.

Geetha nitc (talk) 11:30, 24 February 2010 (UTC)[reply]

Semantic Entity Extraction

So I am thinking about doing semantic entity extraction with the help of NLTK.

So, my prof suggested finding the applicable attributes to an entity. Hence we can create an appropriate tag for the entities. Consider the two examples

"He chairs the board."

"The chairs are bad."

As you can see there is a different sense for each of the chair used here.

The first one refers to a verb chair, whereas the second one refers to the plural chair.

So the first chairs would be tagged with Verb, whereas the second chairs would be tagged with Noun.

Let me see how far I can go.

Geetha nitc (talk) 12:30, 20 August 2010 (UTC)[reply]

Work on Animation in Machine Learning

Soon I shall be starting running out animation applets in Jython regarding Machine Learning. Shall keep that posted later. Geetha nitc (talk) 12:48, 20 August 2010 (UTC)[reply]

All that was needed was a build-dep

There are frustrating times, and then there are the good times. Currently the one that I had is good time because I figured out a way to get around the problem regarding some java problems.

To start off with I am not comfortable with either java or Ubuntu. Since jython creates classes in java, I presumed the error was because of some functionality not installed in java.

Turns out that part was some what true because the command that I typed which cleared out my problems with creating a jar file

      sudo apt-get build-dep jython

After that the code for creating jar file in jython is

      jythonc --all -j abc.jar SimpleApplet.py

There were a few warnings nevertheless I had a working code.

Installing the R-language showed me how to figure out the problem I had with jython.

       sudo apt-get build-dep r-base

The site which helped me was

https://stat.ethz.ch/pipermail/r-help/2007-December/149069.html

JSON

This is installation of python's JSON By default a json module is available in python. But we cannot validate the types in json module.

So there is a package called jsonschema that can also validate data. It is avaialable at http://pypi.python.org/pypi/jsonschema/0.3#downloads.

After downloading and extracting the package, become the root to install the package using

        python setup.py install

Here is the python file,def.py that was used to validate

  from jsonschema import ValidationError, validate
  schema = {
           "type" : "array",
           "items" : {"enum" : [1,2,3]},
           "maxItems" : 2,
        }
  try:
       validate([2,3,4],schema,stop_on_error=False)
  except ValidationError as e:
       print("Validation failed with errors:")
       for error in sorted(e.errors):
            print("    *"+error)

The ouput looks like

       Validation failed with errors:
            *4 is not one of [1, 2, 3]
            *[2, 3, 4] is too long

Apache, PHP, MySQL

Personally it is M.Tech and course work revisited. Since I am on arch linux these links helped me a lot. They are links to installing Apache server, MySQL, and PhpMyAdmin respectively.

     https://wiki.archlinux.org/index.php/LAMP
     https://wiki.archlinux.org/index.php/MySQL
     https://wiki.archlinux.org/index.php/PhpMyAdmin


Earlier my apache was not starting, this link again from arch helped me

     https://wiki.archlinux.org/index.php/Drupal

phpMyAdmin simplifies everything. The only real pain that I had was installation (it was a 3 hour work).

This link was useful for me in setting up the tables.

   http://www.youtube.com/watch?v=1-81n_vuwug

Now the other real issue is creating the foreign key.

This link helped us to import SQL dumps

        http://www.cyberciti.biz/faq/import-mysql-dumpfile-sql-datafile-into-my-database/


Writing out the queries given in the SQL classes of Sir.

So I think I have solved the issue of foreign key. From here onwards I am going to use only MySQL for creating queries.

Tables 1) student:

Primary key: "rollNo"
Foreign keys : 
  "deptNo" referencing "deptId" of table "department",
  "advisor" referencing "empId" of table "professor"

2) department:

 Primary key: "deptId", 
 Foreign keys: "hod" referencing "empId" of table "professor"


3) professor:

 Primary key: "empId", 
 Foreign keys : "deptNo" referencing "deptId" of table "department"

Creating the table

Site that helped me

http://phpprotip.com/2009/07/mysql-alter-table-add-foreign-key
 ALTER TABLE student ADD COLUMN deptNo varchar(2);
 ALTER TABLE student ADD INDEX deptNo (deptNo);
 ALTER TABLE student ADD CONSTRAINT deptNo FOREIGN KEY(deptNo) 
        REFERENCES department (deptId) ON DELETE SET NULL ON UPDATE CASCADE;

This part can be done on the GUI of phpMyAdmin. Please look into the part which tells about the foreign key constraint.


Now I am going over Sir's queries.

Q1) Get rollNo, name of the students in CSE dept along with their advisor's name and phone number

 select s.name, s.rollNo, f.name, f.phone 
 from student as s, professor as f 
 where s.advisor = f.empId LIMIT 0, 30 ;


Q2) Get names, employee Ids, phone numbers of professors in CSE department who joined before 1995.

        select f.name, f.empId, f.phone 
        from professor as f, department as d 
        where f.deptNo = d.deptId and d.name='CSE' 
              and startYear < 1995 LIMIT 0, 30 ;

Nested Queries or subqueries

Q3) Get the rollNo and name of students who have a lady professor as their advisor

       select s.rollNo, s.name 
       from student as s where 
       s.advisor in 
                    ( select empId 
                      from professor as f 
                      where f.sex='F') LIMIT 0, 30 ; 

There is a NOT IN operator also

Q4) Get the name and empId of the senior most professors

      select f.empId, f.name 
      from professor as f 
      where startYear <= 
                      all 
                           (select startYear 
                            from professor) LIMIT 0, 30 ;


Correlated Queries

Q5) Get the rollNo and name of the students whose gender is the same as that of their advisor

    select s.rollNo, s.name 
    from student as s where s.sex = 
                               all 
                                   ( select f.sex 
                                     from professor as f 
                                     where f.empId = s.advisor) LIMIT 0, 30 ; 

Another solution

    select s.rollNo, s.name 
    from student as s where exists 
                  ( select f.sex  
                    from professor as f 
                    where f.empId = s.advisor and f.sex = s.sex); 

Q6)Get employeeId and name of professors who advise at least one woman student

    select f.empId, f.name 
    from professor as f 
    where exists 
              ( select s.sex 
                from student as s 
                where s.advisor = f.empId and s.sex='F');


Q7) Obtain the deptId and name of departments that do not offer any 4 credit courses

    select deptId, name 
    from department as d 
    where not exists 
              (select deptId 
               from course as c 
               where c.deptNo = d.deptId 
               and c.credits = 4) LIMIT 0, 30 ; 

MySQL implements INTERSECT through INNER JOIN.

Site which tells of a work around

    http://www.bitbybit.dk/carsten/blog/?p=71


Doing an INTERSECT

An INTERSECT is simply an inner join where we compare the tuples of one table with those of the other, and select those that appear in both while weeding out duplicates. So

  SELECT member_id, name FROM a
  INTERSECT
  SELECT member_id, name FROM b

can simply be rewritten to

  SELECT a.member_id, a.name
  FROM a INNER JOIN b
  USING (member_id, name)

Performing a MINUS

To transform the statement

 SELECT member_id, name FROM a
 MINUS
 SELECT member_id, name FROM b

into something that MySQL can process, we can utilize subqueries (available from MySQL 4.1 onward). The easy-to-understand transformation is:

 SELECT DISTINCT member_id, name
 FROM a
 WHERE (member_id, name) NOT IN
 (SELECT member_id, name FROM table2);

Of course, to any long-time MySQL user, this is immediately obvious as the classical use-left-join-to-find-what-isn’t-in-the-other-table:

 SELECT DISTINCT a.member_id, a.name
 FROM a LEFT JOIN b USING (member_id, name)
 WHERE b.member_id IS NULL

which tends to be a lot more efficient.


I have to fill in a few queries

Examples involving grouping

Q In an University database, for each department, obtain the name, deptId and the total number of four credit courses offered by the department

 select deptId, name , count(*) as totalCourses
 from department, course
 where deptId=deptNo and credits=4
 group by deptId, name

Having clause

Report the total enrollment in each course in the even semester of 2010, include only the courses with a minimum enrollment of 2

 select courseId, count(rollNo) as enrollcount
 from enrollment
 where  sem ='even' and yearEnroll=2010 
 group by courseId
 having count(rollNo) >= 2

Left, right and full outer joins

Query: List all the professors if they are hods of departments, list their department name also.

  select f.name, d.name
  from professor f left join department d 
  on f.empId = d.hod

Query: List all the professors, if they teach a course, list the course, if they are hods of a department, list the department name

 SELECT f.name, d.name
 FROM professor f LEFT JOIN department d ON f.empId = d.hod
 union
 SELECT f.name, t.courseId
 FROM teaching t RIGHT JOIN  professor f  ON f.empId = t.empId

I need help on this

Geetha nitc (talk) 15:16, 17 November 2012 (UTC)[reply]


Python Programming with MySQL

Python is the language that I have chosen to program in MySQL. My default version of python is 3.3, but MySQLdb requires python 2.7.

So the easy path that I chose was to go for a different package. This is MySQL Connector/Python. The good thing is it is supported on Python 3.

The link for it was found here.

     http://dev.mysql.com/doc/refman/5.5/en/connector-python.html


Initially I had a problem with connection refused.i.e. ERROR no : 111

Then when I went back and checked MySQL settings I found that the default settings was not to listen to any port.


So I made the appropriate changes i.e. I went back to the LAMP installation mentioned previously.

Then another problem I encountered was that my Apache server failed to load. This was the link that helped me solve that problem.

    https://bbs.archlinux.org/viewtopic.php?id=133464

Now the high level programming part this is working. I have to set phpmyadmin properly now. A goody like Designer went underground because of this problem.

I will get back with that result another time. Meanwhile programming in python my site for the tutorial is

     http://dev.mysql.com/doc/refman/5.5/en/myconnpy_example_connecting.html

Geetha nitc (talk) 13:42, 28 November 2012 (UTC)[reply]

Well solved the problem of phpmyadmin There was a statement in the phpmyadmin installation of arch linux which I tweaked a bit.

  GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';

was changed to

  GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost';

So now everything is working properly.

INSERT and SELECT are working from python. I do need to know the datatypes of smallint in python, because it was turning up an error.

Geetha nitc (talk) 22:30, 28 November 2012 (UTC)[reply]

Setting up remote client and server

This took me the better part of 6 hours. In fact it should have taken one hour at the max. But still here is the run down.

My laptop is Lenovo s110 which runs Windows. My desktop machine runs on arch linux. I have some gui applications on my desktop that I want to be dispalyed on my laptop. Simple notion. So for the steps

  1. Install Cygwin-X on Windows. Detailed instructions can be found on
  http://x.cygwin.com/
  1. Use PuTTY as shown in the blog
  http://www.ece.iit.edu/ecesysdocs/MochaX.htm 
  1. Everything crucial is given in this blog with the exception of setenv. Replace setenv by export. i.e.
    setenv DISPLAY iq9:0.0 

should be replaced by

    export DISPLAY=iq9:0.0

So now you can run gui applications of your desktop(laptop) on laptop(desktop). This link also helped me initially

http://mysysadminlife.blogspot.in/2012/01/easy-x11-forwarding-using-cywin-putty.html

Geetha nitc (talk) 20:08, 12 May 2013 (UTC)[reply]

Got into some trouble took me an entire day to correct it again. But cleared it with a few things

  1. set /etc/ssh/sshd_config to these values
  X11Forwarding yes
  X11UseLocalhost yes
  1. set /etc/ssh/ssh_config to these values
   ForwardX11 yes

Then I restarted with

    rc.d restart sshd

Then essentially every thing worked. 14.139.160.4 (talk) 00:29, 14 May 2013 (UTC)[reply]