Thursday, August 20, 2015

Linux terminal Arabic support for Gnome 3.16

Salam (or Hello :) ) everyone,
I've spent a couple of time on figuring out how to correctly display Arabic characters on the Gnome Terminal under Fedora 22 (Gnome 3.16).

At first, I have:

as you can see, the Arabic characters are disconnected (unbidden) to each other, which is wrong and ugly at the same time.

The solution
1) if you didn't installed freebidi, you can have it by typing:
sudo dnf install fribidi.x86_64

2) then type:
bicon
to enable the bidirectional characters display.


If you want to enable bicon all the time in the terminal, I mean, if you restart your terminal, you have to re-type bicon again to enable bidirectional display.

Warning: this caused my Gnome 3.16.2 gdm to freeze or failed to start after login!
So, all what you have to do is to edit the .bashrc file and add the script (taken from here) inside .bashrc file:
# hack to launch bicon if not launched
if ! [[ "$(ps -p $(ps -p $(echo $$) -o ppid=) -o comm=)" =~ 'bicon'* ]]; then
  bicon.bin
ficon

To accomplish this, type in the Terminal:
cd
nano .bashrc

and then add the script above to enable bicon at the startup of the Terminal.

And that is it :)

Tuesday, August 4, 2015

Gradle 21 missing packages on Fedora 22


When I tried to build a project under Fedora 22, with Gnome 16.2, in Android Studio 1.3, I got the
following error:

Error:org.gradle.process.internal.ExecException: A problem occurred starting process 'command '~/android-sdk-linux/build-tools/21.1.2/aapt'' :app:mergeDebugResources FAILED Error:Execution failed for task ':app:mergeDebugResources'.

the solution was to install the 32-bit (i686) version of libstdc++:

$ sudo dnf install libstdc++.i686


then, I got another error from Gradle complaining about missing libz.

the soultion was to install the 32-bit (i686) version of it under Fedora (rpm)


$ sudo dnf install zlib.i686


And that is all, you should now have your Gradle working good.

Monday, August 3, 2015

PPPoE in Fedora 22 Gnome 3.16

1) type in the terminal:
$ nmcli connection add type pppoe con-name office ifname eno1 username abdulmomen@office password 'HighwW , sighW'

you should see:
Connection 'office' (9913272c-141e-488f-91b6-263b77018250) successfully added.

2) continue in being in the Terminal and type:
$ nmcli connection up office
and a message like this should appear to you:
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)

And, now you should have a PPPoE connection in your Fedora 22 Gnome desktop edition.

Thanks to Mustafa Muhammad for his help :)

Thursday, June 11, 2015

Hello NDK with Android Studio 1.3

After surfing the Web for a couple of hours trying to figure out how to execute C\C++ code with AndroidStudio 1.3 and gradle 1.2.3, the 'bull's-eye' solution I fount was on Stackoverflow and its code on GitHub.

I don't want to copy-paste the solution here, you can see how the answer steps clearly.

Thanks :)

Friday, March 20, 2015

هكذا تبدو الأرض خلال الكسوف للشمس



حيث يمكن مشاهدة ظل القمر يعتم جزءاً من الأرض.
هذا الظل ، يتحرك حول الأرض بسرعة 2000 كم\ساعة تقريباً.
فقط المشاهدون (المناطق) في وسط هذا الظل يمكنهم مشاهدة
الكسوف الكلي للشمس، بينما الآخرون يرون كسوفاً جزئياً.
هذه الصورة الرائعة تم أخذها في الشهر 8 عام 1999 من
قبل محطة الفضاء Mir space station ، حيث أنهت هذهِ المحطة
خدمتها بعد أكثر من 10 سنوات من الأعمال الرائعة و المنتجة
لصور في الفضاء.


Thursday, February 5, 2015

Some decimals to hex numbers (powers of 2)

The following table contains a conversion of 2 power some number (2 ^ X), to the corresponding hexadecimal number:


                             dec                  hex
      2^00                    1                    1

      2^01                    2                    2
      2^02                    4                    4
      2^03                    8                    8
      2^04                   16                   10
      2^05                   32                   20

      2^06                   64                   40
      2^07                  128                   80
      2^08                  256                  100
      2^09                  512                  200
      2^10                 1024                  400

      2^11                 2048                  800
      2^12                 4096                 1000
      2^13                 8192                 2000
      2^14                16384                 4000
      2^15                32768                 8000

      2^16                65536                10000
      2^17               131072                20000
      2^18               262144                40000
      2^19               524288                80000
      2^20              1048576               100000

      2^21              2097152               200000
      2^22              4194304               400000
      2^23              8388608               800000
      2^24             16777216              1000000
      2^25             33554432              2000000

      2^26             67108864              4000000
      2^27            134217728              8000000
      2^28            268435456             10000000
      2^29            536870912             20000000

If you notice, the double of 80 in hex is 100 :)


This table is generated using this C code:

#include "stdio.h"
#include "math.h"

int main()
{
long i, t;
printf("%32s %20s", "dec", "hex");
for (i = 0; i < 30; i++) {
t = pow(2, i);
printf("\n%8s%2.2d %20ld %20X","2^", i, t, t);
if (i%5 == 0) printf("\n");
}
return 0;
}