Thursday, December 8, 2016

Slideshare Upload Failing With 307 Internal Redirect

If you try to upload files to slideshare from Chome and the upload fails with a status code of 307 Internal Redirect (in Network tab of dev console) with Non-Authoritative-Reason: Delegate as response header and you get XMLHttpRequest cannot load http://uploads-slideshare.s3.amazons.com/. Response for preflight is invalid (redirect) error, means that your browser is redirecting an http request to https and it is failing. In my case it was because of the HTTPS Everywhere chrome extension. You want to uncheck Amazon Web Services from the extension for the upload to work. Also, if you have PrivacyBadger, then adjust it for the site if login fails.


Use .gitattributes to Override Language Detection in Github

Github uses linguist library to detect the languages used in a repository. It ignores library codes from counting towards the language percentage. So if you have files that are not part of the main code which are not in the vender specific path and you wanted to ignore them from the statistics, you can tell github to not count them by specifying it in .gitattributes file. Say I have a public folder which contains documentation or support files which I wanted to ignore, then the .gitattributes file will look like below.
public/js/libs/* linguist-vendored
public/* linguist-documentation
You can add linguist-vendored or linguist-documentation to ignore the files from counting. You can see the difference in the language statistics bar of your repository.

PrivacyBadger - Commenting on Blogger using Google Account

If you are using PrivacyBadger, your comments at blogger using Google account won't work. Also you cannot preview the comments as this extension blocks cookies. You need to enable cookie from www.blogger.com in PrivacyBadger for this to work.

Wednesday, December 7, 2016

Configuring Leiningen and Git to Work Behind Proxy Under Windows

If you are behind a corporate proxy, you need to add the proxy details before lein or git can work.

Leiningen
Add the following environment variable name with value as given.
# env name
http_proxy
# env value
http://username:password@proxyurl:port
# env name
https_proxy
# env value
https://username:password@proxyurl:port
After setting the above, lein will be able to connect through the proxy.

Github
Add the following in a file called .gitconfig under C:\Users\username.
[http]
    proxy = http://username:password@proxyurl:port
[https]
    proxy = https://username:password@proxyurl:port
If the ssh protocol and port is blocked, you can use the https version to clone and push changes to github. Give the github username and password when prompted. However if you have 2FA enabled, you need to first create an access token. Go to Personal access token under github settings and generate one. Under permissions, only repo needs to be enabled to push the changes to github. When you push, a github popup will prompt for authentication, where you enter your github credentials. Next the git bash will prompt for authentication where you should enter the generated access token for your password. It should get through the proxy.

Sunday, December 4, 2016

Download All Your Emails The Easy Way

You can have offline copy of all your emails with attachments using just Thunderbird.
1. Connect to your webmail account using IMAP (so that the server retains a copy of your mail).
2. Enable "Allow remote content in messages" under Privacy section of the Preference if you want images in the email to be downloaded as well. (See note below).
3. Make sure that the you have the following settings under "Synchronization & Storage" of your Account Settings.
    3.1 Enable "Keep messages for this account on this computer".
    3.2 Under "Advanced" enable all the folders that needs to be synchronized.
    3.3 Under "Disk Space" choose "Synchronize all messages locally regardless of age".
    3.4 Enable "Don't delete any messages".
4. Now click the computer icon on the lower bottom corner of Thunderbird or choose File->Offline->Work Offline. A popup will be displayed. Choose "Download Now".
Thunderbird will now download all your emails and attachments offline.

NB: The only caveat is that Thunderbird won't download remote contents like images from unknown senders even if you enable remote content (step 2). The sender has to be present in your address book or you need to whitelist the domains. See instructions here. This is for privacy reasons.

Privacy
1. It's better to have full disk encryption (LUKS) and home directory encryption enabled or at least the later to keep your mails safer.
2. Enable master password in Thunderbird. Install StartupMaster extension. It fixes the multiple password prompt if you have multiple email accounts added.

Lisp for High Performance Transaction Processing - Repost

Lisp for High Performance Transaction Processing is a talk given by Daniel Weinreb on Aug 2009. The original video is not available now as it was later set as private and now taken down. Luckily I had downloaded it at that time. You can watch or download the talk here or read the excerpt.
It's mainly about the use of Lisp at ITA which now is a part of Google. ITA's products are QPX which is an airline fare search program and res which is the airline reservation system. They use Common Lisp and Clozure CL for their business layer. The presentation is in Java and Oracle for their database. C++ is used for bit manipulation, cryptography, and other performance critical areas. Couple of Python, Perl, Shell etc. He just mentions that computational linguistics algorithm, rule based expert system and diversity algorithms are being used. He also talks about the future direction of Lisp especially with Clojure towards the end of the talk. In general, it's an interesting talk.
Watch or download.

Thursday, December 1, 2016

Chrome App Identity Authentication Not Working Issue

When you try to authenticate the user using OAuth 2.0, to access Google APIs from your chrome app and if it loads a URL like chrome://chrome-signin/?access_point=5&reason=0 means that there is issue with validating your client_id and your extension id. When you are developing chrome app, the extension id of the loaded unpacked extension might not be the same as the id generated by the chrome webstore. So when you create a chrome app oauth 2.0 client id from Google APIs console, instead of giving the chrome webstore URL id which it suggests, give your local extension id. Then use the obtained client_id in your manifest. Next time when you call the chrome identity API, it should show the OAuth permission popup. Basically, your chrome extension id should match the id used for generating the oauth credentials. Before publishing, use a different client id generated from the chrome webstore URL.