Jump to content

Sensei

Senior Members
  • Posts

    7956
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by Sensei

  1. Show source code... Whenever a programmer uses a division operator with a non-static denominator he/she must catch a divide by zero in advance or exception. *) The code in C/C++ e.g. double a, b, c, d; // initialized double e = a * b / ( c * d ); is incorrect/wrong since the beginning. It should be: double a, b, c, d; // initialized double x = c * d; // temporary variable double e = ( x != 0 ) ? a * b / x : DBL_MAX; (alternative to DBL_MAX are https://stackoverflow.com/questions/5834635/how-do-i-get-double-max or https://stackoverflow.com/questions/8690567/setting-an-int-to-infinity-in-c or https://en.cppreference.com/w/c/numeric/math/INFINITY ) Whether dividing by zero is treated as dividing by a very small value (leading to the result of infinity) depends on the context... *) not obeying this rule will lead to random application crashes..
  2. ..but do you know that the most of modern computers don't even have HDD.. ? practically the all sold laptops in shops have SSD and NVMe storages.. SSD is 10x faster (550 MB/s) than HDD (55 MB/s) NVMe (1500-3500 MB/s) can be 30-60x faster than HDD..
  3. In different languages, the same task is performed in different ways.. Sometimes differences are cosmetic. Sometimes they are gigantic (alteration of the entire algorithm).
  4. "SQL (Structured Query Language) is a standardized programming language that's used to manage relational databases and perform various operations on the data in them. ... SQL became the de facto standard programming language for relational databases after they emerged in the late 1970s and early 1980s." SQL is not a general purpose programming language. You must have code that opens the database, creates a table, inserts records, queries records, deletes records, modifies records, and closes it. MySQL is typically used from server-side PHP, Java, Python etc. or client-side JavaScript. SQLite is typically used from Android's Java/Kotlin/Xamarin. It is possible to make changes to the SQL database from the db admin panel by manually typing your own SQL commands. e.g. mysqladmin for MySQL: https://dev.mysql.com/doc/refman/8.0/en/mysqladmin.html Any serious web-hosting company installs such a SQL admin panel, accessible from the HTTP server, to access the database in emergency situations. It is usually used for database backups.
  5. The density of muscle is ~1.1 g/cm^3. The density of fat is ~0.9 g/cm^3. 1.1/0.9 = ~1.22 ratio (+22%). A person with the same height, same weight, but an athletic body, can have a much smaller body volume than a person with the same properties but with fat instead of muscles. BMI does not include this information. Therefor the BVI (Body Volume Index) was introduced. https://www.google.com/search?q=body+volume+index "How do you calculate BVI? BVI was defined as total body volume/height^2 (L/m^2)."
  6. Please calculate the influence of a distant cosmic object using the inverse-square law: https://en.wikipedia.org/wiki/Inverse-square_law
  7. I used the word "endpoint" to make distinction from a control point that not lie on the bezier curve. I made these four beziers (on the left), it has four endpoints (as you can see), and some control points flying in a void (the curve does not go through them *), and frozen to polygons version (on the right). *) they can be disconnected ("unweld" tool in 3D app), and instead of 4, we will have 8 of them.. Is this what you want to achieve? (and you call it "Bezier patch"?) Are you doing it in some programming language like C/C++ with OpenGL/DirectX for visualization? Routine can look like: freeze each bezier to well-defined number of points and interpolate frozen points.
  8. OK. I used a 3D application to visualize it in 2 dimensions. Below we can see 3 beziers. A straight line (just to visualize) is going from the control point of the 1st bezier, then through the endpoint shared by 1st and 2nd bezier, then to the control point of the 2nd bezier. A bezier patch must be created from four beziers, which have 4 endpoints and 8 control points. Move the control points so as to break the straight line (slope) between them, and you will lose smoothness:
  9. A bezier consists of two endpoints and two control points. The endpoint from one bezier must be in the same position as the endpoint from the other bezier. The control point-endpoint line from one bezier must form a straight line with the control point-endpoint from the other bezier. An equal slope means a smooth transition between patches.
  10. Maybe this technique you will find interesting: https://www.youtube.com/watch?v=ndFdPd6GaHQ
  11. ..my distribution of Linux has tools to scan WiFi, intercept encoded passwords, and then decode them.. Worse. Every app has some tools that are useful to someone, but 99.99% of users have no idea about them and/or have never used them (because they only focus on the one they learned). Should these tools be removed from the app? This would reduce bandwidth for 99.99% of users. Plugins to download with the tools and/or pay for each tool independently. This is the direction the IT world is heading, i.e. you only buy a subscription for a month, quarter, year or more, and/or pay multiple times each time you need it e.g. in-app purchases are now common in games. A free game with items to be bought in-app. The effect is that the user has to pay much more at the end, and the IT company gets a flood of money long after the product is released.
  12. Windows 11 looks better than Win 10.. It can run Android apps directly on your PC! https://blogs.windows.com/windows-insider/2021/10/20/introducing-android-apps-on-windows-11-to-windows-insiders/
  13. Be nice, lab mouse! ps. I am debugging my code.. then will restart.. again..
  14. Not only. When you whisk an egg white, it turns a white color without any cooking. ps. Have you started pumpkin season yet? I made a pumpkin pie last week. You need: a cup (i.e. 250-300 mL) of oil, a cup of sugar, a cup of pumpkin, 250g of flour, 3 eggs, a teaspoon of baking soda, a teaspoon of baking powder, and eventually a teaspoon of cinnamon and/or vanilla/vanillin sugar. Whisk the egg white, blend the rest, join with egg white and to 40 minutes to the oven. Takes less time of work than me writing this recipe..
  15. Apart from what @Ghideon said: You have missing semicolons in several places. Groovy online interpreter accepts it, but it will learn you bad habits. 'slope' and 'intercept' are nowhere declared and then used as either variable and as method/function name and also nowhere declared.. My fixed version which passes through online Groovy interpreter: https://www.tutorialspoint.com/execute_groovy_online.php Looks like: /* Hello World in Groovy */ double slope( double a, double b ) { return( a ); } double intercept( double a, double b ) { return( a ); } double simple_regression(double dependend_values, double independend_values, double x_test) { double slope = slope(dependend_values, independend_values); double intercept = intercept(dependend_values, independend_values); return intercept + slope * x_test; } But you will need to fill slope() and intercept() with proper functionality. SimpleRegression java class from: https://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/stat/regression/SimpleRegression.html doesn't have addData() without parameters..
  16. Sounds like dilution of shares. https://www.google.com/search?q=dilution+of+shares If you have an array/list of integers. Sum them together ("total"). For each one list[index] × 100 / total is percentage of shares. Give some more shares list[index] += new_shares Make a copy of array/list and repeat calculation of percentages. Divide new percentage by old percentage for each entry. They can be <1, =1 or >1. Sort them to learn who gained the most and who lost the most. In the real world it is a more complicated because shares can be voting and non-voting i.e. voting minority (or unaware shareholders) can dilute larger shareholders and screw them up (not nicely. Facebook is an example). Also people can buy, sell or receive options. Usually insiders like management and employees. Typically with restrictions.
  17. We are not talking about the usefulness of a thing 1st world citizen poses and why it is a must have for you. I am certain that even Queen or King of the UK or a billionaire would give us some good reasons why they have dozen of cars in the garage and/or jet planes (how they could get fresh French buns in rural house for breakfast after all?!).. We are talking about how to reduce our carbon footprint.. You firstly do actions which 10x increase your carbon footprint and then wonderfully taking step back (or talking about) actions with 1x influence giving overall 9x.. To me, some of you here, are simply mocking from it, or from me, or from global warming and ecology.. Statistical double or triple the usage of energy by average US citizen per capita, than in EU, and much more than the rest of world, didn't come from nowhere..
  18. ...(or) I will end up this madness...
  19. Housing is the US looks like: give cheap credit to NINJA's, who can't paid them back, harvest them to the last penny.. then take house and land.. then disintegrate it.. and give new credits to new people (NINJA-to-be), to buy new buildings-to-be in the same place... Increase rates, and you can repeat it, once again.. ps. Not without a reason there are afraid of my attendance..
  20. Not without a reason I have a facepalm on my face in my profile photo... It appears you understood nothing from this thread.. US has 290 mln registered cars with population 330 mln people, which gives 0.88 per capita. e.g. France had 32 mln registered cars (2019) with population of ~67.4 mln people, which gives ~0.48 per capita. e.g. Germany had 47 mln registered cars (2019) with population of ~83.2 mln people, which gives ~0.57 per capita. Now you go to a thread where we are discussing "how to reduce our carbon footprint" and saying "we are US citizens, we have three cars"... when even two would be too much, per citizen.. where people are talking about too much packaging of toys which are problematic for environment in their simplified view.. Now, show where are you keeping them, in garage, for three (do you have more space for 4th one? Don't you need 4th one? Not possible! Some US are unmet! Buy a new bigger house with more garage space.. that's the way many US/world citizens think, more, more and MORE!) Your comment was kinda like spitting on face of the all people who are bothering about global warming, resource saving, energy saving, planet saving.. ps. If I would be talking to billionaire, he/she would say to me . <Monty Python mode turn on>"My wife/husband and I have three jet planes between us. We would be hard pressed to use the same amount of fuel in the third jet plane as we use in the first two, as we can only fly one jet per person at a time. About the only waste of extra resources is the money we have to spend on insurance for the third jet.".. </Monty Python mode turn off> ps2. I don't have refrigerator in my apartment.. it was shutdown 5 years+ ago..
  21. As I said earlier, these are examples of meaningless (seriously, how often do you buy gifts/toys in a year?), insignificant efforts per average person, only diminishing the actual waste of energy and/or resources. They only look large when multiplied by the total population. Their impact can be obtained by analyzing the production and sales of toy industry. You should waste more time, on proper identification of places were something can be done and have larger overall influence. Otherwise, it is just a pretended ecological action with no significant results at the end.. For example, US has population of 330 mln people (including children (73mln @ 2019), elders, car-less, homeless, paralyzed, ill, etc. etc.), has 290 mln registered cars, So basically, there is a group of people owning 2+, 3+ cars, and wasting double+ amount of fuel and resources, everything a car needs from the engineer's drawing board to the street and daily use. These 290 mln cars consume 338 million gallons per day https://www.statista.com/statistics/188448/total-us-domestic-demand-for-gasoline-since-1990/ Replacing engines in old cars with more modern, economical versions would give a greater impact... The current approach is: buy a new car (which makes automotive industry happy). And sell the old one (which makes automotive industry unhappy). So it's still in the market. But that 1st market is a poorer person, then a 2nd country like Mexico, then a 3rd world country. While the car engine continues to use more and more fuel (for 20 years or more).. Proper pro-ecological action can be e.g. design modern economical (electrical?) engine which is compatible with old car design, and can be easily replaced with little costs/DIY. Debatable.. The problem is that power plants, gas and fuel stations, etc. have their costs. If all the people in the country suddenly start cutting back on electricity use by e.g. -20% *), gasoline use etc., then these companies, in order to survive and keep money flowing to them (and eventually their employees), will raise the prices of their products by +25%.. The poorest people, at the end of the current economic food chain, are always the most screwed.. Therefore there is ground for appearance of anti-ecological movements, global warming deniers, who are upset by the costs paid by the poorest people, while the richest are still flying in the sky by their private jets.. *) after purchasing my watt-meter, I reduced my electrical power consumption by 60% (at least on bills)....
  22. Start with a proper analysis of your home energy consumption, as I showed in this thread. Analyze your daily routines to find the most significant energy and resource wastages. e.g. drinking coffee, tea, water etc. daily from disposable cups has hundreds of times higher the weight of the reusable pill boxes mentioned by others.. Every programmer starts code optimization with the tasks that take the most CPU time. Optimizing infrequently called code will only waste time, giving negligible benefit.. and the erroneous illusion of progress.. I hope you see the analogy.. I'm wearing a jacket I bought in the '90s.. Some people wear once and throw away. I don't understand that. If you did not like the cloth, why did you buy it in the first place? Shopping online has only increased the wastages. I would never buy clothes through Internet. It must fit well, have good dimensions, the appropriate texture etc. etc. Compulsive shopping is unknown for me, but loved by corporations and sellers..
  23. Petroleum products are carcinogenic.. https://www.google.com/search?q=Petroleum+products+are+carcinogenic
  24. When I bought a new digital watt-meter *) approximately ~7 years ago, and started checking every device one by one in the apartment, I identified several such devices in my home.. e.g., the computer speakers and cable TV HDMI recorder were consuming ~90-100% of the regular power usage, when they were supposed to be turned off with the button and/or in stand-by mode.. *) Best purchase for everybody who wants to reduce energy usage and worried about global warming.. just 10 euros, its cost paid back within a month of use after checking the all home devices.. You plug it in between device, and socket, and leave it overnight. One device, one 24h day of checking. To see energy consumption in that period. When you use device, and when you don't. Then open spreadsheet in Open Office or Excel and enter data. Extrapolate to entire year and sum the all devices together, calculate percentage of usage -> you see how much you can gain by having it unplugged/disconnected by splitter which have buttons to shut down the all sockets. I have such electric splitter which has one the main button, and buttons for each socket independently. Search net for "Electrical sockets controlled by remote control". https://www.google.com/search?q=Electrical+sockets+controlled+by+remote+control Yet another "best buy" for somebody who wants to be ecological.. (but check it by watt-matter also it has to be in stand-by mode to support remote access)
  25. https://worldpopulationreview.com/country-rankings/energy-consumption-by-country Click interactive map to see country details. Per-capita data. More valuable than absolute value. In US, as some says, "sky is the limit".. Significantly higher average energy usage per-capita than elsewhere.. ..nowadays I have 550 Watts computer power supply.. CRT's were certainly consuming a lot of energy per device but nowadays 50-60" LED consumes 80-100 Watts. Check your TV device power supply. People in Western countries have a couple devices. One for each family member. Everybody wants to watch something else. In US large chunk of energy usage is used for cooling interiors. Great usage of roof solar panels, not requiring transformation DC ->AC and storage in batteries..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.