Code Monkey home page Code Monkey logo

blog's Introduction

blog's People

Watchers

 avatar  avatar

blog's Issues

swift

swift

  • 不需要main()函数做入口。
  • let for const, var for let, 跟js不同

显示转换/隐示转换

  • swift只有显示转换
  • value to string:
let apple = 2
let appleSummary = "I have \(apple) apples."
  • make null array, dict, let emptyArray = [String]() and let emptyDict = [String:Float]()

for loop

  • there is for-in, for, while, repeat-while

if-switch

  • if后必须是一个bool表达式

force unwrap

https://www.mokacoding.com/blog/impliticly-vs-force-unwrapping-swift-optionals/

Function

func greet(person: String) -> String{
  let greeting = "Hello, " + person + "!"
  return greeting
}

Closure闭包

https://www.zhihu.com/search?type=content&q=js%20%E9%97%AD%E5%8C%85

UIButton state

Swift foundation

protocol

private(set)


ERROR

swift-4

Error

  • fatal error: Unexpectedly found nil while unwrapping an Optional value
    未登录identifier, 登陆identifier

emit-on

https://qiita.com/gitseitanaka/items/d708f3c955cbf8b2158f

  • EventEmitter

Electron

  • server: nodejs, front: chromium
  • use HTML css, js to develop desktop application

monaco editor

use delete in JS

delete nameUsed[priviousNameIndex]

swift static initialize

static var initialYear: Int { return 1600 }

swift optional

swift mutating

  • method for struct, enum

delegate example

https://www.jianshu.com/p/c65f13683001

binding

  • for reactive application or service

sql

sql

erd

ddl

question

sqlの内部実行順序

cte使い方, subqueryとの違い

golang

method

func (b box) getSize() int{
  return b.length * b.width
}
// with pointer as receiver 
func (b *box) getSize() int{
  return b.length * b.width
}
  • why use pointer as receiver, cause you wanna change the value

ctf

  • skip <script> but <img src="123" onClick = "alert(1)"> cant ?
  • ' make sql error

npm

use of old version of npm

https://askubuntu.com/questions/1036278/npm-is-incorrect-version-on-latest-ubuntu-18-04-installation

link

ln -s /usr/local/bin/npm /usr/bin/npm

wsl file cannot edit by vscode

  • microsoft/vscode#17860
  • 由于用vue-cli或者其他脚手架生成的文件默认为root, 需要chrown来改成普通用户才能access

file permission of linux system

vue client generate file, permission error

  • unsolved

golang package management

  • "github.com/woshahua" 全局path导入有效
  • 导入 math/rand, can/rand 这类,需要在使用是用 crand can/rand 来区别。
  • 如果文件中有go可执行文件 package名需要为main

babel for vue

  • unsolved

set chrome headless

express cannot use html

eslint recommand setting cant use console.log

socketio broadcast.to.("room")

  • 发送给除了自己以外的人

jquery focus

swift-3

tableView ???

  • dequeueReuseable
  • didSelectRowAt
  • identifier for tableView

newItem is a label

 func add(newItem item: ToDoItem) {
        items.append(item)
    }

get, set ??

swift _ in

tableView 滑动

web hook

segment fault

typescript

类型

var counter;  // any type
var counter = 0; // number type, 推断
var counter: number; // number type
var counter: number = 0;
  • null和undefined不能被当作类型使用.
  • var作用域, let, const块作用域(常量)

联合类型

  • var path: string[] | string;

类型守护

  • like guard in swift
  • use typeof and instanceof

next ---javascript

swift-2

swift struct/class

  • struct pass value, class pass pointer
  • for array you can do
var a = [Int]()
a = [0]
a += [1, 2]  // a = [0,1,2]

弹出框

  • UIAlertController

cocoapods

use MARK

//MARK: - Networking
/************************

//MARK: - JSON parsing
/************************

delegate委托

locationManager.delegate = self

info.list setting

<?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">
<plist version="1.0">
<dict>
	<key>NSLocationUsageDescription</key>
	<string>为了获取气象信息需要定位你当前的位置。</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>为了获取气象信息需要定位你当前的位置。</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>openweathermap.org</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
</dict>
</plist>

closure swift

  • 在闭包函数中一定要使用self来带入函数。

.double >

  • 转换为double值

intValue, StringValue, int, string

pwa

@objc

  • why this timer selector need objc
timer = Timer.scheduledTimer(timeInterval: 1, target: self,   selector: (#selector(ViewController.updateTimer)), userInfo: nil, repeats: true)

visual code 开发

函数式编程|kotlin

api gateway

golang snippet vscode

缓存区溢出攻击

glide not show image

kotlin standard library usage

companion object

destroy{ view = nll} why we need this.

how to read file from asset android kotlin

kotlin lambda should be moved out of parenthesses

-https://www.reddit.com/r/Kotlin/comments/8x199t/intellij_lambda_argument_should_be_moved_out_of/

文件

  • 文件就是字节序列,每个I/O设备,键盘,磁盘,甚至网络都可以看成是这样。系统中所有输入输出都是通过一小组成为Unix I/O的系统函数调用读写文件来实现的

clousure

relogin terminal

  • exec $SHELL -l

kotlin::class java

  • class in kotlin stands for java class

null 安全

kotlin class need init ???

RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView

hash -r

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.