Sunday, June 28, 2015

Xenserver / linux software raid

I want my Storage Repository (SR) run under the software RAID (RAID1). My xenserver version 6.5. XenServer 6.5 do not load soft raid kernel modules on boot. To load soft raid manually run :

modprobe raid1

To load the soft raid module on boot, we can follow this steps : http://discussions.citrix.com/topic/360943-software-raid-mdadm-on-xenserver-65-unexpected-failure/?p=1855912

To build the RAID array :
 
mknod /dev/md1 b 9 1

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1


/dev/sdb1
and
/dev/sdc1
is using linux raid autodetect as the partition type. Use fdisk to create those partition.

To check the RAID building process :
cat /proc/mdstat

reference :

Thursday, June 25, 2015

Internet access for android on vmware

If you download android x86 virtual appliance (http://www.osboxes.org/android-x86/) or installing android x86 manual to your vmware, you can give an internet access to the device

1. Add Network Adapter, with NAT as the network adapter type
2. Don't start your vm, edit the .vmx file, add / edit this line :

ethernet0.virtualDev = "vlance"

3. Now start your vm and you should can browsing from the android vm

reference:
https://lkubaski.wordpress.com/2012/08/15/running-android-on-vmware-player-with-networking-enabled/

Tuesday, May 26, 2015

Grails / GORM database mapping Money data type on Microsoft SQL Server

import java.math.BigDecimal
class Cloth {
    ...
    BigDecimal price
    ...
    static mapping = {
        price sqlType: "money"
    }
}

reference : https://msdn.microsoft.com/en-us/library/ms378878(v=sql.110).aspx
remember, grails is java too :D

Friday, May 1, 2015

Make uninitialized disk using diskpart

Warning this command will erase all of data on the disk!!!

1. run cmd
2. type : diskpart
3. type : list disk
4. select the disk you want to clean / uninitialize, in this example : select disk 1
5. clean
6. done


This steps are useful if we want to change the disk partition type (GPT or MBR or other)

Friday, October 17, 2014

Grails Spring Security no password encoding

http://stackoverflow.com/questions/8465016/spring-security-no-password-encoding

t's a really really bad idea in general, but if you have a use case for it then it is doable. Override the passwordEncoder bean in grails-app/conf/spring/resources.groovy:

import org.springframework.security.authentication.encoding.PlaintextPasswordEncoder

beans = {
   passwordEncoder(PlaintextPasswordEncoder)
}

Tuesday, October 14, 2014

MySQL Export Query Result to CSV / text file

SELECT order_id,product_name,qty
FROM orders
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'

Saturday, October 11, 2014

MikroTik PPTP Server, client cannot access LAN devices

Don't forget to set up your interface for proxy-arp

Interfaces -> Ether2 ( your interface ) -> ARP : Proxy-arp