Search Results

Search found 284 results on 12 pages for 'sergio leunissen'.

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

  • How can I place zeroes to the left of a given number to a maximum of 6 digits including the given nu

    - by Sergio Tapia
    I have this method that receives an ID number and downloads an HTML website according to that ID. Typically, an IMDB link is like this: http://www.imdb.com/title/tt0892791/ http://www.imdb.com/title/tt1226229/ http://www.imdb.com/title/tt0000429/ They all follow the 'tt' then 7 digits, with lack of digits turning into zeroes to fill out the left spaces. How can I accomplish this using C#? I'm kind of stumped. Here's my method: /// <summary> /// Find a movie page using its precise IMDB id. /// </summary> /// <param name="id">IMDB Movie ID</param> /// <returns>Returns an HtmlDocument with the source code included.</returns> public HtmlDocument ByID(string id) { string url = String.Format("http://www.imdb.com/title/tt{0}/", id); HtmlDocument page = downloader.Load(url); return page; } Thank you very much for your time, and if you are interested in helping out, you can check out the complete source code of TheFreeIMDB here: http://thefreeimdb.codeplex.com/

    Read the article

  • How can I create two contructors that act differently but recieve the same data type?

    - by Sergio Tapia
    public class Parser { Downloader download = new Downloader(); HtmlDocument Page; public Parser(string MovieTitle) { Page = download.FindMovie(MovieTitle); } public Parser(string ActorName) { Page = download.FindActor(ActorName); } } I want to create a constructor that will allow other developers who use this library to easily create a Parser object with the relevant HtmlDocument already loaded as soon as it's done creating it. The problem lies in that a constructor cannot exist twice with the same type of parameters. Sure I can tell the logical difference between the two paramters, but the computer can't. Any suggestions on how to handle this? Thank you!

    Read the article

  • How to prevent traffic to/from a slow Cassandra node using Python

    - by Sergio Ayestarán
    Intro: I have a Python application using a Cassandra 1.2.4 cluster with a replication factor of 3, all reads and writes are done with a consistency level of 2. To access the cluster I use the CQL library. The Cassandra cluster is running on rackspace's virtual servers. The problem: From time to time one of the nodes can become slower than usual, in this case I want to be able to detect this situation and prevent making requests to the slow node and if possible to stop using it at all (this should theoretically be possible since the RF is 3 and the CL is 2 for every single request). The questions: What's the best way of detecting the slow node from a Python application? Is there a way to stop using one of the Cassandra nodes from Python in this scenario without human intervention? Thanks in advance!

    Read the article

  • Index out of bounds exception while iterating through a List<string>.

    - by Sergio Tapia
    I have a List of the location of images on a folder. I have five pictureBoxes that emulate a coverflow type area for users to skim through the images of a given folder. I know that the error is fired because the first image in the collection is set to the first picturebox, then if I click on cycleLeft(), there is a negative number. How can I account for this? For example, if the first image in the List is already set to the farthest left and someone clicks flip left, have that first image put on the last position of the list. Any guidance? private void leftArrow_Click(object sender, EventArgs e) { cycleImagesLeft(); } private void rightArrow_Click(object sender, EventArgs e) { cycleImagesRight(); } public void cycleImagesLeft() { //imageThree is the center image, that's why I use it as a frame of reference. int currentImage = pictures.IndexOf(imageThree.ImageLocation); imageOne.ImageLocation = pictures[currentImage - 3]; imageTwo.ImageLocation = pictures[currentImage - 2]; imageThree.ImageLocation = pictures[currentImage - 1]; imageFour.ImageLocation = pictures[currentImage]; imageFive.ImageLocation = pictures[currentImage + 1]; } public void cycleImagesRight() { int currentImage = pictures.IndexOf(imageThree.ImageLocation); imageOne.ImageLocation = pictures[currentImage - 1]; imageTwo.ImageLocation = pictures[currentImage]; imageThree.ImageLocation = pictures[currentImage + 1]; imageFour.ImageLocation = pictures[currentImage + 2]; imageFive.ImageLocation = pictures[currentImage + 3]; }

    Read the article

  • How can I setup my Netbeans IDE for making Jave ME applications?

    - by Sergio Tapia
    Ok, I have Netbeans 6.7.1 installed with the default Java SDK. I'm using Linux Mint. Now I'm told that I have to download Java Platform Micro Edition Software Development Kit 3.0 So, should I download this? And once I download and install this in Linux, what do I have to install for Netbeans so I can create a Mobile Application? I'm fairly new to this environment so please any advice is welcome! :)

    Read the article

  • Form is trying to save the login value of the submit button to my DB.

    - by Sergio Tapia
    Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function init(){ /*********************USERNAME**********************/ $username = new Zend_Form_Element_Text('username'); $alnumValidator = new Zend_Validate_Alnum(); $username ->setRequired(true) ->setLabel('Username:') ->addFilter('StringToLower') ->addValidator('alnum') ->addValidator('regex', false, array('/^[a-z]+/')) ->addValidator('stringLength',false,array(6,20)); $this->addElement($username); /*********************EMAIL**********************/ $email = new Zend_Form_Element_Text('email'); $alnumValidator = new Zend_Validate_Alnum(); $email ->setRequired(true) ->setLabel('EMail:') ->addFilter('StringToLower') ->addValidator('alnum') ->addValidator('regex', false, array('/^[a-z]+/')) ->addValidator('stringLength',false,array(6,20)); $this->addElement($email); /*********************PASSWORD**********************/ $password = new Zend_Form_Element_Password('password'); $alnumValidator = new Zend_Validate_Alnum(); $password ->setRequired(true) ->setLabel('Password:') ->addFilter('StringToLower') ->addValidator('alnum') ->addValidator('regex', false, array('/^[a-z]+/')) ->addValidator('stringLength',false,array(6,20)); $this->addElement($password); /*********************NAME**********************/ $name = new Zend_Form_Element_Text('name'); $alnumValidator = new Zend_Validate_Alnum(); $name ->setRequired(true) ->setLabel('Name:') ->addFilter('StringToLower') ->addValidator('alnum') ->addValidator('regex', false, array('/^[a-z]+/')) ->addValidator('stringLength',false,array(6,20)); $this->addElement($name); /*********************LASTNAME**********************/ $lastname = new Zend_Form_Element_Text('lastname'); $alnumValidator = new Zend_Validate_Alnum(); $lastname ->setRequired(true) ->setLabel('Last Name:') ->addFilter('StringToLower') ->addValidator('alnum') ->addValidator('regex', false, array('/^[a-z]+/')) ->addValidator('stringLength',false,array(6,20)); $this->addElement($lastname); /*********************DATEOFBIRTH**********************/ $dateofbirth = new Zend_Form_Element_Text('dateofbirth'); $alnumValidator = new Zend_Validate_Alnum(); $dateofbirth->setRequired(true) ->setLabel('Date of Birth:') ->addFilter('StringToLower') ->addValidator('alnum') ->addValidator('regex', false, array('/^[a-z]+/')) ->addValidator('stringLength',false,array(6,20)); $this->addElement($dateofbirth); /*********************AVATAR**********************/ $avatar = new Zend_Form_Element_File('avatar'); $alnumValidator = new Zend_Validate_Alnum(); $avatar ->setRequired(true) ->setLabel('Please select a display picture:'); $this->addElement($avatar); /*********************SUBMIT**********************/ $this->addElement('submit', 'login', array('label' => 'Login')); } } ?> Here's the code I use to save the values: public function saveforminformationAction(){ $form = new Sergio_Form_registrationform(); $request = $this->getRequest(); //if($request->isPost() && $form->isValid($_POST)){ $data = $form->getValues(); $db = $this->_getParam('db'); $db->insert('user',$data); //} } When trying to save the values, I recieve a ghastly error: Column 'login' not found.

    Read the article

  • Jquery mouseover change background color problem

    - by Sergio
    Jquery code: $(".menu_clickable").mouseover(function() { $(this).css({'background-color' : '#F00'}).mouseout(function(){ $(this).css({'background-color' : '#FFF'}); }); }); $(".menu_clickable").live('click', function() { $(this).css({'background-color' : '#FCC'}); }); HTML source: <div class="menu_clickable prof_info2" id="prof_info" >first</div> <div class="menu_clickable prof_info3" id="prof_info" >second</div> <div class="menu_clickable prof_info3" id="prof_info" >third</div> I'm trying to make the hover efect using Jquery and it is working fine but if I want to change the DIV background color when it's clicked it's not working, actually the clicked DIV change background color but it is stay like that while the cursor is on it. If I move it out it will restore the original background color. Why?

    Read the article

  • Can you help me optimize this code for finding factors of a number? I'm brushing up on my math progr

    - by Sergio Tapia
    I've never really bothered with math programming, but today I've decided to give it a shot. Here's my code and it's working as intended: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace PrimeFactorization { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void btnSubmit_Click(object sender, RoutedEventArgs e) { List<int> primeFactors = FindPrimeFactors(Convert.ToInt32(txtNumber.Text)); primeFactors.Sort(); for (int i = 0; i < primeFactors.Count; i++) { listBoxFoundNumbers.Items.Add(primeFactors[i]); } } private List<int> FindPrimeFactors(int number) { List<int> factors = new List<int>(); factors.Add(1); factors.Add(number); for (int i = 2; i < number; i++) { if (number % i == 0) { int holder = number / i; //If the number is in the list, don't add it again. if (!factors.Contains(i)) { factors.Add(i); } //If the number is in the list, don't add it again. if (!factors.Contains(holder)) { factors.Add(holder); } } } return factors; } } } The only problem I can see with my code is that it will iterate through to the bitter end, even though there will definitely not be any factors. For example, imagine I wrote in 35. My loop will go up to 35 and check 24,25,26,27...etc. Not very good. What do you recommend?

    Read the article

  • What are some fun project ideas for a new Python developer?

    - by Sergio Tapia
    I'm new to Python 3 and so far it seems like a decent language. I really like the string manipulation methods you can use and they are pretty radical. :) I'm stuck however in thinking of a project to do with Python. Is there a site similar to Coding4Fun but for Python? Community Wiki because I think this question is really interesting. :D

    Read the article

  • Am I using Settings in .NET correctly?

    - by Sergio Tapia
    Here's what I'm doing. I have three properties: MomsBackground, DadsBackground and ChosenBackground. When Momsbackground is selected in the program, I set the ChosenBackground string according to what item the user has clicked (either "Mom" or "Dad"). Then on Form_Load() I use a switch case for the ChosenBackground string and according to that select This.BackgroundColor to MomsBackground or DadsBackground. Code below: Am I using this as it was intended? Sorry, codes there now. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void momToolStripMenuItem_Click(object sender, EventArgs e) { this.BackColor = Properties.Settings.Default.MomFormColor; Properties.Settings.Default.SelectedTheme = "Mom"; Properties.Settings.Default.Save(); } private void dadToolStripMenuItem_Click(object sender, EventArgs e) { this.BackColor = Properties.Settings.Default.DadFormColor; Properties.Settings.Default.SelectedTheme = "Dad"; Properties.Settings.Default.Save(); } private void Form1_Load(object sender, EventArgs e) { switch (Properties.Settings.Default.SelectedTheme) { case "Mom": this.BackColor = Properties.Settings.Default.MomFormColor; break; case "Dad": this.BackColor = Properties.Settings.Default.DadFormColor; break; default: break; } } } }

    Read the article

  • Problem running a Python program, error: Name 's' is not defined.

    - by Sergio Tapia
    Here's my code: #This is a game to guess a random number. import random guessTaken = 0 print("Hello! What's your name kid") myName = input() number = random.randint(1,20) print("Well, " + myName + ", I'm thinking of a number between 1 and 20.") while guessTaken < 6: print("Take a guess.") guess = input() guess = int(guess) guessTaken = guessTaken + 1 if guess < number: print("You guessed a little bit too low.") if guess > number: print("You guessed a little too high.") if guess == number: break if guess == number: guessTaken = str(guessTaken) print("Well done " + myName + "! You guessed the number in " + guessTaken + " guesses!") if guess != number: number = str(number) print("No dice kid. I was thinking of this number: " + number) This is the error I get: Name error: Name 's' is not defined. I think the problem may be that I have Python 3 installed, but the program is being interpreted by Python 2.6. I'm using Linux Mint if that can help you guys help me. Using Geany as the IDE and pressing F5 to test it. It may be loading 2.6 by default, but I don't really know. :( Edit: Error 1 is: File "GuessingGame.py", line 8, in <Module> myName = input() Error 2 is: File <string>, line 1, in <Module>

    Read the article

  • mysql union query

    - by Sergio
    The table that contains information about members has a structure like: id | fname | pic | status -------------------------------------------------- 1 | john | a.jpg | 1 2 | mike | b.jpg | 1 3 | any | c.jpg | 1 4 | jacky | d.jpg | 1 Table for list of friends looks like: myid | date | user ------------------------------- 1 | 01-01-2011 | 4 2 | 04-01-2011 | 3 I want to make a query that will as result print users from "friendlist" table that contains photos and names of that users from "members" table of both, myid (those who adding) and user (those who are added). That table in this example will look like: myid | myidname | myidpic | user | username | userpic | status ----------------------------------------------------------------------------------- 1 | john | a.jpg | 4 | jacky | d.jpg | 1 2 | mike | b.jpg | 3 | any | c.jpg | 1

    Read the article

  • Ruby Thread with "watchdog"

    - by Sergio Campamá
    I'm implementing a ruby server for handling sockets being created from GPRS modules. The thing is that when the module powers down, there's no indication that the socket closed. I'm doing threads to handle multiple sockets with the same server. What I'm asking is this: Is there a way to use a timer inside a thread, reset it after every socket input, and that if it hits the timeout, closes the thread? Where can I find more information about this? EDIT: Code example that doesn't detect the socket closing require 'socket' server = TCPServer.open(41000) loop do Thread.start(server.accept) do |client| puts "Client connected" begin loop do line = client.readline open('log.txt', 'a') { |f| f.puts line.strip } end rescue puts "Client disconnected" end end end

    Read the article

  • Zend Framework: Zend_DB Error

    - by Sergio E.
    I'm trying to learn ZF, but got strange error after 20 minutes :) Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'Configuration array must have a key for 'dbname' that names the database instance' What does this error mean? I got DB information in my config file: resources.db.adapter=pdo_mysql resources.db.host=localhost resources.db.username=name resources.db.password=pass resources.db.dbname=name Any suggestions? EDIT: This is my model file /app/models/DbTable/Bands.php: class Model_DbTable_Bands extends Zend_Db_Table_Abstract { protected $_name = 'zend_bands'; } Index controller action: public function indexAction() { $albums = new Model_DbTable_Bands(); $this->view->albums = $albums->fetchAll(); } EDIT All codes: bootstrap.php protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => '', 'basePath' => dirname(__FILE__), )); return $autoloader; } protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } public static function setupDatabase() { $config = self::$registry->configuration; $db = Zend_Db::factory($config->db); $db->query("SET NAMES 'utf8'"); self::$registry->database = $db; Zend_Db_Table::setDefaultAdapter($db); Zend_Db_Table_Abstract::setDefaultAdapter($db); } IndexController.php class IndexController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $albums = new Model_DbTable_Bands(); $this->view->albums = $albums->fetchAll(); } } configs/application.ini, changed database and provided password: [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 db.adapter = PDO_MYSQL db.params.host = localhost db.params.username = root db.params.password = pedro db.params.dbname = test models/DbTable/Bands.php class Model_DbTable_Bands extends Zend_Db_Table_Abstract { protected $_name = 'cakephp_bands'; public function getAlbum($id) { $id = (int)$id; $row = $this->fetchRow('id = ' . $id); if (!$row) { throw new Exception("Count not find row $id"); } return $row->toArray(); } }

    Read the article

  • Jquery stop load function after too many clicks

    - by Sergio
    How can I stop loading function after user is clicked too many times on link? Jquery code looks like: $(document).ready(function(){ $(".menu_rfr").click(function() { $("#main").html('<img src="img/spin.gif" class="spin">'); location.replace($(this).attr('rel')); }); $(".menu_clickable").click(function() { $("#main").html('<img src="img/spin.gif" class="spin">'); $("#main").load($(this).attr('rel')); }); });

    Read the article

  • Date javascript object from IE cannot be automatically bound to Datetime in ASP.NET MVC

    - by Sergio
    Hi There, I have a site that uses a jquery calendar to display events. I have noticed than when using the system from within IE (all versions) ASP.NET MVC will fail to bind the datetime to the action that send back the correct events. The sequence of events goes as follows. Calendar posts to server to get events Server ActionMethod accepts start and end date, automatically bound to datetime objects In every browser other than IE the start and end date come through as: Mon, 10 Jan 2011 00:00:00 GMT When IE posts the date, it comes through as Mon, 10 Jan 2011 00:00:00 UTC ASP.NET MVC 2 will then fail to automatically bind this to the action method parameter. Is there a reason why this is happening? The code that posts to the server is as follows: data: function (start, end, callback) { $.post('/tracker/GetTrackerEvents', { start: start.toUTCString(), end: end.toUTCString() }, function (result) { callback(result); }); },

    Read the article

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