Friday, January 16, 2009
Sending Mail + Text with PHP
I am having trouble with this particular bit of code:
$toaddress = "5163596507@txt.att.net";
$subject = 'LIST';
$mailcontent = date('G i');
if($result){
//echo mysql_affected_rows().
echo 'Welcome to the Kissing Kontest. You will receive a text message presently.';
$was_sent = mail($toaddress, $subject, $mailcontent);
if ($was_sent) {
echo 'mail was sent.';
} else {
echo 'error';
}
} else {
echo mysql_error();
}
The mail is being routed through my server extremely slowly, so it's difficult to tell if the script works when I'm working on it. It seems also, that it helps to have the variables declared outside of the conditional "if($result)".
Still unclear on the difference between double and single quotes.
ok - figured it out
to address string must be in single quotes
wrong ---->> $toaddress = "5163596507@txt.att.net";
correct ------->$toaddress = '5163596507@txt.att.net';
Tomorrow I'll start by changing the return address, I think.
$toaddress = "5163596507@txt.att.net";
$subject = 'LIST';
$mailcontent = date('G i');
if($result){
//echo mysql_affected_rows().
echo 'Welcome to the Kissing Kontest. You will receive a text message presently.';
$was_sent = mail($toaddress, $subject, $mailcontent);
if ($was_sent) {
echo 'mail was sent.';
} else {
echo 'error';
}
} else {
echo mysql_error();
}
The mail is being routed through my server extremely slowly, so it's difficult to tell if the script works when I'm working on it. It seems also, that it helps to have the variables declared outside of the conditional "if($result)".
Still unclear on the difference between double and single quotes.
ok - figured it out
to address string must be in single quotes
wrong ---->> $toaddress = "5163596507@txt.att.net";
correct ------->$toaddress = '5163596507@txt.att.net';
Tomorrow I'll start by changing the return address, I think.
How To Set up a Google Apps Email Account
1. To access your google apps homepage visit www.google.com/a/[domain_name.com]
1. To register a new domain visit:
http://www.google.com/apps/intl/en/business/editions.html
1. To register a new domain visit:
http://www.google.com/apps/intl/en/business/editions.html
Thursday, January 15, 2009
KMZ KML DAE
It seems as though .kmz, google sketchup's default and only 3d export format is just a zipped .kml and .dae folder.
-.kml is used for geocoding
-.dae is a cross platform, 3d xml file format
see also COLLADA
-.kml is used for geocoding
-.dae is a cross platform, 3d xml file format
see also COLLADA
How Do I Find the Hosting Address of my Online Database?
@ $db = mysql_connect(host,root,password)
Q:What is the value for host?
A:
1. login to cheap domain-registration
2. click hosting -> manage account
3. databases -> MySQL
4. database -> view/edit settings
host is "Host Name:"
Q:What is the value for host?
A:
1. login to cheap domain-registration
2. click hosting -> manage account
3. databases -> MySQL
4. database -> view/edit settings
host is "Host Name:"
Monday, January 12, 2009
Trouble Viewing Images on Linked Pages
1. I'm having trouble viewing images on certain webpages...
1a. These pages are pages I navigate to.
1b. These pages are pages on my local server.
1c. I think my local server is not able to handle the relative file path of aforementioned images.
1d. The server is looking for images here: localhost/project_images/ instead of here: localhost/davidmahfouda/project_images?
2. I think the issue was with the way i wrote the image filepaths:
incorrect --->
correct ----->
1a. These pages are pages I navigate to.
1b. These pages are pages on my local server.
1c. I think my local server is not able to handle the relative file path of aforementioned images.
1d. The server is looking for images here: localhost/project_images/ instead of here: localhost/davidmahfouda/project_images?
2. I think the issue was with the way i wrote the image filepaths:
incorrect --->

correct ----->
Friday, January 9, 2009
iPhone Application
Q:http://developer.apple.com/iphone/gettingstarted/docs/creatingiphoneapps.action
A: Here are some things I will be learning aboutL
1. initializing the application
2. displaying a window
3. drawing custom content
4. handling touch events
5. performing animations.
Some facts:
1. Objective C files are denoted by the extension .m
2. nib files are denoted by the extension .xib
Q:What are nib files?
A:nib files are resource files that contain "freeze dried" objects.
Fact: The ultimate target of an Xcode project is an application bundle.
Fact: Application bundles have a relatively flat file structure.
Resource: More information about the "Application Bundle" in the Iphone Application Programming Guide, available here:
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/chapter_1_section_1.html
Fact: To rotate iPhone in simulator, use command + right arrow.
Fact: As is true for all C-based applications, the initial entry point for every iPhone application is a function called [main].
Fact: When you use iPhone templates in Xcode, you do not have to write this function yourself.
Fact: ONe of the most important architectural details of an iPhone application is the definition of the Application Delegate Object. In MoveMe the interface for the application delegate class is in MoveMeAppDelegate.h and the implementation is in MoveMeAppDelegate.m.
Q:What is an Application Delegate Object?
A:The application delegate object works in tandem with the UIApplication object to handle changing conditions in the application.
Fact: The application delegate is responsible for the following behaviors:
1. Setting the application window and initial user interface
2. Responding to interruptions like incoming phone calls or sms messages
3. Responding to low memory situations
4. Quitting the application
5. Processing URLs
6. Registering changes in orientation
Fact: The main nib file usually contains the association between the application object and the application delegate.
Interface Builder
Fact: One can create and edit nib files using the Interface Builder application.
Fact: To launch the Interface Builder, double click on the MainWindow.xib file.
Fact: The File's Owner icon represents the UIApplication object.
Fact: To reveal the connection between the application and the delegate, open the Connections Inspector[apple+2].
Fact: For more information about how to create nib files using the interface builder, see Interface Builder User Guide here: http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/index.html
Creating the Application Window
Fact: Graphical applications in do not run side by side.
Fact: Your application is (basically) the only thing running after it is launched.
Fact: Your application should never need more than one window.
Fact: Windows provide the drawing surface for your user interface.
Fact: View objects provide/contain the content of the interface.
Q: What is a view object.
A: A view object is an instance of the UIView class that draws objects, and responds to user interactions with that content.
Launch Time:
1.window object unarchived from MainWindow.xib
2.UIApplication object sends the delegate an ApplicationDidFinishLaunching: message.
In MoveMe ApplicationDidFinishLaunching does the following:
1. it creates a view controller object to manage the content of the window
UIViewController *aViewController = [[UIViewController alloc]
initWithNibName:@"MoveMeView" bundle:[NSBundle mainBundle]];
self.viewController = aViewController;
[aViewController release];
2. it initiallizes the view controller with the nib file whose content it will manage (in this case MoveMeView.xib).
initWithNibName:@"MoveMeView"
3.Q: What does it mean: to add the controller's view as a subview of the window?
A: UIView *controllersView = [viewController view];
[window addSubview:controllersView];
4. it shows the window
[window makeKeyAndVisible];
Fact: MoveMe's ApplicationDidFinishLaunching: method is located in the implementation file MoveMeAppDelegate.m
Fact: During nib loading the MoveMeView object is initialized with its InitWithCoder: method.
Q: Where is InitWithCoder:?
A: In MoveMeView.m.
Fact: The Placard View Object is configured as a subview of the MoveMeView Object.
Fact: This enables:
1. The Welcome Button to be displayed over the application's background.
2. Allows MoveMeView object to handle events targeted at the Weclome Button.
DRAWING THE WELCOME BUTTON
Fact: The standard views provided by the UIKit can be used without modification to many types of simple content.
Q: What is the UIKit?
A:
For example:
-The UIImageView class can be used to display images.
-The UILabel class can be used to display text strings.
MOVEMEFact: PlacardView content consists of
1. background image
2. custom string
To draw this content, the class takes the following steps.
1. Draw the background at the views current origin:
[placardImage drawAtPoint:(CGPointMake(0.0, 0.0))];
2.Compute the position of the Welcome string so it is centered in the button:
CGFloat x = self.bounds.size.width/2 - textSize.width/2;
CGFloat y = self.bounds.size.height/2 - textSize.height/2;
CGPoint point;
3.Set the drawing color to black:
[[UIColor blackColor] set];
4.Draw the string in black, slightly offset:
point = CGPointMake(x, y + 0.5);
[currentDisplayString drawAtPoint:point
forWidth:(self.bounds.size.width-STRING_INDENT)
withFont:font
fontSize:fontSize
lineBreakMode:UILineBreakModeMiddleTruncation
baselineAdjustment:UIBaselineAdjustmentAlignBaselines];
5. Set the drawing color to white:
[[UIColor whiteColor] set];
6.Draw the string in white:
point = CGPointMake(x, y);
[currentDisplayString drawAtPoint:point
forWidth:(self.bounds.size.width-STRING_INDENT)
withFont:font
fontSize:fontSize
lineBreakMode:UILineBreakModeMiddleTruncation
baselineAdjustment:UIBaselineAdjustmentAlignBaselines];
Fact: Use Quartz (Or OpenGL ES) for more content more complicated than images and strings.
Fact: Quartz and UIKit are based on the same drawing environment, so you can use Quartz functions directly from the drawRect: method.
HANDLING TOUCH EVENTS
Fact: The system delivers events to an object called UIResponder.
Q: What does it mean, "my applications views form the bulk of my 'custom responder objects'"
MOVEMEFACT: Only the MoveMeView object responds to event messages.
Here are some methods of the UIResponder class:
- (void)touchesBegan:
- (void)touchesMoved:
- (void)touchesEnded:
As part of its event-Handling behavior, the MoveMe class performs the following steps:
1. When a touch arrives it checks to see where the even occured.
if ([touch view] != placardView)
- double taps outside the welcome button update the string within the welcome button
if ([touch tapCount] == 2)
{
[placardView setupNextDisplayString];
}
- single taps within the welcome button center the button underneath the finger and start an initial animation
if ([touch view] == placardView)
{
CGPoint location = [touch locationInView:self];
placardView.center = location;
return;
}
- all other touch is ignored
2. If the finger moves and it is inside the button, the button's position is updated to match the new position of the finger.
3. If the finger was inside the button, and then removed, an animation is triggered to return button to its original position.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
// If the touch was in the placardView, bounce it back to the center
if ([touch view] == placardView)
{
// Disable user interaction so subsequent touches
// don't interfere with animation
self.userInteractionEnabled = NO;
[self animatePlacardViewToCenter];
return;
}
}
Finishing Your Application
Fact: The simplest way to edit your Application's Info.plist is to use Xcode's built in property-list editor.
For more information about editing your Application's info.plist visit
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/chapter_3_section_4.html
A: Here are some things I will be learning aboutL
1. initializing the application
2. displaying a window
3. drawing custom content
4. handling touch events
5. performing animations.
Some facts:
1. Objective C files are denoted by the extension .m
2. nib files are denoted by the extension .xib
Q:What are nib files?
A:nib files are resource files that contain "freeze dried" objects.
Fact: The ultimate target of an Xcode project is an application bundle.
Fact: Application bundles have a relatively flat file structure.
Resource: More information about the "Application Bundle" in the Iphone Application Programming Guide, available here:
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/chapter_1_section_1.html
Fact: To rotate iPhone in simulator, use command + right arrow.
Fact: As is true for all C-based applications, the initial entry point for every iPhone application is a function called [main].
Fact: When you use iPhone templates in Xcode, you do not have to write this function yourself.
Fact: ONe of the most important architectural details of an iPhone application is the definition of the Application Delegate Object. In MoveMe the interface for the application delegate class is in MoveMeAppDelegate.h and the implementation is in MoveMeAppDelegate.m.
Q:What is an Application Delegate Object?
A:The application delegate object works in tandem with the UIApplication object to handle changing conditions in the application.
Fact: The application delegate is responsible for the following behaviors:
1. Setting the application window and initial user interface
2. Responding to interruptions like incoming phone calls or sms messages
3. Responding to low memory situations
4. Quitting the application
5. Processing URLs
6. Registering changes in orientation
Fact: The main nib file usually contains the association between the application object and the application delegate.
Interface Builder
Fact: One can create and edit nib files using the Interface Builder application.
Fact: To launch the Interface Builder, double click on the MainWindow.xib file.
Fact: The File's Owner icon represents the UIApplication object.
Fact: To reveal the connection between the application and the delegate, open the Connections Inspector[apple+2].
Fact: For more information about how to create nib files using the interface builder, see Interface Builder User Guide here: http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/index.html
Creating the Application Window
Fact: Graphical applications in do not run side by side.
Fact: Your application is (basically) the only thing running after it is launched.
Fact: Your application should never need more than one window.
Fact: Windows provide the drawing surface for your user interface.
Fact: View objects provide/contain the content of the interface.
Q: What is a view object.
A: A view object is an instance of the UIView class that draws objects, and responds to user interactions with that content.
Launch Time:
1.window object unarchived from MainWindow.xib
2.UIApplication object sends the delegate an ApplicationDidFinishLaunching: message.
In MoveMe ApplicationDidFinishLaunching does the following:
1. it creates a view controller object to manage the content of the window
UIViewController *aViewController = [[UIViewController alloc]
initWithNibName:@"MoveMeView" bundle:[NSBundle mainBundle]];
self.viewController = aViewController;
[aViewController release];
2. it initiallizes the view controller with the nib file whose content it will manage (in this case MoveMeView.xib).
initWithNibName:@"MoveMeView"
3.Q: What does it mean: to add the controller's view as a subview of the window?
A: UIView *controllersView = [viewController view];
[window addSubview:controllersView];
4. it shows the window
[window makeKeyAndVisible];
Fact: MoveMe's ApplicationDidFinishLaunching: method is located in the implementation file MoveMeAppDelegate.m
Fact: During nib loading the MoveMeView object is initialized with its InitWithCoder: method.
Q: Where is InitWithCoder:?
A: In MoveMeView.m.
Fact: The Placard View Object is configured as a subview of the MoveMeView Object.
Fact: This enables:
1. The Welcome Button to be displayed over the application's background.
2. Allows MoveMeView object to handle events targeted at the Weclome Button.
DRAWING THE WELCOME BUTTON
Fact: The standard views provided by the UIKit can be used without modification to many types of simple content.
Q: What is the UIKit?
A:
For example:
-The UIImageView class can be used to display images.
-The UILabel class can be used to display text strings.
MOVEMEFact: PlacardView content consists of
1. background image
2. custom string
To draw this content, the class takes the following steps.
1. Draw the background at the views current origin:
[placardImage drawAtPoint:(CGPointMake(0.0, 0.0))];
2.Compute the position of the Welcome string so it is centered in the button:
CGFloat x = self.bounds.size.width/2 - textSize.width/2;
CGFloat y = self.bounds.size.height/2 - textSize.height/2;
CGPoint point;
3.Set the drawing color to black:
[[UIColor blackColor] set];
4.Draw the string in black, slightly offset:
point = CGPointMake(x, y + 0.5);
[currentDisplayString drawAtPoint:point
forWidth:(self.bounds.size.width-STRING_INDENT)
withFont:font
fontSize:fontSize
lineBreakMode:UILineBreakModeMiddleTruncation
baselineAdjustment:UIBaselineAdjustmentAlignBaselines];
5. Set the drawing color to white:
[[UIColor whiteColor] set];
6.Draw the string in white:
point = CGPointMake(x, y);
[currentDisplayString drawAtPoint:point
forWidth:(self.bounds.size.width-STRING_INDENT)
withFont:font
fontSize:fontSize
lineBreakMode:UILineBreakModeMiddleTruncation
baselineAdjustment:UIBaselineAdjustmentAlignBaselines];
Fact: Use Quartz (Or OpenGL ES) for more content more complicated than images and strings.
Fact: Quartz and UIKit are based on the same drawing environment, so you can use Quartz functions directly from the drawRect: method.
HANDLING TOUCH EVENTS
Fact: The system delivers events to an object called UIResponder.
Q: What does it mean, "my applications views form the bulk of my 'custom responder objects'"
MOVEMEFACT: Only the MoveMeView object responds to event messages.
Here are some methods of the UIResponder class:
- (void)touchesBegan:
- (void)touchesMoved:
- (void)touchesEnded:
As part of its event-Handling behavior, the MoveMe class performs the following steps:
1. When a touch arrives it checks to see where the even occured.
if ([touch view] != placardView)
- double taps outside the welcome button update the string within the welcome button
if ([touch tapCount] == 2)
{
[placardView setupNextDisplayString];
}
- single taps within the welcome button center the button underneath the finger and start an initial animation
if ([touch view] == placardView)
{
CGPoint location = [touch locationInView:self];
placardView.center = location;
return;
}
- all other touch is ignored
2. If the finger moves and it is inside the button, the button's position is updated to match the new position of the finger.
3. If the finger was inside the button, and then removed, an animation is triggered to return button to its original position.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
// If the touch was in the placardView, bounce it back to the center
if ([touch view] == placardView)
{
// Disable user interaction so subsequent touches
// don't interfere with animation
self.userInteractionEnabled = NO;
[self animatePlacardViewToCenter];
return;
}
}
Finishing Your Application
Fact: The simplest way to edit your Application's Info.plist is to use Xcode's built in property-list editor.
For more information about editing your Application's info.plist visit
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/chapter_3_section_4.html
Thursday, January 8, 2009
Installing (really, just locating) a MySQL Server on my Computer
Q: Do I have a MySQL server on my computer?
A: Finder>System Preferences>MySQL: yes.

Q: How do I log into said server?
A: From terminal
I login as a super user [su], then type [mysql -p] and get a password prompt.
Q: Do I need to know about various MySQL permissions granting proceedures?
A: I'm not sure, but I did grant hweol certain privileges thusly:
Q: Can I connect to this MySQL server from PHP?
A: I got a host of errors, many of which I didn't record. But it turned out, I needed to create a php.ini file. I did this by copying a php.ini.default file from /etc/, and renaming in php.ini. Then I had to change my default socket setting. I forget how I found my default socket setting. Skom would know. I also had to restart Apache.
Q: Does Blogger enable CSS formatting?
A: Yes. Under the Layout tab.
Q: How do I make my posts a fixed with?
A: layout>html
.post {
max-width: 500px;
min-width: 500px;
/*padding-$startSide:5%;*/
/*padding-$endSide:70%;*/
}
A: Finder>System Preferences>MySQL: yes.

Q: How do I log into said server?
A: From terminal
I login as a super user [su], then type [mysql -p] and get a password prompt.
Q: Do I need to know about various MySQL permissions granting proceedures?
A: I'm not sure, but I did grant hweol certain privileges thusly:

Q: Can I connect to this MySQL server from PHP?
A: I got a host of errors, many of which I didn't record. But it turned out, I needed to create a php.ini file. I did this by copying a php.ini.default file from /etc/, and renaming in php.ini. Then I had to change my default socket setting. I forget how I found my default socket setting. Skom would know. I also had to restart Apache.
Q: Does Blogger enable CSS formatting?
A: Yes. Under the Layout tab.
Q: How do I make my posts a fixed with?
A: layout>html
.post {
max-width: 500px;
min-width: 500px;
/*padding-$startSide:5%;*/
/*padding-$endSide:70%;*/
}
Subscribe to:
Posts (Atom)