All Articles by wiciwit

91 Articles

99 Bottles of Beer Song in Swift

These lyrics should be your output. My solution in Swift is at the end of this post.

99 Bottles of Beer Song Lyrics

99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.

96 bottles of beer on the wall, 96 bottles of beer.
Take one down and pass it around, 95 bottles of beer on the wall.

95 bottles of beer on the wall, 95 bottles of beer.
Take one down and pass it around, 94 bottles of beer on the wall.

94 bottles of beer on the wall, 94 bottles of beer.
Take one down and pass it around, 93 bottles of beer on the wall.

93 bottles of beer on the wall, 93 bottles of beer.
Take one down and pass it around, 92 bottles of beer on the wall.

92 bottles of beer on the wall, 92 bottles of beer.
Take one down and pass it around, 91 bottles of beer on the wall.

91 bottles of beer on the wall, 91 bottles of beer.
Take one down and pass it around, 90 bottles of beer on the wall.

90 bottles of beer on the wall, 90 bottles of beer.
Take one down and pass it around, 89 bottles of beer on the wall.

89 bottles of beer on the wall, 89 bottles of beer.
Take one down and pass it around, 88 bottles of beer on the wall.

88 bottles of beer on the wall, 88 bottles of beer.
Take one down and pass it around, 87 bottles of beer on the wall.

87 bottles of beer on the wall, 87 bottles of beer.
Take one down and pass it around, 86 bottles of beer on the wall.

86 bottles of beer on the wall, 86 bottles of beer.
Take one down and pass it around, 85 bottles of beer on the wall.

85 bottles of beer on the wall, 85 bottles of beer.
Take one down and pass it around, 84 bottles of beer on the wall.

84 bottles of beer on the wall, 84 bottles of beer.
Take one down and pass it around, 83 bottles of beer on the wall.

83 bottles of beer on the wall, 83 bottles of beer.
Take one down and pass it around, 82 bottles of beer on the wall.

82 bottles of beer on the wall, 82 bottles of beer.
Take one down and pass it around, 81 bottles of beer on the wall.

81 bottles of beer on the wall, 81 bottles of beer.
Take one down and pass it around, 80 bottles of beer on the wall.

80 bottles of beer on the wall, 80 bottles of beer.
Take one down and pass it around, 79 bottles of beer on the wall.

79 bottles of beer on the wall, 79 bottles of beer.
Take one down and pass it around, 78 bottles of beer on the wall.

78 bottles of beer on the wall, 78 bottles of beer.
Take one down and pass it around, 77 bottles of beer on the wall.

77 bottles of beer on the wall, 77 bottles of beer.
Take one down and pass it around, 76 bottles of beer on the wall.

76 bottles of beer on the wall, 76 bottles of beer.
Take one down and pass it around, 75 bottles of beer on the wall.

75 bottles of beer on the wall, 75 bottles of beer.
Take one down and pass it around, 74 bottles of beer on the wall.

74 bottles of beer on the wall, 74 bottles of beer.
Take one down and pass it around, 73 bottles of beer on the wall.

73 bottles of beer on the wall, 73 bottles of beer.
Take one down and pass it around, 72 bottles of beer on the wall.

72 bottles of beer on the wall, 72 bottles of beer.
Take one down and pass it around, 71 bottles of beer on the wall.

71 bottles of beer on the wall, 71 bottles of beer.
Take one down and pass it around, 70 bottles of beer on the wall.

70 bottles of beer on the wall, 70 bottles of beer.
Take one down and pass it around, 69 bottles of beer on the wall.

69 bottles of beer on the wall, 69 bottles of beer.
Take one down and pass it around, 68 bottles of beer on the wall.

68 bottles of beer on the wall, 68 bottles of beer.
Take one down and pass it around, 67 bottles of beer on the wall.

67 bottles of beer on the wall, 67 bottles of beer.
Take one down and pass it around, 66 bottles of beer on the wall.

66 bottles of beer on the wall, 66 bottles of beer.
Take one down and pass it around, 65 bottles of beer on the wall.

65 bottles of beer on the wall, 65 bottles of beer.
Take one down and pass it around, 64 bottles of beer on the wall.

64 bottles of beer on the wall, 64 bottles of beer.
Take one down and pass it around, 63 bottles of beer on the wall.

63 bottles of beer on the wall, 63 bottles of beer.
Take one down and pass it around, 62 bottles of beer on the wall.

62 bottles of beer on the wall, 62 bottles of beer.
Take one down and pass it around, 61 bottles of beer on the wall.

61 bottles of beer on the wall, 61 bottles of beer.
Take one down and pass it around, 60 bottles of beer on the wall.

60 bottles of beer on the wall, 60 bottles of beer.
Take one down and pass it around, 59 bottles of beer on the wall.

59 bottles of beer on the wall, 59 bottles of beer.
Take one down and pass it around, 58 bottles of beer on the wall.

58 bottles of beer on the wall, 58 bottles of beer.
Take one down and pass it around, 57 bottles of beer on the wall.

57 bottles of beer on the wall, 57 bottles of beer.
Take one down and pass it around, 56 bottles of beer on the wall.

56 bottles of beer on the wall, 56 bottles of beer.
Take one down and pass it around, 55 bottles of beer on the wall.

55 bottles of beer on the wall, 55 bottles of beer.
Take one down and pass it around, 54 bottles of beer on the wall.

54 bottles of beer on the wall, 54 bottles of beer.
Take one down and pass it around, 53 bottles of beer on the wall.

53 bottles of beer on the wall, 53 bottles of beer.
Take one down and pass it around, 52 bottles of beer on the wall.

52 bottles of beer on the wall, 52 bottles of beer.
Take one down and pass it around, 51 bottles of beer on the wall.

51 bottles of beer on the wall, 51 bottles of beer.
Take one down and pass it around, 50 bottles of beer on the wall.

50 bottles of beer on the wall, 50 bottles of beer.
Take one down and pass it around, 49 bottles of beer on the wall.

49 bottles of beer on the wall, 49 bottles of beer.
Take one down and pass it around, 48 bottles of beer on the wall.

48 bottles of beer on the wall, 48 bottles of beer.
Take one down and pass it around, 47 bottles of beer on the wall.

47 bottles of beer on the wall, 47 bottles of beer.
Take one down and pass it around, 46 bottles of beer on the wall.

46 bottles of beer on the wall, 46 bottles of beer.
Take one down and pass it around, 45 bottles of beer on the wall.

45 bottles of beer on the wall, 45 bottles of beer.
Take one down and pass it around, 44 bottles of beer on the wall.

44 bottles of beer on the wall, 44 bottles of beer.
Take one down and pass it around, 43 bottles of beer on the wall.

43 bottles of beer on the wall, 43 bottles of beer.
Take one down and pass it around, 42 bottles of beer on the wall.

42 bottles of beer on the wall, 42 bottles of beer.
Take one down and pass it around, 41 bottles of beer on the wall.

41 bottles of beer on the wall, 41 bottles of beer.
Take one down and pass it around, 40 bottles of beer on the wall.

40 bottles of beer on the wall, 40 bottles of beer.
Take one down and pass it around, 39 bottles of beer on the wall.

39 bottles of beer on the wall, 39 bottles of beer.
Take one down and pass it around, 38 bottles of beer on the wall.

38 bottles of beer on the wall, 38 bottles of beer.
Take one down and pass it around, 37 bottles of beer on the wall.

37 bottles of beer on the wall, 37 bottles of beer.
Take one down and pass it around, 36 bottles of beer on the wall.

36 bottles of beer on the wall, 36 bottles of beer.
Take one down and pass it around, 35 bottles of beer on the wall.

35 bottles of beer on the wall, 35 bottles of beer.
Take one down and pass it around, 34 bottles of beer on the wall.

34 bottles of beer on the wall, 34 bottles of beer.
Take one down and pass it around, 33 bottles of beer on the wall.

33 bottles of beer on the wall, 33 bottles of beer.
Take one down and pass it around, 32 bottles of beer on the wall.

32 bottles of beer on the wall, 32 bottles of beer.
Take one down and pass it around, 31 bottles of beer on the wall.

31 bottles of beer on the wall, 31 bottles of beer.
Take one down and pass it around, 30 bottles of beer on the wall.

30 bottles of beer on the wall, 30 bottles of beer.
Take one down and pass it around, 29 bottles of beer on the wall.

29 bottles of beer on the wall, 29 bottles of beer.
Take one down and pass it around, 28 bottles of beer on the wall.

28 bottles of beer on the wall, 28 bottles of beer.
Take one down and pass it around, 27 bottles of beer on the wall.

27 bottles of beer on the wall, 27 bottles of beer.
Take one down and pass it around, 26 bottles of beer on the wall.

26 bottles of beer on the wall, 26 bottles of beer.
Take one down and pass it around, 25 bottles of beer on the wall.

25 bottles of beer on the wall, 25 bottles of beer.
Take one down and pass it around, 24 bottles of beer on the wall.

24 bottles of beer on the wall, 24 bottles of beer.
Take one down and pass it around, 23 bottles of beer on the wall.

23 bottles of beer on the wall, 23 bottles of beer.
Take one down and pass it around, 22 bottles of beer on the wall.

22 bottles of beer on the wall, 22 bottles of beer.
Take one down and pass it around, 21 bottles of beer on the wall.

21 bottles of beer on the wall, 21 bottles of beer.
Take one down and pass it around, 20 bottles of beer on the wall.

20 bottles of beer on the wall, 20 bottles of beer.
Take one down and pass it around, 19 bottles of beer on the wall.

19 bottles of beer on the wall, 19 bottles of beer.
Take one down and pass it around, 18 bottles of beer on the wall.

18 bottles of beer on the wall, 18 bottles of beer.
Take one down and pass it around, 17 bottles of beer on the wall.

17 bottles of beer on the wall, 17 bottles of beer.
Take one down and pass it around, 16 bottles of beer on the wall.

16 bottles of beer on the wall, 16 bottles of beer.
Take one down and pass it around, 15 bottles of beer on the wall.

15 bottles of beer on the wall, 15 bottles of beer.
Take one down and pass it around, 14 bottles of beer on the wall.

14 bottles of beer on the wall, 14 bottles of beer.
Take one down and pass it around, 13 bottles of beer on the wall.

13 bottles of beer on the wall, 13 bottles of beer.
Take one down and pass it around, 12 bottles of beer on the wall.

12 bottles of beer on the wall, 12 bottles of beer.
Take one down and pass it around, 11 bottles of beer on the wall.

11 bottles of beer on the wall, 11 bottles of beer.
Take one down and pass it around, 10 bottles of beer on the wall.

10 bottles of beer on the wall, 10 bottles of beer.
Take one down and pass it around, 9 bottles of beer on the wall.

9 bottles of beer on the wall, 9 bottles of beer.
Take one down and pass it around, 8 bottles of beer on the wall.

8 bottles of beer on the wall, 8 bottles of beer.
Take one down and pass it around, 7 bottles of beer on the wall.

7 bottles of beer on the wall, 7 bottles of beer.
Take one down and pass it around, 6 bottles of beer on the wall.

6 bottles of beer on the wall, 6 bottles of beer.
Take one down and pass it around, 5 bottles of beer on the wall.

5 bottles of beer on the wall, 5 bottles of beer.
Take one down and pass it around, 4 bottles of beer on the wall.

4 bottles of beer on the wall, 4 bottles of beer.
Take one down and pass it around, 3 bottles of beer on the wall.

3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 2 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.

No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.

Solution in Swift:

import UIKit

func beerSong(forThisManyBottlesOfBeer totalNumberOfBottles:Int) -> String {

    var lyrics: String = ""

    for number in (0...totalNumberOfBottles).reversed() {

        if number > 1 {let newLine: String = "\n\(number) bottles of beer on the wall, \(number) bottles of beer. \nTake one down and pass it around, \(number - 1) bottles of beer on the wall. \n"

            lyrics += newLine

        } else if number == 1 {

            lyrics += "\n\(number) bottle of beer on the wall, \(number) bottle of beer. \nTake one down and pass it around, no more bottles of beer on the wall. \n"

        } else if number == 0{

            lyrics += "\nNo more bottles of beer on the wall, no more bottles of beer. \nGo to the store and buy some more, 99 bottles of beer on the wall.\n"

        }

    }

    return lyrics

}

print(beerSong(forThisManyBottlesOfBeer:99))

Customizing WordPress Twenty Fourteen Theme

Remove left sidebar:

http://wphow2s.com/twentyfourteen-child-RL.zip

Keeps sidebar:

http://wphow2s.com/twentyfourteen-child.zip

Here’s are the 15  CSS snippets to add to your child theme, to tweak your Twenty Fourteen website further. Some of the code snippets are already included in the 2 DFY child themes, so double check.

I would suggest adding one snippet at a time and making sure it works (in case you didn’t copy the code right, or it just doesn’t work period–things happen 🙂

Make sure that you get all of the code, including the /* */ opening & closing tags for the comments.

Hover your mouse on the icon on the top right of the code box to highlight code.

1.This center aligns 2014:

/*this center aligns site */

.site {
    margin: 0 auto;
        }
        
/*end center align code */

2. This will make featured images span full-width:

 /* span featured images full-width of content */

.post-thumbnail img {
        width: 100%;
        }

/* end span featured image code */

3. Use this to adjust the indenting of content into featured image:

/* remove/adjust featured image indent (default -48px) change to 0 (zero) for no indent */

.site-content .has-post-thumbnail .entry-header {
  margin-top: -48px;
}

/* end indent code */

4. Adjust padding between top of content and header:

/* adjust padding between top of content and header  72px default */

.content-area, .content-sidebar {
  padding-top: 72px;
}

/* end adjust padding between top of content & header */

5. Adjust maximum width of content (don’t use this if you used the remove left sidebar code or child theme–the code to adjust is included):

/*  Content max-width adjust 630px as needed (default 474px)  */

    .site-content .entry-header,
    .site-content .entry-content,
    .site-content .entry-summary,
    .site-content .entry-meta,
    .page-content {
    margin: 0 auto;
    max-width: 630px;}
    
    /*  End of max-width code  */​

6. Align navigation menu:

/* align nav menu (adjust header-main text-align value) */

.header-main {
 text-align: right;
}

.primary-navigation {
 float: none;
}

.primary-navigation li {
 text-align: left;
}

/*end align nav menu*/

7. Adjust current & link hover color, decoration:

/* link color - current & hover change text-decoration to none if link underline not wanted*/
		
		a:active, a:hover {
	color: #41a62a;
	  text-decoration: underline;
}

/* end current & hover link code */

8. Adjust link color – content sidebar widget links:

/* link color - content sidebar widget links */

.content-sidebar .widget a {
  color: #224488;
}

/* end content-sidebar widget link code */

9. Adjust link color, decoration:

/* link color -can underline links by changing text-decoration to underline */
a {
  color: #24890D;
  text-decoration: none;
}

/* end link color */

10. Adjust featured content (in grid header) padding:

/*controls height of featured content padding*/

.grid .featured-content .entry-header {
  height: 70px;
}

/*end code height of featured content padding*/

11. Remove meta data in featured content (grid header)::

/*removes meta data of categories by display: none*/

.featured-content .entry-meta {
  color: #FFFFFF;
  display: none;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.09091;
  margin-bottom: 12px;
}

/* end meta data categories */

12. Adjust page & post title font size:

/*Page titles*/

.entry-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.09091;
  margin: 0 0 12px;
  text-transform: uppercase;
}

/* end page titles*/

13. Adjust site title font size & color:

/*site title font size & color, etc*/

.site-title a, .site-title a:hover {
  color: #FFFFFF;
  font-size: 26px;
}

/* end site title */

14. Remove auto text hyphenation:

/*No auto text hyphenation*/

.entry-content,
.entry-summary,
.page-content {
	-webkit-hyphens: none;
	-moz-hyphens:    none;
	-ms-hyphens:     none;
	hyphens:         none;
	word-wrap: normal;
}

.nav-links {
	-webkit-hyphens: none;
	-moz-hyphens:    none;
	-ms-hyphens:     none;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
	hyphens:         none;
	word-wrap: normal;
}

.comment-content {
	-webkit-hyphens: none;
	-moz-hyphens:    none;
	-ms-hyphens:     none;
	hyphens:         none;
	word-wrap: normal;
}

.widget {
	font-size: 14px;
	-webkit-hyphens: none;
	-moz-hyphens:    none;
	-ms-hyphens:     none;
	hyphens:         none;
	line-height: 1.2857142857;
	margin-bottom: 48px;
	width: 100%;
	word-wrap: normal;
}

/* end no auto text hyphenation*/

15. Use so sub-menu navigation item in left sidebar isn’t covered by slider image:

/*This is so a sub-navigation menu item in the left sidebar menu is not
 covered by a slider image*/

#secondary {
  z-index: 9999;
}

/* end sub-menu code */

Source: http://wphow2s.com/wordpress/twenty-fourteen-css-tweaks-child-theme/

 

Sharing WIFI password with guests is breeze on iOS11

Yesterday I had to share my wifi password with one of my friend when he came over to visit. I am one of the guys who have really long passwords which are very hard to remember. So I went to see the wifi password in my 1Password app and there it was. iOS’ another subtle feature that Apple never advertised it. My iPhone which was also connected to wifi asked me if I wanted to share that password with my friend. That was cool!

IMG_0072.PNG

Here is how you do it;

  1. Ask your friend to tap on your wifi SSID in ‘Settings’ app on his iPhone
  2. Unlock your phone which is already connected to the same wifi.
  3. Just tap on ‘Share Password’ button.

IMG_0073.PNG

If you want to see it in action. Just hit forget password on wifi on a phone in your home and try sharing it. I do not believe this works with iPhone to Android.

Game Review: Need for Speed Payback

Release Date: Nov 10th 2017
WICIWIT Rating: 4.5/10
Playtime: Not sure but the campaign is said to be around 8 hours long.
Website: https://www.ea.com/games/need-for-speed/need-for-speed-payback

Plot: NFS Payback allows players to play as three different characters during the campaign of this game. The game mode focuses on so-called action-packed gaming experience than the simulator car driving experience. If you are looking for driving fun then you have already lost your bet on this game.

Multiple car options are there and with pre-order of the deluxe edition of the game, players get some additional cars. These additional cars are only available for free roam and not in any races as events are pretty much restricted to classes.

Each of the Three game characters have specific skillset when it comes to car classes. During the game campaign, the course takes players through action sequences, cut-scenes and switching of character as predefined directed game plan. Users cannot select or change characters like they can do it in Grand Theft Auto.

Cops and enemy system also feels like restricted. Every time you get into a cop chase the game provides you certain checkpoints to go through as if it’s a time trial. If you do not get caught and don’t run out of time until you reach the final checkpoint, all the cop cars magically disappear. This restricts players from being creative in avoiding cops and enemies in those chase sequences. You cannot be unpredictable to the game AI and make that sudden turn to throw it off. In some instances when I was poorly driving, the cop car chasing me actually went ahead and made the turn before even I realized that I have to make that turn to get to the next checkpoint.

Reward system presents you with random cards to flip at the end of the race and it’s basically all your luck. Customization feels only affects aesthetics and doesn’t really change the performance and handling of the car. All cars felt more or less same to me.

Conclusion: It’s mediocre!If you have pre-ordered this game, RETURN IT! I was excited about this game and was expecting this new NFS title to improve driving and handling experience of cars. Not as good as Forza titles but somewhere close to that. The game looks gorgeous in Las Vegas and surrounding area setting but the player experience is worst than previous NFS titles.

Sources: ea.com

iPhone X; all hope not lost for single hand operation

As everyone probably know by now, iPhone X is not a phone you can use with single hand. In fact none of the phones after iPhone 6 are not ideal for use with one hand because users cannot reach all corners of the screen without adjusting hand grip. The problem is not limited to just iPhones and it applies to any phone that is bigger than iPhone 5, 5s or 5SE.

Solution? Apple implemented reachability feature on all iPhones since Touch ID was introduced. The operation is simple, double tapping (not click) on home button on your iPhone will bring the whole screen half way down so users can reach top corners of screen without having to adjust the grip on the device. Feature works flawlessly on all iPhones. But if you are thinking iPhone X cannot do that becuase it DOES NOT have a home button to tap on, then you’d be wrong.

Reachability on iPhone X. I haven’t seen any reviewers talk specifically about this feature and thought I would shed some light on it. iPhone X uses swipe-up action from bottom notch on the screen to give the default home-button-press action i.e. closing your apps. Swipe-down on the bottom edge notch will give users reachability option. This would particularly come in handy if you wish to use your iPhone X with one hand without adjustting grip risking the fall.

Reachability is not enabled by default and would need activation via Accessibility menu in Settings app. Here is how it works.

Awkward: Swiping down on botton notch is not really intuitive and took some time to master but, I guess fans would not mind training their hand mussles get used to this new workout.

iOS 11: 3D Touch Multitasking and new Emojis

iOS has been advancing very fast since version 8. Currently there is almost no need to actually jailbreak iOS for any new functionality. Engineers at Apple have done good job in mimicking all those fan favorite jailbreak and some of android features. iOS 11 is definitely a big leap for Apple devices especially for iPad however, Apple messed up when they took out 3D touch multitasking functionality from their initial iOS 11 release. They did not announce anything or mentioned anything as this was a negative point on their “fantastic” iOS 11 release. Later Apple told multiple news resources that the functionality was eliminated because it was causing trouble somehow on iPads.

With iOS 11.1 update Apple kept it’s promise to bring this function back. iOS 11.1 also came with several new emojis and the Internet is going crazy about it.

3D touch multitasking is back on iOS 11.1

Here are some of the new emojis introduced in iOS 11.

Apple Music for $5 per month is not a bad idea

Buying music was never my thing until I was introduced to iTunes. I used to listen to radio or just pirate my music whenever I really wanted to hear those famous songs. Yes, I downloaded music when I was staying with my parents and paying for my tuitions. everyone out there does that, so get over it.

Now I buy music but, now that is an old thing too! Last year when apple released their Apple Music streaming service I was excited because it came with 3 months of free subscription. In those 3 months I really didn’t use any streaming because I had all the latest music that I really really wanted to listen to and didn’t feel the need of buying any new music. Once the free trial period got over I absolutely did not want to pay $10/month for the music I love and not keep it with me if I choose not to pay monthly fees anymore.

Recently I came across one amazing option that will still allow me to listen to new music and just in half the price. I sure am a music love and absolutely cannot live without it. So to stay sane in life $5 is really not a bad price. iTunes is one of the reliable source to the highest quality music out in the world.

Even though I think Apple Music is the best quality music streaming service out there I still wouldn’t pay $10/month for it. So how to get Apple Music for $5/month? You need to have a student’s account. If you are a student, you can get Apple Music for half the price of their individual subscription. You can validate your account with your school email. Click the link below and verify your account as student account and start using Apple Music for $0.99 for first 3 months and at discounted price later.

Visit https://www.myunidays.com/perks/view/applemusic/online for validation of your student account.

Caution: If you reach 48 months of Student Membership or they find that you are not a student anymore, your membership automatically becomes an Apple Music Individual Membership. Because, once you’re hooked on them they will rip you off any way. Until then, enjoy!! 🙂