Archive for June, 2009

Virtual Visit Software to boost your site traffic

// June 17th, 2009 // Comments // Old

Here is some more detaisl about virtual visit software continued from my post on How to Boost your Alexa Rank | Site Traffic using Virtual Visit Software

What is Virtual Visit?

  • Sardines Virtual Visit software is a free site visit to the new IP and PV systems, applicable to all types of regulators, businesses and ordinary users.
  • This system can quickly and efficiently and a high degree of simulation to improve web site popularity, and have a website click on external links, the site does not pop-up screen.
  • No web site can use the software friends points, long-term acquisition of site points.


Virtual Visit Software Advantage

  • Software using non-IE core, not in viruses, Trojans, bombs without windows, music.
  • Advanced scheduling algorithm, and full of artificial simulation mechanism, without any risk.
  • Software user-friendly, functional and practical, easy to operate; background system layout beautiful, full-featured, managed and well
  • At present, the highest technical standards of the industry, all free, fully automatic, as long as your computer can open brush to your site

More About Virtual Visit :

  1. Function with the user
    Sardines software is to enhance the use of site visits (an increase of IP, PV, and at the same time improve the page framework / views floating framework, the number of shells pop window, click on the number of external links, etc.). Consists of two parts sardines, sardines and sardine software sites, collectively known as sardines system. Software used to generate access behavior; site management tasks for the deployment, users, web site, significantly more than point / Second point of a significant ratio, flow control, trading points.
    There are two users, web users and non-users. Web site users to upgrade the system web site traffic (website users have to pay can be divided into users and ordinary users); non-Web users access to the main points by logging software, and then sold to the Crown to obtain economic benefits.
  2. Declaration and authorization
    Sardines system design principles are three: 1, non-malicious, usually we can see that the so-called click software, all for a certain advertising, intentional violation of the interests of others. Sardines system simulation is only used by the browser user behavior in general, not directed at any individual and organization. Click on the system web site with external links (the most common form of external link ads advertising) function, but the site does not encourage any use for an improper purpose, and the use of such site for all the consequences caused by shall not be responsible. 2, the software is designed to not directed against any form of website visitors, to maximize the user’s computer does not affect the normal use, such as software, users will not grab input focus does not automatically change ip (interruption of network). 3, testing, research, and entertaining.
    In addition, it is strongly recommended prior to the registration of users to carefully read the registration agreement.
  3. Web site user’s registration and use of
    1. Registration (not submitted to Email and real name)
    2. Web site, open the “submit URL” to submit your site URL.
    3. Download software, use your registered username / password login, and the youngest of the tube would not. Linked as long as several hours a day, for your site will bring stability, a balanced flow. Do not have to care about “points can be used” as long as the daily “Today points” on it.
    4. If you do not want to use the software, you can buy to get points or monthly flow.
      1. Web site points to buy, then brush each IP consume a three points, each with a consumption of an integral pv. Was equivalent to 10000 points per 1700ip and 5000pv. Consumption points of the system faster, mainly used to buy points to test the effect of short-term and long-term monthly users recommend.
      2. VIP users (ie monthly users) the highest daily flow ip12000, pv43200, may be submitted to a root domain and its 30 sub-domain name or two links.
      3. VIP price is divided into six files, 180,150,120,90,60,30 million per month, respectively, the Japanese were ip flow 12000ip, 10000ip, 8000ip, 6000ip, 4000ip, 2000ip, do not hang up there after the purchase of traffic .VIP monthly will increase traffic and click on the.
    5. Function of ad clicks are attached to the flow, you can run multiple ads, almost all types of ad clicks can be points that do not have set point, such as polar coordinates, the system will automatically capture page ads, automated clicking (mouse movement, location, such as the mouse is auto-simulation). Monthly users in the 8% points less than significant than the free-conditioning, each advertising the same in accordance with the significantly more than point to point, because the ads do not affect the number of clicks for each ad. Shells and can be put in the window, all the shells can be pop-up window.
    6. Traffic is to submit the url to the average of each distribution, the number of submitted URL will not affect the number of total flows.
    7. The shells in your site window (including the shells of the shell window pop-up window) will seriously affect your site statistics to the flow, because the shell window will occupy part of the flow of resources
    8. Click on the number of external links and external links to your site and set the number of significantly more than the points, but also link with the outside the way of counting, the specific figures of your own testing.
    9. Pop-up window and click the new window, there will be 2 hits and 2 hits from the second default click-through rate than the control points marked.
    10. Window and the promotion of certain missile systems are ip only once, and many members of the system, there may be other members have also put these URLs, it may appear there are no statistics on traffic issues. Brush these issues are inter-software co-exist.
    11. VVisit flow system software is used by Firefox (firefox) the core, not in those of the Trojan virus, antivirus software, if prompted, and that the risk of the procedure only be downloaded, will not be running against your computer. Can be closed when using antivirus software.
    12. Web site submission and the relevant parameters of the set course
      URL to submit five parameters, significantly more than point at URL, significantly more than the second point, the ratio Rd, Sec URL, where URL is optional Sec. System in the site, when you mouse over them to enter when the box will be prompted accordingly.
      Flow Control
      1, significantly more than point: 10000 every time that you visit the link, click on the page and external links (links to popular understanding of the advertising) number. If set to 0 will not generate any clicks.
      Significant point ratio = clicks / impressions, page impressions to the counting of PV is, in general, clicks should be less than the theoretical ratio, because they are not required every time you open your web site success , nor is it per-click advertising will be successful and Statistics. Therefore, here only to determine the size of the value of the switch, the number is not accurate, your ad must be in accordance with the actual click-through rate to adjust. Need to be reminded that the software, click on this site will not only click on to or less than the difference between clicks, will not be invalid clicks.
      2, Web site URL: is your site’s link to the main web site, sub-link and the secondary site domain name. URL submitted to consume points (except for monthly membership), if you earn points just hang up, then do not submit any site URL.
      3, significantly more than the second point: the role of the “significant points than” on the site within the new window click-through rate of the external links work.
      4, Sec ratio: refers to this your web site URL has been opened 10000 times each, the number of times from the antecedents.
      5, Sec URL: web site can be entered from a link on your site, the general search engines, and other Links. 比如在http://www.google.cn/search?q=%E7%BA%A2%E6%97%97&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:zh-CN:official&client=firefox-aFor example, in http://www.google.cn/search?q =% E7% BA% A2% E6% 97% 97 & ie = utf-8 & oe = utf-8 & aq = t & rls = org.mozilla: zh-CN: official & client = firefox -a can point to the “Red Flag Linux” website, this link is a red flag Rd site. Please according to their own Web site fill in the actual situation in Sec.

      Submit examples:
      For example, the red flag your site is Linux, then set the home page can be submitted
      1,URL: www.redflag-linux.com Significant than points: 250 points, significantly more than the Second:
      2, Sec
      a. the ratio of Rd 1: 4000 Sec URL: www.baidu.com/baidu?wd =% BA% C6% EC% EC & TN = monline_dg
      b. the ratio of Rd 2: 4000 Sec URL: www.baidu.com/s?tn=monline_dg&ie=gb2312&bs =% BA% C6% EC% EC & sr = & z = & CL = 3 & f = 8 & WD = Linux & ct = 0
      c. Sec 3 ratio: 1500 Sec URL: www.baidu.com/s?wd =% BA% C6% EC% EClinux & LM = 0 & si = & RN = 10 & TN = monline_dg & ie = GB2312 & ct = 0 & CL = 3 & f = 1 & rsp = 1
      d. the ratio of Rd 4: 1000 Sec URL: www.baidu.com/s?wd =% BA% C6% EC% D7% EClinux% C3% C0% B0% E6% E66% 2E0 & LM = 0 & si = & RN = 10 & TN = monline_dg & ie = gb2312 & ct = 0 & cl = 3 & f = 1 & rsp = 1

      Such as other sub-links
      http://www.redflag-linux.com/chanpin/index.php http://www.redflag-linux.com/chanpin/index.php
      http://www.redflag-linux.com/yingyong/index.php http://www.redflag-linux.com/yingyong/index.php
      http://www.redflag-linux.com/xiazai/index.php http://www.redflag-linux.com/xiazai/index.php
      http://www.redflag-linux.com/jishu/index.php http://www.redflag-linux.com/jishu/index.php
      http://www.redflag-linux.com/jujiao/index.php http://www.redflag-linux.com/jujiao/index.php
      http://www.redflag-linux.com/phorumredflag/index.php http://www.redflag-linux.com/phorumredflag/index.php
      …… ……
      Modeled on the Home link.

    13. Flow control settings tutorial
      Visit the Web site, open the “flow control”, the following interface appears:
      Flow Control
      Time control for 24 hours were set, the default value of 10000 that: a. the flow system is currently the largest flow (points only an adequate number of members and VIP members); b. If you do not comply with the conditions of 1, then the scope of your qualifications ( qualifications ranging from real-time integration and to identify points yesterday) with the maximum flow; c. flow itself is more than during the day, at a relatively less, and no second visit to normal. For example, the current system ip day 2300, a day would like to limit the 1000IP, time control can set the value of unity in 4000; If you want does not flow after the half-day to 12 hours after control of all can be set to 0. The rest like this.
    14. URL extensions introduced
      Since many sites use a form such as:
      http://www.9think.com/bbs/thread-159.html http://www.9think.com/bbs/thread-159.html
      http://www.9think.com/bbs/thread-1905.html http://www.9think.com/bbs/thread-1905.html
      http://www.9think.com/bbs/thread-1879.html http://www.9think.com/bbs/thread-1879.html
      Of such figures with continuous Url, we can Url figures (such as the above “159,1905,1879”) can be substitution,
      For example, the initial figure of 15, the end figure for 8899, you can just replace the URL:
      http://www.9think.com/bbs/thread-[15-8899].html http://www.9think.com/bbs/thread- [15-8899]. html
      In other words, “[15-8899]” (Note, including in brackets) is used to replace that figure.
      Url that you replace the sequential numbers as follows:
      [Start the figures – the end of the number of]
  4. Non-site users to register and use the
    1. Registration, real names must be submitted and payment of Po (the real name and payment must be consistent on the Po, not for your payment) and payment must be through the real-name authentication Bao. At present, for your payment to pay just to support Bao.
    2. Download software, use your registered username / password login, you can minimize the window. Software to increase the number of traversal as long as is normal, 40 per traversal submit data to the server. Growth points with your computer system resources and speed of the network. Note, do not submit any site, or you get points may be available for consumption.
    3. When you are enough of 20,000 points can be used, the landing site, in the “deal points” to sell points, points per million 2 yuan, from the sale of 20,000 points and the official payment within 48 hours. Do not save points.
    4. VVisit flow system software is used by Firefox (firefox) the core, not in those of the Trojan virus, antivirus software, if prompted, and that the risk of the procedure only be downloaded, will not be running against your computer. Can be closed when using antivirus software.
  5. Frequently Asked Questions
    1. Software error, how to solve?
      1, the software “bind” error: caused by software conflicts, turn off some of the network software (such as firewall, sniffer software, software agents, etc.) Try again, some horse will also cause this error
      2, Application Error (General English prompt): individual friends will appear on the computer, this error is caused by software compatibility may be related to some settings on your computer, use habits, and has yet to find the exact reason, If you frequent, it is recommended not to use the first.
      3, can not log in: Vista operating system in some prone to this problem; and your username password Do not have Chinese characters, punctuation, spaces, and so on. If it is not in front of reasons, are generally large because the system caused by visits, please try again multiple times.
      4, parked in the “browser has been opened”: this error is software built-in Firefox and not compatible with your computer caused the computer may be related to some of your settings, usage patterns, and as a result of the development of Firefox is abroad At present, can not be solved, it is recommended not to use the first.
    2. Sardines rules series software is integral to increase what can be linked to the number of minutes per hour, 24 hours a day to hang up the number of revenue?
      Integral sardines by the IP rules to determine the quality of every day in our system within 24 hours the first time a new IP when traversing the site by up points faster than when the traversal after a certain number of sites provide by the IP traffic into a PV, the speed will drop points.Integral Rules site in the root domain name servers and IP’s visit to determine the correlation between points rise by the IP and to determine the root domain, and a complex cross-cutting relations (such as “linked to the number of hours per hour, can be linked to the number of hours per day “and so on, this kind of question is unanswerable), and with the speed of your network.
      In addition, the Website, 24 hours hanging points is a typical professional hang up, hang up the professional quality will decline in IP, we recommend that you only open when the computer opens the software professionals do not recommend hanging up . And the registration statement, we have repeatedly stressed, do not use the broiler, enterprise server resources to run all the illegal software.
    3. I can use in a LAN routing more than one computer at the same time log software?
      No, more than the same public ip of the computer network log software at the same time, the points will not increase. However, more than you can in different public ip of the computer network log software at the same time, points will be doubled.
    4. How to develop off the assembly line?
      Landing site, in the “Member Center” to get off the development of links sent to your friend, who registered after this link is your line of. System will hang up your reward from their points of 5%. If your friends have opened this site, you sent the link off the assembly line may be invalid.
    5. Software to increase the number of the traverse, but why not point increase (or increase very slow)?
    6. Normal traverse every additional 40 points, points not to increase (or increased very slowly), only five kinds of possibilities: 1, have submitted URL, points to immediate consumption (there will be points available for 0 or negative), repeatedly stressed If it is not used to increase website traffic users hang up, do not submit URL, otherwise the points will be consumed; 2, the same public network ip to open a number of software at the same time (as a local area network linked to a number of software at the same time); 3 , ip with a brush station has completed the task (at this time showed: “no mandate” to change ip change ip, then just a); 4, slow speed, the traverse most of the sites failed to open; 5, cheating.
    7. Software prompts “no tasks”, how can I do?
      This situation is generally due to the success of the software from the server caused by access to the mission, the general do not have possession of, 4 minutes after the software will re-attempt to access, automatic processing. If a long stay in this prompt, the network may be the reason, you can try to restart the computer.
    8. I have 20,000 points, why can not the transaction?
      1, only available before they can trade points, points can not be trading history. If you just pay points, please do not submit URL, otherwise the points will be consumed (that is, there is only the history of integration, the case of points not available). 2, integral units are million of transactions, and the sale can only be an integer (X million) to carry out.
    9. How long after the sale of points to receive payment?
      A fixed time every day for all uniform payment, with the exception of holidays, the waiting time does not exceed 48 hours. But is to be noted that Po must be submitted for payment through the real-name authentication, and you submit the names and payment must be the real name Baozhong consistent, otherwise it is impossible for you to pay.
    10. After I submitted the sale of points, why show the “failure to pay”?
      1, Po pay your real name did not pass the certification; 2, submitted by real name and payment inconsistencies Bao. Real name can not be changed, if the payment of Po is an error, please amended / adopted after the real-name authentication, and then contact customer service and online payment for you to.
    11. I am a monthly (VIP) subscribers, why my site traffic and statistics to the very different pre-determined?
      1, the site is too slow to open; 2, page window in the shell (shell window would seriously reduce the statistics of the traffic); 3, incomplete statistics, for example, submitted a 20 page, but only statistically page code; 4, may for some reason, your website domain name (or ip) was system security software (such as antivirus software, firewalls, etc.) shielding; 5, site failure, it is recommended to replace a good number of the service provider space.
    12. I am a novice, want to site to make money, tell me some skills in this area?
      1, so the League before the first Baidu search for “a certain Union liar” to see if their credibility Furthermore, no adverse records to confirm their re-running the code.
      2, the main points of the main points: the registration number of advertising and more to put their code (1) In your web page.Must not register an advertising alliance, put duplicate code.
      3、 3, If you buy traffic, then, it is strongly recommended before the purchase of traffic, and then put in the code. If you put the code first to buy traffic, then suddenly increased flow, easy to be considered cheating.
      4, page, to open a fast, high position on the page; slow to open, later on the location of the page. The rate of advertising is also important, if an ad block, then other advertising will not be able to download a short period of time, as if it will click on an advertisement can not. If you find that some points less than advertising, you can remove a number of advertising pages to try, or to adjust the order of ads is often the problem can be resolved.
      5, must make a good click-through rate, click on the number of higher than 3% of the ip was the possibility of K on the great. Must be based on the actual number of clicks to adjust, it is very important.
      6, one by the experience, the second on IQ and less profusely, more refined door. The issue of making money, do not have to rely on psychology, we must find their own reasons, to solve their problems.
      7, If you are a beginner, first to the laggards forum basis of learning in this area.
    13. Please provide me with some of the web site resources?
      Technology is mainly responsible for this site, you need can be found through the search engine.

[ Note :  If you liked the article, Please submit to Social Bookmarking Sites ]

System Software Lab Programs ( Lex and Yaac Programs ) 6a

// June 14th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

6) Program to recognize the grammar (anb, n>= 10).

6.l

/* 6.l */
%{
#include<stdio.h>
#include “y.tab.h”
%}
%%
[aA] return A;
[bB] return B;
.|n return yytext[0];
%%

—————————————–

6.y

/* 6.y */
%{
#include<stdio.h>
%}
%token A B
%%
stmt: S ‘n’ {printf(“nValid expression”);exit(1);}
;
S: X B
X: X A | A A A A A A A A A A
%%
main()
{
printf(“nEnter the expression: “);
if(yyparse())
{
printf(“nValid expression”);
exit(0);
}
}
int yyerror()
{
printf(“nInvalid expressionn”);
return 1;
}

int yywrap()
{
return 1;
}

File Structure ( FS ) Lab Program 6 ( 6th Semester Information Science) – Alternative 2

// June 13th, 2009 // Comments // Old

Program 6 : Write a C++ program to implement index on secondary key, the name, for a file of student objects. Implement add ( ), search ( ), delete ( ) using the secondary index

This includes tow files

1.

//scindex.h
class SCIndex
{
public:

int  Insert (const char  *skey,const char  *pkey);
int  Remove (const char * key);
int Search (const char * key) const;
void Print (ostream &);
void Write (ostream &);
void Read(istream &);
void Init (int maxKeys);
private:
int MaxKeys;
int NumKeys;
char  **sKeys;
char  **pKeys;
int Find (const char * key) const;

};

int SCIndex :: Insert (const char *skey,const char *pkey)
{
int i=0,j=0;
if (NumKeys == MaxKeys) return 0; //no room for another key

for (i = NumKeys-1; i >=0; i–)
{

if(strcmp(skey,sKeys[i]) > 0)
break; // insert into location i+1
else if(strcmp(skey,sKeys[i]) == 0)
break; // insert into location i+1

else
{
sKeys[i+1] = sKeys[i];
pKeys[i+1] = pKeys[i];
}
}
j=i;

for(j=i; j>=0; j–)

//   while(strcmp(skey,sKeys[j]) == 0)
{
if(strcmp(pkey,pKeys[j]) > 0)
break;
sKeys[j+1] = sKeys[j];
pKeys[j+1] = pKeys[j];

}
sKeys[j+1] = strdup(skey);
pKeys[j+1] = strdup(pkey);
NumKeys ++;
return 1;
}

void SCIndex::Write(ostream &stream)
{    int i=0;
stream<<NumKeys<<“|”;
for (i = 0; i <NumKeys; i++)
{

stream<<sKeys[i];
stream<<“|”;
stream<<pKeys[i];
stream<<“|”;

}
}

int SCIndex :: Remove (const char * key)
{
int index = Find (key);
if (index < 0) return 0; // key not in index
for (int i = index; i < NumKeys; i++)
{
sKeys[i] = sKeys[i+1];
pKeys[i] = pKeys[i+1];
}
NumKeys –;
return 1;
}

int  SCIndex :: Search (const char * key) const
{
int i=0,fnd=0;
for(i=0;i<NumKeys;i++)
{
if (strcmp(sKeys[i], key)==0)
{
fnd=1;
cout<<endl<<sKeys[i]<<”             “<<pKeys[i];
}
}
if (fnd==0)
return -1;
return 1;

}

void SCIndex :: Print (ostream & stream)
{
stream << “Secondary Index :  Max keys = “<<MaxKeys
<<”    Number of  keys = “<<NumKeys<<endl;
for (int i = 0; i<NumKeys; i++)
stream <<“tKey[“<<i<<“] “<<sKeys[i]
<<”  : Primary key =”<<pKeys[i]<<endl;
}

int SCIndex :: Find (const char * key) const
{
for (int i = 0; i < NumKeys; i++)
if (strcmp(sKeys[i], key)==0)
return i;// key found
else if (strcmp(sKeys[i], key)>0) return -1;// not found
return -1;// not found
}

void SCIndex :: Init (int maxKeys)
{

if (maxKeys <= 0)
{
MaxKeys = 0;
cout<<endl<<“No Records : “<<endl;
}
MaxKeys = maxKeys;
sKeys =new char *[maxKeys];
pKeys = new char *[maxKeys];
NumKeys=0;

}

void SCIndex::Read(istream &stream)
{
int i=0;
/*
stream.read(NumKeys,4);
for (i = 0; i <NumKeys; i++)
{

stream.read(sKeys[i],10);
stream.read(pKeys[i],10);
}
*/
}

—————————————————————————————————————–

2. //lab6.cpp

#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include “student.h”
#include “varbuf.h”
#include “index.h”
#include “scindex.h”

main()
{

//char buffer[500];

student s;
VariableLengthBuffer b;
TextIndex ind;
SCIndex scind;
fstream datafile,indexp,indexs;
int choice=0,k=0,k1=0,n=0;
int recaddr,i;
char delkey[20],skey[20],srchp[10];
datafile.open(“student.txt”,ios::out|ios::in);
indexp.open(“pstudent.ind”, ios::out);
indexs.open(“sstudent.ind”, ios::out);

b.Init(65);
ind.Init(50);
scind.Init(50);
b.Clear();
cout<<endl<<“Enter number of students : “;
cin>>n;

for(i=1;i<=n;i++)
{
cout<<endl<<” Record : “<<i;
s.clear();
s.readdata();
b.Clear();
b.Pack(s.usn);
b.Pack(s.name);
b.Pack(s.address);
b.Pack(s.sem);
recaddr=datafile.tellg();
k=ind.Insert(s.usn,recaddr);
if( k != 1)
cout<<endl<<” Duplicate Primary key : Record Not Inserted “;
else
{
b.Write(datafile);
k=scind.Insert(s.name,s.usn);
}
}

do
{
cout<<endl;
cout<<endl<<“1.Insert Record “;
cout<<endl<<“2.Delete Record “;
cout<<endl<<“3.Search Record “;
cout<<endl<<“4.Display Primary Index”;
cout<<endl<<“5.Display Secondary Index”;
cout<<endl<<“6.Exit “;
cout<<endl;

cout<<” Enter your choice “;
cin>>choice;
switch(choice)
{
case 1:
cout<<endl;
s.readdata();
datafile.seekg(0,ios::end);
recaddr=datafile.tellg();
k=ind.Insert(s.usn,recaddr);
if(k!=1)
cout<<endl<<“Record not inserted : Duplicate Primary Key “;

else
{
k=scind.Insert(s.name,s.usn);
b.Clear();
b.Pack(s.usn);
b.Pack(s.name);
b.Pack(s.address);
b.Pack(s.sem);
b.Write(datafile);
cout<<endl<<“Record Inserted “;
}
break;

case 2:
cout<<endl;
cout<<” Enter Name of the Record to be deleted : ” ;
cin>>delkey;
cout<<endl<<“Following Record/s Found for : “<<delkey<<endl;
cout<<endl<<“Secondary Key   Primary Key”;
cout<<endl<<“————–  ————-“;
k1=scind.Search(delkey);
if(k1 !=1)
{
cout<<endl<<” Record not found “;
break;
}
else
{
cout<<endl<<” Enter USN : “;
cin>>srchp;

k=scind.Remove(delkey);
k1=ind.Remove(srchp);
if(k!=1 || k1!=1)
cout<<endl<<“Record not Found “;
else
cout<<endl<<“Record of “<<delkey<<” USN “<<srchp<<” Deleted”;

}
break;

case 3:
cout<<endl;
cout<<” Enter name of the student to be Searched : ” ;
cin>>skey;
cout<<endl<<“Following Record/s Found for : “<<skey<<endl;
cout<<endl<<“Secondary Key    Primary Key”;
cout<<endl<<“————–   ————“;

k1=scind.Search(skey);
if(k1 !=1)
{
cout<<endl<<” Record not found “;
break;
}
else
{
cout<<endl<<” Enter USN : “;
cin>>srchp;
recaddr=ind.Search(srchp);
if(recaddr<0)
cout<<endl<<“Record does not exist”;
else
{
cout<<endl<<” Record found “;
cout<<endl<<“Record reference of USN “<<srchp<<” is “<<recaddr<<endl;
datafile.seekg(recaddr,ios::beg);
b.Clear();
b.Read(datafile);
b.bufdisplay();
s.clear();
b.Unpack(s.usn);
b.Unpack(s.name);
b.Unpack(s.address);
b.Unpack(s.sem);
s.display();
s.clear();
datafile.seekg(0,ios::end);
}
}
break;

case 4:
ind.Print(cout);
break;

case 5:
scind.Print(cout);
break;
//case 5: exit(1);
}
}   while(choice < 6);

ind.Write(indexp);
scind.Write(indexs);

indexp.close();
indexs.close();
datafile.close();

}

File Structure ( FS ) Lab Program 6 ( 6th Semester Information Science)- Alternative 1

// June 13th, 2009 // Comments // Old

Program 6 : Write a C++ program to implement index on secondary key, the name, for a file of student objects. Implement add ( ), search ( ), delete ( ) using the secondary index

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
using namespace std;
class secondary_index{

public:
string Name_list[100];
int Address_list[100];
int count;
void create_index();
void insert() ;
void remove(string);
void delete_from_file(int);
void search(string);
int search_index(string);
void read_from_file(int);
string extract_Name(string);
void sort_index();

};

void secondary_index::create_index()
{
fstream file;
int pos;
string buffer,name;
count=-1;
file.open(“1.txt”,ios::in);
while(!file.eof())
{
pos=file.tellg();
buffer.erase();
getline(file,buffer);
if(buffer.empty())
break;
//imp since it leads the last n and goes to new line
name=extract_Name(buffer);
Name_list[++count]=name;
Address_list[count]=pos;
}
file.close();
sort_index();

buffer.erase();
}

string secondary_index::extract_Name(string buffer)
{string USN,Name;
int i=0;
USN.erase();
while(buffer[i]!=’|’)
USN+=buffer[i++];
Name.erase();
i++;
while(buffer[i]!=’|’)
Name+=buffer[i++];
return Name;
}

void secondary_index::sort_index()
{
int i,j,temp_Address;
string temp_Name;
for(int i=0;i<count;i++)
{
for(int j=i+1;j<=count;j++)
{
if(Name_list[i]>Name_list[j])
{
temp_Name=Name_list[i];
Name_list[i]=Name_list[j];
Name_list[j]=temp_Name;
temp_Address=Address_list[i];
Address_list[i]=Address_list[j];
Address_list[j]=temp_Address;

}

}
}
}

void secondary_index::insert()
{
string   USN,Name,Branch,sem,buffer;
int semester,pos;
fstream file ;
cout<< “n USN:”;
cin>>USN;
cout<< “n Name:”;
cin>>Name;
cout<< “nBranch:” ;
cin>>Branch;
cout<< “nSEMESTER:”;
cin>>semester;
stringstream out;
out<<semester;
sem=out.str();
buffer=USN+’|’+Name+’|’+Branch+’|’+sem+’$’+’n’;
file.open(“1.txt”,ios::out|ios::app);
pos=file.tellp();
file<<buffer;
file.close();
Name_list[++count]=Name;

Address_list[count]=pos;
sort_index();
}
int secondary_index::search_index(string key){
int low=0,high=count,mid=0,flag=0;
while(low<=high){
mid=(low+high)/2;
if(Name_list[mid]==key){
flag=1;
break;
}
if(Name_list[mid]>key)
high=mid-1;
else
low=mid+1;
}
if(flag){
return mid;
}
else
return -1;
}
void secondary_index::search(string key){
int pos=0,t;
string buffer;
buffer.erase();
pos=search_index(key);
if(pos>=0){
read_from_file(pos);
t=pos;
while(Name_list[++t]==key)
read_from_file(t);
t=pos;
while(Name_list[–t]==key)
read_from_file(t);
}
else
cout<<“n”<<“Not found”;
}
void secondary_index::read_from_file(int pos){
int address;
string buffer;
/*for(int i=pos;i<count;i++){
Name_list[i]=Name_list[i+1];
Address_list[i]=Address_list[i+1];
}    */
fstream file;
file.open(“1.txt”);
address=Address_list[pos];
file.seekp(address,ios::beg);
getline(file,buffer);
cout<<endl<<“Found the record:”<<buffer;
file.close();
}
void secondary_index::remove(string key){
int pos=0,t,ch;
string buffer;
buffer.erase();
pos=search_index(key);
if(pos>=0){
read_from_file(pos);
cout<<endl<<“delete ?”;
cin>>ch;
if(ch)
delete_from_file(pos);
t=pos;
while(Name_list[++t]==key){
read_from_file(t);
cout<<endl<<“Delete?”;
cin>>ch;
if(ch)
delete_from_file(t);
}
t=pos;
while(Name_list[–t]==key){
read_from_file(t);
cout<<endl<<“Delete?”;
cin>>ch;
if(ch)
delete_from_file(t);
}
}
else
cout<<“nnNot foundn”;
}
void secondary_index::delete_from_file(int pos){
char del_ch=’*’;
int i,address;
if(pos>=0){
fstream file;
file.open(“1.txt”);
address=Address_list[pos];
file.seekp(address,ios::beg);
file.put(del_ch);
cout<<endl<<“nnRecord deleted:”;
file.close();
}
for(int i=pos;i<count;i++){
Name_list[i]=Name_list[i+1];
Address_list[i]=Address_list[i+1];
}

count–;
}
int main(){
int ch;
string key;
secondary_index i1;
i1.create_index();
while(1){
cout<<“nMain Menun1:Add()n2:Search()n3:Delete()n4:Exit()nEnter the choice”;
cin>>ch;
switch(ch){
case 1:cout<<“Data n”;
i1.insert();
break;
case 2:cout<<“Enter the namen”;
cin>>key;
i1.search(key);
break;
case 3:cout<<“Enter the Name”;
cin>>key;
i1.remove(key);
break;
case 4: return 0;
default:cout<<“Wrong Choice!!!!!!!nn”;

}
}
}

System Software Lab Programs ( Lex and Yaac Programs ) 5b

// June 13th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

5b. Program to recognize strings ‘aaab’, ‘abbb’, ‘ab’ and ‘a’ using the grammar (anbn, n>= 0).

5b.l

%{
#include<stdio.h>
#include “y.tab.h”
%}

%%
[a] return A;
[b] return B;
. return yytext[0];
n return yytext[0];
%%
——————————————

5b.y

%{
#include<stdio.h>
%}
%token A B
%%
input:expr ‘n’ {return 0;}
expr: X
X: A X B|;
%%

main()
{
printf(“nEnter string: “);
if(!yyparse())
{
printf(“nValid”);
exit(0);
}
}
int yyerror()
{
printf(“nInvalid”);
return 1;
}
int yywrap()
{
return 1;
}

System Software Lab Programs ( Lex and Yaac Programs ) 5a

// June 12th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

5) a. Program to evaluate an arithmetic expression involving operators +, -, * and /.

5a.l

%{
#include “y.tab.h”
extern int yylval;
%}

%%
[0-9]+ { yylval=atoi(yytext);return NUM;}
[ t];
n return 0;
. return yytext[0];
%%

————————————————-

5a.y
/* 5a.y */
%{
#include<stdio.h>
%}
%token NUM
%left ‘-”+’
%left ‘*”/’

%%
start: expr    {printf(“nValid expression.nValue: %d”,$1);}

expr: expr’+’expr   {$$=$1+$3;}
|expr’-‘expr    {$$=$1-$3;}
|expr’*’expr    {$$=$1*$3;}
|expr’/’expr     {if($3==0)
yyerror(“Divide by zero”);
else
$$=$1/$3;
}
|'(‘ expr ‘)’  {$$=$2;}
|NUM
;
%%

main()
{
printf(“nEnter an expression: “);
yyparse();
return(0);
}

int yyerror(char *msg)
{
printf(“n%s”,msg);
printf(“nInvalid expression”);
exit(0);
}

System Software Lab Programs ( Lex and Yaac Programs ) 4a

// June 11th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

4) a. Program to recognize a valid arithmetic expression that uses operators+, -, * and /.

4a.l

%{
#include “y.tab.h”
extern int yylval;
%}

%%
[0-9]+ {yylval=atoi(yytext); return NUM; }
[ t] ;
n return 0;
. return yytext[0];
%%

———————————————–

4a.y

%{
#include<stdio.h>
%}

%%

%token NUM
%left ‘+’ ‘-‘
%left ‘+’ ‘-‘
%nonassoc UMINUS

%%

e:e’+’e |
e’-‘e |
e’*’e |
e’/’e {if($3==0)  {printf(“n DIVIDE BY ZERO ERROR”); exit(0);}} |
‘(‘e’)’ |
‘-‘e %prec UMINUS |
NUM
;
%%

yyerror()
{
printf(“invalid exppressionn”);
exit(0);
}

int main()
{
printf(“enter an expression:”);
yyparse();
printf(“valid expression”);
return 0;
}



System Software Lab Programs ( Lex and Yaac Programs ) 3.l

// June 10th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

3) Program to recognize and count the number of identifiers in a given
input file.

%{
int id=0;
%}

ID [_a-zA-Z][a-zA-Z0-9]*
DECLN “int”|”float”|”char”|”short”|”double”|”long”|”unsigned”
%x DEFN

%%
{DECLN}    {BEGIN DEFN;}
<DEFN>{ID}, id++;
<DEFN>{ID}; id++;
<*>n ;
<*>. ;
%%

main(int argc, char **argv)
{
if(argc==2)
{
yyin=fopen(argv[1],”r”);
yylex();
printf(“n Number of identifiers : %dn”,id);
}
else
printf(“n Usage :%s <file>n”,argv[0]);
}

System Software Lab Programs ( Lex and Yaac Programs )2b.l

// June 9th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

2b. b. Program to recognize whether a given sentence is simple or compound.

%{
#include<stdio.h>
int F0=0,F1=0,F2=0,error=0,l1=0,l2=0;
%}

verb am|run|sit|did|study|is|large|go|come
subject [a-zA-Z]+
compnd “and”|”but”|”also”|”either”|”neither”|”yet”|”still”|”consequences”

%%
{verb} { if(F2==1)
l2=1;
F2=1;
if(F1==0)
error=1;
}

{compnd} { F0=1; }
{subject} { if(F1!=0)
l1=1;
F1++;
}
%%

main()
{
printf(“n Enter a sentence: “);
yylex();

if(error==1 || F2==0 || F1==0)
{
printf(“n Invalid sentence”);
exit(0);
}

if(F0==1 && l1==1 && l2==1)
printf(“n Compound sentencen”);
else
printf(” nSimple sentencen”);
}

System Software Lab Programs ( Lex and Yaac Programs )2a.l

// June 9th, 2009 // Comments // Old

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART – A

………………………………………………………………………………………………………………………….

2) a. Program to recognize a valid arithmetic expression and to recognize
the identifiers and operators present. Print them separately.

%{
#include<stdio.h>
#include<string.h>
#define max 20
int flag,i,j,k,top,b;
char stack[max],ident[max],oper[max],brac[max];
%}

%%
[a-zA-Z0-9] {j++;strcat(ident,yytext);}
[a-zA-Z0-9]+ {flag=1;}
“+” {oper[k++]=’+’;}
“-” {oper[k++]=’-‘;}
“*” {oper[k++]=’*’;}
“/” {oper[k++]=’*’;}
“$” {oper[k++]=’$’;}
“^” {oper[k++]=’^’;}
“%” {oper[k++]=’%’;}
“(” { stack[++top]='(‘;brac[b++]='(‘;}
“)” { if (stack[top]=='(‘ && top!=-1) top–;flag=0;brac[b++]=’)’;}
%%

int  main()
{
int i=j=k=b=flag=0;
top=-1;

printf(“nEnter the Expression : “);
yylex();
printf(“nThe identifiers are :  “);

for(i=0;i<j;i++)
printf(“t%c”,ident[i]);

printf(“nNo.of identifiers are : %d”,j);
printf(“nThe operators are :n”);

for(i=0;i<k;i++)
printf(“t%c”,oper[i]);

printf(“nNo. of operators are :%d”,k);
if(flag==0 && top==-1 && j==k+1)
printf(“nValid expression”);
else
printf(“nInvalid expression”);

return 0;
}