Thursday, 21 January 2016

STL sets example

#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
        int array[] = {9,8,7,9, 6, 5,1,2,3,4,1,2,5};
        //Initialize
        set<int> s(array, array + sizeof(array)/sizeof(array[0]));

        set<int>::iterator it1 = s.end();
        pair<set<int>::iterator, bool> pr;

        vector<int> v(3, 30);

        //Insert
        pr = s.insert(6);
        s.insert(s.end(), 10);
        s.insert(v.begin(), v.end());

        //Delete
        s.erase(s.begin());
        s.erase(s.begin(), ++s.begin());

        //Search
        set<int>::iterator it2 = s.find(7);
        set<int>::iterator it3 = find(s.begin(), s.end(), 7);
        cout<<"Found: "<<*it2<<endl;
        cout<<"Found: "<<*it3<<endl;

        //Traverse
        for(set<int>::iterator it = s.begin(); it != s.end(); it++)
                cout<<*it<<" ";
        cout<<endl;

        //Clear
        s.clear();
}

STL map example

#include <iostream>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
        //Initialize
        map<string, int> m;// = {{"Sundar", 1}, {"Priyanka", 2}};
        m["Sundar"] = 1;
        m["Priyanka"] = 2;
        map<string, int> m2(m);
        map<string, int> m3(m2.begin(), m2.end());

        map<string, int> m4;
        m4["Ambi"] = 10;
        m4["jay"] = 11;

        //Insert
        m.insert(pair<string, int>("Leela", 3));
        m.insert(m.begin(), pair<string, int>("Paramesh", 4));
        m.insert(m.begin(), pair<string, int>("Revanth", 5));
        m.insert(m4.begin(), m4.end());

        //Delete
        m.erase(m.begin());
        m.erase(m.begin(), ++m.begin());

        //Search
        map<string, int>::iterator it1 = m.find("Revanth");
        cout<<"Found: "<<it1->first<<" "<<it1->second<<endl;

        //Traverse
        for(map<string, int>::iterator it = m.begin(); it != m.end(); it++)
                cout<<it->first<<" : "<<it->second<<" ";
        cout<<endl;

        //Clear
        m.clear();
}

STL arrays example

// constructing arrays
#include <iostream>
#include <array>

// default initialization (non-local = static storage):
std::array<int,3> global;               // zero-initialized: {0,0,0}

int main ()
{
  // default initialization (local = automatic storage):
  std::array<int,3> first;              // uninitialized:    {?,?,?}

  // initializer-list initializations:
  std::array<int,3> second = {10,20};   // initialized as:   {10,20,0}
  std::array<int,3> third = {1,2,3};    // initialized as:   {1,2,3}

  // copy initialization:
  std::array<int,3> fourth = third;     // copy:             {1,2,3}

  std::cout << "The contents of fourth are:";
  for (auto x:fourth) std::cout << ' ' << x;
    std::cout << '\n';

  return 0;
}

STL list example

#include <iostream>
#include <list>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
        int array[] = {9,8,7,9, 6, 5,1,2,3,4,1,2,5};

        //Initialize
        list<int> l(array, array + sizeof(array)/sizeof(array[0]));
        list<int> l2;
        l2.assign(array, array + sizeof(array)/sizeof(array[0]));

        list<int>::iterator it = l.end();

        vector<int> v(3,30);

        //Insert
        l.insert(it, 10);
        l.insert(it, 2, 20);
        l.insert(it, v.begin(), v.end());
        l2.push_back(10);

        //Delete
        l.erase(l.begin());
        l2.erase(l2.begin(), l2.begin()++);

        //Search
        list<int>::iterator it1 = find(l.begin(), l.end(), 7);
        cout<<"Found: "<<*it1<<endl;

        //Traverse
        for(list<int>::iterator it = l.begin(); it != l.end(); it++)
                cout<<*it<<" ";
        cout<<endl;
        for(list<int>::iterator it = l2.begin(); it != l2.end(); it++)
                cout<<*it<<" ";
        cout<<endl;

        //Clear
        l.clear();
}

Friday, 11 December 2015

New PC windows 8.1

Get the product key:
http://www.isunshare.com/product-key-finder/find-product-key-for-windows-8-or-8.1.html

Default antivirus for windows 8.1:(Windows Defender)
http://windows.microsoft.com/en-in/windows/using-defender#1TC=windows-7
http://windows.microsoft.com/en-in/windows/turn-windows-defender-on-off#turn-windows-defender-on-off=windows-7
To remove: http://www.sysprobs.com/how-to-remove-windows-defender-on-windows-8-1-windows-8
Install: https://www.avast.com/index
Avast key for 26 years: W3083976R9962A0912-ZZT6LA5J
If the trial version is going to expire: http://peterbestel.com/help/how-to-re-register-avast-free-anti-virus/

User accounts:
http://windows.microsoft.com/en-in/windows/turn-user-account-control-on-off#1TC=windows-7
http://windows.microsoft.com/en-in/windows/create-user-account#create-user-account=windows-7
http://www.softwareok.com/?seite=faq-Windows-8&faq=57

Exporting contacts:
http://answers.microsoft.com/en-us/mobiledevices/wiki/mdlumia-mdtips/how-to-export-contacts-from-windows-phone-to-pc/e6f8292c-8081-45d6-a40d-7ff2337b8a41

Sunday, 4 October 2015

iOs app development xcode6 and swift

Creating tabs:
https://www.youtube.com/watch?v=d1_X0DQdY8o

Dropdown menu:
https://www.youtube.com/watch?v=aj92JFosapk

Creating slider:
https://www.youtube.com/watch?v=jJA9UCbcos0

Sample code fo JSON:
--------------------------
import Foundation

var error: NSError?
//let jsonData: NSData = /* get your json data */
let jsonData = NSData.dataWithContentsOfFile(filepath, options: .DataReadingMappedIfSafe, error: nil)

let jsonDict = NSJSONSerialization.JSONObjectWithData(jsonData, options: nil, error: &error) as NSDictionary

Horizantal scrolling:
------------------------
http://www.raywenderlich.com/4723/how-to-make-an-interface-with-horizontal-tables-like-the-pulse-news-app-part-2
http://devblog.orgsync.com/2013/04/26/creating_scrolling_filmstrip_within_uitableview/
http://www.brianjcoleman.com/tutorial-collection-view-using-swift/
http://www.appcoda.com/uiscrollview-introduction/



Table view:
https://www.youtube.com/watch?v=pR6dR-vVZeY

Custom cell:
http://stackoverflow.com/questions/25999759/custom-table-view-cell-with-swift-in-xcode-6

Adding image to cell:
http://stackoverflow.com/questions/24094644/adding-an-image-into-a-cell

Segue from UIImage to view controller:
http://stackoverflow.com/questions/28647242/segue-ui-image-to-viewcontroller-with-swift

Table view example:
http://www.theappguruz.com/blog/ios-table-view-tutorial-using-swift

Create popover:
https://www.youtube.com/watch?v=j5XFMpXLwZQ

Suggested by Vignesh:
https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/DesigningwithStoryboards.html#//apple_ref/doc/uid/TP40010215-CH43-SW1


http://makeapppie.com/2014/08/04/the-swift-swift-tutorial-why-do-we-need-delegates/#comment-15424
http://stackoverflow.com/questions/12993212/segmented-control-on-top-of-a-table-view-not-in-the-title-view-though


layer.cornerRadius          Number    10
layer.masksToBounds     Boolean    tick

popover:
----------
http://stackoverflow.com/questions/27353691/uipopoverpresentationcontroller-displaying-popover-as-full-screen

Exporting app:
------------------
http://bouk.co/blog/sideload-iphone/
http://www.idownloadblog.com/2015/09/18/how-to-compile-apps-using-xcode-7-to-run-on-a-non-jailbroken-device/