Friday 15 December 2017

Blink LED Raspbery pi3 (P1)


Welcome to MAC+tech We will Start Programming with raspberry pi..
before the start, we show pin diagram, a previous post we detail about raspberry pi types and various port  Read hare..

Pin Digram :

Image result for raspberry pi 3 pin dig

IMP Pins Means All Are IMP But Most of time use full pins...
_______________________VCC AND GND_________________
pin 1     -3.3v
pin 2,4  -5v
pin 6,9,14,20,25,30,34,39 - GND
---------------------------------------------------------------------------------
________________________CLOCK PIN____________________

pin 7 - GPIO4 (GPIO_GCLK)
----------------------------------------------------------------------------------

---------------------------------------------------------------------------------
Start Raspberry Pi Note :
 1. Bootable Memory card Insert Before Power supply attach .
 2. Not Remove memory card After power on
 3. use standard 5-volt power 
_____________________________________________________

Reured resourcess:
Raspberry pi    :)
LED 
1K register (if avilable) <- optional

Circuit Diagram / Connection :

LED +ve connect to Pin 12 (means Second colum 6 no) ie GPIO 18 
LED -ve Any GND

Program for Blink LED :


######################################

Auther    :  Kishor M Sonawane

#Company:  MAC+tech

#Program  : Blink LED Using Key Bord press 1 to on LED 0 to off LED


import RPi.GPIO as GPIOimport timeGPIO.setmode(GPIO.BCM)

GPIO.setwarnings(False)

GPIO.setup(18,GPIO.OUT)while True:    

kk=input('1 or 0')   

if kk==1:        

    print('LED on')        

    GPIO.output(18,GPIO.HIGH)    

else:

    print('LED off')

    GPIO.output(18,GPIO.LOW)

#######################################


Process /RUN Steps :
Copy Code Save Raspberry Pi Any Directory 
as led.py or any_name.py
 open Terminal (Ctrl+Alt+t) goto Directory Where Program Store.

type n terminal :

$ python led.py
LED on
0
LED off


use Ctrl+c to exit program
*NOTE : we Use Python So indentation very proper single space may be problematic ..


Thank You  

-Kishor M Sonawane




Thursday 31 August 2017

Raspberry Pi Your Pocket Computer

   


         Raspberry pi is a Low Price Computer Device . Raspberry pi Contains RAM,CPU,USB Port, Ethernet, Wifi,Bluetooth etc. available, Price Of Raspberry pi is Near About 2800-3300 In India (Including 18% GST). Latest Version of Raspberry pi is Raspberry pi 3 which Contain Wifi, Bluetooth which is not available model 2 and Other pi models.

Raspberry pi work with Python ...

Sunday 23 July 2017

What is a MAC Address?

What is a MAC Address?

Whether you work in a wired network office or a wireless one, one thing is common for both environments: It takes both network software and hardware (cables, routers, etc.) to transfer data from your computer to another—or from a computer thousands of miles away to yours.
And in the end, to get the data you want right to YOU, it comes down to addresses.
So not surprisingly, along with an IP address (which is networks software), there's also a hardware address. Typically it is tied to a key connection device in your computer called the network interface card, or NIC. The NIC is essentially a computer circuit card that makes it possible for your computer to connect to a network.
An NIC turns data into an electrical signal that can be transmitted over the network.

how to get operating system And Browser information Using PHP


how to get operating system And Browser information Using PHP code..

<?PHP
class OS_BR{

    private $agent = "";
    private $info = array();

    function __construct(){
        $this->agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL;
        $this->get_Browser();
        $this->getOS();
    }

    function get_Browser(){
        $browser = array("Navigator"            => "/Navigator(.*)/i",
                         "Firefox"              => "/Firefox(.*)/i",
                         "Internet Explorer"    => "/MSIE(.*)/i",
                         "Google Chrome"        => "/chrome(.*)/i",
                         "MAXTHON"              => "/MAXTHON(.*)/i",
                         "Opera"                => "/Opera(.*)/i",
                         );
        foreach($browser as $key => $value){
            if(preg_match($value, $this->agent)){
                $this->info = array_merge($this->info,array("Browser" => $key));
                $this->info = array_merge($this->info,array(
                  "Version" => $this->getVersion($key, $value, $this->agent)));
                break;
            }else{
                $this->info = array_merge($this->info,array("Browser" => "UnKnown"));
                $this->info = array_merge($this->info,array("Version" => "UnKnown"));
            }
        }
        return $this->info['Browser'];
    }

    function getOS(){
        $OS = array("Windows"   =>   "/Windows/i",
                    "Linux"     =>   "/Linux/i",
                    "Unix"      =>   "/Unix/i",
                    "Mac"       =>   "/Mac/i"
                    );

        foreach($OS as $key => $value){
            if(preg_match($value, $this->agent)){
                $this->info = array_merge($this->info,array("Operating System" => $key));
                break;
            }
        }
        return $this->info['Operating System'];
    }

    function getVersion($browser, $search, $string){
        $browser = $this->info['Browser'];
        $version = "";
        $browser = strtolower($browser);
        preg_match_all($search,$string,$match);
        switch($browser){
            case "firefox": $version = str_replace("/","",$match[1][0]);
            break;

            case "internet explorer": $version = substr($match[1][0],0,4);
            break;

            case "opera": $version = str_replace("/","",substr($match[1][0],0,5));
            break;

            case "navigator": $version = substr($match[1][0],1,7);
            break;

            case "maxthon": $version = str_replace(")","",$match[1][0]);
            break;

            case "google chrome": $version = substr($match[1][0],1,10);
        }
        return $version;
    }

    function show_Info($switch){
        $switch = strtolower($switch);
        switch($switch){
            case "browser": return $this->info['Browser'];
            break;

            case "os": return $this->info['Operating System'];
            break;

            case "version": return $this->info['Version'];
            break;

            case "all" : return array($this->info["Version"], 
              $this->info['Operating System'], $this->info['Browser']);
            break;

            default: return "Unkonw";
            break;

        }
    }
}

// using
// create an new instant of OS_BR class
$obj = new OS_BR();
// // if you want to show one by one information then try show_Info() function

// get browser
echo $obj->show_Info('browser');

// get browser version
echo $obj->show_Info('version');

// get Operating system
echo $obj->show_Info('os');

// get all information and it returns an array
echo "<pre>".print_r($obj->show_Info("all"),true)."</pre>";
?>  


- MAC+tech

Friday 21 July 2017

Removing a virus without using any anti-virus software

Virus is a computer program that can copy itself and infect computers.
The term "virus" is erroneously used to refer to other types of malware, including adware and spyware programs that do not have the reproductive ability.
A true virus can spread from one computer to another (in some form of executable code).
One of the ways by which a virus can infect your PC is through USB/Flash drives.
Common viruses such as 'Ravmon' , 'New Folder.exe', 'Orkut is banned' are spreading through USB drive .
Most anti virus programs are unable to detect them and even if they do, in most cases they are unable
to delete the file, only quarantine it.So in our post we use command prompt to remove harmful files that
any anti-virus can't.

Wednesday 28 June 2017

Loading bar using c++


Loading Bar using c++

#include "iostream.h"
#include "conio.h"
#include "graphics.h"
#include "dos.h"
void main()
{
int x=170,i,gdriver=DETECT,gmode;
initgraph(&amp;gdriver,&amp;gmode,”c:\tc\bgi”);
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(170,180,”LOADING,PLEASE WAIT”);

for(i=0;i&lt;300;++i)
{
delay(30);
line(x,200,x,220);
x++;
}
getch();
closegraph();
}

Monday 26 June 2017

Append file using VB6



Add lines of text to a file

Private Sub Form_Load()
'Replace 'c:\test.txt' with the name of the file you want to edit.
Open "c:\test.txt" For Append As #1
'Replace 'new line added' with the line you want to insert to the file.
Print #1, "new line added"
Close #1
End Sub



-KISHOR M SONAWANE
 code for HAL

change ip address using vb 6

  1. Private Sub Command1_Click()
  2.     Dim ret As String
  3.     ret = SetStaticIp("192.168.0.2", "255.255.255.0", "192.168.0.1")
  4.     Debug.Print ret
  5. End Sub
  6.  
  7. Public Function SetStaticIp(ByVal pIPAddress As String, _
  8.                             ByVal pSubnet As String, _
  9.                             ByVal pGateway As String, _
  10.                             Optional ByVal pDNS1 As String, _
  11.                             Optional ByVal pDNS2 As String) _
  12.                             As String
  13.                            
  14.     Dim objWMIService       As Object
  15.     Dim colNetAdapters      As Object
  16.     Dim objNetAdapter       As Object
  17.     Dim strSelect           As String
  18.     Dim strIPAddress        As String
  19.     Dim strSubnet           As String
  20.     Dim strGateway          As String
  21.     Dim strDns1             As String
  22.     Dim strDns2             As String
  23.     Dim varIPAddress        As Variant
  24.     Dim varSubnet           As Variant
  25.     Dim varGateway          As Variant
  26.     Dim varGatewaymetric    As Variant
  27.     Dim varDns              As Variant
  28.     Dim lngEnable           As Long
  29.     Dim lngGateways         As Long
  30.     Dim lngDns              As Long
  31.     Dim blnDns              As Boolean
  32.    
  33.     On Error GoTo Error_Handler
  34.  
  35.     blnDns = True
  36.     Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  37.     strSelect = "Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE"
  38.     Set colNetAdapters = objWMIService.ExecQuery(strSelect)
  39.    
  40.     strIPAddress = Trim$(pIPAddress)
  41.     strSubnet = Trim$(pSubnet)
  42.     strGateway = Trim$(pGateway)
  43.    
  44.     If Not IsMissing(pDNS1) Then
  45.         strDns1 = Trim$(pDNS1)
  46.     End If
  47.     If Not IsMissing(pDNS2) Then
  48.         strDns2 = Trim$(pDNS2)
  49.     End If
  50.    
  51.     varIPAddress = Array("" & strIPAddress & "")
  52.     varSubnet = Array("" & strSubnet & "")
  53.     varGateway = Array("" & strGateway & "")
  54.     varGatewaymetric = Array(1)
  55.    
  56.     If Len(strDns1) = 0 Then
  57.         If Len(strDns2) = 0 Then
  58.             blnDns = False
  59.             varDns = ""
  60.         Else
  61.             varDns = Array("" & strDns2 & "")
  62.         End If
  63.     Else
  64.         If Len(strDns2) = 0 Then
  65.             varDns = Array("" & strDns1 & "")
  66.         Else
  67.             varDns = Array("" & strDns1 & "", "" & strDns2 & "")
  68.         End If
  69.     End If
  70.    
  71.     For Each objNetAdapter In colNetAdapters
  72.         lngEnable = objNetAdapter.EnableStatic(varIPAddress, varSubnet)
  73.         lngGateways = objNetAdapter.SetGateways(varGateway, varGatewaymetric)
  74.         If blnDns = True Then
  75.             lngDns = objNetAdapter.SetDNSServerSearchOrder(varDns)
  76.         Else
  77.             lngDns = objNetAdapter.SetDNSServerSearchOrder()
  78.         End If
  79.     Next
  80.    
  81.     If lngEnable > 1 Then
  82.         SetStaticIp = NetworkResults(lngEnable)
  83.     ElseIf lngGateways > 1 Then
  84.         SetStaticIp = NetworkResults(lngGateways)
  85.     ElseIf lngDns > 1 Then
  86.         If lngDns = 70 Then
  87.             SetStaticIp = "Invalid DNS Address"
  88.         Else
  89.             SetStaticIp = NetworkResults(lngDns)
  90.         End If
  91.     Else
  92.         SetStaticIp = NetworkResults(lngEnable)
  93.     End If
  94.    
  95. Error_Handler:
  96.     Set colNetAdapters = Nothing
  97.     Set objWMIService = Nothing
  98.     Set objNetAdapter = Nothing
  99.     If Err <> 0 Then _
  100.     SetStaticIp = "Error. " & Err.Description
  101. End Function
  102.  
  103. Public Function NetworkResults(ByVal pNumber As Integer)
  104.     Dim sResults As String
  105.     Select Case pNumber
  106.         Case 0: sResults = "Success, No Reboot Required"
  107.         Case 1: sResults = "Success, Reboot Required"
  108.         Case 64: sResults = "Method Not Supported"
  109.         Case 65: sResults = "Unknown Failure"
  110.         Case 66: sResults = "Invalid Subnet Mask"
  111.         Case 67: sResults = "Processing Error"
  112.         Case 68: sResults = "Invalid Input"
  113.         Case 69: sResults = "Gateways Limit Error"
  114.         Case 70: sResults = "Invalid IP address"
  115.         Case 71: sResults = "Invalid Gateway Address"
  116.         Case 72: sResults = "Registry Access Error"
  117.         Case 73: sResults = "Invalid Domain Name"
  118.         Case 74: sResults = "Invalid Host Name"
  119.         Case 75: sResults = "No WINS Server Defined"
  120.         Case 76: sResults = "Invalid File"
  121.         Case 77: sResults = "Invalid System Path"
  122.         Case 78: sResults = "File Copy Failed"
  123.         Case 79: sResults = "Invalid Security Parameter"
  124.         Case 80: sResults = "Unable to Configure TCP/IP"
  125.         Case 81: sResults = "Unable to Configure DHCP"
  126.         Case 82: sResults = "Unable to Renew DHCP"
  127.         Case 83: sResults = "Unable to Release DHCP"
  128.         Case 84: sResults = "IP Not Enabled On Adapter"
  129.         Case 85: sResults = "IPX Not Enabled On Adapter"
  130.         Case 86: sResults = "Frame/Network Error"
  131.         Case 87: sResults = "Invalid Frame Type"
  132.         Case 88: sResults = "Invalid Network Number"
  133.         Case 89: sResults = "Duplicate Network Number"
  134.         Case 90: sResults = "Parameter Out Of Bounds"
  135.         Case 91: sResults = "Access Denied"
  136.         Case 92: sResults = "Out Of Memory"
  137.         Case 93: sResults = "Already Exists"
  138.         Case 94: sResults = "Path, File, or Object Not Found"
  139.         Case 95: sResults = "Unable To Notify Service"
  140.         Case 96: sResults = "Unable To Notify DNS Service"
  141.         Case 97: sResults = "Interface Not Configurable"
  142.         Case 98: sResults = "Not All DHCP Released/Renewed"
  143.         Case 100: sResults = "DHCP Not Enabled On Adapter"
  144.     End Select
  145.     NetworkResults = sResults
  146. End Function

Saturday 24 June 2017

how to Call jiofi using computer/pc/ laptop

 All of Know jiofi and how it work . i share this post how to Call jiofi using computer/ pc / laptop

 Using Mobile:
 The JIO4GVoice is free android And iOS app & you can download  from Google Play store or Apple Apps.

Using PC:

Step 1>> Download BlueStack Software  for Computer and install it..
                  click here to Download..
Image result for bluestacks
             [Bluestacks is an American technology company that produces the BlueStacks App Player 
                 and other cloud-based cross-platform products.  Read more>>> Wikipedia ]

Step 2>> download  JIO4GVoice (android) using BlueStack or JIO4GVoice.apk(direct).
Image result for jio4gvoice


Step 3>> Register Same As Android/ iOS JIO4GVoice , Free Call And Enjoy. :)
Image result for jio4gvoice registration


-KIshor M Sonawane 

How to delete duplicate records from a SQL data table

  introduction How to delete duplicate records from a SQL data table using CTE (common table expression). Specifies a temporary named result...