Open Side Menu Go to the Top

07-15-2014 , 03:14 PM
That actually sorta made sense. Still don't know if I coulda done what I wanted to do. I think if I keep going with extra-curricular study I should get to the point of doing it though.

If anyone wants to take a moment to look at the set up and explain the best way of doing this, feel free. Won't be offended if everyone ignores it though. Already turned the project in so it's no sweat off my back.

Setup:

World object, 3 actor objects. 2 actors can damage the third, a user-controlled object. They do different amounts of damage.

How I have it now:

User-controlled gets the methods for taking damage and calculating if he's dead.

How I wanted it:

Each damage dealer has his own method for damaging the user-controlled object. They update a health variable in the world object by invoking a method from the world object. Method invoked in world object checks if game is over.

I was getting that error when I tried to call the world's method from the damage dealers. If I'm understanding you correctly, I would first need to create a new world object in the damage dealers' methods to be able to borrow the health manipulating variable (which is attached to the world object)?

Get the feeling this can't be done the way I was wanting to do it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-15-2014 , 05:01 PM
Not sure I'm follwong the example but why are the actors not in the world (world has actors). That way you can just create an actor for the player and one for each bad dude and do something like this in the world:

int demage;
Actor player a new Actor();
Actor villain1 a new Actor();
Actor villain2 a new Actor();
...
damage = villain1.attack();
player.reduceHealth(demage);

Not even sure I understand what you're doing but it makes more sense that the world is the "main where stuff happens" at first glance.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 09:40 AM
Quote:
Originally Posted by Low Key
...

How I wanted it:

Each damage dealer has his own method for damaging the user-controlled object. They update a health variable in the world object by invoking a method from the world object. Method invoked in world object checks if game is over.

I was getting that error when I tried to call the world's method from the damage dealers. If I'm understanding you correctly, I would first need to create a new world object in the damage dealers' methods to be able to borrow the health manipulating variable (which is attached to the world object)?

Get the feeling this can't be done the way I was wanting to do it.
First of all kudos for knowing how you want to do it as opposed to just hacking at it. It may seem trite to some but in my view that is excellent on your part.

Take this FWIW but I can think of two ways.

1) pass a reference to the world object as an input parameter to your damage dealer methods. Overwrite the damage dealer methods you want that are unique to the particular damage dealer keeping the same method signature (polymorphism).

2) use the singleton design pattern to implement the world object. Overwrite the damage dealer methods you want that are unique to the particular damage dealer keeping the same method signature (polymorphism).

This may seem more complicated than it really is. Google is your friend on new terms.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 09:56 AM
Quote:
Originally Posted by Low Key
It's not that I'm not grasping it so much as we haven't even talked about it at all in classes, readings, or videos.

I had the same problem in learning French: I'd always try to make complex sentences that we hadn't learn how to do yet.

I just wish I could figure out about how far in i'd have to go to learn this stuff.
IIRC you are coding in Java. Actually grasping what static memory really entails is a fairly low level concept and is a relic of C. Even when you cover the concept when learning Java I am fairly certain you'll approach it in a purely abstract manner but could be wrong about that. It is similar to the concept of pointers in C. If you've done any significant amount of assembly language programming you almost certainly have used indirect addressing. Stepping up to C from assembly language makes understanding the concept of pointers as basically a trivial exercise. Tackling pointers purely in an abstract way makes it a lot more difficult for most to grasp the concept.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 11:17 AM
Quote:
Originally Posted by adios
IIRC you are coding in Java. Actually grasping what static memory really entails is a fairly low level concept and is a relic of C.
Static keyword in Java doesn't have that much to do with static keyword in C.

Here's the rough equivalence table:

Java -> C

public static variable -> global variable
private static variable -> global static variable
public static method -> function
private static method -> static function
??? -> static local variable

Outside of local context, static in C roughly means private in Java (really private static in Java, but everything in C is already static as far as Java is concerned). Within local context, static in C has no equivalence in Java.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 11:55 AM
I was wrong, we did at least cover static methods. With about a sentence.

Quote:
methods that belong to classes are marked with static in their signature, and are also called class methods
So, not entirely explanatory.

Leaves me wondering if I can just append the signature of the world method I wrote and make it static. Don't entirely get the benefits or drawbacks of that, but I can do some looking around to find that out.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 05:01 PM
Quote:
Originally Posted by candybar
Static keyword in Java doesn't have that much to do with static keyword in C.

Here's the rough equivalence table:

Java -> C

public static variable -> global variable
private static variable -> global static variable
public static method -> function
private static method -> static function
??? -> static local variable

Outside of local context, static in C roughly means private in Java (really private static in Java, but everything in C is already static as far as Java is concerned). Within local context, static in C has no equivalence in Java.
I was including C++. I think I actually made a distinction a between viewing static in the abstract vs. how it is actually implemented and thus I was referring to how it is implemented be it a JVM or directly executable code but whatever.

X Allocated in a separate memory space at compile time separate from the stack and the heap where allocation occurs at run time.

X Certainly not for C but for C++ is common to all instantiated objects of the class IE scope of a static methods are identical. Of course in C a static function's scope is limited to the module it is defined in.

X Java strongly influenced by C and C++

Last edited by adios; 07-16-2014 at 05:22 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 10:02 PM
Has anyone shelled out for an Aeron or equivalent? Thoughts? I spend a ton of time in my home desk chair but not sure I can justify $900 - sort of on the fence.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 10:08 PM
Go to a used office furniture store and sit in some chairs. $900 chairs are for 90's start up companies.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 11:08 PM
I get a new $200-$300 chair from Office Depot every 4 or 5 years. Works fine for me and I'm pretty large, with a sensitive back, and have worked at home/grinded poker full time for long stretches.

Although now I do most of my work at home on a Mac Air sitting in one of these:

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2014 , 11:31 PM
As a poker player I had an aeron and an embody. I really liked both of them but loved the embody. Both are definitely better than the aeron knockoffs at work.

When I moved across the country after black Friday, I sold my aeron for 5 or 6 hundred bucks and the embody for either 900 or 1000. The aeron was probably 4 years old and the embody was 2

Now that I've got my first programming gig, I'm thinking about getting another embody
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 12:06 AM
I have one of these at work and one at home. I like to sit close to my desk and high. The arms on the other chairs get in my way.



**********

I want to double post, but eh.

After working with this PL/pgSQL (which I suck majorly at, lol), I find it disconcerting to program in Python without declaring the argument types. It probably has something to do with the Python talking to the database, so it feels like I'm trying to program on top of something that doesn't fit well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 12:41 AM
have pretty much same chair suzzer and am typing from it
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 04:24 AM
Snagged a pretty nice $200 chair from office max recently. Found it on Amazon for fifty off and they begrudgingly honored the discount.

It was only begrudgingly because it was an office max brand chair and the salesman couldn't figure out how someone else was selling their brand of chair.

At this point, I'm pretty sure a phone with web access could probably save you as much money per year as you spend on the phone itself, if you make a fair amount of >$100 purchases.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 05:31 AM
Quote:
Originally Posted by daveT
I think I have something I'm relatively happy with on this Python OO stuff. I pulled the common stuff out and put it and created a new module (it took me more than 5 minutes to successfully import the modules, thus it is way to ****ing hard).

Code:
class OrderQuery(Universal):
    def creation_time(self, from_date, to_date):
        self.query['CreateTimeFrom'] = from_date
        self.query['CreateTimeTo'] = to_date
        return self

    def include_final_value(self):
        self.query['IncludeFinalValue'] = True
        return self

    def modified_between_dates(self, from_date, to_date):
        self.query['ModTimeFrom'] = from_date
        self.query['ModTimeTo'] = to_date
        return self

    def by_day(self, days):
        if days <= 30:
            self.query['NumberOfDays'] = days
        return self

class Query(OrderQuery):
    KEYS = ['IncludeFinalValue',
            'NumberOfDays',
            'Order_status',
            'EntriesPerPage'
            'PageNumber',
            'ModTimeFrom',
            'ModTimeTo',
            'Pagination']

    def __init__(self, **kwargs):
        self.query = {}
        for k in kwargs:
            self.query = dict(zip(self.KEYS[k], value))
The chaining was a terrible idea. It was ugly, and for some reason, order seems to matter. Also discovered that multiple inheritance doesn't quite work the way I'd expect it to.

Since this would be abstracted away, using this strategy is better, IMO:

Code:
dd = Query()
dd.by_day(6)
dd.modified_between_dates('then', 'now')
dd.get_pagination(5, 4)
dd.include_final_value()
dd.sorting_order('Ascending')
dd.by_status('Active')
Thus:

Code:
print(dd.query)

{'Pagination': {'EntriesPerPage': 5, 'PageNumber': 4}, 
'ModTimeTo': 'now', 
'ModTimeFrom': 'then', 
'SortingOrder': 'Ascending', 
'NumberOfDays': 6, 
'IncludeFinalValue': True, 
'Order_status': 'Active'}
OO is pretty hard: I definitely see why people struggle to go from OO to FP.
It doesn't make sense to inherit a Query from an OrderQuery. You're going to run into problems when you need to make another query type. It also violates the Liskov substitution principle and is just plain confusing for anyone reading the code. I would also keep all the OrderQuery related code in a single class (the methods and keys class variable) which inherits from a generic base class with all of the generic query related stuff (query variable and generic init method).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 05:57 AM
Quote:
Originally Posted by Grue
Has anyone shelled out for an Aeron or equivalent? Thoughts? I spend a ton of time in my home desk chair but not sure I can justify $900 - sort of on the fence.
It's worth every penny. I can count the number of days I get discomfort from sitting in a year on one hand. I feel like I can sit in my Embody for 8+ hours a day for weeks on end and not have issues. While waiting for my Embody to be delivered, I had a £50 ikea chair and after 4-6 weeks I'd start getting back pain within an hour or two of sitting down.

Even if you ignore the benefits of having a better chair, the build quality is really high and I could easily see one of these (expensive, ergonomic) chairs lasting 15+ years. My 5 year old Embody is like new (apart from damage inflicted by cats) and it has seen heavy use.

While I prefer the Embody (and this is definitely subjective), unless you have money to burn, I'd say just buy a used Aeron (and had I been aware of this option at the time, this is the route I would have gone). I believe you can pick them up for ~$400-500.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 10:36 AM
Quote:
Originally Posted by Grue
Has anyone shelled out for an Aeron or equivalent? Thoughts? I spend a ton of time in my home desk chair but not sure I can justify $900 - sort of on the fence.
I have tried a few.

The marketing and advertising for these products are very good, because they convince you that the health benefits are huge, given the large amount of time you spend in your chair at your computer. Its all about your health. The reasoning is sound.

I used a Herman Miller Aeron at work at an internship during college. I didn't like it. I thought it was uncomfortable to sit in. The Embody looks interesting though.

I bought the Humanscale Liberty for use at home. It was definitely comfortable and kept me in good posture. I liked this chair.

Originally I had a simple Leather chair from Staples. This was comfortable too. I never had back issues or anything, and I would spend hours at the computer either browsing, programming, or playing games.

When I next moved, I bought a Salli saddle chair. These chairs are designed to keep you upright by allowing your hips to stay open at around 135 degree angle, rather than the normal 90 degree. The lack of back support isn't an issue, because the angle of the chair forces your legs/hips upright. However, desk height becomes an issue. In combination with this, I bought an adjustable geekdesk, which allowed me to raise the desk as high as I wanted. It is remarkable how awesome it is to have the desk at standing height. The saddle chair was a little weird though.

Ultimately, my opinion now is that none of this matters. The best thing for your health is to not stay stationary in one position for too long. Even the video on the Embody webpage, the first thing it says is "Sitting is bad for you". Thats the great thing about the saddle chair/standing desk: it made it so easy and natural to just walk away and do something else for a few minutes. You may not realize the subtle resistance to getting up and walking around, when you have to lift your weight off a normal chair from a lower position.

Right now, I'm in a furnished apartment, so my setup is not ergonomic at all. But its more important for me to just take proper breaks, move around, etc. So I would probably not spend a fortune on all of this stuff in the future. Probably if I had my own place, I'd get another geekdesk though.

On a side note, getting a negative tilt keyboard tray is arguably more important imo (I had one from Humanscale when I got my Liberty chair. When you use your computer, you control it via keyboard and mouse. So you can have the best chair in the world, but you will still need to make bodily adjustments for the placement of your controls. Having a negative slope allows your arms to relax down on the keyboard, giving you something like suzzers lazyboy + macbook air on lap setup.

Last edited by greg nice; 07-17-2014 at 10:49 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 01:10 PM
Anyone with experience using both Visual Studio and JetBrains Webstorm have a preference for one or the other? I'm leaning towards VS but for some reason Webstorm has me intrigued. Right now I'm really only using these to follow through tutorials and courses online (mostly Pluralsight) as I try to learn AngularJS. I'm not a full-time developer, but my job is giving me the opportunity to work towards that. Here are the pros for each IDE as it applies to me:

Visual Studio:
-I have a license for VS Ultimate 2013 (through my job)
-Resharper
-When I do move to development full time, I'll be using ASP.NET MVC/Web API for backend stuff

WebStorm:
-The courses I'm working through on Pluralsight mostly seem to use this IDE
-Seems to have better support for Angular so far
-I work in a Mac environment for my regular work duties, so it's nice not to have to switch back and forth to my Windows VM when I have time to work on development

All that being said, I'm still leaning towards Visual Studio, mostly because that's what I'll be working in eventually anyway. WebStorm just has me intrigued, and I would love to hear what others have to say about it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 02:10 PM
Ive never had a chair from office max last longer than 3 years, and I buy the nice ones. One of the few instances imo that getting the warranty they always try and sell you at the register is worth it. (tape it to the underside of the chair, so you dont lose it)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 02:36 PM
Instead of investing in chairs, does anyone use an adjustable height desk so that they can switch between sitting and standing?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 05:36 PM
So I'm in my first software engineering position and just started. I've set my Angel list and white truffle settings to show me as not looking, but I keep getting companies contacting me.

I'm very happy where I am and don't foresee looking in the near future, so I'm wondering how to handle these things.

Do you decline the introduction, ignore it and let it expire, or accept but respond with a thank you but I'm not interested?

Sent from my SAMSUNG-SGH-I747 using 2+2 Forums
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 05:52 PM
Just ignore.

Also wtf is angel list and white truffle?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 06:08 PM
lol "ignore it, also, wtf is it?"

Its pretty funny when this is the correct answer.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 06:13 PM
Well I'm assuming it's recruiting emails.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-17-2014 , 06:45 PM
Quote:
Whitetruffle | Matching tech talent with the best startup jobs
https://www.whitetruffle.com/
Whitetruffle connects engineers, designers, and other tech talent with amazing startups. Whitetruffle puts candidates in the driver's seat allowing them to control ...
.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m