locking

How to work around ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc

北战南征 提交于 2019-12-01 06:40:46
问题 I want to lock one record in a table. The record is specified as "the next that has ID greater than..." CREATE TABLE test (id number); SELECT id FROM (SELECT id FROM test WHERE id > 10 ORDER BY id) WHERE ROWNUM = 1 FOR UPDATE; This seems intuitive and easy. But it is not. Any ideas? P.S. I do need the existing query to remain the same because it is a cursor and there are several places that use this cursor's %rowtype. 回答1: I think you're going to need something like: SELECT id FROM test WHERE

Prevent screen lock on dimming/standby while using android app?

时间秒杀一切 提交于 2019-12-01 06:16:42
问题 I'm developing an application and the last touch I need to put on it is preventing the screen to lock when the device goes into standby (screen off). The exact behavior as Google Navigation. I'm wondering what, programatically I will have to use to keep this feature enable the entire time while using the app? 回答1: writing the following code to your xml file will prevent the screen from locking android:keepScreenOn="true" 回答2: In the onCreate of your activity after the setContentView use this:

c++11 std::mutex compiler error in Visual Studio 2012

懵懂的女人 提交于 2019-12-01 06:13:51
问题 This a quest about deadlock in C++11 standard. In the sec3.2.4 of C++ Concurrency in Action, there is an example for preventing multithreads from deadlock. For guys without this book, in addition, there is an another almost similar example you can refer to: http://en.cppreference.com/w/cpp/thread/lock_tag The problem I encountered is that the codes of both codes arise compiler-errors in Visual Studio 2012. The error message is: 'std::mutex::mutex': cannot access private member declared in

SQL Server 2008: SELECT FOR UPDATE

不问归期 提交于 2019-12-01 06:13:01
I have seen a question on here about this however it was old so I will ask again in case a solution now exists. My issue is this. I have a database table which I wish to select from but I want to lock the rows that I have selected. The reason for this is that I may have another process running that will also want to select the same rows and I want to prevent this. Imagine I have two processes doing the same thing. One performs a select and begins to perform its processing of the data. Then a few seconds later the next process comes along and does a select but because the rows aren't locked it

Android lock screen

天涯浪子 提交于 2019-12-01 06:11:20
问题 Is there a way to display text on lock screen? Like the information about unread SMS messages or like that Music Player on lock screen with Play/Pause buttons. Thanks 回答1: Yes and no. Their is no public API to create or modify the lock screen. Whoever built the OS version on your device created your lock screen. Some of the manufacturers or carriers have added additional things to the lock screen. I've seen some that tie in to the music app, HTC sense has a somewhat customizable lock screen.

Thread safe usage of lock helpers (concerning memory barriers)

允我心安 提交于 2019-12-01 05:39:57
By lock helpers I am referring to disposable objects with which locking can be implemented via using statements. For example, consider a typical usage of the SyncLock class from Jon Skeet's MiscUtil : public class Example { private readonly SyncLock _padlock; public Example() { _padlock = new SyncLock(); } public void ConcurrentMethod() { using (_padlock.Lock()) { // Now own the padlock - do concurrent stuff } } } Now, consider the following usage: var example = new Example(); new Thread(example.ConcurrentMethod).Start(); My question is this - since example is created on one thread and

SQL Server 2008: SELECT FOR UPDATE

六眼飞鱼酱① 提交于 2019-12-01 05:29:17
问题 I have seen a question on here about this however it was old so I will ask again in case a solution now exists. My issue is this. I have a database table which I wish to select from but I want to lock the rows that I have selected. The reason for this is that I may have another process running that will also want to select the same rows and I want to prevent this. Imagine I have two processes doing the same thing. One performs a select and begins to perform its processing of the data. Then a

Unexpected behavior using std::try_to_lock

本秂侑毒 提交于 2019-12-01 05:23:40
问题 I get surprising and conflicting behavior when I try to run the following code. #include <iostream> #include <mutex> int main() { std::mutex mtx; std::unique_lock<std::mutex> lock1(mtx); std::unique_lock<std::mutex> lock2(mtx, std::try_to_lock); std::cout << "lock1 owns lock: " << lock1.owns_lock() << std::endl; std::cout << "lock2 owns lock: " << lock2.owns_lock() << std::endl; } When I run this on my computer (linux with either clang++ 4.0.1 or g++ 7.3.0) it prints out that both lock1 and

Android check if lockscreen is set

不问归期 提交于 2019-12-01 05:19:49
i need to check if the lockscreen does have a Pin or something more secure (Password, Fingerprint etc.). Im able to check if there is a Pin, Password or a Pattern. KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); return keyguardManager.isKeyguardSecure(); My Problem is that i cant detect if the lockscreen is a Pattern or something lower. I tried this: int lockPatternEnable = Settings.Secure.getInt(cr, Settings.Secure.LOCK_PATTERN_ENABLED); but its deprecated and throws me an error. I also tried this: long mode2 = Settings.Secure.getLong

Unlock Android phone programmatically?

纵然是瞬间 提交于 2019-12-01 05:18:23
I want to write the code on how to unlock the Android Phone programmatically. I want lock or unlock the phone when the user taps the proximity sensor. public class MyActivity extends Activity{ private static final String ACTION = "android.intent.action.ACTION_SCREEN_OFF"; BroadcastReceiver myReceiver; Context context; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); context = this; final IntentFilter theFilter = new IntentFilter(); theFilter.addAction(ACTION); context.registerReceiver(myReceiver, theFilter);