Skip to main content

Posts

Showing posts from July, 2018

XAMPP suck

<VirtualHost *:8080>    ServerAdmin ahihi@gmail.com    DocumentRoot "C:\Server\www\Org\APIOrg\public"    ServerName organi.uat.test.co    ErrorLog "logs/or.dev-error.log"    CustomLog "logs/or.dev-access.log" common </VirtualHost> <Directory "C:\Server\www\Org\APIOrg\public">         Options Indexes FollowSymLinks MultiViews         AllowOverride all         Order Deny,Allow         Allow from all         Require all granted </Directory> <VirtualHost *:8080> #   ServerAdmin ahihi@gmail.com    DocumentRoot "C:\Server\www\Org\SVN\Adminphase2"    ServerName admin.organi.uat.test.co #   ErrorLog "logs/or.dev-error.log" #   CustomLog "logs/or.dev-access.log" common    <Directory "C:\Server\www\Org\SVN\Adminphase2">         Options Indexes FollowSymLinks MultiViews         AllowOverride all         Order Deny,Allow         Allow from all         Requir

Yith Woocommerce Subscription - Cancel the subscription billing in Stripe when customer doesn't finish/fail to pay the first payment

https://docs.yithemes.com/yith-woocommerce-subscription/premium-settings/suspension/ There are many defect card to test each response status. One of these is declined (before we get to thank you page). 4000000000009995 Charge is declined with a card_declined code. The decline_code attribute is insufficient_funds. If you have time, try these status, it may be useful and reduce confuse each time you touch these test. https://stripe.com/docs/testing Use Simply Show Hooks for faster find hook (than grep ?). It shine when we have to narrow down search scope (ie. error page).

Some Java, J2ME Class, functions

Complex String usage. https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#field_summary String public String(char[] value,       int offset,       int count) Allocates a new String that contains characters from a subarray of the character array argument. The offset argument is the index of the first character of the subarray and the count argument specifies the length of the subarray. The contents of the subarray are copied; subsequent modification of the character array does not affect the newly created string. Parameters: value - Array that is the source of characters offset - The initial offset count - The length Throws: IndexOutOfBoundsException - If the offset and count arguments index characters outside the bounds of the value array "java is always pass-by-value"  https://softwareengineering.stackexchange.com/questions/286008/parameters-are-passed-by-value-but-editing-them-will-edit-the-actual-object-li/286013 The statement that "ja

Simple Bash program to list function by its length

Sometime it is useful to list function order by its length for example when refactoring. Write a simple program count this. It may be depend on Languages. Currently the manual way is to list function and its line number then calculate. $ grep -rn "public" MainGameScreen.java  |grep "(" 9:  public Random rnd = new Random(); 108:  public MainGameHelper gameHelper = new MainGameHelper(); // new MainGameHelper(this.readMedia) 110:  public void init_game(GameConfig paramGameCnf, int paramInt) 320:  public int turn_calc(int paramInt1, int paramInt2) 332:  public void graphic_helper(Graphics paramGraphics, int paramInt1, int paramInt2, int paramInt3, int paramInt4) 358:  public void left_right(boolean paramBoolean) 365:  public void init_game2() 404:  public int shift_byte_6(int paramInt1, int paramInt2, int paramInt3) 409:  public void init_600() grep "(" added to avoid properties declare: public int a; for example.

Guru jobs

Nothing about work and literature is fun or exiting. We human tend to play around, resting or do some exercise ... So programming is not fun, read book or fucking manual document is not fun. But we have paid by do these not fun stuff.    Here are some job requirement in Guru.com: [update here] ... I will update some job that I have read about. Often it is about configuration new server, some software, application that specific for business logic. For example, config DNS domain, debug some server, DevOps server. There are also some job about develop app. I see that job on Guru or Freelancer often require developer have a wide range of knowledge about many thing. With solo developer (or freelancer) I think it is true. I do not know about a group that have full stack team, but with me and many freelancer (solo), we have to become a full stack in order to get job done.    One of the main reason  that I keep receive Guru or try find some job in Freelancer event I do not bid for it, is

SVG Image Edit as XML text file

I have simple SVG image, open in Text Editor will look like this: <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  --> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="54 10 164 32" style="enable-background:new 54 10 164 32;" xml:space="preserve"> <style type="text/css"> .st0{fill:#242582;} </style> <title>top-result-label-background</title> <path class="st0" d="M217.9,11.4c-0.3-0.9-1.1-1.4-2-1.4H56.2c-0.9,0-1.7,0.6-2,1.4c-0.3,0.9-0.1,1.8,0.6,2.5 C75.5,31.8,105.1,42,136,42s60.5-10.2,81.2-28.1C217.9,13.3,218.2,12.3,217.9,11.4z"/> </svg> You can see that you can simple change the color fill for different color o

Wordpress Coding Standard

https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards http://cs.sensiolabs.org/ php-cs-fixer has dry-run mode. https://gist.github.com/andrei0807/a0e7e4f22d6f3d42c88d489a7d303771  ( :-) https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm#PHPCodeSnifferinPhpStorm-1.EnablePHPCodeSnifferintegrationinPhpStorm Default (?) Storm has build in Wordpress standard and it seem work well. I have tried format code from Code menu for a folder and its result is as expected. We have to install PHPCodeSniff ? (May be for automatic hinting, suggest ?). See link above for install on Windows Xampp. http://web-techno.net/code-quality-check-tools-php/#phpcs-php-codesniffer https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer-tool.html Fucking Windows .bat (I miss this point to phpcs, so it not work, it should be ...phpcs.bat) ENV path should be separate like this (not only one record): http://www.bravo-kernel.com/2017/03/installing-p

Using Lua in LibGDX

You can use scripting languages such as lua for many things. For example, you can define the behavior of players, AI, common variables, and much of the logic in scripts. You can easily build a console into your game and edit scripts and pass commands via that console on runtime, rather than reloading the game. I personally use Lua to do event-handling (eg "if player is in pos XYZ, then do this and that and fire event T from nextEvent.lua"). I use the built in text file format included in the gdx-ai module to define the behaviors of the nations in my game, and I have created my own localisation format so as to support multiple languages and easily modify item descriptions. I use XML to handle my GUI. In short you can do a great many things by scripting as well as using a data-oriented format. Source:  https://stackoverflow.com/questions/27307185/scripting-with-lua-in-libgdx

Fix S7 lagging (temporary stall).

Finding, downloading and try re flashing Droid ROM could be a tedious task. S7 backup Flash Root ? What Root benefit ? Fast way ? Yes Backup: Data: almost media: video, photos. Application data: Authentication: Username, password App data: very little. Gmail: Evernote: backup (online) Google Photos Google Contact: Done Skype: Button Savior Juice Defender Hacker keyboard Juice SSH Zalo Play Console Facebook (Pre-installed?) Instagram Blogger Sound-cloud Slack Rotation control Messenger ImageMeter Flickr tumblr Hiper Calc Pomodoro Timer Home Workout Pinterest EasyDowloader (option) Google Pinyin (optional) Twitter Han Viet (Dict) Teamviewer SMS history ? Call log ? VLC Specification: Micro SD 32G => can be use as backup storage. Download rom, flash, tools. S7 G930T build NRD90M G930TUVS4BQL2 Serial Number R28H51S3K4F Rescue plan. https://www.sammobile.com/firmwares/galaxy-s7/SM-G930T/ Account sammb: ZIZOU** mtischer**/AH*******

WC custom guest checkout create account

https://usersinsights.com/woocommerce-auto-register-users/ https://usersinsights.com/woocommerce-custom-fields-registration/ https://businessbloomer.com/woocommerce-visual-hook-guide-checkout-page/ https://wordpress.stackexchange.com/questions/85485/hooks-are-not-executing https://stackoverflow.com/questions/27112461/woocommerce-send-custom-email-on-custom-order-status-change https://cloudredux.com/adding-sending-custom-woocommerce-email/ https://www.wpdesk.net/blog/woocommerce-checkout-hooks/ The problem with the logic flow Manual create customer then add order/sub to this new account is that: 1. Customer in Stripe side (in case use Stripe) does not synced to WC. So next time user login and buy subs product => Stripe create new acc. 2. add_action( 'woocommerce_before_checkout_process', 'wpse_woocommerce_checkout_process' ); function wpse_woocommerce_checkout_process() { // Do something... } //woocommerce_checkout_update_user_meta //woocommerce_c

NGINX 502 caused by max_buffer_size

Error log: 2018/07/12 08:49:42 [error] 20495#20495: *153 upstream sent too big header while reading response header from upstream, client: 113.178.33.148, server: yoursite.com, request: "POST /core/aha.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "timesheet.powergatevn.com", referrer: "http://yoursite.com/core/kkk.php" https://www.digitalocean.com/community/tutorials/understanding-the-nginx-configuration-file-structure-and-configuration-contexts https://www.scalescale.com/tips/nginx/502-bad-gateway-error-using-nginx/ http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffer_size https://stackoverflow.com/questions/23844761/upstream-sent-too-big-header-while-reading-response-header-from-upstream# https://www.digitalocean.com/community/tutorials/how-to-configure-logging-and-log-rotation-in-nginx-on-an-ubuntu-vps server {         listen 80;         listen [::]:80;                       root /var/www/your_s

systemd-analyze blame - Improving boot time/disabling useless services

$ systemd-analyze blame 57.578s apt-daily.service 32.058s docker.service 23.680s tor@default.service 21.697s NetworkManager-wait-online.service          18.048s dev-sda7.device          13.847s apache2.service          11.037s lightdm.service          10.914s ModemManager.service          10.696s plymouth-read-write.service          10.488s apparmor.service           7.755s snapd.service           7.030s wpa_supplicant.service           6.494s teamviewerd.service           6.111s accounts-daemon.service           5.924s grub-common.service           5.208s networking.service           4.967s netfilter-persistent.service Fix: If your current work and project does not require a service on startup, you can stop that for faster boot. Sometime automated load waste time instead of automatic thing that we not use. apt-daily.service https://askubuntu.com/questions/800479/ubuntu-16-04-slow-boot-apt-daily-service Docker: sudo bash -c 'echo manual | sudo tee /etc/in

SFTP bash

https://stackoverflow.com/questions/5386482/how-to-run-the-sftp-command-with-a-password-from-bash-script https://www.tecmint.com/sftp-upload-download-directory-in-linux/ No default port sftp -oPort=port_number host_name https://askubuntu.com/questions/944811/sftp-how-to-connect-to-non-default-port https://www.systutorials.com/docs/linux/man/1-sftp/ Download folder https://superuser.com/questions/40281/how-do-i-get-an-entire-directory-in-sftp

Unreal Engine start

https://wiki.unrealengine.com/Category:Code https://www.unrealengine.com/marketplace/store https://www.unrealengine.com/en-US/video-tutorials https://vimeo.com/album/5027341 https://docs.unrealengine.com/en-us/ https://docs.unrealengine.com/en-US/Programming/QuickStart