Life as Clay

Archive for January 2011

Cocoa: How to close the system color picker panel

with 3 comments

I have a color well in the preferences sheet of the app that I’m building. When I selected a color and then closed the preferences sheet, the system color panel did not automatically close. I googled this and didn’t find an answer immediately, so I searched through the docs. This is the method that I use to close the preferences sheet now:

-(IBAction) hidePreferencesSheet:(id)sender {
	[NSApp endSheet:preferencesSheet];

	if ([NSColorPanel sharedColorPanelExists]) {
		[[NSColorPanel sharedColorPanel] close];

	[preferencesSheet orderOut:sender];

Basically, NSColorPanel is the class that you’re dealing with. The class method +(BOOL)sharedColorPanelExists tells you whether the panel is open. NSColorPanel is a subclass of NSWindow. I use [NSColorPanel sharedColorPanel] to return the system color panel and then the NSWindow close method to close it. Pretty simple!


Written by Clay

January 22, 2011 at 10:10

Posted in Cocoa, Objective-C

Advice for new fathers: A word about patience

leave a comment »

Late night infant care is challenging for many reasons. It is jarring to care for a < 10 lb baby who is shrieking in your ear at 3am. During the day, we have time to notice early feeding cues — rooting, “boob diving” (as I like to call it), and fussiness. During the night, we usually aren’t woken by our infants until they are very hungry and crying loudly. If your wife is exclusively breastfeeding the baby, then, as a father, you may not have much to do during the night.

Our daughter was born a little small, so she received bottles of fortified breast milk several times each day. Doctors suggested giving her these bottles during the night so that mama can get a little sleep. The result is that I’ve fed our child many times during the night.

Books and doctors recommend developing a dialogue with your child during feeding and while changing diapers. If you’re like me, it’s difficult to make cooing noises or even come up with a single coherent sentence at 3am.

Bottle feeding during the night also is frustrating because your child wakes you up with shrieks of hunger, yet you still have to prepare the bottle — warm it up, etc.

Here are a few things to keep in mind if you find yourself frustrated during night feedings:

  1. Your infant does not have control over her limbs. She will flail them around (just like during the day), sometimes impeding your efforts to feed her. Controlling her arms for her frequently will help her calm down a little bit; that’s the whole theory behind swaddling.
  2. Prepare your night feeding and changing areas. Put something near the diaper station that you can read from while changing diapers, if you find yourself having a hard time self-initiating a 3am dialogue. This can even be the ingredients list from a bottle of baby shampoo or something; just speak it in a baby friendly tone to help reassure your child while changing her. Other possibilities: read sports scores, an article from a magazine, sing a song, etc.
  3. Changing your baby’s diaper tends to wake her up a little bit, so if she’s already screaming and the bottle is ready, try feeding her before changing the diaper.
  4. Prepare a blanket or activity mat near the feeding area for use during the night. You may find yourself needing both of your hands during night sessions. You can place your child on the mat for a little supervised tummy time while you use your hands to prepare a bottle, etc.
  5. Prepare bottles before going to bed. I usually have two of them ready to go in the fridge.
  6. Make sure that all other supplies you need are nearby: a burp cloth, diapers, diaper wipes, a swaddle blanket, etc.
  7. Infants are more awake during the night than during the day, frequently. While daytime feedings frequently immediately precede a nap, your child may remain awake for hours after a night feeding. You can use the aforementioned activity mat or blanket for some tummy time while you wait for your child to sleep. Have a few toys or books nearby that you can use to engage your child.
  8. Take time to learn the techniques from The Happiest Baby on the Block. There are some cool swaddle holds that you can use to instantly quiet your crying baby. It’s like magic. Sometimes all you need in order to get through these feedings is a little bit of quiet.
  9. Remember that over stimulation can make your baby fussy. Sometimes your child needs to be left alone (not patted, touched, cooed at, etc.) in order to find peace.
  10. Infants are not able to understand punishment. Do not punish your infant for any reason. The burden is on you to handle the difficulties presented during night feedings.

Finally, regardless of how patient you are or all of the wonderful things that you wish for your child through a glorious life, a screaming baby will test that patience during the night. Learn to recognize your limits. If you get too frustrated you are likely to blame the child for your own frustration. This can lead to anger. When you find yourself approaching the limit, try some hands-off tummy time for a few minutes. If that doesn’t work, wake up your partner and tell her that you need help. Tell her that you are frustrated and having a difficult time.

You sometimes will feel that your well of patience is empty when you are sleep deprived and trying to figure out how to console an inconsolable infant. Put the child down, take a few deep breaths, relax, and move forward with your established process. These can be challenging times and it is up to you to find the strength to endure them peacefully.

Written by Clay

January 14, 2011 at 11:19

Advice for new fathers: Read about breastfeeding

leave a comment »

I’m a new father. My daughter, Blythe, was born 3 weeks early, on 28 December 2010. She’s a beautiful girl and my wife and I are having a blast getting to know her and trying to make sense of her nonsensical sleep patterns. :)

Prior to her birth, I asked a lot of friends whether they had any specific parenting advice for new fathers. Most of the books and material in our (American) society focuses on preparing the mother for child rearing duties. I presumed that there were some specific bits of info that would really help me, as a father, prepare for Blythe’s arrival. None of my friends had much to say specific to fathers. Most nonchalantly suggested I just read the same books and support my wife as much as possible.

They were right about that. Reading the books is important. I’m learning, however, that there are steps that fathers can take to prepare for fatherhood, ease anxiety, and provide better support. I’m going to occasionally post my own lessons learned. Here’s the first:

Become a breastfeeding expert; an ad hoc lactation consultant

I flipped through a lot of books prior to Blythe’s arrival, focusing mainly on issues related to pregnancy, bathing infants, etc. In spite of an active interest in helping my wife with anything possible, I always skipped the chapters on breastfeeding because I assumed that there wasn’t much that I could do to help her with that. I was very wrong.

Blythe arrived a little early and was delivered via C-section (for medical reasons). My wife read several pregnancy books prior to her arrival, but both she and I were caught off guard by the anxiety caused by the first 2 weeks of breastfeeding. Most books claim that a new mother’s milk will arrive 4-5 days after the birth of the child, but in the case of a C-section, it is more like 7-9 days after birth. This is a very stressful period.

During the ~6-7 days that it took my wife’s milk to arrive, she consistently was pushed by the hospital staff to use a breast pump regularly. We found ourselves using small TB syringes to collect the tiniest drops of colostrum from pump pieces that seemed sized for cattle. On a “good” day, during the first week, we were able to collect 1-2 mL of colostrum. We could have had an army of lactation consultants reassuring us that her milk would come in, but it surely didn’t feel that way. My wife, during this time, was too busy recovering from surgery, visiting Blythe in the nursery, and using a breast pump to read about breast feeding.

Troubles with “latching on” are as anxiety-provoking as the lack of milk and the worries compound with the knowledge that, even if Blythe did latch on, she was only getting a drop or two of milk. I was tired. If you find yourself in a similar situation, you will be tired. Take my advice, however, and use this time (if you haven’t done so earlier) to become a household expert on breastfeeding. I strongly recommend the book “Breastfeeding Made Simple: Seven Natural Laws for Nursing Mothers,” by Mohrbacher. (link)

The effort that you put into understanding how breasts work and the knowledge that you gain about proper positioning, latching-on techniques, and milk production will allow you to fill in the gaps in your partner’s knowledge that lead to anxiety. With a pair of educated hands, you will be able to help her properly position the baby, shape the nipple, and get it into the child’s mouth for latching-on. The moment of first latch-on is a victory for everybody involved. When your partner’s milk comes in and your baby latches onto her nipple — when you can see the baby actively swallowing milk from the breast… this is a moment of triumph for all three of you.

Your partner’s knowledge of breastfeeding quickly will surpass yours, as she develops a feeding pattern and your child gains motor control. Your assistance in achieving this relationship can lower the anxiety greatly, improve the efficiency of feeding, and importantly, make you feel like an active participant in the process.

Written by Clay

January 11, 2011 at 12:56