How to access and run PHP with command Line in Windows

You need to add your PHP installation directory to the %PATH% environment variable, or work from the PHP installation directory.

To add it to path (The best approach – Edited for Windows 7):

  • Right-click on a My Computer icon
  • Click Properties
  • Click Advanced system settings from the left nav
  • Click Advanced tab
  • Click Environment Variables button
  • In the System Variables section, select Path (case-insensitive) and click Edit button
  • Add a semi-colon (;) to the end of the string, then add the full file system path of your PHP installation (e.g. C:\Program Files\PHP)
  • Keep clicking OK etc until all dialog boxes have disappeared
  • Close your command prompt and open it again
  • Sorted

Alternatively, you can run cd <PHP installation path> before you try and run you command, or call your script like <FULL file system path of php.exe> <path to script>

Reference:

  1. How to access PHP with the command Line in Windows
  2. Run php file in windows cmd

SMTP gmail on Codeigniter 3

I got this article from stackoverflow as always 😀

Use the following code

And dont froget to unable following two security settings in google.

1) https://www.google.com/settings/security/lesssecureapps << turn it on

2) https://accounts.google.com/b/0/DisplayUnlockCaptcha << Click continue

** Turn off 2 step verification if you have it enabled.

Code :

$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.gmail.com',
        'smtp_port' => 465,
        'smtp_user' => 'dkumara85@gmail.com',    //email id
        'smtp_pass' => 'xxxxxxxxxxx',            // password
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('dkumara85@gmail.com','my name');
    $this->email->to("dkumara85@gmail.com"); // email array
    $this->email->subject('email subject');   
    $this->email->message("my mail body");

    $result = $this->email->send();


    show_error($this->email->print_debugger());  // for debugging purpose :: remove this once it works...

I reblogged this tips from howtogeek.com

image

The other day we wrote up how to compress a folder of images using a single line from the bash shell prompt, which is native to Linux but works on Windows if you install Cygwin. Naturally there’s a simpler solution for Windows users, and reader Lee Thompson wrote in to share it with you all.

First, you’ll need to install ImageMagick for Windows and make sure that it is in your system path.

Then, create a new batch file in Notepad with a clever name like compressall.bat, and paste in the following lines of code. Note that you can adjust the *.jpg to something else if you want to include PNG files as well.

@echo off
for %%f IN (*.jpg) DO convert -quality 70 "%%f" "%%f"

Save that batch file somewhere in your system path (you could stick it into C:\Windows if you really wanted to, but it would be better to create a scripts folder and add that to your system path). Then all you have to do is navigate to a folder in your command prompt, and run the batch file by typing compressall at the prompt.

But we can make this even better.

We also recently showed you a stupid geek trick where you can run commands in the Windows Explorer address bar, or open a command prompt already keyed to that folder. And now, finally, we have a great use case for that trick.

Once you’ve saved the compressall batch file into the system path, you can use it wherever you want. Just open up any folder of images in Windows Explorer, and then type compressall into the address bar.

image

You’ll see a command prompt window flash up and quickly disappear once it is finished. And all your images will be a smaller file size.

If you wanted to get really fancy, you could modify the batch file to create a backup directory, copy all of the images in there, and then proceed with the compression.  That way you’d have an automatic backup before compressing images.

Again, thanks to reader Lee Thompson for this great tip!

Javascript to handle error / broken images

Big thanks to Prestaul and Ryan O’Hara for the anwers.

This solution to handle error / broken images is working like a charm 🙂

Handle the onError event for the image to reassign its source using JavaScript:

function imgError(image) {
    image.onerror = "";
    image.src = "/images/noimage.gif";
    return true;
}
<img src="image.png" onerror="imgError(this);"/>

Or without a JavaScript function:

<img src="image.png" onError="this.onerror=null;this.src='/images/noimage.gif';" />

The following compatibility table lists the browsers that support the error facility:

http://www.quirksmode.org/dom/events/error.html

I use the direct solution without using javascript, it works well especially on lazy load image

Change Apple ID to update XCODE

Thanks to venkat from stackoverflow, you can see the complete information here

Previously I am looking for many source to update xcode since the iphone device now is running ios 9.1 and I cannot downgrade it. So the option is I need to update the previous xcode (version 6) that only support until ios 8. First it’s lill bit frustrating because I tried many times using different solutions and still not working, but this one is working like a charm. Thank you so much ^^

Step by step to change the Apple Developer ID that Xcode has associated using Mac OS X’s Keychain Access App :

  1. Quit Xcode
  2. Open Finder and navigate to Applications,
  3. Ctrl+Click the application and choose “Show Package Contents” (Xcode in this case),
  4. Expand the Contents directory and click the _MASReceipt directory to select it, Type Command+Delete to delete the directory permanently—you will be prompted for your credentials since this is a protected file.
  5. Quit and restart AppStore, then find the application. You can update with your new id now without deleting the old version of the app

Above solution is working for me, when I am writing this post I am waiting for download finish..

Other solutions by using Mac OS’X Keychain can be found here

Hope this help ^^

Open File .h .m from Notepad++

Today, I want to open .h and .m file extension, those are Objective-C file, formerly can only be opened from xcode. I believe that notepad++ can do this..:D, From this source I got this information (written below), thank you so much for your useful Info, now I can open .h and .m file from notepad++ :happy:

========================================

Notepad++ doesn’t list .h, .m and .mm files as Objective-C files (.mm is Objective-C++) by default for some reason.

You can modify your langs.xml file to tell Notepad++ to associate those extensions with Objective-C. Open the file %AppData%\Notepad++\langs.xml, and scroll down to the following area:

<Language name="objc" ext="" commentLine="//" commentStart="/*" commentEnd="*/">
    <Keywords name="instre1">if else switch case default break goto return for while do continue typedef sizeof NULL self super nil NIL</Keywords>
    <Keywords name="instre2">interface implementation protocol end private protected public class selector encode defs</Keywords>
    <Keywords name="type1">void struct union enum char short int long double float signed unsigned const static extern auto register volatile id Class SEL IMP BOOL</Keywords>
    <Keywords name="type2">oneway in out inout bycopy byref</Keywords>
</Language>

Then add h m mm to the ext attribute:

<Language name="objc" ext="h m mm" commentLine="//" commentStart="/*" commentEnd="*/">
    <Keywords name="instre1">if else switch case default break goto return for while do continue typedef sizeof NULL self super nil NIL</Keywords>
    <Keywords name="instre2">interface implementation protocol end private protected public class selector encode defs</Keywords>
    <Keywords name="type1">void struct union enum char short int long double float signed unsigned const static extern auto register volatile id Class SEL IMP BOOL</Keywords>
    <Keywords name="type2">oneway in out inout bycopy byref</Keywords>
</Language>

Then restart Notepad++.

If editing the langs.xml file in your %AppData%\Notepad++ folder doesn’t work, you’ll have to open the one in %ProgramFiles%\Notepad++ instead. Make sure to back up the original in case you mess up somewhere.

This is some version of windows? If so you right click the file, select Open With, and in the subsequent dialog, you can select or browse for Notepad++ and ensure the checkbox that says something like “always use this program to open these files” (not sure of exact wording and I’m not on a windows box now).