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


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 :: 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 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

Ubuntu :: Intramfs Prompts After Shuffling HDD's?

Feb 17, 2010

Wonder if someone out there can help me.

First, a small back-story. I upgraded my Mythbox to 9.10 last year, and as a backup path, I left the original HDD (sda) intact, and chucked a spare drive (sdc) in for the install. I just changed the boot order in the BIOS to boot from the spare drive, and all my data (/var/lib/mythtv/) is on a separate drive (sdb). The original drive is redundant, I just didn't get round to pulling it.

Now, I got a new 1TB drive today, transferred all my data onto it and swapped it for the old data drive, and at the same time pulled the unused old install drive. So I just have the new 9.10 (spare) install drive, and the new drive.

I changed my fstab with the correct UUID's of the drives, but at boot, I get 'gave up waiting for root filesystem on sdc1' and the intramfs prompt. Listing the drives by UUID, I have sda(1&2) and sdb(1&2).

I can get the system bootable again by putting the unused old install drive back, so that I have an sdc, but this is far from ideal, as I have a drive spinning away nearly 24/7 that is not needed.

Now, I thought that using UUID's got away from the whole sda/sdb/hda ... business, but it seems that the kernel is still looking for sdc1 to boot off.

FWIW, my fstab: The old and new data drives, and the boot drive are there, the redundant drive doesn't have an entry.
Code:
mythbox@mythbox-desktop:/$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
code....

So I guess I need to point grub to the correct location. Now I know I'm not supposed to edit grub.cfg, but I can't see how I can successfully boot the system in a state where running update-grub will pull the correct drive in. My thinking is that what I need to do is edit the

Code:
linux/boot/vmlinuz-2.6.31-14-generic root=/dev/sdc1 ro quiet splash hpet=disable
line to read
Code:
linux/boot/vmlinuz-2.6.31-14-generic root=UUID=4a5599f5-d409-42b5-a74f-0c689f15d73d ro quiet splash hpet=disable
Shutdown, pull the redundant drive, boot (hopefully anyway), then run update-grub.

View 9 Replies View Related

General :: Convert Full-disk RAID5 Array To Partition-based Array?

Dec 23, 2010

I have a RAID 5 array, md0, with three full-disk (non-partitioned) members, sdb, sdc, and sdd. My computer will hang during the AHCI BIOS if AHCI is enabled instead of IDE, if these drives are plugged in. I believe it may be because I'm using the whole disk, and the AHCI BIOS expects an MBR to be on the drive (I don't know why it would care).

Is there a way to convert the array to use members sdb1, sdc1 and sdd1, partitioned MBR with 0xFD RAID partitions?

View 1 Replies View Related

General :: Bash: Calculating In Array And Storing Result In Array?

Dec 2, 2010

I have an array called arrayini which stores numbers. I want to take log to the base 2 of each of the numbers in that array and put it in file called result. I've used the following code to do it.

Code:

size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
echo "scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >result

It works fine but its taking pretty long to calculate since I've got about 230,000 items in the array. So I decided to store the result into an array hoping that it'd be faster. I tried the following code. arrayresult is where I try and store the result. The code doesn't work because of the second last line.

Code:

unset arrayresult
size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
arrayresult[$i]="scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >FILE2

There is a syntax error clearly.

View 6 Replies View Related

General :: Get Elements From List In Bash?

Mar 19, 2010

Here is a LIST:

List = "abcd 1234 jvm something"

How to get the second element "1234" without looping all the list?

View 2 Replies View Related

General :: How To Modify Some Particular Elements Of Column

Feb 22, 2010

It is very important for my research work. For example mydata.txt:
id type x y z
1 6 0.474611 0.227223 0.583947
2 4 0.422894 0.22726 0.536791
3 5 0.448963 0.200148 0.560336
4 3 0.386478 0.207721 0.515293
5 6 0.371617 0.22361 0.582206
6 4 0.32123 0.222999 0.534782

How to change second column (type) whose values are 4 and 3 to value 1, so that mydata.text file become:
id type x y z
1 6 0.474611 0.227223 0.583947
2 1 0.422894 0.22726 0.536791
3 5 0.448963 0.200148 0.560336
4 1 0.386478 0.207721 0.515293
5 6 0.371617 0.22361 0.582206
6 1 0.32123 0.222999 0.534782

View 6 Replies View Related

General :: When Running Echinus Can Scrollbars And Similar Window Elements Be Skinned?

Apr 22, 2011

I see on the website URl...screenshots number 5 and 6 -- what is used to to get these style of scrollbars? When I launch Opera I get a very ugly scrollbar that does not fit the look of the wm whatsoever.

View 1 Replies View Related

General :: 'make Menuconfig' To Make These Files Modules Rather Than Compiled Elements?

Feb 25, 2011

I need to modify fs/open.c and fs/read_write.c to make my modifications. I cannot find any options in 'make menuconfig' to make these files modules rather than compiled elements. I'm thinking these cannot be modules because the file system won't work without open.c and read_write.c. Is this correct - I cannot compile fs/open.c and fs/read_write.c as modules, only as compiled elements? Or, is there some way for a module to overwrite these routines when the module is installed and re-enable the routines when the module is removed?

View 3 Replies View Related

Software :: Bash - Indirect Array Reference To Array With Values Containing Spaces?

Jun 4, 2010

This _almost_ works. I just can't quite get it to honor the spaces.

Code:

#!/bin/bash
profiles=(
PROFILE_ONE
)
PROFILE_ONE=(setting1 "setting number 2")

[code].....

View 9 Replies View Related

Ubuntu Servers :: Creation Of RAID-0 Array In Disk Utility Resulting In Smaller Than Expected Array?

Sep 27, 2010

I have a NETGEAR ReadyNAS NV+ with four 1TB drives in a RAID-5 array. This is our primary file storage. This has previously been backed up to a hardware RAID-0 array directly attached to our Windows server. The capacity of this backup array is no longer sufficient. So the plan was, take a bunch of 200GB to 320GB drives (And a 750) I had kicking around, chuck them in a couple of old SCSI drive enclosures I have collecting dust, attach them via IDA/SATA-to-USB adaptors to a USB hub, attach that to the server, create a JBOD array spanning the disks, and back up the NAS to that. Performance is not an issue as this is just to be used for backup, with the idea being as near to zero cost as possible (Spend so far = NZ$100�ish).

The first hurdle I struck was Windows not supporting Dynamic Disks on USB drives (Required to create a spanned volume). At first I resisted using another machine (i.e. a machine running Ubuntu) as I didn't want to dedicate a piece of hardware to backing up the NAS. I then decided it would be acceptable to do this via a VM, which is what I've done.So I have 10.04 running under VMWare Server 2.0.2 under Windows Server 2008 R2. The disks are all presented to the VM. I wasn't sure if I was going to end up creating the array under LVM or something else, but I noticed Disk Utility has an option to create an array, so I tried that. When I add two 250GB drives, the array size is 500GB. When I then add a 160GB drive, the array size drops to 480GB. Huh? If I keep adding disks (Regardless of order) the final array size comes out at 1.8 TB, as per the attached screenshot. Now with the following drives, I expected something more like:

160 + 250 + 250+ 750 + 250 +200 + 200 + 250 + 320 + 250 + 320 = 3.2TB

Am I missing something or making a false assumption somewhere?

View 4 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 :: 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 :: 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

Ubuntu :: How To Get Smaller UI Elements

Sep 14, 2010

I cannot reduce the size of all icons, context menu items etc.For example, I need to do some minor programming for the university. And this is how Eclipse Aptana RadRails look on a netbook: [URL] UI takes up to 70% of screen space, and the IDE is barely usable now. On Windows it looks like [URL] I tried some gnome themes but they all are of the same size. Is there any way how I can reduce the size at least for the whole system (nautilus etc)? If there is a way how I can apply 'nanoized' theming for desired applications only.

View 4 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 :: Filling 2D Array With 1D Array In C?

May 26, 2010

(I am using vector() and matrix() functions from "Numerical recipes in C".)There are 100 numbers to be stored in 2D array of 10 rows and 10 columns.100 numbers are stored in a 1D array.I get "segmentation fault" at the line indicated in the segment of my code below:

Code:

:
:
#define size 100
#define nl 1

[code]....

View 12 Replies View Related

Debian :: Missing UI Elements After Netinstall

May 1, 2016

Every single theme has at least one or more broken UI element. In Arc, I'm missing highlighting in the context menu, and in Numix, some application's backgrounds are just completely black. All of these themes don't give me a urlbar. I'm also missing a lot of boxes. There is no box around the word "submit" in reddit, and neither around "cancel". If you go into the search bar, I'm missing the checkbox for "limit my search to /r/...". I know these themes work, because I had them working in my last install of Debian. Except, last time I used the XFCE iso instead of the netinst. Even default themes, like Raleigh, are not working correctly. I installed all the necessary packages like the gtk2 murrine engine, but if the default themes aren't working then something is definitely missing.

View 0 Replies View Related

Ubuntu :: Panel Elements Move Around?

Apr 8, 2010

Everytime i restart the panel elements are shifted and i have to rearrange them all over again:this is the usual arrangement:and this is what i get after every restart:

View 2 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

Debian :: Nvidia All Video Has Strange Hue Around Certain Elements

Nov 28, 2015

First impressions I really like Debian, been running a server with it for a while and just last week switched to it on my main workstation.

I have only had one problem with video. I have a Geforce 210 with 1gb (1024x768 resolution) of ram and the proprietary Nvidia drivers installed from a repo. Thing is, in all video whether flash in my browser or movies in vlc, mpv, and mplayer, I have these weird overlays that scan over the video, especially in scenes where the camera zooms in, long distance shots seem unaffected.

Also, almost every video I start whether flash or movie file, I get a flash of a green bar at the bottom of the screen very quickly and barley noticeable.

Now I know thats a rough description so I attached two screen shots (link at bottom of post), the affected area is circled in red on one, also I have attached a png of a similar image that may be more enlightening.

Notice the quality of the second screen shot, especially around Will Ferrell's head, and the greenish yellow line leading down his shoulder and arm. The general quality seems terrible. The film is in 720p and looks great in Mac.

I had the proprietary drivers installed in Slackware 14.1 and Mac OS 10.10.5(Nvidia Web Drivers) on this system, with this card and did not have this problem.

I'm in gnome latest version.

01:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
Subsystem: Device 196e:082e
Kernel driver in use: nvidia
01:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)
Subsystem: Device 196e:082e
Kernel driver in use: snd_hda_intel

[URL] ....

Switched Nouveau same result....

View 1 Replies View Related

Ubuntu :: Run Adobe Photoshop And Premiere Elements?

Jun 25, 2010

I'm ready to format my drive and try Ununtu, but I need to make sure the operating system will run the latest version of these two programs.

View 6 Replies View Related

Ubuntu :: Weird Lines Around Elements In Gnome 3?

May 13, 2011

i didn't know which section to put this in, but since it is a question about gnome3, i figured this was the best place. every theme i use besides the default adwaita theme seems to have these red outlines around every element, as seen in the attachment.

View 1 Replies View Related

Red Hat / Fedora :: Elements Of Structure Perl Language

Aug 9, 2010

What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?

View 2 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







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