Author: Catzie

  • Laravel 5: Create controller under new folder and routing

    So here I am on a Sunday, trying to make progress with a personal Laravel 5 site I need to work on. As I bear with the noise outside in the street (some crazy neighbors set up a swimming pool IN THE STREET! :oops:), I’m trying to figure out how too create a new Laravel 5 controller and place it inside a sub-folder.

    Thanks to a StackOverflow answer as my guide, it’s now working. Here, I’ll share how I did it. Just replace “New” with whatever name you want.

    First, create NewController.php on this folder: app\Http\Controllers\New\

    Then the first part of the code should be like:

    My call for the blade file in index() looks like this:

    In app\Http\routes.php, add this:

    $router->get(‘/new’, ‘New\PostsController@index’);

    Last, run composer dump-autoload or php artisan dump

    Guide: Laravel Controller Subfolder routing

  • Android Development: Permission denied when running ./gradlew in Mac

    I’m using a Mac at the moment to work on my Android app projects.

    For some reason I need to run ./gradlew in the terminal, but I was getting this error:

    -bash: ./gradlew: Permission denied

    To fix this, what I did was run the following commands:

    After those commands, my Mac downloaded numerous files and it took an hour to finish because of our poor Internet connection in the workplace. 🙁

    After an hour and a half, I was able to finally use the command ./gradlew on the Mac Mini. Phew!

  • Android Studio and the 64K methods limit (DEX error)

    Hi! I’ll share a few tips with you on how to find out the number of methods that your Android app has. I’m gonna show you a few tools such as APK file methods counter, and an Android plugin that will show you the number of methods each imported class or dependency has. These will help you figure out if you’re nearing the 64K methods limit, and determine which classes/dependencies must be causing it.

    First off, try this online drag-and-drop tool that will show you the total method count as well as breakdown based on the APK file you’ll use: APK Method Count

    Now, let’s install the plugin. After installation, you should be able to see method counts on your app/build.gradle file.

    Install plugin to check for unused dependencies: Jonnyzzz Dependencies. I used version 1.0.10. To do this, in [Windows] go to File -> Plugins, or in [Mac] go to Android Studio -> Preferences. Press “Browse Repositories” then find and install Jonnyzzz Dependencies. Restart Android Studio.

    To use, from the menu, select Tools -> Unused Module Dependencies -> Analyse All Modules

    You’ll be prompted for an option to remove all unused dependencies. I could not do that because I had a team mate who might use some of those in the list, so I manually deleted libraries that I’m sure we no longer need.

    Sync Gradle, Clean, or even Rebuild… and run your app again.

    I must admit that this DEX file error is a nightmare to me. xD I used to only code my Android app in a Windows 7 computer, which was very slow. Then some office friends decided to lend me a higher-specs Mac Mini that nobody’s using. It’s helping a lot, but the app I’m working on in Windows is getting 64K methods limit in Mac. I had the exact same copy of my Android Studio project in both Windows and Mac computers, but only the one in Mac was getting 64K methods limit error. 😆

    Now I’m thinking of the small differences in my Windows’ and Mac’s config for Android Studio…

    Could it be because ‘com.google.gms:google-services:2.0.0-alpha9’ and Android Studio v.2.1 in Mac, while my Windows 7 had ‘com.google.gms:google-services:2.0.0-alpha6’ and Android Studio v.1.4?

    From what I understand in the Methods Count pages for Google Services 2.0.0 Alpha 6 and Alpha 9, Alpha 6 has more methods than Alpha 9.

    My Android Studio v.1.4 in Windows using Alpha 6 (more methods) but the app runs without problem, while Android Studio 2.1 in Mac using Alpha 9 (less methods) triggers the 64K methods limit. 😆

    I don’t want to keep thinking about this right now because I have pending tasks to do. 😆 But it’s nice to know roughly what we can do next time I get this dreaded 64K methods limit error.

  • Oishinbo lunch at Little Tokyo, Makati

    Oishinbo lunch at Little Tokyo, Makati

    So I’m gonna write a really quick post about our meal at Oishinbo, a Japanese restaurant in Little Tokyo, Makati. I’m just passing time as my Android Studio is running its Gradle build. ^o^;; My workstation is a bit too slow for the job.

    We went there for our last lunch with an office friend whose last day in the company is the day after. She likes Japanese food and she chose this place since she hasn’t tried Oishinbo’s food yet.

    Here’s . 3 pieces for each kind: salmon, tuna and squid that’s cut into cute rings.

    Moriawase: 3 x 3 kinds sashimi, P590


    I never paid attention to the slices of lemon that Japanese restaurants serve with sashimi. But a friend suggested I squeeze some lemon juice on my sashimi, and I liked the extra flavor it lent to the raw fish.

    Moriawase: 3 x 3 kinds sashimi, P590

    (Moriawase: 3 x 3 kinds sashimi, P590)

    My friends always liked the Spicy Tuna Maki (P298) at Izakaya Kikufuji and craved for that item while in another restaurant 😆 Good thing Oishinbo serves it too. It looks different and is not spicy at all, at least for us. But it was enjoyable. I think the mayonnaise was the key.

    Delicious but I didn't find it spicy at all
    Delicious but I didn’t find it spicy at all

    And here’s their beef curry.

    Beef Curry

    Gyu Don with mushrooms (P298):

    Gyu Don (Donburi) P298

    I didn’t realize this until now – that I forgot to take a picture of my own food! 😆 It’s probably because I was hungry and began eating immediately when the bowl was placed in front of me. But it was yummy! I especially enjoyed the crispy parts of the chicken.

    Oishinbo address:

    Little Tokyo, 2277 Chino Roces Avenue, Legaspi Village, Makati City

    Oishinbo, Makati store hours:

    May change without notice!
    10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Mon10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Tue10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Wed10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Thu10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Fri10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Sat10:30 AM to 2:30 PM, 5:30 PM to 11 PM
    Sun10:30 AM to 2:30 PM, 5:30 PM to 11 PM

    For Oishinbo menu, refer to this page: Oishinbo page at Zomato

  • Nivea Med Protection lip balm review: for painful chapped lips

    Nivea Med Protection lip balm review: for painful chapped lips

    Last year around December, I began having chronic chapping of my upper lip. I thought maybe it was simply because of the cold season. It’s still cooler than usual in the Philippines in January and February, and I still had chapping, peeling and stinging feeling on my upper lip. I just tried to ignore it, applying lip balm as often as I could, hoping that it would heal and be gone with the dry season.

    It’s summer and I still got red, irritated, peeling upper lip. It was as if I applied lip liner on my upper lip, without coating it with lipstick, plus there was visible peeling. How unsightly. What’s worse was that the chapping was becoming painful, even worse compared to what I had in dry season. It was painful to open my mouth to eat, or to even smile! 🙁 My upper lip crack when it’s stretched.

    I asked an office friend if she knows of any remedy for it, and she lent me her lip balm – Nivea Med Protection.

    20160406_093745

    I was embarrassed to use it at first, like, “is it okay for me to use yours?” I mean, a lip balm is a little bit too personal to share sometimes, right? xD But since I was already getting frustrated with the look and pain on my lip, and my kind friend seemed really okay with it since she saw how miserable the state of my lip was… I used the lip balm.

    It was like a magic lip balm!

    It glided on smoothly on my lips — the texture was buttery smooth, while the scent was very subtle but smelled so nice!

    Nivea Med Protection lip balm: immediate effect on chapped lips

    My upper lip was in a bad state that morning. Like I said, it looked like I lined my upper lip with red lip liner, and the peeling was visible. Nivea Med Protection did not conceal the redness, but it did make the peeling much less visible.

    It hurt my irritated, cracking lips when I smile… but right after applying Nivea Med Protection, it felt better. Not completely healed right away after applying, but really better! 😀

    Effect of Nivea Med Protection lip balm after several hours on chapped lips

    I applied the lip balm on my lips several times that day since morning. Around 5PM I felt that it’s really starting to heal. I passed by a Watson’s section in SM before going home and I bought my own Nivea Med Protection lip balm.

    20160406_193508

    One Nivea Med Protection lip balm costs 95 pesos.

    20160406_193444

    In the evening, around 8 PM, I felt as if my upper lip never got irritated during the day! I could finally smile without feeling my lip cracking. 😀 It still seemed a little bit red, and hurt a bit when I apply pressure, but felt perfectly fine otherwise.

    20160406_193814

    I used Nivea Med Protection lip balm everyday since then and the chronic chapping of my upper lip has not come back yet. Yay for me! Well, it still does peel a little bit everyday… which I think has been what’s “normal” for me for years. But that painful cracking lip condition is the one that hasn’t come back yet.

    By the way, I also bought Nivea Cream (moisturizer), the one in the blue tin container. I use it to moisturize my face, legs and feet because I have dry skin too in those areas. I also use it on my lips when I feel like subbing it for the lip balm… and it works well too! I’m starting to trust Nivea as a brand. At least for moisturizing the skin. 😉

    So yes, if you have badly chapped lips, please do try Nivea Med Protection! It will help you. It’s like a miracle lip balm to me. 😆

    Another piece of advice: avoid using really old lip balm, because they may cause bacterial infection. I just read this somewhere on the web. ^_^

    // UPDATE, 2016-04-13: Again, I’ve been getting mildly irritated upper lip from time to time, with redness lining it. But as long as I keep applying Nivea Med Protection on my lips, it keeps the irritation from getting worse. I’m so glad I discovered such product!

  • Plastic Memories – anime review

    Plastic Memories – anime review

    Warning: potential spoilers may be written in this post.

    In my previous posts, the common topic was Android app development. But this post is going to be about androids (robots) in the anime Plastic Memories. 🙂

    This anime features androids called “Giftia”, and they look and move exactly like humans — they can even get bruises, feel itching on their skin, and feel emotions just like humans. But their life span is only 81,920 hours or 9 years. When the life span is reached, they need to be retrieved. Otherwise, consequences follow due to the decline of the androids’ programming functions.

    Plastic Memories is a romantic drama sci-fi about Giftias, their lives with humans, and their retrieval when the “time” comes. The drama in Plastic Memories mostly comes from the retrieval process of Giftias. Comedy is also present in this show, and I guess the funny scenes are well done because it made me laugh, and it’s not very easy for comedy shows to make me laugh.:oops:

    Image source: MyAnimeList
    Image source: MyAnimeList

    Warning: I do try to avoid it, but potential spoilers may be written in this post.

    The ending was predictable and I would have enjoyed it more if something bizarre happened, but I still liked it. It like, you already know something’s gonna happen, but when it happens, you’re still affected. 😆

    Most anime shows are set in high school and I’m getting sick of high school anime characters. Plastic Memories is set in a workplace and it’s so refreshing!

    Maybe I’m just too serious a person, but even during the heartfelt scenes, what kept running in my head was how did people invent these androids? They have emotions just like humans – they feel sad, they fall in love, and they feel happiness. There were also scenes where Isla got bruised and felt itching on her legs. How in the world were humans able to program androids so that they could feel emotions and physical sensations? Fascinating, right?

    What bothers me the most is regarding the “rending of memories”. If technology in the world has advanced so much that we are able to build and program robots who look, move, bruise, itch, and love exactly like humans, WHY are we not able to develop something [I think] is much simpler like a backup system for Giftia’s memory. Why can’t we re-install the operating system and then recover backup?

    I wanted more sci-fi elements from Plastic Memories, unlike Full Metal Panic, which satisfied my liking for sci-fi well enough. I think Plastic Memories’ autopilot cars, translucent computer screens, and other futuristic inventions seem cool. Hmm… Isn’t it hard to read stuff on translucent screens though?

    By the way, I read in some online news that Full Metal Panic might get a new season. I really hope they push through the plan because I really liked that anime. 😀

    So yeah, to conclude this review…

    Plastic Memories is a really good anime as a “drama”. Prepare tissue or face towel for the tears you’re about to shed if you’re gonna watch this. 😆 I’m not satisfied with the science fiction part, but its comedy is good too.

    Watch Plastic Memories if you like anime set in a futuristic world, especially one that’s not in high school setting, and if you like it when makes you cry. 🙂



    Source featured image of this post: ZeroChan.net

  • CSS / JavaScript: Twitter Bootstrap center modal vertically on mobile web view

    I’ve been working with modal boxes using Twitter Bootstrap. And the page I’m working on needs to be viewed in mobile devices. The modal looks nice and centered when viewed on desktop, but when run in mobile web browsers, it’s aligned to the top.

    Someone on StackOverflow suggested the use of a helper div plus some custom CSS to align Bootstrap modals vertically.

    Code for modal:

    CSS:

    Source: Vertically centering Bootstrap modal window

  • JavaScript: Get current function name

    getCallingFunctionName() is the important function here.

    Source: Can I get the name of the currently running function in JavaScript?

  • Android: Switch into another activity

    To switch into another activity, the method we use is startActivity().

    This is what starts another Android activity:

    Replace NameOfActivity with the name of any activity you’d like to switch into.

  • Android: Basic WebView Tutorial

    A WebView lets you pull a web page and display it in your Android app. It doesn’t take long to implement an Android WebView. Read on. I’ll show you how.

    AndroidManifest.xml

    First, open your manifest file to add this permission for INTERNET:

    The web page won’t be loaded into your app without this permission.

    This is how my manifest file looks like:

    Path: ...\MyAndroidStudioProjects\WebView\app\src\main\AndroidManifest.xml

    activity_main.xml

    Then we’re adding a WebView element to the XML file. My XML file is named activity_main.xml

    Path: ...\MyAndroidStudioProjects\WebView\app\src\main\res\layout\activity_main.xml

    MainActivity.java

    I have MainActivity.java here, which loads activity_main.xml and then loads a web page (google.com) into the WebView.

    Path: ...\MyAndroidStudioProjects\WebView\app\src\main\java\net\catzie\webview\MainActivity.java

    The following line of code attaches the WebView whose id is “webview” to the variable “webView”:

    And this allows JavaScript in the WebView:

    This one is what actually loads a given URl into the WebView: