Open Side Menu Go to the Top

04-19-2014 , 01:18 PM
Quote:
Originally Posted by gaming_mouse
depending what language you're using, objects can be fine if your design is right. a while ago i rewrote the 2p2 hand evaluator in Java, and had a serialized file for the LUT. iirc it was ~230MB or so, so not bad at all. if you are ok with having that kind of memory in RAM (these days it's kind of nothing) then the hand eval code becomes really simple if you take the generated LUT as a given.

c#, just need to write why i created my hand evaluator this way for my dissertation and not sure what i can say the benefits are given performance is a huge tradeoff and like you said, its nothing to have 230mb in RAM these days. ( i guess i could just exaggerate RAM use in LUT method and bang on about how object method isnt nearly as much)
** 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 **
04-19-2014 , 01:23 PM
in theory the benefits would be readability and maintainability (most of the C open source stuff scores low on these metrics imo), but in practice an OO rewrite could make it worse, it all depends on your design execution.

EDIT: btw i just remembered i endeup up using trove library to boost speed... so yeah you do have to be careful where you use objects. iirc i used them to make that code that generates the LUT more readable (that's where most of the complexity was), and then i basically didn't use them in the eval code itself, which is just array lookups.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-19-2014 , 03:36 PM
Quote:
Originally Posted by Shoe Lace
How can you seriously write that?

You realize I am charging people right, but instead of getting $30/month I get 10 months of that up front. I did state that multiple times now, I'm not sure how much more clear I can make it. I'm willing to sacrifice literally 2 minutes of my time on something that happens like 0.000001% of the time for the money up front.

I've never once been in a situation where I've gotten "decimated" over it. Also that statement is implying that I don't charge people for other non-server issues but that's wrong because I do. I'm not going to work for free and I always limit revisions/etc. and have contract clauses that make people aware that extra work will cost more money.
What everyone is trying to say is that there is a Jedi mind-trick here. If you billed $30/month instead of $300/month upfront, you would have a consistent and continuous income flow and this would serve as a constant reminder to the client that you are always there and you are awesome.

The flip side of this is that the owner is going to give your number to the cashier, the secretary, and the hair dresser, so you have a higher chance of being flooded, especially when they decide to hire their niece straight out of high school as their marketing guru, who doesn't quite know your back-end ui, so you will end up getting 15 phone calls during some month.

Quote:
It's also more like forums vs me because I simply stated that you cannot say your time is worth money until ALL of your time could be billed. Somehow that ended up with a bunch of people questioning my billing structure.
Yes, everyone is running blind.

There was an interesting saying one of my bosses used to say: "In real life $5,000 is a lot of money. In a business, that means nothing."
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-19-2014 , 07:43 PM
I've been taking a look at this PL/pgSQL. Very interesting language with a bunch of interesting stuff going on. It's a bit more low-level than I'm used to working at, since it allows a bit of exposure the the database engine itself.

The following is an example from the book I have.

You can create your own types (you can also do this is PostGIS):

[php]create type fruit_qty as (name varchar, qty int);

select '("apple", 3)'::fruit_qty;[/php]

The code example is contrived in a way. I guess they could have adjusted it to show profit, but since this was in the intro chapter, I have this:

[php]create function ft_larger_than (left_fruit fruit_qty,
right_fruit fruit_qty)
returns bool
as $$
begin
if (left_fruit.name = 'apple' and right_fruit.name = 'orange')
then
return left_fruit.qty > (1.5 * right_fruit.qty);
end if;

if (right_fruit.name = 'apple' and left_fruit.name = 'orange')
then
return (1.5 * left_fruit.qty) > right_fruit.qty;
end if;
return left_fruit.qty > right_fruit.qty;
end;
$$
language plpqsql;[/php]

and then compare apples to oranges:

[php]select ft_larger_than ('("apple", 3)'::fruit_qty, '("orange", 2)'::fruit_qty);
>> f

select ft_larger_than ('("apple", 4)'::fruit_qty, '("orange", 2)'::fruit_qty);
>> t[/php]

What? Don't like calling functions? Isn't clear enough? Looks too ugly?

[php]create operator > (
leftarg = fruit_qty,
rightarg = fruit_qty,
procedure = ft_larger_than,
commutator = >
);

select ('("apple", 2)'::fruit_qty > '("orange", 2)'::fruit_qty);[/php]

I'm still not sure if stuff like this is really cool or bogus witches brew.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2014 , 10:33 PM
Hey guys I'm trying to teach myself programming and have decided to start out with C becuase it's a lower level language. What I want to do is break down programs on github, in order to understand how to write programs better myself.

I was wondering if anybody had some tips on finding beginner/intermediate github repositories written in C. Don't know if this is something regularly done, or what, but I figured I'd ask about it here. Thanks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 05:49 AM
Somewhat quick and dirty hack, not sure if I can implement it more efficiently. I have a map and there's a special, invisible layer "triggers" in which I mark certain things. Just imagine a background image that has a path on it or something. The part of the graphic that contains the path also has the invisible pixels that mark it as "walkable". I only want the player to walk on that path so if he clicks the mouse somewhere on the path...presto the player moves there (teleports since animation isn't done yet...also pathfinding is not required yet). If he clicks somewhere else...I let the player walk to the closest x-axis position.

[I'll move all the walkable tiles into a variable to save one call to the find]
Code:
  def __on_walkable(self, position):
    position_rect = pygame.Rect(position, (1,1))
    return self.__tilemap.layers['triggers'].collide(position_rect, 'walkable') 
  def __closest_walkable(self, position):
    cells = self.__tilemap.layers['triggers'].find('walkable')
    position_x = position[0]
    smallest_difference = self.__screen.get_size()[0]
    for cell in cells:
      x = abs(cell.px-position_x)
      if x < smallest_difference:
        smallest_difference = x
        position = (cell.px, cell.py)
    return position
  def position_to_destination(self, position):
    if self.__on_walkable(position):
      return position
    else:
      return self.__closest_walkable(position)

---

elif event.type == MOUSEBUTTONDOWN:
        if event.button == 1:
          # TODO: Walking animation (via update) + A*-pathfinding if there are objects on the path
          # check for "walk" action
          self.actor.update_position(self.current_scene.position_to_destination(event.pos))
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 08:42 AM
any australian programmers itt? want to move to australia at end of year and try get a programming job. Just wondering how difficult this is for someone who has just finished uni and will have to constantly apply for working visa's every year ?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 09:20 AM
Quote:
Originally Posted by animas
Hey guys I'm trying to teach myself programming and have decided to start out with C becuase it's a lower level language. What I want to do is break down programs on github, in order to understand how to write programs better myself.

I was wondering if anybody had some tips on finding beginner/intermediate github repositories written in C. Don't know if this is something regularly done, or what, but I figured I'd ask about it here. Thanks.
Why start out with a lower level language? There are some, in my view, preferable reasons as opposed to others. One would be to understand how much easier it is to manage complexity with higher level languages. Another would be to understand fundamental data types that are "close to the machine." Another would be you are interested in pursuing embedded, real-time type development, especially on target platforms with fairly limited resources.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 09:28 AM
Learning lower level languages first, is almost always a mistake imo.

Pick something like Python and learn the basics of programming. Then once you have that handled and you're really interested in lower level concepts you can get into lower level details.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 11:30 AM
agree with jj. starting with C is a mistake, and then trying to learn C by reading the source code of github repos is a double mistake.

there are so many great resources for learning programming.... don't try to invent your own curriculum based on some vague notions that sound philosophically right to you.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 02:05 PM
Just picked up nerd ranch obj-c book. Pretty good book so far and the language seems really similar to what I am learning in the java class.

I would recommend for anyone looking to get into iOS development.

Last edited by Barrin6; 04-21-2014 at 02:23 PM. Reason: Grammar
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 05:10 PM
Thanks for the reponses guys. I guess I'm gonna work through the CS50 course on edx first, then take it from there.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 08:32 PM
Quote:
Originally Posted by animas
Thanks for the reponses guys. I guess I'm gonna work through the CS50 course on edx first, then take it from there.
cs50x starts you off learning C btw, about 85% of the course is C. A couple of others on the forum don't like that but I think it's worth learning at the start.

Without taking shots at anyone on the forums, how many of them are highly acclaimed professors who have been running a successful entry level computer science course at one of the most prestigious universities in the world for many years as well as run an online course that has had tens of thousands of students go through it?

There's a reason why most people who take cs50 praise it to end (myself included). Long story short, what you learn is way more important than the language. Knowing a language is like 1 step out of 100 things you need to know. The less time you worry about picking a language the better.

Last edited by Shoe Lace; 04-21-2014 at 08:37 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 08:35 PM
Lol. You can find successful introductory CS courses offered by highly acclaimed professors in at least half a dozen languages. Silly appeal to authority is silly.

Shoe, I'd love to hear your thoughts in my consulting thread!

Edit: To be clear though, if you really want to learn C first, then a course geared to teaching C as an introductory language is a reasonable way to do it. Teaching yourself C is not.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 08:36 PM
Yeah but how many of them have a cult following? I've taken a lot of online learning material and cs50x is like rated a 15 on a scale of 1 to 10 while everything else is maybe a 4 relative to cs50x. It's that much higher quality. The only thing that's on its level is the original SICP course but they have a drastically different teaching style and the content is quite different.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 09:32 PM
fwiw, i think C in the context of that course is at least fine, and maybe it's great. i don't think it's impossible to learn programming well starting with C, but i think it's a lot harder and you better have a great teacher.

shoe, as jj said, you can find smart, accomplished people who will recommend drastically different learning strategies for a beginner. so yeah, your argument is kind of silly.

i learned C first many years ago, and i wish i hadn't. while it has some positives, such as learning about how the machine works, i think it ultimately distracts you with unimportant implementation details and, more importantly, it deeply embeds an imperative rather than a declarative approach to programming that can take years to overcome. for my money that is the single most common, and worst, mistake you can make.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 09:37 PM
I can't vouch for cs50x but I heard only good things so far.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2014 , 10:49 PM
Quote:
Originally Posted by gaming_mouse
more importantly, [C] deeply embeds an imperative rather than a declarative approach to programming that can take years to overcome. for my money that is the single most common, and worst, mistake you can make.
The trope about a Cobol programmer programming every language in Cobol goes all directions, IMO.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 12:36 AM
Quote:
Originally Posted by daveT
The trope about a Cobol programmer programming every language in Cobol goes all directions, IMO.
there is a lot of truth in this statement.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 12:45 AM
Quote:
Originally Posted by animas
Thanks for the reponses guys. I guess I'm gonna work through the CS50 course on edx first, then take it from there.
Just to clear, I agree with JJ and GM. My professional work involves working on C and C++ exclusively. There are reasons to learn C but not that many. Certainly not as a way to learn a lot of programming concepts that are widely in use today. In fact there are some practices with C that in my view are outright terrible.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 04:14 AM
This discussion is giving me deja vu:

http://forumserver.twoplustwo.com/19.../index629.html

animas - I've argued against C as a first programming language before for some of the same reasons others have mentioned but from your posting history it sounds like you are not a complete noob. If so, I say go ahead and give CS50x a shot, it's way better than your typical "intro to programming" course.

Stay away from C++ and Java for a while though, at first it helps to stick with simpler languages and syntax.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 08:21 AM
Quote:
Originally Posted by adios
there is a lot of truth in this statement.
4 languages and I'm learning Ruby...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 08:24 AM
Shoe, a good teacher is the exception that breaks the rules about what language to start with. Most people don't have good teachers, I'm not even sure I'd go so far as to say watching an online course from a good teacher rises to the same level. C is difficult and confusing, programming is hard enough to do from scratch without the language fighting you.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 08:46 AM
I started with C++ which is just way harder to do simple stuff than ruby. Part of the important part of learning to do anything is to not get discouraged.

Learn good fundamentals with a language that won't make you quit in the process, and learn stuff that's closer to the metal when it actually matters (still hasn't to me).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-22-2014 , 09:08 AM
Quote:
Originally Posted by kerowo
Shoe, a good teacher is the exception that breaks the rules about what language to start with. Most people don't have good teachers, I'm not even sure I'd go so far as to say watching an online course from a good teacher rises to the same level. C is difficult and confusing, programming is hard enough to do from scratch without the language fighting you.
He just stands in an auditorium and speaks to a packed room, then it's recorded for the online version but I would agree it's probably not close to the real thing since you can talk to him personally after class.

I'm just saying I think there's a reason they chose it as a first language. They teach you just enough implementation details to get going while explaining data types, how memory works, etc..

It's a really great base to get started with.
** 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