Search Results

Search found 10463 results on 419 pages for 'required'.

Page 16/419 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Profiling help required

    - by Mick
    I have a profiling issue - imagine I have the following code... void main() { well_written_function(); badly_written_function(); } void well_written_function() { for (a small number) { highly_optimised_subroutine(); } } void badly_written_function() { for (a wastefully and unnecessarily large number) { highly_optimised_subroutine(); } } void highly_optimised_subroutine() { // lots of code } If I run this under vtune (or other profilers) it is very hard to spot that anything is wrong. All the hotspots will appear in the section marked "// lots of code" which is already optimised. The badly_written_function() will not be highlighted in any way even though it is the cause of all the trouble. Is there some feature of vtune that will help me find the problem? Is there some sort of mode whereby I can find the time taken by badly_written_function() and all of its sub-functions?

    Read the article

  • Is the "==" operator required to be defined to use std::find

    - by user144182
    Let's say I have: class myClass std::list<myClass> myList where myClass does not define the == operator and only consists of public fields. In both VS2010 and VS2005 the following does not compile: myClass myClassVal = myList.front(); std::find( myList.begin(), myList.end(), myClassVal ) complaining about lack of == operator. I naively assumed it would do a value comparison of the myClass object's public members, but I am almost positive this is not correct. I assume if I define a == operator or perhaps use a functor instead, it will solve the problem. Alternatively, if my list was holding pointers instead of values, the comparison would work. Is this right or should I be doing something else?

    Read the article

  • MySQL LEFT JOIN, GROUP BY and ORDER BY not working as required

    - by Simon
    I have a table 'products' => ('product_id', 'name', 'description') and a table 'product_price' => ('product_price_id', 'product_id', 'price', 'date_updated') I want to perform a query something like SELECT `p`.*, `pp`.`price` FROM `products` `p` LEFT JOIN `product_price` `pp` ON `pp`.`product_id` = `p`.`product_id` GROUP BY `p`.`product_id` ORDER BY `pp`.`date_updated` DESC As you can probably guess the price changes often and I need to pull out the latest one. The trouble is I cannot work out how to order the LEFT JOINed table. I tried using some of the GROUP BY functions like MAX() but that would only pull out the column not the row. Thanks.

    Read the article

  • Fallback to another exiting MIME type when the required is missing in Rails

    - by fifigyuri
    I want to extend the exiting supported HTML type of my site by support for iPhone. For this I registered a new MIME type. I created a layout for iphone and also converted some of the html views to iphone version. However, I did not convert all of the html.erb-s. I do not see the reason to convert all views, some of them should not change, some partials simply just remain the same. I guess there should be a solution for this case. I tried to search for ways how to fallback to an existing format, but did not find any answer. Does a way to define fallback for MIME types in Rails exist? How does it work? If it doesn't exist and thus I wanted to solve the issue not the right way, what could simply solve the task of extending an existing site by another format? Thanks for your suggestions.

    Read the article

  • Required Feild validator in grid view

    - by vigna hari karthik
    Hai Friends I am having one dyanmic grid in that amount and date is not null column user should enter some thing in that spceified column.my issue is that if the save button is pressed the requried validator is firing for all the rows which is empty.it should only show if the user shows in the current row.if the user left the particular row is empty and presses the save button the error message should show in the current row not all the rows. how to do this.

    Read the article

  • Why is const required [C++] ? [closed]

    - by Andy Leman
    Possible Duplicate: What's the difference between a const member function and a non-const member function? class Message { public: Message(const char* pStr, const char* key); Message(const char* pStr); Message(); void encryptMessage(); void decryptMessage(); const char* getUnMessage() const; const char* getEnMessage() const; void getMessage(); void getKey(); ~Message(); private: char* pUnMessage; char* pEnMessage; char* pKey; }; In this program, why using const? (2 different places) Please explain those 2 for me. Thank you very much!

    Read the article

  • MATLAB help required function root

    - by programmeur
    Dear All, I have made an program, function bisection; x1=input('enter the first value=') x2=input('enter the second value=') %f3=[]; for x=1:20 %x=1; x3=(x1+x2)/2; while x3-x1 >= 0.001 f3(x)=x3^3 + x3^2 - 3*x3 - 3; f1(x)=x1^3 + x1^2 - 3*x1 - 3; if ((f3(x)*f1(x)) < 0) x2=x3; else x1=x3; end break end format long f3' disp('The root is found to be ='); x3 end . . . . . program calculate function of interval (x1, x2) given by user, my program compile and execute but little stupid repetition until for loop complete, i want to stop further printing loop when desired value is achieved with while condition is used.

    Read the article

  • Web hosting a setup where both Windows and Linux are required

    - by lk
    I have a system where a website needs to be hosted on a Linux machine while a backend application that the site talks to needs to reside on Windows. Is there any "common practice" for such hosting? Note - both of the systems are mine so there is the dilemma of whether to have the machines physically located together to avoid delay for calls over the net.

    Read the article

  • Understanding of a C Code Required..

    - by RBA
    int Size(struct node* node) { if(node == NULL) { return 0; } else if(node != NULL) { return (Size(node->left) + 1 + Size(node->right)); } } Hi, Can Anybody please post the stack trace for the following piece of code. Lets say if we insert the values 2, 1, 10, 5... Then what could be the stack representation during the recursion process.. Please, its very urgent, and its very confusing too...

    Read the article

  • git - is there a way to get only required files in the working directory

    - by spoonboy
    I'm new to git and trying to use it with a project that has many (several hundreds) sources. The problem I have is that git is extracting all the project's sources to my working directory when doing checkout. This makes a lot of mess as I have to jump between the files and can unintentionally change/corrupt files that I wasn't even planning to change. I would prefer to extract only sources that I'm going to modify and then work with them. So, is there a way to tell git that I only going to work with specific sources, and so, that only these sources would be extracted to the working directory? Note, that this is not a partial checkout or something like this. I'm ok to checkout the whole branch. It's more about organising a working folder. Thanks.

    Read the article

  • what is required to run a c# winform program on a computer

    - by saso
    i have created a simple c# winform program that uses MS sql, and several DLLs. what steps should i do in order to get the program run on another computer. ie should i transfer the exe file + the dlls i used? should i also install .net framework 3.5 on the other pc? i used visual studio 2008 to compile.

    Read the article

  • PHP Guideline required

    - by user160820
    I am interested in learning PHP, but the books that I read are in procedural style and the source code that I try to reay are also mixtures of SQL,PHP and HTML. My Background is from Java. What I want to learn is PHP really with seprate Layers. Database Layer, Controller and View but I don't want to use any Framework. I also have fried some OOP PHP books, but they not what I am lloking for. What I need is a book or any Document that develops a sample website in pure PHP but in OOP style. Any Help. Thanks a lot in advance.

    Read the article

  • ASP error 424 Object required

    - by jeff
    I've got a problem with the following code pasted below, the problem seems to be coming from the openastextstream this carries on from another question: Set str_text_stream = obj_file.OpenAsTextStream(ForReading, TristateUseDefault) response.Write "<table>" int_j = 0 int_x = 0 Err.number = 0 Do While Not str_text_stream.AtEndOfStream str_po_insert_sql = "INSERT into tbl_purchase_orders (purchase_order_number, purchase_order_vendor_number, purchase_order_vendor_name) " str_po_insert_sql = str_po_insert_sql & " VALUES (" str_line = str_text_stream.readline arr_line = Split(str_line, """,""", -1) if Ubound(arr_line) <> 2 then Response.write "<tr><td>The line " & str_line & " could not be imported.</td></tr>" int_x = 1 else int_y = Instr(arr_line(2), """,") - 1 str_field_0 = Replace(arr_line(0), """", "") str_field_0 = Replace(str_field_0, "'", "''") str_field_1 = Replace(arr_line(1), "'", "''") str_field_2 = Left(arr_line(2), int_y) str_field_2 = Replace(str_field_2, "'", "''") str_po_insert_sql = str_po_insert_sql & "'" & str_field_0 & "', '" & arr_line(1) & "', '" & str_field_2 & "')" rs_po_insert.Open str_po_insert_sql, dbConnection, 3 if Err.number <> 0 then Response.write "<tr><td>The line " & str_po_insert_sql & " was imported.</td></tr>" end if Err.number = 0 int_j = int_j + 1 end if loop data from test import: "4501366934","800002","Clancy Docwra Ltd",04/05/2010 00:00:00 "4501366935","800004","Clancy Docwra Ltd",04/05/2010 00:00:00 "4501366936","800004","Clancy Docwra Ltd",04/05/2010 00:00:00

    Read the article

  • How can I select the required records?

    - by simple
    Tables: Product: [id, name, brand_id, is_published] Brand: [id, name, is_published] Awards: [id, name] ProductAwards [product_id, award_id] How do I select the list of PUBLISHED brands along with the number of AWARDS of brand's products that are Published. I am cool with all the part except issuing the "is_published" restriction when counting Awards. I hope this is clear; can anyone just suggest where to dig?

    Read the article

  • Why thread specific data is required in pthread ?

    - by user504542
    Hi As i know, all the threads share memory location. For example a global variable changes in one thread will reflect in another thread. Since each thread has its own stack, the local variables that are created inside the thread is unique. In this case, why do we need to go for thread specific data mechanism?. Can't it be achieved by auto storage varibles inside the thread function ? Kindly clarify!!!. BR Rj

    Read the article

  • How do I suppress this output?

    - by David
    I have a code chunk in an R Markdown file. ```{r} library(UsingR) ``` Using knitHTML to compile causes the following output, which never happened before I updated to the latest versions of R and RStudio: ## Loading required package: MASS ## Loading required package: HistData ## Loading required package: Hmisc ## Loading required package: grid ## Loading required package: lattice ## Loading required package: survival ## Loading required package: splines ## Loading required package: Formula ## ## Attaching package: 'Hmisc' ## ## The following objects are masked from 'package:base': ## ## format.pval, round.POSIXt, trunc.POSIXt, units ## ## Loading required package: aplpack ## Loading required package: tcltk ## Loading required package: quantreg ## Loading required package: SparseM ## ## Attaching package: 'SparseM' ## ## The following object is masked from 'package:base': ## ## backsolve ## ## ## Attaching package: 'quantreg' ## ## The following object is masked from 'package:Hmisc': ## ## latex ## ## The following object is masked from 'package:survival': ## ## untangle.specials ## ## ## Attaching package: 'UsingR' ## ## The following object is masked from 'package:survival': ## ## cancer How can I suppress this output? Note: echo=FALSE did not work.

    Read the article

  • What is required for a scope in an injection framework?

    - by johncarl
    Working with libraries like Seam, Guice and Spring I have become accustomed to dealing with variables within a scope. These libraries give you a handful of scopes and allow you to define your own. This is a very handy pattern for dealing with variable lifecycles and dependency injection. I have been trying to identify where scoping is the proper solution, or where another solution is more appropriate (context variable, singleton, etc). I have found that if the scope lifecycle is not well defined it is very difficult and often failure prone to manage injections in this way. I have searched on this topic but have found little discussion on the pattern. Is there some good articles discussing where to use scoping and what are required/suggested prerequisites for scoping? I interested in both reference discussion or your view on what is required or suggested for a proper scope implementation. Keep in mind that I am referring to scoping as a general idea, this includes things like globally scoped singletons, request or session scoped web variable, conversation scopes, and others. Edit: Some simple background on custom scopes: Google Guice custom scope Some definitions relevant to above: “scoping” - A set of requirements that define what objects get injected at what time. A simple example of this is Thread scope, based on a ThreadLocal. This scope would inject a variable based on what thread instantiated the class. Here's an example of this: “context variable” - A repository passed from one object to another holding relevant variables. Much like scoping this is a more brute force way of accessing variables based on the calling code. Example: methodOne(Context context){ methodTwo(context); } methodTwo(Context context){ ... //same context as method one, if called from method one } “globally scoped singleton” - Following the singleton pattern, there is one object per application instance. This applies to scopes because there is a basic lifecycle to this object: there is only one of these objects instantiated. Here's an example of a JSR330 Singleton scoped object: @Singleton public void SingletonExample{ ... } usage: public class One { @Inject SingeltonExample example1; } public class Two { @Inject SingeltonExample example2; } After instantiation: one.example1 == two.example2 //true;

    Read the article

  • Creating PHP Forms with show/hide functionality [migrated]

    - by ronquiq
    I want to create two reports and submit the report data to database by using two functions defined in a class: Here I have two buttons: "Create ES" and "Create RP". Rightnow, my forms are working fine, I can insert data successfully, but the problem was when I click on submit after filling the form data, the content is hiding and displays the fist div content "cs_content" and again I need to onclick to submit again. Could anyone give a solution for this. Requirement : When I click on "Create CS", I should be able to fill the form and submit data successfully with a message within "cs_content" and any form input errors, the errors should display within "cs_content". When I click on "Create RP", I should be able to fill the form and submit data successfully with a message within "rp_content" and any form input errors, the errors should display within "rp_content". home.php <?php require 'classes/class.report.php'; $report = new Report($db); ?> <html> <head> <script src="js/jqueryv1.10.2.js"></script> <script> $ (document).ready(function () { //$("#cs_content").show(); $('#cs').click(function () { $('#cs_content').fadeIn('slow'); $('#rp_content').hide(); }); $('#rp').click(function () { $('#rp_content').fadeIn('slow'); $('#cs_content').hide(); }); }); </script> </head> <body> <div class="container2"> <div style="margin:0px 0px;padding:3px 217px;overflow:hidden;"> <div id="cs" style="float:left;margin:0px 0px;padding:7px;"><input type="button" value="CREATE CS"></div> <div id="rp" style="float:left;margin:0px 0px;padding:7px;"><input type="button" value="CREATE RP"></div><br> </div> <div id="cs_content"> <?php $report->create_cs_report(); ?> </div> <div id="rp_content" style="display:none;"> <?php $report->create_rp_report(); ?> </div> </div> </body> </html> class.report.php <?php class Report { private $db; public function __construct($database){ $this->db = $database; } public function create_cs_report() { if (isset($_POST['create_es_report'])) { $report_name = htmlentities($_POST['report_name']); $from_address = htmlentities($_POST['from_address']); $subject = htmlentities($_POST['subject']); $reply_to = htmlentities($_POST['reply_to']); if (empty($_POST['report_name']) || empty($_POST['from_address']) || empty($_POST['subject']) || empty($_POST['reply_to'])) { $errors[] = '<span class="error">All fields are required.</span>'; } else { if (isset($_POST['report_name']) && empty($_POST['report_name'])) { $errors[] = '<span class="error">Report Name is required</span>'; } else if (!ctype_alnum($_POST['report_name'])) { $errors[] = '<span class="error">Report Name: Whitespace is not allowed, only alphabets and numbers are required</span>'; } if (isset($_POST['from_address']) && empty($_POST['from_address'])) { $errors[] = '<span class="error">From address is required</span>'; } else if (filter_var($_POST['from_address'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = '<span class="error">Please enter a valid From address</span>'; } if (isset($_POST['subject']) && empty($_POST['subject'])) { $errors[] = '<span class="error">Subject is required</span>'; } else if (!ctype_alnum($_POST['subject'])) { $errors[] = '<span class="error">Subject: Whitespace is not allowed, only alphabets and numbers are required</span>'; } if (isset($_POST['reply_to']) && empty($_POST['reply_to'])) { $errors[] = '<span class="error">Reply To is required</span>'; } else if (filter_var($_POST['reply_to'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = '<span class="error">Please enter a valid Reply-To address</span>'; } } if (empty($errors) === true) { $query = $this->db->prepare("INSERT INTO report(report_name, from_address, subject, reply_to) VALUES (?, ?, ?, ?) "); $query->bindValue(1, $report_name); $query->bindValue(2, $from_address); $query->bindValue(3, $subject); $query->bindValue(4, $reply_to); try { $query->execute(); } catch(PDOException $e) { die($e->getMessage()); } header('Location:home.php?success'); exit(); } } if (isset($_GET['success']) && empty($_GET['success'])) { header('Location:home.php'); echo '<span class="error">Report is succesfully created</span>'; } ?> <form action="" method="POST" accept-charset="UTF-8"> <div style="font-weight:bold;padding:17px 80px;text-decoration:underline;">Section A</div> <table class="create_report"> <tr><td><label>Report Name</label><span style="color:#A60000">*</span></td> <td><input type="text" name="report_name" required placeholder="Name of the report" value="<?php if(isset($_POST["report_name"])) echo $report_name; ?>" size="30" maxlength="30"> </td></tr> <tr><td><label>From</label><span style="color:#A60000">*</span></td> <td><input type="text" name="from_address" required placeholder="From address" value="<?php if(isset($_POST["from_address"])) echo $from_address; ?>" size="30"> </td></tr> <tr><td><label>Subject</label><span style="color:#A60000">*</span></td> <td><input type="text" name="subject" required placeholder="Subject" value="<?php if(isset($_POST["subject"])) echo $subject; ?>" size="30"> </td></tr> <tr><td><label>Reply To</label><span style="color:#A60000">*</span></td> <td><input type="text" name="reply_to" required placeholder="Reply address" value="<?php if(isset($_POST["reply_to"])) echo $reply_to; ?>" size="30"> </td></tr> <tr><td><input type="submit" value="create report" style="background:#8AC007;color:#080808;padding:6px;" name="create_es_report"></td></tr> </table> </form> <?php //IF THERE ARE ERRORS, THEY WOULD BE DISPLAY HERE if (empty($errors) === false) { echo '<div>' . implode('</p><p>', $errors) . '</div>'; } } public function create_rp_report() { if (isset($_POST['create_rp_report'])) { $report_name = htmlentities($_POST['report_name']); $to_address = htmlentities($_POST['to_address']); $subject = htmlentities($_POST['subject']); $reply_to = htmlentities($_POST['reply_to']); if (empty($_POST['report_name']) || empty($_POST['to_address']) || empty($_POST['subject']) || empty($_POST['reply_to'])) { $errors[] = '<span class="error">All fields are required.</span>'; } else { if (isset($_POST['report_name']) && empty($_POST['report_name'])) { $errors[] = '<span class="error">Report Name is required</span>'; } else if (!ctype_alnum($_POST['report_name'])) { $errors[] = '<span class="error">Report Name: Whitespace is not allowed, only alphabets and numbers are required</span>'; } if (isset($_POST['to_address']) && empty($_POST['to_address'])) { $errors[] = '<span class="error">to address is required</span>'; } else if (filter_var($_POST['to_address'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = '<span class="error">Please enter a valid to address</span>'; } if (isset($_POST['subject']) && empty($_POST['subject'])) { $errors[] = '<span class="error">Subject is required</span>'; } else if (!ctype_alnum($_POST['subject'])) { $errors[] = '<span class="error">Subject: Whitespace is not allowed, only alphabets and numbers are required</span>'; } if (isset($_POST['reply_to']) && empty($_POST['reply_to'])) { $errors[] = '<span class="error">Reply To is required</span>'; } else if (filter_var($_POST['reply_to'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = '<span class="error">Please enter a valid Reply-To address</span>'; } } if (empty($errors) === true) { $query = $this->db->prepare("INSERT INTO report(report_name, to_address, subject, reply_to) VALUES (?, ?, ?, ?) "); $query->bindValue(1, $report_name); $query->bindValue(2, $to_address); $query->bindValue(3, $subject); $query->bindValue(4, $reply_to); try { $query->execute(); } catch(PDOException $e) { die($e->getMessage()); } header('Location:home.php?success'); exit(); } } if (isset($_GET['success']) && empty($_GET['success'])) { header('Location:home.php'); echo '<span class="error">Report is succesfully created</span>'; } ?> <form action="" method="POST" accept-charset="UTF-8"> <div style="font-weight:bold;padding:17px 80px;text-decoration:underline;">Section A</div> <table class="create_report"> <tr><td><label>Report Name</label><span style="color:#A60000">*</span></td> <td><input type="text" name="report_name" required placeholder="Name of the report" value="<?php if(isset($_POST["report_name"])) echo $report_name; ?>" size="30" maxlength="30"> </td></tr> <tr><td><label>to</label><span style="color:#A60000">*</span></td> <td><input type="text" name="to_address" required placeholder="to address" value="<?php if(isset($_POST["to_address"])) echo $to_address; ?>" size="30"> </td></tr> <tr><td><label>Subject</label><span style="color:#A60000">*</span></td> <td><input type="text" name="subject" required placeholder="Subject" value="<?php if(isset($_POST["subject"])) echo $subject; ?>" size="30"> </td></tr> <tr><td><label>Reply To</label><span style="color:#A60000">*</span></td> <td><input type="text" name="reply_to" required placeholder="Reply address" value="<?php if(isset($_POST["reply_to"])) echo $reply_to; ?>" size="30"> </td></tr> <tr><td><input type="submit" value="create report" style="background:#8AC007;color:#080808;padding:6px;" name="create_rp_report"></td></tr> </table> </form> <?php //IF THERE ARE ERRORS, THEY WOULD BE DISPLAY HERE if (empty($errors) === false) { echo '<div>' . implode('</p><p>', $errors) . '</div>'; } } }//Report CLASS ENDS

    Read the article

  • jQuery Validate plugin - password check - minimum requirements - Regex

    - by QviXx
    I've got a little problem with my password-checker. There's got a registration form with some fields. I use jQuery Validate plugin to validate user-inputs. It all works except the password-validation: The password should meet some minimum requirements: minimum length: 8 - I just use 'minlength: 8' at least one lower-case character at least one digit Allowed Characters: A-Z a-z 0-9 @ * _ - . ! At the moment I use this code to validate the password: $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); This Code works for the allowed characters but not for minimum requirements. I know that you can use for example (?=.*[a-z]) for a lower-case-requirement. But I just don't get it to work. If I add (?=.*[a-z]) the whole code doesn't work anymore. I need to know how to properly add the code to the existing one. Thank you for your answers! This is the complete code <script> $(function() { $("#regform").validate({ rules: { forename: { required: true }, surname: { required: true }, username: { required: true }, password: { required: true, pwcheck: true, minlength: 8 }, password2: { required: true, equalTo: "#password" }, mail1: { required: true, email: true }, mail2: { required: true, equalTo: "#mail1" } }, messages: { forename: { required: "Vornamen angeben" }, surname: { required: "Nachnamen angeben" }, username: { required: "Usernamen angeben" }, password: { required: "Passwort angeben", pwcheck: "Das Passwort entspricht nicht den Kriterien!", minlength: "Das Passwort entspricht nicht den Kriterien!" }, password2: { required: "Passwort wiederholen", equalTo: "Die Passwörter stimmen nicht überein" }, mail1: { required: "Mail-Adresse angeben", email: "ungültiges Mail-Format" }, mail2: { required: "Mail-Adresse wiederholen", equalTo: "Die Mail-Adressen stimmen nicht überein" } } }); $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); }); </script>

    Read the article

  • What would you do if your client required you not to use object-oriented programming?

    - by gunbuster363
    Would you try to persuade your client that using object-oriented programming is much cleaner? Or would you try to follow what he required and give him crappy code? Now I am writing a program to simulate the activity of ants in a grid. The ant can move around, pick up things and drop things. The problem is while the action of the ants and the positions of each ant can be tracked by class attributes easily (and we can easily create many instances of such ants) my client said that since he has a background in functional programming he would like the simulation to be made using functional programming. What would you do?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >