Git add not working for folder with .git folder

Also you might get something like
fatal: Pathspec ‘some.file.name.goes.here’ is in submodule ‘some/folder/name’
Also you might notice, if you commit and pushed, only some skeleton of the of the folder structure without the actual files would be committed.

The root of the problem is the folder you are trying to add is tracked under git itself.
This would confuse git and would rather leave it up to you.

the fix
First go ahead and remove the .git folder in the new directory

sudo rm -rf /path/to/new/folder/.git

Then clear the cache from git memory of the new folder

git rm -r --cache /path/to/new/folder

Then when you do the

git status

you will see all the new files being listed and you can commit that.

graphs

Mac Numbers document to Excel

Starting to play with the mac numbers app that comes with my mac, and after doing my spreadsheet, pretty much the same as excel so far, i want to share it and the standard being xls file, I figured how to do that.

Go to file menu on the number application and select the export to => Excel. export-to-excel

The rest is history after that.. I like how neat the number app is so far, I will try to see how it is flexing its muscles over the giant excel as I have a lot to do on that..

By the way, I have been a great fan of apaches open office just check it out.

 

a door having a knock knob

Who is calling php script browser or cron

Identifying who calls php script

Php script can called from different places or clients. Do you Want to know which client, browser or command line, is calling your php script?
Wanted to handle differently when the script is called from command line
Then use php_sapi_name

Yeah, this sapi thing – Server API is a bit bad boy. You might want to check a manual value comparison before deploying it your server as the sapi return type might be different for different settings say b/n command line script and webserver.

Also having additional check with $_SERVER and $_ENV variables is also a good one for better guarantee. Like some parameters of the $_SERVER would only be set when called from web server like ‘REQUEST_METHOD’

if (!empty($_SERVER['REQUEST_METHOD'])) {
    echo "hey baby web server, calling you from browser X - wssup";
} else {
    echo "umm.. are you cron? manual? who the heck???";
}

Also using the sapi name

$sapi_id = php_sapi_name();
if (stristr($sapi_id, 'cli')) {
    echo "hello command line interface";
}

Since the above would be a bit more conditional it would be advised if used along with existence of like $_SERVER[‘REQEST_METHOD’]

Using the above snippet, you can tell from which the php script is called from and you can say hello to browser or cron.

a truck loading another truck

Check if curl is loaded as module in php

Here are a couple of things to check if cURL is loaded as module or not

1. You can check by using phpinfo();
Just create a single php file and name it as phpinfo.php file and in it add

phpinfo();

Then call the page on your browser and when it loads do the control plus F and search for curl module there. If you can find it, then it means it is loaded.

2. Create a page and name it as test_curl.php and inside that file, add the following code.

if ( in_array('curl', get_loaded_extensions()) ){
echo "Curl is loaded";
} else {
echo "No, I can't find curl";
}

Either of the above two methods would tell you if you have curl to be used as extension or not

Screen Shot 2016-03-29 at 4.59.26 AM

Get your filezilla password from your mac

Yeah, FileZilla, the major FTP software would put the passwords along with your username,  host  and other info in your computer directory.

So if you lost your FTP credentials and you have been using FileZilla, you can simply retrieve or assist you remember it.

Just go ahead and open options menu from FileZilla, on Mac computer, you can get this by clicking on the FileZilla menu, and look for settings directory and there you would get xml files containing your credentials.

You can grab and use it. In the meantime, if your computer is accessed by others, also know that they can access your FTP information from there.

Screen Shot 2016-03-29 at 4.59.26 AM

Adding an app to Launchpad in Mac

Hey, did you end up having an app that won’t be added to the launchpad, aka applications on mac?

The example could be Filezilla. When you download and try to launch it by double clicking it will start but you might not get it on the applications folder and you won’t see it in the lauchpad.

The fix? it is way easier that you think. Just copy the app you want to be added, say the Filezilla, and just paste it in the Applications folder. You can access the applications folder by directly going to Finder.

Enjoy!

git file

Git diff with filemode changes

When you do a

git diff

And you see a lot of files you haven’t changed you would say ‘what is going on’?? and bang your head with brick wall – well don’t do that please :)

Mostly it might have something todo with the file changes taking place. Especially if you have moved your folder or something like that, it would be the problem.

Here is the good news, you can tell git not to worry about the file mode changes through

git config core.fileMode false

This should take care of the problem you are having.

That would take care of git showing all the files being changed to their normal state.

facebook social marketing

Hooking Facebook App to Existing FB Business Manager

Working on Facebook marketing reporting which require setting up a Facebook App and hooking it to existing Business manager and it looks there is no direct instruction that I found so here you go…

First thing first, you would need a developer account from https://developers.facebook.com/ – go and get it, it is free.

Then Go ahead and create a Facebook App there – a minimum you need is a facebook page and thats it.
Then from the dashboard you will get the app_id and secret. This is very important for you to keep it as secret as well. From this, you will get yet another important key called Access Token.

Now you have a Facebook App that you will use it to acquire a lot of information for the business manager you have. You can get lots of User related data, analytics, sales, spending and more..

Now head to https://business.facebook.com/ and select your business manager if you have more than one.
On the left of the menu, you will see Claim Assets and from there select App
You will be asked to insert App Id and it will be a matter of following the instruction after that.
Now you have integrated your app to the existing business manager. Which means, your app now has an access to the data under your business manager through different APIs.

EnJoy

composer shadow image

Composer could not be installed b/c of php.ini setting

trying to install composer on your server and got something like
Some settings on your machine make Composer unable to work properly.

Make sure that you fix the issues listed below and run this script again:
And specifically for suhosin.executor.include.whitelist = phar?

Then the fix is to modify php.ini on the fly while you are passing the installer

sudo curl -sS https://getcomposer.org/installer | php -d suhosin.executor.include.whitelist=phar

That should take care of modifying the php.ini on the fly without you updating the config and re-bouncing the server.