News:

Welcome to PGG Forums:
Ask for tips and advice ranging from men's fashion, grooming, hairstyles and dating women.

Main Menu

programming

Started by carpediem, January 10, 2011, 10:19:40 PM

Previous topic - Next topic

Hitad

Quote from: carpediem on May 31, 2011, 11:29:02 AM
Quote from: Hitad on May 31, 2011, 12:06:57 AM
Do you guys agree that the best programmers are Mathematicians?


Not necessarily, although the better programmers tend to be those with good mathematical background. Computer science is basically applied math.

Indeed.
Honestly hindi ako magaling sa math. I got really mediocre grades before as I find it boring plus the teachers who are boring tolo. I'm quite fortunate that I did pass them all. 


carpediem

Quote from: Chris on May 31, 2011, 12:45:18 AM
math + logic = programming

sabi ng isang teacher namin dati:

algorithms + data structures = program

Hitad

Quote from: Hitad on June 01, 2011, 10:33:52 AM
Hi guys ano nga ulit yung "hooks"?
Tried to research pero ready-made frameworks na kasi yung mga nakikita ko..
Are they just the usual functions with that name? thanks1

carpediem

^ I'll try to answer your question through very rough examples. A "hook" lets you customize behavior by allowing you to provide additional actions on certain events. For example (in pseudocode):

Class MyParentClass
  procedure before_action1() { null }

  procedure action1() { ...... }

  procedure after_action1() { null }

  procedure before_action2() { null }

  procedure action2() { ...... }

  procedure after_action2() { null }

  procedure run() {
    before_action1()
    action1()
    after_action1()
    before_action2()
    action2()
    after_action2()
  }

Here we have a parent class that does two actions, 1 and 2. The before and after procedures are very simple implementation of hooks, and these do nothing by default. In a child class, you can provide your own actions to these hooks (and they will be called automatically by definition of the parent class), thus customizing your own class -- you "hook" your own actions before or after an event is called.

Sometimes it can also be done dynamically, for example:

Class MyClass
  private hooks = []

  procedure register_action(a_proc) {
    hooks.add(a_proc)
  }

  procedure run() {
    ......
    for proc in hooks
      proc()
    ......
  }

Here the class has a private array which you can provide your own procedures via register_action(). All of the procedures in there will get executed when run.

Hitad

Wow thanks carpediem. That was very fundamental. I commend you for that. Many thanks for explaining it!!

ram013

Galing...bow! Master

eLgimiker0

carpediem, isa kang dakilang nilalang

Hitad

#157
Quoteguys pano kaya ako makakgawa ng ganitong program. Gusto ko kasi ganito ang mangyari:
for example pag nagkaron ng method chaining like:



var wrapper = new Foo();
wrapper.append('<level1>').wrapper('<level2>').wrapper('<level3>');
wrapper.output();  

// should display
<wrapper>
       <level1>
             <level2>
                     <level3>
                    </level3>
            </level2>
       </level1>
</wrapper>
---

pero pag hindi naman method chaining like:

var wrapper  = new Foo();
wrapper.append('<level1>');
wrapper.append('<level2>');
wrapper.append('level3');
wrapper.output();

//should display

<wrapper>
     <level1>
     </level1>

     <level2>
     </level2>

     <level3>
     <level3>
</wrapper>


sinusubukan ko kasing gumawa ng simple xml builder. Kanina ko pa iniisip yung logic using OOP pero di ko makuha  :'(
Baka kasi may hindi ko napag-aralang scope.

EDIT: SOLVED. lol

carpediem

The latest rumor is that MS might be starting to abandon .NET. They demoed Windows 8, showcasing the latest "Tiled" mode of the OS, that is based on HTML and JavaScript. However .NET and Silverlight were never mentioned.

Microsoft refuses to comment as .NET developers fret about Windows 8

Hitad

Ang weird ng structure ng javascript. Everything is an object, kaya I often make mistakes dati nung di pa ko gumagamit ng framework like jquery.

carpediem

Ganun talaga yung mga object-oriented languages, especially those "pure" ones, where even primitives like numbers and characters are objects. For example in Ruby,

5.upto(10) { |i| print i }

will output 5678910

Hitad

So how is ruby like? I'm like choosing between python and ruby as the next language I'll try to learn.

carpediem

^ Actually I don't know Ruby. haha! Though I read quite a number of reviews about it, comparing it to Python. I know Python.

These two languages are very similar. Both are scripting languages, and give you the power to quickly get things done. They both try to make programming as fun as possible.

Python is more readable. In fact readability is probably the main aim of Python. It is claimed to be "batteries included", such that most you'll need are already included in its standard library, and if you need extra functionalities, they most probably already exist as additional libraries and can be downloaded and imported to your programs.

Ruby seems to be more OO, as I think it was designed to be OO from the ground up. Because of this, it is more elegant in terms of "OOness". (Just the impression I got from what I've read.)

It all boils down to personal preferences. Check their entries in Wikipedia and try to check sample codes and syntaxes and see which one suits your taste better. :)

Hitad

^
Wow sinearch ko nga sa wikipedia. I find ruby matipid sa code hahahaha
Hindi ko pa alam kung alin sa kanila. By the time siguro na uber bihasa na ko sa web development saka na ko mag-aaral nun. Mejo fresh pa me  8)

--
kakatapos ko lang mag-aral ng regular expression (intermediate), it's really a nice tool! Dati deadma lang ako...

eLgimiker0

Hitad, hindi pa ganun ka stable yung Ruby, nag uupdate pa din sila pero marami na din gumagamit at ngsabi na maganda ang ruby. tried it before pero hindi ako nagtagal. i used ruby on rails. maganda din pagaralan. gusto ko din pagaralan yan pag may mas mahabang time. for now SharePoint ang gamit ko. ahahaha

Thanks carpediem  :D