Sunday, October 20, 2024

How to recursively copy all files from sub directories to a new directory in windows?

The directly solution was to use the below bash command

for /r Source %f in (*) do @copy /Y "%f" Destination

However it will prompt at all conflicts and we don't have an option to say No for all.

So I had to come up with this script instead

@echo off
setlocal enabledelayedexpansion

if "%~1"=="" (
    echo Source directory missing
    exit /b
)
if "%~2"=="" (
    echo Destination directory missing
    exit /b
)

set source=%~1
set destination=%~2

for /r "%source%" %%f in (*) do (
    set filename=%%~nf
    set extension=%%~xf
    set count=1
    set newname=%%~nf_!count!%%~xf
    if not exist "%destination%\!newname!" (
        copy "%%f" "%destination%\!newname!"
    ) else (
        :loop
        set /a count+=1
        set newname=%%~nf_!count!%%~xf
        if exist "%destination%\!newname!" goto loop
        copy "%%f" "%destination%\!newname!"
    )
)
endlocal

Sunday, June 14, 2015

What is running behind svchost?

Go to cmd and issue the command

tasklist /svc /fi "IMAGENAME eq svchost.exe

Sunday, May 24, 2015

How to setup SSH access between Host and VirtualBox Guest VMs

1. Make sure you have SSH server running in your VM

For example in my Ubuntu
sgeevar@ubuntu-ws:~/share$ service ssh status
ssh start/running, process 1157

If you do not have it, install using:
sudo apt-get install openssh-server

2. Power off your VMs and go to VirtualBox
File > Preferences > Network > Host-only Networks

See if you already have an entry, if not create one.

3. Open your VMs settings
Settings > Network > Adapter 2

Check Enable Network Adapter
Attacked to: Host-only Adapter
(The entry you saw in step 2 will be automatically assigned to Name)

Save the changes and exit

4. Now open a terminal in your Host machine
Give ifconfig (ipconfig if Windows)

You should see a new entry corresponding to the host-only adapter we created
Note down the inet addr (in my case 192.168.56.1)

5. Now boot your virtual machine
sudo vim /etc/network/interfaces

Add these entries
auto eth1
iface eth1 inet static
address 192.168.56.56 #based on the address you noted in step 4
netmask 255.255.255.0

Save and exit

sudo ifup eth1

Thats all, now you should be able to connect to your VM via SSH (like putty)

username@ipaddress

Sunday, May 3, 2015

Sunday, March 1, 2015

How to setup VirtualBox Guest Additions Shared Folder on Ubuntu Server

Install Ubuntu Server in VirtualBox (with out any additional packages, may change depending on your need)

Create a Shared folder on your VM's settings.

Setup the build enviorment in the VM:
sudo apt-get build-essentials linux-headers-generic

Insert the CD image:
Devices->Insert Guest Additions CD image

It will be mounted at /dev/cdrom (most likely). If not identify the image using:
sudo blkid

Mount it to a directory in your system so that you can access the contents
sudo mount <source> <target>

Go to the mounted directory and Install the Guest Additions:
sudo sh ./VBoxLinuxAdditions.run

Reboot your system

Add an entry in rc.local for automatic mount:
sudo vi /etc/rc.local

And make the below entry

mount.vboxsf <share_name> <target_directory> vboxsf

Now you may create a shortcut to the target

ln -s <target_directory> /home/<username>/<sharename>

Reboot the system, you should be able to access your share using the target_directory or the symbolic link

Monday, January 12, 2015

tail command in Windows

You can use the equivalent (in Power shell)

type <filename> -wait

Wednesday, February 5, 2014

How to convert const char* to char*

your_char_pointer = const_cast<char*>your_const_char_pointer

Tuesday, February 4, 2014

your security settings have blocked a self-signed application from running with an out-of-date or expired version of Java

1. Go to control panel an open Java
2. Select the 'Security' tab and move the slider to 'Medium'
3. Apply and restart your browser

Hopefully you should be good.

Note: Use this only if you do not want to upgrade your Java

Wednesday, January 29, 2014

kwcheck: ERROR: cannot find installed JVM

Klocwork 9.2 needs Java 1.6 32 bit

Either you do not have Java in your system or you are having a different version of Java or 64 bit Java.

Note: You can have multiple Java installations in the same time.

Tuesday, January 14, 2014

crypto/signature/ksign-publickey.c:2:17: error: key.h: No such file or directory

Seeing the below error when building 2.6.32-279 kernel from Redhat?

crypto/signature/ksign-publickey.c:2:17: error: key.h: No such file or directory
crypto/signature/ksign-publickey.c: In function 'ksign_init':
crypto/signature/ksign-publickey.c:10: error: 'ksign_def_public_key' undeclared (first use in this function)
crypto/signature/ksign-publickey.c:10: error: (Each undeclared identifier is reported only once
crypto/signature/ksign-publickey.c:10: error: for each function it appears in.)
crypto/signature/ksign-publickey.c:11: error: 'ksign_def_public_key_size' undeclared (first use in this function)
make[2]: *** [crypto/signature/ksign-publickey.o] Error 1
make[1]: *** [crypto/signature] Error 2
make: *** [crypto] Error 2


Then try this:

make menuconfig

Select "Enable loadable module support"
Disable "Module signature verification (EXPERIMENTAL)"

Come back to main menu

Select "Cryptographic API"
Scroll down and Disable "In-kernel signature checker (EXPERIMENTAL)"

Save and Exit

Now build your kernel with the modified .config file

kernel: [driver_name]: no symbol version for module_layout

insmod fails with "kernel: [driver_name]: no symbol version for module_layout" message in dmesg?

Make sure you are compiling the driver using the exact same kernel. If yes there is something wrong with Module.symvers file in your kernel directory. Try cleaning the kernel and building once again and then build your driver.

Monday, January 13, 2014

Makefile:[Line Number]: *** missing separator. Stop.

Are you seeing the error in a line similar to the below one in your Makefile?

some_target:
     things to do


If yes make sure the line 'things to do' starts with a tab. I.e. the white spaces should not be space it has to be a 'tab'.

target: dependencies
[tab] system command

Tuesday, December 10, 2013

How to type the dollar sign in Windows Phone/Nokia Lumia?

Are you getting a rupee symbol or your local currency symbol in your Windows Phone keyboard? Touch and hold your local currency symbol for more currency options.

Monday, October 21, 2013

Antivirus for Windows Phone 8

Could not find any antivirus software for your Windows Phone? No worries, Windows Phone 8 has many security features build in and you really do not need an Antivirus. You can read more here.

Yahoo Messanger for Windows Phone 8

Unfortunately there is no messenger application from Yahoo for Windows Phone. But you can try the Nokia Chat which is powered by Yahoo.

Saturday, October 19, 2013

Windows Phone: Lumia 620 vs Lumia 520

Do not go by the comparison websites!! Especially with Lumia 620 vs Lumia 520. It will easily give you a feel that 520 is a better value for money. But there are many differences among the two.
  • Lumia 620 has front camera
  • Camera flash
  • Clear black display
  • NFC
  • Compass
  • Nokia's on super sensitive touch
  • Higher pixel density
  • Faster USB charger (wall socket has a USB port & its 1.3AH vs 700mAH of 520's). 
Note: Lumia 520 has an FM radio and slightly bigger battery (1430mAH vs 1300mAH). But most of the websites giving comparisons doesn't even mention these.

Friday, October 18, 2013

Zune does not detect Windows Phone 8

Unfortunately Zune is not the app to sync your Windows Phone 8. You need to get the Windows Phone App for Desktop to sync your contents.

Tuesday, September 24, 2013

Casio MS-10VC-BU Basic Review

  • First thing you will notice in this calculator is the trendy and eye-catchy colorful design.
  • Other than the standard AC & C buttons it has a key buffer button which will let you delete every key stroke you made in case of a mistake.
  • It can do time calculations and conversions along with tax calculations using a stored tax percentage which you can modify.
  • It has large display, two way power and pretty decent plastic build.

Tuesday, September 10, 2013

Windows: Unable to access microsoft.com

Can you access all other websites but not microsoft.com? This solution has worked for me.

1. Try opening cmd and issue the command 'ipconfig /flushdns'

See if you can access the microsoft.com now. If not:

2. Go to services (services.msc) and stop the 'DNS client' service.

Hopefully you should be able to access microsoft.com now.

Sunday, September 1, 2013

Is PC2 5300 667MHz DDR2 RAM backward compatible for PC2 4200 533MHz DDR2 RAM?

Yes PC2 5300 667MHz RAM is compatible for PC2 4200 533MHz. However when you mix a 667MHz RAM with 533MHz RAM, both will run at 533MHz.

Similarly PC2 6400 800MHz is also designed to be backward compatible.