Monday, September 3, 2018

Ghé làng chài ăn tôm hùm chấm muối ớt

Vùng biển Sa Huỳnh (Quảng Ngãi) độ tháng 7, tháng 8 nước rất trong và mát, nhất là tầng đáy.

 /// Ảnh: Trần Cao Duyên
Ảnh: Trần Cao Duyên

Đây là khoảng thời gian tôm hùm di chuyển ra xa những rặng đá ngầm để kiếm mồi. Vì mê mồi thơm đặt trong lưới lồng nên chú nào cũng mò vào và không có đường ra. Chỉ trong vài giờ buổi sáng, mẻ lưới lồng nào của ngư dân cũng dính ít nhất chục con.

Nếu như cua huỳnh đế là “vua” của các loài cua thì tôm hùm là “vương” của các loài tôm cả về hình dáng lẫn chất lượng thịt. Vỏ tôm hùm đã cứng như áo giáp lại tua tủa gai nhọn ở phần đầu. Riêng hai cái càng vươn dài, cũng li ti gai. Từ “hùm” định danh cho loại tôm này thật chính xác: tướng tá oai phong, dữ như hùm! Do đặc điểm này, với những con tôm lớn, sau khi khoét bụng lấy thịt xong, ngư dân thường ngâm bộ vỏ tôm hùm trong rượu cao độ rồi đem phơi khô. Thứ này treo tường chơi thì vừa đẹp vừa sang, nhiều ngư dân trầm trồ như vậy.

Còn thịt thì khỏi chê. Phải nói là tôm hùm ăn đứt các loại tôm khác ở nhiều “góc độ”: Thịt dai, săn giòn, ngọt, thơm và béo. Ăn một lần là nhớ mãi. Trong các nhà hàng, tôm hùm thường được chế biến thành những món “trứ danh” như tôm hùm xốt bơ cà chua, tôm hùm xốt trái cây thập cẩm, tôm hùm rang muối, tôm hùm nướng bơ tỏi, tôm hùm hấp bia…

Riêng các làng chài dân dã ở Quảng Ngãi như Sa Huỳnh, Phổ Châu, Phổ Vinh… thì chỉ 2 món truyền thống: tôm hùm nướng và tôm hùm luộc cũng đủ ngon tới… ngọn cây dừa. Cả hai món này đều chấm muối ớt. Mà muối ớt phải “chuẩn”. Muối phải là muối bọt, loại muối hạt to, hớt trên mặt ruộng muối Sa Huỳnh trong giờ thu hoạch đầu tiên. Giã muối này với ớt xanh, chấm với thịt tôm hùm thì ngon không gì bằng.

Giờ tôm hùm không còn đắt đỏ nữa nên có thể mua mà không phải xuýt xoa. Chỉ với 200.000 đồng là có thể mua được 5 chú tôm hùm chân cẳng và râu còn ngọ ngoạy (ảnh). Nói vậy chứ phải nhờ bạn hàng cá, canh giờ ghe đánh tôm hùm trở về để xuống bến mà mua với mức giá “hàng xóm láng giềng”.

Theo Thanhnien.vn

Saturday, July 14, 2018

MacOS: Contacts doesnt sync properly

Your MacBook Pro must have a corrupted Contacts database.
Signing out and back in to iCloud isn’t fixing anything because your MacBook Pro is reusing its local database, and thinking that everything is up to date. Updating a contact is what “rebuilds” its entry, allowing it to be displayed.
Try wiping your local cache to force your MacBook Pro to re-download all of your contacts from iCloud.
  1. Sign out of iCloud.
  2. Delete ~/Library/Application Support/AddressBook.
  3. Delete ~/Library/Caches/com.apple.AddressBookSourceSync.
  4. Delete ~/Library/Saved Application State/com.apple.AddressBook.savedState.
  5. Delete ~/Library/Preferences/com.apple.AddressBook.plist.
  6. Restart your MacBook Pro.
  7. Sign back into iCloud.
Your contacts should all download fresh from iCloud.
(Note: Steps 2 & 3 are really the crucial ones, but the Contacts.app doesn’t have much in the way of preferences, so might as well be thorough.)

Thursday, April 19, 2018

MacOS: App Icons are missing

Open terminal, and type:

sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \
sudo rm -rf /Library/Caches/com.apple.iconservices.store
killall Dock

Wednesday, April 11, 2018

iOS : Choose the crypto flow

Even though there are multiple tools for doing just that, not all of those tools are equal. By just taking some random algorithm from CommonCrypto and using StackOverflow example to implement it, you'll fail. Remember, cryptography is hard (read this essay and this presentation), and it's very easy to get it wrong.

So, you need to make your choice consciously. While thinking about your cryptographic tools, it's very useful to keep your goal in mind:

protect the sensitive data in certain context from modification and 3rd party eyes, and be able to trust sender of the data.

Wednesday, November 8, 2017

Mobile: React Native vs Real Native Apps



Mobile applications have traditionally been written in native languages. Lately, however, hybrid cross-platform frameworks have been gaining market share. The recent swell of React Native’s popularity has raised the question: should developers use React Native for mobile development instead of native app development? 

In the last 4 years, the React Native framework has grown to a community of over 2,000 contributors that averages 300,000+ weekly downloads through npm. Some of the largest companies in the world have embraced React Native, including Facebook, Pinterest, Skype, Uber, and Brex. Its widespread adoption is primarily driven by the convenience of its cross-platform nature and the unique technological approach used to accomplish this.

Despite React Native’s success, many people maintain that traditional native mobile apps are still the way to go. The proponents of native primarily cite its performance advantages and robustness when compared to hybrid alternatives. Tradeoffs exist between both options, and careful consideration is required when choosing between the two technologies. This article will weigh in on the matter by delving into what makes React Native so popular, and explore how it works under the hood. We’ll also look at the pros, cons, and business impacts of each option, giving you the facts worth knowing before making a choice one way or another.

Comparing React Native vs Traditional Native Apps

React Native is written primarily with JavaScript and classified as a “hybrid” framework, meaning that it’s platform-independent. This separates it from traditional apps written in native languages such as Java or Kotlin for Android, and Swift or Objective-C for Apple. Instead, hybrid apps have a single codebase that produces an app that will run on both Android and iOS devices. The benefit to this is obvious: less code and related logistics when compared to writing a pair of native apps using different languages. The drawbacks of hybrids are that they aren’t as performant as their native equivalents, and they sometimes lack the ability to make full use of a device’s resources.

Most hybrid frameworks that you may be familiar with, such as Ionic, Cordova, and Phonegap, rely on what’s known as a WebView to accomplish their cross-platform capabilities. Essentially, they embed a webpage inside a native app and hook into it to integrate with the underlying device. The problem with this is that WebViews, especially when hosting complicated apps, run into performance issues and have other limitations.  

React Native does things a little differently. It doesn’t use WebViews, but rather a system that allows it to render native components (hence the name) from its base JavaScript code. There’s a common misconception that React Native compiles JavaScript down to native languages such as Swift or Java, but that isn’t the case. To get a better understanding, let’s compare the underlying structure of a “Hello World” app featuring a labeled button written in React Native to its equivalent native iOS version:

Native iOS:



React Native:



Now it’s obvious that the native iOS version looks “cleaner”, but that isn’t really a concern here. What’s important is that we see there are no WebViews in use, instead we have a set of native components. The stack of views in the React Native example is simply forming the basic responsive layout of the app, given that React Native uses Flexbox. The performance impact of this is essentially nominal, and well worth it given that the need for WebViews has been removed.

However, there are still some performance concerns worth noting when analyzing how React Native achieves this feat.

How Does React Native Work?

In a React Native app, its JavaScript logic runs in a dedicated thread, while the rest of the app runs in what we’ll call “the native realm”. JavaScript handles the business logic of the application, while the native realm renders the UI and manages device interactions. These two domains rely on something called “the Bridge” to communicate.

The JavaScript thread and the native realm can’t have a direct conversation – they are unable to listen, respond to, or cancel events and operations happening on the opposite side. Instead, they pass serialized messages back and forth via asynchronous message queues. This system “bridges” the gap.

For example, React Native may send a message to the native realm saying “render this button”, to which upon receipt (ie. the next time it checks the message queue), native does. Later on, when the user clicks on this button, native dispatches a message to the JavaScript thread informing it of the action, triggering some associated application logic, which will then result in a UI update being pushed back into the queue for native… and so on.

Due to the disconnected and asynchronous nature of this means of communication, some performance issues can arise. Queues can get bogged down, say for example if the user is rapidly scrolling through a long and complicated list – many “user has scrolled” and “draw this new UI” updates fly back and forth. For a similar reason, animations can also be a point of concern. In reality, most of the time these kinds of performance deficits are negligible to the user; however, they are still something developers need to be aware of so they can be designed around. 

The good news is that initiatives such as the JSI (JavaScript Interface) are in development to replace the Bridge with something better. Developers can also use native modules to supplement their app with truly native code to leverage device-specific functionality or address performance issues. This means that having developers familiar with native on your React Native team can be very beneficial.

React Native continues to evolve, given its popularity and supporting community. It remains a top choice for developers, and warrants consideration for those thinking of building an app.

Comparing React Native vs Native Development

Both approaches to mobile development have notable tradeoffs. It’s important to consider the strengths and weaknesses of each option with respect to an application’s use case and your organization’s structure:

Native Frameworks

Pros

  1. Performance: This is the defining factor when compared to hybrid solutions, native development will always win out. Although React Native has sufficient performance for most use cases, native frameworks are better suited for resource-intensive apps such as those using 3D/AR/VR technology, as well as data or animation-heavy applications.
  2. Device integration: Native gets access to all the capabilities of the underlying device. This means all the abilities of the associated hardware, sensors, SDKs, and platform-specific features are in play. To be concise, it gives more power to the developers to make a better product.
  3. Access to new features: When a platform such as Android or iOS introduces a new capability, developers will have access to it straight away, often even before it makes its way into a public release. This can prove to be advantageous and even provide an edge in cases where the new feature helps to improve the appeal of your app.

Cons

  1. The downsides of native frameworks can be summed up in one word: logistics. Assuming you are targeting both Android and iOS, you have to do most things twice. Two development teams, two codebases, separate testing and deployment pipelines, and so forth. Not only is there a doubling of most work, but the two streams must be kept in sync, requiring additional oversight and planning. New features and changes have to be coordinated and timed together, and problems quickly arise if one side falls behind or diverges from the other. A solid set of processes are required to keep things running smoothly. 
  2. The bottom line is that more time, effort, and money must be expended when compared to hybrid alternatives such as React Native.

React Native Development

Pros

  1. Cross-Platform out of the box: React Native runs on both Android and iOS, allowing you to target both platforms from the output of a single development team and codebase. This means that the associated logistics around planning, development, testing, and deployment are easier. This typically translates into a lower cost and time to market when compared to native, making it the primary benefit of the technology.
  2. Native Modules: To help address performance issues or provide support for platform-specific functionality, native modules can be used to supplement a React Native app. This gives developers the capability to leverage (at least some of) the best of both worlds.
  3. Hot Reloading: React Native supports both Hot and Live Reloading, which means that developers are able to quickly see and test changes as they’re made. The ability to do this without having to manually reload an app and lose its present state is a great productivity boost during development. React’s implementation of hot reloading provides a clear advantage over the often-clunkier development and debugging workflow of native IDEs.

Cons

  1. Performance: As discussed, React Native isn’t the best choice for applications with high-performance requirements – specifically those with graphically intensive or data-heavy workloads. Although mitigations for this (such as native modules or the JSI) exist or are on the horizon, it will always remain as the primary concern.
  2. Developer Awareness: Although often pitched as an alternative to hiring native developers, React Native doesn’t exist in a vacuum. Knowledge of the Bridge versus underlying platforms is needed to avoid performance pitfalls and develop native modules. React Native also does not abstract away the submission, review, and deployment process for the associated Google and Apple stores, so having staff experienced with that procedure is still required. Robust mobile skill sets may be necessary when choosing this path, undercutting some of the purported benefits of the framework’s simplicity. 
  3. Reliance on Maintainers: Developers must wait on maintainers of React Native to address issues and provide support for new features. For example, there is currently (as of early 2020) an ongoing issue with audio recording under some circumstances – this could prove problematic for applications relying on such functionality.
  4. With those caveats under consideration, it’s worth reviewing the different situations where it makes sense to choose one approach over the other.

Picking and Choosing

When to Use Native App Development

  1. You need the performance that native frameworks provide. Particularly if you’re making a game (and not using something like Unity), making use of a device’s 3D/AR/VR capabilities, or are building an otherwise complex application.
  2. You have the resources and processes available to support the logistical demands of running two mobile development streams and keeping them in sync.
  3. You’re targeting a single platform for your app – Android or iOS only, and you don’t expect this to change.
  4. You need direct access to device capabilities that only native can provide.

When to Use React Native

  1. You want to build a cross-platform app with a fairly straightforward use case.
  2. You want to quickly make a prototype or MVP. Even if you’re considering using native development when bringing a product to market, React Native is great for putting something together quickly. This can prove to be a valuable test of the framework’s viability for your given use case – maybe native won’t be needed after all.
  3. You want the logistical benefits that a hybrid framework provides: a single codebase and supporting development process, from which typically stems a reduction in costs.

Conclusion

A mobile app is not just a bunch of lines of code, it’s a business. As such, the decision to choose one path over another is not purely a technical one. The bigger picture and associated implications must be considered when deciding whether React Native or traditional native is to be used as your foundation going forward.

On paper, it seems to make sense to develop natively instead of via an abstracted framework that sits on top of the native realm. Native provides superior performance and gives developers complete access to the capabilities of each device. It’s true that some use cases require this level of control. However, these benefits come at a cost – in the literal sense. The duplication of work and associated logistical effort can be taxing on a business that is not able to support it. With that in mind, it may be the case that an alternative approach is more well-suited to your situation.

With React Native development, in most cases, you get the best of both worlds: lower effort and associated cost and time to market, while still producing a robust and performant app that stands up against its native competition. The React Native framework is often the clear choice for rapid prototyping and the production of MVPs – a process that can serve as an evaluation of whether or not the technology meets the long-term requirements of your project. These benefits make React Native a strong option for a lot of organizations. Still, if you need pure horsepower or have a use case that requires it, native can sometimes remain the way to go.

Ultimately, there is no silver bullet. Careful consideration is required when making such a fundamental decision. Review the benefits and limitations of the choices before you.


Original Post