|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On November 17 2016 18:32 Manit0u wrote: Does anyone have any insight on possible RoR developer interview questions?
I'm applying for a new job, trying to move from PHP to RoR but my RoR knowledge is pretty basic (but I have plenty of general experience in web dev).
Am I imagining this or do you seriously apply for new jobs every 2-3 months?
|
On November 17 2016 19:09 Khalum wrote:Show nested quote +On November 17 2016 18:32 Manit0u wrote: Does anyone have any insight on possible RoR developer interview questions?
I'm applying for a new job, trying to move from PHP to RoR but my RoR knowledge is pretty basic (but I have plenty of general experience in web dev). Am I imagining this or do you seriously apply for new jobs every 2-3 months?
Last time I've changed a job was 9 months ago. This one isn't moving me forward in any way so why should I stay stagnant?
http://stackoverflow.com/cv/kkarski
Besides, there's nothing wrong in checking out various possibilities, even if I don't get the job or won't want it.
I've been mostly working for small companies, which don't offer much in terms of self improvement. Now I have a chance to go for something bigger.
|
On November 17 2016 19:22 Manit0u wrote:Show nested quote +On November 17 2016 19:09 Khalum wrote:On November 17 2016 18:32 Manit0u wrote: Does anyone have any insight on possible RoR developer interview questions?
I'm applying for a new job, trying to move from PHP to RoR but my RoR knowledge is pretty basic (but I have plenty of general experience in web dev). Am I imagining this or do you seriously apply for new jobs every 2-3 months? Last time I've changed a job was 9 months ago. This one isn't moving me forward in any way so why should I stay stagnant? Besides, there's nothing wrong in checking out various possibilities, even if I don't get the job or won't want it.
Wasn't meant as criticism, I just had the impression that I read about you applying for some new job every 10 pages here. No idea how that crossed my mind tbh.
|
The company I've started working for has previously done all development through service providers. It's now my Job to build up an inhouse developer team.
Trouble is, a lot of the structure is... not fit for software development. Things like the Firewall spoofing all ssl requests and cerificates, which breaks pretty much all package Management tools that verify cerificates when downloading packages. Also, developers don't have local admin, because only admins were previously allowed to have local admin, which means we have to call an admin every time we need to installieren something or change an entry in the hosts file.
I've pushed for a meeting with the admins next week to change the situation, but I could use a few more arguments for a less restrictive or netter completely open Firewall and local admins for developers. Dev environment will be local VMs, PHP and Java for the current Magento and soon Hybris shop and we want to use openvpn to Connect to partners.
|
On November 17 2016 19:47 Morfildur wrote: The company I've started working for has previously done all development through service providers. It's now my Job to build up an inhouse developer team.
Trouble is, a lot of the structure is... not fit for software development. Things like the Firewall spoofing all ssl requests and cerificates, which breaks pretty much all package Management tools that verify cerificates when downloading packages. Also, developers don't have local admin, because only admins were previously allowed to have local admin, which means we have to call an admin every time we need to installieren something or change an entry in the hosts file.
I've pushed for a meeting with the admins next week to change the situation, but I could use a few more arguments for a less restrictive or netter completely open Firewall and local admins for developers. Dev environment will be local VMs, PHP and Java for the current Magento and soon Hybris shop and we want to use openvpn to Connect to partners.
Can you get a network inside your network? You know, something like dev team intranet where you host all the gitlab/bitbucket stuff and can control your dev and test servers?
|
On November 17 2016 19:47 Morfildur wrote: The company I've started working for has previously done all development through service providers. It's now my Job to build up an inhouse developer team.
Trouble is, a lot of the structure is... not fit for software development. Things like the Firewall spoofing all ssl requests and cerificates, which breaks pretty much all package Management tools that verify cerificates when downloading packages. Also, developers don't have local admin, because only admins were previously allowed to have local admin, which means we have to call an admin every time we need to installieren something or change an entry in the hosts file.
I've pushed for a meeting with the admins next week to change the situation, but I could use a few more arguments for a less restrictive or netter completely open Firewall and local admins for developers. Dev environment will be local VMs, PHP and Java for the current Magento and soon Hybris shop and we want to use openvpn to Connect to partners.
The company I worked for previously did that too, and the policy never changed. However, they were able to open some specific exceptions for things like github and the Android SDK. The apt package manager was able to work through the proxy, so we didn't need it for that (have to add the "fake" certificate to the accepted certificate list, though, or something). It was generally treated on a case-by-case basis and everybody who wanted that access had to ask specifically. However, we did all have admin level access on our local machines. Not giving that is just a mess. This was a giant multinational with severe paranoia of leaking corporate secrets.
|
On November 17 2016 19:25 Khalum wrote:Show nested quote +On November 17 2016 19:22 Manit0u wrote:On November 17 2016 19:09 Khalum wrote:On November 17 2016 18:32 Manit0u wrote: Does anyone have any insight on possible RoR developer interview questions?
I'm applying for a new job, trying to move from PHP to RoR but my RoR knowledge is pretty basic (but I have plenty of general experience in web dev). Am I imagining this or do you seriously apply for new jobs every 2-3 months? Last time I've changed a job was 9 months ago. This one isn't moving me forward in any way so why should I stay stagnant? Besides, there's nothing wrong in checking out various possibilities, even if I don't get the job or won't want it. Wasn't meant as criticism, I just had the impression that I read about you applying for some new job every 10 pages here. No idea how that crossed my mind tbh.
Well, I've had the interview today and got the job starting next month (they've decided to hire me on the spot during the interview). No more PHP for me as I enter RoR development in an inernational company 
I really enjoyed the JS question:
function mystery(input) { var secret = 5; function mystery2(modifier) { modifier *= input; return secret * modifier; } return mystery2; }
var hidden = mystery(4); var result = hidden(2);
// What is the result?
|
On November 18 2016 23:21 Manit0u wrote:Show nested quote +On November 17 2016 19:25 Khalum wrote:On November 17 2016 19:22 Manit0u wrote:On November 17 2016 19:09 Khalum wrote:On November 17 2016 18:32 Manit0u wrote: Does anyone have any insight on possible RoR developer interview questions?
I'm applying for a new job, trying to move from PHP to RoR but my RoR knowledge is pretty basic (but I have plenty of general experience in web dev). Am I imagining this or do you seriously apply for new jobs every 2-3 months? Last time I've changed a job was 9 months ago. This one isn't moving me forward in any way so why should I stay stagnant? Besides, there's nothing wrong in checking out various possibilities, even if I don't get the job or won't want it. Wasn't meant as criticism, I just had the impression that I read about you applying for some new job every 10 pages here. No idea how that crossed my mind tbh. Well, I've had the interview today and got the job starting next month (they've decided to hire me on the spot during the interview). No more PHP for me as I enter RoR development in an inernational company  I really enjoyed the JS question: function mystery(input) { var secret = 5; function mystery2(modifier) { modifier *= input; return secret * modifier; } return mystery2; }
var hidden = mystery(4); var result = hidden(2);
// What is the result?
I'm not well versed on the intricacies of JS, but I would say + Show Spoiler +. Would that be correct? I can't see anything that could obviously fuck with the normal interpretation, but JS has plenty of non-obvious things that you just have to know about the stupid language (and yes, I still hate JS).
+ Show Spoiler + Okay, ran it through a JS engine and the result is indeed 40.
Why did you think that question was particularly interesting?
|
On November 19 2016 00:52 Acrofales wrote: Why did you think that question was particularly interesting?
Well, since I was mostly working with old and shitty code lately I was way out of touch with modern JS so it kind of caught me by surprise. I still managed to figure it out though.
I've found it interesting because it wasn't the usual stuff I see at job interviews (selecting some obscure shit with jQuery and such).
Overall there wasn't much of the stupid programming on the sheet of paper tests typical for most interviews I took part in. Just this JS code to figure out and writing an algorithm in any programming language or pseudo-code that returns the first non-duplicated letter in a string (optimization and implementation is not a concern, it just has to work). On top of that a couple of general questions like "why dynamically creating new symbols in ruby based on user input is bad?" etc.
|
We started talking about threading in my class now. The instructor ran an a couple amusing programs. The first created 100 threads, and each thread ran a loop that displayed it's thread name plus "i", with i being a variable incremented from 0 to 4 in the loop. And then "all done" when all the threads had been made. The amount of time it took each thread to go through its loop differed, and the "all done" came out at varying places in the output. I guess this was to show that threads are competing for processor resources and that which thread has priority is often outside the scope of your control?
The second program created the same 100 threads but this time each thread shared a static int x, which started at 0. Each thread ran a loop a million times, and in the loop it did x++. When everything was said and done x was much lower than 100 million, and each time it varied. This is because the threads were interrupting each other during the x++ operation. While one was about to assign x to the new value (say... x+1 = 6), another may have just said that x will become (x+1 = 6) as well. Then the first thread assigns x = 6, and then the next says x = 6. and really the static x only got incremented once instead of twice. Or maybe instead of 3 our 4 or 10 times even. I thought this was pretty cool!
So what controls threads then anyways? Is it solely the operating system? I mean obviously it depends on your processor but is all the controlling done by the operating system?
|
On November 19 2016 05:56 travis wrote: We started talking about threading in my class now. The instructor ran an a couple amusing programs. The first created 100 threads, and each thread ran a loop that displayed it's thread name plus "i", with i being a variable incremented from 0 to 4 in the loop. And then "all done" when all the threads had been made. The amount of time it took each thread to go through its loop differed, and the "all done" came out at varying places in the output. I guess this was to show that threads are competing for processor resources and that which thread has priority is often outside the scope of your control?
The second program created the same 100 threads but this time each thread shared a static int x, which started at 0. Each thread ran a loop a million times, and in the loop it did x++. When everything was said and done x was much lower than 100 million, and each time it varied. This is because the threads were interrupting each other during the x++ operation. While one was about to assign x to the new value (say... x+1 = 6), another may have just said that x will become (x+1 = 6) as well. Then the first thread assigns x = 6, and then the next says x = 6. and really the static x only got incremented once instead of twice. Or maybe instead of 3 our 4 or 10 times even. I thought this was pretty cool!
So what controls threads then anyways? Is it solely the operating system? I mean obviously it depends on your processor but is all the controlling done by the operating system? It's not cool when you have threads in actual production code that access shared data (the static int). Ideally you don't care about controlling your threads and instead write code that doesn't try to access shared data in the first place. It's not terribly hard to do, but there are plenty of people who just don't know or understand the problem properly or are just way too sloppy when using threads. Which creates really ugly and hard to find bugs.
It's mostly the OS afaik, but you typically have some ways to influence the decisions made by the OS's scheduler.
|
On November 19 2016 05:56 travis wrote: The second program created the same 100 threads but this time each thread shared a static int x, which started at 0. Each thread ran a loop a million times, and in the loop it did x++. When everything was said and done x was much lower than 100 million, and each time it varied. This is because the threads were interrupting each other during the x++ operation. While one was about to assign x to the new value (say... x+1 = 6), another may have just said that x will become (x+1 = 6) as well. Then the first thread assigns x = 6, and then the next says x = 6. and really the static x only got incremented once instead of twice. Or maybe instead of 3 our 4 or 10 times even. I thought this was pretty cool!
It could be that but there can also be other factors at play like caching.
On November 19 2016 05:56 travis wrote: So what controls threads then anyways? Is it solely the operating system? I mean obviously it depends on your processor but is all the controlling done by the operating system? The operating system is scheduling which thread is run. How exactly it does that varies from OS to OS. Its the same deal as with different processes. In the rare case, that an OS does not support threading (all modern ones do) the JVM is supposed to schedule threads itself.
|
I have an arraylist of vertex objects called "vertices"
My breadth first search method is passed a parameter "start", which is where I start my breadth first search from. The "start" parameter is a data variable that is a member of each vertex object.
For my breadth first search I am using a queue, and adding neighbors to the queue as I visit each vertex.
Is there an easy way to find the vertex in my arraylist that has the data that matches the parameter? Do I seriously have to do a for each loop just to find the vertex I am starting at? I guess any equivalent method in arraylist would just be doing the same thing anyways, though..
|
On November 20 2016 03:29 travis wrote: I have an arraylist of vertex objects called "vertices"
My breadth first search method is passed a parameter "start", which is where I start my breadth first search from. The "start" parameter is a data variable that is a member of each vertex object.
For my breadth first search I am using a queue, and adding neighbors to the queue as I visit each vertex.
Is there an easy way to find the vertex in my arraylist that has the data that matches the parameter? Do I seriously have to do a for each loop just to find the vertex I am starting at? I guess any equivalent method in arraylist would just be doing the same thing anyways, though.. An ArrayList is not exactly a good data structure to look up values from. You will need that loop over the entire list. Is that software design forced upon you or did you come up with that?
|
On November 20 2016 03:39 RoomOfMush wrote:Show nested quote +On November 20 2016 03:29 travis wrote: I have an arraylist of vertex objects called "vertices"
My breadth first search method is passed a parameter "start", which is where I start my breadth first search from. The "start" parameter is a data variable that is a member of each vertex object.
For my breadth first search I am using a queue, and adding neighbors to the queue as I visit each vertex.
Is there an easy way to find the vertex in my arraylist that has the data that matches the parameter? Do I seriously have to do a for each loop just to find the vertex I am starting at? I guess any equivalent method in arraylist would just be doing the same thing anyways, though.. An ArrayList is not exactly a good data structure to look up values from. You will need that loop over the entire list. Is that software design forced upon you or did you come up with that?
I came up with it, I kind of coded the rest of my project around it.. and yeah.. I thought that would be the case
|
You could sort the array and then do a binary search instead for log(n) time complexity instead of n.
|
On November 20 2016 03:29 travis wrote: I have an arraylist of vertex objects called "vertices"
My breadth first search method is passed a parameter "start", which is where I start my breadth first search from. The "start" parameter is a data variable that is a member of each vertex object.
For my breadth first search I am using a queue, and adding neighbors to the queue as I visit each vertex.
Is there an easy way to find the vertex in my arraylist that has the data that matches the parameter? Do I seriously have to do a for each loop just to find the vertex I am starting at? I guess any equivalent method in arraylist would just be doing the same thing anyways, though..
What you want to use is called an adjacency list.
Let the vertex be the implicit index in the array. The index should return a queue/stack.
ex:
You should encapsulate your verticies in graph structure Build an api like the following
public class Graph{ //use adjacency list here public Graph(int V); public void addEdge(int v, int w); public Iterable<Integer> adj(int v); }
I am assuming you are given the data like this: 0, 1 0, 2 1, 2 2, 3
Your adjancey list end state would look like this (directed) 0 : [1,2] 1 : [2] 2 : [3] 3 : []
(undirected) 0 : [1, 2] 1 : [0, 2] 2 : [0, 1, 3] 3 : [2]
The above would be read as 0 vertex is connected to the 1 vertex. You can make this directed or undirected depending on how you implement the Graph api.
If you use that api: your BFS algorithm should look a lot simpler
//s : the start vertex public void bfs(int s, Graph g) { Queue<Integer> q = new Queue<Integer> q.enqueue(s); while (!q.isEmpty()){ int v = q.dequeue() foreach(Integer w in g.adj(v)){ //rest of your algorithm using some kind of visted structure } } }
|
|
On November 20 2016 12:17 Nesserev wrote:Please, use the code markup tags to format your code :/ This should become a rule, lol. It happens way too much. [ code]...insert code here[ /code] (remove the spaces in front of code and /code) ex. function meow() { console.log("meow"); }
Didn't know. Thx. Updated my post.
|
On November 14 2016 09:30 Nesserev wrote:I really hate that sentence... "Primitive types are passed by value while complex types are passed by reference." It's a lazy rule that sadly is accepted as truth by so many, because it seems to fit at first sight, but like the new POTUS said, WRONG. Java ALWAYS uses pass by value.Variables can only hold 2 types of values in Java: - primitive values (numbers and bools) - object references Object references can hold the location of an object (objects are always allocated on the heap), and can be used to access the object that they're referring to. So, when you pass arguments to a function, you either pass a copy of a primitive value, or a copy of an object reference. This has 3 important consequences, explained with a simple call: swap(a,b)- if a and b hold a primitive type, the method cannot modify a and b - if a and b hold an object reference, a method can change the state of a and b - if a and b hold an object reference, a method cannot make a and b refer to a new object public static void swap(X a, X b) { X t = a; a = b; b = t; }
public static void main(String[] args) { X a = ...; X b = ...; swap(a,b) // does nothing }
If Java really used pass by reference for complex types, the third consequence would not be true. For example, C++ has real 'pass by reference': void swap(int& a, int& b) { int t = b; b = a; a = t; }
int main() { int a = 1; int b = 2; swap(a,b); // swaps the values of a and b std::cout << a << ", " << b << std::endl; // prints "2, 1" return 0; }
TL;DR: Don't say that Java passes primitive types by value and complex types by reference.EDIT: fixed some typos in Java code
Making OOP great again.
User was warned for this post
|
|
|
|