下午好,
我有一些文本文件,其中包含通过分析报纸文章集合收集的(2克,计数)对的列表,当我启动我正在开发的给定应用程序时,我需要将其加载到内存中.要存储这些对,我使用的结构类似于以下结构:
private static Dictionary<String, Int64>[] ListaDigramas = new Dictionary<String, Int64>[27];
Run Code Online (Sandbox Code Playgroud)
拥有一系列字典的意思是效率问题,因为我在某处读到长字典会对性能产生负面影响.也就是说,每2克进入字典,对应于它的第一个字符的ASCII码减97(如果第一个字符不是'a'到'z'范围内的字符,则为26).
当我将(2-gram,count)对加载到内存中时,应用程序需要总共800Mb的RAM,并保持这样,直到我使用一个名为Memory Cleaner的程序来释放内存.在此之后,程序占用的内存下降到7Mb-100Mb的范围,而不会失去功能(我认为).
有没有办法可以通过这种方式释放内存但不使用外部应用程序?我尝试使用GC.Collect()但在这种情况下不起作用.
非常感谢你.
我有一个我在谷歌找不到的小问题:
UITableView工作正常,直到我开始滚动.
Error Message: `-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5f24870 `
Run Code Online (Sandbox Code Playgroud)
方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
// Set up the cell
int storyIndex = [indexPath indexAtPosition: [indexPath length]-1];
//populate cell
cell.textLabel.text = [[myArray objectAtIndex: storyIndex] objectForKey: @"subject"];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
只是猜到这是"问题" - 方法......如果您需要更多信息:请告诉我:)感谢您的帮助!
编辑:myArray只是正常NSArray *myArray
它是一个排序的数组 - >
NSSortDescriptor *sortDescriptor …Run Code Online (Sandbox Code Playgroud) 在Google AppEngine上进行Clojure开发的良好起点是什么?
似乎有两个竞争库appengine-magic和compojure-gae.
你有什么意见?
如何获取鼠标当前指向的div的id?
如果我启动一个Java应用程序,它启动并做一些工作然后进入线程睡眠一小时,然后在一小时后醒来并做更多的工作......
但我的电脑运行Win7和闲置15分钟后,它会进入睡眠模式,所以我的问题是:从我一小时开始的Java应用程序,如果我不碰电脑,并进入休眠模式,将我的Java应用程序仍然能够醒来,做的工作,如果是的话将在Win7的电脑唤醒与屏幕再次打开[因为在Win7休眠模式下的屏幕关闭]
我写了一个快速的小应用程序,它利用代码与某些关键词的基本文件,替换为关键字的文件,并输出与替换关键字的新文件.
当我使用Ruby 1.8时,我的输出看起来很好.现在使用Ruby 1.9时,我替换的代码中包含换行符而不是换行符.
例如,我看到类似的东西:
["\r\nDim RunningNormal_1 As Boolean", "\r\nDim RunningNormal_2 As Boolean", "\r\nDim RunningNormal_3 As Boolean"]
Run Code Online (Sandbox Code Playgroud)
代替:
Dim RunningNormal_1 As Boolean
Dim RunningNormal_2 As Boolean
Dim RunningNormal_3 As Boolean
Run Code Online (Sandbox Code Playgroud)
我使用替换的散列{"KEYWORD" => ["1","2","3"]}和替代的线的阵列.
我用这个块来完成更换:
resultingLibs.each do |x|
libraryString.sub!(/(<REPEAT>(.*?)<\/REPEAT>)/im) do |match|
x.each do |individual|
individual.to_s
end
end
end
#for each resulting group of the repeatable pattern,
#
#Write out the resulting libs to a combined string
Run Code Online (Sandbox Code Playgroud)
我的预感是我打印出数组而不是数组中的字符串.有关修复的任何建议.当我使用puts调试和打印我替换的字符串时,输出看起来是正确的.当我使用to_s方法(这是我的应用程序将输出写入输出文件的方式)时,我的输出看起来不对.
修复会很好,但我真正想知道的是Ruby 1.8和1.9之间的变化导致了这种行为.to_s方法在Ruby 1.9中以某种方式改变了吗?
*我对Ruby缺乏经验
我试图用我的应用程序设置我导入到iphone日历中的事件的可用性.我使用这段代码:
[event1 setAvailability:EKEventAvailabilityFree];
Run Code Online (Sandbox Code Playgroud)
当我将我的iphone同步到我的iCal时,我检查事件的可用性,并说"忙".Xcode确实要求一个整数,但是free选项没有.当我运行此代码时,我没有错误,有人可以帮助弄清楚什么是错的.
我有一个数组$ product_array,当我使用print_r($ product_array);时.数组显示如下
Array
(
[0] => Array
(
[ID] => P00100
[NAME] => Edina
[PRICE] => $20.00
)
[1] => Array
(
[ID] => P00101
[NAME] => Richfield
[PRICE] => $21.00
)
[2] => Array
(
[ID] => P00102
[NAME] => Bloomington
[PRICE] => $22.00
)
)
Run Code Online (Sandbox Code Playgroud)
我将我的数据库表设置为4个coluts,第一个是mainid,然后是自动增量,后跟ID,NAME,PRICE,如上面显示的键.我想将这个数组$ product_array插入到mysql中.有人可以帮忙吗?非常感谢!韩国社交协会.
我需要计算MySQL select语句中日期的周数.其中一个表中有一个日期列,我需要计算该日期的周数.
SELECT EventDate, (calculation) AS WeeksOut FROM Events;
Run Code Online (Sandbox Code Playgroud)
例:
我无法理解这一点.我想使用这家供应商的OCX http://www.mobyt.it/来发送短信.它是一个DLL,它们提供Vb,.NET,Visual C等的用法示例.
我得到的例外是:
System.Runtime.InteropServices.COMException(0x80040154):未注册接口.(来自HRESULT的异常:0x80040154(REGDB_E_CLASSNOTREG))
我在打扰我.看起来COM对象没有注册,但我该如何注册呢?我试过regsvr32好运.
iphone ×2
mysql ×2
.net ×1
arrays ×1
c# ×1
clojure ×1
cocoa-touch ×1
com ×1
exception ×1
java ×1
javascript ×1
mouseevent ×1
mouseover ×1
objective-c ×1
ocx ×1
php ×1
ruby ×1
ruby-1.9 ×1
sdk ×1
sleep-mode ×1
sql ×1
string ×1
windows ×1