$ git reflog
f0d821f HEAD@{0}: commit_a
2ea24f8 HEAD@{1}: commit_b
0c3cd49 HEAD@{2}: commit_c
de5b02a HEAD@{3}: commit_d
Suppose that "commit_c" was the head commit of the branch just before the rebase. Let's reset the current branch to this commit:
$ git reset --hard HEAD@{2}
A software engineer's technical blog about programming languages, computer graphics, problem solving, systems configuration, books and much more.
Wednesday, April 1, 2015
Playing with vim configuration for C++
What I got as a result:
The main features:
The main features:
- embedded file system explorer
- syntax highlighting
- hotkeys for compiling/running C++ code
Wednesday, February 11, 2015
Netty server is incompatible with ObjectOutputStream on the client side
Recently I faced with the following problem while playing with Netty:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 1048576: 2901213193 - discarded at io.netty.handler.codec.LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:493) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.failIfNecessary(LengthFieldBasedFrameDecoder.java:469) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:404) at io.netty.handler.codec.serialization.ObjectDecoder.decode(ObjectDecoder.java:68) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:351) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:231) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:372) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:780) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:99) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:497) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:465) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:359) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) at java.lang.Thread.run(Thread.java:745) |
How to insert code blocks in Blogger posts
I didn’t find any setting which would allow me to insert code blocks in Blogger posts but I managed to overcome this problem.
Here’re two simple and handy online converters of code to html:
markup
pros: language auto-detection, small html in the output
cons: no line numbers support, no horizontal scrolling
styles I liked: Slush & Poppies, iPlastic
hilite.me
pros: line numbers support, horizontal scrolling in case of long lines
cons: big html in the output
styles I liked: friendly, default, colorful
CSS I used: border:none;
Let’s say we have the following piece of code which is desirable to insert as a code block:
public class RowSocketClient {
public static void main(String[] args) throws Exception {
String host = "localhost";
int port = 4446;
try (Socket socket = new Socket(host, port);
ObjectOutputStream out
= new ObjectOutputStream(socket.getOutputStream())) {
out.writeObject("ping");
}
}
}
Here’re two simple and handy online converters of code to html:
markup
pros: language auto-detection, small html in the output
cons: no line numbers support, no horizontal scrolling
styles I liked: Slush & Poppies, iPlastic
hilite.me
pros: line numbers support, horizontal scrolling in case of long lines
cons: big html in the output
styles I liked: friendly, default, colorful
CSS I used: border:none;
Let’s say we have the following piece of code which is desirable to insert as a code block:
public class RowSocketClient {
public static void main(String[] args) throws Exception {
String host = "localhost";
int port = 4446;
try (Socket socket = new Socket(host, port);
ObjectOutputStream out
= new ObjectOutputStream(socket.getOutputStream())) {
out.writeObject("ping");
}
}
}
Tuesday, February 3, 2015
Useful installations for Fedora to keep in mind
Creating a bootable USB
$ sudo dd if=/path/to/Fedora-Live-xxx.iso of=/dev/sdc
$ sudo dd if=/path/to/Fedora-Live-xxx.iso of=/dev/sdc
where sdc can be found by inserting the usb drive and executing:
$ dmesg | tail
yum plugin which helps to choose the fastest mirrors
yum plugin which helps to choose the fastest mirrors
$ sudo yum install yum-plugin-fastestmirror
RPM fusion reposetories
# su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'
Codecs
$ sudo yum install gstreamer1-libav gstreamer1-plugins-bad-free-extras gstreamer1-plugins-bad-freeworld gstreamer1-plugins-good-extras gstreamer1-plugins-ugly gstreamer-ffmpeg xine-lib-extras xine-lib-extras-freeworld k3b-extras-freeworld gstreamer-plugins-bad gstreamer-plugins-bad-free-extras gstreamer-plugins-bad-nonfree gstreamer-plugins-ugly gstreamer-ffmpeg
E-book management tool
$ sudo yum install calibre
UI package manager
$ sudo yum install yumex
Nvidia Optimus (Bumblebee installation)
Visit: http://fedoraproject.org/wiki/Bumblebee
Move applications in tray to the top bar
Install TopIcons Gnome Extension
Move applications in tray to the top bar
Install TopIcons Gnome Extension
Friday, January 23, 2015
Hash mark in git commit message
From the git commit message:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
So, if you want to use a hash mark '#' in the commit message (E.g.: "#77 - fixed by changing user's permissions") use the following form of commit:
git commit --cleanup=whitespace
NOTE: don't forget to remove other unnecessary lines which start with '#' otherwise they will be added to the commit message as well
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
So, if you want to use a hash mark '#' in the commit message (E.g.: "#77 - fixed by changing user's permissions") use the following form of commit:
git commit --cleanup=whitespace
NOTE: don't forget to remove other unnecessary lines which start with '#' otherwise they will be added to the commit message as well
Wednesday, December 10, 2014
My donation for Eclipse
My donation is 35$. Thanks for a great IDE!
You can also become a friend: https://www.eclipse.org/donate/
New Fedora 21 release
Release Notes: http://docs.fedoraproject.org/en-US/Fedora/21/html/Release_Notes/
Download: https://getfedora.org/en/workstation/download/
Some changes/improvements I found interesting:
GNOME 3.14
Update GNOME to the latest upstream release, 3.14
GCC49
Switch GCC in Fedora 21 to 4.9.x, rebuild all packages with it.
Headless Java
Server installations of Fedora should usually not pull in packages related to X system or sound subsystem. For this reason part of OpenJDK package has been split into headless subpackage which has smaller dependency chain. Fedora packages should be migrated to require java-headless instead of full java package when appropriate
Java 8
Make Java 8 (provided by OpenJDK 8 which is java-1.8.0-openjdk) the default Java runtime. The current default Java runtime (Java 7, provided by OpenJDK 7, java-1.7.0-openjdk) will be obsoleted and removed.
Saturday, July 5, 2014
JLV v.1.3.3 has been released
Update site: https://github.com/rdiachenko/jlv/raw/repo/eclipse
Or Eclipse Marketplace: http://marketplace.eclipse.org/content/jlv
Release notes:
The main project's page: https://github.com/rdiachenko/jlv#information
Or Eclipse Marketplace: http://marketplace.eclipse.org/content/jlv
Release notes:
- fixed problems with hanging on Windows OS
- fixed null pointer exceptions related to loading and releasing resources
- server part was improved
- a new resource manager was provided
Saturday, June 14, 2014
java.lang.IllegalArgumentException while importing guava sources into Eclipse
Today I encountered a problem with importing guava sources into Eclipse.
Steps to reproduce:
0. Checkout guava sources
1. Import project into Eclipse as "Existing Maven Projects"
Detected:
Steps to reproduce:
0. Checkout guava sources
1. Import project into Eclipse as "Existing Maven Projects"
Detected:
Subscribe to:
Posts (Atom)



