Hello how can i lock a usb drive that the user it will be not able to remove the files that are in also to cant add new ones? I think its very cool for advertising own goals :) - Thanks :)

Member Avatar
Member Avatar
+1 forum 13

Hello, I've just begun working with assembly so I'm sorry if this question is simplistic. I would like to implement an atomic add (for incrementing an array pointer). My code looks like this: int * ptr; int step; asm("lock add %1, %2;\n" :"=m"(ptr) :"m"(ptr),"r"(step) : ); But I'm getting an error "expecting lockable instruction after 'lock'", which doesn't make sense as I've read that `add` is a lockable instruction. If I place the `lock` as a separate instruction before the addition it compiles, but ultimate crashes as it claims it is an "illegal instruction." Perhaps I'm understanding the use of …

Member Avatar
Member Avatar
+0 forum 2

Hello, I wonder how we can use lock objects between 2 different applications. In the example below we can use lock objects to let only one thread to execute the code inside the lock object at a time. This works fine within one application. Now I wonder how we can use a lock object between 2 different applications. Is there some kind of Global system lock that can be used? I have put this code as illustration of what I try to find a solution for: object lockobject = new object(); //Application 1 void thread1() { Random rnd = new …

Member Avatar
Member Avatar
+0 forum 7

I'm trying to make this as easy as possible but I'm stuck. Inside the for loop, if the input entered was not a number or wasn't valid, it moves on, but I don't want it to. I want it to repeat that interation. Is there a possible way to do this? package com.geodox.combolock; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class ComboLock { public static void main(String[] args) { new ComboLock(); } private ComboLock() { Combination combo = new Combination(); while(!(getInputCombo() == combo.toString())) { System.out.println("Wrong! Try again!"); } System.out.println("Combo Found: " + combo.toString()); } private String getInputCombo() { …

Member Avatar
Member Avatar
+0 forum 2

My key board doesnt show if cap lock is on or off. Is there any way to add it on Task Bar I can do it on word but not other applications Pl Help how to do it Regards

Member Avatar
Member Avatar
+0 forum 1

I am using FactoryLink SCADA HMI software and I need to lock the focus on a screen that automatically opens and needs operator to answer before it will close and allow the user to continue on the background screen. If anyone knows where I can find this answer I would appreciate it. I have been all over the internet trying to find the proper forum to no avail. This site has always given me good advice.

Member Avatar
Member Avatar
+0 forum 3

I'm curious about write locks with MySQL and how they are prioritized with eachother. Specifically, I'm wondering if "low priority write" locks have lower priority than "normal" write locks, or if they are equal. The only documentation I can find states that the low priority locks have lower priority than read locks, allowing read locks to process first. But I can't find anything that states how they relate to other write locks. The point of this is that I'm looking for a way to "prioritize" write locks, and wondering if just the standard low priority lock will do what I'm …

Member Avatar
Member Avatar
+0 forum 1

The assignment is to implement the Banker's Algorithm using pthreads and mutex locks. We implemented the Banker's Algorithm and it works fine. When we began implementing the pthreads and mutex locks we ran into problems. We know that each process is a thread, and that the mutex lock is acquired once it is inside of the Banker's Algorithm function and it is released once you leave the function. We are just confused about how the threads come into play.

Member Avatar
Member Avatar
+0 forum 1

Hi There. I joined here some three years ago when i created my ONE and ONLY Python program that actually functions as intended *YAY*, it's a little ugly and i've decided to return and learn more, improve it and maybe start up some new projects. I'm a little confused as this isn't the regular forum layout so if i make some mistakes, please forgive me and i'll do my best to mimimise the damage and learn. I've got some catching up to do :) My question for today. I use a locked window, you can't move it, resize it etc, …

Member Avatar
Member Avatar
+0 forum 3

Hi all! This is a simple piece of code that I wrote about a year ago, in response to a question on Daniweb. I decided to infuse it with some C++11 magic, which led to a pretty sweet code snippet, full of neat little techniques you might want to use, not to mention that this class can actually be pretty handy to have. There are a few similar implementations out-there, but they all use a different approach, my main inspiration is the scope-guard technique. This is an implementation of a simple wrapper class template that allows a variable to be …

Member Avatar
Member Avatar
+3 forum 14

Hi, I'm using SQL Enterprise Library (Microsoft.Practices.EnterpriseLibrary.Data.Sql) objects and I'm considering using a DbTransaction to execute multiple DbCommand(s) for inserts/updates in one transaction. Let's say these queries take a few minutes to execute, I do not want it to prevent another process from queries the same tables. Considering I do not want to open/close multiple connections and I do not want any "locks" on my database tables is this a good way to go ahead with this? Thanks

Member Avatar
Member Avatar
+0 forum 3

I've been looking for an app that could find a specific open window on the desktop and 'lock' it so can't be re-sized or moved (most likely by using the title bar value/property). Having had no luck, I was wondering if this can be done in c++? I used to code in myriad languages many eons ago and the last time I used c++ was over 10 years ago. At that time I was coding apps from the ground up, but never coded anything that would look at existing windows etc. on the desktop already. If it can be done …

Member Avatar
Member Avatar
+0 forum 2

I'm trying to do the third writer/reader problem with semaphore (as mention on wiki). But it's not working properly. First 16-element array seem to work properly. But after first, it got wrong. Even though I think I'm almost there, I can't find the error at all. My code is as the following : [CODE] #include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <semaphore.h> #include <string.h> #include <fcntl.h> #define TRUE 1 #define MAX 16 #define STR_MAX 200 void *writer(void*); void *reader(void*); void freebuff(char*); char *init(char* , int); void print_buff(); int readCount = 0; sem_t mutex ,write, read; char* CirBuf[MAX]; int main(int argc, …

Member Avatar
+0 forum 0

I am using a DLL file as my license file for a VB.NET project and was wondering if there was a way to make it locked so notepad can't open it and edit the data stored in there. Thanks in advanced!

Member Avatar
Member Avatar
+0 forum 6

hi, i am writing a program for my dad. I want it to keep the mouse in x=500 y=500 while waiting for input. So its asking for the password and if you try to move the mouse, it'll put the mouse back in x=500 and y=500 and have keep looping that until the correct password is inputed. Any solutions?

Member Avatar
Member Avatar
+0 forum 22

I have a multi-threaded application using over 500 threads and I want to log certain things that go on inside these threads to a single log text file, however not all the threads can access the file at the same time so how can I do this? The only way I can think of is to have the file as a static public resource, lock this and then access it when required. However, I don't know if this process is inefficient for this many threads. Someone else recommended Trace Listener, but the problem with this is that it creates multiple …

Member Avatar
Member Avatar
+0 forum 1

Hi there, Is it possible to lock down permissions to files on a network file server so that people who amend them can only save them back to their original network location? By this I mean can saving them to their local C:\ or sending them on via email after being modified be restricted in any way? Thanks.

Member Avatar
Member Avatar
+0 forum 5

Hello All, I have a question related to synchronization in java; there's more like a confirmation. Let's start with the simplified version of my class: [CODE]class MyClass { private List<MyObject> myList = new ArrayList(); public void addEntry(MyObject obj) { myList.add(obj); } public void removeEntry(MyObject obj) { myList.remove(obj); } public double computeAValue() { // // Compute a value based on myList // } public double computeBValue() { // // Compute a value based on myList // } ...... } [/CODE] I need to make the class thread safe... which means the following: - don't let a thread add / remove entries …

Member Avatar
Member Avatar
+0 forum 7

Consider those two function. When I load file, everything is fine, but then, when I want to save changes, the file is still being locked. Where is the catch? [CODE=C#] public static string Load(string loadPath = null) { string output; string file = loadPath == null ? _defaultFile : (_defaultFile = loadPath); try { using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.None)) { if (!fileStream.CanRead) { Console.Out.Write("File is locked. Waiting for release "); while (!fileStream.CanRead) { Console.Out.Write("."); System.Threading.Thread.Sleep(2000); } } using(var textReader = new StreamReader(fileStream)) { var inputFileDescription = new CsvFileDescription { SeparatorChar = ',', FirstLineHasColumnNames = true }; …

Member Avatar
Member Avatar
+0 forum 1

The End.