Open Side Menu Go to the Top

07-15-2015 , 06:09 PM
Question for any of the Rails guys in thread:

We have a pattern in our code base where we have a parent model and a child model (a has_many/belongs_to relationship) and both the parent and child tables contain a field :foo. We then override the getters/setters like so:

Code:
class Parent
  has_many :children

  attr_accessible :foo
end

class Child
  belongs_to :parent, inverse_of: :children

  attr_accessible :foo

  def foo
    super || parent.foo
  end

  def foo=(value)
    return if foo == value
    self[:foo] = value
  end
end
Is there a better way to do this? Even better if there is a gem for it, but the searches I've tried have yielded nothing.
** 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-16-2015 , 02:54 PM
Anyone been to JavaOne conference? It looks very spammy and corporate but most of my team is going. It's also expensive. I'd hate to drop my yearly conference budget on a crappy one.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2015 , 03:21 PM
Never been but spammy and corporate describes it pretty well from what I was told. If you have a limited budget, do smaller and more fun ones.

If it can fit into your work description at all one of the big security/hacking conferences is always fun (+Vegas).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-16-2015 , 06:22 PM
Angular folks, how would you design this page:

Say you have a Projects page with Categories (select dropdown with track-by), and based on the Category selected there are Attributes.

The API is restful and has endpoints for /projects, /attributes, /categories, etc

Do you serialize all the related category/attribute information in /projects/1/ and make 1 HTTP request?

Or perhaps nest directives for Categories/Attributes and make separate requests for each object?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-18-2015 , 09:22 AM
I interviewed recently for a couple of positions looking for C++ dev experience. They recruited me as I didn't initiate any communication. The first interview asked something about how I would randomize some array, I forget the actual problem. I gave the interviewer a one statement answer that solved the problem using STL (trivial solution to problem). He didn't have a clue if I was correct or not and stated how would you do it without the library. Hmmm

On a second interview I was asked essentially to implement a hashing function. Again this has a trivial solution using STL. He stated that no do it without the library call.

I found it actually quite amusing since they initiated the contact specifically for my C++ experience. Show me that you can re-invent the wheel! Before we start speculating that STL implementations are inefficient they aren't. I have a pet peeve with job reqs that state Java, C#, or C++ skills needed. I'm fine with Java, C#, and C++ skills needed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-18-2015 , 09:37 AM
I confirm the birthday paradox more times by 9am than most people do all day.

And in less than 15 lines of code!

Last edited by Low Key; 07-18-2015 at 09:41 AM. Reason: Started out as less than 50. Kept getting smaller!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2015 , 10:04 AM
A job req that I was contacted about to which I stated I didn't have the hardware design and hardware tech expertise:

================================================== ===
****** Technology is seeking an Embedded Automation Engineer/SDET for their client in Seattle, Washington (WA).

As an Automation Engineer, you will be working in a technical quality assurance role with a talented team of testers, developers, and system engineers supporting a new high-tech toy that brings motion-sensor technology, bluetooth, and cloud connectivity to wearable devices.

Responsibilities include:
* Testing the total system from front to backend, including API
* Interfacing with business units and gathering requirements to build test cases
* Load testing facilitation
* Requirements and Functional Specifications review
* Test environment configuration/management
* Electronic circuit design and implementation as pertaining to the test automation framework.

Required Skills Include:
* Bachelor's Degree in Electrical Engineering or equivalent experience in field
* Thorough understanding of the software QA engineering process
* 3-5 years of software testing experience
* Direct experience testing embedded software and drivers
* Direct experience in hardware design, implementation, and testing
* Strong written and verbal communication skills
* Proven experience defining and implementing testing frameworks
* Experience with automated environment deployment and configuration
* Ability to anticipate, identify and articulate problem areas and develop preventative solutions
* Work with a high degree of independence on projects with little or no precedence
* Proven experience in identifying the relationship of bugs to software code
* Passionate about software quality
* CAD experience in creation of Electrical Schematics and Layouts required
* Experience programming in constrained environments (ARM 32-bit or 8-bit microprocessors)
* Experience with communication protocols desired (eg Bluetooth, BLE, WiFi, RF)

Specific Skills Required:
* Strong working knowledge of C/C++
* Strong working knowledge of circuit design and implementation
* Strong Linux experience
* Strong experience with Python and/or Lua
* Strong troubleshooting skills
* Soldering
* Jira, Git, Confluence, or related experience
* Beaglebone experience a plus.
================================================== ===

3-5 years of testing experience I would guess should be the most recent experience which means that the candidate needs to have been keeping up with with their software and hardware development skills as well. This is the crazy kind of req I see a lot. A wish list where candidates the client doesn't want can be weeded out easily. For instance, if someone had done a significant amount of C/C++ development along with Python development in implementing and using automated test frameworks but didn't have the requisite hardware design experience and hadn't done much soldering then they are easily eliminated. Also I'd bet the ranch that they are not really interested in C++ level development work as they are actually interested in C language development. I'm guessing the person they hire to fill this role will be lacking in at least a third of these requirements probably the hardware related requirements and probably the communication requirements they mention. Regarding those, it is mildly amusing to me how they lump Bluetooth classic, Bluetooth LE, WiFi, and RF together. There are people that can fulfill all these requirements but I have my doubts that the rates they would command will be something this company wants to pay.

Last edited by adios; 07-19-2015 at 10:13 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2015 , 10:11 AM
Or they are looking at who they have in the position now and are building the reqs around them, hoping to get more people like what they have. A working knowledge of C/C++ doesn't seem out of line with 3-5 years of testing, they aren't asking for experience in it. Particularly for hardware testers which this sounds like they are looking for. This seems like a job for hardware oriented EE guys not software engineers.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-19-2015 , 04:38 PM
I was given an auto-grader style test. I'm not sure if the grader tried to run the queries or if it only did syntax checking. Regardless, it was suggested that you follow SQL Server 2008.

Find the customers who all ordered the most widgets in the database. If two or more people ordered the same amount return all names.

I really hate questions like this. Yes, I know the general SQL answer, but your RDMS should have something that helps optimize these kinds of queries. Of course, none of them are going to work on another database. Even worse, SQL Server has broken aliasing rules, so the general SQL answer for this query doesn't even work and throws an exception. I just put "select * from my_table" in the box with my real answer in commented out, then wrote about what I did and why in the post quiz questionnaire.

In any case, I think people who administer tests should be more careful of what they are trying to auto-grade, especially in SQL. If the answer isn't a one-to-one clone of the SQL Standard, it shouldn't be auto-graded. The whiteboard is a perfect place to discuss differences between RDMSs, and I think anyone should be aware of some of the differences. Even if you are not, many features are obviously not, and those shouldn't be auto-graded.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-20-2015 , 06:09 AM
Why is WebRTC not supported for IE or Safari yet
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-21-2015 , 03:44 PM
Quote:
Originally Posted by adios
I interviewed recently for a couple of positions looking for C++ dev experience. They recruited me as I didn't initiate any communication. The first interview asked something about how I would randomize some array, I forget the actual problem. I gave the interviewer a one statement answer that solved the problem using STL (trivial solution to problem). He didn't have a clue if I was correct or not and stated how would you do it without the library. Hmmm

On a second interview I was asked essentially to implement a hashing function. Again this has a trivial solution using STL. He stated that no do it without the library call.

I found it actually quite amusing since they initiated the contact specifically for my C++ experience. Show me that you can re-invent the wheel! Before we start speculating that STL implementations are inefficient they aren't. I have a pet peeve with job reqs that state Java, C#, or C++ skills needed. I'm fine with Java, C#, and C++ skills needed.
That's actually pretty common interview procedure. They just want to see that you understand CS basics. Not really "reinventing the wheel" imo
Otherwise most interview questions would be reinventing the wheel type stuff. The nontrivial questions are usually some variation of quicksort as a base strategy (divide&conquer) from my experience.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-21-2015 , 06:01 PM
Quote:
Originally Posted by clowntable
That's actually pretty common interview procedure. They just want to see that you understand CS basics. Not really "reinventing the wheel" imo
Otherwise most interview questions would be reinventing the wheel type stuff. The nontrivial questions are usually some variation of quicksort as a base strategy (divide&conquer) from my experience.
CS basics regarding what STL call to make? I can call a function that is optimized for speed and works flawlessly that a lot of people have spent a lot of time developing or I can write the function myself and go through the process of coding and testing it. To me it is more productive to actually use STL.

You could basically apply your reasoning regarding any language. If someone is given a task to develop an associate array class in Python for instance should they not use the facilities that Python provides? The intent of STL is to have it be utilized for increasing productivity by providing a capability that is bug free and highly efficient.

One thing I've learned from this process is that when I see an ad that states C++/C as the languages they're looking for they are really looking for someone to code in C almost exclusively. If we're talking about C then the questions totally make sense. If we're using C++, then not so much.

Knowing how to apply the data structure is not the same as implementing it in my view. To me if I am asked to implement a data structure before I can apply it and an implementation is already available that almost certainly will perform much better than what I am going to implement then I am "reinventing the wheel."

Last edited by adios; 07-21-2015 at 06:10 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-21-2015 , 06:50 PM
Quote:
Originally Posted by adios
CS basics regarding what STL call to make? I can call a function that is optimized for speed and works flawlessly that a lot of people have spent a lot of time developing or I can write the function myself and go through the process of coding and testing it. To me it is more productive to actually use STL.
I felt the same for quite a while, but that has changed over time.

If they wanted to know how well you know STL calls, they'd test you on that. More frequently, though, they are interested in how well you understand the underlying principles. For those cases where STL's standard implementation just does not fit the problem perfectly or including STL into the project may not be an option (e.g. embedded systems).
If you can showcase that you know how it is done in plain vanilla, you have a better chance of detecting when the current limitations call for modifications which, in turn, you then should be able to implement.

With interview time being limited, it is more time efficient to just throw a standard problem out there and ask to do it without using STL.
It also gives insight on your thought process if you do not know the details of the implementation. That's actually where the interviewer can gain more insight than if you knew the answer cold.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-21-2015 , 07:27 PM
We do not use STL anywhere (SSD firmware). In a lot of jobs where you use C and C++ it is important to know how to write performant code without relying on library calls.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-21-2015 , 11:26 PM
Quote:
Originally Posted by Low Key
I confirm the birthday paradox more times by 9am than most people do all day.

And in less than 15 lines of code!
Code:
(1..100000).map { (1..23).map {rand(365)}.uniq }
           .count {|x| x.size < 23} / 100000.0
# => 0.50634
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-22-2015 , 08:45 AM
Quiet you!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-22-2015 , 11:02 PM
i want to rent a VM for the sole purpose of running some windows software. i'd like a powerful machine running a new version of windows, and i only plan to use it a few hours a week, via remote desktop. what should i use to do this? ease of setup (put it my credit card and click power on) is the most important factor. also, similar to digitalocean droplets, i want the ability to power it off so i only pay for what i use. thanks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 07:46 AM
Quote:
Originally Posted by gaming_mouse
i want to rent a VM for the sole purpose of running some windows software. i'd like a powerful machine running a new version of windows, and i only plan to use it a few hours a week, via remote desktop. what should i use to do this? ease of setup (put it my credit card and click power on) is the most important factor. also, similar to digitalocean droplets, i want the ability to power it off so i only pay for what i use. thanks.
EC2 spot instance.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 09:28 AM
Quote:
Originally Posted by skario
EC2 spot instance.
perfect. much easier to setup than i'd feared, too.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 12:51 PM
Here's a question for you all:

You are locked in a dungeon. The wizard comes by and says "You are free to do, but there is a caveat."

The wizard sets out 9 pills. They all look the same.

"8 of these are poison. One is not. The non-poison pill weighs slightly more than the poison pill. You are to eat one of these in front of me. If you survive, you are free to go. If not, well, you are dragon food, lol."

He pulls out his magic balanced scale. You are offered the change to weigh the pills 2 times. I know you haven't eaten anything but strange paste and you don't know what time or year it is, but this is your chance! How do you find the non-poison pill with two weighs?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 01:04 PM
You can use the scale twice?
Split the pills into 3 groups of 3
Weigh two groups to see which group is heavy, if they are the same the un-weighed group is the heavy group.
pick two from the heavy group and weigh them, if they are the same the heavy pill is the one you didn't weigh.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 01:08 PM
yep
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 01:08 PM
Darnit beat me to it. I actually had a variation on this question in an interview.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 01:29 PM
Anyone else using Slack?

The hype is real.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-23-2015 , 01:38 PM
We're using hipchat, just starting to get bots for doing deployments in hip chat rooms.
** 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