Category Archives: software

An efficient way to give gifts in Stardew Valley

I was playing Stardew Valley recently... well, it consumed much of my weekends...

In the game, the player has to give gifts to all villagers to keep a good relationship with them. There is an official page displaying each one's preference, wiki. However, my life will be much easier if I can minimize the amount of distinct gifts I carry every day. When there is an optimization question, there is an analytical solution 🙂

My approach:

Use wiki's data as input, then identify the items that are favored by more than one villagers, and easy to obtain regardless of the a result, I can arrange production and carriage easily and efficiently.


A network graph that shows how villagers are connected by gifts.


Source codes:

Original dataset:

Vector graph output:

install Rodeo on OS X El Captain

Today I try to install Rodeo in order to use python for data analysis on my macbook. It is a new macbook (and the New Macbook) so I started everything from scratch. I installed Anaconda as recommended and then I installed iPython notebook. Everything worked fine.

Then I tried to start Rodeo, hmm, error message: "Bad news. Rodeo cannot start".

What can I do? I searched on the internet but found nothing. I can use both ipython and python from my terminal so I thought that could not be a problem. Then I made a guess - there must be something wrong with environment variables. I tried to echo my environment variables from the terminal:

It looks fine to me. Then I opened Rodeo again,  discarded the error message,  and opened its preference tab. Wait, I can specify the python I want to use here, and by default it is /user/bin/python! So I tried this python,

Apparently, my macbook somehow comes with python 2.7. I changed the python path in Rodeo's preferences tab to /Users/Liyun/anaconda/bin/python and restarted Rodeo. This time it worked perfectly. Well, I guess for whatever reason Rodeo is trying to use the old python although I have installed Anaconda for it.

Add shortcut for "Export -> PDF(pdflatex)" on LyX's toolbar

Recently I got annoyed by LyX's inconvenient "Export -> PDF(pdflatex)" command.  Thus, I decide to modify my toolbar in LyX. Particularly, since I don't need the Update function (not an Adobe Reader user...), so I just removed it as well.

Today's aim: add an export shortcut for the menu File -> Export -> PDF(pdflatex), both keyboard shortcut and a button on the toolbar.

To modify LyX's toolbar, you need to go to its installation folder and find "". Mine is under the default path: "C:\Program Files\LyX20\Resources\ui". Then please find

Toolbar "view/update" "View/Update"
Item "View" "buffer-view"
Item "Update" "buffer-update"

After this, if you want to keep the Update button, then add this line after it:

Item "Export" "buffer-export pdflatex"

The result is shown like below

Or you can do it like me, just put the Update line into comment, i.e.

Toolbar "view/update" "View/Update"
Item "View" "buffer-view"
#Item "Update" "buffer-update"
Item "Export" "buffer-export pdflatex"

Moreover, if you love keyboard shortcut better than buttons on the toolbar, then please follow a few steps:

  1. go to "Tools->Preferences->Editing->shorcuts"
  2. under the "function" column, there is "document and window", then find "buffer-update" and remove it.
  3. find "buffer-export-custom", modify it to "buffer-export pdflatex" and configure the keyboard shortcuts as "ctrl+shift+R". (If you want to keep the shortcut for update, please choose another keyboard combination as you like)

Now you are able to use the keyboard shortcut for " File -> Export -> PDF(pdflatex)" as well! Enjoy!

Note: in similar ways, you can modify all the toolbar and shortcut you like!