Tuesday, October 29, 2013

Building iOS apps for Simulator with Xcode 5 with command line

Things a little changed since Xcode 4

If you want to build your project for simulator 
and want to do it with the latest and the greatest version of Xcode - version 5.x
and want to do it with command line utility xcodebuild, 
because you need this for Continuous Integration or someth, 
then: 

1. In your Build Scheme for Simulator in project's "Build Settings" in section "Code Signing" set:
  • "Don't Code Sign" for "Code Signing Identity"
  • "None" for "Provisioning Profile"
2. In command line use iphonesimulator7.0 as desired SDK
(even if you have downloaded SDK 6.1, it won't help. not without other voodoo dark magic)

/usr/bin/xcodebuild -verbose \
  -project MyCoolProject/MyCoolProject.xcodeproj \
  -scheme MyCoolProjectSimulator \
  -configuration Debug \
  -arch i386 \
  -sdk iphonesimulator7.0 \
  TARGETED_DEVICE_FAMILY=2 \
  clean build

where TARGETED_DEVICE_FAMILY is iPhone (1) or iPad (2)


Thursday, October 17, 2013

SSH Port Forward multiple hops

Let's use VNC server two hops away.

ssh -4 -v -A -t -L 15902:localhost:15902 user1@host1 \
ssh -4 -v -A -L    15902:localhost:5900  user2@host2

vncviewer localhost:15902

Wednesday, October 16, 2013

Enable VNC Server on Mac OS X remotely

Thanks Apple, they use shell.

ssh to Mac OS X

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -configure -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw YOUR_PASSWORD  -access -on -users admin -privs -all -restart -agent -menu

Src: don't rememmber

Decompiling Java classes on Linux with Krakatu just for fun


To execute:
python decompile.py -path libs/lib1.jar -path libs/lib2.jar -out decompiled.dir/ jar_to_decompile.jar

Parse JUnit XML reports and output them in HTML

Just add following to ant's task:

<junitreport todir="build/reports">
    <fileset dir="build/reports">
        <include name="TEST-*.xml"/>
    </fileset>
    <report format="frames" todir="build/reports/html"/>
</junitreport>


Auto build project with ant in Eclipse

Who needs Eclipse if there is a shell?

In Eclipse, go to Project's properties and add a new builder of type ant.

On tab Main provide:
  • Build file
  • Base Directory
  • Desired arguments that will be passed to ant ( -Dproperty=value style)

On tab Targets provide ant tasks for targets Auto Build, After a Clean.

Now you can just change sources and save the source file, 
Eclipse will execute "Auto Build" target right away.

Saturday, October 12, 2013

Install libimobiledevice on Mac OS X

So you'd like to manage your iOS devices by command line?
You can use libimobiledevice tools for that.
Easy on Linux. Let's see how it is on Mac OS X.

You'll need to:
1. install Xcode
2. start Xcode and agree to it's license
3. install Xcode command line tools (Start Xcode, Go to Preferences -> Downloads tab)
4. install homebrew by this command (sudo password will be prompted)

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

5. run following


brew install -s --HEAD libimobiledevice ideviceinstaller

6. ready to go


That's all, folks. Just a little more steps than in GNU/Linux.
So Mac OS X can really be of use by people.

Enable VNC Server on Mac remotely

Thanks, Apple! You've made life of many Unix admins easier by integrating some necessary stuff in OS X out of box.

To enable VNC Server on Mac when you have only SSH, fire this command.

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -configure -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw YOUR_PASSWORD  -access -on -users admin -privs -all -restart -agent -menu 


Src - don't rememmber. If i'll find it, I'll add.

Disable hibernate in Windows 7 and delete hyberfil.sys

1. powercfg.exe -h off
2. rm hyberfil.sys

Uninstall MacPorts from Mac


"Uninstalling MacPorts can be a drastic step" so they say. That's why my choice is HomeBrew!

So here it is. Might be your's will be with a little deviation.

%% sudo port -fp uninstall installed

%% sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports




Tuesday, October 1, 2013

How much memory can i insert into my Linux box

One could use dmidecode tool to get info about memory installed

$ dmidecode -t memory

# dmidecode 2.11
SMBIOS 2.7 present.

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 16 GB
        Error Information Handle: Not Provided
        Number Of Devices: 2

Handle 0x0008, DMI type 17, 34 bytes
Memory Device
        Array Handle: 0x0007
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 4096 MB
        Form Factor: SODIMM
        Set: None
        Locator: ChannelA-DIMM0
        Bank Locator: BANK 0
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1333 MHz
        Manufacturer: Hynix/Hyundai
        Serial Number: 0654A654
        Asset Tag: None
        Part Number: HMT351S7C5R6C-PB  
        Rank: Unknown
        Configured Clock Speed: 1333 MHz

Handle 0x0009, DMI type 17, 34 bytes
Memory Device
        Array Handle: 0x0007
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 8192 MB
        Form Factor: SODIMM
        Set: None
        Locator: ChannelB-DIMM0
        Bank Locator: BANK 2
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1333 MHz
        Manufacturer: 029E
        Serial Number: 00000000
        Asset Tag: None
        Part Number: CMSO8GX4M1A1666C9 
        Rank: Unknown
        Configured Clock Speed: 1333 MHz