depicus

changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

  1. Universal version of iDevice application submitted to the app store.

    November 2, 2010 by The Man

    The status for the following app has changed to Waiting For Review.
    App Name: Depicus Wake On Lan
    App Version Number: 1.2

    Fixed a bug when a user input Mac Address but nothing else and pressed wake up the app would crash. (Thanks Hugh)

    Fixed a scrolling issue with the list of already woken machines that would show overlay text.

    Added a bit of extra help information to the help page.

    Our coding monkey have been working full time and eating their bananas and have managed to convert the iPhone app to a Universal app which will run natively on the iPad.

    Should be live in about a week.


  2. iDev – hiding the keyboard for a UITextView

    August 5, 2010 by The Man

    Lots of into for a UITextField but not a UITextView.

    - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
    {
        if ([text isEqualToString:@"n"])
        {
            [textView resignFirstResponder];
            return NO;
        }
        return YES;
    }
    

  3. iDev – Getting a good looking date with prefix

    by The Man

    Not sure it should take this much code but….

    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"MMMM yyyy"];
        
        NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init];
        [timeFormat setDateFormat:@"HH:mm"];
        
        NSDateFormatter *dayFormat = [[NSDateFormatter alloc] init];
        [dayFormat setDateFormat:@"d"];
        
        NSDate *now = [[NSDate alloc] init];
        
        NSString *theDate = [dateFormat stringFromDate:now];
        NSString *theTime = [timeFormat stringFromDate:now];
        NSString *theDay = [dayFormat stringFromDate:now];
        
        NSString *dayWithPrefix;
        
        if ((theDay == @"1") || (theDay == @"21") || (theDay == @"31"))
        {
            dayWithPrefix = [NSString stringWithFormat:@"%@st", theDay];
        }
        else if ((theDay == @"2") || (theDay == @"22"))
        {
            dayWithPrefix = [NSString stringWithFormat:@"%@nd", theDay];
        }
        else if ((theDay == @"3") || (theDay == @"23"))
        {
            dayWithPrefix = [NSString stringWithFormat:@"%@rd", theDay];
        }
        else
        {
            dayWithPrefix = [NSString stringWithFormat:@"%@th", theDay];
        }
        
        
        [lblDateTime setText:[NSString stringWithFormat:@"Date: %@ %@ Time: %@", dayWithPrefix, theDate, theTime]];
    
        [dateFormat release];
        [timeFormat release];
        [theDay release];
        [now release];
    
    

  4. Create a vCal in dot.net

    March 2, 2010 by The Man

    I am in the process of updating a project we started 6 years ago. One of the functions was to add a diary event to Outlook. At the time there was a simple method of automation to add events directly to Outlook but in this day and age there are two problems with this approach

    1. Automation of other applications is becoming more and more complex, having to jump through security hoops and then explain that to end users is just to much hard work.

    2. Outlook may be king now but providing solutions that work with multiple suppliers software is the way forward.

    This snippet now allows us to create a calendar event and open so the user can check and confirm, not the neatest solution but it works.

    Dim myICal As New StreamWriter("event.vcs")
    Dim sDate As Date = Convert.ToDateTime(edtOn.Text + " " + edtAT.Text)
    Dim eDate As Date = DateAdd(DateInterval.Hour, 1, Convert.ToDateTime(edtOn.Text + " " + edtAT.Text))
    Dim myLocation As String = lblView.Text
    Dim mySubject As String = lblFor.Text
    Dim myDescription As String = "Event details: Check server is started"
    
    'Create the vCal
    myICal.WriteLine("BEGIN:VCALENDAR")
    myICal.WriteLine("PRODID:-//Digital Wired Limited.//Agency Manager Professional//EN")
    myICal.WriteLine("BEGIN:VEVENT")
    myICal.WriteLine("DTSTART:" & sDate.ToUniversalTime.ToString("yyyyMMddTHHmmssZ"))
    myICal.WriteLine("DTEND:" & eDate.ToUniversalTime.ToString("yyyyMMddTHHmmssZ"))
    myICal.WriteLine("LOCATION:" & myLocation)
    myICal.WriteLine("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & myDescription)
    myICal.WriteLine("SUMMARY:" & mySubject)
    myICal.WriteLine("PRIORITY:2")
    myICal.WriteLine("END:VEVENT")
    myICal.WriteLine("END:VCALENDAR")
    myICal.Close()
    
    System.Diagnostics.Process.Start("event.vcs")

    That’s it, not pretty but functional.