小不的笔记

时间之外的往事

解决Spring LocalSessionFactoryBean加载Hibernate映射不支持通配符问题

一直在使用公司的BDF,从来没有留意过加载的具体细节,在一次做培训的时候,因为没有使用BDF,Hibernate映射只能一个一个的添加不支持我常用的通配符,文件少了,没什么,要是文件多了,多麻烦呀,才让我正式的面对这个问题。我们BDF的实现方式比较复杂,之后单独写出来。 常用的映射加载方式有这么几种mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations。 mappingResources: 指定classpath下具体映射文件名也可以是一个List的具体映射文件名。

org/xobo/domain/users.hbm.xml org/xobo/domain/users.hbm.xml org/xobo/domain/dept.hbm.xml

mappingLocations:可以指定任何文件路径,并且可以指定前缀:classpath、file等,也可以用通配符指定。

/WEB-INF/users.hbm.xml classpath:/org/xobo/domain/users.hbm.xml classpath:/org/xobo/domain/\*.hbm.xml

mappingDirectoryLocations:指定映射的文件路径


WEB-INF/HibernateMappings

classpath:/XXX/package/

由此可知mappingLocations、mappingDirectoryLocations都可以轻松的满足我的需求,不知道我从网上搜索到的教程为什么会使用mappingResources。

狙击精英V2 无法重新开始 无法正常退出

在找win8 msdn镜像下载的时候找到了异次元的分身,低调异次元,这个网站太低调了。 随便下了狙击精英V2这个游戏,效果没啥说的,由于平时不怎么玩儿游戏的,个人对这个游戏还是很满意的。有些时候会在子弹射出的时候,视角跟着子弹飞出去,直击目标。击中目标之后,会显示出子弹的如何破坏人体内器官,用异次元的描述就是“慢镜的X射线细节,呈现真实的破坏效果”。由于是最简单的模式,游戏还是很轻松的。 美中不足的就是游戏中无法重新开始(restart)及退出(exit)。我已经是纯英文目录了,游戏里运行的也不卡,应该不是硬件问题了。在网上搜搜,发现有人跟我问题一样,但是没有人回答如何处理。最后在(BT之家)http://www.btbbt.com/这个网站的游戏下载的地方找到了一个解决方案。它当时给出的是一个压缩包。下载的时候这个网站竟然没有要求我登录,对该网站好感倍加。压缩包里是个一批处理,要解压到安装跟目录中运行。 批处理如下: cd GUIMenu copy a global.gui cd.. del /F /Q SE.V2.fix.bat 先找到游戏安装目录下的GUIMenu目录,把“a”文件复制一份,然后把已有的global.gui覆盖掉。为了保险,我把先global.gui重命名为global.gui.bak.再复制一份a文件出来,再重命名。 如此简单,试了一下,可用。 PS: 1. 游戏的下载地址:http://www.playnext.cn/sniper-elite-v2.html。以表示对低调异次元的感谢。 2. 点着ctrl键拖动文件可以快速复制文件。 3. 文件a也就是global.gui下载,下载地址:http://pan.baidu.com/s/1jGvIEea 4. 如果本地没有global.gui文件,也所谓,因为我们要使用文件a去覆盖它,文件a的下载地址见上方。如果也没有a文件,那么通过这里直接下载我重命名过的global.gui文件.

本本换SSD

半年前小不在X宝买了一块128G的SSD, 给他的k470p换上, win7对其评分7.5,因为机器速度有明显改进也就一直没再折腾它(说好的7.9呢). 前几天,电脑放包包里没有关机,因下雨小跑了几下,回到家电脑就蓝屏罢工. 刚刚开始还能进入修复页面, 自动修复时说是注册表损坏无法恢复. 再之后自动修复页面也进不了了. 手里又没有启动盘, 等第二天到公司, 用win7盘引导到恢复页面用”chkdsk c: /f”,修复之. 系统正常了,但是小不对这个SSD有了怀疑, SSD也怕震动么? 下了个AS SSD Benchmark, 一测评分2xx. 心里凉了半截,右上有鲜红的提示pci ide bad. 不会是硬件出问题吧. 问谷哥,原来是硬盘没有开启AHCI模式. 重启在BIOS中设置, 又蓝屏. 恢复成IDE又能正常启动. 再问之, 原来是系统安装时是IDE模式, 所以不支持AHCI, 要想支持也很简单,修改注册表就可以了. 将”HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesmsahci”的”Start”改为0即可. 重启启用AHCI, 进系统正常,AS SSD Benchmark测之, 显示为”msahci - ok”, 评分7xx. 看起来是正常了,win7对硬盘评分应该可以满分了吧. 经过漫长的等待, win7给了我一句“无法度量存储性能”“系统无法正确评估磁盘,数据无效”. 我可就是为了看存储性能的呀. 谷歌说我是不是移动系统目录了. 去把环境变量里的TEMP及TMP换成C:temp就好了. 试之, win7总算不罢式了,也对硬盘给出了7.9分. 总结: 1. SSD的数据给我的感觉不安全, 以前用机械硬盘从来没出过种情况, 也可能是因为知道机械硬盘怕震动, 从来没有开机扔包包里. 个人感觉win7的chkdsk要比xp时有用多了. 2. AHCI模式开启不开启直觉上没什么区别, 但是看评分那么给力, 还是开启吧. 3. 微软的评分软件不智能, 发现临时目录被link到其它分区了, 就罢工, 给个提示让我重新给它选个目录也成呀. 硬盘测试是最后一项, 前面的还不能跳过.

BDF Cheat Sheet

  1. BDF上传 调用

var upload = new bdf.UploadFile(); var upload = new bdf.UploadFile(); upload.show({ maxFileCount: 3, caption: "我的上传", onSuccess: function (result) { for (var i = 0; i < result.length; i++) { var info = result[i]; console.log(info.id); console.log(info.fileName); } } });3. ### Datagrid&Autoform个性化

在系统属性表中bdf.datagrid.profile.support,bdf.autoform.profile.support值为’Y’. view中需引入bdfComponentProfile包. //DataGrid个性化 var componentProfile = new bdf.ComponentProfile.DataGrid(); componentProfile.saveGridSet(view,"dataGridId"); //AutoForm个性化显示 var componentProfile = new bdf.ComponentProfile.AutoForm(); componentProfile.saveAutoFormSet(view,"autoFormId",{hideMode:"display"});5. ### 枚举类型的引用

//JS动态创建Dropdown var enumdropdownPosition = new bdf.EnumDropDown(this, "userPositionDropDown"); enumdropdownPosition.loadEnum("employee.position"); //JS动态创建Dropdown 过滤或者排序 var enumdropdownPosition = new bdf.EnumDropDown(this, "userPositionDropDown"); enumdropdownPosition.loadEnum("employee.position", function (entityList) { entityList.each(function (entity) { if (entity.get("name") == "董事长") { entity.remove(); } }) }); //EL表达式引用枚举信息 ${dorado.getDataProvider("bdf.commonPR#findEnums").getResult("枚举key值")}7. ## 固定URL访问权限设定

A IS_AUTHENTICATED_ANONYMOUSLY F IS_AUTHENTICATED_FULLY R IS_AUTHENTICATED_REMEMBERED /test/*.* A /images/*.jpg F bdf.security.specialUrlAccessDefinition=/login.jsp,A;9. ### 替换默认登录界面

bdf.security.loginFormUrl username_ password_ kaptcha_ img src=”bdf.loginController.generateCaptcha.c”

lt26i无法使用Sony PC Companion更新

我的lt26i给出提示,说有新的更新,6.0.A.3.75。虽然没有看到update log,还是想升上去看看的。让我惊讶的是,Sony的手机居然要使用PC端来升级,而不是android通常使用的OTA的方式。 无所谓了,我反正我电脑也一直不离手的。 Sony PC Companion也已经装过了,它也提示有新的更新,原以为一切正常呢,在准备的时候它提示错误“无法安装或启动手机软件更新组件”,然后就结束了。试了两次,反应都一样。我就想会不会跟豌豆荚有冲突,关掉豌豆荚的自动检测手机,重启电脑。问题依旧,Google之。发现我不是一个人,好多人都跟我一样在使用Sony PC Companion时遇到这个问题。 总结大家的解决方案,感觉就有有两条是有意义的 1. 安装jre 2. 检查Sony PC Companion的服务 我电脑已经有了jdk1.5,及jdk1.6有人说要用jre7,我抱着侥幸的心理去下载jdk7, 做为一个Java程序员,抱着Sony PC Companion只能运行于Java7的心理,想想就汗颜。 再下载jdk7的时候,我去检查了系统服务,发现Sony PC Companion处于禁用状态,改为手动启动,再启动之。再运行Sony PC Companion,可以更新。 再抱怨一句,Sony的这个更新速度真慢。 关于jre的下载,程序员就自食其力吧,其它人点这里Java.com

HSQL的BLOB

公司BDF的Demo使用的是HsqlDB,每次启动quartz都会抛一个异常出来。 [code lang=”java”]java.lang.RuntimeException: org.quartz.JobPersistenceException: Couldn’t store job: data exception: string data, right truncation [See nested exception: java.sql.SQLDataException: data exception: string data, right truncation][/code] 没有更多的错误提示信息也不知道怎么定位出错的地方。看到网上有人说是因为2.0之后”BINARY without the length L means a single byte”。打开quartz的HsqlDB的脚本文件tables_hsqldb搜索binary, 发现还真有几个binary。同时打开quartz的mysql的脚本对应的数据类型是blob。这下就好办了,把binary换成LONGVARBINARY。 参考网页:http://db.apache.org/ddlutils/databases/hsqldb.html

Arch Linux 使用小结

Flash中文字体

Arch Linux中Flash中文字体显示看不清,模糊,总之不正常就是了 方法一,修改/etc/fonts/conf.d/49-sansserif.conf,把里面的sans-serif改成sans 方法二,pacman -S ttf-fireflysung (推荐) PS:我尝试过修改配置文件但是没有效果,不过安装好ttf-fireflysung的时候,网址一刷新就好了。又把配置文件还原,字体依旧正常。 原贴地址

关闭独显

BIOS竟然不支持关闭显卡,不经常玩游戏的我,真是后悔买这样的本本。 原本想跟Ubuntu一样解决呢,结果 /sys/kernel/debug/ 目录下是空的。 原来是因为没有加载debugfs。Mount上去就好了。

# mount -t debugfs debugfs /sys/kernel/debug

让他自动加载就更好了/etc/fstab:

debugfs /sys/kernel/debug debugfs 0 0

参考:https://wiki.archlinux.org/index.php/Acer_TimelineX#Switchable_Graphics

Linux Hybrid Graphics

This team is a group of hybrid graphics laptop owners and/or developers interested in getting them to work 100% under Linux. Please join this team if you are new by clicking on the “Join Team” link at the right of the Launchpad page. It’s important to have as many users in the community as possible to request for appropriate support. ### RESOURCES: acpi_call – byo-switcheroo – ironhide/bumblebee: There are two modules for switching on/off the discrete card, acpi_call and byo-switcheroo: You can try them like this: ### a) acpi_call sudo apt-get install git # type password git clone https://github.com/mkottman/acpi\_call.git cd acpi_call make sudo insmod acpi_call.ko ### To check that the status of your VGA devices, run this command: lspci -vnnn grep VGA ### Now run this script: ./test_off.sh ### If you see a “works!” message, it’s found a method. To check that ### the status of your VGA devices has changed, run this command ### again: lspci -vnnn grep VGA ### On an unplugged laptop, clicking on the battery indicator before ### and after running the test.sh script, should show a difference of ### about an extra 1-3 hours battery life. ### b) byo-switcheroo: git clone https://github.com/awilliam/asus-switcheroo.git cd asus-switcheroo make ### To install, pick your distro from: sudo make install-fedora sudo make install-ubuntu sudo make install-arch ### To switch off the card: echo OFF > /sys/kernel/debug/vgaswitcheroo/switch ### more instructions in the README file ### On an unplugged laptop, clicking on the battery indicator before ### and after running the switch, should show a difference of about an ### extra 1-3 hours battery life. For a list of DSDT ON/OFF methods, subscribe to the mailing list at the bottom of the Launchpad page http://launchpad.net/~hybrid-graphics-linux and also follow the blogspot page http://linux-hybrid-graphics.blogspot.com/ We are gathering technical information to improve Linux support for hybrid graphics systems. If you have a switchable graphics laptop, please submit your laptop’s DSDT.dsl and SSDT tables as an attachment to this bug report: http://bugs.launchpad.net/bugs/752542 To compile your DSDT and SSDTs information, install if you haven’t already the acpidump and iasl tools: sudo apt-get install acpidump iasl ### or sudo yum install pmtools iasl Then run the following commands on a bash terminal: mkdir ~/acpiinfo ; cd ~/acpiinfo sudo acpidump > acpidump.txt # enter password sudo acpixtract acpidump.txt ls *.dat while read i; do iasl -d “${i}”; done pid=`sudo dmidecode -s system-product-name` vid=`sudo dmidecode -s system-version` name=${pid// /}.${vid// /} mkdir “${name}” && cp *.dsl “${name}”/ tar czf “${name}.tar.gz” “${name}”/ && ls -l “$( pwd )/${name}”.tar.gz This will create a tar.gz file that you can attach to the bug report. Finally, for posting the information in the bug report, you can check the laptop and graphics card model identifiers with these commands: sudo dmidecode -s system-product-name && sudo dmidecode -s system-version lspci -vnnn perl -lne ‘print if /^d+:.+([S+:S+])/‘ grep VGA This information will allow the full development of hybrid graphics features for Linux. Thanks for your help! ——————– STATUS ——————– ATI hybrid: The PowerXpress pre-4.0 models have a mux solution to switch between discrete and integrated card. For most ATI/Intel hybrid configurations: a) try the latest closed-source Catalyst Driver for login/logout card switching, or b) try vga_switcheroo and open-source graphics drivers (kernel 2.6.35 or newer). The PowerXpress 4.0+ models have a muxless solution to use both cards and switch on/off the discrete card. For Muxless PowerXpress 4.0+ models, please submit your DSDT tables information as described here: http://linux-hybrid-graphics.blogspot.com/ NVIDIA hybrid: For nvidia hybrid configurations: ### a) try acpi_call or byo-switcheroo for switching on/off ### b) try ironhide/bumblebee for simultaneously using the intel and nvidia cards: ### For ironhide (Ubuntu Natty/Oneiric instructions): sudo apt-get remove bumblebee ### reboot sudo apt-get install dialog ### or sudo apt-get install cdialog sudo apt-add-repository ppa:mj-casalogic/ironhide sudo apt-get update && sudo apt-get install ironhide ### For bumblebee (git installation): sudo apt-get install git # type password git clone http://github.com/MrMEEE/bumblebee.git cd bumblebee/ sudo ./install.sh ### For a WebGL benchmark, install google-chrome or use a ### WebGL-enabled browser and can try it with/without optirun and ### report the FPS values on the mailing list: optirun google-chrome http://webglsamples.googlecode.com/hg/aquarium/aquarium.html # close window google-chrome http://webglsamples.googlecode.com/hg/aquarium/aquarium.html There is ongoing work to support for Nvidia Optimus/Intel hybrid offloading for nouveau drivers: http://airlied.livejournal.com/74176.html We are looking for Linux users with Nvidia Optimus-enabled or AMD BACON muxless laptops willing to provide debugging information for the multi-gpu support features being worked on. Please join the team by clicking on “Join” on the right, fill in this doodle: http://www.doodle.com/63fyczzrxqaquhqx and send an email to the mailing list specifying your laptop model with these commands: sudo dmidecode -s system-product-name && sudo dmidecode -s system-version lspci -vnnn perl -lne ‘print if /^d+:.+([S+:S+])/‘ grep VGA

Using acpi_call module to switch on/off discrete graphics card in Linux

sudo apt-get install git # type password git clone http://github.com/mkottman/acpi\_call.git cd acpi_call make sudo insmod acpi_call.ko # To check that the status of your VGA devices, run this command: lspci -vnnn grep VGA # Unplug laptop, click on the battery indicator and take note of # estimated remaining time. # Now run this script: ./test_off.sh # If you see a “works!” message, it’s found a method. To check that the status of your VGA devices has changed, run this command again and check for the differences: lspci -vnnn grep VGA Click on the battery indicator after running the test.sh script, it should show a difference of about an extra 1-3 hours battery life. Please join the hybrid graphics team if you are new by clicking on the “Join Team” link at the right in this URL: http://launchpad.net/~hybrid-graphics-linux If you have any comments/questions, the best way to get an answer is to subscribe to the mailing list at the bottom of that page and send an email there.     copy from: http://linux-hybrid-graphics.blogspot.com/2010/07/using-acpicall-module-to-switch-onoff.html

Win7 Tweak Win7优化指南

XP时代电脑配置低,为了让电脑高效的运行,可以关的服务,启动项都禁了。正常使用的情况下,进程也不过是20个左右。天天没事扫扫病毒、清清垃圾、优化一下注册表。 后来才发现硬件才是王道。给电脑加个内存条,比啥优化都实在。渐渐对电脑的要求更多的是方便效率,而不仅仅是速度了。

Switcher, Expose for Win

在Windows上模拟Mac的Expose效果。Expose效果,在演示的时候,我以为是华而不时,真正在用的时候发现真的好方便。 虽然软件版本很老,但是在我的64bit win7上表现正常。 下载地址: http://insentient.net/Files/Projects/Switcher/Switcher-2.0.0.2705.msi

AltDrag, Easily drag windows when pressing the alt key

习惯了在Linux下,按着Alt键,用鼠标拖动窗口。上网,看电影,玩游戏啥的基本用不到这个功能,但是写代码的时候会用到。屏幕太小需要调整窗口位置来适应,多窗口的需求。 下载链接:http://code.google.com/p/altdrag/downloads/list

Wizmouse, 在非激活的窗口用滚轮。

不用激活鼠标指向的窗口,就可以使用滚轮滚动它。 可以使不支持滚轮的软件支持鼠标滚动。 可以反向滚动就像OS X Lion的”Natural”滚动一样。 下载链接:http://antibody-software.com/web/software/software/wizmouse-makes-your-mouse-wheel-work-on-the-window-under-the-mouse/

RocketDock

只是喜欢鼠标指向会变大的效果。

不听话的Ubuntu

换了新电脑,arch linux下,Gnome死活不启动。只好用Ubuntu了。最新版11.10。

折腾

1. 习惯了Gnome Shell.

安装gnome-shell

sudo apt-get install gnome-shell #gnome-shell界面 sudo apt-get install gnome-session-fallback #gnome传统界面

首先要系统设置用户帐户里启用自动登录 默认启动gnome shell

sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell

改回unity

sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu

更多的问题可以来这里 本帖集中了11.10中多次出现的各种问题,和解决方法。

2. mysql-workbench无法启动,卡在启动画面

好像是当前的mysql-workbench跟ubuntu 11.10不兼容引起的,要打上补丁重新编译一下。 更多信息参考http://mysqlworkbench.org/?p=1217。 我找到一个64bit的,直接安装就可以了。 下载地址:Dropbox 115网盘

3. 一进ubuntu,风扇狂转,发热变大

查资料发现是因为两显卡都在工作原因。关闭不在使用的显卡就好了。不过要先换root帐户,sudo好像都不好使。

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

原理待补充。 可以期待xobo版的双显卡切换。 参考: Linux下双显卡切换  双显卡笔记本ubuntu下禁用独显 HybridGraphics

4. 接上个问题,如何启用root帐户

sudo passwd root

此命令将会重新设置 root 的密码,按照提示输入新的密码,并加以确认。之后,重启系统时,就可以用 root 登录了。 如果你想要禁用 root 帐号,则执行下列命令:

sudo passwd -l root

引自 linuxtoy.org