Wednesday, November 25, 2020

Pokemon Go: Networking - get to level 40 in 90 days!


One of the most under appreciated ways to get to level 40 is to increase your friendship level with all your friends every day. With suggestions that you can send up to 100 gifts per day.

So how would this work?

    It is a good practice to add 20 friends at a time, and send them gifts as soon as they accept.
Step 2: When they accept, start sending them gifts. During pandemics 2020 may people have limited ability to move, thus receiving gifts is godsend to replenish their items. 
Step 3: Repeat this for 90 days and you will be reaching level 40.

Here is total number of points needed to reach different levels in Pokemon Go.

You will get 3000 xp first time your friend opens gifts, after 7 days of opening present you get 10000 xps, 30 days 50000 xps and 90 days 100000 xps

The tactics I recommend is having 29 days of interaction with at least 30 people, starting XP egg and opening 30 gifts at the same time. This will double number of XP points you receive by becoming Ultra Friend. That will yield 100000 points per friend and almost assured level up in an instant. 

Best friend, is used with eggs at ultra and best friend level will net you more than 300000 points. Which is enough to level up to level 30, and it is 1/10 of the points needed to level to level 39.

People stop opening gifts and don't regularly send them, thus you will need to have many friends. Maximum is 200. Thus pruning your friends list of friends that stopped interacting is crucial.


Tuesday, March 10, 2015

Facebook: All time ranges must be midnights - Not every day is like another, some days are 23h and some are 25h long

Facebook has funny thing about their API. They require timestamps used in their report to be on midnight boundary in your local timezone.

Originally I wrote this code:


facebook_time = DateTime.parse(@run_date.to_s).utc.in_time_zone('America/Los_Angeles').midnight.to_i
time_interval="{time_start:#{facebook_time}, time_stop:#{facebook_time+24*3600}}"

That worked great until daylight savings kicked in, and failed with "All time ranges must be midnights", so after a bit of debugging I changed it to this one:

facebook_time = DateTime.parse(@run_date.to_s).utc.in_time_zone('US/Pacific-New').midnight.to_i
facebook_time_end = DateTime.parse((@run_date+1).to_s).utc.in_time_zone('US/Pacific-New').midnight.to_i
time_interval="{time_start:#{facebook_time}, time_stop:#{facebook_time_end}}"
I hope this will help someone spend less time debugging.

Friday, February 20, 2015

Creating Users and Databases

It is tedious to create database. Well, not really hard, just annoying.

While 3 lines of code to create database, create user and grant user privileges to the database are not hard to write, one needs to remember correct syntax and to place same text 2-3 times.

To mitigate this issue, I created a tiny template to help me with it. It is available at:


Or embedded here for your convenience:

Sunday, January 4, 2015

Did you ever wanted to know when a webpage changed?

There is a new web service - WebFollower - what it does is a simple simple, but still important task.
Here is how it works - you sign-up with your Facebook account and go to the dashboard.
On the dashboard you add URLs you'd like to monitor and web follower crawler checks if page has changed. If it didn't than nothing happens and WebFollower's crawler checks it again later. If it did change WebFollower sends you an email notifying you that page changed. If you want to be notified of change when page changes again, you'll need to re-enable it on the dashboard.

That's it - a simple and hopefully useful service.


Monday, August 25, 2014

Setting up ghost on the Openshift

In past few days I decided that I would like to keep track on my progress in how I learn new stuff. After some consideration I hope a good way to organize my work would be to use Ghost: is just a blogging platform funded on Kickstarter last year. I have heard all the hype when Ghost got funded and tried to use it early on, but it was disaster to when it was first released. Also, I didn't have a good use case to keep working at it, but now... here is an opportunity.

Quick googling ghost resulted in number of links as a community seem to be sprouting around it. I read a good introduction on setting it up and on its current features on "Ghost for Beginners". The site covers how to set Ghost on Ghost(PRO), AWS and DigitalOcean, but there was nothing about my favorite hosting solution - OpenShift. So I figured I can write a post on setting Ghost on OpenShift.

At first I tried to set it up using OpenShift's console, but that yielded in an error:



Attempting to install through web interface failed twice, I was a bit discouraged, so finally I attempted to try running rhc command from terminal. That worked like a charm:

rhc app create ghost nodejs-0.10 --env NODE_ENV=production --from-code https://github.com/openshift-quickstart/openshift-ghost-quickstart.git

And here is terminal output:

Application Options
-------------------
Domain:                _MY_DOMAIN_
Cartridges:            nodejs-0.10
Source Code:           https://github.com/openshift-quickstart/openshift-ghost-quickstart.git
Gear Size:             default
Scaling:               no
Environment Variables: NODE_ENV=production

Creating application 'ghost' ... done

Waiting for your DNS name to be available ... done

Cloning into 'ghost'...
The authenticity of host 'ghost-_MY_DOMAIN_.rhcloud.com (54.82.127.129)' can't be established.
RSA key fingerprint is cf:ee:77:cb:0e:fc:02:d7:72:7e:ae:80:c0:90:88:a7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ghost-_MYDOMAIN_.rhcloud.com,54.82.127.129' (RSA) to the list of known hosts.

Your application 'ghost' is now available.

  URL:        http://ghost-_MY_DOMAIN_.rhcloud.com/
  SSH to:     53fba91d5004466ac7000306@ghost-_MY_DOMAIN_.rhcloud.com
  Git remote: ssh://53fba91d5004466ac7000306@ghost-_MY_DOMAIN_.rhcloud.com/~/git/ghost.git/
  Cloned to:  /Users/_MY_USER_/Source/ghost

Run 'rhc show-app ghost' for more details about your app.

Ghost correctly appears in the console after that:

Here is a snapshot of Ghost homepage:

I added the user, and published test post:


Adding a custom domain name boils down to:
    1. add an alias using RHC
       rhc alias add ghost MY_CUSTOM_NAME.MY_DOMAIN.COM
    2. setting up DNS alias:
       from: MY_CUSTOM_NAME 
       to: ghost-_MY_DOMAIN_.rhcloud.com
       as: CNAME (alias)
    3. setting up DNS name in config.js:
       edit config.js and replace:
         url: 'http://'+process.env.OPENSHIFT_APP_DNS,
       with:
         url: 'http://_MY_CUSTOM_NAME.MY_DOMAIN.COM/'

I use namecheap.com and have had a great experience with them for a couple of years now. They have very easy to use admin panel (not the most intuitive, but very efficient).

Adding google analytics to the blog:
  go to your RHC folder with the application
  edit file: content/themes/YOUR_THEME/default.hbs
  just before end < /head> tag insert your GA code.
  git commit -a # to commit to code repository
  git push # to push to OpenShift

I will update this post with other steps I plan to undertake, staring from ensuring that there is a scheduled backup, over adding google analytics and google adsense to the blog.

Thursday, May 22, 2014

FIX: Django, uwsgi, Apache, ProxyPass, host is localhost and using ProxyPreserveHost

I just spent some time trying to figure out how to set our Django application.

Our setup is:
  Apache (handles HTTPS and client certificates) is front-end proxy to uwsgi
  uwsgi is used to run Django application in the backend.

The problem we faced is that our redirects were broken as links build by django used 'localhost' instead of name of the virtual host. After looking through solutions, and finding some of the issues like:


I looked into django handling of get_host() and tried to understand what's happening.
Long story short, Apache passed HOST header as 'localhost', this led to search of apache documentation, as I was thinking that I reset headers using 
   RequestHeader set X-FORWARDED-PROTOCOL ssl
   RequestHeader set X-FORWARDED-SSL on
   RequestHeader set X-FORWARDED-HOST *hostname*
   RequestHeader set HTTP_HOST *hostname*
   RequestHeader set HOST *hostname*
but apparently, apache does not pass these through the proxy... so... drumroll, saving grace is:
and side note, ProxyPreserveHost needs to be on the VirtualHost level or higher.

I hope this short post will save you some time :)

Tuesday, March 11, 2014

MacOSX & Chrome: How to make scrollbars ALWAYS visible in your web application

If you are, like me, annoyed that overflow: scroll does not display scrollbars on all MacOSX computers in chrome; you can actually force Chrome to behave by just adding this to your CSS:


::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 7px;
}
::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(192,192,192,.3);
    -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}


Friday, February 28, 2014

How to calculate MD5 and SHA1 fingerprints using web browser?


Downloads and fingerprints

MD5 and SHA1 fingerprints often listed next to the large files one can downloads from files are there to ensure that data downloaded is the same as the data on the server. It is a good policy to always check if downloaded file has the same fingerprint as the one provided from the trusted source.

How to perform MD5 or SHA1 check using web browser?

While you can download the command line tools (shasum and md5sum) or use GUI tools to calculate MD5 and SHA1 checksum, it seems that today's browsers should be suited to let you do that calculation without resorting to specialized applications. One such tools that does not require you to download software, but lets you check MD5 and SHA1 sums right from the browser is Checksum MD5 and SHA1 calculator. This handy tool let you pick one or more files, and without uploading them anywhere check them right from the comfort of your device. It works with most of the modern browsers (IE10+, Chrome, Firefox, Safari) and it even works with your mobile devices if you ever need to do that sort of calculation (for example for .apk you just downloaded).


Monday, February 7, 2011

Dropbox (Error code -36)

Today, I was faced with Dropbox 'Error 36' on MacOS.
So, let's start from beginning... Dropbox has file name limitations, and those limitations are a bit different than operating system limitations (MacOSX).
I am convinced that there are good reasons for these, as they have special meaning on the command line level or would look really weird in the browser.

Let's start with the issues:
- Issue 1: File names can not start or end with blank character
- Issue 2: File names should not contain slashes

Where issue 2 is easy to spot, finder does not make it easy to spot issue 1. Thus I have created a short script that fixes blank characters in file names.

You can download dropbox_fix_script.pl. You need to navigate to the folder you are trying to copy, unzip and run this script from terminal.

Before you run this script, make sure to backup your data.

If there are enough interested readers, I may wrap this into application that you can drop a folder on.

--- script content is:
#!/usr/bin/env perl
#
sub fix()
{
    my @list = `find .` ;
    chomp(@list);
    for my $file (@list)
    {
    print "." ;
    my $base = `basename "$file"` ;
    my $dir = `dirname "$file"` ;
    chomp($base);
    chomp($dir);
        if( ($base =~ /\s+$/) || ($base =~ /^\s+/) || ($base =~ /\// )
        {
      print "match $file\n" ;
          $base =~ s/\s+$//mig ;
          $base =~ s/^\s+//mig ;
          $base =~ s/\//_/mig ;
    print "\n" ;
          return ( $file, "$dir/$base");
        }
    }
    return undef;
}

while( 1 )
{
    my ($file, $new_file) = &fix();
    if( defined( $file ) )
    {
        print "rename '$file' '$new_file'\n" ;
        if( -f $new_file )
        {
            print "file already exists $new_file -- fix $file \n" ;
            exit ;
        }
        if( -d $new_file )
        {
            print "dir already exists $new_file -- fix $file \n" ;
            exit ;
        }
        rename $file , $new_file ;
    }
    else
    {
        last;
    }

}

Wednesday, January 26, 2011

DNA reverse complement

Just published simple DNA reverse complement tool. It features reverse sequence generation, complementary RNA and DNA generation and of course reverse complement for both DNA and RNA. Check it out.

Wednesday, January 19, 2011

Click-o-mania and cyclick-o-mania in pure HTML

Last time I wrote click-o-mania clone was in summer of 1999. I wrote it in an MIT Athena cluster one summer day with the idea that it would help me with, than fresh Java skills.

Now the time has come, and I wanted to work on my GWT skills - thus - new HTML only, Flash-free, Java-free version of Click-o-mania and cyclick-o-mania are available. This simple games are written in using GWT/Java and compiled and tested on Mac and Windows, in variety of browsers and also adapted to work on iPhone. If they work well on Android, I would be interested to hear.

I hope you will enjoy these games as much as I enjoyed writing them.

Wednesday, September 8, 2010

Punnett Square at Bugaco.com

I just started writing Punnett Square calculator. It seems to be a nice tool for understanding inheritance relationships. Check it out at: http://www.bugaco.com/calculators/punnett_square.php

Wednesday, March 31, 2010

Eclipse - Linux - Unable to connect to repository

I just moved to new Ubuntu 10.4, and downloading Eclipse or Aptana Studio suddenly stopped working with repositories. This is very very annoying as I'm unable to install pydev and continue working on my improvements of Analytics@bugaco. So, what I had to do something to fix it. It seems that I am not the only one with this problem.

The problem seems to be related to Java's preference to use IPv6 stack over IPv4 stack that causes some systems to be unable to connect to web sites.

Fix for it is documented at debian's bug report's list. The reading is quite verbose, so I'll document cookbook solution that just works for me.

Open your eclipse.ini file, at some stage it has -vmargs line, after that line add following define: 
-Djava.net.preferIPv4Stack=true

Original file
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m



New file
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Djava.net.preferIPv4Stack=true 
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m

Good luck! Let me know if this fixes your problem...

Sunday, November 15, 2009

Windows 7 on Acer TravelMate C110

introduction
I got Acer travel mate Tablet PC. This is a great little workhorse - it has 900MHz CPU that is on par with most of the Atom's out there, so I find little reason to even consider getting a netbook.

My Acer was running Windows XP Table PC edition. I wasn't even thinking of upgrading it to Windows Vista (as it did not have enough resources), but with all the hype that Windows 7 is optimized operating systems - I was thinking - let's give it a try!

First, let's go with the setup of Acer - it has 1.25GB of memory, thereby passing a requirement for more than 1GB of RAM. It has 900MHz CPU, barely below 1GHz minimum, and I upgraded it with 80GB/5400 PATA drive that works just fine.



As you can see from "Windows Experience Index" the slowest part of the setup is graphics, but given that I don't plan to play first person shooters on it - it's just fine!

install
Acer does not have DVD drive, so I used USB key to boot Windows installation.
I installed clean install of Windows 7 on the machine (I upgraded HDD before installing Windows 7, so there was no point of transfering XP over first).
Machine booted in safe graphics mode, and it was missing some of the drivers.

network
First I installed network drivers - it turns out one can install Intel 2100b drivers for XP on Windows 7. It turns out you can 'force' windows to use XP's driver. So I downloaded latest driver from Intel's site and forced Windows 7 to accept Intel drivers although it complained a lot!

This was not enough to get Windows 7 to start using networking adapter, and after some agony I remembered that friend of mine mentioned that Acer has stupidest software button that turns of wireless adapter. Linux has a app that can be used to flip the software switch, as button in itself is dead and wireless if off (remember that wireless is on only when red LED is turned on).

After trying to install most of the original Acer utilities I figured that I may need to return back to XP as Notebook Manager throws exceptions almost on any click. After a bit of frustration I noticed that 'Launch manager' althrough it does not help with the button has an option 'Wireless Device Boot Status' and it can be turned on.


This saved the day! Now networking works.

sleep & graphics
Acer is not functional, so let's see what is next issue on the list. Mysteriously Acer does not want to sleep. It just wants to hibernate or shut down. This is a bit of annoying as using XP I could just close the lid and it would sleep fine.

Another set of frustrating explorations led to the command that will list sleep states, and what prevents system from falling a sleep. Results of this command suggested that the issue is in graphics adapter that was generic VESA and as such it didn't know anything about sleeping.

It turns out that Intel didn't provide support for 855 chipset - can you blaim them? Chipset is about quite old and they would like us to buy new ones. Installing 915 drivers didn't work, but using XDDM mode of 855 drivers (produced for Vista) worked just well enough to get my machine to accept driver, and to be able to happily fall asleep.


Now finally sleep worked fine! Awesome!

not much sleep for the wary
While sleep would be really cool and I would enjoy it - it had one drawback. Remember network? And that stupid button? Well, if you sleep machine, on wake up network does not wake up.
So I just hibernate my Acer when I'm done using it.

conclusion
Windows 7 works well on Acer C110. It is an awesome little machine. Sleep does not work well, but most of the other functions are just fine. I also like how Windows 7 improved tablet functionality - hand writing recognition is way better than before.


Friday, November 13, 2009

Setting Putty with Kerberos on Windows (including Windows 7)


note
If you don't know what is Kerberos and SSH - you probably don't need it. So read some of the other posts that may be more relevant for you.

introduction
If you do know that you want Kerberos and SSH on your machine - welcome to the post that will explain how to set it up on Windows. Unlike MacOSX that comes with Kerberos and kerberos aware SSH and Ubuntu, Red Hat and other major Linux distributions that have Kerberos and Kerberos aware SSH easily accessible, finding good Kerberized SSH client for Windows was a challenge.
Although I like challenges, I like to solve them once, and reuse them often - so this post is on how to setup yourself with Kerberized SSH and SCP for Windows.

installation
Best SSH client I have found for Windows is Putty, but default installation does not came with Kerberos enabled, so if you need Kerberized Putty, you can download it from Mattew Loar's web page.
In addition to Kerberized Putty you will need to install MIT's Kerberos for Windows.
As kerberos needs to be in the path, Putty may not work until you add it to the path (by for example restarting CMD or slickrun)
Install these two packages and you should have whole install.

why kerberos?
Cool thing about Kerberos is that separates your credentials (authentication) from your privilegies (authorization). By default you should be able to login to your account SSH enabled Unix server, but Kerberos makes it easy to allow someone else to login as you without giving them password - for example I can login as both root and myself on our server with same Kerberos ticket, and so guy next to me; but unlike non-Kerberized SSH revoking and adding people is matter of editing .k5login file.

how to do it with Putty?
1. Get a ticket.
2. Open Putty and select 'connection -> data' and setup user account you are authorized to access - for example root.
3. login to server by setting server name in session tab.

resources
UPDATE: Putty now supports Kerberos out of the box - see comment below
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Putty with Kerberos authentication:

MIT Kerberos Package:

Dual Boot USB stick with Windows 7 and Ubuntu 9.10 (Karmic Koala)

introduction

I setup on doing a dual boot (or hopefully dual boot + dual install) of Windows and Ubuntu on USB stick. This proved to be more challenging than I would expect, so I'll try to outline what my conclusions are and how to make dual boot stick.

Let's start with the basics, unlike Vista, Windows 7 optimizes driver installation when it boots, preventing it from booting from USB stick on different machine (or different type of the machine) than it was installed on. This yields a simple result that one probably does not want to install Windows 7 on USB drive, but only to have bootable install partition.

Ubuntu's option to make bootalbe USB drive asks for amount of persistent space that you can use to keep your data on USB drive, thereby really making USB drive a full install without a need to additional partition with "full install".

This leads us to needing only bootable Ubuntu and bootable Windows 7 install. While it may be possible to boot Ubuntu from windows bcd bootloader, I opted for opposite direction thus booting into Ubuntu boot screen that has an option to start Windows 7 installer.

My first few attempts to get syslinux (Ubuntu installer to boot Windows from same partitino were unsuccessful). My next few attempts to get windows to boot from second USB partition were as well unsuccessful and at the end I found this prescription that works.

the prescription
1. Boot into Ubuntu Live CD
2. Start GParted and create two primary partitions (first at least 2.5Gb, and second at least 1.1Gb)
3. Format both partitions as FAT32
4. Boot into Windows
5. Note drive letter of your USB drive's first partiton (example Q:)
6. Go to Windows 7 installer DVD (or folder where you extracted ISO using 7-zip)
7. Go to boot folder and from command line (with Administrative privilegies) run:
bootsect /nt60 Q: /mbr
8. Extract Windows 7 DVD files to your USB drive (example Q: drive)
9. Boot back into Ubuntu
10. Make bootable usb drive (option from Administration menu)
11. Get chain.c32 from syslinux and copy to /isolinux folder
12. Get ldlinux.sys from syslinux and copy to / folder [this may be optional step]
13. Edit text.cfg and add at the end:
MENU LABEL Windows 7
COM32 /syslinux/chain.c32
APPEND hd0 1 ntldr=/BOOTMGR
14. Dual boot your Windows 7 Installation

Happy dual booting...

Friday, October 23, 2009

Analyics @ Bugaco allows embedding analytics data in web pages

Analytics @ Bugaco is updated with a new feature - stored reports.
Currently only google maps report can be stored. When report is stored, user is given URL that can be embedded or shared with friends.

Analytis @ Bugaco is collection of freely available reports that utilize Google Analytics data to produce additional report. The tool was originally announced in this blog post.

Here is an example of stored report.

Wednesday, October 7, 2009

Seagate Date Calculator for iPhone

In previous blog post I talked about seagate date code calculator. It seems to be useful tool for the people out there, and I decided to revamp it. It has better user interface, and I now created off-spin that works well on touch devices like iPhone.

Wednesday, September 23, 2009

Reports that were missing from Google Analytics are being developed at analytics.bugaco.com

Did you ever feel like Google Analytics is somewhat constrained in reports it has?

If the answer to this question is NO - that stop here and go do something else.

If on the other hand you wanted to do more with google analytics, but it was almost impossible to get a report you wanted, you may be interested in a new effort at Analytics @ Bugaco.
It starts as a modest effort that created two custom reports that use Google Analyics API to provide different reports than ones provided by Google Analytics itself.
It is in early stages of development, and any comments that would make it better are welcomed by development team. All comments you do send will be seriously evaluated and prioritized.

So, what is Analytics@Bugaco at this early stage of development?

At this time Analytics@Bugaco has two reports - one is oriented toward developers - it allows you to determine what kind of screens your users have, and thus it will help you design better software/website layouts that will fit your real users.

Another report available is mapping visitors on google map. This is cool for a few reasons, and where we intend to go with it is to allow you to include generated map into your website. For an example of how this would work visit Software Tools for Academics and Researchers site. They have a map that displays visitors from last 30 days - it's an cool and impresive map, and what's really cool, you can zoom in and see your city!
At this stage, through map is not embeddable, but with sufficient interest (read comments) it will be put ahead of other priorities.

Thanks, and enjoy Analytics@Bugaco site

Monday, September 14, 2009

Sequence conversion tool

There is new sequence conversion tool at Bioinf @ Bugaco.com. It allows conversion between 16 most popular sequence formats.
Here is direct link to sequence conversion utility

What is really cool is that it supports:


  • ace
  • embl
  • fasta
  • fastq
  • fastq-solexa
  • fastq-illumina
  • genbank
  • ig
  • nexus
  • phd
  • phylip
  • pir
  • stockholm
  • swiss
  • tab
  • qual