My experience on my daily works... helping others ease each other

Sunday, December 31, 2017

Javascript to newbies

Want to learn JavaScript and conquer the world? Start here:

Tutorials and Books
- JavaScript For Cats is a dead simply introduction for new programmers.
- MDN JavaScript Guide has the most standard and straightforward tutorials. If you need references, MDN is here for you
too.
- You Don’t Know JS is the best book to learn JavaScript from. It’s free to read on GitHub.
- Eloquent JavaScript is another great introduction to programming and learning JavaScript.
- Modern JavaScript Cheatsheet helps you understand and learn all the new features in the language.
- JSBooks, a collection of free JavaScript books.

Videos and Courses
- JavaScript: Understanding the Weird Parts an incredible course which teaches the concepts of the language. First 3 hours
are free on YouTube, you can but the whole course from Udemy.
- FunFunFunction makes the learning process enjoyable.
- Javascript30, 30 videos to level up your skills.
- Traversy Media great contents mostly aimed for begginers.

Learn by Doing
- FreeCodeCamp, learn to code by building projects.
- CodeAcademy, learn to code interactively.
- Codewars, train with programming challenges.

Functional Programming
This where the true the good parts show theirselves.
- JSUnconf 2016, learn functional programming basics with this talk from Anjana Vakil.
- FunFunFunction's videos are a great start.
- Mostly Adequate Guide to Functional Programming and Functional Light JS will make you master the functional programming.
- JavaScript Allongé, programming from functions to classes.
- Functional Programming Jargon in simple terms.
- awesome-fp-js is a good reference for functional programming in JavaScript.

Other Resources
- Spellbook of Modern Web Dev is a big picture of modern JavaScript development.
- What the fuck JavaScript?, list of funny and tricky JavaScript examples.

From JS telegram Part of @thedevs 
Rules: @thedevsrules Join other dev groups https://thedevs.network
Share:

Thursday, December 28, 2017

Cannot parse JSON-encoded object value

I'm using Loopback, a node.js API framework which helps you to develop RESTful API very easy and fast. It reduces the programming/coding require and allow you to deploy your API within days.

However, things may not be as easy you can think of. The documentation given is still lack of information and there are not many solutions that can help you to solve your problem. One of it is Cannot parse JSON-encoded object value issue.

The error message you will get as example below

error": {
"statusCode": 400
"name": "Error"
"message": "Cannot parse JSON-encoded object value."
"stack": "Error: Cannot parse JSON-encoded object value. at Object.fromSloppyValue (D:\Project\loopback\touchpoint\node_modules\strong-remoting\lib\types\object.js:34:19) at HttpContext.buildArgs (D:\Project\loopback\touchpoint\node_modules\strong-remoting\lib\http-context.js:193:22) at new HttpContext (D:\Project\loopback\touchpoint\node_modules\strong-remoting\lib\http-context.js:59:20) at restStaticMethodHandler (D:\Project\loopback\touchpoint\node_modules\strong-remoting\lib\rest-adapter.js:485:15) at Layer.handle [as handle_request] (D:\Project\loopback\touchpoint\node_modules\express\lib\router\layer.js:95:5) at next (D:\Project\loopback\touchpoint\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (D:\Project\loopback\touchpoint\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (D:\Project\loopback\touchpoint\node_modules\express\lib\router\layer.js:95:5) at D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:281:22 at Function.process_params (D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:335:12) at next (D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:275:10) at Function.handle (D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:174:3) at router (D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:47:12) at Layer.handle [as handle_request] (D:\Project\loopback\touchpoint\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:317:13) at D:\Project\loopback\touchpoint\node_modules\express\lib\router\index.js:284:7"

You can google it but the solution was not helpful enough to guide you. Sometimes, when you used its pre-default apps (coming together when you setup your loopback apps) known as swagger (Loopback API Explorer), the url and parameter used seem work as it meant to be. The problem only occurs when you try to call it from 3rd party apps such as ARC (Advanced Rest Client, POSTMAN, IMSONIA) or from your program, the above error occurs.

How to solve this?


  1. Ensure that you run and test your parameter passing which should be in JSON format is valid. You may use online such as Jsonlint or any JSON validator available.
  2. If it is valid, then, ensure that all key and value is in open and close double quote - "key": "value". Do not use single quote 'key': 'value'
  3. Finally, if the above two is correct, encode some of your parameter; for instance, '%' shall be encoded to '%25'. Use online encoder to help you such as https://www.urlencoder.org/


The above solution only applicable if you implement method through http GET, POST, PATCH, etc request. It may not be applicable for other REST calling method.

#enjoycoding





Share:

Wednesday, December 27, 2017

Set the display to center using Ionic

If you are developing apps focusing only on mobile, you may not be facing display issue as the user won't be able to see gaps or alignment problem. However, if you are developing apps that required to run on multiple platforms including web and mobile, aligning your display may cause a problem.

You will spend lots of time to configure your .css (or .scss) and when you thought you solved the problem on mobile, it shows differently on web.

I too faced such difficulties and finally found a way to solve it. I'm using ion-card and ion-list together.

here are snapshot of the code
<ion-card-content style="justify-content: center; margin-left: 0px; margin-right:
0px;background-color: #000000;">
<ion-card-title style="color: #fcfa87">
Center content <br> Working together
</ion-card-title>
<ion-list no-lines style="justify-content: center; margin-left: 0px;
margin-right: 0px; background-color: #030303;">
<ion-item style="background-color: #f1f7d6;">
<ion-label floating class="item item-input">Username</ion-label>
<ion-input type="text" name="username" class="input-label"></ion-input>
</ion-item>

and of course you need to configure your .scss too

snapshot of the code
.displayed {
display: block;
margin-left: auto;
margin-right: auto;
}
.card{
width:100%;
margin: auto;
}

the first (.displayed) shall be call by your ion-content tags and the .card is automatically set the card to be 100% width depending on your screen size

and it shall be displaying nicely on any screen as shown below
On web browser

On iPhone 7
For complete source code, you can download from my github.

All the best coding :)

Share:

Tuesday, October 31, 2017

Best Hacking e-books 2017

1.Metasploit The Penetration Tester's Guide 
https://www.up-4ever.com/591f0cz49n7d

2.A Beginners Guide To Hacking Computer Systems 
https://www.up-4ever.com/idwc4g1ag2ob

3.Black Book of Viruses and Hacking 
https://www.up-4ever.com/niv9ibml1voe

4.Hackers High School 13 Complete Hacking Ebooks 
https://www.up-4ever.com/82dzt2rjcpy3

5.Reverse Engineering Hacking and Cracking 
https://www.up-4ever.com/b2fgqs7cxw9a

6.Computer Hacking 
https://www.up-4ever.com/tuaz42q7dh0y

7.Blind SQL Injection Discovery & Exploitation 
https://www.up-4ever.com/83i3791x8gc5

8.Hacking With Experts  Facebook Hacking)Size:3mp 
https://www.up-4ever.com/ruph352nrxcl

9.Computer Hacking & Malware Attacks for Dummies 
https://www.up-4ever.com/xgcvoxuc6y76

10.stealing network 
https://www.up-4ever.com/96r86k3dg2yy

11.secrets of super hacker 
https://www.up-4ever.com/kifr8kytmfz9

12.501 websites secrets 
https://www.up-4ever.com/zqpne3e4s2cy

13.google dangerous searching 
https://www.up-4ever.com/en6dihqmf3lm

14.hacking gmail 
https://www.up-4ever.com/v2oxzy02sgm8

15.computer viruses 
https://www.up-4ever.com/gib7ecozp8yg

16.google apps hacks 
https://www.up-4ever.com/cxokzthwn6rh

17.gray hat hacking 
https://www.up-4ever.com/s5e7c3jif0kn

18.webapp hacker hand book 
https://www.up-4ever.com/85y1mqe8qgar

19.denial of service 
https://www.up-4ever.com/dfpwh6a3uw4y

20.Vulnerability Exploit & website Hacking for Dummies 
https://www.up-4ever.com/9hxraizlp8zq

21.Internet Advanced Denial of Service (DDOS) Attack 
https://www.up-4ever.com/gyf271w4gwbo

22.Beginning Ethical Hacking with Python.pdf       
http://gsurl.in/4Laz

23.Certified Ethical Hacker (CEH) Foundation Guide.pdf 
http://gsurl.in/4Lbj

24.Game Hacking.pdf
http://gsurl.in/4Lbt

25.Hacking Android.pdf 
http://gsurl.in/4LbB

The link listed above is valid as of 30th October 2017
Share:

Saturday, September 30, 2017

Developing Microservices Using Orleans by Microsoft



Image result for microservices architectureI am new to Microservices although it has been a while in software engineering world. Luckily Microsoft (am not marketing them) has done a pretty good job in explaining the detail.

Take a look if you guys which to understand in detail.

Microservices offer great benefits but also raise huge new challenges. Microservice architecture patterns are fundamental pillars when creating a microservice-based application. [more]

And as part of their initiative (and of course to boost their .NET platform), they too develop a framework to support the implementation of microservices. Have time to read here.

* note: all link is valid as of 1st October 2017


Share:

Tuesday, July 25, 2017

Replicate same question to different course in Moodle

How do I copy Moodle Quiz questions from one course to another?

In the Moodle section from which you would like to copy questions:
1. In the “Administration” block, click on “Export” in the “Question bank” menu.
2. Choose “Moodle XML format” and select the category you would like to copy from the “Export category” drop-down menu; click on the “Export questions to file” button.
3. Save the file to your desktop.
4. Go to the Moodle section to which you would like to copy the questions.
5. Click “Import” in the “Question bank” menu.
6. Choose “Moodle XML format,” and make sure the “Default” course level category is chosen for the “Import category” drop-down menu.
7. Click “Choose file…” to open the “File picker” window.
8. In the “File picker” window, click “Choose File” to browse and select your exported Moodle questions file, then click “Upload this file.”
9. Click “Import,” and you will see a preview of the imported questions.
10. Click “Continue” to proceed to the category containing the imported questions.
NOTE: At this point, you have only copied the quiz questions, and must still create a new quiz and load in the copied questions.

To add the copied questions into a new quiz:

1. Go to the home page of your Moodle course section and click “Turn editing on.”
2. Click the “Add an activity or resource” link in any section where you would like the link to your quiz to be displayed.
3. In the “Add an activity or resource” window, choose “Quiz” and click on the “Add” button.
4. Give your quiz a Name, Open and Close Dates, and set any other desired configurations.
5. Click on the “Save and display” button at the bottom of the page.
6. Click on the “Edit quiz” button; in the “Select a category” drop-down menu in the purple box on the right, select the (newly imported) question category.
7. Check the box to the left of the questions you would like to add to the quiz, or check the box at the top of the column to select all.
8. Click on the “Add to quiz” button.

The above content is copied directly from here:
https://delta.ncsu.edu/knowledgebase/how-do-i-copy-moodle-quiz-questions-from-one-course-to-another/
Share:

Thursday, July 20, 2017

Tableau - The user could not be added because you do not have access to the domain specified.

You may get the following error when you try to add new user. You have try may solutions as listed in Tableau:


Even you have file a case at Tableau Support and received respond from them. I received the following from Tableau Support:
Thank you for contacting Tableau Technical Support. My name is Henk, and I will be assisting with this case.

I have investigated the reported issue and I do have some steps below that should resolve the permissions issues on Tableau Server. We suggest consulting with your Active directory administrator to make sure the Tableau Server Run As User account has been granted permission to has access to query the Active Directory. If having the access capability, please follow the steps below re-entering the Run As User password and start Tableau Server.

• Try stopping TABLEAU Server, re-enter the Run As User password and start Tableau Server

1. Open Command Prompt and run as administrator, navigate to the “bin” folder located in the Tableau Server directory. For example if Tableau Server is installed in the default location, the directory will be: C:\Program Files\Tableau\Tableau Server\\bin 2. Type the following command to stop Tableau Server: tabadmin stop 3. From the start menu, type "Configure Tableau Server", and right click the program to open it as a Window Administrator.
4. Type the Run As user password and click "Ok" to save.
5. Type the following command to start Tableau Server: tabadmin start

Additional information on how to add Active Directory users can be found in the following links:

Add Users to a Site

I believe the above information will resolve this issue. If the information provided does not resolve the issue, please let me know by responding with the additional information requested below and a few details regarding why the solution above did not resolve the issue.

1.            What issues are still occurring?
2.            Did the steps not resolve the issue?
3.            Is this an issue with all users or just a specific Active Directory user?

We may send a survey to confirm that the case has been fully resolved.

We appreciate any feedback on this issue as well as the general Tableau Technical Support experience.

Thank you for being a valued Tableau Software customer!

Please find your case summary below. To update this case via email, please reply to this message.

Sincerely,
Henk
Tech Support
Tableau Software


After try all the above, you still get the same result and thought of re-install your tableau server. Before you do that, let me give you another solutions:
1. Please make sure the username used to manage the tableau server (start, stop, restart) is register in the same domain as other user (in your Active Directory, LDAP server, or any authentication method used excluding local authentication)
2. If no. 1 ok, then ensure that the user has administrator privileges and has granted by your domain authenticator (in my case is Active Directory)
3. Open you Tableau Server Config (for Windows Start Menu > Tableau > Config Tableau Server).
4. In the window pop-up, make sure the username and password entered is the same username/password register in the Active Directory.
5. Restart your tableau server. Opps.. I recommended that you stop your tableau server first. :)

And it shall solve your problem.

p/s: it took me 2 days to figure out.

Share:

Friday, May 26, 2017

Kotlin + Netbeans IDE 8.2 - Don't use yet

I try the new language Kotlin with Netbeans 8.2.
http://plugins.netbeans.org/plugin/68590/kotlin

After download and install the plugin, it cause error on all projects currently on my list of projects and causing my netbeans to behave abnormally.

The error does not stop there. When I uninstall it, which you can't as it only appear in User Plugin and when you uninstall the plugin (just for the sake to remove kotlin), it causes many other problem.

So guys, use with extra careful ya.
Share:

Thursday, March 2, 2017

Get start with ionic framework

When I first developed apps using ionic, not many resources over the net will provide good explanation on it. I've found one and it is very easy to understand.

Here is the structure of ionic framework after it successfully execute ionic start command; for example 

ionic start myfirst blank --v2

>> ionic start [your_apps_name] [template] [ionic_framework_version]

the command will create a new folder (myfirst) and construct the following structures

├── hooks // custom cordova hooks to execute on specific commands 
├── platforms // iOS/Android specific builds will reside here 
├── plugins // where your cordova/ionic plugins will be installed 
├── resources // icon and splash screen 
├── scss // scss code, which will output to www/css/
 |── www // application - JS code and libs, CSS, images, etc. 
      |---------css //customs styles 
      |---------img //app images 
      |---------js //angular app and custom JS 
      |---------lib //third party libraries 
      |---------index.html //app master page 
├── bower.json // bower dependencies 
├── config.xml // cordova configuration 
├── gulpfile.js // gulp tasks 
├── ionic.project // ionic configuration 
├── package.json // node dependencies


Following are current potential templates that you can use:
  • tabs : a simple 3 tab layout
  • sidemenua layout with a swipable menu on the side
  • blanka bare starter with a single page
  • superstarter project with over 14 ready to use page designs
  • tutoriala guided starter project

Once it is completed, you will get to see the following message appear:
Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
Downloading: https://github.com/driftyco/ionic2-starter-                   sidemenu/archive/master.zip                                                
Installing npm packages (may take a minute or two)...                      
-                                                                          
♬ ♫ ♬ ♫  Your Ionic app is ready to go! ♬ ♫ ♬ ♫                          
                                                                           
Some helpful tips:                                                         
                                                                           
Run your app in the browser (great for initial development):               
  ionic serve                                                              
                                                                           
Run on a device or simulator:                                              
  ionic run ios[android,browser]                                           
                                                                           
Share your app with testers, and test on device easily with the Ionic View companion app:                                                             
  http://view.ionic.io                                                     

Yeah... now you test your apps. Just run ionic serve to view on your browser. It will pop-up your browser and automatically navigate to http://localhost:8100 ... else, you can open your browser and go to the address.

If you want to view in mobile, you may use mobile emulator or deploy on your mobile. Before that, do install mobile platform package first. To do that, run the following command:

                                                                       
ionic platform add ios  // to add ios platform into the package      
                                                                     
ionic platform add android //to add android platform into the package  
                                                                       

Finally, you are ready to run (on emulator or actual device).


                                                                           
ionic run android --prod --release //to run on emulator as production mode 
                                                                           
ionic build android --prod --release //to build as package for installation
                                                                           

For ios, it will require more steps and you can follow it https://ionicframework.com/docs/v2/intro/deploying/.

Lets dance... :)
Share:

Tuesday, February 28, 2017

PHP Randomize and Sort for multi-dimensional array

Learn to use rand() in php and sortation on multi-dimensional array via dice program.

Here is the code https://github.com/masteramuk/PHP-Rand-and-Sort
Share:

Directory Listener (java code) - finally on github

Hi guys.. it has been a while since I last wrote anything here.

Just wanna share with you my latest contribution to community. I've uploaded a simple directory listener code written in java. What it does?
1. Listen to any directory pass as parameter
2. Basically alert you through message prompt on any activity done.

It can be further extended for any process you wish.

Feel free to use the code. It can be downloaded at
https://github.com/masteramuk/Java-Directory-Watcher

Adios..

Share:

About Me

Somewhere, Selangor, Malaysia
An IT by profession, a beginner in photography

Blog Archive

Blogger templates