Programming :: Create An Array That Will Allow To Print A List After Selection?

Oct 18, 2010

I am trying to create an array that will allow me to print a list after selection such as:

1) Location A
2) Location B
3) Location C

Would you like to print selected locations? Print I have no idea how to approach this problem and don't know whether Perl, Bash or shell script would be the most useful in this particular situation.

View 5 Replies


ADVERTISEMENT

Programming :: Create A Multi Selection Menu?

Sep 18, 2010

I am creating a program that need menu with multi selection option for shell (CLI).I am using of Bash scripts.something that will look like that:

Menu:
[ ] option 1
[x] option 2

[code]...

View 2 Replies View Related

Programming :: Print A Range Of A Char Array Without A For Loop?

Nov 6, 2010

Program in CSay I have a char array of 1024 bytes called buf1.But I only want to print the chars in index 0 up to index 30. I know I could do this with a for loop. But is there any other way? What about maybe storing from 31-1024 to another char array say buf2 with strcpy and somehow popping 31+ out of the buf1 char array?

View 3 Replies View Related

Programming :: List String Indexes From An Array In Ksh?

Jan 24, 2011

How can I list string indexes from an array in ksh ?

View 4 Replies View Related

Programming :: Split String Into An Array/list Of Lines In C++?

Jun 4, 2010

How can i split a string like this,

Code:
This is my first line.
This is my second line.
This is my third line.
into,

Code:
"This is my first line.", "This is my second line.", "This is my third line."
in C++.

i.e. split the code at every new line

View 11 Replies View Related

Programming :: Reading Lines To An Array And Generate Dynamic Zenity List?

May 18, 2011

explanation what I want to do exactly:I have a textfile which looks for instance like this:

file.txt:
...
something=else to do

[code]....

View 14 Replies View Related

Programming :: Create A Small Array Of 3x3 Arrays?

Jul 12, 2009

I'm trying to figure how to create an small array of 3x3 arrays such I can do

Code:

SUM1(i) = SUM1(i) + SUM2

where i goes from 1 to 8 and SUM2 is a 3x3 array.

View 2 Replies View Related

Programming :: Unable To Dynamically Create An Array Of Params For Execv In C

Jan 6, 2011

I haven't programmed in C for a while, so I am trying to remember certain aspects of syntax. I have a program that will fork and exec other programs. Those programs will be specified on the command line as follows:

./main "prog1 arg arg ..." "prog2 arg arg ..."

Here is the main snippet:

int countChar(char* s, char c)
{ int cnt = 0;
int len = strlen(s);
for(int i = 0; i < len; i++)

[code]....

The highlighted line is the problem. I get this error:

dualstarter.cpp:58: error: initializer fails to determine size of 'params'.

Right now I am thinking of creating an array with the specified size and simply copying the required string into it, but it just seems like there is an easier way.

View 9 Replies View Related

Programming :: Awk+print, Create File If Not Exixt?

May 15, 2011

I having the following awk line in a script, is it possible to modify the script so that it create a the directory if it dosnt exist (similar to mkdir -p) awk -v datum="$DATUM" -v workingdir="$workingdir" '{ sub("\[.*","",$5); print > workingdir"/"datum "/" $5;}' $1

View 1 Replies View Related

Programming :: Create Cvs From List Text File

Dec 21, 2010

I have a file with 5000 lines. it is a list of books authors, series and titles. all lines start with the author names, than there is a dash (-) than the series name, a dash again and the title of the book.

The problem I encounter is that sometime there is a series, sometime not, and as I try to enter this list in a database, I wanted to create a cvs file to import into mysql.

ex:

The best would be to be able to add in the second line, a "space dash space" just after the author name, but how to make sure it does not do it to the first line as well.

If I could separate all line with 2 dash, (grep ?) then I would be able to do a simple replace, and change the single dash into two.

View 2 Replies View Related

Programming :: Create A Link List Is Giving An Error

Sep 23, 2010

I wrote a program to create a link list

Code:
#include <stdio.h>
#include <stdlib.h>
struct node {

[Code].....

View 4 Replies View Related

Programming :: Python: Dynamically Create A List Within A Dictionary?

Jul 9, 2011

how to dynamically create a list within a dictionary using Python.

Code:
dates = defaultdict(int)
array = []
...
dates[m.group(3)] = array.append(date)
dates[m.group(3)] = [array.append(date)]
dates[m.group(3)].append(date)

None of the above works and I've tried everything I can think of.

View 3 Replies View Related

Programming :: Create A Script That Returns A List Of The Users Who Have Never Changed Their Password From /etc/shadow

May 17, 2011

I need to create a script that returns a list of the users who have never changed their password from /etc/shadow. As I know on linux there is a command "chage" used for find last password change.

View 2 Replies View Related

Ubuntu :: Pae Kernel - Selection From List Appears After Grub Load?

Aug 23, 2010

I am currently running 9.10 ubuntu (gnome). I have a dual core intel chip at 3.00 ghz. My mobo is an ASUS P5ND2-SLI. My mobo will support up to 8gb of ram. Now, as we all know, 32-bit os/kernel will only support like 3.2gb, and 64-bit like 4gb. I'd like to install a pae kernel so I can get the most from my mobo, but honestly, I don't have a clue where to start looking for a pae kernel. I'd like to be able to select it from the list that already appears after the grub loads, and if I like it, be able to remove the rest from the list, or just make it default.

Question, in CPU-G, it says my architecture is i686. I don't know if that's the os/distro, or the kernel itself. it also lists the GCC version as 4.4.1 and Xorg as 1.6.4. my current kernel is Linux 2.6.31-22-generic. Again, I'm trying to find a pae kernel, but I don't know if my os/distro will make a difference, if the architecture is the kernel or os itself. I am still fairly new to ubuntu, and I must say, I've made the switch completely from windows.. which blows...

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

Debian Installation :: On IMac: Screen Goes All Black When Chose In Grub-selection List

May 20, 2011

I have installed Debian a few times now (and other distro's), so I'm fairly used to installing linux. I'm not used to installing it on Apple hardware (back in 2009 on my laptop I had some issues that were solved rather quickly, but that's about it). Now I'm installing Debian Squeeze on a new (well, bought today, but it is the previous model: iMac 11,2) desktop iMac.

Installing goes well (resizing partition, rEFIt, booting Debian 6.0.1a netinstall CD, installing packages etc.) I followed a tutorial [URL] to install grub explicitly with force after installing and running gptsync. Everything went according to the tutorial and I rebooted to be welcomed by rEFIt and then grub: perfect!

BUT when I chose Debian in the grub-selection list, I only see a few lines of starting the kernel, and then my screen goes all black. A few seconds later I hear a sound, and iirc it's the sound of gdm prompting to select a user. I cannot switch to a TTY and I have to use the power-button to shut the system down.

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

Programming :: HUGE Files - Compare A List Of Patterns From One File And Grep Them Against Another File And Print Out Only The Unique Patterns?

Aug 13, 2010

I am trying to compare a list of patterns from one file and grep them against another file and print out only the unique patterns. Unfortunately these files are so large that they have yet to run to completion. Here's the command that I used:

Code: grep -L -f file_one.txt file_two.txt > output.output Here's some example data:

Code:
>FQ4HLCS01BMR4N
>FQ4HLCS01BZNV6
>FQ4HLCS01B40PB
>FQ4HLCS01BT43K
>FQ4HLCS01CB736
>FQ4HLCS01BU3UM
>FQ4HLCS01BBIFQ

how to increase efficiency or use another command?

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

Software :: Selection Buffer Sending Text Before Completing Selection?

Jun 18, 2010

How can I change the behavior of the selection buffer or a program that uses it ( I have xclip) to not send me text until the mouse button is released while clicking and dragging? This causes havok in the software I'm developing that tries to make use of the selection buffer. I need the full selection, not bits more bits more bits and then the full selection.EDIT: I cannot listen for mouse events such as button release outside of the GUI of my program.

View 2 Replies View Related

Programming :: Bash Array Add Function Example Using Indirect Array Reference As Function Argument?

Jun 20, 2010

I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.

#!/bin/bash
addelementtoarray()
{
local arrayname=$1

[code]....

View 10 Replies View Related

General :: Copying Directory List Into Array Then Accessing It

Jul 22, 2010

What I'm trying to do: write a script that will list all the directories in a given location. Ask the user to enter a number corresponding to the location of the directory in the list, and then moving into that directory.

I have written a script to do this, but it only works when I run it as: <user>$program_name and the script runs in a sub-shell. But, when it is run in a sub-shell, the changes made by the script go away after the script ends.

When I run it as:
<user>$. program_name
and the script runs in the current source shell, I get an error:
bash: cd: /home/dev/Project/dirname: No such file of directory

Code:
IFS='
' read -d '' -a ArrName < <(ls ~/Projects)
read filenumber
cd $HOME/Projects/${ArrName[$filenumber]}

View 6 Replies View Related

Software :: Store (and/or) Print A List For Later Use?

Feb 8, 2010

I am running Debian on a 4 years old pentium machine. I have recently switched from Windows to Linux, so I'm still preferring the graphical user interface (Gnome is very good for me).

Now my problem: My harddisk becomes too small for the data I am storing and processing (pics, music, videos), and I would like to fit a larger one. So afterwards, I will need to reinstall debian and all the software I now have in it. How can I store a list of the currently installed software? (I can view it with the gnome apt software manager (also with synaptic), but I did not find a way how to store or print it).

Or, could I possibly save the whole system on an external harddisk and restore from that afterwards, as I do with the data?

View 10 Replies View Related

Programming :: Xdialog - How To Save Checklist Selection

Jan 31, 2011

I am creating an script with Xdialog.The checklist option is confusing me a litte. Can someone tell me how to save the checklist states so they can be used in a script? As an example:

Code:

Xdialog --checklist "Choose toppings:" 10 40 3
1 Cheese on
2 "Tomato Sauce" on
3 Anchovies off

I would then like to put these values through if/else statements to perform different things with respect to the user selection.

View 2 Replies View Related

Ubuntu Multimedia :: Print List Of Music

Sep 19, 2010

I want to make a list of music based on tags. My girlfriend wants to go through my list of music to choose what she wants for a trip we're taking. However, she's not able to be in front of my computer, so I need to make a list of music that she can go through. A flat html file would be fine, but I'm sure other formats would work too. And I need it to be based on metadata, not the filenames (I could easily print out a list of files, but metadata would be much better). I've tried some tag editors, such as kid3 and easytag, but none will let you export a list like this. I suppose I could just make a playlist then remove all other unneeded data.

View 1 Replies View Related

General :: Print List Of All Users In The Container

Apr 7, 2011

We are using OES 10.00 and would like ot print list of all users in the container.

View 3 Replies View Related

Programming :: MySQL - Get A Random Selection Of An Ordered Data Set

Jan 11, 2011

Given the following data structure: Quote:

[Code]...

What is the minimum possible MySQL query to get a random data selection that includes each Index number only once and ordered ascending. The maximum index number is known. For example running the query should get the following data: 01, 06, 07, 02. Running the query again, you may get the same data or another possible combination like: 01, 05, 07, 04. Of course you could run a loop for 1 to max_index and process a random ordered data selection until the next index number is found. But I think this will result in too many database access. Also you could run max_index queries to get all IDs that correspond to the given index and randomly select one ID for each index.

View 3 Replies View Related

Programming :: Incorrect Selection Of The C Library With Build Root?

Aug 1, 2010

I'm trying to use buildroot to cross compile some libraries for me. To do so I've set up build root to point to my working tool chain in the menuconfig.All seems fine however when I try to make (buildroot) I get the following error

rm -rf /root/buildroot-2010.05/output/build/buildroot-config
mkdir -p /root/buildroot-2010.05/output/build
cp -dpRf package/config/buildroot-config /root/buildroot-2010.05/output/build/buildroot-config
Checking external toolchain settings
Incorrect selection of the C library
make: *** [/root/buildroot-2010.05/output/stamps/ext-toolchain-installed] Error 255

I know it's pointing to the correct files and gcc as any wrong paths are reported in make menuconfig.

View 1 Replies View Related

Programming :: List 4 Names From Users List And Output Them To Fbusers In Numbered Ascending Order?

Feb 2, 2010

How would I list 4 users ID numbered 10, 11, 12 and 13 from my users list and output them to a file busers where their names are numbered by ascending order? How would I accomplish that on a one line command?

View 4 Replies View Related







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