Skip to content

Home

啟用 OS X El Capitan 的自動登錄

問題

我剛剛進行了 OS X El Capitan 的全新安裝。我試圖啟用自動登錄,但是它仍然被鎖定。這讓我感到困惑。

解決方案

  1. 前往系統偏好設定並選擇安全與隱私權。為磁盤關閉FileVault。
  2. 導航到使用者與群組並點擊更改密碼
  3. 我選擇使用另一個密碼而不是使用我的 iCloud 密碼來登錄並解鎖這台Mac。
  4. 我設定了我的新密碼。
  5. 我點擊了登錄選項並為我的帳戶啟用自動登錄。

耶,它成功了!

Ember Inject Controller

The Problem I Encountered:

After updating my Ember project to version 1.13.5, I received the following warning in the browser console:

_DEPRECATION: Controller#needs is deprecated. Please use Ember.inject.controller() instead._

However, I couldn't find any documentation on how to implement the new syntax.

The Solution:

Though it's marked as a private method in the Ember documentation, you can view it by selecting the "private" checkbox.

There are two ways to use Ember.inject.controller(): with and without specifying a controller name.

_App.PostController = Ember.Controller.extend({ posts: Ember.inject.controller() });_

When you don't specify the name of the controller, Ember uses the property name to look it up, as in:

posts: Ember.inject.controller('posts').

You will only need to specify the controller name if the property name and the controller name are different.

_App.PostController = Ember.Controller.extend({ myPosts: Ember.inject.controller('posts') });_

This way, you can successfully update your project to comply with the new Ember guidelines.

Ember Inject Controller

The Problem I Encountered: Welcome to Continuous Improvement, the podcast where we explore solutions to common problems faced by developers. I'm your host, Victor, and today we are diving into a recent problem I encountered while updating my Ember project.

So, after updating to version 1.13.5, I was greeted with a warning in the browser console telling me that Controller#needs is deprecated. The warning kindly suggested that I should use Ember.inject.controller() instead. But, I was left wondering, how exactly do I implement this new syntax?

Luckily, I did some digging and found a solution that I'll be sharing with you today. Firstly, let's address the Ember documentation - it marks Ember.inject.controller() as a private method. But fear not, you can still access it by selecting the "private" checkbox. It's always helpful to have access to these hidden gems, isn't it?

Now, let's dive into the implementation. There are actually two ways to use Ember.inject.controller(). The first method is without specifying a controller name. For example, you can define it like this:

Victor (cont.): App.PostController = Ember.Controller.extend({ posts: Ember.inject.controller() });

What happens here is that Ember uses the property name, in this case 'posts', to look up the controller. So, whenever you access 'this.posts' in your code, Ember will automatically fetch the 'posts' controller for you.

But what if the property name and controller name are different? Well, that's where the second method comes in. You can specify the controller name using Ember.inject.controller(). For example:

Victor (cont.): App.PostController = Ember.Controller.extend({ myPosts: Ember.inject.controller('posts') });

Here we have 'myPosts' as the property name and 'posts' as the controller name. Now, whenever you access 'this.myPosts', Ember will fetch the 'posts' controller for you.

And there you have it - a solution to the deprecation warning you may face when updating your Ember project. By using Ember.inject.controller(), you can ensure your code complies with the latest Ember guidelines.

That's it for today's episode of Continuous Improvement. I hope this solution helps you tackle any similar issues you may encounter in your own projects. Remember, continuous improvement is the key to becoming a better developer.

If you have any questions or topics you'd like us to explore in future episodes, feel free to reach out to us. Thank you for tuning in, and until next time, keep coding and keep improving.

Ember注入控制器

我遇到的問題:

在將我的Ember專案更新到1.13.5版本後,我在瀏覽器控制台中收到以下警告:

_棄用警告: Controller#needs 已被棄用。請改用 Ember.inject.controller() 。_

然而,我找不到任何關於如何實現新語法的文檔。

解決方案:

雖然它在Ember文檔中被標記為私有方法,但你可以選擇“私有”複選框來查看它。

使用Ember.inject.controller()有兩種方式:指定和不指定控制器名稱。

_應用程序.貼文控制器 = Ember.控制器.extend({ 文章: Ember.inject.控制器() });_

當你不指定控制器的名稱時,Ember會使用屬性名來查找,例如:

文章: Ember.注入.控制器('文章').

只有在屬性名稱和控制器名稱不同的情況下,你才需要指定控制器名稱。

_應用程序.貼文控制器 = Ember.控制器.extend({ 我的帖子: Ember.注入.控制器('文章') });_

這樣,您就可以成功地將您的專案更新以符合新的Ember指南。

Fun Things to Do in Hanoi, Vietnam

My ambition is to travel the world, although I realize that may be a bit too ambitious.

One essential lesson I've learned in software engineering is how to manage complexity. By breaking down a large challenge into smaller, more manageable pieces, we can accomplish meaningful goals step by step. Taking a weekend getaway to Vietnam is one of those simple joys that doesn't require using annual vacation days.

Here are some fun things to do in Hanoi:

Halong Bay Kayaking - My Instagram photos may have multiple filter layers, but the scenery in Halong Bay is as beautiful as postcard pictures without any need for Photoshop. Though the journey from the city took four hours, this UNESCO World Heritage site was well worth the effort. Kayaking is my favorite way to get up close and personal with the magnificent limestone formations. If you go, remember to bring a waterproof bag to protect your iPhone in case you fall into the water.

Nature's Marvel - Dong Thien Cung Cave - Shaped by wind and water over millennia, the Dong Thien Cung cave is awe-inspiring. With a little imagination, you might see a dragon, lion, or even a breast-shaped formation among the colorful stalagmites. Interestingly, some superstitious women who struggle with breastfeeding pray for milk blessings in front of that particular rock.

Navigating the Night Market - The experience was both fantastic and overwhelming. During the Mid-Autumn Festival, I visited the bustling night market but also found myself stuck in the crowd. It seemed everyone on the street had an ice cream cone, so I got one too. The mint flavor tasted like toothpaste but was refreshing on a hot, humid night. Crossing the road in Hanoi, congested with motorcycles, is a real challenge. Regardless of whether the light is red or green, people just keep moving. Successfully crossing the street amid cars, motorcycles, and pushcarts coming from all directions takes courage. Thankfully, I made it unscathed.

Savor the Street Food - If you're adventurous, be prepared to sample a variety of local dishes. While I was there, I tried to remember the Vietnamese names of the foods, but now that I'm back home, they've slipped my mind. Although the language sounds melodic, I still can't comprehend the nuanced tones.

Egg Coffee - Don't knock it until you've tried it; it's not as off-putting as it sounds. Traditional Vietnamese egg coffee (Cà Phê Trứng) is primarily found in Hanoi. Thanks to a local guide, I enjoyed this beverage at a hidden upstairs coffee shop, priced similarly for tourists and locals. As a coffee enthusiast, another visit to a historic coffee shop for the famous condensed milk coffee—a perfect blend of sweet and bitter—is a must.

Visit the Hoa Lo Prison Museum - Let me clarify, I didn't do anything wrong! I visited the Hoa Lo Prison Museum after touring the French-style St. Joseph's Cathedral. I've always been fascinated by the darker aspects of human nature, such as torture and execution. Reflecting on history, I feel fortunate to live in an era and place without oppressive political regimes and major conflicts. The Vietnam War is not just a movie topic; it's a real-life historical event built on dubious political justifications. Each soldier has a family, and each death brings them sorrow. At that moment, I found myself missing my partner and wishing for her continued safety.

So, it's time to start planning your trip. There's so much to see and do in Hanoi that I almost missed my flight back. I plan to continue exploring and seeing what the world has to offer. Can't wait for the next adventure! If you book early, you might even find some great deals.

Fun Things to Do in Hanoi, Vietnam

Welcome to "Continuous Improvement," the podcast that brings you practical tips and insights for personal and professional growth. I'm your host, Victor, and today we're going to talk about the joy of traveling and the importance of managing complexity.

So, my ambition is to travel the world. But, let's face it, that can be quite ambitious, right? That's why I've learned a valuable lesson in software engineering that applies to other aspects of life as well - managing complexity by breaking it down into smaller, more manageable pieces.

Today, we're going to dive into one of those smaller pieces. I recently took a weekend getaway to Hanoi, Vietnam, and let me tell you, it was a fantastic experience. I want to share some of the fun things I did there, so if you're ever planning to visit, you know what to check out.

The first highlight of my trip was kayaking in Halong Bay. Trust me when I say the beauty of this UNESCO World Heritage site is beyond compare. Those limestone formations are stunning! And kayaking was the perfect way to experience them up close and personal. Just a tip: don't forget to bring a waterproof bag for your phone. You never know what could happen!

Another natural marvel that left me with a sense of awe was the Dong Thien Cung cave. This cave, shaped by wind and water over thousands of years, is truly a sight to behold. If you have a vivid imagination, you might even spot some interesting rock formations, including one that supposedly resembles a breast. Believe it or not, some superstitious women pray for milk blessings in front of that particular formation.

Now, one of the most exciting and challenging experiences in Hanoi has to be navigating the night market. Picture this: during the Mid-Autumn Festival, the streets are crowded, full of people enjoying the festivities. And there I was, ice cream cone in hand, trying to maneuver through it all. Crossing the road in Hanoi is an adventure in itself! Motorcycles, cars, and pushcarts coming from all directions, but guess what? I made it across the street safely, and that's an achievement worth celebrating!

Now, let's talk about food. Oh boy, Hanoi is a street food lover's paradise. The flavors, the variety, it's a culinary adventure like no other. I wish I could remember all the Vietnamese names for the dishes I tried. But trust me, they were delicious. And if you're feeling daring, you must try the famous Vietnamese egg coffee. I know, it might sound strange, but don't knock it until you've tried it. And while you're at it, make sure to visit a historic coffee shop for a taste of their famous condensed milk coffee.

Now, no trip to Hanoi would be complete without a visit to the Hoa Lo Prison Museum. I know, it's not the cheeriest of attractions, but it's a part of history that we shouldn't forget. As I walked through the museum, reflecting on the past and the conflicts that occurred, it reminded me how fortunate we are to live in a time and place without oppressive regimes. It also made me appreciate the safety and well-being of my loved ones. Deep thoughts, right?

So, my takeaway from this trip is that even though my ambition of traveling the world may seem overwhelming, it's all about managing complexity and breaking it down into smaller, more achievable pieces. By doing so, I had the chance to experience the wonders of Hanoi, embark on unforgettable adventures, and truly immerse myself in the culture.

That's it for today's episode of "Continuous Improvement." I hope you enjoyed hearing about my Hanoi trip and learned a thing or two about managing complexity along the way. Remember, in life, just as in software engineering, taking things one step at a time can lead to great achievements.

在越南河內可以做的有趣事情

我的志向是環遊世界,雖然我意識到這可能有點過於雄心勃勃。

我在軟件工程中學到的一個重要課程是如何管理復雜性。通過把一個大挑戰分解成小而更好管理的部分,我們可以一步一步地完成有意義的目標。到越南週末度假就是一種簡單的快樂,不需要使用年假。

以下是一些在河內可以做的有趣事情:

下龍灣皮划艇 - 我的Instagram照片可能有多層濾鏡,但下龍灣的風景無需任何Photoshop就如明信片般美麗。雖然從城市出發需要四小時,但這個聯合國教科文組織世界遺產非常值得。皮划艇是我最喜歡接近壯觀的石灰石形成的方式。如果你去,記得帶一個防水袋來保護你的iPhone,以防你掉入水中。

自然奇觀 -東天宮洞 - 經過數千年風和水的塑造,東天宮洞令人驚嘆。用點想像力,你可能會在五彩斑斕的石筍中看到一條龍,一頭獅子,甚至一種乳房形狀的形成。有趣的是,一些迷信的女性在該岩石前祈福以求母乳充足。

在夜市導航 - 這種體驗既奇妙又厲害。在中秋節時,我參觀了繁華的夜市,但我也發現自己陷入群眾中。街上似乎每個人都有一個冰淇淋,所以我也買了一個。薄荷味的味道像牙膏,但在潮濕的熱夜裡很提神。在摩托車繁多的河內過馬路是一項真正的挑戰。無論紅燈還是綠燈,人們都在移動。成功地在來自所有方向的汽車,摩托車和手推車中穿過街道需要勇氣。謝天謝地,我安然無恙。

享受街頭美食 - 如果你敢於冒險,一定要準備品嚐各種當地美食。當我在那裡的時候,我試圖記住食物的越南名稱,但現在我回家了,它們已經從我的記憶中消失了。儘管語言聽起來很有旋律,我仍然無法理解其細膩的語調。

蛋咖啡 - 在你試過之前不要嘲笑它;它並不像聽起來那麼令人不悅。越南傳統的蛋咖啡(Cà Phê Trứng)主要在河內能找到。感謝當地的導遊,我在一家隱藏在樓上的咖啡店品嚐了這種飲料,對於遊客和本地人來說價格差不多。作為一名咖啡愛好者,我必須再次參觀歷史悠久的咖啡店品嚐那著名的煉乳咖啡——甜與苦的完美融合。

參觀和勞監獄博物館 - 讓我澄清一下,我沒做錯什麼!我參觀了法式的聖若瑟主教座堂後,參觀了和勞監獄博物館。我一直都對人性的黑暗面,如折磨和懲罰,感到著迷。反思歷史,我感到幸運能在沒有壓迫性政治政權和主要衝突的時代和地方生活。越南戰爭不僅僅是電影主題,它是一個建立在不明確政治理由上的真實歷史事件。每個士兵都有一個家庭,每個死亡都帶給他們悲痛。那一刻,我發現自己想念我的伴侶,並希望她持續安全。

所以,現在是時候開始規劃你的旅行了。河內有那麼多可以看和做的事情,我差點錯過回家的飛機。我打算繼續探索世界並看看世界可以提供什麼。迫不及待想要進行下一次冒險!如果你提早預定,你甚至可能找到一些很好的優惠。

Batch Crop Images using ImageMagick

Today, one of the tasks I performed involved batch cropping numerous pictures. I found ImageMagick to be very useful for scaling and cropping images. Mogrify, a command within the ImageMagick package, enables us to perform various operations on multiple images. I am posting this guide as a future reference for myself and perhaps it will be helpful for others as well.

Step 1: Install MacPorts

https://www.macports.org/install.php

After completing the installation, if you encounter the following error:

> _sudo: port: command not found_

The issue likely arises because MacPorts binaries are installed in /opt/local/bin. You'll need to manually update your shell’s environment to work with MacPorts:

> _export PATH=$PATH:/opt/local/bin_
> _source .profile_
> _sudo port -v selfupdate_

Step 2: Install ImageMagick

http://www.imagemagick.org/script/binary-releases.php

To install, run:

> _sudo port install ImageMagick_

The port command will download ImageMagick and many of its delegate libraries. If you encounter an error like:

> _convert: command not found_

Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files:

> _export MAGICK_HOME="$HOME/ImageMagick-6.9.1"_

If the bin subdirectory of the extracted package isn't already in your executable search path, add it:

> _export PATH="$MAGICK_HOME/bin:$PATH"_

Set the DYLD_LIBRARY_PATH environment variable:

> _export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"_

Step 3: Add Missing Decoding Library

If you try to convert JPEG images and get the following error message:

> _“convert: no decode delegate for this image format”_
  1. Visit http://www.imagemagick.org/download/delegates/ and download the required or missing delegate library, such as jpegsr9a.zip.
  2. Unzip the file.
  3. Change directory to the unzipped folder:
> _cd jpeg-9a_
  1. Then run:
> _./configure; make; make test; make -n install_

Step 5: Usage

To avoid overwriting the original image files, create a new folder and backup the images there.

To resize a single image to a height of 600px while maintaining the same aspect ratio, run:

> _convert input.png -geometry x600 output.png_

If you'd like to convert all images in a folder, change to that directory and use:

> _mogrify -geometry x600 *.png_

To scale down an image to 200 pixels:

> _convert myPhoto.jpg -resize 200x200^_

To crop the image from the center:

> _convert myPhoto.jpg -gravity Center -crop 200x200+0+0 +repage newPhoto.jpg_

The -gravity south option specifies that the crop should start at the bottom of the image. The -chop 0x135 option cuts 135 pixels from the height:

> _mogrify -gravity south -chop 0x135 *.jpg_

To resize all images in the current directory to a width of 800 (height will be reduced proportionally):

> _mogrify -resize 800 *.jpg_

To rotate images 90 degrees:

> _mogrify -rotate 90 *.jpg_

For More Information:

Visit http://www.imagemagick.org.

Batch Crop Images using ImageMagick

Today, one of the tasks I performed involved batch cropping numerous pictures. I found ImageMagick to be very useful for scaling and cropping images. Mogrify, a command within the ImageMagick package, enables us to perform various operations on multiple images. I am posting this guide as a future reference for myself and perhaps it will be helpful for others as well.

Welcome back to another episode of Continuous Improvement, the podcast where we explore various tools and techniques for enhancing our productivity and achieving personal growth. I'm your host, Victor, and in today's episode, we'll be discussing an essential tool for image manipulation – ImageMagick. Specifically, we'll be focusing on the batch cropping feature using the Mogrify command. So without further ado, let's dive in!

Have you ever found yourself needing to resize or crop multiple images at once? It can be a time-consuming task if done manually, but fear not! ImageMagick is here to save the day. In today's episode, we'll guide you through the installation process and show you how to efficiently batch crop your images.

First things first, let's ensure that we have all the necessary dependencies installed. We recommend using MacPorts for this purpose. To install MacPorts, visit the official website at https://www.macports.org/install.php. Once installed, you might encounter an error message when using the port command. But don't worry, we have a solution for that too.

To resolve the error message, you'll need to update your shell's environment to work with MacPorts. Open your terminal and enter the following commands:

> _export PATH=$PATH:/opt/local/bin_
> _source .profile_
> _sudo port -v selfupdate_

Great! Now that we have MacPorts set up, let's move on to installing ImageMagick. You can find the installation files at http://www.imagemagick.org/script/binary-releases.php. Once you've downloaded the files, run the command:

> _sudo port install ImageMagick_

Sometimes, after installing ImageMagick, you might encounter an error message like "convert: command not found." Don't worry; we have a workaround for that too. Let's set the necessary environment variables. First, set the MAGICK_HOME variable to the path where you extracted the ImageMagick files:

> _export MAGICK_HOME="$HOME/ImageMagick-6.9.1"_

Next, ensure that the bin subdirectory of the extracted package is in your executable search path:

> _export PATH="$MAGICK_HOME/bin:$PATH"_

Lastly, set the DYLD_LIBRARY_PATH environment variable:

> _export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"_

Now that we have ImageMagick successfully installed, let's move on to an optional step – adding a missing decoding library. If you come across an error message like "convert: no decode delegate for this image format," here's what you can do.

Firstly, visit http://www.imagemagick.org/download/delegates/ and download the required or missing delegate library, such as jpegsr9a.zip. Once downloaded, unzip the file and change your directory to the unzipped folder using the command cd jpeg-9a.

Now that we have everything set up, let's explore how to use ImageMagick and Mogrify for batch cropping your images. To avoid overwriting your original image files, it's always a good practice to create a new folder and back up your images there before performing any modifications.

If you want to resize a single image to a specific height while maintaining the aspect ratio, you can simply run the command:

> _convert input.png -geometry x600 output.png_

And if you'd like to convert all images in a folder to a certain height, change to that directory and use the command:

> _mogrify -geometry x600 *.png_

Need to scale down an image to a specific size? No problem! Just use the command:

> _convert myPhoto.jpg -resize 200x200^_

Looking to crop an image from the center? Easy! Just run the command:

> _convert myPhoto.jpg -gravity Center -crop 200x200+0+0 +repage newPhoto.jpg_

There are even more advanced options available. For instance, if you want to chop a certain portion from multiple images, you can use the command:

> _mogrify -gravity south -chop 0x135 *.jpg_

Additionally, if you need to resize all images in the current directory to a specific width while maintaining the aspect ratio, you can use the command:

> _mogrify -resize 800 *.jpg_

Lastly, if you wish to rotate multiple images by 90 degrees, you can leverage the power of ImageMagick with the command:

> _mogrify -rotate 90 *.jpg_

And that concludes our overview of using ImageMagick and the powerful Mogrify command for batch cropping and image manipulation. I hope you find this guide helpful in streamlining your image editing workflows.

If you're interested in diving deeper into ImageMagick and exploring its other capabilities, be sure to visit their official website at http://www.imagemagick.org.

That's it for today's episode of Continuous Improvement. Thank you for tuning in, and I hope you found this information valuable. If you have any questions or suggestions for future topics, feel free to reach out. Keep striving for continuous improvement, and until next time, happy cropping!

使用ImageMagick批量裁剪圖像

今天,我進行的任務之一涉及批量裁剪許多圖片。我發現ImageMagick在縮放和裁剪圖像方面非常有用。Mogrify,一個在ImageMagick包內的命令,使我們能夠對多個圖像進行各種操作。我發表這篇指南作為自己未來的參考,也許對其他人也有所幫助。

第一步:安裝MacPorts

https://www.macports.org/install.php

完成安裝後,如果你遇到以下錯誤:

> _sudo: port: command not found_

问题可能是因为MacPorts二进制文件安装在/opt/local/bin。你需要手動更新你的shell的環境以適配MacPorts:

> _export PATH=$PATH:/opt/local/bin_
> _source .profile_
> _sudo port -v selfupdate_

第二步:安裝 ImageMagick

http://www.imagemagick.org/script/binary-releases.php

執行以下命令進行安裝:

> _sudo port install ImageMagick_

port指令會下載ImageMagick和許多來自它的委託庫。如果你遇到像這樣的錯誤:

> _convert: command not found_

MAGICK_HOME環境變量設置為你提取ImageMagick文件的路徑:

> _export MAGICK_HOME="$HOME/ImageMagick-6.9.1"_

如果解壓包的bin子目錄還不在你的可執行搜尋路徑中,添加它:

> _export PATH="$MAGICK_HOME/bin:$PATH"_

設置DYLD_LIBRARY_PATH環境變量:

> _export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"_

第三步:添加遺失的解碼庫

如果你嘗試轉換JPEG圖像並獲得以下錯誤消息:

> _“convert: no decode delegate for this image format”_

1.訪問 http://www.imagemagick.org/download/delegates/ 下載需要的或缺失的代理庫,如jpegsr9a.zip。 2.解壓縮該檔案。 3.更改目錄到解壓縮後的文件夾:

> _cd jpeg-9a_

4.然後執行:

> _./configure; make; make test; make -n install_

第五步:使用方式

為了避免覆蓋原始圖像文件,創建一個新文件夾,並在那裡備份圖像。

如果要將一個單獨的圖像大小調整為600px的高度,同時保持相同的縱橫比,運行:

> _convert input.png -geometry x600 output.png_

如果你想轉換文件夾中的所有圖像,更改到該目錄並使用:

> _mogrify -geometry x600 *.png_

要將圖像縮小到200像素:

> _convert myPhoto.jpg -resize 200x200^_

從圖片中央裁剪圖片:

> _convert myPhoto.jpg -gravity Center -crop 200x200+0+0 +repage newPhoto.jpg_

-gravity south選項指定裁剪應該從圖像的底部開始。-chop 0x135選項從高度中切割135個像素:

> _mogrify -gravity south -chop 0x135 *.jpg_

要將當前目錄中的所有圖像大小調整為800的寬度(高度將按比例減少):

> _mogrify -resize 800 *.jpg_

要旋轉圖片90度:

> _mogrify -rotate 90 *.jpg_

閱讀更多:

請訪問 http://www.imagemagick.org.