Search Results

Search found 334 results on 14 pages for 'drew wagner'.

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

  • How to set App as site.com/ in Kohana3

    - by Drew
    Hi all! I've only just started using Kohana ( 3 hours ago), and so far it's blown my socks off (and I'm wearing slippers, so that's quite impressive). Right now, I have a controller 'Controller_FrontPage' with associated views and models and I'm trying to get it accesible from the root of my website (eg, http://www.mysite.com/). If I edit the default controller in the bootstrap from: Route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'welcome', 'action' => 'index', )); to 'controller' => '', I get an error, could not find controller_ (which makes sense), and if I change it to 'controller' => '/', I get an error, could not find controller_/ (which also makes sense). If I set 'controller' => 'FrontPage', everything works fine, but all my links (html::anchor(...)) point to http://www.mysite.com/FrontPage/*. Is there a way to have all the anchors point to http://www.mysite.com/*?

    Read the article

  • WPF - How to stop an ItemsControl psuedo-grid's columns from dancing/jumping around during layout

    - by Drew Noakes
    Several other questions on SO have come to the same conclusion I have -- using an ItemsControl with a DataTemplate for each item constructed to position items such that they resemble a grid is much simpler (especially to format) than using a ListView. The code resembles: <StackPanel Grid.IsSharedSizeScope="True"> <!-- Header --> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="Column1" /> <ColumnDefinition Width="Auto" SharedSizeGroup="Column2" /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="Column Header 1" /> <TextBlock Grid.Column="1" Text="Column Header 2" /> </Grid> <!-- Items --> <ItemsControl ItemsSource="{Binding Path=Values, Mode=OneWay}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="Column1" /> <ColumnDefinition Width="Auto" SharedSizeGroup="Column2" /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="{Binding ColumnProperty1}" /> <TextBlock Grid.Column="1" Text="{Binding ColumnProperty2}" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </StackPanel> The problem I'm seeing is that whenever I swap the object to which the ItemsSource is bound (it's an ObservableCollection that I replace the reference to, rather than clear and re-add), the entire 'grid' dances about for a few seconds. Presumably it is making a few layout passes to get all the Auto-width columns to match up. This is very distracting for my users and I'd like to get it sorted out. Has anyone else seen this?

    Read the article

  • jquery to check when a someone starts typing in to a field

    - by Drew
    $('a#next').click(function() { var tags = $('input[name=tags]'); if(tags.val()==''){ tags.addClass('hightlight'); return false; }else{ tags.removeClass('hightlight'); $('#formcont').fadeIn('slow'); $('#next').hide('slow'); return false; } }); I would like the above code to fire the fadeIn as soon as somebody starts typing into the tags input. Can somebody tell me the correct way to do this or point me in the right direction? Thanks in advance EDIT here is the code to do it: $('input#tags').keypress(function() { $('#formcont').fadeIn('slow'); $('#next').hide('slow'); }); The only problem I've found is that my cursor no longer shows up in the text box. What am I doing wrong?

    Read the article

  • Extending the .NET type system so the compiler enforces semantic meaning of primitive values in cert

    - by Drew Noakes
    I'm working with geometry a bit at the moment and am converting a lot between degrees and radians. Unfortunately, both of these are represented by double, so there's compile time warning/error if I try to pass a value in degrees where radians are expected. I believe F# has a compile-time solution for this (called units of measure.) I'd like to do something similar in C#. As another example, imagine a SQL library that accepts various query parameters as strings. It'd be good to have a way of enforcing that only clean strings were allowed to be passed in at runtime, and the only way to get a clean string was to pass through some SQL injection attack preventing logic. The obvious solution is to wrap the double/string/whatever in a new type to give it the type information the compiler needs. I'm curious if anyone has an alternative solution. If you do think wrapping is the only/best way, then please go into some of the downsides of the pattern (and any upsides I haven't mentioned too.) I'm especially concerned about the performance of abstracted primitive numeric types on my calculations at runtime.

    Read the article

  • Do COM Dll References Require Manual Disposal? If so, How?

    - by Drew
    I have written some code in VB that verifies that a particular port in the Windows Firewall is open, and opens one otherwise. The code uses references to three COM DLLs. I wrote a WindowsFirewall class, which Imports the primary namespace defined by the DLLs. Within members of the WindowsFirewall class I construct some of the types defined by the DLLs referenced. The following code isn't the entire class, but demonstrates what I am doing. Imports NetFwTypeLib Public Class WindowsFirewall Public Shared Function IsFirewallEnabled as Boolean Dim icfMgr As INetFwMgr icfMgr = CType(System.Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwMgr")), INetFwMgr) Dim profile As INetFwProfile profile = icfMgr.LocalPolicy.CurrentProfile Dim fIsFirewallEnabled as Boolean fIsFirewallEnabled = profile.FirewallEnabled return fIsFirewallEnabled End Function End Class I do not reference COM DLLs very often. I have read that unmanaged code may not be cleaned up by the garbage collector and I would like to know how to make sure that I have not introduced any memory leaks. Please tell me (a) if I have introduced a memory leak, and (b) how I may clean it up. (My theory is that the icfMgr and profile objects do allocate memory that remains unreleased until after the application closes. I am hopeful that setting their references equal to nothing will mark them for garbage collection, since I can find no other way to dispose of them. Neither one implements IDisposable, and neither contains a Finalize method. I suspect they may not even be relevant here, and that both of those methods of releasing memory only apply to .Net types.)

    Read the article

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Formatting associative array declaration

    - by Drew Stephens
    When declaring an associative array, how do you handle the indentation of the elements of the array? I've seen a number of different styles (PHP syntax, since that's what I've been in lately). This is a pretty picky and trivial thing, so move along if you're interested in more serious pursuits. 1) Indent elements one more level: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); 2) Indent elements two levels: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); 3) Indent elements beyond the array constructor, with closing brace aligned with the start of the constructor: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); 4) Indent elements beyond the array construct, with closing brace aligned with opening brace: $array = array( 'Foo' => 'Bar', 'Baz' => 'Qux' ); Personally, I like #3—the broad indentation makes it clear that we're at a break point in the code (constructing the array), and having the closing brace floating a bit to the left of all of the array's data makes it clear that this declaration is done.

    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

  • 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

  • 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

  • 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

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