我的代码出了什么问题?正在FileNameArray被重用?
f.rb:17:警告:已经初始化了常量FileNameArray
number = 0
while number < 99
number = number + 1
if number <= 9
numbers = "000" + number.to_s
elsif
numbers = "00" + number.to_s
end
files = Dir.glob("/home/product/" + numbers + "/*/*.txt")
files.each do |file_name|
File.open(file_name,"r:utf-8").each do | txt |
if txt =~ /http:\/\//
if txt =~ /static.abc.com/ or txt =~ /static0[1-9].abc.com/
elsif
$find = txt
FileNameArray = file_name.split('/')
f = File.open("error.txt", 'a+')
f.puts FileNameArray[8], txt , "\n"
f.close
end
end
end
end …Run Code Online (Sandbox Code Playgroud) 我有这个代码,我试图从Url读取图像:
public class question_insert {
public static String latex(String tex) throws IOException {
String urltext = "http://chart.apis.google.com/chart?cht=tx&chl="+tex;
URL url = new URL(urltext);
BufferedReader in = new BufferedReader(new InputStreamReader(url
.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
// Process each line.
System.out.println(inputLine.toString());
}
in.close();
return inputLine;}
Run Code Online (Sandbox Code Playgroud)
但我得到的是无法读取的代码.网址只提供一张图片试试这个:
http://chart.apis.google.com/chart?cht=tx&chl=2+2%20\frac{3}{4}
我该怎么做才能将图像嵌入到Html中?
是否可以在画布A中读取图像的像素并在画布B上创建像素?我想在Canvas B上创建新像素,只有图像的像素为绿色.例如.如果图像的像素(120,45)为绿色,我需要在(120,45)画布B中创建绿色像素
Ruby 1.9使用本机线程,与Ruby 1.8(MRI)不同.
但是,是否可以请求Ruby 1.9.3创建绿色线程而不是本地线程?
-
我为什么要这样?
用于测试目的.
我正在尝试创建一个简单的TCP服务器,它可以接受数千个并发连接,这些连接在返回一些结果之前会休眠几秒钟.
在Ruby 1.8中,我可以轻松创建数千个线程,因此并发连接数量的唯一限制是操作系统.
在Ruby 1.9中似乎是不可能的.
这段代码演示了我的意思:
require 'thread'
m = Mutex.new
c = 0
ta = Array.new 10000
ta.fill do
Thread.new do
m.synchronize { c += 1; p "created #{c}th" if c%100 == 0; }
sleep 15
m.synchronize { c -= 1; p "destroyed #{c+1}th" if c%100 == 0; }
end
end
ta.each {|t| t.join}
Run Code Online (Sandbox Code Playgroud)
它在Ruby 1.8中运行良好,但在1.9中它非常糟糕.
-
不幸的是,在使用eventmachine进行一些实验后,add_timer我能想到的最好的是Node.js服务器:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'}); …Run Code Online (Sandbox Code Playgroud) 我有一个简单的问题:
从Windows批处理(.bat)脚本执行单个WshShell命令的最佳方法是什么?
(希望它不是用VB代码创建一个新文件)
快速提问:是否保证此代码始终打印true?
Boolean b1 = true;
Boolean b2 = true;
System.out.println(b1 == b2);
Run Code Online (Sandbox Code Playgroud)
拳击布尔似乎总是导致相同的布尔对象,但我找不到太多关于JLS中的盒装布尔相等的信息.相反,它甚至似乎暗示拳击应该创建新对象,甚至可能导致OOM异常.
你的想法是什么?
我正在制作一个克罗地亚语的网站,我需要使用"č","ć","ž","đ"和"š"等标志.它们目前显示为小盒子.
信息:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />但是,它不起作用.甚至Notepad ++都无法使用UTF-8显示我的角色,因此这表明我应该使用其他东西......
我正在尝试使用服务器URL将图像上传到服务器.为此,我使用java.netapi.发送请求后,它返回一个显示会话无效的响应.我从该服务器获取会话ID但无法添加它.如何HttpURLConnection在向服务器发送请求时使用添加会话ID .他们有什么方法可以解决这个问题?
我们对此有解决方案吗?
我的代码是这样的:
preparedStatement.SetObject(i , MyArray);
Run Code Online (Sandbox Code Playgroud)
在这里,MyArray是从表中获取的记录的数组。现在,只要以上语句找到一个null值,它就会引发一个SQL异常:无效的列类型。
可用的选项是使用setObject(int parameterIndex,Object x,int sqlType)或setNull,但是在那种情况下,我需要提供目标列的SQL类型,这似乎是不可能的。
谢谢
所以我知道这非常简单,我很抱歉不得不在这里问这个问题.不幸的是,我感到很困惑,没有人问过......
无论如何,我正在尝试使用Java来解决以下等式:
__________________
? (3.1^17 + 2.7^11)
Run Code Online (Sandbox Code Playgroud)
我现在的代码不起作用.它是:
public class Math
{
public static void main(String[] args)
{
double a = 3.1
double b = 2.7;
double c = Math.sqrt(Math.pow(a,17) + Math.pow(b,11));
System.out.println(c);
}
}
Run Code Online (Sandbox Code Playgroud) java ×5
html ×2
image ×2
ruby ×2
autoboxing ×1
batch-file ×1
dir ×1
encoding ×1
fonts ×1
html5 ×1
httpsession ×1
javascript ×1
math ×1
null ×1
pixels ×1
primitive ×1
search ×1
unicode ×1
windows ×1
wsh ×1