Page 3 of 3

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Sat Sep 22, 2012 10:41 pm
by Robin
Nsmurf wrote:I'd say the worst habit of mine is not indenting. When I start coding, I just want to get something up and running, so I don't think about indenting, then it ends up as a habit, and I'm to lazy to go back and fix to :(
You know, there are editors that automatically do the indenting for you. I'm so used to that by now that when such a program is not available, it actually hurts to write code. :P

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Sun Sep 23, 2012 9:32 am
by qaisjp
Robin wrote:
Nsmurf wrote:I'd say the worst habit of mine is not indenting. When I start coding, I just want to get something up and running, so I don't think about indenting, then it ends up as a habit, and I'm to lazy to go back and fix to :(
You know, there are editors that automatically do the indenting for you. I'm so used to that by now that when such a program is not available, it actually hurts to write code. :P
yeah, notepad++ is ace :D
typing the " " (space 4x) is a real pain in the arse when you cant press TAB.

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Sun Sep 23, 2012 10:58 am
by jonyzz
kikito wrote:My favorite one is "yoda conditions", i.e. typing this:

Code: Select all

if 5 == count then
instead of this:

Code: Select all

if count == 5 then
That reminds me the way how Java programmers usually compare strings:

Code: Select all

if ("stringValue".equals(stringVariable)) ...
When I've first seen this I was wondering why don't they simply write:

Code: Select all

if (stringVariable.equals("stringValue")) ...
The reason is quite simple. In case the stringVariable is null, the first condition evaluates to false, but evaluation of the second one causes NullPointerException.

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Sun Sep 23, 2012 12:21 pm
by Robin
qaisjp wrote:yeah, notepad++ is ace :D
typing the " " (space 4x) is a real pain in the arse when you cant press TAB.
That's very basic. What I meant more was you type function foo(a, b)<ENTER> and the editor puts a tab on the new line. Same thing, you write end and the editor moves that line one tab to the left.

You can write a while program, never once press tab or shift-tab and still have a completely indented source file.

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Sun Sep 23, 2012 2:25 pm
by qaisjp
Robin wrote:
qaisjp wrote:yeah, notepad++ is ace :D
typing the " " (space 4x) is a real pain in the arse when you cant press TAB.
That's very basic. What I meant more was you type function foo(a, b)<ENTER> and the editor puts a tab on the new line. Same thing, you write end and the editor moves that line one tab to the left.

You can write a while program, never once press tab or shift-tab and still have a completely indented source file.
Oh that, yeah that too (SCITE does that i think) - anyway I don't like automatic indentation*2 now because i am so used to np++)

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Sun Sep 23, 2012 6:22 pm
by tv_user
Yeah, I miss the times I programmed c++ using an IDE that you do that kind of stuff and much more...actually, I think debugging is the feature I miss the most. Nowadays its just me, textwrangler (great free program btw) and LOVE.
I don't suppose any of you have a Lua IDE hidden somewhere in your old disks, do you? :nyu:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Mon Sep 24, 2012 6:53 pm
by qaisjp
tv_user wrote:Yeah, I miss the times I programmed c++ using an IDE that you do that kind of stuff and much more...actually, I think debugging is the feature I miss the most. Nowadays its just me, textwrangler (great free program btw) and LOVE.
I don't suppose any of you have a Lua IDE hidden somewhere in your old disks, do you? :nyu:
TextWrangler IS great, I use it whenever I am not using Windows.
Lua IDE's are virtually useless unless you have a framework specific idea, Lua ide's can probably only provide better support for native Lua libraries and some syntax.

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Mon Sep 24, 2012 11:26 pm
by Inny
Okay, I haven't had much time to think about this, but I think this is the minimum "gimme" that you'd have to take to obfuscate code:

Code: Select all

_={__="char",___=_G}
Why? Because from there we can build arbitrary strings and execute arbitrary code.

Code: Select all

_._=_.__[_.__] -- String.char function via the string metatable
_["!"]=(#"##")^(#"####")*(#"#######") -- 112, or lowercase p
_["@"]=_._(_["!"]+(#"####")).._._(_["!"]+(#"#########")).._._(_["!"]).._._(_["!"]-(#"###########")) -- "type"
_["$"]=_._(_["!"]-(#"####")).._._(_["!"]-(#"#")).._._(_["!"]-(#"##")^(#"####")+(#"#")).._._(_["!"]-(#"############")) -- "load"
_["*"]=_.___[_["$"].._.___[_["@"]]("")] -- loadstring function
Once you're at loadstring, you can basically do anything you want.

I couldn't figure out how to get to "char" from just symbols and _G.

Edit: fixed a typo

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Tue Sep 25, 2012 5:10 pm
by Xgoff
Inny wrote:Okay, I haven't had much time to think about this, but I think this is the minimum "gimme" that you'd have to take to obfuscate code:

Code: Select all

_={__"char",___=_G}
Why? Because from there we can build arbitrary strings and execute arbitrary code.

Code: Select all

_._=_.__[_.__] -- String.char function via the string metatable
_["!"]=(#"##")^(#"####")*(#"#######") -- 112, or lowercase p
_["@"]=_._(_["!"]+(#"####")).._._(_["!"]+(#"#########")).._._(_["!"]).._._(_["!"]-(#"###########")) -- "type"
_["$"]=_._(_["!"]-(#"####")).._._(_["!"]-(#"#")).._._(_["!"]-(#"##")^(#"####")+(#"#")).._._(_["!"]-(#"############")) -- "load"
_["*"]=_.___[_["$"].._.___[_["@"]]("")] -- loadstring function
Once you're at loadstring, you can basically do anything you want.

I couldn't figure out how to get to "char" from just symbols and _G.
have fun debugging

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Posted: Tue Sep 25, 2012 5:17 pm
by qaisjp
Xgoff wrote:have fun debugging
lol, i don't even understand that code...