最近專案有個需求,客戶想要網址是他們的,但主機不放在他們那邊,這方式要用所謂的反向代理,這時網址的使用要全改用對方的網址才能正常執行,依我5.8.35的版本看了下.env及app.php的設定,更動了APP_URL及ASSET_URL的設定,本來預期是可以用的,卻發現使用route來取得url的都沒有使用APP_URL的設定,查半天,看起來不知是哪個版本開始,url就只使用在command執行,找半天找到這討論串:route() helper function does not acknowledge app.url,裡頭提到可以使用Url::forceRoot('https://www.google.com/'),但不知道要放哪,後來放到web.app中,就可以用了。真是太好了!!!
----更新----
另外也可以如tadeubarbosa/RouteServiceProvider.php所示,將app/Providers/RouteServiceProvider的boot改寫,加入foreRootUrl的設定,也是可以達到相同的需求
參考網址:
route() helper function does not acknowledge app.url
tadeubarbosa/RouteServiceProvider.php
2019年9月27日 星期五
2019年8月20日 星期二
安裝Laravel-Excel(maatwebsite/excel)時,一直停在Updating dependencies (including require-dev)
安裝Laravel-Excel(maatwebsite/excel)時,一直停在Updating dependencies (including require-dev),看不出哪有問題,從Laravel-Excel -- Installation看起來也沒錯,找半天看到Composer install doesn't actually install library,看了裡頭的回應半天,最後結論,等它update結束。
有寫跟沒寫一樣,但記錄一下,免得一直以為有錯
參考網址:
Composer install doesn't actually install library
bash: composer require "maatwebsite/excel:~3.1"
有寫跟沒寫一樣,但記錄一下,免得一直以為有錯
參考網址:
Composer install doesn't actually install library
2019年3月24日 星期日
將字串轉回NSDate
之前有一篇是寫字串轉回NSDate: iOS開發筆記 -NSDate用字串初始及轉回字串
好久前的了,最近剛好遇到一種寫法:2019-03-24T19:35:39.208+08:00
試半天都試不出要怎用,原本是請對方改成2019-03-24T19:35:39+0800,再使用底下的程式去轉
但發現後續發現隨程式的增長連自己都搞不清楚格式而一團亂,最好的方式是對方用制式的我也是制式的,依NSDateFormatter所述,2019-03-24T19:35:39.208+08:00好像就是RFC3339,可以使用
這樣就可以正確轉回去了。
參考網址:
NSDateFormatter
好久前的了,最近剛好遇到一種寫法:2019-03-24T19:35:39.208+08:00
試半天都試不出要怎用,原本是請對方改成2019-03-24T19:35:39+0800,再使用底下的程式去轉
NSISO8601DateFormatter *formatter = [[NSISO8601DateFormatter alloc] init]; [formatter setFormatOptions:NSISO8601DateFormatWithInternetDateTime]; [formatter dateFromString:timeString];
但發現後續發現隨程式的增長連自己都搞不清楚格式而一團亂,最好的方式是對方用制式的我也是制式的,依NSDateFormatter所述,2019-03-24T19:35:39.208+08:00好像就是RFC3339,可以使用
NSDateFormatter *formater = [NSDateFormatter new]; [formater setDateFormat:@"YYYY-MM-dd'T'HH:mm:ss.SSSZZZZZ"]; [formater dateFromString:timeString];
這樣就可以正確轉回去了。
參考網址:
NSDateFormatter
2018年8月26日 星期日
單純秀文字時,最好是直接使用UILabel,而不要用UITextView
最近想說直接UITextView重覆使用,不能編輯時直接將它偽裝成UILabel,但真正使用時發現,UITextView使用sizeThatFits計算出來的高度,常常莫名的最底下一行會截掉,但換用UILabel時就沒這問題,看起來單純秀文字時,還是使用UILabel比較不會有奇怪狀況發生。
-–-更新-–-
後續發現主要是計算時算出來的是浮點數,但UIView在使用時大多都無條件捨棄小數點,變成就會有少1 pixel的問題
-–-更新-–-
後續發現主要是計算時算出來的是浮點數,但UIView在使用時大多都無條件捨棄小數點,變成就會有少1 pixel的問題
2018年7月25日 星期三
.Net網站部署後發生"錯誤碼:-2146232576"的問題
去裝機花了好久時間在這問題上,問了N個人沒人遇過,找資料也找不到,回家後覺得是否是Keyword下錯,用"錯誤碼:-2146232576"才找到類似的問題。依ASP.NET 網站部署後發生 ryslon 編譯錯誤-2146232576所述,看起來是Microsoft.Net.Compilers這個Library版本的問題。貼上ASP.NET 網站部署後發生 ryslon 編譯錯誤-2146232576摘錄的StackOver的回應如下:
The culprit is the Microsoft.Net.Compilers package, used to support modern C# syntax/features (version 6.0, 7.0) in your project and in Razor views in particular. Depending on its version, the package requires a particular minimum version of the full .NET framework to be installed on a machine in question.
For instance, the 2.2.0 package requires .NET 4.6+. Even though your project is targeting say .NET 4.5.2, you probably have the latest .NET installed on your development machine, and everything goes just fine. The remote deployment machine only has .NET 4.5.2 installed, and when your ASP.NET application tries to compile resource (e.g. views) at run time, you get error -2146232576.
回去查了下自己用的,沒想到用到2.6.1 ,難怪出問題,畢竟主機只用了.Net framework 4.5.1。乖乖的找1.3.2來用。其實可以用2.0.1,但怕怕的。

參考網址:
ASP.NET 網站部署後發生 ryslon 編譯錯誤-2146232576
The culprit is the Microsoft.Net.Compilers package, used to support modern C# syntax/features (version 6.0, 7.0) in your project and in Razor views in particular. Depending on its version, the package requires a particular minimum version of the full .NET framework to be installed on a machine in question.
For instance, the 2.2.0 package requires .NET 4.6+. Even though your project is targeting say .NET 4.5.2, you probably have the latest .NET installed on your development machine, and everything goes just fine. The remote deployment machine only has .NET 4.5.2 installed, and when your ASP.NET application tries to compile resource (e.g. views) at run time, you get error -2146232576.
回去查了下自己用的,沒想到用到2.6.1 ,難怪出問題,畢竟主機只用了.Net framework 4.5.1。乖乖的找1.3.2來用。其實可以用2.0.1,但怕怕的。

參考網址:
ASP.NET 網站部署後發生 ryslon 編譯錯誤-2146232576
訂閱:
文章 (Atom)
