Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

06-16-2011 , 10:46 PM
never use it, can't parse it in my head without really thinking what's supposed to be going on, takes a good few minutes

Code:
if (boolexpression)
{
   then_do_this
}
else
{
   else_do_this
}
fyp
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-16-2011 , 10:49 PM
If it's really compact I think it can be useful. But I rarely find use for it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-16-2011 , 10:53 PM
Quote:
Originally Posted by RoundTower
Is it clear to you yet that the best way to learn programming was probably not to dive into the PL/SQL reference manual?
Quote:
Originally Posted by gaming_mouse
lol
It's becoming clear to me that the best way to learn programming is not:

-- figure out a free tutorial that is slowed down to stupidity and use it to "learn" how to program. With this course of action, I became used to the thought that iterations are only good for going through lists and printing things out. I never figured out that something like {i -= 1} is a powerful tool to have and use. Oh, and of course, the word "tuple" never entered my vocabulary. Running two or more iterations in the same code? Forget about it.

-- figure out a project to do and attempt to create some program with zero idea of the complexity that lies ahead. This only helps one learn how to sequence code via copy/paste and shows nothing about the actual workings of the code. Sure, I see "how it works" but not "why it works." I would never figure out important things like flow control, proper bracketing (indentation), etc.

-- Jumping into a program project without a pencil and paper. There's nothing shameful about creating a chart, table, or something else to help visualize what I am attempting to do. Even if this is debatable on some level, it's only easier for me to chart a plan first, then think about the execution. Using a pencil/paper helps a lot with understanding who while loops work, what the expected output is, and most importantly, why the loop behaves the way it does and why the output is what it is. I guess I am too much into the why?

-- Not using math: I am sure this goes without saying, but if you add "without using math" at various places throughout example 1,2,3, the examples perhaps becomes more truthful or laughable. Probably both.

-- Do not think that just because it is "easy" that it is actually "easy." There is a huge difference between what is "easy" to someone with experience and what is "easy" to me, and sometimes that gap is like "holy ****, **** this problem." I just say that because the Open Course problems are supposedly "easy," though for me, they are like Project Eulers.

-----------------------------

This is a stupid question, but all these rules about brackets: are you specifically talking about programs that don't use brackets? Like Python? Now I'm going to add brackets to a Python code and cry because the code broke.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-16-2011 , 10:58 PM
Well different languages have different means of doing so.

In a C-derived language you use lots and lots of them. This is what the above discussion generally relates to.

In Python, for most things you'll just use indentation.

In Ruby it's really a matter of taste in some cases, but usually you'll use do/end.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-16-2011 , 11:01 PM
no, we're talking about C-style languages JavaScript, AHK etc. where brackets are optional for single-line statements
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-16-2011 , 11:07 PM
Quote:
Originally Posted by greg nice
RFC about the ternary operator, like/dislike
I use it, but very sparingly. Generally only when the if clause is one simple comparison and the result is returning one variable vs the other.
[php]x = (items.isEmpty()) ? "Thing 1" : "Thing 2";[/php]
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-16-2011 , 11:45 PM
I use the ternary operator a lot in expressions in situations like:

Location.x = 500 * ( IsLeftSide ? 1 : -1 );

Still plenty readable imo and way more compact than

if ( IsLeftSide ) Location.x = 500;
else Location = -500;

or

Location.x = 500;
if ( IsLeftSide ) Location.x *= -1;
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 12:01 AM
Anyone ever use it outside of assignments? It seems to me restricting it to assignments is a good way to aid ?:'s clarity.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 03:49 AM
Just saw this on Reddit.... never write your own uninstall scripts! https://github.com/MrMEEE/bumblebee/...7755cdbe0acce6
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 06:31 AM
Quote:
Originally Posted by Neil S
Anyone ever use it outside of assignments? It seems to me restricting it to assignments is a good way to aid ?:'s clarity.
Method return, esp. with implicit return in ruby.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 08:37 AM
Quote:
Originally Posted by MrWooster
Just saw this on Reddit.... never write your own uninstall scripts! https://github.com/MrMEEE/bumblebee/...7755cdbe0acce6

That is some funny **** right there.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 08:55 AM
Lol I don't get what it's doing exactly, is it deleting some OS file? If so that's lol.

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 08:59 AM
Deletes /usr on Linux systems.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 09:42 AM
Quote:
Originally Posted by Neil S
Anyone ever use it outside of assignments? It seems to me restricting it to assignments is a good way to aid ?:'s clarity.
I use to be really against it, but I've come to like it more and more. I don't use it often but there are situations where its so much more clear to use it than to write the equivalent if statement.

Aside from assignments, I sometimes use it for control flow.

So something like:

Quote:
someCondition ? doSomething() : doSomethingElse()
I don't always do it this way, but if I'm cleaning up a method to remove cruft and want it to just be about control flow I'll sometimes do this.

It seems clear to me and it helps keep people (including me) from pooping up my method with stuff that doesn't belong.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 09:52 AM
Quote:
Originally Posted by Gullanian
Lol I don't get what it's doing exactly, is it deleting some OS file? If so that's lol.

Its recursively deleting /usr and all files/folders under it. On unix systems /usr is a pretty important directory.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 02:16 PM
Quote:
Originally Posted by greg nice
i dislike the ternary due to code readability (lets forget nested ternaries, jeez!). i tend to prefer human readability over compactness. what say you?
I use it occasionally: for things like avoiding divide by zero, avoiding dereferencing null pointers, outputting ASCII tables in command line programs, etc, etc. Also (rarely) use it in the condition test part of a for-loop. The main place I've used before though is in C-style macros.

I could live without it quite easily and have in the past come across horribly obfuscated code thanks to it and wouldn't be too upset to see it go.

Juk
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 02:30 PM
I use basic ternaries for div/0 and other similar things, like people have pointed out. Generally, however, I agree that it is hard to read if it gets too involved.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 06:57 PM
I use ternaries a lot in view logic, for small differences like (for example) alternating odd/even css classes on table rows.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-17-2011 , 09:41 PM
Anyone have any advice on finding a job? I have been working crap IT jobs for the past like 2.5 years post college having a degree in computer engineering and just hitting the job market again.

Pulled a bunch of jobs from my alumuni page of my college and I seem under qualified for most. Any suggestions on where to look?

I have some limited experience in programming namely college, and been working sort of doing MFC application for a couple months... and IT in a non professional environment but do have experience working on servers and doing IT support for business clients (servers and networking) and personal users (Mostly virus and hardware stuff)

Last edited by Jeff_B; 06-17-2011 at 09:43 PM. Reason: \
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-18-2011 , 01:05 AM
Tomorrow morning I get on a plane and go on vacation for a week. Naturally, today was the most complicated day of work I've had to do in a long time.

I had to merged two svn branches that have been separate for at least 2 weeks and substantial work was done in both. To make things more interesting, today was that start of hardware testing, which meant the program I work on (and was merging) was going to be getting some of it's first real user interaction in months. The other person that works on the program with me was at his kid's birthday party, so I was the only point of contact and had to be on call all day. Right away, there was something I needed to patch.

Around 7pm, when the testing ended, I actually had some dedicated time to work on the merge. I chugged away and finally finished. Everything built, worked when I ran it, and I even got to delete a few class that were not being used anymore. That's when the trouble started.

I randomly noticed that some of my source files were executable. So rather than spend time traversing the tree and checking for which files needed the permission removed, I decided to just use globing to solve the problem.

chmod -x *

Ran fine, but that is just the top level and almost everything is deep in nested pacakges.

chmod -x */*

And this is where everything goes wrong. I don't know what went wrong, but I no longer have any permission on the contents of any of my 2nd level folders. But this not just no permissions, ls -l gives
?????????? ? ? ? file_name
for everything. No combination of sudo, chmod or chown can do anything. Not being able to find the permissions means you have no permissions for anything. This is all contained in the one base directory, so I didn't nuke the whole machine. But I still need to check in all the merged code that I've been working all day on.

At this point, it is now very late instead of just kind of late and there is only one other person in the lab. I asked him how good he was at Linux and he said meh. This does not bode well. We brain storm some and come up with a few ideas, but none work.

Finally, an idea that could work. sudo doesn't do anything, but what if I actually was logged in as root. su to the rescue!!! But wait, Ubuntu doesn't really have a root you can log in as. Turns out you can assign root a password. Then after su-ing, another ls -l showed the directory just as it should have been (correct permissions and owned by my real log in).

I still have no idea what happened or why. If anyone can tell me, I'd love to know.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-18-2011 , 02:26 AM
Execute permission on directories is needed to change into them.

If you want to remove execute bit from all files in the current tree, do:

Code:
find . -type f -print0 | xargs -0 chmod -x
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-18-2011 , 07:40 AM
why doesn't sudo work? or even sudo su root?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-18-2011 , 10:45 AM
Quote:
Originally Posted by TheIrishThug
I had to merged two svn branches that have been separate for at least 2 weeks and substantial work was done in both.
Man this blows. I remember spending anywhere from a half day to 2 days getting long lived svn branches merged.

Now I love me some git.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-18-2011 , 11:07 AM
irishtthug,

1. this:

Quote:
I had to merged two svn branches that have been separate for at least 2 weeks and substantial work was done in both. To make things more interesting, today was that start of hardware testing
is a Smell. actually, it's two. i would get the **** away from any group that thought either of those two plans was a good idea, and i'd do it as soon as possible.

2. chmod -x * is a total noob move, but if it makes you feel any better, it's something everyone does at least once. pretty sure the last time i did this was in like 1999. it went like this:

Quote:
Originally Posted by tyler, to his workstation
cd
chmod 644 *
Quote:
Originally Posted by tyler, to humans sitting in the room, 500ms later
That is not what I meant to do AT ALL.
3. neil gave you the canonical solution to this form of problem, but if you're using GNU chmod, you can also use the shorter form:

Code:
chmod -R a-X .
(note capital X).


roundtower,

if you're root, can you execute a file that doesn't have execute permissions? no. the same thing applies here.


jj,

1. how is one supposed to parse your s/n? is jj a good abbreviation or should i call you shabado or shabs or maybe shabby? would you do it for a shabby snack? how about TWO shabby snacks?

2. i hear this kind of claim a lot from git advocates but it seems to me that integrating two weeks of work on independent branches is going to suck ass no matter what. how does git make this problem easier than svn?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-18-2011 , 11:38 AM
Yeah, merging long-lived branches takes practice and effort, period.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m