id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
11,300 | calculate the cube of the given number cube is cube is cube is cube is cube is total time taken by threads is creating thread threads in python are an entity within process that can be scheduled for execution in simpler wordsa thread is computation process that is to be performed by computer it is sequence of such inst... |
11,301 | outputgfg idol exit creating python threads using functionthe below code shows the creation of new thread using functionexamplefrom threading import thread from time import sleep function to create threads def threaded_function(arg)for in range(arg)print("running"wait sec in between each thread sleep( if __name__ ="__m... |
11,302 | function as its target then we used start(method to start the python thread synchronizing threads the threading module provided with python includes simple-toimplement locking mechanism that allows you to synchronize threads new lock is created by calling the lock(methodwhich returns the new lock the acquire(blockingme... |
11,303 | threads [create new threads thread mythread( "thread- " thread mythread( "thread- " start new threads thread start(thread start(add threads to thread list threads append(thread threads append(thread wait for all threads to complete for in threadst join(print "exiting main threadwhen the above code is executedit produce... |
11,304 | it returns boolean value depending upon whether the queue is full or not priority queue is an extension of the queue with the following propertiesan element with high priority is dequeued before an element with low priority if two elements have the same prioritythey are served according to their order in the queue belo... |
11,305 | workqueue queue queue( threads [threadid create new threads for thread_name in thread_listthread sample_thread(threadidthread_nameworkqueuethread start(threads append(threadthreadid + fill the queue queuelock acquire(for items in name_listworkqueue put(itemsqueuelock release(wait for the queue to empty while not workqu... |
11,306 | multithreading can significantly improve the speed of computation on multiprocessor or multi-core systems because each processor or core handles separate thread concurrently multithreading allows program to remain responsive while one thread waits for inputand another runs gui at the same time this statement holds true... |
11,307 | unit end exercise explain the differences between multithreading and multiprocessing explain different types of multithreading explain different types of thread states explain the wait (and sleep (methods explain different methods for threads**** |
11,308 | module unit structure objectives introduction importing module creating and exploring modules math module random module time module summary bibliography unit end exercise objectives modules are simply 'program logicor 'python scriptthat can be used for variety of applications or functions we can declare functionsclasse... |
11,309 | import in python is similar to #include header_file in / +python modules can get access to code from another module by importing the file/function using import the import statement is the most common way of invoking the import machinerybut it is not the only way import module_namewhen the import is usedit searches for ... |
11,310 | from math import print(piprint(factorial( )output as said above import uses __import__(to search for the moduleand if not foundit would raise importerror exampleimport mathematics print(mathematics pioutputtraceback (most recent call last)file " :/users/gfg/tuples/xxx py"line in import mathematics importerrorno module ... |
11,311 | named example the function takes in two numbers and returns their sum importing moduleswe can import the definitions inside module to another module or the interactive interpreter in python we use the import keyword to do this to import our previously defined module examplewe type the following in the python prompt imp... |
11,312 | some output when run as scriptmod py "if comrade napoleon says itit must be right [ def foo(arg)print( 'arg {arg}'class foopass print(sprint(afoo('quux' foo(print(xnow it should be little more interestingc:\users\john\documents>python mod py if comrade napoleon says itit must be right [ arg quux unfortunatelynow it als... |
11,313 | pass if (__name__ ='__main__')print('executing as standalone script'print(sprint(afoo('quux' foo(print(xnowif you run as scriptyou get outputc:\users\john\documents>python mod py executing as standalone script if comrade napoleon says itit must be right [ arg quux math module python math module is defined as the most f... |
11,314 | called the standard logarithm example import math = small value of of print('log (xis :'math log ( )outputlog (xis math exp(this method returns floating-point number after raising to the given number example import math number - small value of of print('the given number (xis :'numberprint(' ^ (using exp(functionis :'ma... |
11,315 | the floor value is math ceil(xthis method returns the ceil value of the it returns the greater than or equal value to import math number math ceil( print("the floor value is:",numberoutputthe floor value is math fabs(xthis method returns the absolute value of import math number math fabs( print("the floor absolute is:"... |
11,316 | the python random module functions depend on pseudorandom number generator function random()which generates the float number between and there are different types of functions used in random module which is given belowrandom random(this function generates random float number between and random randint(this function ret... |
11,317 | random number from range is random seed(this function is used to apply on the particular random number with the seed argument it returns the mapper value consider the following example importing "randommodule import random using random(to generate random number between and print("the random number between and is "end="... |
11,318 | time(and gmtime(importing "timemodule for time operations import time using time(to display time since epoch print ("seconds elapsed since the epoch are ",end=""print (time time()using gmtime(to return the time attribute structure print ("time calculated acc to given seconds is "print (time gmtime()outputseconds elapse... |
11,319 | python code to demonstrate the working of sleep(importing "timemodule for time operations import time using ctime(to show present time print ("start execution ",end=""print (time ctime()using sleep(to hault execution time sleep( using ctime(to show present time print ("stop execution ",end=""print (time ctime()python p... |
11,320 | explain the concept of module in detail with examples write python code to execute module as script explain the dir function in details what is packagewrite python code to create package of fruit and create two modules apple and orange in it and it contains apple and orange classes respectively create test script py fi... |
11,321 | creating the gui form and adding widgets unit structure objectives introduction widgets label button entry textbox combobox check button radio button scroll bar list box menubutton spin box paned window tk message box summary questions references objectives at the end of this unitthe student will able to design gui for... |
11,322 | must be above to run tkinter properly next download the python ide known as pycharm from the link given- download pycharm community version for trial of days once the download is completerun the exe for install pycharm the setup wizard should have started click next as shown in figure below on the next screenchange the... |
11,323 | click on "next choose the start menu folder keep selected jetbrains and click on "install |
11,324 | once installation finishedyou should receive message screen that pycharm is installed if you want to go ahead and run itclick the "run pycharm community editionbox first and click finish |
11,325 | an empty tkinter top-level window can be created by using the following steps import the tkinter module create the main application window add the widgets like labelsbuttonsframes etc to the window call the main event loop so that the actions can take place on the users computer screen |
11,326 | there are various widgets like buttoncanvascheck buttonentry etc that are used to build the python gui application label label is text used to display some message or information about the other widgets syntax wlabel(master,options list of option are as follows sr no option anchor description it specifies the exact pos... |
11,327 | underline we can display line under the specified letter of the text set this option to the number of the letter under which the line will be displayed width the width of the widget it is specified as the number of characters wraplength instead of having only one line as the label textwe can break it to the number of l... |
11,328 | option activebackground activeforeground bd bg command fg font height highlightcolor image justify padx pady relief state underline width wraplength description it represents the background of the button when the mouse hover the button it represents the font color of the button when the mouse hover the button it repres... |
11,329 | import tkinter as tk from tkinter import ttk #create instance win=tk tk(#adding label that will get modified a_label=ttk label(win,text=" label"a_label grid(column= ,row= #button click event function def click_me()action configure(text="* have been clicked**"a_label configure(foreground='red'a_label configure(text=' re... |
11,330 | cursor the mouse pointer will be changed to the cursor type set to the arrowdot etc exportselection the text written inside the entry box will be automatically copied to the clipboard by default we can set the exportselection to to not copy this fg it represents the color of the text font it represents the font type of... |
11,331 | import tkinter from tkinter #create win=tk tk(#modified button def action configure(text='hello#changing ttk label(win,text="enter as import tk ttk instance click function click_me()+name get()our label name:"grid(column= ,row= #adding text box entry widget name=tk stringvar(name_entered=ttk entry(win,width= ,textvaria... |
11,332 | fig output of combobox checkbutton the checkbutton is used to display the checkbutton on the window it is used to track the user' choices provided to the application in other wordswe can say that checkbutton is used to implement the on/off selections the checkbutton can obtain the text or images the checkbutton is most... |
11,333 | wraplength if this option is set to an integer numberthe text will be broken in to the number of pieces code snippetoutputfig output of checkbutton radio button the radiobutton is different from checkbutton here the user is provided with various options and the user can select only one option among them it is used to i... |
11,334 | the list of possible options given below sr no option command cursor font fg height highlightcolor state text textvariable value description this option is set to the procedure which must be called every-time when the state of the radiobutton is changed the mouse pointer is changed to the specified cursor type it can b... |
11,335 | lbl pack( radiobutton(toptext=" "variable=radiovalue= command=selectionr packanchor radiobutton(toptext=" ++"variable=radiovalue= command=selectionr packanchor radiobutton(toptext="java"variable=radiovalue= command=selectionr packanchor wlabel label(toplabel pack(top mainloop(outputfig output of radiobutton scrollbar i... |
11,336 | option orient description it can be set to horizontal or vertical depending upon the orientation of the scrollbar jump it is used to control the behavior of the scroll jump if it set to then the callback is called when the user releases the mouse button repeatdelay this option tells the duration up to which the button ... |
11,337 | the listbox widget is used to display list of options to the user it is used to display the list items to the user we can place only text items in the listbox and all text items contain the same font and color the user can choose one or more items from the list depending upon the configuration the syntax to use the lis... |
11,338 | listbox pack(btn pack(top mainloop(output fig listbox button output fig after pressing delete button-output menubutton the menubutton is used to display the menu items to the user |
11,339 | the time it is used to provide the user option to select the appropriate choice exist within the application the menubutton is used to implement various types of menus in the python application menu is associated with the menubutton that can display the choices of the menubutton when clicked by the user the syntax to u... |
11,340 | it is an entry widget used to select from options of values the spinbox widget is an alternative to the entry widget it provides the range of values to the userout of whichthe user can select the one it is used in the case where user is given some fixed number of values to choose from we can use various options with th... |
11,341 | it is like container widget that contains horizontal or vertical panes the panedwindow widget acts like container widget which contains one or more child widgets (panesarranged horizontally or vertically the child panes can be resized by the userby moving the separator lines known as sashes by using the mouse each pane... |
11,342 | this module is used to display the message-box in the desktop based applications the messagebox module is used to display the message boxes in the python applications there are the various functions which are used to display the relevant messages depending upon the application requirements the syntax to use the message... |
11,343 | in this we discussed about various widgets used in python for handling gui in python programming this also revising the concept of each widget with its syntaxoptionsmethodscode and output in this one section is briefed about installation of pycharm required to handle the python tkinter for gui purpose questions design ... |
11,344 | layout management look feel customization unit structure objectives introduction layout management-designing gui application with proper layout management features look feel customizationenhancing look feel of gui using different appearances of widgets summary questions references objectives at the end of this unitthe ... |
11,345 | application with proper layout management features arranging several labels within label frame widget the labelframe widget allows us to design our gui in an organized fashion we are still using the grid layout manager as our main layout design toolbut by using labelframe widgetswill get much more control over our gui ... |
11,346 | using padding to add space around widgets the procedural way of adding space around widgets is shown here and then use of loop is done to achieve the same thing in much better way buttons_frame grid(column= ,row= ,padx= ,pady= )with this statement labelframe gets some breathing space fig labelframe output in tkinteradd... |
11,347 | fig label frame widget with space the grid_configure(function enables us to modify the ui elements before the main loop displays them soinstead of hardcoding values when we first create widgetwe can work on our layout and then arrange spacing towards the end of our filejust before the gui is created the winfo_children(... |
11,348 | row col row col row col row col row col using the grid layout managerwhat happens is that the width of any given column is determined by the longest name or widget in that column this affects all the rows by adding our labelframe widget and giving it title that is longer than some hardcoded size widgetsuch as the top-l... |
11,349 | reference to our main gui tkinter window framemighty is the variable that holds reference to our labelframe and is child of the main window frame (win)and label and all other widgets are now placed into the labelframe container (mightynextwe will modify the following controls to use mighty as the parentreplacing win he... |
11,350 | we have to import the menu class from tkinter add the following line of code to the top of the python modulewhere the import statement live as shown below in pseudocode nextwe will create the menu baradd the following code towards the bottom of the modulejust above where we create the main event loop in order to make a... |
11,351 | nextwe will add help functionalities to our existing menu |
11,352 | nextwe will add menu bar exit functionalities creating tabbed widgets we will create tabbed widgets to further organize our expanding gui written in tkinter pseudocode for same |
11,353 | using the grid layout manager the grid layout manager is one of the most useful layout tools pseudocode to add grid layout in any python gui code tkinter automatically adds the missing row where we did not specify any particular row look feel customizationenhancing look feel of gui using different appearances of widget... |
11,354 | help menu fig help message box nexttransform the above code in to warning message box pop-up windowinstead fig warning message next we will add error message code to show error message box |
11,355 | how to create independent message boxes we will create out tkinter message boxes as stand-alone top-level gui windows sowhy would we wish to create an independent message boxone reason is that we might customize our message boxes and reuse them in several of our guis instead of having to copy and paste the same code in... |
11,356 | in code how to create the title of tkinter window form the principle of changing the title of tkinter main root window is the same as what discussed in topic presented above here we create the main root window and give it title fig gui title changing the icon of the main root window we will use an icon that ships with ... |
11,357 | we will use spinbox widget and we will also bind the enter key on the keyboard to one of our widget we will use tabbed gui code and will add further spinbox widget above the scrolledtext control this simply requires us to increment the scrolledtext row value by one and to insert our new spinbox control in the row above... |
11,358 | short-hand notation for the borderwidth property spin=spinbox(mightyfrom= to= ,width- bd= fig spin box with border herewe add functionality to the widget by creating callback and linking it to the control fig spinbox with small borderwidth instead of using rangewe can also specify set of values |
11,359 | reliefsunken and raised appearance of widgets we can control the appearance of our spinbox widgets by using property that makes them appear in different sunken or raised formats we will add one more spinbox control to demonstrate the available appearance of widgets using the relief property of the spinbox control fig t... |
11,360 | tk sunken tk raised tk flat tk groove tk ridge by assigning the different available options to the relief propertywe can create different appearances for this widget assigning the tk ridge relief and reducing the border width to the same value as our first spinbox widget results in the following gui fig spinbox with tw... |
11,361 | new class in our python module python allows us to place more than one class in to same pyhton module and it also enables us to mix-and-match classes and regular functions in the same module in our tooltip codewe declare python class and explicitly make it inherit from objectwhich is the foundation of all python classe... |
11,362 | adding progressbar to the gui progressbar is typically used to show the current status of longrunning process add four buttons in to label frame and set the label frame text property to progressbar we connect each of our four new buttons to new callback functionwhich we assign to their command property |
11,363 | how to use the canvas widgetfirstwe will create third tab in our gui in order to isolate our new code here is the code to create the new third tab nextwe use another built-in widget of tkinter:canvas lot of people like this widget as it has powerful capabilities |
11,364 | summary in this we discuss how to add messageboxtooltipprogress bargrid layout and other layout management and customized gui features codes for every widget is covered with output questions design calculator with proper grid layout change the title of main screen write small code for that discuss how to change the bor... |
11,365 | storing data in our mysql database via our gui unit structure objectives introduction connecting to mysql database from python configuring the mysql connectiondesigning the python gui database using the insert command using the update command using the delete command storing and retrieving data from mysql database summ... |
11,366 | four basic sql commands and stands for create readupdateand delete connecting to mysql database from python before we can connect to mysql databasewe have to connect to the mysql server in order to do thiswe need to know the ip address of the mysql server as well as the port it is listening on we also have to be regist... |
11,367 | the consolethen we are good if you are not able to connect to the mysql serverthen something probably went wrong during the installation if this is the casetry uninstalling mysqlreboot your pcand then run the mysql installation again double-check that you downloaded the mysql installer to match your version of python i... |
11,368 | designing the python gui database we used the shortest way to connect to mysql server by hardcoding the credentials required for authentication into the connection method while this is fast approach for early developmentwe definitely do not want to expose our mysql server credentials to anybody unless we grant permissi... |
11,369 | print(conn this results in the same successful connection to the mysql serverbut the difference is that the connection method no longer exposes any mission-critical information nowplacing the same usernamepassworddatabaseand so on into dictionary in the same python module does not eliminate the risk of having the crede... |
11,370 | itself we wrap the python code into tary except block and use the built-in error codes of mysql to tell us if anything went wrong we can verify that this block works by executing the database-creating code twice the first timeit will create new database in mysqland the second time it will print out an error message sta... |
11,371 | try dbs cur execute("show databases" except myconn rollback( for in cur print( myconn close(output fig already existing output import mysql connector #create the connection object myconn mysql connector connect(host "localhost"user "root", asswd "google" #creating the cursor object cur myconn cursor( try #creating new ... |
11,372 | print( myconn close(outputfig created new database creating the table we will create the new table employee we have to mention the database name while establishing the connection object we can create the new table by using the create table statement of sql in our database pythondbthe table employee will have the four c... |
11,373 | myconn rollback( myconn close(fig output of create table insert operation the insert into statement is used to add record to the table in pythonwe can mention the format specifier (%sin place of values we provide the actual values in the form of tuple in the execute(method of the cursor consider the following example i... |
11,374 | try #inserting the values into the table cur execute(sql,val #commit the transaction myconn commit( except myconn rollback( print(cur rowcount,"record inserted!" myconn close(fig insert operation output insert multiple rows we can also insert multiple rows at once using the python script the multiple rows are mentioned... |
11,375 | part fundamentals of deep learning what is deep learning before we beginthe mathematical building blocks of neural networks getting started with neural networks fundamentals of machine learning part deep learning in practice deep learning for computer vision deep learning for text and sequences advanced deep-learning b... |
11,376 | |
11,377 | preface xiii acknowledgments xv about this book xvi about the author xx about the cover xxi part fundamentals of deep learning is deep learning what artificial intelligencemachine learningand deep learning artificial intelligence machine learning learning representations from data the "deepin deep learning understandin... |
11,378 | contents why deep learningwhy now hardware data algorithms new wave of investment the democratization of deep learning will it last we beginthe mathematical building blocks of before neural networks first look at neural network data representations for neural networks scalars ( tensors vectors ( tensors matrices ( tens... |
11,379 | contents running deep-learning jobs in the cloudpros and cons what is the best gpu for deep learning classifying movie reviewsa binary classification example the imdb dataset preparing the data building your network validating your approach using trained network to generate predictions on new data further experiments w... |
11,380 | contents evaluation protocol preparing your data developing model that does better than baseline scaling updeveloping model that overfits regularizing your model and tuning your hyperparameters part summary deep learning in practice learning for computer vision deep introduction to convnets the convolution operation op... |
11,381 | contents to fight overfitting stacking recurrent layers using bidirectional rnns going even further wrapping up sequence processing with convnets understanding convolution for sequence data pooling for sequence data implementing convnet combining cnns and rnns to process long sequences wrapping up summary deep-learning... |
11,382 | contents generating images with variational autoencoders sampling from latent spaces of images concept vectors for image editing variational autoencoders wrapping up introduction to generative adversarial networks schematic gan implementation bag of tricks the generator the discriminator the adversarial network how to ... |
11,383 | if you've picked up this bookyou're probably aware of the extraordinary progress that deep learning has represented for the field of artificial intelligence in the recent past in mere five yearswe've gone from near-unusable image recognition and speech transcriptionto superhuman performance on these tasks the consequen... |
11,384 | preface simultaneously cover fundamentals of deep learningkeras usage patternsand deeplearning best practices this book is my best effort to produce such course wrote it with focus on making the concepts behind deep learningand their implementationas approachable as possible doing so didn' require me to dumb down anyth... |
11,385 | ' like to thank the keras community for making this book possible keras has grown to have hundreds of open source contributors and more than , users your contributions and feedback have turned keras into what it is today ' also like to thank google for backing the keras project it has been fantastic to see keras adopte... |
11,386 | this book was written for anyone who wishes to explore deep learning from scratch or broaden their understanding of deep learning whether you're practicing machine-learning engineera software developeror college studentyou'll find value in these pages this book offers practicalhands-on exploration of deep learning it a... |
11,387 | xvii who should read this book this book is written for people with python programming experience who want to get started with machine learning and deep learning but this book can also be valuable to many different types of readersif you're data scientist familiar with machine learningthis book will provide you with so... |
11,388 | about this book networks to handle classification and regression tasksand you'll have solid idea of what' happening in the background as you train them explores the canonical machine-learning workflow you'll also learn about common pitfalls and their solutions part takes an in-depth dive into practical applications of ... |
11,389 | xix book forum purchase of deep learning with python includes free access to private web forum run by manning publications where you can make comments about the bookask technical questionsand receive help from the author and from other users to access the forumgo to learn more about manning' forums and the rules of con... |
11,390 | francois chollet works on deep learning at google in mountain viewca he is the creator of the keras deep-learning libraryas well as contributor to the tensorflow machinelearning framework he also does deep-learning researchwith focus on computer vision and the application of machine learning to formal reasoning his pap... |
11,391 | the figure on the cover of deep learning with python is captioned "habit of persian lady in the illustration is taken from thomas jefferysa collection of the dresses of different nationsancient and modern (four volumes)londonpublished between and the title page states that these are hand-colored copperplate engravingsh... |
11,392 | |
11,393 | fundamentals of deep learning hapters - of this book will give you foundational understanding of what deep learning iswhat it can achieveand how it works it will also make you familiar with the canonical workflow for solving data problems using deep learning if you aren' already highly knowledgeable about deep learning... |
11,394 | |
11,395 | this covers high-level definitions of fundamental concepts timeline of the development of machine learning key factors behind deep learning' rising popularity and future potential in the past few yearsartificial intelligence (aihas been subject of intense media hype machine learningdeep learningand ai come up in countl... |
11,396 | what is deep learningartificial intelligencemachine learningand deep learning firstwe need to define clearly what we're talking about when we mention ai what are artificial intelligencemachine learningand deep learning (see figure )how do they relate to each otherartificial intelligence machine learning deep learning f... |
11,397 | engine wasn' meant as general-purpose computer when it was designed in the and sbecause the concept of general-purpose computation was yet to be invented it was merely meant as way to use mechanical operations to automate certain computations from the field of mathematical analysis--hencethe name analytical engine in a... |
11,398 | what is deep learningalthough machine learning only started to flourish in the sit has quickly become the most popular and most successful subfield of aia trend driven by the availability of faster hardware and larger datasets machine learning is tightly related to mathematical statisticsbut it differs from statistics ... |
11,399 | artificial intelligencemachine learningand deep learning let' make this concrete consider an -axisa -axisand some points represented by their coordinates in the (xysystemas shown in figure as you can seewe have few white points and few black points let' say we want to develop an algorithm that can take the coordinates ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.