answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

How to store the file in array variable using perl?

As simple as that. If your Perl is in: /usr/bin/perl, then just copy and paste the text below in a file (e.g. my_prog.pl), make my_prog.pl executable (chmod u+x my_prog.pl) and execure this (./my_prog.pl) .

I hope my comments will allow you to adapt this small script according to your needs.

---- #!/usr/bin/perl

###########################

#### This is how you open the file ####

###########################

# First define the "record delimiter", if you wish. Options:

# $/ = "\n" # One line is one record! This is the default, no need to be defined.

# $/ = "\n\n" # An enpty line is the record delimiter (useful for mail headers, etc.)

# $/ = "you_name_it!" # According to your specific problem.

# try opening the file for reading and associate it with the

# "File Pointer" FP. If you fail the msg below will be printed

# and the program will halt.

open (FP, '/etc/hosts') or die('Cannot open file for reading');

#################################

#### This is how you store the file in arrary ####

#################################

# Read the file; here record=line.

my @records = ;

# and do not forget to close FP

close FP;

#######################

#### This is how you test it ####

#######################

# Print them, just for testing

foreach my $record (@records) {

chomp $record; # Get rid of the trailing "\n" that apears in each line

$record = "[$record]"; # Wrap the record in [] for the sake of presentation

print "$record\n";

}

----

Full form of basic in computer?

millsbery is good but its no far to shut it down bye millsbery we love millsbery one more chanes plz

What is corba?

Common Object Request Broker Architecture (CORBA) is an architecture and specification for creating, distributing, and managing distributed program objects in a network. It allows programs at different locations and developed by different vendors to communicate in a network through an "interface broker." CORBA was developed by a consortium of vendors through the Object Management Group (OMG), which currently includes over 500 member companies. Both International Organization for Standardization (ISO) and X/Open have sanctioned CORBA as the standard architecture for distributed objects (which are also known as components). CORBA 3 is the latest level.

The essential concept in CORBA is the Object Request Broker (ORB). ORB support in a network of clients and servers on different computers means that a client program (which may itself be an object) can request services from a server program or object without having to understand where the server is in a distributed network or what the interface to the server program looks like. To make requests or return replies between the ORBs, programs use the General Inter-ORB Protocol (GIOP) and, for the Internet, its Internet Inter-ORB Protocol (IIOP). IIOP maps GIOP requests and replies to the Internet's Transmission Control Protocol (TCP) layer in each computer.

A notable holdout from CORBA is Microsoft, which has its own distributed object architecture, the Distributed Component Object Model (DCOM). However, CORBA and Microsoft have agreed on a gateway approach so that a client object developed with the Component Object Model will be able to communicate with a CORBA server (and vice versa).

Distributed Computing Environment (DCE), a distributed programming architecture that preceded the trend toward object-oriented programming and CORBA, is currently used by a number of large companies. DCE will perhaps continue to exist along with CORBA and there will be "bridges" between the two.

What is a vertex shader?

Vertex and pixel (or fragment) shaders are shaders that run on a graphics card, executed once for every vertex or pixel in a specified 3D mesh. They operate in the context of interactively rendering a 3D scene, usually using either the Direct3D or OpenGL API.

How do you get to sunc the mp3 with the computer to get music on it. Why won't the program show up on the computer?

I just got my first MP3 player and I had some difficulty with it, too. Mine was a cheap brand that didn't offer much for instructions. They just sent me a CD with 1 driver and a piece of paper that said "thanks for buying." I had to open my computer and there it was listed as "removable disk." Double click removable disk and leave that window open on your desktop. Now, go open your music folder in another window. Now all you have to to is drop and drag. Click on the ones you want in the music folder and drag them over to the other window and that was how I got mine to work. Hope this helps. Good Day and Good Luck!

What is dynamic programming language?

Dynamic programming languages are often refered to as 'weakly typed' which means that variables are not bound to a particular type until runtime. For example, C++ is a 'strongly typed language, while Perl is a 'weakly typed' or 'dynamic' language.

A strongly typed language requires that you specify a type:

int i = 0;

In that C++ snippet, an integer names i is created and assigned the value of 0. The following would not compile in C++:

int i = 0;

i = "Hello world";

This would fail because i has been declared to be an integer and can not be assigned a string value. The following code would succeed in a dynamic language like Perl:

i = 0;

i = "Hello world";

The type is not declared here at all, because it is not bound to a type until runtime. In the first statement, i is bound to an integer type but in the second statement it is bound to a string type.

While dynamic language are easier to program in, they are much slower than strongly typed languages and are generally regarded as less safe since checking is not done until run time.

Write an iterative function to search an element in a binary search tree?

_node* search (_node* head, _key key) {

_node* node;

for (node=head; node != NULL;;) {

if (key == node->key) return node;

else if (key < node.>key) node = node->left;

else node = node->right;

}

return node;

}

Where are dynamic libraries dylibs located in Mac OS X?

dylib files can be found in the Lib folder or contained within an application's package.

What are abstract questions?

This question is one of them :)

abstract means not concrete, and may be influenced by context.

"Are you rich?" an abstract question (because of the abstracting word RICH.

I don't owe any money to any one means I am rich, vs

I have 1 million (but may owe 2 to others)

What is an ecv check?

ECV stands for "Extended Content Verification".

An ECV check is typically used to verify a computer server is functioning properly.

It usually works by making an HTTP call to a specific web page. It will then examine the returned HTML and verify the content by looking for a keyword (or expression).

Only if the page is returned (within a certain timeout) and contains the keyword, will the check be considered successful.

For example:

ECV Check: http://myserver.mydomain.com/admin/check_ecv.jsp

Keyword: "server_okay"

Many organisations use additional logic that allows them to take servers in and out of service for maintenance, upgrades, etc.

This logic can control the content of the "check_ecv.jsp" page accordingly.

[This question and answer should not be changed, unless agreed upon in advance with Dir of Ops or CTO]

Write a program in c to read the name age and basic salary of n employee and write these data to a file?

#include<stdio.h>

#include<conio.h>

void main()

{ FILE *fp;

char nm[50];

int a,b,n,i;

printf("\nInput file name:");

gets(nm);

printf("\nEnter no. of employees:");

scanf("%d",&n);

fp=fopen(nm,"w");

printf("Input Invendory Data:\n");

printf("Enter name age basic salary\n");

for(i=1;i<=n;i++)

{ scanf("%s %d %d",nm,&a,&b);

fprintf(fp,"%s %d %d",nm,&a,&b);

}

fclose(fp);

getch();

}

If the ans helps you,plz increase the trust point.

Write a program to input 20 arbitrary numbers in one-dimensional array CalculateFrequency of each number Print the number and its frequency in a tabular form?

/*

Code by In

contact facebook.com/inderspace :)

Do whatever you like with the code.... :P

*/

#include<stdio.h>

#include<conio.h>

/*==================

*/

int main()

{

int input[20],adone[20]={0},count[20]={0};

int i,j,k,c=0;

printf("\nEnter 20 numbers followed by ',': \n");

for(i=0;i<20;i++){

scanf("%d,",&input[i]); //Here the values are input

}

for(i=0;i<20;i++){

if(!done(input[i],&adone[0])){ //checks to see if number is done before

count[c]=freq(input[i],&input[0]); //if not done that it counts frequency

adone[c]=input[i];

c++;

}

}

for(i=0;i<c;i++)

printf("\n%d = %d",adone[i],count[i]); //output in tabular fashion :)

getch(); //not supported by gcc compilers sorry :(

return 0;

}

What does non-linear data structure mean?

When we speak of linear and no-linear data structures, we are referring to the links between one element and the next. These links determine how we traverse the structure such that we "visit" every element in the structure. When every element has only one possible link to the next in sequence, then the structure is said to be linear. If any element has two or more possible links, it is said to be non-linear.

Arrays, lists, stack and queues are examples of linear structures. Trees, networks and graphs are examples of non-linear structures.

A binary tree is the simplest example of a non-linear structure because every element has, at most, two possible links, a left link and a right link. If we follow the left link, then at some point we must return to that same element in order to follow its right link. This means we must backtrack. Any structure that requires us to backtrack during a traversal is therefore non-linear.

Linear traversal is more efficient than non-linear traversal because there is no need to backtrack to traverse a linear data structure.

What does open source mean?

"Open source" means it is written in or related to a type of computer programming code that is available to the public.

See related links for details.

What happened to the append function in python?

It's still there...

Type the following into a python prompt...

x = [7,4,3]

x.append(5)

print(x)

and you get the result...

[7,4,3,5]

It's definitely working in python 3

Who now controls the Internet?

The internet is not controled by any one party. The internet itself is a vast combination of networks. There is no centralized hub for the internet. The closest parties for "control" of the internet would be the service providers, who control the hubs that connect large regions to the rest of the world, and countries who can put laws on internet use and service.

5 elements of electronic data processing?

The 5 elements are hardware, software, user program, procedure and personnel. Data processing transforms data into meaningful information to carry out business or scientific activities.

Write a program that will add the number specified by the user?

In BASIC, this could be as simple as:

10 Input X

20 Input Y

30 Z=X+Y

40 Print X;" + ";Y;" = ";Z

50 END

In JAVA...

/**

* A simple calculator that adds, subtracts, multiplies, and divides.

* Written in Java by: AustinDoggie

*/

public class Calculator()

{

public Calculator()

{

// don't really have to do anything here

}

public int add(int x, int y)

{

int z = x + y; // add two numbers

return z; // and return it

}

public int subtract(int x, int y)

{

int z = x - y; // subtract two number

return z; // and return it

}

public int multiply(int x, int y)

{

int z = x*y; // multiply two number

return z; // and return it

}

public int divide(int x, int y)

{

int z = x/y; // divide two numbers

return z; // and return the result

}

}

Hope that helps.

What are some good free animating programs?

For Mac and Windows:

Stykz - Mac, Windows

TISFAT - Windows

Pivot Stick Figure Animator - Windows

----------------------------------------------------------------------------------

That's all I know of!

And I don't know of any online animators. Sorry.

Where can i get code for C plus plus airline program?

Not to be blunt, but if you want code for an "airline program", then you have to actually sit down and write it yourself. What constitutes an "airline program"? Is it a flight simulator or a business simulator? Either way, nobody is simply going to give you the code for a non-trivial application such as this.

To write one yourself, first think about all the types you will need. Given it is an airline you will obviously need an "aeroplane" base class from which all types of aircraft will be derived. Everything that is common to all aircraft (both attributes and interface) should be encapsulated by your base class, with specific implementation details handled by your specific derivatives. You may also find it easier if you break your abstract aeroplane down in to separate components (landing gear, flight controls, engines, fuel, and so on), thus making it possible to construct specific aeroplanes from specific components.

You must also consider the "world" object; the arena in which your simulation is set, which will naturally include airports. If it is a business simulation, you must also consider passengers, cargo, ground crews -- and competitors! Each of these types must be modelled separately using individual classes, both abstract and concrete. Once you have all your types defined, concentrate on the algorithms that will allow these types to interact in meaningful ways. Identify common features and use templates as much as possible to keep code duplication to a minimum.

With your types and algorithms in place you can then concentrate on the graphical side of things; how to present these types to the end-user. Finally, you can provide the "script" that brings everything together.

Clearly this is not a project you will complete overnight; it may take years all by yourself. But only by getting your hands dirty with such a project will you appreciate just how much effort actually goes into writing non-trivial software and why no-one is simply going to give you the code.

There are plenty of programming forums that will provide free help if you get stuck, but you have to actually make some effort first. Nobody is going to do your homework for you. You're not in school anymore.

I want to be a programmer and want to ask does programming requires a lot of math like Geometry-I'm good in math generally but not geometry i can do most of normal math?

1. What do you mean by "math generally"? Do you mean algebra, pre-algebra, calculus, statiscs, trigonometry, arithmetic, or other?

2. That depends. I mean, if you want to make a web browser, you don't have to know that much about math if you just make a basic one. But if you want to make a more advanced web browser, you will have to.(Trust me, e.g. testing kbps, packets/s, IP connections and branches, etc.) But if you want to make something like a 3D game, that will require tons of math, like trigonometry(sin, cos, tan will be very useful), and especially matrices. (Shifting matrices and converting them into pixels are like the most important thing you need to know in that case, and matrices are pretty easy in math.) So yeah, I guess if you want to unlock more chances of making a really good program, you're better off first taking a few weeks extending your mathematical knowledge!