Ignore File Changes without using .gitignore

I am taking a note regarding this way of ignoring file changes just encase you guys bump in to the situation where the file is not included to your .gitignore file and you want to keep it track later on.

This will tell git you want to start ignoring the changes to the file
git update-index –assume-unchanged path/to/file
(This command will assume that there is no changes to the specified file , so no need to worry if you’ll accidentally committed its changes)

When you want to start keeping track again
git update-index –no-assume-unchanged path/to/file

Advertisements

Avoid app from crashing during the loop – C#

I was new on C#.Net when i tried to create an app for scraping websites. At first i am using a single thread to handle loop logic which causes the app to crash several times if it involves a huge amount of data and leave all activity on foreground.

C# has background worker which can help avoid system crashes and more resource wise.

check this simple code , this shows how background workers being used

Laravel 404

From your web development using Laravel you may experience this issue as you setup a fresh web application run by apache and using virtual host for your http configurations. Defined routes doesn’t work but you think you set it right. On your virtual host configuration (.conf file) you put

AllowOverride All

but still you are getting a 404 error

the solution is, be sure to enable mod_rewrite

 

sudo a2enmod rewrite

then restart your apache

sudo service apache2 restart

This should fix the issue

Note: This is on linux implemetation

I experienced this issue when i tried to setup AsgardCMS (a laravel CMS) on a fresh/new server, took me a long time to discover the issue that’s why i am posting this note just encase.

 

How to play dota2 offline

You and your friends are stuck at home with no internet or there is but it sucks and you have dota2 installed on each computer ( sad life 😦 ). Worry no more you can still play dota2 on your LOCAL AREA NETWORK. Steps Below that should be done on all machines.

TERMINOLOGY

Server – the computer you want to host the dota2 it could be your machine

Clients – computers that will be connecting on the server – could be your friends computers

 

I. LAUNCHING WITH CONSOLE (Server And CLIENT)

  1. Launch Steam
  2. Right Click on DOTA2
  3. Hit Properties
  4. On GENERAL tab -> click SET LAUNCH OPTIONS
  5. Type in “-console” – don’t be an idiot don’t include the quotes
  6. Then Launc DOTA2
    jointeam good/bad

connect IP:PORT jointeam good/bad

dota_bot_populate

II. USING CONSOLE (Server)

  1. With your dota2 open type “\” – this will launch the console something like thistype-console-steam
    THIS IS THE CONSOLE – Clients should also launch console
  2. TYPE IN
    sv_cheats 1
    dota_bot_set_difficulty 4
    dota_start_ai_game 1
    dota_force_gamemode 1
    map dota.bsp
    jointeam good/bad
  3. This should start the server

III. USING CONSOLE (Client)

  1. Launch Console type in “/”
  2. TYPE IN (IP is the ip address of the Server PORT is the port the server is using)
    connect IP:PORT
    jointeam good/bad
  3. Then clients should be connected on the server

IV. ONCE clients are CONNECTED

Client are connected and all of have heroes of your choice but your number is less than 10 you can populate your team with bots

So the SERVER should type in
dota_bot_populate

BOOOM! ENJOY

Install Dota 2 without downloading it

Install dota2 but you dont want to download huge gig of file because of slow internet(meh) and you want to save time? Below are the steps on how to do it. BUT please note you need a machine that has already dota2 installed on it , if you don’t have it or you’re friend don’t have it go to sleep and continue your life without DOTA 😛

And please note i only tried this on windows IDK if it’s the same on the other platform.

  1. Copy the dota2 beta folder from the other machine where it is already installed. Example directory is on C:\Program Files\Steam\steamapps\common\dota 2 beta
  2. Now got to the computer you want dota2 to be installed  and install Steam (don’t worry steam is not that big)
  3. Login to your steam account/Create if you don’t have one zzzzzzz.
  4. Install Dota2 (ops! don’t panic i din’t want you to install the whole thing )
  5. Then Pause the installation (no need to continue , we install dota2 on purpose and pause it so it will create it’s directory/folder).
  6. Then transfer the file you copied from step #1 to steamapps\common folder. Example folder location C:\Program Files\Steam\steamapps\common
  7. On my end i close the steam application but i think it is fine without closing it. But i know you are a bit hesitant so close it 😛
  8. Run steam again (if you skip step #7 go to step #9).
  9. Go to steam LIBRARY -> GAMES
  10. Right click on Dota2, hit Unistall this will remove something IDK what but it’s not the whole dota2 files so chill
  11. Then install Dota2 again – This time steam will verify if you have dota2 installed on your machine/computer . (wait until it’s done verifying)
  12. Then BOOM! you can now play DOTA2 as soon as it’s finish verifying IF THERE IS NO UPDATE/NEW PATCH.
  13. ENJOY!

Leave a comment if this articles helps you or there is something i miss.

Using Google Sheet as Database

One way to show the data to your client with read only(depends on you) access accessible through web/mobile without creating new interface. Google Sheet is one of the solutions you can pick. Google sheet provides security features, history etc.. which make stuffs easier.

Using GSHEET as a DB is probably not a good idea. This is just an experiment (You might lose your hair)

On this article I will teach you how to Integrate Google Sheet as your database with PHP engine. LET’S GET STARTED!

NOTE
We need Google Developer Console Account for this

  1. On your google developer console account create a new project , name it whatever you want 😉 .
  2. Once it is successfully created. Click on credentials , then create credentials. Select service account key  cc
  3. Then you will be redirected to this page(see image below).
    cre
  4.  On service account select New service then fill out Service account name(input whatever service name you want). Choose P12 as Key type
  5. Then hit Create!
  6. After it is created .p12 file should be automatically downloaded(example file: whateveryouwant-2.p12 – dont lose this file we will gonna use this for Google Service API)  and pop out look like this(see image below). Note on the private key “notasecret” we will be using this one later. (BTW You can hit close)pop
  7. After closing the modal you will be Service Accounts page.sap Please note on the service account ID from the service account we created. It’s an email address format right? This we will use this email address later.
  8. Next step is to create your own GOOGLE SHEET (now here we go setting up our DB).
  9. Done creating your own GOOGLE SHEET?
  10.  Hold up! dont close the sheet. Click on share.
  11.  Now share it to the service account we created on step #7. (Input the service account ID in this case whateveryouwant@whateveryouwant.iam.gserviceaccount.com)INTEGRATING the connection with PHP using google service API will be in  my next article 😉

ZMQ on Xampp

I have an app run by laravel and experienced this error when i run composer install command from CLI.

Problem 1
 - Installation request for react/zmq v0.3.0 -> satisfiable by react/zmq[v0.3.0].
 - react/zmq v0.3.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system.
To enable extensions, verify that they are enabled in those .ini files:
 - C:\xampp\php\php.ini
 You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Here are some awesome ways to deal with that issue.
1.  Download all dll here http://pecl.php.net/package/zmq to your matching OS.
Make sure you got the right one (x86 or x64) and that it is either thread safe or non-      thread safe. How would you know? Time to play DLL roulette.
2. Copy libzmq.dll to your ~/xampp/php/
3. Copy php_zmq.dll to your php extension directory (eg. ~/xampp/php/ext/)
4. Then add this to your php.ini extension=php_zmq.dll