程序设计

专业和发烧友程序员的问答

17
是否可以从Javascript ping服务器?
我正在制作一个Web应用程序,要求我检查远程服务器是否在线。当我从命令行运行它时,我的页面加载达到60s(对于8个条目,它将线性增加)。 我决定在用户​​端执行ping操作。这样,我可以加载页面并让他们在浏览内容时等待“服务器在线”数据。 如果有人对上述问题有答案,或者他们知道一种可以使我的页面快速加载的解决方案,我一定会很感激的。
152 javascript 

1
LibStatusBar图标在第三方应用启动时消失
我为Cydia编写了一个调整项,它在状态栏中添加了一个图标。它在主屏幕上正常运行,并且在启动SpringBoard时,如果已经启动了某个应用程序,那么它也可以正常运行,但是,如果某个应用程序(例如Facebook或Twitter)已关闭(完全)并且图标显示,启动应用程序,它将导致图标消失。使用以下代码使用libStatusBar显示图标: if(icon) // if icon needs to be removed { [icon release]; icon = nil; } ... // add the icon to the status bar icon = [[%c(LSStatusBarItem) alloc] initWithIdentifier:[NSString stringWithFormat:@"muteIconLablabla"] alignment:StatusBarAlignmentRight]; icon.imageName = [NSString stringWithFormat:@"Mute"]; 我也尝试使用libStatusBar自述文件中建议的方法 [[UIApplication sharedApplication] addStatusBarImageNamed:@"ON_Mute"]; // and removeStatusBarImageNamed:... 我尝试覆盖-(id)init和更新那里的图标,但结果相同。 上面显示的代码是从一个static void函数中调用的。这个函数被调用几次,例如从-(void)applicationDidFinishLaunching:(id)application 下%hook SpringBoard和-(void)ringerChanged:(int)changed 所有里面Tweak.xm。问题也发生了iOS7。

8
如何阻止Visual Studio“始终”检出解决方案文件?
显然没有理由,每次我打开解决方案时,Visual Studio都会将sln文件签出。 如果将其与以前的版本进行比较,则没有任何变化。但这确实令人沮丧,因为每个人都有解决方案。 我正在使用VS 2008和TFS 2008,两者均为SP2。 关于如何阻止这种情况发生的任何想法?或者是VS的TFS源代码控制提供程序的功能/错误?


30
如果该行或列包含0,则将矩阵中的每个单元格设置为0
想要改善这篇文章吗?提供此问题的详细答案,包括引文和答案正确的解释。答案不够详细的答案可能会被编辑或删除。 给定一个0x和1s的NxN矩阵。将包含a的每一行设置0为all 0,并将包含a的每一列设置0为all 0。 例如 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 结果是 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 …


18
Android通知声音
我使用了较新的NotificationCompat构建器,但无法获得发出声音的通知。它将振动并闪烁灯光。android文档说要设置我已经完成的样式: builder.setStyle(new NotificationCompat.InboxStyle()); 但是没有声音吗? 完整代码: NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Notifications Example") .setContentText("This is a test notification"); Intent notificationIntent = new Intent(this, MenuScreen.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); builder.setAutoCancel(true); builder.setLights(Color.BLUE, 500, 500); long[] pattern = {500,500,500,500,500,500,500,500,500}; builder.setVibrate(pattern); builder.setStyle(new NotificationCompat.InboxStyle()); // Add as notification NotificationManager manager = …

26
在PHP中将数字转换为月份名称
我有这个PHP代码: $monthNum = sprintf("%02s", $result["month"]); $monthName = date("F", strtotime($monthNum)); echo $monthName; 但这是返回December而不是August。 $result["month"]等于8,因此sprintf函数要添加一个0使其08。
152 php  date 

10
从JavaScript中的KeyCode获取字符值,然后修剪
这就是我现在所拥有的: $("input").bind("keydown",function(e){ var value = this.value + String.fromCharCode(e.keyCode); } 如果e.keyCode可能不是一个ASCII字符(Alt,backspace,del,arrows,,等)......我现在需要trim这些价值从value某种程度上(最好是编程-不查找表)。 我正在使用jQuery。 我必须使用该keydown事件。keyPress不会激活某些键,我需要捕捉(Esc,del,backspace等)。 我不能setTimeout用来获取输入的值。setTimeout(function(){},0)太慢了。

9
如何获得字典中的键列表?
我只想要键,而不想要字典的值。 我还没有获得任何代码来执行此操作。使用另一个数组被证明是太多的工作,因为我也使用remove。 如何获得字典中的键列表?
152 c#  list  dictionary 






By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.