Search Results

Search found 288 results on 12 pages for 'sergio tapia'.

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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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 post and get data from PHP

    - by Sergio
    Jquery code looks like: $('#gal').rating('gl.php?gal_no=<?=$gal_no;?>&id=<?=$id;?>', {maxvalue:10,increment:.5, curvalue: <?=$cur;?>}); PHP code: $br=mysql_query("SELECT count(gal) as total FROM ...") if ... { echo '0'; } else echo '1'; } Jquery code successfully transmitted data to PHP script and when the PHP done with checking data echo the result ('1' or '0'). How can I get this PHP result back to Jquery and based on them write a message? Some thing like: if(data=="1") { $("#error").show("fast").html('not correct').css({'background-color' : '#F5F5F5','border-color' : '#F69'}); }else{ $("#error").show("fast").html('correct').css({'background-color' : '#FFF','border-color' : '#3b5998'}); }

    Read the article

  • How to stop Jquery load function

    - by Sergio
    The Jquery load function don't stop if there is multiple click on the links in the menu. The jquery code looks like: $(document).ready(function(){ $(".menu_rfr").unbind("click").click(function() { $("#main").html('<img src="img/spin.gif" class="spin">'); location.replace($(this).attr('rel')); }); function handleClick() { $(this).unbind("click"); $("#main").html('<img src="img/spin.gif" class="spin">'); $("#main").load($(this).attr('rel'), function() { // reactivate it after some loading has completed $(this).click(handleClick); }); } $(".menu_clickable").click(handleClick); }); You can see the sample page at link text How can I prevent users clicks if the DIV content is not loaded completely and never ending DIV loading?

    Read the article

  • How to select the first element of a set with JSTL?

    - by Sergio del Amo
    I managed to do it with the next code but there must be an easier way. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:if test="${fn:length(attachments) > 0}"> <c:forEach var="attachment" items="${attachments}" varStatus="loopCount"> <c:if test="${loopCount.count eq 1}"> attachment.id </c:if> </c:forEach> </c:if>

    Read the article

  • Jquery and PHP rating function problem

    - by Sergio
    I know that I was already posted similar question but I just can't find the answer and figure it out how to solve this problem. I'm trying to customize Jquery Star Rating plugin (link text) but I do not know what to do to show the message based on response of PHP script. Jquery script successfully send rating data to PHP scripts that query the database and based on that echo message of proper or improper rating. What should I add to an existing JS code so I can get echo from PHP and base on that write a message on some DIV beside rating star? Jquery: $('#gal').rating('gl.php?gal_no=<?=$gal_no;?>&id=<?=$id;?>', {maxvalue:10,increment:.5, curvalue: <?=$cur;?>}); Simplified PHP code: $br=mysql_query("SELECT count(gal) as total FROM ...") if ... { echo '0'; } else echo '1'; } Jquery code successfully transmitted data to PHP script and when the PHP done with checking data echo the result ('1' or '0'). How can I get this PHP result back to Jquery and based on them write a message? Something like: if(data=="1") { $("#error").show("fast").html('not correct').css({'background-color':'#F5F5F5','border-color' : '#F69'}); }else{ $("#error").show("fast").html('correct').css({'background-color' : '#FFF','border-color' : '#3b5998'}); } If someone has an idea...I would appreciate it.

    Read the article

  • Remove trailing slash from comment form

    - by Sergio Vargott
    and i really need a code to remove the ending slash when a user put their link. for example i need them to put their url to grab their avatar, but in some cases they put their url ending with a slash (.com/) how can i remove that slash automatically? because when they put their url like that the avatar doesn't show i need them to end like this (.com) in order to show their avatar. I was looking for a remove trailing slash php code, but any solution will be appreciated. i tried to use this code but didn't work $string = rtrim($string, '/');

    Read the article

  • Trying to put a generic MyObj<T, U> into an IList where U can be different between objects

    - by Sergio Romero
    I have the following class definition: public interface IItem{} public class FirstObject<T, U> : IItem { public U SomeProperty { get; private set; } } IList<IItem> myList = new List<IItem>(); I did it like this because U can be of different types. Now I want to iterate the list and get my items back, the problem is that I do not know how to cast them back to their original type so I can read the value of SomeProperty. Thanks for your help.

    Read the article

  • SQL join to grab data from same table via intermediate table

    - by Sergio
    Hi Could someone help me with building the following query. I have a table called Sites, and one called Site_H. The two are joined by a foreign key relationship on page_id. So the Sites table contains pages, and the Site_H table shows which pages any given page is a child of by having another foreign key relation back to the site table with a column called ParentOf. So, a page can be have another page as a parent. Other data is stored in the Site_H table such as position etc, hence why it is separated out. I would like a query that returns the details of a page along with the details of its parent page. I just cant quite think about how to structure the SQL. Thanks

    Read the article

  • Java Script in Rails 3.1 works only in certain parts. Any idea why?

    - by Sergio Nekora
    This might seem a bit weird, but since I am new in RoR and cannot find any similar questions I thought you might know. The situation is that JavaScript does not work throughout my whole site. For instance. For the sake of checking, I place a link with an alert function in the footer. It did not work at the beginning, it felt like the JS was disabled(but it wasn't). But eventually it worked. Now it works in most the pages but it does not work in one that there is also an 'autocomplete' field. Of course, this autocomplete field does not work either. That could lead you to think that there is something wrong with the autocomplete code. However this same code is working in the sidebar. Any ideas why? Could it have anything to do with the fact that one day my assets folder appeared empty? After installing the gmaps4rails gem I realized that all my Js and CSS files were gone from my assests folder. Ok, it might have happened long before and I just realized at that point. I don't really know. Here in the root you can see that the 'Hola sip' click at the button works. here it works However, here same link does not trigger the alert function. here it doesn't

    Read the article

  • Jquery load DIV inside another DIV at same page

    - by Sergio
    HTML: <div class="someclass" rel="first">text 1</div> <div class="someclass" rel="second">text 2</div></div></div> <div class="info_ly">here is some text</div> <div class="first" > the first DIV </div> <div class="second" > the second DIV </div> CSS: .first{ display:none} .second{ display:none} Jquery: $(".someclass").click(function() { $(".info_ly").html($(this).attr('rel')); }); I want to call and load the "rel" DIV inside "info_ly" DIV. With this Jquery code I get only text "first" or "second" inside "info_ly" DIV. How can I load the DIV with the class "first" or DIV with the class "second" inside "info_ly" DIV?

    Read the article

  • Nested joins hide table names

    - by Sergio
    Hi: I have three tables: Suppliers, Parts and Types. I need to join all of them while discriminating columns with the same name (say, "id") in the three tables. I would like to successfully run this query: CREATE VIEW Everything AS SELECT Suppliers.name as supplier, Parts.id, Parts.description, Types.typedesc as type FROM Suppliers JOIN (Parts JOIN Types ON Parts.type_id = Types.id) ON Suppliers.id = Parts.supplier_id; My DBMS (sqlite) complains that "there is not such a column (Parts.id)". I guess it forgets table names once the JOIN is done but then how can I refer to the column id that belongs to the table Parts?

    Read the article

  • Mysql count columns

    - by Sergio
    I have a table for image gallery with four columns like: foid | uid | pic1 | pic2 | pic3 | date | ----------------------------------------------- 104 | 5 | 1.jpg | 2.jpg | 3.jpg | 2010-01-01 105 | 14 | 8.jpg | | | 2009-04-08 106 | 48 | x.jpg | y.jpg | | 2010-08-09 Mysql query for the user's galleries looks like: SELECT * FROM foto WHERE uid = $id order by foid DESC The thing that I want to do is count the number of images (PIC1, PIC2, PIC3) in every of the listed galleries. What is the best way for doing that?

    Read the article

  • Scale an image which is stored as a byte[] in Java

    - by Sergio del Amo
    I upload a file with a struts form. I have the image as a byte[] and I would like to scale it. FormFile file = (FormFile) dynaform.get("file"); byte[] fileData = file.getFileData(); fileData = scale(fileData,200,200); public byte[] scale(byte[] fileData, int width, int height) { // TODO } Anyone knows an easy function to do this? public byte[] scale(byte[] fileData, int width, int height) { ByteArrayInputStream in = new ByteArrayInputStream(fileData); try { BufferedImage img = ImageIO.read(in); if(height == 0) { height = (width * img.getHeight())/ img.getWidth(); } if(width == 0) { width = (height * img.getWidth())/ img.getHeight(); } Image scaledImage = img.getScaledInstance(width, height, Image.SCALE_SMOOTH); BufferedImage imageBuff = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); imageBuff.getGraphics().drawImage(scaledImage, 0, 0, new Color(0,0,0), null); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ImageIO.write(imageBuff, "jpg", buffer); return buffer.toByteArray(); } catch (IOException e) { throw new ApplicationException("IOException in scale"); } } If you run out of Java Heap Space in tomcat as I did, increase the heap space which is used by tomcat. In case you use the tomcat plugin for Eclipse, next should apply: In Eclipse, choose Window Preferences Tomcat JVM Settings Add the following to the JVM Parameters section -Xms256m -Xmx512m

    Read the article

  • Binding Listbox Items

    - by Sergio
    Hi, I have a user with it's roles, it's an entitycollection. I have a ListBox that has all possible roles, and I have them like checkboxes, but I want to bind the IsChecked property of each one to check if the user has the role. Something like IsChecked={Binding Roles.Contains}

    Read the article

  • How to apply images conditionally using entries and categories?

    - by Sergio Acosta
    Using version 2.5.3 of ExpressionEngine, I have a list of products displayed by category, but I need the premium products among this list being featured with a small star image. How do you call conditionally this little stars besides the {title}? At the moment this code shows stars for all products and that is not ideal. <ol class="voices-list"> {exp:channel:entries channel="product" orderby="title" sort="asc" category="2&6" dynamic="no"} <li><a href="{page_url}">{title}<img class="feature_icon medium" src="{root_url}img/audio/smallstar.png" alt="star"></a></li> {/exp:channel:entries} </ol> I need your help, please.

    Read the article

  • Problem with CSS DIV align

    - by Sergio
    If the doctype declaration is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN"> what is the best way for horizontal alignment of the DIV's like these: <div id="outer"><div id="inner">Some text</div></div> The CSS is: #outer{ border-top:1px dotted #999; background-color: #F4F4F4; width:100%;} #inner{ width:500px;border:1px solid #F00; margin:auto;} The thing that I want to do is the inner DIV align at center (horizontally) inside the outer DIV. This CSS working fine if the doctype declaration is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    Read the article

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