Encode and Decode UUEncode Files Using Python

Pradeep Elance
Updated on 28-Dec-2020 10:57:25

1K+ Views

It is a common requirement during file transfers to encode and decode them for various reasons like encryption, compression or just because they are going to be processed by different OS or file reading programs. The uuencode module helps us on both encoding and decoding files as shown below.Encode the fileWe will use the below image for encoding and later decoding it to get it back.In the below program we use the encode function to encode the given image and read the content of the file after encoding.Exampleimport uu infile = "E:\tp_logo.JPG" uu.encode(infile, 'encoded_logo.JPG') f = open("E:\TP\encoded_logo.JPG", 'r') ... Read More

Encode and Decode MIME Quoted-Printable Data Using Python

Pradeep Elance
Updated on 28-Dec-2020 10:55:16

2K+ Views

Many times we need to deal with data which not always has the regular ASCII characters. For example, an email in a different language other than English. Python has mechanism to deal with such characters by using MIME (Multipurpose Internet Mail Extensions) based module. In this article we will see how we can decode such characters in an email or otherwise in some straight inputs.Using email packageThe email package has modules namely mime and charset which can carry out the encoding and decoding work as shown in the below example. We have taken an email message containing Unicode characters and ... Read More

Button Action in Kivy

Pradeep Elance
Updated on 28-Dec-2020 10:53:23

602 Views

Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use events when a button is pressed.In the below example we have created a button and a label in a horizontal BoxLayout. We give initial text to the button and label. Then we create an event for clicking the button which changes the text both in the button and in the label. It is a single ... Read More

Python BoxLayout Widget in Kivy

Pradeep Elance
Updated on 28-Dec-2020 10:51:13

723 Views

Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use the BoxLayout widget to create buttons of different orientation and colours.In the below code we first create an outer box whose orientation is vertical. Then we create a row 1 with horizontal orientation. Then two other rows again with vertical orientation. We wrap all these rows in the outer box and giver different text and ... Read More

AnchorLayout in Kivy

Pradeep Elance
Updated on 28-Dec-2020 10:47:44

654 Views

Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. It is used to develop the Android application, as well as Desktops applications. In this article we will see how to use the anchor layout positioning.Using AnchorLayouts we place the widgets at one of the borders. The class kivy.uix.anchorlayout.AnchorLayout implements the anchor layout. Both the anchor_x parameter and anchor_y parameter can be passed the values ‘left’, ‘right’ and ‘center’. In the below program we create two buttons, attach them to two anchors and keep them in a ... Read More

Convert List of Nested Dictionary into Pandas DataFrame

Pradeep Elance
Updated on 28-Dec-2020 10:39:57

5K+ Views

Many times python will receive data from various sources which can be in different formats like csv, JSON etc which can be converted to python list or dictionaries etc. But to apply the calculations or analysis using packages like pandas, we need to convert this data into a dataframes. In this article we will see how we can convert a given python list whose elements are a nested dictionary, into a pandas Datframe.We first take the list of nested dictionary and extract the rows of data from it. Then we create another for loop to append the rows into the ... Read More

Check If Computer is Connected to a Domain Using PowerShell

Chirag Nagrekar
Updated on 28-Dec-2020 07:03:41

16K+ Views

To check if a computer is connected to any domain we can use multiple methods. In this article, we can use two methods. One using the System Information of the computer and the second using the DirectoryServices .Net Class.First method using System Information and filter out a string called “Domain” which shows us if the computer is in the domain or the workgroup.systeminfo | findstr "Domain"OutputIf the computer is in the workgroup, It will show the workgroup name. For example, In the second method, we will use the directory service .Net class method name GetComputerDomain(). If the server is not connected to the ... Read More

Remove Computer from AD Domain Using PowerShell

Chirag Nagrekar
Updated on 28-Dec-2020 07:01:58

3K+ Views

To remove the computer from the domain we need to use the Remove-Computer command.Remove-Computer -ComputerName Test1-win2k16 `                 -UnjoinDomainCredential Labdomain\Administrator `                 -WorkgroupName WG -Restart -Force -PassThruIn the above example, the Computer name Test1-Win2k16 is going to remove from the domain with the domain credentials and it will be joined to WorkGroup named WG. If the system doesn’t restart due to any reason, you need to reboot the system manually.Here the computer name is the String[]. So you can provide multiple computers to remove from the domain. For example, Remove-Computer -ComputerName Test1-win2k16, ... Read More

Join Computer to AD Domain Using PowerShell

Chirag Nagrekar
Updated on 28-Dec-2020 07:00:56

2K+ Views

To join any workgroup computer in the domain using PowerShell, we can use the Add-Computer command but before that, there are a few Windows prerequisite that DNS must be configured properly and the domain controller should be reachable and others should suffice then only PowerShell can use the command to join computer into a domain.Add-Computer -ComputerName Test1-win2k16 `              -DomainCredential Labdomain\Administrator `              -DomainName Labdomain.local -Restart -Force -PassThruOnce you run the above command, it will ask you for the credential for the user you entered. In the above example, we are joining a ... Read More

Create a Scheduled Task with Task Scheduler Using PowerShell

Chirag Nagrekar
Updated on 28-Dec-2020 06:59:47

752 Views

To create a task using GUI (As shown below image) we need a few settings like the Name of the task, trigger, and Action.Similarly, to create a new task in task scheduler using PowerShell comprises of several settings.Name of the taskThe time when the task to triggerAction − Do we need to schedule a program for execution or send an email on some event trigger.Description − This is optional. You can add a description of the task.Registering task − Final step is to register the created task.Above all actions use different cmdlets but they are part of a ScheduledTasks module. To ... Read More

Advertisements