XCode 无法显示Size Inspector

XCode 升级到4.5 以后,在View的设置界面中就再也找不到Size Inspector  的踪迹了,找了很长时间,才知道原来 到 4.5 的时候,引入了“Autolayout”功能来简化设计,可是,当需要手动配置某些复杂控件的时候,这个就不怎么智能了。

找到下面的方法禁止掉其自动的功能。只是所有的都要手动设置了。

在Interface Builder中选中View,然后在Attributes Builder中去掉“Use Autolayout”前面的钩,如下图:

1352635874_6561

Ubuntu 12 以及 13 清除Dash主页及电影播放器(视频)历史记录的方法

1.清除Dash主页中历史记录的方法。

系统设置-隐私-清除历史记录

也可在“应用程序”选项卡中,设置哪些应用软件不启用历史记录。

2.电影播放器用文本编辑器历史记录的清除方法。

ctrl+alt+t,打开命令行

Android 源代码 error: Exited sync due to fetch errors…

希望各位不要出现这个错误,出现这个错误就要折腾一会了

首先继续repo sync,若是一直提示这个错误,那么就按照下面的方法来做吧:

关于这个问题其实google是有说明的http://source.android.com/source/downloading.html,为了防止连接数过多,每个ip都需要认证。。。

第一步:从这里 the password generator 获取用户名和密码,前提是你在之前填写了你的真实姓名和邮箱

第二步:将上面的页面上以machine开头的两行复制到 ~/.netrc文件中

第三步:

多了个“/a”,并且指定 “--config-name”

参数,很多时候会用以前配置过的用户名密码,指定这个参数会重新设置用户名

然后就可以repo sync了

特别注意.netrc文件是在用户的根目录下,root用户就是/目录下,如果没有的话就自己建一个,把权限改为 777 好了

Install the Arduino IDE in Ubuntu 12.04

转自http://blog.markloiseau.com/2012/05/install-arduino-ubuntu/

Install the Arduino IDE in Ubuntu 12.04

Installing the Arduino IDE in Ubuntu only takes a few minutes. As usual, it’s a better idea to install the Arduino straight from the source, instead of relying on the version in Ubuntu’s repository. While it wasn’t hard to install the Arduino IDE, I noticed that the Arduino GUI was really slow and laggy. This is because the startup script tells Java to use Ubuntu’s GTK look and feel, which makes everything run slowly. It’s easily fixed by changing a single line in the startup script.

Update: In the Arduino 1.0.1 update, “Serial Port” is greyed out. The fix is outlined in the troubleshooting section.

Install the Arduino IDE in Ubuntuarduino_logo

  1. Install gcc-avr, avr-libc and openjdk-6-jre if you don’t have it already.
  2. Plug in the board, see where it’s connected
  3. Download and unpack the Arduino IDEtarball
  4. Run the IDE
  5. Select your board model and serial port
  6. Run a sample program
  7. Fix the buggy interface (optional)
  8. Troubleshooting

Everything worked out of the box, other than the interface.

Install gcc-avr and avr-libc

Gcc-avr and avr-libc give your system the tools it needs to compile c into AVR machine code:

If you don’t have openjdk-6-jre already, install and configure that too:

Once those are installed plug in your board and type  $ dmesg . It will print the kernel’s ring buffer and show you what USB port your Arduino is plugged into:

According to dmesg, our board is plugged into ttyACM0.

Download and Run the Arduino IDE

Go to the downloads page on Arduino’s download page to get the latest Arduino IDE tarball (.tgz file) for your architecture. My laptop is 64-bit, so I chose accordingly. Once the file was finished downloading, I unzipped and ran it with the following command:

Select your board model and serial port

I’m using an Arduino MEGA 2560, so I went to Tools>Board>”Arduino Mega 2560 or Mega ADK.” At this point, I noticed that the GUI was really slow and hard to use. If you want to fix it before proceeding, exit the IDE and skip to the  ”Fixing the Interface” section before proceeding.

The IDE flashed an error about how my board wasn’t accessible over the COM1 port. COM1 usually refers to a 9-pin serial port, and my laptop doesn’t even have one. I went to Tools>Serial Port and selected /dev/ttyACM0, which reflected the output I saw when I checked dmesg.

The errors went away, and I went to File>Examples>Basics>Blink and clicked upload. Sure enough, the LED started blinking. You should be ready to start writing and running Arduino programs!

Fix the Arduino IDE to make it run more smoothly in Ubuntu

Exit the Arduino IDE and go to the installation folder (the folder you unzipped from the .tgz file). Edit the “arduino” script in your favorite text editor. To make Arduino use the native Swing windowing instead of forcing the GTK look and feel, which is the cause of the bugginess, change the following line:

Just delete the -D flag and its argument. Personally, I get nostalgic about the old-school Swing look and feel, but either way, it fixed all of the lagginess issues I was experiencing.arduino_ide_ubuntu

My Arduino IDE, running in Ubuntu (using SWT instead of GTK)

Troubleshooting USB and the grayed out Serial Port

When I got the Arduino 1.0.1 update, “Serial Port” was grayed out in the tools menu. Running arduino as root ( sudo ./arduino) resolved the issue, but it’s not an acceptable solution. In my case, serial port was grayed out because my user didn’t have permission to read and write to the device.

I added my user to the dialout group with the command  sudo usermod -a -G dialout mark . Usually, that would have fixed it but iserial port was still grayed out.

Changing the permissions on /dev/ttyACM0 to world readable and writeable fixed the grayed out serial port. I ran  sudo chmod a+rw /dev/ttyACM0 and the serial port menu worked again.

I’ve noticed that running programs that send lots of data over USB can cause issues with the arduino programming software, making it give errors while uploading code. Holding down the reset button fixed my upload and USB errors in most cases.

Further Reading

If you read nothing else before you start writing programs, look at the official Arduino Reference page. It might be the most concise, complete language reference I’ve ever seen.

Ubuntu 13.04 Android Studio "Unrecognized VM option '+UseCodeCacheFlushing'"

下载完成最新的 Android Studio 结果执行 “./android-studio/bin/studio.sh” 的时候报告

“Unrecognized VM option '+UseCodeCacheFlushing'
Could not create the Java virtual machine.”

解决方法为 在 “/android-studio/bin” 目录下面找到 “studio.vmoptions”,如果你是 64未系统 就打开 “studio64.vmoptions”然后删除里面的 “-XX:+UseCodeCacheFlushing”

Ubuntu12.10 Broadcom (BCM4311)无线网卡驱动问题

DELL E5400 电脑安装 Ubuntu 12.10 ,但是不能识别无线网卡,在这个时候,查看默认的驱动,默认使用的驱动存在问题。

执行

命令,然后重启机器,保证最后的结果为下图所示就可以了。

2013-05-26 00:47:45的屏幕截图

Ubuntu 13.04 用户安装 Flash plugin for Firefox

转自 http://imcn.me/html/y2012/11199.html

今天有童鞋在 Ubuntu QQ群中请教如果为火狐浏览器安装 flashplayer 插件问题,其实这个很简单,此教程以ubuntu 12.04 为列,其实Ubuntu 10.04 之后的版本都可以按照这样的方式安装,因为在ubuntu 软件中没有Flash plugin,那么我么需要手动添加源,去adobe官方网站就可以,使用方便,打开网站:http://get.adobe.com/cn/flashplayer/

然后如图选择“APT,适用于ubuntu 10.04 +”意思就是ubuntu10.04以上版本,再点击“立即下载”按钮。

flashplayerforfirefox01

之后弹出下面的窗口,点击“OK”就行了

flashplayerforFF02

软件中心会为你自动添加源地址并更新,所以你不用管,知道出现下面的的窗口,窗口被你点没有了,没关系,现在你可以在软件中心直接搜索插件了,然后点击“”install”安装就可以了,安装完毕之后别忘了重新启动火狐浏览器!

flashplayerforFF03

Arduino小车更换锂电池导致过载的问题分析

一直是用四节镍氢电池来作为小车的电源,某天在网上看到了一个 5V,9V,12V的多用锂电池电源,忍不住就买了个过来,本以为很轻松的换上就可以了,结果当接到12V的电源口子上面的时候,总是自动断开,进入保护模式,感觉很奇怪。

电源图片

image

该电源提供1.5A的极限电流,过流以后会自动切断电源。

感觉尽管小车有四个马达,但是功率不至于达到 12V*1.5A 这么恐怖的地步。

最后用我的直流电源来分析,得到惊人的发现平时的电流也就在300mA左右,但是,某个瞬间,会直接飙升到2.24A以上,这个电流实在是有些恐怖。

直流电源如下:

image

百思不地其解,究竟是为什么导致如此大的瞬间过载电流,幸好电源有过流保护,否则,非出事不可,锂电池可是标准的易燃易爆啊。

细想之下,发觉问题出在如下的代码上面

这段代码看似没有问题,当时也是为了方便才这样写的。

请注意 “停车”这两个字,当时为了使得小车在获得超声传感器的反馈后才会动作,因此要求小车运动一段距离以后就要停下来等待传感器。

但是如此操作导致一个严重的问题,那就是电机的启动负载问题,电机的启动电流非常大,频繁启动,尤其是多电机同步,会导致不可预测的瞬时启动功率过载,非常危险。小车可是有四个驱动电机啊!

虽然知道原因了,但是,却不好解决,原因在于,直流电机的软启动,国内的技术,唉,不提也罢,随便一个配件都是进口的,都要几张红的,关键是还没有给小车这么小的电机的专用的驱动模块,太难了,也不合适。

没办法,不过可以通过降低启动电压的方式来降低瞬时功率,代价就是电机输出功率的下降。于是把电压切换到9V,瞬时最大峰值电流一下子降到了1.2A左右。

勉强撮合。

不过最根本的解决方法,恐怕还是PWM来降低速度,电机一旦启动,就不要停下来,反而是最节能,最不容易烧毁控制芯片的。

的确是个问题。

VBScript 中读取环境变量

最近在编译的时候,需要用到VBScript,发现里面的某些调用路径是写死的实路径,因此修改了一下,提高灵活性一下。

Eclipse使用SVN插件报Failed to load JavaHL Library.错误

最近在使用Eclipse的SVN插件时总是弹出一个大大的对话框,报一个Failed to load JavaHL Library.错误

虽然不是很影响正常使用,但是当你编着编着代码就偶尔弹出这么个大框来着实不爽。

于是在网络上找了答案,按照其中一种方法操作,果然不再报错。

其法为:

1.windows->preferences->Team->SVN->SVN接口

2.选择SVNKit (Pure Java) xxxxxx

如下图所示

image