WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);
if (!hasAdministrativeRight)
{
RunElevated(Application.ExecutablePath);
this.Close();
Application.Exit();
}
private static void RunElevated(string fileName)
{
//MessageBox.Show("Run: " + fileName);
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.Verb = "runas";
processInfo.FileName = fileName;
try
{
Process.Start(processInfo);
}
catch (Win32Exception)
{
//Do nothing. Probably the user canceled the UAC window
}
}
This blog is dedicated to all those thecno-crats and the techno freaks who love to learn new emerging technology. This blog is open to share your knowledge and help others to grow their knowledge. "Knowledge grows when shared with others"
Wednesday, December 8, 2010
C#: Elevating UAC privileges from within application
Thursday, November 11, 2010
Turn off Android power management from console
It is very annoying during development on Android system if it enters sleep mode and there is no keyboard connected to Android target machine. So use the following commands to turn off power management from console.
# echo my_lock > /sys/power/wake_lock
and
# echo my_lock > /sys/power/wake_unlock
to enable power management back.
Monday, November 8, 2010
Saturday, October 30, 2010
Monday, October 4, 2010
Network and DNS settings for Android
Use following command to set DNS server:
setprop net.dns1 xxx.xxx.xxx.xxx
Use following command to set gateway:
route add default gw 192.168.1.1 dev eth0
Building individual module in Android
Steps required to compile individual application package in Android SDK.
1. Go to build directory under Android sdk directory
suhas@ubuntu:~$ cd myandroid/build
2. Execute source source envsetup.shsuhas@ubuntu:~/myandroid/build$ . ./envsetup.sh
3. Go to corresponding application directorysuhas@ubuntu:~/myandroid$ cd hardware/module4. Issue mm command to build the application only
suhas@ubuntu:~/myandroid/hardware/module$ mm
Thursday, September 30, 2010
Run “C” application on Android OS
It had been a hard time for me to dig this problem. I was trying to cross-compile a simple hello world “C” application for Android. Whenever I tried to execute the application, it gave a error as file not found. I was using the same toolchain that I used for compiling Android kerenel. However, after some googling I found following important information; We need to follow these commands to compile “C” application for Android.
$ ANDROID_NDK=~/android-ndk-1.6_r1
$ export PATH=$PATH:${ANDROID_NDK}/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin
$ alias agcc='arm-eabi-gcc --sysroot ${ANDROID_NDK}/build/platforms/android-4/arch-arm -fPIC -mandroid -DANDROID -DOS_ANDROID'
I hope this help you as well !!!
Thursday, June 17, 2010
Linux board bringup commands
mkfs.cramfs -b 4096 arago-rootfs/ arago-rootfs.img
************************************************************************************************************************************************
#this is board specific changes
echo "Board specific script"
#/bin/psplash-write "PROGRESS 90"
#/bin/psplash-write "MSG Board Specific changes"
#/bin/psplash-write "PROGRESS 100"
#/bin/psplash-write "MSG "
#/bin/psplash-write "QUIT"
cp /home/root/pap-secrets /tmp/
cp /home/root/chap-secrets /tmp/
cp /home/root/resolv.conf /tmp/
export TSLIB_TSEVENTTYPE=GALAX
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CALIBFILE=/tmp/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/usr/lib/ts
export QWS_MOUSE_PROTO=tslib:/dev/input/event0
echo "05c6 9000" >/sys/bus/usb-serial/drivers/option1/new_id
#./bin/psplash-write "PROGRESS 100"
#./bin/psplash-write "QUIT"
/opt/dm365/av_capture_load.sh
cat /etc/maven.txt
/opt/dm365/encodedecode &
************************************************************************************************************************************************
Iperf configure
Assuming you are running using bash shell, can you try running this command, before running configure:
$ export ac_cv_func_malloc_0_nonnull=yes
If you are using a different shell, adapt this command.
./configure --host=arm-linux --prefix=/home/shriharsh/Projects/AVL/Test_App/iperf-2.0.4/install CC=/opt/arm/v5t_le/bin/arm_v5t_le-gcc CXX=/opt/arm/v5t_le/bin/arm_v5t_le-g++ CFLAGS=-static CXXFLAGS=-static LDFLAGS=-L /home/shriharsh/temp/arago_rootfs/lib
insmod /mnt/usb/libertas.ko libertas_debug=0x4863a7
libertas_debug=0xFFF86FFF
insmod /mnt/usb/libertas.ko
insmod /mnt/usb/libertas_sdio.ko &
ifconfig wlan0 up
iwconfig wlan0 essid "TESTAP" key "1010abcd20"
echo "nameserver 192.168.1.3" > /etc/resolv.conf
ifconfig wlan0 192.168.1.249
route add default gw 192.168.1.1
TCP
* Server side command - iperf -s
* Client side command - iperf -c (serveripadddress) -w (window size) -d -t (time interval for data tranfer).
UDP
* Server side command - iperf -s -u
* Client side command - iperf -c (serveripadddress) -u -d -t (time interval for data tranfer).
NOTE :-d option stands for bidirectional traffic.
wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant.conf -B
************************************************************************************************************************************************
http://elinux.org/CompilingMTDUtils
http://www.linux-mtd.infradead.org/faq/ubifs.html
create ubi.img on PC
//512 page size
mkfs.ubifs -r dm365 -m 512 -e 15360 -c 768 -o ubifs.img
ubinize -o ubi.img -m 512 -p 16KiB ubinize.cfg
//2048 page size
mkfs.ubifs -r dm365 -m 2048 -e 129024 -c 96 -o ubifs.img
ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubinize.cfg
Configuration file ubinize.cfg contents
>>>>>>
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=11MiB
vol_type=dynamic
vol_name=jffs2
vol_alignment=1
vol_flags=autoresize
<<<<<<
ubiformat /dev/mtd9 -f ubi.img
ubiattach /dev/ubi_ctrl -m 9
ubimkvol /dev/ubi0 -N jffs2 -s 11MiB
mount -t ubifs ubi0 /mnt/cf
************************************************************************************************************************************************
SIMCOM Modem Command
Add this VID/PID to usb-serial
echo "05c6 9000" >/sys/bus/usb-serial/drivers/option1/new_id
./DM365_modemtest /dev/ttyUSB2 115200 AT+CFUN=1
Start GPS
./DM365_modemtest /dev/ttyUSB2 115200 AT+CGPS=1
Stop GPS
./DM365_modemtest /dev/ttyUSB2 115200 AT+CGPS=0
Friday, March 5, 2010
Compiling QT-4.6.2 for ARM (DM365)
STEP 1:
Download QT from
http://qt.nokia.com/downloads/embedded-linux-cpp
Direct link to download:
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz
STEP 2:
untar this downloaded tar to your home directory
tar xvzf qt-everywhere-opensource-src-4.6.2.tar.gz
[Note:] You can find the further steps at following location as well
http://doc.trolltech.com/4.4/qt-embedded-crosscompiling.html
STEP 3:
Create your custom platform directory. Platform and toolchain specific files are located in mkspec/qws/ directory.
Copy an already existing directory in mkspecs/qws/ and modify the toolchain and platform specific files.
STEP 4:
Configure QT: for embedded platorm use
./configure –embedded arm –xplatform qws/<custom platform name> <other options>
To have look at available components use:
./configure –help
STEP 5:
make
make install
This will copy the binaries to the directory specified by –prefix
Thursday, March 4, 2010
Cross compiling ALSA library & utilities
Compile alsa-utils-1.0.22
CC=arm_v5t_le-gcc ./configure --host=i686-linux --target=arm-linux --disable-alsamixer --disable-xmlto --disable-largefile --without-librt --prefix=`pwd`/../alsa-lib-1.0.22/_install/ --without-libintl-prefix --without-libiconv-prefix --disable-nls --with-alsa-prefix=../alsa-lib-1.0.22/_install/lib/ --with-alsa-inc-prefix=../alsa-lib-1.0.22/_install/include/ --disable-alsaconf
more details to be added… for time being use this command.
Replace path with your alsa source code directory