Everything posted by Sensei
-
Puzzle for the Day
General advice @Genady if you write an answer to a puzzle, use the [ spoiler ] tag to hide it.. (spoiler option is the eye icon on a desktop computer)
-
Understanding 'Self' and Python instance creation
"self" does not have to be called self in Python. It can be anything that is not a reserved word. "self" is the Python equivalent of "this" from other languages such as C++ or Java: https://en.wikipedia.org/wiki/This_(computer_programming) In other words, it is a pointer/holder/reference to the object's data. Each new instance will have a different set of data, pointed to by "this"/"self". https://www.w3schools.com/python/gloss_python_self.asp class Person: def __init__(mysillyobject, name, age): mysillyobject.name = name mysillyobject.age = age def myfunc(abc): print("Hello my name is " + abc.name) p1 = Person("John", 36) p1.myfunc() "mysillyobject" and "abc" are equal to "p1" in the above code. The above code in C++ could look like: #include <iostream> class Person { private: std::string name; int age; public: Person( const std::string name, int age ) { this->name = name; this->age = age; } public: void myfunc() { std::cout << "Name: " << this->name << std::endl; std::cout << "Age: " << this->age << std::endl; } }; int main() { Person *p = new Person( "John", 36 ); p->myfunc(); return( 0 ); } C++ allows you to omit "this". "this" is the default for the object's local variables (i.e. name and age). But since I used these words as constructor parameters, I have to use "this" to differentiate them. I could write: public: void myfunc() { std::cout << "Name: " << name << std::endl; std::cout << "Age: " << age << std::endl; } And the C++ compiler would know that "name" is equivalent to "this->name", and "age" is equivalent to "this->age". It's different in Python and "self" is obligatory.
-
Puzzle for the Day
..talk to like a five year old child..
-
Nature needs chaos -Rewiggling Swindale Beck
...people's general understanding of nature.... i.e. if you go to such a place and straighten the river, you don't understand nature, or you understand and know you are doing something wrong.. which can end in disaster.. In a capitalist country? That's not possible.. In a capitalist country everything revolves around money.. Want to reduce the amount of CO2 in the atmosphere? They introduced taxes on CO2.. WTF? WTF!!! Now they are fighting 1) themselves, 2) the mobsters who abused the system, 3) the financiers/bankers (they bought certificates when they were cheap and sold them when they were expensive - any normal capitalist would have done the same thing)! A tax to solve the problem? If a politician is a criminal and wants to steal state money, they will solve the problem by introducing a tax, a fine, a penalty.. They only introduce more problems than they solve.. If you put someone in jail, then jail is a punishment, imprisonment and a fine is not punishment, it is creating more criminals in the future.... A incriminated person is only able to get the lowest paying jobs, so he/she is unable to pay the fines. After getting out of prison, he/she has to become a professional criminal just to pay the fines.. Welcome to the U.S.A.. (In Russia it was worse, they were sent to fight and died).
-
Nature needs chaos -Rewiggling Swindale Beck
@StringJunky To some extent I agree with you - people want land for farms.. The land around rivers is the best, with many nutrients provided over centuries.. So people are trying to regulate rivers so they flow straight instead of meandering.. For months, years, or a dozen years, it can work. But when the water is too much and flows too fast (because it no longer meanders), flooding occurs.. and this is the result of actions of human-politics-idiots done dozen years earlier.. They are dead, or almost dead retires and result of their action is death of people in the future..
-
Puzzle for the Day
Thx. Because the question from the beginning was failure (ambiguous).. does not say that each number (=letter) must be used only once.. For a human reading it was obvious.. Repeat. But give hints, that the answers are wrong i.e. TxxTx, so 5th and 2nd letters must be the same etc. etc. Imagine being a ChatGPT teacher.. Let's see where we/you get to..
-
Puzzle for the Day
@Commander
-
higher CO2 means nutrient dilution in plants
In nature, the faster plants grow, the more the soil is depleted of nutrients (which have not changed/increased accordingly to CO2 levels).. In agriculture, to prevent resource depletion ( https://en.wikipedia.org/wiki/Slash-and-burn ) man first invented crop rotation: the two-field system, then the three-field system, then the four-field rotations. https://en.wikipedia.org/wiki/Crop_rotation https://en.wikipedia.org/wiki/Three-field_system Letting cows, pigs, chickens eat directly from the field is good for it because they poop and pee on it, giving up nutrients back.. ps. The next level is hydroponics in skyscrapers.. where you can control the amount of water and nutrients, temperature, pressure, have an environment free of parasites and pests.. unused nutrients and water are reused (not wasted as in current agriculture) ..they could simply ask any farmer from the 20th century..
-
Laws of definite and multiple proportions
14.13 g carbon / 12.011 g/mol = 1.18 mol of Carbon 2.96 g hydrogen / 1.008 g/mol = 2.937 mol of Hydrogen 2.937 / 1.18 = ~ 2.5 i.e. proportions are 5 Hydrogen atoms to 2 Carbon atoms.
-
Puzzle for the Day
There is a second possible answer: 76928+70475=147403 And here is the source code in C/C++. Not very optimal (it takes ~ 9 seconds for my laptop to go through all the combinations). This is an easy algorithm to convert to multithreading, multi-cpu or GPU. // puzzle (c) 2023 Sensei // // Compile (Linux): // gcc puzzle.c -o puzzle // #include <stdio.h> int get_digit( int value, int index ) { while( index > 0 ) { value /= 10; index--; } return( value % 10 ); } int same( const int *digits ) { if( digits != 0 ) { int value = digits[ 0 ]; if( value != -1 ) { for( int i = 1; digits[ i ] != -1; i++ ) { if( value == digits[ i ] ) return( 1 ); } return( same( digits + 1 ) ); } } return( 0 ); } int main( void ) { int count = 0; for( int i = 0; i < 200000; i++ ) { int u = get_digit( i, 4 ); if( u == get_digit( i, 2 ) ) { int f = get_digit( i, 5 ); int t = get_digit( i, 3 ); int r = get_digit( i, 1 ); int e = get_digit( i, 0 ); int buf[ 11 ]; buf[ 0 ] = f; buf[ 1 ] = u; buf[ 2 ] = t; buf[ 3 ] = r; buf[ 4 ] = e; buf[ 5 ] = -1; if( !same( buf ) ) { for( int j = 0; j < 100000; j++ ) { int k = i - j; if( k < 0 ) continue; if( k >= 100000 ) continue; if( ( t == get_digit( j, 4 ) ) && ( r == get_digit( j, 3 ) ) && ( u == get_digit( j, 2 ) ) && ( t == get_digit( j, 1 ) ) ) { int h = get_digit( j, 0 ); if( t == get_digit( k, 4 ) ) { int o = get_digit( k, 3 ); int d = get_digit( k, 2 ); int a = get_digit( k, 1 ); int y = get_digit( k, 0 ); buf[ 5 ] = h; buf[ 6 ] = o; buf[ 7 ] = d; buf[ 8 ] = a; buf[ 9 ] = y; buf[ 10 ] = -1; if( !same( buf ) ) { count++; printf( "%d+%d=%d\n", k, j, i ); } } } } } } } printf( "%d\n", count ); return( 0 ); } Feel free to modify it to generate such quizzes - get the word dictionary from, for example, /usr/share/dict/words, on Linux.
-
Use it or loose it ?
Study humanists, and you will not even be aware of the changes around you.. The girls in the store are always amazed when I tell them they made a mistake.. and gave me too much money.. ..Sorry, I don't understand you? Can you use ChatGPT to translate it for me, please?
-
Puzzle for the Day
Let's cheat: ask ChatGPT what the correct answer is.. ps. But be quick... very fast... until I give you the C/C++ source code that generates all the results..
-
War Games: Russia Takes Ukraine, China Takes Taiwan. US Response?
Degenerates from army industry are like "on safari" (a quote from "The Mayor of Kingstown"), on either side of this equation.. don't be happy about the extra money you make..
-
How does ChatGPT work?
Look at the mirror.. Aren't you AI... ? If you are playing chess and you say "let the AI play," it will play the most optimal way found at the time.. Same chessboard, same (optimal) movements.. You play tic-tac-toe.. and it's always the same.. There are not many ways to win the game..
-
Is it posible to create DNA personalized sequence ?
This sentence makes no sense whatsoever. The genetic code is now being used to identify people who have committed crimes. So if someone has your DNA they can frame you.. People with money can buy specialized (personal) gene therapy. Poor people can't. So it is economical discrimination. ps. Nothing new..
-
Red Cabbage indicator
Have you seen the ocean world map? https://www.google.com/search?q=seawater+world+map+ph
-
Using VPS to bypass the internet cencorship
@Saber You don't need to understand.. all you have to do is follow the 4 minute video tutorial..
-
Using VPS to bypass the internet cencorship
To configure a VPS, or dedicated server, you need to connect to it. On Linux, this is done via SSH (hence the need to install Linux, or run it from a Linux Live flash drive - which I described in a previous post). However, there is a tool for Windows that you can use PuTTY. Tutorials on how to use PuTTY: https://www.google.com/search?q=how+to+use+putty For an example, watch this 4-minute video:
-
Using VPS to bypass the internet cencorship
Setting up OpenVPN is a much more challenging task than Tor and proxychains, which I suggested.. ..if you have VPS, and ANY internet works.. then it will work.. ..if not.. you have to grab satellite i.e. Musk's.. I have asked many questions and received no answers from you.... ..but you should have followed the instructions and not read them twice....
-
Definition of particle and black hole
...United States budget? ;) The black hole sucks everything they can get, just like any government..
-
What is the technical term for direct connection ?
WiFi Direct https://en.wikipedia.org/wiki/Wi-Fi_Direct The smartphone can be configured to create hotspots, which can be found by other devices. I am using it all day long. https://en.wikipedia.org/wiki/Tethering
-
Schools treating parents as customers
.the real problem is with doctors who want (too much) money.. You want to help people. Or you want their money.. You can't treat people and steal their money at the same time.. Hundred thousands or millions of dollars for "experimental therapy" or "terminally ill" person? Your PhD is dismissed.. Don't complain at the police station you cannot log in to your banking accounts etc.. @StringJunky We will have to remember not to respond to Erina threads next time.. I upped completely undeserved downvote.. ..which governmental, once-created institution does not want more public money next year than it got last year? Which one? People are thieves.. Just leave your smartphone in an apartment with multimillionaires.. I used to make fun of them, and put the latest iPhone in the trash at the bottom and covered it..
-
Schools treating parents as customers
In a capitalist country? .... In which country? ... In a communist country? Make an non ambiguous request.. then you might be satisfied..
-
Schools treating parents as customers
What?! I am the last being in the universe who could talk about such nonsense as philosophy.. Seriously.. ? Seriously deadly seriously..? According to your ex-POTUS.. must have a gun... https://www.bbc.com/news/world-us-canada-43149694 More deadly seriously: In the US? Don't get shot? ...except the US is not the world.. what you want to talk..
-
Schools treating parents as customers
A free of charge state school can be good or evil. Evil if it indoctrinates young people, brainwashes them, presents them with an alternative version of reality and turns them into supporters of their chosen politicians (i.e. world vision of these politicians). Mass production of slaves.. Paid school can be good or evil. Evil if it discriminates against people because the amount to be paid is too high for most people to bear. A loan of a dozen or a hundred thousand dollars for a 25-year-old? Seriously? Mass production of slaves.. ps. Paid is not free from indoctrination (i.e., the worldview of these teachers).. ps2. Free is not free from discrimination based on parental wealth either..