Search Results

Search found 659 results on 27 pages for 'safety'.

Page 4/27 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Writing a synchronized thread-safety wrapper for NavigableMap

    - by polygenelubricants
    java.util.Collections currently provide the following utility methods for creating synchronized wrapper for various collection interfaces: synchronizedCollection(Collection<T> c) synchronizedList(List<T> list) synchronizedMap(Map<K,V> m) synchronizedSet(Set<T> s) synchronizedSortedMap(SortedMap<K,V> m) synchronizedSortedSet(SortedSet<T> s) Analogously, it also has 6 unmodifiedXXX overloads. The glaring omission here are the utility methods for NavigableMap<K,V>. It's true that it extends SortedMap, but so does SortedSet extends Set, and Set extends Collection, and Collections have dedicated utility methods for SortedSet and Set. Presumably NavigableMap is a useful abstraction, or else it wouldn't have been there in the first place, and yet there are no utility methods for it. So the questions are: Is there a specific reason why Collections doesn't provide utility methods for NavigableMap? How would you write your own synchronized wrapper for NavigableMap? Glancing at the source code for OpenJDK version of Collections.java seems to suggest that this is just a "mechanical" process Is it true that in general you can add synchronized thread-safetiness feature like this? If it's such a mechanical process, can it be automated? (Eclipse plug-in, etc) Is this code repetition necessary, or could it have been avoided by a different OOP design pattern?

    Read the article

  • OGNL thread safety

    - by Dewfy
    I'm going to reuse OGNL library out of Struts2 scope. I have rather large set of formulas, that is why I would like to precompile all of them: Ognl.parseExpression(expressionString); But I'm not sure if precompiled expression can be used in multi-thread environment. Does anybody knows if it can be used?

    Read the article

  • Java - Thread safety of ArrayList constructors

    - by andy boot
    I am looking at this piece of code. This constructor delegates to the native method "System.arraycopy" Is it Thread safe? And by that I mean can it ever throw a ConcurrentModificationException? public Collection<Object> getConnections(Collection<Object> someCollection) { return new ArrayList<Object>(someCollection); } Does it make any difference if the collection being copied is ThreadSafe eg a CopyOnWriteArrayList? public Collection<Object> getConnections(CopyOnWriteArrayList<Object> someCollection) { return new ArrayList<Object>(someCollection); }

    Read the article

  • SharePoint SLK and T-SQL xp_cmdshell safety

    - by Mitchell Skurnik
    I am looking into a TSQL command called "xp_cmdshell" to use to monitor a change to a the SLK (SharePoint Learning Kit) database and then execute a batch or PowerShell script that will trigger some events that I need. (It is bad practice to modify SharePoint's database directly, so I will be using its API) I have been reading on various blogs and MSDN that there are some security concerns with this approach. The sites suggest that you limit security so the command can be executed by only a specific user role. What other tips/suggestions would you recommend with using "xp_cmdshell"? Or should I go about this another way and create a script or console application that constantly checks if a change has been made? I am running Server 2008 with SQL 2008.

    Read the article

  • memcpy() safety on adjacent memory regions

    - by JaredC
    I recently asked a question on using volatile and was directed to read some very informative articles from Intel and others discussing memory barriers and their uses. After reading these articles I have become quite paranoid though. I have a 64-bit machine. Is it safe to memcpy into adjacent, non-overlapping regions of memory from multiple threads? For example, say I have a buffer: char buff[10]; Is it always safe for one thread to memcpy into the first 5 bytes while a second thread copies into the last 5 bytes? My gut reaction (and some simple tests) indicate that this is completely safe, but I have been unable to find documentation anywhere that can completely convince me.

    Read the article

  • Is there a quasi-standard set of attributes to annotate thread safety, immutability etc.?

    - by Eugene Beresovksy
    Except for a blog post here and there, describing the custom attributes someone created, but that do not seem to get any traction - like one describing how to enforce immutability, another one on Documenting Thread Safety, modeling the attributes after JCIP annotations - is there any standard emerging? Anything MS might be planning for the future? This is something that should be standard, if there's to be any chance of interoperability between libraries concurrency-wise. Both for documentation purposes, and also to feed static / dynamic test tools. If MS isn't doing anything in that direction, it could be done on CodePlex - but I couldn't find anything there, either. <opinion>Concurrency and thread safety are really hard in imperative and object-languages like C# and Java, we should try to tame it, until we hopefully switch to more appropriate languages.</opinion>

    Read the article

  • Unshorten.it! Unpacks Shortened URLs and Provides Safety Rating

    - by Jason Fitzpatrick
    Shortened URLs sure are convenient and compact but they hide the destination URL. Unshorten.it! is a free Chrome/Firefox extension that not only shows you the full URL but will even give you a safety rating–no need to click blindly again. Install the extension for Chrome or Firefox and then, when you come across a shortened URL, simply right click on it and click “Unshorten this link” to see both the unpacked URL and a safety rating provided by Web of Trust and HPHosts. Unshorten.it! is a free extension, available for both Chrome and Firefox. Unshorten.it! [via Gizmo's Freeware] How To Delete, Move, or Rename Locked Files in Windows HTG Explains: Why Screen Savers Are No Longer Necessary 6 Ways Windows 8 Is More Secure Than Windows 7

    Read the article

  • Type-safe mapping from Class<T> to Thing<T>

    - by Joonas Pulakka
    I want to make a map-kind of container that has the following interface: public <T> Thing<T> get(Class<T> clazz); public <T> void put(Class<T> clazz, Thing<T> thing); The interesting point is that the Ts in each Class<T><- Thing<T> pair is the same T, but the container should be able to hold many different types of pairs. Initially I tried a (Hash)Map. But, for instance, Map<Class<T>, Thing<T>> is not right, because then T would be same T for all pairs in that map. Of course, Map<Class<?>, Thing<?>> works, but then I don't have type-safety guarantees so that when I get(String.class), I can't be sure that I get a Thing<String> instance back. Is there a way to accomplish the kind of type safety that I'm looking for?

    Read the article

  • Returning pointers in a thread-safe way.

    - by Roddy
    Assume I have a thread-safe collection of Things (call it a ThingList), and I want to add the following function. Thing * ThingList::findByName(string name) { return &item[name]; // or something similar.. } But by doing this, I've delegated the responsibility for thread safety to the calling code, which would have to do something like this: try { list.lock(); // NEEDED FOR THREAD SAFETY Thing *foo = list.findByName("wibble"); foo->Bar = 123; list.unlock(); } catch (...) { list.unlock(); throw; } Obviously a RAII lock/unlock object would simplify/remove the try/catch/unlocks, but it's still easy for the caller to forget. There are a few alternatives I've looked at: Return Thing by value, instead of a pointer - fine unless you need to modify the Thing Add function ThingList::setItemBar(string name, int value) - fine, but these tend to proliferate Return a pointerlike object which locks the list on creation and unlocks it again on destruction. Not sure if this is good/bad practice... What's the right approach to dealing with this?

    Read the article

  • .NET List Thread-Safe Implementation Suggestion needed

    - by Bamboo
    .Net List class isn't thread safe. I hope to achieve the minimal lock needed and yet still fulfilling the requirement such that as for reading, phantom record is allowed, and for writing, they must be thread-safe so there won't be any lost updates. So I have something like public static List<string> list = new List<string>(); In Methods that have **List.Add**/**List.Remove** , I always lock to assure thread safety lock (lockHelper) { list.Add(obj); or list.Remove(obj); } In Methods that requires **List Reading** I don't care about phantom record so I go ahead to read without any locking. In this case. Return a bool by checking whether a string had been added. if (list.Count() != 0) { return list.Contains("some string") } All I did was locking write accesses, and allow read accesses to go through without any locking. Is my thread safety idea valid? I understand there is List size expansion. Will it be ok? My guess is that when a List is expanding, it may uses a temp. list. This is ok becasue the temp list size will always have a boundary, and .Net class is well implemented, ie. there shouldn't be any indexOutOfBound or circular reference problems when reading was caught in updates.

    Read the article

  • When creating a library for a simple program, what must I do to protect others from its lack of thread safety?

    - by DeveloperDon
    When creating a library for a simple program, is it more cost effective to make it thread safe or is there a way to detect the program's use in a multithreaded program and ASSERT() or otherwise determine (preferably at compile or link time) that it may create problems. Related help for this question would be automated tool support for finding potential problems with thread safety, programming language features that enforce it,

    Read the article

  • Is there a straightforward way to have a thread-local instance variable?

    - by Dan Tao
    With the ThreadStatic attribute I can have a static member of a class with one instance of the object per thread. This is really handy for achieving thread safety using types of objects that don't guarantee thread-safe instance methods (e.g., System.Random). It only works for static members, though. Is there any straightforward way to declare a class member as thread-local, meaning, each class instance gets an object per thread?

    Read the article

  • Is there a straightforward way to have a ThreadStatic instance member?

    - by Dan Tao
    With the ThreadStatic attribute I can have a static member of a class with one instance of the object per thread. This is really handy for achieving thread safety using types of objects that don't guarantee thread-safe instance methods (e.g., System.Random). It only works for static members, though. Is there some corresponding attribute that provides the same functionality, but for instance members? In other words, that allows me to have one instance of the object, per thread, per instance of the containing class?

    Read the article

  • Does the Virtual PC XP Mode need safety measures?

    - by Ivo
    Does the Virtual PC XP-Mode (or any other virtualized mode) require safety measures, such as antivirus or a firewall? I'm just wondering if the XP-Mode would be a large security loophole, since it's so much more integrated into Windows 7. Actually I'm wondering the same for Portable Ubuntu, are their any safety measures I should undertake, so that I don't open a backdoor on my computer.

    Read the article

  • I found two usb sticks on the ground. Now what?

    - by Stefano Borini
    As from subject. I want to see what's inside. I am seriously interested in finding the owner if possible and returning them, but I am worried it could be an attempt at social engineering. I own a macbook intel with OSX 10.6. It is a very important install. What would you do in my situation if you want to see the content without risks ? Any proposal welcome. Edit: I decided not to plug them in, and I brought them to the hotel reception. They will forward it to the police.

    Read the article

  • OS X Lion: Emptying the trash takes "forever": is using rm -r safe?

    - by EOL
    Emptying my Trash in OS X Lion (non securely) is taking about three hours (about 1.5 million files, from a Time Machine backup). I had to stop the process a few times already, because I could not move my laptop with the external harddrive the files are on. This is also a problem because the Trash emptying is restarted from the very beginning each time I empty the Trash again (i.e., files are not deleted when the Trash emptying is aborted). I read that it is faster to use rm -rf on ~/.Trash, in this case. However, is this safe? (I am afraid that does OS X Lion performs tasks behind the scenes—which would explain its slowness—that rm -r does not, which could lead to problems in the future.)

    Read the article

  • Tool to assist loading servers into a rack??

    - by MikeJ
    Is there any kind of tool to assist in loading an unloading servers? I realized that I lack both height and upper body strength to remove servers from the upper tiers of a rack? I could not find the name or type of equipment that folks are using to do this kind of work safely?

    Read the article

  • I found two usb sticks on the ground. Now what ?

    - by Stefano Borini
    As from subject. I want to see what's inside. I am seriously interested in finding the owner if possible and returning them, but I am worried it could be an attempt at social engineering. I own a macbook intel with OSX 10.6. It is a very important install. What would you do in my situation if you want to see the content without risks ? Any proposal welcome. Edit: I decided not to plug them in, and I brought them to the hotel reception. They will forward it to the police.

    Read the article

  • Moving an external hard drive while running

    - by user1108939
    I mean physically moving the drive around. I've never dealt with external hard drives before. Just plugged this wd mypassport to test the transfer rate. At one point I 'safely ejected' the drive. A minute later I decide to check the underside of the drive, not realizing the disk is still spinning. I lift the drive, rotating my writs about 70 degrees to the left... I hear a sequence of three high pitched sounds. I couldn't determine whether that was an indication beep by an internal security feature or the head scratching the plate (oh god...). Drive stops and usb power is disconnected. I reconnect it - it shows up fine - reads/writes. The drive was not reading/writing when i moved it. Did I damage my drive? Are these things that fragile? I thought them to be at least as durable as a standard 2.5" internal drive. Am I mistaken?

    Read the article

  • How to get PHP command line to work with PDO?

    - by Sabya
    I want to work with PDO, through PHP command line. It works perfect through the PHP web API, but not through the command line. But when I execute the command: php test.php, it says unknown class PDO. I think it has something to do with the thread-safety difference. Because, when I execute the above command, the following warnings come: - F:\shema\htdocs>php test.php PHP Warning: PHP Startup: soap: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: sockets: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: mysql: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: pdo_pgsql: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 PHP Fatal error: Class 'PDO' not found in F:\shema\htdocs\test.php on line 2 PHP version: 5.2.9-2, downloaded from here. OS: Windows Vista If the problem is with the modules, where do I get the thread safe modules for those modules?

    Read the article

  • C# thread with multiple parameters

    - by Lucas B
    Does anyone know how to pass multiple parameters into a Thread.Start routine? I thought of extending the class, but the C# Thread class is sealed. Here is what I think the code would look like: ... Thread standardTCPServerThread = new Thread(startSocketServerAsThread); standardServerThread.Start( orchestrator, initializeMemberBalance, arg, 60000); ... } static void startSocketServerAsThread(ServiceOrchestrator orchestrator, List<int> memberBalances, string arg, int port) { startSocketServer(orchestrator, memberBalances, arg, port); } Thank you in advance. BTW, I start a number of threads with different orchestrators, balances and ports. Please consider thread safety also.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >