Can someone review my code please
I wrote a program for converting miles to kilometers and kilometers to miles. I've got it working good now, but there's something I can't figure out. The way I have it now, after you convert something, if you choose not to make another conversion, it exits the program. I'd like to make it go back to the main menu rather than exiting. In other words; if I convert miles to kilometers and then decide I want to do a kilometers to miles conversion, I'd like a way to return to the main menu without exiting the program. I would really appreciate any suggestions. Also, please feel free to give me pointers on better ways to make my code in general. Go easy though, I know I'm a newb. I didn't get any help making this, so please be kind. I apologize if it's hard to read; I wrote it in Jgrasp and it formated it weird when I opened it with wordpad.
Thanks
Here's the code:
import java.util.*;
public class Squires1
Scanner keyboard = new Scanner(System.in);
//Allows for keyboard inputs
public void milesToKilometers()//Method for converting miles to kilometers
double kilometers;
String more;//Used in option for additional conversions
final double OFFSET = 0.62136994949495;//number for conversion
do
System.out.print( "Please tell me the number of miles: ");
//Prompts user for miles
double miles = keyboard.nextDouble();
kilometers = (miles / OFFSET);
//calculates number of kilometers
System.out.println(miles + " miles is equal to " + kilometers + " kilometers.");
System.out.println("Would you like to make another conversion?");
System.out.println("Yes or No");
more = keyboard.next();
if
(more.equalsIgnoreCase("Yes"))
System.out.println("One Moment Please");
else
System.out.println("Thanks for using my program.");
System.out.println("Please tell your friends.");
System.exit(0);//Exits program if additional conversions are not desired
}while (more.equalsIgnoreCase("Yes"));//Repeats method if yes is typed
public void kilometersToMiles()//Method for converting kilometers to miles
double miles;
String more;//Used in option for additional conversions
final double OFFSET = 0.62136994949495;//number for conversion
do
System.out.print( "Please tell me the number of kilometers: ");
double kilometers = keyboard.nextDouble();
miles = (kilometers * OFFSET);//Converts kilometers to miles
System.out.println(kilometers + " kilometers is equal to " + miles + " miles.");
System.out.println("Would you like to make another conversion?");
System.out.println("Yes or No");
more = keyboard.next();
if
(more.equalsIgnoreCase("Yes"))
System.out.println("One Moment Please");
else
System.out.println("Thanks for using my program.");
System.out.println("Please tell your friends.");
System.exit(0);//exits program if user types "no"
}while (more.equalsIgnoreCase("Yes"));//Repeats loop if user types "yes"
public static void main(String[] args)//main method
Squires1 s1 = new Squires1();//creates new instance of class
int option;
Scanner keyboard = new Scanner(System.in);//allows for keyboard inputs
System.out.println( "I can convert distances for you. Please tell me what you'd like to do.");
System.out.println( "1. Convert miles to kilometers ");
System.out.println( "2. Convert kilometers to miles ");
System.out.println( "3. End our session. ");
option = keyboard.nextInt();
if (option == 1)
s1.milesToKilometers();//runs milesToKilometers method
if (option == 2)
s1.kilometersToMiles();//runs kilometersToMiles method }
if (option == 3)
System.out.println("Thanks for using my program.");
System.out.println("Have a nice day.");
}while (option != 3);//Repeats main method as long as user doesn't type 3
}
Here's another instance of my code with tags.
import java.util.*;
public class Squires1
Scanner keyboard = new Scanner(System.in);
//Allows for keyboard inputs
public void milesToKilometers()//Method for converting miles to kilometers
double kilometers;
String more;//Used in option for additional conversions
final double OFFSET = 0.62136994949495;//number for conversion
do
System.out.print( "Please tell me the number of miles: ");
//Prompts user for miles
double miles = keyboard.nextDouble();
kilometers = (miles / OFFSET);
//calculates number of kilometers
System.out.println(miles + " miles is equal to " + kilometers + " kilometers.");
System.out.println("Would you like to make another conversion?");
System.out.println("Yes or No");
more = keyboard.next();
if
(more.equalsIgnoreCase("Yes"))
System.out.println("One Moment Please");
else
System.out.println("Thanks for using my program.");
System.out.println("Please tell your friends.");
System.exit(0);//Exits program if additional conversions are not desired
}while (more.equalsIgnoreCase("Yes"));//Repeats method if yes is typed
public void kilometersToMiles()//Method for converting kilometers to miles
double miles;
String more;//Used in option for additional conversions
final double OFFSET = 0.62136994949495;//number for conversion
do
System.out.print( "Please tell me the number of kilometers: ");
double kilometers = keyboard.nextDouble();
miles = (kilometers * OFFSET);//Converts kilometers to miles
System.out.println(kilometers + " kilometers is equal to " + miles + " miles.");
System.out.println("Would you like to make another conversion?");
System.out.println("Yes or No");
more = keyboard.next();
if
(more.equalsIgnoreCase("Yes"))
System.out.println("One Moment Please");
else
System.out.println("Thanks for using my program.");
System.out.println("Please tell your friends.");
System.exit(0);//exits program if user types "no"
}while (more.equalsIgnoreCase("Yes"));//Repeats loop if user types "yes"
public static void main(String[] args)//main method
Squires1 s1 = new Squires1();//creates new instance of class
int option;
Scanner keyboard = new Scanner(System.in);//allows for keyboard inputs
System.out.println( "I can convert distances for you. Please tell me what you'd like to do.");
System.out.println( "1. Convert miles to kilometers ");
System.out.println( "2. Convert kilometers to miles ");
System.out.println( "3. End our session. ");
option = keyboard.nextInt();
if (option == 1)
s1.milesToKilometers();//runs milesToKilometers method
if (option == 2)
s1.kilometersToMiles();//runs kilometersToMiles method }
if (option == 3)
System.out.println("Thanks for using my program.");
System.out.println("Have a nice day.");
}while (option != 3);//Repeats main method as long as user doesn't type 3
}
Similar Messages
-
i have lost my photos/videos when i imported from my ipad 2 to my new imac latest version OS X 10.8.4
and it's not reading the files. I have downloaded iMac library manager and can see them. when i go back into iphoto i'm getting the following message :
Do you want to switch the current iPhoto Library from “iPhoto Library.photolibrary” to “iPhoto Library.photolibrary” and relaunch iPhoto?
I don't know what to do - please help !!!!
can someone shed some light please ?So it appears you have only one library on the hard drive. Apply the two fixes below in order as needed to that library:
Fix #1
1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
2 - run Option #4 to rebuild the database.
Fix #2
Using iPhoto Library Manager to Rebuild Your iPhoto Library
1 - download iPhoto Library Manager and launch.
2 - click on the Add Library button and select the library you want to add in the selection window..
3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option.
4 - In the next window name the new library and select the location you want it to be placed.
5 - Click on the Create button.
Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments. However, books, calendars, cards and slideshows will be lost. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory. -
I have an hp dvd ram gh60L DVD Drive. It shows up in Windows Explorer (Windows 7), but doesn't show up in itunes. Can someone suggest a fix, please?
Hello b0nvivant,
Thank you for providing so much information about the iPod issue you are experiencing. I found an article with steps to take when your iPod is recognized in Windows Explorer but not in iTunes:
iPod: Appears in Windows but not in iTunes
http://support.apple.com/kb/TS1363
Thank you for using Apple Support Communities.
Best,
Sheila M. -
Cffunction and how to ? can someone explain the code to me line by line
Hello i went to get this online and i want to test it.
the udf is supposed to
* CSVFormat accepts the name of an existing query and
converts it to csv format.
* Updated version of UDF orig. written by Simon Horwith
my question how to break it down.
can someone explain the code to me line by line
thankssilviasalsa wrote:
> thanks
>
> but line by line
>
> what is
> if(ArrayLen(Arguments) GTE 2) qualifier = Arguments[2];
> if(ArrayLen(Arguments) GTE 3 AND Len(Arguments[3]))
columns = Arguments[3];
> returnValue[1] = ListQualify(columns, qualifier);
> ArrayResize(returnValue, query.recordcount + 1);
> columns = ListToArray(columns);
> for(i = 1; i LTE query.recordcount; i = i + 1)
> {
> rowValue = ArrayNew(1);
> ArrayResize(rowValue, ArrayLen(columns));
> for(j = 1; j LTE ArrayLen(columns); j = j + 1)
> rowValue[j] = qualifier & query[columns[j]]
& qualifier;
> returnValue[i + 1] = ArrayToList(rowValue);
> }
> returnValue = ArrayToList(returnValue, Chr(13));
> return returnValue;
> }
>
> thanks
Apparently this UDF takes two optional parameters so that one
can define
(A) a text "qualifier" to use in the CSV file, this is
usually the
single quote|tick ['] mark - but sometimes one wants this to
be a
different character and (B) what columns to use in the
output in case
one does not want to use all the columns in the record set
in the
outputted CSV file.
The if statements are checking for these optional parameters
and if
found setting the values in them to internal variables.
These
variables are then used in the rest of the logic to create
the CSV output.
HTH
Ian -
I have a mac book pro with Windows for Mac, I have really been struggling to figure out a keyboard shortcut to switch between 2 excel files can someone suggest a solution please ?
someonehelpmaddy wrote:
My Mac knows that it is connected to the montior...
Open your Displays system preferences. Is there an Arrangement tab and does it show two screens? If no Arrangement tab then your mac does not know it has two screens. Maybe smc and pram reset will shake it free and maybe not. Maybe there's something wrong with the connection. Thunderbolt plugs are similar to mini-displayport plugs so make sure the plug is pushed firmly in so that essentially all the metal part disappears inside the socket. The plugs can be a little tricky in that you need to make sure the plug is fully seated in their socket.
If you do see two screens in the Arrangement tab then click Detect Displays and Gather Windows to get the Displays preferences of the other monitor on to your main monitor. Check the resolution and if there is a refresh rate check that as well. -
Can someone awnser this question please
'\ my sound card and my tv is digital but my stereo surround system is analogue but my question is.
how well to the analogue to digital converts work which i can buy for 40 quid.
will it give me the same quality digital to digital if im using analogue to digital.
any help will be much apreciated+Re: can someone awnser this question pleased
deebs986 wrote:
my sound card and my tv is digital but my stereo surround system is analogue but my question is.
how well to the analogue to digital converts work which i can buy for 40 quid.
will it give me the same quality digital to digital if im using analogue to digital.
any help will be much apreciated
Depends on
the analog part of A/D Converter and the converter as well ... there are cheap ones which (if you're audiophile)? may give weak results but normally, those are suitable even being that cheap ... you name ones you have in mind to get more exact answers<
the source ... D to D is : (lossless (theory))? , A to D (lossy (why, ... read above))<
jutapa
@9.56.77.37 -
Can someone take a look please !!!
1. Product name:
BT Home Hub
2. Serial number:
+068343+NQ35026719
3. Firmware version:
Software version 4.7.5.1.83.8.173.1.6 (Type A) Last updated 15/02/14
4. Board version:
BT Hub 5A
5. VDSL uptime:
0 days, 19:48:35
6. Data rate:
20000 / 79995
7. Maximum data rate:
23698 / 84936
8. Noise margin:
6.8 / 8.2
9. Line attenuation:
0.0 / 17.7
10. Signal attenuation:
0.0 / 17.6
11. Data sent/received:
632.2 MB / 2.5 GB
can someone have a look at my details of helpdesk information much appreciated !!Full speed ahead with margin to spare!
To say thanks for a helpful answer, please click the white star -
HI,
CAN SOMEONE EXPLAIN TO ME THIS CODE:
FUNCTION DISP_QATD return VARCHAR2 is
BEGIN
SRW.REFERENCE(:P_CURRENCY_CODE);
SRW.REFERENCE(:P_QATD1);
SRW.USER_EXIT('FND FORMAT_CURRENCY
CODE = ":P_CURRENCY_CODE"
DISPLAY_WIDTH = "19"
AMOUNT = ":P_QATD1"
DISPLAY = ":DISP_QATD"
PRECISION = "STANDARD"');
RETURN(:DISP_QATD);
END;Hello,
For details about SRW.REFERENCE :
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_reference.htm?tp=true
Regards -
Can someone explain the code for having the Accordion panels closed?
I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
<script type="test/javascript">
var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
</script>
AngelaGPDMTR25 wrote:
I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
<script type="test/javascript">
var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
</script>
Angela
Hi Angela,
You are right, the only way it will work is by setting the fixed height to false. As for the for the default panel option, -1 is not a panel and if you had 3 panels we could have used the number 3 (panel1 = 0) or 99 or whatever as long as there is no panel with that number. If we had used the number 1 for instance, then the 2nd panel would be opened by default.
Hope this helps.
Ben -
Can someone review this nTPV (POS system) PKGBUILD, please ?
Hi, This is my first serious attempt to make a PKGBUILD, and I would like if someone can review it and make comments, bugfixes, and all kind of feedback you want. The package is nTPV, a POS (Point Of Sale) system for pubs, discos, restaurants, .... I think the program is very nice but the source tarball is not easy to build (It's mainly focused on debian). Right now the program is in spanish but the author says that for 1.2 final version it will be released in english also.
I have had to make many workarounds to make the program compile and I don't know if the process can be enhanced before trying it to be acce pted in the AUR. I Hope soon I would put a link to a binary package and a simple instruccions on how to build the complete POS system (database & customizations included).
Unfortunaly, this package depends on other one (gdchart) that hasn't an official archlinux package. So I submit two PKGBUILDS for your review.
Many thanx.
pkgname=ntpv
pkgver=1.2rc1
pkgrel=3
pkgdesc="nTPV POS System & libs"
url="http://www.napsis.com"
license=""
depends=('xorg' 'qt' 'kdelibs' 'libxml2' 'gd' 'gdchart' 'sudo' 'nmap' 'iproute')
makedepends=()
conflicts=()
replaces=()
backup=()
install=ntpv.install
source=(http://switch.dl.sourceforge.net/sourceforge/ntpv/ntpv_bundle-1.2-rc1.tar.gz)
md5sums=('0712a36f80c72c5b6c6011170683eac7')
dirname=ntpv_bundle-1.2rc1
build() {
# 1) Libbslxml
cd $startdir/src/$dirname/libbslxml
make INCLUDES+="-I/usr/include/libxml2 -I/opt/qt/include" LDFLAGS+="-L/opt/qt/lib" || return 1
mkdir -p $startdir/pkg/usr/lib $startdir/pkg/usr/include/libbslxml
cp libbslxml.so.0.2.1 $startdir/pkg/usr/lib
cp *.h $startdir/pkg/usr/include/libbslxml
cd $startdir/pkg/usr/lib
ln -s libbslxml.so.0.2.1 libbslxml.so.0.2
ln -s libbslxml.so.0.2.1 libbslxml.so
# 2) Libqutexr
cd $startdir/src/$dirname/libqutexr/src
qmake -makefile || return 1
make LDFLAGS+="-L$stardir/pkg/usr/lib" || return 1
mkdir -p $startdir/pkg/usr/include/libqutexr
cp *.h $startdir/pkg/usr/include/libqutexr
cp libqutexr.a $startdir/pkg/usr/lib
chmod 755 $startdir/pkg/usr/lib/libqutexr.a
# 3) ntpv-libs base
cd $startdir/src/$dirname/ntpvlibs
make -f Makefile-base INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include" LDFLAGS+="-L$startdir/pkg/usr/lib -lsql -lpsql" || return 1
mkdir -p $startdir/pkg/usr/include/liblinuxbar
cp -f *.h $startdir/pkg//usr/include/liblinuxbar/
cp -f liblinuxbar.so.0.1.1 $startdir/pkg/usr/lib/
cd $startdir/pkg/usr/lib
ln -s liblinuxbar.so.0.1.1 liblinuxbar.so.0.1
ln -s liblinuxbar.so.0.1.1 liblinuxbar.so.0
ln -s liblinuxbar.so.0.1.1 liblinuxbar.so
# 4) ntpv-libs widgets
cd $startdir/src/$dirname/ntpvlibs
sed -i -e "s:// ::" floatkeyboardbox.cpp
sed -i -e "s:/usr/bin/moc:/opt/qt/bin/moc:" Makefile-widgets
sed -i -e "s/-shared/-shared $(LDFLAGS)/ " Makefile-widgets
make -f Makefile-widgets INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include" LDFLAGS+="-L$startdir/pkg/usr/lib -L/opt/qt/lib" || return 1
mkdir -p $startdir/pkg/usr/include/liblinuxbarwidgets
cp -f *.h $startdir/pkg/usr/include/liblinuxbarwidgets/
cp -f liblinuxbarwidgets.so.0.0.4 $startdir/pkg/usr/lib/
cd $startdir/pkg/usr/lib
ln -s liblinuxbarwidgets.so.0.0.4 liblinuxbarwidgets.so.0.1
ln -s liblinuxbarwidgets.so.0.0.4 liblinuxbarwidgets.so.0
ln -s liblinuxbarwidgets.so.0.0.4 liblinuxbarwidgets.so
# 5) xmlmanage
cd $startdir/src/$dirname/xmlmanage-0.1
./configure
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include" LDFLAGS+="-L$startdir/pkg/usr/lib -L/opt/qt/lib" || return 1
mkdir -p $startdir/pkg/usr/bin
cp xmlmanage/xmlmanage $startdir/pkg/usr/bin/
# 6) dcopprinter
cd $startdir/src/$dirname/dcopprinter-0.3
grep -Rl --include "*.cpp" "namespace.*{}.*;" . | xargs sed -i -e "s/^namespace.*{}.*;/namespace std {}/"
./configure
sed -i -e "s:/usr/lib/libqutexr.a:$startdir/pkg/usr/lib/libqutexr.a:" dcopprinter/Makefile
sed -i -e "s:/usr/bin/dcopidl:/opt/kde/bin/dcopidl:" dcopprinter/Makefile
sed -i -e "s:/usr/bin/dcopudl2cpp:/opt/kde/bin/dcopidl2cpp:" dcopprinter/Makefile
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include" LDFLAGS+="-L$startdir/pkg/usr/lib -L/opt/qt/lib -L/opt/kde/lib" || return 1
cp dcopprinter/dcopprinter $startdir/pkg/usr/bin/
mkdir -p $startdir/pkg/etc/ntpv
cp -r etc_linuxbar/* $startdir/pkg/etc/ntpv
mkdir -p $startdir/pkg/usr/share/dcopprinter
cp -r usr_dcopprinter/* $startdir/pkg/usr/share/dcopprinter/
#7) ntpv
cd $startdir/src/$dirname/ntpv-1.2
sed -i -e "s/" "/" > "/" linuxbar/barcore/openbox.cpp # BUG FIX
sed -i -e "s/fewa/ntpv/" etc_ntpv/bar_database.xml
sed -i -e "s/192.168.2.201/localhost/" etc_ntpv/dcopprinter_config.xml
sed -i -e "s:/sbin/sync:/bin/sync:" linuxbar/menusystem/menus/bslexitactionswidget.cpp
./configure
grep -Rl --include "*.cpp" "namespace.*{}.*;" . | xargs sed -i -e "s/^namespace.*{}.*;/namespace std {}/"
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include -I/usr/include/gdchart" LDFLAGS+="-L$startdir/pkg/usr/lib" || return 1
cp linuxbar/linuxbar $startdir/pkg/usr/bin/ntpv
cp -r etc_ntpv/* $startdir/pkg/etc/ntpv/
mkdir -p $startdir/pkg/usr/share/ntpv
cp -r usr_share_ntpv/* $startdir/pkg/usr/share/ntpv
#8) ntpvbo
cd $startdir/src/$dirname/ntpvbo-1.2
sed -i -e "s:*proc << "sudo";://*proc << "sudo";:" linuxbarbackoffice/menusystem/database/bslddbbwidget.cpp
./configure
grep -Rl --include "*.cpp" --include "*.h" "/usr/include/" . | xargs sed -i -e "s:/usr/include/::"
grep -Rl --include "*.cpp" "namespace.*{}.*;" . | xargs sed -i -e "s/^namespace.*{}.*;/namespace std {}/"
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include" LDFLAGS+="-L$startdir/pkg/usr/lib" || return 1
cp linuxbarbackoffice/linuxbarbackoffice $startdir/pkg/usr/bin/ntpv_backoffice
mkdir -p $startdir/pkg/etc/ntpv_backoffice
cp -r etc_ntpv_backoffice/* $startdir/pkg/etc/ntpv_backoffice/
mkdir -p $startdir/pkg/usr/share/ntpv_backoffice
cp -r usr_share_linuxbarbackoffice/* $startdir/pkg/usr/share/ntpv_backoffice/
the ntpv.install file
create_group() {
grupo_ntpv=$(cat /etc/group |sed s/:/' '/ | awk '$1~/ntpv/ {print $1}' |wc -l)
ADDGRP=$(which addgroup 2>/dev/null)
if [ -z $ADDGRP ]
then
ADDGRP=$(which groupadd 2>/dev/null)
fi
if [ $grupo_ntpv -eq 0 ]
then
$ADDGRP ntpv
fi
check_perms() {
if [ -d $dir_ntpv ]
then
echo -ne "checking group and permissions of /etc/ntpv"
chgrp -R ntpv $dir_ntpv
chgrp -R ntpv ${dir_ntpv}/*
chmod g+rwx $dir_ntpv
find ${dir_ntpv}/ -type d | xargs chmod g+rwx
find ${dir_ntpv}/ -type f | xargs chmod g+rw
echo -e " ttt[DONE]"
fi
if [ -d $dir_ntpv_backoffice ]
then
echo -ne "checking group and permissions of /etc/ntpv_backoffice"
chgrp -R ntpv $dir_ntpv_backoffice
chgrp -R ntpv ${dir_ntpv_backoffice}/*
chmod g+rwx $dir_ntpv_backoffice
find ${dir_ntpv_backoffice}/ -type d | xargs chmod g+rwx
find ${dir_ntpv_backoffice}/ -type f | xargs chmod g+rw
echo -e " tt[DONE]"
fi
# arg 1: the new package version
post_install() {
create_group
check_perms
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
check_perms
dir_ntpv=/etc/ntpv
dir_ntpv_backoffice=/etc/ntpv_backoffice
op=$1
shift
$op $*
and the other PKGBUILD
pkgname=gdchart
pkgver=0.11.5dev
pkgrel=1
pkgdesc="Create charts and graphs in PNG, GIF and WBMP format"
url="http://www.fred.net/brv/chart/"
license=""
depends=('gd')
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=(http://www.fred.net/brv/chart/$pkgname$pkgver.tar.gz)
md5sums=('a4af7bc927d8b88934da56fce10a7a3c')
build() {
cd $startdir/src/$pkgname$pkgver
sed -i -e "s:local/::" Makefile
make || return 1
mkdir -p $startdir/pkg/usr/include
cp *.h $startdir/pkg/usr/include/
mkdir -p $startdir/pkg/usr/lib
cp libgdc.a $startdir/pkg/usr/libHi, This is my first serious attempt to make a PKGBUILD, and I would like if someone can review it and make comments, bugfixes, and all kind of feedback you want. The package is nTPV, a POS (Point Of Sale) system for pubs, discos, restaurants, .... I think the program is very nice but the source tarball is not easy to build (It's mainly focused on debian). Right now the program is in spanish but the author says that for 1.2 final version it will be released in english also.
I have had to make many workarounds to make the program compile and I don't know if the process can be enhanced before trying it to be acce pted in the AUR. I Hope soon I would put a link to a binary package and a simple instruccions on how to build the complete POS system (database & customizations included).
Unfortunaly, this package depends on other one (gdchart) that hasn't an official archlinux package. So I submit two PKGBUILDS for your review.
Many thanx.
pkgname=ntpv
pkgver=1.2rc1
pkgrel=3
pkgdesc="nTPV POS System & libs"
url="http://www.napsis.com"
license=""
depends=('xorg' 'qt' 'kdelibs' 'libxml2' 'gd' 'gdchart' 'sudo' 'nmap' 'iproute')
makedepends=()
conflicts=()
replaces=()
backup=()
install=ntpv.install
source=(http://switch.dl.sourceforge.net/sourceforge/ntpv/ntpv_bundle-1.2-rc1.tar.gz)
md5sums=('0712a36f80c72c5b6c6011170683eac7')
dirname=ntpv_bundle-1.2rc1
build() {
# 1) Libbslxml
cd $startdir/src/$dirname/libbslxml
make INCLUDES+="-I/usr/include/libxml2 -I/opt/qt/include" LDFLAGS+="-L/opt/qt/lib" || return 1
mkdir -p $startdir/pkg/usr/lib $startdir/pkg/usr/include/libbslxml
cp libbslxml.so.0.2.1 $startdir/pkg/usr/lib
cp *.h $startdir/pkg/usr/include/libbslxml
cd $startdir/pkg/usr/lib
ln -s libbslxml.so.0.2.1 libbslxml.so.0.2
ln -s libbslxml.so.0.2.1 libbslxml.so
# 2) Libqutexr
cd $startdir/src/$dirname/libqutexr/src
qmake -makefile || return 1
make LDFLAGS+="-L$stardir/pkg/usr/lib" || return 1
mkdir -p $startdir/pkg/usr/include/libqutexr
cp *.h $startdir/pkg/usr/include/libqutexr
cp libqutexr.a $startdir/pkg/usr/lib
chmod 755 $startdir/pkg/usr/lib/libqutexr.a
# 3) ntpv-libs base
cd $startdir/src/$dirname/ntpvlibs
make -f Makefile-base INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include" LDFLAGS+="-L$startdir/pkg/usr/lib -lsql -lpsql" || return 1
mkdir -p $startdir/pkg/usr/include/liblinuxbar
cp -f *.h $startdir/pkg//usr/include/liblinuxbar/
cp -f liblinuxbar.so.0.1.1 $startdir/pkg/usr/lib/
cd $startdir/pkg/usr/lib
ln -s liblinuxbar.so.0.1.1 liblinuxbar.so.0.1
ln -s liblinuxbar.so.0.1.1 liblinuxbar.so.0
ln -s liblinuxbar.so.0.1.1 liblinuxbar.so
# 4) ntpv-libs widgets
cd $startdir/src/$dirname/ntpvlibs
sed -i -e "s:// ::" floatkeyboardbox.cpp
sed -i -e "s:/usr/bin/moc:/opt/qt/bin/moc:" Makefile-widgets
sed -i -e "s/-shared/-shared $(LDFLAGS)/ " Makefile-widgets
make -f Makefile-widgets INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include" LDFLAGS+="-L$startdir/pkg/usr/lib -L/opt/qt/lib" || return 1
mkdir -p $startdir/pkg/usr/include/liblinuxbarwidgets
cp -f *.h $startdir/pkg/usr/include/liblinuxbarwidgets/
cp -f liblinuxbarwidgets.so.0.0.4 $startdir/pkg/usr/lib/
cd $startdir/pkg/usr/lib
ln -s liblinuxbarwidgets.so.0.0.4 liblinuxbarwidgets.so.0.1
ln -s liblinuxbarwidgets.so.0.0.4 liblinuxbarwidgets.so.0
ln -s liblinuxbarwidgets.so.0.0.4 liblinuxbarwidgets.so
# 5) xmlmanage
cd $startdir/src/$dirname/xmlmanage-0.1
./configure
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include" LDFLAGS+="-L$startdir/pkg/usr/lib -L/opt/qt/lib" || return 1
mkdir -p $startdir/pkg/usr/bin
cp xmlmanage/xmlmanage $startdir/pkg/usr/bin/
# 6) dcopprinter
cd $startdir/src/$dirname/dcopprinter-0.3
grep -Rl --include "*.cpp" "namespace.*{}.*;" . | xargs sed -i -e "s/^namespace.*{}.*;/namespace std {}/"
./configure
sed -i -e "s:/usr/lib/libqutexr.a:$startdir/pkg/usr/lib/libqutexr.a:" dcopprinter/Makefile
sed -i -e "s:/usr/bin/dcopidl:/opt/kde/bin/dcopidl:" dcopprinter/Makefile
sed -i -e "s:/usr/bin/dcopudl2cpp:/opt/kde/bin/dcopidl2cpp:" dcopprinter/Makefile
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include" LDFLAGS+="-L$startdir/pkg/usr/lib -L/opt/qt/lib -L/opt/kde/lib" || return 1
cp dcopprinter/dcopprinter $startdir/pkg/usr/bin/
mkdir -p $startdir/pkg/etc/ntpv
cp -r etc_linuxbar/* $startdir/pkg/etc/ntpv
mkdir -p $startdir/pkg/usr/share/dcopprinter
cp -r usr_dcopprinter/* $startdir/pkg/usr/share/dcopprinter/
#7) ntpv
cd $startdir/src/$dirname/ntpv-1.2
sed -i -e "s/" "/" > "/" linuxbar/barcore/openbox.cpp # BUG FIX
sed -i -e "s/fewa/ntpv/" etc_ntpv/bar_database.xml
sed -i -e "s/192.168.2.201/localhost/" etc_ntpv/dcopprinter_config.xml
sed -i -e "s:/sbin/sync:/bin/sync:" linuxbar/menusystem/menus/bslexitactionswidget.cpp
./configure
grep -Rl --include "*.cpp" "namespace.*{}.*;" . | xargs sed -i -e "s/^namespace.*{}.*;/namespace std {}/"
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include -I/usr/include/gdchart" LDFLAGS+="-L$startdir/pkg/usr/lib" || return 1
cp linuxbar/linuxbar $startdir/pkg/usr/bin/ntpv
cp -r etc_ntpv/* $startdir/pkg/etc/ntpv/
mkdir -p $startdir/pkg/usr/share/ntpv
cp -r usr_share_ntpv/* $startdir/pkg/usr/share/ntpv
#8) ntpvbo
cd $startdir/src/$dirname/ntpvbo-1.2
sed -i -e "s:*proc << "sudo";://*proc << "sudo";:" linuxbarbackoffice/menusystem/database/bslddbbwidget.cpp
./configure
grep -Rl --include "*.cpp" --include "*.h" "/usr/include/" . | xargs sed -i -e "s:/usr/include/::"
grep -Rl --include "*.cpp" "namespace.*{}.*;" . | xargs sed -i -e "s/^namespace.*{}.*;/namespace std {}/"
make INCLUDES+="-I$startdir/pkg/usr/include -I/opt/qt/include -I/opt/kde/include" LDFLAGS+="-L$startdir/pkg/usr/lib" || return 1
cp linuxbarbackoffice/linuxbarbackoffice $startdir/pkg/usr/bin/ntpv_backoffice
mkdir -p $startdir/pkg/etc/ntpv_backoffice
cp -r etc_ntpv_backoffice/* $startdir/pkg/etc/ntpv_backoffice/
mkdir -p $startdir/pkg/usr/share/ntpv_backoffice
cp -r usr_share_linuxbarbackoffice/* $startdir/pkg/usr/share/ntpv_backoffice/
the ntpv.install file
create_group() {
grupo_ntpv=$(cat /etc/group |sed s/:/' '/ | awk '$1~/ntpv/ {print $1}' |wc -l)
ADDGRP=$(which addgroup 2>/dev/null)
if [ -z $ADDGRP ]
then
ADDGRP=$(which groupadd 2>/dev/null)
fi
if [ $grupo_ntpv -eq 0 ]
then
$ADDGRP ntpv
fi
check_perms() {
if [ -d $dir_ntpv ]
then
echo -ne "checking group and permissions of /etc/ntpv"
chgrp -R ntpv $dir_ntpv
chgrp -R ntpv ${dir_ntpv}/*
chmod g+rwx $dir_ntpv
find ${dir_ntpv}/ -type d | xargs chmod g+rwx
find ${dir_ntpv}/ -type f | xargs chmod g+rw
echo -e " ttt[DONE]"
fi
if [ -d $dir_ntpv_backoffice ]
then
echo -ne "checking group and permissions of /etc/ntpv_backoffice"
chgrp -R ntpv $dir_ntpv_backoffice
chgrp -R ntpv ${dir_ntpv_backoffice}/*
chmod g+rwx $dir_ntpv_backoffice
find ${dir_ntpv_backoffice}/ -type d | xargs chmod g+rwx
find ${dir_ntpv_backoffice}/ -type f | xargs chmod g+rw
echo -e " tt[DONE]"
fi
# arg 1: the new package version
post_install() {
create_group
check_perms
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
check_perms
dir_ntpv=/etc/ntpv
dir_ntpv_backoffice=/etc/ntpv_backoffice
op=$1
shift
$op $*
and the other PKGBUILD
pkgname=gdchart
pkgver=0.11.5dev
pkgrel=1
pkgdesc="Create charts and graphs in PNG, GIF and WBMP format"
url="http://www.fred.net/brv/chart/"
license=""
depends=('gd')
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=(http://www.fred.net/brv/chart/$pkgname$pkgver.tar.gz)
md5sums=('a4af7bc927d8b88934da56fce10a7a3c')
build() {
cd $startdir/src/$pkgname$pkgver
sed -i -e "s:local/::" Makefile
make || return 1
mkdir -p $startdir/pkg/usr/include
cp *.h $startdir/pkg/usr/include/
mkdir -p $startdir/pkg/usr/lib
cp libgdc.a $startdir/pkg/usr/lib -
Can someone verify my code for calculatin​g a Gaussian kernel?
I've attached my VI for calculating a Gausssian kernel function of selectable width and resolution. I am not an expert in mathmatics and I was hoping someone on here could confirm the validity of my code. If anyone has any suggestions please let me know.
Eric
Attachments:
Old Gaussian Kernel.vi 24 KBTo better show what it is I'm trying to accomplish, I've attached
the top level VI that's using the kernel function, entitled "Pattern
Analysis of IPIs 2," . The zip folder contains the top level VI, a
folder with all the subVI's and two data files. Open the "Pattern
Analysis of IPIs 2" VI and go to the "Files" selector tab toward the
bottom right of the front panel. Here you'll be able to select the
folder containing the data files. You'll need to unzip the attached
folder and save it somewhere, then select that folder as the "current
folder" to be opened (you don't need to specify which data file to
open, it will open both). Once the folder is selected you can run the
VI and view its results.
When the program begins
running a boolean indicator located in the bottom left corner will
appear red and the slider bars along the bottom will be disabled. When
everything has been calculated the boolean will turn green and the
slider bars will become enabled. Choose the selector tab entitled "SPI,
SDF & SDD" to view the spike density function. The spike density
function (SDF) is what's being created with the Gaussian kernel. The
enabled slider bars allow you to adjust the x-axis values of the plot.
The cursors on the plot indicate indicate the start, peak and end of
high rate bursts. It may be easier to visualize this by viewing the
raw data located at the "Wfm Absolute and Relative Time" selector tab.
To reduce file sizes the raw data has areas of "quite" removed, so you
will only see the voltage change events, represented by what appear to
be vertical lines.
To move to the next data file, click
the button entitled "Save and Go to Next" located in the bottom right
hand corner. A prompt will appear asking if you want to save the data,
click "No" and the next file will automatically be loaded. To stop the
VI, wait until the boolean is green and the slider bars are enabled,
then click the "Stop" bottom located at the bottom right. It may take
a few seconds for the VI to stop.
Moving to the
block diagram, you'll see a yellow subVI with black writing that says
"SDF," this is where the SDF is calculated. Open the front panel and
block diagram of this subVI. On the block diagram you'll see the subVI
entitled "Gaussian Kernel," this is the subVI you saw yesterday. The
generated Gaussian kernel is alligned at peak pulse times (can be seen
in the graph entitled "Gaussian Kernel Alligned at Peak Times") and
summed to create the SDF. I only choose this method of generating the
SDF because it seemed intuitive to me, it may be wrong. If it is,
could you please demonstrate how to program the convolution.
Ultimately, I'm trying to achieve the plot described on the third page
of the attached paper.
Attachments:
Pattern Analysis.zip 2916 KB
Stereotyped temporal patterns in electrical communication.pdf 380 KB -
Can someone check this code?
What I am trying to achieve is an "active" button state. I
have six buttons. When one is clicked, i need it to change to a
color which denotes that it is the active button.
someone provided me with this code, but I can't seem to get
it to work. I followed the directions precisely.
The directions were as follows:
One thing I think you could do is create another invisible
layer of buttons above all your other buttons. You could make them
all invisible, unless a button is clicked.
Let's say your original layer of buttons is called a_but,
b_but, and c_but.
Then you could have another invisible layer of buttons called
invA_but, invB_but, and invC_but. This layer of buttons would each
be the color you want displayed while the button is selected. The
code would look something like-
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
a_but.onRelease=function(){
invA_but._visible=true;
invB_but._visible=false;
invB_but._visible=false;
b_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=true;
invC_but._visible=false;
c_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=trueinvA_but, invB_but, and invC_but refer to instance names for
your buttons, not layer names as suggested in the description. It
should work if you have the instance names for the buttons right. I
would probably add code to make the nomal state invisible instead
of just having the active button covering the inactive one. EX:
a_but.onRelease=function(){
invA_but._visible=true; //show the buttons active state
a_but._visible = false; //hide the off state of the button
invB_but._visible=false; //hides the active state of button b
invC_but._visible=false; //hides the active state of button c -
Need help.. can someone look at code..
and tell me what is happening, or rather not happening and
why....
This is a neat clock that shows current time and zulu time
with a disclaimer popup..... Would like to get it working to put on
my site but can not figure it out.
It is made up of two files.... first is the html file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script language-"javascript"
src="clock.js"></script>
<!-- InstanceParam name="onloadVal" type="text"
value="doTime()" -->
<title>Clock</title>
</head>
<body>
<FORM name=Horloge>
<TABLE cellSpacing=0 cellPadding=0 width=756
bgColor=#205670>
<TBODY>
<TR>
<TD height=34><FONT face="Arial, Helvetica,
sans-serif" color=#ffffcc
size=-2>Your time </FONT><font face="Arial,
Helvetica, sans-serif"
color=#ffffcc size=-1>
<input value="Not available" name=HreLocale />
</font></TD>
<TD height=34><FONT face="Arial, Helvetica,
sans-serif" color=#ffffcc
size=-2>UTC time</FONT><font face="Arial,
Helvetica, sans-serif"
color=#ffffcc size=-1>
<input value="Not available" name=HreUTC />
</font></TD>
<TD noWrap width=100 height=34>
<DIV align=center><font color=#ffffcc size=-2>
<input onclick="MM_popupMsg('Reliable clock times are
dependant on two sources:\r1. Your computer`s time\r2. Your
computer`s time zone settings\rPlease verify that both these
settings are correct before relying on the clock.')" type=button
value="Clock Disclaimer" name="Clock Disclaimer" />
</font></DIV></TD>
<TD noWrap width=67 colSpan=4 height=34>
<DIV align=center><FONT face="Arial, Helvetica,
sans-serif" color=#ffffcc
size=-2></FONT></DIV>
<DIV align=center><FONT size=+1><A
href="javascript:seLogger()"><FONT
face="Arial, Helvetica, sans-serif" color=#ffffcc
size=-1>Log
out</FONT></A></FONT></DIV></TD></TR></TBODY></TABLE>
</form>
</body>
</html>
Then there is a seperate .js file:
function format(value) {
if (value < 10) {
return "0" + value;
} else {
return value;
function putFocus() {
// Put the cursor in the first text box available
// or in the specified field with id="init"
// Params: none
var f = 0;
var e = 0;
var fName;
if (document.getElementById &&
document.getElementById('init')) {
if (document.getElementById('init').type != "hidden") {
document.getElementById('init').focus();
} else while (f < document.forms.length &&
document.forms[f].name != "Horloge") {
e = 0;
while (document.forms[f] && e <
document.forms[f].elements.length) {
if (document.forms[f].elements[e].type == "text"
|| document.forms[f].elements[e].type == "password") {
document.forms[f].elements[e].focus();
fName = document.forms[f].name;
e=9999;f=9999;
e++;
f++;
function enterAction(obj) {
// Capture key events at the document level and submit the
form when the enter key is pressed
// by a simulated click on the submit button given as
parameter.
// Function added by Thierry Husson 2006-05
// Sample call: <body
onLoad="enterAction(document.Registered.elements['R-Submit']);">
if (obj && obj.click) {
if (document.layers) document.captureEvents(Event.KEYPRESS);
document.onkeypress = function (evt) {
var key = document.all ? event.keyCode : evt.which ?
evt.which : evt.keyCode;
if (key == 13) {
obj.click();
function doTime() {
months = new Array(12);
months[0] = "Jan";
months[1] = "Feb";
months[2] = "Mar";
months[3] = "Apr";
months[4] = "May";
months[5] = "Jun";
months[6] = "Jul";
months[7] = "Aug";
months[8] = "Sep";
months[9] = "Oct";
months[10] = "Nov";
months[11] = "Dec";
days = new Array(7);
days[0] = "Sun";
days[1] = "Mon";
days[2] = "Tue";
days[3] = "Wed";
days[4] = "Thu";
days[5] = "Fri";
days[6] = "Sat";
strLocalTime = "Your Time: ";
strUTCTime = "UTC Time: ";
local = new Date();
tzOffset = local.getTimezoneOffset()/60;
localMonth = local.getMonth();
localDay = local.getDay();
localDate = local.getDate();
localYear = local.getYear();
localHour = local.getHours();
localMin = local.getMinutes();
localSec = local.getSeconds();
UTCDate = new Date(localYear, localMonth, localDate,
localHour + (tzOffset/1), localMin + ((tzOffset%1)*60), localSec);
if (localYear < 1900) {
localYear = 1900 + localYear;
UTCYear = localYear;
strLocalTime = format(localDate) + " " + months[localMonth]
+ " " + format(localYear) + " " + localHour + ":" +
format(localMin) + ":" + format(localSec);
strUTCTime = format(UTCDate.getDate()) + " " +
months[UTCDate.getMonth()] + " " + format(UTCYear) + " " +
UTCDate.getHours() + ":" + format(UTCDate.getMinutes()) + ":" +
format(UTCDate.getSeconds());
document.Horloge.HreLocale.value = strLocalTime;
document.Horloge.HreUTC.value = strUTCTime;
setTimeout("doTime()", 1000);
//==============================================================
// Fonction doAsepTime est basee sur doTime mais modifiee
pour ne recuperer
// que les champs utiles soit : AAAA MM JJ HH UTC.
// Fonction doAsepTime retourne dans :
// input name="HreAsep value="YYYY MM DD HH" lorsque vide
(anglais)
// input name="HreAsep value="AAAA MM JJ HH" lorsque vide
(francais)
//==============================================================
function doAsepTime() {
// strUTCTime sera retourne a l 'interface (html)
strUTCTime = "UTC Time: ";
local = new Date();
tzOffset = local.getTimezoneOffset()/60;
AsepLocalMonth = local.getMonth();
AsepLocalDate = local.getDate();
AsepLocalYear = local.getYear();
AsepLocalHour = local.getHours();
UTCDate = new Date(AsepLocalYear, AsepLocalMonth,
AsepLocalDate, AsepLocalHour + (tzOffset/1));
if (AsepLocalYear < 1900) {
AsepLocalYear = 1900 + AsepLocalYear;
UTCYear = AsepLocalYear;
strUTCTime = format(UTCYear) + " " +
format(UTCDate.getMonth() + 1) + " " + format(UTCDate.getDate()) +
" " + format(UTCDate.getHours());
document.Produit.HreAsep.value = strUTCTime;
// setTimeout("doAsepTime()", 1000);Hi. I'm new to Java myself, but I've noticed a few things in your code..you have a bunch of methods inside the braces of your main method, which cannot work. Additional methods must be placed outside the main method, after the ending brace. But actually, if this is a secondary class and these methods will be called from a different class, which it looks to me to be, then you wouldn't need a main method at all. The class variables should go right after the opening brace of the class declaration and then the rest of the methods can be placed after those variables. Try this..
public class Date
int day;
int month;
int year;
public Date(int day, int month, int year)
setDay(day);
setMonth(month);
setYear(year);
public void setDay(int myDay)
day =myDay;
public void setMonth(int myMonth)
month =myMonth;
public void setYear(int myYear)
year =myYear;
public int getDay()
return day;
public int getMonth()
return month;
public int getYear()
return year;
public String displayDate()
return getMonth() + "/" + getDay() + "/" + getYear();
Sorry it that's hard to read, I just copied and pasted it, but all I did was eliminate the declaration of the main method, the opening brace, and the closing brace (second to last one at the bottom).
Hope this helps..Take care. -
Can someone explain error code DW020 - conflicts found in selected payloads?
Our laptop's hard drive failed. I don't believe Master Collection 5.5 was unregistered and uninstalled prior to the failure. I am attempting to put the software on another laptop and encounter the following errors: DS013, Fatal DW020, about conflicts found in selected payloads and flash player 10 Active X.
How can I get our license cleared up? Or what other error might I be having? Thanks.was that exit code 6? if so, Errors "Exit Code: 6," "Exit Code: 7" | CS5, CS5.5
-
Please can someone activate my broadband please?.....
Im a new BT user and my broadband was meant to go live yesterday but it still hasnt. Could someone activate it please?
Hi you need to contact the help line on 08001114567
This is a customer to customer self help forum the only BT Presence here are the forum moderators
If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’
Maybe you are looking for
-
Inspector-Hyperlink-An External Page = a Relative URL?
I'm on iWeb '08 and have a question that I simply can't find an answer too despite searching many failed searches. I'm using iWeb to publish to a folder, so that I can later ftp the finished site. In my site, I want to add a hyperlink to an external
-
How to insert horizontal line dynamically after every line item in sapscrip
Hi All, I have to insert a horizontal line after every new item in sap script. How to do this . In some material there is2 line item or in other line item it ay be more . How to insert horizontal line dynamically after every line item Point will be
-
CS3 Web Standard Installation Nightmare
I just had to purchase a new computer (my old one was dying) and I've had nothing but NIGHTMARES trying to install just about anything. I just finished spending THREE HOURS installing Acrobat Pro and and am now trying to install Adobe CS3 Web Edition
-
Hello. Requirement is : We need to find out the dafault window printer name for the SAP user id....Using Get_print_parameter function module, I could find out the device name LOCL (if this is what maintained through user profile). But it doesnot give
-
Activation of Objects with Type Data Transfer Process
Hi Experts, I am stuck in a problem of activation of DTP. I loaded the data from the Datasource to PSA and there are about 200,000 reocrds. Now I wanted to take this load to DSO NEW table ..I have created a DTP and when I try to activate the DTP I ge