​
Showing posts with label from. Show all posts
Showing posts with label from. Show all posts

Monday, 24 July 2017

Create styling string from resources

Create styling string from resources


This example show how to create partial styling string from resources:


Edit values/strings.xml to add string resources with styling:
<resources>
<string name="app_name">AndroidStylingStringResources</string>
<string name="normal_name">It is Normal String</string>
<string name="italic_name">Partial <i>Italic String</i> from resources</string>
<string name="bold_name">Partial <b>Bold String</b> from resources</string>
<string name="underline_name">Partial <u>Underline String</u> from resources</string>
</resources>


Edit layout/activity_main.xml to use the string resources:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

android_layout_width="match_parent"
android_layout_height="match_parent"
android_padding="16dp"
android_orientation="vertical"
tools_context="com.blogspot.android_er.androidstylingstringresources.MainActivity">

<TextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_margin="20dp"
android_layout_gravity="center_horizontal"
android_autoLink="web"
android_text="http://android-er.blogspot.com/"
android_textStyle="bold"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/normal_name"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_textStyle="italic"
android_text="Whole TextView in italic style"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/italic_name"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/bold_name"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/underline_name"/>

</LinearLayout>



{ Read More }


Copying files from my remote linux machine

Copying files from my remote linux machine


  •  Copying file
Source:  File vs.txt in the location /home/vineeshvs_logged_in/Desktop from the pc I have logged in.
Destination: /home/vineeshvs_remote_pc/Desktop in a remote pc in the same network with ip 10.107.104.1

scp /home/vineeshvs_logged_in/Desktop vineeshvs@10.107.104.1:/home/vineeshvs_remote_pc/Desktop
  • Copying folder
Source:  Folder vs in the location /home/vineeshvs_logged_in/Desktop/vs from the pc I have logged in.
Destination: /home/vineeshvs_remote_pc/Desktop in a remote pc in the same network with ip 10.107.104.1

scp -r /home/vineeshvs_logged_in/Desktop/vs vineeshvs@10.107.104.1:/home/vineeshvs_remote_pc/Desktop
{ Read More }


Sunday, 23 July 2017

Count number of characters in file from command line and Vim

Count number of characters in file from command line and Vim


The command wc prints several file statistics: bytes, lines, words, etc. Using the -m option we can count the number of characters in a text file.

Install

Open a terminal window and run:

wc -m FILE

We can count the number of characters from Vim editor using this ex command:

:!wc -m %

References

wc(1) - Linux man page
{ Read More }


Friday, 21 July 2017

cool now you can visit us from this url themkbytes tk

cool now you can visit us from this url themkbytes tk


now you can visit the mk bytes from this shorten URL:

themkbytes.tk
{ Read More }


Wednesday, 19 July 2017

Copy and paste from the system clipboard with vim

Copy and paste from the system clipboard with vim


Often, when using vim, highlighting text in the terminal to copy-and-paste it around is plausible.  This is definitely true when on a true terminal.  I use the rnu option so that I have relative line numbers on each line.  So copying multiple lines with the mouse grabs the line number with unwanted indentation.  When I need to move code around it is annoying to have to manually remove the numbers.

To understand how to get vims clipboard to match your systems you need to understand vim registers.  On a computer we usually only get one clipboard.  Every time we ctrl-c, the contents of the clipboard are discarded and replaced with whatever is highlighted.  We dont have any option to copy multiple objects and then paste them around.  However vim has multiple "registers" where text can be copied and pasted from.  To see the registers type :reg in command mode.

The register that we are interested in is register +.  To test it out, copy some text from another application then run :reg and see the contents displayed in register +.

So now we just need to know how to access the contents of register +.  Register access is done with ".  To paste from they keyboard we type "+p  To copy, for example an entire line, into the system clipboard we type "+yy  To delete the current line and store it in the system clipboard we type "+dd

We can also use registers with visual mode.  If we wanted to copy the line underneath the cursor we would type V"+y  We could copy the next three lines into the system clipboard by typing Vjj"+y

To sum it up, to use the system clipboard to copy and paste in vim simply do what you would usually do in vim, then prepend "+ to your y (yank) or p (paste) command.

Update:
Depending on the version of vim you are using, the register for the clipboard may work differently. In some cases the * and + registers are the same register. If you want to find out which register is for your system clipboard, simply copy some text from anywhere into your clipboard, then run :reg. Whichever register has the text you copied is the register that holds the contents of your clipboard.
{ Read More }


Friday, 14 July 2017

Cool Holiday Greeting from The Witcher Team

Cool Holiday Greeting from The Witcher Team








{ Read More }


Monday, 26 June 2017

Create keystore from certificates

Create keystore from certificates


I had a wildcard certificate that already been used previously on a few apacahe servers. so I had already generated a CSR.

To generate a new keystore from the existing certificates I used the following commands:

Create a pkcs12 keystore from the certificate using openssl:
openssl pkcs12 -export -in star_domain_com.crt -inkey star_domain_com.key -certfile DigiCertCA.crt -out keystore.p12
Convert the pkcs12 keystore into a jks keystore:
keytool -importkeystore -srckeystore keystore.p12 -destkeystore keystore -srcstoretype pkcs12
You can use the following command to check your keystore contents:
keytool -list -keystore keystore
Usually your certificate will be stored under the alias 1, you might want to change that to tomcat, use the command:
keytool -changealias -alias 1 -destalias tomcat -keystore keystore
{ Read More }


Friday, 23 June 2017

Creating DDL scripts from Excel Model using Pentaho Data Integration

Creating DDL scripts from Excel Model using Pentaho Data Integration


What this post is about

In this post, I will walk through an ETL transformation that takes a data model defined in spreadsheets into a DDL script that can be executed to create tables on PostgreSQL. I am using Pentaho Data Integration Community Edition for this exercise.

Creating Data Models in Spreadsheets

While creating data models, it is usually easier to create a data model using spreadsheets. I typically use multiple sheets in the spreadsheet for each table, list the column names and data types as descriptions.

The structure I use is as follows, with one sample row of data

ID AttributeName DataType DataWidth Description Dimension SourceColumns ExtractionMethod
1 W_ATTRIB_1 Numeric 4




Here is a sample fact table shown in Excel



Here is a Dimension table (its the same structure except the name ends in "_D" instead of "_F" based on naming conventions.


The problem with Spreadsheets

The problem with spreadsheets is of course creating the final SQL script is not straightforward. For this reason, I am creating the transformation in an ETL tool, so that it can be maintained and used over and over again.

Lets walk through the high level steps for the transformation.

High level steps

The high level steps in the ETL transformation are as follows.

1. Read all the spreadsheet(s) sitting in one folder, and read all the sheets in the spreadsheet.
2. Filter the sheets to be processed.
3. Add constants
4. Concatenate Fields
5. Sorting the rows
6. Denormalizing the rows
7. Concatenating the final SQL
8. Outputting to a text file

Here is a picture of the transformation



Reading all the spreadsheets in the folder

The first step is to read all the spreadsheets in a folder, as well as all sheets in each spreadsheet file. Since this step is an important and big enough step, I have posted it as a separate post on my blog.

Filter the sheets to be processed by the transformation

Since I may have multiple sheets in each spreadsheet, and only some may be relevant in the model, I added a step to Filter Rows. Filter Rows is available under the Flow group of transformers on the Design tab.


Click on Edit Step to configure this step. As you can see, I have added two filters to only allow sheets in each file that either end with _D or _F.


Adding some constants

Next step was to add some constants that I need at multiple places in the transformation to fully form the SQL. The Add Constants step can be found under the "Transform" group of steps under the Design tab.


The constants I added were the following:


#Constant NameValue
1.TableColumnKey TabColKey
2.OpenParanthesis (
3.ClosedParanthesis)
4.CreateTable CREATE TABLE
5.Semicolon ;
6.Space




Click Ok to continue. Next step is to concatenate fields to form column definitions.

Concatenating Fields to form Column Definitions

I used the "Concat Fields" step under the Transform group of steps on the Design tab as shown below.



After dragging and connecting it to the previous step, right click and select Edit Step. Enter the following details on the dialog box

1. TargetFieldName: TableColumnDefinition
2. Separator: or blank

Here are the input columns I concatenated, in the following order.

1. AttributeName
2. Space
3. DataType
4. OpenParanthesis
5. DataWidth
6. ClosedParanthesis

 This will create a column called TableColumnDefinition concatenating all the above fields in listed order.


Next we need to prepare to flatten the rows. Prior to feeding the rows into the Denormalizer, we need to sort these.

Sorting the definitions by Table name

The Sort Rows step is also present under the Transform group of steps. Drag and connect it to the previous step.


Right click and Edit step to make the following entries. The fields need to be in the order listed below.

1. TableName
2. ID

This will sort the input rows accordingly. Click Ok to continue.



Denormalizing the rows.

This is the most important step in this entire transformation. Drag and connect the Row Denormalizer step present under Transform steps, to the previous steps.

Right-Click and select Edit Step to continue.



On this dialog box, we will enter the following details

1. The Key Field: TableColumnKey (This is the constant we introduced in previous steps and is same for all input rows)

2. GroupField: TableName (We want to select all rows having the same TableName to be merged into a single row)

3. Target Fields: (We will enter only one target field with the following values)

a. TargetFieldName: AllColumns (Each output row will now have this additional column)

b. ValueFieldName: TableColumnDefinition (This is the concatenated column we created in a previous step)

c. Length: 5000 (We need space for long table statements)

d. Aggregation: Concatenate strings separated by , (This will take individual column definitions for a given table name, and concatenate them with comma separations, creating a list of column definitions)

Click Ok to continue.



Constructing the Full SQL


The last step before writing to file is to construct the full SQL. We will concatenate the following with a space between them. Enter the following details

1. TargetFieldName: FullSQL
2. Length of Target Field: 5000
3. Separator: " " (Single Space)
4. Fields:
a. CreateTable
b. TableName
c. OpenParanthesis
d. AllColumns
e. ClosedParanthesis
f. SemiColon



Writing to file

Last step in this transformation is writing to file. Drag and connect a Text File Output step from the Output group of steps.


Enter the following

1. Name of file: Your choice
2. Extension: sql



On the Content tab, I made no changes.


Finally on the Fields tab, we only need one output column with following details

1. Name: FullSQL
2. Length: 5000


Thats it. Save the tranformation and execute.


{ Read More }


Wednesday, 7 June 2017

Copy A File From Localhost to Remotehost

Copy A File From Localhost to Remotehost



DESCRIPTION:
  • Consider we want to copy test.txt file from local machine(192.168.1.10) to remote  machine(192.168.2.5)
  • We need to use scp(secure copy) command to establish above need
  • For this you want the root password of the remote host.

COMMAND:

    scp <source file> <remote username>@<remote ipaddress>:<dest path with file name>

    example:
    scp test.txt root@192.168.2.5:/home/user/Desktop/test.txt
  • It will ask the remote machine password to enter
  • Now file will successfully copy to remote machine 



{ Read More }


Create LVM volume from multiple disks

Create LVM volume from multiple disks


Recently I had to crate an Amazon EC2 Instance with a storage capacity of 5Tb, unfortunately, Amazon only allows us to create 1Tb volumes so I had to create 5 volumes, attach them to the instance and create a 5Tb LVM device.

My instance was running Ubuntu and I hat to install the lvm2 package:
apt-get install lvm2 
The volumes attached to my instance where named from /dev/xvdg to /dev/xvdk

to find the names you can use the command:
fdisk -l
First we have to prepare our volumes for LVM with:
pvcreate /dev/xvdg /dev/xvdh /dev/xvdi /dev/xvdj /dev/xvdk
You can run the following command to check the result:
pvdisplay
The next step is to create a volume group, I used the command:
vgcreate storage /dev/xvdg /dev/xvdh /dev/xvdi /dev/xvdj /dev/xvdk 
And used the command:
vgdisplay
to check the result, you can also use:
vgscan 
Now we need to create the logical volume, in this case I wanted to use the entire available space so, I used the command:
lvcreate -n data -l 100%free storage
And
lvdisplay 
to check the new volume if every thing goes well it should be on /dev/storage/data 

you can also use the command 
lvscan
Now you just have to format the new device, you can use:
mkft -t ext4 /dev/storage/data
When ready you can mount it with:
mout /dev/storage/data /mnt

{ Read More }


Saturday, 3 June 2017

Create a file from varius files using win command

Create a file from varius files using win command


Let you have two separate file such as "A.avi "and "B.avi". Now you want to create a file C.avi that contain all of content of file A.avi and B.avi. In generally for this you have to want to use software but you can do this by windows command.

Process:
1. Open command prompt by "windows+r" write "cmd" and press enter.
2. Go to the drive where files having A.avi and B.avi by "cd D:" (D is the drive).
3. Write command "copy<space>/b<space>A.avi+B.avi<space>C.avi" and press enter.
4. Wait sometime until showing " 1 file(s) copied."


NB: In image my files was in F drives Download folder, and 3.avi creating from 1.avi and 2.avi.
Now you can see the C.avi is the compact file to A.avi and B.avi. By this process you can create all type of video files to one compact file.
{ Read More }


Thursday, 25 May 2017

Create Bootable Linux ISO from DD command

Create Bootable Linux ISO from DD command



I have tried many times to create a Bootable USB linux from ISO but failed almost 20 times. After a lot of googling I have found as this is the proper command

dd if=/path/to/ISO.iso of=/dev/sda bs=4M;sync

Thats it. Note: at of=/dev/sda dont give anything after your device. for example If your USB mounted as /dev/sdb1 then at of you should give as of=/dev/sdb only.
{ Read More }


Create pdf from context menu with pdf generate

Create pdf from context menu with pdf generate


Source.



sudo apt-get install imagemagick unoconv ghostscript zenity libfile-mimeinfo-perl
 
 
 
 gedit ~/.config/pdf-generate.conf
 
 
And paste this:


[general]
compression=95 
density=200


So if you want to modify any default parameter, just edit this file before running the tool.

 Main script in charge of the PDF generation k=job should be placed under /usr/local/bin/pdf-generate. See source link to see its content. (Also here.)


# mkdir --parents $HOME/.config
# wget --header=Accept-Encoding:none -O $HOME/.config/pdf-generate.conf https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/pdf/pdf-generate.conf
# sudo wget --header=Accept-Encoding:none -O /usr/local/bin/pdf-generate https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/pdf/pdf-generate
# sudo chmod +x /usr/local/bin/pdf-generate
 
In case that expires:

sudo gedit /usr/local/bin/pdf-generate



and paste this:


#!/bin/bash
# --------------------------------------------
#  Generate a PDF document from a given list of documents
#  Documents are added in final document following
#  alphabetical order
#
#  Setup procedure : http://bernaerts.dyndns.org/linux/74-ubuntu/338-ubuntu-generate-pdf-from-documents
#
#  Depends on :
#   * imagemagick
#   * unoconv
#   * ghostscript
#   * mimetype
#
#  Parameters : full path of documents
#
#  Revision history :
#   05/07/2015, V1.0 - Creation by N. Bernaerts
#   15/08/2015, V1.1 - Force jpeg quality to 95
#   25/09/2015, V1.2 - Add configuration file
#   02/10/2015, V2.0 - Code rewrite to handle progress and notification
# ---------------------------------------------------

# -------------------------------------------------------
# check tools availability
# -------------------------------------------------------

command -v bc >/dev/null 2>&1 || { zenity --error --text="Please install bc"; exit 1; }
command -v mimetype >/dev/null 2>&1 || { zenity --error --text="Please install mimetype"; exit 1; }
command -v convert >/dev/null 2>&1 || { zenity --error --text="Please install convert [imagemagick]"; exit 1; }
command -v unoconv >/dev/null 2>&1 || { zenity --error --text="Please install unoconv"; exit 1; }
command -v gs >/dev/null 2>&1 || { zenity --error --text="Please install gs utility [ghostscript]"; exit 1; }

# ---------------------------------------------------------
#   Read and calculate parameters from configuration file
# ---------------------------------------------------------

# Configuration file : ~/.config/pdf-generate.conf
FILE_CONF="$HOME/.config/pdf-generate.conf"

# check configuration file
[ -f "$FILE_CONF" ] || { zenity --error --text="Please create and configure ${FILE_CONF}"; exit 1; }

# Load configuration file
COMPRESSION=$(cat "${FILE_CONF}" | grep "compression" | cut -d= -f2)
DENSITY=$(cat "${FILE_CONF}" | grep "density" | cut -d= -f2)

# calculate page size
PAGE_WIDTH=$(echo "${DENSITY} * 8.27" | bc)
PAGE_HEIGHT=$(echo "${DENSITY} * 11.7" | bc)

# -------------------------------------------------------
#          Retrieve or select input files
# -------------------------------------------------------

# set separator as carriage return
IFS=$

# loop thru arguments to load candidate files
for ARGUMENT
do
  [ -f "${ARGUMENT}" ] && ARR_FILE=("${ARR_FILE[@]}" "${ARGUMENT}")
  [ -d "${ARGUMENT}" ] && ARR_FILE=("${ARR_FILE[@]}" $(find "${ARGUMENT}" -maxdepth 1 -type f) )
done

# if there is no candidate files, open selection dialog
if [ ${#ARR_FILE[@]} -eq 0 ]
then
  # open multiple files selection dialog box
  LST_FILE=$(zenity --file --multiple --title="Select file to merge as PDF")

  # generate video files array
  ARR_FILE=($(echo "${LST_FILE}" | tr "|" " "))
fi

# -------------------------------------------------------
# loop thru selected files to check convertibility
# -------------------------------------------------------

for FILE in "${ARR_FILE[@]}"
do
  # document type undefined
  DOCTYPE=""

  # get the file mime type (application/msword, ...)
  MIMETYPE=$(mimetype -b "${FILE}")

  # check if file is a image file (.jpg, .png, .tiff, ...)
  CHECKTYPE=$(echo "${MIMETYPE}" | grep "image/")
  [ "${CHECKTYPE}" != "" ] && DOCTYPE="image"

  # check if file is a libreoffice file (.odt, .ods, ...)
  CHECKTYPE=$(echo "${MIMETYPE}" | grep ".opendocument.")
  [ "${CHECKTYPE}" != "" ] && DOCTYPE="libreoffice"

  # check if file is a microsoft file 2007+ file (.docx, .xlsx, .pptx, ...)
  CHECKTYPE=$(echo "${MIMETYPE}" | grep "vnd.openxmlformats-officedocument.")
  [ "${CHECKTYPE}" != "" ] && DOCTYPE="ms-office"

  # check some specific document types
  case $MIMETYPE in
    # ms-office document (.doc, .xls, .ppt, ...)
    "application/msword" | "application/vnd.ms-word" | "application/vnd.oasis.opendocument.text" |
    "application/vnd.ms-excel" | "application/vnd.ms-powerpoint" )
      DOCTYPE="ms-office"
      ;;

    # PDF document (.pdf)
    "application/pdf" | "application/x-pdf" | "application/x-bzpdf" | "application/x-gzpdf" )
      DOCTYPE="pdf"
      ;;

    # plain text file (.txt)
    "text/plain" | "application/x-shellscript" )
      DOCTYPE="text"
      ;;

    * )
      ;;
  esac

  # if document type is compatible, add current file as candidate
  [ "${DOCTYPE}" != "" ] && ARR_CANDIDATE=("${ARR_CANDIDATE[@]}" "${FILE}|${DOCTYPE}")

done

# -------------------------------------------------------
#       Confirmation dialog box
# -------------------------------------------------------

# calculate number of files to convert
NBR_FILE=${#ARR_FILE[@]}
NBR_CANDIDATE=${#ARR_CANDIDATE[@]}

# if some candidate file exist, order them and display confirmation dialog
if [ ${NBR_CANDIDATE} -gt 0 ]
then
  # order generated PDF files in alphabetical order
  ARR_CANDIDATE=($(sort <<<"${ARR_CANDIDATE[*]}"))

  # generate final file name
  FILE=$(echo "${ARR_CANDIDATE[0]}" | cut -d| -f1)
  FILE_FINAL="$(echo "${FILE}" | sed s/^(.*)..*$/1/)-merged.pdf"

  # display confirmation dialog box
  RESULT=$(zenity --question --title="Merge to PDF" --text="${NBR_CANDIDATE} file(s) out of ${NBR_FILE} will be merged to a single PDF file (${DENSITY} DPI) Do you want to generate ${FILE_FINAL} ?" )
  ACTION=$?

# else display error dialog
else
  # display confirmation dialog box
  RESULT=$(zenity --error --title="Merge to PDF" --text="There is no file compatible with PDF format." )
  ACTION=""

fi

# if action canceled or error, exit
[ "${ACTION}" != "0" ] && exit 1

(

# -------------------------------------------------------
# loop thru candidate files to convert them to PDF
# -------------------------------------------------------

for CANDIDATE in "${ARR_CANDIDATE[@]}"
do
  # retrieve document type and filename
  FILE=$(echo "${CANDIDATE}" | cut -d| -f1)
  DOCTYPE=$(echo "${CANDIDATE}" | cut -d| -f2)

  # progress display
  echo "# Conversion of ${FILE}"

  # get file name without extension & generate resulting PDF file name
  FILE_BASE="$(echo "${FILE}" | sed s/^(.*)..*$/1/)"
  FILE_PDF="${FILE_BASE}.pdf"

  # convert file according to its type
  case $DOCTYPE in
    # PDF files
    "pdf" )
    ARR_PDF=("${ARR_PDF[@]}" "${FILE}")
    ;;

    # image files
    "image" )
    convert "${FILE}" -compress jpeg -quality ${COMPRESSION} -resize ${PAGE_WIDTH}x${PAGE_HEIGHT} -gravity center -extent ${PAGE_WIDTH}x${PAGE_HEIGHT} -units PixelsPerInch -density ${DENSITY}x${DENSITY} "${FILE_PDF}"
    ARR_TMP=("${ARR_TMP[@]}" "${FILE_PDF}")
    ARR_PDF=("${ARR_PDF[@]}" "${FILE_PDF}")
    ;;

    # office files
    "libreoffice" | "ms-office" | "text" )
    unoconv -f pdf -o "${FILE_PDF}" "${FILE}"
    ARR_TMP=("${ARR_TMP[@]}" "${FILE_PDF}")
    ARR_PDF=("${ARR_PDF[@]}" "${FILE_PDF}")
    ;;

    # other formats, not handled
    * )
    ;;
  esac

done

# -------------------------------------------------------
#   Final merge
# -------------------------------------------------------

if [ ${#ARR_PDF[@]} -gt 0 ]
then
  # progress display
  echo "# Final assembly of ${FILE_FINAL}"

  # generate resulting PDF
  gs -q -dNOPAUSE -dBATCH -dSAFER -sPAPERSIZE=a4 -dPDFFitPage -dCompatibilityLevel=1.4 -sDEVICE=pdfwrite -sOutputFile="${FILE_FINAL}" ${ARR_PDF[@]}
fi

# -------------------------------------------------------
#   Temporary files clean-up
# -------------------------------------------------------

# loop to remove temporary files
for TMP_FILE in "${ARR_TMP[@]}"
do
  rm "${TMP_FILE}"
done

) | zenity --width=500 --height=25 --progress --pulsate --auto-close --title "Merge to PDF"

# -------------------------------------------------------
#   End of job notification
# -------------------------------------------------------

[ ${#ARR_CANDIDATE[@]} -gt 0 ] && zenity --notification --window-icon="evince" --text="${FILE_FINAL} generated."
                               || zenity --notification --window-icon="error" --text="Document type was not compatible for PDF generation."






Then make it executable:

sudo chmod +x /usr/local/bin/pdf-generate


To fully integrate this PDF generation tool in your desktop environment:
gedit /usr/share/applications/pdf-generate.desktop. 
 
 
Nautilus-Gnome content:
 
 
 [Desktop Entry]
Type=Application
Exec=pdf-generate
Hidden=false
NoDisplay=false
Icon=evince
Keywords=pdf;generate;image;office;document;merge
X-GNOME-Autostart-enabled=true
Name[en_US]=Generate PDF document
Name[en]=Generate PDF document
Name[C]=Generate PDF document
Name[fr_FR]=G�n�ration dun PDF
Comment=Tool to merge a set of documents to a PDF file.
Comment[en_US]=Tool to merge a set of documents to a PDF file.
Comment[fr_FR]=Outil de concat�nation de documents en un fichier PDF.
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;application/pdf;application/x-pdf;application/x-bzpdf;application/x-gzpdf;application/msword;application/vnd.ms-word;application/vnd.oasis.opendocument.text;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;text/plain;
Categories=GNOME;GTK;Graphics;Conversion;Utility;

 KDE-Dolphin content

[Desktop Entry]
Actions=pdf-generate
Encoding=UTF8
Icon=pdf
MimeType=MimeTypes=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;application/pdf;application/x-pdf;application/x-bzpdf;application/x-gzpdf;application/msword;application/vnd.ms-word;application/vnd.oasis.opendocument.text;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;text/plain;inode/directory;application/pdf
ServiceTypes=KonqPopupMenu/Plugin,image/jpeg
Type=Service
#X-KDE-Submenu=Convert all in folder

[Desktop Action pdf-generate]
Exec=pdf-generate %F
Icon=pdf
Name=Create pdf file


To get a full desktop integration, this PDF generation tool should be available from a custom action in your file manager context menu.

For Nautilus you need to declare the new custom action in a .desktop file placed under ~/.local/share/file-manager/actions

[Desktop Entry]
Type=Action
Icon=evince
Name[C]=Generate PDF document
Name[en]=Generate PDF document
Name[en_US]=Generate PDF document
Name[fr_FR]=G�n�ration dun PDF
Tooltip[C]=Tool to merge a set of documents to a PDF file
Tooltip[en]=Tool to merge a set of documents to a PDF file
Tooltip[en_US]=Tool to merge a set of documents to a PDF file
Tooltip[fr_FR]=Outil de concat�nation de documents en un fichier PDF
Profiles=pdf_generate;

[X-Action-Profile pdf_generate]
Exec=pdf-generate %F
MimeTypes=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;application/pdf;application/x-pdf;application/x-bzpdf;application/x-gzpdf;application/msword;application/vnd.ms-word;application/vnd.oasis.opendocument.text;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;text/plain;inode/directory;
Name[C]=Default profile
Name[en]=Default profile
Name[en_US]=Default profile
Name[fr_FR]=Profil par d�faut

 For Dolphin/KDE it is in ~/.kde/share/kde4/services/ServiceMenus/

 Therefore,


gedit ~/.kde/share/kde4/services/ServiceMenus/pdf-generate.desktop

with the content:
 
[Desktop Entry]
Actions=pdf-generate
Encoding=UTF8
Icon=pdf
MimeType=MimeTypes=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;application/pdf;application/x-pdf;application/x-bzpdf;application/x-gzpdf;application/msword;application/vnd.ms-word;application/vnd.oasis.opendocument.text;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;text/plain;inode/directory;application/pdf
ServiceTypes=KonqPopupMenu/Plugin
Type=Service


[Desktop Action pdf-generate]
Exec=pdf-generate %F
Icon=pdf
Name=Create pdf file
 After re-login, a context menu option will appear for selected files as indicated in the source link. For my KDE/Dolphin configuration, this works for selected files if they have the same extension. Otherwise, the best way it just to put all needed files in one folder and then execute the command from the right-click context menu of that folder.

Also here.


{ Read More }


Thursday, 18 May 2017

Create Animated GIFs from Video with Instagiffer

Create Animated GIFs from Video with Instagiffer


Create Animated GIFs from Video with Instagiffer

Free Video to GIF Convertor
Instagiffer is a free GIF creating software for Windows and Mac that allows user to easily create animated GIFs from video files, online video sites like Youtube or anything on your screen (ie. Netflix, games, etc). Instagiffer allows you to create animated GIFs directly from Youtube and nearly any video file format (mkv, flv, avi, mp4) and online video sites.

Just add a video or URL, tweak your settings and upload to your favorite social media site. Instagiffers simple interface makes it a great choice for beginners. Dont be discouraged because making GIFs is simple now. Instagiffer doesn�t restrict you to video uploads like online web GIF converters. Instagiffer supports a huge amount of both offline and online video to GIF conversion sources including YouTube (in 1080p), Youku, Dailymotion, Metacafe, MKV (HD), AVI, etc.  You can also GIF anything on your screen using the Screen Capture feature.

Being able to open video files directly has certain advantages, especially when creating GIF sets. In addition to video file support, users can also create animated GIFs from images. The program features an easy to use interface that allows you to adjust the quality of the GIFs, add effects and text captions, crop images, a screen capture feature to create animated GIFs, and more.

The GIF format is superior at compressing images with a few distinct colors (like cartoons), but isn�t that good at compressing full-color images. One of the main reasons is that GIF frames can�t exceed 255 colors. The quality of your input video will have an affect on your GIF quality, but only to a degree.

Download free Instagiffer for Windows.
Download free Instagiffer for Mac OS.
Instagiffer file size 22.22MB.
Instagiffer Website

{ Read More }


Tuesday, 16 May 2017

Creating an Evolution e mail from the command line and python

Creating an Evolution e mail from the command line and python


Evolution is intended as a GUI e-mail client, so the scripting options are limited. Also, it looks like you cannot autosend e-mail from a script, theres so script command equivalent to the send button.


But thats a good thing; I can autosend from nail when I want to. So a script will compose the e-mail, which will sit on my desktop until I review it and click to send it. Nice.


shell command source

This command creates a window with To:, From:, Subject:, and Body filled in. From: is already known by Evolution, the rest is parsed from the following command:

evolution mailto:person@example.com?subject=Test&body=Some%20crazy%20story%20stuff%0D%0Acolumn1%09%09column2%09%09column3%0D%0A%0D%0ASincerely,%0D%0A%0D%0AMe


Another (easier) way:
evolution mailto:person@example.com?cc="second_person@example.com"&subject="This Is The Subject"&body="This is the body of the message"&attach=Desktop/test_file.xml
  • evolution mailto:person@example.com - Launches Evolutions e-mail composer and To: line
  • ?cc="Person@example.com" - CC: Line
  • &subject="Subject" or ?subject="Subject" - Subject line
  • &body="Body" - Body of the e-mail is everything after this line
  • &attach=/path/file - Files to attach
  • %20 - Space
  • %0D%0A - CR/LF (new line)
  • %09 - Tab

python command

Python 2.x has its own smtp module for creating e-mail, its far more useful in most circumstances. But in this case, we want the composed evolution window.

import os
body_string = This is the body of the e-mail message
body_string = body_string.replace( ,%20)
os.popen(evolution mailto:person@example.com?subject=Test&body= + body_string)
  • import os - Use pythons os module
  • body_string = This is the body of the e-mail message - The body in normal text
  • body_string = body_string.replace( ,%20) - Encode the spaces (evolution will decode them). Tabs, newlines, and other reserved strings need to be encoded.
  • os.popen(evolution mailto:person@example.com?subject=Test&body= + body_string) - The os.popen(cmd) executes shell cmd. Note that cmd is just a python string, and you can use all the string tools on it, like adding body_string.
>>> import os
>>> to = person@example.com
>>> cc = "second_person@example.com"
>>> subject = "This is the subject"
>>> body = "This is the body"
>>> attachment = Desktop/rss_test.xml
>>> os.popen(evolution mailto:+to+?cc=+cc+&subject=+subject+&body=+body+&attachment=+attachment)
{ Read More }


Saturday, 13 May 2017

Create Videos from Photos and Screen Captures QlipBoard

Create Videos from Photos and Screen Captures QlipBoard


QlipBoard is free application that lets you create movies from photos and screenshot images. The interesting part is that QlipBoard has an in-built screen capture feature and voice recorder.

The images (or screen captures) appear in the timeline of QlipBoard (like most other video editors) so you just have to drag-n-drop to change the position of any image frame in the timeline. Further, you can easily record voice narrations, annotate or add text to images.

screen capture movies

And all your pen highlighter movements over the screenshot are recorded as part of the movie itself - so as you speak and move the cursor pen over the image, the exact movements are captured by Qlip Board.

You may think of QlipBoard as a blend of Microsoft Photostory # and SnagIt. The free version of QlipBoad is supported by advertising.

Overall, the software interface is not very intuitive but the application is still useful for creating screencast movies, photo slide shows or for annotating images.

Get QlipBoard at www.qlipmedia.com [Thanks Murali at Hindu]

Related: Turns Boring Video Clips & Still Pictures into Movies

{ Read More }


Wednesday, 10 May 2017

Copy OneNote Notebooks from One Account to Another

Copy OneNote Notebooks from One Account to Another


By using a shared folder on OneDrive, you can Copy an entire OneNote notebook from one user to another.

Heres how:
  1. Lets call the user hosting the notebook OriginalUser, and the account we are going to copy to TargetUser
  2. In OneDrive web app on the OriginalUser account, share a folder to TargetUser
  3. Confirm you have access to the shared folder by logging in to the OneDrive web app for TargetUser. Select the folder and "Add to my OneDrive"
  4. Now, back in the OneDrive web app for OriginalUser, select a Notebook and Copy it to the folder you shared with TargetUser. Wait for it to complete copying...
  5. In the OneDrive web app for TargetUser, navigate to the shared folder and click to open the copied Notebook in the OneNote web app
  6. Wait for the opening process to complete (this may take a while)
  7. Rename the Notebook on the TargetUser OneDrive web app
  8. Move to desired, non-shared folder in the TargetUser OneDrive. You will receive this message, and you have to press "Move Anyway"
 
{ Read More }


Saturday, 29 April 2017

Copy A File From RemoteHost to LocalHost

Copy A File From RemoteHost to LocalHost


DESCRIPTION:
  • Consider we want to copy test.txt file from remote machine(192.168.2.5) to local machine(192.168.1.10)
  • We need to use scp(secure copy) command to establish above need
  • For this you want the root password of the remote host.

COMMAND:

    scp  <remote username>@<remote ipaddress>:<source with path> <dest path with file name>

    example:
    scp root@192.168.2.5:/home/remote/test.txt /home/user/Desktop/test.txt
  • It will ask the remote machine password to enter
  • Now file will successfully copy to remote machine 

{ Read More }


Wednesday, 26 April 2017

Create OS X NetInstall Images from Command Line

Create OS X NetInstall Images from Command Line


Creating NetInstall images on OS X is quite easy, there are a number of different ways to do so. There are tools such as AutoNBI, or Casper NetInstall Creator. But third party tools are not required to make the NBI for Mavericks, Yosemite, or El Capitan. The System Image Utility is a great tool with a GUI to make the images. The only caveat to this that I have found is that you can only create an image from the installer of that version you are on. So lets say you have a MacBook Pro running Yosemite and you have the Install application for Mavericks in your applications folder. When opening the System Image Utility, it would not recognize the installer.

One way to go around this is to use the imagetool through the command line. This is a Unix Executable File located in the Contents folder of the System Image Utility.

/System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool

From Terminal, this can be run to create a NetInstall Image with the install application that was downloaded from the App Store and no other tools are required. To create a Mavericks NetInstall, I have copied the Install OS X Mavericks.app outside of the Applications folder for safe keeping, but in order to run the tool the installer must be in the Applications folder. Open up terminal and run this command (note, you must be sudo to run):

sudo /System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool --netinstall --index 1001 --source /Applications/Install OS X Mavericks.app --destination /Mavericks/NetInstall of Mavericks OS X --name Mavericks NetInstall

The same can be done with Yosemite on the same MacBook Pro mentioned earlier.

sudo /System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool --netinstall --index 1002 --source /Applications/Install OS X Yosemite.app --destination /Yosemite/NetInstall of Yosemite OS X --name Yosemite NetInstall

In order to create the NetInstall image for El Capitan, the machine MUST be running El Capitan. Otherwise, image tool will throw an error and will not complete. However, on an El Capitan machine the command is the same and you can create all three versions from there.

sudo /System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool --netinstall --index 1003 --source /Applications/Install OS X El Capitan.app --destination /El Capitan/NetInstall of El Capitan OS X --name El Capitan NetInstall

The only version of OS X where the imagetool command is different is in Mavericks, where the executable is located: 

/System/Library/CoreServices/System Image Utility.app/Contents/MacOS/imagetool
{ Read More }


Tuesday, 25 April 2017

Copy Text from Images and Flash OCR

Copy Text from Images and Flash OCR


When you surf through web you may have seen some websites which doesn�t allow their content to be copied. In order to protect their data (text) they use images, flash or any other method. Here I am giving you some methods to extract/copy text from images. This can also be used copy text from games and printed notes. Also known as OCR (Optical Character Recognition). I don�t know whether it can copy text from Hand written. Check it out yourself. Here are the steps�


1) Open file or website which you want to copy the text.
2) Press the Print Screen button (Prt Scr � just above the delete button).
3) Using Photoshop or any other image editing tools crop the area only you want.
4) Drag the picture to Microsoft office Onenote. Right click and �Copy Text from picture�.
5) Paste the text any where you want.

If you don�t have MS office Onenote logon to www.free-ocr.com

{ Read More }