Jump to content

Sensei

Senior Members
  • Posts

    7872
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by Sensei

  1. This is how mass murderer killing children look like: @Anonymous
  2. I share your point of view, but more chance of being hit by lightning.. (no more golf game? ) ps. If such a mortal is hit by lightning, some will say Zeus doesn't like him..
  3. ..which makes no sense, because there is no point in washin not dirty cloth.. ps. You should be an US politician.. ...brown prevents black? My cheap stuff does the same thing.
  4. Cheap things are intensely (artificially) dyed. What looks black in reality is not really black, but, for example, white with a black color that washes out after time. ps. Or dirty.. People rarely wash black cloth because there is no apparent reason to wash it..
  5. When programming, logging is an essential operation to find out what happened and why it happened. Especially in an application written on Linux and running on a server, without a GUI, whose output goes to a terminal / shell. I have created some basic C++ classes that can be useful in an application (C++, but they can be easily adapted to other OOP languages). Logs.Base is a virtual class without implemented methods. Logs.QuietLogs is implemented as a no-op. Simply put, nothing, quiet. Logs.Logs is implemented to write only about serious errors (Logs.Error() method implemented). Logs.VerboseLogs is implemented to write about errors and warnings (Logs.Warning() method implemented). Logs.VeryVerboseLogs is implemented to write about errors, warnings and notifications (Logs.Notice() method implemented). By passing a generic logging class object to functions, methods, classes, constructors, etc., they can write what they want to the logging object, but what appears to the user depends on user willingness to listen using -q (--quiet), -s (--silent), -v (--verbose), -vv (--very-verbose) etc. on the command line.. Writing to a separate log file can be as simple as creating another Logs.Base subclass with the appropriate methods overridden, or even over the network. // Logs v1.0 (c) 2023 Sensei (aka 'Q') (8.XI.2023) #include <iostream> namespace Logs { class Base { public: virtual void Notice( const std::string &message ) = 0; virtual void Warning( const std::string &message ) = 0; virtual void Error( const std::string &message ) = 0; }; class QuietLogs : public Base { public: virtual void Notice( const std::string &message ) {} virtual void Warning( const std::string &message ) {} virtual void Error( const std::string &message ) {} }; class Logs : public QuietLogs { public: virtual void Error( const std::string &message ) { std::cerr << message << std::endl; } }; class VerboseLogs : public Logs { public: virtual void Warning( const std::string &message ) { std::cerr << message << std::endl; } }; class VeryVerboseLogs : public VerboseLogs { public: virtual void Notice( const std::string &message ) { std::cout << message << std::endl; } }; }; class Program { public: Program( const std::string &title, Logs::Base &logs ) { std::cout << "Testing " << title << std::endl; logs.Error( "Error!" ); logs.Warning( "Warning!" ); logs.Notice( "Notice!" ); std::cout << std::endl; } }; int main( int argc, const char *argv[] ) { Logs::VeryVerboseLogs l3; Program p1( "Very Verbose Logs Test", l3 ); Logs::VerboseLogs l2; Program p2( "Verbose Logs Test", l2 ); Logs::Logs l1; Program p3( "Logs Test", l1 ); Logs::QuietLogs l0; Program p4( "Quiet Test", l0 ); return( 0 ); } Example output: ./logs Testing Very Verbose Logs Test Error! Warning! Notice! Testing Verbose Logs Test Error! Warning! Testing Logs Test Error! Testing Quiet Test I think passing arguments --verbose, --very-verbose, --quiet, --silent, etc. is quite sloppy in code.. better instead to create such a C++ class.. logs.cpp
  6. Of course, it is everywhere. It's like learning a language from the alphabet (characters). First the alphabet (characters), then words, then sentences. Your description (though it's accurate) is like starting from the opposite direction. Starting to read the book from the middle. That is, the person will have no idea where this Gibbs energy comes from and why all this happened (or not in the case of reaction which does not occur).. I was trying to say why the reaction occurs without bothering with what these A, B, C, D are. In my country, physics is/was taught from the same direction as discoveries and laws in historical order. Bizarre. Hook's law is/was taught first. I would say, it is stupefying people.. People learn about the energy released by a reaction and have no idea where that energy comes from.
  7. For all these wrongdoings, now even more people in the world hate Jews.. They are 1) idiots 2) love the fact that people hate them.. 3) they are idiots..
  8. It is very simple: from the state in which compounds have more energy (E=mc^2) it goes to the state in which they have less energy.. e.g. CO2 and H2O have less energy/mass per particle than sugar, fuel or so. The difference is extremely small, counted in eV/c^2 per molecule (and in chemistry expressed as J/mols or so), so by looking at g/mol is impossible to determine in advance, as the difference is billions times less visible. Such reactions are exothermic/exoenergetic i.e goes without any additional energy from external source. In the reverse direction, energy is needed from an external source. e.g. no energy source is needed to convert a metal to a metal oxide. But to convert a metal oxide into a metal, an external energy source is needed. This is why so few metals in nature occur in the metallic state (for example, gold, which does not readily form compounds with other elements). The energy is need to break bounds between elements, and the energy is released in breaking bounds between elements. It depends on the element and compound. Look at reactivity chart of elements: https://www.google.com/search?q=activity+chart+chemistry+wikipedia https://en.wikipedia.org/wiki/Reactivity_series Some (most?) elements/compounds need a certain "activation energy" to start the whole reaction: https://en.wikipedia.org/wiki/Activation_energy That's why fuels or explosives do not spontaneously combust or explode in most cases.
  9. ..how do you verify if something is fact or bullshit.. ?
  10. ..when you don't know something, experiment.. do two or more and adjust the settings, remember/store the results and compare.. This way you will gain more knowledge than simply asking on the forum. In any field, not only in cooking. BTW, I'm not fond of liver unless I have to, but I tried (because of the discount, $4 for 1 kg) hare liver.. Wow! Completely different from pork, beef or poultry liver! When I see my salesgirls in the meat store I am now joking: when will the liver from the bear.. "Any news from the Canada?" etc.
  11. ..the whole story behind the movie "Matrix" does not make any sense.. 'humans created clouds to cover the whole world to prevent A.I. from taking sunlight, so they were placed in "carnisters" to produce electricity for A.I'.. This is what I remember from "The Matrix Part #1".... The creators created things on the fly, without giving much thought to whether it would even come together into any larger story (as is the case when there is an adaptation of a book by a writer who has been writing it for many years, and has thought through every page of the script). The second and third parts are tacked on to the first, which was a spectacular and unexpected success. So the creators must have added some explanation of something they didn't think too much about when writing the original. This is a video in which they mention that man is a battery, a source of electricity (bizarre!): (which is nonsense, because a 4-year-old would find a better source of electricity) When you live in a simulation, the creators (aka "superadmins", as someone said about me in the religious section), can do whatever want.. i.e., change "the script" and change someone's life (in hell, heaven or whatever)..
  12. ..so do humans..
  13. ..let me guess - you would turn on the language checker in your web browser...? ..I think it is different here.... It is easy for a layman.... and difficult for a non-layman.... ps. All this stuff, theoretical experiments, at the speed of sound, are not enough accurate.. Like I said, the Earth, rotates..
  14. The earth is rotating. The emitter rotates with the Earth. The receiver also rotates. With a home-made apparatus, no serious experiment can be conducted. Photons emitted by the emitter, travel a curved path to reach the receiver, while the Earth rotates? The distances are too small to make measurements.. All the experiments with "speed of sound" are useless.. The field of view is only 5 km near the ground. https://www.google.com/search?q=how+many+kilometers+you+can+see+sea+horizon At the speed of light, it takes 42.5 ms for a particle to pass through the center of the Earth (12,700 km). Sound - one particle hits another particle, which hits another particle, and so on. Imagine that the Earth is rotating.. But his name was Lorentz.. https://en.wikipedia.org/wiki/Hendrik_Lorentz
  15. If they didn't like the cold winter, they would move south, wouldn't they?
  16. Judges, especially in the U.S., twelve jurors, don't have that option, because they are ordinary people randomly selected from the crowd.. For such things, the simplest way is to run a computer program/script that will perform the most basic version of the equation in a loop. Don't know the result? It doesn't matter, use a (pseudo) random number generator and repeat the procedure over and over to average the results.
  17. An intermediate solution should be to simply draw straight lines between the control points.
  18. ..but where these data is loaded from the CSV...? There should be a curve, not a straight line....
  19. Newton's physics is relative.. Einstein's physics is special relative..
  20. I provided a link in previous messages. A map can be found there.. Decimal separator can be dot or comma or else. CSV usually use comma as separator. But it is not hardcoded. It can be other character. Comma decimal separator conflicts with comma separator in CSV (if parser is buggy). Download OpenOffice Spreadsheet, make some CSV text file, and try to load, try to save in CSV, it will ask what character do you want as column separator. It can be anything.
  21. If there is a double-quote character in the field, commas (or "commas") are ignored until the next ending double-quote character. Add quotes, add commas in them, and try loading again.. Some countries use a period as a decimal separator and some use a comma as a decimal separator. https://en.wikipedia.org/wiki/Decimal_separator By default, computer languages use the user's local settings and the user's country settings when writing and parsing floating-point numbers. If a CSV, XML, HTML, etc. file is created, it will have an incompatible floating point/number format, and trying to load it in that form in another country will cause problems. For CSV, this will cause problems with simple/buggy CSV parsers, such as line.split( "," ) When each field in the CSV is in double-quotes, the parser can automatically detect where the separators are and whether we are importing data from a country with a different format than in the USA-UK-Australia-China and a few Africans countries. ps. Add padding/margins between controls. Reduce the inner padding from text to border. Text buttons should not glue together. (Image buttons can, if there is image inside of them without borders)
  22. BTW, CSVs are not as easy to use as you think. Files can have characters other than a comma as a separator (that's why the Open Office Spreadsheet asks the user what character is a "comma" - so you need entire window ("panel"/"GUI") to handle it) and there is a problem with escaping that character (double quotes in some fields). People doing a simple cols = string.split( "," ) create the buggy code. Example CSV: "1.0","2",3,"4,0" "1.1","2,1",4,"5,1" Commas are part of the record field. Using cols = string.split( "," ) will cause an error in the code. A simple solution is to use a CSV-compatible library. But nevertheless in-depth you need to test it on unusual files (like above CSV)..
  23. The app for making graphs should let the user to enter data, not just click and move with the mouse, the values must be precise, if it is to be 100.0, it cannot be done with the mouse. The mouse dragging procedure would have to have a snap-to-grid functionality - which the user should be able to turn on and off at will. (and edit grid size numeric text control - may be in the toolbox) This allows the user to click each point on the curve and see the value in the text (numeric) control and can change it. You can also select multiple points (Shift key) or use the region/lasso selection tool and drag them all at once. Or delete (you need del key event handler). Hovering the mouse over a point should display the value of the point in a floating bubble. You need some kind of threshold, a few pixels (editable in Tools > Settings), not an exact value (already at Full HD it's hard to hit something, at higher resolutions it would be a nightmare). Import and export various file formats. So the best way would be to make proprietary SDK to let other developers writing extensions. But it is way way more than your level of expertise (you would need to learn how to make C++/C# DLLs/modules) After creating menustrip, you need to create a toolbox with tools - images in buttons. So you need "Add", "Delete", "Edit" modes, "Select all", "Deselect all", "Invert selection" tools (all image-buttons). Have a Mode variable in the code. When you click Add Image button, you set Mode=Add (create enums). When you click Delete image button, you set Mode=Delete, etc. Select All, Deselect All, Invert are immediate operations. So you need in your project a list of control-points. Make C++/C# class for them, with properties: position, value, selection-state (which is altered by Select All etc. tools). Edit tool changes value property. Some other tool for sliding them to change position property. ..this is the Computer Science subforum..
  24. You should do some basic research before jumping into the topic in earnest to the level where you present the script to the public. For example, have you ever heard of Excel? Open Office Spreadsheet? You load a CSV file into them, for example, one click and you have a ready-made chart with many options to choose from. ps. It's good that you write some stuff. New code every day. Practice makes perfect. Do you have support for different curves? So far you have shown a straight line. Why didn't you click the Add Point button and present us with a nice, smooth curve? Let me guess - this function is not implemented yet.. Learn how to draw a Catmull-Rom curve: https://en.wikipedia.org/wiki/Centripetal_Catmull–Rom_spline https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull–Rom_spline (The Catmull-Rom spline passes through all control-points, unlike the Bezier and B-Spline). Once the control-points are created, they should be saved and restored each time the user runs the program. The program should allow loading and saving projects. Load from the resent list. Undo and redo operations. I always start writing an application in the .NET Framework (C++/C#) by creating a GUI and begin by creating the top menu. Typical setup is: File: Open, Resent list sub-menu, Save, Save As, (more stuff), Exit Edit: Undo, Redo, Cut, Copy, Paste, Delete (more stuff) View: (app context dependent) Tools: Settings, (more stuff) Help: (more stuff), About This is basically a standard in the industry that a good UI developer should follow. You do in the Visual Studio/Express. Download for free: https://www.google.com/search?q=Visual+Studio After creating a basic menu strip, double-click each entry to create actions in C++/C# code. Exit and About are the easiest, so I start from them. Tools > Settings should open another window. Settings depend on the application, and are different in each. Settings should have tree list control on the left, and on the right context dependent panel which the user switch by clicking on the tree entry.
×
×
  • 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.