Slashdot Mirror


User: GreyWolf3000

GreyWolf3000's activity in the archive.

Stories
0
Comments
1,743
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 1,743

  1. Re:These techniques are horrid for maintainability on Metaprogramming Ruby · · Score: 1

    The actual implementation of the functionality I described involves tons of calls to instance/module_eval, define_method, etc. that are available to every Ruby object which allow you to modify an object's methods at runtime.  The amount of code that is generated on-the-fly is both substantial and essential.  How can that not be metaprogramming?

  2. Re:These techniques are horrid for maintainability on Metaprogramming Ruby · · Score: 3, Informative

    ActiveRecord.  Let's say you have a database table called "products" with three fields, "name," "description," and "price."  This code:

    class Product < ActiveRecord::Base
    end

    Instantiates a class called 'product' which is a subclass of ActiveRecord::Base (AR::Base).  As soon as the <i>act</i> of subclassing AR::Base, occurs, AR::Base has code that infers the name of the database table (in this case 'products') as the singular, lower case version of the subclass' name (Product).  Then, it reads the table 'products' from the database, and dynamically adds getters and setters for the name, description, and price attributes.

    In addition, AR::Base knows how to respond to a lot of methods whose names aren't known until runtime.  Product.find_by_name("Table") will internally invoke "SELECT * FROM PRODUCTS WHERE name = 'Table'" and fetch a Product whose name, description, and price are reflected in the output of that SQL query.

    Hence, you can do this on the Ruby console:

    >> product = Product.find_by_name("Table")
    >> puts product.name
    "Table"
    >> puts product.description
    "This is a table (my description was living inside the database)"
    >> puts product.price
    $4.29

    It's greatly simplified, but metaprogramming allows you to construct classes and objects who <i>present</i> behavior based on run time state.

    You really have to dig in and use a language like Ruby for a while to see how powerful this is.  If you're worried about the lack of maintainability, then write good tests :)

  3. Re:Same old mistakes on Opera Sees "Dramatic" Rise From Microsoft's Ballot · · Score: 1

    ":first-child" is not some new CSS3 thing and it doesn't work in IE6. There's at least 10 such css selectors or properties I use in IE7 that don't work in IE6 that have been around for years. Also, have you never heard of a child selector?

  4. Re:how much does it cost? on Startup's Submerged Servers Could Cut Cooling Costs · · Score: 1

    I prefer to buy my servers from Dell, and if you can't take it, then I'll see you on July 12, 8 o'clock 9 pm central on pay per view! at the Royal Rumble in Las Vegas!

  5. Re:What's the problem? on Schooling Microsoft On Random Browser Selection · · Score: 1

    You remind me of the babe.

  6. Re:Games don't use multiple cores? on Today's Best CPUs Compared... To a Pentium 4 · · Score: 1

    What I don't understand (because I'm not an expert) is that it seems like you could not improve the quality or realism of the physics without shortening the time interval of the "set." Each transition from one step to the next is an inherent parallel bottleneck, since you need to build up the shared set for the next step to use. At some point, won't the simulation will return to being entirely serialized? Perhaps you can get "good enough" results by reasonably small time intervals which are still large enough to realistically solve in parallel?

    To come at this from another angle, if a gun from a pistol hits your back, and almost instantly after impact a shotgun burst hits you from the front, there will be a brief period of time where the victim is hurled forward by the pistol blast before being thrust backward by the shotgun.

    Although, perhaps for a 30hz frame rate you can always get away with ~30ms time intervals for the simulation and guarantee every 'event' which could be graphically rendered is also physically simulated.

    OK, I just answered my own question, but I spent too much time thinking about this not to post it.

  7. Re:IE6 outdated. on Is Internet Explorer 6/7 Support Required Now? · · Score: 1

    I'd agree with that assessment of IE7/8 not being *too* bad, except for three things:

    1. If IE supported display: table/table-cell/etc., layout would be much simpler. No more overflow:hidden/float:left nonsense.

    2. inline-block support is shoddy. You have to set display: inline on block level elements, and trigger hasLayout to get it to work. Not to mention, you can't set a background image containing text and push the inner text out of the box with text-indent. This is huge for designers that use fonts like Gotham for their buttons.

    3. border-radius. OMG... give me border-radius please.

  8. Re:Looks interesting as replacement for Python on An Interview With F# Creator Don Syme · · Score: 1

    I second the ruby suggestion.

    bash# irb

    >> (2..5).each { |number| puts number }
    2
    3
    4
    5
    >>

    >> (2..5).to_a
    [ 2, 3, 4, 5 ]
    >>

    >> (2...5).to_a
    [ 2, 3, 4 ]
    >>

    >> [ "apple", "orange", "banana", "peach" ].each do |fruit|
      puts "Yummy, #{fruit.pluralize}!"
    end
    Yummy, apples!
    Yummy, oranges!
    Yummy, bananas!
    Yummy, peaches!
    >>

  9. Re:Old news on Will Your Super Bowl Party Anger the Copyright Gods? · · Score: 1

    A usb cable is just wires, but that doesn't mean you can pass any ole' +/- 5V digital signal on the two data wires and expect to be able to connect the device to your computer.

  10. Re:grad vs masters vs phd the myth. on Is Programming a Lucrative Profession? · · Score: 1

    I'm personally not a chip designer, I just have a lot of friends who are, and they all find VHDL painful. I find the debate as entertaining as vi vs. emacs.

  11. Re:grad vs masters vs phd the myth. on Is Programming a Lucrative Profession? · · Score: 1

    What if they know Verilog extremely well and think that VHDL is an archaic leftover from three decades ago which is only still hanging on thanks to military contracts?

  12. Re:Editors and Debuggers on What Tools Do FLOSS Developers Need? · · Score: 1

    "There is no substitute for watching your code run on the platform in real time."

    Well, yeah.. but debuggers often alter what goes on in real time. Especially when lots of hardware interrupts are involved. I've seen first hand the damage a kernel level debugger can do. It can lead you chasing down ghosts, misidentifying problems, mask problems making them impossible to see when the debugger is running, etc.

    To be fair, I've also seen printk() screw things up. Especially when prink() is stuck running inside interrupt context and is spewing data out a serial port :)

    I found that the best way to debug the really nitty gritty hard-to-debug stuff is to bit bang wires that are connected to a logic analyzer of some sort.

  13. Re:They can't ban them. on Laptop Fires On Airplanes · · Score: 1, Insightful

    People put there pets in kennels and fly them down there.

  14. Re:Disney sells product that solves Disney's probl on Disney Close To Unveiling New "DVD Killer" · · Score: 1

    Pirates are also in the minority...

  15. Re:IBM's hardware vendor mind is taking over on IBM's Answer To Windows 7 Is Ubuntu Linux · · Score: 2, Funny

    Will the real Anonymous Coward please stand up?

  16. Re:Seems a trifle disingenuous to me on Game Development On Android · · Score: 1

    I have no idea who danaris is. I have no idea who the AC was. Nor do I require any other poster to back me up on anything I say. And if I wanted to call you a "massive douche" I would not do so anonymously, that's just not classy.

    At any rate, my explanation of bitfields comes directly from several years of designing and implementing firmware to drive 3-wire serial interfaces, DMA engines, custom FPGAs, and more, as well as a proprietary point-to-multipoint network protocol implementation.

    I doubt you'll believe me, and I'm certainly not going to imply anything about you're C skills, but whatever. I think your point was stupid because you listed aspects of C that, as far as I know, are not important aspects of ObjC. The GCC Apple ships has garbage collection for ObjC. Function pointers are useful for things like implementing data structures that can accept callbacks and jumping to a function whose address you don't know until run time. Guess what? ObjC has a runtime library built in to it that handles dynamic binding via message passing. Unions are nice for a few things, but not *required* to implement anything. Pre processor macros can make an existing codebase pretty hard to understand, but we're really talking about people building ObjC/cocoa based iPhone apps vs. Android apps in Java... the list goes on. You did not bring up valid barriers to someone learning to develop iPhone applications.

    For the record, I also don't use and IDE for any of my work. Currently I work with Ruby on Rails and use nano inside a screen session. I could be faster with vim or emacs, but I find my text editor isn't slowing me down, and I'm pretty much stuck on the pico style key bindings.

  17. Re:Seems a trifle disingenuous to me on Game Development On Android · · Score: 1

    "So, given Android programming is much easier (far more programmers know Java than Objective C)"

    Yeah, and Windows is easier than Linux because for more people use it.

  18. Re:Seems a trifle disingenuous to me on Game Development On Android · · Score: 1

    FWIW, bitfields are great for hardware specific device driver code. They let you hit specific hardware registers mapped into memory without having to do any bit level manipulation. There are portability issues, but GCC at least has some techniques you can use to enforce ordering and packing.

    I do agree that the parent's argument was stupid; he was just rattling off C keywords hoping to make Obj-C programming for the iphone seem as difficult and obtuse as C can be when you use it for extremely low level code.

  19. Re:Maybe software prices are too high? on BSA Says 41% of Software On Personal Computers Is Pirated · · Score: 1

    Well clearly a new computer plus Windows 7 will cost more than Windows 7...

  20. Re:For being the opposite of Bush on Barack Obama Wins the 2009 Nobel Peace Prize · · Score: 1

    Dude, you don't have to attend Sunday School to know that the laws of Leviticus are not practiced in Christianity (not invalid, just belonging to an ancient people at a different time). The laws Moryath was speaking about are as much valid today for Muslims as "love thy neighbor" is for Christians today. I'm not saying either law is correct, but merely that only one can be justifiably used as the basis for law in a theocracy.

  21. Re:Will Ben Ever Learn? on Ben Heck's PS3 Slim Laptop · · Score: 2, Informative

    There are apparently legal gray areas with that that CmdrTaco doesn't want to get into. If I recall correctly, it's not clear that he has the legal right to take someone else's content, throw it up on some other server that does not earn the original author ad revenue, and post a link to it on the home page.

  22. Re:Anti-trust? on NVidia Cripples PhysX "Open" API · · Score: 1

    But they did have a monopoly on SSL offload chips and if they decided to disable SSL acceleration if you ran DB2 instead of Oracle because they were a start-up funded with by Oracle's venture capital wing then the analogy would be appropriate.

    Better analogy than mine to be sure, but the question is still "should antitrust come in to play"... since anyone could be considered to be a monopoly if you narrow the "market" sufficiently, you can't just lump any dick move that a company makes as being an antitrust violation.

    Ah, so only the people who don't need a card for phsyx acceleration and thus probably have not purchased one have the right to complain that nvidia is disabling such cards? The people who actually paid for it and got screwed over, they have no standing, eh? WTF are you smoking?

    Look, there's no question this is an anti consumer move. I don't buy nvidia, and I don't see them as the good guys here. It just seems silly to think that the anti trust laws should somehow protect us from any dick move a company makes, especially when it comes down to a $250 dollar novelty item you bought to play games. Don't the courts have better things to do?

  23. Re:Anti-trust? on NVidia Cripples PhysX "Open" API · · Score: 1

    No, it's more like when the first SSL offload chip was introduced into the network card market, said company did not have a "monopoly" on secure communications. If your computer doesn't have the power to run uber realistic physics models in real time without PhysX then you don't have any reason to belly ache about anti trust.

  24. Re:Waste MORE time!? on Obama Makes a Push To Add Time To the School Year · · Score: 1

    I've seen the Bush administration accused of a lot of things, and I've become accustomed to just believing them without questioning them... but exactly what policies can you point to that reflect anything about "being in the right family was assumed to be the key to getting ahead?" I don't see it anywhere in NCLB....

  25. Re:The way I do it on Data Locking In a Web Application? · · Score: 1

    Not a bad recommendation.. one nitpick.. I would call the columns "lock" and "lock_timestamp."