/**
* Send email
*
* @param $to
* @param $subject
* @param $body content of the email
* @param $attachments (optional)
*
* @return boolean
*/
function mySendMail($to, $subject, $body, $attachments = array()) {
$CI =& get_instance();
$CI->load->library('email');
$config = array('protocol' => 'sendmail', 'smtp_host' => 'relay-hosting.secureserver.net', 'mailtype' => 'html');
$CI->email->initialize($config);
$CI->email->from('webmaster@xxx.com', 'xxx');
$CI->email->to($to);
$CI->email->subject($subject);
$CI->email->message($body);
foreach ($attachments as $attachment) {
$CI->email->attach($attachment);
}
if ($CI->email->send()) {
// echo 'success!';
return true;
} else {
// echo $CI->email->print_debugger();
return false;
}
}
Create a file named “php5.ini”, add this text “cgi.fix_pathinfo = On”
Upload this file to the root directory of your website, wait for some minutes. Then it works fine.
For VS 2008
Tools => Options => Projects and solutions => VC++ directories, Choose “Include Files”, Add
D:\Qt\4.7.2\include
D:\Qt\4.7.2\include\QtGui
PS: D:\Qt is the installation directory for QT.
For Visual Assist X
In the configuration page of VS assistantX, Projects=>C/C++ Directories=>ustom, Add
D:\Qt\4.7.2\include
D:\Qt\4.7.2\include\QtGui
D:\Qt\4.7.2\include\Qt
I ran the project “Triangle”(Chapter 2, OpenGL SuperBible) on my computer, and got the following error: Unhandled exception at 0×00000000 in Triangle.exe: 0xC0000005: Access violation, which thrown from the statement “shaderManager.InitializeStockShaders();”
Solution: update the display adapater driver to the latest version.
Repaste from http://gaogengzhi.javaeye.com/blog/697159
Sometimes we need a clean copy(which doesn’t contain the .svn/.cvs Folder).
There is a method to do this:
For svn
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""
For cvs
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteCVS]
@="Delete CVS Folders"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing CVS Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.cvs) DO RD /s /q \"%%f\" \""
Save the above text as “DeleteSvnFolder.reg”/”DeleteCvsFolder.reg”. Double-click it to import it to the registry. Then you’ll find that there will be a item “Delete SVN Folder”/”Delete CVS Folder” in your windows context menu.
My apache server cannot start up one day. I get the error message “Apache Faulting Module Ntdll.dll” from windows event log viewer. I thought that there were some conflicts between apache and other softwares. So I tried to uninstall softwares which installed recently.
However, the apache cannot start up. I still got the same error message.
The problem was resolved until I read a web page, which point out that this error may caused by the conflict between PHP extension dlls and windows dlls. I removed all PHP extensions in the php.ini, then restarted apache. Thank goodness, apache works fine at last.
I got the message “the table `user` marked as crashed and should be repaired” when I execute a sql statement in my Mysql server.
I thought there should be something wrong with the table `user`. Then I sought help from Google and got the solution at last:
open the command line prompt, change the directory to mysql/bin
cd D:\Program Files\MySQL\bin
use the “myisamchk” tool to repair the table
myisamchk -f ‘D:\Program Files\MySQL\MySQL Server 5.1\data\dbName\user.MYI’
PS: the “dbName” stands for the name of the database which the table in.
Sometimes, we need use the Dispatcher.BeginInvoke. You can call it by anonymous delegate if you use C#. Like this:
Dispatcher.BeginInvoke(delegate
{
Method1();
Method2();
});
VB.Net doesn’t support anonymous delegate. You cannot call the Dispatcher.BeginInvoke like in C#. However, VB.NET supports Lambda Expressions, which with a single statement. For example:
Dispatcher.BeginInvoke(Function() DisposeTimer())
Private Function DisposeTimer() As Integer
Me._timer.Stop()
Me._timer = Nothing
Return 0
End Function
Problem
I use colorbox to display an inline list of checkboxes to choose.
It works fine with FF & IE7 & IE8, but it lose the selection on IE6 when I close the colox window.
Here’s a example page to reproduce this problem.
<script src="js/jQuery/jquery-1.3.2.min.js" type="text/javascript"><!--mce:0--></script> <script src="js/jQuery/colorBox/jquery.colorbox-1.3.9.min.js" type="text/javascript"><!--mce:1--></script> <script type="text/javascript"><!--mce:2--></script> <a id="colorBoxLink">Open checkbox page</a> <div style="display: none;"> <div id="chkBoxContainer"> <input name="chkbox1" type="checkbox" value="1" /> 1 <input name="chkbox2" type="checkbox" value="2" /> 2</div> </div> |
Solution
However, I found that this probelem doesn’t caused by colorBox but jQuery. The original state would be lost if a checkbox moved by jQuery in the DOM in ie6.
So you can use the event hooks to detect which boxes have been checked, then re-check them after colorbox has been opened, then re-check them again after coloxbox has been
closed.
You can do such things with the following function so as to solve the tricky problem. Please attach the function to the body of $(document).ready(function() {}).
You can also get the function here
function fixColorBoxBugInIe6() { if (navigator.appName == "Microsoft Internet Explorer") { var arrVersion = navigator.appVersion.split("MSIE"); if (parseFloat(arrVersion[1]) == 6) { // if the browser is ie6 var $checked = null; $().bind('cbox_open', function() { $checked = $('input:checked'); }).bind('cbox_complete', function() { $checked.attr('checked', true); }).bind('cbox_cleanup', function() { $checked = $('input:checked'); }).bind('cbox_closed', function() { $checked.attr('checked', true); }); } } } |
This site was built to provide elegant codes and focus on trouble shooting. Just enjoy!