Search Results

Search found 1439 results on 58 pages for 'rob ford'.

Page 36/58 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • Django gives "I/O operation on closed file" error when reading from a saved ImageField

    - by Rob Osborne
    I have a model with two image fields, a source image and a thumbnail. When I update the new source image, save it and then try to read the source image to crop/scale it to a thumbnail I get an "I/O operation on closed file" error from PIL. If I update the source image, don't save the source image, and then try to read the source image to crop/scale, I get an "attempting to read from closed file" error from PIL. In both cases the source image is actually saved and available in later request/response loops. If I don't crop/scale in a single request/response loop but instead upload on one page and then crop/scale in another page this all works fine. This seems to be a cached buffer being reused some how, either by PIL or by the Django file storage. Any ideas on how to make an ImageField readable after saving?

    Read the article

  • How to decouple an app's agile development from a database using BDUF?

    - by Rob Wells
    G'day, I was reading the article "Database as a Fortress" by Dan Chak from the excellent book "97 Things Every Software Architect Should Know" (sanitised Amazon link) which suggests that databases should not be designed using an agile approach. There's an SO question on agile approaches and databases "Agile development and database changes" which has some excellent answers covering agile development approaches. In fact, one of the answers supplies a brilliant idea of what's needed for each update of the DB. ;-) But after reading Dan Chak's article, I am left wondering if an agile approach is really suitable for large scale systems. This of course leads on to the question of how best to decouple an agile approach for the application that is interacting with the BDUF database design without adding complicated translation layers in the final design employed? Any suggestions? cheers,

    Read the article

  • Pulling changes between two separate Mercurial repositories

    - by Rob
    I have two versions of a product and am using separate Hg repositories for each. I have made a change to one (v1.0) and I want to pull just that change into the v2.0 repository. How do I go about this? As far as I can tell, using hg pull -f -r xxxxx \\server\hg\v1.0 will pull in all changes up to the specified revision which isn't what I want. Is this possible or will I have to add the fix by hand?

    Read the article

  • How do I use a custom #theme function to a fieldset in a drupal module?

    - by Rob Crowell
    I have a module that builds a form that includes a fieldset. Instead of using the <legend> element to render the fieldset title, I want to place this content in a <div> element instead. But I want to change the behavior only for the form returned by my module, so I don't want to place any new functionality into my theme's template.php file. In mymod.module I have defined: // custom rendering function for fieldset elements function theme_mymod_fieldset($element) { return 'test'; } // implement hook_theme function mymod_theme() { return array( 'mymod_fieldset' => array('arguments' => array('element' => NULL)), 'mymod_form' => array('arguments' => array()) ); } // return a form that is based on the 'Basic Account Info' category of the user profile function mymod_form() { // load the user's profile global $user; $account = user_load($user->uid); // load the profile form, and then edit it $form_state = array(); $form = drupal_retrieve_form('user_profile_form', $form_state, $account, 'Basic Account Info'); // set the custom #theme function for this fieldset $form['Basic Account Info']['#theme'] = 'mymod_fieldset'; // more form manipulations // ... return $form; } When my page gets rendered, I expected to see the fieldset representing 'Basic Account Info' to be wholly replaced by my test message 'test'. Instead what happens is that the <fieldset> and <legend> elements are rendered as normal, but with the body of the fieldset replaced by the test message instead, like this: <fieldset> <legend>Basic Account Info</legend> test </fieldset> Why doesn't my #theme function have the chance to replace the entire <fieldset> element? If I wrap a textfield in this function instead, I am able to completely replace the <input> element along with its label. Furthermore, if I provide an override in my site's template.php for theme_fieldset, it works as expected and I am able to completely replace the <fieldset>, so I know it is possible. What's different about providing #theme functions to fieldsets inside a module?

    Read the article

  • Fast, easy, and secure method to perform DB actions with GET

    - by rob - not a robber
    Hey All, Sort of a methods/best practices question here that I am sure has been addressed, yet I can't find a solution based on the vague search terms I enter. I know starting off the question with "Fast and easy" will probably draw out a few sighs, so my apologies. Here is the deal. I have a logged in area where an ADMIN can do a whole host of POST operations to input data relating to their profile. The way I have data structured is pretty distinct and well segmented in most tables as it relates to the ID of the admin. Now, I have a table where I dump one type of data into and differentiate this data by assigning the ADMIN's unique ID to each record. In other words, all ADMINs have this one type of data writing to this table. I just differentiate by the ADMIN ID with each record. I was planning on letting the ADMIN remove these records by clicking on a link with a query string - obviously using GET. Obviously, the query structure is in the link so any logged in admin could then exploit the URL and delete a competitor's records. Is the only way to safely do this through POST or should I pass through the session info that includes password and validate it against the ADMIN ID that is requesting the delete? This is obviously much more work for me. As they said in the auto repair biz I used to work in... there are 3 ways to do a job: Fast, Good, and Cheap. You can only have two at a time. Fast and cheap will not be good. Good and cheap will not have fast turnaround. Fast and good will NOT be cheap. haha I guess that applies here... can never have Fast, Easy and Secure all at once ;) Thanks in advance...

    Read the article

  • RegEx - Remove HTML hyperlinks based on the link text

    - by Rob
    Hi, I have some text that has HTML hyper-links in it. I want to remove the hyperlinks, but only specific ones. e.g. I start with this: This is text <a href="link/to/somewhere">Link to Remove</a> and more text with another link <a href="/link/to/somewhere/else">Keep this link</a> I want to have: This is text and more text with another link <a href="/link/to/somewhere/else">Keep this link</a> I have this RegEx expression, <a\s[^>]*>.*?</a> ... but it matches ALL of the links. What do I need to add to that expression to match only the links with the link-text 'Remove' (for example) in it? thanks in advance.

    Read the article

  • UIActivityView and blocking

    - by Rob Bonner
    Hello, I have a section of code that uploads an image: [activity startAnimating]; [self uploadImage:img Session_id:appDelegate.sessionID PlaceID:place.placeID Comment:comment.text]; [activity stopAnimating]; I am sure that activity is wired up correctly to a UIActivityViewIndicator, but it never shows. Inside the uploadImage function, I open a connection to the server and start the upload. Does anyone have an example or possible explanation as to why the activity view would not display?

    Read the article

  • Trying to Install Rails 3

    - by Rob Fuller
    I'm trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I'm wondering if I've hosed myself. So far, I've run these commands: $ gem update --system $ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n $ gem install rails --pre However, when I run the last command, I get this error: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /usr/bin directory. I think it wants me to run the command with sudo so that it can write over /usr/bin/rails. But if I do that, won't I be overwriting my Rails 2.3.5 executable? I don't want to do that. Instead, I'd like to keep both versions of Rails. Can anyone help? Thanks.

    Read the article

  • Visual Studio 2008 Create Word 2007 Template Project Crashes

    - by Rob
    I've got this weird crashing happening when creating a C# Word 2007 Template Project in Visual Studio 2008. The IDE tells me that it's creating the project (it does create the solution and C# vsproj as well as the dotx and cs files). Then the IDE just crashes - no errors, messages, etc. When I try devenv /SafeMode it still doesn't work. I've also tried devenv /log but I don't really see any smoking guns. I have VS2008 SP1 and VSTO 3.0 SP1 installed. Anybody know why this is occurring or more importantly, how I can get it to stop?

    Read the article

  • Query next/previous record

    - by Rob
    I'm trying to find a better way to get the next or previous record from a table. Let's say I have a blog or news table: CREATE TABLE news ( news_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, news_datestamp DATETIME NOT NULL, news_author VARCHAR(100) NOT NULL, news_title VARCHAR(100) NOT NULL, news_text MEDIUMTEXT NOT NULL ); Now on the frontend I want navigation buttons for the next or previous records, if i'm sorting by news_id, I can do something rather simple like: SELECT MIN(news_id) AS next_news_id FROM news WHERE news_id > '$old_news_id' LIMIT 1 SELECT MAX(news_id) AS prev_news_id FROM news WHERE news_id < '$old_news_id' LIMIT 1 But the news can be sorted by any field, and I don't necessarily know which field is sorted on, so this won't work if the user sorts on news_author for example. I've resorted to the rather ugly and inefficient method of sorting the entire table and looping through all records until I find the record I need. $res = mysql_query("SELECT news_id FROM news ORDER BY `$sort_column` $sort_way"); $found = $prev = $next = 0; while(list($id) = mysql_fetch_row($res)) { if($found) { $next = $id; break; } if($id == $old_news_id) { $found = true; continue; } $prev = $id; } There's got to be a better way.

    Read the article

  • Using an ampersand in scanf()

    - by Rob
    When I compile scanf("%s", &var);, gcc sends back a warning: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[20]’ however when I compile scanf("%s", var);, no warning is applied. Both pieces of code work and the book I am reading specifically says to use the ampersand, but even it doesn't in some of the examples. My question is, should I continue to use the ampersand, even when the book doesn't specify?

    Read the article

  • Variable declarations in header files - static or not?

    - by Rob
    When refactoring away some #defines I came across declarations similar to the following in a C++ header file: static const unsigned int VAL = 42; const unsigned int ANOTHER_VAL = 37; The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible due to the classic #ifndef HEADER #define HEADER #endif trick (if that matters). Does the static mean only one copy of VAL is created, in case the header is included by more than one source file?

    Read the article

  • curl_multi_exec stops if one url is 404, how can I change that?

    - by Rob
    Currently, my cURL multi exec stops if one url it connects to doesn't work, so a few questions: 1: Why does it stop? That doesn't make sense to me. 2: How can I make it continue? EDIT: Here is my code: $SQL = mysql_query("SELECT url FROM shells") ; $mh = curl_multi_init(); $handles = array(); while($resultSet = mysql_fetch_array($SQL)){ //load the urls and send GET data $ch = curl_init($resultSet['url'] . $fullcurl); //Only load it for two seconds (Long enough to send the data) curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_multi_add_handle($mh, $ch); $handles[] = $ch; } // Create a status variable so we know when exec is done. $running = null; //execute the handles do { // Call exec. This call is non-blocking, meaning it works in the background. curl_multi_exec($mh,$running); // Sleep while it's executing. You could do other work here, if you have any. sleep(2); // Keep going until it's done. } while ($running > 0); // For loop to remove (close) the regular handles. foreach($handles as $ch) { // Remove the current array handle. curl_multi_remove_handle($mh, $ch); } // Close the multi handle curl_multi_close($mh);

    Read the article

  • Recursion in prepared statements

    - by Rob
    I've been using PDO and preparing all my statements primarily for security reasons. However, I have a part of my code that does execute the same statement many times with different parameters, and I thought this would be where the prepared statements really shine. But they actually break the code... The basic logic of the code is this. function someFunction($something) { global $pdo; $array = array(); static $handle = null; if (!$handle) { $handle = $pdo->prepare("A STATEMENT WITH :a_param"); } $handle->bindValue(":a_param", $something); if ($handle->execute()) { while ($row = $handle->fetch()) { $array[] = someFunction($row['blah']); } } return $array; } It looked fine to me, but it was missing out a lot of rows. Eventually I realised that the statement handle was being changed (executed with different param), which means the call to fetch in the while loop will only ever work once, then the function calls itself again, and the result set is changed. So I am wondering what's the best way of using PDO prepared statements in a recursive way. One way could be to use fetchAll(), but it says in the manual that has a substantial overhead. The whole point of this is to make it more efficient. The other thing I could do is not reuse a static handle, and instead make a new one every time. I believe that since the query string is the same, internally the MySQL driver will be using a prepared statement anyway, so there is just the small overhead of creating a new handle on each recursive call. Personally I think that defeats the point. Or is there some way of rewriting this?

    Read the article

  • Using PHP, can I put variables inside of variables?

    - by Rob
    For example, take this code: $ch = curl_init($resultSet['url']."?get0=get0&get1=".$get1."&get2=".$get2."&get3=".$get3); This of course, looks very ugly, and kind of a pain in the ass to read. So my question is, would I be able to use something like this: $allgets ="?act=phptools&host=".$host."&time=".$duration."&port=".$port; $ch = curl_init($resultSet['url'] . $allgets); Very simple question I suppose, but my server is undergoing maintenance, so I can't upload it and test it myself. I suppose a yes or no answer will suffice, but if you have a more efficient way of doing this, that would be even better. :)

    Read the article

  • What are Code Smells? What is the best way to correct them?

    - by Rob Cooper
    OK, so I know what a code smell is, and the Wikipedia Article is pretty clear in its definition: In computer programming, code smell is any symptom in the source code of a computer program that indicates something may be wrong. It generally indicates that the code should be refactored or the overall design should be reexamined. The term appears to have been coined by Kent Beck on WardsWiki. Usage of the term increased after it was featured in Refactoring. Improving the Design of Existing Code. I know it also provides a list of common code smells. But I thought it would be great if we could get clear list of not only what code smells there are, but also how to correct them. Some Rules Now, this is going to be a little subjective in that there are differences to languages, programming style etc. So lets lay down some ground rules: ** ONE SMELL PER ANSWER PLEASE! & ADVISE ON HOW TO CORRECT! ** See this answer for a good display of what this thread should be! DO NOT downmod if a smell doesn't apply to your language or development methodology We are all different. DO NOT just quickly smash in as many as you can think of Think about the smells you want to list and get a good idea down on how to work around. DO downmod answers that just look rushed For example "dupe code - remove dupe code". Let's makes it useful (e.g. Duplicate Code - Refactor into separate methods or even classes, use these links for help on these common.. etc. etc.). DO upmod answers that you would add yourself If you wish to expand, then answer with your thoughts linking to the original answer (if it's detailed) or comment if its a minor point. DO format your answers! Help others to be able to read it, use code snippets, headings and markup to make key points stand out!

    Read the article

  • Using Cucumber With Modular Sinatra Apps

    - by Rob Conery
    I'm building out a medium-sized application using Sinatra and all was well when I had a single app.rb file and I followed Aslak's guidance up on Github: http://wiki.github.com/aslakhellesoy/cucumber/sinatra As the app grew a bit larger and the app.rb file started to bulge, I refactored out a lot of of the bits into "middleware" style modules using Sinatra::Base, mapping things using a rack-up file (config.ru) etc. The app works nicely - but my specs blew up as there was no more app.rb file for webrat to run against (as defined in the link above). I've tried to find examples on how to work this - and I think I'm just not used to the internal guts of Cuke just yet as I can't find a single way to have it cover all the apps. I tried just pointing to "config.ru" instead of app.rb - but that doesn't work. What I ended up doing - which is completely hackish - is to have a separate app.rb file in my support directory, which has all the requires stuff so I can at least test the model stuff. I can also specify routes in there - but that's not at all what I want to do. So - the question is: how can I get Cucumber to properly work with the modular app approach?

    Read the article

  • Protecting Content with AuthLogic

    - by Rob Wilkerson
    I know this sounds like a really, really simple use case and I'm hoping that it is, but I swear I've looked all over the place and haven't found any mention of any way - not even the best way - of doing this. I'm brand-spanking new to Ruby, Rails and everything surrounding either (which may explain a lot). The dummy app that I'm using as my learning tool requires authentication in order to do almost anything meaningful, so I chose to start by solving that problem. I've installed the AuthLogic gem and have it working nicely to the extent that is covered by the intro documentation and Railscast, but now that I can register, login and logout...I need to do something with it. As an example, I need to create a page where users can upload images. I'm planning to have an ImagesController with an upload action method, but I want that only accessible to logged in users. I suppose that in every restricted action I could add code to redirect if there's no current_user, but that seems really verbose. Is there a better way of doing this that allows me to define or identify restricted areas and handle the authentication check in one place?

    Read the article

  • Is it possible to craft your own packets with python?

    - by Rob
    Well, I know its possible, using external libraries and modules such as scapy. But how about without external modules? Without running the script as root? No external dependencies? I've been doing a lot of googling, but haven't found much help. I'd like to be able to create my own packets, but without running as root, or installing extra dependencies. Any suggestions?

    Read the article

  • Get the selected value from a Select box and check that value against an array in the same form

    - by Rob Allen
    I'm new to JSTL/EL and JSP and can't seem to find a reference which covers the following scenario: I have an array of values in JavaScipt: var Countries = ('US', 'CA'); I then need to check to see if the currently selected value of a standard HTML select box is in that array. This is what I have so far: <select id="shippingCountry"> <option value="AT">Austria</option> <option value="CA">Canada</option> <option value="DE">Germany</option> //... <option value="US">United States</option> </select> <c:choose> <c:when test=" "> // I don't know what to put in the 'test' case <span class="required">*</span> </c:when> </c:choose>

    Read the article

  • Javascript: Using the Module Pattern for larger projects

    - by Rob
    I'm interested in using the Module Pattern to better organize my future projects. Unfortunately, there are only a few brief tutorials and proof-of-concept examples of the Module Pattern. Using the module pattern, I would like to organize projects into this sort of structure: project.arm.object.method(); Where "project" is my global project name, "arm" is a sub-section or branch of the project, "object" is an individual object, and so on to the methods and properties. However, I'm not sure how I should be declaring and organizing multiple "arms" and "objects" under "project". var project = window.project || {}; project.arm = project.arm || {}; project.arm.object = (function() { var privateVar = "Private contents."; function privateMethod() { alert(privateVar); } return { method: privateMethod }; }()); Are there any best practices or conventions when defining a complex module structure? Should I just declare a new arm/object underneath the last?

    Read the article

  • SQL Server Conditional Mailing Address Formatting

    - by Rob Packwood
    I have the following SQL to format a US address into each line for a mailing address but it is rather ugly. Is there a better way to solve this problem or does it have to be this ugly? declare @NL varchar(2); set @NL = char(13) + char(10); select case when rtrim(coalesce(AttentionLine,'') ) != '' then rtrim(AttentionLine ) + @NL else '' end + case when rtrim(coalesce(Recipient,'') ) != '' then rtrim(Recipient ) + @NL else '' end + case when rtrim(coalesce(AddlAddrLine,'') ) != '' then rtrim(AddlAddrLine ) + @NL else '' end + case when rtrim(coalesce(DeliveryAddr,'') ) != '' then rtrim(DeliveryAddr ) + @NL else '' end + case when rtrim(coalesce(LastLine,'') ) != '' then rtrim(LastLine ) + @NL else '' end + case when rtrim(coalesce(Country,'') ) != '' then rtrim(Country ) + @NL else '' end as FormattedMailingAddress from Address where Id = 1

    Read the article

  • Chaining jQuery animations using recursion crashes browser

    - by Rob Sobers
    Here's the basic idea of what I'm trying to do: Set the innerHTML of a DIV to some value X Animate the DIV When the animation finishes, change the value of X and repeat N times If I do this in a loop, what ends up happening is, because the animations occur asynchronously, the loop finishes and the DIV is set to its final value before the animations have had a chance to run for each value of X. As this question notes, the best way to solve this problem is to make a recursive call to the function in the callback handler for the animation. This way the value of the DIV doesn't change until the animation of the previous value is complete. This works perfectly...to a point. If I animate a bunch of these DIVs at the same time, my browser gets overwhelmed and crashes. Too much recursion. Can anyone think of a way to do this without using recursion?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >