db.products.insertOne({ name: 'Product 1', price: 200 })db.products.insertMany([{ name: 'Product 1', price: 200 }, { name: 'Product 2', price: 100 }])| import CoreData | |
| import UIKit | |
| // ./NoteList.xcdatamodeld | |
| class CoreDataManager { | |
| static let sharedInstance = CoreDataManager() | |
| private init() { } |
| extension Binding where Value == Double { | |
| /// Returns a new version of the binding that scales the value logarithmically using the specified base. That is, | |
| /// when getting the value, `log_b(value)` is returned; when setting it, the new value is `pow(base, newValue)`. | |
| /// | |
| /// - Parameter base: The base to use. | |
| func logarithmic(base: Double = 10) -> Binding<Double> { | |
| Binding( | |
| get: { | |
| log10(self.wrappedValue) / log10(base) | |
| }, |
| import Foundation | |
| import SwiftUI | |
| struct FormattedTextFieldView : View { | |
| @State private var double = 0.5 | |
| @State private var nsNumber: NSNumber = 0.5 | |
| static let numberFormatter: NumberFormatter = { |
| import Foundation | |
| struct AnyError: Error { | |
| let error: Error | |
| init(_ error: Error) { | |
| self.error = error | |
| } | |
| } |
| import Foundation | |
| extension Date { | |
| typealias FormattedString = (DateFormatter) -> String | |
| func formatted(by format: String) -> FormattedString { | |
| return { formatter in | |
| formatter.dateFormat = format | |
| return formatter.string(from: self) | |
| } |
| enum APIError: Error, LocalizedError { | |
| case unknown, apiError(reason: String), parserError(reason: String) | |
| var errorDescription: String? { | |
| switch self { | |
| case .unknown: | |
| return "Unknown error" | |
| case .apiError(let reason), .parserError(let reason): | |
| return reason | |
| } |
| // | |
| // ContentView.swift | |
| // Shared | |
| // | |
| // Created by Costantino Pistagna on 25/03/21. | |
| // | |
| import SwiftUI | |
| struct ContentView: View { |
| --ReOrg and RunStat for IBM DB2 | |
| --All Programs > IBM DB2 > DB2COPY1 (Default) > Command Line Tools > Command Window - Administrator | |
| -- Connect to Database | |
| db2 connect to <DATABASE NAME> | |
| -- Generate output for RunStat on Tables | |
| db2 -x "SELECT 'RUNSTATS ON TABLE ' || TRIM(TABSCHEMA) || '.' || TRIM(TABNAME) || ' AND INDEXES ALL;' FROM SYSCAT.TABLES WHERE TYPE = 'T' AND TABSCHEMA NOT LIKE 'SYS%' ORDER BY TABSCHEMA, TABNAME" > db2_runstats.sql.out | |
| -- Use the genereated file for RunStat on Tables. | |
| db2 -tvf db2_runstats.sql.out |
| using System; | |
| using System.IO; | |
| using DevExpress.Utils; | |
| using DevExpress.XtraGrid; | |
| using DevExpress.ExpressApp; | |
| using System.ComponentModel; | |
| using DevExpress.ExpressApp.Model; | |
| using DevExpress.Utils.Serializing; | |
| using DevExpress.ExpressApp.Win.Editors; |