问候,
我在Objective C中生成SHA256字符串时遇到了麻烦(可能是因为我对语言这么新).
在jQuery中,我所要做的就是:
var sha256String=$.sha256("Hello");
Run Code Online (Sandbox Code Playgroud)
它按预期产生哈希值.
但是在Objective-C中,我尝试了以下内容无济于事:
NSString *pword=[[NSString alloc]
initWithString:login_pword.text];
unsigned char result[64];
CC_SHA256([pword UTF8String], [pword lengthOfBytesUsingEncoding:NSASCIIStringEncoding],result);
UIAlertView *msg=[[UIAlertView alloc] initWithTitle:@"Hi" message:result delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[msg show];
[msg release];
Run Code Online (Sandbox Code Playgroud)
是否有一些我可以调用的功能,如:
NSString *sha256String=[self getSHA256:pword];
Run Code Online (Sandbox Code Playgroud)
这就是我想要创造的东西,我发现它很难!
我希望有人能帮帮忙.
提前谢谢了,
我有一个iframe,我想制作一个if条件,如果iframe源等于一个div应该显示的一个speciefied页面:
例
if(getElementById('iframe').src = 'someurl'){
getElementById('div').style.display. = 'block';
}
Run Code Online (Sandbox Code Playgroud)
问题
我不是JS的专家,但是当我使用这个脚本时,iframe会在加载主页面时自动加载"someurl",这是我不想要的,我希望在iframe源更改为"someurl"时显示div "通过链接.链接工作正常,它更改iframe src但if语句不起作用.
如何获得DrawText()使用的字体的默认字体高度?如果可能的话我宁愿不设置新的字体.
如果我理解正确:
JSR -223:用Java引入脚本语言引擎,就是这样!您可以自由使用您想要的任何脚本语言,例如:Groovy,Mozilla Rhino,PHP,Jython,Python等.Project的默认实现支持JavaScript作为脚本引擎,但您可以添加任何您喜欢的脚本语言.所以这只是将用Java语言编写的类与用脚本语言编写的代码连接起来(反之亦然).我可以看到,这种集成的唯一好处是脚本语言在编写程序时提供的简单性与在Java中编写相同的程序相比.
JSR 241:这是JSR-223的扩展,并强调采用Groovy作为脚本语言,即如果您计划在Java应用程序(Web或Dekstop应用程序)中使用脚本语言,请使用Groovy ..留下其他人,因为Groovy是更多Java和其他脚本语言如Jython,Python,JavaScript等已被采用和修改以适应Java,但自然选择是Groovy.
能否请你多说一点,我的理解是否正确?
今天我试着从eclipse.org下载EGit插件,等了一个小时,什么都没发生.我再试了三次,等了三个小时才停下来.
然后我尝试从存储库开发人员克隆egit,但它开始以5kbps的速率克隆.
然后我想我的Eclipse可能有问题,并决定下载一个新的.Eclipse主站点以超慢的速度打开(虽然大于5kbps).我只是害怕以这种速度下载安装程序.
任何人都可以重新制作吗?我该怎么办?
我有通过Java在Socket类上发送数据的功能.当我发送数据时,我需要接收一些数据.问题是如何在2秒内设置等待数据的超时(如果我在2秒内没有收到数据,我需要理解通信错误和显示消息).这是我的代码,任何帮助?
public boolean SendMonitorMessage(
final MonitorRequestRepeatMessageTCP message) {
boolean result = true;
System.out
.println("****************** SEND MONITOR REQUEST REPEAT MESSAGE TCP **********************************");
// new Thread() {
// public void run() {
int prevService=message.GetService();
synchronized (socket) {
try {
System.out.println("IPADDRESS=" + ipAddress);
System.out.println("PORT=" + port);
System.out.println("Is reachable=" + Ping());
message.PrintMessage(message.toBytes());
OutputStream socketOutputStream = (OutputStream) socket
.getOutputStream();
socketOutputStream.write(message.toBytes());
InputStream socketInputStream = (InputStream) socket
.getInputStream();
byte[] buffer = new byte[256];
List<byte[]> received = new LinkedList<byte[]>();
int numberReceived;
byte[] tempBuffer;
while ((numberReceived = socketInputStream.read(buffer)) != …
Run Code Online (Sandbox Code Playgroud) 有没有人知道使用.proto源文件生成Google Protobuf文档的好工具?
documentation protocols documentation-generation protocol-buffers
基本上我正在尝试多态性.我有2个对象,一个客户和一个员工.客户有姓名和投诉.员工有姓名和薪水.
在循环中,我接受这些参数并创建一个新的Person来添加到数组中.
但这是我的问题:如果我在字符串中放置任何空格,那么循环就会结束.
Person *persons[10];
for (int i = 0; i < sizeof persons;i++)
{
cout<<"Please type 1 for customer or 2 for Employee"<<endl;
int q;
cin>>q;
string name;
int salary;
string complaint;
if (q == 1)
{
cout<<"What is your name?"<<endl;
cin>>name;
cout<<"What is your complaint"<<endl;
cin>>complaint;
personPtr = new Customer(name,complaint);
cout<<"Created customer"<<endl<<endl;
persons[i] = personPtr;
cout<< "added to array"<<endl<<endl;
}
else if(q==2)
{
cout<<"What is your name?"<<endl;
cin>>name;
cout<<"What is your salary"<<endl;
cin>>salary;
personPtr = new Employee(name,salary);
persons[i] …
Run Code Online (Sandbox Code Playgroud) 是否可以在Windows(Apache或IIS)上配置Web服务器而无需设置虚拟主机,因此可以使用http://example.com/myapp等链接访问Zend Framework应用程序,而不是http://example.com/myapp/公众?
我目前正在进入Android 3.0预览版的片段API,并构建了以下最小编码:
我有一个Activty,它将嵌入Fragment(s),目前实现如下:
public class Cockpit extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cockpit);
}
public static class InfoFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
ViewGroup infoFragmentRoot = (ViewGroup) getActivity().findViewById(
R.id.infoFragmentRoot) ;
return inflater.inflate(R.id.infoFragment, container, false);
}
}
Run Code Online (Sandbox Code Playgroud)
}
活动的相应布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<fragment android:name="test.android.ui.cockpit.Cockpit$InfoFragment"
android:id="@+id/infoFragment"
android:layout_weight="1"
android:layout_width="10dp"
android:layout_height="match_parent" >
<LinearLayout …
Run Code Online (Sandbox Code Playgroud)