我正在研究加密MD5,我在谷歌找到了这个代码
public string CalculateMD5Hash(string input)
{
// Primeiro passo, calcular o MD5 hash a partir da string
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
// Segundo passo, converter o array de bytes em uma string haxadecimal
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
Run Code Online (Sandbox Code Playgroud)
但为什么它使用ToString("X2")?ToString正常有什么区别?
在我的数据库(MySQL的)表中,有一列1
,并0
为代表true
和false
分别.
但在SELECT
,我需要替换true
或false
在GridView中打印.
如何让我的SELECT
查询这样做?
在我目前的表格中:
id | name | hide
1 | Paul | 1
2 | John | 0
3 | Jessica | 1
Run Code Online (Sandbox Code Playgroud)
我需要它显示:
id | name | hide
1 | Paul | true
2 | John | false
3 | Jessica | true
Run Code Online (Sandbox Code Playgroud) 我需要使用React Router
一个Laravel
项目.
但是当我创建路由器React Router
并尝试访问时,Laravel
指责Route not exists错误.
如何使用React Router
经理Laravel项目路线?
render((
<Router history={browserHistory}>
<Route path="/" component={App}/>
<Route path="/profile" component={Profile}/> // this route I trying access
</Router>
), document.getElementById('root'));
Run Code Online (Sandbox Code Playgroud) 我尝试在EF中进行测试,创建多对多的关系,因为我总是将One映射到One或One to Many,我已经在互联网上试了一个例子,这个例子适用于插入寄存器,但我无法读取寄存器
这是我的课程,我不知道是什么HashSet
,我在网站上得到了这个代码
public class Person
{
public int PersonId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public ICollection<Course> CoursesAttending { get; set; }
public Person()
{
CoursesAttending = new HashSet<Course>();
}
}
public class Course
{
public int CourseId { get; set; }
public string Title { get; set; }
public ICollection<Person> Students { get; set; }
public Course()
{
Students = new HashSet<Person>();
} …
Run Code Online (Sandbox Code Playgroud) 我react-router
在我的申请中使用.
在我的登录页面中,我需要身份验证,ajax
如果成功则需要重定向.
有些人喜欢以下代码:
class PageLogin extends React.Component {
login() {
// How to can I redirect to another page if auth success?
}
render() {
return (
<div className="login-page">
<form action="">
<div className="form-group">
<label>Username:</label>
<input type="text"/>
</div>
<div className="form-group">
<label>Password:</label>
<input type="text"/>
</div>
<div>
<button onClick={this.login}>Login</button>
</div>
</form>
</div>
)
}
}
Run Code Online (Sandbox Code Playgroud)
在我的login
功能中,如果身份验证成功,如何重定向到另一个页面?
我正在使用测试我的应用程序Jest
,但出现了如下错误:
SyntaxError: Unexpected token }
Run Code Online (Sandbox Code Playgroud)
行女巫的发生错误是:
import { something } from "../my-json.json";
Run Code Online (Sandbox Code Playgroud)
如何JSON
在Jest测试中导入文件?
我是单元测试和UI测试的初学者
我正在尝试使用以下代码为我的登录页面创建UI测试:
console.log("Teste de Login");
var page = require('webpage').create();
page.open('http://localhost/login', function(status) {
console.log("Page loadeed");
if(status === "success") {
page.render('example1.png');
}
page.evaluate(function() {
// $("#numeroUsuario").val("99734167");
document.getElementById('numeroUsuario').value = "99734167";
page.render('exampl2.png');
// $("#formLogin").submit();
page.render('example3.png');
});
phantom.exit();
});
Run Code Online (Sandbox Code Playgroud)
但是此代码返回以下错误:
> phantomjs.exe ./testLogin.js
Teste de Login
Page loadeed
ReferenceError: Can't find variable: page
phantomjs://webpage.evaluate():4
phantomjs://webpage.evaluate():8
Run Code Online (Sandbox Code Playgroud)
元素$("#numeroUsuario")
存在的地方.我做错了什么?
我正在尝试React
使用Jest
+ 测试我的组件Enzyme
,但是当我的组件有SASS
file(scss
)时,正在发生SyntaxError
.
这是我的SASS文件内容:
.user-box {
width: 50px;
height: 50px;
}
Run Code Online (Sandbox Code Playgroud)
我只是在我的组件中导入它:
import React from 'react';
import './userBox.scss';
class MyComponent extends React.Component {
render() {
const style = {
borderRadius: '99px'
};
return (
<div>Hello World</div>
);
}
}
export default MyComponent;
Run Code Online (Sandbox Code Playgroud)
以下是我测试的错误消息:
如果我评论import './userBox.scss';
,测试将是okey.
如果导入样式,如何React
用Jest
+`Enzyme` 测试组件
I'm creating an app using Expo
to take picture, I'm already possible to save pictures to FileSystem.documentDirectory
, but this is not what I want.
我试图将图像保存到 Camera Roll
using code like this:
import { CameraRoll } from 'react-native';
...
...
await CameraRoll.saveToCameraRoll(photo.uri);
Run Code Online (Sandbox Code Playgroud)
但它返回一个警告我使用react-native-cameraroll
而不是react-native
. But as I see in the document of the react-native-cameraroll
, it's seems not supporting Expo
.
有没有办法将图像保存到相机胶卷中Expo
?
我只知道如何填充gridview asp:SqlDataSource
但是我有一列TemplateField
在我的内容gridview
,当我需要修改我的SQL以改变网格内容时,我失去了我的TemplateField
,所以我认为学习gridview
用C语言填充我
有人可以教我或给我一些教程?
javascript ×5
c# ×3
reactjs ×3
jestjs ×2
mysql ×2
react-router ×2
asp.net ×1
encryption ×1
enzyme ×1
expo ×1
gridview ×1
laravel ×1
many-to-many ×1
phantomjs ×1
php ×1
react-native ×1
select ×1
sql ×1
tostring ×1
unit-testing ×1