Programming :: An Array With 15 Elements, And Want To Break It Down Into Three Columns?

Jul 20, 2011

I have an array with 15 elements, and I want to break it down into three columns. When the array is split into a the three elements - however on the iteration, it does not conform to that structure.

Code:
#!/usr/bin/perl -w
use strict ;

[code]....

View 13 Replies


ADVERTISEMENT

Programming :: Perl Array Last 2 Elements Will Not Pop?

Apr 27, 2010

created this array and the last two elements will not pop - phil and sylvia never get up to bat.

1#!/usr/bin/perl
2use strict;
3use warnings;

[code]...

View 3 Replies View Related

Programming :: Perl - Regex With Array Elements?

Mar 13, 2011

I have .txt.gz files that store queries made on a browser, d my job is to analyze them.The information is stored in a xml-like style.Quote:

<browser>lwp-trivial/1.41</browser>
<http_code>200</http_code>
<keywords />

[code]...

View 6 Replies View Related

Programming :: Declare An Array With The Number Of Elements Is Larger Than 2^32?

Oct 12, 2010

How can I declare an array with the number of elements is larger than 2^32 ?

View 2 Replies View Related

Programming :: Bash - Searching Strings For Array Elements?

Apr 30, 2010

...and returning the index of the found element in its array.

I have:

for ((i=0; i < ${#array1[@]}; i++)); do
# Read each line of the file test
if [[ $(eval "sed -n '$(($i+1))'p test") == *${array2[0]}* ]]
stuff

I want to find the index of the found substring in array2 and only if it isn't found, move on to the next element of array2. I don't know the size of array2 so that [0] has just got to go.

View 14 Replies View Related

Programming :: Declare An Array With Fixed Size And Initialize All The Elements To Zero

Jul 5, 2010

I want to declare an array with fixed size and initialize all the elements to zero. i want all elements of x to be zero and i dont know how to specify the size of array. also i have problem in comparing values in loops. my script is as follows:

i=0
let k=0
declare -a x
for U in ${S[@]}
do
for (( T=1276082023 ; $T -le 1276082139 ; (( T++ )) ))

[Code]...

View 8 Replies View Related

General :: Randomly Shuffling Of Array Elements?

Oct 10, 2010

i have an array var=(node1,node2,node3,node4) and i want to shuffle the array elements randomly every time when unix script will run like that.....

first time when script run order will be shuffle randomly
node3,node1,node4,node2

second time when script run order will be shuffle randomly like
node1,node4,node2,node3

third time when script will run again order will be shuffle randomly like
node2,node1,node3,node4

how to do this without using of shuf or shufsequence commands

View 8 Replies View Related

Programming :: C Realloc Resize Array / Delete And Add Information Into The Array?

Mar 6, 2011

I am trying to dynamically delete and add information into the array "blah"

Code:
int blahsize = 1;
char** blah = (char**) calloc(blahsize+1,sizeof(char*));
Adding information:
Code:
blah[1]=stuff1;
blah[2]=stuff2;
code....

View 2 Replies View Related

Programming :: Use Of Static Elements In Cpp?

May 27, 2010

i've got certain functions now declared as static and their being used as pointers. So, moving on I then added a variable which so happened to be used in both static and non static functions. Here's some testbed code, the variable in question is 'window':

Code:
//g++ -Wall -I/usr/include/ -L/usr/X11R6/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm main.cpp -o run
#include <GL/glut.h>
#include <stdlib.h>

[Code]....

In short, I can't see the point of using a class to wrap all of this. Never having been taught programming i'm unsure as to the best method for structuring an application like this. Should (would you design) this initial section be a class?

View 4 Replies View Related

Programming :: Convert Short Array To Char Array?

Jun 7, 2010

I have trouble converting a short array to a char array

Code:

short pShort[4] = { 0x41, 0x42, 0x43, 0x44 };

How to convert this to a char array?

View 4 Replies View Related

Programming :: Get The Number Of Elements In A Char*[] In C++?

Jan 27, 2011

I have a char*[] array:

Code:
char* myarray[] = {"Hello", "there!", "LQ"};

and I wish to use/ write a function to find the number of elements in myarray (in this case, its 3).

*equivalent of .NET's array.size() that returns number of elements in array

How do I achieve it?

View 7 Replies View Related

Programming :: Dividing A String Into Substrings With Three Elements In C++

Jun 23, 2011

im trying to receive a string from user, then divide it into groups of strings with 3 elements only. meaning if input is:

12345 it should give 123 and 45
123456 it should give 123 and 456
1234567 it should give 123 and 456 and 7

anyway what happens based on my code is that it works fine with first two (when it has groups of 3 elements and 2 element, and also when it has groups of all 3 elements) but for the last case (when makes groups of 3 elements and 1 group of 1 element) it shouws as "123 456 7 D"!! meaning it adds one extra character to the last element out of no where!

here is my code:

Code:
#include <iostream>
#include <conio>
struct array
{

[Code]....

View 1 Replies View Related

Programming :: Get Number Of Elements In A Hash Of Arrays?

Dec 10, 2008

I have something like this:

$arr_hash{'produce'}{'veggies'}[0] = Broccoli
$arr_hash{'produce'}{'veggies'}[1] = Cauliflower
$arr_hash{'produce'}{'veggies'}[2] = Carrots

[code]...

View 2 Replies View Related

Programming :: Include Common Elements On Every Page?

May 16, 2010

I am trying to learn how to include common elements on every page. At first I made the mistake of calling it ssi but I do not think that is correct in php5. I downloaded phpb3 to look at and they are not doing it that way. they do it like this.
Code...

Problem is I can not find any articles that explain it. I even looked at the php manual and did not find it. Could someone explain this or point me in the right direction.

View 1 Replies View Related

Programming :: Perl: How To Do A Foreach For Elements In A Database

Jul 15, 2009

For Perl I need to understand a few things. It's unlikely that anyone will be able to give me direct answers but if they could point outI'm trying to hack down an existing script http://eoylpac.org/source/eoy.pl. What I need to be able to do (in a nut shell):1. Open a database2. Read the values for each uniq id and execute a subroutine for each of those values. (The subroutine already exists in the above file 'do_pdf').

View 5 Replies View Related

Programming :: Two Elements Inside A Form In HTML?

Sep 18, 2010

For a search box on my site, I want a textbox, which will let the user input the term to be searched for, and next to it I want a drop down list that'll have, for example, "Fruit" and "Vegetables" as categories to be searched within. How do I do the HTML for this? (so that the arguments to my search.php script will be eg. "search.php?text=apples&type=fruit" ? )

View 3 Replies View Related

Programming :: Converting A PHP Array Into An HTML Array?

Aug 9, 2009

I'm writing a PHP program. I've encountered a problem; in the following code I try to pass $_POST['delete'] which is an array as the value of a hidden input to some form, but it doesn't do so.there's something wrong with converting PHP array into HTML array. I'm sure that $_POST['delete'] is not null and is a real array.

echo '<input type="hidden" name="delete[]" value="'.$_POST['delete'].'" />';

View 4 Replies View Related

Programming :: How To Add Columns To Right Of GtkTreeView

Oct 24, 2010

How can I add columns to the right of GtkTreeView? How can I add the menu to the right of the window? How can I change the position of the icon in the GnomeMessageBox to the right of the dialog? And how can I change the arrange of the buttons from right to left in GnomeMessageBox? and position of the icon on the buttons in the GnomeMessageBox?

View 5 Replies View Related

Programming :: Separate Columns Using Sed?

Jul 1, 2010

I have a file that contains a couple of email addresses and I want to extract the usernames ( Letters before @ symbol ). How can I do that using sed/awk.

I know cut will work, but the current environment doesn't allow me to use cut command. I can use either awk or sed.

View 4 Replies View Related

Programming :: Access HTML Elements Via Javascript With Internal ID?

Mar 29, 2010

Is there some way to access HTML elements via javascript through some internal ID?

For instance, given a form like:

Code:
<form name="myForm">
<input type="text" />
<input type="text" />

[Code]....

I think I've seen some way to do this before but I'm not certain

View 4 Replies View Related

Programming :: Insert Elements Into A Combobox From A Database Using NETBEANS?

Apr 13, 2010

I'm trying to make a combo box which should have elements dynamically taken from a database. I've an Exam Table,and it has columns Sno,Ename,Month,year. i need the combobox to list to the elements that are present in Ename.

i read some things in the web and tried that out in the netbeans. it said to rightclick the combobox and set bind ->elements and bind->selecteditem. But i'm not sure how to set the binding expressions inorder to get the required list in the combobox.

View 1 Replies View Related

Programming :: When Parse A XML File - Should Rely On The Order Of Elements?

Feb 24, 2010

When I parse a XML file, should I rely on the order of elements?

For example say we have:

Should I rely on the above order?

Would the following still be valid:

I'm trying to find out if a well formed XML document should have an ordered structure, or if it's still valid XML if it has no order.

View 7 Replies View Related

Programming :: Extracting Columns In Particular Order?

Jun 9, 2010

Say I have a text file with10 columns. I need to reorder them based on a list of column numbers that will reorder them.

My problem is this:

If I want to cut out 5 columns (columns 1,2,3,9,10) in the order 1,10,2,9,3 then I have tried using:

Code: cut -f1,10,2,9,3 my_file.txt > reordered_file.txt But this just extracts the columns in order as if I used:

Code: cut -f1,2,3,9,10 my_file.txt > reordered_file.txt How can I cut these columns and place them into the new file in the order I specify?

While this might seem quite trivial, I will actually need to do this for a file containing ~14000 columns with ~12000 columns that I need to extract in a particular order.

View 2 Replies View Related

Programming :: Script To Compare 2 Columns ?

Mar 1, 2011

Actually build a script which can monitor the "DateTimeHourMinute" in a data file.

I wanted to compare the "DateTimeHourMinute" from the 2nd column against "DateTimeHourMinute" on the 3rd column which located in the same line.

Below is the data sample:

View 7 Replies View Related

Programming :: AWK - Combining Multiple Columns?

Feb 23, 2010

I have a folder with only 24 files named <number>.dat (i.e. 4.dat, 6.dat and so on) where <number> is between 0 and 256. Each file has just two columns of data and nothing else.

I'm trying to combine all the second columns ($2) together. I've been fiddling around with getline and so far have

awk '{ getline ln < "6.dat" ; print ln" "$2 }' 4.dat

which takes file 4.dat and adds $2 from 6.dat, but I want a single command to take each $2 from every file and add them to (for example) 4.dat (having $1 from 4.dat is no problem). A command that takes every file in the folder and grabs $2 and places them in a common file would be ideal. Frankly I can work around if you combine both columns from every file.

View 5 Replies View Related

Programming :: Convert Columns To Rows

Aug 10, 2009

I bet this is a Perl one-liner (or very simple python script).I have a tab separated files in which each row looks like:Unique_Eight_Character_Sequence [3 tabs] data1~moredata1~moredata1 [3 tabs] data2~ moredata2~ moredata2 ... dataN~.The output file should have each column converted into a row (with the unique character sequence copied in for the first column), and then each "~" replaced by a comma.

View 14 Replies View Related

Programming :: Filtering Based On Columns?

Nov 13, 2010

Is there any way to filter the output of a command based on the values on the output columns. For example i execute du -h on directory with many files. Now I want to filter the output based on the size (i.e. M or G or K ). The filtered o/p should contain only M(megabytes) or G(gigabytes) and also all columns.

20K ./fload/temp/20000101/Pam
15K ./fload/temp/20000101/NAVEX
29K ./fload/temp/20000101/Avenge

[code]....

View 3 Replies View Related

Programming :: Printing 2 Arrays To 2 Columns?

Jun 16, 2010

I have a Perl script that has two arrays - they are related. I would like to print out the contents into two columns next to each other.

#!/usr/bin/perl
open(PINGFILE, </home/casper/pingdata.txt") or die " can not open file ";
my @totalfile=<PINGFILE>;
foreach $string(@totalfile) {
if ($string =~ m/(^1sping)(?=.*max))/) {
push(usecstring,"$string");

[Code]...

View 2 Replies View Related

Programming :: How Break Points Work In GDB

Mar 24, 2011

I want to know that how the break points and watch points work in the GDB. I know the GDB works on symbol table. But would like to know more details of it. How watch points differ from break points.

View 3 Replies View Related

Programming :: Javascript Line Break

Feb 25, 2011

I have some variables that are loaded from mysql - in mysql, the line breaks are not indicated by ' or '<br>' or anything -they are just line breaks. the variable is loaded into javascript and then inserted into a <pre> element. the line breaks are not showing up.

pre1 = pre1.replace(/>/g,">"); - this works well, naturally. but how do i get those line breaks to show up as line breaks in a browser?

I've tried many variations of something like:

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved