Skip to main content

Posts

Showing posts from 2017

How to revoke code from github?

How to revoke code from github? https://stackoverflow.com/questions/6655052/is-there-a-way-to-rollback-my-last-push-to-git Since you are the only user: git reset --hard HEAD@{1} git push -f git reset --hard HEAD@{1} ( basically, go back one commit, force push to the repo, then go back again - remove the last step if you don't care about the commit ) Without doing any changes to your local repo, you can also do something like: git push -f origin <sha_of_previous_commit>:master

Send push motification to iphone and android code

Send push motification to iphone and android code function sendIphoneAdminPush($token,$message) { $streamContext = stream_context_create(); $badge = 0; //$message = "Here is the new deal having 50% discount for business ABC."; //$token = "ghjkghkgkghkghkjghkghkghjkhkghkghjkhkhgjkhgj"; stream_context_set_option($streamContext, 'ssl', 'local_cert', $_SERVER['DOCUMENT_ROOT'].'/nodatapp/pem/pushNew.pem'); $apns = stream_socket_client( //'ssl://gateway.sandbox.push.apple.com:2195', 'ssl://gateway.push.apple.com:2195', $error, $errorString, 60, STREAM_CLIENT_CONNECT, $streamContext); $load = array(   'aps' => array(   'alert' => $message,   'badge' => $badge,   'sound' => 'default',   'data' => array( 'push_type' => "IphonePush" )   )   ); $payloa

If you Face this error in ionic : Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: :mergeArmv7DebugResources FAILED ionic 2

If you Face this error in ionic : Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:         :mergeArmv7DebugResources FAILED ionic 2 run ionic resources and check if any image is curruopted

If location on IOS do not work with geolocation

If location on IOS do not work with geolocation iOS Quirks Since iOS 10 it's mandatory to add a NSLocationWhenInUseUsageDescription entry in the info.plist. NSLocationWhenInUseUsageDescription describes the reason that the app accesses the user's location. When the system prompts the user to allow access, this string is displayed as part of the dialog box. To add this entry you can pass the variable GEOLOCATION_USAGE_DESCRIPTION on plugin install. Example: cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="your usage message" If you don't pass the variable, the plugin will add an empty string as value. To solve your problem, try: Uninstall the plugin: cordova plugin remove cordova-plugin-geolocation Reinstall with: cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION= "my_project would like to use your location" platform/ios/{project}/{project}

angular2-color-picker TypeError: Cannot read property 'substr' of undefined - source-node.js

angular2-color-picker TypeError: Cannot read property 'substr' of undefined - source-node.js if you install npm i --save angular2-color-picker and get node error  TypeError: Cannot read property 'substr' of undefined - source-node.js TypeError : Cannot read property 'substr' of undefined at Function .< anonymous > ( E : \Documents\Year_3\Mobile_Application_Development\mammoth - v2\node_modules\webpack - sources\node_modules\source - map\lib\source - node . js : 95 : 30 ) at Array . forEach ( native ) at BasicSourceMapConsumer . SourceMapConsumer_eachMapping [ as eachMapping ] ( E : \Documents\Year_3\Mobile_Application_Development\mammoth - v2\node_modules\webpack - sources\node_modules\source - map\lib\source - map - consumer . js : 155 : 14 ) at Function . SourceNode_fromStringWithSourceMap [ as fromStringWithSourceMap ] ( E : \Documents\Year_3\Mobile_Application_Development\mammoth - v2\node_mod

Error: ios-deploy was not found. Please download, build and install version 1.9.0 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy' solution this solved the issue sudo npm install -g ios-deploy -unsafe-perm

Error: ios-deploy was not found. Please download, build and install version 1.9.0 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy' solution this solved the issue sudo npm install -g ios-deploy -unsafe-perm

Ionic - Add/Remove phonegap-push-plugin - CocoaPods was not found

Ionic - Add/Remove phonegap-push-plugin - CocoaPods was not found or after You cannot run CocoaPods as root. To install push you must first install cocoapods . Follow these steps on your terminal in the Ionic project directory. First remove what you tried to install ionic plugin remove phonegap-plugin-push Next install cocoapods sudo gem install cocoapods Then you need to sync the cocoapods repo pod setup (run as normal user not as root) This may take a while Finally install push ionic plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX" Then change owenership of folders required  sudo chown -R osx /usr/ etc /etc/etc/etc chmod -R 777   /usr/ etc /etc/etc/etc

Working tutorials on ionic push notification.

Working tutorials on ionic push notification. https://github.com/replysam2009/ionic2-push-notifications ionic start -- v2 myApp blank npm install @ ionic / cloud - angular -- save ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX How to get SENDER_ID: https://medium.com/@ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbd#.2dfwmb64z Go to : https://apps.ionic.io/ Create account give command :  ionic upload See app in account here  :   https://apps.ionic.io/ Upload app Copy app id  in app.module.ts import { NgModule, ErrorHandler } from '@angular/core'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { MyApp } from './app.component'; import { AboutPage } from '../pages/about/about'; import { ContactPage } from '../pages/contact/contact'; import { HomePage } from '../pages/home/hom

Observable after every send return example

Observable after every send return example setData(data: any): Observable<Array<any>> { this.amount = data.amount; this.currency = data.currency; this.description = data.description; this.email = data.email; this.source = data.source; this.customer = data.customer; return Observable.interval(1000).map(i=> [{amount: this.amount},{currency: this.currency},{email:this.email}]); }

How to create directive in angular 2 -- Limit the length of a string using angular 2/ionic 2

How to create directive in angular 2 -- Limit the length of a string using angular 2/ionic 2 In angular2 it will look like: import {Directive, Input} from '@angular/core'; @Directive({   selector: '[limit-to]',   host: {     '(keypress)': '_onKeypress($event)',   } }) export class LimitToDirective {   @Input('limit-to') limitTo;    _onKeypress(e) {      const limit = +this.limitTo;      if (e.target.value.length === limit) e.preventDefault();   } } Don't forget to register directive in NgModule sth like: @NgModule({   imports: [ BrowserModule ],   declarations: [ App, LimitToDirective ],  //keep this in declaration only   bootstrap: [ App ] }) export class AppModule {} And then use it like: <input limit-to="4" type="number" placeholder="enter first 4 digits: 09XX"> https://plnkr.co/edit/sgMubU0p8Z5BPzAIKsf4?p=preview Conf

Application error the connection to the server was unsuccessful ionic 2

Application error the connection to the server was unsuccessful ionic 2 Resolved In my index.html I removed the link '<script src = "http://maps.googleapis.com/maps/api/js?sensor=false"> </ script>' and in my config.xml file I added ' < preference name = "loadUrlTimeoutValue" value = "700000" /> ' Thank you for trying to help

ionic build android error gradle error

If faced error while building ionic build android then got to this path on mac and delete everything /var/root/.gradle/wrapper/dists/gradle-2.14.1-all/ /var/root/.gradle/wrapper/dists/gradle-2.14.1-all/ nzipping  /var/root/.gradle/wrapper/dists/gradle-2.14.1-all/53l0mv9mggp9q5m2ip574m21oh/gradle-2.14.1-all.zip  to  /var/root/.gradle/wrapper/dists/gradle-2.14.1-all/53l0mv9mggp9q5m2ip574m21oh Exception in thread "main"  java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78) at org.gradle.wrapper.Install.createDist(Install.java:47) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) Caused by: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile

Inside conference app ionic To navigate between pages class type in .ts file in ionic 2 where class type in export

Inside conference app ionic To navigate between pages class type in .ts file in ionic 2 where class type in export Use Nav import { Events, MenuController, Nav, Platform } from 'ionic-angular'; right in start of declaration of class export class ConferenceApp {   // the root nav is a child of the root app component   // @ViewChild(Nav) gets a reference to the app's root nav   @ViewChild(Nav) nav: Nav;

create modal in ionic 2 angular 2 from parent page and receive data

create modal in ionic 2 angular 2 from parent page signIn() {     let data = { 'foo': 'bar' };     let modal = this.modalCtrl.create(LoginPage);     modal.present();     modal.onDidDismiss( (data : any) => {      //console.log(data.loggedin);      this.navCtrl.push(TabsPage);    });    //modal.onDidDismiss(() => {       //console.log("abcdef");     //});   } inside modal page setTimeout(() => {           //this.navCtrl.pop();           // Close modal           let data = { 'loggedin': 'yes' };           this.viewCtrl.dismiss(data);       }, 500);