Search Results

Search found 2229 results on 90 pages for 'newbie'.

Page 11/90 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Java Newbie can't do simple Math, operator error

    - by elguapo-85
    Trying to do some really basic math here, but my lack of understanding of Java is causing some problems for me. double[][] handProbability = new double[][] {{0,0,0},{0,0,0},{0,0,0}}; double[] handProbabilityTotal = new double[] {0,0,0}; double positivePot = 0; double negativePot = 0; int localAhead = 0; int localTied = 1; int localBehind = 2; //do some stuff that adds values to handProbability and handProbabilityTotal positivePot = (handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0)); negativePot = (handProbability[localAhead][localBehind] + (handProbability[localAhead][localTied] / 2.0) + (handProbability[localTied][localBehind] / 2.0) ) / (handProbabilityTotal[localAhead] + (handProbabilityTotal[localTied] / 2.0)); The last two lines are giving me problems (sorry for their lengthiness). Compiler Errors: src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double[],double positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) ); ^ src/MyPokerClient/MyPokerClient.java:180: operator + cannot be applied to double, positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) ); ^ src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double, positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) ); Not really sure what the problem is. You shouldn't need anything special for basic math, right?

    Read the article

  • Connecting to an MQ: Newbie question

    - by deltamatrix
    Hi, I am a novice with Websphere MQ and require some novice help. I am using Websphere MQ Explorer to connect to a queue but do not know how to write the connection string. I have all the details (host, port, channel, queue manager name) but do not know how to put them together correctly as a connection string. Can any help this novice? Thanks

    Read the article

  • Help a newbie with a PHP Function

    - by danit
    I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using XMLRPC, can anyone give me the basics for using this function and maybe a brief over view? I want to learn how functions work and how to use them.

    Read the article

  • C newbie malloc question

    - by roufamatic
    Why doesn't this print 5? void writeValue(int* value) { value = malloc(sizeof(int)); *value = 5; } int main(int argc, char * argv) { int* value = NULL; writeValue(value); printf("value = %d\n", *value); // error trying to access 0x00000000 } and how can I modify this so it would work while still using a pointer as an argument to writeValue?

    Read the article

  • Java Enum Newbie Question

    - by ikurtz
    i have a situation where i need the Checker enum below used in multiple classes: package Sartre.Connect4; public enum Checker { EMPTY, RED, YELLOW } so i put the Checker in a Checker.java file and then from the classes that need it i simply do the following: example: public Cell(){ currentCell = Checker.EMPTY; } example: public Cell(Checker checker){ currentCell = checker; } and the code compiles fine and runs fine also. so what is my question? well being new to Java i am just wondering if the way i use Checker without encapsulating it in a class is a sound implementation? it may be because of The enum declaration defines a class (called an enum type). as noted in Java docs enum tutorial page. thank you for your insight into this matter.

    Read the article

  • Newbie question about file formatting in Python

    - by user568041
    I'm writing a simple program in Python 2.7 using pycURL library to submit file contents to pastebin. Here's the code of the program: #!/usr/bin/env python2 import pycurl, os def send(file): print "Sending file to pastebin...." curl = pycurl.Curl() curl.setopt(pycurl.URL, "http://pastebin.com/api_public.php") curl.setopt(pycurl.POST, True) curl.setopt(pycurl.POSTFIELDS, "paste_code=%s" % file) curl.setopt(pycurl.NOPROGRESS, True) curl.perform() def main(): content = raw_input("Provide the FULL path to the file: ") open = file(content, 'r') send(open.readlines()) return 0 main() The output pastebin looks like standard Python list: ['string\n', 'line of text\n', ...] etc. Is there any way I could format it so it looks better and it's actually human-readable? Also, I would be very happy if someone could tell me how to use multiple data inputs in POSTFIELDS. Pastebin API uses paste_code as its main data input, but it can use optional things like paste_name that sets the name of the upload or paste_private that sets it private.

    Read the article

  • Help! I'm a Haskell Newbie

    - by Darknight
    I've only just dipped my toe in the world of Haskell as part of my journey of programming enlightenment (moving on from, procedural to OOP to concurrent to now functional). I've been trying an online Haskell Evaluator. However I'm now stuck on a problem: Create a simple function that gives the total sum of an array of numbers. In a procedural language this for me is easy enough (using recursion) (c#) : private int sum(ArrayList x, int i) { if (!(x.Count < i + 1)) { int t = 0; t = x.Item(i); t = sum(x, i + 1) + t; return t; } } All very fine however my failed attempt at Haskell was thus: let sum x = x+sum in map sum [1..10] this resulted in the following error (from that above mentioned website): Occurs check: cannot construct the infinite type: a = a -> t Please bear in mind I've only used Haskell for the last 30 minutes! I'm not looking simply for an answer but a more explanation of it. Thanks in advanced.

    Read the article

  • Html newbie! background-image question

    - by Kevin Li
    Hi! I'm learning HTML and I wanted to practice by recreating a invoice sent to me by Electronics Expo. However, I used the background-image property and repeated it by repeat-x and now, the background stretches across the page so much that it has a horizontal bar to drag. http://htmlpocketreference.110mb.com/index.html You can see what I did in my link above. Also, I would really appreciate some advice on simplifying my CSS coding. It seems really messy and I have to move every element once something changes. -.- Thanks!

    Read the article

  • Newbie question attribute from associated table not showing up in index view

    - by Lauren
    Hi I know this is something simple I am doing wrong. I have three tables, installation, neighborhood, schools Installation: has_many :schools has_many :neighborhoods Neighborhood: has_many :installations has_many :schools Schools: belongs_to :installations belongs_to :neighborhoods I can't figure out how to show the name of the neighborhood the school is located in on the index view. I can get it to show on the show view once I have the school id. But on the index view I can't figure out what to put in the controller that will allow me to access the neighborhood name from the neighborhood_id that is in the School model. I am sure this is so easy and I am screwing up something stupid. HELP!

    Read the article

  • Objective C instance variables - Newbie

    - by Dwayne King
    OK - so I'm sure my confusion here is just a result of being stuck in a "Java mindset" and not understanding how Obj C differs in this case. In Java, I can declare a variable in a class, like this, and each instance of that class will have it's own: MyClass { String myVar; MyClass() { // constructor } } In Obj C I tried to do the same thing by declaring a variable only in the .m file like this: #import "MyClass.h" @implementation MyClass NSString *testVar; @end My expectation here was that this variable has a scope limited to this class. So I created a second class (identical): #import "MySecondClass.h" @implementation MySecondClass NSString *testVar; @end What I'm seeing (and has me baffled) is that changing the variable in one class, affects the value seen in the other class. In fact, if I set a breakpoint, and then "Jump to Definition" of the variable, it takes me to th I've created an extremely small XCode project that demonstrates the problem here Nothing more humbling than moving to a new language :) Thanks in advance.

    Read the article

  • C++ Newbie Question

    - by JavaMan
    I am from a Java background and is learning C++. I encountered the following C++ code: String source = String::New("'Hello' + ', World'"); As what I understand so far, this should be a call to static member function 'New' of class 'String'. But, I've searched through the whole header file defining 'String', there is not any static member named 'New' in the String class or its super classes. Is there any special meaning attached to String class or the New member function in C++?

    Read the article

  • Textmate newbie question: how to indent CSS

    - by AP257
    New to TextMate and can't find the answer in the documentation. I've saved an empty file as CSS and the 'active bundle' is showing as CSS, at the bottom of the screen. I've then pasted in a bunch of CSS from elsewhere (a minified page). However, it's all pasted in as a single line. How can I indent it to look like 'proper' CSS, using TextMate? Text + Indent just indents the whole line by a single tab. thanks!

    Read the article

  • Friendly PHP framework for a newbie?

    - by dineshbabu
    Hello people, I am given a task to convert a crappy(non-secure) hardcoded website into a good one using any good framework. I have a good idea of PHP. So can you help me in choosing a framework? Also, do i need to learn about Model View Controller to use frameworks?

    Read the article

  • newbie hibernate first level cache confusion

    - by Bruce
    Hi all I'm just geting to grips with hibernate. Little bit confused. I just wanted to watch the operation of the first level cache, which I understood to batch up queries until the end of the session. But if I create an object, hibernate saves it immediately, so that when I later update it in the same transaction, it has to do an update too: Session session = factory.getCurrentSession(); session.beginTransaction(); Test1 test1 = new Test1(); test1.setName("Test 1"); test1.setValue(10); // Touch it session.save(test1); System.out.println("At checkpoint 1"); test1.setValue(20); session.getTransaction().commit(); I see the sql for the save, then 'At checkpoint 1', then the sql for the update. Do I have something set up wrong or am I misunderstanding hibernate's first level cache? Is there a good document on the first level cache - I didn't find anything in the hibernate docs, but I could easily have missed it.. Thanks!

    Read the article

  • C# Linq to SQL connection string (newbie)

    - by Chris'o
    i am a new linq to sql learner and this is my very first attempt to create a data viewer program. The idea is simple, i'd like to create a software that is able to view content of a table in a database. That's it. I got an early problem here already and i have seen many tutes and articles online but I still cant fix the bug. Here is my code: static void Main(string[] args) { string cs = "Data Source=localhost;Initial Catalog=somedb;Integrated Security=SSPI;"; var db = new DataClasses1DataContext(cs); db.Connection.Open(); foreach (var b in db.Mapping.GetTables()) Console.WriteLine(b.TableName); Console.ReadKey(true); } When I tried to check db.connection.equals(null); it returns false, so i thought i have connected successfully to the database since there is no error at all. But the code above doesn't print anything out to the screen. I kind of lost and don't know what's going on here. Does anyone know what is going wrong here?

    Read the article

  • Newbie SQL joining question: houses, refrigerators, and apples

    - by Philip Brocoum
    There are three tables in my database: apples, refrigerators, and houses. Each apple belongs to a refrigerator (it has a column that references the refrigerator that it's in), and each refrigerator belongs to a house. The problem is, each apple ALSO belongs to a house. I guess this isn't "normalized" or whatever, but it's the way it is. Obviously, each apple should belong to the house that its refrigerator belongs to. An apple can't be in two different places at once, after all. So, my question is this: what SQL statement will allow me to find all of the "bad apples" that for some reason incorrectly reference a different house than the refrigerator that they are supposedly in. In other words, I need to find the apples that contain contradictory information. I don't know if this is a "join" question or not, but I'm sure there's probably a very straightforward way of figuring this out. I just don't know what it is. Thanks for your help!

    Read the article

  • Unable to import example projects from book (newbie question)

    - by StayWett
    I am trying to import projects from a book "Beginning Android 2" but when I choose the root directory the "Finish" button is still grayed out. I've tried importing the project from scratch with no success, and I've also tried to create a template project with the same name and everything and then importing into that (Import existing projects into workspace) but it always says "No projects are found to import". The contents of the folder are: Res folder, src folder with .java file, the manifest, build, and default.properties files. I am new to android dev (obviously) so I appreciate the help.

    Read the article

  • Visual Basic: Newbie questions.

    - by Omega
    Hello there. I am starting to learn visual basic. So far, it is quite simple and easy to use. I am liking it! Anyway, I want to make applications a little bit more complex. So far I have done very silly things. I would appreciate if you could help me with these: How do I open a new window (form)? Maybe I click a button on my main form and another form pops up. How do I "deactivate" the main form while the new form is running? (if I try to click the main form, an error sound plays) So my second form has a text field and a "OK" button. If I click it, the second form closes activating the main form again. I want to "pass" the text in the text field from the second form to the first one. How do I do that? Thank you, I am enjoying this new programming environment (didn't use Visual Studio much before)

    Read the article

  • (newbie) type signature "Maybe a" doesn't like "Just [Event]"

    - by sisif
    i'm still learning Haskell and need help with the type inference please! using packages SDL and Yampa i get the following type signature from FRP.Yampa.reactimate: (Bool -> IO (DTime, Maybe a)) and i want to use it for: myInput :: Bool -> IO (DTime, Maybe [SDL.Event]) myInput isBlocking = do event <- SDL.pollEvent return (1, Just [event]) ... reactimate myInit myInput myOutput mySF but it says Couldn't match expected type `()' against inferred type `[SDL.Event]' Expected type: IO (DTime, Maybe ()) Inferred type: IO (DTime, Maybe [SDL.Event]) In the second argument of `reactimate', namely `input' In the expression: reactimate initialize input output process i thought "Maybe a" allows me to use anything, even a SDL.Event list? why is it expecting "Maybe ()" when the type signature is actually "Maybe a"? why does it want an empty tuple, or a function taking no arguments, or what is () supposed to be?

    Read the article

  • problem with jQuery array being a newBie.

    - by user236106
    <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script> <script type="text/jscript"> $('document').ready(function (){ var clickNo=0; $('div#pics>img').hide() $('div#pics>input').click(function(event){ $('div#pics>img')[0].show('slow'); }) }); </script> </head> <body> <div id="pics"> <input type="button" value="next" /> <--a bunch of img tags .I had to resort to this comment because the system won't let me include the img tag in the code--> </div> </body> </html> I can't understand why the line $('div#picsimg')[0].show('slow'); is not working ?

    Read the article

  • a newbie gcc compiler and c language question

    - by dydx
    Hi, when I'm trying to compile my c program it gives me this error warning: integer constant is too large for 'long' type which refers to these lines int barcode, a, b, c; scanf("%d", &barcode); a = barcode / 1000000000000; b = barcode / 100000000000 % 10; c = barcode / 10000000000 % 10; and the rest is fine. I know I'm not supposed to use int for such a large number, any suggestions on what I should use? if I replace int with double what should the '%d' part be replaced with then?

    Read the article

  • C Newbie, ascii control function

    - by user570607
    Hey there, I have written a program that works well in C that converts non-readable ASCII to their character values. I would appreciate if a C master? would show me a better way of doing it that I have currently done, mainly this section: if (isascii(ch)) { switch (ch) { case 0: printControl("NUL"); break; case 1: printControl("SOH"); break; .. etc (32 in total) case default: putchar(ch); break; } } Is it normal to make a switch that big? Or should I be using some other method (input from an ascii table?)

    Read the article

  • newbie in Jquery (including but no result)

    - by Negin
    I have this code: <html> <head> </head> <body> <form method='post'> <link type="text/css" href="css/themename/jquery-ui-1.8.14.custom.css" rel="Stylesheet" /> <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script> <style> #feedback { font-size: 1.4em; } #selectable .ui-selecting { background: #FECA40; } #selectable .ui-selected { background: #F39814; color: white; } #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; } #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; } </style> <script> $(function() { $( "#selectable" ).selectable(); }); </script> <div class="demo"> <ol id="selectable"> <li class="ui-widget-content">Item 1</li> <li class="ui-widget-content">Item 2</li> <li class="ui-widget-content">Item 3</li> </ol> </div><!-- End demo --> <div class="demo-description" style="display: none; "> <p>Enable a DOM element (or group of elements) to be selectable. Draw a box with your cursor to select items. Hold down the Ctrl key to make multiple non-adjacent selections. </p> </div><!-- End demo-description --> </form> </body> </html> I downloaded the jquery but it has no result I used this site: http://jqueryui.com/demos/selectable/#event-create what is wrong here?

    Read the article

  • Worst aspect of Python for a newbie

    - by schickb
    I'm wondering specifically what experienced programmers thought when they started developing in Python. I'm sure the answer depends on your background, but my own personal answer is the conversion of basically anything in the language to a True/False value in boolean contexts. Resulting in "oddities" like: if x: not meaning the same thing as: if x == True: I understand why, but it bugs me, and I certainly had to think about it a bit when I first ran into it.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >