Monday, September 15, 2014

KB: SQL Server DBA queries

Get the running queries:
select r.session_id,r.status,r.start_time,r.total_elapsed_time,r.command,s.text
from sys.dm_exec_requests r
cross apply  sys.dm_exec_sql_text(r.sql_handle) s
--where r.status='running'

Get linked servers:
exec sp_linkedservers

Thursday, September 4, 2014

SSRS

如何写一个SSRS项目:
http://msdn.microsoft.com/zh-cn/library/ms167305.aspx

如果配置本地SSRS server+deploy report:
http://www.cnblogs.com/aspnetx/archive/2013/04/20/3033189.html

创建一个报告:
1.加入report









2. 创建database连接
按edit创建,然后选择分享这个data source,其他报告也可以共享


3. 设计query


4. 最后会自动生成一个dataset,每个报告都会有一个dataset. 右击表格,tablix property可以查看dataset












5. 右击该Dataset1可以使其变成share dataset,以便其他报告使用

















如果其他报告要使用,加入shared dataset后即可使用

6. 输入域:用于输入一些参数,然后生成报告





这些参数还可以在Dataset中作为Parameter输入SP,比如需要输入参数才能产生的report








而Parameter还可以做成一个下拉菜单,这需要让parameter associate到一个dataset



配置本地reporting server:
run SQLServerManager11.msc或者sql server configuration manager


















Example for the link above:
In Google drive books\SSRS\Code\Quotes-simple.rar

Email the report by scheduler:



Wednesday, July 23, 2014

在Linux下载Android源代码

1. Change to root

$ sudo su


2. Installing the JDK:

$ sudo apt-get update (with proxysudo env http_proxy=
http://10.1.3.1:8080 apt-get update)

$ sudo apt-get install openjdk-7-jdk

3. curl工具的安装:
sudo apt-get install curl

4. git工具的安装
sudo apt-get install git-core


5. make new dir
mkdir Android
cd Android

6. repo工具的安装
chmod a+x repo
apt-get install phablet-tools

7. 下载源代码

$ repo init -u https://android.googlesource.com/platform/manifest
(proxy: 如果要设置代理,先运行git config --global http.proxy localhost:8080,再运行repo init)
出现错误是补充如下信息:
git config --global user.email "cenjiajie@gmail.com"
git config --global user.name "gary"

最后运行
$ repo sync

运行了一晚后,结果是(这时占用了17G)




8. Build
$ sudo apt-get install git gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

$ . build/envsetup.sh

指定输出路径,这样可以界面交互
export OUT_DIR_COMMON_BASE=/home/gary/Android

root@gary-virtual-machine:~/bin# lunch

You're building on Linux

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_mips-eng
     4. aosp_mips64-eng
     5. aosp_x86-eng
     6. aosp_x86_64-eng
     7. vbox_x86-eng
     8. aosp_manta-userdebug
     9. mini_mips-userdebug
     10. mini_armv7a_neon-userdebug
     11. mini_x86-userdebug
     12. aosp_tilapia-userdebug
     13. aosp_deb-userdebug
     14. aosp_flo-userdebug
     15. aosp_grouper-userdebug
     16. aosp_mako-userdebug
     17. aosp_hammerhead-userdebug


<select 5>

make -j4
--failed
make




http://www.linuxidc.com/Linux/2011-02/32269.htm


官方参考:
https://source.android.com/source/initializing.html
百度经验:

http://jingyan.baidu.com/article/03b2f78c44e2a55ea337ae5b.html

Thursday, July 17, 2014

在windows利用VMware安装Ubuntu

1. 在http://www.ubuntu.com/   下载Ubuntu,我选的是64位系统
2. 下载并安装VMware Workstation 8.0

安装过程注意在bios设置enable visualization technology, 如果要用于下载Android源代码,内存至少2G,硬盘至少100G

百度经验
http://jingyan.baidu.com/article/14bd256e0ca52ebb6d26129c.html
其中,有时可能光盘为空,这时需要把光盘eject再重新按install VMware tools

安装完Ubuntu下一个问题是屏幕不够大,这里需要安装VMware tools来解决,具体见:

百度经验(看前6步即可):
http://jingyan.baidu.com/article/3065b3b6e8dedabecff8a435.html

然后按Ctrl+Alt+T出现terminal的窗口,输入:
cd Desktop
cd vmware-tools-disturib 

sudo ./vmware-install.pl  

安装一直回车即用默认值,一直到安装完毕,然后重启虚拟器
这时候可以见到VMware里面View->Fit Guest now选项可以选了,按一下就全屏了!

















Sunday, June 8, 2014

改变affinity - CPU利用数

由于Android emulator存在bug - 只能单cpu运行,所以我们必须在emulator启动后,改变其affinity,使其可以多CPU运行

PowShell "Get-Process"

PowerShell "Get-Process calc | Select-Object ProcessorAffinity"
PowerShell "$Process = Get-Process calc; $Process.ProcessorAffinity=255"


PowerShell "Get-Process | where-Object {$_.mainWindowTitle} | format-table id,name,mainwindowtitle -AutoSize"

PowerShell "Get-Process | where-Object {$_.mainWindowTitle -like 'calculator'} | format-table id,name,mainwindowtitle -AutoSize"

Id Name MainWindowTitle
-- ---- ---------------
40312 calc Calculator


PowerShell "$Process = Get-Process | where-Object {$_.mainWindowTitle -like 'calculator'}; $Process.ProcessorAffinity=255"



PowerShell "$Process = Get-Process | where-Object {$_.mainWindowTitle -like '5554:test'}; $Process.ProcessorAffinity=255"


Wednesday, May 28, 2014

Android emulator加速和代理

软件加速:
avd设置中,选use host gpu

硬件加速:
1. 在bios设置, enable visualization technology.
2. cmd输入sc query intelhaxm见到尽管硬件设置了,但软件未安装
3. SDK manager下载intel accelarate








4. Go to android SDK folder,  sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe, 安装时候,按需要提高内存上限(默认2G)
5. 在Android SDK manager安装 google APIs (x86 system image) and google APIs ( ARM system image) and Intel x86 Emulator Accelerated(HAXM installer)
这时候重复步骤2可见intelhaxm服务开始了
6. Avd设置中,target选google APIs(x86 system image), skin WXga800-7in
或者cmd: emulator -avd nexus5 -gpu on

代理proxy:
在安装apk到虚拟器emulator一文提到用cmd设置proxy,但笔者用后觉得emulator容易暂停或死机,这里用emulator中设置方法达到:
1. 打开emualotor
2. Settings->more->mobile networks->check data enabled option and click 
access point name->us t-mobile
设置Proxy, port, 置空username password
右上角Save

如果要创建文件:
1. 在创建avd时候设置sd card

Reference:
Android using hardware acceleration 
http://developer.android.com/tools/devices/emulator.html#acceleration

Friday, May 9, 2014

UiAutomator简介(4) - 输入中文

这一节主要讲怎么settext中输入中文,方法主要是用一个外部包

步骤主要如下:
1. 安装Utf7ImeHelper.apk
2. 在你的代码中,加入Utf7ImeHelper.java,并且调用setText(Utf7ImeHelper.e(“我们women”))

当你运行UiAutomator时候,输入文字,不会出现键盘



详细可以参考:
http://testerhome.com/topics/678
http://testerhome.com/topics/408