quarta-feira, 28 de agosto de 2024

PyCharm: Your Python BFF



Ever felt like you're drowning in a sea of Python code? Fear not, my friend, for PyCharm is here to save the day! It's like having a super-powered sidekick that knows Python inside and out. 

So, what makes PyCharm so awesome? 

  • Code Completion: Forget struggling to remember all those Python keywords and functions. PyCharm's code completion feature is like having a personal assistant who knows Python better than you do. Just start typing, and it'll suggest the right code. 
  • Debugging: Debugging can be a pain, but PyCharm makes it a breeze. Set breakpoints, step through your code, and inspect variables with ease. It's like having a detective on your side, helping you track down those pesky bugs. 
  • Refactoring: Need to clean up your code? PyCharm has got you covered. Rename variables, extract methods, and more with just a few clicks. It's like having a professional cleaner for your code. 
  • Plugins: Want to supercharge PyCharm? There's a plugin for that! From version control integration to linting tools, you can customize PyCharm to fit your workflow. It's like adding accessories to your favorite outfit. 
But PyCharm isn't just for coding. It also comes with a bunch of handy features like: 

  • Unit Testing: Write and run tests directly from PyCharm. It's like having a personal QA team. 
  • Remote Development: Work on projects on remote machines without leaving PyCharm. It's like having a teleporter for your code. 
  • Web Development: Build web apps with frameworks like Django and Flask. 

PyCharm has built-in support for these tools, making it a one-stop shop for web development. So, if you're a Python developer looking for a tool that can help you be more productive and write better code, PyCharm is a must-have. It's like having a best friend who's always there to help you out, and who just happens to be really good at Python. 

Give it a try and see for yourself why PyCharm is the ultimate Python IDE.

sábado, 19 de setembro de 2020

PDFsam Basic an open source solution for manipulating pdfs files

pdfsam

Do you work with a lot of pdfs files, do you need to split, merge, extract pages, mix and rotates PDF files? PDFsam Basic is the solution, it is a free, open source, multi-platform software. It is user friendly and available for Mac Os, Linux and Windows for installation. And if your are not able to install software on your companies laptop, because of permissions, you can download the portable version for each of the platform.

pdfsam-merge


sexta-feira, 18 de setembro de 2020

Activate Developer Tab in Excel

Do you need to activate the The Developer tab? 

It  isn't displayed by default, but you can add it to the ribbon.

On the File tab, go to Options > Customize Ribbon.

Under Customize the Ribbon and under Main Tabs, select the Developer check box.


Website login using excel vba

Do you need to constantly login, introduce username and password into a website in order to check updated data? 

For example, if your are working with account receivables, do you need to check your company´s bank accounts to confirm if new deposits are available? And for that you have to input username and password manually every time you go to the bank website? Depending on the bank website, there is a timeout that is applied of 3 or 5 minutes and the website automatically logouts, so if you check the bank website 20 times, you have to input the username and password 20 times manually and it is prone to error. 

To avoid the manual input of the credentials and the potential typing error, you can use excel with vba macro to automate the login process and it is valid for all websites that requires username and password.

Will show an example of login to a account in the Facebook website using excel and vba macro. What the macro does it is to automate the login process: creates a Internet Explorer windows and fills the username and password fields and clicks the login button.

For that, on the Visual Basic window, you need to include some libraries, go to References and select  the following library: "Microsoft Internet Controls"




After including this reference create or copy this procedure on VBA and fill with your username and password.

Sub SearchBotLogin()
    
    'declare an Internet Explorer Object
    Dim objIE As InternetExplorer
    
    'create a new Internet Object
    Set objIE = New InternetExplorer
    
    'Set the Explorer to VIsible
    objIE.Visible = True
    
    'fill the Excel status bar with some progess information
    Application.StatusBar = "Login"
 
    'navigate IE to the web page
    objIE.navigate "https://www.facebook.com/"
 
    'wait here a few seconds while the browser is busy
    Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
 
    'fill the username in the username field id
    objIE.document.getElementById("email").Value = "username"
    
    'wait here a few seconds while the browser is busy
    Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop

    'fill the username in the password field id
    objIE.document.getElementById("pass").Value = "password"
    
    'wait here a few seconds while the browser is busy
    Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
     
    'click the 'Login' button
    objIE.document.getElementById("u_0_f").Click
    
    'wait again for the browser
    Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
     
    'fill the Excel status bar with some progress information
    Application.StatusBar = "Login OK"

End Sub
The elements for username, password and login button can be obtained using the inspection tool on the Internet Explorer


sexta-feira, 28 de março de 2014

IDEs for OpenErp Development

PyCharm IDE seems nice for Openerp development:

  • www.jetbrains.com/pycharm

Please feel free to suggest any other IDE.

sábado, 23 de julho de 2011

VB script to backup and send e-mail

Sometimes there is the need to send regularly to a specific e-mail address\person files with updated data. And most of the times it is done at the end of the day, when all the transaction of the day were recorded and ready to send. It can be quite boring if you do it every day, using for example outlook or the webmail, because the steps are always the same: creating the e-mail, adding the email address zipping the content, attaching the content, writing the subject and the body and sending the e-mail. And if you use webmail there are additional steps of logging on and the file uploading. So why not finding a solution that does this automatically with no human intervention.

And it is possible if we combine windows task manager, some vb script, 7z and a Gmail account. You can download the source code at sendMail. The zip file contains 3 files:
  1. sendMail.vbs - vb script
  2. 7z.exe - program to create the zip file
  3. logs.txt - log file to log the time and the events
Some configuration is needed:

homePath =  "C:\xxx\" 'folder where sendMail.vbs, logs.txt, 7z.exe and created zip files are
dataPath = "C:\xxxx\" ' folder that contains the files to zip
attachFile ="zipFile.ZIP"
'created zip file that will be attached to the e-mail

if zipFile("MAP*.?10") = 0 then ' file name of the file to zip or a wildcard containing the files to zip

For sending the e-mail, configure correctly the following parameters with your Gmail account details:

With objEmail
 .from = "xxx@gmail.com"
 .To = "xxx@gmail.com; xxx@yahoo.com.br" .Subject = "Test Mail" .Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog" 

  .Item (schema & "smtpserver") = "smtp.gmail.com"
  .Item (schema & "sendusername") = "xxx@gmail.com"
  .Item (schema & "smtpaccountname") = "xxx@gmail.com"
  .Item (schema & "sendpassword") ="xxxxxx"

You can test it double clicking on the sendMail.vbs file and checking thee events logged on the logs.txt.

Later I will be explaining how run this file regularly from windows task manager.

PyCharm: Your Python BFF

Ever felt like you're drowning in a sea of Python code? Fear not, my friend, for PyCharm is here to save the day! It's like having a...