Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
monitorNetwork()
}
func monitorNetwork(){
let monitor = NWPathMonitor()
monitor.pathUpdateHandler = {
path in
if path.status == .satisfied{
DispatchQueue.main.async {
self.webview.navigationDelegate = self
let urlString = URL(string: "http://subdomain1.mywebsite.com.vn")
let request = URLRequest(url: urlString!)
self.webview.load(request)
}
}else{
DispatchQueue.main.async {
self.Alert(Message: "Thiết bị không kết nối mạng")
}
}
}
let queue = DispatchQueue(label: "Network")
monitor.start(queue: queue)
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
monitorNetwork()
}
func monitorNetwork(){
let monitor = NWPathMonitor()
monitor.pathUpdateHandler = {
path in
if path.status == .satisfied{
DispatchQueue.main.async {
self.webview.navigationDelegate = self
let urlString = URL(string: "http://subdomain1.mywebsite.com.vn")
let request = URLRequest(url: urlString!)
self.webview.load(request)
}
}else{
DispatchQueue.main.async {
self.Alert(Message: "Thiết bị không kết nối mạng")
}
}
}
let queue = DispatchQueue(label: "Network")
monitor.start(queue: queue)
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ!
Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm.
Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình.
Như sau ạ:
import UIKit
import WebKit
import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
monitorNetwork()
}
func monitorNetwork(){
let monitor = NWPathMonitor()
monitor.pathUpdateHandler = {
path in
if path.status == .satisfied{
DispatchQueue.main.async {
self.webview.navigationDelegate = self
let urlString = URL(string: "http://subdomain1.mywebsite.com.vn")
let request = URLRequest(url: urlString!)
self.webview.load(request)
}
}else{
DispatchQueue.main.async {
self.Alert(Message: "Thiết bị không kết nối mạng")
}
}
}
let queue = DispatchQueue(label: "Network")
monitor.start(queue: queue)
}
func Alert (Message: String){
let alert = UIAlertController(title: "Thông báo", message: Message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Đồng ý", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
if url.absoluteString.hasSuffix(".pdf") || url.absoluteString.hasSuffix(".doc") ||
url.absoluteString.hasSuffix(".docx") || url.absoluteString.hasSuffix(".xls") ||
url.absoluteString.hasSuffix(".xlsx") || url.absoluteString.hasSuffix(".jpg") || url.absoluteString.hasSuffix(".jpeg") || url.absoluteString.hasSuffix(".png") || url.absoluteString.hasSuffix(".ppt") || url.absoluteString.hasSuffix(".pptx") {
// let fileURL : String = url.absoluteString;
let downloadTask = URLSession.shared.downloadTask(with: url) {
urlOrNil, responseOrNil, errorOrNil in
// check for and handle errors:
// * errorOrNil should be nil
// * responseOrNil should be an HTTPURLResponse with statusCode in 200..<299
guard let fileURL = urlOrNil else { return }
do {
let documentsURL = try
FileManager.default.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: false)
let savedURL = documentsURL.appendingPathComponent(fileURL.lastPathComponent)
try FileManager.default.moveItem(at: fileURL, to: savedURL)
} catch {
print ("file error: \(error)")
}
}
downloadTask.resume()
/* URLSession.shared.downloadTask(with: url, completionHandler: { (tempURL, response, error) in
print("finished fetching \(url.absoluteString)")
}).resume()
*/
/* DispatchQueue.main.async {
let url = URL(string: fileURL)
let pdfData = try? Data.init(contentsOf: url!)
let resDocPath = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last!) as URL
let pdfFileName = "\(UUID().uuidString).jpg"
let filePath = resDocPath.appendingPathComponent(pdfFileName)
// Save to File
do {
try pdfData?.write(to: filePath,options: .atomic)
print("File Saved")
} catch {
print("Some Error in code")
}
}
*/
decisionHandler(.cancel)
return
}
}
decisionHandler(.allow)
}
func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) {
download.delegate = self;
}
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
if navigationResponse.canShowMIMEType {
decisionHandler(.allow)
} else {
decisionHandler(.download)
}
}
// Download Delegate (to allow downloading PDF)
func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL? {
let urls = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask)
// for Japanese names.
let name = suggestedFilename.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "cannotencode"
return URL(string: name, relativeTo: urls[0])
}
}
Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Sau khi chạy hệ thống báo lỗi như sau:
App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ.
NHỜ ANH CHỈ RÙM EM VỚI Ạ.
Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Đây là những khó khăn mình từng gặp khi làm việc với DynamoDB. Nếu có điểm nào chưa đúng hoặc cần bổ sung, rất mong mọi người góp ý và cùng chia sẻ thêm giải pháp để hoàn thiện hơn nhé! 🙇
Atomic operation chủ yếu phù hợp với các tác vụ đơn giản, nó không phù hợp với yêu cầu phức tạp với nhiều điều kiện đi kèm => bạn cho mình ví dụ phức tạp như thế nào là ko dùng đc cái này đc ko ?
THẢO LUẬN
https://www.virustotal.com/gui/file/7302d76b37f70e58894605707160c9d0376ad5ac8c51e893a9abdb85f561f18c
Phân biệt 2 khái niệm Standalone Consumer và Single Consumer Group
"ngoại trừ việc không hỗ trợ hệ điều hành Windows" sài Window và lặng lẽ đi ra
vì vậy mới thấy được sự chênh lệch của cloudflare nhé bạn 😅
@caonhanqd quá dữ 👍️
2025 - Các bạn phải đọc docs và cài thêm thư viên Daphne thì mới triển khai được asgi mới chạy được websocket
https://dev.to/codewithshahan/how-to-write-clean-code-tips-for-developers-with-examples-25ic lấy content của người khác thì ít nhất cũng phải để lại nguồn chứ bạn
Các bác khi clone plugin zsh-autosuggestions thì clone bằng https, chứ đừng clone bằng ssh nhé:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
bạn gõ câu lệnh mysql_secure_installation chưa. Nếu chưa gõ câu lệnh này rồi setup pass nhé
đam mê viết blog e ạ 🤣🤣
Uầy xịn, sao anh cân bằng được giữa việc làm ở công ty với viết blog vậy ạ, bài nào cũng chất nữa chứ
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView! override func viewDidLoad() { super.viewDidLoad()
} func monitorNetwork(){ let monitor = NWPathMonitor() monitor.pathUpdateHandler = { path in if path.status == .satisfied{ DispatchQueue.main.async { self.webview.navigationDelegate = self let urlString = URL(string: "http://subdomain1.mywebsite.com.vn") let request = URLRequest(url: urlString!) self.webview.load(request) } }else{ DispatchQueue.main.async { self.Alert(Message: "Thiết bị không kết nối mạng") }
}
func Alert (Message: String){
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
}
func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) { download.delegate = self; }
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { if navigationResponse.canShowMIMEType { decisionHandler(.allow) } else { decisionHandler(.download) } }
// Download Delegate (to allow downloading PDF) func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL? { let urls = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask) // for Japanese names. let name = suggestedFilename.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "cannotencode" return URL(string: name, relativeTo: urls[0]) }
} Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><dict> <key>CFBundleGetInfoString</key> <string></string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSExceptionDomains</key> <dict> <key>http://subdomain1.mywebsite.com.vn</key> <string></string> </dict> </dict> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> </dict>
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView! override func viewDidLoad() { super.viewDidLoad()
} func monitorNetwork(){ let monitor = NWPathMonitor() monitor.pathUpdateHandler = { path in if path.status == .satisfied{ DispatchQueue.main.async { self.webview.navigationDelegate = self let urlString = URL(string: "http://subdomain1.mywebsite.com.vn") let request = URLRequest(url: urlString!) self.webview.load(request) } }else{ DispatchQueue.main.async { self.Alert(Message: "Thiết bị không kết nối mạng") }
}
func Alert (Message: String){
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
}
func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) { download.delegate = self; }
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { if navigationResponse.canShowMIMEType { decisionHandler(.allow) } else { decisionHandler(.download) } }
// Download Delegate (to allow downloading PDF) func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL? { let urls = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask) // for Japanese names. let name = suggestedFilename.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "cannotencode" return URL(string: name, relativeTo: urls[0]) }
} Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><dict> <key>CFBundleGetInfoString</key> <string></string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSExceptionDomains</key> <dict> <key>http://subdomain1.mywebsite.com.vn</key> <string></string> </dict> </dict> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> </dict>
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
} Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><dict> <key>CFBundleGetInfoString</key> <string></string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSExceptionDomains</key> <dict> <key>http://subdomain1.mywebsite.com.vn</key> <string></string> </dict> </dict> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> </dict>
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Đây là những khó khăn mình từng gặp khi làm việc với DynamoDB. Nếu có điểm nào chưa đúng hoặc cần bổ sung, rất mong mọi người góp ý và cùng chia sẻ thêm giải pháp để hoàn thiện hơn nhé! 🙇
GORM nó chỉ nhận là orm library, bác lại ném nó thành framework bài viết cũng lấy từ nguồn https://dev.to/empiree/top-5-popular-frameworks-and-libraries-for-go-in-2024-c6n 2024 chỉnh lại thành 2025, ảo thật
Bạn dịch khó hiểu qúa. Ví dụ với cách diễn đạt sơ sài quá
Atomic operation chủ yếu phù hợp với các tác vụ đơn giản, nó không phù hợp với yêu cầu phức tạp với nhiều điều kiện đi kèm => bạn cho mình ví dụ phức tạp như thế nào là ko dùng đc cái này đc ko ?
sợ chỉ là cảm giác thôi e
)
có bác nào làm module gửi link forgot password khi user yêu cầu chưa ạ, cho em xin bài hướng dẫn