Sunday, December 10, 2017

MAMP mysql not starting

https://stackoverflow.com/questions/16021564/mamp-mysql-server-wont-start-no-mysql-processes-are-running

The easiest solution: quit MAMP and remove the log files from MAMP/db/mysql directory [ib_logfile0, ib_logfile1] and restart MAMP. For more visit http://juanfra.me/2013/01/mysql-not-starting-mamp-fix/

Tuesday, December 5, 2017

Install wordpress

http://webdesignerwall.com/tutorials/installing-wordpress-locally

create directory
copy files (zip it and upload to folder)


change config file to match above: wp-config.php
1. db name
2. login in credential
  db user root
  db password root
  use port 3306

create database use MAMP

run install
http://localhost/mysite/wp-admin/install.php

launch site
localhost/dbname
select language

after wp installed
change settings
general - title, tag line, time zone
reading - sample page as front page
Media - change to one folder
Permalinks - use post
user profile - turn off admin bar


in wp-config.php
generate Authentication Unique Keys and Salts

https://api.wordpress.org/secret-key/1.1/salt/

define('AUTH_KEY',         '13F|9&|f^(D@SFth!:o$^4|nanoz=p=)hI`dSKc,3:t+F|f7;y+H:TwUm]y+l6w5');
define('SECURE_AUTH_KEY',  'H[+3IJ&|c{`M?$Z$TbmN]CWhe-WFM-O^$(On-p0`L7}hlR;n#H<r< J_/)u%|f!2');
define('LOGGED_IN_KEY',    'PQzdiJkKoImMzfNhYVCSo$HeV0<U`,}@owN-c[3wQH-LVR#]5eiWTTIc9F=uZ3c@');
define('NONCE_KEY',        ':~V+Tx1n|.R(TVYTNE}K}a_na<x.u:=H#0QiuEM^PXs|%VtRM?5m8yP`)$A.P-j>');
define('AUTH_SALT',        'uPDej2jx6Z_3Y.fu[9=%a-|Z68^hli)7+l0L`kx-!S|/<?o@u^/(u+KQO<z3ro+h');
define('SECURE_AUTH_SALT', 'Atl_J^1@gLbl.A^Ji6qc+!dZwKL-Old7;1mukCE3| !x]wASTU]&fs5>VcEqHO5G');
define('LOGGED_IN_SALT',   '.faG[K9JXPum52i,H.Zk|,t8vin:e9AI2+;27e`fLc? .|{a!:n dNtJ2]5):VX+');
define('NONCE_SALT',       'AW,OoXK5g-@NW9xPvqK~$>@>1%Ik+%lp-ZGEk1XjH{-9s5JejOhEP+?CDe-])|OC');

Monday, March 20, 2017

Datareader vs dataset

https://www.codeproject.com/Articles/420217/DataSet-vs-DataReader

DataReader

DataReader is a stream which is readonly and forward only. It fetches the record from databse and stores in the network buffer and gives whenever requests. DataReader releasese the records as query executes and do not wait for the entire query to execute. Therefore it is very fast as compare to the dataset. It releases only when read method is called.

DataSet is a collection of in memory tables and datareader provides the ability to expose the data from database.

Both are very widely used in asp.net applications to get/fetch the data from the database. But for a scalable, fast, and reliable application one has to know the best practices in developing application.

DataSet

We should use when the application is:

  • Windows application
  • Not too large data
  • Returning multiple tables
  • If, to be serialized
  • Disconnected architecture
  • To return from a WCF  service
  • To send across layers
  • Caching the data
  • Do not need to open or close connection




Friday, March 10, 2017

Pdanet connection to Internet from laptop

You have to kill adb.exe

Run as administrator  d:\util\procexp.exe

http://www.junefabrics.com

Monday, February 6, 2017

$apply vs $digest

https://www.sitepoint.com/understanding-angulars-apply-digest/

remove hash

https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag
http://www.getursolution.com/2016/06/15/angularjs-pretty-url-remove-hash/

angular js deep linking

http://odetocode.com/blogs/scott/archive/2014/04/14/deep-linking-a-tabbed-ui-with-angularjs.aspx

Friday, January 13, 2017

sort string elements in an array object

$scope.source.specializations.sort(function(a, b) {
    var textA = a.specialization.toUpperCase();
    var textB = b.specialization.toUpperCase();
    return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});

robomongo insert a doc

db.specialization.insert({specialization:'', programArea:'', visibility:true})

Friday, January 6, 2017

posgresql select case

Just to help if anyone stumble on this question like me, if you want to use if in PostgreSQL, you use "CASE"
select 
    case
        when stage = 1 then 'running'
        when stage = 2 then 'done'
        when stage = 3 then 'stopped'
    else 
        'not running'
    end as run_status from processes

Tuesday, January 3, 2017

regex tool

http://www.regexr.com/v1/desktop/

download desktop version

replace 1 with 2016

I have a database with year value 1=>2016, 2=> 2017, 3=>2015

use Pentaho data integration transformation

^.{0,1}[1]$ is used to match 1 with length 1
^.{0,1}[2]$ is used to match 2 with length 1
....