Search Results

Search found 13 results on 1 pages for 'gerardo marset'.

Page 1/1 | 1 

  • Actor and Sprite, who should own these properties?

    - by Gerardo Marset
    I'm writing sort of a 2D game engine for making the process of creating games easier. It has two classes, Actor and Sprite. Actor is used for interactive elements (the player, enemies, bullets, a menu, an invisible instance that controls score, etc) and Sprite is used for animated (or not) images with transparency (or not). The actor may have an assigned sprite that represents it on the screen, which may change during the game. E.g. in a top-down action game you may have an actor with a sprite of a little guy that changes when attacking, walking, and facing different directions, etc. Currently the actor has x and y properties (its coordinates in the screen), while the sprite has an index property (the number of the frame currently being shown by the sprite). Since the sprite doesn't know which actor it belongs to (or if it belongs to an actor at all), the actor must pass its x and y coordinates when drawing the sprite. Also, since a actors may reset its sprite each frame (and usually do), the sprite's index property must be passed from the old to the new sprite like so (pseudocode): function change_sprite(new_sprite) old_index = my.sprite.index my.sprite = new_sprite() my.sprite.index = old_index % my.sprite.frames end I always thought this was kind of cumbersome, but it never was a big problem. Now I decided to add support for more properties. Namely a property to draw the sprite rotated, a property to draw it flipped, it a property draw it stretched, etc. These should probably belong to the sprite and not the actor, but if they do, the actor would have to pass them from the old to the new sprite each time it changes... On the other hand, if they belonged to the actor, the actor would have to pass each property to the sprite when drawing it (since the sprite doesn't know which actor it belongs to, and it shouldn't, since sprites aren't just meant to be used by actors, really). Another option I thought of would be having an extra class that owns all these properties (plus index, x and y) and links an actor with a sprite, but that doesn't come without drawbacks. So, what should I do with all these properties? Thanks!

    Read the article

  • How do I install Ubuntu 12.04 PPC on a PowerPC G4 from commands line or fix the graphical mode?

    - by Gerardo Rodríguez
    Good afternoon. I'm new to this Linux world so I hope someone can help me . I recently got a Mac as a gift, a PowerPC G4 , which has 1GB of RAM but came with no optical drive or hard drive. So I put a dvd burner and a hard drive of 40 GB I got. Then download an iso of Ubuntu 12.04 for PowerPC and burned onto a CD. I'm trying to install from Open Firmware ( as I haven't a Mac keyboard, I use one standard ) . Finally, the Installation CD boots , but on live mode and after the Ubuntu 12.04 screen I get a message that there is a problem with my graphics adapter but I can continue with minimal graphics and give me the command line . My question is that how do I install through a text or if there is any way to fix this problem to run the graphical mode and so can continue the installation of Ubuntu, and if once installed Ubuntu the problem will be fixed or what? I would appreciate if you help me , as I mentioned before, there is almost nothing of Ubuntu but I think it will be easier than trying to get the Mac OS X proper . Spend good.

    Read the article

  • Integrate Cognos Mobile for iPad to other iOS apps [closed]

    - by Gerardo Contijoch
    I'm developing an iPad application that will have integration with IBM Cognos in the near future. As part of that integration I have a very special requirement: It should be possible to open my application from Cognos Mobile app (the native app). Common sense tells me it's not possible to do that, since Cognos Mobile is a closed application, but it wouldn't hut to ask anyway. Is it possible to do that? What about the other way around? iOS uses URL Schemas to open apps from other apps, but as far as I know Cognos Mobile doesn't register any Url Schema to interact with it. Thank you!

    Read the article

  • Retrieve part of a MySQL column with PHP

    - by Gerardo Marset
    For instance, if I have the following table: +----+---+----------+ | id | a | position | +----+---+----------+ | 0 | 0 | 0 | | 1 | 0 | 1 | | 2 | 1 | 4 | | 3 | 1 | 9 | | 4 | 1 | 6 | | 5 | 1 | 1 | +----+---+----------+ and I want to get an array that contains the first 100 values from position where a is 1 in ascending order, what would I do? Im guessing something like this: $col = mysql_fetch_array( mysql_query(' SELECT `position` FROM `table` WHERE `a`="1" ORDER BY `position` ASC LIMIT 100 ')); I'd expect to get the following array: +-------+-------+ | index | value | +-------+-------+ | 0 | 1 | | 1 | 4 | | 2 | 6 | | 3 | 9 | +-------+-------+ but it doesn't work. ¿What should I do to make it work? Thanks

    Read the article

  • Does the concept of "magic number" change from language to language?

    - by Gerardo Marset
    Take the following code in C/C++, for example: int foo[] = {0, 0, 0, 0}; No magic numbers, right? Now, the Python "equivalent" of that would be: foo = [0, 0, 0, 0] Still no magic numbers. However, in Python, that same thing can be written like this: foo = [0] * 4 And now we DO have a magic number. Or do we? I'm guessing this and other similar things are present on these and other languages.

    Read the article

  • Linking Listbox child categories

    - by Gerardo Abdo
    Hello I have few monhts working with aspx, and now I'm developing a shopping cart website. For the employee to upload the products on the DB, every product needs to be linked to a category and sub category, and sub-sub category, and so on. Sometimes the sub-sub categories are up to 5. For example Electronics-TV-LCD-Samsung-40 inches. First, What I would like to identify is if the SQL table has the apporpiate structure. I have 3 columns Id, Description, Parent_Id. Categories with Parent Id=0 is used for the top ones. Is this the best way to do it? Then I want to use the ListBox control to select main Categories, and once it is selected, filled a second listbox with its childs and so on. Do I need to query SQL DB everytime the change event happens? I heard about linq but have not used yet, What would be your suggestion to do this. If you have seen a sample to understand it better will be appreciated. Thank you

    Read the article

  • Mysqli connection trying with different users

    - by gerardo
    I'm trying to create a PHP class extending mysqli that is capable of connecting with another user if the connection fails. It is probably easier to explain with code: public function __construct() { $users = new ArrayObject(self::$user); $passwords = new ArrayObject(self::$pass); $itUser = $users->getIterator(); $itPass = $passwords->getIterator(); parent::__construct(self::$host, $itUser->current(), $itPass->current(), self::$prefix.self::$db); while($this->connect_errno && $itUser->valid()){ $itUser->next(); $itPass->next(); $this->change_user($itUser->current(), $itPass->current(), self::$prefix.self::$db); } if($this->connect_errno) throw new Exception("Error", $this->connect_errno); } $user and $pass are static variables containing arrays of users and passwords. If the first user fails to connect, I try with the next one. The problem here is with $this->connect_errno. It says it cannot find Mysqli. Is there any solution to this or should I create a Factory class?

    Read the article

  • Optimize MySQL query (ngrams, COUNT(), GROUP BY, ORDER BY)

    - by Gerardo
    I have a database with thousands of companies and their locations. I have implemented n-grams to optimize search. I am making one query to retrieve all the companies that match with the search query and another one to get a list with their locations and the number of companies in each location. The query I am trying to optimize is the latter. Maybe the problem is this: Every company ('anunciante') has a field ('estado') to make logical deletes. So, if 'estado' equals 1, the company should be retrieved. When I run the EXPLAIN command, it shows that it goes through almost 40k rows, when the actual result (the reality matching companies) are 80. How can I optimize this? This is my query (XXX represent the n-grams for the search query): SELECT provincias.provincia AS provincia, provincias.id, COUNT(*) AS cantidad FROM anunciantes JOIN anunciante_invertido AS a_i0 ON anunciantes.id = a_i0.id_anunciante JOIN indice_invertido AS indice0 ON a_i0.id_invertido = indice0.id LEFT OUTER JOIN domicilios ON anunciantes.id = domicilios.id_anunciante LEFT OUTER JOIN localidades ON domicilios.id_localidad = localidades.id LEFT OUTER JOIN provincias ON provincias.id = localidades.id_provincia WHERE anunciantes.estado = 1 AND indice0.id IN (SELECT invertido_ngrama.id_palabra FROM invertido_ngrama JOIN ngrama ON ngrama.id = invertido_ngrama.id_ngrama WHERE ngrama.ngrama = 'XXX') AND indice0.id IN (SELECT invertido_ngrama.id_palabra FROM invertido_ngrama JOIN ngrama ON ngrama.id = invertido_ngrama.id_ngrama WHERE ngrama.ngrama = 'XXX') AND indice0.id IN (SELECT invertido_ngrama.id_palabra FROM invertido_ngrama JOIN ngrama ON ngrama.id = invertido_ngrama.id_ngrama WHERE ngrama.ngrama = 'XXX') AND indice0.id IN (SELECT invertido_ngrama.id_palabra FROM invertido_ngrama JOIN ngrama ON ngrama.id = invertido_ngrama.id_ngrama WHERE ngrama.ngrama = 'XXX') AND indice0.id IN (SELECT invertido_ngrama.id_palabra FROM invertido_ngrama JOIN ngrama ON ngrama.id = invertido_ngrama.id_ngrama WHERE ngrama.ngrama = 'XXX') GROUP BY provincias.id ORDER BY cantidad DESC And this is the query explained (hope it can be read in this format): id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY anunciantes ref PRIMARY,estado estado 1 const 36669 Using index; Using temporary; Using filesort 1 PRIMARY domicilios ref id_anunciante id_anunciante 4 db84771_viaempresas.anunciantes.id 1 1 PRIMARY localidades eq_ref PRIMARY PRIMARY 4 db84771_viaempresas.domicilios.id_localidad 1 1 PRIMARY provincias eq_ref PRIMARY PRIMARY 4 db84771_viaempresas.localidades.id_provincia 1 1 PRIMARY a_i0 ref PRIMARY,id_anunciante,id_invertido PRIMARY 4 db84771_viaempresas.anunciantes.id 1 Using where; Using index 1 PRIMARY indice0 eq_ref PRIMARY PRIMARY 4 db84771_viaempresas.a_i0.id_invertido 1 Using index 6 DEPENDENT SUBQUERY ngrama const PRIMARY,ngrama ngrama 5 const 1 Using index 6 DEPENDENT SUBQUERY invertido_ngrama eq_ref PRIMARY,id_palabra,id_ngrama PRIMARY 8 func,const 1 Using index 5 DEPENDENT SUBQUERY ngrama const PRIMARY,ngrama ngrama 5 const 1 Using index 5 DEPENDENT SUBQUERY invertido_ngrama eq_ref PRIMARY,id_palabra,id_ngrama PRIMARY 8 func,const 1 Using index 4 DEPENDENT SUBQUERY ngrama const PRIMARY,ngrama ngrama 5 const 1 Using index 4 DEPENDENT SUBQUERY invertido_ngrama eq_ref PRIMARY,id_palabra,id_ngrama PRIMARY 8 func,const 1 Using index 3 DEPENDENT SUBQUERY ngrama const PRIMARY,ngrama ngrama 5 const 1 Using index 3 DEPENDENT SUBQUERY invertido_ngrama eq_ref PRIMARY,id_palabra,id_ngrama PRIMARY 8 func,const 1 Using index 2 DEPENDENT SUBQUERY ngrama const PRIMARY,ngrama ngrama 5 const 1 Using index 2 DEPENDENT SUBQUERY invertido_ngrama eq_ref PRIMARY,id_palabra,id_ngrama PRIMARY 8 func,const 1 Using index

    Read the article

  • Custom Filter on Dynamic Data Website

    - by Gerardo Gala
    Hi All! I want to able to search on a column that is a foreign key to another table. I don't want to type in the ID (which is the foreign key). I want to search by name. For example, you have a Product Table and a Manufacturer Table. On the Products gridview, I want to be able to search the Manufacturer Name - not Manufacturer Id. But the Products gridview has ProductID. Thanks!

    Read the article

  • SQL Server Update Group by

    - by Gerardo Abdo
    I'm trying to execute this on MS-SQL but returns me an error just at the Group by line update #temp Set Dos=Count(1) From Temp_Table2010 s where Id=s.Total and s.total in (Select Id from #temp) group by s.Total Do anyone knows how can I solve this problem having good performance.

    Read the article

  • Android: R$id class not loaded?

    - by llappall
    Hi, I have a Android class extending Application to generate some global classes, etc. It works, in that I can, for example, get the context, etc. BUT, when I try this: row = (TextView) findViewById(R.id.list_row_text); I get R.id.list_row_text = Class not loaded : <mypackage>.R$id Any ideas why this is happening? Thanks Gerardo

    Read the article

1