Search Results

Search found 307 results on 13 pages for 'drew stephens'.

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

  • How to get elements from an object in C#?

    - by Drew
    I am using the AutoCompleteBox in WPF, I populate the suggestions with a List that consists of four fields. When the user selects an item and I reach my eventHandler, i can see that MyAutoCompleteBox.SelectedItem is an object that has my four values, if i hover this text in the debugger i can see the four values listed, however i don't know how to access these values in the code. I tried List<Codes> selected = MyAutoCompleteBox.SelectedItem as List<Codes>; where Codes is my List. selected returns as null and empty every time. Is there a way to get to these values? Thanks!

    Read the article

  • Is there any appreciable difference between if and if-else?

    - by Drew
    Given the following code snippets, is there any appreciable difference? public boolean foo(int input) { if(input > 10) { doStuff(); return true; } if(input == 0) { doOtherStuff(); return true; } return false; } vs. public boolean foo(int input) { if(input > 10) { doStuff(); return true; } else if(input == 0) { doOtherStuff(); return true; } else { return false; } } Or would the single exit principle be better here with this piece of code... public boolean foo(int input) { boolean toBeReturned = false; if(input > 10) { doStuff(); toBeReturned = true; } else if(input == 0) { doOtherStuff(); toBeReturned = true; } return toBeReturned; } Is there any perceptible performance difference? Do you feel one is more or less maintainable/readable than the others?

    Read the article

  • Which MySQL Fork/Version to Pick??

    - by Drew
    As most of you know, Sun acquired MySQL (and later Oracle acquired Sun), and during these acquisitions, there were a lot of FUD in MySQL community which resulted in creation of various forks. Today we have MySQL from MySQL, Percona (XtraDB) MySQL, OurDelta MySQL, MariaDB, Drizzle to name a few. Which brings us to the source of the problem. We are in the process of upgrading our databases (hardware/software) and I would like to know which one of the forks should I go with. Each has their own set of pros/cons. We are currently using MySQL 5.0.x from MySQL/Linux on an 8-core machine. Our new hardware is a monster with 32 cores and 32GB of memory connecting to a fast NetApp Storage via FC. I would like to stick with MySQL from MySQL but I have heard horror stories on how badly MySQL 5.1 performs on many cores. I have also heard that MySQL 5.4 performs better on multi-core machines but that's still not production ready. In addition, I have also heard a lot of good things about Percona builds. This is what I know so far: MySQL 5.1 from MySQL: Reliable choice, but doesn't scale well on a big machine Percona: Scales well, good backing company. I don't have much experience with it MariaDB: Don't know much about it besides that it was founded by Original MySQL developers (including Monty) OurDelta: Don't know much Drizzle: Mostly optimized for cloud computing I would like to know what's the general notion about this problem. Which build/version should I go with? How are you guys picking your builds/versions? Thanks!

    Read the article

  • Searching with MATCH(), AGAINST() and AS score with mysqli and php

    - by Drew
    Below is the code I am using to search my table. I have made the relevant columns FULLTEXT in the table. This doesn't return me anything. Can someone tell me what it is that i'm doing wrong? Thanks in advance. $sql = 'SELECT id,uname,class,school, MATCH(uname, class, school) AGAINST(?) AS score FROM images WHERE MATCH(uname, class, school) AGAINST(? IN BOOLEAN MODE) ORDER BY score DES'; $stmt = $db_connection->prepare($sql); $stmt->bind_param('ss',$keyword,$keyword); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id,$uname,$class,$school); $xml = "<data>".PHP_EOL; while($stmt->fetch()){ $xml .= " <person>".PHP_EOL; $xml .= " <id>$id</id>".PHP_EOL; $xml .= " <name>$uname</name>".PHP_EOL; $xml .= " <class>$class</class>".PHP_EOL; $xml .= " <school>$school</school>".PHP_EOL; $xml .= " </person>".PHP_EOL; } $xml .= "</data>"; echo $xml; Below is an image of the indexes of the table:

    Read the article

  • CFExecute not performing command

    - by Drew
    <cfset LOCAL.cmd = expandPath('..\library\gm.exe') /> <cfset LOCAL.args = "convert image1.jpg image2.jpg" /> <cfexecute variable="gm" errorVariable="error" name="#LOCAL.cmd#" timeout="10" arguments="#local.args#" /> <cfdump var="#gm#" /> This code always results in an empty string in gm. No matter how I execute gm with or without parameters. Other examples work fine like running cmd.exe or netstat.exe as is in the CFDocs example. I get no errors thrown or warnings in errorVariable, it simply does nothing.

    Read the article

  • Can't Insert Data Into Tables Containing Auto Increment Primary Key Using PHP Prepared Statements

    - by Drew
    I know I have that my connection to the database works, and a test I did using no auto-increment id worked fine for me. The code below refuses to work and I can't find a a way around it. My table has 3 columns, ID (auto increment), name and value. What do I need to change in order to get this to work? Thanks in advance //create placeholder query $query = "INSERT INTO prepared_test (name, value) VALUES (?,?)"; //prepare the query $stmt = mysqli_prepare($connection, $query); $name = 'steve'; $value = 45; mysqli_bind_param($stmt, array(MYSQLI_BIND_STRING, MYSQLI_BIND_INT), $name, $value); mysqli_execute($stmt); if(mysqli_stmt_affected_rows($stmt) != 1) die("issues"); mysqli_stmt_close($stmt); $connection-close();

    Read the article

  • How do I return clean JSON from a WCF Service?

    - by user208662
    I am trying to return some JSON from a WCF service. This service simply returns some content from my database. I can get the data. However, I am concerned about the format of my JSON. Currently, the JSON that gets returned is formatted like this: {"d":"[{\"Age\":35,\"FirstName\":\"Peyton\",\"LastName\":\"Manning\"},{\"Age\":31,\"FirstName\":\"Drew\",\"LastName\":\"Brees\"},{\"Age\":29,\"FirstName\":\"Tony\",\"LastName\":\"Romo\"}]"} In reality, I would like my JSON to be formatted as cleanly as possible. I believe (I may be incorrect), that the same collection of results, represented in clean JSON, should look like so: [{"Age":35,"FirstName":"Peyton","LastName":"Manning"},{"Age":31,"FirstName":"Drew","LastName":"Brees"},{"Age":29,"FirstName":"Tony","LastName":"Romo"}] I have no idea where the “d” is coming from. I also have no clue why the escape characters are being inserted. My entity looks like the following: [DataContract] public class Person { [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] public int Age { get; set; } public Person(string firstName, string lastName, int age) { this.FirstName = firstName; this.LastName = lastName; this.Age = age; } } The service that is responsible for returning the content is defined as: [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class TestService { [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] public string GetResults() { List<Person> results = new List<Person>(); results.Add(new Person("Peyton", "Manning", 35)); results.Add(new Person("Drew", "Brees", 31)); results.Add(new Person("Tony", "Romo", 29)); // Serialize the results as JSON DataContractJsonSerializer serializer = new DataContractJsonSerializer(results.GetType()); MemoryStream memoryStream = new MemoryStream(); serializer.WriteObject(memoryStream, results); // Return the results serialized as JSON string json = Encoding.Default.GetString(memoryStream.ToArray()); return json; } } How do I return “clean” JSON from a WCF service? Thank you!

    Read the article

  • Importing ctype; embedding python in C++ application

    - by Drew
    I'm trying to embed python within a C++ based programming language (CCL: The compuatational control language, not that any of you have heard of it). Thus, I don't really have a "main" function to make calls from. I have made a test .cc program with a main, and when I compile it and run it, I am able to import my own python modules and system modules for use. When I embed my code in my CCL-based program and compile it (with g++), it seems I have most functionality, but I get the import error: ImportError: /usr/lib/python2.6/lib-dynload/_ctypes.so: undefined symbol: PyType_GenericNew Can someone explain this to me and how to go about solving it? It seems like I've linked the objects correctly. Thanks.

    Read the article

  • Codeigniter not returning me to upload form after image upload.

    - by Drew
    I'm still very new to codeigniter. The issue i'm having is that the file uploads fine and it writes to the database without issue but it just doesn't return me to the upload form. Instead it stays in the do_upload and doesn't display anything. Even more bizarrely there is some source code behind the scenes. Can someone tell my what it is i'm doing wrong because I want to be returning to my upload form after submission. Thanks in advance. Below is my code: Controller: function do_upload() { if($this->Upload_model->do_upload()) { $this->load->view('home/upload_form'); }else{ $this->load->view('home/upload_success', $error); } } Model: function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '2000'; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); return $error; } else { $data = $this->upload->data(); $full_path = 'uploads/' . $data['file_name']; $spam = array( 'image_url' => $full_path, 'url' => $this->input->post('url') ); $id = $this->input->post('id'); $this->db->where('id', $id); $this->db->update('NavItemData', $spam); return true; } } View (called upload_form): <html> <head> <title>Upload Form</title> </head> <body> <?php if(isset($buttons)) : foreach($buttons as $row) : ?> <h2><?php echo $row->image_url; ?></h2> <p><?php echo $row->url; ?></p> <p><?php echo $row->name; ?></p> <p><?php echo anchor("upload/update_nav/$row->id", 'edit'); ?></p> <?php endforeach; ?> <?php endif; ?> </body> </html>

    Read the article

  • What preferred way to reconcile keyCode/charCode across browsers?

    - by Drew Turner
    Based on the properties of the keydown event I would like to ascertain what the current charCode are? Example. For the keydown event when the NumPad0, D0, and Colon key is pressed I would like to know what the associated charcode is. Currently I have a map that contains the charcode associated with that keyCode or use the current if charCode is not specified. keyCode = { Colon: 186, D0: 48, NumPad0: 96, }; charCodes = { 186: 59, 96: 48, }; shiftCharCodes = { 186: 58, 48: 41 }; Also in certain cases the keyCodes are different accross browsers? Example. The keydown event has different keyCode values across browsers. Colon Key (:/;) - keyCode is 59 on firefox - keyCode is 186 on IE/safari For more information http://www.quirksmode.org/js/keys.html

    Read the article

  • How do I perform 'WHERE' on groups of rows?

    - by Drew
    I have a table, which looks like: +-----------+----------+ + person_id + group_id + +-----------+----------+ + 1 + 10 + + 1 + 20 + + 1 + 30 + + 2 + 10 + + 2 + 20 + + 3 + 10 + +-----------+----------+ I need a query such that only person_ids with groups 10 AND 20 AND 30 are returned (only person_id: 1). I am not sure how to do this, as from what I can see it would require me to group the rows by person_id and then select the rows which contain all group_ids. I'm looking for something which will preserve the use of keys without resorting to string operations on group_concat() or such.

    Read the article

  • In C#, What is <T> After a Method Declaration?

    - by Drew
    I'm a VB.Net guy. (because I have to be, because the person who signs my check says so. :P) I grew up in Java and I don't generally struggle to read or write in C# when I get the chance. I came across some syntax today that I have never seen, and that I can't seem to figure out. In the following method declaration, what does < T represent? static void Foo < T (params T[] x) I have seen used in conjunction with declaring generic collections and things, but I can't for the life of me figure out what it does for this method. In case it matters, I came across it when thinking about some C# brain teasers. The sixth teaser contains the entire code snippet.

    Read the article

  • Efficient way to store tuples in the datastore

    - by Drew Sears
    If I have a pair of floats, is it any more efficient (computationally or storage-wise) to store them as a GeoPtProperty than it would be pickle the tuple and store it as a BlobProperty? If GeoPt is doing something more clever to keep multiple values in a single property, can it be leveraged for arbitrary data? Can I store the tuple ("Johnny", 5) in a single entity property in a similarly efficient manner?

    Read the article

  • MySQL Removing Some Foreign keys

    - by Drew
    I have a table whose primary key is used in several other tables and has several foreign keys to other tables. CREATE TABLE location ( locationID INT NOT NULL AUTO_INCREMENT PRIMARY KEY ... ) ENGINE = InnoDB; CREATE TABLE assignment ( assignmentID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, locationID INT NOT NULL, FOREIGN KEY locationIDX (locationID) REFERENCES location (locationID) ... ) ENGINE = InnoDB; CREATE TABLE assignmentStuff ( ... assignmentID INT NOT NULL, FOREIGN KEY assignmentIDX (assignmentID) REFERENCES assignment (assignmentID) ) ENGINE = InnoDB; The problem is that when I'm trying to drop one of the foreign key columns (ie locationIDX) it gives me an "ERROR 1025 (HY000): Error on rename" error. How can I drop the column in the assignment table above without getting this error?

    Read the article

  • Connection Pool Strategy: Good, Bad or Ugly?

    - by Drew
    I'm in charge of developing and maintaining a group of Web Applications that are centered around similar data. The architecture I decided on at the time was that each application would have their own database and web-root application. Each application maintains a connection pool to its own database and a central database for shared data (logins, etc.) A co-worker has been positing that this strategy will not scale because having so many different connection pools will not be scalable and that we should refactor the database so that all of the different applications use a single central database and that any modifications that may be unique to a system will need to be reflected from that one database and then use a single pool powered by Tomcat. He has posited that there is a lot of "meta data" that goes back and forth across the network to maintain a connection pool. My understanding is that with proper tuning to use only as many connections as necessary across the different pools (low volume apps getting less connections, high volume apps getting more, etc.) that the number of pools doesn't matter compared to the number of connections or more formally that the difference in overhead required to maintain 3 pools of 10 connections is negligible compared to 1 pool of 30 connections. The reasoning behind initially breaking the systems into a one-app-one-database design was that there are likely going to be differences between the apps and that each system could make modifications on the schema as needed. Similarly, it eliminated the possibility of system data bleeding through to other apps. Unfortunately there is not strong leadership in the company to make a hard decision. Although my co-worker is backing up his worries only with vagueness, I want to make sure I understand the ramifications of multiple small databases/connections versus one large database/connection pool.

    Read the article

  • Embedding Python in C: Having problems importin local modules

    - by Drew
    I'm needing to run Python scripts within a C-based app. I am able to import standard modules from the Python libraries i.e.: PyRun_SimpleString("import sys") But when I try to import a local module 'can' PyRun_SimpleString("import can") returns the error msg: Traceback (most recent call last): File "", line 1, in ImportError: No module named can When I type the command "import can" in iPython, the system is able to find it. How can I link my app with can? I've tried setting PYTHONPATH to my working directory. Thanks.

    Read the article

  • OpenGL - GL_FRONT versus GL_FRONT_AND_BACK

    - by Drew Noakes
    I'm tinkering with an open source project that uses OpenGL for rendering in 3D. In the construction of the materials I see code like this: // set ambient material reflectance glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mAmbient); In other examples, this is used: glMaterialfv(GL_FRONT, GL_AMBIENT, mAmbient); So my question is, what is the difference here? Under what circumstances would it look different and, if my volume is enclosed with all normals pointing outwards, is there any performance difference?

    Read the article

  • Dreamweaver recordset filter - Display all records as default

    - by Drew
    I am trying to create a simple search form to filter the results in the dynamic table. The search form is on the same pages as the results and posts to itself. I get the search string from the post variable. It is working, but I can't figure out how to set the default value to display all results. Dreamweaver automatically sets the default value to -1, and therefore no results are displayed on the initial load. How do I change this to display ALL records as default and the filter only if there is search string defined.

    Read the article

  • Is Catching a Null Pointer Exception a Code Smell?

    - by Drew
    Recently a co-worker of mine wrote in some code to catch a null pointer exception around an entire method, and return a single result. I pointed out how there could've been any number of reasons for the null pointer, so we changed it to a defensive check for the one result. However, catching NullPointerException just seemed wrong to me. In my mind, Null pointer exceptions are the result of bad code and not to be an expected exception in the system. Are there any cases where it makes sense to catch a null pointer exception?

    Read the article

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