Thursday, 31 January 2019

One click open two link

Craete single link for double link. Given code open two link first www.google.com and second www.sakhihosting.in

Just copy and paste this code and replace url link as per your need.

<a href="http://www.google.com" onclick="window.open('http://sakhihosting.in')">Click</a>

 For Demo Click Here 

Thursday, 17 January 2019

How to Make HTML Button Links

This page shows how to make HTML button links with onclick and hrefusing the <form> tag and styling them using CSS into different colors and sizes.


DIRECT VIDEO LINK : https://youtu.be/PKI17ZbO3Gk

One of the easiest ways to make HTML button links is to create a HTML <form> which will automatically generate the button ..
Code - HTML Link Button
<form>
<input type="button" value="Put Your Text Here"onclick="window.location.href='http://www.hyperlinkcode.com/button-links.php'"/>
</form>


While this method is easy because it has minimal code, the button looks a bit plain. It is possible however to make great looking hyperlink buttons by adding CSS code. Keep scrolling to see examples.
This is an example of how to style a button link with inline CSS. The code can be used by directly inserting it into the HTML same as the first example. Change color and other properties as required.

<form>
<input style="width: 300px; padding: 20px; cursor: pointer; box-shadow: 6px 6px 5px; #999; -webkit-box-shadow: 6px 6px 5px #999; -moz-box-shadow: 6px 6px 5px #999; font-weight: bold; background: #ffff00; color: #000; border-radius: 10px; border: 1px solid #999; font-size: 150%;" type="button" value="Put Your Text Here" onclick="window.location.href='http://www.hyperlinkcode.com/button-links.php'" />
</form>

Tip: Visit html-color-names.com or htmlColorCodes.org for matching color palettes.
If more than one styled button is required on the same website, or if you want additional effectssuch as making the color change when the mouse is hovered over the button, it is recommended to use an internal or external stylesheet for faster editing of multiple buttons at once. See example below ..

This button code has a slight but important difference than the other styled button because the class attribute has been added with the value MyButton so it can select the CSS rules from the stylesheet. Change the MyButton values as required.

<form>
<input class="MyButton" type="button" value="Your Text Here"onclick="window.location.href='http://www.hyperlinkcode.com/button-links.php'"/>
</form>

<head>
<style>
input.MyButton {
width: 300px;
padding: 20px;
cursor: pointer;
font-weight: bold;
font-size: 150%;
background: #3366cc;
color: #fff;
border: 1px solid #3366cc;
border-radius: 10px;
}
input.MyButton:hover {
color: #ffff00;
background: #000;
border: 1px solid #fff;
}
</style>
</head>

The above <style> belongs in the <head> section of HTML documents. Change color and other properties as required. This Internal CSS code will style button links only on the page where the code is inserted. If button links are required on multiple pages on the same website, an external stylesheet is recommended. See example below.

<form>
<input class="MyButton" type="button" value="Your Text Here"onclick="window.location.href='http://www.hyperlinkcode.com/button-links.php'"/>
</form>

input.MyButton {
width: 300px;
padding: 20px;
cursor: pointer;
font-weight: bold;
font-size: 150%;
background: #3366cc;
color: #fff;
border: 1px solid #3366cc;
border-radius: 10px;
-moz-box-shadow:: 6px 6px 5px #999;
-webkit-box-shadow:: 6px 6px 5px #999;
box-shadow:: 6px 6px 5px #999;
}
input.MyButton:hover {
color: #ffff00;
background: #000;
border: 1px solid #fff;
}

The above CSS styling rules go into external stylesheets. Change color and other properties as required.

Tuesday, 15 January 2019

Auto Load Page in Div

Auto Load Page in Div via ajax in every 5 seconds ..

create file 
 index.php
<------ code start ------>

<html>  
<head>  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>  
<script>  
setInterval(  
function()  
{  
$('#content').load('load.php');  
}, 3000);  
</script>  
<style>  
#content{  
background-color:#00A1E0;  
font-size:24px;  
font-weight:bold;  
padding-top:10px;  
color:#fff;  
min-height: 200px;  
}  
#content,h1{  
     text-align: center;  
}  
</style>  
<title>Auto Load Page in Div using Jquery</title>  
</head>  
<body>  
<h1>Auto Load Page in Div</h1>  
<div id="content"> Please wait .. </div>  
</body>  
<html> 

<------ code end ------>


load.php

<------ code start ------>

<?php 
echo 'This content is loaded via ajax in every 5 seconds ..';    
?>

<------ code end ------>

Tuesday, 8 January 2019

GPU Programming with Python

In this article, we’ll dive into GPU programming with Python. Using the ease of Python, you can unlock the incredible computing power of your video card’s GPU (graphics processing unit). In this example, we’ll work with NVIDIA’s CUDA library.


Limitations and Benefits of GPU Programming

It’s tempting to think that we can convert any Python program into a GPU-based program, dramatically accelerating its performance. However, the GPU on a video card works considerably differently than a standard CPU in a computer.
CPUs handle a lot of different inputs and outputs and have a wide assortment of instructions for dealing with these situations. They also are responsible for accessing memory, dealing with the system bus, handling protection rings, segmenting, and input/output functionality. They are extreme multitaskers with no specific focus.
GPUs on the other hand are built to process simple functions with blindingly fast speed. To accomplish this, they expect a more uniform state of input and output. By specializing in scalar functions. A scalar function takes one or more inputs but returns only a single output. These values must be types pre-defined by numpy.

Open Notepad++ and copy give code and paste in Notepad++ and save file as gpu.py on Desktop
<<<<< code start >>>>>
import numpy as np
from timeit import default_timer as timer
from numba import vectorize

# This should be a substantially high value. On my test machine, this took
# 33 seconds to run via the CPU and just over 3 seconds on the GPU.
NUM_ELEMENTS = 100000000

# This is the CPU version.
def vector_add_cpu(a, b):
  c = np.zeros(NUM_ELEMENTS, dtype=np.float32)
  for i in range(NUM_ELEMENTS):
    c[i] = a[i] + b[i]
  return c

# This is the GPU version. Note the @vectorize decorator. This tells
# numba to turn this into a GPU vectorized function.
@vectorize(["float32(float32, float32)"], target='cuda')
def vector_add_gpu(a, b):
  return a + b;

def main():
  a_source = np.ones(NUM_ELEMENTS, dtype=np.float32)
  b_source = np.ones(NUM_ELEMENTS, dtype=np.float32)

  # Time the CPU function
  start = timer()
  vector_add_cpu(a_source, b_source)
  vector_add_cpu_time = timer() - start

  # Time the GPU function
  start = timer()
  vector_add_gpu(a_source, b_source)
  vector_add_gpu_time = timer() - start

  # Report times
  print("CPU function took %f seconds." % vector_add_cpu_time)
  print("GPU function took %f seconds." % vector_add_gpu_time)

  return 0

if __name__ == "__main__":

  main()


<<<<< code end >>>>>



Now install Anaconda on your window click here for Anaconda
After installing Anaconda follow given step :
conda update conda
conda install numba
conda install cudatoolkit

cd Desktop
python gpu.py


 NOTE: If you run into issues when running your program, try using “conda install accelerate”.
As you can see, the CPU version runs considerably slower.
If not, then your iterations are too small. Adjust the NUM_ELEMENTS to a larger value (on mine, the breakeven mark seemed to be around 100 million). This is because the setup of the GPU takes a small but noticeable amount of time, so to make the operation worth it, a higher workload is needed. Once you raise it above the threshold for your machine, you’ll notice substantial performance improvements of the GPU version over the CPU version.

For accelerate follow step:

conda create -n cuda
conda activate cuda
conda install accelerate