Saturday, 19 December 2015

Issue: Currently, there are no packages. Please use "Retrieve List From Internet" to update package list

Yesterday I met an issue: I didn't see any packages in package manager.
The solution was that I had to remove the "/usr/local/zy-pkgs/zypkg_conf" folder.

Tuesday, 27 October 2015

Android manual flash

  • run the flash-all.bat up until the point where it fails
  • unzip image-volantis-lrx21l.zip
  • fastboot flash system system.img
  • fastboot flash recovery recovery.img
  • fastboot flash cache cache.img
  • fastboot flash boot boot.img
  • fastboot flash vendor vendor.img
  • from tablet - select hboot
  • select factory reset

Git credential helper

To permanently store password for git:

git config credential.helper store

Use should specify caching expire:

git config --global credential.helper 'cache --timeout 7200'

Git aliases

[diff]
        algorithm = patience

[http]
        sslVerify = false
[push]
        default = matching
[alias]
        stat = status
        co = checkout
        lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold yellow)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(whit
)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
        lg = !"git lg1"
        sb = submodule

Saturday, 26 September 2015

Zyxel install ffp plugin

Be sure you have installed latest firmware.

After  enter the next directory:
$ cd /i-data/md0/admin/zy-pkgs
and download the following web_prefix file (of course you can enter it manually)
$ wget http://downloads.zyxel.nas-central.org/Users/Mijzelf/zypkg-repo/web_prefix

Via web UI go to Firmware and packages – Packages – press retrieve list from the internet. Only the MetaRepository package should show up. Install it, and re-request the list.
And now you can enjoy new pkgs.

Friday, 25 September 2015

NSA325-v2, assemble Raid partition

To check existing RAID partition:

$ cat /proc/mdstat

To assemble the raid array:
$ mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1

To stop:
$ mdadm --stop /dev/md1

Now you can mount the raid array to mount point:
$ mount /dev/md1 /root/md1

Zyxel NSA325v2 How to mount a ntfs as internal disk

First, determine new disk:
$ su
enter your password

$ fdisk -l

$ mount -t tntfs -o iostreaming,noatime,ioblocksize=1048576,min_iostreaming_read_iosize=524288,min_iostreaming_write_iosize=1048576,nls=utf8 /dev/sdb1 /e-data/4T

Wednesday, 12 August 2015

Linux debug tips

Debug dynamic libraries loading:
LD_DEBUG=files ./myprogram

Show all unresolved symbols:
ldd -r -d myprogram

Show mangled symbol names:
nm -C /home/xxx/libs/libxxxdb.so

Sunday, 12 July 2015

VS visualizers and usertype.dat

User type keywords

In Visual Studio you can define custom keywords:
usertype.dat next to the devenv.exe
Example content:
Vec3
Vec4
Rectangle
etc...
One line one word, so simple.
-------------------------------------------------------------------------------------------------------------------
Now about the visualizers

You have to place visualizer files under:
c:\Users\YourName\Documents\Visual Studio 2013\Visualizers\

e.g.:
example.natvis

To enable natvis debugger

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Debugger]
"EnableNatvisDiagnostics"=dword:00000001

Later I will describe it.

Example:
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="Rectangle">
    <DisplayString>A rectangle with height = {height} {width} </DisplayString>
    <Expand>
      <Item Name="height">height</Item>
      <Item Name="width">width</Item>
      <Item Name="area">height * width</Item>
      <Item Name="macik">macik</Item>
      <ExpandedItem>macik</ExpandedItem>

        <Synthetic Name="Am I a square?" Condition="height==width">
          <DisplayString>Yes I am. </DisplayString>
        </Synthetic>
        <Synthetic Name="Am I a square?" Condition="height!=width">
          <DisplayString>No I am not.</DisplayString>
        </Synthetic>

    </Expand>
  </Type>


  <Type Name="Rectangle2">
    <DisplayString Condition="height == 4">negy = {height} {width} </DisplayString>
    <DisplayString Condition="height == 3">harom</DisplayString>
    <Expand>
      <Item Name="height">height</Item>
      <Item Name="width">width</Item>
      <Item Name="area">height * width</Item>
    </Expand>
  </Type>


  <Type Name="std::vector&lt;*&gt;">
    <Expand>
      <Item Name="[size]">_Mylast - _Myfirst</Item>
<!--      <Item Name="[capacity]">(_Myend - _Myfirst)</Item>-->
      <ArrayItems>
        <Size>_Mylast - _Myfirst</Size>
        <ValuePointer>_Myfirst</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>


</AutoVisualizer>

Friday, 10 July 2015

Run as administrator Windows from command line

You can do it with the followings:

"runas.exe /savecred /user:administrator cmd"

Sunday, 21 June 2015

CMake and HLSL Shader Compilation

This post demonstrates how to use CMake 3.2 to configure the compilation of HLSL shaders, including setting shader types, models, and entry points.

CMake 3.2 introduces support for compiling HLSL shaders directly. This allows developers to easily integrate shader compilation into their build process.

set_source_files_properties( ${PS_SHADER_SOURCES}
    PROPERTIES VS_SHADER_TYPE Pixel
              VS_SHADER_MODEL 5.0
              VS_SHADER_ENTRYPOINT main )

set_source_files_properties( ${VS_SHADER_SOURCES}
    PROPERTIES VS_SHADER_TYPE Vertex
              VS_SHADER_MODEL 5.0
              VS_SHADER_ENTRYPOINT main )

In this example, we demonstrate how to configure two sets of shader sources: pixel shaders (`PS_SHADER_SOURCES`) and vertex shaders (`VS_SHADER_SOURCES`).

For each set, we use set_source_files_properties to define the following properties:

  • VS_SHADER_TYPE: Specifies the shader type (Pixel or Vertex).
  • VS_SHADER_MODEL: Sets the shader model version (in this case, 5.0).
  • VS_SHADER_ENTRYPOINT: Defines the entry point function for the shader (here, `main`).

This CMake snippet allows you to seamlessly manage HLSL shader compilation within your build system, streamlining your workflow and ensuring proper shader configuration.

Transmission tips

To get peers at every five minutes just add to cron ($ crontab -e):

*/5 * * * * LD_LIBRARY_PATH=/i-data/md0/.system/zy-pkgs/lib /i-data/md0/.system/zy-pkgs/bin/transmission-remote -tall --reannounce

Restart Transmission at 1 am:
0 1 * * * LD_LIBRARY_PATH=/usr/local/zy-pkgs/lib /usr/local/zy-pkgs/etc/init.d/Transmission disable
5 1 * * * LD_LIBRARY_PATH=/usr/local/zy-pkgs/lib /usr/local/zy-pkgs/etc/init.d/Transmission enable

Now reboot:
/etc/init.d/crond.sh restart

Monday, 25 May 2015

Create a Git patch file that you can apply it

$ git diff --no-prefix > save.patch
$ patch -p0 < save.patch

Git rebase a topic branch

When you work on your own branch and finished the work it should 'put' back to the master branch without create a merge commit that is very disgust.

Our branch name is 'topic'.

git checkout topic
git rebase master
git checkout master
git merge topic  - this create a fast forward merge

And now we're happy.

Visual Studio compiler flags

Here are some compiler flag that is can be useful:

-D_CRT_SECURE_NO_WARNINGS
-D_HAS_ITERATOR_DEBUGGING=0
-D_SECURE_SCL=0
-D_SECURE_SCL_THROWS=0
-D_SECURE_SCL_DEPRECATE=0

C++11 features that I should use it

Delegating constructors
Uniform Initialization

Saturday, 23 May 2015

Fix crappy VS Find&Replace

Tools -> Options -> Environment -> Find and Replace -> Automatically populate Find What with text from the editor

Win32PrioritySeparation

You can set up the CPU schedule via
HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl\Win32PrioritySeparation

2A Hex = Short, Fixed , High foreground boost.
29 Hex = Short, Fixed , Medium foreground boost.
28 Hex = Short, Fixed , No foreground boost.

26 Hex = Short, Variable , High foreground boost.
25 Hex = Short, Variable , Medium foreground boost.
24 Hex = Short, Variable , No foreground boost.

1A Hex = Long, Fixed, High foreground boost.
19 Hex = Long, Fixed, Medium foreground boost.
18 Hex = Long, Fixed, No foreground boost.

16 Hex = Long, Variable, High foreground boost.
15 Hex = Long, Variable, Medium foreground boost.
14 Hex = Long, Variable, No foreground boost.

Sunday, 8 March 2015

Linux tcp tuning

You can increase the network performance by override the default settings:

cat /etc/sysctl.conf
vm.swappiness = 10
vm.vfs_cache_pressure = 500
net.core.netdev_max_backlog = 4096
net.core.wmem_max = 1048568
net.core.rmem_max = 1048568
net.ipv4.tcp_wmem = 8192 32768 2027520
net.ipv4.tcp_rmem = 8192 131072 2027520
net.ipv4.tcp_mem = 32768 98304 131072
net.core.optmem_max = 32768

To the meaning of them, please check in man.

Sunday, 8 February 2015

Replace default notepad

 There is a little trick to replace windows' default text editor to anyone.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="c:\\Program Files\\EmEditor\\EmEditor.exe"

There is only issue with this:
because of the Debugger string purpose of set up a debugger application the notepad called with the following form:
c:\\Program Files\\EmEditor\\EmEditor.exe c:\\windows\\notepad.exe
So in emeditor always try to open notepad.exe too.

So better alternative use the http://www.binaryfortress.com/notepadreplacer/
or you have to write a wrapper exe.

Saturday, 7 February 2015

Windows bootable pendrive

Copy dvd content to pendrive.

BOOTSECT.EXE/NT60 d:

Get the progress of dd

I found a good article how to get the progress of dd.

Show progress during dd copy

dd is a popular, generic command-line tool for copying files from 1 location to another. It is often used to copy entire disk images.

Like many Linux command line tools, it operates silently unless something unexpected happens. Its lack of visual progress feedback is a nice feature for scripting. However, it can leave you wondering about its progress if you are interactively dd-copying a large disk.

To illustrate, you run the following (valid, but perhaps not very useful) dd copy:
$ dd if=/dev/random of=/dev/null bs=1K count=100 


It will run for a few minutes as it copies (and immediately discards) 100 blocks of randomly generated data, each of size 1 KB.

To get a progress report while dd is running, you need to open another virtual terminal, and then send a special USR1 signal to the dd process.

First, find out the process id of the dd process by running the following in the new virtual terminal.
$ pgrep -l '^dd$'
8789 dd
$


To send the USR1 signal to the dd prcoess:
$ kill -USR1  8789
$


Note that as soon as the USR1 signal is detected, dd will print out the current statistics to its STDERR.

$ dd if=/dev/random of=/dev/null bs=1K count=100
0+14 records in
0+14 records out
204 bytes (204 B) copied, 24.92 seconds, 0.0 kB/s


After reporting the status, dd will resume copying. You can repeat the above kill command any time you want to see the interim statistics. Alternatively, you can use the watch command to execute kill at a set interval.
$ watch -n 10 kill -USR1 8789
 
Ref.:http://linuxcommando.blogspot.hu/2008/06/show-progress-during-dd-copy.html