Jump to content

fiveworlds

Senior Members
  • Content Count

    1848
  • Joined

  • Last visited

Community Reputation

74 Excellent

1 Follower

About fiveworlds

  • Rank
    Primate
  • Birthday 08/11/1993

Profile Information

  • Location
    Somewhere on the internet
  • Favorite Area of Science
    computers

Recent Profile Visitors

21391 profile views
  1. You can selectively ignore sounds using ai too. For example you can filter out background noise from traffic or other people in a restaurant. You can also separate the lyrics sung by a singer in real-time translated to another language and the background music. You can even focus on specific instruments.
  2. If you want to show that, you'd have to start by disproving that a universal Turing machine with no internal states need only be slower by a logarithmic time factor compared to the machine it simulates. Since logarithmic time < polynomial time it holds that since a then b. Their is a draft of the book where that was shown here http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=EE1010E9E59F8CAA143C55745A49BD9A?doi=10.1.1.297.6224&rep=rep1&type=pdf
  3. Has anyone here used Blazor and know if it is worthwhile learning? Blazor appears to be an attempt to replace JavaScript with .net core C#. https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor
  4. There really isn't though c++ is more complicated with header files etc. Private variables are accessible by subclasses, protected variables/methods can only be called by classes in the same package or sub packages (folder). namespace second_space { class Box { private: class B { protected: double length = 10; }; public: class Car : B { public: double dimensions() { return B::length; }; }; double height=4; double getDimensions(void); protected: double breadth = 7; }; double Box::getDimensions() { Car car = Car(); return car.dimensions(); } class ExtendedBox:Box { public: double test(void); }; double ExtendedBox::test() { return breadth; } class Bar { double test(void); }; double Bar::test(void) { Box box = Box(); return box.height; //return box.breadth; compile error } } int main() { // Calls function from first name space. second_space::Box box; cout << box.getDimensions() << endl; second_space::ExtendedBox extendedBox; cout << extendedBox.test() << endl; Bar::ExtendedCar extendedCar; cout << extendedCar.test() << endl; return 0; } Everything is public in Java, C# etc via reflection... I don't see the difference they all use some form of obfuscation in their own proprietary way.
  5. Not correct it doesn't have to be a subclass, protected methods can only be called by classes in the same package or sub packages (folder). There you go nice python example # coding = "utf-8" class Npc(object): ########################################## # Static Attributes ######################################### # All instances of the Npc class will only ever have one instance of a Static variable static_npc_database = "game_npc_list" _max_walk_vertical = 12 __max_walk_horizontal = 10 max_run_vertical = 35 max_run_horizontal = 30 ########################################## # Static Getters ########################################## @staticmethod def _get_max_walk_horizontal(): """ static private methods can be called only from instances of this class :return the top secret of Npc """ return Npc.__max_walk_horizontal @staticmethod def __get_max_walk_vertical(): """ static protected methods can be called only from classes/subclasses in the same package/module :return the secret of Npc """ return Npc._max_walk_vertical @staticmethod def get_max_run_horizontal(): """ public static methods can be called from all classes :return the top secret of Npc """ return Npc.max_run_horizontal @staticmethod def get_max_run_vertical(): """ public static methods can be called from all classes :return the secret of Npc """ return Npc.max_run_vertical ########################################## # Static Setters ########################################## @staticmethod def _set_max_walk_horizontal(new_max_walk_horizontal): """ static private methods can be called only from instances of this class :except not string or null """ if Npc.string_validator(new_max_walk_horizontal): Npc.__max_walk_horizontal = new_max_walk_horizontal @staticmethod def __set_max_walk_vertical(new_max_walk_vertical): """ static protected methods can be called only from classes/subclasses in the same package/module :except not string or null """ if Npc.string_validator(new_max_walk_vertical): Npc._max_walk_vertical = new_max_walk_vertical @staticmethod def _set_max_run_horizontal(new_max_run_horizontal): """ static private methods can be called only from instances of this class :except not string or null """ if Npc.string_validator(new_max_run_horizontal): Npc.__max_run_horizontal = new_max_run_horizontal @staticmethod def __set_max_run_vertical(new_max_run_vertical): """ static protected methods can be called only from classes/subclasses in the same package/module :except not string or null """ if Npc.string_validator(new_max_run_vertical): Npc._max_run_vertical = new_max_run_vertical ######################################### # Static Methods ########################################## @staticmethod def string_validator(variable): """ Validates that a variable is a string :param variable: The string :return: The result :except: Variable is not a string """ if variable is None or type(variable) != str: raise Exception("Npc cannot have a null/(non string) variable") else: return True @staticmethod def int_validator(variable): """ Validates that a variable is an int :param variable: The int :return: The result :except: Variable is not an int """ if variable is None or type(variable) != int: raise Exception("Npc cannot have a null/(non int) variable") else: return True @staticmethod def _calculate_movement_value(value, max_value): if Npc.int_validator(value): if value < max_value: return value elif value > 0: return max_value else: return -max_value ####################### # constructor ####################### def __init__(self, first_name: str = "Santa", x_position: int = 100, y_position: int = 100, max_walk_vertical: int = None, max_walk_horizontal: int = None, max_run_vertical: int = None, max_run_horizontal: int = None): """ Npc Constructor (non static variables are defined here) :type first_name: str :param first_name: The Npc's first-name. :type x_position: int :param x_position: The Npc's x position. :type y_position: int :param y_position: The Npc's y position. """ if Npc.string_validator(first_name): # this is public attribute/member of object/class self.firstName = first_name if Npc.int_validator(x_position): # this is protected attribute/member of object/class # (accessible from this class and subclasses of this class) self._x_position = x_position if Npc.int_validator(y_position): # this is private attribute/member of object/class # (accessible only from this class code: actually never in this example) self.__y_position = y_position if max_walk_vertical is not None and max_walk_vertical < Npc._max_walk_vertical: self.max_walk_vertical = max_walk_vertical else: self.walk_vertical = Npc._max_walk_vertical if max_walk_horizontal is not None and max_walk_horizontal < Npc.__max_walk_horizontal: self.max_walk_horizontal = max_walk_horizontal else: self.max_walk_horizontal = Npc.__max_walk_horizontal if max_run_vertical is not None and max_run_vertical < Npc.max_run_vertical: self.max_run_vertical = max_run_vertical else: self.max_run_vertical = Npc.max_run_vertical if max_run_horizontal is not None and max_run_horizontal < Npc.max_run_horizontal: self.max_run_horizontal = max_run_horizontal else: self.max_run_horizontal = Npc.max_run_horizontal ######################################### # Getters Methods ########################################## def get_first_name(self): """ yet another public method :return the first name of Npc """ return self.firstName def _get_x_position(self): """ protected methods can be called only from classes/subclasses in the same package/module :return the secret of Npc """ return self._x_position def __get_y_position(self): """ private methods can be called only from this class :return the top secret of Npc """ return self.__y_position ######################################### # Setter Methods ########################################## def set_first_name(self, first_name: str): """ public method can be executed from anywhere (with special careful attention from separate thread, than the main thread!) :except not string """ if Npc.string_validator(first_name): self.firstName = first_name def _set_x_position(self, new_x_position): """ protected methods can be called only from classes/subclasses in the same package/module :return the secret of Npc """ if Npc.int_validator(new_x_position): self._x_position = new_x_position def __set_y_position(self, new_y_position): """ private methods can be called only from this class :return the top secret of Npc """ if Npc.int_validator(new_y_position): self.__y_position = new_y_position ################################################# # Methods ################################################# def walk(self, vertical=0, horizontal=0): """ An Npc should be able to walk :param vertical: The distance to walk vertical :param horizontal: The distance to walk horizontal """ self.__set_y_position( self.__get_y_position() + self._calculate_movement_value(vertical, self.max_walk_vertical)) self._set_x_position( self._get_x_position() + self._calculate_movement_value(horizontal, self.max_walk_horizontal)) def run(self, vertical=0, horizontal=0): """ An Npc should be able to run :param vertical: The distance to run vertical :param horizontal: The distance to run horizontal """ self.__set_y_position( self.__get_y_position() + self._calculate_movement_value(vertical, self.max_run_vertical)) self._set_x_position( self._get_x_position() + self._calculate_movement_value(horizontal, self.max_run_horizontal)) class Teacher(Npc): def foo(self): self._get_x_position() def bar(self): self.__get_y_position() if __name__ == "__main__": teacher = Teacher() print(teacher.firstName) print(teacher.bar()) try: print(teacher.foo()) except: print("cannot get y position here because it is private") teacher.run(10, 10) print(teacher.bar())
  6. Don't we have animal insulin etc already? If the animals aren't in pain then in the short term it is ok (in the hope we could eventually be able to grow custom organs in a lab eliminating the need for animals to be used at all.) What advances are we missing out on because we didn't make the attempt? It really depends, a lot of diseases can be traced back to animals and will it create a new epidemic?
  7. Georg Cantor (the inventor of set theory) thought infinite sets didn't exist. He even made up the word transfinite to describe sets that which were enormous but not necessarily infinite.
  8. WebRtc is the new standard for video capture from a users camera. So similar to like facebook video chat/ google hangouts. The gets streamed to a <video> element normally and video data can then be drawn to canvas. The problem would be that sometimes the canvas can prevent access to the pixels data due to CORS. So something like this only multiplayer.
  9. Well I wanted to make some multiplayer games that make use of motion capture by drawing a video stream to a canvas in html. WebRtc is fairly new though so there isn't many tutorials on it. It also seems hard to do and might not work if CORS prevents me from getting the video stream pixel data.
  10. Does anybody know if a WebRtc stream drawn to html canvas is blocked by CORS?
  11. I seriously doubt they would release 5G if it was dangerous. There has been people living off the wifi is dangerous bandwagon for years. Buy product x to protect you from wifi. If you are worried about it just use ethernet.
  12. Yeah I have one of those already but there is huge amounts of data This was the actual code that was causing an error If IsEmpty("F29") = False And Round(Range("F29").Value, 2) >= 0.05 Then content = content & vbCrLf & "- Display Time (Seconds) " & WorksheetFunction.Round(Range("'Chart Data'!P34") * 100, 0) & "% worse" End If where F29 = 0.121043590973107
  13. That always worked that is the function version and not the vba version. I have to use vba because my function is >8124 characters. I found how to use it in vba though, it is iif not if confusing.
  14. There is none I just want it to do one thing if the number is larger than the other and it doesn't execute. The numbers are negative to as in -2.3553456E23 > -4.3527892E21. It is also an old Excel version (2013)
  15. How do I write an if statement in excel vba to compare two numbers from worksheet cells that are in scientific notation? I thought it would be as simple as comparing the cell.value but that didn't work.
×
×
  • 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.