Embarcadero RAD Studio XE8, Delphi XE8, and C++ Builder XE8 Update 1 正式發佈

這次更新分為二種版本,分為有買維護合約且有效期的以及沒有買維護合約的版本。差別如下~

 

General Update 1 Feature and Fix List

This update is provided to XE8 customers without an Update Subscription

Click here for the download.

  • Community toolbar
  • iOS 8 simulator fix
  • Several files missing from the initial XE8 delivery

Subscription Update 1 Features and Fix List

This update is provided to active Update Subscription customers

Click here for the download.

  • Community toolbar
  • Favorites in welcome page
  • Fast search of Bluetooth LE devices
  • iOS 8 simulator support
  • Improved robustness of IDE productivity features
  • Improvements in multi-device previews

延伸連結

Fix List for XE8 Update 1:
http://edn.embarcadero.com/article/44470

PHP透過curl上傳xml給API

[php]

<?php
$xml_data ='<?xml version="1.0" encoding="UTF-8"?>
<FILE>
<HEAD>
<FILEDESC>ORDER</FILEDESC>
</HEAD>
<CONTENT>
<DATA>
<ID>XXXX</ID>
<MEMO>XXXXXXX</MEMO>
</DATA>
</CONTENT>
</FILE>
‘;

$URL = "http://apisite";

$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_MUTE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: text/xml’));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
[/php]

CodeIgniter發送台灣簡訊範例

[php]
<?php
$username = "xxx"; // 帳號
$password = "xxx"; // 密碼
$mobile = "09xxxxxxxx"; // 電話
$message = "測試簡訊"; // 簡訊內容
$MSGData = "";

$msg = "username=".$username."&password=".$password."&mobile=".$mobile."&message=".urlencode($message)."&drurl=".urlencode("http://xxxx.com.tw/admin/drul/");
$num = strlen($msg);

// 打開 API 閘道
$fp = fsockopen ("api.twsms.com", 80);
if ($fp) {
$MSGData .= "POST /smsSend.php HTTP/1.1\r\n";
$MSGData .= "Host: api.twsms.com\r\n";
$MSGData .= "Content-Length: ".$num."\r\n";
$MSGData .= "Content-Type: application/x-www-form-urlencoded\r\n";
$MSGData .= "Connection: Close\r\n\r\n";
$MSGData .= $msg."\r\n";
fputs ($fp, $MSGData);
$Tmp ="";
// 取出回傳值
while (!feof($fp)) $Tmp.=fgets($fp,128);
$temp2 = explode(PHP_EOL, $Tmp);
// 關閉閘道
fclose ($fp);
/*
0 傳送完成:HTTP/1.1 200 OK
1 Date: Wed, 03 Jun 20xx 09:31:36 GMT
2 Server: Apache
3 X-Powered-By: PHP/5.2.12
4 Connection: close
5 Transfer-Encoding: chunked
6 Content-Type: text/html
7
8 51
9 <smsResp><code>00000</code><text>Success</text><msgid>188xxxx69</msgid></smsResp>
10 0
*/
$xml = simplexml_load_string($temp2[9]);
$xmldata = json_decode( json_encode($xml) , 1);
echo "傳送完成:".$Tmp."<br/>".$xmldata[‘msgid’];
} else {
echo "您無法連接 TwSMS API Server";
}
$this->load->view(‘welcome_message’,$data);

}

public function drul(){
$this->load->database();
$inputdata = $this->input->get(‘xml’);
$xml = simplexml_load_string($inputdata);
$xmldata = json_decode( json_encode($xml) , 1);
$arraystring =print_r($xmldata);
$this->msg=$arraystring;

$dbvalue = array(
‘sms_msg’=> $xmldata[‘msgid’]."status=".$xmldata[‘statustext’],
‘id’ =>$xmldata[‘code’],
‘ip’ => $this->input->ip_address(),
);
$this->db->insert(‘drul’,$dbvalue );
$data = array(
‘message’ => $xmldata[‘msgid’]
);
$this->load->view(‘welcome_message’,$data);
}
[/php]

CodeIgniter超簡易發信

[php]
$email_config = Array(
‘mailtype’ => ‘html’

);
$this->load->library(’email’,$email_config);
$this->email->from(‘superlevin@gmail.com’, ‘林壽山’); //寄件者
$this->email->to(‘123@gmail.com’); // 收件者
//$this->email->cc(‘123cc@gmail.com’); // 副本
//$this->email->bcc(‘123bcc@gmail.com’); // 密件副本

$this->email->subject(‘成功通知信’); // 主旨
$this->email->message(‘<b>報名成功</b>’); //內容
$this->email->send();
[/php]

CodeIgniter上傳圖檔以及縮圖

[php]
// 縮圖
function _createThumbnail($fileName, $isThumb, $thumbMarker="", $width, $height) {
// 參數
$config[‘image_library’] = ‘gd2’;
$config[‘source_image’] = $fileName;
$config[‘create_thumb’] = $isThumb;
$config[‘maintain_ratio’] = TRUE;
$config[‘master_dim’] = ‘width’;
if(isset($thumbMarker) && $thumbMarker!=""){
$config[‘thumb_marker’] = $thumbMarker;
}
$config[‘width’] = $width;
$config[‘height’] = $height;

$this->load->library(‘image_lib’, $config);
$this->image_lib->clear();
$this->image_lib->initialize($config);
if(!$this->image_lib->resize()) echo $this->image_lib->display_errors();
}
[/php]
上傳
[php]
function uploadimage(){
$name = $this->input->get_post(‘my_file’);
$config[‘upload_path’] = ‘./uploads/’;
$config[‘allowed_types’] = ‘gif|jpg|png’;
$config[‘file_name’] = $name;
$config[‘overwrite’] = true;
$config[‘max_size’] = 4096;
//$config[‘max_width’] = 5000;
//$config[‘max_height’] = 5000;
$this->load->library(‘upload’, $config);
if ( ! $this->upload->do_upload())
{
$data[‘errormsg’] = array(‘error’ => $this->upload->display_errors());
$this->load->view(‘welcome_message’, $data);
}
else
{
$fInfo = $this->upload->data();
$this->_createThumbnail($fInfo[‘full_path’],TRUE,"",330,480);
$this->_createThumbnail($fInfo[‘full_path’],TRUE,"_tn",110,160);

$data[‘filename’]=$this->upload->data(‘file_name’);
$this->load->view(‘welcome_message’,$data);
}

}
[/php]

法國商使用Delphi結合UV感測器發表智慧型比基尼

法國公司Spinali Design發表了智慧型比基尼泳衣,使用Delphi結合UV 感測器開發app,如果穿載者紫外線過度 提醒穿戴者紫外線過度,並適時提醒補充防曬乳。

在影片中,32秒、40秒及55秒等多處都 可以看到Delphi IDE現身。

新聞網址:
http://www.telegraph.co.uk/news/worldnews/europe/france/11667659/Intelligent-French-bikini-warns-bathers-over-too-much-sun.html

HP機器上執行Rad Studio問題

HP的機器上面安裝Rad Studio後,執行時會出現下面的錯誤訊息。

[Error Error] Invalid PLATFORM variable “BPC”. PLATFORM must be one of the following: “Win32”, “Win64”, “Android”, “iOSSimulator”, “iOSDevice”, or “OSX32”. If PLATFORM is defined by your system’s environment, it must be overridden in the RAD Studio IDE or passed explicitly on the command line to MSBuild; e.g., /p:Platform=Win32.

原因是HP出廠時,在系統變數有一個變數名稱Platform造成Rad Studio出錯。只要將它刪除就行了!

hpradiostudio

CodeIgniter解決CSS路徑問題

使用CodeIgniter撰寫網頁很方便,不過會遇到的問題常常是css、image的路徑問題。
除了使用絕對路徑外,也可以使用HTML base Tag來指定基準的URL。
[php]
// 記得要load helper url
$this->load->helper(‘url’);
// 在 view 中的HTML加上
<base href="<?php echo base_url();?>"/>
[/php]