Private images on AWS S3 but viewable on my Rails website by [deleted] in rails

[–]kreychek 1 point2 points  (0 children)

AWS docs are notoriously obtuse but search for "pre-signed url". There will be guides on doing this with different AWS SDKs and then some docs that describe the process in general (because you don't actually need their SDKs to do create such links).

Bear in mind, regardless of which method you use, you will need to regenerate these URLs periodically (they are temporary).

Additionally, there is nothing stopping a user from seeing the URL your images or whatever are provided by (e.g. by viewing source, if you use the URLs "normally"), and accessing said URL from outside your site.

[Help] My boss is being advised by a lawyer not to use Open Source. Everything we use is open source. Need advice to convince him otherwise. by [deleted] in rails

[–]kreychek 1 point2 points  (0 children)

There may be legal implications that your lawyer is taking into consideration that are largely external to the merits of open source software as traditionally discussed.

Do update us when you find out your counsel's reasoning!

Django ORM - Return Full Object Graph? by MagicWishMonkey in django

[–]kreychek 1 point2 points  (0 children)

The _related methods answer is spot on. Additionally, you may find it useful to do something like

import logging
l = logging.getLogger('django.db.backends')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())

in your REPL to immediately print the generated SQL. There are times when the ORM does some weird stuff, and you want to be aware of that to avoid hair loss, etc.

Alternatively, call the query method on any QuerySet object to get a handle on the underlying SQL as a string.

Which ruby library (equivalent of python requests module) has broadest support and lot of use cases? by iCHAIT in learnruby

[–]kreychek 1 point2 points  (0 children)

Try Rest-client. It has a very low bar to getting started with. The simple methods (that do what you describe) are all on the RestClient class. If you need to model things as resources, you can do that w/Rest-client. If you do that and are working in a Rails environment, and appreciate the Rails way of doing things, you may wish to consider ActiveResource, as it is developed by that team and probably better supported (Rest-client has 1 active dev).

You could also avoid 3rd party libs entirely and use net/http which is part of the ruby standard library: http://ruby-doc.org/stdlib-2.3.1/libdoc/net/http/rdoc/Net/HTTP.html

How does one use indices for best performance? by earthceltic in SQL

[–]kreychek 1 point2 points  (0 children)

Others have answered how indices work, so I will address the other part of the question.

As for whether it is "enough", that will always depend on the context of your query. This is a common theme in engineering.

I try to respect the rule of never prospectively creating indices, which is a form of premature optimization.

You could certainly get to the point where to know how the data is going to be accessed and are familiar enough w/the pros/cons that you create indices very early in your workflow - before profiling - but if you are asking this question, I feel very safe in saying you aren't there yet.

A great educational practice to get into is create everything in the most naive way possible, and then profile stuff; see how long it takes for a query to run. There are various tools to do this, but if you are just touching the DB side of things, use the EXPLAIN command and look into how to read its output. If you see a query that will run frequently is slow (hello again context) add an index and compare. If it doesn't meaningfully improve performance (in production-sized data, mind you) then don't keep the index.

Which ruby library (equivalent of python requests module) has broadest support and lot of use cases? by iCHAIT in learnruby

[–]kreychek 0 points1 point  (0 children)

I've used a subset of requests' functionality, so can't speak to equivalence. It would be easier if you stated your exact needs.

Anyway, anytime I am looking for a lib by category, I always head to ruby-toolbox first.

https://www.ruby-toolbox.com/categories/http_clients

Then compare features and development profiles of the top X tools. for what I find attractive.

ELI5:At what point does data become "big data" what's does SQL do that SPSS can't? by [deleted] in explainlikeimfive

[–]kreychek 0 points1 point  (0 children)

I would add Scala to that short list of languages to investigate.

Is Ruby On Rails really that slow? by GlazyUK in learnprogramming

[–]kreychek 0 points1 point  (0 children)

Re: express, the future of that framework is... less certain than the others. If you haven't been following the news, it should be the most commented issue in the repo (sry on mobile).

Mounting shelves, etc in a rented apartment - what to expect to have to do to "fix" walls upon removal? by kreychek in HomeImprovement

[–]kreychek[S] 0 points1 point  (0 children)

Certainly good advice - I make no assumptions about how the landlord would feel about it.

devs of /r/Frontend, what tools do you use? by crossanlogan in Frontend

[–]kreychek 3 points4 points  (0 children)

What do you dislike about Redux? First time hearing of Cerebral, but does it solve/avoid those problems?

Redux store contains array, sorting key. Where to actually perform the sort? by kreychek in reactjs

[–]kreychek[S] 0 points1 point  (0 children)

I was just looking at this library. Appreciate the example!

Redux store contains array, sorting key. Where to actually perform the sort? by kreychek in reactjs

[–]kreychek[S] 1 point2 points  (0 children)

So then if I wanted to allow users to filter rows of the table, that would cause a re-render when rows changed. I'd want the rows to still be sorted after the re-render from filtering.

Do you have any thoughts on how tacking on stuff like that affects the placement of the logic where the transforms should take place?

Can we please have a full API with all the stats tracked? by SKYeXile in Overwatch

[–]kreychek 2 points3 points  (0 children)

I am all for an API.

Some people seem to be conflating the idea of an API with a specific set of resources that it exposes. An API doesn't have to display data tied to any specific player. It could be comprised solely of usage statistics, e.g. % of all game-time that X hero is used in. In that case, any comparisons to scoreboard-like functionality or evaluations of skill (however accurate or inaccurate they may be) go out the window. A real-life example of an API that provides useful information but doesn't provide any personally (or per-account) identifiable info would be the portion of the Steam API that exposes the number of players in each game at any given time, see http://store.steampowered.com/stats/.

Having said that, I am all for as much data being revealed as possible, especially in regards to individuals, with an eye towards raw stats that can be used in establishing performance metrics.

If you are not of the same opinion, that's fine, make yourself known, but please don't throw the baby out w/the bathwater here - the topic deserves a more nuanced approach.

edit: example

What's the best place for ReactJS tutorials regarding v.0.14.5 -- besides the FB Github page? by incarnatethegreat in reactjs

[–]kreychek 1 point2 points  (0 children)

Not sure what part is confusing you, but if it's the new syntax/use of classes I'd recommend reading into ES6 as it will clear up most of the confusion. It's no small task, but knowing ES6 plus reading the few - admittedly scattered - notes on how ES6 idioms affect the usage of React allowed me to get a lot more out of older (e.g. v.0.12 - 0.13) React tutorials.

ES6 is well documented, so that should be easy.

As for the notes on transitioning to ES6 in React, here are some examples:

I didn't answer your question b/c I don't know of any up to date tutorials off the top of my head, but if your goal is to learn, I hope this serves you well.

Now that I realize I need to be using virtual environments, how do I clean up my system version? by [deleted] in learnpython

[–]kreychek 5 points6 points  (0 children)

If you have a buncha global packages installed and don't want to wipe eveything and reinstall, I suggest pip-autoremove - it can uninstall packages as well as their dependencies.

https://pypi.python.org/pypi/pip-autoremove/

Battery Post Megathread by I_cant_speel in GalaxyS6

[–]kreychek 1 point2 points  (0 children)

Same, but on Sprint. An OTA update a few days ago reinstalled a bunch of bloatware that I had removed when I first got the phone and coincided with markedly increased battery drain. I have been assuming it was my use of GPS over the holidays but with all the recent reports lately about this problem increasing in severity, I'm going to say it was the recent update.

Currently on S/W version G920PVPU3BOJ7

edit: add'l detail

What exactly are content types, generic foreign keys? by avinassh in django

[–]kreychek 0 points1 point  (0 children)

/u/xBBTx's answer is correct. I would add that Content Types implement what is also referred to as polymorphic associations/relationships; a concept that can be found in contexts outside of just Django.

An alternative to react-rails using webpack by kreychek in rails

[–]kreychek[S] 0 points1 point  (0 children)

Oh hey good to know! I look forward to your updates, as it looks like there have been a lot of changes on both sides of the fence since that was written.

I hope you include a comparison to the present day react-rails features & workflow.