Posts

Creating Any Data Types in Dart and Flutter

As we know, all programming languages have some data types. I've been learning dart and as I didn't code much in C or Java, I am not that much familiar with how these actually works. It has some basic data types like String int bool etc etc But, this moring I was working on Stateful Widget in Flutter and I saw this kind of code class MyApp extends StatefulWidget { @override _myState createState () => _myState (); } class _myState extends State < MyApp > { ... } _myState createState () => _myState (); But I couldn't understand. As far as I knew, we use data type beofre a variable or class name [in this case its return type]. So, I dig into this and found that we can create any types. The real thing is when we create  _myState  Class, it becomes a type. That's the reason we can use it as type later. Actually,  all types are just types. Even primitive data types like String and int are just classes that are defined in

Fixing AMPPS MySQL Not Starting and Unable to Change PHP Version

Image
Okay, It was my first time I tried AMPPS. Which is a awesome Software with so many options and it also included Softaculous which is really awesome. It will definitely speed up development. But for the first time when I was testing it, the MySQL was not starting and also I couldn't change the PHP version for 5.6 to 7.1. I was searching on google but could not find any working solution. I tried  AMPPS Official Fixing Guide  but it didn't work. They suggested to add the following line in MySQL config. innodb_force_recovery = 1 But it failed to solve the issue. So, What did I do? I tried to run MySQL.exe from C:\Program Files (x86)\Ampps\mysql\bin but it showed me the error MSVCP100.dll and MSVCR100.dll not found. So, I downloaded these dll files but it didn't solve the problem, rather it gave me another error of " 0xc700007b ". It was a common error for every gamer :D All I had to do is installing  Microsoft Visual C++ 2010 Redistributable Package (x

Why PHP Array Functions are so important?

I was building an API for Android. I used Lumen  as its blazing fast and based on PHP. And ready to go framework. Everything was easy and fun. But, at one moment I got stuck. I got stuck to return a specific data. As my database was designed by the client and also result was also fixed by the client. The result was odd, in one JSON  object the clients so many values with same key or name. But that's not possible. So, What do I do? without changing the database structure. I got an idea to put a key [ex. 1,  2, 3 so on] with each key name so the name will be unique for the JSON object. In that time, I faced so many difficulties. As I had to return some data from the database and store them in an array. And the most pathetic part was that, the database return data with some values, from those values I had to use some data one times and some data several times. It got me mad, then I tried to DISTINCT   the data, but  DISTINCT   caused another error of escaping all of the necessary

Mouse Right Button Click, CTRL +U disabling in HTML to protect content from Copying and Viewing source by visitor

In some rare cases, we need to protect our source code form visitors. Sometimes, for security reasons, to safeguard source code from hackers . Disabling is easy. It can be done in three steps: Add the attribute to any HTML Tags Add JavaScript code to disable some KEYS with the onkeydown event Add JQuery to prevent a combined key event. <html lang="en" oncontextmenu="return false" ondragstart="return false" onselectstart="return false"> Warning: If add these attributes in body tag then, right click will work where the body tag is finished [in such case, where the page body doesn't feel full display of the browser] JavaScript Code <script> document.onkeydown = function(e) { if (e.ctrlKey && (e.keyCode === 67 || e.keyCode === 86 || e.keyCode === 85 || e.keyCode === 117)) { alert('You are not allowed to perform this action.'

Create WordPress Admin from cPanel or MySQL or phpMyAdmin

Image
Sometimes  we need to create admin user from hosting or cPanel. In that case, simply adding any user in wp_users won't work even if we put proper password " Salted Hash ". It will surely log you in but you won't be able to see the Dashboard, To activate this superpower you will have to edit wp_capabilities from " wp_usermeta " and the value will be " a:1:{s:13:"administrator";b:1;} ".