Search Results

Search found 1162 results on 47 pages for 'nick'.

Page 31/47 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Arrays not matching correctly

    - by Nick Gibson
    userAnswer[] holds the string of the answer the user types in and is comparing it to answers[] to see if they match up and then spits out correct or wrong. j is equal to the question number. So if j was question 6, answers[j] should refer to answers[6] right? Then userAnswer[6] should compare to answers[6] and match if its correct. But its giving me wrong answers and displaying the answer I typed as correct. int abc, loopCount = 100; int j = quesNum, overValue, forLoop = 100; for (int loop = 1; loop < loopCount; loop++) { aa = r.nextInt(10+1); abc = (int) aa; String[] userAnswer = new String[x]; JOptionPane.showMessageDialog(null,abc); if(abc < x) { userAnswer[j] = JOptionPane.showInputDialog(null,"Question "+quesNum+"\n"+questions[abc]+"\n\nA: "+a[abc]+"\nB: "+b[abc]+"\nC: "+c[abc]+"\nD: "+d[abc]); if(userAnswer[j].equals(answers[j])) { JOptionPane.showMessageDialog(null,"Correct. \nThe Correct Answer is "+answers[abc]); } else { JOptionPane.showMessageDialog(null,"Wrong. \n The Correct Answer is "+answers[abc]); }//else }//if }//for

    Read the article

  • MySql "comments" parameter as descriptor?

    - by Nick
    So, I'm trying to learn a lot at once, and this place is really helpful! I'm making a little running log website for myself and maybe a few other people, and I have it so that the user can add workouts for each day. With each workout, I have a variety of information the user can fill out for the workout, such as running distance, time, quality of run, course, etc... I store this in a MySql database as a table with fields titled "distance", "time", "runquality", etc... Now, these field titles don't match up with what I want displayed on the running log, so I was thinking of using the "Comments" attribute for a field to store its human-readable title--thus the field "runquality" would have "Quality of run" as its comment, and then I would pull the comment with a SQL query and display it instead of the field name. Is this a good theoretical/practical way of going about it? And what sort of SQL would I use to pull the comment for the field anyway? Secondly, suppose I want to add the ability for the user to create their own workout descriptors. So say a user wants to add a "temperature" descriptor for their workout. Should I create a script that adds fields to my workout table, or should I create a separate table listing only workout descriptors and somehow link the descriptor table with the "contents" table? I haven't learned any theory about database design or anything so any help is appreciated!

    Read the article

  • Converting a navbar to a tabbar app

    - by Nick
    Hey guys, I was wondering how to convert a NavigationController style app into a TabBarcontroller style app. I changed my mainwindow to not contain a navigationcontroller anymore (but a tabbarcontroller instead) and my delegate also appropiatly, but when I launch the app something still thinks I want a navigationController: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navigationController.' Stack trace: #0 0x020fa004 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ #1 0x96fc0509 in objc_exception_throw #2 0x020ee1c1 in -[NSException raise] #3 0x000d8a78 in _NSSetUsingKeyValueSetter #4 0x000d84c5 in -[NSObject(NSKeyValueCoding) setValue:forKey:] #5 0x004fb4c8 in -[UIRuntimeOutletConnection connect] #6 0x020af92f in -[NSArray makeObjectsPerformSelector:] #7 0x004f9f7f in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:] #8 0x004fbfcb in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:] #9 0x0033b0a6 in -[UIApplication _loadMainNibFile] #10 0x0034482a in -[UIApplication _runWithURL:sourceBundleID:] #11 0x00341b88 in -[UIApplication handleEvent:withNewEvent:] #12 0x0033d6d3 in -[UIApplication sendEvent:] #13 0x003440b5 in _UIApplicationHandleEvent #14 0x0265aed1 in PurpleEventCallback #15 0x02092b80 in CFRunLoopRunSpecific #16 0x02091c48 in CFRunLoopRunInMode #17 0x0033be69 in -[UIApplication _run] #18 0x00345003 in UIApplicationMain #19 0x00002ec8 in main at main.m:14 Where can I specify the app is a tabbarcontrolled app, instead of a navigationbarcontrolled app? Thanks in advance,

    Read the article

  • Combining Data from two MySQL tables.

    - by Nick
    I'm trying to combine data from two tables in MySQL with PHP. I want to select all the data (id, title, post_by, content and created_at) from the "posts" table. Then I would like to select the comment_id COUNT from the "comments" table IF the comment_id equals the posts id. Finally, I would like to echo/print something on this order: <? echo $row->title; ?> Posted by <? echo $row->post_by; ?> on <? echo $row->created_at; ?> CST <? echo $row->content; ?> <? echo $row->comment_id; ?> comments | <a href="comment.php?id=<? echo $row->id; ?>">view/post comments</a> I'm uncertain as to how to "combine" the data from two tables. I have tried numerous things and have spent several evenings and have had no luck. Any help would be greatly appreciated!

    Read the article

  • How do I create a MessageBox in C# ?

    - by Nick Stinemates
    I have just installed C# for the first time, and at first glance it appears to be very similar to VB6. I decided to start off by trying to make a 'Hello, World!' UI Edition. I started in the Form Designer and made a button named "Click Me!" proceeded to double-click it and typed in MessageBox("Hello, World!"); I received the following error: MessageBox is a 'type' but used as a 'variable' Fair enough, it seems in C# MessageBox is an Object. I tried the following MessageBox a = new MessageBox("Hello, World!"); I received the following error: MessageBox does not contain a constructor that takes '1' arguments Now I am stumped. Please help.

    Read the article

  • Order By Problem T-Sql

    - by Nick LaMarca
    I have a sql statement I am using a simple sort such as the following Select numbers From theTable Order By numbers What I get in return is the following 1 11 12 14 2 21 22 23 3 35 37 etc... I want it to be ordered in normal order 1 2 3 4 5 6 etc...

    Read the article

  • Trouble with Code First DatabaseGenerated Composite Primary Key

    - by Nick Fleetwood
    This is a tad complicated, and please, I know all the arguments against natural PK's, so we don't need to have that discussion. using VS2012/MVC4/C#/CodeFirst So, the PK is based on the date and a corresponding digit together. So, a few rows created today would be like this: 20131019 1 20131019 2 And one created tomorrow: 20131020 1 This has to be automatically generated using C# or as a trigger or whatever. The user wouldn't input this. I did come up with a solution, but I'm having problems with it, and I'm a little stuck, hence the question. So, I have a model: public class MainOne { //[Key] //public int ID { get; set; } [Key][Column(Order=1)] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string DocketDate { get; set; } [Key][Column(Order=2)] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string DocketNumber { get; set; } [StringLength(3, ErrorMessage = "Corp Code must be three letters")] public string CorpCode { get; set; } [StringLength(4, ErrorMessage = "Corp Code must be four letters")] public string DocketStatus { get; set; } } After I finish the model, I create a new controller and views using VS2012 scaffolding. Then, what I'm doing is debugging to create the database, then adding the following instead of trigger after Code First creates the DB [I don't know if this is correct procedure]: CREATE TRIGGER AutoIncrement_Trigger ON [dbo].[MainOnes] instead OF INSERT AS BEGIN DECLARE @number INT SELECT @number=COUNT(*) FROM [dbo].[MainOnes] WHERE [DocketDate] = CONVERT(DATE, GETDATE()) INSERT INTO [dbo].[MainOnes] (DocketDate,DocketNumber,CorpCode,DocketStatus) SELECT (CONVERT(DATE, GETDATE ())),(@number+1),inserted.CorpCode,inserted.DocketStatus FROM inserted END And when I try to create a record, this is the error I'm getting: The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: The object state cannot be changed. This exception may result from one or more of the primary key properties being set to null. Non-Added objects cannot have null primary key values. See inner exception for details. Now, what's interesting to me, is that after I stop debugging and I start again, everything is perfect. The trigger fired perfectly, so the composite PK is unique and perfect, and the data in other columns is intact. My guess is that EF is confused by the fact that there is seemingly no value for the PK until AFTER an insert command is given. Also, appearing to back this theory, is that when I try to edit on of the rows, in debug, I get the following error: The number of primary key values passed must match number of primary key values defined on the entity. Same error occurs if I try to pull the 'Details' or 'Delete' function. Any solution or ideas on how to pull this off? I'm pretty open to anything, even creating a hidden int PK. But it would seem redundant. EDIT 21OCT13 [HttpPost] public ActionResult Create(MainOne mainone) { if (ModelState.IsValid) { var countId = db.MainOnes.Count(d => d.DocketDate == mainone.DocketNumber); //assuming that the date field already has a value mainone.DocketNumber = countId + 1; //Cannot implicitly convert type int to string db.MainOnes.Add(mainone); db.SaveChanges(); return RedirectToAction("Index"); } return View(mainone); } EDIT 21OCT2013 FINAL CODE SOLUTION For anyone like me, who is constantly searching for clear and complete solutions. if (ModelState.IsValid) { String udate = DateTime.UtcNow.ToString("yyyy-MM-dd"); mainone.DocketDate = udate; var ddate = db.MainOnes.Count(d => d.DocketDate == mainone.DocketDate); //assuming that the date field already has a value mainone.DocketNumber = ddate + 1; db.MainOnes.Add(mainone); db.SaveChanges(); return RedirectToAction("Index"); }

    Read the article

  • In Bloomberg API how do you specify to get FX forwards as a spread rather than absolute values?

    - by Nick Fortescue
    How do you explicitly request fx forwards as outrights using the bloomberg API? In the Bloomberg terminal you can choose whether to get FX Forwards as absolute rates (outrights) or as offsets from Spots (Points) by doing XDF, hitting 7, then the option is about half way down. 0 means outrights, and 1 means offfsets. With most defaults you can explicitly set them in the API, so your code gives the same result whichever computer you run on. How do you set this one in a V3 API query?

    Read the article

  • C# DLL: Need to know when application is closing

    - by Nick
    Is there a way to monitor when an application that is using the dll closes? The DLL and the application are both C#, neither are Windows Forms. I can check when the main application is closing, but I would like for the DLL to see "hey the program is closing and releasing me, I should do this real quick before I die". Any way to do it? Or am I stuck having the application dish out "do this before you die"?

    Read the article

  • iPhone: Custom UITableViewCell with multiple areas that respond to taps?

    - by Nick
    I've been asked to create a custom UITableViewCell with multiple areas that can be tapped. These areas won't have buttons or any graphics - they'll be invisible. 3 different methods will be called depending on which third of the cell the user taps i.e. || decrementFooCount || viewFooDetails || incrementFooCount || The cell has a few labels on it that need to be visible at all times - the fooName and fooCount. I'm thinking perhaps three hidden UIButtons over the cell? I also need to maintain the swipe to delete default behavior.

    Read the article

  • Base class with abstract subclasses in C# ?

    - by Nick Brooks
    public abstract class Request { public class Parameters { //Threre are no members here //But there should be in inherited classes } public Request() { parameters = new Parameters(); } public Parameters parameters; } Two questions: How do I make it so I can add stuff to the constructor but the original constructor will still be executed? How do I make it so the subclasses can add members to the Parameters class?

    Read the article

  • How to set a EditText in a certain column of a TableLayout?

    - by Nick
    I have a TableLayout on one Android Activity UI. It has two columns. Now I need to add a new row, and put an EditText box in second column of that new row. And also, I want that EditText full fill the whole cell. I have some code like this: TableRow tr = new TableRow(context); EditText et = new EditText(context); et.SetMaxLines(4); etText.setLayoutParams(new TableRow.LayoutParams(1)); //set it to the second coloumn tr.addView(et); tl.addView(tr); //tl is the tableLayout It puts the EditText in the second column fine, but the EditText is too small. I tried to use etText.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); but that seems to disabled the TableRow.LayoutParams setting. I guess each control can only have one LayoutParamas setting. So, how to make the EditText as a 4 lines text editor and also make sure it is in the second column of that row? Thanks.

    Read the article

  • Sun App Server Deployment Error

    - by Nick Long
    Sun App Server Deployment : When choose to precompile JSP : Throw this error com.sun.enterprise.admin.common.exception.MBeanConfigException: Component not registered then have to do asadmin undeploy Anyone know what is the reason for this error?

    Read the article

  • glDrawArrays() slow on iPad?

    - by Nick
    Hey guys, I was wondering how to speed up my iPad application using OpenGLES 2.0. At the moment we have every drawable object draw itself with a call to glDrawArrays(). Blend mode is on, we really need it. Without disabling blendmode, how would we improve performance for this app? For instances, if we now draw 1 texture across the whole screen, the app only gets 15FPS, which is really slow I think? Are we doing something terribly wrong? Our drawing code (for each drawable), is as follows: - (void) draw { GLuint textureAvailable = 0; if(texture != nil){ textureAvailable = 1; } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture.name); glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_FLOAT, 0, 0, vertices); glEnableVertexAttribArray(ATTRIB_VERTEX); glVertexAttribPointer(ATTRIB_COLOR, 4, GL_FLOAT, 1, 0, colorsWithMultipliedAlpha); glEnableVertexAttribArray(ATTRIB_COLOR); glVertexAttribPointer(ATTRIB_TEXTUREMAP, 2, GL_FLOAT, 1, 0, textureMapping); glEnableVertexAttribArray(ATTRIB_TEXTUREMAP); //Note that we are NOT using position.z here because that is only used to determine drawing order int *jnUniforms = JNOpenGLConstants::getInstance().uniforms; glUniform4f(jnUniforms[UNIFORM_TRANSLATE], position.x, position.y, 0.0, 0.0); glUniform4f(jnUniforms[UNIFORM_SCALE], scale.x, scale.y, 1.0, 1.0); glUniform1f(jnUniforms[UNIFORM_ROTATION], rotation); glUniform1i(jnUniforms[UNIFORM_TEXTURE_SAMPLE], 0); glUniform2f(jnUniforms[UNIFORM_TEXTURE_REPEAT], textureRepeat.x, textureRepeat.y); glUniform1i(jnUniforms[UNIFORM_TEXTURE_AVAILABLE], textureAvailable); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); }

    Read the article

  • Constructor on type: "Namespace.type" not found.

    - by Nick
    Hello, I am using Castle.Windsor as an IOC. So I am trying to resolve a service type in the constructor of an HTTPHandler. I keep receiving this error, "Constructor on type: "Namespace.type" not found." My configuration has the following entries for service type: IDocumentDirectory <component id="restricted.content.directory" service="org.healthwise.foundations.services.content.IDocumentDirectory, org.healthwise.foundations.services" type="org.healthwise.foundations.services.content.RestrictedLocalizationDocumentDirectory, org.healthwise.foundations.services"> <parameters> <contentDirectory>${content.directory}</contentDirectory> <localizations> <array> <item>en-us</item> <item>es-us</item> </array> </localizations> </parameters> </component> <component id="content.directory" service="org.healthwise.foundations.services.content.IDocumentDirectory, org.healthwise.foundations.services" type="org.healthwise.foundations.services.web.client.WebServiceDocumentDirectory, org.healthwise.foundations.services.web.client"> <parameters> <webServiceURL>#{contentDirectoryWebsiteUrl}</webServiceURL> </parameters> </component> In my new handler the constructor looks like this: public HeartBeatHttpHandler(IDocumentDirectory contentDirectory) { _contentDirectory = contentDirectory; } I have never recieved this error using Castle.Windsor. Can someone explain? Thanks!

    Read the article

  • Rails - Active Record :conditions overrides :select

    - by Nick
    I have a fairly large model and I want to retrieve only a select set of fields for each record in order to keep the JSON string I am building small. Using :select with find works great but my key goal is to use conditional logic with an associated model. Is the only way to do this really with a lamda in a named scope? I'm dreading that perhaps unnecessarily but I'd like to understand if there is a way to make the :select work with a condition. This works: @sites = Site.find :all, :select => 'id,foo,bar' When I try this: @sites = Site.find :all, :select => 'id,foo,bar', :include => [:relatedmodel], :conditions => ["relatedmodel.type in (?)", params[:filters]] The condition works but each record includes all of the Site attributes which makes my JSON string way way too large. Thanks for any pointers!

    Read the article

  • Most elegant way to break CSV columns into separate data structures using Python?

    - by Nick L
    I'm trying to pick up Python. As part of the learning process I'm porting a project I wrote in Java to Python. I'm at a section now where I have a list of CSV headers of the form: headers = [a, b, c, d, e, .....] and separate lists of groups that these headers should be broken up into, e.g.: headers_for_list_a = [b, c, e, ...] headers_for_list_b = [a, d, k, ...] . . . I want to take the CSV data and turn it into dict's based on these groups, e.g.: list_a = [ {b:val_1b, c:val_1c, e:val_1e, ... }, {b:val_2b, c:val_2c, e:val_2e, ... }, {b:val_3b, c:val_3c, e:val_3e, ... }, . . . ] where for example, val_1b is the first row of the 'b' column, val_3c is the third row of the 'c' column, etc. My first "Java instinct" is to do something like: for row in data: for col_num, val in enumerate(row): col_name = headers[col_num] if col_name in group_a: dict_a[col_name] = val elif headers[col_cum] in group_b: dict_b[col_name] = val ... list_a.append(dict_a) list_b.append(dict_b) ... However, this method seems inefficient/unwieldy and doesn't posses the elegance that Python programmers are constantly talking about. Is there a more "Zen-like" way I should try- keeping with the philosophy of Python?

    Read the article

  • Change window title to the one in text box in Objective-C?

    - by Nick Brooks
    I'm just getting started with Objective-C and I'm writing a simple application. I made two outlets : wnd - main window display - the text box Then I've tried using this code: [wnd setTitle:[display value]]; Unfortuanately it didn't work ... The debugger said : 2010-05-22 XX:XX:08.577 HelloWorld[2536:a0f] -[NSTextField value]: unrecognized selector sent to instance 0x102e032a0 Does anyone know how to get it to work?

    Read the article

  • Cocoa - Change text of label

    - by Nick
    I've got a cocoa application that reads in a text file. I'd like to display that text in a multi-line label, but I for the life of me can't figure it out. I opened up my .nib file and poped a multi-line label down but after that I'm stuck. I don't have any experience working with XCode or Cocoa, mostly Eclipse, Visual Studio, and pretty much every other IDE except XCode which seems very foreign.

    Read the article

  • __doPostBack is undefined on DotNetNuke website for IE 10

    - by nick
    I have a DotNetNuke site, and today a customer called in and said it wasn't working on IE 10. Specifically the login and register links weren't working, but they do in compatibility mode. I took a look on our test windows 8 machine and saw that it was failing because __doPostBack was undefined. I've been searching for a fix for the last 6ish hours, and what I've been able to find is that apparently the IE10 user agent is covered in the ie.browser file and that I should install this hotfix and reboot the server. That didn't work. I haven't noticed any changes, even though I think the new ie.browser file should match the new user agent. What other steps can I take to fix the problem? Note: the server is running .NET 3.5 with service pack 1 on Windows server 2003. The site is running DotNetNuke 05.06.02. Any suggestions would be greatly appreciated.

    Read the article

  • JSDoc with AngularJS

    - by Nick White
    Currently within my Project we are using JSDoc, we have recently started to implement Angular and I want to continue using JSDoc to ensure that all the documentation is within the same place. I have taken a look at people mainly just saying to use ngDoc but this isn't really a viable option as we will always have separate JavaScript and I ideally would have everything together. /** * @author Example <[email protected]> * @copyright 2014 Example Ltd. All rights reserved. */ (function () { window.example = window.example || {}; /** * Example Namespace * @memberOf example * @namespace example.angular */ window.example.angular = window.example.angular || {}; var exAngular = window.example.angular; /** * A Example Angular Bootstrap Module * @module exampleAngularBootstrap */ exAngular.bootstrap = angular.module('exampleAngularBootstrap', [ 'ngRoute', 'ngResource', 'ngCookies' ]) .run(function ($http, $cookies) { $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; $http.defaults.headers.common['X-CSRFToken'] = $cookies.csrftoken; }); })(); Currently this is what I have but am unable to put documentation for the run() any ideas? Thank you in advanced!

    Read the article

  • facebook graph api does not return all feed items on facebook page

    - by Nick Franceschina
    at the time of this question, if you go here: http://www.facebook.com/realplayer you'll see six posts down, I have posted a photo with a message of "#highfive Cincinnati, OH" but if you to either of these: http://graph.facebook.com/realplayer/feed http://graph.facebook.com/realplayer/tagged the JSON that is returned seemingly includes everything on the wall, except for MY post. there is another photo post from someone else down below mine, and it is showing up (and both my photo and his photo are in the "Fan photos" section) obviously, since I can see everything with these links already, it appears that access_token is not a part of the equation... BUT, some more info: if I use an access_token from a session that isn't me, I can't see the post in the JSON if I use an access_token from MY logged in session, then I DO see the post in the JSON so I'm very confused. if everyone in the world can see those posts on the wall without even authenticating, then I expect all of them to come back in the graph api as well. anyone have thoughts on this? I am aware of the "manage_page" permission... which I can use to get a list of accounts and special offline access tokens for those pages... and that's something I can explore... but it seems like alot of work when my post seemingly SHOULD be there in the graph

    Read the article

  • Execute something on application startup?

    - by Nick Brooks
    I have a class in my application which handles all the controls and all the functions and variables are stored in it. How can I add a function which handles the application startup to it? So basically I need to handle 'applicationDidFinishLaunching' in my class as well as in the application delegate. How do I do that?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >