最近,我与一位同事讨论了如何在Java中转换List
为最佳方式,Map
以及是否有任何特定的好处.
我想知道最佳转换方法,如果有人能指导我,我会非常感激.
这是一个好方法:
List<Object[]> results;
Map<Integer, String> resultsMap = new HashMap<Integer, String>();
for (Object[] o : results) {
resultsMap.put((Integer) o[0], (String) o[1]);
}
Run Code Online (Sandbox Code Playgroud) 在iOS 4中,当用户按下Home按钮时,正在运行的应用程序将保存当前状态并转到后台.但是我正在开发一个应用程序,我不希望它转到后台.我想让它自杀,就像在iOS 3和之前一样.我该怎么做?谢谢.
我试图在一个滚动的12个月期间返回一些结果,例如:
MONTH IN OUT
January 210 191
February 200 111
March 132 141
April 112 141
May 191 188
etc...
Run Code Online (Sandbox Code Playgroud)
如何在日期范围内展开结果,使用月份名称填充第一列?
在MSSQL中它将是这样的:
SELECT COUNT(problem.problem_type = 'IN') AS IN,
COUNT(problem.problem_type = 'OUT') AS OUT,
DATEPART(year, DateTime) as Year,
DATEPART(month, DateTime) as Month
FROM problem
WHERE (DateTime >= dbo.FormatDateTime('2010-01-01'))
AND
(DateTime < dbo.FormatDateTime('2010-01-31'))
GROUP BY DATEPART(year, DateTime),
DATEPART(month, DateTime);
Run Code Online (Sandbox Code Playgroud)
但这是针对Oracle数据库的,因此DATEPART和DateTime不可用.
我的问题表大致是:
problem_ID Problem_type IN_Date OUT_Date
1 IN 2010-01-23 16:34:29.0 2010-02-29 13:06:28.0
2 IN 2010-01-27 12:34:29.0 2010-01-29 12:01:28.0
3 OUT 2010-02-13 13:24:29.0 2010-09-29 …
Run Code Online (Sandbox Code Playgroud) 如何从应用程序启动IE实例?用浏览器窗口寻呼到窗口是否更好?
我正在将VB6应用程序转换为C#.我开始在VB6应用程序的顶部,并从那里开始.什么是RS.东西?我不明白?
Sub Main()
Dim RS As ADODB.Recordset
Dim FileName As String, FilePath As String
Dim Test As Boolean
Dim ResultCode As xcdError
Dim oAccess As Access.Application
Dim Zip_File As String
On Error GoTo ErrorHandler
' Make a connection to the database
Call MakeDBConnection
' Create a recordset of the directories to check
Set RS = New ADODB.Recordset
RS.ActiveConnection = DB
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
RS.Open "Select ConversionDefinition.* From ConversionDefinition"
' Check the directories for Raw Data
' If …
Run Code Online (Sandbox Code Playgroud) 我的iPhone应用程序具有自定义UITableViewCell
功能,每个功能都带有图标 在正常的单元状态下,这些图标是黑色的,具有透明背景.而不是将应用程序的第二组倒置图标与突出显示的状态(透明背景上的白色)捆绑在一起,我想在用户触摸相应的表格单元格时使用Core Graphics即时反转这些图标.
我发现了一些UIImage
与用颜色重叠或重新着色相关的其他答案UIImage
,但所有这些技巧都会给我带来模糊的结果(见下文).我已经尝试了各种各样的CGBlendMode
s,以及手动计算更准确的面具(也许我做错了),但似乎我的图标边缘周围的半透明像素变得不透明或者基本上是掉落 - 外观波动/模糊.因为我做错了,我感到很茫然.
它也不是真正改变我所有图标的选项,因此它只是纯黑色/白色而没有透明度 - 我需要将图标放在透明背景上,以便它们也可以叠加在其他UI元素之上.
我用来反转图标的代码(由查德威克伍德提供)(我在每个原始图标上调用此方法并[UIColor whiteColor]
作为第二个参数传入)和示例输出(在带有iOS 4.1的iPhone 4上)在下方(忽略突出显示图像上的蓝色背景 - 它是所选表格单元格的突出显示背景).
任何帮助是极大的赞赏.
示例输入和输出:
@implementation UIImage(FFExtensions)
+ (UIImage *)imageNamed:(NSString *)name withColor:(UIColor *)color {
// load the image
UIImage *img = [UIImage imageNamed:name];
// begin a new image context, to draw our colored image onto
UIGraphicsBeginImageContext(img.size);
// get a reference to that context we created
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
// set the fill color
[color setFill]; …
Run Code Online (Sandbox Code Playgroud) 我差不多完成了这个在线图书馆:http://gramma.ro
我在YSlow中有C级,但我仍然不满意该网站的平均加载时间(在我的网络连接上约为7秒).
也许你们中的一些人会说它运作良好,但请与这个速度相比:http://www.libris.ro/绝对快.
你对我的申请有什么建议吗?您是否看到了我可以改进的关键位置,这会严重缩短我网站的加载时间?
使用的数据库:sql server 2008.
使用的语言:c#+ asp.net
使用的硬件:专用服务器,AMD 64 2.2 Ghz,2 GB Ram
提前致谢...
更新:我已经在我的页面上使用了OutputCache(1小时或1天)选项用于4个用户控件,这改善了网站的加载时间为3秒!
我想在下面的小部件中添加多个类以用于样式目的:
var filteringSelect = new dijit.form.FilteringSelect({
id: "test",
},
"test");
Run Code Online (Sandbox Code Playgroud)
我怎么做到这一点?
这是实际的html:
<div tabindex="-1" wairole="combobox" dojoattachpoint="comboNode" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse" id="widget_test" class="dijit dijitReset dijitInlineTable dijitLeft dijitComboBox" role="combobox" widgetid="test">
<div style="overflow: hidden;">
<div dojoattachevent="onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:_onMouse,onmouseleave:_onMouse" wairole="presentation" dojoattachpoint="downArrowNode" class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton" role="presentation">
<div class="dijitArrowButtonInner">
 
</div>
<div class="dijitArrowButtonChar">
?
</div>
</div>
<div class="dijitReset dijitValidationIcon">
<br>
</div>
<div class="dijitReset dijitValidationIconText">
?
</div>
<div class="dijitReset dijitInputField">
<input type="text" waistate="haspopup-true,autocomplete-list" wairole="textbox" dojoattachpoint="textbox,focusNode" dojoattachevent="onkeypress:_onKeyPress,compositionend" class="dijitReset" autocomplete="off" role="textbox" aria-haspopup="true" aria-autocomplete="list" aria-invalid="false" id="test" tabindex="0" aria-required="true" value="United States"><input type="text" style="display: none;" …
Run Code Online (Sandbox Code Playgroud) 我试图使用ORDER BY对查询进行排序,我需要逐个排序3列.第三列是特定于价值的.
例如:如果我有3列a,b和c我需要使用ORDER BY a,b desc,c ='3'asc,c
我想要做的是首先排序顺序是a,然后b按顺序排列然后我希望其中的值有3个被排序,然后剩下的值不是3.