Posts

  • How to play audio and video in html

  • Audio Preview Your browser does not support the audio element. Note: The audio tag is not supported in Internet Explorer 8 and earlier versions. Example An audio file that will automatically start playing: <audio controls autoplay>   <source src="audio.ogg" type="audio/ogg">   <source src="audio.mp3" type="audio/mpeg">   Your browser does not support the audio element. </audio> Video Preview Your browser does not support the video tag. Note: The video... Read more
  • How to create a Slideshow with CSS and JavaScript

  • * {box-sizing:border-box} /*body {font-family: Verdana,sans-serif;}*/ .mySlides {display:none} /* Slideshow container */ .slideshow-container { max-width: 950px; position: relative; margin: auto; } /* Caption text */ .text { color: #f2f2f2; font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; width: 100%; text-align: center; } /* Number text (1/3 etc) */ .numbertext { color: #f2f2f2; font-size: 12px; padding: 8px 12px; position: absolute; top: 0; } /* The dots/bullets/indicators */ .dot { height: 13px; width: 13px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .active { background-color: #717171; } /* Fading animation */ .fade { -webkit-animation-name:... Read more
  • How to change the font size on a matplotlib plot

  • For example, like this import matplotlib matplotlib.rc('xtick', labelsize=20) matplotlib.rc('ytick', labelsize=20) From the matplotlib documentation font = {'family' : 'normal', 'weight' : 'bold', 'size' : 22} matplotlib.rc('font', **font) This sets the font of all items to the font specified by the kwargs object, font. Alternatively, you could also use the rcParams and update method as suggested in this answer: matplotlib.rcParams.update({'font.size': 22}) You can find a full list of available properties on the Customizing matplotlib page. If you want to change... Read more
  • Print map while using lambda in Python 3

  • Since lambda x: print(x) is a syntax error in Python < 3, I’m assuming Python 3. That means map returns a generator, meaning to get map to actually call the function on every element of a list, you need to iterate through the resultant generator. Fortunately, this can be done easily: list(map(lambda x:print(x),primes)) Oh, and you can get rid of the lambda too, if you like: list(map(print,primes)) But, at that point you are better off with letting print handle it: print(*primes, sep='\n') NOTE:... Read more
  • How to Solve Gamma Function

  • I. Theoretical Analysis Gamma Function is defined in the following, Using integration by parts, one sees that: From the above calculation,and note that where . If is a positive integer, one can obtain: Appendix: Integral calculus() \int_{-\infty}^{+\infty}\mathrm{e}^{-(ax^2+bx)}\mathrm{d}x = \int_{-\infty}^{+\infty}\mathrm{e}^{-y^2 + (b^2/4a)}\frac{1}{\sqrt{a}}\mathrm{d}y... Read more