Lemur's Profile User Rating: *****

Reputation: 1389 Grandmaster
Group:
Expert w/DIC++
Active Posts:
3,509 (1.8 per day)
Joined:
28-November 09
Profile Views:
110,173
Last Active:
User is offline Yesterday, 11:13 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Mac
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Honda
Dream Kudos:
600
Expert In:
Web Development

Latest Visitors

Icon   Lemur has not set their status

Posts I've Made

  1. In Topic: How to populate data/dropdown to form.input activeadmin rails

    Posted 25 Mar 2015

    The controller is going to be your problem

    If I were you I'd make a full name method on the model as well:
    class Customer < ActiveRecord::Base
      belongs_to :room
    
      def full_name
        "#{firstname} #{lastname}"
      end
    end
    
    


    Without the controller code I can only make guesses on this one. I will give you a hint though that it has to do with getting the collection of ids out of that form and select them from the collection of customers which should have been declared in your controller.

    Second hint, you should never have a model referenced in a view, that's the controllers job.
  2. In Topic: Working with 2d arrays and trying to change 'touching' indexes

    Posted 23 Mar 2015

    Let' s take a functional ride on this, shall we?

    First we're going to want to get a list of coordinates that have 1 in them:
    arr = [
      [0, 0, 0, 0],
      [0, 1, 0, 0],
      [0, 0, 0, 1],
      [0, 0, 0, 0]
    ]
    
    coordinates = arr.each_with_index.map { |row, row_index|
      row.each_with_index.reduce([]) { |row_coordinates, (item, col_index)|
        item == 1 ? row_coordinates.concat([row_index, col_index]) : row_coordinates
      }
    }.reject(&:empty?)
    
    


    Then we're going to want to get all the surrounding points. In this I just used a quick lambda and a closure to capture our bounds so as to not recompute them every loop.
    surrounding = -> x_bound, y_bound {
      x_bounds = (0...x_bound)
      y_bounds = (0...y_bound)
    
      -> coords {
        x_coord, y_coord = coords
    
        [
          [x_coord + 1, y_coord],
          [x_coord - 1, y_coord],
          [x_coord, y_coord + 1],
          [x_coord, y_coord - 1]
        ].select { |(x, y)| y_bounds.include?(y) && x_bounds.include?(x) } # We select only points that are within the bounds
      }
    }.call(arr.length, arr.first.length) # This function closes over the x_bounds and y_bounds, caching them for later use and returns a function for us to use.
    
    



    Now we want the positions where a one will be, which would be the concatenation of the surrounding points and the original coordinates we found:
    one_coords = coordinates.flat_map(&surrounding).uniq.concat(coordinates) 
    
    


    Then we just make ourselves a new array:
    new_array = Array.new(arr.length) { |row|
      Array.new(arr.first.length) { |col|
        one_coords.include?([row, col]) ? 1 : 0
      }
    }
    
    # => [
    #   [0, 1, 0, 0],
    #   [1, 1, 1, 1],
    #   [0, 1, 1, 1],
    #   [0, 0, 0, 1]
    # ]
    
    


    Call this more of a thought exercise to see if it can be done without mutation and in more of a functional style. More of I just wanted to see how it would be done. Any more I tend to value code that won't transform things as it's far easier to test later and run in parallel if the time should come (think Sidekiq, ActionController::Live, and a few others which are picky on mutations)

    Admittedly I've spent a bit too much time tinkering around Elixir, Scala, and Haskell lately so I have a few new habits.
  3. In Topic: Is a programming career risky to pursue?

    Posted 5 Mar 2015

    Yes, it's an old thread, but this bares some refuting....

    View PostBeenThereAlso, on 04 March 2015 - 12:42 PM, said:

    Your question has 3 parts and really needs 3 answers.

    In spite of the replies below or above from young people keenly coding and getting paid for it, your concerns are valid in some areas and maybe need further qualification so here goes:


    Bad assumption mate. Not everyone on here is young.

    View PostBeenThereAlso, on 04 March 2015 - 12:42 PM, said:

    1. Skill erosion. This is the major objection to programming as a long term career. It is only short term (5 or 10 years at the most. Maybe even shorter in the future) see http://mltan100.blog...ramming_01.html After that you are expected to move into management or sales. The replies above and below saying "programming is fun - go for it" are probably written by people in the peak of that short cycle with their current "hot" languages/technologies.


    This is a load of garbage, plain and simple. Management and sales are not the end of the road for programmers, it's a completely different job path. Companies that believe this are not worth the time of day. Go to any major engineering firm worth their salt and you'll notice a fork path, one leads to management and the other leads to technical leadership. They're different things and both are valuable.

    I get tired of hearing this nonsense that you're doomed if you can't be a manager. Have you talked to some programmers? Brilliant, but you never want them to try managing anything other than a project architecture. Does that make them worthless? Of course not.

    View PostBeenThereAlso, on 04 March 2015 - 12:42 PM, said:

    Some will go on to be still coding in their 50s if they are lucky. (There is still a lot of COBOL running in various places). However, if you are still in the game in your 50s you will be permanently married to your current employer until they finally phase out their legacy code then it is all over.


    Assumptions again. Not all of us get married and very rarely does a tech stick around long enough to see legacy hit. We're not all lifers, that's a bad assumption to make. I know a few 50+ peers which are still insanely on their game and could school any under 30 coder without breaking a sweat. We're talking mythic greybeards here, and those people are not ones to relegate to legacy concerns.

    View PostBeenThereAlso, on 04 March 2015 - 12:42 PM, said:

    As for retraining as the new tech comes along, the IT industry is notorious for not wanting to train anyone in anything now days (it did happen 20 years ago when I entered the game). If you do retrain, it is on your own dime and in your own time. Then no one will look at you until you have 3 years full commercial experience on the latest "hot" language/technology.


    You must work for some really crappy company mate. This is not the case in tech hubs at all. Your employer will send you to conferences, get you training, pay for books, and the works. That's common out here.

    View PostBeenThereAlso, on 04 March 2015 - 12:42 PM, said:

    2. Offshoring. This one is an unknown variable. A while ago everything was being offshored. However, much of this work is now returning onshore again. The IT industry is more fashion driven than women's clothing and constantly undergoes cycles of insource/outsource, inhouse/bureau, thin client/fat client etc etc etc. For now, offshoring is probably not too much to worry about.


    That I can agree with to a degree.

    View PostBeenThereAlso, on 04 March 2015 - 12:42 PM, said:

    3. Low Barrier to entry. On the whole, this is true. Consider the fact that about 50% of software on istore is never downloaded once. There are now good programing tools available for free on the internet and heaps of good support groups for most popular languages thus more people are coding than ever. Therefore the oversupply of programmers for writing code for SMEs and consumer software is huge. However, if you are in the top percentiles of IQ and can understand very complex algorithms and business processes easily and fast, then there will be a demand for your services with no oversupply because of the natural limitations of the number of people who fit into those top percentiles.


    IQ is irrelevant. There's an abundance of junk coders who have no idea what they're doing and assume they're a coder after getting through w3schools and friends. No, the barrier to entry is insanely high for good markets, and it keeps getting higher as you want to climb. You want to play the game you're going to have to keep an edge. That's what makes programming hard is that you're always moving and learning.
  4. In Topic: Ruby sorting algorithm

    Posted 1 Mar 2015

    View Postbrep, on 01 March 2015 - 03:16 PM, said:

    Never mind, I solved my own problem after taking a half hour break haha.

    I uncommented #switched = false and changed =! to !=. I do not understand why this solved the problem, but it did!

    If anyone knows why this solved the problem let me know.


    != is the not equal operator. =! is setting something to not value, such that =!false assigns something to true.

    That being said, learn to use the enumerable module and blocks. Most rubyists do not use for loops.
  5. In Topic: Cucumber/RSpec gem loading error

    Posted 14 Feb 2015

    Don't delete your lock file, that's a horrible idea. The amount of collisions it can potentially cause are insane. No, your lock file is meant to provide a last known good state of gems. Discard it at your own peril, and keep it version controlled at all times.

My Information

Member Title:
Pragmatism over Dogma
Age:
24 years old
Birthday:
June 22, 1990
Gender:
Location:
*.*
Full Name:
Brandon Weaver
Years Programming:
7
Programming Languages:
Ruby, Javascript, Elixir, BASH, Haskell, Common Lisp, Scala, Clojure, C#, Perl, Python, and way too many others to reconcile with.

Contact Information

E-mail:
Private
Website URL:
Website URL  http://www.baweaver.com
Skype:
Skype  keystonelemur
LinkedIn:
http://www.linkedin.com/profile/view?id=127322322
Facebook:
http://facebook.com/keystonelemur
Twitter:
keystonelemur

Comments

Page 1 of 1
  1. Photo

    hdr Icon

    25 Mar 2014 - 00:45
    Hey are you the same lemur who used to be around the Computer Help Forums? I haven't been there since forever, but I saw your username and it looked familiar.
  2. Photo

    ric1989 Icon

    08 Mar 2014 - 07:56
    im a college student studying asp.net, html, css, java, and unity. Im pursuing a bachelor in computer science
    I wanted to know exactly what it takes to become a front-end web developer?
    How do i make an online portfolio?
    I've made simple html database page
    as class project.
  3. Photo

    mimimintan Icon

    14 Sep 2013 - 20:43
    Haha... I'm trying to get into development but I'm having a rough time. q w q Definitely not for the weak hearted I'm noticing. I think I still want to focus more on drawing, but programming seems like a new medium I want to explore, you know? >:3 (Yeah, I'm one of those brats who suddenly wants to make games with no previous experience hur...) It's good that you still d...
  4. Photo

    mimimintan Icon

    13 Sep 2013 - 04:35
    Just stalked and found your deviantArt (aka clicked "portfolio" out of curiosity)... Even though it's been a while since you've posted (I understand), there's some pretty neat stuff, I gotta say :D Just thought I'd drop by and say that.
  5. Photo

    jon.kiparsky Icon

    15 Dec 2012 - 23:42
    Good point. BTW, ran into Andrew this morning. First thing he said to me was "Sorry I haven't got back to your friend, busy week at work" Expect to hear from him.
  6. Photo

    PokeSTrainer Icon

    02 Oct 2011 - 17:49
    Hey Weaver
  7. Photo

    macosxnerd101 Icon

    25 Aug 2010 - 18:31
    I don't have a Facebook, so DIC profiles are like Facebook for me. :p
  8. Photo

    thefreemenucom Icon

    14 Mar 2010 - 10:21
    Added cuz of your reply to super browser : )
Page 1 of 1