Skip to main content

Posts

iOS 13 presentViewController has updated transition way

Very surprised that my weather widget app is not updated it content automatically after a view has appeared. First, I called self presentViewController to present a view, after closing that view, I hope that my below view will call  -( void )viewWillAppear:( BOOL )animated{ but nothing happens. I started figuring out that on iOS 13, the view which is presented is displaying like a floating window, not fullscreen, like below. This is new in iOS 13. Quite cool, you can swipe the screen down, without pressing a close button. in order to get the below view called, you need to use Delegate BIG CHANGE~

MySQL is running out of memory in DigitalOcean

Hey, after update from MySQL 5.5 to 5.6, my life is getting worse. There are many 'Database connection error' when I try to open my website. And I even can not access to phpMyAdmin. What's happening. OK, I turn on the SSH, connect to my server and BOOM, mysql is having 'Out of Memory' error, and everything crash. That time, I need to restart mySQL: $> sudo service mysql start Next, I need to find out how much memory is being used, because Digital Ocean does not support this feature. $>  sudo apt-get install htop $> htop Now there is my memory usage: Wow, mysqld service is consuming 48.9% memory, what!!! There are 2 things I can do: Upgrade RAM (means upgrade Dropplet) or continue to check for another solution, my VPS is 1GB RAM. Next, I check the log of mysql at /var/log/mysql:  There are alot of errors: There are some problems that we can find out: + InnoDB can not allocate memory  + InnoDB memory heap is disabled ...

Install Ruby on Rails on MAC

Hello, I am quite familliar with Apache's friend products like XAMPP, LAMPP... And this is the first time I try Ruby on Rails(RoR). I'm quite stuck on installing it. As a normal PHP guy, I first try install Rails, following this tutorial: http://installrails.com/ And the next thing I want to learn about is how RoR works with MySQL, PhpMyadmin. So I tried to make it connect to XAMPP's MySQL but it did not work at all. I found out that, using mySQL in XAMPP package is not a common method, what I should do is to install MySQL as a single service onto my MAC. So I did following: 1. Install MYSQL with HomeBrew Did you install HomeBrew, if not, please follow:  https://coolestguidesontheplanet.com/installing-homebrew-on-os-x-el-capitan-10-11-package-manager-for-unix-apps/ Next, type this command to install MySQL to your machine: $ brew install mysql This will install mysql to your computer, if the installation is success, you could try start using mySQL with this c...

Kí sự Béc-tơ - Vòng quay hoàn hảo

Năm 20xx, một sự kiện vô cùng trọng đại đã diễn ra trên đất nước chúng tôi. Tại đại hội liên đoàn lao động thế giới ĐuA, chúng tôi được vinh dự xếp vào hàng những quốc gia phát triển nhất thế giới. Toà báo yêu cầu tôi đi phỏng vấn vị đại diện liên hợp các doanh nghiệp thần tốc trong nước, ông mới từ hội nghị ĐuA trở về. Tên ông là Rôn-ni-bin. Ngài Rônnibin rất thẳng thắn trong mọi câu trả lời của ngài. Nhiều câu nói của ngài khiến cho bản thân tôi cực kì ngưỡng mộ, đơn cử có một đoạn như sau: "Thưa ngài Rôn, theo ngài thì yếu tố quan trọng nhất để trở thành một người thành công trong bất cứ lĩnh vực nào, đó là gì?" Ngài trả lời: " Theo chúng tôi đó là tính cách độc lập suy nghĩ và không chờ để người khác sai khiến. Chúng tôi đã nghiên cứu CV của rất nhiều bạn sinh viên. Và chúng tôi luôn đánh giá cao những ai như vậy. Đối với 1 người luôn chủ động thì hẳn anh ta sẽ không để thừa 1 phút 1 giây nào trong cuộc sống để hoang phí, và luôn tìm cách để đạt được mục...

7 Lợi ích của việc học nhóm

1. Giải pháp cho tính cao su Hầu hết các nhóm đều có quy ước về thời gian và địa điểm họp mặt hay làm việc từ trước và các thành viên tham gia đều đồng ý chấp hành khi tham gia nhóm. Nên nếu bạn là một thành viên trong nhóm, ít nhiều bạn sẽ cảm thấy xấu hổ khi lỡ một buổi họp nhóm như vậy. Nói về việc học một mình, thường thì bạn sẽ có xu hướng thế nào? Rất nhiều sinh viên không giữ được thói quen học đều đặn thường xuyên mà hay trì hoãn việc ôn bài cho tới buổi tối trước hôm đi thi. Vậy nên, nếu bạn là một người hay thích trì hoãn và cao su thì nên học theo nhóm, đấy là một giải pháp tốt. 2. Học nhanh hơn Khi làm bài tập cùng nhau, các sinh viên trong nhóm học thường sẽ học nhanh hơn là các sinh viên làm bài tập một mình. Ví dụ, đối với bạn thì thỉnh thoảng bạn sẽ thấy sẽ có vài phần của giáo trình rất khó hiểu, bạn còn tưởng nó hầu như là chẳng liên quan gì đến cái môn học của bạn nữa. Thế nhưng lại có nhưng sinh viên nắm rất rõ những phần như vậy và hiểu tại sao phần đó buộc...

How to use composer with PHP, Yii framework

  Introduction: Some PHP components is installed using composer, like every other dependency framework. You can reference the page:   https://packagist.org/  . This page contains a lot of useful PHP repositories, libraries. The benefits of using composer are: When we create a library which depends on another libraries(of other developer), we of course do not want to copy all these libraries into our project(do not do that, they are not yours). We might want our project(library) to be condense, simple to use and always up-to-date. --> Therefore, we will create a file, which presents that our library is depending on some other guys... Our library users might want a small command to download everything they need, including our library. One command and everything is setup. User want the latest version of our library If you are a developer, how to install libaries using composer? First, lets imagine that your project need some external libraries(this is ...

Dịch cuốn Founders At Work - phần mở đầu

Foreword   Vận động viên chạy nước rút chắc chắn phải phải trải qua giai đoạn chạy cấp tốc nhất và giai đoạn chậm lại một chút cho phần còn lại của cuộc đua. Những người thắng cuộc là những người thường chậm lại ít nhất. Đó là cách mà hầu hết các startup làm. Những giai đoạn sớm nhất là những giai đoạn mà productive(năng suất) nhất. Đó là khi mà họ có những ý tưởng thực sự lớn. Thử tưởng tượng xem Apple trong như thế nào khi mà 100% nhân công của họ chỉ là Steve Jobs và Steve Wozniak.   Điều đáng chú ý về pha này đó là nó hoàn toàn khác hẳn với hầu hết các ý tưởng của mọi người về việc một doanh nghiệp sẽ trông như thế nào. Nếu mà bạn nhòm vào đầu mấy ông đang tưởng tượng xem business nó thế nào thì đa số là bạn sẽ thấy hình ảnh mọi người mặc áo vét, ngồi thành bàn tròn mặt trông rất căng thẳng, dùng Powerpoint, và họ mang những bản báo cáo dầy cộp cho người khác đọc. Giai đoạn sớm của các startups lại hoàn toàn ngược lại, mà hơn nữa lại còn là bộ phận productive nhất tron...

Setup splunk for virtual machine using Vagrant and Ansible

Splunk is a great tool for collecting and indexing data in any kind(log files, changes, tickets, scripts…) from any sources (sensors, networks, databases, smartphones,..( Then creating index for data which then support us to analyse data or search data in the way we like it. We want to try installing Splunk on Virtual environment in order to test, try, study… And with Vagrant&Ansible we can easily save our virtual machine configuration for next time use(in case my virtual machine was broken). There is already Splunkbox by Phips on githubs for simply installing:  https://github.com/phips/splunkbox 1.Download and install Virtual Box (You need a Virtual machine provider for Vagrant(Virtualbox is prefered)) https://www.virtualbox.org/wiki/Downloads 2. Download and install Vagrant   http://www.vagrantup.com/downloads 3. Download and install Ansible   http://docs.ansible.com/intro_installation.html   For MAC:  https://devopsu.co...

Server-side HTML vs. JS Widgets vs. Single-Page Web Apps

When I was deciding which architecture could fit our start up service, I found that API-centric architecture is very efficient. However, it has disadvantages as well, so, finally I can find what should I depend on to choose. Here is the content of pamela fox's blog  At the recent  GOTO Chicago conference , I gave a talk on  "Frontend Architectures: from the prehistoric to the Post-modern."  In just my first 10 months at Coursera, I've experienced the joys and woes of many different frontend architectures, and I wanted to share what I learnt. I detail everything in  the slides , but I'll summarize my thoughts here as well. How do you pick an architecture? We could make our decision by just checking Twitter and seeing what all the cool kids are talking about, but uh, let's pretend that we're more scientific about it than that, and figure out whats important to us as web developers. To start off with, here are a few things that users care a ...

Install MySQL for python on Mac OS 10.9 with XAMPP

Assume that you already have Python installed. 1. Install XAMPP for MAC http://sourceforge.net/projects/xampp/files/ As it is a dmg file, it should be easy to be installed. 2. Now you need to install MySQLdb package for Python a. Download the lastest module of MySQLdb here : http://sourceforge.net/projects/mysql-python/files/latest/download b. Extract it to your prefered location. Notice: You might need to change site.cfg according to your mysql_config path. See the next step c. Setup your path Because you need to setup /bin and /lib folder of XAMPP's MySQL. So, let prepare your $PATH variable. > Edit your ~/.bash_profile ( or ~/.profile) by adding the following lines:  export DYLD_LIBRARY_PATH=/Applications/XAMPP/xamppfiles/lib export PATH=/Applications/XAMPP/xamppfiles/bin/:$PATH Notice: if you are not using XAMPP, you should edit above PATH by your mysql equivalent path. for example /usr/local/mysql/lib and /usr/local/mysql/bin Notice: About site.cfg(in y...

Simple understand about Android ninepatch

This is the well formed tutorial about Android ninepatch, noted from "http://radleymarx.com/blog/simple-guide-to-9-patch/"  asically, 9-patch uses png transparency to do an advanced form of  9-slice  or  scale9 . The guides are straight, 1-pixel black lines drawn on the edge of your image that define the scaling and fill of your image. By naming your image file  name.9.png , Android will recognize the  9.png format and use the black guides to scale and fill your bitmaps. Here’s a basic guide map: As you can see, you have guides on each side of your image. The TOP and LEFT guides are for scaling your image (i.e. 9-slice), while the RIGHT and BOTTOM guides define the fill area. The black guide lines are cut-off/removed from your image – they won’t show in the app.  Guides must only be one pixel wide, so if you want a 48×48 button, your png will actually be 50×50. Anything thicker than one pixel will remain part of your image. (My exam...