2017年10月1日 星期日

SPSS 無期限試用


https://zhuanlan.zhihu.com/p/25933448

IBM SPSS是强大的数据统计分析软件,但是笔者确实无力负担每年接近1,2k刀的授权费用,因为还没入课题组,暂时还没得到批量授权,只能自己先想个办法学习SPSS操作方式。
在寻找可用资源的过程中,发现了这么一个理论上是适用于各版本及各平台SPSS的绕过试用时间限制的方式。(仅用于学习交流。商务用途,你们IT部门肯定买得起)
以下以SPSS v24.0 for Mac为例进行示范。
第一步:官网下载试用包并以正常流程完成安装;安装提示输入许可证时选择试用;接下来的流程均为对使用许可证进行修改。
第二步:退出安装程序后启动“SPSS Statistics License Authorization Wizard”;该步骤主要目的是为了确认许可证所在目录
出现的许可状态界面会显示:
注意显示的内容是:“安装在 xx 中的 IBM SPSS Statistics 24 的许可证信息/Applications/IBM/SPSS/Statistics/24/SPSSStatistics.app/Contents/bin”
注意显示的内容是:“安装在 xx 中的 IBM SPSS Statistics 24 的许可证信息/Applications/IBM/SPSS/Statistics/24/SPSSStatistics.app/Contents/bin”
因此我们也就知道了目标许可证所在文件夹为“/Applications/IBM/SPSS/Statistics/24/SPSSStatistics.app/Contents/bin”。
第三步:打开Finder,进入“/Applications/IBM/SPSS/Statistics/24/”(该目录依上一部中显示的内容而定)。如果系统语言是中文,该目录是 “应用程序/IBM/SPSS/Statistics/24/”。
第四步在SPSSStatistics.app上右键选择“显示包内容”,随后进入目录“Contents/bin/”。定位找到文件lservrc。右键打开方式选择 sublime text(whatever u want, it's just used for editing the file)。
Tips :Windows 应该不需要这么麻烦,可以直接定位到lservrc所在文件夹。
第五步:使用代码
9MQT8R78RQBWEXN3WRG7CEC2WCO6TOREVH6CBAI8TI58MI2QM22IKP6V9L8DHS6T2MOFL5MPNSEXTH4SYI24JOU3WO
代码较长,↔️
替换掉文件中pound符号前面部分。(该代码与版本号相关)
第六步:确认 version 信息是否为240.是则直接保存。
发散思维:搜索下载时会发现如果是安装win版的SPSS有两种免购买方式,一种是替换文件lservrc,一种是直接输入贴出的一长串代码。实际上两种方式都是直接或间接修改文件lservrc的内容。
v22.0:
9DNCAF2O3QVDV7FBIO696OO6GWLNXZPPRYTPWF2PPX7C8T6Y24LMVV2ET7DOLX5CXAL5YDLL79UPGEFCPDXP5Q8O5E
代码较长,↔️

v23.0:
VDOV7M8KUEIAWBZIKPP6DUKX4JIO3LWRSJQW4BTDCU5NS28ZLZSSROOZQ8HASZ6VUHRZRZ8I8DGWIFY9WJTIRD5P9Y
代码较长,↔️

v24.0:
9MQT8R78RQBWEXN3WRG7CEC2WCO6TOREVH6CBAI8TI58MI2QM22IKP6V9L8DHS6T2MOFL5MPNSEXTH4SYI24JOU3WO
代码较长,↔️

最後 直接輸入一組 email 開始試用

成功畫面


2016年11月29日 星期二

MAC OS printing to a color Ricoh MP C3300

http://flying-geek.blogspot.tw/2016/05/getting-os-x-1011-el-capitan-printing.html


Solution:

foomatic-rip --version
foomatic rip version 4.0.6.230
"man foomatic-rip" for help.
gs -v
GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
cupsctl WebInterface=yes

  • Browse to http://localhost:631
    • Under “CUPS for Administrators” click “Adding Printers and Classes”
    • Under “Printers” click the button [Add Printer]
    • If prompted for a username and password, login as a user with administrative privileges on the Mac (e.g., "bob" / "password4bob")
    • In my case, I selected “LPD/LPR Host or Printer” and clicked the button [Continue]
    • In my case, the printer is on IP address 192.168.1.41, and I used the ‘default’ (lp) queue: lpd://192.168.1.41/lp
    • I gave the printer a legal name (“Ricoh_MP_C2503_pxlmono”)
    • I configured it as a Make: “Generic” and Model: “Generic PCL 6/PCL XL Printer Foomatic/pxlcolor (en)” printer.
    • On the Defaults screen, I changed Printout Mode to “Normal”
  • Run Matt Broughton’s excellent yosemite_foomatic_paths.command (available: https://gist.github.com/coffeesam/578d7b6beef0fbda975a or http://tinyurl.com/oepe5go [yosemite_foomatic_paths.command.zip]), which will come up in a Terminal.app window (if prompted for a password, if you’re an administrator, punch in your own password, e.g., password4bob):
The printer queue Ricoh_MP_C2503_pxlmono should be modified.
Do you want to continue? (y,n)  y
  • In Terminal.app, sudo to ‘root’ and append a line to the /etc/cups/cups-files.conf file, then stop and restart CUPS (same password as above):
sudo -i
echo "Sandboxing Relaxed" >> /etc/cups/cups-files.conf
launchctl  stop org.cups.cupsd
launchctl start org.cups.cupsd

Voila, you’ll now have color PCL printing to the Ricoh (or whatever PCL printer you have that needs pxlmono + foomatic-rip + ghostscript to work under OS X)...


Update: With the paper size set to 'letter' I was getting complaints from Word, etc., that my margins were bad, and sure enough, when I printed from my standard templates the bottom 1/2" or so was cut off. Setting the paper size to "Custom" 8.5"x11" instead of Letter appears to have solved that problem:


Update to the Update: I was still having margin issues, and Word wasn’t letting me set the non-printable area greater than .5" from the top/bottom, .25" from the sides. I did some PostScript math (72 points = 1", my templates assume .17" non-printable margins) and came up with 12 12 600 780 as the printable boundaries that should work. I then looked at the PPD for the Ricoh Aficio 3510sf I have at my home office, and lo and behold, the dimensions were identical...

Here’s my fixed, working “Letter” page definition / imageable area PPD, which should live at /etc/cups/ppd/Ricoh_MP_C2503_pxlmono.ppd


cd /etc/cups/ppd
sudo vi Ricoh_MP_C2503_pxlmono.ppd
    *DefaultImageableArea: Custom.8.5x11in
    *ImageableArea Letter/US Letter: "12 12 600 780"

(The PPD specified, before it was edited: *ImageableArea Letter/US Letter: "18 36 594 756")

Now, all my (admittedly pretty annoyingly technical) templates print properly again, with no footers cut off.

macOS Sierra Update

I did an upgrade-in-place to Sierra and the Ricoh stopped working. It seemed to send prints out, but the printer never received them or spat them out. Followed Apple's simple process to reset the printing system (which, annoyingly, nuked all the printers I'd installed) and more or less followed the above steps to reinstall it. Didn't have to reinstall foomatic or ghostscript. Did have to re-enable the cupsctl WebInterface, and walk through the steps to re-add the printer. This time, instead of a generic PCL printer, I set it up as a Ricoh MP C2500 PXL (which I believe is PCL XL, and not the "PS" version, which I'm pretty sure is PostScript, which my printer doesn't have). Set up this way, I didn't have to modify the .ppd file at all, it was already setup with the 12 12 600 780 printable area. Everything's working again, in color.







https://bbs.archlinux.org/viewtopic.php?id=121767
set up color to gray mode
Use:
lpoptions -l
to list printer specific settings
then
lpoptions -o option=value
to set it.
On my HP printer, I had this particular option:
ColorModel/Color Mode: *FromPrintoutMode Color Grayscale
So I set
lpoptions -o ColorModel=Grayscale


ColorModel/Color Mode: *FromPrintoutMode Color *Grayscale








2016年7月21日 星期四

rails - problem when install nokogiri cannot discover where libxml2 is located on your system.

Update

For those using El Capitan the following command will work:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 --use-system-libraries

sierra

gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-system-libraries


http://stackoverflow.com/questions/19643153/error-to-install-nokogiri-on-osx-10-9-maverick

2016年3月17日 星期四

swift send value via HTTPHeader

i.e authentication

http://stackoverflow.com/questions/35071753/send-data-through-params-to-rails-app-from-ios-in-swift


request.setValue("XXXXXXXXXX", forHTTPHeaderField: "Authorization")

func postRequest2(x: String) {
    let string = "http://localhost:3000/api/users/2/products"
    let url = NSURL(string: string)
    let session = NSURLSession.sharedSession()
    let request = NSMutableURLRequest(URL: url!)
    let params = ["title": "Fifth Title"]
    request.setValue("XXXXXXXXXX", forHTTPHeaderField: "Authorization")
    request.addValue("application/json", forHTTPHeaderField: "Content-Type")
    request.HTTPMethod = "POST"
    do {
        request.HTTPBody = try NSJSONSerialization.dataWithJSONObject(params, options: NSJSONWritingOptions.PrettyPrinted)
    }
    catch {

    }
    let tache = session.dataTaskWithRequest(request) { (data, response, error) -> Void in
        if let antwort = response as? NSHTTPURLResponse {
            let code = antwort.statusCode
            print(code)
        }
    }
    tache.resume()

}

swift - A Simple Table View Example

https://medium.com/@ronm333/a-simple-table-view-example-in-swift-cbf9a405f975#.egj26mr64

Swift waitUntilAllTasksAreFinished error


http://stackoverflow.com/questions/26947608/waituntilalltasksarefinished-error-swift

func checkLogin(succeed: Bool, msg: String) {
    if (succeed) {

        NSOperationQueue.mainQueue().addOperationWithBlock {
            self.performSegueWithIdentifier("logInTrue", sender: self)
        }        
    }
}