[Finished] [ARCed] project management implement ARC_Dump utilization

Started by Ryex, September 09, 2011, 07:00:51 pm

Previous topic - Next topic

Ryex

Re-factoring of project management and implement ARC_Dump utilization




Description

The current system for project management is to store the project data as global data in a module named "Project" attached to the kernel namespace i'm going to re factor this to use the Global object namespace provided by the Kernel and implement proper data management through a actual class object in the process i'm going to replace the current project load system to load ARC files via ARC_Dump



Priority

High



Prerequisites

[ARCed] MsgPack serialization modules for Python and Ruby



Assigned

Ryex



Everything else

critical to proper functioning of data management.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

half done, I have the generic project system in place I just have to rewrite the open and save project methods to use it. when I get the panels to use the panel manager system i'll get them to pull the project data form the right place again.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

Ok, I WANT to mark this done but we have one problem. ARC_Data isn't loading files correctly I'll created a project secessfuly files saved ect. and then tried to open it only to get and error from ARC_Data saying that there is an undefined type deceleration Blizz can you look at the ARC_Data file in the editor/ARCed/src/Core folder and see if you can find anything wrong?

you can run the Main.py file if you want and create new project and take a look at the files it saves to see what's going on.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

I can take a look at it. If you are getting an undefined type exception, then you reader isn't doing something right. As I said, I can take a look at it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Blizzard

Alright, I analyzed your code, but I didn't fix it. Here's what could be causing the problems.


  • 1. __try_map: Array#index returns nil in Ruby if the element is not present in the array. I am not sure if Python does the same thing with list.index. If I remember right, list.index should return -1, i.e. generally an integer less than 0 if the element is not present in the list instance.

  • 2. __load_int32: In Ruby using unpack creates an array from a string. I'm not sure anymore if the same applies to Python. You should look into it.

  • 3. I'm not exactly sure if the operator "is" is an equivalent for "==". I know that I always avoided the "is" operator so you might wanna take a look at that as well. At least I think that for the sake of consistency you should just use "==" and "!=" everywhere.

  • 4. _dump_float, _load_float: Double check all pack/unpack formatting one more time. I noticed that you used <I and <f (instead of a capitalized <F).

  • 5. _dump_string, _dump_array, _dump_hash: You used obj.size to check the string/array/hash size instead of len(obj).

  • 6. _dump_object: I think that object.__module__ can return a module like "X.Y" and after appending the class with your code it would look like "X.Y::Z". I suggest you split the module name with "." and join it with "::" before concatenating the class name. Also make sure that __module__ returns a string and not a "Module" object or something like that.

  • 7. Use "xrange" instead of "range". It's better.

  • 8. _load_object: I think you can use "classe()" instead of "classe.__new__(classe)". If any case, make sure it does the same thing that Ruby does, because  "class.new" responds to "classe()" so "class.allocate" should logically respond to "classe.__new__(classe)". Class#allocate only creates the object in the memory, it doesn't call the initialize method so I hope that Python's __new__ method does the same.



The bolded ones are the ones that I think are definitely causing the problems.

I'd actually fix the stuff myself and test it, but last night was crazy and the only part of my brain that's properly working is music related. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

AngryPacman

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 3. I'm not exactly sure if the operator "is" is an equivalent for "==". I know that I always avoided the "is" operator so you might wanna take a look at that as well. At least I think that for the sake of consistency you should just use "==" and "!=" everywhere.



In Python, == compares by value and 'is' compares by reference, i.e. object identities.
G_G's a silly boy.

Blizzard

Then "==" would definitely be more suited for our needs. As a matter of fact, that might actually be a cause of a problem in a specific big if-elif block. Ryex knows what I'm talking about.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

Quote from: Blizzard on October 16, 2011, 07:12:07 am

  • 1. __try_map: Array#index returns nil in Ruby if the element is not present in the array. I am not sure if Python does the same thing with list.index. If I remember right, list.index should return -1, i.e. generally an integer less than 0 if the element is not present in the list instance.



actually I did a test and it actually errors out is the item is not in the list so I put that line in an if statment
if obj in data: index = data.index(obj) else: index = None


Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 2. __load_int32: In Ruby using unpack creates an array from a string. I'm not sure anymore if the same applies to Python. You should look into it.


your right it returns a tuple even if there is only one item. I needed to get the first item out of the tuple.

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 3. I'm not exactly sure if the operator "is" is an equivalent for "==". I know that I always avoided the "is" operator so you might wanna take a look at that as well. At least I think that for the sake of consistency you should just use "==" and "!=" everywhere.


"is" compares by identity, "==" compares by equality. It is actually a python convention to use "is" when you test for True, False or None because they are all references to the same object. is also works with strings because all strings with the same content are considered the same object (strings are immutable)

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 4. _dump_float, _load_float: Double check all pack/unpack formatting one more time. I noticed that you used <I and <f (instead of a capitalized <F).


this is correct there is no "F" format. only "f" which is a float the difference between "I" and "i" is that "I" is unsigned

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 5. _dump_string, _dump_array, _dump_hash: You used obj.size to check the string/array/hash size instead of len(obj).


you must not have the latest version because I fixed this a week or two ago. the file under editor/ARCed/src/Core is the latest version

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 6. _dump_object: I think that object.__module__ can return a module like "X.Y" and after appending the class with your code it would look like "X.Y::Z". I suggest you split the module name with "." and join it with "::" before concatenating the class name. Also make sure that __module__ returns a string and not a "Module" object or something like that.



crap your right, fixed that

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 7. Use "xrange" instead of "range". It's better.


I actually forgot about xrange I went ahead and changed that in the entire code base except where range would actually be needed

Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 8. _load_object: I think you can use "classe()" instead of "classe.__new__(classe)". If any case, make sure it does the same thing that Ruby does, because  "class.new" responds to "classe()" so "class.allocate" should logically respond to "classe.__new__(classe)". Class#allocate only creates the object in the memory, it doesn't call the initialize method so I hope that Python's __new__ method does the same.



python's __new__ is the same as ruby's allocate. but only for new style classes. thus if you want to write a class that can be dumped you have to make it inherent from "object"

I fixed it all but I haven't tested yet
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Quote from: Ryex on October 16, 2011, 04:38:05 pm
Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 3. I'm not exactly sure if the operator "is" is an equivalent for "==". I know that I always avoided the "is" operator so you might wanna take a look at that as well. At least I think that for the sake of consistency you should just use "==" and "!=" everywhere.


"is" compares by identity, "==" compares by equality. It is actually a python convention to use "is" when you test for True, False or None because they are all references to the same object. is also works with strings because all strings with the same content are considered the same object (strings are immutable)


Alright, I was just confused because you mixed "is" and "==" with True/False/None.

Quote from: Ryex on October 16, 2011, 04:38:05 pm
Quote from: Blizzard on October 16, 2011, 07:12:07 am
  • 5. _dump_string, _dump_array, _dump_hash: You used obj.size to check the string/array/hash size instead of len(obj).


you must not have the latest version because I fixed this a week or two ago. the file under editor/ARCed/src/Core is the latest version


Right, I wasn't checking that one. I was checking the one in the tests folder. BTW, if the stuff in the tests folder is not needed anymore, you can delete it. If we ever need that data again, you can always check out a revision before it was deleted.

Alright then. I think this should be it. Let me know how the testing went when you are done.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

And... Done.

you can now load a project that was converted to ARC with the converter.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />