Lập trình

Q & A cho các lập trình viên chuyên nghiệp và đam mê

12
Các lớp tĩnh TypeScript
Tôi muốn chuyển sang TypeScript từ JS truyền thống vì tôi thích cú pháp giống C #. Vấn đề của tôi là tôi không thể tìm ra cách khai báo các lớp tĩnh trong TypeScript. Trong C #, tôi thường sử dụng các lớp tĩnh để tổ chức các biến …

13
Làm cách nào để kiểm tra kích thước của tệp bằng Bash?
Tôi đã có một tập lệnh kiểm tra kích thước 0, nhưng tôi nghĩ rằng phải có một cách dễ dàng hơn để kiểm tra kích thước tệp thay thế. Tức file.txtlà bình thường 100k; làm thế nào để tạo một kịch bản kiểm tra nếu nó nhỏ hơn 90k …
145 bash 


7
android.content.res.Resource $ NotFoundException: ID tài nguyên chuỗi # 0x0
Tôi đang phát triển một ứng dụng Android đọc dữ liệu từ cơ sở dữ liệu MySQL và tôi đã gặp phải lỗi này. Tôi có bố cục XML này: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/wardNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3dp" android:text="Ward Number" android:textSize="22dp"/> <TextView android:id="@+id/dateTime" android:layout_width="wrap_content" …
145 java  android  xml  listview 

8
Cách tạo buildConfigField với kiểu String
Trong Android Studiodự án của tôi có hai build configurationvới một số buildConfigField: buildTypes { def SERVER_URL = "SERVER_URL" def APP_VERSION = "APP_VERSION" debug { buildConfigField "String", SERVER_URL, "http://dev.myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" } release { buildConfigField "String", SERVER_URL, "https://myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } …


12
Làm cách nào để nâng cao Ngoại lệ tương tự với thông báo tùy chỉnh trong Python?
Tôi có trykhối này trong mã của tôi: try: do_something_that_might_raise_an_exception() except ValueError as err: errmsg = 'My custom error message.' raise ValueError(errmsg) Nói đúng ra, tôi thực sự đang nuôi một người khác ValueError , không phải người ValueErrorbị ném do_something...(), được gọi là errtrong trường hợp này. Làm cách …





15
Lỗi Node.js: Không thể tìm thấy mô-đun express
Tôi đã viết ứng dụng node.js đầu tiên của mình, nhưng nó không thể tìm thấy thư viện express: C:\ChatServer\Server>node server.js module.js:340 throw err; ^ Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (C:\ChatServer\Server\server.js:6:9) at Object.<anonymous> (C:\ChatServer\Server\server.js:25:4) at Module._compile …
145 node.js  express  npm 


7
pytest: khẳng định gần như bằng nhau
Cách thực hiện assert almost equalvới py.test cho phao mà không cần dùng đến một cái gì đó như: assert x - 0.00001 <= y <= x + 0.00001 Cụ thể hơn sẽ hữu ích khi biết một giải pháp gọn gàng để nhanh chóng so sánh các cặp float …

6
Làm thế nào để xóa (không cắt) trong Vim?
Làm thế nào tôi có thể xóa một dòng mà không đặt nó vào bộ đệm mặc định của tôi? Thí dụ: line that will be copied. line that I want to be substitued with the previous one. Những gì tôi đang cố gắng làm: yy dd p Nhưng Vim …
145 vim  copy-paste 

Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.