網頁

2023年6月2日 星期五

.Net Application(.net 6.0以後)部屬到IIS上

雖然是寫.net 6.0,但應該說是.net core之後都算在內

最近主機疑似被入侵,為了安全起見整個重灌,問題就在沒筆記,所以網站原本好好的但出現了以下畫面的錯誤

看半天找不出問題點,忘了那時不知道是怎弄好的可以動(謎之聲:由此可知筆記的重要性啊~~),用0x8007000d去google看到【茶包射手日記】IIS 跑 ASP.NET Core 出現 500.19 0x8007000d 錯誤再找到[.NET Core] 將 .NET Core Application 部屬到 IIS,看了下自己專案中web.config有筆AspNetCoreModuleV2才想起~缺了.net core hosting moduler啊~

在使用 IIS 的 Windows 上裝載 ASP.NET Core中如下圖連結可以取得目前系統有安裝所需要最新的.net core hosting moduler


安裝好後再去IIS的模組查有沒有AspNetCoreModuleV2的存在


重啟IIS(理論上不用),就可以用了

2023年2月4日 星期六

Xcode一直出現libGoogleAnalytics.a building for iOS Simulator, but linking in object file built for iOS無法執行compiler

 舊案子要在新的Xcode上執行總是一堆有的沒的問題,最近又遇到“libGoogleAnalytics.a(GAIUtil.o), building for iOS Simulator, but linking in object file built for iOS”,怎樣都不讓Link,用這當key找到模擬器無法執行 App 的 architecture arm64 問題,沒想到就只是打開finder,進應用程式找到Xcode,對著他按右鍵,勾選“使用Rosetta打開”,再開它就OK了,沒想到這麼簡單



參考網址:

模擬器無法執行 App 的 architecture arm64 問題

2021年11月4日 星期四

舊案一直出現 Error: objc_msgSend Calls Too many arguments to function call, expected 0, have 4

 一個很舊的案子去年改過最近重啟加新需求,去年沒事今年卻出現"Too many arguments to function call, expected 0, have 4"的Error,看了看是objc_msgSend這個造成,但看define: "objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)"也看不出來有4個,3個應該也行吧,Google了下Too many arguments to function call, expected 0, have 3中提到https://github.com/th-in-gs/THObserversAndBinders/blob/master/THObserversAndBinders/THObserver.m,根本跟有幾個參數無關,第一個先將"Apple Clang-Preprocessing"中的"Enable Strict Checking of objc_msgSend Calls"改成NO,然後在用到objc_msgSend前面要加參數的型態,如

objc_msgSend(target, action, selectedDate, origin)
改成 => ((void(*)(id, SEL, NSDate*, id))objc_msgSend)(target, action, selectedDate, origin)

這樣就能解決這error了


參考網址:

objc_msgSend()報錯Too many arguments to function call ,expected 0,have2

Too many arguments to function call, expected 0, have 3

2021年8月16日 星期一

使用Moya/RxSwift rx.request一直發生Error: Error calling

使用RxSwift時,一直出現Error: Error calling GetProfile()的錯誤訊息,GetProfile是我使用Moya做出來的enum值,查半天沒資料,後來發現拿掉disposed就正常了,發現Use the latest version of Moya/RxSwift to request the network interface to return an error message #1462有提及這狀況,不過看起來沒講什麼,似乎是這樣做會造成自我消除,記下來再觀察看看


參考網址:

Use the latest version of Moya/RxSwift to request the network interface to return an error message #1462

2021年8月3日 星期二

解決Windows Server的IE11無法下載chrome

 這幾天弄個新環境時發現用IE11點擊Chrome的下載連結怎樣都沒反應,查了半天,看到【茶包射手日記】無法下載 Chrome 的 IE才發現,被擋掉了,以前都只要去安全設定那邊處理就好,點擊了Server Manager,再找到"IE Enhanced Security Configuration"取消掉就能用了


參考網址:

【茶包射手日記】無法下載 Chrome 的 IE

2020年11月19日 星期四

解決Gradle DSL method not found: 'implementation()' 及 更換Android Studio Project的Android Gradle plugin version及Gradle Version

在想要加入新版billing library到舊專案時,一直遇到"Gradle DSL method not found: 'implementation()'"的問題,查了下看起來是Project中Gradle的版本問題, 更換方式如下:

對著app按右鍵選Open Module Settings


再點Project就可以選Android Gradle plugin version及Gradle Version


參考網址:

Gradle DSL method not found: 'implementation()'


2020年11月13日 星期五

解決Service Intent must be explicit

更改舊android專案升到api 28時,一直跳出Service Intent must be explicit,找半天解答,如:Service Intent must be explicit的解决方案或【完美解决系列】Service Intent must be explicit,都太複雜,後來看到Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview,才了解重點在Intent要設定Package字串,如,我在用的是"com.android.vending.billing.MarketBillingService.BIND",就設定intent.setPackage("com.android.vending"),這樣就OK了


參考網址:

Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview

2020年11月6日 星期五

HttpClient won't import in Android Studio

在舊專案中在build.gradle中將compileSdkVersion及targetSdkVersion改成28後,突然出現import org.apache.http.HttpResponse有error,整個都沒了,google了下發現是因為sdk 23就不再包進去了,要另外加入底下的設定

android {
    useLibrary 'org.apache.http.legacy'
}

這樣就OK囉~

參考網址:

HttpClient won't import in Android Studio

2020年10月27日 星期二

解決CI框加的Disallowed Key Characters Error

客戶發生"Disallowed Key Characters"的錯誤回覆,找了朋友及自己的,都看起來正常,本以為請客戶清cache就好,但查了下google才發現是CI本身可能有的狀況,跟cookie有關,但看起來原因實在不是太明白。

一開始找到如何解決CI框架的Disallowed Key Characters錯誤提示的寫法,但發現沒用後來找到如何解決CI框架的Disallowed Key Characters錯誤提示_PHP教程才解決,看起來差在+,有點版本上的問題,總之將

if ( ! preg_match("/^[a-z0-9:_/-]+$/i", $str))

換成

$config = &get_config('config');
if ( ! preg_match("/^[".$config['permitted_uri_chars']."]+$/i", rawurlencode($str))) 

這樣就OK了

參考網址:

如何解決CI框架的Disallowed Key Characters錯誤提示_PHP教程

2020年9月15日 星期二

解決〞Design editor is unavailable until after a successful project sync〞

將舊案從Eclipse匯入到Android studio,點選MainActivity.xml想改畫面卻一直出現底下的訊息
查了下資料,看到這篇android studio 新建一個專案,卻出現Design editor is unavailable until after a successful project sync,看起來點選File -> sync project with Gradle Files,出現Erorr:“The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.〞

找半天找到AndroidManifes.xml,查看發現有底下這句
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17"/>

將它mark掉後,再點選File -> sync project with Gradle Files,就build成功可以使用了

參考網址:

xquery用for loop取得json array的值

上傳json array,卻發現用底下的code一直變成存成單一字串

for $item in params?array
	let $new := <item>{$item}</item>
	return update insert $new into $file

查半天覺得怪,參考JSON改成

let $size := array:size($params?array)
for $index in (1 to size)
	let $new := <item>{$params?array($index)}</item>
	return update insert $new into $file

這樣就OK了,看起來似乎是無法直接使用、要再查看看


參考網址:

JSON

2020年9月6日 星期日

解決UITableView的Grouped型態的Section間會有空隙

為了讓Section不會一直停留在最上方,將UITableView的style改成UITableViewStyleGrouped。但卻發現第二個section和第一個seciont的最後一個元素隔一大段空白,查半天看到的StackOver都沒有但打勾確認,不過實際測了下Space Between Sections in UITableview的解決,如下面程式碼就能解決了,其實不能回傳0是要注意的,就直接給個比0大的值就好

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.00001f;
}


參考網址:

Space Between Sections in UITableview

2020年9月4日 星期五

iOS上架遇到出口合資訊這怪問題

上傳iOS app後,點選建置版本後,跳出回應"出口合規資訊"這樣的問題,查半天看半天大家都選否,也不是很清楚,APP TestFlight缺少出口合規資訊是寫了這是很久前的規定"很久很久之前美國政府不允許採用高強度加密的套件,必須改成弱強度的加密方式",蘋果提交版本後顯示”缺少出口合規證明“的解決辦法這邊倒是有特別寫個解法,最後選了否......再看看狀況吧


參考網址:

https://www.ptt.cc/bbs/MacDev/M.1513654588.A.92C.html

APP TestFlight缺少出口合規資訊

蘋果提交版本後顯示”缺少出口合規證明“的解決辦法

解決"ERROR ITMS-90339: "This bundle is invalid. The Info.plist contains an invalid key 'UIApplicationExitsOnSuspend' in bundle"

 上架上傳app時遇到個Error,"ERROR ITMS-90339: "This bundle is invalid. The Info.plist contains an invalid key 'UIApplicationExitsOnSuspend' in bundle XXX [XXX.app]""


看半天,看到UIApplicationExitsOnSuspend key issue. How do I fix it?有寫,對著info.plist按右鍵,點選"Show Raw Keys/Values",倒是真的出現UIApplicationExitsOnSuspend,將它拿掉就可以過了

參考網址:

UIApplicationExitsOnSuspend key issue. How do I fix it?


2020年8月14日 星期五

Xcode舊專案改用Automatic Sign發生〞Set the provisioning profile value to "Automatic" in the build settings editor, or switch to manual signing in the Signing & Capabilities editor.〞 Error

平時都是用手動指定憑證發布app,但剛好有舊案可以使用自動的,就改成自動,結果一直發生"Set the provisioning profile value to "Automatic" in the build settings editor, or switch to manual signing in the Signing & Capabilities editor.",查半天,看到升级Xcode 10后遇到的问题提到清空User defined中的PROVISIONING_PROFILE,Target及Project設定都要改。

改完後,最好是Automatically manage signing的勾選取消再勾回,選Team,重開XCode。

參考網址:

升级Xcode 10后遇到的问题

2020年8月3日 星期一

nginx設定轉址

有個網站跟客戶希望能直接轉址到別處,基本上有好幾種做法
  1. 直接php轉
  2. .htaccess寫方式轉
  3. web server(我是用nginx)轉
查了下,最後選了第三個做,直接在nginx.conf或site-enabled/default中的server內最後面加底下這行,oldpage及http://www.domain.com/newpage自行更換
rewrite ^/oldpage$ http://www.domain.com/newpage redirect;

重開機就OK了
#service nginx reload

參考網址:

2020年7月13日 星期一

IE11中使用flex + min-height做垂直置中的問題

前端的人使用bootstrap4切版,套版後覺得不好看,臨時改成有有最小高度,結果發現在IE無法垂直置中,查半天跟flex有關的資料,看到internet-explorer - 在 IE 中,css Flexbox不是垂直居中提到height要設定因為ie的bug,實際設定height設個比min-height小的值,就真的垂直置中了,真的太神奇了 @@

PS. 不確定是否全部ie版本都能用,但ie11可行。

--- 7/16 更新
傻傻的以為能用,這做法不適合高度會變動的版面

參考網址:
internet-explorer - 在 IE 中,css Flexbox不是垂直居中

2020年3月15日 星期日

Xcode 10.1編譯舊專案出現了'sqlite3_key' is invalid in C99的Error

依然是舊專案的問題,出現了'sqlite3_key' is invalid in C99的Error,查了下看到這篇sqlite3_key is invalid in C99 iOS11,看起來在iOS10是正常的,仔細想了下猜測是compiler版本問題,我的Xcode是10.1,就回到Xcode -> Preferences,點擊Locations,找到Command Line Tools,選Xcode 8.3.1,重開再compiler就OK了

參考網址:
sqlite3_key is invalid in C99 iOS11

升級到Xcode 9.3後出現Expected method to read dictionary element not found on object of type 'id'

開啟多年未開的專案想要compile時一直出現Expected method to read dictionary element not found on object of type 'id<NSFastEnumeration,NSObject>'的錯誤訊息,仔細查看,是PromiseKit這個library在xcode 9.3後會有的問題,查半天都是講用cocoapods升級PromiseKit到1.7.2就OK了,打下pod update後,又出現其他專案的Error,仔細一看發現一個根本不能update的Library,問題最後只能是直接解決這error,反過來想,只好去查看這Framework針對這issue的commit,最後找到Fix build on Xcode 9.3,修改如下



有種怎沒想到這樣改的蠢想法,不過又有種這像是workaround的感覺!!

參考網址:
Objective C- Xcode 9.3 - Expected method to read dictionary element not found on object of type
Fix build on Xcode 9.3

2020年1月30日 星期四

Laravel指定版本建立專案

Laravel的版本更新蠻快的,但主機的PHP常都在舊些的版本,例如沒指定版本都用到Laravel framework 6.X及PHP 7.2,但我還在用PHP 7.1,最新支援版本是5.8.35,所以在建立是要用以下的指令,demo是專案名,這樣即可。這邊做個筆記。

composer create-project laravel/laravel=5.8.* demo

參考網址:
Installing specific laravel version with composer create-project