Friday, December 22, 2017

How to call a function from html with *ngIf condition - IONIC 2

Try this code
home.ts
@Component({
  selector: 'my-page',
  templateUrl: 'home.html',
})
export class MyPage {
  myDate:any;

   // function you call when u select date
   setDate(){
      this.myDate="2017-12-22";
   }
}

home.html
<ion-list>
<ion-item text-wrap *ngIf="myDate" style="border-radius:7px 0px 10px 7px;box-shadow: 3px 3px 3px #ececec;">
  You selected {{myDate}} as your target date.
</ion-item>
</ion-list>


CodeIgniter Forums
Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 (/thread-60976.html)



Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - El Forum - 08-17-2014

[eluser]Unknown[/eluser]
Hi im new in the forum.

I've readed all the solutions i found on this issue yet no one worked for me so far.

Every time i try to connect to de db i see this error:

Quote:A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 346

This is my database.php config:

Code:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'p6000115_user';
$db['default']['password'] = 'mypassword';
$db['default']['database'] = 'p6000115_bigplan';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I've tryed to connect without using ci with this code:

Code:
echo '<pre>';
print_r($db['default']);
echo '</pre>';

$link = mysqli_connect($db['default']['hostname'],$db['default']['username'],$db['default']['password'],$db['default']['database']) or die("Error " . mysqli_error($link));
echo 'Conecte';
die();

When i do this it connects to the db.

Following another post here i've dissabled the db_debug param. It didn't show the error but when i try to access the db it's not there so it isn't connected.

I've tryied also to change DB_driver.php where it says :

Code:
$this->display_error('db_unable_to_connect');

I've changed it to:

Code:
die(mysqli_connect_error());
$this->display_error('db_unable_to_connect');

It only shows a blank page, no error. I don't know what to do anymore.

Thanks in advance.




Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - El Forum - 08-17-2014

[eluser]CroNiX[/eluser]
Your test code is using the MySQLi driver. Did you try using that for CI? It's using regular (deprecated) mysql driver (dbdriver).


Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - El Forum - 08-18-2014

[eluser]stevezissou[/eluser]
To add what CroNiX said, you also have persistent connections enabled in datatabase.php (which would use mysql_pconnect()).


Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - El Forum - 08-19-2014

[eluser]InsiteFX[/eluser]
Test database, create a new php file in your root

Code:
&lt;?php

$db_conn = mysqli_connect("localhost", "user_name", "password", "database_name");

// Evaluate the connection
if (mysqli_connect_errno())
{
    echo mysqli_connect_error();
    exit();
}
else
{
    echo "Successful database connection, happy coding!!!";
}

?&gt;

I use MySQLi with pconnect and it works fine on my system.



Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - El Forum - 08-19-2014

[eluser]CroNiX[/eluser]
He said he already did that in the first post and it worked. Not sure why you're suggesting he try again.


Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 - El Forum - 08-20-2014

[eluser]Unknown[/eluser]
[quote author="CroNiX" date="1408301585"]Your test code is using the MySQLi driver. Did you try using that for CI? It's using regular (deprecated) mysql driver (dbdriver).[/quote]

Thank you very much, i've just change the param dbdriver and it wotks perfect. :lol:

This is my final database.php file just in case someone is having the same issue.

Code:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'Lugones24';
$db['default']['database'] = 'bigplan';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;



Thursday, December 21, 2017

Shrink vertical spacing between fixed-size boxes to fit list within parent's bounds

Try this code
<div class="box">
  <div class="stack a">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="label">A</div>
  </div>
  <div class="stack b">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="label">B</div>
  </div>
  <div class="stack c">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="label">C</div>
  </div>
  <div class="stack d">
    <div class="surr"><div class="item" style="margin-top: -0%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -25%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -50%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -75%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -100%;"></div></div>
    <div class="label">D</div>
  </div>
  <div class="stack e">
    <div class="surr"><div class="item" style="margin-top: -0%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -12.5%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -25%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -37.5%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -50%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -62.5%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -75%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -87.5%;"></div></div>
    <div class="surr"><div class="item" style="margin-top: -100%;"></div></div>
    <div class="label">E</div>
  </div>
</div>
css:
.box {
  margin-top: 25px;
  
  border: 2px solid #000;

  
  display: flex;
  flex-direction: row;
}

.stack {
  position: relative;
  box-sizing: border-box;
  width: 15%;

  padding: 5px 5px 0 5px;
  margin: 0 10px;
  
  background: #fff;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

.label {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  text-align: center;
}

.item {
  box-sizing: border-box;
  height: 0;
  padding-top: 80%; /* aspect ratio */
  margin-bottom: 5px;
  
  background: #fff;
  border: 1px solid #333;
}


.stack.a .item:not(:first-child),
.stack.b .item:not(:first-child),
.stack.c .item:not(:first-child) {
  margin-top: -60%;
}


.stack.d, .stack.e {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.surr {
  height: 0;
}
ouput:

How to set up the current day (today) as a default date on FullCalendar?

HTML PAGE ADD THIS
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.css">
<body>
<div id='calendar'></div>
</body>

add this script code

$('#calendar').fullCalendar();

// change month
$('#months-tab').on('change', function() {
    // get month from the tab. Get the year from the current fullcalendar date
    var month = $(this).find(":selected").attr('data-month'),
        year = $("#calendar").fullCalendar('getDate').format('YYYY');
 
    var m = moment([year, month, 1]).format('YYYY-MM-DD');
 
    $('#calendar').fullCalendar('gotoDate', m );
});

// go to prev year
$("#prev-year").on('click', function() {
    $('#calendar').fullCalendar( 'prevYear' );
});

// set the month as the current month
// has to be -1 because this is 0 based
var month = $("#calendar").fullCalendar('getDate').format('MM') -1 ;
// set the correct month selected
$("#months-tab").find('option[data-month=' + month + ']').prop('selected', true);

OUTPUT:
calender


Tuesday, December 19, 2017

Impliment parent class's hover css to its child tag hover css

Try this
.videos-holder figure  figcaption:hover{
    -webkit-filter: grayscale(0%); 
    filter: grayscale(0%);
     -webkit-transition: .2s; /* Safari */
    transition: .2s;
}
Replace to
.videos-holder figure:hover  figcaption{
    -webkit-filter: grayscale(0%); 
    filter: grayscale(0%);
     -webkit-transition: .2s; /* Safari */
    transition: .2s;
}

Ionic native Google Maps not showing correctly

This is perfectly working
ionic map.html file
<ion-content>
<div class="map">
<ion-searchbar #searchbar placeholder="Suchen" [hidden]="!search"></ion-searchbar>
<div id="map" #map></div>
</div>
map.ts file
import { Component, ViewChild,ElementRef } from '@angular/core';
import { Geolocation ,GeolocationOptions ,Geoposition ,PositionError } from '@ionic-native/geolocation';
import { NavController, NavParams,Platform } from 'ionic-angular';

declare var google;
@Component({
selector: 'page-map',
templateUrl: 'map.html',
})

export class MapPage {
options : GeolocationOptions;
currentPos : Geoposition;
@ViewChild('map') mapElement: ElementRef;
map: any;
status:any;
isActive:any;
alertmsg:any;
alertcondition:any;
data:any = {};

constructor(public navCtrl: NavController, public navParams: NavParams,private geolocation: Geolocation) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad MapPage');

this.mapload();
}
/*##Get user location map starts##*/
mapload(){
// this.loadMap(13.08648395538330,80.27350616455078 );
this.options = {
enableHighAccuracy : true
};
this.geolocation.getCurrentPosition(this.options).then((pos : Geoposition) => {
this.currentPos = pos;
console.log(pos);
console.log(pos.coords.latitude+','+pos.coords.longitude)
//this.addMap(pos.coords.latitude,pos.coords.longitude);
this.loadMap(pos.coords.latitude,pos.coords.longitude);
},(err : PositionError)=>{
console.log("error : " + err.message);
});
}
}
loadMap(lat,long){
let latLng= new google.maps.LatLng(lat, long);
let mapOptions={
center:latLng,
radius:300,
strokeColor:'#AA00FF',
strokeWidth: 5,
fillColor : '#880000',
zoom:15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map=new google.maps.Map(this.mapElement.nativeElement,mapOptions);
}
hide() {
}
}


Result