UI components not getting completely displayed in NSIS ModernUI Custom pages - nsis

I am a beginner at working with NSIS and am trying to create a custom page. I have added a few components to the custom page as follows
${NSD_CreateLabel} 10 10u 80% 20u "Please provide configuration details."
${NSD_CreateLabel} 10 30u 40% 10u "Check this box for input 1"
${NSD_CreateCheckBox} 280 30u 10% 10u ""
${NSD_CreateLabel} 10 50u 40% 10u "Enter the details for input 2"
${NSD_CreateText} 10 60u 80% 10u ""
${NSD_CreateLabel} 10 80u 40% 10u "Enter the details for input 3"
${NSD_CreateText} 10 90u 80% 10u ""
${NSD_CreateLabel} 10 110u 40% 10u "Enter the details for input 4"
${NSD_CreateText} 10 120u 80% 10u ""
${NSD_CreateLabel} 10 140u 40% 10u "5"
${NSD_CreateText} 10 150u 80% 10u ""
As evident, all the elements after element 4 are not getting displayed.
Can you please tell me what I might be doing wrong here and how can I resolve this?
Thanks in advance.

Related

Recode value in the column in unix with awk or sed

In the following file, The values of 6th column for the rows who have values other than 1 or 2 in sixth column should be replaced with -9. How can I do it?
old.fam
18_0033 26210 0 0 1 1
18_0036 24595 0 0 1 2
18_0040 25563 0 0 1
18_0041 35990 0 0 0 -8
18_0042 39398 0 0 0 -8
18_0045 21586 0 0 1 1
18_0050 22211 0 0 1 2
new.fam should be
18_0033 26210 0 0 1 1
18_0036 24595 0 0 1 2
18_0040 25563 0 0 1 -9
18_0041 35990 0 0 0 -9
18_0042 39398 0 0 0 -9
18_0045 21586 0 0 1 1
18_0050 22211 0 0 1 2
Edit: I used cat old.fam | awk '{ if ($6==1 || $6==2) {print $1 " " $2 " " $3 " " $4 " " $5 " " $6 ;} else {print $1 " " $2 " " $3 " " $4 " " $5 " " -9;}}'> new.fam
Now the problem is the rows with replaced 6th column value (-9), does not have space separated FS between 5th and 6th column.
18_0033 26210 0 0 1 1
18_0036 24595 0 0 1 2
18_0040 25563 0 0 1-9
18_0041 35990 0 0 0-9
18_0042 39398 0 0 0-9
18_0045 21586 0 0 1 1
18_0050 22211 0 0 1 2
Here you have something you can start working on:
cat test.txt | awk '{if ($6==1||$6==2) {print $1 " " $6;} else {print $1 " -9";}}'
The awk script does the following:
check the value of the sixth column
between both checks, there's the awk || logical OR operator
The rest of the script is obvious.
Edit
Apparently awk can't handle spaces, followed by numbers, so you might use this awk script:
awk '{ if ( $6==1|| $6==2) {print $1 " " $2 " " $3 " " $4 " " $5 " " $6 ;} else
{print $1 " " $2 " " $3 " " $4 " " $5 " -9";}}'
(Mind the $5 " -9" at the end)

what is iteration count and byte count in hexdump?

It was really confusing to deal with hexdump command in linux.
Basically I am trying to get the output from the /proc/device-tree.
I tried to use the hexdump but ended up with confusion.
My dts contains
vvn = <0 0 2 2 0 0>;
I got a proc node under /proc/device-tree.
I tried the following command.
hexdump -v -e '4/1 "%x" " "' vvn ; echo
0000 0000 0002 0002 0000 0000
hexdump -v -e '1/4 "%x" " "' vvn ; echo
0 0 2000000 2000000 0 0
hexdump -v -e '4/1 "%x "' vvn ; echo
0 0 0 00 0 0 00 0 0 20 0 0 20 0 0 00 0 0 0
I got different output, I thought all will produce the same output.
Can anyone please explain me how to use the iterationcount and bytecount of the hexdump and what it's for and How to use the format too?
Iteration count controls how may times the format will be repeated.
Byte count indicates how many byte will be format for each iteration.
Format string is the same as that of printf.
'4/1 "%x" " "': iteration for 4 times: in each time, format 1 byte with "%x", and when the iteration finished, insert " ".
'1/4 "%x" " "': iteration for 1 time: in each time, format 4 byte with "%x", and when the iteration finished, insert " ". This is equal to '1/4 "%x "'
'4/1 "%x "': iteration for 4 times: in each time, format 1 byte with "%x "; when iteration finished, eats the last space, insert nothing.
I do know why hexdump eats the last space :(.

Xev doesnt recognize the down key

I accidentally unbound my downkey. Now my system wont recognize it.
Xev prints out
FocusOut event, serial 36, synthetic NO, window 0x0,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 36, synthetic NO, window 0x0,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 36, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
showkey -a dumps nothing when i press down.
$ showkey -s
$ 0xe0 0x50 0xe0 0xd0
$ showkey
$ keycode 108
I know xev would tell me down's keycode is 116.
What I am to do with this information I dont know but this is possible to fix I swear.
Also when I run dumpkeys "keycode 108 = Down" and thats it.
while next says
keycode 109 = Next
shift keycode 109 = Scroll_Forward
Thanks for the help
Yeah so the problem is LXDE (my desktop environment) had a keyboard shortcut for down bound to nothing. Deleted it and all was fixed.

Trying to Understand the size of a binary file (NASM) output

I have these two files myboot.asm and theirboot.asm (listed respectively):
;----------------------------------------------------------------------
; A Simple boot program that prints the string 'Hello World'
; Author: Matthew Hoggan 2012
;----------------------------------------------------------------------
Output db 'Hello',0x00 ; Output string for bios
org 0x7c00 ; This is where BIOS loads the bootloader
entry: ; Label to Signify entry to program
jmp short begin ; Jump over the DOS boot record data
; --------------------------------------------
; Boot program code begins here
; --------------------------------------------
begin: ; Label to Signify entry to program
mov si, Output ; Get pointer to string
loop: ; Top of loop to iterate over string
mov al, [si] ; Move contents of pointer to al
or al, al ; Check if character pointed to is Zero
jz hang ; Zero signifies end of string
call print_char ; Print current char in al
jmp loop ; Repeat
; --------------------------------------------
; Function to print char
; assume caller has placed char in al
; --------------------------------------------
print_char:
mov ah, 0x0e ; Function to print a character to the screen
mov bl, 7 ; color/style to use for the character
int 0x10 ; print the character
hang:
jmp hang ; just loop forever.
;---------------------------------------------
; Write Zeros up to end of program - 2 then boot signature
;---------------------------------------------
size equ $ - entry
times (512 - size - 2) db 0
db 0x55, 0xAA ;2 byte boot signature
;----------------------------------------------------------------------
; A Simple boot program that prints the string 'Hello World'
;----------------------------------------------------------------------
org 0x7c00 ; This is where BIOS loads the bootloader
entry: ; Label to Signify entry to program
jmp short begin ; Jump over the DOS boot record data
; --------------------------------------------
; Boot program code begins here
; --------------------------------------------
begin: ; Label to Signify entry to program
xor ax, ax ; Zero out ax
mov ds, ax ; Set data segment to base of RAM
mov si, msg ; Get pointer to string
call putstr ; Print the message
jmp hang ; Go to infinite loop
msg db 'Hello, World',0x00
putstr: ; Function to print the string
lodsb ; al = [DS:SI]
or al, al ; Set zero flag if al = 0
jz ret ; Jump to end of function if al = 0
mov ah, 0x0e ; Video function 0Eh (print char)
mov bx, 0x0007 ; Color
int 0x10
jmp putstr
ret:
retn
hang:
jmp hang ; just loop forever.
;---------------------------------------------
; Write Zeros up to end of program - 2 then boot signature
;---------------------------------------------
size equ $ - entry
times (512 - size - 2) db 0
db 0x55, 0xAA ;2 byte boot signature
Building both of these files running hexdump on them and listing the files in the directory to see their size reveals:
mehoggan#mehoggan-laptop:~/Code/play/asm$ nasm myboot.asm -f bin -o boot.bin && hexdump boot.bin && ls -l && echo "------" && nasm bootloader1.asm -f bin -o boot.bin && hexdump boot.bin && ls -l
0000000 6548 6c6c 006f 00eb 00be 8a7c 0804 74c0
0000010 e80c 0003 f4e9 b4ff b30e cd07 e910 fffd
0000020 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200 0000 0000 aa55
0000206
total 20
-rw-r--r-- 1 mehoggan mehoggan 518 2012-02-29 21:57 boot.bin
-rw-r--r-- 1 mehoggan mehoggan 2290 2012-02-29 20:23 bootloader0.asm
-rw-r--r-- 1 mehoggan mehoggan 1661 2012-02-29 21:55 bootloader1.asm
-rw-r--r-- 1 mehoggan mehoggan 1786 2012-02-29 21:49 myboot.asm
-rw-r--r-- 1 mehoggan mehoggan 1065 2012-02-29 20:14 ourbootloader.asm
------
0000000 00eb c031 d88e 0fbe e87c 0010 1de9 4800
0000010 6c65 6f6c 202c 6f57 6c72 0064 08ac 74c0
0000020 b40a bb0e 0007 10cd f1e9 c3ff fde9 00ff
0000030 0000 0000 0000 0000 0000 0000 0000 0000
*
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000200
total 20
-rw-r--r-- 1 mehoggan mehoggan 512 2012-02-29 21:57 boot.bin
-rw-r--r-- 1 mehoggan mehoggan 2290 2012-02-29 20:23 bootloader0.asm
-rw-r--r-- 1 mehoggan mehoggan 1661 2012-02-29 21:55 bootloader1.asm
-rw-r--r-- 1 mehoggan mehoggan 1786 2012-02-29 21:49 myboot.asm
-rw-r--r-- 1 mehoggan mehoggan 1065 2012-02-29 20:14 ourbootloader.asm
Why are the files sizes off by 6 bytes?
Check out the last little block of assembly code there:
size equ $ - entry
times (512 - size - 2) db 0
db 0x55, 0xAA ;2 byte boot signature
This block of code calculates how big the code is (from entry to the current location), then pads it out to a total of 512 bytes with zeroes and a signature 0x55 0xAA in the last two positions. That is:
entry: Some code
.
.
.
Some zeroes
.
.
.
0x55 0xAA
That little assembly block means the output size from the entry label to 0x55 0xAA is always 512 bytes. In your first example, there is a six byte string Hello\0 before entry. In your second example there's not. Therefore, the first program is six bytes longer than the second. You probably want to move that string to someplace after entry and before the padding block.
If you use hexump -C on your binaries, you'll see the string right up at the top of the first binary.

dialog --menu selected option

My script is:
dialog --title 'Example' --menu 'Select:' 0 0 0 1 'ABC' 2 'DEF' 3 'GHI'
I would like that option 2 was selected by default (over). Its possible?
Try:
dialog --title 'Example' --default-item '2' --menu 'Select:' 0 0 0 1 'ABC' 2 'DEF' 3 'GHI'
dialog --title "Example" --default-item '2' --menu "Select:" 25 25 3 1 "ABC" 2 "DEF" 3 "GHI"
use of ["] for strings is most recommended
--default-item is common option provided into dialog utilities for menu box or forms.
This will keep selection on '2' option.

Resources