我非常接近能够做到这一点.我选择了JDatePicker来看看它需要什么.脚步:
1) git clone https://github.com/JDatePicker/JDatePicker
2) cd JDatePicker
3) mvn package
Run Code Online (Sandbox Code Playgroud)
然后安装localrepo不知道是否有一个更简单的方法,但这似乎是互联网上其他人指出的方式.
4) vi ~/.lein/profiles.clj
5) {:user {:plugins [[lein-localrepo "0.5.3"]]}}
Run Code Online (Sandbox Code Playgroud)
在.jar文件所在的JDatePicker目录中,使用localrepo为jdatepicker提供一个坐标,以便lein项目可以使用它.我正在使用lein版本:
idf@idf-Satellite-C55t-A ~/Documents/clojure/jdatepickertest $ lein version
Leiningen 2.5.0 on Java 1.7.0_72 Java HotSpot(TM) 64-Bit Server VM
idf@idf-Satellite-C55t-A ~/Documents/clojure/jdatepickertest $
6) lein localrepo install jdatepicker-2.0.0-SNAPSHOT.jar org/jdatepicker 2.0.0
Run Code Online (Sandbox Code Playgroud)
创建了一个新的clojure项目,看看我是否可以访问它
7) lein new jdatepickertest
8) cd jdatepickertest
Run Code Online (Sandbox Code Playgroud)
修改了project.clj文件,并将[org/jdatepicker"2.0.0"]添加到依赖项部分
9)
(defproject jdatepickertest "0.1.0-SNAPSHOT" :description
"FIXME: write description" :url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies
[
[org.clojure/clojure "1.6.0"] …Run Code Online (Sandbox Code Playgroud) 我有一个 python 程序和一个 golang 程序,它们都从套接字获取数据。我打印它从两者接收的字节。
python
Data = 0a300a084a6f686e20446f6510071a126a6f686e2e646f6540676d61696c2e636f6d220e0a0c3131312d3131312d31313130
golang
2016/04/02 23:21:08 50 bytes read from 192.168.0.1:65120
2016/04/02 23:21:08 00000000 0a 30 0a 08 4a 6f 68 6e 20 44 6f 65 10 08 1a 12 |.0..John Doe....|
00000010 6a 6f 68 6e 2e 64 6f 65 40 67 6d 61 69 6c 2e 63 |john.doe@gmail.c|
00000020 6f 6d 22 0e 0a 0c 31 31 31 2d 31 31 31 2d 31 31 |om"...111-111-11|
00000030 31 30 |10|
Run Code Online (Sandbox Code Playgroud)
.proto 文件在两者中是相同的。 …
如果我取消注释这些
//BaseList baselist;
//MemberList memberlist;
Run Code Online (Sandbox Code Playgroud)
在循环之外并注释掉循环中的那些它崩溃了.我需要能够在任何循环之外使用baselist(和memberlist).这是如何实现的?
编辑
我试图以最简单的形式解决的实际问题是这个.
我想要一个std :: vector
MyClass,称之为AllThingsBunchedTogether.我也想要一个std :: vectorBaseList,称之为AllThingsSpreadOut.所以
- AllThingsBunchedTogether可能含有(只
anInt1用于紧凑的缘故部分)1,2,1,10,2,3,4,4,5,9,10,10.- AllThingsSpreadOut可能包含([1]
1,1中的[1]2,2,[3]3,[ 3] ,[4]4,4,[5]5,[9]9,[ 9] ,[10]10,10,10.注意,数字本身不存储在
BaseList例如MyClass(1,"John")中.在[1]它可能是"迈克","约翰",在[2]它可能是"迈克","达戈巴特"在[3]"约翰"......在[10]"约翰""迈克"" Dagobart"等因此
BaseListAllThingsSpreadOut [i] 中的任何一个都没有重复,因为MyClass每个BaseList散列到不同的值(anInt1 + Name).从本质上讲,它
anInt1告诉MyClassAllThingsSpreadOut生活在哪里,但anInt1 + name保证每个人的独特性BaseList.因此,我们的想法是AllThingsSpreadOut是一个向量,
BaseList其中每个BaseList向量位置都是类似事物的列表.然后,当我从AllThingsBunchedTogether中删除内容时(不是通过清除,而是通过搜索删除IsMarkedToDelete下面的代码中的某些项目),它们将自动从相应的AllThingsSpreadOut中消失.
AllThingsSpreadOut充当AllThingsBunchedTogether的排序,具有侵入性语义.AllThingsBunchedTogether允许通过[]进行超高速访问.
结束编辑 …
我有第三方API,我没有源代码.我实例化一个回调到这样的事件:
using namespace API; // This is where APIClient lives
namespace TestApiClientUI
{
public partial class Form1 : Form
{
APIClient apiClient = new APICLient();
apiClient.QuoteUpdated += api_ClientUpdated;
private void api_ClientUpdated(object sender, string s, double b, double a)
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何将其包装到Rx Observable.FromEvent中?
另外,有没有办法做到这一点所以包装副本的开销尽可能少(零拷贝)?
给定 aList<T>其中Tf loat/decimal/double,使用 LINQ 计算percent change所有值的 。
这是 的定义PercentChange(error例如不检查是否a是zero)
static double PercentChange(double a, double b)
{
double result = 0;
result = (b - a) / a;
return result;
}
var list = new List<double>();
list.Add(2.0);
list.Add(2.5);
list.Add(2.0);
list.Add(1.75);
Run Code Online (Sandbox Code Playgroud)
然后使用LINQ将返回一个新的列表少一个元素,其值:
[.25, -.20, -.125]
Run Code Online (Sandbox Code Playgroud)
我知道我可以loop。我想要一个functional使用LINQ.