Jump to content

HauntedDawg

Members
  • Content Count

    476
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by HauntedDawg

  1. I often a times do extensive development (lots of small micro-services) spanning multiple different languages which is listed below. In term's of web server environments - I have been using the docker / kubernetes route for the passed 2 and half years and have never looked back. Part of this docker / kubernetes environment I make use of a Reverse Proxy / Load Balancer router in-front of the docker containers named Traefik.io - no need for nginx / apache virtual hosts. Docker has helped me not need to worry about server configuration and the smaller details - now it's as simple as `docker run {{ image name }}` and that image can either be an existing prebuilt image from the huge library over at Docker Hub https://hub.docker.com or you create your own image by using a file named Dockerfile - the final image can then be published to Docker Hub publicly or privately. Some helpful use cases: Need to run a static one page website but don't want to go through the hassle of having to deal with virtual host files? Use a lightweight container with nginx pre-installed and pre-configured, just tell docker which build folder you want to mount on the container. Further Reading: https://hub.docker.com/r/bitnami/nginx/ Have a lot of website's to manage on a single server? Use https://traefik.io - a dynamic reverse proxy with built in load balancing capabilities combined with docker making for zero need for web server configuration. Traefik listens on the docker socket for container events (restart, shutdown, high cpu, low cpu,, startup amongst a few) - and these containers simply needs a label (E.G. `- "traefik.frontend.rule=Host:example.com"`) as well as a domain pointed the servers IP Address and the Traefik Reverse Proxy server will handle serving HTTP & HTTPS requests to the correct docker containers based on the domain name. It provides plug & play support for Let's Encrypt + auto-renewal -- pure awesomeness! If you use docker and use the auto scaling functionality, Traefik will see the new containers immediately and start load balancing them. Traefik is the 9th most popular image on Docker Hub with 10M+ downloads at this time while nginx is further down the list. Saved me lot's of time needing to still configure services as well as install services such as PHP and it's subsequent extensions. See screenshot attached of my development machine's services that are needed for all my projects. I can delete the containers / services while keeping the needed data on the host machine and bring the container / service up again with existing data IDE's / Tools / Services to their relevant languages / use cases / needs: JetBrains IntelliJ Community Edition - for Java / Kotlin development as well as sometime's the odd cases of Native Android Development Building REST / Soap API's with Spring MVC framework using Kotlin is a bliss in itself and with Kotlin being significantly faster than Java - it makes perfect for API's. Kotlin comes with Java interoperability in mind thereby allowing Java code to be called from Kotlin in a natural way, and Kotlin code can be used from Java What is Kotlin you ask? https://www.infoworld.com/article/3224868/what-is-kotlin-the-java-alternative-explained.html PHPStorm - for the obvious first 3 letters of the application's name 😄 - current place of employment make's use of an already extensively scaffolded starter project which has been built on for the passed 12 - 15 years plus / minus, first making use of the Zend framework and then in the last 4 years making the change of the underlying framework to Symfony Silex using an annotation provider for routing thus keeping the route declaration with the class file and it's subsequent endpoints. Additional Tools: xdebug for debugging / code profiling purposes Always have PHPStorm built-in Terminal open. Siege an http load tester and benchmarking utility https://github.com/JoeDog/siege Visual Studio Code - for all my front-end based applications consisting of NativeScript, Angular, VueJs, HTML, CSS Because I got to experience building Java apps where every variable needs to be type casted - I have become a believer of TypeScript as it enforces type casting. That has saved me a days if not weeks of combined time finding bugs / issues. Chrome Browser - Some developers believe in the Firefox developer tools, but for me and quite a few developers I know, Chrome's Developer Tools is well built and fit's in nicely with Chrome. Also has a dark mode. Bonus. Postman - Manual API endpoint testing API Doc Generators - Swagger for PHP Symfony & Swagger + SpringFox for Java Spring MVC Swagger provides running a list of tests against your API's saving you time during the development lifecycle of an API Digital Ocean - development testing & production based VM's. There's an existing supported driver to allow docker-machine to connect to Digital Ocean to gather information about existing VM's or the ability to create VM's from your own terminal. It's overhead for minimal site's but wonderful for more site's and growth There is probably quite a few other tools / services that I have not listed. I didn't see anyone making use of docker nor any articles floating about - it's worth looking into!
  2. HauntedDawg

    TypeScript

    We have not found to have any performance impact using NativeScript and we have a variety of mobile apps out there at the moment. The app is truly native though hence "Native"Script 😛 - it just make's it super easy to maintain without needing 2 different developers cause of different languages. See here for more reading: https://www.nativescript.org/nativescript-is-how-you-build-native-mobile-apps-with-angular
  3. HauntedDawg

    TypeScript

    NativeScript is what you want for mobile apps (or React Native) - https://www.nativescript.org/ Haven't heard of Flutter. Will give it a look
  4. MCCode's come's with an IPN file. Paypal also provide's an IPN PHP file. Use those in your application. They already have the methods to check a payment is completed.
  5. Without seeing the underlying server structure, ports opened, whats on and whats off, it will be a hard guess.
  6. Does it eventually trigger this line: $db->query("UPDATE `crons` SET `nextUpdate`={$times} WHERE `file`='{$file}'"); As that is what will depict the next cron time. Check and make sure nextUpdate is now() time + 60.
  7. http://old.makewebgames.io/showthread.php/32642-any-version-Removal-of-1-minute-crons There on, its simple to add 5 minutes, 1 hour, daily, etc etc.
  8. http://old.makewebgames.io/showthread.php/32642-any-version-Removal-of-1-minute-crons I think (have not checked), but lower down or further in the thread shows the 5 minute and etc.. And its quite easy to add to it. This does run 1 minute cron 10 times if the user has been inactive for 10 minutes.
  9. Post up your final result so others that may have the same issue can see. Glad its resolved :)
  10. It looks like what you are wanting to do is create a global array and then populate that inside the loop to later use in the morris bar object:   var chartData = []; // Holds our data for the chart /* Do ajax stuffs here */ // Loop through the data from the ajax $.each(data.result, function(a, i) { chartData.push({x: i.date, y: i.count}); // Push values into array }); console.log(chartData); Morris.Bar({ element: 'graph', data: chartData, xkey: 'x', ykeys: ['y', 'z', 'a'], labels: ['Y', 'Z', 'A'] }).on('click', function(i, row) { console.log(i, row); });
  11. jsFiddle Your json return data (or your psuedo json is wrong).   { "result":[ { 'id': 1, 'date': '2014-12-10', 'site_id': 'http://someurl.com', 'count': 1 }, { 'id': 2, 'date': '2014-12-03', 'site_id': 'http://someurl2.com', 'count': 52 }, // More results go here ] }   Also, by adding a secondary argument to the $.each function, you can then extract the data by using the second argument while the first remains the index.   $.each(data.result, function(a, i) { var json = i; // Since we no longer need to target the main array anymore var chartData = ''; // Depending how this array/object is built, i would suggest reading up on writing json strings });
  12. Skype me or inbox me, can assist you.
  13. Retirement, yet the part above in bold had me in tears with laughter. Who use's hack anymore? Is this the 1990's?? Well done script kiddy :)
  14. First of, in the first email response.   And unfortunately, by that time when you had some finances to do work, you caught me in a very busy time and was on holiday. But, non the less.. Good luck with your venture.
  15. Seeing as your other thread is closed, and don't quite feel its necessary to create a new thread. But on previous thread you state that we must email you. By all means, I prefer that, but it would help if you answered your email or your Skype. Oh well... Don't be complaining next time. K Cheers.
  16. Apart from more processing power to check for each isset. They essentially do the same. But regardless if this was on-the-fly. I was providing a tip, and not necessarily telling you to code like that. But it's best to start practicing Rule of least power. Also, it's not about "least code" method either, but the simple KISS (Keep it simple stupid) principle. Creating "on-the-fly" simple, logical code, does not take a lot of brain power :)
  17. You don't actually need all those isset's..   $priName = 'None Equipped'; $secName = 'None Equipped'; $armName = 'None Equipped'; $query = $db->query("SELECT `itmname`, `itmid` FROM `items` WHERE `itmid` IN (".$r['equip_primary'].", ".$r['equip_secondary'].", ".$r['equip_armor'].")"); while($getresults = $db->fetch_row($query)) { switch($getresults['itmid']) { case $r['equip_primary']: $priName = $getresults['itmname']; break; case $r['equip_secondary']: $secName = $getresults['itmname']; break; case $r['equip_armor']: $armName = $getresults['itmname']; break; } }
  18. Code is super bugged, I have fixed all parse errors:   <?php require('globals.php'); ///Configuration $item = 0; //Item ID required to be obtained before performing a hire ninja. $prohibited = array(1); //Add player IDs to this array who you want to be protected from hire ninja. $prohibited_npc = true; //Set this to true to block NPC's from being spied on. // End if ($ir['donatordays'] <= 0) { error('This is a donator only option.'); } $q1 = $db->query("SELECT * FROM `inventory` WHERE `inv_userid`= {$ir['userid']} and `inv_itemid` = $item"); if ($db->num_rows($q1) < 1) { error('You need to get in contact with a ninja.To get in contact with one, go buy a ninja card.'); } if ($ir['jail'] > 0 || $ir['hospital'] > 0) { error('You can not hire a ninja on someone when your in jail or hospital.'); } $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $_POST['ID'] = (isset($_POST['ID']) && is_numeric($_POST['ID'])) ? abs(intval($_POST['ID'])) : ''; if ($_POST['ID']) { $q = $db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_POST['ID']}"); $r = $db->fetch_assoc($q); if (in_array($_POST['ID'], $prohibited)) { error('The ninja never came back!It was rumoured he was attacked by ' . $r['username'] . ' and pushed off a cliff.'); } if (in_array($in, $prohibited)) { error('You cannot spy on this player.'); } if ($r['fedjail']) { error('You cannot spy on people in federal jail.'); } if ($in == $userid) { error('You cannot spy on yourself!'); } $payment = $r['level'] * 100; if ($ir['money'] < $payment) { error("You need " . money_formatter($payment) . " to hire a ninja on this member."); } else { $payment = $r['level'] * 100; $db->query("UPDATE `users` SET `money` = `money` - '$payment' WHERE `userid` = '$userid'"); $exp = (int) ($r['exp'] / (($r['level'] + 1) * ($r['level'] + 1) * ($r['level'] + 1) * 2) * 100); $ts = $r['strength'] + $r['agility'] + $r['guard'] + $r['labour'] + $r['IQ']; ?> <hr width='75%'>You have hired a ninja to get information on <b><?php echo format($r['username']); ?></b> at the cost of <?php echo money_formatter($payment); ?>. Here is the information retrieved:<hr width='75%'> <h3><u>Statistics</u></h3> <table cellspacing='1' border='0' cellpadding='1' class='table' width='75%'> <tr><th colspan='2' class='h'><b>Stats Info</b></td></tr> <tr> <td>Strength: <?php echo format($r['strength']); ?></td> <td>Agility: <?php echo format($r['agility']); ?></td> </tr> <tr> <td>Guard: <?php echo format($r['guard']); ?></td> <td>Labour: <?php echo format($r['labour']); ?></td> </tr> <tr> <td>IQ: <?php echo format($r['IQ']); ?></td> <td>EXP: <?php echo format($exp); ?>%</td> </tr> <tr> <td colspan='2'><font color = red><b>Total Stats:</b></font><?php echo format($ts); ?></td> </tr></table> <h3><u>Equipped Items</u></h3> <?php $q1 = $db->query("SELECT * FROM items WHERE itmid IN({$r['equip_primary']}, {$r['equip_secondary']}, {$r['equip_armor']})"); while ($r1 = $db->fetch_assoc($q1)) { $equip[$r1['itmid']] = $r1; } ?><table width='75%' cellspacing='1' class='table'> <tr> <th>Primary Weapon</th> <td> <?php if ($equip[$r['equip_primary']]['itmid']) { echo $equip[$r['equip_primary']]['itmname']; ?></td> <td> <?php echo $equip[$r['equip_primary']]['itmdesc']; ?> </td> <?php } else { ?> None equipped.</td><td> </td> <?php } ?> <tr> <th>Secondary Weapon</th> <td> <?php if ($equip[$r['equip_secondary']]['itmid']) { echo $equip[$r['equip_secondary']]['itmname']; ?></td> <td> <?php echo $equip[$r['equip_secondary']]['itmdesc']; ?></td> <?php } else { ?> None equipped.</td><td> </td> <?php } ?> <tr> <th>Armor</th> <td> <?php if ($equip[$r['equip_armor']]['itmid']) { echo $equip[$r['equip_armor']]['itmname']; ?></td> <td> <?php echo $equip[$r['equip_armor']]['itmdesc']; ?></td><?php } else { ?> None equipped.</td><td> </td> <?php } ?> </tr></table> <h3><u>Inventory</u></h3> <?php $inv = $db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']}"); if ($db->num_rows($inv) == 0) { ?> <hr width='75%'>This person has no items!<hr width='75%'> <?php } else { ?> <b>Inventory listed below.</b> <hr width='75%'><table width=75% cellspacing=1 class='table'><tr style='background:gray'><th>Item</th><th>Sell Value</th><th>Total Sell Value</th></tr> <?php while ($i = $db->fetch_assoc($inv)) { ?> <tr><td><?php echo format($i['itmname']); if ($i['inv_qty'] > 1) { ?> x<?php echo format($i['inv_qty']); ?> <?php } ?> </td><td><?php echo money_formatter($i['itmsellprice']); ?></td><td> <?php echo money_formatter($i['itmsellprice'] * $i['inv_qty']); ?> </td></tr> <?php } ?> </table><hr width='75%'><hr width='50%'><a href='viewuser.php?u=<?php echo $_POST['ID']; ?>'>> Go Back</a><hr width='50%'> <?php } } } else { $q = $db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); if (!$_GET['ID']) { error('No valid player ID to hire spy specified.'); } else if (!$db->num_rows($q)) { error('This user does not exist.'); } else if ($_GET['ID'] == $userid) { error('What is the point in hiring a ninja on yourself.'); } else { $r = $db->fetch_assoc($q); $payment = $r['level'] * 100; ?> <hr width='100%'>You are hiring a ninja to spy on <b><?php format($r['username']); ?></b> at the cost of <?php echo money_formatter($payment); ?><hr width='100%'> <?php if ($ir['money'] >= $payment) { ?> <form action='hireninja.php' method='post'><input type='hidden' name='ID' value='<?php echo $_GET['ID']; ?>' /><input type='submit' value='Hire' /></form> <?php } else { error('You don not have enough money!'); } } } $h->endpage(); ?>   It's not even worth asking some unknown person for some random image for 2 minutes of your time.
  19. Hahaha, in programming game for near 14 years, but still self proclaims to be the best without proof. A person who self proclaims to be some sort of programming god, is a self absorbed person. A person who counts his self equal to others within regards to their development progress, how ever is a different story. To claim they know the owner of torn. Wait, lets see, in person, or on skype? Cause there has been many Joe Chedburns going around. Or wait, I know the owner of torn, because I read an article with his name: http://www.telegraph.co.uk/technology/news/6264082/21-year-old-computer-geek-makes-1m-with-online-game.html Oh just by the way. I also know joe personally, because we had interaction over email. Wow, I know a multi millionaire.. Wrong. Look at my previous account, been here since 2006. He rocked up in late 2006 claiming to be a god, under which "AbsoluteZero" was helping him at the time to improve his coding. Now, at the time I started here in CE, I looked up to "AbsoluteZero", and we spoke often. He left the scene, I started a new job, to which I became known to real world development, SVN, time tracking, Coding Standards. I then realized that AbsoluteZero, knew what he was doing, when he wanted to, but lacked in the standards side. To me, that is no big issue, if you can code, you can learn the standards. But you see what I'm getting at? If any of those from the old CE days popped up here, they would know kingscorpion the moment they heard his name. Hell, he was even banned my MD that time back.
  20. You seem very hesitant to show your coding. Therefor, until you do, no one will hire you.
  21. That upload was in 2009. I re-call GRPG being out since 2007 - 2008? I may be wrong though.
  22. I recently had a go at something like this for another project, and I found that regardless of what you try, it still relies on what the end user has installed to view videos. But here is what I done: When uploading a file, you have the $_FILES['name']['type'] parameter. I found that by using that "type" parameter, you can store it in the database, and by using php headers Content-Type, use the type from the DB. You can also use that same Content-Type in your html5 video tag. The problem comes in with certain file formats, specifically wma. Requires the end user to install quicktime. I would switch to DigitalOcean VPS, or even still, use a cheap $5 vps on DigitalOcean to connect to your database, fetch the files & convert them using ffmpeg (you can install it onto your own vps). And then on your website server, serve the files from the VPS (http://enable-cors.org/). There are many approaches. It depends on what you feel like using :cool:
×
×
  • Create New...