Posts

Rails throwing error: Association named 'media' was not found on User; perhaps you misspelled it? -

So I'm trying to find all users who have made a comment under the same picture. The psql terminal I write it and it gives me all the information that I need: select * Come to the users, users.id = comments.user_id in the media Media to join .ID = Comments can include internal media. Media_id where media_id = 1 I am currently doing this in the rail: @users = User.joins (: Comments: Media) .where (Media_id = @ medium.id) I should work. But when trying to print all the usernames from my code in @ , this error is thrown: The association named 'Media' Not found on user; Maybe you misspelled it? Did I do wrong work in my pen? DB Schema: create_table "media", force: true do | T | # Unrecognized columns using t.integer "user_id" end add_index "media", ["user_id"], name: "index_media_on_user_id", :: btree create_table "comments", force: true do | T | # Indispensable column t.integer "user_...

create a list with content of multiple zip files in linux -

I am trying to create a script for linux which is a list with all the files inside the directory from all directories Will make / P> #! / Bin / bash * .zip * "-type f` for the file in / Find / home -iname" * * unzip-l $ (echo $ {file}) & gt; & Gt; /home/list.txt This works, but only when there is no white space in the file name. What can I do to make this work? You find this command to execute a command for each file Maybe try to do something like this: find / home-name "* .zip *" -type f -exec unzip -l {} \; & Gt; /home/list.txt

openssl - is RSA private key less than public? -

When I create a pair of RSA by OpenSL, it seems that the private key (personal exponent) is always less than the public key (modulus). ). Is it from RSA Design? This is not a requirement, but there is no reason to grow it compared to modulus: Personal exponent d is calculated to satisfy the public exponent e and the modulus n : ed ≡ 1 mod φ (n) Now, if we believe that d & gt; Φ (n) , then we can define d '= d mod φ (n) , and not only d' & lt; Φ (n) , but the above relationship still holds, that is: ed '≡ 1 mod φ (n) Thus D ' is also a valid private exponent, and since φ (n) , d ' should also be less than n . Since a large private investor needs more storage, and (at least nostalgic implementation) decryption slows down, the least possible private exponent is most suitable.

xcode6 - How to programmaticlly center verticaly a label in swift ? -

Image
I have a problem with the label; I'm not sure about standing this label: textRect = NSMakeRect (newX, newY, 400, 400) to textTextContent = NSString (string: "label") let textStyle = NSMutableParagraphStyle.defaultParagraphStyle (). As mutableCopy () NSMutableParagraphStyle textStyle.alignment = NSTextAlignment.CenterTextAlignment horizontaly easy, but verticaly I find a way to do it coudn't .. Thanks for the help, and sorry for my english! I think that any alignment like qualities to have container Use the view to stop the label to focus the center. You have the form of obstacles program can add: containerView.addConstraints ([NSLayoutConstraint (item: ContainerView, featuring: .CenterX, relatedBy: .Equal, toItem: labelView, featuring: KCenterX, multiplier: 1.0, continued : 0.0), NSLayoutConstraint (item: ContainerView, featuring: .CenterY, relatedBy: .Equal, toItem: labelView, featuring: KCenterY, multiplier: 1.0, constant: 0.0)])

javascript - How can I access the function applied in success of an $http.post? -

I'm starting this function when I click on a button. .controller ( 'Formctrl' function ($ scope, ichrisLayoutLeavebalanceService) {$ scope.listRowSelected = function (list, item) {var det = {detnumber: item.detnumber}; ichrisLayoutLeavebalanceService.callPost (DET) .success (function) (ichrisLayoutLeavebalanceService.leaveBalanceProcess ();});};}); However, it seems that I can not use the holiday balance process (). It seems that only the factory part is able to share. Here is my controller and factory code which is accessed by the above code. . Directive (/ * code ... code ... * / / / code ... long code ... * / / * Code ... code ... * /} controller ($ scope, ichrisLayoutLeavebalanceService) { function equals () {// code ... code ...} $ scope.leaveBalanceProcess = function () {/ * code ... code ... * /} $ scope.build = function () {ichrisLayoutLeavebalanceService.callPost (equals ()) success (function (data) {$ scope.leaveBalanceProcess (data)}) ;.} $ scope.buil...

python - Pythonista way of extracting elements from an array -

I am writing some python lines of code that do the following: I have two arrays And in B, B (full strictly) increasing integers are not included. I want to extract from those values ​​for which the value of b is greater than 20, but I do not want that duplicate, if B has values: ..., 40,40,41 , ... I just do not want the first value equal to 40 to the other. This is the reason that a [b% 20 == 0] does not work. I am using: factor = [20 * i in xrange (1, for factors in int factors [0] [0] [0] [ 0] [0] [0] [0] [0] [0] [0] [/]> -text "itemprop =" text "> a [(b% 20 == 0 ) & Amp; Np.r_ [true, npdiiff (b)> gt;] b% 20 == 0 div gives a binary mask Which selects all the elements of B, which is the factor of 20. NPR_ [true, np df (b) gt; 0] makes a binary mask that only elements Which separates from the previous element (we obviously add a truth in the beginning, because there is no previous element in the first element). Add ...

adobe air development ide / tools -

I would like to create the HTML5 app for desktop in Adobe Air. Unfortunately, Aptana Studio 3 thinks that Adobe Air Does not support, only Aptana Studio 2. So what is the best development idea for Adobe Air? Thank you for your help! OK, so I think the Adobe Air platform has died, but I've found that Development is allowed in the native desktop application in HTML5 / css3 / js I think, this is the best solution.