Please help me to complete this code
import java.security.MessageDigest;
import java.util.Map;
import java.util.Scanner;
public class PasswordService
//The hash is to be formed using the SHA algorithm
//to create a MessageDigest
private final String algorithmName = "SHA";
//Use a message digest to create hashed passwords
private MessageDigest md = null;
//We simulate a database of users using who have a login and password
//as a key and value pair in a Map
private Map<String, byte[]> userData;
//complete the constructor
public PasswordService()
//TODO - intialize the class instance data
//some dummy data - do not alter these lines
addUser("daddy", "cool");
addUser("nightflight", "topChat");
addUser("boney", "2E5sxuSRg6A");
public void showProvider()
//TODO
//Get the hash value for the provided string password.
public byte[] getHash(String password)
//TODO
return null;
public void addUser(String login, String password)
//TODO
public byte[] getPassword(String login)
//TODO
return null;
public boolean checkLogin(String login, String password)
// TODO
return false;
//This method is provided to perform a login from the command line
public boolean doLogin()
Scanner sc = new Scanner(System.in);
System.out.println("Enter login please");
String login = sc.next();
System.out.println("Your password please");
String password = sc.next();
return checkLogin(login, password);
public static void main(String[] args)
int attempts = 0;
showProvider();
while(attempts < 4)
boolean match = doLogin(); //request login and password
System.out.println("match? " + match);
attempts++;
}
please help me to complete this code
void completeCode(Code code,Properties options) throws CodeCompletingException
CodeCompleterFactory cf = CodeCompleterFactory.newInstance();
CodeCompleter cc = cf.newCodeCompleter();
cc.complete(code,options);
}
Similar Messages
-
I forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod
i forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod...
Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
A
1. iOS- Forgotten passcode or device disabled after entering wrong passcode
2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
3. Restoring iPod touch after forgotten passcode
4. What to Do If You've Forgotten Your iPhone's Passcode
5. iOS- Understanding passcodes
6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
7. iOS - Unable to update or restore
Forgotten Restrictions Passcode Help
iPad,iPod,iPod Touch Recovery Mode
You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
Also, see iTunes- Restoring iOS software.
And also see How to Recover Forgotten iPhone, iPad Restrictions Passcode. -
Please help me break down this code
i really need help at understanding this, i put it together a while ago with some help but im really no pro at java but my tutor has asked me to give a break down of the code line by line
/* This program rolls two six-sided dice a user-specified
number of times, and prints how many times an ordered dice combination occured.
This is followed by a column stating how many times the sum of the two dice
equalled 2 through 12.
import java.util.Scanner;
public class DiceSumDistribution
public static void main(String[] args)
Scanner scan = new Scanner(System.in); //receive input from keyboard
System.out.print("Enter the number of times you would like to toss two dice: "); //prompt user for input
int timesToToss = scan.nextInt(); //read in user input
int[] diceSum = new int[37]; //this array holds the dice roll distribution table
int[] frequencySum = new int[13]; //this array holds how many times a dice sum occured
int die1, die2; //integers representing the two dice
for(int i = 0; i < timesToToss; i++) //toss two dice as many times as the user specified
die1 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice one
die2 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice two
diceSum[(6*(die1-1))+die2]++; //add one to appropriate cell in distribution table
frequencySum[die1+die2]++; //add one to appropriate sum counter
/*the dice roll distribution table shows how many times a certain combination of dice rolls
and the rows represent the other dice.
System.out.println("\n---Dice Roll Distribution Table---");
System.out.println("\t 1\t2\t3\t4\t5\t6"); //print distribution table
System.out.println("\t____________________________________________"); //print distribution table
for(int i = 1; i < 37; i++) //print all 36 cells of distribution tables
if(i%6 == 1) //if at the beginning of a table row
System.out.print(i/6+1 + "\t|"); //print row number
System.out.print(diceSum[i]+ "\t"); //for each cell in a row, print its value
if(i%6 == 0) //if at the end of a row
System.out.println(); //go down a line
/*this column represents how many times a sum occured. For example, if the following output occurs
System.out.println("\n---Dice Roll Sums---");
for(int i=2; i<=12; i++) //for each possible dice sum
System.out.println(i+": " + frequencySum); //print each dice sum on its own row
ii wrote this with some help a while ago but i havent done java at all since so im totaly clueless again. if someone could help i would be really greatful, thanks.ok chill man, and i wasnt asking you to do it for me or nothign liek that.
its mostly these parts im having trouble explaining
Scanner scan = new Scanner(System.in); //receive input from keyboard
System.out.print("Enter the number of times you would like to toss two dice: "); //prompt user for input
int timesToToss = scan.nextInt(); //read in user input
die1 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice one
die2 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice two
diceSum[(6*(die1-1))+die2]++; //add one to appropriate cell in distribution table
frequencySum[die1+die2]++; //add one to appropriate sum counter
if(i%6 == 1) //if at the beginning of a table row
System.out.print(i/6+1 + "\t|"); //print row number
System.out.print(diceSum[i]+ "\t"); //for each cell in a row, print its value
if(i%6 == 0) //if at the end of a row
System.out.println(); //go down a linei know in the last one there the "if(i%6 == 1) " and "if(i%6 == 0) " effect the
"System.out.print(i/6+1 + "\t|");" in some way, but i dont really know how to explain it.
thanks -
Can you please help me improve on this code
Here is code for a drag and drop activituy where there are 4 questions, each question is on a separate frame of a movieclip mentorquestions. I am trying to have the frame picked at random and then have either the yes target or the no target visible for the right answer to correspond with the question. yesplay is a little animation to let you know you got the correct answer. My code is a bit hit and miss I think.. I am doing something (or many things) wrong
any suggestions?
cheers
sub
import flash.events.MouseEvent;
yesplay.addEventListener(Event.ENTER_FRAME, checkit);
function checkit (myevent:Event):void {
if (yesplay.currentFrame == 27)
{reset1();
var incorrect:Number=0;
var correct:Number=0;
targetYes.visible=false;
targetNo.visible=false;
var Qmove:Array = [1,2,3,4];
var b:Number=4;
var a:Number;
var c:Number;
function pickquestion(){
a=Math.floor(Math.random() * b);
mentorquestions.gotoAndStop(Qmove[a]);
c=Qmove[a];
trace(c);
setanswer();
Qmove.splice(a,1);
b=b-1;
trace(a);
trace(Qmove);
trace(b);
pickquestion();
function setanswer(){;
if (c==3){
targetYes.visible=true;
targetNo.visible=false;
}else{
targetYes.visible=false;
targetNo.visible=true;
AbackBT.addEventListener(MouseEvent.CLICK, Abacker);
function Abacker(e:MouseEvent){
visible=false;
var Yx:Number=843;
var Yy:Number=295;
var Nx:Number=843;
var Ny:Number=394;
function reset1(){
yes.x=Yx;
yes.y=Yy;
no.x=Nx;
no.y=Ny;
pickquestion();
var startX:Number;
var startY:Number;
this.yes.addEventListener(MouseEvent.MOUSE_DOWN, pickMe);
this.yes.addEventListener(MouseEvent.MOUSE_UP,dropMe);
function pickMe(event:MouseEvent):void {
event.target.startDrag();
startX = event.target.x;
startY = event.target.y;
function dropMe(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "yes" + event.target.name;
if (event.target.dropTarget != null && event.target.dropTarget.parent == targetYes){
event.target.x = targetYes.x;
event.target.y = targetYes.y;
yesplay.play();
}else{
event.target.x = startX;
event.target.y = startY;
wrongun.play();
this.yes.buttonMode = true;
this.no.addEventListener(MouseEvent.MOUSE_DOWN, pickMe1);
this.no.addEventListener(MouseEvent.MOUSE_UP,dropMe1);
function pickMe1(event:MouseEvent):void {
event.target.startDrag();
startX = event.target.x;
startY = event.target.y;
function dropMe1(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "no" + event.target.name;
if (event.target.dropTarget != null && event.target.dropTarget.parent == targetNo){
event.target.x = targetNo.x;
event.target.y = targetNo.y;
yesplay.play();
}else{
event.target.x = startX;
event.target.y = startY;
wrongun.play();
this.no.buttonMode = true;You'll need to be more specific with presenting your problems insteasd of just putting up a bunch of code and asking others to fix it for you. Try to keep what you present focused on a specific problem.
-
Please help me with modifying this code
I am using the attached code to acauire and save data to a text file, using 'write measurement file' express VI.
WHat I want to do is to replace 'write to measurement VI' with low-level file I/O VIs. I tried to convert the express VI, but the obtained code is too complicated.
Anyone can give me hints for using file I/O Vis to implement same function without using the express VI? Thanks a lot.
Message Edited by Dejun on 08-27-2007 11:26 AM
Attachments:
4.png 14 KB
code.vi 121 KBAbove code is in a case of an event structure, i.e., each time I click a buttom, such as 'RUN', data acquisition begins and write data into a file.
What I want is, each time this event case is executed, a file is open, write data to it, and finally close this file. The next time when I run this case, maybe another file is open for writting data.
The problem of using 'write measure file' express VI is: if a file is open in one execution of the case, it will continuously be in 'open' after this case execution is finished, i.e., there is no explicit close file function with the express VI, which in some cases may be a problem. What I need is closing the file at the end of each execution of a event case. With low-level file I/O VIs, maybe I can directly put a close file VI there.
The data file should be in text format so that data analysis software, such as MS-powerpoint, can directly reads it.
Message Edited by Dejun on 08-27-2007 01:55 PM
Message Edited by Dejun on 08-27-2007 01:56 PM -
I have problem with account that i can't make update or buy from app store
There is massage appear in my payment page that i must contact with i tunes support to complete this transaction
Please help me to fixe this problem as soon possible
Hany hassan
0096597617317
0096596677186
Thank youYou need to Contact iTunes Support...
Apple Support iTunes Store Contact Us -
Hi, when ever I'm using 3G, on my Iphone4 sim stops working and network is lost, this started after I updated my phone with 6.0.1(10A523)version. Please help how to solve this problem. Thanks.
Photos/videos in the Camera Roll are not synced. Photos/videos in the Camera Roll are not touched with the iTunes sync process. Photos/videos in the Camera Roll can be imported by your computer which is not handled by iTunes. Most importing software includes an option to delete the photos/videos from the Camera Roll after the import process is complete. If is my understanding that some Windows import software supports importing photos from the Camera Roll, but not videos. Regardless, the import software should not delete the photos/videos from the Camera Roll unless you set the app to do so.
Photos/videos in the Camera Roll are included with your iPhone's backup. If you synced your iPhone with iTunes before the videos on the Camera Roll went missing and you haven't synced your iPhone with iTunes since they went missing, you can try restoring the iPhone with iTunes from the iPhone's backup. Don't sync the iPhone with iTunes again and decline the prompt to update the iPhone's backup after selecting Restore. -
Please help me to solve this date comparision issue..
Please help me to solve this issue..
If i have some data like the following..
ID START DATE END DATE
1 20080101 20080501
1 20080502 20080630
2 20080631 20080801
2 20080802 20080901
---------------> There is a break in date over here
2 20080930 20081029
2 20081030 20081130
I need to compare the End Date with the start date (These data will not be in order)
and find out if there is any break and should get the output date : *20080930*
I am trying to do this in SQL or PL/SQL.Please help me .
Thanks in advance.
phaniHi Frank ,
Sorry to bug you again. I ran your code on my actual data but not gettting the expected output.Here i am posting the actual code and the output that i got when i ran your code.Please bear with me and help me to solve this..
/* Formatted on 5/25/2009 2:27:24 PM (QP5 v5.115.810.9015) */
SELECT member_nbr,
aff_nbr,
ymdeff,
ymdend,
gap_before,
COUNT (gap_after)
OVER (PARTITION BY member_nbr, aff_nbr ORDER BY ymdend DESC)
AS gap_cnt
FROM (SELECT member_nbr,
aff_nbr,
ymdeff,
ymdend,
CASE
WHEN ymdeff >
LEAD(ymdend)
OVER (PARTITION BY member_nbr, aff_nbr
ORDER BY ymdend DESC)
+ 1
THEN
1
END
AS gap_before,
CASE
WHEN ymdend <
LAG(ymdeff)
OVER (PARTITION BY member_nbr, aff_nbr
ORDER BY ymdend DESC)
- 1
THEN
1
END
AS gap_after
------------I need this SQL to filter the whole data to the data that i posted in previous post -----
FROM ( SELECT ms1.member_nbr,
ms1.aff_nbr,
ms1.ymdeff,
ms1.ymdend,
ms1.void
FROM (SELECT ms.member_nbr,
ms.aff_nbr,
ms.ymdeff,
ms.ymdend,
ms.void
FROM MEMBER mb, member_span ms
WHERE mb.member_nbr = ms.member_nbr
AND (20090523 BETWEEN ms.ymdeff
AND ms.ymdend
AND TRIM (void) IS NULL)
AND mb.member_nbr = 'A1000073000 ')
eff_pcp,
member_span ms1
WHERE ms1.member_nbr = eff_pcp.member_nbr
AND (SUBSTR (eff_pcp.aff_nbr, 1, 6) =
SUBSTR (ms1.aff_nbr, 1, 6))
ORDER BY ms1.ymdeff DESC)
---------- end of my part ----------
table_x) got_gaps;Outputs that i got when i ran that code for each individual members..
Sorry to bug you frank and thanks for all the help.I will post here if i get any other data.
Thanks
phani -
Please help to re-write this query using exists or with
Hi please help to re-write this query using exists or with, i need to write same code for 45 day , 90 days and so on but sub query condition is same for all
SELECT SUM (DECODE (t_one_mon_c_paid_us, 0, 0, 1)) t_two_y_m_mul_ca_
FROM (SELECT SUM (one_mon_c_paid_us) t_one_mon_c_paid_us
FROM (
SELECT a.individual_id individual_id,
CASE
WHEN NVL
(b.ship_dt,
TO_DATE ('05-MAY-1955')
) >= SYSDATE - 45
AND a.country_cd = 'US'
AND b.individual_id in (
SELECT UNIQUE c.individual_id
FROM order c
WHERE c.prod_cd = 'A'
AND NVL (c.last_payment_dt,
TO_DATE ('05-MAY-1955')
) >= SYSDATE - 745)
THEN 1
ELSE 0
END AS one_mon_c_paid_us
FROM items b, addr a, product d
WHERE b.prod_id = d.prod_id
AND d.affinity_1_cd = 'ADH'
AND b.individual_id = a.individual_id)
GROUP BY individual_id)
Edited by: user4522368 on Aug 23, 2010 9:11 AMPlease try and place \ before and after you code \Could you not remove the inline column select with the following?
SELECT a.individual_id individual_id
,CASE
when b.Ship_dt is null then
3
WHEN b.ship_dt >= SYSDATE - 90
3
WHEN b.ship_dt >= SYSDATE - 45
2
WHEN b.ship_dt >= SYSDATE - 30
1
END AS one_mon_c_paid_us
FROM items b
,addr a
,product d
,order o
WHERE b.prod_id = d.prod_id
AND d.affinity_1_cd = 'ADH'
AND b.individual_id = a.individual_id
AND b.Individual_ID = o.Individual_ID
and o.Prod_CD = 'A'
and NVL (o.last_payment_dt,TO_DATE ('05-MAY-1955') ) >= SYSDATE - 745
and a.Country_CD = 'US' -
I just bought iWorks Serial Number Key over the internet. When I use the key, iWorks keep telling me the key is invalid!! Please help. (I bought this iWorks from someone in Singapore. I am using it in Malaysia.). Thanks
Downloaded the Trial version. It still says the serial number key is invalid. On the iWork page where I am suppose to enter the serial number key, the "Go Back" button is always BOLD, but the "Continue" button remains GREY all the time. The "Continue" button remains grey even after I have completed the key entry. I have to type the "Return" key on my keyboard to force enter the key. The message I get is still "Invalid key".
I have called Apple. The first person helped by asking me to delete certain items in some Folders and it still did not work. I was then connected to a senior person, but I heard over the recording that there were 15 persons waiting on the line. I had to end the call because the wait will take too long. -
hi,
I'm new for the JSP and got struck at this point .
I have a JSP page wherein it consists of a table and the servlet that retrieves the data from the DB(MY SQL). Now i need to fill the contents of the table as mentioned below.
First 5 rows must get printed then upon clicking the next button the next five rows must be filled.....and so on......
Please help me in reaching this requirement.
JSP CODE:
<%@ page import="java.io.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.*" %>
<html>
<head><title> TOP USERS </title>
</head>
<body bgcolor="c0c0c0">
<div align="center">
<table>
<tr bgcolor="white"><td> <font color="red" size="5"><b>TOP USERS </b> </font></td></tr>
</table>
</div>
<div align="center">
<form name="top">
<font face="verdana">
Report for TOP
<select name="users">
<option value="5">5
<option value="10">10
<option value="15">15
</select>
Users
<br> <br>
<% ArrayList list=new ArrayList();
list=(ArrayList)request.getAttribute("TOPUSERS");
%>
<table border="1" align="center" width=35%>
<tr>
<td align="center"><b> Name </b> </td>
<td align="center"> <b> Phone # </b> </td>
</tr>
<%
int cnt=10;
if(cnt!=0)
for(int i=0; i<cnt; i++)
%>
<tr>
<td align="left"> <% out.println(list.get(i));
i++; %>
</td>
<td align="right"> <% out.println(list.get(i));%>
</td>
</tr>
<% }
} %>
</table>
<table border="0" align="center" width=35% >
<tr><td align="right"> <input type="submit" value="next" name="next" onclick="return cnt+=10"> </td> </tr>
</table>
</font>
</form>
</div>
</body>
</html>Please correct the above code......
sorry if my code is wrong........
Here i can print the all the rows at once but i'm not able to pring in 5 rows and upon the clik of next the next five rows........Pass it as a hidden parameter.
-
Please help me to complete the transaction to purchase OS X mountain Lion version 10.8
Dear Sir/Madam,
Please kindly help me to complete this transaction to buy your OS X Mountain Lion .
Thanks a lot and Best Regards.
Dao Ngoc TaoNot an itunes question.
Try posting in the Mac App Store forum -
I have a ipod touch 4th gen and it wont chrage. When you plug it into the wall the lightniing bolt screen will apear but no matter how long you leave it, it will never turn on. Also it the lightning bolt screen wont even come on when you plug it into a computer (PC)..........PLease help its been like this for forever
Hi Gammer576775!
Here is an article that will help you troubleshoot this issue with your iPod touch:
iPod touch: Hardware troubleshooting
http://support.apple.com/kb/ts2771
Will not power on, or will not turn on unless connected to power
Verify that the Sleep/Wake button functions. If it does not function, inspect it for signs of damage. If the button is damaged or is not functioning when pressed, seek service.
Connect the iPod touch to an Apple USB power adapter and let it charge for at least ten minutes.
After at least 15 minutes, if the display turns on and…
The home screen appears, the device should be working. Continue charging it until it is completely charged and you see this battery icon in the upper-right corner of the screen: . Then disconnect the device from power. If it immediately turns off, seek service.
The low-battery image appears even after the iPod touch has charged for at least 20 minutes: See the "iPod touch displays the low-battery image and is unresponsive" symptom in this article.
Something other than the Home screen or low-battery image appears , continue with this article for further troubleshooting steps.
If the iPod touch did not turn on, reset it while connected to an Apple USB power adapter. If the display turns on, go to step 4.If the display remains black, go to the next step.
Restore the device. Connect it to a computer and open iTunes. If iTunes recognizes it and indicates that it is in recovery mode, attempt to restore the iPod touch. If the device doesn't appear in iTunes or if you have difficulties in restoring it, see this article for further assistance.
If restoring the iPod touch resolved the issue, go to step 4. If restoring it did not solve the issue, seek service.
Thanks for using the Apple Support Communities!
Cheers,
Braden -
My iPhone 6 ear speaker is not working properly I couldn't able to hear any thing from ear speaker to listen I had to put on loud speaker or to use hands free please help me out with this problem if some body have answer?
Hi Venkata from NZ,
If you are having an issue with the speaker on your iPhone, I would suggest that you troubleshoot using the steps in this article -
If you hear no sound or distorted sound from your iPhone, iPad, or iPod touch speaker - Apple Support
Thanks for using Apple Support Communities.
Best,
Brett L -
I have unabled 5 fingure gesture now not able to perform any task,also my power button is not working,please help me in removing this gesture,using I phone 4
I have unabled 5 fingure gesture now not able to perform any task,also my power button is not working,please help me in removing this gesture,using I phone 4
Maybe you are looking for
-
Hi, I have a table in which I populate entries by importing a .csv file. Now on clicking OK i want to read this entries on screen in the table and store it in the internal table. How do I read these entries (can be any number of rows) and store it in
-
Mini-DVI port does not work in windows 7
I am currently running boot camp 3.2 on windows 7 professional. When I attempt to use my display port it does not register in windows 7, however when i switch back to snow leopard it works perfectly fine. What can I do to fix this?
-
Can anyone help with my code?
Hello, I bought Photoshop last december, I got my invoice and everything went well untill the 30 days trial end, I can't use it anymore is asking for a code and I can't find it ANYWHERE, please help.
-
Getting a copy of Cold Fusion 6
Hi All, I've got a client who needs support for his CF 6 app. He doesn't want to upgrade to CF 8 right now, but that makes troubleshooting and development work a bit difficult, because I don't have a CF 6 license anywhere. I know you can download fre
-
How to get resources from jar-files
Hi in my app I load an image via the Toolkit.getImage() method. Works fine if the app and the image are in folders on disk. It fails to load the image, if the app (and the image) is packed in a jar file. How can I get the image from there? I try to g