Search Results

Search found 14182 results on 568 pages for 'andrew answer'.

Page 13/568 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • jqgrid and django models

    - by Andrew Gee
    Hi, I have the following models class Employee(Person): job = model.Charfield(max_length=200) class Address(models.Model): street = models.CharField(max_length=200) city = models.CharField(max_length=200) class EmpAddress(Address): date_occupied = models.DateField() date_vacated = models.DateField() employee = models.ForeignKey() When I build a json data structure for an EmpAddress object using the django serialzer it does not include the inherited fields only the EmpAddress fields. I know the fields are available in the object in my view as I can print them but they are not built into the json structure. Does anyone know how to overcome this? Thanks Andrew

    Read the article

  • Changing default logical filename in SQL 2005

    - by Andrew
    I have a issue about creating databases in SQL 2005. I want to be able to change the default logical filename for the mdf file. At the moment the log logical filename ends in _log by default. I want the data logical filename to automatically end with _data for consistency. Is there a way i can set this? Andrew

    Read the article

  • Allow unregistered paypal users to make payments

    - by andrew
    Hi i am integrating paypal web payments standard into my shopping cart using the setup where you just send a form to paypal with all the values in hidden fields. I want to enable the option that allows people to make payments even if they are not a registered paypal user. I am sure i read somewhere in the paypal documentation but now i can't find it. Thanks a lot Andrew

    Read the article

  • DropdownList reset to to index 0 on load

    - by Andrew
    Hi, How would I reset my asp:DropDownList element (which has a runat="server") to index 0 every time the page is "reloaded" in firefox (F5 is pressed). If you suggest using javascript...please note that A: I am not using a form and B: I don't know how to access elements that have a runat="server" with javascript If this can be done using script on the .aspx page....please explain things you think an ASP newb would not know (ie. me, lol) thanks, Andrew :)

    Read the article

  • SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Introduction – Day 1 of 31

    - by pinaldave
    List of all the Interview Questions and Answers Series blogs Posts covering interview questions and answers always make for interesting reading.  Some people like the subject for their helpful hints and thought provoking subject, and others dislike these posts because they feel it is nothing more than cheating.  I’d like to discuss the pros and cons of a Question and Answer format here. Interview Questions and Answers are Helpful Just like blog posts, books, and articles, interview Question and Answer discussions are learning material.  The popular Dummy’s books or Idiots Guides are not only for “dummies,” but can help everyone relearn the fundamentals.  Question and Answer discussions can serve the same purpose.  You could call this SQL Server Fundamentals or SQL Server 101. I have administrated hundreds of interviews during my career and I have noticed that sometimes an interviewee with several years of experience lacks an understanding of the fundamentals.  These individuals have been in the industry for so long, usually working on a very specific project, that the ABCs of the business have slipped their mind. Or, when a college graduate is looking to get into the industry, he is not expected to have experience since he is just graduated. However, the new grad is expected to have an understanding of fundamentals and theory.  Sometimes after the stress of final exams and graduation, it can be difficult to remember the correct answers to interview questions, though. An interview Question and Answer discussion can be very helpful to both these individuals.  It is simply a way to go back over the building blocks of a topic.  Many times a simple review like this will help “jog” your memory, and all those previously-memorized facts will come flooding back to you.  It is not a way to re-learn a topic, but a way to remind yourself of what you already know. A Question and Answer discussion can also be a way to go over old topics in a more interesting manner.  Especially if you have been working in the industry, or taking lots of classes on the topic, everything you read can sound like a repeat of what you already know.  Going over a topic in a new format can make the material seem fresh and interesting.  And an interested mind will be more engaged and remember more in the end. Interview Questions and Answers are Harmful A common argument against a Question and Answer discussion is that it will give someone a “cheat sheet.” A new guy with relatively little experience can read the interview questions and answers, and then memorize them. When an interviewer asks him the same questions, he will repeat the answers and get the job. Honestly, is he good hire because he memorized the interview questions? Wouldn’t it be better for the interviewer to hire someone with actual experience?  The answer is not as easy as it seems – there are many different factors to be considered. If the interviewer is asking fundamentals-related questions only, he gets the answers he wants to hear, and then hires this first candidate – there is a good chance that he is hiring based on personality rather than experience.  If the interviewer is smart he will ask deeper questions, have more than one person on the interview team, and interview a variety of candidates.  If one interviewee happens to memorize some answers, it usually doesn’t mean he will automatically get the job at the expense of more qualified candidates. Another argument against interview Question and Answers is that it will give candidates a false sense of confidence, and that they will appear more qualified than they are. Well, if that is true, it will not last after the first interview when the candidate is asked difficult questions and he cannot find the answers in the list of interview Questions and Answers.  Besides, confidence is one of the best things to walk into an interview with! In today’s competitive job market, there are often hundreds of candidates applying for the same position.  With so many applicants to choose from, interviewers must make decisions about who to call back and who to hire based on their gut feeling.  One drawback to reading an interview Question and Answer article is that you might sound very boring in your interview – saying the same thing as every single candidate, and parroting answers that sound like someone else wrote them for you – because they did.  However, it is definitely better to go to an interview prepared, just make sure that you give a lot of thought to your answers to make them sound like your own voice.  Remember that you will be hired based on your skills as well as your personality, so don’t think that having all the right answers will make get you hired.  A good interviewee will be prepared, confident, and know how to stand out. My Opinion A list of interview Questions and Answers is really helpful as a refresher or for beginners. To really ace an interview, one needs to have real-world, hands-on experience with SQL Server as well. Interview questions just serve as a starter or easy read for experienced professionals. When I have to learn new technology, I often search online for interview questions and get an idea about the breadth and depth of the technology. Next Action I am going to write about interview Questions and Answers for next 30 days. I have previously written a series of interview questions and answers; now I have re-written them keeping the latest version of SQL Server and current industry progress in mind. If you have faced interesting interview questions or situations, please write to me and I will publish them as a guest post. If you want me to add few more details, leave a comment and I will make sure that I do my best to accommodate. Tomorrow we will start the interview Questions and Answers series, with a few interesting stories, best practices and guest posts. We will have a prize give-away and other awards when the series ends. List of all the Interview Questions and Answers Series blogs Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Interview Questions and Answers, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • How to code Microsoft Excel "Shift Cells Up" feature in SQL

    - by user293249
    Take a simple table like below: Column Headings: || Agent's Name || Time Logged In || Center || Row 1: Andrew || 12:30 PM || Home Base Row 2: Jeff || 7:00 AM || Virtual Base Row 3: Ryan || 6:30 PM || Test Base Now lets say that a single cell is deleted so the table now looks like this: Column Headings: || Agent's Name || Time Logged In || Center || Row 1: Andrew || 12:30 PM || Row 2: Jeff || 7:00 AM || Virtual Base Row 3: Ryan || 6:30 PM || Test Base Notice that "Home Base" is missing. Now in excel you can delete the cell and shift the rest so the finished product looks like below: Column Headings: || Agent's Name || Time Logged In || Center || Row 1: Andrew || 12:30 PM || Virtual Base Row 2: Jeff || 7:00 AM || Test Base Row 3: Ryan || 6:30 PM || And you can see we are left with a blank cell last row. How do I code this procedure of shifting the cells up in SQL? I've been struggling on this problem for weeks! Thank you!

    Read the article

  • tableView:didSelectRowAtIndexPath: calls TTNavigator openURLAction:applyAnimated: — UITabBar and na

    - by vikingosegundo
    I have an existing iphone project with a UITabBar. Now I need styled text and in-text links to other ViewControllers in my app. I am trying to integrate TTStyledTextLabel. I have a FirstViewController:UITabelViewController with this tableView:didSelectRowAtIndexPath: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *url; if ([self.filteredQuestions count]>0) { url = [NSString stringWithFormat:@"%@%d", @"tt://question/", [[self.filteredQuestions objectAtIndex:indexPath.row] id]]; [[TTNavigator navigator] openURLAction:[[TTURLAction actionWithURLPath: url] applyAnimated:YES]]; } else { Question * q = [self.questions objectAtIndex:indexPath.row] ; url = [NSString stringWithFormat:@"%@%d", @"tt://question/", [q.id intValue]]; } TTDPRINT(@"%@", url); TTNavigator *navigator = [TTNavigator navigator]; [navigator openURLAction:[[TTURLAction actionWithURLPath: url] applyAnimated:YES]]; } My mapping looks like this: TTNavigator* navigator = [TTNavigator navigator]; navigator.window = window; navigator.supportsShakeToReload = YES; TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; [map from:@"tt://question/(initWithQID:)" toViewController:[QuestionDetailViewController class]]; and my QuestionDetailViewController: @interface QuestionDetailViewController : UIViewController <UIScrollViewDelegate , QuestionDetailViewProtocol> { Question *question; } @property(nonatomic,retain) Question *question; -(id) initWithQID:(NSString *)qid; -(void) goBack:(id)sender; @end When I hit a cell, q QuestionDetailViewController will be called — but the navigationBar wont @implementation QuestionDetailViewController @synthesize question; -(id) initWithQID:(NSString *)qid { if (self = [super initWithNibName:@"QuestionDetailViewController" bundle:nil]) { //; TTDPRINT(@"%@", qid); NSManagedObjectContext *managedObjectContext = [(domainAppDelegate*)[[UIApplication sharedApplication] delegate] managedObjectContext]; NSPredicate *predicate =[NSPredicate predicateWithFormat:@"id == %@", qid]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Question" inManagedObjectContext:managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entity]; [request setPredicate:predicate]; NSError *error = nil; NSArray *array = [managedObjectContext executeFetchRequest:request error:&error]; if (error==nil && [array count]>0 ) { self.question = [array objectAtIndex:0]; } else { TTDPRINT(@"error: %@", array); } } return self; } - (void)viewDidLoad { [super viewDidLoad]; [TTStyleSheet setGlobalStyleSheet:[[[TextTestStyleSheet alloc] init] autorelease]]; [self.navigationController.navigationBar setTranslucent:YES]; NSArray *includedLinks = [self.question.answer.text vs_extractExternalLinks]; NSMutableDictionary *linksToTT = [[NSMutableDictionary alloc] init]; for (NSArray *a in includedLinks) { NSString *s = [a objectAtIndex:3]; if ([s hasPrefix:@"/answer/"] || [s hasPrefix:@"http://domain.com/answer/"] || [s hasPrefix:@"http://www.domain.com/answer/"]) { NSString *ttAdress = @"tt://question/"; NSArray *adressComps = [s pathComponents]; for (NSString *s in adressComps) { if ([s isEqualToString:@"qid"]) { ttAdress = [ttAdress stringByAppendingString:[adressComps objectAtIndex:[adressComps indexOfObject:s]+1]]; } } [linksToTT setObject:ttAdress forKey:s]; } } for (NSString *k in [linksToTT allKeys]) { self.question.answer.text = [self.question.answer.text stringByReplacingOccurrencesOfString:k withString: [linksToTT objectForKey:k]]; } TTStyledTextLabel *answerText = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(0, 0, 320, 700)] autorelease]; if (![[self.question.answer.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] hasPrefix:@"<div"]) { self.question.answer.text = [NSString stringWithFormat:@"%<div>%@</div>", self.question.answer.text]; } NSString * s = [NSString stringWithFormat:@"<div class=\"header\">%@</div>\n%@",self.question.title ,self.question.answer.text]; answerText.text = [TTStyledText textFromXHTML:s lineBreaks:YES URLs:YES]; answerText.contentInset = UIEdgeInsetsMake(20, 15, 20, 15); [answerText sizeToFit]; [self.navigationController setNavigationBarHidden:NO animated:YES]; [self.view addSubview:answerText]; [(UIScrollView *)self.view setContentSize:answerText.frame.size]; self.view.backgroundColor = [UIColor whiteColor]; [linksToTT release]; } ....... @end This works quite nice, as soon as a cell is touched, a QuestionDetailViewController is called and pushed — but the tabBar will disappear, and the navigationItem — I set it like this: self.navigationItem.title =@"back to first screen"; — won't be shown. And it just appears without animation. But if I press a link inside the TTStyledTextLabel the animation works, the navigationItem will be shown. How can I make the animation, the navigationItem and the tabBar be shown?

    Read the article

  • ASP.NET MVC AJAX value not displaying

    - by mazhar kaunain baig
    View: function success(arg) { var obj = arg.get_response().get_object(); if (obj.ErrorMessage === '') { var answer = document.createElement('div'); answer.appendChild(document.createTextNode(obj.Answer)); document.getElementById('answers').appendChild(answer); } else { document.getElementById('errors').innerHTML = obj.ErrorMessage; } } <% using (Ajax.BeginForm("EditOrganizationMeta", "Organization", new AjaxOptions { HttpMethod = "POST", OnSuccess = "success" })) { %> <input type="submit" name="button<%=OrganizationMeta.vcr_MetaKey + Lang.int_LangId %>" value="Save" /> <div id="errors"></div> <div id="answers"></div> <% } %> Controller: [HttpPost] [ValidateInput(false)] public ActionResult EditOrganizationMeta(FormCollection collection) { return Json(new { Answer = "Record Successfully Saved", ErrorMessages = "Title is required" }); } The thing is that success method in the javascript is not getting the required parameters. It is printing undefined there. Is there a problem in javascript method OnSuccess?

    Read the article

  • Multiple Questions per page using Drupal Quiz

    - by Andrew
    I'm using the Drupal Quiz module, and have setup some basic quizzes and stuff like that. However some further customization is required, involving more than 1 question per page, and a multi-type answer in this type of format: Question 1: Describe 4 things you did last summer a) [ short answer space - text field ] b) "I wept" c) "My whole family died so I learned self reliance" d) "I got another xbox" Question 2: Describe 2 things you hate about yourself a) "My arms are way shorter than my legs" b) "I was born without human emotion" So I guess in two parts, how to show multiple questions per page, and then how to allow multiple text fields for answers. Oh and this quiz is not graded, it's like a self assessment. Thanks!

    Read the article

  • What's your favorite programmable calculator?

    - by Pat Notz
    The HP-32S still holds a soft spot in my heart, even though it only had 4 registers. I have fond memories of writing a nonlinear solver for finding an azeotrope curve during a Thermodynamics final. Despite the increase in power, memory, pixels and features the HP-32G that followed never could steal my heart away. Here's to you, HP-32S. Let's hear it, what's your favorite programmable calculator? As with all poll type questions, do NOT submit a new answer unless your answer is not represented. Vote up your answer instead of adding yet another TI-85 or HP-49 to the list, and add comments to that answer if you want to relate specifics. EDIT: I moved my photo into an answer for polling.

    Read the article

  • JQuery drag and Drop

    - by dremay
    I wish to create an Interface to choose Multiple answers using Drag & Drop rather than CheckBox near to the answers. User can choose two types of answers (Real Answer and a Fake Answer). The User has Two Images (for Real & Fake) on the answer page. User can drag an Image and drop near to the selected answer. It is possible to change the selection by moving the "image and drop over some other answer". I have used a "div formatted with an image" near to all answers, so user can drop the image (ie fake or real image) over this "div". I have used JQuery to move the "image" and drop over the "div". Now I need add the code to the "div" (ie container used to hold the image) to identify which "image is placed over it" ie either "fake or real".

    Read the article

  • How to Create a Multiple Question ?

    - by user537422
    Hi Guys, I need to retrieve 6 questions from a plist and check the answer if is correct from the plist itself?? i will use a QR code scanner api to scan for answer, the api will covert to a string and read from the plist to check if the answer is correct... is there any tutorial or references for me to look @ ?? In my plist there is: question ~ Dictionary with the following strings: NumberOfOption ~ which define if the question is a multiple choice or a QR code question Question ~ question itself Answer ~ Answer itself Option 1 ~ 4 ~ if it is a multiple choice question Thanks in advance for answering my questions, i appreciated it cheers Desmond

    Read the article

  • call method from main class, gives error

    - by user557039
    try to call method ss from class from it return me error, Blockquote Exception in thread "main" java.lang.NullPointerException at teste1.exp.ss(exp.java:16) at teste1.Main.main(Main.java:64) Java Result: 1 Blockquote <pre> public class Main { public static void main(String[] arguments) { ................... private static String[] ff; exp mega = new exp(); mega.ss(ff); } class exp { public void ss (String gvanswer[]){ String answer[] = new String[3]; answer[0] = "pacific "; answer[1] = "everest"; answer[2] = "amazon "; if (gvnswer[0].equals("pacific")) {System.out.println("eeeeeeeeeeeeee ");} if (gvanswer[1].equals(answer[1])){System.out.println("l ");} }

    Read the article

  • How do i resolve method Overlapping in java/Processing [duplicate]

    - by user3718913
    This question already has an answer here: How do I compare strings in Java? 24 answers I have two methods/function in a class, called, Qestion1 and Question2, i want it in such a way that after the user has answered Question one correctly, the Question 2 method is called. Whenever i call the method 2, it displays both of them together instead exiting the first method first. Here's a dummy code to illustrate what i'm saying: void Question1() { String question="What is the capital of England?"; String Answer="London"; if(Answer=='London') { Question2(); } } void Question2() { String question="What is the capital of California?"; String Answer="Sacramento"; if(Answer=='Sacramento') { Question3(); } } Pls, this question is in no way related to that other question. Pls peruse the thread again.

    Read the article

  • Bare-metal virtualisation for the desktop

    - by Andrew Taylor
    Hi, Does anyone have any knowledge about bare-metal virtualisation products? I'm interested in building a new desktop machine for home, I've been looking at the Intel Quad Core processors and I'd like to put 8GB of RAM in there, but, it got me thinking about making the most out of the available resources. I thought if I could get a good 64bit machine, put some bare-metal virtualisation on, then have a primary system, I'd also be able to bring up some extra virtualised systems as and when I needed. I know most of the bare metal systems are designed for the server market, but, is there anything out there that works well for a desktop. What are the caveats? I presume I won't be able to make the most out of any video cards I could buy, what about just getting a decent screen resolution, will this be a problem? I run a single 24" screen. What about DVD/CD writing, is this possible? I'd like to re-rip my CD collection, I was hoping the quad 64Bit goodness would help me out with the encoding. I currently use a Mac and couldn't go back to windows so that leaves Linux, I was thinking a primary OS of ubuntu. Does this make a difference? Thanks Andrew

    Read the article

  • How does NMap decide to print a progress line?

    - by Andrew Bolster
    Checking a larger subnet than I normally do; mapping out a cluster suite in a university for a traffic mapping project (permission attained), and I was wondering something. NMap usually prints its progress periodically, but I'm unclear to what that 'periodically' is, because the cirrent scan printed a line for basically every 100th of a percent up to 1% done, then one at 1.5%, and has said nothing since. I suspect that it changes at different 'levels' but does anyone have an actual answer?

    Read the article

  • Vim: tab-align multiple lines?

    - by Andrew Bolster
    In GUI style editors, you can generally select multiple lines, press tab a few times to move all the lines across (or shift-tab to go back). I have no idea how to do this in VIM. I googled around and couldn't find any straight answer to I came here.

    Read the article

  • Postfix mail forwarder

    - by Andrew
    Hello, I just bought a dedicated server and I'm trying to install a webserver on it. The server is Ubuntu 10.04. I installed ftp, nginx, php, mysql, bind and now I have to install mail server. For the mail server I'm using Postfix, because it's recomended on ubuntu. I installed Postfix with apt-get install postfix but mail() function from php wasn't working. After a little debug I found the way to solve this : I created an empty file /etc/postfix/main.cf and it worked good. I do have a mx record like this mail 5M IN A xxx.xxx.xxx.xxx example.com. 5M IN MX 1 mail.example.com. After that I wanted to forward all e-mails to my GMail address. So I googled for it and I found in the official docs Virtual Domain Host Forwarding I added these lines in main.cf virtual_alias_domains = example.com virtual_alias_maps = hash:/etc/postfix/virtual I created map file and I placed this line in it @example.com [email protected] I run in terminal postmap /etc/postfix/virtual postfix reload The result: I can send e-mail from php with mail() function, but when I send an email to [email protected] that e-mail isn't forwarded to my Gmail. How to solve this? -Andrew I also tried this but not working http://rackerhacker.com/2006/12/26/postfix-virtual-mailboxes-forwarding-externally/ It works now! But I don't know what the problem was. I just installed "Mail Server" from Tasksel and after that it worked fine. Can anyone tell me what Tasksel installed or that it changed ?

    Read the article

  • Mesh Remote Desktop crashes 64 bit Windows 7 VM (8 GB)

    - by Andrew J. Brehm
    I have a Windows 7 VirtualBox VM (64 bit, 8 GB) on a Snow Leopard host (64 bit, 24 GB). It works fine until I connect via Microsoft Mesh. When I connect via Mesh remote desktop, the VM crashes about one or two minutes after the connection has been established. It doesn't answer to pings (from the host and from other machines in the network) and no RDC connections (from other Windows machines in the network where Mesh works) are possible. Any ideas?

    Read the article

  • Issue Parsing File with YAML-CPP

    - by Andrew
    In the following code, I'm having some sort of issue getting my .yaml file parsed using parser.GetNextDocument(doc);. After much gross debugging, I've found that the (main) issue here is that my for loop is not running, due to doc.size() == 0; What am I doing wrong? void BookView::load() { aBook.clear(); QString fileName = QFileDialog::getOpenFileName(this, tr("Load Address Book"), "", tr("Address Book (*.yaml);;All Files (*)")); if(fileName.isEmpty()) { return; } else { try { std::ifstream fin(fileName.toStdString().c_str()); YAML::Parser parser(fin); YAML::Node doc; std::map< std::string, std::string > entry; parser.GetNextDocument(doc); std::cout << doc.size(); for( YAML::Iterator it = doc.begin(); it != doc.end(); it++ ) { *it >> entry; aBook.push_back(entry); } } catch(YAML::ParserException &e) { std::cout << "YAML Exception caught: " << e.what() << std::endl; } } updateLayout( Navigating ); } The .yaml file being read was generated using yaml-cpp, so I assume it is correctly formed YAML, but just in case, here's the file anyways. ^@^@^@\230--- - address: ****************** comment: None. email: andrew(dot)levenson(at)gmail(dot)com name: Andrew Levenson phone: **********^@ Edit: By request, the emitting code: void BookView::save() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save Address Book"), "", tr("Address Book (*.yaml);;All Files (*)")); if (fileName.isEmpty()) { return; } else { QFile file(fileName); if(!file.open(QIODevice::WriteOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } std::vector< std::map< std::string, std::string > >::iterator itr; std::map< std::string, std::string >::iterator mItr; YAML::Emitter yaml; yaml << YAML::BeginSeq; for( itr = aBook.begin(); itr < aBook.end(); itr++ ) { yaml << YAML::BeginMap; for( mItr = (*itr).begin(); mItr != (*itr).end(); mItr++ ) { yaml << YAML::Key << (*mItr).first << YAML::Value << (*mItr).second; } yaml << YAML::EndMap; } yaml << YAML::EndSeq; QDataStream out(&file); out.setVersion(QDataStream::Qt_4_5); out << yaml.c_str(); } }

    Read the article

  • xpath/xslt to determine index of context node relative to all nodes of same name?

    - by Geoff
    Given the schema below - with a "query" node as the context, is it possible with xpath/xslt to determine the index of that "query" node relative to all "query" nodes in the document (not position() relative to its immediate siblings). TIA, Geoff <section> <name>About</name> <link>about</link> <questions> <question> <query>Question 1</query> <answer>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In cursus, elit id lacinia semper, ligula nunc rhoncus ante, in euismod tortor nibh dictum tellus.</answer> </question> </questions> </section> <section> <name>Contact</name> <link>contact</link> <questions> <question> <query>Question 1</query> <answer>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In cursus, elit id lacinia semper, ligula nunc rhoncus ante, in euismod tortor nibh dictum tellus.</answer> </question> <question> <query>Question 2</query> <answer>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In cursus, elit id lacinia semper, ligula nunc rhoncus ante, in euismod tortor nibh dictum tellus.</answer> </question> </questions> </section>

    Read the article

  • How do I use this indirect relationship?

    - by tyjkenn
    I'm working on incorporating a reputation system into my site, similar to SO. Here is how it is structured: User hasMany Project User hasMany Answer Project hasMany Rating Answer hasMany Rating Rating belongsTo Project where Rating.parent_type = Project Rating belongsTo Answer where Rating.parent_type = Answer Rating's value field will be a number between 1 and 5. The user should gain +10 for every 5-star review, +5 for every 4-star review, and +1 for every 3-star review. The way I currently have it set up is this: a recalcRep($id) action in the UsersController (along with other actions in other controllers, when necessary) calls the calcRep($id) method inside the User model, which is supposed to calculate the reputation of a user with an id of $id. public function calcRep($id) { $rep = 0; $data = $this->Rating->find('all'); //does not work, because it is not directly associated foreach($data as $rating) { if(($rating['Rating']['parent_type'] == 'Project' && $rating['Project']['user_id']==$id) or ($rating['Rating']['parent_type'] == 'Answer' && $rating['Answer']['user_id']==$id)) { if($rating['Rating']['value']==5) { $rep += 10; } else if($rating['Rating']['value']==4) { $rep += 5; } else if($rating['Rating']['value']==3) { $rep += 2; } } } $data['User']['reputation'] = $rep; $this->save($data); } I may be approaching this in completely the wrong way, but I can't figure out how to find all the ratings that belong to any of the children of a specific user.

    Read the article

  • fortran complications passing arrays in function

    - by user1514188
    I'm trying to write a program to calculate a cross product of two vectors (input is of "real" type, so for example [1.3 3.4 1,5]). But I keep getting numerous errors: program Q3CW implicit none REAL :: matA(3), matB(3) REAL :: A11, A12, A13 REAL :: B11, B12, B13 real :: productc(3), answer(3) read*,A11, A12, A13 read*,B11, B12, B13 matA = (/A11, A12, A13/) matB = (/B11, B12, B13/) answer = productc(matA, matB) print*,'Answer = ', answer(1), answer(2), answer(3) end program real function productc(matIn1, matIn2) real, dimension(3) :: matIn1, matIn2 productc(1)=(/matIn1(2)*matIn2(3)-matIn1(3)*matIn2(2)/) productc(2)=(/matIn1(3)*matIn2(1)-matIn1(1)*matIn2(3)/) productc(3)=(/matIn1(1)*matIn2(2)-matIn1(2)*matIn2(1)/) end function This is the error I get: Error: Q33333.f95(20) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@= Error: Q33333.f95(21) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@= Error: Q33333.f95(22) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@= Warning: Q33333.f95(23) : Function PRODUCTC has not been assigned a value; detected at FUNCTION@<end-of-statement> Build Result Error(3) Warning(1) Extension(0) Any idea what the problem could be ?

    Read the article

  • VB.NET trying simple captcha

    - by Pride Grimm
    I'm trying to write a simple captcha program in vb.net. I'm just wanting to make an image from random numbers and display it, check the answer, and then proceed. I'm pretty new to vb.net, so I found some code to generate the information. I will cite the owner when I find it again (http://www.knowlegezone.com/80/article/Technology/Software/Asp-Net/Simple-ASP-NET-CAPTCHA-Tutorial) This is in the onload() of default2.aspx Public Sub returnNumer() Dim num1 As New Random Dim num2 As New Random Dim numQ1 As Integer Dim numQ2 As Integer Dim QString As String numQ1 = num1.Next(10, 15) numQ2 = num2.Next(17, 31) QString = numQ1.ToString + " + " + numQ2.ToString + " = " Session("answer") = numQ1 + numQ2 Dim bitmap As New Bitmap(85, 35) Dim Grfx As Graphics = Graphics.FromImage(bitmap) Dim font As New Font("Arial", 18, FontStyle.Bold, GraphicsUnit.Pixel) Dim Rect As New Rectangle(0, 0, 100, 50) Grfx.FillRectangle(Brushes.Brown, Rect) Grfx.DrawRectangle(Pens.PeachPuff, Rect) ' Border Grfx.DrawString(QString, font, Brushes.Azure, 0, 0) Response.ContentType = "Image/jpeg" bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) bitmap.Dispose() Grfx.Dispose() End Sub So I put this in a separate page, like this This all works find and dandy, but when I get the answer from the session like this Dim literal As String = Convert.ToString(Session("answer")) It's always one behind. So if The images adds to 32, the answer in session isn't 32. But after a refresh (and a new image) the session("answer") will be 32. Is there a way to refresh the session on page 1, after the default2.aspx loads? Is there a better way to do this? I though about trying to run the code all on one page, and trying to set the src of and image to returnNumber(), but I need a bit of help on that one.

    Read the article

  • What's the most trivial function that would benfit from being computed on a GPU?

    - by hanDerPeder
    Hi. I'm just starting out learning OpenCL. I'm trying to get a feel for what performance gains to expect when moving functions/algorithms to the GPU. The most basic kernel given in most tutorials is a kernel that takes two arrays of numbers and sums the value at the corresponding indexes and adds them to a third array, like so: __kernel void add(__global float *a, __global float *b, __global float *answer) { int gid = get_global_id(0); answer[gid] = a[gid] + b[gid]; } __kernel void sub(__global float* n, __global float* answer) { int gid = get_global_id(0); answer[gid] = n[gid] - 2; } __kernel void ranksort(__global const float *a, __global float *answer) { int gid = get_global_id(0); int gSize = get_global_size(0); int x = 0; for(int i = 0; i < gSize; i++){ if(a[gid] > a[i]) x++; } answer[x] = a[gid]; } I am assuming that you could never justify computing this on the GPU, the memory transfer would out weight the time it would take computing this on the CPU by magnitudes (I might be wrong about this, hence this question). What I am wondering is what would be the most trivial example where you would expect significant speedup when using a OpenCL kernel instead of the CPU?

    Read the article

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