Menu Home

未分类

Manage SSH Key

Generate SSH Key $ ssh-keygen -t rsa -C “[email protected]” Add Key $ ssh-add ~/.ssh/id_rsa Check Saved Keys ssh-add -l Delete All Keys ssh-add -D

Test HE AAC

HE AAC M4A 您的浏览器不支持 video 标签。 MP4 您的浏览器不支持 video 标签。 HE AAC v2 M4A 您的浏览器不支持 video 标签。 MP4 您的浏览器不支持 video 标签。

iOS: create thumbnail by means of offscreen image context

– (void)setThumbnailFromImage:(UIImage *)image { CGSize origImageSize = image.size; CGRect newRect = CGRectMake(0, 0, 40, 40); float ratio = MAX(newRect.size.width / origImageSize.width, newRect.size.height / origImageSize.height); UIGraphicsBeginImageContextWithOptions(newRect.size, NO, ratio); UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:newRect cornerRadius:5.0]; [path addClip]; CGRect thumbRect; thumbRect.size.width = ratio * origImageSize.width; thumbRect.size.height = ratio * origImageSize.height; thumbRect.origin.x = (newRect.size.width […]

RelativeLayout居中显示

XML方式 <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:paddingLeft=”@dimen/activity_horizontal_margin” android:paddingRight=”@dimen/activity_horizontal_margin” android:paddingTop=”@dimen/activity_vertical_margin” android:paddingBottom=”@dimen/activity_vertical_margin” tools:context=”.MainActivity”> <TextView android:id=”@+id/center” android:background=”@android:color/holo_red_light” android:layout_width=”100dp” android:layout_height=”50dp” android:layout_centerInParent=”true” android:text=”Center” android:gravity=”center” /> <TextView android:id=”@+id/left” android:background=”@android:color/background_dark” android:layout_width=”100dp” android:layout_height=”50dp” android:layout_alignTop=”@id/center” android:layout_toLeftOf=”@id/center” android:text=”Left” android:textColor=”@android:color/white” android:gravity=”center” /> <TextView android:id=”@+id/right” android:background=”@android:color/holo_purple” android:layout_width=”100dp” android:layout_height=”50dp” android:layout_alignTop=”@id/center” android:layout_toRightOf=”@id/center” android:text=”Right” android:textColor=”@android:color/white” android:gravity=”center” /> </RelativeLayout> Java方式 centerLayoutParam.addRule(RelativeLayout.CENTER_IN_PARENT);//把center TextView居中显示 leftLayoutParam.addRule(RelativeLayout.LEFT_OF, R.id.one);//把left TextView控件放在center TextView左侧显示,并且距离center […]