嘿所以我想知道如何使AtomicInteger成为一个二维数组,从我在javadocs上发现的AtomicIntegerArray只是单维.
int[] newArray = new int[100];
AtomicIntegerArray atomicarray = new AtomicIntegerArray(newArray);
Run Code Online (Sandbox Code Playgroud)
这会创建一个大小为100的AtomicIntegerArray.但我想要一个具有两个维度的原子阵列.我试过做..
AtomicInteger[][] atomicArray = new AtomicInteger[100][100];
atomicArray[00][00].set(1);
Run Code Online (Sandbox Code Playgroud)
但我遇到了......
nz.ac.massey.threadpool.MyClass上的java.lang.NullPointerException.(MyClass.java:20)
那么任何想法?谢谢!:)我之前没有做过很多关于原子变量的工作.
如果这是不可能的,我怎样才能将一个常规的原始整数二个dim数组最小化成一个AtomicInteger两个dim数组?
我有一个非常简单的加密类,使用tripleDES加密我网站上特定页面的查询字符串.我这样做是为了防止人们根据我们的数据库ID顺序抓取页面.
无论如何,我已经使用过 这种加密方法
但是,它包含3d%一些special characters不应该在查询字符串中的其他内容,并且出于安全目的而被Url Scan拒绝.=生成的实际加密字符串中有一个.我并不想改变URL扫描,但我不知道是否有一种方法可以限制的加密字符的tripleDES crypto provider什么的.我对加密几乎一无所知,我实际上只是混淆了查询字符串,因此我对其对查询字符串加密的其他选项持开放态度.
所以我正在编写一个带有os模块的通用备份应用程序,pickle并且到目前为止我已经尝试了下面的代码来查看某些内容是否是文件或目录(基于其字符串输入而不是其物理内容)。
import os, re
def test(path):
prog = re.compile("^[-\w,\s]+.[A-Za-z]{3}$")
result = prog.match(path)
if os.path.isfile(path) or result:
print "is file"
elif os.path.isdir(path):
print "is directory"
else: print "I dont know"
Run Code Online (Sandbox Code Playgroud)
问题
test("C:/treeOfFunFiles/")
is directory
test("/beach.jpg")
I dont know
test("beach.jpg")
I dont know
test("/directory/")
I dont know
Run Code Online (Sandbox Code Playgroud)
期望输出
test("C:/treeOfFunFiles/")
is directory
test("/beach.jpg")
is file
test("beach.jpg")
is file
test("/directory/")
is directory
Run Code Online (Sandbox Code Playgroud)
资源
我应该使用什么正则表达式来区分可能是 afile和可能是 a的区别directory?还是有不同的方法来解决这个问题?
好的,我有一个问题,我想知道将including许多文件放入一个single php file(假设这个文件名为init.php)的等价物是什么。例如,init.php读取Directory X并包含每个文件*.php。导入的这些文件中包含的任何文件init.php现在都将在脚本(或系统)之间共享。
In similar example but this time with python, I have a file called init.py that reads over Directory Y and imports each module (or package) using find_packages() would lines such as import numpy as np, os, sys be included across the files within Directory Y or would each of these files require this import line? inorder to access the os and …
好的,所以我一直在这里关注joomla 2.5教程,并且我设法制作了一个非故障的初始组件.
但我想知道如何将额外的类导入框架?
我有一个名为auth.php的模型类
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla modelitem library
jimport('joomla.application.component.modelitem');
/**
* Auth Model
*/
class AutoBaseModelAuth extends JModelItem
{
function detail()
{
echo "this is test";
}
}
Run Code Online (Sandbox Code Playgroud)
位于C:/xampp/htdocs/com_autobase/model/auth.php
xampp http://iforce.co.nz/i/p5m1gjxh.jpx.png
我的观点......
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* HTML View class for the AutoBase Component
*/
class AutoBaseViewAutoBase extends …Run Code Online (Sandbox Code Playgroud) 我有函数a调用函数b(返回True或False到a),之后函数a可以返回要打印的结果.
class C:
...
def a(self, data):
p = self.head
return self.b( p,data)
def b(self, p, data):
current = p
if current.data == data:
return True
else:
return False
if __name__=="__main__":
x = C()
print(x.a(1))
Run Code Online (Sandbox Code Playgroud)
有时它会返回None,尽管它应该是True.我不确定发生了什么?
所以我试图将一个字符串转换31/12/9999为9999/12/31,我一直在尝试,date = date[::-1]但它产生9999/21/31并且不保留字符串的内容.
我是那种寻找类似的东西php,reverse_array( $array , $preserve );.