w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Notifications bar lags when onGoing notification is on
Check whether 'if-case' code to show notification is getting executed repeatedly. If so try limiting show notification to once via a flag value and reset the flag during notifi.cancel().

Categories : Android

Ongoing Notification and singleTop-Flag
This is not correct: PendingIntent startIntent = PendingIntent.getActivity(context, 0, activityIntent, Intent.FLAG_ACTIVITY_SINGLE_TOP); You are passing an Intent flag to getActivity(). The 4th parameter for getActivity() takes PendingIntent flags, such as: PendingIntent.FLAG_CANCEL_CURRENT PendingIntent.FLAG_NO_CREATE PendingIntent.FLAG_ONE_SHOT PendingIntent.FLAG_UPDATE_CURRENT You are passing Intent.FLAG_ACTIVITY_SINGLE_TOP as the 4th parameter. That constance actually has the value 0x20000000. Coincidentally, PendingIntent.NO_CREATE also has the value 0x20000000, so what you are doing is the same as this: PendingIntent startIntent = PendingIntent.getActivity(context, 0, activityIntent, PendingIntent.NO_CREATE); That's your problem. Just set the 4th parameter to getActivity

Categories : Android

Local notification on application termination
You will not receive any notice when it gets terminated, when your app is suspended in the background. iOS will send a kill -9 signal for your apps progress and you app is just killed, this is the same thing that happens when the user kills your app from the quicklaunch tray. From the Apple documentation: Even if you develop your app using iOS SDK 4 and later, you must still be prepared for your app to be killed without any notification. The user can kill apps explicitly using the multitasking UI. In addition, if memory becomes constrained, the system might remove apps from memory to make more room. Suspended apps are not notified of termination but if your app is currently running in the background state (and not suspended), the system calls the applicationWillTerminat

Categories : Iphone

How to clear all the notifications from notification bar in iphone
It seems your code is correct. Still you can try this. [UIApplication sharedApplication].applicationIconBadgeNumber = -1; See this.

Categories : Iphone

How to clear a single notification from a list of notifications on clicking?
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { // when you tap on any of notification this delegate method will call... [[UIApplication sharedApplication] cancelLocalNotification:notification]; }

Categories : Iphone

Clear Push notifications from notification centre after selecting one
All you need to do is application.applicationIconBadgeNumber = 0; in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions. EDIT If you are not closing your app but just sending it to background. Then add this in your below function as well. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if ( application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground ) { //opened from a push notification when the app was on background application.applicationIconBadgeNumber = 0; } }

Categories : IOS

How to clear Push notification alert on status bar - android
Does android.app.NotificationManager.cancelAll() not work? If you need to do something very custom, you can use ParsePush to launch an Intent rather than creating a Notification. You can then use a BroadcastReceiver to create Notifications with non-standard behavior (i.e. selective stacking, dismiss all when one is interacted with, etc).

Categories : Android

How can we detect notification cancel?
You don't need an intent-filter to get a broadcast if you define the Intent to trigger your class by hand. Just implement the BroadcastReceiver public class NotificationDeleteReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // kill service here } } And add the Receiver to the AndroidManifest.xml <receiver android:name="NotificationDeleteReceiver" /> Then set the PendingIndent to the notification: notification.deleteIntent = PendingIntent.getBroadcast( this, 0, new Intent(context, NotificationDeleteReceiver.class), 0); This will work.

Categories : Android

Chrome Notification/Permission Bar - Detect if visible
Detecting the security bar would be a security breach. I doesn't seem to me that this would be implemented for use in any language. i am 100% certain this can not be done in javascript as well as AS3

Categories : Javascript

How to stop an ongoing upload in vc
If you are using WININET, you need to post the file in several smaller chunks. If the uses presses "Cancel" you then need to set a variable to abort the upload. This must be checked after each small upload... A full example of Splitting Uploads into smaller pparts can be found here: http://support.microsoft.com/kb/177188/en-us You need to download the "hsrex.exe" file and then open it with WinZip or 7-zip and extract the "BigPost.cpp" file. Also I can post the code here, if you want...

Categories : C++

Discern "ongoing" notifciations in AccessibilityService?
As you can see in StatusBarNotification.java, isOngoing() just looks at the flags: public boolean isOngoing() { return (notification.flags & Notification.FLAG_ONGOING_EVENT) != 0; } So you can do this too. There's no way to clear notifications using an accessibility service—that's why the NotificationListenerService was created. :)

Categories : Android

AngularJS ongoing polling of server, with cancellation
I think the specific error you're getting is because, when you do $timeout(thing.startPolling, 15000), startPolling is unbound. So "this" inside startPolling is undefined. I think you could just replace both $timeout calls with $timeout(obj.poller, ...) and get rid of startPolling. Or you can just bind the method like $timeout(thing.poller.bind(thing), 5000).

Categories : Angularjs

Typing on an EditText without disturbing ongoing activity?
There is an opensource library for that. Its called the standOut library. Have a look. It may help you.

Categories : Android

To generate and keep log files ongoing for the last 5-7 days in XML in log4j.xml
http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender Read the manual :) Hint: Triggering Policies

Categories : Java

Check for any ongoing background API calls to finish in AngularJS
Perhaps something like: $scope.$watch('!is_searching && publishing', function(newVal){ if (newVal) { $scope.memberslist.members = $scope.memberslist.temp; $scope.publishing = false; } }) Set "is_searching" to true on the scope when the search starts, and set it to false when it is done. Set "publishing" on the scope when the search button is clicked. That should give you the desired behavior. Publish right away if no search is running, otherwise wait until search is complete.

Categories : Angularjs

Break ongoing loop started by a tkinter button
What I would do is, is that I would make your active_stat a tkinter variable, and then call its get method when ever you want to check if it: EDIT: also, add root.update() to your loop. That should fix your problem. The reason for the tkinter variables is because of variable scope problems, which I initially though where your problem. (note: this code is for python 3...) import time import tkinter as Tk def _start(): for outer in range(5): if active_stat.get(): time.sleep(1) # some code in the real app else: active_stat.set(True) break for inner in range(5): if active_stat.get(): #counterstr.set("%02d-%02d" % (outer,inner)) #does not update till the end of loop textbox.insert(Tk.E

Categories : Python

Notification won't work using notification manager and notification.builder
According to the documentation, you can try something like this NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.notification_icon) .setContentTitle("My notification") .setContentText("Hello World!"); Intent resultIntent = new Intent(this, ResultActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(ResultActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( 0, PendingIntent.FLAG_UPDATE_CURRENT ); mBuilder.setContentIntent(resultPendingIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotific

Categories : Android

In AngularJS, how to stop ongoing $http calls on query change
You should use version 1.1.5, which has the ability to cancel $http requests: https://github.com/angular/angular.js/blob/master/CHANGELOG.md // set up a dummy canceler var canceler = $q.defer(); // use it as a timeout canceler for the request $http({method: 'GET', url: '/some', timeout: canceler.promise}).success( function (data) { alert("this won't be displayed on cancel"); } ).error( function (data) { alert("this will be displayed on cancel"); } ) // now, cancel it (before it may come back with data) $rootScope.$apply(function() { canceler.resolve(); }); you can use the same canceler for all the requests, and resolve it just before starting the new set.

Categories : Http

Confusion between "#define clear()" and "std::wstring::clear()"
The reason is because the preprocessor basically does a search-and-replace on all macros that are defined. And it's done before the compiler proper gets the code, and it does not know anything about namespaces, classes or scope in general. So if you have e.g. #define clear() something and then use wstr.clear(); The preprocessor will replace the clear() so that the compiler sees wstr.something;

Categories : C++

How to clear the bottom of an image like clear left / right
Based on your image, you can realize the layout by using the the following HTML: <div class="contentpart"> <a href="#"> <img src="http://placehold.it/300x200"> </a> Donec adipiscing, lorem non euismod venenatis... </div> and applying the following CSS rules: .contentpart { border: 1px dotted gray; display: table; } .contentpart a { display: table-cell; vertical-align: top; padding-right: 20px; } You can see the demo at: http://jsfiddle.net/audetwebdesign/wknjA/ How This Works You can use CSS tables to get the text to stay in a single column without wrapping it in a block element. Apply display: table to the parent block and display: table-cell to the a tag. You can have some control over white space by

Categories : CSS

Asp.net session termination
Do you wan't to log out the user? In that case killing of the session won't work for you. If you use Forms Authentication, you can execute FormsAuthentication.SignOut method to do that.

Categories : C#

Get Process Information After Termination
Quoting from man 5 proc: /proc/[pid] There is a numerical subdirectory for each running process; the subdirectory is named by the process ID. A terminated process is no longer running, and its /proc/[pid] directory (including the stat file), is no longer going to be there. If it was going to be there, you can just store the PID in a variable before you call proc.wait(): pid = proc.pid proc.wait() with open('/proc/%d/stat' % pid, "r") as f: There is no 'just before termination' event; subprocess waits, then reaps the exit code. You could do your own waiting with os.wait4() instead: pid, status, resources = os.wait4(proc.pid, 0) cpu_time = resources.ru_utime + resources.ru_stime resources is a named tuple, see resource.getrusage() for a list of what names it supports. Both .

Categories : Python

termination of finite lists
One way to prove that a recursive calculation will terminate if the size of its input is (a) finite and (b) decreasing. Let's look at pp pp :: [a] -> [a] pp list = case list of [] -> [] (x: _) -> x : (qq list) The last line returns x:qq list, but the input was list, so it calls qq with the same length list. Let's see what qq does: qq :: [a] -> [a] qq list = case list of [] -> [] (x: xs) -> (pp xs) ++ [x] Here, we call pp xs, where we've matched list with the pattern x:xs. This means x is the head (first element) and xs is the tail (rest-of-list), so xs is one element shorter than the input, list. This means that the length of the input decreases by one every time we call qq and doesn't decrease when we call pp. Hence you're right that there are a

Categories : Haskell

Program termination callback in QT?
You need to handle Linux-style signals. Note - this will not work on Windows or Mac if you are trying to be cross platform. See the Qt article Calling Qt Functions From Unix Signal Handlers. Here is a minimal setup example extracted from the article: class MyDaemon : public QObject { ... public: static void hupSignalHandler(int unused); public slots: void handleSigHup(); private: static int sighupFd[2]; QSocketNotifier *snHup; }; MyDaemon::MyDaemon(...) { if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sighupFd)) qFatal("Couldn't create HUP socketpair"); snHup = new QSocketNotifier(sighupFd[1], QSocketNotifier::Read, this); connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup())); } static int setup_unix_signal_handlers() { struct siga

Categories : C++

Null termination of C string
First question: yes Second question: yes on a ASCII system: you calculate '4' - '2' + '' which is in integers: 0x34 - 0x32 + 0 = 2 so you get str[2] which is '2' which is 0x32. '4' - '2' to be 2 is defined in C, but if you ran your code on an EBCDIC system, '2' was 0xf2

Categories : C

Correct greenlet termination
Why not try something like: timeout = Timeout(10) def downloadSite(url): with Timeout(10): downloadUrl(url) urls = ["url1", "url2", "url3"] workers = [] limit = 5 counter = 0 for i in urls: # limit to 5 URL requests at a time if counter < limit: workers.append(gevent.spawn(downloadSite, i)) counter += 1 else: gevent.joinall(workers) workers = [i,] counter = 0 gevent.joinall(workers) You could also save a status in a dict or something for every URL, or append the ones that fail in a different array, to retry later.

Categories : Python

While loop termination in Python
the counter i gets increased by another function Impossible. it is a local integer. The values printed are values of a different variable. Try add print i inside the loop, and you'll see. int is an immutable type. it means an object of this type cannot change its value. The only thing can change is the object that some variable is holding. def inc(i): i+=1 i=0 inc(i) print i output: 0 why is this? because i inside inc and i outside it are two independent variable. The i+=1 inside inc only mean "Let the local variable i now point to a new object, 2". It does not affect the global i in any way. Just like C and Java (and the default in most other major languages), variables are passed by value. The only way this loop can end is if function removes elements from f, assuming

Categories : Python

How to ignore remote notification when App runs in the foreground but handle it when clicking the notification to launch the App?
When the app is in the foreground, a notification doesn't appear in the notification bar. The notification payload is passed to the application:didReceiveRemoteNotification: method, where you can ignore it if that's what you want. When the app is running in the background when the notification arrives, when you open the app, application:didReceiveRemoteNotification: is also called. You can distinguish between those two cases with the following code : -(void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo { if([app applicationState] == UIApplicationStateInactive) { //application was running in the background } } When you open the app by tapping a notification, the notification payload is passed to a different method, called a

Categories : IOS

Android Notification : perform task in place by clicking notification. Do not launch an activity
That should be an easy one. Just use an IntentService: http://developer.android.com/reference/android/app/IntentService.html and here the first tutorial I found on google: http://mobile.tutsplus.com/tutorials/android/android-fundamentals-intentservice-basics/

Categories : Android

Distinguish notification center hiding and returning from background with DidBecomeActive notification
Maybe you should try UIApplicationWillEnterForegroundNotification, the apple doc has said: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html UIApplicationDidBecomeActiveNotification: Posted when the application becomes active. An application is active when it is receiving events. An active application can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.

Categories : IOS

How to get server notification(push notification) to client using vert.x java api
The callback function in registerHandler() receive message from server in Json form. You can get your custom message by message.notification where notification is your unique key that is to be set at server side.

Categories : Java

How to hide Notification Panel after sending a PendingIntent to Service in a notification
find my question answered in other place: 1. Android: How to collapse status bar on android 4.2? 2. Preventing status bar expansion first, add use permission lines to AndroidManifest.xml <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/> second, use following codes to make it work: try { Object service = getSystemService("statusbar"); Class<?> statusbarManager = Class.forName("android.app.StatusBarManager"); if (Build.VERSION.SDK_INT <= 16) { Method collapse = statusbarManager.getMethod("collapse"); collapse.setAccessible(true); collapse.invoke(service); } else { Method collapse2 = statusbarManager.getMethod("collapsePanels"); collapse2.setAccessible(true); collapse2.in

Categories : Android

Intercepting push notification android c2dm from another application and using the notification in my app
First of all, c2dm has been deprecated for a year now. You shouldn't use it in new development, and if you have apps already using it, you should migrate to Google Cloud Messaging. In GCM, when you using the same credentials for differnt apps, you still get different registration ids for the same device. Therefore one app cannot receive the notifications sent to another app. You must send the notification from the server to the registration ids of both apps.

Categories : Android

Android notification PendingIntent open activity per notification click
Just use this one line of code- PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); And for more detail see this answer: GCM android Push Notification shows old message always. Intent received incorrect

Categories : Android

Clicking Android Notification Actions does not close Notification drawer
The android system collapses the notification drawer for you whenever you click on a notification and launch an activity or broadcast. I don't think there are any programmatic way to close the notification drawer by your code. I suggest that you check the intents that you pass to the notification builder and make sure that they are given correct reference intents. I think something inside the android notification manager is getting blocked due to the intent you provide. So far i have not seen the notification drawer staying open once the action is triggered from the notification. Just curious to know whether your target activity is having a semitransparent area where the previous activity is visible, if it is then i suggest you make the background completely opaque (having no transparent/s

Categories : Android

Unexpected termination of my Java program
Your for loop is wrong. It will only ever loop once and only if testCases is 1. Try this instead: for( int loop1 = 0; loop1 < testCases; ++loop1 ) FYI - There is nothing wrong with starting at 1 and going until <= numIterations, however general programming convention is to start at value 0 and go till < numIterations because that is how arrays work (1st element is at index 0, then 10th is at index 9).

Categories : Java

What is "Terminating in response to backboardd's termination"?
backboardd is the companion daemon for SpringBoard. "Terminating in response to backboardd's termination” most likely means that backboardd crashed. Check to see if there are any backboardd crash logs and, if present, file a bug report with Apple.

Categories : IOS

Checking for abnormal socket termination
(decided to move this to an answer) BufferedReader.readLine() returns null if the socket is closed as per the docs. Your if statement's first condition as shown: if (null != lastLine && !lastLine.equals ("QUIT")) will evaluate to false if that is the case (or, your computer is broken ;) ). If your logging says "null" and it's not evaluating to false ... then the string contains the actual text "null". Put it in the debugger, set a breakpoint in this loop, and step through looking at the value of lastLine; you will see what's going on. That said, the first rule of writing a server is never trust the client. Like in the case of your using telnet ultimately you don't have any control over what's being sent to you. When you read from that socket, you need to be doing more input

Categories : Java

Termination of PHP script between two mysql queries
Use a transaction: START TRANSACTION; INSERT INTO foo ... INSERT INTO bar ... COMMIT If either INSERT fails, you ROLLBACK the transaction and you won't be left with "useless" records.

Categories : PHP

C++ varadic template class termination
Your most general case takes at least 1 argument (pin), so you cannot create a specialization, that has 0 arguments. Instead, you should make most general case, that accepts any amount of arguments: template< typename... > class tee; And then create specializations: template< typename pin, typename... tail_args > class tee<pin, tail_args...> { public: typedef tee< tail_args... > tail; static void set( bool b ){ pin::set( b ); tail::set( b ); } }; template<> class tee<> { public: static void set( bool b ){} };

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.