Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Thursday, September 28, 2017

Solved "openssl config failed: error:02001003:system library:fopen:No such process" for Nodejs Window 10




If you get this kind of error after installed nodejs in window 10, it means that your ssl is not pointed  correctly.

So you have to point to the correct path.

1) echo %OPENSSL_CONF% (See your openssl path)
2) set OPENSSL_CONF=C:\OpenSSL\bin\openssl.cnf (Set your openssl path)

After that try and type npm -v again in cmd. You should be able to proceed without error.


Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)

Sunday, June 25, 2017

Enlarge Image when hover using css with LIVE EXAMPLE!




This is a simple image enlargement using css. Do click on the link for example in jsfiddle.

Live Example

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

Wednesday, May 24, 2017

How to create release in git in SourceTree (Window) (Mac)



1. First of all, make sure that `master` branch and `develop` branch in the same branch. (All you have to do is just merge the develop into the master and it will be in the same level)

(If no `master` brunch just double click the `remote/master` branch to create a local branch OR
 follow the link to put the master here)

2. Now make sure that you in `master` branch.
3. Click Git Flow in the GUI.
4. Click `Create New Release`
5. Enter release name. For example: 0.6.2.0 and click OK. (A new branch is created.)
6. You should see uncommited changes. Commit the Changes.
7. Click `Git Flow` again to complete the release
8. DONE :)


Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

Minus (hour) from a datetime in Mysql



DATE_SUB(in_time, INTERVAL 8 HOUR);

Easy :)

SOURCE

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

Sunday, May 21, 2017

Useful InnoDB optimizing tips!

 

 

9.5.1 Optimizing Storage Layout for InnoDB Tables

  • Once your data reaches a stable size, or a growing table has increased by tens or some hundreds of megabytes, consider using the OPTIMIZE TABLE statement to reorganize the table and compact any wasted space. The reorganized tables require less disk I/O to perform full table scans. This is a straightforward technique that can improve performance when other techniques such as improving index usage or tuning application code are not practical.
    OPTIMIZE TABLE copies the data part of the table and rebuilds the indexes. The benefits come from improved packing of data within indexes, and reduced fragmentation within the tablespaces and on disk. The benefits vary depending on the data in each table. You may find that there are significant gains for some and not for others, or that the gains decrease over time until you next optimize the table. This operation can be slow if the table is large or if the indexes being rebuilt do not fit into the buffer pool. The first run after adding a lot of data to a table is often much slower than later runs.
  • In InnoDB, having a long PRIMARY KEY (either a single column with a lengthy value, or several columns that form a long composite value) wastes a lot of disk space. The primary key value for a row is duplicated in all the secondary index records that point to the same row. (See Section 15.8.9, “Clustered and Secondary Indexes”.) Create an AUTO_INCREMENT column as the primary key if your primary key is long, or index a prefix of a long VARCHAR column instead of the entire column.
  • Use the VARCHAR data type instead of CHAR to store variable-length strings or for columns with many NULL values. A CHAR(N) column always takes N characters to store data, even if the string is shorter or its value is NULL. Smaller tables fit better in the buffer pool and reduce disk I/O.
    When using COMPACT row format (the default InnoDB format) and variable-length character sets, such as utf8 or sjis, CHAR(N) columns occupy a variable amount of space, but still at least N bytes.
  • For tables that are big, or contain lots of repetitive text or numeric data, consider using COMPRESSED row format. Less disk I/O is required to bring data into the buffer pool, or to perform full table scans. Before making a permanent decision, measure the amount of compression you can achieve by using COMPRESSED versus COMPACT row format. 

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

"Openssl extension is required error " FIXED!



 [Composer\Exception\NoSslException]
The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.


navigate to php.ini (Note that php 7 have php.ini-development and php.ini-production, choose one of this and rename it as php.ini)

Set your path (Line 738)

extension_dir = "C:\EntryPass\Web\php\ext\" ( Make sure that your path is correct, if not it will nto work)

You should be able to create laravel project now. The openssl problem should gone.

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

"Unabled to retrieve chinese character in xsocket" FIXED!



Turn out that it is the encoding issue. So what I do is i use below solution. Below function will detect what type of string that being received and convert it into the same type.

iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text);

Solution here

Solution Reference

http://stackoverflow.com/questions/4164719/utf-8-encoding-xml-in-php

http://stackoverflow.com/questions/152006/change-mime-type-of-output-in-php

http://php.net/utf8_encode

http://stackoverflow.com/questions/1354263/how-to-load-xml-when-php-cant-indicate-the-right-encoding

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

Checked checkbox value in multiple chekcbox in javascript



 Here a quick example.

 <input class='try' type="checkbox" name="device" id="1_2" value="1" />
 <input class='try' type="checkbox" name="device" id="10_4" value="2" />
 <input class='try' type="checkbox" name="device" id="5_6" value="3" />
 <input class='try' type="checkbox" name="device" id="4_0" value="4" />
 <input class='try' type="checkbox" name="device" id="8_9" value="5" />
 <input class='try' type="checkbox" name="device" id="3_4" value="6" />

$('.try').click(function() {
    var value = $(this).val();
   var idd= $(this).attr('id');
   var explode = idd.split('_');
    alert('Value before:' +value + ' - Value after:' + value);
});

Example here 

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

"Boostrap modal not scrollable within modal" FIXED



Turn out that if you want to make you modal scrollable when you use two modal, you have to add this.

#modal_1 {
    overflow-y:scroll;
}

Example here.

Source

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

How to do loop insert in mysql




Example on how to do loop insert in mysql. This act like a function. NOTE that mysql does not support stored procedure.

DELIMITER $$

DROP PROCEDURE IF EXISTS insert_loop $$

CREATE PROCEDURE insert_loop ()
BEGIN
    DECLARE i int DEFAULT 1;
    WHILE i <=30 DO
        UPDATE test_db.visitor_visit SET visitor_id=i WHERE id=i;
        SET i = i + 1;
    END WHILE;
END $$

CALL insert_loop();

Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

"Unable to execute exec php " FIXED (Apache permission issue)




  1. Go to Control Panel->Administrative Tools_>Services
  2. Select the Apache service and hit Properties
  3. On the Log On tab, click 'This account:' instead of 'Local System account', and then find the User account of Windows user who's normally logged on to that terminal
  4. Restart Apache
    Source
Thanks for watching my blog. Do follow me on google+ or like my facebook page for more! :)
Obstrum Facebook Page

Monday, March 20, 2017

Execute query in mysql using command prompt



There are time where we as a programmer been forced to use cmd instead of gui software. People thought that it will become much harder if everything done by command prompt. Well, that not 100% true. By learning to use software by command prompt will make you understand better about the software architecture and how powerful it is. This tutorial will teach you all on how to execute query in mysql using only command prompt. Enjoy!

First, navigate to the mysql.exe in cmd.

Example, 


There nothing special syntax that you need to change, it all the same.

Below is some of the example query for your reference.

Create user in mysql
mysql.exe -u root -e "CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'";

Grant Privileges
mysql.exe -u root -e "GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'";

Flush Privileges
mysql.exe -u root -e "FLUSH PRIVILEGES";

Create database
mysql.exe -u root -e "CREATE DATABASE titan";

Delete database
mysql.exe -u root -e "DROP DATABASE database_name";

Select database
mysql.exe -u root -e "USE database_name";


If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page

Monday, February 13, 2017

How to install Node.js and Npm in Window



Javascript is one of the languages that are widely use nowadays. You can even create a real time application with node.js and many mores.

Installing Nodejs is pretty straight forwards as they provide .msi installer that allow us to install it like normal application in window.

Step 1 : Download nodejs .msi at the Nodejs Official website

Step 2 : Run the .msi file and install it like how you usually install program in your window.
(You can install it at wherever directory that you want)

Step 3 : Restart your computer to allow the changes to take effect on your computer.

Step 4 : Run command prompt or any command-line tool that you use.

Type node -v and it should show the version of the nodejs installed.


Type npm-v and it should show the version of the npm installed.


You can also write a file and use nodejs to run the file.

Open code editor, type console.log("Nodejs installed, congratulations!"); and save as .js file , after that go back to command prompt and run it by type node file-name. (For mine is node hello.js)

If a new version is available at the nodejs official website, you can just update it by download the newer version and install it again. It will automatically replace the old version.

If you want to uninstall the nodejs, just uninstall it like how you normally do in window.

If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page

Saturday, January 28, 2017

How to upgrade php version in xampp in Window OS




Hi guys, I'm back! Today I will show you guys how to renew your php version in xampp. Note that this is only applicable on window as there might be slight different of steps in other OS. As a programmer, it good for you to keep yourselves using the latest version of PHP as ton of improvement have been done on it.

Step 1 : Go to this website php and download latest php version.

*Note that  you should choose based on you Window version
VC14 x86 Thread Safe or VC14 x64 Thread Safe ( x86 for 32-bit and x64 for 64-bit )


Step 2 : Rename you old php folder to php_old and create a new folder called php. After that, paste the php that you just downloaded into the newly created php folder.


Step 3 : Navigate to xampp-control and click on Config -> Apache (httpd-xampp.config)

Change this :
LoadFile "C:/xampp/Web/php/php5ts.dll"
LoadModule php5_module "C:/xampp/Web/php/php5apache2_4.dll"

To this : 
LoadFile "C:/xampp/Web/php/php7ts.dll"
LoadModule php7_module "C:/xampp/Web/php/php7apache2_4.dll"


Step 4 : Open your phpinfo file and you should have the latest php version.

If you don't know how to create phpinfo file, this tutorial will help you. How to create phpinfo?


If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page



Tuesday, December 20, 2016

Solved " MySQL InnoDB not releasing disk space after deleting data rows from table "




Today, I encountered an issue MySQL InnoDB not releasing disk space even thought most of the data inside are empty.

For your information, innodb will not release the space even though you delete data inside the table. 
People call it a fail design because it hog all the spaces that supposedly be free.

In order to solve this, you have to enabled 'innodb_file_per_table' in mysql.ini 
(Note that if you don't enabled this and just delete the data and run the optimize query (OPTIMIZE TABLE table_name), mysql will reuse it later again hence the space occupy will not change.) 

I wouldn't not go into detail about this because it will take quite long time to explain it. I will just provide you the link to the documentation page. 
InnoDB File-Per-Table Tablespaces

Step 1 : enabled innodb_file_per_table




Step 2 : Restart mysql

Step 3 : Run this query "OPTIMIZE TABLE table_name"





Refresh your database. You should be able to see the table will now use lesser disk space.


If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page 



Sunday, December 11, 2016

Implement Adblock detector in blogger without writing any code



Nowadays a lot of bloggers are losing revenue because of the ad block.Ad block is advancing every day and it does not seem to stop at any time soon. To prevent losing revenue, BlockAdblock has created this amazing tool for us to generate a script to counter Adblock. Below is the step by step guide on how you can implement it into your blog website.

Step 1 :
Go to  BlockAdblock

Step 2 :
Click the button "Set up now for free".


Step 3 :  
Customize your own Adblock detector. You can even change the text appear on the Adblock detector script. How convenient is that!



Step 4 : 
Generate your script by click on "I'm ready! Generate my custom BlockAdblock code!". You can find this link at the bottom of the customization page. After that, a script is generated for you.


Step 5 :

Login into your blogger account and go to layout.

Step 6 : 
Go to Add a Gadget and choose HTML/Javascript. Insert your script into the field provided.


Step 7 :
You are good to go! You should be able to see the Adblock detector message if Adblock is enabled.
 
If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page 

Saturday, December 10, 2016

Guide on how to insert custom series into area Stacked Chart in HighCharts (Javascript)



Sample code that HighCharts provided on their website are all hard coded and there no guide on how to generate a custom value for the series. So, in this tutorial I will teach you on how to dynamically add the series value.

Below is the sample from HighCharts.
You can download it here. highchart javascript library





Step 1 :
You have to create an array containing the value that you want.
Note that the array must have format like below.



Step 2:
Next, just put the name of your array into the 'Series'.

So instead of this



Do this.


Step 3: Run your script again and you should be able to parse you array item into the chart.


If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need.

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page 

Thursday, December 8, 2016

Simplest way to check internet connection availability in PHP



Internet connection is extremely important for live production of a website. Below is code that you can use to check the availability of internet connection in PHP.
It is recommended to use "www.google.com.my" for determining the connection as it is highly unlikely google website will go down compared to other website.





If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need :

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page  

Thursday, December 1, 2016

Guide on how to change mysql username and password for mysql




Today I would like to teach about how to change mysql username and password for mysql.
It wouldn't take much of your time, all you can have to do are just two things. Access you mysql
from command prompt and run a query.That's it, easy like abc.

Step 1:
Open cmd and access your mysql.exe. If you are a super beginner for this, here easy steps for you.
  • Go to mysql directory (This will be varied depends on where you install your mysql). In my case, I install it using default directory of xampp and this is my command. 

Step 2;
Run this query.

For mysql < 5.7



For mysql >= 5.7



 If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need :

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page  

Tuesday, November 29, 2016

How to enable image imagick in apache?



Hello guys! Welcome back to Obstrum! Today I want to teach you guys on how to enable ImageMagick in apache.

First of all, what is the uses of ImageMagick? ImageMagick is a powerful tool for compressing image using php without losing the quality of the images. This is by far the best tool for compressing image in php.

But of course before you are able to use it, you have to enable it. To enable ImageMagick require more steps compare to others, but fear not, we will go through the step one by one. Before we start, note that these steps are mean for Window.

Step 1:
Open your phpinfo.php and check these two things. Note that phpinfo.php is not preinstalled and you have to write it by yourselves. You can check this page on how to create phpinfo.
How to create phpinfo.php

1) Architecture (x86 or x64)
2) Thread Safety (enabled or disabled)


Step 2:
Download ImageMagick from this website.  ImageMagick .
Make sure that visual c++ 14 also installed. Just google the word and you should be able to find it and download.

Upon finish download, unzip the file and copy all the .dll file into apache bin.
(If you installed it on default directory, this is the directory path : C:\xampp\apache\bin)

Step 3:
Go to this page and install thread safety.  Thread Safety
Choose stable version and note that you have to choose your .dll file based on you php version.
(To view php version just go to command prompt and type php -v)

Download and unzip the files. Inside you will found "php_imagick.dll" file. Save this file into your php extension file.
(If you installed it on default directory, this is the directory path : C:\xampp\php\ext)

Step 4:
Navigate to php.ini and type these.

[Imagick]
extension=php_imagick.dll
(For newbie, just copy these text into the last row of php.ini)


Step 5:
Restart Apache.

Step 6:
Open your phpinfo.php and you should see something like this.

 If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.

Hope this tutorial will help those in need :

If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page