攝影師:Pixabay |
為了增加百貨公司品牌爬蟲的內容, 近期開始研究台北 101 網站,找到這裡可以看到全部的品牌,把這些都爬出來就行了
先找出正確的 element
從下圖可看出,這些品牌存在於 "listarea logo" class 下面的 "cardobj lazyload show" class 中
攝影師:Pixabay |
為了增加百貨公司品牌爬蟲的內容, 近期開始研究台北 101 網站,找到這裡可以看到全部的品牌,把這些都爬出來就行了
從下圖可看出,這些品牌存在於 "listarea logo" class 下面的 "cardobj lazyload show" class 中
攝影師:Walls.io |
2023 年使用了定期定額+再平衡的操作,今年用市值來看績效比較單純,市值增加 62.5%,若不計算入金也就是純投資的部份,市值增加 51%,表現超越台美股大盤(台股大盤 24%、NASDAQ 43%),記得去年投資回顧有提到,大盤投報好的時候,我的投報可能會落後,看來打破了這個預期;既然時間用的少,大盤好與壞時的績效都還可以接受,那就繼續這麼做下去吧。
重點數字
市值增加:62.5%
市值(不含入金)增加:51%
平均現金水位:11.7%
台股大盤投報:24%
NASDAQ 投報:43%
2024 年的策略:定期定額 + 再平衡
定期定額:每個月操作一次,輪流投入每個標的,當標的歷史價格低於十年前太多時,當次投入兩倍
再平衡:每半年將投報超過 20% 或平均的標的,賣出賺錢的部份
2024 年標的
006208、00878、5880 合庫金、2412 中華電、QQQ、ARKW、AAPL、TSLA
2023 年市值變化圖
非常歡迎您使用百貨小工具,為了讓您安心使用百貨小工具的各項服務,特此向您說明百貨小工具的隱私權保護政策,以保障您的權益,請您詳閱下列內容:
Error message |
升級到 iOS 17 後,也得升級到 Xcode 15 才能使用了,但原本的 project 卻無法 build 了,遇到的就是上圖的 error,以下是解決方法
Reference
Photo by Ketut Subiyanto |
簡單記錄一下實作搜尋建議的方法,完整的程式在下方
struct ContentView: View {
@State private var searchText = ""
@State private var selectedSuggestion = ""
// 建議列表
@State private var suggestions: [String] = ["Apple 蘋果", "ALLSAINTS", "BOTTEGA VENETA", "COSME DECORTE 黛珂", "Nike 耐吉", "Dell 戴爾", "COS", "Zara", "Emilie Louis", "L.ERICKSON", "SPRAYGROUND", "gubami Social-法式tapas餐廳", "Sarabeth's"]
@State private var showSuggestions = false
var body: some View {
VStack {
// 搜尋欄位
TextField("Search", text: $searchText)
.padding(.horizontal, 15)
.padding(.vertical, 10)
.background(Color(.systemGray6))
.cornerRadius(8)
.padding(.top, 10)
.padding(.bottom, 5)
.onChange(of: searchText) { newValue in
showSuggestions = !newValue.isEmpty
}
// 選擇搜尋建議後的顯示
if !selectedSuggestion.isEmpty {
Text("Selected: \(selectedSuggestion)")
.padding(.top, 10)
}
if showSuggestions {
List {
ForEach(filteredSuggestions, id: \.self) { suggestion in
Text(suggestion)
.onTapGesture {
selectedSuggestion = suggestion
searchText = "" // 清空 TextField
showSuggestions = false // 隱藏建議列表
}
}
if filteredSuggestions.isEmpty {
Text("找不到品牌")
.foregroundColor(.gray)
}
}
.background(Color.white)
.cornerRadius(8)
.shadow(radius: 5)
.padding()
}
Spacer() // 添加一個間距,以便頁面內容和建議列表不重疊
}
.padding()
var filteredSuggestions: [String] {
if searchText.isEmpty {
return []
}
return suggestions.filter({ $0.localizedCaseInsensitiveContains(searchText) })
}
}
}
Photo by Ketut Subiyanto |
我在整合 Google AdMob 時卡了超久,Google 了也沒找到很直接能解決的方法,想說在此做個記錄,讓以後的我能照著做,也讓遇到類似問題的人能夠有個解法,以下是參考 官方說明 做的
第一動,Import the Mobile Ads SDK
先在 xocde project 的根目錄下(.xcodeproj 檔案的路徑)執行 pod init,這樣就能產生一個 Podfile 檔案,若沒安裝 cocopods 可以 follow 這裡 安裝,然後再按照 這裡 的做法,加
pod 'Google-Mobile-Ads-SDK'
在 Podfile 檔案,然後執行下面,記得此時要將 xcode 關閉
pod install --repo-update
這邊我遇到一個問題
[!] Unable to determine the platform for the `your project name` target.
解決方法是將 Podfile 檔案裡的第二行 uncomment 就可以了,完成後如下
platform :ios, '9.0'
第二動,Update your Info.plist
遇到的第一個問題是,我找不到 Info.plist 檔案
參考 這邊,原來 info.plist 變成了 project 設定裡的 tab
然後將 GADApplicationIdentifier (1個) 和 SKAdNetworkItems (49個) 輸入(如下圖紅框)
import GoogleMobileAds struct BannerVC: UIViewControllerRepresentable { var bannerID: String var width: CGFloat func makeUIViewController(context: Context) -> UIViewController { let view = GADBannerView(adSize: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width)) let viewController = UIViewController() view.adUnitID = bannerID view.rootViewController = viewController viewController.view.addSubview(view) #if false /* Simulator */ let request = GADRequest() let extras = GADExtras() extras.additionalParameters = ["suppress_test_label": "1"] request.register(extras) view.load(request) #else /* Real device */ view.load(GADRequest()) #endif return viewController } func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} } struct Banner: View { var bannerID: String var width: CGFloat var size: CGSize { return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width).size } var body: some View { BannerVC(bannerID: bannerID, width: width) .frame(width: size.width, height: size.height) } }
struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) Text("Hello, world!") } .padding() Banner(bannerID: "ca-app-pub-3940256099942544/2934735716", width: UIScreen.main.bounds.width) } }
實作方式如上,這邊用的 bannerID 是測試使用的,請參考這邊,順利的話就可以看到下面的畫面
Simulator
Photo by ThisIsEngineering |
記錄一下使用 scrapy 遇到的一些問題
問題:
用 browser 打開這個網頁明明就能看到畫面,但使用下面方法後
scrapy shell https://info.sogo.com.tw/tp1/floors/B2
view(response)
卻只能看到下面錯誤
處理方式:
在 settings.py 裡找到 USER_AGENT 設定,將一個正確的 user agent 填入即可,這邊我是參考 chrome 的 user agent 填入(如下)
<div class="tab-content">
...
<a href="xxxx" class="brandBox">...</a>