5 Reasons you should attend Open Source Day (OSD) at GHC 2019

1. Contribute to an Open Source Project

Being an open source contributor helps you show off your expertise to potential employers since your code is peer-reviewed and publicly available. While contributing to any open source project online can seem daunting to newcomers, at OSD, mentors and representatives from the organization with help you all the way from setting up to fixing your first bug. Participants of all levels are welcome!

2. Network with Organizations

This way you can skip the long lines at the career expo, plus we have lunch covered for you 🙂

Check out the career pages of some of the organizations that are going to be at OSD 2019: Ultimate Software (booth #131), Code for America, Tidepool, OpenStreetMap, and Techtonica

Also Oppia, OpenStack, OpenStreetMap, CHAOSS, and Code for America have been part of Google Summer of Code which is a 3 month programming project during the summer for students (stipend included).

3. Gain mentoring experience

It’s a great way to develop your leadership skills and give back to the tech community. We will provide you with all that you need to get you up to speed with the projects so that not only will you get to work on these inspiring projects, but you will also get the chance to help OSD participants build their technical confidence. Slots are still open for mentors so sign up here. More details about mentoring for OSD can be found here.

4. There’s something for everybody

You don’t always need to know how to code to contribute to open source projects. You can contribute via documentation, translation, design, bug triaging etc. And in case your wondering what project you should pick…

Data Science-y : CHAOSS, Code for America, Tidepool
Cloud: OpenStack
Mobile: Tidepool, Ultimate Software
Design: Code for America
Non-coders: OpenStreetMap

5. It’s for a good cause!


More details about the projects at https://ghc.anitab.org/2019-attend/schedule-overview/open-source-day/

If you have any questions at all about OSD don’t hesitate to ping me 🙂

TIL – Sentiment Lexicons

Lexicon” will refer to the component of a NLP system that contains information (semantic, grammatical) about individual words or word strings.

The role of lexicons in natural language processing – ACM Digital Library

Sentiment lexicons are mappings from words to scores capturing the degree of the sentiment expressed by a given word.

On the Automatic Learning of Sentiment Lexicons
  • There are different kinds of lexicons for different things (Subjectivity Lexicon, Sentiment Lexicon, Emotion, Opinion), even different languages.
  • They can be manually constructed or automated.
  • Sentiment lexicons are an important source of features.

Lexicon Embeddings

Lexicon embeddings are derived by taking scores from multiple sources of lexicon datasets. Each lexicon dataset consists of key-value pairs, where the key is a word and the value is a list of sentiment scores for that word (e.g., probabilities of the word in positive, neutral, and negative contexts). A lexicon embedding is constructed by concatenating all the scores among the datasets with respect to a word. If a word does not appear in certain datasets, 0 values are an assigned in place. The resulting embedding is in the form of a vector v ∈ R^e, where e is the total number of scores across all lexicon datasets.

(Lexicon Integrated CNN Models with Attention for Sentiment Analysis)

GSoC Fedora Happines Packets Update – Week 8th and 9th

The talk got accepted a month ago (https://pagure.io/flock/issue/55) but I didn’t know if I’d be able to attend it. I couldn’t find an appointment at the Houston consulate for July, the entire month was booked but luckily someone cancelled last week so I made a quick trip to Houston. And I got my passport back today and saw the VISA was approved. So I’ll be attending FLOCK 2018 😀

Added a search bar for the messages archive (https://pagure.io/fedora-commops/fedora-happiness-packets/issue/11). Djangos’ django.contrib.postgres.search module makes use of PostgreSQL’s full text search engine which made it pretty convenient to design a query to search against the messages, senders, and recipients. Using the SearchVector you can search against multiple fields. Maybe next week I can add an option to filter and sort the search results based on teh date or user.

Little bit of holdup on (https://pagure.io/fedora-infrastructure/issue/7053) I thought it would be straightforward setting up the production and staging instance once the dev instance was done but ran into a lot of bumps:

  1. Client IDs and secrets: In certain cases, you can’t always set the environment variables with the client ID and secret which is why I opted to go with a secret.json file for the staging and production instance.
  2. JWK endpoints: Mozillas’ OIDC Django plugin throws an error if the JWK doesn’t specify ‘alg’ (the algorithm for the key). I filed a bug report here (https://github.com/mozilla/mozilla-django-oidc/issues/247). The way I worked around it in the dev instace was using the public key from here (https://github.com/transtats/transtats/blob/devel/transtats/settings/auth.py) so I never had to use the endpoint. But I’m not entirely sure how to generate a public key for the production and staging instance from the JWK endpoint. So for now I’m thinking about making a PR to mozilla-django-oidc
  3. fedmsg: Finally, with the help of the infra team, got fedmsg to work in the staging instance. Had to publish messages to the relay.

Badge: So the badge is waiting on the logo for now (https://pagure.io/fedora-badges/issue/627). Might still be able to get this done before since fedmsg is up and running.

Design: The logo request (https://pagure.io/design/issue/606), blue doesn’t seem like the appropriate color to express happiness.

Nginx and Gunicorn

What is gunicorn?

Guincorn or Green Unicorn is a HTTP Server which supports WSGI (WSGI are a bunch rules that allow a web framework, in this case Django, to talk with the server). Django by default generates a WSGI config for your project wsgi.py, and from the comments “It should expose a module-level variable named “application“. ” Keep this in mind for later. Gunicorn is an app server. Its primary job is to work with the web application and serve up “processed” data to web servers and sometimes other app servers. Based on the pre-forker model, there is a master process which manages the workers who handle all the requests and responses.

What is Nginx?

Nginx is a web server. Its primary job is to serve the static content from a web application (HTML, images, videos etc.) to us (browsers or mobile applications). As a reverse proxy server, it’s the public face for the application, it can direct requests from the browsers to the appropriate backend server (Gunicorn). Nginx handles load balancing, web acceleration and security.

Why do we need guincorn OR NGINX?

The Django server by itself is great for development but wouldn’t survive in production. It’s not meant to handle a lot of traffic. That’s where Guincorn and Nginx come in. While we could Guincorn to run the web application, create workers and sockets, server static content, Ngnix just does a better job of handling the stress of the web as a reverse proxy. Gunicorn recommends having a proxy server in front of it (and Nginx is strongly preferred).

If your application is a fancy upscale restaurant, Ngnix would be the dedicated expeditor and Gunicorn the Chef who directs the rest of the kitchen in this case your Django applications.

Setting up Gunicorn

pip install gunicorn

Gunicorn requires an application object, remember the wsgi.py generated by Django and a socket file to communicate with Nginx (the socket file is automatically created the first time the application is run with Gunicorn). You can also specify the number and type of workers you want.

gunicorn --workers 3 --bind unix:myproject.sock wsgi:app

Setting up Nginx

The default welcome site you see is at /usr/share/nginx/html

It’s specified in the default server block configuration file /etc/nginx/nginx.conf

A server block to used to receive requests from a particular domain and port. A location block is defined in a server block and can be used to match the request URI. The bare minimum to set up Gunicorn with Nginx is this:

  server {
    listen 80;
    server_name example.org;
    access_log  /var/log/nginx/example.log;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }

Here a server block has been defined for example.org which listens to requests from port 80 and passes it on to the proxied server http://127.0.0.1:8000. But in our case the proxied server is the socket at myproject.sock (http://unix:/home/user/myproject/myproject.sock;)

References

https://www.nginx.com/resources/glossary/application-server-vs-web-server/

https://www.digitalocean.com/community/tutorials/django-server-comparison-the-development-server-mod_wsgi-uwsgi-and-gunicorn

https://serverfault.com/questions/331256/why-do-i-need-nginx-and-something-like-gunicorn

http://docs.gunicorn.org/en/stable/design.html

Share and Follow buttons on FB, Twitter and Google +

Share Buttons
Twitter

Adding a hashtag button for Twitter is pretty straightforward with the Hashtag button but for Facebook and Google Plus you need to get creative and use a prefill text to toss in the hashtag (In my case #FedoraAppreciationWeek2k18). Plus you need to register your application to get a client ID for both the FB and Google share buttons.

Facebook

For Facebook, I was checking out the share buttons but there was no way you could prefill the text. And they have a platform policy for sharing.

Don’t prefill any content in captions, comments, messages or the user message parameter of posts unless (a) it is a single hashtag in a post shared through our Share Dialog (but not via our APIs), (b) it was created by the person using your app, or (c) it was created by a business whose employees use your app to administer the business’s presence on Facebook.

So I went with Share Dialogs which has a hashtag parameter. But before that, you need to create a new App on Facebook and then set up the Facebook SDK for Javascript. In your settings under App Domains, don’t forget to add http://localhost:8000 (It doesn’t accept 127.0.0.1). If you don’t you might get this error “ Can’t Load URL: The domain of this URL isn’t included in the app’s domains”

To make it easier for the FB crawler to fetch the relevant content from the site (instead of trying to guess what the header and body for the post should be) we use Open graph tags.

You can even check what it might look like using the Sharing debugger.

Google +

The Share tag is the easiest way to share a link on Google Plus but again no way to prefill text. But I found an alternative, I decided to go with Interactive Posts since it allowed for prefilled text (data-prefilltext parameter). You need to register your app to get the client ID. Don’t forget under Authorised JavaScript origins (in your projects credentials) you need to add http://localhost:8000 (without the / at the end)

Follow Buttons
twitter

I decided to go with a simple link to the twitter handle. But there is an official follow button available. You just can’t customize it much.

facebook

There is a deprecetaed follow button. But the page plugin is the way to go. Again not a lot of options for customization.

google +

We do have a follow button for Google +. And this one does not require a client ID.

 

© 2019 Anna Philips

Theme by Anders NorénUp ↑