iOS tutorial: How to implement facebook ads counting


* This tutorial guesses you already have the api key to the app ad

1. Download and link the FacebookSDK.framework to your project
2. In the project's build phase, add these frameworks: AdSupport, Social, Accounts
3. Change the above link dependency to "optional" (aka 'weak')
4. In your app delegate, import
5. And again in the app delegate, in the method 'applicationDidBecomeActive' add this api call to facebook: [FBSettings publishInstall:@"YOUR_API_KEY"];

Good luck!

How to copy a file from another computer using SCP (SSH copy)

I needed a file from a friend's computer. I could log in using VNC, but as my friend suggested, I used SCP which is SSH copy.

This is how to copy a file from a remote machine to your local machine using terminal:

scp username@host:/Users/path/to/remoteFile /Users/nur/Desktop/targetFolder

Input the correct user's password and you get a copy of the file to your target folder!

Hopefully this tutorial will save you time copying files from a remote computer to your own computer.

iOS snippet : How to stop all audio html elements played inside a UIWebView when I close it?


I wrote an app with a UIWebView that has audio html5 tags in it. While the audio element is played, closing the webview doesn't stop the audio playback.

So, how do we stop it?

When the webview is supposed to exit, run this code:


NSURLRequest *emptyRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
    [webView loadRequest:emptyRequest];


This code actually loads an empty request, thus killing all the current elements and objects in the current webview.

I hope this little snippet helps you when your html5 audio keeps playing even after you closed the webview.

Android: How to create round corners in layouts

I'm writing an app in which the corners of the layout should be rounded. So how do I make the corners round? It's very easy:

1. Create a new xml file in drawable with this content ("rounded_corners.xml"):



xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:bottom="3px">
        <shape android:shape="rectangle" >
            <solid android:color="#fff" />

            <corners android:radius="7dp" />
        </shape>
    </item>

</layer-list>

2. Set the background of the layout to the xml file we created in step 1

...
android:background="@drawable/rounded_corners"
...


That's it!
Hope it helps you create round corners in your Android app :)

Mac : How to configure $PATH in terminal

Most developers use a terminal in Mac from time to time. Sometimes, the $PATH gets ruined. So this is how to change it permanently in terminal:

1. What is my current $PATH? type "echo $PATH"

2. Adding "newpath" to your $PATH in the current terminal session (will be deleted when you close terminal):
"export PATH=$PATH:/newpath"

3. Setting the $PATH permanently:
3.1 (*change "USER" with your mac username)
"nano ~USER/.bash_profile"
3.2 add paths to the file separated with ":"
"PATH=$PATH:/newpath1:/newpath2:/new/path/3"
3.3 [control]+[x] to exit, [y] to save changes, [enter] to overwrite the file

Hope this helps you configuring your mac os x path with terminal and use all the command line tools you need handy



About Nur

My Photo
Young Software Developer from Tel-Aviv. Business & Design enthusiast.
Loves Coffee & Purplecookie.com