I just wanted to throw up a quick post on the current state of gCalWall. I know there’s some things that are a little “wonky”. Some (minor number) of folks have seen issues with all day events, and some other stuff like blurry images. I have every intention of doing everything I can to fix these issues. I also have every intention of working in some requested improvements. But at the same time, I haven’t made much of anything off of gCalWall wall – so while its a product I intend to continue working on, it’s not a “top” priority.
So, long story short – I’m working on it, but I wouldn’t expect to release anything (aside from a major affects everybody emergency bugfix) until the iPhone 3.0 software is released. Why? Well, there’s some things I have to change for gCalWall in 3.0 to work properly and I’ve already got a development build started. So, rather than try and maintain separate builds, I’m jumping ship from 2.x and moving on to 3.x…
Adding this one for my own future reference. The important things to note was really how to remove the references to the NIB files when first building the project.
In the Resouces like locate the info.plist file and right click then go to source view and delete:
key - NSMainNibFile
string - MainWindow
While you’re in he resources list also delete the mainWindow.xib file. Finally open “Other Sources” main.m and you’re going to edit this line:
int retVal = UIApplicationMain(argc, argv, nil, nil);
and make it look like this:
int retVal = UIApplicationMain(argc, argv, nil, @"Your_App_Delegate_Class");
That pretty well sums up the key points. There’s some good information about UIWindow and UIView in the video as well if you’re not familiar with building your base view without IB. gCalWall was built largely without using Interface Builder at all so I was pretty familiar with most of it.
was throwing an error about assigning the values from a distinct Objective-C type. I was able to fake my way around it in another viewController I had a similar issue with, but this time it was a show stopper because when I tried to work with the resulting array later (by adding/removing some stuff from it) I would get another error:
exception: *** -[NSCFArray addObject:]: mutating method sent to immutable object
Well, I was pretty dammed sure I hadn’t asked for my array to be immutable, but I’m guessing somewhere in the code for the persistent object (which I’ll be checking into) there’s a copy happening (or something similar) and its turning the returned data into an NSCFArray. To fix it… I needed to make it a mutable array again:
if (self.commandArray != array){
[self.commandArray release];
self.commandArray = [array mutableCopy];
Of course this may be simple if you’re the programming type… but it drove me nuts for a while!
Had to write a VBScript today to do some funky stuff. Basically we needed to copy in a string of text and then output that text so it would be formatted to go into an email.
Input text looked something like:
x.x.x.0/x Company How Assigned Location
The big issue I had with all of this is that there’s spaces in the company names, spaces in the location, spaces in how assigned… so I couldn’t use a space as the delimter. Well, the code is UGLY… but the general concept is I knew I had certain points where I would have more than one space in a row. After the company name I had 2 spaces. After the How assigned I had 4 spaces. So I could create a couple arrays and delimit using those known values. The only other problem I had was how to get rid of the IP address before the company name… well I solved that by getting rid of all the numbers from the section of the array where the company should be. Again this isn’t pretty – but it got the job done.
window.resizeTo 450,500
dim arrHeaders(3), strIP, strCompany, strStatus, strNewContent
arrHeaders(0) = "IP Block:"
arrHeaders(1) = "Customer:"
arrHeaders(2) = "Status:"
arrHeaders(3) = "IDC:"
Sub SetCopyPaste
strPortal = "From the site:"
strline = CopyPaste.value
arrFields = Split(strLine)
arrFields2 = Split(strline, " ")
cutString = arrFields2(0)
arrFields3 = Split(strline, " ")
strAlphaNumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
For i = 1 to len(cutString)
strChar = mid(cutString,i,1)
If instr(strAlphaNumeric,strChar) Then
CleanedString = CleanedString & strChar
End If
next
strIP = arrFields(0)
strCompany = CleanedString
strStatus = arrFields2(1)
strIDC = arrFields3(1)
strNewContent = strPortal & vbCrLf & vbCrLf & arrheaders(0) & " " & strIP & " - " & strStatus & vbCrLf _
& arrHeaders(1) & " " & strCompany & vbCrLf & arrheaders(3) & " " & strIDC
CombinedText.Value = strNewContent
End Sub
Obviously there’s VBSCRIPT tags at the top and the bottom… and some HTML to format the page.
The attached file you can grab and see the whole thing with the code and whatnot.
Output text looked like this: From the site:
IP Block: x.x.x.0/x – How Assigned
Customer: Company
IDC: Location
Here's the code. Reposted for my future reference in case the source disappears.
@interface AppDelegate : NSObject {
UIWindow *window;
UITabBarController *tabBarController;
MyTableViewController *myTableViewController;
MySecondTableViewController *mySecondTableViewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) UITabBarController *tabBarController;
@property (nonatomic, retain) MyTableViewController *myTableViewController;
@property (nonatomic, retain) MySecondTableViewController *mySecondTableViewController;
@end
@implementation AppDelegate
@synthesize window, myTableViewController, mySecondTableViewController, tabBarController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
tabBarController = [[UITabBarController alloc] init]; // creates your tab bar so you can add everything else to it
myTableViewController = [[MyTableViewController alloc] init]; // creates your table view - this should be a UIViewController with a table view in it, or UITableViewController
UINavigationController *tableNavController = [[[UINavigationController alloc] initWithRootViewController:myTableViewController] autorelease];
[myTableViewController release]; // creates your table view's navigation controller, then adds the view controller you made. Note I then let go of the view controller as the navigation controller now holds onto it for me. This saves memory.
mySecondTableViewController = [[MySecondTableViewController alloc] init];
UINavigationController *table2NavController = [[[UINavigationController alloc] initWithRootViewController:mySecondTableViewController] autorelease];
[mySecondTableViewController release]; // does exactly the same as the first round, but for your second tab at the bottom of the bar.
tabBarController.viewControllers = [NSArray arrayWithObjects:tableNavController, table2NavController, nil]; add both of your navigation controllers to the tab bar. You can put as many controllers on as you like, but they will turn into the more button like in the iPod program.
[window addSubview:tabBarController.view]; // adds the tab bar's view property to the window
[window makeKeyAndVisible]; // makes the window visible
}
- (void)dealloc {
[tabBarController release];
[window release];
[super dealloc];
} // lets go of everything else, thats so your program doesn't create any leaks of memory.
@end
So, for the past few days I’ve been pulling my hair out (because I’m not a programmer so this is all new to me). I was having a really hard time with figuring out why even if I had a class named AppDelegate, and I had all the methods I needed in that AppDelegate class I would get exceptions thrown at runtime because I was requesting something my tableview controller that it didn’t have. Drove me bananas trying to figure out why the tableview controller was responding and throwing errors when I knew the AppDelegate class has the right stuff.
Turns out there was one little problem with my understanding of the Model-View-Controller concept – and its this:
You can have as many classes as you want, and you can call them all kinds of things including AppDelegate, but only one of them is actually going to be the app delegate – and it’s the one that has this little line in it:
// notice the part where it conforms to UIApplicationDelegate. That’s the key!
I gleaned this little jem of information in an explanation from (another) Brandon here:
The AppDelegate is basically your application’s controller. It is where execution begins (other than main.m). That line was put into place to access the AppDelegate object. This was to get a reference to the “fruits” array. The “fruits” array was declared inside of our application’s delegate.
Here it is line by line
FruitAppDelegate *appDelegate
// Declaring an object to hold the reference to the applicaiton’s appDelegate
(FruitAppDelegate *)
// We are casting the return value of the next phrase to a FruitAppDelegate
[[UIApplication sharedApplication] delegate]
// This gives us a reference to the appDelegate for the whole application
now that the appDelegate object holds a reference to the application’s appDelegate object, we can access variables that are declared inside of it. This allows us to do things like [appDelegate.fruits count] which will return the number of fruits in the array.
I hope that helps…
So they key to all of this – is AppDelegate isn’t that class you smartly named AppDelegate. The AppDelegate was defined when you started the project.
Last month we introduced new ways to post and keep up to date with WordPress.com blogs through the Twitter API. One of the coolest parts about this is you can make use of a growing number of…
Did you ever look at your stats chart and wonder which posts were published on a particular day? Now it’s easy to find out. Just move your mouse around the chart. (This only works for…
We’ve said it before, and we’ll probably say it again: attending a WordCamp is one of the most enjoyable ways to meet other WordPress users and learn new tricks that you can use on your site….
Happy Holidays! To spice up the coming weekend I’m here to present you with Duotone. Duotone is the successor to our highly popular photo blogging theme, Monotone. Duotone is very similar, but…
This year, we teamed up with San Francisco artist Coley Wopperer to spread some WordPress-themed holiday cheer. We thought it turned out so well, we wanted to share it with everyone as a…
If you haven’t already tried our post by email feature then it makes blog publishing as simple as sending an email. Configure your blog, write an email, and we’ll do the rest. You can…
Before we get to the stats, I should mention that at the top of my thankful-for list this Thanksgiving was our growing group of Automatticians. These are the folks who bring you the awesome…
I’ve seen my fair share of snow growing up in northern Michigan. The sun was shining today, but there is a good chance we’ll have snow on the ground by the end of the week. My favorite…