Last visit was: It is currently 21/08/2014, 7:17


All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 

Should i continue forking?
Yes 0%  0%  [ 0 ]
No 0%  0%  [ 0 ]
Total votes : 0
Author Message
 Post subject: SamsungTools — FORKED
PostPosted: 12/07/2013, 16:38 
Newbie
Newbie

Joined: 12/07/2013, 16:05
Posts: 8
Location: Russia
Hello all, hello developers.

I created a simple fork for SamsungTools program.

First i cleaned code. It was not good and still its.
Next i added support for "battery life time extender" as developers and users wanted.

I hope you enjoy it, and hope, that developers accept me in their "team", because i want to help developing it.

Source code attached here, maybe i'll cheate .deb's.

Best regards, mrDoctorWho.


Attachments:
File comment: SamsungTools
samsung-tools.tar.gz [621.4 KiB]
Downloaded 107 times
Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 12/07/2013, 17:18 
Newbie
Newbie

Joined: 12/07/2013, 16:05
Posts: 8
Location: Russia
As i said, i created .deb package.
Get it here: http://simpleapps.ru/samsung-tools_2.2_all.deb (Voria forum doesn't accept .deb)


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 15/07/2013, 12:06 
Administrator
Administrator
User avatar

Joined: 12/02/2009, 18:08
Posts: 1377
Location: Italy
Hi,
first of all, thanks for your interest in "Samsung Tools" project, which is rather slack at the moment (along with the whole project "Linux On My Samsung"). The main reason is that I've lost interest, I'm starting to dislike Samsung products, and it just does not feel right to waste my time to fix their products.

The "Samsung Tools" code is far from perfect, it was written in a fast way to make it usable in short times. In fact, the first thing in my TODO list was code refactoring (which I never did for the said lack of interest).

That said, I was looking at your changes, they seem good to me except for some "simplifications" you did which in result make the code harder to read, and I prefer readability over the syntesis.

For example, you changed this:
Code:
with open(SL_PATH_BACKLIGHT, 'r') as file:
   status = int(file.read(1))
   if status == 0:
      return True
   else:
      return False
with:
Code:
return not bool(int(rFile(SL_PATH_BACKLIGHT)[0]))
I don't like it.

If you provide me with a proper patch that I can apply to the bzr branch, I would be happy to apply it.

Greetings ;)

_________________
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 15/07/2013, 12:13 
Administrator
Administrator
User avatar

Joined: 12/02/2009, 18:08
Posts: 1377
Location: Italy
Why did you report this thread as spam?

_________________
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 15/07/2013, 12:16 
Newbie
Newbie

Joined: 12/07/2013, 16:05
Posts: 8
Location: Russia
voRia wrote:
For example, you changed this:
Code:
with open(SL_PATH_BACKLIGHT, 'r') as file:
   status = int(file.read(1))
   if status == 0:
      return True
   else:
      return False
with:
Code:
return not bool(int(rFile(SL_PATH_BACKLIGHT)[0]))
I don't like it.

Hello voRia! I just cleaned code. In your code, CPU doing excess operation. Python accepts 0/1 as bool code, why don't use this?


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 15/07/2013, 12:24 
Newbie
Newbie

Joined: 12/07/2013, 16:05
Posts: 8
Location: Russia
voRia, I just wanted to draw your attention to this post. I tried many times to contact some developers of some python projects. They just ignores any additions.
After all. Can you accept my addition request to your jabberID? We can talk in it about code parts that you don't like and take a solution


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 15/07/2013, 12:33 
Administrator
Administrator
User avatar

Joined: 12/02/2009, 18:08
Posts: 1377
Location: Italy
mrDoctorWho wrote:
Hello voRia! I just cleaned code. In your code, CPU doing excess operation. Python accepts 0/1 as bool code, why don't use this?

For the sake of clarity.

mrDoctorWho wrote:
voRia, I just wanted to draw your attention to this post. I tried many times to contact some developers of some python projects. They just ignores any additions.

Ok, but I already got your private email and the bug report you filed on Launchpad. ;)

mrDoctorWho wrote:
After all. Can you accept my addition request to your jabberID? We can talk here about code parts that you don't like and take a solution

I don't use jabber anymore, I completely moved to my google account (GTalk/Hangouts).
You can contact me there or by email.

_________________
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 15/07/2013, 12:42 
Newbie
Newbie

Joined: 12/07/2013, 16:05
Posts: 8
Location: Russia
voRia wrote:
For the sake of clarity.

If user look at code, he should know python or basis of programming. Python as original is easy to understand. Making program slower for better reading is a bad tone. Need a average of it. All web-developers doing optimization of their code: they using 1/0 instread of true/false in js. they using obfuscation and something else.
voRia wrote:
I don't use jabber anymore, I completely moved to my google account (GTalk/Hangouts).
You can contact me there or by email.

So, accept GTalk addition. I using both: jabber & gtalk. GTalk is almost jabber, it based on xmpp protocol.


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 16/07/2013, 14:06 
Newbie
Newbie

Joined: 24/06/2013, 14:58
Posts: 2
[ Aside on programming style ]

mrDoctorWho wrote:
Making program slower for better reading is a bad tone. Need a average of it. All web-developers doing optimization of their code: they using 1/0 instread of true/false in js.
While I don't use python myself, I must say that I object to that statement.

As Knuth himself said1:
Donald Knuth wrote:
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil


Your code does indeed have the advantage of making the code more compact, which would have been worthwhile in the bad old days of 25-line terminals. Today we can all afford to see 100+lines of code at a time, and compact code is no longer a necessary boon. (And if you have a clever enough editor it can probably be folded away.)

At the same time - don't make any premature pronouncements on performance without running the code through a profiler! Modern compilers are pretty clever at optimization, and I'm pretty sure that using '1/0' instead of 'true/false' won't result in different machine code.

1Apparently I can't post links - I found that quote here: http://en.wikipedia.org/wiki/Optimizati ... ted268_2-0


[ / Aside ]


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 16/07/2013, 14:29 
Newbie
Newbie

Joined: 12/07/2013, 16:05
Posts: 8
Location: Russia
It's a part of code, that i replaced in samsung-tools:
Code:
if os.path.exists(spam):
    return True
else:
    return False

That's code is incorrect. Why? Just its extra (not needed) operation. We can do that and it will be correct:
Code:
return os.path.exists(spam)

Its not just simple, it's correct. And i'm sure that PEP8 accept it. Did you read "Zen of Python"?
Zen of Python #3 wrote:
Simple is better than complex.


Top
 Profile  
 
 Post subject: Re: SamsungTools — FORKED
PostPosted: 16/07/2013, 14:40 
Administrator
Administrator
User avatar

Joined: 12/02/2009, 18:08
Posts: 1377
Location: Italy
@mrDoctorWho:
I agree with you on your last example, it's just a banal error from my part, writing code too fast without taking a proper look at it afterward. There was other code in that if-else block which I removed later and I forgot to remove the if-else block itself. ;)

Yet, this example does not prove your point, the previous code snippets posted are not errors, they are good and perfectly readable as they are.
Also, I don't think optimization is that much important here: samsung-tools does a very simple job and it's not crucial to be as fast as possible. On the other hand, code readability allows me (and you ;)) to easily work on the code.

_________________
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net & kodeki