Illegal Configuration: Safe Area Layout Guide before ios 9.0

Note to self, refer here next time: link

Reklamlar

Yorum bırakın

Filed under iOS, iOS App Development, Uncategorized, Xcode

How to get file(s) from specific folder from another branch with git?

Git’s checkout will be more than satisfactory in this case. For instance:

git checkout nameOfTargetBranchpath/of_files/.

git commit -m “getting path/of_files/. directory from nameOfTargetBranch branch”

Yorum bırakın

Filed under git, Uncategorized

how to revert git merges

As one might expect there are two types of merges. The ones that had been pushed and the ones that hadn’t yet.

This is what you do if you haven’t pushed it yet:

Timurs-MacBook-Pro:Halkbank__iOS timuraykutyildirim$ git reset --hard commit_hash
HEAD is now at commit_hash commit_message

Timurs-MacBook-Pro:Halkbank__iOS timuraykutyildirim$ git pull
Already up-to-date

 

And this is what you do when you pushed it:

git revert -m 1 commit_hash

 

Sources:

[1]: https://stackoverflow.com/a/2389555/1450201

[2]: https://stackoverflow.com/a/6217372/1450201

Yorum bırakın

Filed under git, Source Control

Outlets vs Referencing Outlets

The term referencing outlet means an outlet in another object that references, or points to, the current object.

As an example, say you have a nib that has a File’s Owner and a UITableView in it, among other things. In order for a tableview to work it has a datasource and delegate, which are outlets and can be connected in IB. From the standpoint of the tableview the datasource and delegate are outlets. From the standpoint of the File’s Owner the datasource and delegate in the tableview are referencing outlets.

Ref 1 : https://stackoverflow.com/a/5786061/1450201

Yorum bırakın

Filed under iOS App Development, Uncategorized

Xcode Error : The maximum number of apps for free development profiles has been reached.

I just came across with this silly error. I think error message itself is self-explanatory enough so i’ll just write down how to fix this;

Just delete some apps you developed from your device. Yep, it’s that simple.

Yorum bırakın

Filed under Xcode

How to reinstall Cocoapods?

Dealing with cocoapods can be tricky time to time. And if you ever found yourself in need of reintalling it, just follow these steps:

  1. sudo gem uninstall cocoapods
  2. sudo rm -fr ~/.cocoapods/repos/master
  3. sudo gem install cocoapods
  4. pod setup

Btw, if you ever have something like this in 3rd step;

  ~ sudo gem install cocoapods

Password:

ERROR:  While executing gem … (Errno::EPERM)

    Operation not permitted – /usr/bin/pod

Just follow these instructions:

  ~ mkdir -p $HOME/Software/ruby

  ~ export GEM_HOME=$HOME/Software/ruby    

  ~ gem install cocoapods

Fetching: cocoapods-1.2.0.gem (100%)

Successfully installed cocoapods-1.2.0

Parsing documentation for cocoapods-1.2.0

Installing ri documentation for cocoapods-1.2.0

1 gem installed

  ~ export PATH=$PATH:$HOME/Software/ruby/bin

  ~ pod –version

1.2.0

And if it’s not working properly, just do this;

sudo gem install -n /usr/local/bin cocoapods

Yorum bırakın

Filed under Mac OS X

How to change Bundle ID and/or Package Name in Ionic?

Every mobile developer is gonna need to change this at some point wheter they port their Ionic project to iOS or Android or any other platform that ionic supports. And in my case it was because i needed to configure it so that i can send push notification in Android.(For iOS, i changed the bundle id from Xcode. I know it’s not the right way but in my defense; it was a friday night and i was still in office at 11pm and i was working on a demo project. Not something real) And this is how I did it:

Go to config.xml file in your project’s root and find something very similar to the following line:

 <widget id="com.ionicframework.exampleproject223738" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 

You need to change that reverse domain thing as you desire then reinstall all your plugins by;

ionic state reset — plugins;

Also when you rebuild your project, ionic might say it has missing platform but don’t worry. It adds it automatically back to your project.

Yorum bırakın

Filed under Uncategorized

Project Euler – 07

This is the problem:

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

What is the 10 001st prime number?

And this is how you solve it:

#include <cstdlib>
#include "iostream"

using namespace std;
bool isPrime (int x);

int main(int argc, char** argv) {
    
    int x=1; // index of prime number
    int r; // result
    int c; // counter
    
    // i excluded 2 from prime number squences so i'm looking for 10000th prime now
    for(c=3; ; c+=2){
        if(isPrime(c) && x<=10000) {
            x+=1;
            cout<< "index: " << x << " number: " << c << endl;
        }
            
    }
    
    return (0);
}

bool isPrime (int x) {
    bool res;
    if( x%2 != 0 ){
        for(int i=3; i<x; i++){
            if(x%i==0){
                res = false;
                break;
            }
            else
                res = true;
        }
    } else {
        res = false;
    }
    
    return res;
}

Yorum bırakın

Filed under Project Euler

Project Euler – 06

Here’s the problem:

The sum of the squares of the first ten natural numbers is,

12 + 22 + … + 102 = 385

The square of the sum of the first ten natural numbers is,

(1 + 2 + … + 10)2 = 552 = 3025

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

Here’s the code:

#include <cstdlib>
#include "iostream"

using namespace std;

int main(int argc, char** argv) {
    int sumOfSquares = 0;
    int sums = 0;
    
    for(int i=1; i<=100; i++){
        sumOfSquares += i*i;
        sums += i;
    }
    
    cout << "Sums: " << sums << endl;
    cout << "Square of sums: " << sums*sums << endl;
    cout << "Sum of squares: " << sumOfSquares << endl;
    cout << "result: " << ((sums*sums)-sumOfSquares) << endl;
    
    return 0;
}

Yorum bırakın

Filed under Project Euler

Project Euler – 05

Here’s the question:

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

And here’s the code: (I know it’s really not my the most elegant work but it get’s the job done)

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    int res = 2520;
    int list[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
    do
    {
        if (res % list[0] == 0 && res % list[1] == 0 && res % list[2] == 0 && res % list[3] == 0 && res % list[4] == 0 && res % list[5] == 0 && res % list[6] == 0 && res % list[7] == 0 && res % list[8] == 0 && res % list[9] == 0 && res % list[10] == 0 && res % list[11] == 0 && res % list[12] == 0 && res % list[13] == 0 && res % list[14] == 0 && res % list[15] == 0 && res % list[16] == 0 && res % list[17] == 0 && res % list[18] == 0 && res % list[19] == 0)
        {
            cout << "LCM = " << res << endl;
            break;
        }
        else
            ++res;    
    } while (true);
    
    return 0;
}

Yorum bırakın

Filed under Project Euler