# Searched tag: My projects

## How to insert Math Formula into your web page?

»My Projects

Let's firstly have a look at the final display effect:

#### Formula 1

$$\lim _{x \rightarrow \infty} \frac{e^{\sin \frac{1}{x}}-1}{\left(1+\frac{1}{x}\right)^{\alpha}-\left(1+\frac{1}{x}\right)}=\lim _{x \rightarrow \infty} \frac{\sin \frac{1}{x}}{\left(1+\frac{1}{x}\right)^{\alpha-1}-1}$$

#### Formula 2

$$\frac{\underset{x\to \infty }{\mathop{\lim }}\,\frac{1}{\infty }}{\sqrt{2x}}$$

## Insert highlighted code with CSS and JS on your website

»My Projects

It is a reasonable solution to use the embedded editor of Joomla! to highlight any code on an article. With simply one click on Joomla's TinyMCE Editor, it allows you to insert any highlighted code from any programing languages into a Joomla! Article.

Here goes some sample Python codes,

## Code 1

print("hello world!")

## Code 2

import love from me

love1 = love.joomla()
for i in range(5):
print("No. " + str(i) + str(love1))


## Code 3

# This is a comment
i = 100
while True:
i -= 1
print(i)
if i < 50:
break

# This is the end of the code

## Control LEDs on Webpage

»My Projects #### Project Goal:

1. The Raspberry Pi should be able to read data from this blog post to light on the I/O LEDs of the Raspberry Pi Board.

LED_DATA: "1, 1, 1, 1, 1, 0, 1, 0"

LED_EXIT: "0"

The LEDs should be lighted according to the data shown above.

2. The Python program on the Raspberry Pi should immediately terminated whenever "LED_EXIT" is set to "1".

## Random Music Composer

»My Projects Project Progressing...

from music21 import note, stream
from decorators import get_halftones, get_basenote
from random import randint

# 把作曲的N多方法封为一类
class Compose():
# 初始化
def __init__ (self):
self.music = []
self.time_signature = [4,4]
numerator = self.time_signature
denominator = self.time_signature
self.default_bar_QL = numerator / denominator * 4
self.key_signature = 'C_maj'
self.tempo = 88

# 随机作曲方法，装饰器get_halftones会把不是数字的音乐范围转化为数字
@get_halftones
@get_basenote
def random_bars (self, **kw):
# 实例变量赋值
self.music_length = kw['music_length']
self.base_note = kw['base_note']
self.compose_range = kw['compose_range']

# 逐个小节生成音符
for i in range(self.music_length):
self.music.append([])

# 生成当前小节的音符数量
note_num = randint(1,8)

# 计算每小节的 QL