Its long since I blogged, thanks to some unfinished network maintenance stuff. This time its a console age-calculator, the git version calculates the month and year and date difference given by the user, still its a good time pass and strong back-end for another Qt application :P.
source code:
github, wish me luck :)
to run the code, in terminal type:
$ g++ age.cpp -o age
$ ./age
Wednesday, July 27, 2011
Wednesday, July 13, 2011
a day in my school, spreading message of open-ness
DAV Gandhi Nagar AISSE-2007 get-together, June 30 2011: Some things were to be done, seeking required privileges to give juniors a talk on Open Source. Principal S K Sinha, was welcoming, gave me the liberty of choosing, tum jab aoge, tab kara denge.
Tuesday July 5, 2011: It was already late when I woke up, and slides unprepared, but the talk had to be given, typical college lazy bug, some points were chalked and Images downloaded, all set to school!
OK fine, principal sir was leaving, had to talk to VP Mr B K Singh
Frustrating, but finally permitted! phew, gates to OPEN SOURCE were OPEN, 2 periods were alloted, 45 minutes each, and now the problem was, I had to give talks to two different batches, all class X, no IX. I had to compromise with my talk duration.
Anyways, I was more than satisfied for it, at least the message could be spread to some, something which should have been known to them (by then). In a small places like Ranchi, we seldom come in touch with any such technologies (except core i processors, new propitiatory OSs, thanks to ads). Some kind of myth supporting, doing this is good, this is not good etc, etc. Talking about me, Open Source and Free Softwares was with me for the first time in 2009 sometime after I joined the college.
The session was titled
Introduction to OPEN SOURCE and FREE Softwares, there I was assisted by Chinta. It all went well. Happy-happy ending!! [:)] was a bit doubtful how well my message would have penetrated those guys, I was in library all the time, library mam ( I forgot her name :P ) introduced me a student called Prakhar Prasad. Coming beyond my expectations, he proved to be a real FOSS guy, exploring since past three years, his area of interest is Network Security. FINALLY there was some feeling of achievement. His softpedia profile.
Comment for slides, they would be mailed directly to you.
While discussing installing linux based OSs in school's computers, I came across some inevitable problems coming out of CBSE hypocrisy. Norms are there to work on linux boxes but the copies with #include<iostream.h> are considered right. [my gcc compiler never accepted this].
Tuesday July 5, 2011: It was already late when I woke up, and slides unprepared, but the talk had to be given, typical college lazy bug, some points were chalked and Images downloaded, all set to school!
OK fine, principal sir was leaving, had to talk to VP Mr B K Singh
- There was no such auditorium to support the strength of classes I requested [class IX and X], one hall which school had was turned into classroom(s).
- The talk could only be allowed if there is no test the following day, wtf..., I had not talked beforehand for this kindaa .... .
Frustrating, but finally permitted! phew, gates to OPEN SOURCE were OPEN, 2 periods were alloted, 45 minutes each, and now the problem was, I had to give talks to two different batches, all class X, no IX. I had to compromise with my talk duration.
Anyways, I was more than satisfied for it, at least the message could be spread to some, something which should have been known to them (by then). In a small places like Ranchi, we seldom come in touch with any such technologies (except core i processors, new propitiatory OSs, thanks to ads). Some kind of myth supporting, doing this is good, this is not good etc, etc. Talking about me, Open Source and Free Softwares was with me for the first time in 2009 sometime after I joined the college.
in our school library |
The session was titled
Introduction to OPEN SOURCE and FREE Softwares, there I was assisted by Chinta. It all went well. Happy-happy ending!! [:)] was a bit doubtful how well my message would have penetrated those guys, I was in library all the time, library mam ( I forgot her name :P ) introduced me a student called Prakhar Prasad. Coming beyond my expectations, he proved to be a real FOSS guy, exploring since past three years, his area of interest is Network Security. FINALLY there was some feeling of achievement. His softpedia profile.
Comment for slides, they would be mailed directly to you.
While discussing installing linux based OSs in school's computers, I came across some inevitable problems coming out of CBSE hypocrisy. Norms are there to work on linux boxes but the copies with #include<iostream.h> are considered right. [my gcc compiler never accepted this].
Tuesday, July 12, 2011
Back-end Database to slamBook
Some changes:
in the *.pro file it needed to be included
QT += sql // taking care of case
although the backingdb.cpp file is not functioning properly as expected, it places 21 out of 23 parameters in place [which may still be considered as a failure]. Even after cross-checking the syntax several times and writing from scratch, the real bug could not be figured out, soon the code would be split into database tables in a 'tab specific' manner hence reducing number of parameters passed per function.
The database, compared to previous HTML outputs, gives an upper hand in data management.
Here are the screen shots of all tabs:
I would be rude if I don't mention Prakhar Prasad in this blog. Also acknowledging all previous names mentioned under label slamBook.
[github link to this commit]
in the *.pro file it needed to be included
QT += sql // taking care of case
although the backingdb.cpp file is not functioning properly as expected, it places 21 out of 23 parameters in place [which may still be considered as a failure]. Even after cross-checking the syntax several times and writing from scratch, the real bug could not be figured out, soon the code would be split into database tables in a 'tab specific' manner hence reducing number of parameters passed per function.
The database, compared to previous HTML outputs, gives an upper hand in data management.
Here are the screen shots of all tabs:
I would be rude if I don't mention Prakhar Prasad in this blog. Also acknowledging all previous names mentioned under label slamBook.
[github link to this commit]
Thursday, July 7, 2011
Documentation to slamBook
some Qt stuff:
Suppose in Image tab, I paste a URI and click attach button(or press Alt+t) a signal 'click()' is generated by this->ui->pushButton_7, ui being the present object, then it requires this to be acted upon by a SLOT [or a function, written specifically for acting to a SIGNAL] called imageView().
$ qmake slamBook.pro
$ make
and Run the output file:
$./slamBook
Signals and slots are used for communication between objects.I have implemented it using
QObject::connect( sourceObj , SIGNAL(typeOfSignalGenerated()) , destinationObj, SLOT(actionToBeInitiatedForSignal()) );
Suppose in Image tab, I paste a URI and click attach button(or press Alt+t) a signal 'click()' is generated by this->ui->pushButton_7, ui being the present object, then it requires this to be acted upon by a SLOT [or a function, written specifically for acting to a SIGNAL] called imageView().
[lines 78,79 in mainwindow.cpp].
About the code: xml file is automatically generated WYSIWYG feature of Qtcreater coming handy saving a lot of time in User Interface design.
slots:
void Accept() : this SLOT (or function) reads the values from UI and push to an HTML file. Those values are of QString [using *.toStdString()] type, and needs to be converted to std::string, as no operator<< is defined in order to complete file insertions.
void imageView() : it fetches the image from imageURI provided ans shows it in QGraphicsView.
To compile and view the application, you need to:
pull the code from git@github.com:saurabhsar/slamBook.git
or URI
pull the code from git@github.com:saurabhsar/slamBook.git
or URI
$ qmake slamBook.pro
$ make
and Run the output file:
$./slamBook
Happy cute(Qt)-ing.
Slam Book v0.02
Compared to last version, this has the following changes
Hope you enjoy this!
Codes on github: Direct link to this commit
Test
[1] Tirtha for his hints in making imageViewer work [blog].
[2] Rolie, Srishti and Aishwarya, for their feedback on the same.
- a tab exclusively to view image has been added [1].
- now we can switch through textEdit by pressing tab
- some changes in HTML output.
- changes have been made to ambiguous options like 'About', 'You are crazy about', 'Hobbies and interests' to make it more specific [2].
- one line informal description to every textEdit(s).
- the dateTimeEdit is replaced by dateEdit for filling Date Of Birth
Hope you enjoy this!
Codes on github: Direct link to this commit
Test
[1] Tirtha for his hints in making imageViewer work [blog].
[2] Rolie, Srishti and Aishwarya, for their feedback on the same.
Tuesday, July 5, 2011
Slam Book
This is my second project using Qt. Compared to my previous Numerology Calculator, it is a much organized effort having pretty specific files. The whole code was written using Qtcreater as an IDE, Its effectiveness and efficiency made it possible to push out the v0.01 in less than 24 hours form the moment it started.
This application only performs write operations, no pre-existing files generated could be edited or viewed in it. The output is stored as a plain HTML file.
Source Codes
git
Output files of this app
Distributed under GNU GPLv3+
PS: I should mention my friends, who inspired me for this.
a screen shot |
This application only performs write operations, no pre-existing files generated could be edited or viewed in it. The output is stored as a plain HTML file.
Source Codes
git
Output files of this app
Distributed under GNU GPLv3+
PS: I should mention my friends, who inspired me for this.
Monday, June 27, 2011
My first Qt app
So with sparse matrix on stands, and summer haunting, something had to be done. Qt haunted my empty brain this time. Simple thought of 'MY' app made me Qt aficionado. Now the thing was, WHAT. I have always been fascinated by numerology, so the track was set.
About the code: a SLOT had to be written, taking input from QLineEdit, and calculating the numerology subsequently displaying it to QLabel via QSpinBox.
The first version of looked something like this:
With a QSpinBox showing the numerological equivalent of QString ( or user Input ).
It had some bugs, specially with QSpinBox, The value can be changed and was not right to use it as an output widget, so here came my second version:
Its cool, QLabel replacing QSpinBox, responding to shortcuts like Alt+C, Alt+Q
would be uploading the codes soon...
Apart from it, I have added restrictions to window size to avoid defacing of the app on maximizing.
Codes
License: GNU GPLv3+ view
PS: Suggest me some more numerological stuffs, to make this a real cool app, looking forwar
About the code: a SLOT had to be written, taking input from QLineEdit, and calculating the numerology subsequently displaying it to QLabel via QSpinBox.
The first version of looked something like this:
With a QSpinBox showing the numerological equivalent of QString ( or user Input ).
It had some bugs, specially with QSpinBox, The value can be changed and was not right to use it as an output widget, so here came my second version:
Its cool, QLabel replacing QSpinBox, responding to shortcuts like Alt+C, Alt+Q
would be uploading the codes soon...
Apart from it, I have added restrictions to window size to avoid defacing of the app on maximizing.
Codes
License: GNU GPLv3+ view
PS: Suggest me some more numerological stuffs, to make this a real cool app, looking forwar
Saturday, June 25, 2011
sparse.cpp,
This might be my last post related to sparse.cpp, failing to code as per my expectations and goals this became an idea not so longlived. I would be uploading the working code soon, fixing some errors, or curtailing the erroneous codes.
This blog post may mark an end of coding phase, not the end on sparse.cpp. Any one looking forward to work with me on this, is most welcome :). Please get me on any of the contacts listed below or simply leave a comment, I'll definitely get to you.
twitter
irc: saurabharaiyer
(#nitdgplug on freenode)
This blog post may mark an end of coding phase, not the end on sparse.cpp. Any one looking forward to work with me on this, is most welcome :). Please get me on any of the contacts listed below or simply leave a comment, I'll definitely get to you.
irc: saurabharaiyer
(#nitdgplug on freenode)
Saturday, June 18, 2011
When Network icon is not coming in notification area
No problem, again open the terminal, and type the following commands
thanks to: Shreyankg and Arjun Basu
- sudo service NetworkManager start
- sudo chkconfig NetworkManager on
thanks to: Shreyankg and Arjun Basu
Thursday, June 16, 2011
Adding more flexibility, to #include "sparse.cpp"
This is my third blog post regarding #include "sparse.cpp". I have tried to embed more user friendliness this time. display() function is still giving segfaults, and the definitions of retrieve( int, int ) and remove ( int, int ) are not included in the source.
Complete source code(s)
One major change this time: The code is split into header and definition files.
sparse.h:
/*
* This program is a part of an attempt to implement Sparse
* Matrix in C(plus)(plus)
* Licenced under GNU GPL v3+
*
* Downloaded From http://goo.gl/WNrQZ
*/
#include <iostream>
#include <vector>
#include "llnode.cpp"
using std::vector;
using std::cout;
using std::cin;
*/
#ifndef SPARSE_H
#define SPARSE_H
template <class T>
class sparse
{
public:
llnode <T> *root;
sparse(char cVerbose = NULL);
sparse(vector <T> , vector <int> , vector <int> );
~sparse();
int insert(T , int, int);
void dispaly();
void vertical(int);
void horizontal(int);
T retrieve(int, int); // Input is Array indeces
int remove (int, int); //Synonymous to delete, input is array indeces
private:
int m,n;
llnode <T> *temp;
int maxval(vector<int>);
int push(T , int, int);
int index_return(int, llnode <T>*);
int incase(int, llnode <T>*, int, int);
};
#endif // SPARSE_H
Complete source code(s)
One major change this time: The code is split into header and definition files.
sparse.h:
/*
* This program is a part of an attempt to implement Sparse
* Matrix in C(plus)(plus)
*
* Copyright 2011 Saurabh Araiyer <sizzsa(at)gmail(dot)com>
* * Licenced under GNU GPL v3+
*
* Downloaded From http://goo.gl/WNrQZ
*/
#include <iostream>
#include <vector>
#include "llnode.cpp"
using std::vector;
using std::cout;
using std::cin;
/*
* std::cin and cin::cout to be removed in later phase(s)
* included for verbose input*/
#ifndef SPARSE_H
#define SPARSE_H
template <class T>
class sparse
{
public:
llnode <T> *root;
sparse(char cVerbose = NULL);
sparse(vector <T> , vector <int> , vector <int> );
~sparse();
int insert(T , int, int);
void dispaly();
void vertical(int);
void horizontal(int);
T retrieve(int, int); // Input is Array indeces
int remove (int, int); //Synonymous to delete, input is array indeces
private:
int m,n;
llnode <T> *temp;
int maxval(vector<int>);
int push(T , int, int);
int index_return(int, llnode <T>*);
int incase(int, llnode <T>*, int, int);
};
#endif // SPARSE_H
Monday, June 13, 2011
#include "sparse.cpp" insertion function
This time its happy news for me, all segmentation faults from the insertion function has been resolved, in this version of my code, I have removed the display function, an addition in the form of retrieve function would be done soon, so that values could be fetched from the sparse <type> object.
Click for Source code
All source codes and screenshots
Click for Source code
All source codes and screenshots
Tuesday, June 7, 2011
#include "sparse.cpp"
I was thinking about 2-D arrays and memory, there it stroke me Sparse Matrix, a relatively efficient way to do so. Then why not develop it, there it started rolling:
Source Code
Mapping of nodes, for easy understandibility
Things done to create a node:
__________________
| | |
| | |
| 1 | 2 |
| | |
|_________|______|
| 3 | 4 |
|_________|______|
1. template <class T>class node :: <T> data. //Template
2. template <class T>class node :: node <T> * hnode. //hnode stands for horizontal link to the node
3. template <class T>class node :: node <T> * vnode. //vnode stands for vertical link to the node
4. template <class T>class node :: short int num data. //For tracking node positions
About the code:
sparse is defined as a generic class having
Data variables:
Member Functions:
int insertion ( case 2 , node <T>* a , int pv , int ph )
int insertion ( case 3 , node <T>* a , int pv , int ph )
int insertion ( case 4 , node <T>* a , int pv , int ph )
int index_return( int ret = 0 , node <T> * a)
int index_return( int ret = 1 , node <T> * a)
More recent definitions to the code
/* incase i = insertion ( casei )
*
* incase 1: when at both positions root->vnode[pv].hnode and
* root->hnode[ph].vnode, don't have any node associated with
* them
*
* incase 2: when root->vnode[pv].hnode is occupied and
* root->hnode[ph].vnode is free
*
* incase 3: when root->hnode[ph].vnode is occupied and
* root->vnode[pv].hnode is free
*
* incase 4: when both root->hnode[ph].vnode and
* root->vnode[pv].hnode are occupied
*
* index_return(0, ... ) returns the current vertical position
* ( assumed that the mxn matrix created is similar to a
* a standing grid )
*
* index_return( 1 , ... ) returns the horizontal position of the
* node in the matrix grid
*/
Please suggest me more functions which I may write for increased usability.
Source Code
Mapping of nodes, for easy understandibility
Things done to create a node:
__________________
| | |
| | |
| 1 | 2 |
| | |
|_________|______|
| 3 | 4 |
|_________|______|
1. template <class T>class node :: <T> data. //Template
2. template <class T>class node :: node <T> * hnode. //hnode stands for horizontal link to the node
3. template <class T>class node :: node <T> * vnode. //vnode stands for vertical link to the node
4. template <class T>class node :: short int num data. //For tracking node positions
About the code:
sparse is defined as a generic class having
Data variables:
public:
node <T>* root;
private:
node <T>* temp;
int m, n; // to define the maximum size of the sparse matrix
Member Functions:
public:
sparse();//Constructer
void insert(int case, T a, int posva,int posha);//for insertion
void display( void ); //lots of bugs to be fixed in this function
private:
int insertion ( case 1 , node <T>* a , int pv , int ph )int insertion ( case 2 , node <T>* a , int pv , int ph )
int insertion ( case 3 , node <T>* a , int pv , int ph )
int insertion ( case 4 , node <T>* a , int pv , int ph )
int index_return( int ret = 0 , node <T> * a)
int index_return( int ret = 1 , node <T> * a)
More recent definitions to the code
/* incase i = insertion ( casei )
*
* incase 1: when at both positions root->vnode[pv].hnode and
* root->hnode[ph].vnode, don't have any node associated with
* them
*
* incase 2: when root->vnode[pv].hnode is occupied and
* root->hnode[ph].vnode is free
*
* incase 3: when root->hnode[ph].vnode is occupied and
* root->vnode[pv].hnode is free
*
* incase 4: when both root->hnode[ph].vnode and
* root->vnode[pv].hnode are occupied
*
* index_return(0, ... ) returns the current vertical position
* ( assumed that the mxn matrix created is similar to a
* a standing grid )
*
* index_return( 1 , ... ) returns the horizontal position of the
* node in the matrix grid
*/
Please suggest me more functions which I may write for increased usability.
Wednesday, May 25, 2011
Adding a new GSM Network to Ubuntu
Connecting a GSM network in ubuntu, no problem! Follow the following steps :
1. Open Network Connections, either from network applet or System->Configuration [in ubuntu].
2. Select tab 'Mobile Broadband'.
3. Click on add, a wizard opens for New Mobile Broadband Connection.
4. You would be prompt to select Country, Service Provider and plan.
5. On completion of the wizard, a new window would open, leave it as it is.
6. You may change the settings ( also known as dial-up settings ) in window above.
7. And yes, don't forget to check Available to all users. Enter password when prompted.
9. Enjoy Networking :)
Comment on this thread if not connected
1. Open Network Connections, either from network applet or System->Configuration [in ubuntu].
2. Select tab 'Mobile Broadband'.
3. Click on add, a wizard opens for New Mobile Broadband Connection.
4. You would be prompt to select Country, Service Provider and plan.
5. On completion of the wizard, a new window would open, leave it as it is.
6. You may change the settings ( also known as dial-up settings ) in window above.
7. And yes, don't forget to check Available to all users. Enter password when prompted.
8. Select network applet, select your newly created connection.
9. Enjoy Networking :)
Comment on this thread if not connected
Configuring network manually on Linux
Sometimes, it may happen that our Linux OS does not detect the Internet connection despite connectivity [ It generally happens in Proxy servers ]
Open terminal and type
decapsulatingabstraction@ubuntu:~$ sudo -s
[sudo] password for decapsulatingabstraction:
root@ubuntu:~# ifconfig eth0 your IP netmask your subnet mask
root@ubuntu:~# route add default gateway IP v4/v6 Gateway
root@ubuntu:~# sh -c "echo nameserver IP v4 DNS > /etc/resolv.conf"
You can view your network configuration using ifconfig
If you hate terminal then also there's a way out, here it is:
1. Click on the network applet, select edit connections
2. Select a pre-existing connection or simply add a new, then click on edit,
3. Give a connection name, add Auto in front of it, if you want that connection to be connected automatically.
4. In IPv4 tab, make the method manual.
5. After making the method Manual, click on add, and edit the present addresses to desired ones
5. Save it !
For NIT Durgapur students,
IPv4 Gateway 172.16.40.1
IPv4 DNS 172.16.1.90
Subnet Mask 255.255.254.0
for Manual DHCP, DHCP = 172.16.1.90
Enjoy Networking !!!
Open terminal and type
decapsulatingabstraction@ubuntu:~$ sudo -s
[sudo] password for decapsulatingabstraction:
root@ubuntu:~# ifconfig eth0 your IP netmask your subnet mask
root@ubuntu:~# route add default gateway IP v4/v6 Gateway
root@ubuntu:~# sh -c "echo nameserver IP v4 DNS > /etc/resolv.conf"
You can view your network configuration using ifconfig
If you hate terminal then also there's a way out, here it is:
1. Click on the network applet, select edit connections
2. Select a pre-existing connection or simply add a new, then click on edit,
3. Give a connection name, add Auto in front of it, if you want that connection to be connected automatically.
4. In IPv4 tab, make the method manual.
5. After making the method Manual, click on add, and edit the present addresses to desired ones
5. Save it !
For NIT Durgapur students,
IPv4 Gateway 172.16.40.1
IPv4 DNS 172.16.1.90
Subnet Mask 255.255.254.0
for Manual DHCP, DHCP = 172.16.1.90
Enjoy Networking !!!
Sunday, May 22, 2011
kumar-pravin: a father figure
I first met this man regarding conf.kde.in, sometime in February, and together we had gone there, it was a great experience spending some quality time with the real 'techies' of industry and the foss guys. The whole of journey was exciting, informative and refreshing.
Some snaps and conference details:
http://kumar-pravin.blogspot.com/2011/03/kde-conf-day-1.html
http://kumar-pravin.blogspot.com/2011/03/kde-conf-day-2.html
http://kumar-pravin.blogspot.com/2011/03/kde-conf-day-3.html
http://kumar-pravin.blogspot.com/2011/03/kde-conf-last-day.html
It was attended by me Praveen Ravi Mukul Sam Vikas Tirtha
Overall we found Pravin as a father figure to us, it he restrained us from doing any bad, except the k-hut project which he accepted to be a packager. Praveen was the strictest of all, had Ravi not been there, Praveen would have made our days .... He is a man whom I would never like to forget, a nerdy geek, always having a reason for what he is doing and ice cool personality.
Some snaps and conference details:
http://kumar-pravin.blogspot.com/2011/03/kde-conf-day-1.html
http://kumar-pravin.blogspot.com/2011/03/kde-conf-day-2.html
http://kumar-pravin.blogspot.com/2011/03/kde-conf-day-3.html
http://kumar-pravin.blogspot.com/2011/03/kde-conf-last-day.html
It was attended by me Praveen Ravi Mukul Sam Vikas Tirtha
Overall we found Pravin as a father figure to us, it he restrained us from doing any bad, except the k-hut project which he accepted to be a packager. Praveen was the strictest of all, had Ravi not been there, Praveen would have made our days .... He is a man whom I would never like to forget, a nerdy geek, always having a reason for what he is doing and ice cool personality.
why 'decapsulating abstraction'
First of all there is no proper word called Decapsulating in English dictionary, These words originated in our Object Oriented Programming (OOPS!!!!) in our third semester.
Encapsulation : Process of enclosing data members and functions in a class (user defined data type)
Abstraction : Simply hiding a part of information content of a concept
hope you got it!!!!
Encapsulation : Process of enclosing data members and functions in a class (user defined data type)
Abstraction : Simply hiding a part of information content of a concept
hope you got it!!!!
Subscribe to:
Posts (Atom)