我在我的Ionic 2应用程序中使用cordova-plugin-camera.我可以成功拍摄照片,然后提醒selfieImage的值 - 这显示了我的数据:image/jpeg; base64,然后是我的图像的base64编码版本 - 很棒
takeRegistrationSelfie() {
Camera.getPicture({
destinationType: Camera.DestinationType.DATA_URL,
targetWidth: 1000,
targetHeight: 1000,
correctOrientation: true,
cameraDirection: 1
}).then((imageData) => {
// imageData is a base64 encoded string
this.selfieImage = "data:image/jpeg;base64," + imageData;
}, (err) => {
console.log(err);
});
}
Run Code Online (Sandbox Code Playgroud)
在我的模板中,我有
<img [src]="selfieImage" *ngIf="selfieImage" />
Run Code Online (Sandbox Code Playgroud)
此时定义了selfieImage,但我的图像是空的 - 10 x 10像素,灰色边框,没有图像.
稍后在我的应用程序中,我将带有图像的ajax请求发送到我的后端 - 这样工作正常,图像被正确接收.
为什么图像不会显示在我的模板中?
在Julia中,我想将定义为2D数组的Vector的数据转换为Matrix的2D数组.如下例所示,我想将数据转换为数据t,但到目前为止我还没有成功.我该如何处理此案?
julia> s = [[1 2 3], [4 5 6], [7 8 9]]
3-element Array{Array{Int64,2},1}:
[1 2 3]
[4 5 6]
[7 8 9]
julia> t = [[1 2 3]; [4 5 6]; [7 8 9]]
3××3 Array{Int64,2}:
1 2 3
4 5 6
7 8 9
julia> s |> typeof
Array{Array{Int64,2},1}
julia> t |> typeof
Array{Int64,2}
julia> convert(Array{Int64, 2}, s)
ERROR: MethodError: Cannot `convert` an object of type Array{Array{Int64,2},1} to an object of type Array{Int64,2}
This may have arisen …Run Code Online (Sandbox Code Playgroud) int[] iBuf = new int[2];
iBuf[0] = 1;
iBuf[1] = 2;
short[] sBuf = new short[2];
Buffer.BlockCopy(iBuf, 0, sBuf, 0, 2);
result
iBuf[0] = 1
sBuf[0] = 1
iBuf[1] = 2
sBuf[1] = 0
My desired result
iBuf[0] = 1
sBuf[0] = 1
iBuf[1] = 2
sBuf[1] = 2
Run Code Online (Sandbox Code Playgroud)
结果与我想要的不同.
有没有使用循环转换的方法?
如何将字符串形式的分数转换为数值?
strFrac = "3/2"
Run Code Online (Sandbox Code Playgroud)
目前通过拆分字符串来获取分子和分母。
Dim x() As String
x = Split(strFrac, "/")
Run Code Online (Sandbox Code Playgroud)
然后使用Val()和划分。
v = Val(x(0)) / Val(x(1))
Run Code Online (Sandbox Code Playgroud)
结果:v = 1.5
有没有更直接的方法?Val("3/2")如果类似的东西能起作用就好了。
有什么区别
document.getElementById("id").click();
Run Code Online (Sandbox Code Playgroud)
和
document.getElementById("id").onclick();
Run Code Online (Sandbox Code Playgroud)
?
在这个主要方法:
package practice;
public class PersonTest {
public static void main(String[] args)
{
Person[] people = new Person[2];
people[0] = new Person();
people[1] = new Employee();
System.out.println(people[1].job);
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用作业时遇到编译器错误.任何人都可以告诉我为什么,以及它应该怎么做?以下是我为上述方法创建的类:
Person类:
package practice;
public class Person{
String name;
int age;
public Person () {
this.name = "undefined";
this.age = 0;
}
}
Run Code Online (Sandbox Code Playgroud)
和Employee类:
package practice;
public class Employee extends Person{
String job;
Employee () {
super();
this.job = "job";
}
}
Run Code Online (Sandbox Code Playgroud) 无法导航:找不到TabsPage的组件工厂.你有没有把它添加到@ NgModule.entryComponents?
app.module.ts
@NgModule({
declarations: [
MyApp,
FormModal,
PreviewModal,
],
imports: [
BrowserModule,
HttpModule,
JsonpModule,
CommonModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [
Router,
StatusBar,
SplashScreen,
ApiService,
Toast,
Loading,
Alert,
UserService,
ChangeTitle,
ParseLogin,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
app.component.ts
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = "TabsPage";
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,router:Router) {
router.setVersion('1.0',10000);
router.load(Routes);
Event.subscribe('push',(ev,data)=>{
document.title =Routes[data.toPage.name].title;
var i = document.createElement('iframe');
i.src = 'blank.html';
i.style.display …Run Code Online (Sandbox Code Playgroud) 我正在学习 Ionic 应用程序。我接触到了 Grid 的东西,但是,我一直坚持删除/修改行之间的空格(第 2 行和第 3 行),如下面的屏幕截图所示:
我的 HTML 中有以下代码:
<ion-content padding>
<ion-row>
<ion-label> I am good I do not want any space.</ion-label>
</ion-row>
<ion-row>
<div >
<div class="inner">
<ion-label *ngIf="!inverse" no-margin>1 USD = 67 INR</ion-label>
<ion-label *ngIf="inverse" no-margin>1 INR = {{(1/67) | number }} USD </ion-label>
</div>
<button (click)="inverse=!inverse" ion-button clear class="iconWidth" color="dark"> <ion-icon name="swap" class="rotate"></ion-icon></button>
</div>
</ion-row>
<ion-row>
<p>Can you help me to get rid of space between this row and above</p>
<ion-label> Thanks</ion-label>
</ion-row>
</ion-content> …Run Code Online (Sandbox Code Playgroud) Activating extension 'ms-python.python' failed: command 'python.viewOutput' already exists.
workbench.desktop.main.js:2350 Cannot activate the 'Pylance' extension because its dependency 'Python' failed to activate
Run Code Online (Sandbox Code Playgroud)
我尝试使用 vscode 编辑 python 文件,它显示扩展激活失败
我通过了一门关于 Node.js 和 Angular 的学习课程。那里的老师在package.json中使用了
很多星号而不是特定版本的库。
"dependencies": {
"bcrypt": "*",
"bcryptjs": "^2.4.3",
"body-parser": "*",
"cors": "*",
"express": "*",
"jsonwebtoken": "*",
"mongoose": "*",
"morgan": "^1.10.0",
"passport": "*",
"passport-jwt": "*"
},
"devDependencies": {
"nodemon": "^2.0.7"
}
Run Code Online (Sandbox Code Playgroud)
使用它们是好是坏?
angular ×3
arrays ×3
ionic2 ×2
javascript ×2
c# ×1
click ×1
cordova ×1
css ×1
html ×1
inheritance ×1
ionic3 ×1
java ×1
julia ×1
lazy-loading ×1
matrix ×1
npm ×1
package.json ×1
python ×1
typescript ×1
vba ×1
version ×1