奇怪的请求,但我需要将当前浏览器滚动位置作为变量.我应该使用什么js或jquery函数?我需要它来确定侧面显示的元素.我在网上发现了一些东西,但没有什么对我的div有用,只是整页.
我正在开发一个私人消息系统,允许用户以他们的全名搜索用户,例如:"George Washington".
我有一个名为两个变量$firstname和$lastname,并通过相关性(你有多少次传递消息的那个人)的搜索功能的命令结果.我如何获得一个文本字段为"乔治·华盛顿"分成$firstname="George"和$lastname="Washington"?
我的Android应用程序必须能够向一大群人发送简短的警报.显而易见的地方是通知中心.完整通知显示在自动收报机中没有问题,但在通知中心,用户只能看到前几个单词,然后是省略号.通知不长,最多只有10-15个字.如何将文本换行到新行?
我在这里构建通知的代码
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.splash)
.setContentTitle("Student Engauge")
.setContentText(extras.getString("message"))
.setAutoCancel(true)
.setTicker(extras.getString("message"));
final int notificationId = 1;
NotificationManager nm = (NotificationManager) getApplicationContext()
.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(notificationId, mBuilder.build());
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个非常长的分段控制器,让用户在众多选项中进行选择.如何在Scroll View中获取它?
我试过拖放它但它不允许我滚动它.
我有一个jquery脚本,当按下键盘上的任何键时显示div.我想在脚本中添加一个条件,如果页面上没有其他输入区域(textarea或texfields),则只运行脚本.这样你就可以实际输入页面的其余部分而不显示div.
$(document).on('keydown', function (e) {
if (!$('#test').is(':visible')) {
//######## IF (every input is not active....) {
if (65 <= e.keyCode && e.keyCode <= 90) {
$(elem).fadeIn();
$('#textarea').val('');
$('#textarea').focus();
$('#textarea').val(temp);
}
}
});
Run Code Online (Sandbox Code Playgroud)
谢谢.如果有必要,我可以在页面上为每个其他textarea提供相同的ID.
我想在工作日上午9点到下午5点之间设置一个cron工作每十分钟运行一次.
我现在有一大堆工作要在工作日以10分钟的间隔运行(所以48个工作岗位)
有没有办法在一个Cron工作中做到这一点?
我无法按照此处的说明使用Android的Big Text通知:NotificationCompat.BigTextStyle.这是我用来显示通知的代码.我知道所有的数据都正确回归,因为我可以将它显示在控制台上,作为传统的内容文本和标题.难道我做错了什么?我是否还需要在其他地方定义bigTestStyle?希望你们中的一个人之前已经做过这件事,并且知道可能会遗漏什么.谢谢.

我的代码:
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle();
bigTextStyle.bigText(extras.getString("message"));
NotificationCompat.Builder bigTextNotification = new NotificationCompat.Builder(context)
.setContentTitle("My App")
.setContentIntent(pendingIntent)
.setContentText("Message:")
.setSound(soundUri)
.setTicker(extras.getString("message"))
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.splash)
.setAutoCancel(true)
.setVibrate(new long[] { 0, 100, 200, 300 })
.setStyle(bigTextStyle);
final int notificationId = (int) (System.currentTimeMillis() / 1000L);
NotificationManager thisone = (NotificationManager) getApplicationContext()
.getSystemService(Context.NOTIFICATION_SERVICE);
thisone.notify(notificationId, bigTextNotification.build());
Run Code Online (Sandbox Code Playgroud) android push-notification android-layout google-cloud-messaging
我正在尝试模仿cmd-tab键盘快捷键的功能,用户可以在应用程序之间切换某个键,然后当它们释放命令时会发生某些事情.
我现在正在使用此代码,但它只能检测keydown.我需要这个才能解决问题
- (void)flagsChanged:(NSEvent *)theEvent {
if ([theEvent modifierFlags] & NSCommandKeyMask) {
NSLog(@"Do my stuff here");
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在使用此代码在我的应用程序中捕获全局键盘快捷键.
这几乎适用于我运行它的每台计算机.我本周在一台全新的Retina Macbook Pro上尝试过,addGlobalMonitorForEventsMatchingMask根本不起作用.它甚至没有像我设置的那样记录每个键进行调试.
有更可靠的方法吗?现在我加载它applicationDidFinishLaunching.
我认为在App Delegate中将它作为自己的方法加载可能更有意义,但我不确定它的语法是什么样的.
[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event){
NSLog(@"sequence = %li", (unsigned long)[event modifierFlags]);
// Activate app when pressing cmd-c
if([event modifierFlags] == 1048840 && [[event charactersIgnoringModifiers] compare:@"c"] == 0) {
Run Code Online (Sandbox Code Playgroud) 我有一些子视图,我放在每个标签栏的视图控制器中.现在我用像素计数来调整它的尺寸,但它只适用于iPhone 4和4s而不是iPhone 5,因为屏幕尺寸较长.我可以检查设备,然后按照这种方式调整大小,但我觉得必须有一个更简单的方法来做到这一点.
viewController1.view.frame = CGRectMake(0, 0, 320, 460);
Run Code Online (Sandbox Code Playgroud)
我将子视图染成黄色,因此更容易看到.

我正在尝试设置深入我的NSMutableDictionary的对象,我的意思是在我可以访问之前有几个级别的密钥.
显然我做不到
setObject:x forKey forKey forKey forKey...
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
objective-c ×5
cocoa ×3
android ×2
cocoa-touch ×2
jquery ×2
cron ×1
crontab ×1
focus ×1
input ×1
ios ×1
javascript ×1
php ×1
ubuntu ×1