2015年11月26日 星期四

[RWD] Google maps

RWD with Google maps…

reference:
http://webomnizz.com/how-to-make-responsive-google-map-with-google-map-api/

方法一:css
HTML內容:

<div class="map-canvas" id="map-canvas">

<iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="https://www.google.com.tw/maps/@24.7655142,121.0162967,15z?hl=zh-TW" width="425"></iframe>

</div>



2015年11月23日 星期一

Python學習筆記(四) - Advanced Django models management

Django裡,model的資料操作與查詢,可進階寫成Manager,整個詳細過程記錄如下…

一、定義Manager class:
class TempleManager(models.Manager):
    def create_temple(self,name,locateRegion,religiousBelief,masterGod,address,latitude,longitude,phone1,phone2):
        temple = self.create(name = name, locateRegion = locateRegion, religiousBelief = religiousBelief, masterGod = masterGod, address = address, latitude = latitude, longitude = longitude, phone1 = phone1, phone2 = phone2)
        return temple

    def filter_temple(self,name,locateRegion,masterGod,address):
        temple = self.filter(name = name, locateRegion = locateRegion,  masterGod = masterGod, address = address)
        return temple

    def filterByMasterGod(self, masterGod):
        temple = self.filter(masterGod = masterGod)
        return temple

    def filterByRegion(self, locateRegion):
        temple = self.filter(locateRegion = locateRegion)
        return temple

2015年11月13日 星期五

Python學習筆記(三) - 部署到Microsoft Azure

今天上了Microsoft Azure課程後,一直想做一件事,就是把已經寫好的demo  site部署到azure上,在多次嘗試後,終於成功。當然必要條件是要先有一個Microsoft Azure的帳戶…
今天再為demo專案加入一個新的功能,就是輸入地址,轉換為經緯度的功能;透過google map api提供的功能,讓我們很輕鬆的完成這個功能。

2015年11月12日 星期四

Python學習筆記(二)....感動的JSON處理

雖然只是測試功能,但對 Python處理JSON字串留下深刻的印象,再度對Django框架有了更濃厚的興趣

建立django虛擬環境(virtualvenv):
ref - https://djangogirlstaipei.gitbooks.io/django-girls-taipei-tutorial/content/django/installation.html

我們可以直接開始安裝 Django,但實務上,大多數人都會搭配使用虛擬環境。使用虛擬環境有許多優點:
  • 你的專案會擁有一個專屬的獨立 Python 環境。
  • 不需要 root 權限,就可以安裝新套件。
  • 方便控管不同版本的套件,不用擔心升級套件會影響到其他專案。
  • 如果需要多人協作或在不同機器上跑同一個專案時,使用虛擬環境也可以確保環境一致性。

2015年11月10日 星期二

Python學習筆記(一)

這幾天,終於把Python的線上課程(https://www.codecademy.com)上完了,基本的語法和函數都不難,比較難的反而是class的語法有點難懂,不過這部份應該多寫就能習慣…
接下來,進入Django的世界,首先就是很多種plugin要安裝(目前用到的有pip, easy_install, setuptoolsDjango, psycopg2)。
easy_install, setuptools和pip通常已經內建於Python安裝程式。

安裝開發環境:
OS: Windows 7 64bits
1. Visual Studio 2015 Community
2. Git Hub
3. Python 3.4.3
4. PostgreSQL 9.4