Quantcast
Channel: Planet Apache
Viewing all 9364 articles
Browse latest View live

Justin Mason: Links for 2018-04-04

$
0
0

Shawn McKinney: Programming in Python using the py-fortress RBAC APIs

$
0
0

py-fortress implements standards-based RBAC in Python. There have been numerous postings lately here about it.

This article is for anyone wanting to get started using its APIs.  Bear in mind the code is still new and there’ll be some refactoring, but the overall approach will be as follows.

Prerequisites

Very soon we’ll have a release of py-fortress that works with just the file system. This is to lower complexity of testing and developing with this package. In the meantime, an LDAP server has to be running on the network, so follow the instructions in the quickstart below to use a Docker container, if you don’t already have one installed.

  • Install an LDAP server using Docker – SECTION 2. Start using ApacheDS or OpenLDAP Docker Image:
    • README-QUICKSTART
    • Note: No need to perform any steps after SECTION 2, like cloning py-fortress and running integration tests.
  • Completed installation py-fortress:
    • README-INSTALL
    • After this step py-fortress will be installed as a package to your local Python runtime environment.
  • Copied py-fortress-cfg.json to the runtime folder of your python program.
    • This config file has the startup parameters py-fortress needs to connect to ldap, etc.
    • Ensure the ldap coordinates in the config file point to your ldap server instance.

API Usage

The py-fortress-sample project includes python module you can use as a starting point.

  1. Prepare your python module for usage by importing:
    from pyfortress import (
        # model
        User,
        Role,
        Perm,
        PermObj,
        # apis:
        review_mgr, 
        admin_mgr, 
        access_mgr,
        #exception handling:
        FortressError,
        global_ids
    )
  2. Add a user:
    def test_add_user(self):
        """
        Add a basic user
        """
        print('test_add_user')
        
        try:
            admin_mgr.add_user(User(uid='foo1', password='secret'))
            print('test_add_user success')                        
        except FortressError as e:
            self.fail('test_add_user failed, exception=' + e.msg)     
    
  3. Add a role:
    def test_add_role(self):
        """
        Add a basic role
        """
        print('test_add_role')        
        try:
            admin_mgr.add_role(Role(name='Customer'))
            print('test_add_role success')                        
        except FortressError as e:
            self.fail('test_add_role failed, exception=' + e.msg)     
    
  4. Add an object:
    def test_add_obj(self):
        """
        Add a basic perm object
        """
        print('test_add_obj')
        
        try:
            admin_mgr.add_object(PermObj(obj_name='ShoppingCart'))
            print('test_add_obj success')                        
        except FortressError as e:
            self.fail('test_add_obj failed, exception=' + e.msg)     
    
  5. Add a perm:
    def test_add_perm(self):
        """
        Add a basic perm
        """
        print('test_add_perm')
        
        try:
            admin_mgr.add_perm(Perm(obj_name='ShoppingCart', op_name='add'))
            print('test_add_perm success')                        
        except FortressError as e:
            self.fail('test_add_perm failed, exception=' + e.msg)     
    
  6. Assign a user:
    def test_assign_user(self):
        """
        Assign a user to a role
        """
        print('test_assign_user')
        
        try:
            admin_mgr.assign(User(uid='foo1'), Role(name='Customer'))
            print('test_assign_user success')                        
        except FortressError as e:
            self.fail('test_assign_user failed, exception=' + e.msg)     
    
  7. Grant a permission:
    def test_grant_perm(self):
        """
        Grant a permission to a role
        """
        print('test_grant_perm')
        
        try:
            admin_mgr.grant(Perm(obj_name='ShoppingCart', op_name='add'), Role(name="Customer"))
            print('test_grant_perm success')                        
        except FortressError as e:
            self.fail('test_grant_perm failed, exception=' + e.msg)     
    
  8. Now test signing on the RBAC way:
    def test_create_session(self):
        """
        create session
        """
        print('test_create_session')
        
        try:
            session = access_mgr.create_session(User(uid='foo1', password='secret'), False)
            if not session:
                print('test_create_session fail')
                self.fail('test_create_session fail')
            else:
                print('test_create_session pass')
                pass                        
        except FortressError as e:
            self.fail('test_create_session failed, exception=' + e.msg)            
    

    The session will then be held on to by the client for subsequent calls like check_access and session_perms

  9. Here’s how to check a single permission:
    def test_check_access(self):
        """
        create session and check perm
        """
        print('test_check_access')
        
        try:
            session = ... obtained earlier
            result = access_mgr.check_access(session, Perm(obj_name='ShoppingCart', op_name='add'))
            if not result:
                print('test_check_access fail')
                self.fail('test_check_access fail')
            else:
                print('test_check_access pass')
                pass                        
        except FortressError as e:
            self.fail('test_check_access failed, exception=' + e.msg)                 
    
  10. Retrieve all of the permissions as a list:
    def test_session_perms(self):
        """
        create session and get perms for user
        """
        print('test_check_access')
        
        try:
            session = ... obtained earlier
            perms = access_mgr.session_perms(session)
            if not perms:
                print('test_session_perms failed')
                self.fail('test_session_perms failed')
            
            for perm in perms:
                print_perm(perm, 'session_perms: ')
            pass                        
        except FortressError as e:
            self.fail('test_session_perms failed, exception=' + e.msg)     
    
  11. More… py-fortress-sample

There’s a bit more to standards-based RBAC than just these 10 apis, stay tuned…!

Matt Raible: Spring Break 2018: Sun, Fun, and Disney World!

$
0
0

I love Spring break. Who doesn't?! When I was a student, it was a nice break between quarters and led to many adventures with friends in college. As an adult, I love taking a Spring break holiday and spending it with my family. In a recent blog post on the @oktadev blog, I wrote:

I work hard, and I play hard. My family loves to do ski weekends, road trips, and whitewater raft trips. I’m lucky to work at a company like Okta that has an unlimited vacation policy. I’ve heard that most unlimited vacation policies don’t work for people because they tend to work more, and take fewer vacations.

I take full advantage of our unlimited vacation policy and make sure to take a week of vacation during every other six-week plan.

How to Achieve Massive Productivity at Work

Last week, my family and I spent Spring break 2018 with Trish's parents in Naples, Florida. We saw some incredible cars, enjoyed a day at Magic Kingdom in Disney World, played some golf, took in a couple of sunsets, and relaxed a bunch. I think some pictures describe it best.

An hour into the two hour wait for #splashmountain.Watch out - Jack is driving!

Disney Fireworks!

Naples Sunset

Awww, they really do ?? each other!

Happy Easter!

More on Flickr → Spring Break 2018

Q1 Technical Blog Posts

In case you're here looking for technical blog posts, I'm still writing about Java, Spring Boot, Angular, React, and JHipster quite a bit. However, I'm doing it mostly on the Okta Developer Blog. Here's a list of my blog posts from Q1 2018:

JHipster Mini-Book v4.5 Released!

In related writing news, version 4.5 of the JHipster Mini-Book is now available! Please let me know if you find any issues, or would like clarification on any topics.

Justin Mason: Links for 2018-04-06

Bryan Pendleton: Life moves along

$
0
0

Does anybody know of a way that I can find out the names of the people in thisamazing picture?

I recognize some of the most obvious ones: Jesse Jackson, Andrew Young, Coretta Scott King and her children, Ralph Abernathy, John Lewis (?), Julian Bond (?), but I'm sure that somewhere, there must be a copy of this picture with everyone tagged? I'd love to know more about the picture, and more about the people in it, besides those who are of course well-known to us all. The best I found was this, which is fascinating but I was hoping for even more.

Meanwhile, in other completely unrelated, but interesting to me, news:

  • It was just as big a storm as predicted: Record April Rains Raise Rivers And Flood Concerns
    Yosemite National Park closed campgrounds and lodging in its busy Yosemite Valley because of flooding concerns, with the Merced River there expected to peak 5 feet (1.5 meters) above flood stage on Saturday.

    ...

    Bodega Bay in the county received nearly 6 inches (15.2 centimeters) of rain for the day

    ...

    Lake Oroville has been filling up all winter, and more water was coming in than flowing out Friday. The water level Friday night had topped 793 feet (242 meters). If it reaches about 830 feet (253 meters), water managers said they may open the gates to the spillway.

    ...

    California officials say they hope to avoid using the main spillway but are confident it can safely function.
  • Test Drilling Launched at the Sinking Millennium Tower
    Crews have quietly launched a $9 million exploratory drilling project at the Millennium Tower to evaluate a planned fix for the sinking and tilting structure, NBC Bay Area has learned.

    The project started earlier this month on Beale Street and involves drilling holes between 200 and 300 feet down to bedrock. The goal is to see whether the method will stabilize the troubled foundation.

    ...

    The so-called micropile strategy is not new; it was used to shore up the Mandalay Bay Resort in Las Vegas, which sank some 18 inches during construction before being stabilized by more than 500 micropiles.

  • Micropile Underpinning of the Mandalay Bay Hotel & Casino
    The approach was to drill and install micropiles through holes cored into the mat and not bonded in the mat, so that the piles could be jacked into the ground and maintain the building at a desired level. Then structural beam supports would be installed to act as permanent attachments and jacking frames. The entire system had the capacity to lift the center of the tower if that proved to be necessary. In order to support the center core, a layout consisting of 536 micropiles (Pin Piles) was developed by the structural engineer, Lochsa Engineering. Due to the limited plan area and the fact that it would be impractical to delay elevator construction to drill inside the shafts, all piles were located outside of the shafts. The resulting system was designed to support the core as if it was one very large pile cap. All the micropiles used to support the hotel core were 200 feet deep, were fully bonded with grout to the various soil and caliche layers and were isolated from the mat. The decision to drill 200 feet was based on a fairly substantial caliche layer being encounter at the depth in a preliminary methods hole and subsequent boring also often encountering a similar layer.
  • FORM S-4 REGISTRATION STATEMENT
    On February 2, 2018, Mr. Somorjai sent an email to Mr. Schott requesting a meeting to discuss various commercial matters, including joint business development ideas.

    ...

    On February 26, 2018, Mr. Schott met with Mr. Benioff. During the course of this meeting, Mr. Benioff described the importance of an integration platform to Salesforce’s strategic plans, and observed that MuleSoft’s products could be the foundation of Salesforce’s integration platform. Mr. Benioff asked Mr. Schott if the MuleSoft board of directors would be open to the possibility of considering a combination of the two companies. Mr. Schott responded that, although MuleSoft was not for sale, the MuleSoft board of directors would consider in good faith any reasonable offer it received from Salesforce.

    ...

    Between the afternoon of March 18, 2018 and the morning of March 20, 2018, representatives of WSGR continued to negotiate and finalized the draft definitive merger agreement with representatives of Wachtell Lipton.

  • SPRING EDITION: March 2018
    Ridership on WETA’s San Francisco Bay Ferry has increased by 94 percent since 2012 to more than 2.7 million riders annually. The demand for ferry service has grown across all four service routes

    ...

    WETA has already been modernizing and expanding its fleet, investing in infrastructure improvements, and planning for new service:

    • Two of four new 400-passenger, 27-knot vessels have already entered service, with the third entering service in May and the fourth in December.
    • Three new 445-passenger, 34-knot vessels for the Vallejo/North Bay services are expected in late 2018 and 2019.
    • The North Bay Operations and Maintenance Facility in Vallejo opened in 2016, and the Ron Cowan Central Bay Operations and Maintenance Facility in Alameda is scheduled to open in Summer 2018.
    • A major expansion of ferry landing facilities at the San Francisco Ferry Building is currently under construction with two gates scheduled to open in November.
    • A Richmond ferry terminal is under construction and new service from Richmond to San Francisco is scheduled to start in Fall 2018.
  • Alameda’s Ferry Nightmare
    The city downsized parking for the ferry terminal after area neighbors complained. “We protect our property values and make sure that this is a safe place for residents and homeowners,” said Dawn Jaeger, executive director of the Harbor Bay Isle Association.

    Under the city’s new rules, four homeowners associations received parking permits for residents of the area. Ferry commuters aren’t allowed access to the permits.

    The city’s decision on ferry parking comes as the Harbor Bay ferry has been experiencing a surge in popularity. The ferry’s ridership has surged by 68 percent in the past five years, according to a city report last fall.

  • Raising the Speed Limit on Future Growth
    The final and perhaps most critical issue I want to highlight also relates to skills: We’re not adequately preparing a large fraction of our young people for the jobs of the future. Like in most advanced economies, job creation in the United States is being tilted toward jobs that require a college degree (OECD 2017). Even if high school-educated workers can find jobs today, their future job security is in jeopardy. Indeed by 2020, for the first time in our history, more jobs will require a bachelor’s degree than a high school diploma (Carnevale, Smith, and Strohl 2013).

    These statistics contrast with the trends for college completion. Although the share of young people with four-year college degrees is rising, in 2016 only 37% of 25- to 29-year-olds had a college diploma (Snyder, de Brey, and Dillow 2018). This falls short of the progress in many of our international competitors (OECD 2018), but also means that many of our young people are underprepared for the jobs in our economy.

  • Crossword
    This puzzle is a collaboration by the singer/songwriter Weird Al Yankovic, working together with Eric Berlin, a writer and puzzle editor from Milford, Conn.

Shawn McKinney: New Sheriff in Town

$
0
0

And we don’t need no stinking badges either.  Yeah, I’m mixing up clichés, sometimes happens after coding for too many hours in a stretch.  🙂

What I’m talking about is a new software development kit, released to PyPI yesterday for the first time.

py-fortress on PyPI

Considering we just started coding on this project a couple of months ago that’s pretty good progress.

What’s it do?  It’s a toolkit designed for the Python3 platform, with APIs that programs can use to do security in an RBAC-compliant way.  Today, it uses an LDAP server to store the policies, but a file-based backend will soon be ready.  No, I’m not recommending files in production, but it’s fine for getting started.

How does py-fortress work?  It’s built on top of some concepts that followers of this blog have heard about before — Apache Fortress.  You can check out the project, and some introductory comments here:

py-fortress README on GitHub

Inside are links to some documents to help get started including a QUICKSTART for first-time users.  The quickstart doesn’t require cloning the project GIT repo, but you’ll need a linux machine, Python3 and a Docker engine installed (to run the test LDAP server) to try it out.  Everything else should be covered.  Let me know what you think.

Why would you want it?  That’s a long story.  It starts with a need to follow standards, in security processes, like authentication and authorization.  That models such as RBAC are of vital importance to the well-being of most computing ecosystems.  That there’s value in following best-practices.

It may help to know that this project is backed by my employer — Symas.  A company well-versed in commercial sponsorship of open source projects.

Eventually, this code may end up in an Apache project, like Apache Fortress.  Or, it might land somewhere else.  It’s too early to know.  What’s certain is that it’ll remain open, available to use and learn from.

Justin Mason: Links for 2018-04-07

Justin Mason: Links for 2018-04-09

$
0
0
  • If iPads were meant for kids

    A long list of the misfeatures that IOS/Android devices have regarding child use. 100% agreed with this

    (tags: iosipadiphoneparentingdeviceskidsandroidyoutube)

  • A Closer Look at Experian Big Data and Artificial Intelligence in Durham Police

    ‘UK police bought profiling data for their artificial intelligence (AI) system, deciding whether to hold suspects in custody, from … Experian.’ ‘The AI tool uses 34 data categories including the offender’s criminal history, combined with their age, gender and two types of residential postcode. The use of postcode data is problematic in predictive software of this kind as it carries a risk of perpetuating bias towards areas marked by community deprivation.’

    (tags: experianmarketingcredit-scoredatapolicingukdurhamaistatisticscrimehart)

  • lemire/JavaFastPFOR: A simple integer compression library in Java

    a library to compress and uncompress arrays of integers very fast. The assumption is that most (but not all) values in your array use much less than 32 bits, or that the gaps between the integers use much less than 32 bits. These sort of arrays often come up when using differential coding in databases and information retrieval (e.g., in inverted indexes or column stores). Please note that random integers are not compressible, by this library or by any other means. If you ever had the means of systematically compressing random integers, you could compress any data source to nothing, by recursive application of your technique. This library can decompress integers at a rate of over 1.2 billions per second (4.5 GB/s). It is significantly faster than generic codecs (such as Snappy, LZ4 and so on) when compressing arrays of integers. The library is used in LinkedIn Pinot, a realtime distributed OLAP datastore. Part of this library has been integrated in Parquet (http://parquet.io/). A modified version of the library is included in the search engine Terrier (http://terrier.org/). This libary is used by ClueWeb Tools (https://github.com/lintool/clueweb). It is also used by Apache NiFi.

    (tags: compressionjavapforencodingintegersalgorithmsstorage)

  • Austerity is an Algorithm

    Fucking hell, things sound grim Down Under:

    Things changed in December 2016, when the government announced that the system had undergone full automation. Humans would no longer investigate anomalies in earnings. Instead, debt notices would be automatically generated when inconsistencies were detected. The government’s rationale for automating the process was telling. “Our aim is to ensure that people get what they are entitled to—no more and no less,” read the press release. “And to crack down hard when people deliberately defraud the system.” The result was a disaster. I’ve had friends who’ve received an innocuous email urging them to check their MyGov account—an online portal available to Australian citizens with an internet connection to access a variety of government services—only to log in and find they’re hundreds or thousands of dollars in arrears, supposedly because they didn’t accurately report their income. Some received threats from private debt collectors, who told them their wages would be seized if they didn’t submit to a payment plan. Those who wanted to contest their debts had to lodge a formal complaint, and were subjected to hours of Mozart’s Divertimento in F Major before they could talk to a case worker. Others tried taking their concerns directly to the Centrelink agency on Twitter, where they were directed to calling Lifeline, a 24-hour hotline for crisis support and suicide prevention. At the end of 2015, my friend Chloe received a notice claiming she owed $20,000 to the government. She was told that she had reported her income incorrectly while on Youth Allowance, which provides financial assistance to certain categories of young people. The figure was shocking and, like others in her position, she grew suspicious. She decided to contest the debt: she contacted all of her previous employers so she could gather pay slips, and scanned them into the MyGov app. “I gave them all of my information to prove that there was no way I owed them $20,000,” she says. The bean counters were unmoved. They maintained that Chloe had reported her after-tax income instead of her before-tax income. As a result, they increased the amount she owed to $30,000. She agreed to a payment plan, which will see her pay off the debt in fortnightly installments of $50 over the course of two decades. “I even looked into bankruptcy because I was so stressed by it,” she says. “All I could think about was the Centrelink debt, and once they upped it to 30k, I was so ashamed and sad and miserable,” she says.

    (tags: austerityalgorithmsautomationdystopiaaustraliagovernmentdebt-collectorsrobo-debtdolebenefitgrim-meathook-future)

  • The Irish Border’s Ladybird How It Works book on The Technological Solution

    amazing

    (tags: ladybirdparodyfunnyirelandpoliticsnorthern-irelandbrexit)

  • Mythology about security…

    A valuable history lesson from Jim Gettys:

    Government export controls crippled Internet security and the design of Internet protocols from the very beginning: we continue to pay the price to this day.  Getting security right is really, really hard, and current efforts towards “back doors”, or other access is misguided. We haven’t even recovered from the previous rounds of government regulations, which has caused excessive complexity in an already difficult problem and many serious security problems. Let us not repeat this mistake…
    I remember the complexity of navigating crypto export controls. As noted here, it was generally easier just not to incorporate security features.

    (tags: securitycryptoexport-controljim-gettysx11historyx-windowsmitathenakerberos)


Justin Mason: Links for 2018-04-10

$
0
0

Nick Kew: Far from the comfort zone

$
0
0

(Readers with no interest in singing, please consider this TL;DR).

Yesterday evening I crossed the floor.

Let me explain.  This is a choir rehearsal.  The choir in question is not a strong one, but has a new conductor who is doing a lot of good things to improve it, and whose reputation drew me to join.  I recently enjoyed singing Rossini with them (as reported here last month), and the eventual standard of performance was a lot better than one would’ve expected from the rehearsals.

This choir’s next fixture is a concert in which only half is choral.  The Fauré Requiem and his Pavane.  The Requiem is something I’ve sung in many times – both First and Second Bass lines – and I really can’t face rehearsing it all over again with a choir that needs to note-bash and such boring things.  So I crossed the floor, and am attempting to sing Second Tenor.

It’s something I’ve occasionally contemplated, and the Fauré is kind-of an ideal trial work: not too long, not too high, and the tenors have most of the best lines!  I know I can do tenor in small doses, but I tend to suffer if I try and sustain it for more than a few minutes.  So it is with trepidation and a great deal of uncertainty that I cross the floor.

And it’s not just the tessitura that’s a challenge.  Reading the music is different: not so much the treble clef (any male singer needs to be .. um .. ambiclefstrous) but the different character of a tenor line.   That’s a minor challenge, but one I’ll enjoy.  And in one rehearsal so far, I don’t hear it around me: there’s scope to be the confident leader, which I managed in places.

Can I hack the tessitura?  I came to a grinding halt on the last page of the Dies Irae section, but was otherwise OK.  Time will tell how that plays out: on a day when I’m tired I’ll be useless, but when I’m on form I shall be working on technique to get through it and pace myself for the sustained high passage that defeated me.

Still Bass in my regular choir and other occasional and one-off activities.  That’s the comfort zone.

Justin Mason: Links for 2018-04-11

$
0
0
  • Uses This / Leonard Lin

    lhl describes the stuff he uses, day to day. Lots of travel gear, drones, Linux and a surprising lack of Macs

    (tags: travelshoppinghardwaregearuses-thislhldronesvrlinuxvivechromebooktips)

  • #Repealthe8th | Are the Irish Media Up To The Job?

    For years we were subject to speculation and debate about the emergence of new party in Irish politics. Endless coverage for Lucinda Creighton, Michael McDowell and whoever else. All the while, the most incredibly vibrant social movement touching every county in Ireland has emerged and the majority of journalists are unable to write about it. Media comment has concerned itself not so much with the issues but with grave concern that this is happening outside perceived boundaries of respectable politics. This is ordinary people getting together and putting a most unspeakable issue on the agenda and soon to vote – in spite of the Normal Rules. It is not just that regime journalists live in a bubble or don’t care to inform themselves. They genuinely do not understand how this campaign has played out. It is beyond their entire conception. This is what happens when your idea of politics only extends to the ritual of posters on lamp posts.

    (tags: mediairelandpoliticspolitical-correspondentsoireachtas-retortanalysissocietymarrefrepealthe8th)

Rohit Yadav: CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)

Rohit Yadav: RAILS: UPLOADING PHOTOS VIA AMAZON S3 AND PAPERCLIP (UPLOADING FILES TO S3 IN RUBY WITH PAPERCLIP)

$
0
0

Set up Ruby on Rails with Paperclip and S3 using AWS SDK
Uploading Files to S3 in Ruby with Paperclip

Paperclip requires the following gems added to your Gemfile.

If your paperclip version is 5.1.0 then we are using 'aws-sdk' version 2.3.

# Gemfile
gem 'paperclip'
gem 'aws-sdk', '~> 2.3'

or our paperclip version is 4.1.0 then we need to use 'aws-sdk' version < 2  (note: add version less than 2.0 otherwise you will get paperclip error)

gem 'paperclip'
gem 'aws-sdk', '< 2.0'


Run bundle install and restart the Rails server after modifying the Gemfile.

Then run the command :-

rails generate paperclip user image

Define the file attribute in the Model

class User < ActiveRecord::Base
    has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "/images/:style/missing.png"
      validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
end

Migrations: Now our migration file look like :-

class AddAvatarColumnsToUsers < ActiveRecord::Migration
  def up
    add_attachment :users, :image
  end

  def down
    remove_attachment :users, :image
  end
end


View Page :-

<%= form_for @user, url: users_path, html: { multipart: true } do |form| %>
  <%= form.file_field :image %>
<% end %>


Now in the controller :-

def create
  @user = User.create( user_params )
end

private
def user_params
  params.require(:user).permit(:image)
end


In our view page we can show the image using :-

<%= image_tag @user.image.url %>
<%= image_tag @user.image.url(:medium) %>
<%= image_tag @user.image.url(:thumb) %>


After that :- 
S3 bucket Implementation:-
1. Go to Aws Console
2. Create the s3 bucket with bucket name and choose specific region.
3. Get the app_key and app_secret (link: https://www.multcloud.com/tutorials/s3-key.html)


We’ll also need to specify the AWS configuration variables for the development/production Environment.

# config/environments/production.rb

config.paperclip_defaults = {
    storage: :s3,
    s3_credentials: {
    bucket:
ENV.fetch('S3_BUCKET_NAME'),
    access_key_id:
ENV.fetch('AWS_ACCESS_KEY_ID'),
    secret_access_key:
ENV.fetch('AWS_SECRET_ACCESS_KEY'),
    s3_region:
ENV.fetch('AWS_REGION')   
    }
  }



If we are getting problem with http or https s3 image path then you can do that :-

config.paperclip_defaults = {storage: :s3,s3_protocol: :http,s3_host_name: "s3.us-east-2.amazonaws.com",bucket: ENV.fetch('S3_BUCKET_NAME'),s3_credentials: {access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),s3_region: ENV.fetch('AWS_REGION')    },s3_permission: {:original => :public}

OR IF YOU ARE CREATING NEW FILE IN CONFIG FOLDER FOR SAVING THE S3 CREDENTIALS THEN WE JUST HAVE TO CHANGE OUR MODEL SETTING AND WE CAN GET THE S3_CREDENTIALS FROM CONFIG FILE :-

Model :-

class User < ActiveRecord::Base
     has_attached_file :image,:styles => { :icon => "50x50>", :small => "150x150", :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/assets/icons/picture.png", :storage => :s3,:s3_credentials => "#{Rails.root}/config/aws_s3.yml",:url => ':s3_domain_url', :path=> ":attachment/:id/:style/:filename"

      validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
end


# config/aws_s3.yml

development:
bucket: ENV.fetch('S3_BUCKET_NAME')
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID')
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY')
s3_region: ENV.fetch('AWS_REGION')



WE CAN REFER :-

https://github.com/thoughtbot/paperclip

https://devcenter.heroku.com/articles/paperclip-s3#define-the-file-attribute-in-the-model
https://coderwall.com/p/vv1iwg/set-up-ruby-on-rails-with-paperclip-5-and-s3-using-aws-sdk-v2
http://www.korenlc.com/rails-uploading-photos-via-amazon-s3-and-paperclip/

Rohit Yadav: Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension.

$
0
0

When we are getting problem with mysql like :-

Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension.

If we want to solve this problem so firstly we need to uninstall the mysql :-

Uninstall mysql :-

https://www.linuxhelp.com/how-to-remove-mysql-package-completely-on-ubuntu-16-04/

Then we need to install the mysql :-


Then install the mysql gem :-

gem install mysql 

After that run the below command :-

sudo apt-get install libmysqlclient-dev

Justin Mason: Links for 2018-04-12

$
0
0

Justin Mason: Links for 2018-04-14

$
0
0
  • How to report graphic abortion imagery to the gardai under Irish law

    I tried to report ICBR graphic abortion imagery to the Gardai today and met a lot of resistance. The following thread gives an account of what happened and how someone can effectively report this imagery. 1/x At 2pm on Friday the 13th of April I noticed the presence of ICBR graphic abortion imagery being displayed outside the Nassau street entrance of Trinity. I called Kevin Street Garda Station in order to make a complaint under Section 7 of the Public Order Act 1994 2/x I was told that the Gardai had been instructed by their superiors to not intervene with such imagery and that this direction had come from the Refendum Commission itself. I then called the Refendum Commission in order to query this, as they’d never been involved previously. 3/x A representative from the commission informed me that no such direction had been given to the Gardai as it is not in the commission’s remit to influence such imagery. The representative told me that they would contact with Kevin Street Station about this miscommunication. 4/x I then rang Kevin Street Station again to inform them of what I had been told by the Refendum Commission. I was then told that a complaint had to be made in person to either a Garda on the scene or to a local station (Trinity would be Pearse Street), which is understandable. 5/x I informed the Gardai of a similar experience in Dundrum in which the local station had dispatched officers to move along those displaying the imagery to prevent a breach of the peace without a complaint being made in person. 6/x I was finally told that Pearse Street Station would be contacted to have an available car dispatched to Trinity. 8/x TLDR: If you see this imagery, report it under Section 7. If you are told that the Gardai cannot intervene, let them know that other stations have before. If they say they have been directed by the Referendum Commission, let them know there is no such directive on record. 9/x I hope this miscommunication can be cleared up and that both @gardainfo and @RefCom_ie end up on the same page, so that Gardai can continue to do their jobs effectively and respond to public complaints of breach of the peace. 10/10
    Very illuminating.

    (tags: twitterthreadsabortionpropagandagardailawirelandpublic-order-act)

  • Thomas Mayne (politician) – Wikipedia

    An illustrious ancestor, apparently! ‘Thomas Mayne (1832–1915) was an Irish Parliamentary Party politician. He was elected as Member of Parliament (MP) for Tipperary at a by-election in 1883,[1] and held the seat until the constituency was divided at the 1885 general election. He was then elected for the new Mid division of Tipperary,[2] and held that seat until he resigned in 1890 by becoming Steward of the Manor of Northstead.[3]’ He was known for helping Charles Stewart Parnell in a sticky situation — from http://www.online-literature.com/elbert-hubbard/journeys-vol-thirteen/6/ : ‘About six months after this, London was convulsed with laughter at a joke too good to keep: One Captain O’Shea [Kitty O’Shea’s husband] had challenged Charles Parnell, the Irish Leader, to a duel. Parnell accepted the challenge, but the fight was off, because Thomas Mayne had gone to O’Shea and told him he “would kick him the length of Rotten Row if he tried to harm or even opened his Galway yawp about Parnell.”‘

    (tags: parnellthomas-mayneancestorshistoryirelandnationalismmps1800s19th-centurykitty-oshea)

Edward J. Yoon: Gear Watchface Designer on Mac OS X

$
0
0
재직 시절에 (싸게) 구매했던 기어 S3를 쓰다보면 watchface 권태기를 3개월마다 겪게 되는데, 그럴때마다 구매한게 지금 거진 20개 가까이 된다. 그런데 내 마음에 썩 들지도 않고 얼마 안하지만 아깝기도 해서 직접 만들어보기로 했다.

디자이너들을 위한 개발 도구는 Gear Watchface Designer를 검색해서 설치하면 되는데, Java 버전에 따라 키보드와 마우스가 먹통이 되는 현상이 있다. Java다 보니 뭐 맥북이든 윈도우즈든 상관은 없고, 최신버전 JDK에서는 동작하지 않고 반드시 JDK 8u151 [1] 버전을 설치해야 한다. 이것 때문에 개삽...

아래는 내가 지금 만들고 있는 watchface 인데, free 이미지를 활용해서 Roman 스타일로 내 맘에 꼭 든다 ㅋ 돈 받고 팔아봐야지~


[1]. JDK 8u151 버전 설치 링크: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html?printOnly=1

Tom White: Type 1 Diabetes

$
0
0
On 16 February this year I was diagnosed with Type 1 Diabetes.

I had been feeling under the weather - a bit weak, but also persistently thirsty and hungry. I would gulp down a large glass of water in one go with ease (a bit like I did when I was 10 years old after running around outside for hours on a hot day), and I would do this several times every day. I would eat a sandwich after dinner, even after having seconds. Strangely, I was losing weight despite eating a lot. And I found it hard to complete my usual morning run, and when I did manage it, it was noticeably slower than normal.

In retrospect these are all classic symptoms of type 1 diabetes: weight loss, increased thirst and hunger. My body was not producing enough insulin, which is needed to use the glucose in my blood. The weight loss occurred because my body was using fat reserves for energy. My heightened thirst was my body’s way of trying to flush the excess glucose from my system by getting me to urinate more.

So I went to see the doctor and she arranged a blood test, which I had the next day. That was at lunchtime on Friday, and the nurse who took my blood said it would be a week or two before the results came back. So I was surprised when the phone rang at 6pm, and the doctor’s receptionist asked me to come in. On Friday evening? Weren’t they closed then?

A few minutes later I went in, and she said that my blood glucose level was over 30, and that normally it would be 7. “Tom, you have diabetes.” I didn’t know what to say. I remember asking what the blood glucose level was measured in (millimoles per litre). (I’m always impressing on my daughters the importance of units in science.)

I also asked how they knew it was Type 1. Mainly from the symptoms - I'm quite skinny! Most people with diabetes have Type 2, which is characterised by insulin resistance: the body is still producing insulin, but it can’t use it as effectively. Less than 10% of diabetes sufferers have Type 1, and while most of those are children, adults can get the disease too.

The doctor sent me to the hospital straightaway so they could check if my body was coping with the high sugar levels. Left untreated, high blood glucose levels can lead to a dangerous condition called ketoacidosis.

I rang Eliane to tell her, and we both had a bit of a wobble. She drove over to take me to the hospital. We went to the Emergency Admissions Unit, where they would check my ketone levels (which, thankfully, were normal) and give me a shot of insulin. After that I could go home - there was no need to stay overnight, but they asked me to go back the next day and Sunday to be given insulin again.

The next day, Monday, I saw the Diabetic Specialist Nurse (DSN) who gave me a blood glucose monitor and insulin pens so I could manage the condition myself. She explained my new routine: before every meal and before bed I have to check my blood glucose level and inject insulin. The bedtime insulin is a slow-acting background insulin that lasts for almost a whole day, whereas the mealtime insulin is fast-acting and is meant to compensate for the blood glucose level rise caused by the carbohydrates in the meal. The idea is that you count the number of carbohydrates in the meal you are about to eat, then calculate the number of units of insulin that are needed to cover it.

It doesn’t sound like much, but I hadn’t really paid much attention to the nutritional composition of meals before. And nor had Eliane. We eat healthily, and mainly cook from scratch, but having to analyse each meal was a big change. In the first few weeks it felt like we were spending all our time analysing recipes. It gets easier, but it’s still time consuming.

The goal with diabetes is to keep the blood glucose level between 4 and 7 mmol/l. A person without diabetes has a pancreas that does this for them. Unfortunately, my pancreas has stopped performing this role, hence the need for injected insulin. There are two things to avoid: hyperglycaemia, which is when the blood glucose level is too high, and hypoglycaemia when it is too low.

Broadly speaking, hyperglycaemia has long term effects (such as cardiovascular problems), while hypoglycaemia needs to be treated immediately since its more severe form can require hospitalisation. Normally though, treating a mild “hypo” involves eating something with very fast acting sugar in it (like glucose tablets) and waiting 15 minutes for the level to get back in range. During this time you likely feel weak and shaky.

This chart shows all my blood glucose readings. In the first couple of weeks all my readings were out of range, but then they started stabilising, and now they are mainly in range.



When someone is newly diagnosed with diabetes in the UK, the full support network of the NHS swings into action. In addition to my GP, I have a diabetes consultant, two DSNs, and a dietitian. I saw all of these people in the first week, and I have ongoing support from the DSNs and the dietitian, who I can phone or email if I have a question, or need some help with my insulin dose adjustment. I have a recurring appointment with the consultant every six months. I’ve also been added to the system for annual screening for eye disease. The NHS also provides education programs for carb counting and insulin dose adjustment (one has the fabulous acronym DAFYDD - dose adjustment for your daily diet), as well as an excellent series of videos for newly diagnosed patients. All of this is free. And in Wales, where I live, there are no prescription charges for anyone (for people with diabetes in England, prescriptions are free too), so I don’t have to pay for the medical supplies that I now depend on every day. 

All of the medical staff that Eliane and I have encountered in the last two months have been unfailingly kind and supportive, even when working under pressure (like the first night in the EAU). It’s incredibly reassuring to have access to the resources the NHS provides. I would like to thank everyone there, along with my family, friends, and colleagues from work who have helped me get through the last two months. 

Bryan Pendleton: Faithful Place: a very short review

$
0
0

The third in Tana French's superb Dublin-based mystery novels is Faithful Place.

French's approach to the series is quite unusual. A supporting character in an earlier novel becomes the main character in a subsequent one, and, over time, we get to know a variety of characters who are interconnected in various ways.

But one thing this means is that the books are different, because the characters are different. When you read, for example, a Sue Grafton novel, at some point you knew what to expect.

French's books don't have that quality. Each is different, and stands on its own (though I'm going through them in order, as I think she probably expects readers to do).

Faithful Place is different from the first two works in several ways, but the most notable one is a matter of style. Whereas the earlier words were lyric, moody, enigmatic, Faithful Place is like a truck on a highway: straightforward, blunt, powerful.

There isn't, really, much of a mystery here, in a way. The mystery is more about subtler things, involving how families manipulate themselves, how grudges and hurts thought to be long overcome are still alive, and how people often struggle to do the right thing about those that they care about the most.

It's gritty, it's harsh, it's blunt, and I roared through it like that proverbial truck on a highway, pausing only briefly for rest and refreshment before moving on.

Bryan Pendleton: Happy 90th Mr. Lehrer

$
0
0

Here's a nice tribute from Ken Regan: Tom Lehrer At 90.

It's got some nice links, too, including:

I have to admit I heard most of my Tom Lehrer songs on Dr. Demento, but I don't think it matters how you got to Tom Lehrer, as long as you got there.

Why, we had a great discussion at the office the other day about I got it from Agnes, which I was rather red-faced to admit went totally over my head when I listened to it as a precocious 12-year-old in the early 1970s.

Viewing all 9364 articles
Browse latest View live


Latest Images