- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
29 Posted Topics
sed - need to replace only the chars or symbol after 1st and 2nd dot(.) with "int1" and "int2" respectively. Here is what I have tried but it replaces the strings in other lines. End result should look like - A.**int1**.**int2**.any.string.here sed -e 's/*/int1/' -e 's/*/int2/' -e 's/ABCD/int1/' filename A.*.*.ABCD.DEFG.HIJK …
How do you padd textboxes in cgi. I have 2 colums of textboxes but would like to more spacing in column and rows. print $q->Tr( $q->td('Semester:'), $q->td( $q->checkbox_group( -name => 'semester', -values => ['Spring 2012', 'Summer 2012', 'Fall 2013 ', 'Spring 2013', 'Summer 2013', 'Fall 2013', 'Spring 2014', 'Summer 2014'], …
Dont know much PHP but logic for regex is similar; use \w+ - for one or more whitespaces (q|c) - letter q or c so squat/scuat/scaut/sqaut with ending whitespace will be. you get the idea. s(q|c)(a|u)t(\w+)
I.*I need to validate if characters a-z are entered it will reprompt*. Below is a snippet of my script wh While [true] do mainMenu # menu function read $opt # read option from menu if [ $opt -eq 0 ]; then exit elif [ $opt -gt 4 -o $choice -lt …
for multiple scroll_list I used code below. [CODE]print scrolling_list(-name=>'services', -values=>\@field3, -multiple=>'true', -size=>25);[/CODE] How can I fix for a maximum of 3 selects since I have more than 50 scrolls.
How do i match "00:04" and "4+21:08" which is ("days+hrs:mins" and "hrs:mins") in a file. I would like to combine regex patterns so I can calculate running time. This is what i got for regex but does not match "00:04" --> (\d\d)(\:)(\d\d) [CODE]if($string = ~ m/(\d)(\+)(\d\d)(\:)(\d\d)/) { #code goes here …
Errors when compiling. its seem to be complaining about line 52 and i do not get output of second file.(data.words) strarray[numStrings++]=strdup(word); $ gcc -Wall -ansi prt.c -o prt In function ‘main’: warning: implicit declaration of function ‘strdup’ warning: assignment makes pointer from integer without a cast [CODE]#include <stdio.h> #include <stdlib.h> …
How do I read and print just n(10) lines in a file and not whole file. [CODE]#include<stdio.h> #include<string.h> int main() { char line[50]; FILE *datafile; datafile = fopen("/data3", "r"); while(fgets(line,sizeof line,datafile)!=NULL) printf(" %s\n", line); fclose(datafile); return 0; }[/CODE]
cant get this to display on webpage. Apache is setup correctly. Getting error "[COLOR="Green"]malformed header from script. Bad header=04/19/2010: date.pl[/COLOR]" where am i going wrong? [CODE]#!/usr/bin/perl use strict; use warnings; use POSIX qw(strftime); my $cur_time = strftime "%a %b %e %H:%M:%S %Y", localtime; print "$cur_time\n"; open PS, "/bin/netstat -nra 2>&1|" …
Can you execute a ksh script within javascript? Inside my js function I have window.open("http://myhomepage.com:12345/Home/bin/ksh/" "Page Name", width=470,height=452"); ksh script should return output which the js function should display.
cant figure out why summaryCounter wont increment?? [CODE] if (source == calculateButton) { int summaryCounter = 1; double payment = Double.parseDouble(paymentTextField.getText()); double rate = Double.parseDouble(rateTextField.getText()); int years = (Integer)yearsComboBox.getSelectedItem(); DecimalFormat currency = new DecimalFormat(" ##,##0.00"); double futureValue; String s; int i; futureValueListModel.clear(); System.out.printf("\n Investment Summary Option %d \n Monthly Payment%,10.2f\n …
need this to change to random colors every .8 secs. compiles ok, but not getting wanted results. cant figure out where i am wrong? i get the applet viewer window with a black square but no color change. Here is the .html file <applet code = ColorChange .class width = …
How do I reinitialize array to null or zero when reprompted to renter data. Tried this but still computes average for previous entry. Student[] students1 = new Student[studentCount]; here is a snippet of code [CODE]float totalscore = 0.0f; boolean isValid = false; String lastName = ""; String firstName = ""; …
java float example float f1 = 5.5f; float f2 = 5.4f; how would you initialize a static float without using the wrapper class? static float f1 = 5.5f would that be correct?
I am migrating scripts from UNIX server to a Linux. In the perl script it calls rcp to transfer files. It worked ok in UNIX but not in Linux, which has scp, I dont want to do scp now as this is a temporary Linux Box I am using. I …
how do i increment the category book? eventually i will display it in summary *************** Summary Books 3. [CODE]public class ProductDB { public static String[] inventory = {" java", "jsps", "mcb2", "txtp", "sgtp", "tgif", "tcby", "myob"}; public static Product getProduct(String productCode) { Product p = null; if (productCode.equalsIgnoreCase("java") || productCode.equalsIgnoreCase("jsps") …
getting error when compiling. "java:60: non-static variable inventory cannot be referenced from a static context for (String show : ProductDB.inventory)" the showCodes class has to public static void. Here is code [CODE]import java.util.*; import java.text.*; public class ProductApp { public static void main(String args[]) { // display a weclome message …
[ICODE]while getopts htn: OPTION do case ${OPTION} in t) LIST='john mike smith' ;; n) LIST='rob peter joe' ;; h|*) show_usage exit 0 ;; esac done shift $(($OPTIND - 1)) args=$*[/ICODE] above is a snippet of code. i would like to use more than one character in my options e.g fname …
I have setup in .profile my login prompt as: PS1='${HOSTNAME}/${PWD}> how do I get the prompt to highlight so everytime i log in i see whatever i set my PS1 to highlighted.?
python script reading config file and then zipping files after X days from directories. dir contains dynamic files. i have specified the extension and the "startswith" in the config. problem i have is it [B]zips up everything[/B]. (if i can get this work will add a delete too). i also …
need to read the config file and then zip files in path. dont get any errors but files not zipping [ICODE]# config file [clean1] path = C:/Project/Log1 action=zip [clean2] path = C:/Project/Log2 action = zip #zip.py import zipfile, os, time, sys, ConfigParser, zlib def zip_fh(): zip = zipfile.ZipFile('%s.zip' % (path), …
[ICODE]trying to diff new files in a dir cd ${PWD} for line in $(ls *.new) do # lists all new files and then 2nd variable strips the .new extension of the files echo ${line} ${line} | sed 's/\(.*\)..../\1/' diff ${line} ${line} | sed 's/\(.*\)..../\1/' # this doesnt seem to work …
>>> line = '2008-10-27 12:05:54........... >>> time = line.split(' ')[1].split('.')[0] >>> print time 12:05:54 i would like to add 45 or so minutes to the time i am parsing from a line i have tried print time.timedelta(minutes=45) Traceback (most recent call last): File "<pyshell#44>", line 1, in <module> print time.timedelta(minutes=45) …
i have a python script and would like to know how to email the output of the script in python. i can do it from the command line(kshell) with in *nix but would like something like this in the script. somescript.py; echo "test" | mailx [email][email protected][/email]
display output on one line. this is a exerpt from my kshell script cat <filename> |egrep -v Pattern1|egrep -v Pattern2|egrep -v Pattern3 |egrep -v Pattern3 which displays Name=john, Age=24, Occupation=Sales Name=mike, Age=34, Occupation=Unemployed Name=mike, Age=34, Occupation=Unemployed Name=mike, Age=34, Occupation=Unemployed would like to get em all on one line with or …
i can write to the file with no issues, but cant read. i have defined the file to append so as not to overwrite data. then i write to it [B]log_file.writelines(lines)[/B] but the reading wont work?? [B]log_file.readlines(lines)[/B] and thought i could just use log_file = open('%s' % os.path.join(logfile_path, file), 'a+r')
here is the snippet data = ''2007-12-31 Name (mike) Age (34).....' gregorian = time.strftime(data.split(" ")[0]) print gregorian this gives me "2007-12-31" i need to convert the gregorian date in the variable to julian date. i tried this but it gives me the current date julian = time.strftime('%j', time.localtime())
excuse my ignorance, cant find it here in the forum. how do i strip the "|" or the pipe character from a line. i tried this. it splits but doesnt remove the "|" character. output = string.strip (line, '|') # strip the pipe character print output.split() # split output and …
i know how to create a dictionary but how do i search for a pattern in a file and then create a dictionary based on the search
The End.
axn