Search Results

Search found 8389 results on 336 pages for 'shared calendar'.

Page 62/336 | < Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >

  • Immutability and shared references - how to reconcile?

    - by davetron5000
    Consider this simplified application domain: Criminal Investigative database Person is anyone involved in an investigation Report is a bit of info that is part of an investigation A Report references a primary Person (the subject of an investigation) A Report has accomplices who are secondarily related (and could certainly be primary in other investigations or reports These classes have ids that are used to store them in a database, since their info can change over time (e.g. we might find new aliases for a person, or add persons of interest to a report) If these are stored in some sort of database and I wish to use immutable objects, there seems to be an issue regarding state and referencing. Supposing that I change some meta-data about a Person. Since my Person objects immutable, I might have some code like: class Person( val id:UUID, val aliases:List[String], val reports:List[Report]) { def addAlias(name:String) = new Person(id,name :: aliases,reports) } So that my Person with a new alias becomes a new object, also immutable. If a Report refers to that person, but the alias was changed elsewhere in the system, my Report now refers to the "old" person, i.e. the person without the new alias. Similarly, I might have: class Report(val id:UUID, val content:String) { /** Adding more info to our report */ def updateContent(newContent:String) = new Report(id,newContent) } Since these objects don't know who refers to them, it's not clear to me how to let all the "referrers" know that there is a new object available representing the most recent state. This could be done by having all objects "refresh" from a central data store and all operations that create new, updated, objects store to the central data store, but this feels like a cheesy reimplementation of the underlying language's referencing. i.e. it would be more clear to just make these "secondary storable objects" mutable. So, if I add an alias to a Person, all referrers see the new value without doing anything. How is this dealt with when we want to avoid mutability, or is this a case where immutability is not helpful?

    Read the article

  • Make password case unsensitive in shared ASP.Net membership tables web ap

    - by bill
    Hi all, i have two webapps.. that share ASP.Net membership tables. Everything works fine except i cannot remove case-sensitivity in one of the apps the way i am doing it in the other. in the non-working app void Login1_LoggingIn(object sender, LoginCancelEventArgs e) { string username = Login1.UserName.Trim(); if (!string.IsNullOrEmpty(username)) { MembershipUser user = Membership.GetUser(username); if (user != null) { // Only adjust the UserName if the password is correct. This is more secure // so a hacker can't find valid usernames if we adjust the case of mis-cased // usernames with incorrect passwords. string password = Login1.Password.ToUpper(); if (Membership.ValidateUser(user.UserName, password)) { Login1.UserName = user.UserName; } } } } is not working. the password is stored as all upper case. Converted at the time the membership user is created! So if the password is PASSWORD, typing PASSWORD allows me to authenticate. but typing password does not! Even though i can see the string being sent is PASSWORD (converted with toUpper()). I am at a complete loss on this.. in the other app i can type in lower or upper or mixed and i am able to authenticate. In the other app i am not using the textboxes from the login control though.. not sure if this is making the difference??

    Read the article

  • Velocity engine fails to load template from a remote shared folder

    - by performanceuser
    I have following code File temlateFile = new File( "D:/config/emails/MailBody.vm" ); temlateFile.exists(); VelocityEngine velocityEngine = new VelocityEngine(); velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); velocityEngine.setProperty("file.resource.loader.class", FileResourceLoader.class.getName()); velocityEngine.setProperty("file.resource.loader.path", temlateFile.getParentFile().getAbsolutePath()); velocityEngine.init(); template = velocityEngine.getTemplate( temlateFile.getName() ); This works because it is loading a file from local file system. Once I change the first like to: File temlateFile = new File( "//remote/config/emails/MailBody.vm" ); It doesn't work. org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'MailBody.vm' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514) at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373) at com.actuate.iserver.mail.VelocityContent.<init>(VelocityContent.java:33) at com.actuate.iserver.mail.VolumeCreationMail.<init>(VolumeCreationMail.java:40) at com.actuate.iserver.mail.VolumeCreationMail.main(VolumeCreationMail.java:67) In both cases temlateFile.exists() always return true. Any ideas?

    Read the article

  • Quickest way to clone a GregorianCalendar?

    - by wds
    I'm trying to make a deep copy of an object, including a GregorianCalendar instance. I'm always wary of using clone() and it doesn't seem to have been overridden here, so I'm just doing the copy field by field. Ideally, there'd be a copy constructor, which I could use like so: GregorianCalendar newCalendar = new GregorianCalendar(oldCalendar); Unfortunately I can't find any such functionality in the API and am stuck trying to figure out which fields I need to get an exact copy. So, to make a copy of one of these calendars, how would you do it? Am I missing some simple shortcut here?

    Read the article

  • What would be a better implementation of shared variable among subclass

    - by Churk
    So currently I have a spring unit testing application. And it requires me to get a session cookie from a foreign authentication source. Problem what that is, this authentication process is fairly expensive and time consuming, and I am trying to create a structure where I am authenticate once, by any subclass, and any subsequent subclass is created, it will reuse this session cookie without hitting the authentication process again. My problem right now is, the static cookie is null each time another subclass is created. And I been reading that using static as a global variable is a bad idea, but I couldn't think of another way to do this because of Spring framework setting things during run time and how I would set the cookie so that all other classes can use it. Another piece of information. The variable is being use, but is change able during run time. It is not a single user being signed in and used across the board. But more like a Sub1 would call login, and we have a cookie. Then multiple test will be using that login until SubX will come in and say, I am using different credential, so I need to login as something else. And repeats. Here is a outline of my code: public class Parent implements InitializingBean { protected static String BASE_URL; public static Cookie cookie; ... All default InitializingBean methods ... afterPropertiesSet() { cookie = // login process returns a cookie } } public class Sub1 extends Parent { @resource public String baseURL; @PostConstruct public void init() { // set parents with my baseURL; BASE_URL = baseURL; } public void doSomething() { // Do something with cookie, because it should have been set by parent class } } public class Sub2 extends Parent { @resource public String baseURL; @PostConstruct public void init() { // set parents with my baseURL; BASE_URL = baseURL; } public void doSomethingElse() { // Do something with cookie, because it should have been set by parent class } }

    Read the article

  • java objects, shared variables

    - by raven
    hello, I have a simple question here. If I declare a variable inside an object which was made [declared] in the main class, like this: public static int number; ( usually I declare it like this : private int number; ) can it be used in a different object which was also made [declared] in the main class? btw I do not care about security atm, I just want to make something work, don't care about protection)

    Read the article

  • Updating a modul leve shared dictionary

    - by Vishal
    Hi, A module level dictionary 'd' and is accessed by different threads/requests in a django web application. I need to update 'd' every minute with a new data and the process takes about 5 seconds. What could be best solution where I want the users to get either the old value or the new value of d and nothing in between. I can think of a solution where a temp dictionary is constructed with a new data and assigned to 'd' but not sure how this works! Appreciate your ideas. Thanks

    Read the article

  • Java date processing

    - by Don
    Hi, Given an instance of java.util.Date which is a Sunday. If there are 4 Sundays in the month in question, I need to figure out whether the chosen date is 1st Sunday of month 2nd Sunday of month 2nd last Sunday of month Last Sunday of month If there are 5 Sundays in the month in question, then I need to figure out whether the chosen date is 1st Sunday of month 2nd Sunday of month 3rd Sunday of month 2nd last Sunday of month Last Sunday of month I've had a look in JodaTime, but haven't found the relevant functionality there yet. The project is actually a Groovy project, so I could use either Java or Groovy to solve this. Thanks, Donal

    Read the article

  • Updating a module level shared dictionary

    - by Vishal
    Hi, A module level dictionary 'd' and is accessed by different threads/requests in a django web application. I need to update 'd' every minute with a new data and the process takes about 5 seconds. What could be best solution where I want the users to get either the old value or the new value of d and nothing in between. I can think of a solution where a temp dictionary is constructed with a new data and assigned to 'd' but not sure how this works! Appreciate your ideas. Thanks

    Read the article

  • GWT Calendrical Calculations

    - by Kyle Hayes
    We have a GWT application that needs to display various holidays. Is there a library available to do these calendrical calculations? If not, we'll have to do our own that we can ingest a set of rules to. Cheers

    Read the article

  • How do I calculate someone's age in Java?

    - by nojevive
    I want to return an age in years as an int in a Java method. What I have now is the following where getBirthDate() returns a Date object (with the birth date ;-)): public int getAge() { long ageInMillis = new Date().getTime() - getBirthDate().getTime(); Date age = new Date(ageInMillis); return age.getYear(); } But since getYear() is deprecated I'm wondering if there is a better way to do this? I'm not even sure this works correctly, since I have no unit tests in place (yet).

    Read the article

  • Java giving incorrect year values

    - by whistler
    Something very, very strange is occurring in my program, and I'm wondering if anyone out there has seen this occur before. And, if so, how to fix it. Basically, I am parsing an csv file...no problem there. One column contains a date and I am taking it in as a String and changing to a Date object. Again, no problem there. The code is as follows: SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy hh:mm"); Date initialDate = new Date(); try { initialDate = dateFormat.parse(rows.get(0)[8]); System.out.println(initialDate); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } Of course, I'm parsing other columns as well (and those are working fine). So, when I run my program for a small csv file (2.8 MB), the dates come out (i.e. are parsed) perfectly. However, when I run the program for a large csv file (25 MB), the dates are a hot mess. For example, take a look at the year values I am getting (the following is just a tiny portion of the println output from the code above): 1000264 at Sun Nov 05 15:30:00 EST 2186 1000320 at Sat Mar 04 17:30:00 EST 2169 1000347 at Sat Apr 01 09:45:00 EDT 2169 1000413 at Tue Jul 09 13:00:00 EDT 2182 1000638 at Fri Dec 11 13:45:00 EST 2167 1000667 at Wed Dec 10 10:00:00 EST 2188 1000690 at Mon Jan 02 13:00:00 EST 2169 1000843 at Thu Feb 11 13:30:00 EST 2196 In actuality, the years are in the realm of 1990-2006 or so. Again, this does not happen with the small csv file. Does anyone know what's going on here and how I can fix it? I need to process the large csv file (the small one was just for testing purposes). By request, here are the actual dates in the csv file and after that the value given by the code above: 5/20/03 15:30 5/20/03 15:30 8/30/04 9:00 8/30/04 9:00 12/20/04 10:30 12/20/04 10:30 Sun Nov 05 15:30:00 EST 2186 Sun Nov 05 15:30:00 EST 2186 Sun Nov 05 15:30:00 EST 2186 Thu Dec 08 09:00:00 EST 2196 Tue Dec 12 10:30:00 EST 2186 Tue Dec 12 10:30:00 EST 2186

    Read the article

  • Python : How to add month to December 2012 and get January 2013?

    - by daydreamer
    >>> start_date = date(1983, 11, 23) >>> start_date.replace(month=start_date.month+1) datetime.date(1983, 12, 23) This works until the month is <=11, as soon as I do >>> start_date = date(1983, 12, 23) >>> start_date.replace(month=start_date.month+1) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: month must be in 1..12 How can I keep adding months which increments the year when new month is added to December?

    Read the article

  • Shared data in an ASP.NET application

    - by Barguast
    I have a basic ASP.NET application which is used to request data which is stored on disk. This is loaded from files and sent as the response. I want to be able to store the data loaded from these files in memory to reduce the number of reads from disk. All of the requests will be asking for the same data, so it makes sense to have a single cache of in-memory data which is accessible to all requests. What is the best way to create a single accessible object instance which I can use to store and access this cached data? I've looked into HttpApplication, but apparently a new instance of this is created for parallel requests and so it doesn't fit my needs.

    Read the article

  • If either one of both equals

    - by user1620028
    I have start and end dates which are stored in a database in this format: start date= 20121004 //4th October 2012 end date= 20121004 //16th November 2012 so I can use date format: $date = date("Ymd"); // returns: 20121004 to determine when to display and not display to repopulate my update input boxes I use: $start=(str_split($stdate,4));// START DATE: splits stored date into 2x4 ie: 20121209 = 2012 1209 $syr = $start[0];// re first half ie: 2012 which is the year $start2 = $start[1];//re second half ie: 1209 $start3=(str_split($start2,2));// splits second half date into 2x2 ie: 1209 = 12 09 $smth = $start3[0]; // first half = month ie: 12 $sday = $start3[1]; // second half = day ie: 09 $expiry=(str_split($exdate,4)); ///SAME AGAIN FOR EXPIRY DATE ... $xyr = $expiry[0]; $expiry2 = $expiry[1]; $expiry3=(str_split($expiry2,2)); $xmth = $expiry3[0]; $xday = $expiry3[1]; which works fine but I need to repopulate the input boxes for the month showing the date in the database like this <option value="01">January</option`> using if ($smth==01):$month='January'; endif; if ($xmth==01):$month='January'; endif; // if the start and/or expiry month number = 01 display $month as January if ($smth==02):$smonth='February'; endif; if ($xmth==02):$smonth='February'; endif; if ($smth==03):$month='March'; endif; <select name="stmonth" class="input"> <option value="<?=$smth?>"><?=$month?></option> ... </select> is there an easier way to display IF EITHER ONE EQUALS rather than having to write the same line twice once for each $smth AND $xmth ? re: if ($smth **and or** $xmth ==01):$month='January'; endif;

    Read the article

  • Detecting inconsistent revisions of shared sources in SVN

    - by maxim1000
    I have an SVN repository containing several components: LibraryA LibraryB - depends on LibraryA Application - depends on LibraryB and LibraryA More detailed structure (branches and tags are not related to the problem): LibraryA LibraryA_code LibraryB LibraryB_code svn:externals to a fixed revision R1 of LibraryA_code Application Application_code svn:externals to a fixed revision R2 of LibraryA_code svn:externals to a fixed revision R3 of LibraryB_code The problem I'm trying to solve is automatic detection of situation when R2 differs from R1 (breaking expectations of LibraryB_code) and notification about this (e.g. build failure). I'll describe in an answer the only solution which I see for now, but I hope for something more elegant :) Environment: Windows, Visual Studio, SVN.

    Read the article

  • "Passing Go" in a (python) date range

    - by anonymous coward
    The Rules: An employee accrues 8 hours of Paid Time Off on the day after each quarter. Quarters, specifically being: Jan 1 - Mar 31 Apr 1 - Jun 30 Jul 1 - Sep 30 Oct 1 - Dec 31 The Problem Employees will use an automated system to request paid time off, possibly occurring in the past, as well as the future. Requests should only be accepted if the employee has (or will have) that time available. For instance, if an employee only has 1 Day of Paid Time Off currently available (currently being January 20th), but is requesting 2 Days of Paid Time Off, beginning September 20th, the system should take into account that the employee would have accrued enough time off by then and allow the request. (Obviously ignoring that the employee may use up existing time before that date). I'm currently using Python, and wondering what the correct approach to something like this would be. I'm assuming that using DateTime objects, and possibly the dateutil module, would help here, but my brain isn't wrapping around this problem for some reason.

    Read the article

< Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >