Search Results

Search found 1112 results on 45 pages for 'robert'.

Page 24/45 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Thread safety in Singleton

    - by Robert
    I understand that double locking in Java is broken, so what are the best ways to make Singletons Thread Safe in Java? The first thing that springs to my mind is: class Singleton{ private static Singleton instance; private Singleton(){} public static synchronized Singleton getInstance(){ if(instance == null) instance = new Singleton(); return instance; } } Does this work? if so, is it the best way (I guess that depends on circumstances, so stating when a particular technique is best, would be useful)

    Read the article

  • Is there any legitimate use for bare strings in PHP?

    - by Robert
    This question got me thinking about bare strings. When PHP sees a string that's not enclosed in quotes, it first checks to see if it's a constant. If not, it just assumes it's a string and goes on anyway. So for example if I have echo $foo[bar]; If there's a constant called bar it uses that for the array key, but if not then it treats bar as a bare string, so it behaves just like echo $foo["bar"]; This can cause all kinds of problems if at some future date a constant is added with the same name. My question is, is there any situation in which it actually makes sense to use a bare string?

    Read the article

  • Which management tools would you recommend for software development?

    - by Robert Schneider
    What would you generally recommend for software developement? Which combination do you use or would you recommend? I assume that tools are needed for Version control, issues/bugs/task, Release management, Requirement management. Tools for Test management and Project management should be accounted for as well, I guess. Did I forget anything? Maybe tools for Continous Integration. I'm not interested in a halfway combination of one ore two tools like a Subversion + Bugzilla (I know they are good but for a company they might not be sufficient). And also tools like make/ant shouldn't be taken into account. I'd like to know a combination that covers all what is important for professional software development. However, it could be a single tool of course if it covers all the management issues. What do you think would be a good combination? I assume a combination should be regardes as good if the tools itself are good but also if they have good integrations. Udate: Something like Ant is just a script not a management tool. Okay: we do already have Perforce. But this is somehow generic. We have different projects that uses C-, VS/.NET-, Python-, PHP and we will be starting new projects in Java. Plenty of languages and frameworks, though some are going to be legacy. So the tools should be generic. Obviously we don't want to use Bugzilla for one project and Jira for another. The management tools have to be generic. Further thoughts: Think of sourceforge: For each project they offer a version control system, an issue tracker, a wiki, ... totally independent of what the project is about. Those are some management tools that a project usually needs. I would say that most companies need such a set of tools. But I could imagine, if a company has several projects, they need further tools too: for Project management, Quality management, ... And I could imagine there are some recommendable combinations of tools. A not really apropiate comparison to this could be LAMP (Linux, Apache, MySQL, PHP). A combination of software that has evolved since they work very well together, and are pretty useful for a lot of applications (or rather web sites). So maybe there are some recommendable management tool combinations that also fit toghether like LAMP. The integration is important. Thank you for the incredibly fast and helpful responses!!!

    Read the article

  • When is it safe to remote import entires from feature.xml?

    - by Robert Munteanu
    I've recently learned that the import section from feature.xml is legacy, and the actual dependency work is delegated to the p2 engine, which uses the information from the plugin manifest. I am not sure though if p2 is available for all recent versions of Eclipse, or in all Eclipse-based products, so I'm not sure if it is safe to remove the import section from feature.xml. Under what circumstances is it safe to remove the import section from feature.xml? Assume that we are taking into consideration Eclipse 3.4 or newer.

    Read the article

  • Create an anonymous type object from an arbitrary text file

    - by Robert Harvey
    I need a sensible way to draw arbitrary text files into a C# program, and produce an arbitrary anonymous type object, or perhaps a composite dictionary of some sort. I have a representative text file that looks like this: adapter 1: LPe11002 Factory IEEE: 10000000 C97A83FC Non-Volatile WWPN: 10000000 C93D6A8A , WWNN: 20000000 C93D6A8A adapter 2: LPe11002 Factory IEEE: 10000000 C97A83FD Non-Volatile WWPN: 10000000 C93D6A8B , WWNN: 20000000 C93D6A8B Is there a way to get this information into an anonymous type object or some similar structure? The final anonymous type might look something like this, if it were composed in C# by hand: new { adapter1 = new { FactoryIEEE = "10000000 C97A83FC", Non-VolatileWWPN = "10000000 C93D6A8A", WWNN = "20000000 C93D6A8A" } adapter2 = new { FactoryIEEE = "10000000 C97A83FD", Non-VolatileWWPN = "10000000 C93D6A8B", WWNN = "20000000 C93D6A8B" } } Note that, as the text file's content is arbitrary (i.e. the keys could be anything), a specialized solution (e.g. that looks for names like "FactoryIEEE") won't work. However, the structure of the file will always be the same (i.e. indentation for groups, colons and commas as delimiters, etc). Or maybe I'm going about this the wrong way, and you have a better idea?

    Read the article

  • How to Create MySQL Query to Find Related Posts from Multiple Tables?

    - by Robert Samuel White
    This is a complicated situation (for me) that I'm hopeful someone on here can help me with. I've done plenty of searching for a solution and have not been able to locate one. This is essentially my situation... (I've trimmed it down because if someone can help me to create this query I can take it from there.) TABLE articles (article_id, article_title) TABLE articles_tags (row_id, article_id, tag_id) TABLE article_categories (row_id, article_id, category_id) All of the tables have article_id in common. I know what all of the tag_id and category_id rows are. What I want to do is return a list of all the articles that article_tags and article_categories MAY have in common, ordered by the number of common entries. For example: article1 - tags: tag1, tag2, tag3 - categories: cat1, cat2 article2 - tags: tag2 - categories: cat1, cat2 article3 - tags: tag1, tag3 - categories: cat1 So if my article had "tag1" and "cat1 and cat2" it should return the articles in this order: article1 (tag1, cat1 and cat2 in common) article3 (tag1, cat1 in common) article2 (cat1 in common) Any help would genuinely be appreciated! Thank you!

    Read the article

  • Java Loop every minute.

    - by Robert
    I want to write a loop in Java that firs starts up and goes like this: while (!x){ //wait one minute or two //execute code } I want to do this so that it does not use up system resources. What is actually going on in the code is that it goes to a website and checks to see if something is done, if it is not done, it should wait another minute until it checks again, and when its done it just moves on. Is their anyway to do this in java? I googled it but didnt find anything. Thanks

    Read the article

  • Unable to cast object of type MyObject to type MyObject

    - by Robert W
    I have this scenario where a webservice method I'm consuming in C# returns a Business object, when calling the webservice method with the following code I get the exception "Unable to cast object of type ContactInfo to type ContactInfo" in the reference.cs class of the web reference Code: ContactInfo contactInfo = new ContactInfo(); Contact contact = new Contact(); contactInfo = contact.Load(this.ContactID.Value); Any help would be much appreciated.

    Read the article

  • The type of field isn't supported by declared persistence strategy "OneToMany"

    - by Robert
    We are new to JPA and trying to setup a very simple one to many relationship where a pojo called Message can have a list of integer group id's defined by a join table called GROUP_ASSOC. Here is the DDL: CREATE TABLE "APP"."MESSAGE" ( "MESSAGE_ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) ); ALTER TABLE "APP"."MESSAGE" ADD CONSTRAINT "MESSAGE_PK" PRIMARY KEY ("MESSAGE_ID"); CREATE TABLE "APP"."GROUP_ASSOC" ( "GROUP_ID" INTEGER NOT NULL, "MESSAGE_ID" INTEGER NOT NULL ); ALTER TABLE "APP"."GROUP_ASSOC" ADD CONSTRAINT "GROUP_ASSOC_PK" PRIMARY KEY ("MESSAGE_ID", "GROUP_ID"); ALTER TABLE "APP"."GROUP_ASSOC" ADD CONSTRAINT "GROUP_ASSOC_FK" FOREIGN KEY ("MESSAGE_ID") REFERENCES "APP"."MESSAGE" ("MESSAGE_ID"); Here is the pojo: @Entity @Table(name = "MESSAGE") public class Message { @Id @Column(name = "MESSAGE_ID") @GeneratedValue(strategy = GenerationType.IDENTITY) private int messageId; @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.PERSIST) private List groupIds; public int getMessageId() { return messageId; } public void setMessageId(int messageId) { this.messageId = messageId; } public List getGroupIds() { return groupIds; } public void setGroupIds(List groupIds) { this.groupIds = groupIds; } } When we try to execute the following test code we get <openjpa-1.2.3-SNAPSHOT-r422266:907835 fatal user error> org.apache.openjpa.util.MetaDataException: The type of field "pojo.Message.groupIds" isn't supported by declared persistence strategy "OneToMany". Please choose a different strategy. Message msg = new Message(); List groups = new ArrayList(); groups.add(101); groups.add(102); EntityManager em = Persistence.createEntityManagerFactory("TestDBWeb").createEntityManager(); em.getTransaction().begin(); em.persist(msg); em.getTransaction().commit(); Help!

    Read the article

  • Sharepoint Foundation 2010 development environment installation problems

    - by Robert Koritnik
    I'm having problems installing development machine for Sharepoint (Foundation) 2010. This is what I did so far on the same machine: Installed a clean Windows 7 x64 with 4GB of RAM without being part of any domain. Just a simple standalone machine. Enabled IIS related features as described here except IIS6 related ones (two of them) Installed SQL Server 2008 R2 Development Edition (DB Engine and Writer being enabled but not SQL Agent) Installed Visual Studio 2010 Premium Started installing Sharepoint Foundation 2010 with first extracting files, changing config to enable Windows 7 installation and then installed it as Server Farm (then Complete) to avoid installing SQL Express. Created a separate SPF_CONFIG local user with Logon on as a service right. Opened SPF Management Shell and run New-SPConfigurationDatabase so I am able to use a non-domain username (SPF_CONFIG that I created in the previous step) But all I get is this: The outcome after this error is: Database Sharepoint2010Config is created User SPF_CONFIG is added to SQL Server and attached to this newly created database as dbowner Checking SQL server security logins this user has following rights: dbcreator securityadmin public

    Read the article

  • Smart auto detect and replace URLs with anchor tags

    - by Robert Koritnik
    I've written a regular expression that automatically detects URLs in free text that users enter. This is not such a simple task as it may seem at first. Jeff Atwood writes about it in his post. His regular expression works, but needs extra code after detection is done. I've managed to write a regular expression that does everything in a single go. This is how it looks like (I've broken it down into separate lines to make it more understandable what it does): 1 (?<outer>\()? 2 (?<scheme>http(?<secure>s)?://)? 3 (?<url> 4 (?(scheme) 5 (?:www\.)? 6 | 7 www\. 8 ) 9 [a-z0-9] 10 (?(outer) 11 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\)) 12 | 13 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+ 14 ) 15 ) 16 (?<ending>(?(outer)\))) As you may see, I'm using named capture groups (used later in Regex.Replace()) and I've also included some local characters (cšžcd), that allow our localised URL to be parsed as well. You can easily omit them if you'd like. Anyway. Here's what it does (referring to line numbers): 1 - detects if URL starts with open braces (is contained inside braces) and stores it in "outer" named capture group 2 - checks if it starts with URL scheme also detecting whether scheme is SSL or not 3 - starts parsing URL itself (will store it in "url" named capture group) 4-8 - if statement that says: if "sheme" was present then www. part is optional, otherwise mandatory for a string to be a link (so this regular expression detects all strings that start with either http or www) 9 - first character after http:// or www. should be either a letter or a number (this can be extended if you would like to cover even more links, but I've decided to omit other characters because I can't remember a link that would start with some other character 10-14 - if statement that says: if "outer" (braces) was present capture everything up to the last closing braces otherwise capture all 15 - closes the named capture group for URL 16 - if open braces was present, capture closing braces as well and store it in "ending" named capture group First and last line used to have \s* in them as well, so user could also write open braces and put a space inside before pasting link. Anyway. My code that does link replacement with actual anchor HTML elements looks exactly like this: value = Regex.Replace( value, @"(?<outer>\()?(?<scheme>http(?<secure>s)?://)?(?<url>(?(scheme)(?:www\.)?|www\.)[a-z0-9](?(outer)[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\))|[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+))(?<ending>(?(outer)\)))", "${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending}", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); As you can see I'm using named capture groups to replace link with an Anchor tag: ${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending} I could as well omit the http(s) part in anchor display to make links look friendlier, but for now I decided not to. Question I would like for my links to be replaced with shortenings as well. So when user copies a very long links (for instance if they would copy a link from google maps that usually generates long links I would like to shorten the visible part of the anchor tag. Link would work, but visible part of an anchor tag would be shortened to some number of characters. Does the replace string support notations like that so I can stil use a singe Regex.Replace() call?

    Read the article

  • Read nested Lua table who key is a System.Double

    - by Robert Kerr
    Using C# and LuaInterface, I am trying to read a nested table, but am getting a null LuaTable when I try to open the key containing the table. The .lua file: DB = { ["inventory"] = { [10001] = { ["row"] = 140, ["count"] = 20, }, [10021] = { ["row"] = 83, ["count"] = 3, }, [10075] = { ["row"] = 927, ["count"] = 15, }, } } I can successfully foreach the entries under inventory, by opening that table with: LuaTable tbl = lua.GetTable("DB.inventory"); foreach (DictionaryEntry de in tbl) ... What I cannot do is open an inventory item and enumerate its entries the same way. Is this because the key is a System.Double type? This fails: LuaTable tbl = lua.GetTable("DB.inventory.10001"); foreach (DictionaryEntry de in tbl) with an exception, because tbl is null. Effectively, once I enumerate the keys (inventory items), I then want to drill down into the nested table and work with those contents. As you can see, I am not able to get a reference to the nested table the way I am doing it.

    Read the article

  • How do I load a module catalog from a database in Prism?

    - by Robert S.
    I'm using Prism in my WPF application and up to now, I've been loading the modules via var moduleCatalog = new ConfigurationModuleCatalog();. I'd like to get the module catalog from a database. The Prism documentation indicates that this is possible, but it doesn't go into any details. Has anyone done this and can provide some guidance?

    Read the article

  • showSettings callback in Flex?

    - by Jim Robert
    I am pretty new to flex, so forgive me if this is an obvious question. Is there a way to open the Security.showSettings (flash.system.Security) with a callback? or at least to detect if it is currently open or not? My flex application is used for streaming audio, and is normally controlled by javascript, so I keep it hidden for normal use (via absolute positioning it off the page). When I need microphone access I need to make the flash settings dialog visible, which works fine, I move it into view and open the dialog. When the user closes it, I need to move it back off the screen so they don't see an empty flex app sitting there after they change their settings. thanks :)

    Read the article

  • Mysql IN clause, php array

    - by robert knobulous
    I know that this has been asked and answered before, but for the life of me I cannot find where I am going wrong. My code is below. $backa = array("1", "7", "8", "9", "12"); $backaa = implode(",", $backa); /* code to create connection object $wkHook */ $getOpt=$wkHook->prepare("select movementId, movementName from Movement where movementId IN ($backaa) order by movementName asc"); $getOpt->execute(); $getOpt->store_result($id, $name); Every time I run this I get one of two errors depending upon how I use the $backaa variable. More often than not I get a call to a non-object error indicating that $getOpt is not a proper Mysql query. I have tried every fashion of quoting, bracketing, etc for the $backaa variable but it's just not working for me. What obvious thing am I missing?

    Read the article

  • Scheme Beginner question

    - by Robert
    Hello.I am trying to put the following statement in Dr.Scheme: {with {x {+ 5 5}} {+ x x}} but I got an error: expand: unbound identifier in module in: with anyone could help me?Thanks.

    Read the article

  • Trouble with jquery email form submitHandler

    - by Robert
    Here is the code I'm using for the submitHandler: submitHandler: function() { $('.holder').fadeOut('slow'); $('#loading').fadeIn('slow'); $.post('email.php',{name:$('#em_name').val(), email:$('#em_email').val(), message:$('#em_message').val()}, function(data){ $('#loading').css({display:'none'}); if( data == 'success') { $('#callback').show().append('Message delivered successfully'); $('#emailform').slideUp('slow'); } else { $('#callback').show().append('Sorry but your message could not be sent, try again later'); } }); } This isn't working when used in conjunction with this php: <?php $name = stripcslashes($_POST['name']); $emailAddr = stripcslashes($_POST['email']); $message = stripcslashes($_POST['message']); $email = "Message: $message \r \n From: $name \r \n Reply to: $emailAddr"; $to = '[email protected]'; $subject = 'Message from example'; //validate the email address on the server side if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $emailAddr) ) { //if successful lets send the message mail($to, $subject, $email); echo('success'); //return success callback } else { echo('An invalid email address was entered'); //email was not valid } ?> Does anyone have any suggestions as to why this isn't working like it should. It seems to just lock up when I submit. Any help would be appreciated. Thanks!

    Read the article

  • Interface builder problem: When hooking up an IBOutlet, getting "this class is not key value coding-

    - by Robert
    Here is what I do: 1) Create New UIViewController subclass , tick with NIB for interface builder 2) In the header: @interface QuizMainViewController : UIViewController { UILabel* aLabel; } @property (nonatomic, retain) IBOutlet UILabel* aLabel; @end 3) In the .m #import "QuizMainViewController.h" @implementation QuizMainViewController @synthesize aLabel; - (void)dealloc { [aLabel release]; [super dealloc]; } @end 4) Open the NIB In interface builder, drag a new UILabel into the view. I test the program here and it runs fine. 5) right click on file's owner, connect 'aLabel' from the Outlets to the UILabel. I run here and it crashes. Message from log: * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aLabel.'

    Read the article

  • Testing fault tolerant code

    - by Robert
    I’m currently working on a server application were we have agreed to try and maintain a certain level of service. The level of service we want to guaranty is: if a request is accepted by the server and the server sends on an acknowledgement to the client we want to guaranty that the request will happen, even if the server crashes. As requests can be long running and the acknowledgement time needs be short we implement this by persisting the request, then sending an acknowledgement to the client, then carrying out the various actions to fulfill the request. As actions are carried out they too are persisted, so the server knows the state of a request on start up, and there’s also various reconciliation mechanisms with external systems to check the accuracy of our logs. This all seems to work fairly well, but we have difficult saying this with any conviction as we find it very difficult to test our fault tolerant code. So far we’ve come up with two strategies but neither is entirely satisfactory: Have an external process watch the server code and then try and kill it off at what the external process thinks is an appropriate point in the test Add code the application that will cause it to crash a certain know critical points My problem with the first strategy is the external process cannot know the exact state of the application, so we cannot be sure we’re hitting the most problematic points in the code. My problem with the second strategy, although it gives more control over were the fault takes, is I do not like have code to inject faults within my application, even with optional compilation etc. I fear it would be too easy to over look a fault injection point and have it slip into a production environment.

    Read the article

  • Android MediaStore insertVideo

    - by Robert
    So our app has the option to take either a picture or a video. If the user takes a picture, we can use the MediaStore.Images.Media.insertImage function to add the new image (via a filepath) to the phone's gallery and generate a content:// style URI. Is there a similar process for a captured video, given that we only have it's filepath?

    Read the article

  • Using a FormattedText object, how do I find out how much of my text was actually displayed?

    - by Robert
    If I have code like this: FormattedText text = new FormattedText(sTheBook, System.Globalization.CultureInfo.CurrentUICulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Times New Roman"), 13, Brushes.Black); text.MaxTextWidth = 300; text.MaxTextHeight = 600; text.TextAlignment = TextAlignment.Justify; dc.DrawText(text, new Point(10, 0)); ...then, if it is long, only some of the text that I passed in (via sTheBook) will be displayed on the screen. I need to know how much was displayed so I can display the rest later! I can easily measure an amount of text, but it seems silly to do a search by rendering and re-rendering my text over and over until I find the piece that fits exactly. Thanks!

    Read the article

  • Can you find a pattern to sync files knowing only dates and filenames?

    - by Robert MacLean
    Imagine if you will a operating system that had the following methods for files Create File: Creates (writes) a new file to disk. Calling this if a file exists causes a fault. Update File: Updates an existing file. Call this if a file doesn't exist causes a fault. Read File: Reads data from a file. Enumerate files: Gets all files in a folder. Files themselves in this operating system only have the following meta data: Created Time: The original date and time the file was created, by the Create File method. Modified Time: The date and time the file was last modified by the Update File method. If the file has never been modified, this will equal the Create Time. You have been given the task of writing an application which will sync the files between two directories (lets call them bill and ted) on a machine. However it is not that simple, the client has required that The application never faults (see methods above). That while the application is running the users can add and update files and those will be sync'd next time the application runs. Files can be added to either the ted or bill directories. File names cannot be altered. The application will perform one sync per time it is run. The application must be almost entirely in memory, in other words you cannot create a log of filenames and write that to disk and then check that the next time. The exception to point 6 is that you can store date and times between runs. Each date/time is associated with a key labeled A through J (so you have 10 to use) so you can compare keys between runs. There is no way to catch exceptions in the application. Answer will be accepted based on the following conditions: First answer to meet all requirements will be accepted. If there is no way to meet all requirements, the answer which ensures the smallest amount of missed changes per sync will be accepted. A bounty will be created (100 points) as soon as possible for the prize. The winner will be selected one day before the bounty ends. Please ask questions in the comments and I will gladly update and refine the question on those.

    Read the article

  • How do I draw a proper parallelogram that can be animated on iPhone?

    - by Robert Kosara
    I'm trying to do something very simple: I need some parallelograms in my program. These are attached to other objects, all of which are UIViews. It's important that I be able to animate these, since the objects they are attached to can also be animated. I've figured out how to use the transform in UIView/CALayer to do this, but the problem is that these sheared UIViews don't look very nice: there is no anti-aliasing of the edges. Is there some other way to do this? I would like to use UIViews, since I also use them for user interaction and animation is so much easier than drawing by hand. I don't want to use OpenGL for this.

    Read the article

  • Is is possible to programmatically change the resourceProviderFactoryType?

    - by Robert Massa
    I have a custom implementation of IResourceProvider and ResourceProviderFactory. Now the default way of making sure ASP.NET uses these custom types is to use the web.config and specify the factory like so: <globalization resourceProviderFactoryType="Product.Globalization.TranslationResourceProviderFactory" /> This works perfectly, except that in my resource provider I need database access. I want to use my IoC-container(Ninject) to inject the repositories needed to access this data into the CustomResourceProvider. But how am I going to do this? I have no control over the instantiation of the factory, so the factory can't get a reference to my IoC. Is there any way to register a custom provider programmatically, in for example the Global.asax?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >