Posts

C++: Controlling the Decimal places to be shown

While dealing with some scientific calculations, I came across a problem that no of digits that were represented after the decimal were not as per the in-file(8 digits). It was only taking 4 digits after the decimal. I had gone through various forums and discovered <iomanip>. IOMANIP  is a header file that is being used to represent the number of decimal places to be used. #include<iomanip> void main() {         cout<<setiosflags(ios::fixed)<<setprecision(8);         ......         ......         ...... } Using the above code you can represent as many digits you want to represent after the decimal.

Check Your Website Particular Section Execution Time In codeigniter

CodeIgniter has a Benchmarking class that is always active, enabling the time difference between any two marked points to be calculated. For using the Benchmark Class you have to : Mark a start point Mark an end point Run the "elapsed time" function to view the results Here's the example of the code $this->benchmark->mark('code_start'); // Some code happens here $this->benchmark->mark('code_end'); echo $this->benchmark->elapsed_time('code_start', 'code_end'); For reference please use thebelow link https://ellislab.com/codeigniter/user-guide/libraries/benchmark.html

Create a log of your Database Queries that are getting executed while running a application written in Codeigniter

First of all enable the hooks from your config file . Just Open the config.php in you application/cofig folder $config['enable_hooks'] = TRUE; Now open the hooks.php and write down the code $hook['post_controller'] = array( // 'post_controller' indicated execution of hooks after controller is finished 'class' => 'Db_log', // Name of Class 'function' => 'logQueries', // Name of function to be executed in from Class 'filename' => 'db_log.php', // Name of the Hook file 'filepath' => 'hooks' // Name of folder where Hook file is stored ); Now we will create the hook with name db_log.php which we have set above and save it in application/hooks/ folder. Then we simply put the following code in this file. // Name of Class as mentioned in $hook['post_controller] class Db_log { function __construct() { // Anything except exit() ...

How To Design Email In html News letter

The biggest pain when coding HTML email is that so many email services likeEudora, Outlook, AOL, Thunderbird, Lotus Notes, Yahoo!, Hotmail, and Google Mail, to email apps on phones and tablets. The software used to render HTML for each email software tool determines what HTML and CSS code works and doesn’t work. If you thought it was difficult to ensure the cross-browser compatibility of your web sites, be aware that this is a whole new game — each of these email software tools can display the same email in vastly different ways. And even when these tools do display an HTML email properly, accounting for variances in, for example, the widths at which readers size their windows when reading emails makes things even trickier. http://www.sitepoint.com/how-to-code-html-email-newsletters/

Codeigniter slug library for making Url seo friendly

Codeigniter Slug Library With the Help of thi s library you should convert your codeigniter websites URL as Seo friendly examples are mysite.com/post/my-post-title Please note that these fields map to your database table fields.

Few validation sites for html validation

http://validator.w3.org/

Use ordering in group_concat mysql function

SELECT  group_concat(couloumname order by couloumname) AS views FROM tablename GROUP BY couloumname you should use different order by condition for the  multiple  group_concat condition below is the example of using the multiple group_concat with order by condition SELECT  group_concat(couloumname1 order by couloumname1) AS views , group_concat(couloumname2 order by couloumname2) AS views2 FROM tablename GROUP BY couloumname you should also use the seperator if you want to change the comma seperated value from the select query SELECT  group_concat(couloumname1 order by couloumname1   desc SEPARATOR ' ') AS views , group_concat(couloumname2 order by couloumname2) AS views2 FROM tablename GROUP BY couloumname

checking the detail of database table in codeigniter

These functions let you fetch table information. $this->db->list_tables(); Returns an array containing the names of all the tables in the database you are currently connected to. Example: if ($this->db->table_exists('table_name')) {    // some code... }

Get all detail from ip address

function ip_details($ip) { $json = unserialize(file_get_contents("http://ip-api.com/php/".$ip."")); return $json; } and you get a response like Array (     [city] => city name     [timezone] => timezone     [status] => success     [regionName] => State     [lat] => 26.223600387573     [isp] => your operator name     [as] => operator registration     [query] => ipaddress     [region] => statecode     [zip] => zipcoe     [org] => your broadband organizxatio     [country] => country name     [countryCode] => country code     [lon] => 78.17919921875 )

create index in the database table to make your result response faster

The CREATE INDEX statement is used to create indexes in tables. Indexes allow the database application to find data fast; without reading the whole table. An index can be created in a table to find data more quickly and efficiently. The users cannot see the indexes, they are just used to speed up searches/queries. here in the below you find a video how to create the indexes in database https://www.youtube.com/watch?v=zmAMXSr8zio