Jump to content

fiveworlds

Senior Members
  • Posts

    1903
  • Joined

  • Last visited

Everything posted by fiveworlds

  1. An FYP should be about independent research. I assume you have a topic so use Google, YouTube, Udemy and various books to learn. Be sure to reference all the information you used in your FYP including any design patterns you think are appropriate.
  2. The greedy approach is bad because it doesn't find the optimum solution. Once a site has been selected it cannot be changed. It can lead to situations where one site is responsible for a large area in comparison to other selected sites.
  3. In python you must use either tabs or spaces for indentation not both. It is an annoying feature of python if you are using notepad++ you can "view>show symbol>show white space and tabs"
  4. 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.
  5. 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
  6. 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
  7. 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.
  8. 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())
  9. 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?
  10. 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.
  11. 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.
  12. 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.
  13. Does anybody know if a WebRtc stream drawn to html canvas is blocked by CORS?
  14. 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.
  15. 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
  16. 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.
  17. 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)
  18. 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.
  19. I am not sure if you are right about that. It just isn't a conventional use case. There is some applications available on GitHub that do stuff similar to this for example https://github.com/gistrec/File-Broadcaster You can assume that you have complete access to the client. For example you could start a service to listen for the download on all clients. As for lost packets surely the client can keep track of where it loses packets and ask the sender to resend? Or the sender can loop through the download several times.
  20. I would like to use existing software if possible. If not I could write it. I am using windows server 2012 as the switch which will be connected to many machines (not necessarily windows) on the same network. There are no users. It is an automated process involving downloading a large (12GB) zip file containing windows driver tests to about 40 computers a process which normally would take several hours from the windows assessment services server rig. Since the server is also the switch I would like to try using https://en.wikipedia.org/wiki/Broadcasting_(networking) or https://en.wikipedia.org/wiki/Multicast But most usages of these tend to be for things other than downloading a file such as sms/video emergency broadcasting
  21. Is there an existing application/hardware that will allow a single computer to send duplicate network traffic to multiple computers. For example, say I want many computers to download the same update file?
  22. Yeah I did. My dad had all the books at home.
  23. I liked the books written by Robert Jordan but thought that Brandon Sanderson's continuation was hard to follow. I can't help thinking what Jordan would have written.
  24. 3-Sat is basically a Boolean expression written as an and of 3 or statements. (a!bc) and (!a!bc) and (!ab!c) and (!cde) and (!bc!d) 010**** 110**** 101**** **100** *010*** (aaa) and (!a!a!a) 0******* 1******* It can be solved in deterministic polynomial time by performing a bitwise unique match on FALSE values stored in an array. For example (a or !b or c) is only false for (010). We add the false values to an ordered array so a,b,c etc and simply do a bitwise check to see if the opposite already exists in the array, so for 010 that would be 101. If the opposite already exists then the Boolean expression is unsatisfiable. This would need to iterate over O(n) values in the worst case on a Single Tape Deterministic Turing machine. The expression is also unsatisfiable if the length of the array is >= 2n/2. Therefore the worst case runtime can never reach the exponential 2n I am unsure whether there is any exceptions to the rule that would make this not 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.