Skip to main content

A simple copying directory function

function recurseCopy($src, $dst, $excludeFileType=array()) {
    $dir = opendir($src);
    mkdir($dst, 0755, true);
    while(false !== ( $file = readdir($dir)) ) {
        if (( $file != '.' ) && ( $file != '..' )) {
            if ( is_dir($src . '/' . $file) ) {
                $this->recurseCopy($src . '/' . $file, $dst . '/' . $file, $excludeFileType);
            }
            else {
                $filePathInfo = pathinfo($file);
                $ext = '';
                if(!empty($filePathInfo['extension'])){
                    $ext = $filePathInfo['extension'];
                }
                if(empty($ext) || !in_array($ext, $excludeFileType)){
                    copy($src . '/' . $file, $dst . '/' . $file);
                }
            }
        }
    }
    closedir($dir);
}

Comments

Popular posts from this blog

Bose TV Speaker vs Sonos Beam

I have been searching a compact soundbar for my living room. The Bose TV Speaker (2020 model) and Sonos Beam (2018 model) are my final contenders.  Size and Build Bose 23.5 w x 2.2 h x 4.1 d. Sonos 25.6 w x 2.6 h x 4.0 d. Height is an important factor here considering lots of TVs have very low bottom clearance. For example, LG OLED is only 1.5 inches. Build quality on both soundbars is solid. I personally like the Bose better because it has metal grills instead of cloth on Sonos. Sound rtings.com's technical review is spot on. I'm not going to have an in-deep review here, but just to point out a few things I found that are important.  The sound profiles are very similar. Sonos has a little bit wider stage and able to fill the room with music better thanks to its extra side speakers. It's also more neutral sounding. Bose has a noticeable clearer dialogue. They both have a dialogue enhance feature, but I find the result is poor. For Bose, it makes the dialogue harsh and hurts

Userful xcodebuild command lines

I setup Jenkins jobs to build iOS project for QA and release. Here are some useful xcodebuild commands that I use. Tested with XCode 9. Create a xcarchive file xcodebuild -project ${APPNAME}.xcodeproj -scheme ${APPSCHEME} -configuration Release clean -archivePath "${WORKSPACE}/${APPNAME}.xcarchive" archive Create an IPA from xcarchive file with exportOptions. xcodebuild -exportArchive -archivePath "${APPNAME}.xcarchive" -exportPath "${WORKSPACE}" -exportOptionsPlist exportOptions.plist -allowProvisioningUpdates If the above command doesn't create an IPA, try putting xcrun in front. To generate an IPA with the correct certificate and provision profile, you must set them correctly in exportOptions.plist. See example below. Create an APP file for simulator xcodebuild -project ${APPNAME}.xcodeproj -scheme ${APPSCHEME} -configuration Debug -sdk iphonesimulator clean build Sample exportOptions.plist <?xml version="1.0" encoding=&

How to resign an IPA with new bundle Id, certificate and entitlements

Create an Entitlements.plist using Xcode Include the following keys values in the plist file.  application-identifier (String) -> 3Q83MXXZGH.com.company.appname get-task-allow (Boolean) -> NO Put the Entitlements.plist in the same folder of the app.ipa file Unpackage the app unzip app.ipa Delete current code signature rm -rf Payload/MyApp.app/_CodeSignature/ Open Payload/MyApp.app/Info.plist in Xcode and update the bundle ID(CFBundleIdentifier) Copy the new .mobileprovision file to Payload/MyApp.app/embedded.mobileprovision Run the codesign command codesign -f -s "iPhone Distribution: Company Certificate" --resource-rules Payload/MyApp.app/ResourceRules.plist --entitlements Entitlements.plist Payload/MyApp.app Repackage the app zip -qr app-resigned.ipa Payload/ Sample Entitlements.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.c