124 views

PHP get daylight saving time

$dst = date("I"); //I (capital i); 0 or 1 if daylight saving time
 
// example:
$hour = 14;
if(date("I")===1){
 $hour = $hour + 1;
}
// OR
$hour = 14 + date("I");
Posted in PHP | Tagged | Comments Off on PHP get daylight saving time
139 views

Access-Control-Allow-Origin Multiple Origin Domains

In browser’s console get message:
no 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.
PHP source code: put into start of php script

// different DOMAINS
$http_origin = $_SERVER['HTTP_ORIGIN'];
 
if ($http_origin == "http://www.domain1.com" || $http_origin == "http://www.domain2.com" || $http_origin == "http://www.domain3.info")
{  
    header("Access-Control-Allow-Origin: $http_origin");
}
 
// OR different SUBDOMAINS
 $http_origin = $_SERVER['HTTP_ORIGIN']; // e.g. http://bla.yourdomain.com/index.php
 
$pos = strpos($http_origin, ".yourdomain.com");
$dom = ".yourdomain.com";
$le = strlen($dom);
$pos = strpos($http_origin, $dom);
 
if($pos !== false){
	$my_subdomains = substr($http_origin, 0, $pos + $le); // e.g. substr equal http://bla.yourdomain.com
    header("Access-Control-Allow-Origin: $my_subdomains");
}
?>
<!DOCTYPE HTML>
<html>
  <head>
  <meta............... etc.
Posted in PHP | Tagged , | Comments Off on Access-Control-Allow-Origin Multiple Origin Domains
2,345 views

Histogram foto picture smartphone

Very dark picture, in photo editor black remains black
histogram-picture-very-black colored

Very bright picture, in photo editor white will white
histogram-picture-very-bright-picture

Dark picture but the chart is not in black color area – dark shades can be lighten in graphics editor
histogram-picture-diagram

Posted in Android Examples Code, Smartphones | Comments Off on Histogram foto picture smartphone
3,060 views

htaccess code

Change sitemap.txt to sitemap.php if url http://domain.com/sitemap.txt

# http://domain.com/sitemap.txt open sitemap.php
# in sitemap.php is function what return list of address
RewriteRule ^sitemap\.txt$ sitemap.php [L]
RewriteRule ^sitemap$ sitemap.php [L]

Remove www before subdomain name
www.www.subdomain.example.com
to
subdomain.example.com

RewriteCond %{HTTP_HOST} (^|\.)(www\.)([^\.]*)\.example\.com$ [NC]
RewriteRule (.*) http://%3.example.com/$1  [R=301,QSA,L]
Posted in Uncategorized | Tagged | Comments Off on htaccess code
3,986 views

Android Speedometer Tempomat Utility Tools

Speedometer Cruise Control Tempomat – warning sound after exceeded speed limit DOWNLOAD only from PLAY GOOGLE.
Do not set up while driving (To comply with the laws Your country).
1.) Button MILE / KILOMETER change units.
Set up warnings:
2.) Buttons 15 to 130 set up the speed limit.
3.) Button CURRENT SPEED set current speed like the speed limit.
4.) Stop Start the Warning Sound button
5.) Button UNLIMITED set unlimited speed.
6.) Hide/Show unused buttons
The warning sound sounds when the limit is exceeded by 10%.
For example: Limit:70 – warning sound sounds if speed is 77 and more.

speedometer_tempomat_guide_1.png

speedometer_tempomat_guide_2.png

Menu: Edit Warnings
You can to create new location of warning and update this one.

edit_warnings-location.png

Edit warning location – click to new place of map. Edit bearing if it is different from the previous point. Press UPDATE button.

bad-warning-speedometer.png

Create a New Warning
new-warning.png

Speedometer Cruise Control Tempomat – warning sound after exceeded speed limit DOWNLOAD only from PLAY GOOGLE.

Posted in Android Software Download | Tagged | Comments Off on Android Speedometer Tempomat Utility Tools
4,298 views

Android 4.4 Lenovo A6000 black screen

Try reboot device.
Start device with start button on side of phone.
Screen will go to light black color.
Long press Start button for menu:
Power off
Reboot
Airplane mode

Reboot item is in same level like Start button.
Click on the screen – (Hear a click)
Now find OK button , it is under Reboot item on right side of screen.
Press OK (Hear a click)
Wait a moment.
If device to do nothing , try short press Start button (sreen will black)
and again to press Start button. If screen go to light black color,
try again find Reboot item as written above.

Posted in Android Examples Code, Bugs, warnings, errors | Tagged , | Comments Off on Android 4.4 Lenovo A6000 black screen
4,579 views

Android runtime change switch Activity theme

static boolean mbThemeLight = false;
 
 @Override
    public void onCreate(Bundle savedInstanceState) {
         if(mbThemeLight)
        setTheme(android.R.style.Theme_Light);
        super.onCreate(savedInstanceState);
        // bla bla bla..........
    }
 
private void switchTheme(){
 mbThemeLight = true;
 this.recreate();
}
Posted in Android Examples Code, Android Studio | Tagged | Comments Off on Android runtime change switch Activity theme
4,678 views

Expected resource of type raw drawable

Try insert + before R.drawable.xxxx

// error
InputStream is = context.getResources().openRawResource(R.drawable.app_sample_code);
 
// ok
InputStream is = context.getResources().openRawResource(+R.drawable.app_sample_code);
Posted in Android Examples Code, Bitmap, drawing, Bugs, warnings, errors | Comments Off on Expected resource of type raw drawable
5,920 views

Call requires permission which may be rejected by user

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`

 
try {
// your code for example: 
//  LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);         
//  Criteria criteria = new Criteria();
//        provider = locationManager.getBestProvider(criteria, false);
//  locationManager.requestLocationUpdates(provider, 400, 1, this);
        } catch (SecurityException e) {
            e.printStackTrace();
        }
Posted in Android Examples Code, Bugs, warnings, errors | Tagged | Comments Off on Call requires permission which may be rejected by user
5,610 views

Error type 3 Activity class does not exist

Try some solution – each individually or all

  1. Check AndroidManifest.xml activity declaration
    <activity
                android:name=".EnableProfileActivity"
                android:label="@string/app_name" />
  2. Delete BUILD folder in module tree and Clean / Rebuild project
  3. Restart Android Studio
Posted in Bugs, warnings, errors | Tagged , | Comments Off on Error type 3 Activity class does not exist
5,610 views