w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
suspend thread for a second in C
I assume you are on Linux. Please read Advanced Linux Programming. You want to use the sleep(3) function (or the nanosleep(2) syscall). You probably need to learn also about multiplexing syscalls like poll(2) See also intro(2) man page.

Categories : C

Threads suspend resume c#
You should never use suspend/resume, be it in Java or C#, because only your threads know when it's safe to stop or suspend. Instead use synchronization primitives like events to control the execution of a thread. Here is a little sample using WinForms (so you just need to add a reference to System.Windows.Forms): using System.Threading; using System.Windows.Forms; using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Label label = new Label { Dock = DockStyle.Top }; Button button = new Button { Text = "||", Dock = DockStyle.Bottom }; Form form = new Form(); form.Controls.Add(label); form.Controls.Add(button); bool @continue = true; boo

Categories : C#

How to prevent a script being stopped by suspend?
Even in sleep mode S1 (your "suspend" I think), the CPU(s) stop executing instructions. So your program is no longer running -- hence cannot wake-up your computer... You will certainly have to explore other ways of doing, such as configuring the real-time clock (which is still powered at sleep) to wake-up the computer. On embedded systems, you also have access to an hardware watchdog that could be (miss)used for that purpose. Don't know if this is available on PC.

Categories : Python

How to Poweroff /suspend WinCE 6 device from C#
There's is no command line support to shutdown the WindowCE. you can use PInvoke the core.dll and call P/Invoke ExitWindowsEx [Flags] public enum ExitFlags { Reboot = 0x02, PowerOff = 0x08 } [DllImport("coredll")] public static extern int ExitWindowsEx(ExitFlags flags, int reserved); ... ExitWindowsEx(ExitFlags.PowerOff, 0); ----- Updated --------- Try with GwesPowerOffSystem it's for WinCE 5.0. This is exactly what you are looking for. It's in the same core dll file.

Categories : C#

How to stop/suspend a form from painting in C#?
Several of the standard controls handle WM_SETREDRAW. They don't stop painting, they stop refreshing their window when, say, you add a new item or alter the text. This is not otherwise prescribed behavior, every control interprets that message the way it sees fit. The Form and Control classes do not have any logic built in that alters the way they draw. You will have to implement that yourself. You would not do so with a message handler (WndProc), you'd just add a public property of type bool. And, say, not paint anything in the OnPaint method when it is set to false. Etcetera. Preventing the parent from redrawing itself is not okay, it isn't clear why you are contemplating this.

Categories : C#

iOS Reachability and app suspend/resume behavior
After app resumes, try this: //Reachability is the class from Apple's Reachability sample Reachability *reachability = [Reachability reachabilityForLocalWiFi]; NetworkStatus netStatus = [reachability currentReachabilityStatus]; if (netStatus == NotReachable) { NSLog(@"Not Reachable"); } else { NSLog(@"Reachable"); }

Categories : IOS

Suspend Javascript execution in UIWebView
Do you need a full UIWebView? If not you could just invoke JavaScriptCore directly. - (NSString *)runJS:(NSString *)aJSString { JSContextRef ctx = JSGlobalContextCreate(NULL); JSStringRef scriptJS = JSStringCreateWithUTF8CString([aJSString UTF8String]); JSValueRef exception = NULL; JSValueRef result = JSEvaluateScript([self JSContext], scriptJS, NULL, NULL, 0, &exception); JSGlobalContextRelease(ctx); ... This would give you more control over the entire JS runtime, but unfortunately I've not found an API to suspend execution of timers other than releasing the whole context. For a more complete example of how to use JavaScriptCore see https://github.com/jfahrenkrug/AddressBookSpy/blob/master/AddressBookSpy/AddressBookSpy/ABSEngine.m

Categories : Javascript

Does SQL Server 2008 Log Truncation suspend transactions
I've found this article, which states that a transaction can not be deleted if the records mentioned in the logs are still active. So the answer to your question is No, Transaction log back up or truncation wont suspend the active transactions. Here is the link http://msdn.microsoft.com/en-us/library/ms345414(v=sql.105).aspx

Categories : SQL

"Suspend" execution, but keep event handlers running?
It seems like you're trying to create a service. To do that, the easiest way is probably to create a new project based on the "Windows Service" template and migrate your existing code. MSDN docs: http://msdn.microsoft.com/en-us/library/d56de412.aspx

Categories : Vb.Net

how set suspend an application automatically ? for security purpose
You can use SharedPreferences to keep track of login attempts and check this value each time the login Activity starts. If it equals 6, or whatever number you choose, then show a Dialog informing the user of the issue and how to fix (or however you want to handle that). In the Dialog you can have one Button which on click it closes the Application (just call finish() on that Activity. Each time the login fails just add 1 to the previous value of that SharedPreference. If this isn't what you need then, as CommonsWare said, " define what you mean by 'suspend'"

Categories : Android

Eclipse suspend a specific thread while letting others run
If you have a convenient point in your code to set a breakpoint for that single thread, you can change the Suspend Policy of that breakpoint in its properties to only stop the current thread instead of the whole VM.

Categories : Java

which signal can be used to suspend process temporary in linx
SIGSTOP stops a process, and SIGCONT resumes it (not SIGINT) A process that is stopped by SIGSTOP can not be set to resume on receiving a certain key, because it isn't processing anything while it is stopped, but a parent or another process could be programmed to continue a child on receiving a key...

Categories : Linux

Suspend browsing while AJAX scripts are running?
You cannot suspend browsing per-se, but you can cough up a decent looking 'wait, loading' block on top of a full-page shadow that warns the user that things are happening. That, or disable every href on the page via javascript, which is hardly advisable. :) Other than that, you have no control over the client whatsoever. P.S.: If by "dialog" you mean an alert, kill that thought with fire immediately.

Categories : Ajax

Can printf suspend after printing half the contents
printf ultimately calls write(). If the write() system call returns a -1 because the system call received EINTR, for example, then it is possible for some data to have been written. However, the tty (screen) is line buffered. This means nothing appears on the screen until a character is placed on the output stream. The EINTR would happen on a system that is being really hammered by I/O, for example. Because write() is not guaranteed to complete, it can be interrupted. So, I do not get what you are seeing. What problem do you see?

Categories : C

How can I run my shell script once the device wakeup from suspend mode?
You could try run a watchdog like script, checking if the application is running in a loop and restarting it when needed. In standby the watchdog script will stop and on resume it will restart your application.

Categories : Linux

How to suspend/resume a progress based on the scheduled time?
I assume that the scheduling application you show above persists that information to a file. If so, you can do the following. First, the process that you want to execute must have some way of being told that it needs to shut down. I'll assume that it's some kind of Windows event or a flag in a file or database somewhere that it checks periodically. If you don't have this facility, then you'll have a tough time killing the task safely. Have a small application (call it the Keeper) that reads the schedule from the file. It then checks to see if the program you're scheduling is running. If it is running and it's time to pause, then send the signal telling it to stop. Then, create a scheduled task to restart the program at the next start time. Also create a scheduled task to make the Keeper

Categories : C#

Does QMutex need to be static so other threads calls of this class instance know to suspend their operations?
No it doesn't need to be static, just make it a member in your classA and also you can take a look at QMutexLocker to scope lock and unlock the mutex: void classA::Append(int _msg) { static int c = 0; QMutexLocker locker(&mutex); // mutex is a QMutex member in your class intArray[c] = _msg; c++; /*mutex.unlock(); this unlock is not needed anymore, because QMutexLocker unlocks the mutex when the locker scope ends, this very useful especially if you have conditional and return statements in your function*/ }

Categories : C++

do we need to add provision at server end so that file downloading in browser can give facility for suspend and resume?
If you want to support suspend and resume, you'll need to add support for partial GETs, also referred to support for ranges or range headers. RFC2616 (section 14.35) has the details on how to handle range requests. http://tools.ietf.org/html/rfc2616#section-14.35 Tomcat's default servlet has an implementation you can use as a starting point if you wish. http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?view=annotate

Categories : Java

Add UISearchBar programmatically to a programmatically added UITableView in a normal ViewController
Is your object implementing the delegate methods in UISearchDisplayDelegate? In other words, you have to define what happens when text is entered in the search bar, it does not happen automatically for you.

Categories : Objective C

Suspend a thread from another thread in VB.NET
Instead of suspending the main thread, you could use Control.Invoke (Windows Forms) or Dispatcher.Invoke (WPF) to actually show the message box on the main thread, but call it from your background thread. In addition to providing the behavior you wish, this would also have that advantage of allowing you to parent your message box to the proper Window, which would give the proper modal message box behavior.

Categories : Vb.Net

Programmatically set R.ID
R is a Read-Only class. It is generate at compile time and You should not use reflection to modify its field. Also you should avoid reflection to access the fields values. You should use the official API. The comment at the first row of the class is /* AUTO-GENERATED FILE. DO NOT MODIFY. */

Categories : Android

How can I use JDT compiler programmatically?
org.eclipse.jdt.internal.compiler.Compiler is internal API. According to the JavaDoc of its resolve method: Internal API used to resolve a given compilation unit. Can run a subset of the compilation process. Instead, the official way of compiling Java files and determining the compilation problems is described here. Basically, you create a Java project and invoke Eclipse's builder on it, then query the project's Java problem markers.

Categories : Eclipse

How to add DRM on epub programmatically?
If you just want to protect your books from copying, then publish them through Amazon or Apple. As long as you don't select otherwise, those bookstores will wrap the books in DRM that allows them to be read only a limited number of devices belonging to the purchaser. If you have some reason for wanting to worry about DRM yourself, then after carefully considering why on earth you'd want to, you'll need to find a vendor who can provide both the DRM technology and the reader (perhaps white-labeled for you) which knows how to read those DRM'd books. You see, DRM is useless unless there's a reader that can read the DRM'd books. And what's more, you need a back-end infrastructure to keep track of which devices belong to which person. There are vendors who provide such solutions. However, you'l

Categories : Misc

Best way to name objects programmatically using R?
There is a fair amount of guesswork involved in this answer but I think this could help: # get a vector with the column names in data_resp modNames <- colnames( data_resp ) # create empty list models <- as.list( NULL ) # iterate through your columns and assign the result as list members for( n in modNames ) { models[[n]] <- train(data_pred_scale[!is.na(data_resp[, n]), ], ### this may need modification, can't test without data data_resp[!is.na(data_resp[, n]), n], method = "rf", tuneGrid = data.frame(.mtry = c(3:6)), nodesize = 3, ntrees = 500) } # save the whole bunch save( models, file = "models.rda" ) You can now retrieve, just with load( "models.rda ), this one object, the list with a

Categories : R

Is it possible to run .scf file programmatically
Hand in a ProcessStartInfo with UseShellExecute set to true. This executes the scf in the same way START -> RUN would do.

Categories : C#

Sign JAR programmatically
I Signed jar using pom.xml I happy if it help you: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ABC</groupId> <artifactId>applet</artifactId> <version>ABC</version> <packaging>jar</packaging> <name>applet</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> &l

Categories : Java

How do you programmatically - or from CLI - rotate a PDF?
You can use pdfpages LaTeX package documentclass{article} usepackage{pdfpages} egin{document} includepdf[angle=45]{document.pdf} end{document} The LaTeX document above, compiled via pdflatex, produces a document rotated 45 degrees. There are also tools (wrappers of pdfpages) like pdfjam that can be used directly from command line: $ pdfjam --suffix rotated45 --angle 45 --fitpaper true document.pdf

Categories : PHP

DetailViewController programmatically iOS
Your labels are not being updated to the correct values because the -isEqualToString: method is used to test whether two NSStrings are equal, and it doesn't actually set the value of any NSString. If you want to assign a value to a string variable, you do it the same as you would assign any other variable. Therefore, in order to set the labels properly, you just need to assign the text property of the UILabels, like this: self.username.text = self.user; self.captiontext.text = self.caption;

Categories : Iphone

Get Datasources programmatically
If your datasources are configured with JNDI then you can list the context and can get all the names (more from here) with Context.list() method and from those name you can find all the datasources the Context.list() returns an enumeration of NameClassPair. Each NameClassPair consists of the object's name and its class name. So just iterate it and check the class name for java.sql.DataSource and then get the object name to retrieve it.

Categories : Java

How to kill an 3rd-app programmatically?
You can't kill just any process in Android. From the documentation on Process: Note that, though this API allows us to request to kill any process based on its PID, the kernel will still impose standard restrictions on which PIDs you are actually able to kill. Typically this means only the process running the caller's packages/application and any additional processes created by that app; packages sharing a common UID will also be able to kill each other's processes. Also note that the permission you're requesting in your manifest doesn't work the way you think it does. According to the documentation, KILL_BACKGROUND_PROCESS: Allows an application to call killBackgroundProcesses(String).

Categories : Java

Change Tab Bar Programmatically
As @H2CO3 mentioned, there is no tabBarController property in NSTabView. If you read the documentation, you’ll notice that NSTabView provides a few selection methods, including -selectTabViewItemAtIndex:, which you can use like so: - (IBAction)startScratch:(id)sender { [_mainTabBar selectTabViewItemAtIndex:1]; } Note that the first tab is at index 0.

Categories : Objective C

Programmatically instantiating ValueExpressions
This is a known bug in JSF. It has been filed here with the Mojarra team: https://java.net/jira/browse/JAVASERVERFACES-2089 and here with the MyFaces team: https://issues.apache.org/jira/browse/MYFACES-3168. I realize the phrasing of these bug reports is not exactly what you'd expect, but it is the same bug. If you look at the comments: Hi guys, I just hit this bug again while working on a client's code, and noticed Manfred had closed it as 'resolved'? Why was this considered 'resolved'? It's a real problem for me, stopping me doing things like... <h:dataTable value="#{companyImport.importFiles}" var="_importFile"> <h:column> <h:outputText value="#{_importFile.name}:"/> </h:column> <h:column> <m:metawidget value="#{_importFi

Categories : JSF

Programmatically create json
Try this var json = {"sensors":[]}; $(".marker").each(function() { var x = $(this).attr("data-x"); var y = $(this).attr("data-y"); var id = $(this).attr("data-id"); json.sensors.push({"x":x, "y":y,"id":id}); });

Categories : Javascript

implementation of tab bar programmatically not in the rootView
Create your UITabBarController as per normal. When a user touches a button, push to that controller: YourTabController *tabController = [[YourTabController alloc] initWithNibName:@"Tabs" bundle:nil]; [self.navController pushViewController:tabController animated:YES];

Categories : Iphone

Add items to popup programmatically
Popup is a FrameworkElement and can have only one child (Child) => you cannot add multiple controls inside, but you can set Child to be any UIElement you want. For instance a DockPanel, and than use AddChild on the panel to add further controls. myPopup.Child = new DockPanel();

Categories : C#

how to programmatically set a value of Treelist in sitecore
Sitecore Treelist stores the ids of selected items in a pipeline separated form. If you want to set the value of Treelist programmatically you need to set it to a string which looks like: {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}|{EA015A5F-C41B-4510-B538-438EF204F5E2} where {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}, {EA015A5F-C41B-4510-B538-438EF204F5E2} and possibly more of the string parts separated with | characters are ids of chosen pages. using (new EditContext(jobItem)) { jobItem["OfficeLocations"] = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}|{EA015A5F-C41B-4510-B538-438EF204F5E2}"; }

Categories : C#

Expanding NSOutlineView programmatically
Thanks to all of you to look into this, By putting log, i found out to be , it seems to be [NSOutlineView reloadData ] seems to be blocking call, so after that if i need to expand / collapse group , i am using [pCTOutlineView expandItem:pValue]; and working so far....

Categories : Objective C

End call in android programmatically
You do not need to be a system app. First, create package com.internal.android.telephony in your project, and put this in a file called "ITelephony.aidl": package com.android.internal.telephony; interface ITelephony { boolean endCall(); void answerRingingCall(); void silenceRinger(); } Once you have that, you can use this code to end a call: TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); Class clazz = Class.forName(telephonyManager.getClass().getName()); Method method = clazz.getDeclaredMethod("getITelephony"); method.setAccessible(true); ITelephony telephonyService = (ITelephony) method.invoke(telephonyManager); telephonyService.endCall(); You could use this inside a PhoneStateListener, for example.

Categories : Android

How-to edit EDMX programmatically
Well, what I wanted was a free library which contained the object-model representation of the EDMX. This would allow developers to edmx.Load(pathToEdmx), query the object-model, make changes, and edmx.Save(). Apparently, such a library doesn't exist. So, I wrote some code to load the XML, query the XML, make some changes, and save. Not as rich as an object-model with validation and helpful exceptions (and very prone to typos), but it worked.

Categories : Entity Framework

Download Android SDK programmatically
Decompilation as suggested in one of the comments is overkill. You just need to parse the XML content from https://dl-ssl.google.com/android/repository/repository.xml . Check the SDK:url tag and use that to fetch (wget, curl, httpclient, ...) the required zip files.

Categories : Java



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