Posts

Support Deeplink in react-native app with react-navigation

Open Kenji App Open Kenji App, User Screen

Adding mailchimp popup in Google Optimize

Image
mailchimp popup Adding mailchimp popup in Google Optimize keywords : google-optimize, mailchimp, popup, js TL;DR A tip to add mailchimp popup in Google Optimize Handle CSS issue when adding mailchimp So… Today I have a task that need to add mailchimp popup on my website as an experiment. Since we use Google Optimize to implement the A/B testing , I need to add the mailchimp script on Google Optimize ( Please read the references below if you don’t know about Google Optimize or Mailchimp ) The script I need to add from mailchimp look like this: < script type = " text/javascript " src = " //downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js " data-dojo-config = " usePlainJson: true, isDebug: false " > </ script > < script type = " text/javascript " > window . dojoRequire ( [ "mojo/signup-forms/Loader" ] , function ( L ) { L . start ( { "baseUr...

How this blog is build

Image
Content Intro 111 Customise Theme Support syntax highlight with highlighjs Customise CSS I write this blog to learn and share The best way to learn is notes and share. So I write this blog to do that; I’ve tried to write blog on medium but found it quite difficult and don’t have what I need: customizable be able to backup support markdown After investigate several blog platforms, I choose blogger: => cusmtomizable: under the hood, it’s just html & css; so I can do whatever I want => be able to backup: I compose & edit my blog post on a markdown editor, than convert it to html & post to blogpost; So I can keep all of my data you can check StackEdit to edit in markdown and publish to blogger => support markdown: I found it’s easier if I use markdown to write blog. It’s have almost every format I need Choosing theme You can go to Theme -> Customise to choose the theme you want I found that simple theme is good enough for me :> Support ...

Level up your log in React-Native with Reactotron

Image
A Log - Many Logs Log is the essential part of programming. If you ever worked with mobile programming or react-native, you will find that log is a the essential for monitor your app. In this post, I just want to a share a little bit trick to log in react-native app :) Console.log is bad!!! React-Native come with the default console.log to be able to see the log messages. You have to turn on Debug JS Remotely and open Inspector in chrome to view the message. This is bad because Debug mode is very slow. If you write a long message, it can crash your app The app continues warning about keeping chrome on foreground Reactotron come to rescue!!! https://github.com/infinitered/reactotron Yes!!! with reactotron, you DON’T NEED to turn-on Debug JS to be able to see log, and the log is also FASTER btw. The example below show how to configure Reactotron with redux for simulator and real device import Reactotron from 'reactotron-react-native'; import { reactotronRedux }...

Enhanced your programming skill with Assert and Unit Test

Enhanced your programming skill with Assert and Unit Test Sources http://www.pgbovine.net/programming-with-asserts.htm http://stackoverflow.com/questions/1375786/whats-the-point-of-nsassert-actually https://www.youtube.com/watch?v=BbPPnxhcdHo Why you need Assert in your program? 1/ What is Assert? + Assert is the way you make sure a condition in your program must be matched. Otherwise, the app will crash. 2/ What is the point of Assertion? + Using assert will guarantee your program always act like your assumption. => For instance, you write a function with a lot of input and in some situation, inputs mus be valid. Let's say input_1 must comes with input_2. In that case, writing if else and return value is not fit, because you have to handle a lot of return value & error => So that, you will use Assert to make sure your function is used properly. This is very important when you working in a team while writing functions for other people to use. O...

iOS Push Notification with HTTP2

Setup iOS APNS with HTTP/2 Overview: There're one issue while sending iOS notification to multiple devices with old method (send by ftp write stream). Let say you send to 100 devices, ftp write work likes this: 1. connect to APNS Server 2. for each device: send notification by using device_token & payload 3. disconnect In step 2, if there're 1 invalid token (there're many reason make a token invalid: expired, wrong cert, wrong format...etc) the connection will be block without status from APNS Server, if you want to check the status, you have to wait at least 0.5s-1s and using ftp-read to read the status. It's mean you have to check status after every ftp-write and re-connect again if there're an invalid token.  So, to send to 100 devices, you need 50 seconds, that's too long. At WWDC 2015, Apple has introduce a  new notification api by using HTTP/2 This api allow you to send notification as a post request or curl and get the result ...

How to handle iOS Push Notification

Image
Handle iOS Push Notification Handle push notification on iOS is quite hard if you don't understand it. In short topic, I on;y want to present how I handle when user tap on push notification when app is in active/background or killed. First, these are few important notes that you need to keep in mind: - APNS have sandbox & prod certificates, don't forget when you run the app in debug mode, you have to use sandbox. - The registration token cannot be shared, sandbox token cannot be use for prod and vice versa. Others tut: - Apple Documents -  APNS with HTTP2 Generate Push Certificate: cert_file="mobisys_prod_apns.cer" key_file="mobisys_prod_apns.p12" openssl x509 -in $cert_file -inform der -out pem_cert.pem openssl pkcs12 -nocerts -in $key_file -out pem_key.pem cat pem_cert.pem pem_key.pem > PushCert.pem Common Mistakes - using wrong certificate (APNS will return error) / wrong passphrase (in script will retunr error) - using in...

FFmpeg Tutorial (1)

FFmpeg is a leading source for encode/decode video, audio and widely use But,... the only problem is ffmpeg nearly don't have enough documents I'm currently working with ffmpeg and live streaming, And I'll note here some experience I meet while working and investigate ffmpeg :) OK, first, this is some useful link: https://www.ffmpeg.org/ http://dranger.com/ffmpeg/ <- some code on this site is depricated, but this still useful to understand how ffmpeg work, how to display movie, and some issues https://github.com/chelyaev/ffmpeg-tutorial/issues/11 <- this is same as dranger but updated sourcecode (still have one problem with stereo planar audio, you will hear noise instead of correct audio, using this to resample: https://github.com/illuusio/ffmpeg-tutorial) And this is some term you should to know  (google it for better result if you don't understand what I explain:D) > streaming + split video file into frames and send to client buffer ...

Mac OS - How to set multi owner for file / dir

Are you using multi profiles on mac ? Are you have a dir and file want to share with these profiles ? (for me, this is dropbox) But when read/write in these files, you usually be asked for password ?  The solution is add more owner to this file (by mouse), but when you need to add more dir, or sub dirs/files => so, using mouse and UI is terrible in this case. +_+! Mac OS have another mod call ACL - Access Control Lists which can help you (for full of docs, please read here:  mac osx acl ) in this post, I just want to show a some simple mod I use: read/write, and how to use it: - this is basic command structure (note as parenthesis) $ chmod +a “<user or group> allow <permission>” - view list of permission $ ls -le to show acl permissions - dirs permission: directory: list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,file_inherit,di...

How to add custom media codec to pjsip

How to add custom media codec to pjsip Hi, in this post, I will show you how to add a custom codec to pjsip 2.2.1 Introduction: http://www.pjsip.org pjsip is a very strong and widely use in voip. you can combine pjsip with kamailio, stund, turn server, freeswitch to build chat application like Skype with many well feature like message, call, conversation.v.v. http://www.opus-codec.org opus is a lightweight media codec with very good quality but also cost minimum bandwidth (you can customize it bitrate yourself) to port opus codec you should choose a codec and follow it config (gsm for example) (This tutorial I read from http://www.piemontewireless.net/ , but now, this link is no longer exist) A little bit you need to know about pjsip build system (make file) pjsip use a set of make files to build, if you familiar with gnumake, it’s very easy to understand pjsip. but if you are not, here are some tips to help you easily maintain pjsip and solved bug when buid notice abou...