Jump to content


Member Since 19 Nov 2008
Offline Last Active Apr 25 2014 09:10 AM

Topics I've Started

does CodeCanyon is a reliable source of income?

12 April 2014 - 06:35 AM


i was thinking about start selling on codecanyon lately.

i always bought there stuff but never thought to sell there and im not sure if it's worth

to waste my time on trying to sell there.

im not looking for a main income, just a few dollars a month will be good enough.

is the competition is hard there?

thanks in advance! :)

something i cant under stand

03 July 2013 - 07:34 PM

hey there,
lately im was working on a new application that required alot of ajax requests...
i was wondering, many websites return fom the server a json object and then creates the html elements with javasript and then appending it to the document. why not return the html from the server and then just append it to a div, which is more easier!

for example, lets say i want to print a table with shop items and their prices, why should i return a json object and then print a table with javascript with the data insted of return the whole html table from the server? am i missing something?

thanks in advance.

draw dynamic polygons

19 March 2013 - 09:48 AM


im making a simple game, and im trying to draw a dynamic polygon around each star in the game to show the stars area.

for example, lets say "STAR A" positioned on X=50,Y=100 on the map, in the database i have a colum that determine the star's surended area for example, area=100; is that posible to darw a polygon around each star depending on the star area on the DB? another think is that each polygon shuold be in diffrent color. im not asking for the full soultion, but if someone can please give me some directions how to do it... im not good at math :|

i made an image to demostarate what im trying to reach...


Thanks in advance...

Attached File  Untitled.png   494.81KB   14 downloads

looking for jquery plugin

15 March 2013 - 04:54 AM

i trying to find a specific plugin, but searches in google haven't helped me :|

i looking for a plugin that doing these things:
lets assume i have an image 2500X2500.
i putting this image as a background on a div sized 600X600
now all i need is a buttons that will move the div background and content!
for example lets say the div is 100X100 and i putting some text in a floating div positioned in x=300, y=500
which mean out of the range of the view. now if i want watch this text i need to move with arrows/buttons to see it.

is there a plugin like that?

Thanks in advance
** sorry for poor english **

update user in DB every hour

14 March 2013 - 07:10 AM

hey, im building a web based browser game.

what im trying to do is to give the user 15 tickets every hour.

what i did is to store the time the user got the tickets last time, and when the user loging in again, or refresh the page,

i check how many hours passed from the last time he got tickets, then i update his tickets to 15*$hours.

the problem is that it updates the tickets all the time :|


here is my code so far:

$member_id = intval($this->member['id']);

if ($member_id != 0) {
    $ticketsToAdd    = 0;
    $lastTicket      = $this->member['last_tickets']; // last time the user got tickets
    $ticketsJump     = $INFO['tickets_jump'];         // how many tickets to add the user, set to 15
    $ticketsJumpTime = $INFO['tickets_jump_time'];    // after how many hours update the user tickets, set to 1
    $timeDiff        = $std->timePassed($lastTicket); // calculate the time diffrence between now and the last time the user got tikets
    if ($timeDiff['hours'] >= $ticketsJumpTime) {
        $ticketsToAdd = $ticketsJump * $timeDiff['hours'];
        if ($timeDiff['minutes'] != 0) {
            $lastTicketWorkAround = time() - ($timeDiff['minutes']*60);
        } else {
            $lastTicketWorkAround = time();

        $DB->query("UPDATE users SET tickets = tickets+".$ticketsToAdd.", last_tickets='".$lastTicketWorkAround."' WHERE id='".$this->member['id']."'");

public function timePassed($str) {
        $sec = time() - $str;
        return array(   "hours"     =>  intval($sec / 60 / 60),
                        "minutes"   =>  intval($sec / 60));
       # if($sec < 60) {
            /* if less than a minute, return seconds */
       #     return $sec . " seconds ago";
       # }
       # else if($sec < 60*60) {
            /* if less than an hour, return minutes */
       #     return intval($sec / 60) . " minutes ago";
       # }
       # else if($sec < 24*60*60) {
            /* if less than a day, return hours */
       #     return intval($sec / 60 / 60) . " hours ago";
       # }
       # else {
            /* else returns days */
       #     return intval($sec / 60 / 60 / 24) . " days ago";
       # }

i add some comments to the code so you can understend better.

the whole code is a part from a class...


Thanks in advance!

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime