connect your laptop to your TV

December 30, 2017 Leave a comment

Problem
You want to connect your laptop to your TV. For instance you have Netflix / HBO GO / etc. subscription and you want to watch movies on a bigger screen.

Story time
We have an old LG HD-ready television (32LG3000) whose resolution is 1366×768. I had an old (and small) laptop connected to the TV via a VGA cable that worked well with movies (avi, mp4, etc.). This laptop had Manjaro on it and its resolution was 1024×768. When it was connected to the TV, the screen was cloned and the TV also had the same resolution. The image quality was very good. However, this laptop was weak for videos running in the browser, so for instance I couldn’t watch Youtube videos in full screen.

A few days ago I decided to try HBO GO. It’s similar to Netflix. It’s not expensive (7.66 USD/month), the first month is free, and you can cancel it any time. It was clear that my old laptop won’t be enough for this.

I tried another laptop, a Toshiba C55 that has a VGA and an HDMI output too. Strangely, the VGA output was not recognized by my TV, so I couldn’t use it. And when I tried HDMI, the image quality was shit. The colors were terrible and the image was blurred. The text on the screen was ugly and the whole thing looked pixelated. I tried every resolution, but it was the same shit :( I even changed the HDMI cable to a gold-plated one. Nothing. With a software I could adjust the colors but I wasn’t satisfied with the colors at all.

Solution
I don’t know the exact reason of the problem. Maybe our TV is old, maybe a full-HD TV would be better, who knows… It was clear that there is something wrong with the HDMI connection.

So, let’s get back to VGA. I had yet another laptop, a Dell Vostro 2510 (also old). It worked well for me and it only had a VGA output. I installed Windows 7 on it, connected to the TV, but the TV only showed a black screen. And when I changed the resolution down to 1024×768, the screen appeared on the TV! Yes! And the quality was good! Later I figured out that the resolution 1280×720 was even better for this TV. This laptop is sufficient for videos running in a browser. It took me 3 days to find the best solution…

I also made some experiments. With VGA, I tried different resolutions, but they looked ugly. The result was similar to the HDMI. However, 1024×768 and 1280×720 were good. Then I tried HDMI again with these two resolutions and they were ugly again. I don’t get it but fine…

TL;DR: Via VGA I got better quality on the TV. On the laptop I put Windows 7. The resolution 1280×720 worked well. HDMI produced shit quality but I couldn’t figure out why. I’ll stay with VGA.

Advertisements

[windows] Xpadder: play any game with your controller

December 29, 2017 Leave a comment

Xpadder allows you to map keyboard keys and mouse button actions to your game controller buttons. Xpadder also allows you to map the mouse pointer to your game controller sticks. Xpadder can also handle combinations, sequences, toggles, triggers, shift sets, multiple controllers and more.” (source)

So, if you have a game that doesn’t support controllers, then with the help of Xpadder you can still use your favorite controller.

These two videos will give a good introduction to the program:

Short press: A; long press: B (from the advanced tutorial)

 

What are set selectors? I found a good explanation under this video by Hugo Freitas. I copy his answer here:

For those who couldn’t understand, i’ll explain: Xpadder does not directly support the scheme of pressing two buttons for one keyboard stroke (Under the circumstances of using One Set Only), So what happens in order to make this possible is a sort of trick: Xpadder divides it’s variety of commands on different sets (those sets are clearly noticeable on the bottom side of the software window). If a person wants to perform a command requiring two buttons, What such person needs to understand, is that the first button usually works as an “enabler”, so the Second Button can have it’s behavior changed to perform the command.

In order to make things more comprehensible, i’ll give an example: In Tony Hawk’s American Wasteland, there’s a trick called “Caveman”, on the ps2 version, in order to perform such command, the player needs to hold “L1” then press “R1” (Note that L1 being held acts like an “enabler” , so the R1 can have it’s behavior changed to perform the trick). For instance However, in the PC version of the game, all the player needs to do is press “E” on the Keyboard.

Given this Situation, In order to reproduce the “L1 + R1” combination on Xpadder, what you need to do is select the “L1” button, click on it, go to the “Advanced” > “Set Selector” and choose: “Selects Set 2 while HELD”, as a consequence, when holding “L1” button, it will switch to/enable the Second Set which will have empty assignments, and while holding “L1” down, select “R1” button, click on it and assign the “E” button to it.

And that’s it, Regardless the controller you’re using, if it’s compatible with Xpadder, I believe the Set Selector will work on all of them.” (quote from Hugo Freitas)

Categories: games, windows Tags: , ,

Advent of Code 2017

December 25, 2017 Leave a comment

This year I jumped into Advent of Code again. It was a great fun and I was waiting the new exercises every morning. Today I finished it:

This year I solved all the exercises in Kotlin. I will publish my solutions on GitHub soon. Update: here is the repo.

Here is a link to the Twitter page of Eric Wastl, to whom we can thank the Advent of Code. Thanks, Eric and keep up the good work!

Links

Categories: kotlin, programming Tags: , ,

vuze goes to queued status

December 19, 2017 Leave a comment

Problem
The status of downloaded torrents in Vuze switch to “queued” after a while. How to keep them in “seeding” status?

Solution
I found the solution here. It works for me.


Categories: Uncategorized Tags: , , ,

[manjaro] open URLs with Firefox

December 18, 2017 Leave a comment

Problem
Under Manjaro I ran into a strange problem. Using Studio 3T (which is a GUI for MongoDB), if I click on a URL, it’s opened in Chrome. However, in Visual Studio Code for instance URLs are opened with Firefox. How to tell the system which browser to use?

Solution
I wrote to Studio 3T and they kindly answered me: “We don’t specify any browser but simply ask the OS to open the page. This might be a settings issue in the Manjaro Linux distro, which we don’t currently support. I hope this has not caused much inconvenience.

So, the problem is not with Studio 3T but it’s a Manjaro setting. After some research, I found the solution. Edit the file “~/.config/mimeapps.list” (first make a backup copy of it!) and identify the lines that start with “x-scheme-handler/http“. I made the following changes:

x-scheme-handler/http=firefox.desktop                                                                                                                       
x-scheme-handler/https=firefox.desktop

These two rows appear under another section too, so altogether I changed 4 lines. The string before “.desktop” is the name of the command that is used to start Firefox from the command-line. Thus, if you want to open the URLs with Palemoon for instance, you should write “palemoon.desktop“, etc.

When you save the file, changes are taken into account immediately.

(This is for Manjaro, using the XFCE graphical environment.)

Categories: firefox, manjaro Tags: , , ,

figure out your browser’s user-agent without any external service

December 15, 2017 Leave a comment

Question
If you want to see your browser’s User-Agent string, there are services that tell you the answer, e.g. https://www.whoishostingthis.com/tools/user-agent/ . But how to do it locally, without any external help?

Answer
Fire up netcat in your terminal:

$ nc -l -p 8000 -v

and then visit

http://localhost:8000

in your browser. In my case, netcat printed this:

$ nc -l -p 8000 -v
Connection from 127.0.0.1:47640
GET / HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
...

Tip from here.

Categories: bash, firefox Tags: ,

[wget] downloading images

December 11, 2017 Leave a comment

Problem
Working with a Python script, I wanted to download images from various websites. I gave this job to wget that I called as an external program. However, downloading some images failed. I verified them, and they opened nicely in my browser. What da hell?

Solution
Some web servers verify the client and if it’s not a browser, they simply block it. Our job is to make wget pretend it’s a normal browser. Put the following content in your “~/.wgetrc“:

header = Accept-Language: en-us,en;q=0.5
header = Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
header = Connection: keep-alive
user_agent = Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
referer = /
robots = off

Problem solved. I found this tip here.

Categories: bash, web Tags: ,