如何调用适用于iOS的Swift REPL?我尝试了命令行参数,swift -sdk ...并通过swift -h其他调用参数查看,但没有一个跳出来.
$ swift
Welcome to Swift! Type :help for assistance.
1> import UIKit
<REPL>:1:8: error: no such module 'UIKit'
import UIKit
^
Run Code Online (Sandbox Code Playgroud)
Swift REPL在Mac上以"iOS"模式运行在Playground中; 只是希望从命令行获得相同的信息.
我无法获得以太网LES getProofsV2(或getProofs)请求来生成ProofsV2(或Proofs)响应,除了一个空的节点数组外.这适用于针对打开LES连接的GETH节点的请求.
请求参数是[B_32 (blockHash), B_32 (key), B_32 (key2), P (fromLevel)].我blockHash从最近开采的块中提供了一个; a key作为20字节帐户的Keccak256哈希值(来自几个月前的事务),一个key232字节的0和0,fromLevel我期望得到一个Nodes最后一个节点具有RLP编码的数组在AccountState(用{nonce,balance,...}.就是这种期望纠正或将我只期望得到节点的数组,如果?key在有交易的规定blockHash?[事实是,我都尝试- blockHash瓦特/或W/O交易,仍然肿大[].
具体来说,这是请求数据:
ETH: LES-ProofsV2-Req: L 1: [
ETH: LES-ProofsV2-Req: L 4: [
ETH: LES-ProofsV2-Req: I 32: 0x0a89dd55d38929468c1303b92ab43ca57269ac864175fc6208ae739ffcc17c9b
ETH: LES-ProofsV2-Req: I 32: 0x272cf200ca06815ab2170fde0901e7da10ab1dddc31223184f139def3b09f670
ETH: LES-ProofsV2-Req: I 32: 0x0000000000000000000000000000000000000000000000000000000000000000
ETH: LES-ProofsV2-Req: I 0: 0x
ETH: LES-ProofsV2-Req: ]
ETH: LES-ProofsV2-Req: ]
Run Code Online (Sandbox Code Playgroud)
其中blockHash 0x0a89...是blockNumber 5732521,key2是帐户的哈希值0x49f4C50d9BcC7AfdbCF77e0d6e364C29D5a660DF.
为完整起见,回复是: …
我想忽略我的一些文件(/config/environments/production.rb,/webrat.log,/config/database.yml).我的gitignore:
/.bundle
/db/*.sqlite3
/doc/
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/vendor/bundle
/log/*
/tmp/*
/public/system/*
/coverage/
/spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html
/config/environments/production.rb
/config/*.yml
/*.log
Run Code Online (Sandbox Code Playgroud)
但这不起作用.怎么了?
我试图在方案中使用check-expect函数,但我一直被告知它是一个未绑定的check-expect标识符.不检查 - 期待我已经可以使用的功能吗?以下是我的代码:
#lang racket
(define contains (lambda (item list*)
(if (equal? list* '())
#f
(if (equal? item (car list*))
#t
(contains item (cdr list*))))))
(define z (list 1 2 3))
(define q (list 4 5 6))
(define p (list "apple" "orange" "carrot"))
(check-expect (contains 1 z) #t)
Run Code Online (Sandbox Code Playgroud) 对于使用不区分大小写的数据库模式的JPA实体模型,当我使用@IdClass注释时,我始终得到"实例的标识符被更改"异常.对于具有"字符串"主键的对象,当数据库中存在一个案例的字符串并且仅使用大小写相同的字符串执行查询时,会发生错误.
我查看了其他SO答案,它们的形式如下:a)不修改主键(我不是)和b)你的equals()/ hashCode()实现有缺陷.对于"B"我已经尝试使用toLowerCase()和equalsIgnoringCase(),但无济于事.[此外,似乎Hibernate代码直接设置属性,而不是在发生'更改'时调用属性设置器.
这是具体的错误:
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException:
identifier of an instance of db.Company was altered
from {Company.Identity [62109154] ACURA}
to {Company.Identity [63094242] Acura}
Run Code Online (Sandbox Code Playgroud)
问:对于包含公司'Acura'(作为主键)的不区分大小写的DB,使用@IdClass如何随后查找其他大写字母?
这是有问题的代码(从空数据库开始):
public class Main {
public static void main(String[] args) {
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("mobile.mysql");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Company c1 = new Company ("Acura");
em.persist(c1);
em.getTransaction().commit();
em.getTransaction().begin();
c1 = em.find (Company.class, new Company.Identity("ACURA"));
em.getTransaction().commit();
em.close();
System.exit (0);
}
}
Run Code Online (Sandbox Code Playgroud)
这是'db.Company'实现:
@Entity
@IdClass(Company.Identity.class)
public class Company implements Serializable {
@Id …Run Code Online (Sandbox Code Playgroud) 在'git merge'中,我希望任何差异,即使通常不是合并冲突,也可以被视为合并冲突.然后,通过'git mergetool',我可以看到并解决每一个差异.我尝试在.gitattributes中指定'*-merge',但这似乎没有奏效:
$ git checkout master
Switched to branch 'master'
$ ls
foo.c
$ git merge add-on
Updating a628824..2219552
Fast-forward
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 bar.c
$ cat .gitattributes
* -merge
$ ls
bar.c foo.c
Run Code Online (Sandbox Code Playgroud)
对于上面的'git merge add-on',我预计'bar.c'的合并冲突没有基本版本,没有本地版本和远程版本.[编辑]正如在一个答案中所建议的,上面没有发生合并.这是我强制合并的情况,仍然没有所需的合并冲突:
$ git merge --no-ff add-on
Merge made by the 'recursive' strategy.
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 bing.c
Run Code Online (Sandbox Code Playgroud)
请注意,上面的'bing.c'实际上是空的; 但是,这不是问题,因为提供非空文件仍然会被合并.[编辑2]我试过 - 没有提交这个结果:
$ git merge --no-ff --no-commit add-on
Automatic merge went well; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用scheme读取文件,并将其内容放入列表中.
问题是如何删除问号,数字,并保持单词.我应该每次使用循环检查吗?如果不是这样的话,我如何从"阅读"中获取下一个单词的内容?
我尝试使用此代码解决它,但我找不到一种方法来调用"读取"直到获得文件结束;
(define Project
(lambda (fileName)
(if (null? fileName)
'error
(readNext (open fileName) '()))))
(define readNext
(lambda (fc tmp)
(if (null? (read fc) "#<eof>")
tmp
(readNext fc (cons (read fc) tmp)))))
Run Code Online (Sandbox Code Playgroud) 使用Objective-C,我使用下面显示的代码来设置/更改选择器的字体系列和大小:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
UILabel* tView = (UILabel*)view;
if (!tView){
tView = [[UILabel alloc] init];
// Setup label properties - frame, font, colors etc
tView.font = [UIFont fontWithName:@"Times New Roman" size:fontsize];;
}
tView.text = [_mysitedata findKeyForRow:row];
NSLog(@"C key:%@ row:%ld comp:%ld", tView.text, (long int)row, (long int)component);
return tView;
}
Run Code Online (Sandbox Code Playgroud)
但是,Swift不接受从UIView到UILabel的演员阵容,因此我不能遵循这条看起来如下所示的路径:
func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView {
let label = view as! UILabel
label.font = UIFont(name: "Times …Run Code Online (Sandbox Code Playgroud) 我有一个简单的问题,我希望你们能帮助我回答.现在我在故事板中有一个UIPageControl根据你所在的点改变图像,但是,到现在你必须按下点来改变点/图像,我怎样才能改变图像/点通过刷?
这是我的.h的代码
#import <UIKit/UIKit.h>
@interface PageViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIImageView *dssview;
- (IBAction)changephoto:(UIPageControl *)sender;
@end
Run Code Online (Sandbox Code Playgroud)
这是我的.m的代码
#import "PageViewController.h"
@interface PageViewController ()
@end
@implementation PageViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)changephoto:(UIPageControl …Run Code Online (Sandbox Code Playgroud) xcode objective-c uipagecontrol uiswipegesturerecognizer swipe-gesture
(define ..
(lambda (start stop)
(cond ((> (add1 start) stop) (quote ()))
((eq? (add1 start) stop) (sub1 stop))
(else (cons start (.. (add1 start) stop))))))
Run Code Online (Sandbox Code Playgroud)
我已经定义了一个简单的范围函数.目的是为了
(.. 1 5) --> (1 2 3 4)
Run Code Online (Sandbox Code Playgroud)
相反,我的元组中添加了一个奇怪的时期,我不明白为什么:
(.. 1 5) --> (1 2 3 . 4)
Run Code Online (Sandbox Code Playgroud)
我不明白为什么会这样.任何帮助表示赞赏