Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,946
» Latest member: blackopsdlc
» Forum threads: 21,997
» Forum posts: 22,964

Full Statistics

Online Users
There are currently 1251 online users.
» 0 Member(s) | 1246 Guest(s)
Applebot, Baidu, Bing, Facebook, Google

Latest Threads
[DevBlog MS] Creating a m...
Forum: C#, Visual Basic, & .Net Frameworks
Last Post: xSicKxBot

» Replies: 0
» Views: 7
[WoW Retail News] Fixed C...
Forum: World of Warcraft
Last Post: xSicKxBot

» Replies: 0
» Views: 10
[PS.Blog] Fading Echo mak...
Forum: Sony Discussion
Last Post: xSicKxBot

» Replies: 0
» Views: 10
[Steam Release] Cowbots a...
Forum: New Game Releases
Last Post: xSicKxBot

» Replies: 0
» Views: 13
[Dev News] September Free...
Forum: Game Development
Last Post: xSicKxBot

» Replies: 0
» Views: 10
Marvel Rivals Venom guide...
Forum: PC Discussion
Last Post: xSicKxBot

» Replies: 0
» Views: 15
[WoW Retail News] Midnigh...
Forum: World of Warcraft
Last Post: xSicKxBot

» Replies: 0
» Views: 21
[Steam Release] Kodon
Forum: New Game Releases
Last Post: xSicKxBot

» Replies: 0
» Views: 21
[WoW Retail News] Downloa...
Forum: World of Warcraft
Last Post: xSicKxBot

» Replies: 0
» Views: 18
[PS.Blog] (For Southeast ...
Forum: Sony Discussion
Last Post: xSicKxBot

» Replies: 0
» Views: 17

 
  PC - Nine Noir Lives
Posted by: xSicKxBot - 09-18-2022, 10:22 AM - Forum: New Game Releases - No Replies

Nine Noir Lives



Welcome to Meow Meow Furrington, capital city of cats, home of the world's biggest ball of yarn...and hotbed of crime. You are Cuddles Nutterbutter, feline private investigator and owner of two perfectly normal-sized paws, the doctor said so.

After agreeing to take on a last-minute case for the Chief of Police, you and your plucky assistant find yourselves investigating a murder that risks upsetting the careful balance between the city's two most powerful crime families: the Montameeuws and the Catulets.

Cuddles will need to use every skill he's learned - as well as his definitely-not-smaller-than-average paws - to poke, lick and talk his way through to the heart of the mystery...before some very dangerous cats decide to take matters into their own paws. Which, to clarify, are absolutely regular-sized.

Stretch your legs, clean your whiskers, and dive into Nine Noir Lives. Enjoy a "point-and-lick" comedy-noir adventure, full of humour, crazy characters, and intriguing locations. Solve challenging puzzles and answer the immortal question: how many things need to be licked to solve a murder in this town?

Publisher: Silvernode Studios

Release Date: Sep 07, 2022




https://www.metacritic.com/game/pc/nine-noir-lives

Print this item

  News - CoD: Warzone 2.0 Overhauls The Gulag -- Here's How It Works
Posted by: xSicKxBot - 09-18-2022, 10:22 AM - Forum: Lounge - No Replies

CoD: Warzone 2.0 Overhauls The Gulag -- Here's How It Works

The sequel to Call of Duty: Warzone was officially revealed during Call of Duty Next on September 15, featuring the brand-new Al Mazrah map and a reinvented Gulag. Here we highlight everything we learned about Warzone 2.0's updated Gulag experience.

The Gulag, Warzone's home for second chances, was originally a 1v1 arena for eliminated players to go head-to-head for the chance to return to the match. The arena itself received a few different map layouts since the original Gulag Showers arena was introduced with the launch of Verdansk, but now the rules are completely changing for Warzone 2.0.

Al Mazrah's Gulag is no longer a 1v1 arena, and eliminated players will be transported to a larger Gulag, which is set at a prison's live fire training complex. This is a multi-level arena played out in 2v2 matches, so players are temporarily paired up with another eliminated player. Players no longer spawn into the fight with a gun in hand. Everyone spawns in with their fists, weapons must now be looted, and the surviving duo will return to the match. There will be proximity chat for Al Mazrah, so players can communicate with their temporary duo partner.

Continue Reading at GameSpot

https://www.gamespot.com/articles/cod-wa...01-10abi2f

Print this item

  [Tut] Solidity Example – Safe Remote Purchase
Posted by: xSicKxBot - 09-17-2022, 09:33 AM - Forum: Python - No Replies

Solidity Example – Safe Remote Purchase

5/5 – (1 vote)
YouTube Video

This article continues on the Solidity Smart Contract Examples series, which implements a simple, but the useful process of safe remote purchase.

Here, we’re walking through an example of a blind auction (docs).

  • We’ll first lay out the entire smart contract example without the comments for readability and development purposes.
  • Then we’ll dissect it part by part, analyze it and explain it.
  • Following this path, we’ll get a hands-on experience with smart contracts, as well as good practices in coding, understanding, and debugging smart contracts.

Smart Contract – Safe Remote Purchase


// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
contract Purchase { uint public value; address payable public seller; address payable public buyer; enum State { Created, Locked, Release, Inactive } State public state; modifier condition(bool condition_) { require(condition_); _; } error OnlyBuyer(); error OnlySeller(); error InvalidState(); error ValueNotEven(); modifier onlyBuyer() { if (msg.sender != buyer) revert OnlyBuyer(); _; } modifier onlySeller() { if (msg.sender != seller) revert OnlySeller(); _; } modifier inState(State state_) { if (state != state_) revert InvalidState(); _; } event Aborted(); event PurchaseConfirmed(); event ItemReceived(); event SellerRefunded(); constructor() payable { seller = payable(msg.sender); value = msg.value / 2; if ((2 * value) != msg.value) revert ValueNotEven(); } function abort() external onlySeller inState(State.Created) { emit Aborted(); state = State.Inactive; seller.transfer(address(this).balance); } function confirmPurchase() external inState(State.Created) condition(msg.value == (2 * value)) payable { emit PurchaseConfirmed(); buyer = payable(msg.sender); state = State.Locked; } function confirmReceived() external onlyBuyer inState(State.Locked) { emit ItemReceived(); state = State.Release; buyer.transfer(value); } function refundSeller() external onlySeller inState(State.Release) { emit SellerRefunded(); state = State.Inactive; seller.transfer(3 * value); }
}

Code breakdown and analysis


// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
contract Purchase {

The state variables for recording the value, seller, and buyer addresses.

 uint public value; address payable public seller; address payable public buyer;

For the first time, we’re introducing the enum data structure that symbolically defines the four possible states of our contract. The states are internally indexed from 0 to enum_length - 1.

 enum State { Created, Locked, Release, Inactive }

The variable state keeps track of the current state. Our contract starts by default in the created state and can transition to the Locked, Release, and Inactive state.

 State public state;

The condition modifier guards a function against executing without previously satisfying the condition, i.e. an expression given alongside the function definition.

 modifier condition(bool condition_) { require(condition_); _; }

The error definitions are used with the appropriate, equally-named modifiers.

 error OnlyBuyer(); error OnlySeller(); error InvalidState(); error ValueNotEven();

The onlyBuyer modifier guards a function against executing when the function caller is not the buyer.

 modifier onlyBuyer() { if (msg.sender != buyer) revert OnlyBuyer(); _; }

The onlySeller modifier guards a function against executing when the function caller differs from the seller.

 modifier onlySeller() { if (msg.sender != seller) revert OnlySeller(); _; }

The inState modifier guards a function against executing when the contract state differs from the required state_.

 modifier inState(State state_) { if (state != state_) revert InvalidState(); _; }

The events that the contract emits to acknowledge the functions abort(), confirmPurchase(), confirmReceived(), and refundSeller() were executed.

 event Aborted(); event PurchaseConfirmed(); event ItemReceived(); event SellerRefunded();

The constructor is declared as payable, meaning that the contract deployment (synonyms creation, instantiation) requires sending a value (msg.value) with the contract-creating transaction.

 constructor() payable {

The seller state variable is set to msg.sender address, cast (converted) to payable.

 seller = payable(msg.sender);

The value state variable is set to half the msg.value, because both the seller and the buyer have to put twice the value of the item being sold/bought into the contract as an escrow agreement.

? Info: “Escrow is a legal arrangement in which a third party temporarily holds money or property until a particular condition has been met (such as the fulfillment of a purchase agreement).” (source)

In our case, our escrow is our smart contract.

 value = msg.value / 2;

If the value is not equally divided, i.e. the msg.value is not an even number, the function will terminate. Since the seller will always

 if ((2 * value) != msg.value) revert ValueNotEven(); }

Aborting the remote safe purchase is allowed only in the Created state and only by the seller.

The external keyword makes the function callable only by other accounts / smart contracts. From the business perspective, only the seller can call the abort() function and only before the buyer decides to purchase, i.e. before the contract enters the Locked state.

 function abort() external onlySeller inState(State.Created) {

Emits the Aborted event, the contract state transitions to inactive, and the balance is transferred to the seller.

 emit Aborted(); state = State.Inactive;

? Note: “Prior to version 0.5.0, Solidity allowed address members to be accessed by a contract instance, for example, this.balance. This is now forbidden and an explicit conversion to address must be done: address(this).balance.” (docs).

In other words, this keyword lets us access the contract’s inherited members.

Every contract inherits its members from the address type and can access these members via address(this).<a member> (docs).

 seller.transfer(address(this).balance); }

The confirmPurchase() function is available for execution only in the Created state.

It enforces the rule that a msg.value must be twice the value of the purchase.

The confirmPurchase() function is also declared as payable, meaning the caller, i.e. the buyer has to send the currency (msg.value) with the function call.

 function confirmPurchase() external inState(State.Created) condition(msg.value == (2 * value)) payable {

The event PurchaseConfirmed() is emitted to mark the purchase confirmation.

 emit PurchaseConfirmed();

The msg.sender value is cast to payable and assigned to the buyer variable.

? Info: Addresses are non-payable by design to prevent accidental payments; that’s why we have to cast an address to a payable before being able to transfer a payment.

 buyer = payable(msg.sender);

The state is set to Locked as seller and buyer entered the contract, i.e., our digital version of an escrow agreement.

 state = State.Locked; }

The confirmReceived() function is available for execution only in the Locked state, and only to the buyer.

Since the buyer deposited twice the value amount and withdrew only a single value amount, the second value amount remains on the contract balance with the seller’s deposit.

 function confirmReceived() external onlyBuyer inState(State.Locked) {

Emits the ItemReceived() event.

 emit ItemReceived();

Changes the state to Release.

 state = State.Release;

Transfers the deposit to the buyer.

 buyer.transfer(value); }

The refundSeller() function is available for execution only in the Release state, and only to the seller.

Since the seller deposited twice the value amount and earned a single value amount from the purchase, the contract transfers three value amounts from the contract balance to the seller.

 function refundSeller() external onlySeller inState(State.Release) {

Emits the SellerRefunded() event.

 emit SellerRefunded();

Changes the state to Inactive.

 state = State.Inactive;

Transfers the deposit of two value amounts and the one earned value amount to the seller.

 seller.transfer(3 * value); }
}

Our smart contract example of a safe remote purchase is a nice and simple example that demonstrates how a purchase may be conducted on the Ethereum blockchain network.

The safe remote purchase example shows two parties, a seller and a buyer, who both enter a trading relationship with their deposits to the contract balance.

Each deposit amounts to twice the value of the purchase, meaning that the contract balance will hold four times the purchase value at its highest point, i.e. in the Locked state.

The height of deposits is intended to stimulate the resolution of any possible disputes between the parties, because otherwise, their deposits will stay locked and unavailable in the contract balance.

When the buyer confirms that he received the goods he purchased, the contract will transition to the Release state, and the purchase value will be released to the buyer.

The seller can now withdraw his earned purchase value with the deposit, the contract balance drops to 0 Wei, the contract transitions to the Inactive state, and the safe remote purchase concludes with execution.

The Contract Arguments


This section contains additional information for running the contract. We should expect that our example accounts may change with each refresh/reload of Remix.

Our contract creation argument is the deposit (twice the purchase value). We’ll assume the purchase value to be 5 Wei, making the contract creation argument very simple:

10

Contract Test Scenario


  1. Account 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 deploys the contract with a deposit of 10 Wei, effectively becoming a seller.
  2. Account 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2 confirms the purchase by calling the confirmPurchase() function and enters the trade with a deposit of 10 Wei, effectively becoming a buyer.
  3. The buyer confirms receiving the order by calling the confirmReceived() function.
  4. The seller concludes the trade by calling the refundSeller() function.

Conclusion


We continued our smart contract example series with this article that implements a safe remote purchase.

First, we laid out clean source code (without any comments) for readability purposes.

Second, we dissected the code, analyzed it, and explained each possibly non-trivial segment.





https://www.sickgaming.net/blog/2022/09/...-purchase/

Print this item

  News - Today's Wordle Answer (#454) - September 16, 2022
Posted by: xSicKxBot - 09-17-2022, 09:33 AM - Forum: Lounge - No Replies

Today's Wordle Answer (#454) - September 16, 2022

There's no better way to end the week than by getting the Wordle correct. If you're here, then you might be struggling to accomplish that goal. Luckily for you, we're here to make sure that you end the week with a bang and continue your streak into the weekend. Of course, it might prove difficult today, as the answer to the September 16 Wordle is quite tricky. We wouldn't be surprised if players didn't even know the answer was a word itself once they see it. If you haven't started the Wordle yet, though, you can check out our list of recommended starting words to give yourself an advantage before you've begun.

However, if you're a few guesses deep, then it might be time to seek some helpful advice. We have exactly that just below. There are two hints that should help players at least come up with guesses for today's puzzle on September 16. We will also spell out the full answer further down in the guide if players simply want to escape today unscathed with no trouble.

Today's Wordle Answer - September 16, 2022

We'll begin with two hints that directly relate to the Wordle answer, but won't immediately give the word away.

Continue Reading at GameSpot

https://www.gamespot.com/articles/todays...01-10abi2f

Print this item

  PC - Circus Electrique
Posted by: xSicKxBot - 09-17-2022, 09:33 AM - Forum: New Game Releases - No Replies

Circus Electrique



When everyday Londoners mysteriously turn into vicious killers, only the circus' lineup of Strongmen, Fire Blowers, Clowns and other performers possess the unique talents necessary to save the city.

Circus Electrique is part story-driven RPG, part tactics, part circus management, and completely enthralling - all with a steampunk twist.

Through tactical turn-based battles, these unlikely heroes face Bobbies, British Sailors gone bad, aggressive Posh Girls, and other Victorian-era archetypes stand in their way - not to mention the occasional menacing Mime or Robobear.

The game's innovative Devotion morale system affects characters' performance not only in battles, but also for actual circus shows, dutifully managed between heroic jaunts through six sprawling districts.

Publisher: Saber Interactive

Release Date: Sep 06, 2022




https://www.metacritic.com/game/pc/circus-electrique

Print this item

  [Tut] How to Find All Palindromes in a Python String?
Posted by: xSicKxBot - 09-16-2022, 12:52 PM - Forum: Python - No Replies

How to Find All Palindromes in a Python String?

5/5 – (1 vote)

Coding Challenge


? Challenge: Given a string. How to find all palindromes in the string?

For comprehensibility, allow me to quickly add a definition of the term palindrome:

? Definition: A palindrome is a sequence of characters that reads the same backward as forward such as 'madam', 'anna', or '101'.

This article wants to give you a quick and easy solution in Python. First, we’ll solve the easier but important problem of checking if a substring is a palindrome in the first place:

How to Check If String is Palindrome


You can easily check if a string is a palindrome by using the slicing expression word == word[::-1] that evaluates to True if the word is the same forward and backward, i.e., it is a palindrome.

? Recommended Tutorial: Python Palindromes One-Liner

Next, we’ll explore how to find all substrings in a Python string that are also palindromes. You can find our palindrome checker in the code solution (highlighted):

Find All Substrings That Are Palindrome


The brute-force approach to finding all palindromes in a string is to iterate over all substrings in a nested for loop. Then check each substring if it is a palindrome using word == word[::-1]. Keep track of the found palindromes using the list.append() method. Return the final list after traversing all substrings.

Here’s the full solution:

def find_palindromes(s): palindromes = [] n = len(s) for i in range(n): for j in range(i+1,n+1): word = s[i:j] if word == word[::-1]: palindromes.append(word) return palindromes print(find_palindromes('locoannamadam'))
# ['l', 'o', 'oco', 'c', 'o', 'a', 'anna',
# 'n', 'nn', 'n', 'a', 'ama', 'm', 'madam',
# 'a', 'ada', 'd', 'a', 'm'] print(find_palindromes('anna'))
# ['a', 'anna', 'n', 'nn', 'n', 'a'] print(find_palindromes('abc'))
# ['a', 'b', 'c']

Runtime Complexity


This has cubic runtime complexity, i.e., for a string with length n, we need to check O(n*n) different words. Each word may have up to n characters, thus the palindrome check itself is O(n). Together, this yields runtime complexity of O(n*n*n) = O(n³).

Quadratic Runtime Solutions


Is this the best we can do? No! There’s also an O(n²) time solution!

Here’s a quadratic-runtime solution to find all palindromes in a given string that ignores the trivial one-character palindromes (significantly modified from source):

def find_palindromes(s, j, k): ''' Finds palindromes in substring between indices j and k''' palindromes = [] while j >= 0 and k < len(s): if s[j] != s[k]: break palindromes.append(s[j: k + 1]) j -= 1 k += 1 return palindromes def find_all(s): '''Finds all palindromes (non-trivial) in string s''' palindromes = [] for i in range(0, len(s)): palindromes.extend(find_palindromes(s, i-1, i+1)) palindromes.extend(find_palindromes(s, i, i+1)) return palindromes print(find_all('locoannamadam'))
# ['oco', 'nn', 'anna', 'ama', 'ada', 'madam'] print(find_all('anna'))
# ['nn', 'anna'] print(find_all('abc'))
# []

Feel free to join our community of ambitious learners like you (we have cheat sheets too): ❤



https://www.sickgaming.net/blog/2022/09/...on-string/

Print this item

  [Tut] PHP YouTube Video Downloader Script
Posted by: xSicKxBot - 09-16-2022, 12:52 PM - Forum: PHP Development - No Replies

PHP YouTube Video Downloader Script

by Vincy. Last modified on September 15th, 2022.

YouTube is almost the numero uno platform for hosting videos. It allows users to publish and share videos, more like a social network.

Downloading YouTube videos is sometimes required. You must read through the YouTube terms and conditions before downloading videos and act according to the permissions given. For example you may wish to download to have a backup of older videos that are going to be replaced or removed.

This quick example provides a YouTube Video downloader script in PHP. It has a video URL defined in a PHP variable. It also establishes a key to access the YouTube video meta via API.

Configure the key and store the video URL to get the video downloader link using this script.

Quick example


<?php
$apiKey = "API_KEY";
$videoUrl = "YOUTUBE_VIDEO_URL";
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $videoUrl, $match);
$youtubeVideoId = $match[1];
$videoMeta = json_decode(getYoutubeVideoMeta($youtubeVideoId, $apiKey));
$videoTitle = $videoMeta->videoDetails->title;
$videoFormats = $videoMeta->streamingData->formats;
foreach ($videoFormats as $videoFormat) { $url = $videoFormat->url; if ($videoFormat->mimeType) $mimeType = explode(";", explode("/", $videoFormat->mimeType)[1])[0]; else $mimeType = "mp4"; ?>
<a href="video-downloader.php?link=<?php echo urlencode($url)?>&title=<?php echo urlencode($videoTitle)?>&type=<?php echo $mimeType; ?>"> Download Video</a>
<?php
} function getYoutubeVideoMeta($videoId, $key)
{ $ch = curl_init(); $curlUrl = 'https://www.youtube.com/youtubei/v1/player?key=' . $key; curl_setopt($ch, CURLOPT_URL, $curlUrl); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $curlOptions = '{"context": {"client": {"hl": "en","clientName": "WEB", "clientVersion": "2.20210721.00.00","clientFormFactor": "UNKNOWN_FORM_FACTOR","clientScreen": "WATCH", "mainAppWebInfo": {"graftUrl": "/watch?v=' . $videoId . '",}},"user": {"lockedSafetyMode": false}, "request": {"useSsl": true,"internalExperimentFlags": [],"consistencyTokenJars": []}}, "videoId": "' . $videoId . '", "playbackContext": {"contentPlaybackContext": {"vis": 0,"splay": false,"autoCaptionsDefaultOn": false, "autonavState": "STATE_NONE","html5Preference": "HTML5_PREF_WANTS","lactMilliseconds": "-1"}}, "racyCheckOk": false, "contentCheckOk": false}'; curl_setopt($ch, CURLOPT_POSTFIELDS, $curlOptions); $headers = array(); $headers[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $curlResult = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); return $curlResult;
}
?>

This example code works in the following flow to output the link to download the YouTube video.

  1. Get the unique id of the YouTube video from the input URL.
  2. Request YouTube API via PHP cURL post to access the video metadata.
  3. Get video title, data array in various formats, and MIME type by parsing the cURL response.
  4. Pass the video links, title and mime types to the video downloader script.
  5. Apply PHP readfile() to download the video file by setting the PHP header Content-type.

youtube video downloader links php

The below video downloader script is called by clicking the “Download video” link in the browser.

It receives the video title, and extension to define the output video file name. It also gets the video link from which it reads the video to be downloaded to the browser.

This script sets the content header in PHP to output the YouTube video file.

video-downloader.php

<?php
// this PHP script reads and downloads the video from YouTube
$downloadURL = urldecode($_GET['link']);
$downloadFileName = urldecode($_GET['title']) . '.' . urldecode($_GET['type']);
if (! empty($downloadURL) && substr($downloadURL, 0, 8) === 'https://') { header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment;filename=\"$downloadFileName\""); header("Content-Transfer-Encoding: binary"); readfile($downloadURL);
}
?>

View Demo

Collect YouTube video URL via form and process video downloader script


In the quick example, it has a sample to hardcode the YouTube video URL to a PHP variable.

But, the below code will allow users to enter the video URL instead of the hardcode.

An HTML form will post the entered video URL to process the PHP cURL request to the YouTube API.

After posting the video URL, the PHP flow is the same as the quick example. But, the difference is, that it displays more links to download videos in all the adaptive formats.

index.php

<form method="post" action=""> <h1>PHP YouTube Video Downloader Script</h1> <div class="row"> <input type="text" class="inline-block" name="youtube-video-url"> <button type="submit" name="submit" id="submit">Download Video</button> </div>
</form>
<?php
if (isset($_POST['youtube-video-url'])) { $videoUrl = $_POST['youtube-video-url']; ?>
<p> URL: <a href="<?php echo $videoUrl;?>"><?php echo $videoUrl;?></a>
</p>
<?php
}
if (isset($_POST['submit'])) { preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $videoUrl, $match); $youtubeVideoId = $match[1]; require './youtube-video-meta.php'; $videoMeta = json_decode(getYoutubeVideoMeta($youtubeVideoId, $key)); $videoThumbnails = $videoMeta->videoDetails->thumbnail->thumbnails; $thumbnail = end($videoThumbnails)->url; ?>
<p> <img src="<?php echo $thumbnail; ?>">
</p>
<?php $videoTitle = $videoMeta->videoDetails->title; ?>
<h2>Video title: <?php echo $videoTitle; ?></h2>
<?php $shortDescription = $videoMeta->videoDetails->shortDescription; ?>
<p><?php echo str_split($shortDescription, 100)[0];?></p>
<?php $videoFormats = $videoMeta->streamingData->formats; if (! empty($videoFormats)) { if (@$videoFormats[0]->url == "") { ?>
<p> <strong>This YouTube video cannot be downloaded by the downloader!</strong><?php $signature = "https://example.com?" . $videoFormats[0]->signatureCipher; parse_str(parse_url($signature, PHP_URL_QUERY), $parse_signature); $url = $parse_signature['url'] . "&sig=" . $parse_signature['s']; ?> </p>
<?php die(); } ?>
<h3>With Video & Sound</h3>
<table class="striped"> <tr> <th>Video URL</th> <th>Type</th> <th>Quality</th> <th>Download Video</th> </tr> <?php foreach ($videoFormats as $videoFormat) { if (@$videoFormat->url == "") { $signature = "https://example.com?" . $videoFormat->signatureCipher; parse_str(parse_url($signature, PHP_URL_QUERY), $parse_signature); $url = $parse_signature['url'] . "&sig=" . $parse_signature['s']; } else { $url = $videoFormat->url; } ?> <tr> <td><a href="<?php echo $url; ?>">View Video</a></td> <td><?php if($videoFormat->mimeType) echo explode(";",explode("/",$videoFormat->mimeType)[1])[0]; else echo "Unknown";?></td> <td><?php if($videoFormat->qualityLabel) echo $videoFormat->qualityLabel; else echo "Unknown"; ?></td> <td><a href="video-downloader.php?link=<?php echo urlencode($url)?>&title=<?php echo urlencode($videoTitle)?>&type=<?php if($videoFormat->mimeType) echo explode(";",explode("/",$videoFormat->mimeType)[1])[0]; else echo "mp4";?>"> Download Video</a></td> </tr> <?php } ?> </table>
<?php // if you wish to provide formats based on different formats // then keep the below two lines $adaptiveFormats = $videoMeta->streamingData->adaptiveFormats; include 'adaptive-formats.php'; ?> <?php }
}
?>

This program will output the following once it has the video downloader response.

php youtube video downloader

PHP cURL script to get the video metadata


The PHP cURL script used to access the YouTube endpoint to read the file meta is already seen in the quick example.

The above code snippet has a PHP require_once statement for having the cURL post handler.

The youtube-video-meta.php file has this handler to read the video file meta. It receives the unique id of the video and the key used in the PHP cURL parsing.

In a recently posted article, we have collected file meta to upload to Google Drive.

Display YouTube video downloaders in adaptive formats


The landing page shows another table of downloads to get the video file in the available adaptive formats.

The PHP script accesses the adaptiveFormats property of the Youtube video meta-object to display these downloads.

adaptive-formats.php

<h3>YouTube Videos Adaptive Formats</h3>
<table class="striped"> <tr> <th>Type</th> <th>Quality</th> <th>Download Video</th> </tr> <?php foreach ($adaptiveFormats as $videoFormat) { try { $url = $videoFormat->url; } catch (Exception $e) { $signature = $videoFormat->signatureCipher; parse_str(parse_url($signature, PHP_URL_QUERY), $parse_signature); $url = $parse_signature['url']; } ?> <tr> <td><?php if(@$videoFormat->mimeType) echo explode(";",explode("/",$videoFormat->mimeType)[1])[0]; else echo "Unknown";?></td> <td><?php if(@$videoFormat->qualityLabel) echo $videoFormat->qualityLabel; else echo "Unknown"; ?></td> <td><a href="video-downloader.php?link=<?php print urlencode($url)?>&title=<?php print urlencode($videoTitle)?>&type=<?php if($videoFormat->mimeType) echo explode(";",explode("/",$videoFormat->mimeType)[1])[0]; else echo "mp4";?>">Download Video</a></td> </tr> <?php }?>
</table>

View DemoDownload

↑ Back to Top



https://www.sickgaming.net/blog/2022/09/...er-script/

Print this item

  News - Call of Duty: Modern Warfare 2's New Invasion Mode Features AI Teammates
Posted by: xSicKxBot - 09-16-2022, 12:52 PM - Forum: Lounge - No Replies

Call of Duty: Modern Warfare 2's New Invasion Mode Features AI Teammates

Call of Duty: Modern Warfare 2 is getting a ton of new game modes and changes, including the rumored third-person mode. Among those is a very different kind of Ground War match called Invasion, which will augment your regular human teammates and opponents with AI bots to make for a sprawling combat experience.

The Call of Duty blog says each team starts with multiple squads of Operators, fighting alongside AI combatants, all pursuing objectives from within their respective headquarters. Each team will be pushing forward to the front line, which shifts your respawn locations. And due to the AI teammates, it promises "more troops than any previous Ground War experience," and the maps will be larger to facilitate the huge team size.

This game will also reintroduce third-person multiplayer playlists, giving you a little more situational awareness as you survey the battlefield. It will also include vehicular combat so you can lean out of your vehicles while firing at enemies. Ricochet anti-cheat tech will once again be included with both Modern Warfare 2 and the new Warzone 2.0.

Continue Reading at GameSpot

https://www.gamespot.com/articles/call-o...01-10abi2f

Print this item

  PC - JoJo's Bizarre Adventure: All-Star Battle R
Posted by: xSicKxBot - 09-16-2022, 12:52 PM - Forum: New Game Releases - No Replies

JoJo's Bizarre Adventure: All-Star Battle R



All JOJOs Unite! Fight for Your Destiny!

Jonathan Joestar, Jotaro Kujo, DIO, Jolyne Cujoh, and other characters from JoJo's Bizarre Adventure gather across multiple generations! With 50 playable characters from all arcs, you can experience popular battles from each story, and see characters from different universes interact for the first time!

This title is based on the All Star Battle fighting system that was released in 2012. The game design of JoJo's Bizarre Adventure: All Star Battle R reinvigorates the experience with adjustments to the fighting tempo and the addition of hit stops and jump dashes.

With new audio recordings from the Part 6 anime voice actors, the full atmosphere of the animated series is realized. Both fans who have played the original All Star Battle and newcomers will be able to enjoy the experience.

Publisher: Bandai Namco Games

Release Date: Sep 02, 2022




https://www.metacritic.com/game/pc/jojos...r-battle-r

Print this item

  [Tut] How to Get a Random Entry from a Python Dictionary
Posted by: xSicKxBot - 09-15-2022, 02:08 PM - Forum: Python - No Replies

How to Get a Random Entry from a Python Dictionary

5/5 – (1 vote)

Problem Formulation and Solution Overview


This article will show you how to get a random entry from a Dictionary in Python.

To make it more interesting, we have the following running scenario:

?‍? The Plot: Mr. Sinclair, an 8th great Science Teacher, is giving his students a quiz on the first 25 Periodic Table elements. He has asked you to write a Python script so that when run, it generates a random key, value, or key:value pair from the Dictionary shown below to ask his students.

els = {'Hydrogen': 'H', 'Helium': 'He', 'Lithium': 'Li', 'Beryllium': 'Be', 'Boron': 'B', 'Carbon': 'C', 'Nitrogen': 'N', 'Oxygen': 'O', 'Fluorine': 'F', 'Neon': 'Ne', 'Sodium': 'Na', 'Magnesium': 'Mg', 'Aluminum': 'Al', 'Silicon': 'Si', 'Phosphorus': 'P', 'Sulfur': 'S', 'Chlorine': 'Cl', 'Argon': 'Ar', 'Potassium': 'K', 'Calcium': 'Ca', 'Scandium': 'Sc', 'Titanium': 'Ti', 'Vanadium': 'V', 'Chromium': 'Cr', 'Manganese': 'Mn'}

? Question: How would we write code to get a random entry from a Dictionary?

We can accomplish this task by one of the following options:


Preparation


This article uses the random library for each example. For these code samples to run error-free, add the following snippet to the top of each example.

import random

Method 1: Use random.choice() and items()


This example uses random.choice() and items() to generate a random Dictionary key:value pair.

el_list = list(els.items())
random_el = random.choice(el_list)
print(random_el)

The above code converts the Dictionary of Periodic Table Elements to a List of Tuples and saves it to el_list. If output to the terminal, the contents of el_list contains the following.

[('Hydrogen', 'H'), ('Helium', 'He'), ('Lithium', 'Li'), ('Beryllium', 'Be'), ('Boron', 'B'), ('Carbon', 'C'), ('Nitrogen', 'N'), ('Oxygen', 'O'), ('Fluorine', 'F'), ('Neon', 'Ne'), ('Sodium', 'Na'), ('Magnesium', 'Mg'), ('Aluminum', 'Al'), ('Silicon', 'Si'), ('Phosphorus', 'P'), ('Sulfur', 'S'), ('Chlorine', 'Cl'), ('Argon', 'Ar'), ('Potassium', 'K'), ('Calcium', 'Ca'), ('Scandium', 'Sc'), ('Titanium', 'Ti'), ('Vanadium', 'V'), ('Chromium', 'Cr'), ('Manganese', 'Mn')]

Next, random.choice() is called and passed one (1) argument: el_list.

The results return a random Tuple from the List of Tuples, saves to random_el and is output to the terminal.


('Oxygen', 'O')

This code can be streamlined down to the following.

random_el = random.choice(list(els.items()))
YouTube Video


Method 2: Use random.choice() and keys()


This example uses random.choice() and keys() to generate a random Dictionary key.

random_el = random.choice(list(els.keys()))
print(random_el)

The above code calls random.choice() and passes it one (1) argument: the keys of the els Dictionary converted to a List of Tuples.

The result returns a random key, saves to random_el and is output to the terminal.


Beryllium

YouTube Video


Method 3: Use random.choice() and dict.values()


This example uses random.choice() and values() to generate a random Dictionary value.

random_el = random.choice(list(els.values()))
print(random_el)

The above code calls random.choice() and passes it one (1) argument: the keys of the els Dictionary converted to a List of Tuples.

The result returns a random value, saves to random_el and is output to the terminal.


Si

YouTube Video


Method 4: Use sample()


This example uses the sample() function to generate a random Dictionary key.

from random import sample
random_el = sample(list(els), 1)
print(random_el)

The above code requires sample to be imported from the random library.

Then, sample() is called and passed two (2) arguments: els converted to a List of Tuples and the number of random keys to return.

The results save to random_el and is output to the terminal.


['Carbon']


Method 5: Use np.random.choice()


This example uses NumPy and np.random.choice() to generate a random Dictionary key.

Before moving forward, please ensure the NumPy library is installed. Click here if you require instructions.

import numpy as np random_el = np.random.choice(list(els), 1)
print(random_el)

This code imports the NumPy library installed above.

Then, np.random.choice() is called and passed two (2) arguments: els converted to a List of Tuples and the number of random keys to return.

The results save to random_el and is output to the terminal.


['Chromium' 'Silicon' 'Oxygen']

?Note: np.random.choice() has an additional parameter that can be passed. This parameter is a List containing associated probabilities.


Bonus:


This code generates a random key:value pair from a list of tuples. When the teacher runs this code, a random question displays on the screen and waits for a student to answer. Press 1 to display the answer, 2 to quit.

import keyboard
import random
import time els = {'Hydrogen': 'H', 'Helium': 'He', 'Lithium': 'Li', 'Beryllium': 'Be', 'Boron': 'B', 'Carbon': 'C', 'Nitrogen': 'N', 'Oxygen': 'O', 'Fluorine': 'F', 'Neon': 'Ne', 'Sodium': 'Na', 'Magnesium': 'Mg', 'Aluminum': 'Al', 'Silicon': 'Si', 'Phosphorus': 'P', 'Sulfur': 'S', 'Chlorine': 'Cl', 'Argon': 'Ar', 'Potassium': 'K', 'Calcium': 'Ca', 'Scandium': 'Sc', 'Titanium': 'Ti', 'Vanadium': 'V', 'Chromium': 'Cr', 'Manganese': 'Mn'} print('1 Answer 2 quit')
def quiz(): while True: k, v = random.choice(list(els.items())) print(f'\nWhat is the Symbol for {k}?') pressed = keyboard.read_key() if pressed == '1': print(f'The answer is {v}!') elif pressed == '2': print("Exiting\n") exit(0) time.sleep(5)
quiz()

✨Finxter Challenge!
Write code to allow the teacher to enter the answer!


Summary


This article has provided five (5) ways to get a random entry from a Dictionary to select the best fit for your coding requirements.

Good Luck & Happy Coding!


Programmer Humor – Blockchain


“Blockchains are like grappling hooks, in that it’s extremely cool when you encounter a problem for which they’re the right solution, but it happens way too rarely in real life.” source xkcd



https://www.sickgaming.net/blog/2022/09/...ictionary/

Print this item