09.19
PHP: CodeIgniter: Send image response with mime header
By Satish Natarajan
function send_image {
$imageString = file_get_contents('you image path goes here...');
header("Content-Type: image/gif");
echo $imageString;
} Findings, Tips & Tricks
function send_image {
$imageString = file_get_contents('you image path goes here...');
header("Content-Type: image/gif");
echo $imageString;
} I am sure most of you know this. I am writing this one for reference.
Suppose you want to delete something…
Alert.show(”Do you want to delete ? “, “Delete Confirmation”, Alert.OK|Alert.CANCEL, this, action_function, null, Alert.CANCEL);
Variables: Message, Window title, What options to Show, Who is the parent, Handler function, Icon?, Default Option
the action function looks like this
public function action_function(eventObj:CloseEvent):void {
if(eventObj.detail == Alert.OK){
//Selected OK
}
if(eventObj.detail == Alert.CANCEL){
//Selected Cancel
}
}
<mx:DataGrid id=”myGrid” dataProvider=”{dataAC}”>
<mx:columns>
<mx:DataGridColumn dataField=”id” headerText=”ID” />
<mx:DataGridColumn dataField=”description” headerText=”Description Detail” headerWordWrap=”true”/>
<mx:DataGridColumn headerText=”Action”>
<mx:itemRenderer>
<mx:Component>
<mx:Text text=”Delete” textDecoration=”underline” click=”outerDocument.delete_function(data.id)”/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Ok some assumptions
Overall I like this – Lot of neat uses….
The regex below removes html tags from a given string
str = <<HTML_TEXT <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body> <h1>Title</h1> <p>Blah Blah Blah!</p> </body> </html> HTML_TEXT puts str.gsub(/<\/?[^>]*>/, "")
We recommend using OpenInviter at http://openinviter.com. We have tried it in a recent project and we like it for ease of integration and their updates.
In your application create a function that will be called when an event like click on link or button happens
import mx.managers.PopUpManager;
private function showTestPopup():void {
var win:TestPopup = PopUpManager.createPopUp(this.parent, TestPopup, true) as TestPopup;
PopUpManager.centerPopUp(win);
}
TestPopup.mxml will look like this:
<?xml version=”1.0″ encoding=”utf-8″?>
<!– TestPopup.mxml –>
<mx:TitleWindow xmlns:mx=”http://www.adobe.com/2006/mxml”
layout=”vertical”
title=”Test Popup”
showCloseButton=”true”
width=”400″
height=”300″
close=”titleWindow_close(event);”>
<mx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
private function titleWindow_close(evt:CloseEvent):void {
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:Text text=”This is a test 12345″>
</mx:Text>
</mx:TitleWindow>
Hope this helps…
Add the following section to you <Application> block. The key is “global” style.
<mx:Style>
@font-face{
src:url(’assets/fonts/arial.ttf’);
font-family:myArial;
font-weight:normal;
}
@font-face{
src:url(’assets/fonts/arialbd.ttf’);
font-family:myArial;
font-weight:bold;
}
global
{
font-family:myArial;
}
</mx:Style>
Remove the <mx:Legend> element from within your chart
.---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr ... | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat | | | | | * * * * * command to be executed
I found this this morning..
Object doesn’t support this property or Method. This turned out to be that in IE7 all javascript variables need to declared before use. So if you have say my_var1 you would want to put “var my_var1;” at the beginning of the script before assigning any value to it.
Oh I like new browsers (more fault tolerant) however lot of folks use IE7 at this time.