小编mr-*_*-sk的帖子

扩展编程技能的语言建议(对于半经验的软件开发人员)

我的经验很少(<1年专业)

  • Perl的
  • Groovy中/ Java的

我有限(<2年专业)

  • C

我有很好的经验(> = 6年专业)

  • PHP
  • SQL

我有爱好经验

所以我的问题是我接下来可以用什么语言(在我的空闲时间)给我一些关于编程和解决问题的新见解 - 我正在看LISP - 这对我来说是非常陌生的.我想解决与上面列出的语言非常不同的问题.

编辑:我想我会调查Haskell - 感谢您的反馈!也许可能是Erlang,我真的很喜欢Adrian Kosmaczewski关于雪豹Mac App的想法.

php c++

4
推荐指数
1
解决办法
534
查看次数

为什么命令行计算base64字符串不同于curl计算的base64字符串?

真的很困惑 - 猜猜它与最后的单个字符放置有关,或者可能用我不知道的基本摘要填充...?

所以,如果我执行它,你可以看到base64编码的产品:

echo 'host@mail.com:password' | openssl enc -base64
aG9zdEBtYWlsLmNvbTpwYXNzd29yZAo=
Run Code Online (Sandbox Code Playgroud)

现在,如果我提出卷曲请求:

curl -v -u host@mail.com:password https://
aG9zdEBtYWlsLmNvbTpwYXNzd29yZA==
Run Code Online (Sandbox Code Playgroud)

你会注意到base64字符串不一样......哈哈是什么?base64命令行1实际上是不正确的 - 如果在请求中替换它,它将失败.SO - 基本消化不真正使用base64字符串吗?我注意到在字符串末尾总是做ao =而不是==

和想法?

编辑:所以,它是echo的尾随换行符:-n不输出尾随换行符

谢谢!

base64 command-line curl http basic-authentication

4
推荐指数
1
解决办法
4655
查看次数

类属性mVar和实例变量self.mVar之间的区别

我对于通过self访问实例变量或仅通过名称(在类中工作时)之间的区别感到困惑.

例如,参加这个课程:

//In .h file:
@interface Register : NSObject {
    NSString *mName;
}

- (id) initWithName:(NSString *) name;

//In .m file:
- (id) initWithName:(NSString *)name
{
    if (self == [super init])
    {
        mName = name;
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

通过访问实例变量之间的区别是什么

self.mName = name;
Run Code Online (Sandbox Code Playgroud)

VS

mName = name;
Run Code Online (Sandbox Code Playgroud)

哪个不是@property而且不是@ sythenize'd.

说这是这个,但是这个例子:

//In .h file:
@interface Manange_My_ViewsViewController : UIViewController { 
    IBOutlet UILabel *countLabel;
}

@property (nonatomic, retain) IBOutlet UILabel *countLabel;

//In .m file:
@synthesize countLabel;

- (void) updateLabel:(NSUInteger)count
{
    countLabel.text = [NSString …
Run Code Online (Sandbox Code Playgroud)

oop iphone objective-c self core-foundation

4
推荐指数
1
解决办法
1343
查看次数

Mongod 100%CPU - 不确定如何诊断?

我有一个python(python和mongo newbie)应用程序,每小时通过cron运行以获取数据,清理它并插入到mongo中.在执行期间,应用程序将查询mongo以检查重复项,并在文档是新的时插入.

我最近注意到mongod的cpu利用率是100%......而且我不确定何时/为何开始发生这种情况.

我正在运行EC2微型实例,其中有一个用于mongo的专用EBS卷,大小约为2.2GB.

我不确定从哪里开始诊断这个问题.这是系统上stats()和systemStatus()的输出:

> db.myApp.stats()
{
"ns" : "myApp.myApp",
"count" : 138096,
"size" : 106576816,
"avgObjSize" : 771.7588923647318,
"storageSize" : 133079040,
"numExtents" : 13,
"nindexes" : 1,
"lastExtentSize" : 27090944,
"paddingFactor" : 1,
"flags" : 1,
"totalIndexSize" : 4496800,
"indexSizes" : {
    "_id_" : 4496800
},
"ok" : 1
}
> db.serverStatus()
{
"host" : "kar",
"version" : "2.0.4",
"process" : "mongod",
"uptime" : 4146089,
"uptimeEstimate" : 3583433,
"localTime" : ISODate("2013-04-07T21:18:05.466Z"),
"globalLock" : {
    "totalTime" : 4146088784941,
    "lockTime" …
Run Code Online (Sandbox Code Playgroud)

python performance amazon-ec2 mongodb

4
推荐指数
1
解决办法
3651
查看次数

Hello World CUDA编译问题

我正在使用CUDA by Example书籍并尝试编译本书中的第一个真实示例.我在OSX 10.9.2上:

我的来源是:

@punk ~/Documents/Projects/CUDA$ /Developer/NVIDIA/CUDA-6.0/bin/nvcc hello.c
nvcc warning : The 'compute_10' and 'sm_10' architectures are deprecated, and may be removed in a future release.
hello.c:6:1: error: unknown type name '__global__'
__global__ void kernel(void) {
^
hello.c:6:12: error: expected identifier or '('
__global__ void kernel(void) {
           ^
hello.c:10:3: error: use of undeclared identifier 'kernel'
  kernel<<<1,1>>>();
  ^
hello.c:10:11: error: expected expression
  kernel<<<1,1>>>();
          ^
hello.c:10:17: error: expected expression
  kernel<<<1,1>>>();
                ^
hello.c:10:19: error: expected expression
  kernel<<<1,1>>>();
                  ^
6 errors …
Run Code Online (Sandbox Code Playgroud)

c c++ macos cuda nvcc

4
推荐指数
1
解决办法
3131
查看次数

没有调用editingStyleForRowAtIndexPath(因此将显示一个删除按钮)

我在玩移动uitableviewcell,无论出于何种原因,

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
           editingstyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewCellEditingStyleNone; //<-- bp set on it
}
Run Code Online (Sandbox Code Playgroud)

没有被调用(我已经在其上设置了一个断点)-因此表显示了delete选项,但我不希望这样。这是我的实现:

@implementation MoveItController
@synthesize mList;

- (IBAction)moveButton
{
    [self.tableView setEditing:!self.tableView.editing animated:YES];

    [self.navigationItem.rightBarButtonItem setTitle:(self.tableView.editing)? @"Done" : @"Move"];
}

- (void)viewDidLoad
{
    if (mList == nil)
    {
        mList = [[NSMutableArray alloc] initWithObjects:@"$1", @"$2", @"$5", @"$10", @"$20", @"$50", @"$100", nil];
    }

    UIBarButtonItem *mvButton = [[UIBarButtonItem alloc]
                                 initWithTitle:@"Move" 
                                 style:UIBarButtonItemStyleBordered 
                                 target:self 
                                 action:@selector(moveButton)];
    self.navigationItem.rightBarButtonItem = mvButton;
    [mvButton release];
    [super viewDidLoad];
}

// Table datasource methods

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview tablecell

3
推荐指数
1
解决办法
6364
查看次数

THREE.js - 无法读取未定义的属性'lib'(THREE.ShaderUtils.lib ["normal"])

我正在完成Oreilly在WebGL入门书中找到的练习.

以下行导致运行时错误.我用Google搜索,没有看到其他人有问题,所以我做错了什么?

var specularMap= THREE.ImageUtils.loadTexture("WebGLBook/images/earth_specular_2048.jpg");

var shader   = THREE.ShaderUtils.lib[ "normal" ]; <-- fails
var uniforms = THREE.UniformsUtils.clone(shader.uniforms);

uniforms['tNormal'].texture   = normalMap; 
uniforms['tDiffuse'].texture  = surfaceMap;
Run Code Online (Sandbox Code Playgroud)

注意到的行失败,出现以下错误:

Uncaught TypeError: Cannot read property 'lib' of undefined solar-system-spec-map.html:60
Earth.createGlobe solar-system-spec-map.html:60
Earth.init solar-system-spec-map.html:51
EarthApp.init solar-system-spec-map.html:33
(anonymous function) solar-system-spec-map.html:93
deferred.resolveWith jquery-1.6.4.js:1016
jQuery.extend.ready jquery-1.6.4.js:437
DOMContentLoaded
Run Code Online (Sandbox Code Playgroud)

同样奇怪的是,"ShaderUtils"没有列在THREE.js文档中...... http://mrdoob.github.com/three.js/docs/55/

这是怎么回事?!

javascript webgl three.js

2
推荐指数
1
解决办法
5644
查看次数

在 OSX 上的 Emacs 中将 alt/option 键设置为 Meta

是的,我用谷歌搜索了一下,所提供的答案似乎都不起作用。我最近买了一台新电脑并将其移.emacs过来,但有些功能无法正常工作。具体来说,alt/option 键在 emacs 中未检测为元。

我上线了:

Darwin punk.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
Run Code Online (Sandbox Code Playgroud)

我的 中有以下内容.emacs

(if (system-is-mac)
  (setq ns-command-modifier 'meta))
(setq mac-option-modifier 'meta)
Run Code Online (Sandbox Code Playgroud)

我正在跑步iterm2 build 3.0.13

非常感谢任何帮助,谢谢!

meta macos emacs iterm

2
推荐指数
1
解决办法
1664
查看次数

全新安装后无法运行`jupyter notebook`

我做了:

pip install --upgrade pip
pip install jupyter
jupyter notebook
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

    Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 61, in <module>
    from .services.kernels.kernelmanager import MappingKernelManager
  File "/Library/Python/2.7/site-packages/notebook/services/kernels/kernelmanager.py", line 16, in <module>
    from jupyter_client.multikernelmanager import MultiKernelManager
  File "/Library/Python/2.7/site-packages/jupyter_client/__init__.py", line 7, in <module>
    from .manager import KernelManager, run_kernel
  File "/Library/Python/2.7/site-packages/jupyter_client/manager.py", line 32, in <module>
    from .session import Session
  File "/Library/Python/2.7/site-packages/jupyter_client/session.py", line 51, in <module>
    from dateutil.tz import tzutc
  File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line …
Run Code Online (Sandbox Code Playgroud)

python pip jupyter

2
推荐指数
1
解决办法
449
查看次数

使用 github 配置 EMR 笔记本

我正在运行一个 EMR 集群,并且正在尝试将笔记本链接到 github。

我有:

  • 添加了对 EMR 角色的 AWS 秘密访问(这是我的第一个错误)
  • 向所有 EMR 安全组添加了出站 HTTPS/443

尝试使用我的用户/密码密钥将笔记本链接到私人存储库,但出现以下错误:

Unable to reach repository https://github.com/<my repo>. Ensure network and security groups have valid configurations. Ensure that the repository information provided is correct.
Run Code Online (Sandbox Code Playgroud)

我在文档中看到它谈到了 NAT 和 VPG 选项,而我没有这两个选项。有这个必要吗?这些文档对细节/配置的描述非常简单。

https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-management-notebooks-git-considerations.html

任何帮助表示赞赏。

amazon-ec2 amazon-web-services amazon-emr amazon-vpc jupyter-notebook

2
推荐指数
1
解决办法
2189
查看次数