Posts
Double.Parse、Double.TryParse、IsNumeric 使用注意事項
Module Module1
Sub Main() Dim values = New String() {"不是一個數字", "正無窮大", "負無窮大"} For Each value In values Dim convertedValue = 0.0 Dim result = Double.TryParse(value, convertedValue) Console.WriteLine("value: {0}", value) Console.WriteLine("Double.TryParse(value, convertedValue): {0} ({1})", result, convertedValue) Console.WriteLine("Double.Parse(value): {0}", Double.Parse(value)) Console.WriteLine("IsNumeric(value): {0}", IsNumeric(value)) Console.WriteLine(New String("=", 78)) Next End Sub End Module
read morePosts
FlickrNet開發系列- FlickrNet基本功能開發(一)
MessageBox.Show(string.Format( @“FullName: {0} UserId: {1} UserName: {2}”, user.FullName, user.UserId, user.UserName)); }
var photoSets = m_Flickr.PhotosetsGetList(userID); foreach (var photoSet in photoSets) { var pic = new PictureBox() { ImageLocation = photoSet.PhotosetThumbnailUrl, BorderStyle = BorderStyle.FixedSingle, SizeMode = PictureBoxSizeMode.AutoSize }; container.Controls.Add(pic); } var photos = m_Flickr.PhotosGetNotInSet(); foreach (var photo in photos) { var pic = new PictureBox() { ImageLocation = photo.ThumbnailUrl, SizeMode = PictureBoxSizeMode.AutoSize }; container.Controls.Add(pic); } form.Controls.Add(container); form.ShowDialog(); }</pre> foreach (var photo in photos) { var pic = new PictureBox() { ImageLocation = photo.
read morePosts
FlickrNet開發系列- FlickrNet基本功能開發(二)
for (int i = 0; i < photos.Count; ++i) { var photo = photos[i]; var pic = new PictureBox() { ImageLocation = photo.ThumbnailUrl, BorderStyle = BorderStyle.FixedSingle, SizeMode = PictureBoxSizeMode.AutoSize, Tag = photo }; container.Controls.Add(pic); pic.Click += (sender, e) => { photo = (sender as PictureBox).Tag as FlickrNet.Photo; var sizes = m_Flickr.PhotosGetSizes(photo.PhotoId); var hasLargePhoto = (from item in sizes where string.Equals(item.Label, "Large", StringComparison.CurrentCultureIgnoreCase) select item).Count() > 0; var dialog = new Form(); var photoBox = new PictureBox() { ImageLocation = hasLargePhoto ?
read morePosts
FlickrNet開發系列- 使用FlickrNet上傳照片至Flickr
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; var form = new Form(); var progress = new ProgressBar() { Maximum = 100, Dock = DockStyle.Fill }; form.Controls.Add(progress); form.Size = new System.Drawing.Size(200, 100); m_Flickr.OnUploadProgress += (s, ex) => { progress.Value = ex.ProcessPercentage; }; form.Show(); m_Flickr.UploadPicture(dialog.FileName, "Photo1", "Just test upload");</pre></div>
read morePosts
GAE's Memcache
if value: #Data still cached … else: #Data without cached …
class MainHandler(webapp2.RequestHandler): def get(self): memcache.set(“name”, “LevelUp”)
value = memcache.get("name") self.response.write(value + "<br/>") memcache.set_multi({"name": "LevelUp", "url": "httlp://www.dotblogs.com.tw/larrynung"}) values = memcache.get_multi(["name", "url"]) self.response.write(values["name"] + "<br/>") self.response.write(values["url"] + "<br/>") application = webapp2.WSGIApplication([ (’/’, MainHandler) ])
class Article(db.Model): id = db.StringProperty(required=True) name = db.StringProperty() content = db.TextProperty()
class Blog(db.Model): id = db.StringProperty(required=True) name = db.StringProperty(required=True) url = db.LinkProperty(required=True) articleIDs = db.StringListProperty()
class MainHandler(webapp2.
read more