Search Results

Search found 1676 results on 68 pages for 'andrew philpott'.

Page 55/68 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Projects to learn Python

    - by Andrew
    I know this isn't a question about a specific snippet of code or anything, but here goes - I've been messing around with the idea of learning Python since I'm pretty bored with PHP (and web development in general), but I can't think of any projects to help me learn. I've already worked through some of Project Euler with Python, but it's getting old. I know the basics, and I want to write something more fun that will introduce me to new things in Python. Is there a cliche beginner project for Python? (for example, PHP's would be a blog or something similiar) Are there any common Python projects for newcomers, or any uncommon ones that you'd suggest? Any ideas would help.

    Read the article

  • Navigating sorted XML data (XSLT)

    - by Andrew Parisi
    I have an XML file with company data in it, for 30 companies across 8 industries, on a portfolio page. The user has the option to sort this data by Industry, and this XML file will be added to constantly. This sorting is done in my XSL file using <xsl:choose>. Example: <xsl:when test="(invest[@investid='con'])"> <xsl:for-each select="$invest-port/portfolio/company[@industry='Communications']"> <xsl:sort select="name" /> <div class="invest-port-thumb"> <a> <xsl:attribute name="href"> <xsl:value-of select="link" /> </xsl:attribute> </a> </div> </xsl:for-each> </xsl:when> When navigating to an individual company's page, there are "previous" and "next" buttons at the bottom of the window. My issue is that I need these to dynamically link to the previous and next elements from within the XML data that has been sorted. Is this possible? Or is there an easier way to do this? (such as place each company in industry-divided XML files instead of one) Any insight would be greatly appreciated!

    Read the article

  • JQuery. Layout is shaking during animation

    - by Andrew Florko
    Hello everybody, JQuery accordion animation (as well as simple hides / shows) looks weird with some browsers (IE, Opera). But Fire Fox and Chrome renders animation perfectly without artifacts. Html layout tends to shake with IE / Opera during animation as if surrounding paddings / margins are changed for small random value. How can I minimize this effect. Is it jquery bug or browsers issue?

    Read the article

  • CTRL+mouse wheel in gvim (windows) not paging

    - by andrew
    Hello, I'm loving vim, but one thing that's bugging me is that when I hold the control key and mouse wheel up or down, the window scrolls normally when the bindings are telling it to page up/down. I'm using the exact same vimrc file (and plugins) on one of my linux machines and the CTRL+mouse wheel does page up down (as opposed to just normally scrolling like in windows). Is there some way to force gvim to response to a ctrl+MouseUp/Down event? It seems to be ignoring it in windows ='[

    Read the article

  • C++ Word-Number to int

    - by Andrew
    I'm developing a program that makes basic calculations using words instead of numbers. E.g. five + two would output seven. The program becomes more complex, taking input such as two_hundred_one + five_thousand_six (201 + 5006) Through operator overloading methods, I split each number and assign it to it's own array index. two would be [0], hundred is [1], and one is [2]. Then the array recycles for 5006. My problem is, to perform the actual calculation, I need to convert the words stored in the array to actual integers. I have const string arrays such as this as a library of the words: const string units[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; const string teens[] = { "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; const string tens[] = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; If my 'token' array has stored in it two hundred one in index 0, 1, and 2, I'm not sure what the best way to convert these to ints would involve.

    Read the article

  • Easy way to keep counting up infinitely

    - by Andrew Alexander
    What's a good way to keep counting up infinitely? I'm trying to write a condition that will keep going until there's no value in a database, so it's going to iterate from 0, up to theoretically infinity (inside a try block, of course). How would I count upwards infinitely? Or should I use something else? I am looking for something similar to i++ in other languages, where it keeps iterating until failure.

    Read the article

  • Working with PHP and MySQL - need a good and secure design with OO design

    - by Andrew
    I am new to PHP- first time developer. I am working on my web application and it is nearly done; nevertheless, most of my sql was done directly via code using direct mysql requests. This is the way I approached it: In classes_db.php I declared the db settings and created methods that I use to open and close DB connections. I declare those objects on my regular pages: class classes_db { public $dbserver = 'server; public $dbusername = 'user'; public $dbpassword = 'pass'; public $dbname = 'db'; function openDb() { $dbhandle = mysql_connect($this->dbserver, $this->dbusername, $this->dbpassword); if (!$dbhandle) { die('Could not connect: ' . mysql_error()); } $selected = mysql_select_db($this->dbname, $dbhandle) or die("Could not select the database"); return $dbhandle; } function closeDb($con) { mysql_close($con); } } On my regular page, I do this: <?php require 'classes_db.php'; session_start(); //create instance of the DB class $db = new classes_db(); //get dbhandle $dbhandle = $db->openDb(); //process query $result = mysql_query("update user set username = '" . $usernameFromForm . "' where iduser= " . $_SESSION['user']->iduser); //close the connection if (isset($dbhandle)) { $db->closeDb($dbhandle); } ?> My questions is: how to do it right and make it OO and secure? I know that I need incorporate prepared queries- how to do it the best way? Please provide some code

    Read the article

  • GIt Deployment + Configuration Files + Heroku

    - by Andrew
    I'm using Heroku to host a Rails app, which means using Git to deploy to Heroku. Because of the "pure Git workflow" on Heroku, anything that needs to go upstream to the server has to be configured identically on my local box. However I need to have certain configuration files be different depending on whether I'm in the local setup or deployed on Heroku. Again, because of the deployment method Heroku uses I can't use .gitignore and a template (as I have seen suggested many times, and have used in other projects). What I need is for git to somehow track changes on a file, but selectively tell git not to override certain files when pulling from a particular repo -- basically to make certain changes one-way only. Can this be done? I'd appreciate any suggestions!

    Read the article

  • Nowaday C++ projects for Windows

    - by Andrew Florko
    Please, describe nowadays projects you took part in where C++ platform was preferred to .net where .net runtime could be installed. Some of my friends works in SCADA area. They have to program microcontrollers with Linux Embedded and so on. So my friends have nearly no choice in programming tools. But when you had, why did you prefer C++ ?

    Read the article

  • jquery load function problem

    - by andrew
    Hi, i have a select box like that <select name="sehirler_post" id="sehirler_post"> i am getting values via jquery. i know two different ways to get values. first one is : var sehirler_post = jQuery('select#sehirler_post').attr('value'); second one is: jQuery('#sehirler_post ').val() and finally here is my problem, i have something like this: jQuery("#okay").load("ajax_post_category.php?okay="+id+""); i would like to use selectbox value instead of id (okay="+id+"). so, i must change +id+ part with select box value. however i can not do it.. i tried to do like that: jQuery("#okay").load("ajax_post_category.php?okay="+jQuery('#sehirler_post').val()+""); it did not work. there must be a way, so i can use selectbox value instead of id in my load function. if anyone helps me, ill be so glad. regards

    Read the article

  • PHP syntax question: global $argv, $argc;

    - by Andrew
    So I have a PHPUnit test, and found this code within a function. global $argv, $argc; echo $argc; print_r($argv); I understand what these variables represent (arguments passed from the command line), but I've never seen this syntax before:global $argv, $argc; What specifically is going on here?

    Read the article

  • Understand link redirect

    - by Andrew
    wordpress placed into category 'blog' there are no subcategory 'contact' into category 'blog', neither .htaccess with redirect directives. How I can find what script does executed? and I VERY want understand how server find it. http://domain.com/freeaccess/blog/contact Thank you!

    Read the article

  • Rails: RESTful Find, Initialize, or Create

    - by Andrew
    I have an app that has Cities in it. I'm looking for some suggestions on how to RESTfully structure a controller so that I can lookup, initialize, and create city records via AJAX requests. For instance: Given a text field city_name A user enters the name of a City, like "Paris, France" The app checks this location to see if there is such a city in the database already If there is, it returns the city object If there is not, it returns a new record initialized with the name "Paris" and the country "France", and prompts the user to confirm they want to add this city to the database If the user says "Yes" the record is saved. If not the record is discarded and the form is cleared. Now, my first approach was to change the Create action to use find_or_create, so that an AJAX post to cities_path would result in either returning the existing city or creating it and returning it. That works ok... However, it would be better to setup controller actions that would take a string input, find , or else initialize and return, then only create if the user confirms the generated record is correct. The ideal scenario would put this all in one action so AJAX request can go to that url, the server responds with JSON objects, and javascript can handle things from there. I'd like to keep all the user-interaction logic client side, and also minimize the number of requests it takes to achieve this. Any suggestions on the cleanest, most RESTful way to accomplish this?

    Read the article

  • Centered DIV w/ width dependant on text, buffered by two divs that should fill the containing DIV

    - by Andrew Thompson
    I have been wracking my brains on this seemingly small issue the whole day. My web dev friends are baffled and I could not find a suitable answer in my search of this site and others (though, I could have missed it somewhere along the way). Here's the problem: 3 DIVS within one fixed-width container DIV The center DIV has text that will be different on other sites The center DIV needs to be centered, and no larger than the text it contains. This is what I'd like to end up with The basic HTMl: <div id="container" > <div id="left" ></div> <div id="center" >Text inside center should resize this block</div> <div id="right" ></div> </div> Below, I removed most of the styles I have tried. This CSS currently centers the DIV (if I set it as an inline block), but I need the other divs to fill the left and right space remaining: #container { width:750px; text-align:center; } #left { background-color:#E85355; } #center { background-color:#CDD7D7; display:inline-block; } #right { background-color:#65A8A6; } I've tried floating, no-wrap, overflow, etc. Thanks a million to whomever can offer some help! JSFiddle Link

    Read the article

  • Refactoring. Your way to reduce code complexity of big class with big methods

    - by Andrew Florko
    I have a legacy class that is rahter complex to maintain: class OldClass { method1(arg1, arg2) { ... 200 lines of code ... } method2(arg1) { ... 200 lines of code ... } ... method20(arg1, arg2, arg3) { ... 200 lines of code ... } } methods are huge, unstructured and repetitive (developer loved copy/paste aprroach). I want to split each method into 3-5 small functions, whith one pulic method and several helpers. What will you suggest? Several ideas come to my mind: Add several private helper methods to each method and join them in #region (straight-forward refactoring) Use Command pattern (one command class per OldClass method in a separate file). Create helper static class per method with one public method & several private helper methods. OldClass methods delegate implementation to appropriate static class (very similiar to commands). ? Thank you in advance!

    Read the article

  • MySQL Returns wrong values on SELECT statement

    - by Andrew K
    All, I'm wondering if this is a MySQL bug, but since I've seen others playing with larger numbers than this, I'm thinking I'm doing something wrong here. Here is my table structure for the table I'm querying: mysql describe ipspace6\G ************* 1. row ************* Field: id Type: decimal(39,0) unsigned Null: NO Key: Default: NULL Extra: ************* 2. row ************* Field: addr Type: decimal(39,0) unsigned Null: NO Key: PRI Default: 0 Extra: ************* 3. row ************* Field: netmask Type: decimal(39,0) unsigned Null: NO Key: Default: 0 Extra: ************* 4. row ************* Field: subnet Type: int(4) Null: NO Key: Default: NULL Extra: Now, I run a simple SELECT statement against the "id" column: mysql SELECT id FROM ipspace6 WHERE id='50552019118453823914642686339427860480'; +----------------------------------------+ | id | +----------------------------------------+ | 50552019118453823730175245602332344320 | | 50552019118453823730175245602332344320 | | 50552019118453823914642686339427860480 | | 50552019118453823914642686339427860480 | +----------------------------------------+ ...What the heck is going on here? Two of these results are valid, and two definitely are not. It's not like I'm doing some super-complex nested query or anything, this is simple stuff, and it's driving me insane. Help, anyone?

    Read the article

  • MySQL: Records inserted by hour, for the last 24 hours

    - by Andrew M
    I'm trying to list the number of records per hour inserted into a database for the last 24 hours. Each row displays the records inserted that hour, as well as how many hours ago it was. Here's my query now: SELECT COUNT(*), FLOOR( TIME_TO_SEC( TIMEDIFF( NOW(), time)) / 3600 ) FROM `records` WHERE time > DATE_SUB(NOW(), INTERVAL 24 HOUR) GROUP BY HOUR(time) ORDER BY time ASC right now it returns: 28 23 62 23 14 20 1 4 28 3 19 1 That shows two rows from 23 hours ago, when it should only show one per hour. I think it has something to do with using NOW() instead of getting the time at the start of the hour, which I'm unsure on how to get. There must be a simpler way of doing this.

    Read the article

  • Chat Server with sockets in C

    - by Andrew
    I'm trying to write a chat server in C that allows communication between two clients using POSIX sockets. I'm not sure I have a good grasp on this concept or how I should set up the communication protocol between the clients and the server. I know I need one socket to bind() the server port to so I can accept incoming connections from clients, but in order to have two clients connected at the same time do I need to create a socket for each of these clients when I accept() or should I accept() a client and then fork() so I can have another client accept? I'm not worried about concurrent chatting yet, it's more of a ping-pong approach where the clients need to wait for a recv() after they send() before they can type a new message.

    Read the article

  • Parallel doseq for Clojure

    - by andrew cooke
    I haven't used multithreading in Clojure at all so am unsure where to start. I have a doseq whose body can run in parallel. What I'd like is for there always to be 3 threads running (leaving 1 core free) that evaluate the body in parallel until the range is exhausted. There's no shared state, nothing complicated - the equivalent of Python's multiprocessing would be just fine. So something like: (dopar 3 [i (range 100)] ; repeated 100 times in 3 parallel threads... ...) Where should I start looking? Is there a command for this? A standard package? A good reference? So far I have found pmap, and could use that (how do I restrict to 3 at a time? looks like it uses 32 at a time - no, source says 2 + number of processors), but it seems like this is a basic primitive that should already exist somewhere. clarification: I really would like to control the number of threads. I have processes that are long-running and use a fair amount of memory, so creating a large number and hoping things work out OK isn't a good approach (example which uses a significant chunk available mem). update: Starting to write a macro that does this, and I need a semaphore (or a mutex, or an atom i can wait on). Do semaphores exist in Clojure? Or should I use a ThreadPoolExecutor? It seems odd to have to pull so much in from Java - I thought parallel programming in Clojure was supposed to be easy... Maybe I am thinking about this completely the wrong way? Hmmm. Agents?

    Read the article

  • How to extend an existing Ruby on Rails CMS to host multiple sites?

    - by Andrew
    I am trying to build a CMS I can use to host multiple sites. I know I'm going to end up reinventing the wheel a million times with this project, so I'm thinking about extending an existing open source Ruby on Rails CMS to meet my needs. One of those needs is to be able to run multiple sites, while using only one code-base. That way, when there's an update I want to make, I can update it in one place, and the change is reflected on all of the sites. I think that this will be able to scale by running multiple instances of the application. I think that I can use the domain/subdomain to determine which data to display. For example, someone goes to subdomain1.mysite.com and the application looks in the database for the content for subdomain1. The problem I see is with most pre-built CMS solutions, they are only designed to host one site, including the one I want to use. So the database is structured to work with one site. However, I had the idea that I could overcome this by "creating a new database" for each site, then specifying which database to connect to based on the domain/subdomain as I mentioned above. I'm thinking of hosting this on Heroku, so I'm wondering what my options for this might be. I'm not very familiar with Amazon S3, or Amazon SimpleDB, but I feel like there's some sort of "cloud database" that would make this solution a lot more realistic, than creating a new MySQL database for each site. What do you think? Am I thinking about this the wrong way? What advice do you have to offer in this area?

    Read the article

  • Sending VB data to another page in Javascript.

    - by Andrew
    I'm creating a search form using an asp:button control with the urlpostback set to a results page. The problem is, the asp:button uses Visual Basic and the search results from Google require Javascript. Is there a way to take the data from an asp: textbox in VB and then send it to another page that uses Javascript and use the data?

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >