我对java.util.zip图书馆有一些一般性的问题.我们基本上做的是导入和导出许多小组件.以前,这些组件是使用单个大文件导入和导出的,例如:
<component-type-a id="1"/>
<component-type-a id="2"/>
<component-type-a id="N"/>
<component-type-b id="1"/>
<component-type-b id="2"/>
<component-type-b id="N"/>
Run Code Online (Sandbox Code Playgroud)
请注意,导入期间组件的顺序是相关的.
现在每个组件都应该占用自己的文件,该文件应该是外部版本的,QA-ed,bla,bla.我们决定导出的输出应该是一个zip文件(包含所有这些文件),我们导入的输入应该是一个类似的zip文件.我们不想在我们的系统中爆炸zip.我们不希望为每个小文件打开单独的流.我目前的问题:
Q1.可以ZipInputStream保证zip条目(小文件)的读取顺序与我们使用的导出插入的顺序相同ZipOutputStream吗?我认为阅读是这样的:
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry;
while((entry = zis.getNextEntry()) != null)
{
//read from zis until available
}
Run Code Online (Sandbox Code Playgroud)
我知道中央zip目录放在zip文件的末尾但是内部的文件条目有顺序.我也知道依靠订单是一个丑陋的想法,但我只想记住所有的事实.
Q2.如果我使用ZipFile(我更喜欢),呼叫getInputStream()数百次会对性能产生什么影响?它会比ZipInputStream解决方案慢得多吗?拉链只打开一次ZipFile并由后备RandomAccessFile- 这是正确的吗?我认为阅读是这样的:
ZipFile zipfile = new ZipFile(argv[0]);
Enumeration e = zipfile.entries();//TODO: assure the order of the entries
while(e.hasMoreElements()) {
entry = (ZipEntry) e.nextElement();
is = …Run Code Online (Sandbox Code Playgroud) 使用GCC,是否可以指定一组免除-Wframe-larger-than的函数?(例如,主要.)
几个小时以来我一直在努力.我还检查了文档和几个主题.我发现这个代码有两个主题,两个人都说代码工作正常,但不能在我的电脑上运行.第一个Toast出现了,但第二个Toast出现了.怎么了?
public class HelloAndroid2 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (10 * 1000), pendingIntent);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();
}
public final class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Alarm worked.", Toast.LENGTH_LONG).show();
}
}
Run Code Online (Sandbox Code Playgroud)
}
我在选择表a(id,room_name)中的值时遇到问题,其中表b中没有相应的事件(room_id,room_start,room_finish)
我的查询看起来如下
SELECT id, room_name FROM rooms
WHERE NOT EXISTS
(SELECT * FROM room_events
WHERE room_start BETWEEN '1294727400' AND '1294729200'
OR
room_finish BETWEEN '1294727400' AND '1294729200')
表a包含多个房间,表b包含房间事件我没有得到结果,以防时间戳内的任何房间有任何事件.我期待所有房间都没有活动.
我现在正在与一个企业客户端合作,利用Magento中的目录事件功能.对于那些不熟悉的人,这意味着他们的产品类别仅在特定日期之间可供客户使用.
我正致力于为他们提供良好的登台/测试环境,每天抓取(并匿名化)所有网站数据,为他们提供最新的游乐场.我想做的其中一件事是允许他们快进到未来的日期,看看该日期的网站会是什么样子(销售,活动,假日设计等).
有没有人知道一种干净的方式来愚弄Magento运行一切,好像我们目前正处于其他日期?我不认为改变服务器时间是一个很好的可扩展解决方案(在这台机器上有多个人测试,加上黑客攻击),因此最佳答案甚至可以在特定用户会话中进行本地化.
这是一个日期列表:
04-22-11
12-19-11
11-04-11
12-08-11
09-27-11
09-27-11
04-01-11
在Excel中复制此列表时,其中一些会被识别为日期,而其他则不会被识别为以下方式:
04-22-11
12-19-11
11-04-11(日期)
12-08-11(日期)
09-27-11
09-27-11
04-01-11(日期)
有谁知道为什么?以及如何强制Excel将所有列表项识别为日期?
非常感谢!
我有两个问题:
public class Address
{
public int Id { get; set; }
public string FirstName { get; set;
public string LastName { get; set; }
}
public partial class Customer
{
public int Id { get; set; }
public string Email { get; set; }
public string Username { get; set; }
public virtual Address BillingAddress { get; set; }
public virtual Address ShippingAddress { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
下面是映射类:
public partial class AddressMap : EntityTypeConfiguration<Address>
{
public AddressMap()
{ …Run Code Online (Sandbox Code Playgroud) 我注意到一些页面几乎立即开始呈现,而其他页面有时必须等到许多或所有资源(javascript,image,css)都已下载.最糟糕的情况似乎是一个大页面,在慢速连接或服务器上.我正在查看的一个特定页面大约有2 MB,包含30个不同的.js文件,12个.css文件和80个图像.
我知道http://developer.yahoo.com/performance/rules.html上的建议,但是什么会妨碍浏览器尝试呈现页面,直到最后一个元素被下载?
我有这个功能 -
public int GetAvgResult()
{
var weeklyvalues=GetWeeklyValues();//gets list of weekly values.
if (weeklyvalues.Count == 0)
return 0;
return (weeklyvalues.Sum() / weeklyvalues.Count);
}
Run Code Online (Sandbox Code Playgroud)
是否有更短的方式来使用?:或者其他东西写这个?
对于总标题我很抱歉,但我真的不知道怎么称呼它.
这是我的代码,我想减少:
$('.ShowDialogIcon').click(function() {
$('.show_dialog').slideDown('fast');
return false;
});
$('.ShowDialogIcon2').click(function() {
$('.show_dialog2').slideDown('fast');
return false;
});
$('.ShowDialogIcon3').click(function() {
$('.show_dialog3').slideDown('fast');
return false;
});
$('.ShowDialogIcon4').click(function() {
$('.show_dialog4').slideDown('fast');
return false;
});
Run Code Online (Sandbox Code Playgroud)
现在我看,这有点不完整,我想做的是:
$('.ShowDialogIcon').showDialog('.showDialog');
$('.ShowDialogIcon2').showDialog('.showDialog2');
$('.ShowDialogIcon4').showDialog('.showDialog3');
$('.ShowDialogIcon4').showDialog('.showDialog4');
Run Code Online (Sandbox Code Playgroud)
我想出的是:
jQuery.fn.showDialog = function(cls) {
$(this).click(function() {
$(cls).show('fast');
});
}
Run Code Online (Sandbox Code Playgroud)
它不起作用,任何人都可以帮忙吗?
谢谢,迈克.