|
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. |
Man, Ruby is indeed a magic language...
My CI pipeline started failing out of the blue so I went on to investigate. All the tests are green in development and for some reason in test environment they always fail (but only the first time they run, if you run them again they're all green).
The reason they're failing seems to be the fact that the test thinks that one of the models from the fixtures is invalid (when it is). I've tried changing the test to create brand new valid model instead of loading it from the fixtures (thought it might be a timing thing) but it's still failing (and only on the first run).
Such magic. Not wow.
|
On September 27 2017 15:58 Manit0u wrote:Show nested quote +On September 27 2017 11:41 Piledriver wrote:Anyone familiar with AngularJS? Could you help debug this plunk? plnkr.coBasically I have an array of objects, and the user can select any object on the array, and then a particular property on the array to see its value. This binding syntax has usually worked for me, but I'm not able to make it work for any reason today. {{ selectedElement[selectedProperty] }} Try this: <body ng-controller="MainCtrl"> Array Element: <select ng-model="selectedIndex"> <option ng-repeat="obj in testData.Table1" value="{{obj.Index}}">{{obj.Index}}</option> </select> <br> <br> Property Name: <select ng-model="selectedProp"> <option ng-repeat="(k,v) in testData.Table1[0]" value="{{k}}">{{k}}</option> </select> <br> <br> Array Element[Property] <input type='text' readonly value="{{ testData.Table1[selectedIndex][selectedProp] }}"> <br> <br> Selected Array Element: {{selectedIndex}} <br> Selected Property: {{selectedProp}} <br> <br> </body>
Your selectedElement was a string. Not an object...
Starting from his example -- you can fix that by changing the select from
<select ng-model="selectedPeriod"> <option ng-repeat="option in testData.Table1" value="{{option}}">{{option.Index}}</option> </select>
to
<select ng-model="selectedPeriod" ng-options="option.Index for option in testData.Table1"> </select>
I'd have to dig deeper to figure out a different solution with you still creating the options but I think that this --> value="{{option}}" on the original is turning the object into a string and setting that as the value. So even though your debug output looks like it's selecting the object correctly it wasn't. Switching it to the second syntax fixed it for me.
|
On September 27 2017 16:53 Manit0u wrote: Man, Ruby is indeed a magic language...
My CI pipeline started failing out of the blue so I went on to investigate. All the tests are green in development and for some reason in test environment they always fail (but only the first time they run, if you run them again they're all green).
The reason they're failing seems to be the fact that the test thinks that one of the models from the fixtures is invalid (when it is). I've tried changing the test to create brand new valid model instead of loading it from the fixtures (thought it might be a timing thing) but it's still failing (and only on the first run).
Such magic. Not wow.
It seems that model validations were dependent on stuff being (or not) in the DB. Since fixtures are loaded asynchronously model showed up as invalid. Super dumb.
|
On September 27 2017 17:19 berated- wrote:Show nested quote +On September 27 2017 15:58 Manit0u wrote:On September 27 2017 11:41 Piledriver wrote:Anyone familiar with AngularJS? Could you help debug this plunk? plnkr.coBasically I have an array of objects, and the user can select any object on the array, and then a particular property on the array to see its value. This binding syntax has usually worked for me, but I'm not able to make it work for any reason today. {{ selectedElement[selectedProperty] }} Try this: <body ng-controller="MainCtrl"> Array Element: <select ng-model="selectedIndex"> <option ng-repeat="obj in testData.Table1" value="{{obj.Index}}">{{obj.Index}}</option> </select> <br> <br> Property Name: <select ng-model="selectedProp"> <option ng-repeat="(k,v) in testData.Table1[0]" value="{{k}}">{{k}}</option> </select> <br> <br> Array Element[Property] <input type='text' readonly value="{{ testData.Table1[selectedIndex][selectedProp] }}"> <br> <br> Selected Array Element: {{selectedIndex}} <br> Selected Property: {{selectedProp}} <br> <br> </body>
Your selectedElement was a string. Not an object... Starting from his example -- you can fix that by changing the select from <select ng-model="selectedPeriod"> <option ng-repeat="option in testData.Table1" value="{{option}}">{{option.Index}}</option> </select>
to <select ng-model="selectedPeriod" ng-options="option.Index for option in testData.Table1"> </select>
I'd have to dig deeper to figure out a different solution with you still creating the options but I think that this --> value="{{option}}" on the original is turning the object into a string and setting that as the value. So even though your debug output looks like it's selecting the object correctly it wasn't. Switching it to the second syntax fixed it for me.
Thanks guys. I finally ended up fixing it by setting ng-value = 'option', instead of value = "{{option}}", since the latter syntax stringifies it.
I almost immediately figured it out once I created a plunk and posted it here, so in some ways taking it out of a large project and putting it into a plunk helped me understand my mistakes.
Also ng-options seems like an elegant solution. Have been a windows developer for almost 9 years now, so angularjs (and web development) is still pretty new to me.
Edit: Also to you guys, how do you manage Datamodels in angularjs. Coming from a world of strongly typed objects and well defined models, web development seems like a strange beast to get used to, especially for a large enterprise application that involves large amounts of financial and accounting data.
|
On September 28 2017 01:28 Piledriver wrote:Show nested quote +On September 27 2017 17:19 berated- wrote:On September 27 2017 15:58 Manit0u wrote:On September 27 2017 11:41 Piledriver wrote:Anyone familiar with AngularJS? Could you help debug this plunk? plnkr.coBasically I have an array of objects, and the user can select any object on the array, and then a particular property on the array to see its value. This binding syntax has usually worked for me, but I'm not able to make it work for any reason today. {{ selectedElement[selectedProperty] }} Try this: <body ng-controller="MainCtrl"> Array Element: <select ng-model="selectedIndex"> <option ng-repeat="obj in testData.Table1" value="{{obj.Index}}">{{obj.Index}}</option> </select> <br> <br> Property Name: <select ng-model="selectedProp"> <option ng-repeat="(k,v) in testData.Table1[0]" value="{{k}}">{{k}}</option> </select> <br> <br> Array Element[Property] <input type='text' readonly value="{{ testData.Table1[selectedIndex][selectedProp] }}"> <br> <br> Selected Array Element: {{selectedIndex}} <br> Selected Property: {{selectedProp}} <br> <br> </body>
Your selectedElement was a string. Not an object... Starting from his example -- you can fix that by changing the select from <select ng-model="selectedPeriod"> <option ng-repeat="option in testData.Table1" value="{{option}}">{{option.Index}}</option> </select>
to <select ng-model="selectedPeriod" ng-options="option.Index for option in testData.Table1"> </select>
I'd have to dig deeper to figure out a different solution with you still creating the options but I think that this --> value="{{option}}" on the original is turning the object into a string and setting that as the value. So even though your debug output looks like it's selecting the object correctly it wasn't. Switching it to the second syntax fixed it for me. Thanks guys. I finally ended up fixing it by setting ng-value = 'option', instead of value = "{{option}}", since the latter syntax stringifies it. I almost immediately figured it out once I created a plunk and posted it here, so in some ways taking it out of a large project and putting it into a plunk helped me understand my mistakes. Also ng-options seems like an elegant solution. Have been a windows developer for almost 9 years now, so angularjs (and web development) is still pretty new to me. Edit: Also to you guys, how do you manage Datamodels in angularjs. Coming from a world of strongly typed objects and well defined models, web development seems like a strange beast to get used to, especially for a large enterprise application that involves large amounts of financial and accounting data.
Use TypeScript
|
Does anyone know a job board or something with companies that offer H1B sponsorship? I've tried glassdoor, indeed.com and reed.co.uk but there should be more.
|
Does anyone else find networking events really awkward? I have no problem talking to people normally, but whenever I want something from them it becomes much more difficult.
|
28079 Posts
On October 03 2017 07:23 WarSame wrote: Does anyone else find networking events really awkward? I have no problem talking to people normally, but whenever I want something from them it becomes much more difficult. Just need to realize everyone is there for the same reason (get hired or hire someone).
|
Could someone help me identify a possible issue with Docker? For some bizarre reason our GitLab CI pipeline started failing since October 1st and I have no idea why it would be so (I'm pretty newb with Docker).
Here's the error log:
Running with gitlab-ci-multi-runner 9.2.0 (adfc387) on Lublin runner (ac3d6fad) Using Docker executor with image ruby:2.2.3 ... Starting service postgres:9.3 ... Pulling docker image postgres:9.3 ... Using docker image postgres:9.3 ID=sha256:817c286a6a5053f00b2d533ac4e6d1c4791e9bb33ad806da659d78a181a47e06 for postgres service... WARNING: Possibly zombie container runner-ac3d6fad-project-17-concurrent-0-postgres is disconnected from network bridge Starting service redis:3.2 ... Pulling docker image redis:3.2 ... Using docker image redis:3.2 ID=sha256:2a3b4efd4801ded81054f15a3dd39f068e593eef593052e0c3d4defa4abe3ac7 for redis service... WARNING: Possibly zombie container runner-ac3d6fad-project-17-concurrent-0-redis is disconnected from network bridge Waiting for services to be up and running...
*** WARNING: Service runner-ac3d6fad-project-17-concurrent-0-postgres probably didn't start properly.
Error response from daemon: endpoint with name runner-ac3d6fad-project-17-concurrent-0-postgres-wait-for-service already exists in network bridge
2017-10-03T16:50:16.801498049Z The files belonging to this database system will be owned by user "postgres". 2017-10-03T16:50:16.801567506Z This user must also own the server process. 2017-10-03T16:50:16.801576192Z 2017-10-03T16:50:16.801580728Z The database cluster will be initialized with locale "en_US.utf8". 2017-10-03T16:50:16.801585947Z The default database encoding has accordingly been set to "UTF8". 2017-10-03T16:50:16.801590806Z The default text search configuration will be set to "english". 2017-10-03T16:50:16.801595728Z 2017-10-03T16:50:16.801599793Z Data page checksums are disabled. 2017-10-03T16:50:16.801604508Z 2017-10-03T16:50:16.801608536Z fixing permissions on existing directory /var/lib/postgresql/data ... ok 2017-10-03T16:50:16.801613466Z creating subdirectories ... ok 2017-10-03T16:50:16.818715875Z selecting default max_connections ... 100 2017-10-03T16:50:16.885837442Z selecting default shared_buffers ... 128MB 2017-10-03T16:50:17.342815968Z creating configuration files ... ok 2017-10-03T16:50:18.294583217Z creating template1 database in /var/lib/postgresql/data/base/1 ... ok 2017-10-03T16:50:18.331840907Z initializing pg_authid ... ok 2017-10-03T16:50:18.459589158Z initializing dependencies ... ok 2017-10-03T16:50:18.582860596Z creating system views ... ok 2017-10-03T16:50:18.657802074Z loading system objects' descriptions ... ok 2017-10-03T16:50:18.710833442Z creating collations ... ok 2017-10-03T16:50:18.858716835Z creating conversions ... ok 2017-10-03T16:50:18.904821562Z creating dictionaries ... ok 2017-10-03T16:50:18.910010079Z setting privileges on built-in objects ... ok 2017-10-03T16:50:20.059088765Z creating information schema ... ok 2017-10-03T16:50:20.192394362Z loading PL/pgSQL server-side language ... ok
*********
*** WARNING: Service runner-ac3d6fad-project-17-concurrent-0-redis probably didn't start properly.
Error response from daemon: endpoint with name runner-ac3d6fad-project-17-concurrent-0-redis-wait-for-service already exists in network bridge
*********
Using docker image sha256:74d936810a143a4661cd63475977192df8a92b10c595f468c373db6df37c1c57 for predefined container... WARNING: Possibly zombie container runner-ac3d6fad-project-17-concurrent-0-predefined is disconnected from network bridge Pulling docker image ruby:2.2.3 ... Using docker image ruby:2.2.3 ID=sha256:c713ad3e7169aa72fcabe62161bffae2d0ea9baaa90a01eefc56c51a607e5f6a for build container... Running on runner-ac3d6fad-project-17-concurrent-0 via cloutrack-api-versioned... ERROR: Job failed: execution took longer than 1h0m0s seconds
It never did all this db setup stuff before and everything was working fine just a day before. Any idea what could be the reason for those failures? Perhaps the machine run out of memory and killed some processes, now Docker has info about images that have been killed or something?
|
Did those warnings about network disconnects happen before and possible zombie containers?
|
Hard to tell. What does 'docker inspect network' say? You could try to 'docker network disconnect --force' the runner-ac3d6fad-project-17-concurrent-0-redis or runner-ac3d6fad-project-17-concurrent-0-redis-wait-for-service.
|
Turns out that for some reason we had a zombie runner which didn't shut down properly after finishing/failing a job in the pipeline. This prevented new runners to execute.
|
I wanted to git gud at OOP. Now I have strategies built upon more abstract strategies which select factories built upon more abstract factories and it's all encompassed in even more abstractions with managers, providers, resolvers, handlers, services and such. All this to parse single JSON file...
|
We are learning about, and implementing in our latest project, DFAs and NFAs. I think they are pretty interesting and I was surprised I had literally never heard of them.
The professor never really told us what their applications are, though. It seems to me that their role is basically to pattern match? They are probably used to implement regex, for example?
Have any of you used these in the real world?
|
On October 06 2017 18:14 Manit0u wrote:I wanted to git gud at OOP. Now I have strategies built upon more abstract strategies which select factories built upon more abstract factories and it's all encompassed in even more abstractions with managers, providers, resolvers, handlers, services and such. All this to parse single JSON file... ![[image loading]](https://media.giphy.com/media/l0MYEqEzwMWFCg8rm/giphy.gif)
But did you put everything into one large class?
|
On October 06 2017 18:14 Manit0u wrote:I wanted to git gud at OOP. Now I have strategies built upon more abstract strategies which select factories built upon more abstract factories and it's all encompassed in even more abstractions with managers, providers, resolvers, handlers, services and such. All this to parse single JSON file... ![[image loading]](https://media.giphy.com/media/l0MYEqEzwMWFCg8rm/giphy.gif) Someone who is good with OOP would use an existing parser.
|
On October 07 2017 01:00 spinesheath wrote:Show nested quote +On October 06 2017 18:14 Manit0u wrote:I wanted to git gud at OOP. Now I have strategies built upon more abstract strategies which select factories built upon more abstract factories and it's all encompassed in even more abstractions with managers, providers, resolvers, handlers, services and such. All this to parse single JSON file... ![[image loading]](https://media.giphy.com/media/l0MYEqEzwMWFCg8rm/giphy.gif) Someone who is good with OOP would use an existing parser.
I am using an existing parser. But I need to parse the contents of the JSON and then map them to our database structure creating/updating records as necessary.
|
On October 07 2017 01:59 Manit0u wrote:Show nested quote +On October 07 2017 01:00 spinesheath wrote:On October 06 2017 18:14 Manit0u wrote: I wanted to git gud at OOP. Now I have strategies built upon more abstract strategies which select factories built upon more abstract factories and it's all encompassed in even more abstractions with managers, providers, resolvers, handlers, services and such. All this to parse single JSON file...
Someone who is good with OOP would use an existing parser. I am using an existing parser. But I need to parse the contents of the JSON and then map them to our database structure creating/updating records as necessary.
Every time I see stuff like this I always just want to post the image from the medium article showing java having the highest paid salaries. >_<
Which parsing library are you using? You parsing into json objects and then doing the data transformations yourself or using something like Gson and going straight to objects? You even in java?
Edit: I think you're in ruby, right?
Design patterns never made much sense to me until I started testing. Once you starting writing code for testability they make a ton of sense. If you are just trying to break things down because you "want to git gud" (yeah I know you're joking), then it's really hard to see where you really need to make your seams.
|
On October 06 2017 23:02 travis wrote: We are learning about, and implementing in our latest project, DFAs and NFAs. I think they are pretty interesting and I was surprised I had literally never heard of them.
The professor never really told us what their applications are, though. It seems to me that their role is basically to pattern match? They are probably used to implement regex, for example?
Have any of you used these in the real world?
Yes, they are used in regex, and are heavily used in constructing and parsing programming languages in unambiguous ways.
You will probably never need to use them in the real world. I only ever used them for practical purposes in my compilers class. They are definitely interesting though!
|
On October 07 2017 06:10 berated- wrote:Show nested quote +On October 07 2017 01:59 Manit0u wrote:On October 07 2017 01:00 spinesheath wrote:On October 06 2017 18:14 Manit0u wrote: I wanted to git gud at OOP. Now I have strategies built upon more abstract strategies which select factories built upon more abstract factories and it's all encompassed in even more abstractions with managers, providers, resolvers, handlers, services and such. All this to parse single JSON file...
Someone who is good with OOP would use an existing parser. I am using an existing parser. But I need to parse the contents of the JSON and then map them to our database structure creating/updating records as necessary. Every time I see stuff like this I always just want to post the image from the medium article showing java having the highest paid salaries. >_< Which parsing library are you using? You parsing into json objects and then doing the data transformations yourself or using something like Gson and going straight to objects? You even in java? Edit: I think you're in ruby, right? Design patterns never made much sense to me until I started testing. Once you starting writing code for testability they make a ton of sense. If you are just trying to break things down because you "want to git gud" (yeah I know you're joking), then it's really hard to see where you really need to make your seams.
Yeah. Also, my original post was kind of a sitire (pointed at myself of course) about how you can sometimes go overboard and do simple stuff in most convoluted ways.
|
|
|
|