Programming :: Checking For Alphabets ?
Jan 25, 2010
Code:
I am trying to do a search to check if the input is using alphabets and nothing else.
I tried using [[:digit:]] and [[:alpha:]] but none seems to work
When i use digit, it read 22.k as alphabet and not as a wrong syntax.
For alpha , it does not allow me to input data which has spaces such as " hello world".
View 1 Replies
ADVERTISEMENT
Apr 8, 2010
I am having a huge problem checking the data I input to make sure it is correct. What I am trying to achieve is when I input a value, it will check if the input is all digits and if it is not, check to see if it contains certain alphabets. Thus for example, if I were to input in data such as "11A" , the program will then inform me "There is an important alphabet in the program." This would be my expected output. Here is the program I have wrote...
Code:
int test(string r ){ const int arraySize = 10;
char array2[arraySize2] ={'A','B','E','F','G','H','J','K','N','O','P','Q','R','S','T','U','W','Y','Z'};
for(int cntr = 0; cntr <r.length(); cntr++)
if(!isdigit(r[cntr])){ for(int new1 =0; new1<arraySize2;new1++)
for(int cntr1 = 0; cntr1 <r.length(); cntr1++)
if(array2[new1] == r[cntr1]){ return 2; //will return2 when it finds the same
// char in the array and the string r. } else{ return 3;
//will return 3 when there is a char
//in the string which isnt in the array
} } else { return 1; // will return 1 when string is all digit.
} int main() { string r = "11D"; test(r);
if(test(r) == 1) { cout << "ALL ARE DIGITS" << endl;
} if (test(r)== 2) {
cout << "There is an important alphabet in the program." << endl;
} if (test(r)== 3) { // testRoman(r);
cout << "There is an Alphabet in the String which is not in the Array" << endl;
} }
So, the problem I am facing is when I input in data such as 11 or A , the prog will come out the right input. But if I were to put in data such as "11A" , the output coming out will be "ALL ARE DIGITS". The problem which causes this seems to be in the return statement , as once as it finds the first char which is a digit, it will then return 1 and not continue checking the rest of the string. Is there a way I can stop or continue a loop if it has met the condition I stated? What I can do or any other way available for me to check my input?
View 4 Replies
View Related
Feb 19, 2011
how to handle non argument error while adding two alphabets using 'expr' (not bc).
View 1 Replies
View Related
Dec 17, 2010
@work we use Zabbix and also IP-audit for monitoring. Each day we have a list of outgoing SMTP-servers on our IPaudit server.
This script will take that list and check them all against a whole bunch of DNSBL's
# cat /usr/local/sbin/check_rbl
Code:
#!/bin/bash
#####################################################
# check_rbl
#####################################################
# 17-12-2010 by JP van Melis
#
[Code].....
View 15 Replies
View Related
Jul 9, 2010
I am facing some problems in font rendering issue for Urdu (South Asian language). Actually the alphabets are being displayed as, for example, "a p p l e" instead of "apple" - if you see this website, probably you will see the gaps in alphabets are making them difficult to read.
I have installed at least 10 different Urdu fonts but still no help, then I tried adding:
MOZ_DISABLE_PANGO="0" to /etc/environment but it also did not helped.
I am using OpenSuse 11.2, Firefox 3.5.10
View 7 Replies
View Related
Jan 18, 2010
what i am trying to do is to allow the user to key in data such as "23.23" or "24" , as it is the price of certain objectsHow am i able to design a check which will allow me to prevent users from typing in input such as "ab.21" or "rfrr" as this field is purely a numerical field. The problem i am facing is i tried using this search code.
Code:
echo "read this"
read this
[code]....
View 14 Replies
View Related
Sep 18, 2010
I am trying to figure out how i would go about finding out where system call is made and error checking is not done. I have code below, if somebody can point me in the right direction where system call is made but error checking is not done.Quote:
#include "shell.h"
#include <stdio.h>
#include <string.h>
[code]....
View 5 Replies
View Related
Nov 8, 2010
I need to allocate a % of the total system memory for a buffer but what is the best method to determine how much memory is in the system? So far the only way I have found is to get the pages of memory:
Code:
long sysconf(_SC_PHYS_PAGES)
Is that the only option?
View 2 Replies
View Related
Apr 20, 2010
I run my own icecast2 server. In the near future it looks like, I will be doing some shows. I would like to beable to change my link, so if I am broadcasting, to go to the stream if not pop a box for my schedule.Now from when I was checking to see if my webcam was up or not, i used this.does anyone know haw to change my code for this? I know when I'm not stream it generates a 404 error, in winamp (on windows)
View 3 Replies
View Related
Apr 11, 2010
i have to write a program which checks the information inside a text file to make sure it is all integers and then convert the integers to roman Numerals. My program seems to have a bit of a problem and im not sure where exactly the problem is....
Code:
#include<stdlib.h>
#include<string>
[code]....
View 8 Replies
View Related
May 11, 2010
How can i check what operating system, i am running on, at run time?Moreover, how can i retrieve that current state of process?
View 4 Replies
View Related
Jul 21, 2011
1. i need to check whether the oracle database is running or not if it is running it will run auto mount script.nohup /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbfs_client dbfs@xxxxx -o allow_other,direct_io /u01/app/oracle/DBFS/XXXXX < /home/oracle/passwd_dbfs.txt&nohup /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbfs_client dbfs@xxxxxx -o allow_other,direct_io /u01/app/oracle/DBFS/XXXXX < /home/oracle/passwd_dbfs.txt &2. For every 1 hour i need to check above mount points is mounted or not if it is not mounted it should be mounted.
View 3 Replies
View Related
Jul 17, 2010
It is possible to check who logged in with "who" command. If we are also logged in to that linux pc.
But, is there any possibility to check without our login?(not even by ssh)
Our logging in to find that pc, will be wasting the cpu resources. And may disturb the user who is working on the x-session.
View 7 Replies
View Related
Jan 19, 2010
I am trying to do a search for the certain books, and I am trying to make it case insensitive. what I have come up with so far is this :
Code:
Database.txt
RETARDED MONKEY:RACHEAL ABRAHAML:30:30:20
GOLD:FATIN:23.20:12:3
StUPiD:JERLYN:20:40:3
Code:
echo -n "Title: "
read Title
echo -n "Author:"
read Author
echo ""
valuecheck='grep -i "$Title" Database.txt | grep -i "$Author" | awk -F":" '{ print $1}''
echo $valuecheck
if [ $Title = $valuecheck ] ; then
echo "HOHOHO"
else
echo "too bad"
fi
The issue which I am having is that, when it does the search for the correct row to be inputted into valuecheck, it will input the value as written in the database, which is in Uppercase. For this case, if I type in stupid for $Title and jerlyn for $Author, it searches the correct row, but the awk will print "STUPID" into the variable as that is what is written in the database. So how can I make my if statement case insensitive? Currently it reads like this:
Code:
if [ $Title = $valuecheck ] ; then
which means
if [stupid = StUPiD ] ; then
How can I make the if statement it case insensitive to allow it to display "HOHOHO"
View 5 Replies
View Related
Apr 8, 2010
i am searching a string(with multiple words) in a file that file contains the string but words are separated with multiple white space.
ex: pattern to be matched "hello how are you" all single white space and file contains " hello how are you" variable white space between words
grep "pattern" file_in_which_to_search i am reading the "pattern" so i cannot modify the "pattern"
so my pattern match does not take place, though i want it to match.
View 3 Replies
View Related
Apr 22, 2010
I'm trying to figure out a simple script to go thought 500 Cisco devices to see if I can SSH to the device. Then display something like this:
10.0.0.1 Yes
10.0.0.2 No
10.0.0.3 No
I tried something like this:
Code:
ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no user@10.0.0.1 "echo 2>&1" && echo "Yes" || echo "No"
When tested the above line it replied No, even if I tried it on a Switch that does not have SSH configure.
View 8 Replies
View Related
Jan 20, 2009
To know the function on checking whether a character is ascii or unicode character. From the following [uRL]. The function IsTextUnicode is related to Windows VC++ library. I would like to know the library/function which provides such facility.
View 2 Replies
View Related
Jan 20, 2011
I have a bash script that checks for contents in a folder every 15 seconds and then acts on it's contents. This works great for the average size file however on very large files it starts acting on the file before it's completely written. Is there a facility in bash shell to get a file complete signal or such? here is trigger to launch a larger script.
Code:
#!/bin/sh
while true
do
$HOME/bin/hpgl.sh >/dev/null 2>&1 &
[code].....
View 10 Replies
View Related
Mar 28, 2009
I need to check whether a shell script variable contains non-zero numeric data to proceed. The variable should contain numeric values, but may in fact contain zeroes, blank space or nothing. So far, I have tried various combinations of:
Code:
if test $variable
then
if test $variable -gt 0
then
echo "good data exists"
else "no good data exists"
fi
fi
It partially works, but I get either "too many arguments" or "integer expression expected".
View 2 Replies
View Related
May 10, 2010
Sometimes at startup I get this message "Checking disk 1 of 1". Does that mean it's checking all partitions on the hd? After a bad shutdown there is no prompt for fsck to run and the system just boots up. In fstab I have both options set to "1" for the partition Ubuntu is on, all others set to "0". Any ideas on both?
View 3 Replies
View Related
Mar 3, 2010
I have a csv file like, having HDR segment and multiple LIN01 segment in each line:like
Here i want to split file in two, one having LIN01 segment which have LR at end, and one which have LF at end in LIN01 segment.
Is it possible to created awk or shell script for this?
View 3 Replies
View Related
Feb 26, 2010
I chose Mint 8 Fluxbox and have the iso. I cannot figure out how to check the iso for errors and the MD5 signature.I'm using Windohs XP so I tried to install MD5sum.exe. When I double click on it to run it all it does is flash and then nothing.When I type in the commands it says it can't find it or it can't read it or something.I may be typing the commands incorrectly. I'm just not understanding.I need to check the iso for errors but can't understand how to check it.
View 5 Replies
View Related
Apr 8, 2011
I'm trying to determine if IE is viewing my web page with the following HTML code:
Code:
But I don't see anything except "Test for IE". It is like the tests are being treated as comments? Do I need to turn something on in the server?
View 3 Replies
View Related
May 11, 2011
I can use spell check for English with vim, it works quite fine. But I don't succeed in doing it in another language. For example German spell checking: The command :mkspell ~/.vim/spell/de /usr/share/hunspell/de_DE.aff generates a de.utf-8.spl in the right folder, but vim marks every word as wrong when I activate it with
:setlocal spell spelllang=de
View 3 Replies
View Related
Aug 24, 2009
I will keep this short, I have a bad HDD possibly PCB damage due to heat.It's a laptop although I can remove it but in the mean time till then, is there any way I can pass an option to the kernel to stop scanning it.My OS mounted on a 8 gb sd card plus 4 gb flash drive.It takes 20 minutes for Fedora to bootup and Debian base Linux 30 to 35 minutes.
It wouldn't been a problem setting my laptop to sleep mode when I'm done and it was working fine but after a few updates, once I put my laptop to sleep I can't do it again in the same row. I have to shutdown. Lets say I tried anyway, system stop being responsive, while I let it continue to see it will become responsive again, it went on for an hour and half. It's annoying... So my question is, what option can tell the kernel to not scan my HDD.
View 3 Replies
View Related
May 31, 2010
I'm trying to get a program to compile with OpenGL support and it's saying that the headers are missing. But I think (or thought!) that I already had Open GL up and running. My suspicion is that I need to install the appropriate -devel files...but I just can't seem to find them. Furthermore, I don't want to tweak my system and install proprietary Nvidia drivers if things are already working just fine.
I have a Geforce 8300 GS in a i586 32bit Dell Inspiron 530. I'm trying to compile Cinelarra and keep getting:
Quote:
OpenGL 2.0 libraries missing Hardware acceleration using OpenGL 2.0 is disabled
Does anyone know which driver (ie: 96xx? 173xx?) I should be using for this? Where are these libraries? How can I find them and tell Cinelarra where to look?
And even more basically: How do I tell if OpenGL is working or not? Maybe I don't have them afterall..
View 6 Replies
View Related
Jul 19, 2010
I have just installed from the Live Cd (Fedora 13). So far so good except that I have just installed the updates (which has taken some time) .
The updater screen shows a full progress bar and next to the progress bar is this text " checking for libraries currently in use" this has been at least one hour showing the same thing, it hasn't changed (PC is still running OK). Does this mean I can safely quit and the updates will be OK or should I keep waiting for a reboot screen or updates success message ? Is this normal, if so how long does it usually take to complete?
View 1 Replies
View Related
Feb 5, 2010
I run Ubuntu 9.04 and was recently told by my university that my computer is massively port scanning the network. I am interesting in learning more about figuring out what is happening to stop it, but I am lost at where to begin. What steps should I take (or files to look at) to figure out what is happening?
View 3 Replies
View Related
May 22, 2011
I'm writing and correcting API documentation in Sphinx using reStructuredText. Does anyone know of a good spellchecker that will handle this format, or a bunch of Unix/Linux tools that will allow me to use Aspell with it?
View 1 Replies
View Related
Jan 30, 2010
Is it possible to have a drive dedicated to parity check for several other drives and not use a raid?
I want to keep all the drives separate, raids seem too dangerous.
View 2 Replies
View Related