Sunday, August 28, 2016

CSS - relative element appears in front of absolute element, ignoring z-index

CSS - relative element appears in front of absolute element, ignoring z-index:

Make sure that the elements have the same stacking context.
This usually means that you need an ancestor of both of these with position:relative or something similar.

More details:
http://stackoverflow.com/questions/3538583/position-relative-appearing-over-positionabsolute

Sunday, August 21, 2016

Decision Trees , ML

Cool link / interactive tutorial on Decision Trees:

http://www.r2d3.us/visual-intro-to-machine-learning-part-1/

Saturday, August 20, 2016

Fitting and forecasting with ARIMA in Matlab

Useful discsussion here:

http://stats.stackexchange.com/questions/106071/get-fitted-values-estimated-in-arima-in-matlab


I am using Matlab to forecast time series data using ARIMA algorithm. I am able to get forecasted values, but unable to get the fitted values. This is what I mean. In R:
 model <- auto.arima(data)");
 forecasted <- forecast.Arima(model, h=36)
 forecasted$fitted
forecasted$fitted will give the data which has been fitted to the original data by the ARIMA algorithm. But I cannot see anything like that in Matlab. This is what I have done so far:
model = arima(1,1,0);
[est, ~, logL, info] = estimate(model, data);
[output, YMSE] = forecast(est, 10);
output gives me the 10 values Arima has forecasted, but not the original data values it has fitted. I would like to know those.
Any help is appreciated.


I believe what you want can be indirectly obtained using the function infer.
As in general the actual fitted values from an ARIMA model are of little use themselves, what MATLAB returns is the residuals vector (somewhat oddly). In your case after you have estimated the parameters of the ARIMA model of your choice (model) given your observed univariate time series (data), you can use the model containing the parameter estimates (est) to infer the residuals of your model. So you want something like:
residuals = infer(est,data);
Following that you actual estimated values (est_data) are simply:
est_data = data - residuals;
Take note that infer function uses default setting regarding presample data. I do not know what are R is doing to get its estimates so I would advice you to look at the notion of presample before continuing. You might be surprised about what assumptions are put in place by different packages.

Monday, August 15, 2016

Google Maps JS v3 API - unable to display multiple Google maps on the same page

If the maps are coming out as blank gray, then you will probably have to use such a function:


window.maps = new Array();


function refresh_maps() {


    setTimeout(function () {


        var lenx = window.maps.length;

        for (var i = 0; i < lenx; i++) {

            var cur_map = window.maps[i];

            google.maps.event.trigger(cur_map, 'resize');

            cur_map.setCenter(cur_map.xxcenter);


       
        }

        //alert("DONE");

    }, 1000);


}


It refreshes all the Google Maps by raising a resize event. Also, it's important to re-center them.

The looping which adds maps to the array can look like this:

..............


        map.xxcenter = myLatlng;


        window.maps.push(map);
...........

Wednesday, August 10, 2016

Grant Cardone - video on preparation

Another important video from Grant Cardone:

https://www.youtube.com/watch?v=84KC_e7gZRU


phpmyadmin won't export certain JOIN queries

If phpmyadmin won't export the results of some INNER JOIN / LEFT JOIN queries in CSV, you can try to first make a view out of the query, and then export.

This seems to be a bug in some versions of phpmyadmin.

Tuesday, August 9, 2016

Monday, August 8, 2016

The science behind decision making

7 smart mental models:

http://rypeapp.com/blog/mental-models-decision-making/

jQuery - when bind-first plugin is not enough to disable a button

If you want to conditionaly disable a button, without knowing the handlers attached to it, this code might interest you:

jQuery(".add_to_cart_button").liveFirst("mouseup",function(e){


//jQuery("form[name=checkout]").liveFirst("submit",function(e){

e.preventDefault();
e.stopPropagation();

if(window.wcg_settings.cart_empty==0)
{

//jQuery(this).off();

jQuery(this).attr("disabled",true);

var resp=confirm("This action will empty the contents of your current cart. Are you sure you want to proceed?");
window.resp3=resp;

if(resp){

jQuery(this).attr("disabled",false);
return true;

}

return resp;

}
else{

jQuery(this).attr("disabled", false);
return true;
}


});

Basically, we attach to mouseup, which happens before "click" event, and conditionally disable the button!
Also, if it doesn't work, you can add it inside a setTimeout block, so you make sure it's not being overwritten by some other JS code.

Number of phone calls it takes to make something massively successful

Watch this great interview with Grand Cardone, it reveals a lot on sales:



https://youtu.be/oEG8zMndDg4?t=425


Grant claims that he made 100,000+ phone calls in his career! That's why he has got massive successs. :)

Sunday, August 7, 2016

FIR,IIR filters explained

An intuitive approach to FIR/IIR filters can be found in this thread:

https://www.quora.com/What-is-the-intuitive-meaning-of-FIR-and-IIR-filters-What-is-the-difference-Why-do-we-prefer-FIR-over-IIR-What-is-the-physical-significance

Wednesday, August 3, 2016

Monday, August 1, 2016

Binary XML file line #11: Error inflating class android.webkit.WebView

If your Android app is crashing with an Exception like this:

Binary XML file line #11: Error inflating class android.webkit.WebView


Then you probably need just to install WebView system component (you can find it on Google Play, and it should be already packed with every device) on that errorneus device.

The same fix applies to this problem:

AndroidRuntimeException: android.util.android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview (which is the root cause of Inflating Error Exception here).

PSR-1 and PSR-2 coding standards for PHP

Visual aspects of code play a significant role in raising or drowning developer's productivity. In case that there's too much clutte...