ZK

Clear Date from Datebox through Jquery

拈花ヽ惹草 提交于 2019-12-12 18:33:38
问题 This below code is showing a button in datebox modal popup but I want clear the date when I will click on the button. I tried lots of things but not able to do it by jQuery method. <zk> <script> zk.afterLoad('zul.db', function () { var _xRenderer = {}; zk.override(zul.db.Renderer, _xRenderer, { titleHTML: function (wgt, out, localizedSymbols) { _xRenderer.titleHTML.apply(this, arguments); //call the original method var uuid = wgt.uuid, view = wgt._view, text = wgt.getZclass() + '-ctrler'; if

Pass value from viewmodel to script in zk

只谈情不闲聊 提交于 2019-12-12 16:49:23
问题 I am trying to use PDFObject to show the pdf files inline. The application may contain many files. All the files are shown in the list. On clicking any one of the file, the pdf should be viewable if browser contains the pdf plugin or else show some anchor tag to download the file. The problem I am having is .. I couldn't figure out how to pass the file name from viewmodel to the script in the zul page. This is what I have done so far.. <?page title="Auto Generated index.zul"?> <?script type=

Zk Remove event Listener from selected tab

守給你的承諾、 提交于 2019-12-12 10:25:37
问题 I have 2 tabs one is Parent tab and other is child tabs.I have created Parent tab and put listener using onClose event dynamically to it and then creating child tabs. Actually I want that when user clicks on close button of Tab, he is not able to close and get message so I put event.stopPropogation() to handle the close event. After creation of child tabs, event listener should be removed out from parent tab.But listener is not removing from parent tab. As I am using removeEventlistener but

Getting an error as “Could not initialize class sun.net.www.protocol.http.HttpURLConnection” in ZK Framework

删除回忆录丶 提交于 2019-12-12 05:48:22
问题 My code is below : home.zul <?page title="Home" contentType="text/html;charset=UTF-8"?> <zk> <window title="Home" border="normal" maximizable="true" height="488px" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('com.company.login.HomePage')"> <borderlayout> <north height="80px"> <hlayout> <div> <a image="/Image/books.png" id="image" onClick="@command('getImage')"/> </div> <space width="600px"/> <menubar id="menubar" width="100%" autodrop="true"> <menuitem label="Home" /> <menu

ZooKeeper 分布式锁

你说的曾经没有我的故事 提交于 2019-12-11 17:55:12
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> ZooKeeper 分布式锁   目前分布式锁,比较成熟、主流的方案有基于redis及基于zookeeper的二种方案。 基于zookeeper的分布式锁   大体来讲,基于redis的分布式锁核心指令为SETNX,即如果目标key存在,写入缓存失败返回0,反之如果目标key不存在,写入缓存成功返回1,通过区分这二个不同的返回值,可以认为SETNX成功即为获得了锁。   redis分布式锁,看上去很简单,但其实要考虑周全,并不容易,网上有一篇文章讨论得很详细: http://blog.csdn.net/ugg/article/details/41894947/ ,有兴趣的可以阅读一下。   其主要问题在于某些异常情况下,锁的释放会有问题,比如SETNX成功,应用获得锁,这时出于某种原因,比如网络中断,或程序出异常退出,会导致锁无法及时释放,只能依赖于缓存的过期时间,但是过期时间这个值设置多大,也是一个纠结的问题,设置小了,应用处理逻辑很复杂的话,可能会导致锁提前释放,如果设置大了,又会导致锁不能及时释放,所以那篇文章中针对这些细节讨论了很多。   而基于zk的分布式锁,在锁的释放问题上处理起来要容易一些,其大体思路是利用zk的“临时顺序”节点,需要获取锁时,在某个约定节点下注册一个临时顺序节点

zookeeper: 分布式锁的实现

ⅰ亾dé卋堺 提交于 2019-12-11 17:54:51
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 为什么要用分布式锁 Martin Kleppmann是英国剑桥大学的分布式系统的研究员,之前和Redis之父Antirez进行过关于RedLock(红锁,后续有讲到)是否安全的激烈讨论。Martin认为一般我们使用分布式锁有两个场景: •效率:使用分布式锁可以避免不同节点重复相同的工作,这些工作会浪费资源。比如用户付了钱之后有可能不同节点会发出多封短信。 •正确性:加分布式锁同样可以避免破坏正确性的发生,如果两个节点在同一条数据上面操作,比如多个节点机器对同一个订单操作不同的流程有可能会导致该笔订单最后状态出现错误,造成损失。 分布式锁的一些特点: 当我们确定了在不同节点上需要分布式锁,那么我们需要了解分布式锁到底应该有哪些特点: •互斥性:和我们本地锁一样互斥性是最基本,但是分布式锁需要保证在不同节点的不同线程的互斥。 •可重入性:同一个节点上的同一个线程如果获取了锁之后那么也可以再次获取这个锁。 •锁超时:和本地锁一样支持锁超时,防止死锁。 •高效,高可用:加锁和解锁需要高效,同时也需要保证高可用防止分布式锁失效,可以增加降级。 •支持阻塞和非阻塞:和ReentrantLock一样支持lock和trylock以及tryLock(long timeOut)。 •支持公平锁和非公平锁(可选)

zk中分布式锁,分布式屏障

你说的曾经没有我的故事 提交于 2019-12-11 17:52:04
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> zk中分布式锁,分布式屏障 curator 屏障 DistributedBarrier对象 通过客户端连接和指定路径创建DistributedBarrier对象 barrier.setBarrier() 表示没有屏障时先设置屏障节点 Barrier.waitOnBarrier() 检查,如果屏障存在,则一直调用wait()等待,如果不存在,跳出无限循环,或者超时时跳出无限循环 当所有要做的事情都完成后,解除屏障,开始下一步处理,barrier.removeBarrier() 删除指定屏障 client.delete().forPath(barrierPath); java中的屏障 CyclicBarrier 有count计数,通过计数来保证线程阻塞中 分布式锁 InterProcessMutex lock.acpuire() lock.release() 多线程中,如果不使用锁,访问公共资源时候就会造成并发修改资源,导致资源失效 来源: oschina 链接: https://my.oschina.net/iioschina/blog/3141865

zk集群部署

亡梦爱人 提交于 2019-12-11 16:36:45
一.环境准备 当前环境:centos7.3三台 软件版本:zookeeper-3.5.2 部署目录:/usr/local/zookeeper 启动端口:2181 配置文件:/usr/local/zookeeper/conf/zoo.cfg yum依赖(3台同时操作) yum install java-1.8.0-openjdk 二.安装 1.下载安装包(3台同时操作) wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.5.2-alpha/zookeeper-3.5.2-alpha.tar.gz 2.解压并移动,再创建一个数据目录data(3台同时操作) tar zxvf zookeeper-3.5.2-alpha.tar.gz mv zookeeper-3.5.2-alpha /usr/local/zookeeper 3.创建数据目录和日志目录 cd /usr/local/zookeeper mkdir /data mkdir /var/log/zookeeper 3.创建配置文件更改配置(3台同时操作) vim conf/zoo.cfg clientPort = 2181 #监听端口其他服务器保持这个 dataDir = /usr/ local / zookeeper / data #数据目录,要自己创建

Textbox Enabling in ZK

自古美人都是妖i 提交于 2019-12-11 13:22:43
问题 Continuing with my zk studies, now i have a better knowledge about data binding features from here Selected Item data from a table to textbox in ZK thanks for the previous help i resolved the issue, now i have a small request for someone that has experience using ZK and it is when i select an item from this table http://s33.postimg.org/mo1bu0ua6/Sample.jpg i want to enable all the component of above, the textboxes and the buttons and only when i do the selection. How works the components

Is there an easy way to make the fileupload work with IE11 without updating zk

夙愿已清 提交于 2019-12-11 11:54:03
问题 In IE11 file upload button of ZK is not working. I got few replies, It says after updating ZK it will fix the problem. But we can't update ZK, So in this scenario is there any way to work out this problem any how. 回答1: If you can't upgrade ZK then you can try to "downgrade" the IE using "X-UA-Compatible" either as meta-tag or as a response header here an example using the meta tag: <?meta http-equiv="X-UA-Compatible" content="IE=10" ?> <zk> <fileupload label="upload" onUpload="alert(event