Create an account


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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,134
» Latest member: jax9090nnn
» Forum threads: 21,936
» Forum posts: 22,806

Full Statistics

Online Users
There are currently 3374 online users.
» 0 Member(s) | 3369 Guest(s)
Applebot, Baidu, Bing, Google, Yandex

 
  [Tut] Python TypeError ‘set’ object is not subscriptable
Posted by: xSicKxBot - 09-11-2022, 08:12 AM - Forum: Python - No Replies

Python TypeError ‘set’ object is not subscriptable

5/5 – (1 vote)

Minimal Error Example


Given the following minimal example where you create a set and attempt to access an element of this set using indexing or slicing:

my_set = {1, 2, 3}
my_set[0]

If you run this code snippet, Python raises the TypeError: 'set' object is not subscriptable:

Traceback (most recent call last): File "C:\Users\xcent\Desktop\code.py", line 2, in <module> my_set[0]
TypeError: 'set' object is not subscriptable

Why Does the Error Occur?


The Python TypeError: 'set' object is not subscriptable occurs if you try to access an element of a set using indexing or slicing that imply an ordering of the set.

However, sets are unordered collections of unique elements: they have no ordering of elements. Thus, you cannot use slicing or indexing, operations that are only possible on an ordered type.

? Recommended Tutorial: The Ultimate Guide to Python Sets

How to Fix the Error?


How to fix the TypeError: 'set' object is not subscriptable?

To fix the TypeError: 'set' object is not subscriptable, either convert the unordered set to an ordered list or tuple before accessing it or get rid of the indexing or slicing call altogether.

Here’s an example where you convert the unordered set to an ordered list first. Only then you use indexing or slicing so the error doesn’t occur anymore:

my_set = {1, 2, 3} # Convert set to list:
my_list = list(my_set) # Indexing:
print(my_list[0])
# 1 # Slicing:
print(my_list[:-1])
# [1, 2]

Alternatively, you can also convert the set to a tuple to avoid the TypeError: 'set' object is not subscriptable:

my_tuple = tuple(my_set)

Let’s end this article with a bit of humor, shall we? ?

Programmer Humor


There are only 10 kinds of people in this world: those who know binary and those who don’t.
??‍♂️
~~~

There are 10 types of people in the world. Those who understand trinary, those who don’t, and those who mistake it for binary.
??‍♂️?‍♀️



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

Print this item

  (Indie Deal) Movie Quest Giveaways, Frontier & Ubisoft Sales
Posted by: xSicKxBot - 09-11-2022, 08:12 AM - Forum: Deals or Specials - No Replies

Movie Quest Giveaways, Frontier & Ubisoft Sales

Movie Quest Giveaways
[www.indiegala.com]

https://www.youtube.com/watch?v=icC3BbrxRQI
[www.indiegala.com]
[www.indiegala.com]
https://www.youtube.com/watch?v=jvYSjvibfm4


https://steamcommunity.com/groups/indieg...7417618431

Print this item

  News - Best NBA 2K23 PFs: Top Power Forwards By Rating
Posted by: xSicKxBot - 09-11-2022, 08:12 AM - Forum: Lounge - No Replies

Best NBA 2K23 PFs: Top Power Forwards By Rating

NBA 2K23 is finally here, which means it's time to discuss the league's best power forwards. Barkley or Malone? Duncan or Webber? Dirk or Gasol? This year's list of NBA strong forwards has a lot more talent than you think and with Paolo Banchero being the Rookie Of The Year favorite, we wanted to find out the answers for ourselves. 2K23 ratings are in the wild and if you're curious about who's on the rise, here's everything you need to know about the 10 Best power forwards in NBA 2K23.

For more on NBA 2K23, check out our MyNBA Eras preview and the 2K23 ratings hub.

NBA 2K23: Top 10 Power Forwards

Below is Visual Concepts' in-game list of the best strong fours in NBA 2K23:

Continue Reading at GameSpot

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

Print this item

  PC - Teenage Mutant Ninja Turtles: The Cowabunga Collection
Posted by: xSicKxBot - 09-11-2022, 08:12 AM - Forum: New Game Releases - No Replies

Teenage Mutant Ninja Turtles: The Cowabunga Collection



Teenage Mutant Ninja Turtles: The Cowabunga Collection assembles thirteen classic TMNT games by KONAMI in one incredible package. This collection provides a unique opportunity for gamers to experience these immensely popular and very influential games on modern consoles and includes a fantastic set of new quality of life features:

* Added Online Play for certain games and Local Couch Play
* Save Anytime and Rewind
* Eleven Japanese Regional Versions
* Button Mapping
* Unique Development Art & Sketches
* Historic TMNT Media Content

The games are based on the characters and themes based on the 80's children's cartoon and comic book series, The Teenage Mutant Ninja Turtles. The game often takes place in a fictionalized New York City, in the sewers, inside futuristic enemy bases and even across time itself!

Publisher: Konami

Release Date: Aug 30, 2022




https://www.metacritic.com/game/pc/teena...collection

Print this item

  How to Join a Bedrock/Java Edition Server on Console/Xbox/Switch/iOS/Android
Posted by: SickProdigy - 09-10-2022, 11:04 PM - Forum: Minecraft - Replies (1)

Overview:
One of the biggest perks for playing on Bedrock or a Java server with Geyser is the potential for cross-play. Bedrock players can join any server running GeyserMC or Bedrock Edition from any console. Most people know this already from playing on PC and PocketEdition, but the process for joining from a Switch or an Xbox requires a few extra steps. Here is a complete breakdown of how to join a Bedrock server from Xbox and Switch so you can join your friends online.
 
How to add a Minecraft Server on Xbox:
Joining on Xbox Requires you to change your connection settings. Doing this will give you a new menu from the server page in your game to add a new server. These settings should not affect online play for other games, but you can reset them at any time should you choose to do so.

  1. Open your Xbox settings and select the Network Settings option.
    [Image: Discord_aFjEAuVwo5.jpg]
  2. Go to Advanced Settings and choose the DNS Settings option.
  3. Select Manual and you will be taken to a screen to manually enter your DNS settings
    [Image: Discord_ZsEos8p6Wf.jpg]
  4. For the Primary IPv4 DNS enter:
    Code:
    104.238.130.180
  5. For the Secondary enter either:
    Code:
    8.8.8.8
    or
    Code:
    1.1.1.1
    [Image: image_2021-10-05_161444.jpg]
  6. Save the changes and the console will perform a connection test
 
How to add a Minecraft Server on Nintendo Switch:
The process for joining from Switch is almost identical to setting up on Xbox. You can use the same basic settings used in the Xbox setup. You will also receive the exact same menu to join new servers in the game. These settings should not affect online play for other games, but you can reset them at any time should you choose to do so.
  1. Go to your System Settings and scroll down to the Internet option
  2. Click on the Internet Settings option, choose your current network, and click on Change Settings
  3. Scroll down to the DNS Settings and change it to Manual
  4. For the Primary DNS enter:
    Code:
    104.238.130.180
  5. For the Secondary enter either:
    Code:
    8.8.8.8
    or
    Code:
    1.1.1.1
  6. Save the changes and you are ready to go.
 
Joining the game:
Once you get your connection settings saved you can go ahead and open the game. From there the process to join a server is the same regardless of the console you are using.
  1. Click on Play and go to the Servers tab
  2. Click on any of the pre-added servers on the list
    [Image: bedrock-server-list.png]
  3. A new menu will appear when you try to join the server
    [Image: add-bedrock-server-1.png]
  4. Choose the Connect to a Server option at the top of the screen
    [Image: add-bedrock-server-2.png]
  5. Enter the Address and Port of the server you want to join
  6. Choose the “add to server list” option to add it to your list, then click Submit
 
Common Issues:
Unable to connect to world:
This is an unfortunately common issue for Bedrock servers. There are not many sure-fire ways to resolve this issue, but here are our recommendations:
  1. Restart your console
  2. Restart your server
  3. Make sure both your game/console and the server are fully updated
  4. If you are using a Java server with Geyser, make sure you have the latest version of the plugin installed and configured correctly. Also make sure you have Floodgate and ViaVersion installed on the server as well.
  5. Change your secondary DNS from
    Code:
    8.8.8.8
    to
    Code:
    1.1.1.1
    or vice versa
 
The add server menu doesn’t appear:
Change your secondary DNS from 8.8.8.8 to 1.1.1.1 or vice versa. In most cases, switching will allow the menu to pop up as normal.
Wow this server is popular:
This error usually means that the server has too many people on it, or too many connection attempts have been made at once. If you believe that you are getting this in error though, the quickest and easiest way to fix it is to either wait a few minutes, or to just restart the server. The problem will go away once the server comes back up or is no longer getting so many connection attempts at once.
You should also consider raising the player cap of your server from the control panel if you have it set to a low number like 2 or 3.
 
You are not invited to this server:
That means that the whitelist on the server is active. You will need to contact the server’s owner to get added to the whitelist, or disable it altogether. We have a guide available that goes over how whitelisting works and how it can be enabled/disabled.
Please note that if you are using a Java server with Geyser you will need to put a * before a player’s name when adding them to the whitelist. Ex:
Code:
/whitelist add *iVestri
instead of just
Code:
/whitelist add iVestri


Looking for a Bedrock/Java server to join?

Checkout McEcon

Java IP: mcecon.sickgaming.net:25565 (note* you don't really need port)
or
Bedrock IP: mcecon.sickgaming.net:19132

Print this item

  [Tut] Python Convert Image (JPG, PNG) to CSV
Posted by: xSicKxBot - 09-10-2022, 12:05 PM - Forum: Python - No Replies

Python Convert Image (JPG, PNG) to CSV

5/5 – (1 vote)

Given an image as a .png or .jpeg file. How to convert it to a CSV file in Python?

Example image:


Convert the image to a CSV using the following steps:

  1. Read the image into a PIL.Image object.
  2. Convert the PIL.Image object to a 3D NumPy array with the dimensions rows, columns, and RGB values.
  3. Convert the 3D NumPy array to a 2D list of lists by collapsing the RGB values into a single value (e.g., a string representation).
  4. Write the 2D list of lists to a CSV using normal file I/O in Python.

Here’s the code that applies these four steps, assuming the image is stored in a file named 'c++.jpg':

from PIL import Image
import numpy as np # 1. Read image
img = Image.open('c++.jpg') # 2. Convert image to NumPy array
arr = np.asarray(img)
print(arr.shape)
# (771, 771, 3) # 3. Convert 3D array to 2D list of lists
lst = []
for row in arr: tmp = [] for col in row: tmp.append(str(col)) lst.append(tmp) # 4. Save list of lists to CSV
with open('my_file.csv', 'w') as f: for row in lst: f.write(','.join(row) + '\n')

Note that the resulting CSV file looks like this with super long rows.


Each CSV cell (column) value is a representation of the RGB value at that specific pixel. For example, [255 255 255] represents the color white at that pixel.


For more information and some background on file I/O, check out our detailed tutorial on converting a list of lists to a CSV:

? Related Tutorial: How to Convert a List to a CSV File in Python [5 Ways]



https://www.sickgaming.net/blog/2022/09/...ng-to-csv/

Print this item

  [Tut] JavaScript Copy Text to Clipboard
Posted by: xSicKxBot - 09-10-2022, 12:05 PM - Forum: PHP Development - No Replies

JavaScript Copy Text to Clipboard

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

This example script in JavaScript is to copy text to the system clipboard. I am presenting three different methods in this tutorial.

  1. Via ClipBoard API.
  2. Using document.executeCommand (not recommended).
  3. By user consent.

This JS quick example uses the first and the best method to copy content of a textarea to the clipboard.

Quick example


var contentToCopy = document.getElementById(text_to_copy).value;
navigator.clipboard.writeText(contentToCopy).then(function() { console.log('Copied to clipboard with async.');
}, function(err) { console.error('Unable to copy with async ', err);
});

HTML textarea element from where the content is copied by the JS script.

<textarea id="text_to_copy">Text to copy</textarea>

javascript copy clipboard

1) Using The Clipboard API


Below HTML script gives an interface with a textarea and a button to trigger the copy action.

On clicking the button to call the JavaScript copyToClipBoard() function. This function moves the textarea content to the clipboard.

index.html

<html>
<head>
<title>JavaScript Copy Text to Clipboard</title>
<script src="copy-clipboard-async.js"></script>
<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<link rel='stylesheet' href='style.css' type='text/css' />
<link rel='stylesheet' href='form.css' type='text/css' />
</head>
<body> <div class="phppot-container"> <h1>JavaScript Copy Text to Clipboard</h1> <div class="row"> <div class="message-input"> <label for="message-input">Message: </label> <textarea id="message-input" rows="15" name="message-input" class="message-input"></textarea> </div> </div> <div class="row"> <button on‌click="copyToClipboard('message-input')" type="button">Copy to clipboard</button> </div> <div class="row"> <div id="copied"></div> </div> </div>
</body>
</html>

This JS script writes the text to the clipboard by calling clipboard.writeText(). It enhances the quick example by providing an interface to copy content via ClipBoard API.

copy-clipboard-async.js

/** * to copy to the clipboard using the Clipboard API * * @param element * @returns */
function copyToClipboard(element) { var contentToCopy = document.getElementById(element).value; navigator.clipboard.writeText(contentToCopy).then(function() { console.log('Copied to clipboard with async.'); }, function(err) { console.error('Unable to copy with async ', err); });
}

2) document.execCommand


This method was widely used to copy content by calling the executeCommand(“copy”). It is deprecated but still supported by many browsers.

It dynamically appends the textarea element to the HTML body and selects its content using JavaScript. Then the executeCommand() function call triggers the copy action.

copy-clipboard-execcommand.js

/** * to copy to the clipboard using the document.execCommand * * @param element * @returns */
function copyToClipboard(element) { var contentToCopy = document.getElementById(element).value; var temp = $("<textarea>"); $("body").append($temp); temp.val(contentToCopy); temp.select(); document.execCommand("copy"); temp.remove(); console.log('Copied!');
}

3) Copy by user


This is the safest method of copying the content to the clipboard. This does not use any native function of the JavaScript and can be described more of a process. It prompts the user to confirm copying the selected content to the clipboard.

copy-by-user-consent.html

<html>
<head>
<title>JavaScript Copy Text to Clipboard</title>
</head>
<body> <!-- In this style, we present the control to the end user to copy. --> <!-- Text to be copied is shown to the user and he uses the built-in browser's feature and copies to the clipboard. --> <!-- If this is possible to use in your use case, then this is the safest method. --> <button id="copy-btn" on‌click="copyToClipboard(document.getElementById('copy-btn').innerHTML)">Text to copy.</button> <script> function copyToClipboard(text) { window.prompt("Press Ctrl+C to copy to clipboard.", text); } </script>
</body>
</html>

Download

↑ Back to Top



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

Print this item

  (Indie Deal) Supernatural Tales Bundle, Truck Sim, new sales & more
Posted by: xSicKxBot - 09-10-2022, 12:04 PM - Forum: Deals or Specials - No Replies

Supernatural Tales Bundle, Truck Sim, new sales & more

Supernatural Tales Bundle | 8 e-books | 93% OFF
[www.indiegala.com]
Summer season is nearly over...but it is never too early for Halloween Fall season! Get your supernatural senses ready, for a collection of books that defies the law of nature: Madison Dark, Fractures, Bayou Arcana, Ritual 2: The Resurrection & the Alpha Gods series with Betrayal, Emergence, Omnibus & Revelation.

https://youtu.be/gnphAVXFYYw
SCS Software Sale, Euro/American Truck Simulator Deals
[www.indiegala.com]
https://www.youtube.com/watch?v=CdzM2b9NnnY
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...7412188898

Print this item

  News - Star Wars Andor Spin-Off Gets Nine-Minute Extended Look
Posted by: xSicKxBot - 09-10-2022, 12:04 PM - Forum: Lounge - No Replies

Star Wars Andor Spin-Off Gets Nine-Minute Extended Look

Disney's annual Disney+ Day has arrived with a lot for Star Wars fans to enjoy, especially a special look at Andor that's nine minutes long. It's the longest preview we've had at the series so far, and you can watch it now over at Disney+, and gives new details about the story.

We now know that the timeline for Andor takes place five years before the events of Rogue One and confirms what we figured out is that it also acts as an origin story for Cassian Andor from a child of war to an eventual member of the Rebel Alliance.

"Andor is how a revolutionary is born," said star Diego Luna in the Disney+ featurette. "And the beauty of this show is that it commits to a perspective and a point of view. You can tell that there is that integrity behind this character."

Continue Reading at GameSpot

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

Print this item

  PC - Tinykin
Posted by: xSicKxBot - 09-10-2022, 12:04 PM - Forum: New Game Releases - No Replies

Tinykin



Milo arrives on Earth to find that he's way too small, everybody's gone and a day hasn't passed since 1991!

Catch hundreds of mysterious tinykin and use their unique powers to create ladders, bridges, explosions and a lot more!

Find a way home through a sprawling ant-sized metropolis, and unravel Earth's biggest mystery!

Publisher: tinyBuild

Release Date: Aug 30, 2022




https://www.metacritic.com/game/pc/tinykin

Print this item

 
Latest Threads
௹©Ukraine Shein COUPON Co...
Last Post: udwivedi923
8 hours ago
௹©Morocco Shein COUPON Co...
Last Post: udwivedi923
8 hours ago
௹©USA Shein COUPON Code ...
Last Post: udwivedi923
8 hours ago
௹©Armenia Shein COUPON Co...
Last Post: udwivedi923
8 hours ago
௹©Brazil Shein COUPON Cod...
Last Post: udwivedi923
8 hours ago
௹©South Africa Shein COUP...
Last Post: udwivedi923
8 hours ago
௹©Moldova Shein COUPON Co...
Last Post: udwivedi923
8 hours ago
௹©Malta Shein COUPON Code...
Last Post: udwivedi923
8 hours ago
௹©Luxembourg Shein COUPON...
Last Post: udwivedi923
8 hours ago
௹©Kazakhstan Shein COUPON...
Last Post: udwivedi923
8 hours ago

Forum software by © MyBB Theme © iAndrew 2016