.htaccess URL redirect

You could utilise mod_rewrite. RewriteEngine On RewriteRule ^blog/index\.php/weblog/rss_2\.0/$ /feed/ [R=302] That should forward the URL to /feed/ on the same domain as the request came in on. Once you’re happy it’s working you can change the 302 to 301.

Draw random numbers from pre-specified probability mass function in Matlab

Using the Statistics Toolbox The randsample function can do that directly: result = randsample(supp_epsilon, n, true, pr_mass_epsilon); Without using toolboxes Manual approach: Generate n samples of a uniform random variable in the interval (0,1). Compare each sample with the distribution function (cumulative sum of mass function). See in which interval of the distribution function each … Read more

How do I get Greasemonkey to click on a button that only appears after a delay?

That code has errors. Use Firefox’s error console (CtrlShiftJ) to see them. Using jslint to check your code, can be helpful too. Anyway, this is a common Greasemonkey problem. Use the waitForKeyElements() utility to handle the delayed appearance of that button. Use jQuery to simplify the code (and make it more robust and portable). So … Read more

Selecting close matches from one array based on another reference array

Approach #1: With NumPy broadcasting, we can look for absolute element-wise subtractions between the input arrays and use an appropriate threshold to filter out unwanted elements from A. It seems for the given sample inputs, a threshold of 90 works. Thus, we would have an implementation, like so – thresh = 90 Aout = A[(np.abs(A[:,None] … Read more

Take screenshot from window content (without border)

Edit: While using the ClientArea is key, it isn’t quite enough, as DrawToBitmap will always include the title, borders, scrollbars.. So after taking the full screen- or rather ‘formshot’, we’ll have to crop it, using an offset we can get from mapping the origin of the clientarea to the screen coordinates and subtracting these from … Read more

Running VBA from a HYPERLINK()

To run the function only on a click you can try entering as a subaddress: =HYPERLINK(“#generateEmail(H2, I2, M2)”, “Generate Email”) and then add an extra line in the code to return the current address: Function generateEmail(name, manager, cc) Set generateEmail = Selection ‘Paste Outlook Code Here End Function Note this method does not get executed … Read more

How to output serialized JSON view data as an array of objects, instead of wrapped in an outer object?

Set a string for the _serialize option instead of an array. An array indicates that there might be multiple view vars that need to be serialized, and that requires them to be packed into separate object properties. $this->set(array( ‘platformusers’ => $platformusers, ‘_serialize’ => ‘platformusers’ )); That should give you the desired result.