Search Results

Search found 2170 results on 87 pages for 'matt dice'.

Page 2/87 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • JSF - Random Number using Beans (JAVA)

    - by Alex Encore Tr
    I am trying to create a jsf application which, upon page refresh increments the hit counter and generates two random numbers. What should be displayed on the window may look something like this: On your On your roll x you have thrown x and x For this program I decided to create two Beans, one to hold the page refresh counter and one to generate a random number. Those look like this for the moment: CounterBean.java package diceroll; public class CounterBean { int count=0; public CounterBean() { } public void setCount(int count) { this.count=count; } public int getCount() { count++; return count; } } RandomNumberBean.java package diceroll; import java.util.Random; public class RandomNumberBean { int rand=0; Random r = new Random(); public RandomNumberBean() { rand = r.nextInt(6); } public void setNextInt(int rand) { this.rand=rand; } public int getNextInt() { return rand; } } I have then created an index.jsp to display the above message. <html> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <f:view> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Roll the Dice</title> </head> <body> <h:form> <p> On your roll # <h:outputText value="#{CounterBean.count} " /> you have thrown <h:outputText value="#{RandomNumberBean.rand}" />and <h:outputText value="#{RandomNumberBean.rand} " /> </p> </h:form> </body> </f:view> </html> However, when I run the application, I get the following message: org.apache.jasper.el.JspPropertyNotFoundException: /index.jsp(14,20) '#{RandomNumberBean.rand}' Property 'rand' not found on type diceroll.RandomNumberBean Caused by: org.apache.jasper.el.JspPropertyNotFoundException - /index.jsp(14,20) '#{RandomNumberBean.rand}' Property 'rand' not found on type diceroll.RandomNumberBean I suppose there's a mistake with my faces-config.xml file, so I will post this here as well, see if somebody can provide some help: faces-config.xml <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"> <managed-bean> <managed-bean-name>CounterBean</managed-bean-name> <managed-bean-class>diceroll.CounterBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>RandomNumberBean</managed-bean-name> <managed-bean-class>diceroll.RandomNumberBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> </faces-config>

    Read the article

  • Will this ever result in a stack overflow error?

    - by David
    Will incrementing the instance variables of an object ever lead to a stack overflow error? For example: This method (java) will cause a stack overflow error: class StackOverflow { public static void StackOverflow (int x) { System.out.println (x) ; StackOverflow(x+1) ; } public static void main (String[]arg) { StackOverflow (0) ; } but will this?: (..... is a gap that i've put in to shorten the code. its long enough as it is.) import java.util.*; class Dice { String name ; int x ; int[] sum ; .... public Dice (String name) { this.name = name ; this.x = 0 ; this.sum = new int[7] ; } .... public static void main (String[] arg) { Dice a1 = new Dice ("a1") ; for (int i = 0; i<6000000; i++) { a1.roll () ; printDice(a1) ; } } .... public void roll () { this.x = randNum(1, this.sum.length) ; this.sum[x] ++ ; } public static int randNum (int a, int b) { Random random = new Random() ; int c = (b-a) ; int randomNumber = ((random.nextInt(c)) + a) ; return randomNumber ; } public static void printDice (Dice Dice) { System.out.println (Dice.name) ; System.out.println ("value: "+Dice.x) ; printValues (Dice) ; } public static void printValues (Dice Dice) { for (int i = 0; i<Dice.sum.length; i++) System.out.println ("#of "+i+"'s: "+Dice.sum[i]) ; } } The above doesn't currently cause a stack overflow error but could i get it too if i changed this line in main: for (int i = 0; i<6000000; i++) so that instead of 6 million something sufficiently high were there?

    Read the article

  • null pointer exception comparing two strings in java.

    - by David
    I got this error message and I'm not quite sure whats wrong: Exception in thread "main" java.lang.NullPointerException at Risk.runTeams(Risk.java:384) at Risk.blobRunner(Risk.java:220) at Risk.genRunner(Risk.java:207) at Risk.main(Risk.java:176) Here is the relevant bits of code (i will draw attention to the line numbers within the error message via comments in the code as well as inputs i put into the program while its running where relevant) public class Risk { ... public static void main (String[]arg) { String CPUcolor = CPUcolor () ; genRunner (CPUcolor) ; //line 176 ... } ... public static void genRunner (String CPUcolor) // when this method runs i select 0 and run blob since its my only option. Theres nothing wrong with this method so long as i know, this is only significant because it takes me to blob runner and because another one of our relelvent line numbers apears. { String[] strats = new String[1] ; strats[0] = "0 - Blob" ; int s = chooseStrat (strats) ; if (s == 0) blobRunner (CPUcolor) ; // this is line 207 } ... public static void blobRunner (String CPUcolor) { System.out.println ("blob Runner") ; int turn = 0 ; boolean gameOver = false ; Dice other = new Dice ("other") ; Dice a1 = new Dice ("a1") ; Dice a2 = new Dice ("a2") ; Dice a3 = new Dice ("a3") ; Dice d1 = new Dice ("d1") ; Dice d2 = new Dice ("d2") ; space (5) ; Territory[] board = makeBoard() ; IdiceRoll (other) ; String[] colors = runTeams(CPUcolor) ; //this is line 220 Card[] deck = Card.createDeck () ; System.out.println (StratUtil.canTurnIn (deck)) ; while (gameOver == false) { idler (deck) ; board = assignTerri (board, colors) ; checkBoard (board, colors) ; } } ... public static String[] runTeams (String CPUcolor) { boolean z = false ; String[] a = new String[6] ; while (z == false) { a = assignTeams () ; printOrder (a) ; boolean CPU = false ; for (int i = 0; i<a.length; i++) { if (a[i].equals(CPUcolor)) CPU = true ; //this is line 384 } if (CPU==false) { System.out.println ("ERROR YOU NEED TO INCLUDE THE COLOR OF THE CPU IN THE TURN ORDER") ; runTeams (CPUcolor) ; } System.out.println ("is this turn order correct? (Y/N)") ; String s = getIns () ; while (!((s.equals ("y")) || (s.equals ("Y")) || (s.equals ("n")) || (s.equals ("N")))) { System.out.println ("try again") ; s = getIns () ; } if (s.equals ("y") || s.equals ("Y") ) z = true ; } return a ; } ... } // This } closes the class The reason i don't think i should be getting a Null:pointerException is because in this line: a[i].equals(CPUcolor) a at index i holds a string and CPUcolor is a string. Both at this point definatly have a value neither is null. Can anyone please tell me whats going wrong?

    Read the article

  • Top 31 Favorite Features in Windows Server 2012

    - by KeithMayer
    Over the past month, my fellow IT Pro Technical Evangelists and I have authored a series of articles about our Top 31 Favorite Features in Windows Server 2012.  Now that our series is complete, I’m providing a clickable index below of all of the articles in the series for your convenience, just in case you perhaps missed any of them when they were first released.  Hope you enjoy our Favorite Features in Windows Server 2012! Top 31 Favorite Features in Windows Server 2012 The Cloud OS Platform by Kevin Remde Server Manager in Windows Server 2012 by Brian Lewis Feel the Power of PowerShell 3.0 by Matt Hester Live Migrate Your VMS in One Line of PowerShell by Keith Mayer Windows Server 2012 and Hyper-V Replica by Kevin Remde Right-size IT Budgets with “Storage Spaces” by Keith Mayer Yes, there is an “I” in Team – the NIC Team! by Kevin Remde Hyper-V Network Virtualization by Keith Mayer Get Happy over the FREE Hyper-V Server 2012 by Matt Hester Simplified BranchCache in Windows Server 2012 by Brian Lewis Getting Snippy with PowerShell 3.0 by Matt Hester How to Get Unbelievable Data Deduplication Results by Chris Henley of Veeam Simplified VDI Configuration and Management by Brian Lewis Taming the New Task Manager by Keith Mayer Improve File Server Resiliency with ReFS by Keith Mayer Simplified DirectAccess by Sumeeth Evans SMB 3.0 – The Glue in Windows Server 2012 by Matt Hester Continuously Available File Shares by Steven Murawski of Edgenet Server Core - Improved Taste, Less Filling, More Uptime by Keith Mayer Extend Your Hyper-V Virtual Switch by Kevin Remde To NIC or to Not NIC Hardware Requirements by Brian Lewis Simplified Licensing and Server Versions by Kevin Remde I Think, Therefore IPAM! by Kevin Remde Windows Server 2012 and the RSATs by Kevin Remde Top 3 New Tricks in the Active Directory Admin Center by Keith Mayer Dynamic Access Control by Brian Lewis Get the Gremlin out of Your Active Directory Virtualized Infrastructure by Matt Hester Scoping out the New DHCP Failover by Keith Mayer Gone in 8 Seconds – The New CHKDSK by Matt Hester New Remote Desktop Services (RDS) by Brian Lewis No Better Time Than Now to Choose Hyper-V by Matt Hester What’s Next? Keep Learning! Want to learn more about Windows Server 2012 and Hyper-V Server 2012?  Want to prepare for certification on Windows Server 2012? Do It: Join our Windows Server 2012 “Early Experts” Challenge online peer study group for FREE at http://earlyexperts.net. You’ll get FREE access to video-based lectures, structured study materials and hands-on lab activities to help you study and prepare!  Along the way, you’ll be part of an IT Pro community of over 1,000+ IT Pros that are all helping each other learn Windows Server 2012! What are Your Favorite Features? Do you have a Favorite Feature in Windows Server 2012 that we missed in our list above?  Feel free to share your favorites in the comments below! Keith Build Your Lab! Download Windows Server 2012 Don’t Have a Lab? Build Your Lab in the Cloud with Windows Azure Virtual Machines Want to Get Certified? Join our Windows Server 2012 "Early Experts" Study Group

    Read the article

  • 2 Shaders using the same vertex data

    - by Fonix
    So im having problems rendering using 2 different shaders. Im currently rendering shapes that represent dice, what i want is if the dice is selected by the user, it draws an outline by drawing the dice completely red and slightly scaled up, then render the proper dice over it. At the moment some of the dice, for some reason, render the wrong dice for the outline, but the right one for the proper foreground dice. Im wondering if they aren't getting their vertex data mixed up somehow. Im not sure if doing something like this is even allowed in openGL: glGenBuffers(1, &_vertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(GLfloat), vertices, GL_STATIC_DRAW); glEnableVertexAttribArray(effect->vertCoord); glVertexAttribPointer(effect->vertCoord, 3, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(effect->toon_vertCoord); glVertexAttribPointer(effect->toon_vertCoord, 3, GL_FLOAT, GL_FALSE, 0, 0); im trying to bind the vertex data to 2 different shaders here when i load my first shader i have: vertCoord = glGetAttribLocation(TexAndLighting, "position"); and the other shader has: toon_vertCoord = glGetAttribLocation(Toon, "position"); if I use the shaders independently of each other they work fine, but when i try to render both one on top of the other they get the model mixed up some times. here is how my draw function looks: - (void) draw { [EAGLContext setCurrentContext:context]; glBindVertexArrayOES(_vertexArray); effect->modelViewMatrix = mvm; effect->numberColour = GLKVector4Make(numbers[colorSelected].r, numbers[colorSelected].g, numbers[colorSelected].b, 1); effect->faceColour = GLKVector4Make(faceColors[colorSelected].r, faceColors[colorSelected].g, faceColors[colorSelected].b, 1); if(selected){ [effect drawOutline]; //this function prepares the shader glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0); } [effect prepareToDraw]; //same with this one glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_SHORT, 0); } this is what it looks like, as you can see most of the outlines are using the wrong dice, or none at all: links to full code: http://pastebin.com/yDKb3wrD Dice.mm //rendering stuff http://pastebin.com/eBK0pzrK Effects.mm //shader stuff http://pastebin.com/5LtDAk8J //my shaders, shouldn't be anything to do with them though TL;DR: trying to use 2 different shaders that use the same vertex data, but its getting the models mixed up when rendering using both at the same time, well thats what i think is going wrong, quite stumped actually.

    Read the article

  • OSX - User home directories shared via NFS

    - by Hugh
    Hi, I've run into some problems with how I've got user home directories set up on our system here. Our server is an XServe, using Open Directory to manage the user accounts. The majority of our workstations are OSX, but there are a few running Linux (Centos 5.3), and, as time goes on, we expect the proportion of Linux workstations to increase (at some point, we expect to move the server side over to Linux too, but for now we're running with what we've already got) To ensure that the Linux and OSX workstations both see user's home directories in the same place, I shared the home directories using NFS. On the server end, the home directories are stored in: /Volumes/data/company_users This is mounted on the workstations to: /mount/company_users This work fine on the Linux workstations, but there is some weirdness under OSX. For the user who is logged in through the GUI, it all works just fine. However, if a user tries to SSH into a machine that they are not the primary user on, they often have no access to their own home directory. It looks as though OSX is trying to do something else to the user home directories mount point when you log in through the GUI.... For example, on this machine (nv001), I (hugh) am logged into the GUI. Last login: Mon Mar 8 18:17:52 on ttys011 [nv001:~] hugh% ls -al /mount/company_users total 40 drwxrwxrwx 26 hugh wheel 840 27 Jan 19:09 . drwxr-xr-x 6 admin admin 204 19 Dec 18:36 .. drwx------+ 128 hugh staff 4308 27 Feb 23:36 hugh drwx------+ 26 matt staff 840 4 Dec 14:14 matt [nv001:~] hugh% So Matt's home directory is accessible to him. However, if I try to switch to him: [nv001:~] hugh% su - matt Password: su: no directory [nv001:~] hugh% Or: [nv001:~] hugh% su matt Password: tcsh: Permission denied tcsh: Trying to start from "/mount/company_users/matt" tcsh: Trying to start from "/" [nv001:/] matt% Does anyone have any idea why it might be doing this? It's causing me all sorts of problems at the moment... The only machine that I can successfully switch users at the moment is the server that the user directories are stored on, where /mount/company_users is actually just a symlink to /Volumes/data/company_users Thanks

    Read the article

  • Mac OS X - User home directories shared via NFS

    - by Hugh
    I've run into some problems with how I've got user home directories set up on our system here. Our server is an XServe, using Open Directory to manage the user accounts. The majority of our workstations are OS X, but there are a few running Linux (Centos 5.3), and, as time goes on, we expect the proportion of Linux workstations to increase (at some point, we expect to move the server side over to Linux too, but for now we're running with what we've already got) To ensure that the Linux and OS X workstations both see user's home directories in the same place, I shared the home directories using NFS. On the server end, the home directories are stored in: /Volumes/data/company_users This is mounted on the workstations to: /mount/company_users This work fine on the Linux workstations, but there is some weirdness under OS X. For the user who is logged in through the GUI, it all works just fine. However, if a user tries to SSH into a machine that they are not the primary user on, they often have no access to their own home directory. It looks as though OS X is trying to do something else to the user home directories mount point when you log in through the GUI.... For example, on this machine (nv001), I (hugh) am logged into the GUI. Last login: Mon Mar 8 18:17:52 on ttys011 [nv001:~] hugh% ls -al /mount/company_users total 40 drwxrwxrwx 26 hugh wheel 840 27 Jan 19:09 . drwxr-xr-x 6 admin admin 204 19 Dec 18:36 .. drwx------+ 128 hugh staff 4308 27 Feb 23:36 hugh drwx------+ 26 matt staff 840 4 Dec 14:14 matt [nv001:~] hugh% So Matt's home directory is accessible to him. However, if I try to switch to him: [nv001:~] hugh% su - matt Password: su: no directory [nv001:~] hugh% Or: [nv001:~] hugh% su matt Password: tcsh: Permission denied tcsh: Trying to start from "/mount/company_users/matt" tcsh: Trying to start from "/" [nv001:/] matt% Does anyone have any idea why it might be doing this? It's causing me all sorts of problems at the moment... The only machine that I can successfully switch users at the moment is the server that the user directories are stored on, where /mount/company_users is actually just a symlink to /Volumes/data/company_users

    Read the article

  • Exchange not preserving the "To:" field

    - by Matt Simmons
    I've got a hosted exchange solution through Apptix, which isn't the problem, I think, but it may be relevant. I have my main account, [email protected], and to that, I have an alias, matt[email protected]. Whenever I send an email to matt[email protected], I examine the headers, and I see the "To:" field being correct, "To: matt[email protected]". All is well. I recently set up another user, [email protected] to function as a multipurpose mailbox. I aliased "[email protected]" to the services account in the same method that I did "matt[email protected]", however nothing I have sent to "[email protected]" actually goes TO "[email protected]". All of the headers say "To: [email protected]". This makes it extremely difficult to filter based on headers alone. Does anyone have any feedback on what settings I would need to look at in order to fix that?

    Read the article

  • Exchange not preserving the "To:" field

    - by Matt Simmons
    I've got a hosted exchange solution through Apptix, which isn't the problem, I think, but it may be relevant. I have my main account, [email protected], and to that, I have an alias, matt[email protected]. Whenever I send an email to matt[email protected], I examine the headers, and I see the "To:" field being correct, "To: matt[email protected]". All is well. I recently set up another user, [email protected] to function as a multipurpose mailbox. I aliased "[email protected]" to the services account in the same method that I did "matt[email protected]", however nothing I have sent to "[email protected]" actually goes TO "[email protected]". All of the headers say "To: [email protected]". This makes it extremely difficult to filter based on headers alone. Does anyone have any feedback on what settings I would need to look at in order to fix that?

    Read the article

  • Multiple range product in Python

    - by Tyr
    Is there a better way to do this: perms = product(range(1,7),range(1,7),range(1,7)) so that I can choose how many ranges I use? I want it to be equivalent to this, but scalable. def dice(num) if num == 1: perms = ((i,) for i in range(1,7)) elif num == 2: perms = product(range(1,7),range(1,7)) elif num == 3: perms = product(range(1,7),range(1,7),range(1,7)) #... and so on but I know there has to be a better way. I'm using it for counting dice outcomes. The actual code def dice(selection= lambda d: d[2]): perms = itertools.product(range(1,7),range(1,7),range(1,7)) return collections.Counter(((selection(sorted(i)) for i in perms))) where I can call it with a variety of selectors, like sum(d[0:2]) for the sum of the lowest 2 dice or d[1] to get the middle dice.

    Read the article

  • Agile Testing Days 2012 – My First Conference!

    - by Chris George
    I’d like to give you a bit of background first… so please bear with me! In 1996, whilst studying for my final year of my degree, I applied for a job as a C++ Developer at a small software house in Hertfordshire  After bodging up the technical part of the interview I didn’t get the job, but was offered a position as a QA Engineer instead. The role sounded intriguing and the pay was pretty good so in the absence of anything else I took it. Here began my career in the world of software testing! Back then, testing/QA was often an afterthought, something that was bolted on to the development process and very much a second class citizen. Test automation was rare, and tools were basic or non-existent! The internet was just starting to take off, and whilst there might have been testing communities and resources, we were certainly not exposed to any of them. After 8 years I moved to another small company, and again didn’t find myself exposed to any of the changes that were happening in the industry. It wasn’t until I joined Red Gate in 2008 that my view of testing and software development as a whole started to expand. But it took a further 4 years for my view of testing to be totally blown open, and so the story really begins… In May 2012 I was fortunate to land the role of Head of Test Engineering. Soon after, I received an email with details for the “Agile Testi However, in my new role, I decided that it was time to bite the bullet and at least go to one conference. Perhaps I could get some new ideas to supplement and support some of the ideas I already had.ng Days” conference in Potsdam, Germany. I looked over the suggested programme and some of the talks peeked my interest. For numerous reasons I’d shied away from attending conferences in the past, one of the main ones being that I didn’t see much benefit in attending loads of talks when I could just read about stuff like that on the internet. So, on the 18th November 2012, myself and three other Red Gaters boarded a plane at Heathrow bound for Potsdam, Germany to attend Agile Testing Days 2012. Tutorial Day – “Software Testing Reloaded” We chose to do the tutorials on the 19th, I chose the one titled “Software Testing Reloaded – So you wanna actually DO something? We’ve got just the workshop for you. Now with even less powerpoint!”. With such a concise and serious title I just had to see what it was about! I nervously entered the room to be greeted by tables, chairs etc all over the place, not set out and frankly in one hell of a mess! There were a few people in there playing a game with dice. Okaaaay… this is going to be a long day! Actually the dice game was an exercise in deduction and simplification… I found it very interesting and is certainly something I’ll be using at work as a training exercise! (I won’t explain the game here cause I don’t want to let the cat out of the bag…) The tutorial consisted of several games, exploring different aspects of testing. They were all practical yet required a fair amount of thin king. Matt Heusser and Pete Walen were running the tutorial, and presented it in a very relaxed and light-hearted manner. It was really my first experience of working in small teams with testers from very different backgrounds, and it was really enjoyable. Matt & Pete were very approachable and offered advice where required whilst still making you work for the answers! One of the tasks was to devise several strategies for testing some electronic dice. The premise was that a Vegas casino wanted to use the dice to appeal to the twenty-somethings interested in tech, but needed assurance that they were as reliable and random as traditional dice. This was a very interesting and challenging exercise that forced us to challenge various assumptions, determine/clarify requirements but most of all it was frustrating because the dice made a very very irritating beeping noise. Multiple that by at least 12 dice and I was dreaming about them all that night!! Some of the main takeaways that were brilliantly demonstrated through the games were not to make assumptions, challenge requirements, and have fun testing! The tutorial lasted the whole day, but to be honest the day went very quickly! My introduction into the conference experience started very well indeed, and I would talk to both Matt and Pete several times during the 4 days. Days 1,2 & 3 will be coming soon…  

    Read the article

  • In this program(Java) I'm trying to make a dice roller. How do I make it so it rolls a bunch of times and adds the rolls?

    - by Mac
    import java.util.Random; public class dice { private int times; private int roll; private int side; Random roller = new Random(); public void setTimes(int sides) { times = sides; } public void setSides(int die) { side = die; } public int getRoll() //this is where the "rolling" happens { int total = 0; int c = 0; while (c <= times) { c = c + 1; int rol = 0; roll = roller.nextInt(side) + 1; rol = rol + roll; total = rol; } return total; } } If you need the GUIWindow and the main, just ask

    Read the article

  • Code to generate random numbers in C++

    - by user1678927
    Basically I have to write a program to generate random numbers to simulate the rolling of a pair of dice. This program should be constructed in multiple files. The main function should be in one file, the other functions should be in a second source file, and their prototypes should be in a header file. First I write a short function that returns a random value between 1 and 6 to simulate the rolling of a single 6-sided die.Second, i write a function that pretends to roll a pair of dice by calling this function twice. My program starts by asking the user how many rolls should be made. Then I write a function to simulate rolling the dice this many times, keeping a count of exactly how many times the values 2,3,4,5,6,7,8,9,10,11,12(each number is the sum of a pair of dice) occur in an array. Later I write a function to display a small bar chart using these counts that ideally would look something like below for a sample of 144 rolls, where the number of asterisks printed corresponds to the count: 2 3 4 5 6 7 8 9 10 11 12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Next, to see how well the random number generator is doing, I write a function to compute the average value rolled. Compare this to the ideal average of 7. Also, print out a small table showing the counts of each roll made by the program, the ideal count based on the frequencies above given the total number of rolls, and the difference between these values in separate columns. This is my incomplete code so far: "Compiler visual studio 2010" int rolling(){ //Function that returns a random value between 1 and 6 rand(unsigned(time(NULL))); int dice = 1 + (rand() %6); return dice; } int roll_dice(int num1,int num2){ //it calls 'rolling function' twice int result1,result2; num1 = rolling(); num2 = rolling(); result1 = num1; result2 = num2; return result1,result2; } int main(void){ int times,i,sum,n1,n2; int c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11;//counters for each sum printf("Please enter how many times you want to roll the dice.\n") scanf_s("%i",&times); I pretend to use counters to count each sum and store the number(the count) in an array. I know i need a loop (for) and some conditional statements (if) but m main problem is to get the values from roll_dice and store them in n1 and n2 so then i can sum them up and store the sum in 'sum'.

    Read the article

  • SQL Syntax to count unique users completing a task

    - by Belliez
    I have the following code which shows me what users has completed ticket and this lists each user and the date they close a ticket. i.e. Paul Matt Matt Bob Matt Paul Matt Matt At the moment I manually count each user myself to see their totals for the day. EDIT: Changed output as columns instead of rows: What I have been trying to do is get SQL Server to do this for me i.e. the final result to look like: Paul | 2 Matt | 5 Bob | 1 My code I am currently using is and I would be greatful if someone can help me change this so I can get it outputting something similar to above? DECLARE @StartDate DateTime; DECLARE @EndDate DateTime; -- Date format: YYYY-MM-DD SET @StartDate = '2013-11-06 00:00:00' SET @EndDate = GETDATE() -- Today SELECT (select Username from Membership where UserId = Ticket.CompletedBy) as TicketStatusChangedBy FROM Ticket INNER JOIN TicketStatus ON Ticket.TicketStatusID = TicketStatus.TicketStatusID INNER JOIN Membership ON Ticket.CheckedInBy = Membership.UserId WHERE TicketStatus.TicketStatusName = 'Completed' and Ticket.ClosedDate >= @StartDate --(GETDATE() - 1) and Ticket.ClosedDate <= @EndDate --(GETDATE()-0) ORDER BY Ticket.CompletedBy ASC, Ticket.ClosedDate ASC Thank you for your help and time.

    Read the article

  • Hot-hot-hot for jobs in Java and mobile software

    - by hinkmond
    It's hot-hot-hot! The market for Java and mobile developers keeps growing hotter, and hotter--so says the latest Dice survey. See: Dice survey says Java & Mobile are tops Here's a quote: The market for mobile developers is expanding faster than the talent pool can adapt, a Dice survey indicates. Software developers in general—as well as Java, mobile software and Microsoft .Net developers in particular—are in short supply today. Those fields represent four of the top five most difficult positions IT managers are looking to fill... ... The New York/New Jersey metro area led the country with 8,871 positions listed... So, if you are looking to get into software development get crackin' in learning Java mobile programming and move to NY or NJ. Let's go Mets! Hinkmond

    Read the article

  • Introducing Ben Barreth, Community Builder &amp; Software Developer at GWB

    - by Staff of Geeks
    Please extend a warm welcome to Ben Barreth as the new community builder and full-time software developer at Geeks With Blogs. We've been wanting to add some cool features to the site but haven't had the opportunity until now. Adding Ben to the team should give us a big kick in the right direction. Ben has several years of .Net development experience and is heavily involved in the startup community in Kansas City, including the KC Startup Village as well as his own startup initiatives: Homes for Hackers and FreeIdeas.co. He loves working with people even more than coding and is excited to serve the GWB community in any way possible. Ben originally met Matt Watson as a beta tester for Stackify, the software company that gives developers the safe & secure access to troubleshoot in production. Jeff Julian and Matt are old friends and recently decided the site needed new ownership to carry it forward and build the enhancements it deserves. The site management transferred in October and Matt quickly began looking for a full-time community builder to lead the charge. Ben bumped into Matt once again at a Tech Cocktail event at the Boulevard Brewery where Stackify was presenting and an alliance was forged. Yes, the beer really IS that good! Which brings us to the biggest question of all: Where do you want Geeks with Blogs to go next? As a contributor to the GWB community, now is your chance to be heard! What are we missing? Features on our radar: New templates Add a code "formatter" to posts Add categories to blog feeds Re-skin the site and redesign the logo Feel free to contact Ben with further questions and ideas below. We need your help! @BenBarreth [email protected] Cell: 816-332-9770 www.linkedin.com/in/benbarreth

    Read the article

  • Social Engineering approach to collecting from deadbeat ebay winners

    - by Malcolm Anderson
    You just sold something on e-bay and now the winner won't pay up.  What do you do?  I'm not sure what the legality of this kind of Social Engineering hack is, but I believe you've got to give it points for elegance.   Here's the link to the lifehacker.com post (I can't find the original Reddit post.) Reddit user "BadgerMatt" (we'll call him Matt for short) recently posted a story about how he tried to sell tickets to a sporting event on eBay, but when the auction was won the winning bidder backed out of the deal. In some cases this is mainly an inconvenience and you can re-list the item, but Matt was selling tickets to a sporting event and no longer had the time to do that. With the losing bidders uninterested in the tickets, he was going to end up stuck with tickets he couldn't use and a deadbeat bidder who was unwilling to honor their contract. Rather than give up, Matt decided to trick her into paying: I created a new eBay account, "Payback" we'll call it, and sent her a message: "Hi there, I noticed you won an auction for 4 [sporting event] tickets. I meant to bid on these but couldn't get to a computer. I wanted to take my son and dad and would be willing to give you $1,000 for the tickets. I imagine that you've already made plans to attend, but I figured it was worth a shot." The woman agreed, but for $1,100. She paid for the auction, received the tickets, and then Matt (of course) never re-purchased them. Needless to say, the woman was angry. Perhaps it was the wrong thing for the right reasons, but I'm mostly jealous I never thought of it back when I still sold things on eBay.

    Read the article

  • constructing a recursive function returning an array

    - by Admiral Kunkka
    I'm developing a function that has a random chance to loop through itself and put it's results in one array for me to use later in my PHP class. Is there a better way to do this more organized, specifically case 5. The array becomes sloppy if it rolls 5, after 5, after 5 looking unpleasant. private function dice($sides) { return mt_rand(1, $sides); } private function randomLoot($dice) { switch($dice) { case 1: $array[] = "A fancy mug."; break; case 2: $array[] = "A buckler."; break; case 3: $array[] = "A sword."; break; case 4: $array[] = "A jewel."; break; case 5: $array[] = "A treasure chest with contents:"; $count = $this->dice(3); $i = 1; while($i <= $count) { $array[] = $this->randomLoot($this->dice(5)); $i++; } break; } return $array; }

    Read the article

  • Calculate the number of ways to roll a certain number

    - by helloworld
    I'm a high school Computer Science student, and today I was given a problem to: Program Description: There is a belief among dice players that in throwing three dice a ten is easier to get than a nine. Can you write a program that proves or disproves this belief? Have the computer compute all the possible ways three dice can be thrown: 1 + 1 + 1, 1 + 1 + 2, 1 + 1 + 3, etc. Add up each of these possibilities and see how many give nine as the result and how many give ten. If more give ten, then the belief is proven. I quickly worked out a brute force solution, as such int sum,tens,nines; tens=nines=0; for(int i=1;i<=6;i++){ for(int j=1;j<=6;j++){ for(int k=1;k<=6;k++){ sum=i+j+k; //Ternary operators are fun! tens+=((sum==10)?1:0); nines+=((sum==9)?1:0); } } } System.out.println("There are "+tens+" ways to roll a 10"); System.out.println("There are "+nines+" ways to roll a 9"); Which works just fine, and a brute force solution is what the teacher wanted us to do. However, it doesn't scale, and I am trying to find a way to make an algorithm that can calculate the number of ways to roll n dice to get a specific number. Therefore, I started generating the number of ways to get each sum with n dice. With 1 die, there is obviously 1 solution for each. I then calculated, through brute force, the combinations with 2 and 3 dice. These are for two: There are 1 ways to roll a 2 There are 2 ways to roll a 3 There are 3 ways to roll a 4 There are 4 ways to roll a 5 There are 5 ways to roll a 6 There are 6 ways to roll a 7 There are 5 ways to roll a 8 There are 4 ways to roll a 9 There are 3 ways to roll a 10 There are 2 ways to roll a 11 There are 1 ways to roll a 12 Which looks straightforward enough; it can be calculated with a simple linear absolute value function. But then things start getting trickier. With 3: There are 1 ways to roll a 3 There are 3 ways to roll a 4 There are 6 ways to roll a 5 There are 10 ways to roll a 6 There are 15 ways to roll a 7 There are 21 ways to roll a 8 There are 25 ways to roll a 9 There are 27 ways to roll a 10 There are 27 ways to roll a 11 There are 25 ways to roll a 12 There are 21 ways to roll a 13 There are 15 ways to roll a 14 There are 10 ways to roll a 15 There are 6 ways to roll a 16 There are 3 ways to roll a 17 There are 1 ways to roll a 18 So I look at that, and I think: Cool, Triangular numbers! However, then I notice those pesky 25s and 27s. So it's obviously not triangular numbers, but still some polynomial expansion, since it's symmetric. So I take to Google, and I come across this page that goes into some detail about how to do this with math. It is fairly easy(albeit long) to find this using repeated derivatives or expansion, but it would be much harder to program that for me. I didn't quite understand the second and third answers, since I have never encountered that notation or those concepts in my math studies before. Could someone please explain how I could write a program to do this, or explain the solutions given on that page, for my own understanding of combinatorics? EDIT: I'm looking for a mathematical way to solve this, that gives an exact theoretical number, not by simulating dice

    Read the article

  • Remove a single non-unique value from a sequence in F#

    - by mavnn
    I have a sequence of integers representing dice in F#. In the game in question, the player has a pool of dice and can choose to play one (governed by certain rules) and keep the rest. If, for example, a player rolls a 6, 6 and a 4 and decides to play one the sixes, is there a simple way to return a sequence with only one 6 removed? Seq.filter (fun x -> x != 6) dice removes all of the sixes, not just one.

    Read the article

  • how to reset gnome panel?

    - by Matt
    I think my gnome-panel is messed up because I alt+right click it and nothing pops up. I'm on 12.04, classic gnome desktop. so I used locate and found gnome-panel in .gconf somewhere, how do I clear just gnome-panel's settings so that I can add things to my panel again? edit: matt: ~/.gconf $ find|grep -iw panel ./desktop/ibus/panel ./desktop/ibus/panel/%gconf.xml ./apps/gnome-settings/gnome-panel ./apps/gnome-settings/gnome-panel/%gconf.xml

    Read the article

  • Writing to a specific line of a file.

    - by helpmeh
    I have a .dat file with data like this in "James","Project5","15/05/2010","3" "Matt","Project1","01/05/2010","5" "Ellie","Project5","24/04/2010","1" "Ellie","Project2","10/05/2010","3" "Matt","Project3","03/05/2010","4" It gets written in with thise code. Private Sub Command2_Click() Open jobs For Append As #1 Write #1, Combo1, Combo3, Combo2, Text3 Close #1 End Sub I instead would like to write it to the file so that if a persons name is already in the file then it would just put the data in the file, under their that is already there but without the name. I can't figure out how to do this but this is what I would like it to end up like. "James","Project5","15/05/2010","3" "Matt","Project1","01/05/2010","5" "Ellie","Project5","24/04/2010","1" "Project2","10/05/2010","3" "Matt","Project3","03/05/2010","4" Any help would be fantastic!

    Read the article

  • Why can't my Apache see my media folder?

    - by alex
    Alias /media/ /home/matt/repos/hello/media <Directory /home/matt/repos/hello/media> Options -Indexes Order deny,allow Allow from all </Directory> WSGIScriptAlias / /home/matt/repos/hello/wsgi/django.wsgi /media is my directory. When I go to mydomain.com/media/, it says 403 Forbidden. And, the rest of my site doesn't work because all static files are 404s. Why? Edit: hello is my project folder

    Read the article

  • Storing and retrieving CGPoints inside NSMutableArray

    - by Matt Dice
    I've looked through countless questions on here and elsewhere and cannot for the life of me figure out what I'm doing wrong. I'm trying to store an array of CGPoints as NSValues inside of an NSMutableArray named points like so on the iPhone: NSValue *point = [NSValue valueWithCGPoint:firstTouch]; NSLog(@"NSValue *point = %@", point); [points addObject:point]; NSLOG OUTPUT NSValue *point = NSPoint: {120, 221} Everything is going smooth converting from the CGPoint to NSValue. But when I try to retrieve the point I get nothing. NSValue *getPoint = [points objectAtIndex:0]; CGPoint thePoint = [getPoint CGPointValue]; NSLog(@"Point = %@", NSStringFromCGPoint(thePoint)); NSLOG OUTPUT Point = {0, 0} The points should be the same but I'm getting a null result. For testing purposes this is happening in the touchesBegan method. Does anyone have any idea where I'm going wrong? Thanks in advance.

    Read the article

  • Google présente les trois stratégies les plus importantes pour le référencement en 2011 : rapidité, contrôle interne et réseaux sociaux

    Google présente les trois stratégies les plus importantes pour le référencement en 2011 Rapidité, contrôle interne et Webmarketing sur les réseaux sociaux Sur sa chaine YouTube, le centre Google Webmaster Help répond régulièrement aux questions les plus pertinentes venant de professionnels des divers métiers du web. Cette semaine, Matt Cutts, responsable de l'équipe anti-spam de Google, répond à une question particulièrement intéressante : « Si vous étiez un expert en optimisation pour les moteurs de recherche dans une grande entreprise, quelles sont les trois choses que vous incluriez dans votre stratégie pour 2011 ? » Pour Matt Cutts, la première chose qu'i...

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >