OS X (Lion) .DS_Store disabling

OS X (Lion) .DS_Store disabling

May 17

Because we show hidden files in finder, primarily for the reason of being able to see/edit profile settings, git, and htaccess files, a problem that has just been silently bothering me for years has just reached a fever pitch as I’m trying to finalize a directory structure to upload. Sure, most programs worth their salt have an option to ignore files to upload/sync but it goes deeper than this – I JUST DON’T WANT THEM THERE.

I think anyone who argues about the utility of controlling files that are silently placed/replaced in potentially sensitive dirs (i.e. source code) doesn’t have enough experience to provide an opinion, even windows gives you the option to disable thumbnail caching (thumbs.db). The argument of “This is the way apple did it, therefore, obviously it’s a good design, you’re the one doing it wrong” is lacking substance.

In searching for potential solutions to disable the creation of .DS_Store files in EVERY. SINGLE. DIR. I offer the following solutions.

Cleanup

This will recursively clean up the offending files within whatever directory you point it. In Terminal (/Applications/Utilities/Terminal.app) – you may have to sudo depending on your target directory.

cd /Volumes/Dev [change to whatever dir you want to clean]
find . -name '*.DS_Store' -type f -delete

Solution #1: Brute Force

After having deleted the .DS_STORE files, I came across this solution and have been running it with success on Lion http://www.aorensoftware.com/blog/2011/12/24/death-to-ds_store/ it does a live patch on Finder to simply replace the function responsible for creating these files thus they simply Won’t be created. It includes a Launchd agent for setting this up at every reboot (Finder is not physically modified). This method completely disables Finder’s ability to remember view settings on folders that don’t already have them such as which view mode – Icon/Column/List, Window Size, Sorting, etc. are customized.

Solution #2: Redirection

Asepsis by BinaryAge (maker of TotalFinder and TotalTerminal – my fave) http://asepsis.binaryage.com/  is a cleaner solution in that it preserves the expected functionality which is ideal. Only drawback is it seems to break on every OS X version update.  The author is very diligent however so it usually stays current.

While the first solution simply disables .DS_Store creation altogether – which will have the effect of folders not remembering their setting – this solution, re-routes the process of .DS_Store creation to a unified cache directory for all folders (rather than storing it in each one) hence maintaining the correct functionality while keeping everything clean.

Other Solutions

Cleanup on External drives: http://www.zeroonetwenty.com/blueharvest4/ (not free) provides an easy way to clean up external drives so they may be shared on other systems without showing evidence of their having been used on a mac (i.e. .Trashes, .FSEvent stores, Spotlight stores, etc.)

Prevention on Network Shares: (Apple KB)

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Thanks to http://danilo.ariadoss.com/how-to-recursively-remove-ds_store-files-on-mac-os-x/  and many others for the cleanup step

For more info http://en.wikipedia.org/wiki/.ds_store

May 17

OS X Mountain Lion – Disable Notification Center

OS X Mountain Lion – Disable Notification Center

May 01

If you’re like me and don’t really make use of the features the new Notification Center offers, there’s an easy way to disable it and remove the its icon in the menu bar.

To permanently remove the notification center,
In terminal (/Applications/Utilities/Terminal – or press CMD+SPACE and type “Terminal”, hit ENTER)

sudo launchctl remove com.apple.notificationcenterui.agent
launchctl remove com.apple.notificationcenterui.agent

It will ask you for your login password, presumably, your account is an administrator. One of those commands may output “launchctl remove error: No such process”, this is normal. The Notification center agent may or may not run as a system service, or a user service.

Contrary to changing the application’s  file permissions (which will revert if you ever need to repair the permissions for the disk), This will prevent it from launching in the first place – since setting the permission to make it unavailable pollutes the syslog as the launchd process attempts to load the notification center continuously.

To Restore the Notification Center,

sudo launchctl submit -l com.apple.notificationcenterui.agent -p /System/Library/CoreServices/NotificationCenter.app/Contents/MacOS/NotificationCenter

no fuss no muss, no permissions to set/reset.

Install Fuppes (0.661+) on Ubuntu 9.10 Karmic x64

Install Fuppes (0.661+) on Ubuntu 9.10 Karmic x64

Jan 19

I was having a tough time finding thorough, up to date instructions not requiring any compiler hacks on setting up a good well rounded fuppes media server with transcoding/thumbnailing support for my PS3.

What you see here are corrected instructions put together from various forums and web posts and the Fuppes wiki (links to follow)

FUPPES .661+ INSTALL INSTRUCTIONS FOR UBUNTU (Debian) 9.10 Karmic 64 bit

MySQL – Excellent performance with good planning

MySQL – Excellent performance with good planning

Jul 31

This is nothing new to add to the world of comparisons, but I felt it worth clarifying a few points that I – someone who’s not a complete pro, yet not a novice — I’d say intermediate developer – have learned about working with MySQL in terms of when to use what and improving efficiency based on an average of all information researched, and the results I achieved.

Normally, most of my work has been with small low traffic websites for various small businesses where efficiency planning was mostly too time consuming for the cost. Recently have been working on higher traffic applications and after running into a “too many connections” issue during peak hours tried many initial steps at alleviating the problem, such as increasing efficiency in my database abstraction class (starting with lazy loading), and releasing result sets asap among a few others. Each step added a performance gain, but not until all matters were taken into account did it make a difference.

These changes quickly formed into my personal list of best practices and good habits to get into.

A few rules of thumb that have served me well:

__PHP_Incomplete_Class as array

__PHP_Incomplete_Class as array

Jun 03

Regarding something to which I found no straight answer in 8 pages of google results:

“Fatal error: Cannot use object of type __PHP_Incomplete_Class as array in”

The offending line was the first instance of a session variable with a certain key name:

if (!isset($_SESSION['user'][0])) { $_SESSION['user'][0] = 0; }

On the development server there were no problems, but put on the demo shared server over which I have no control, the error appeared. I scoured the internet for the solution but it seems anyone who has this problem never really gets a straight answer – and it seems to come up a fair bit. Incidentally, it seems to be related usually to login/user/session management scripts since certain keywords are fairly common in those situations.

Frustrated, as a last ditch attempt I changed it to:

if (!isset($_SESSION['usrinf'][0])) { $_SESSION['usrinf'][0] = 0; }

The problem was solved instantly.

Turns out it was the key “user” which was the problem in the hosting environment.

So if anyone has this issue, do a find/replace of all instances of the session variable key located in the line indicated by the error to something more unique .

How i get to work when excuses to not abound…

How i get to work when excuses to not abound…

May 18

Or: how an avid procrastinator finally gets to work.

Often severe spells of procrastination are spurred on by a feeling of being overwhelmed by a project, disorganized and generally making a mountain out of a molehill, even if it is a big project.

This isn’t even addressing any tendencies to simply be lazy which ultimately must be overcome at ones own expense. My trick to this is to brainstorm on something that will motivate me to complete the job – typically the reward at the end but more often than not it isn’t the reward that is more motivating but the ‘hunger’ in the meantime — rent/bills are due, something important needs to be taken care of, etc. This is not even taking into account any actual deadlines.

As far as I know, the greatest motivators in the world are hunger and ego. Hunger is a metaphor for any immediate need but can be taken literally in certain circumstances and ego expresses the need to prove ones worth and place in the world. These are, however, only a motivating factors when working out of a rut or starting from the bottom. Motivation becomes increasingly difficult as NEEDS become WANTS and WANTS are more easily attained at which time incessant boredom sets in and once frivolous or extraneous ordeals become the primary focus.

Too much stress, not enough being done about it

One of my greatest problems comes in feeling overwhelmed because of the project at hand PLUS a looming responsibility such as debt and other such things. This paralyzing combination have to be separated and dealt with in turn otherwise they will create a complete creative blockage wherein a feedback loop ensues – can’t work cause I’m stressed, stressed cause I’m not working and things are due.

There are 5 conditions under which I do not function well:

  1. tired
  2. hungry
  3. sexually frustrated
  4. temperature discomfort (too cold / too hot)
  5. constipated/bloated – laugh if you must but it’s a real problem for many

the third item may seem a vulgar and exaggerated issue and for some people may not ever be an issue (i am a man after all, let’s be honest), but in reality these concerns are primal needs and when unsatisfied will forcefully and involuntarily take precedence over intellectual endeavors, — this is to say it’s entirely possible to get the job done, but coming back later under different circumstances to look over my work, I find I either did not work efficiently and could have worked faster having made poor structural choices when scripting or programming, or poor design/layout choices.

The worse part is that these issues compound and affect each other. That is, tired produces crankiness and a sense of discouragement. Sexually frustrated makes one tense disagreeable and easily distracted (which is actually the lesser of the 5 issues) plus if you take care of that, you could then be tired. Uncomfortable temperature and being tired will cause internal temperature fluctuations and ultimately make me feel sick and worn out. Too cold makes me sleepy and lethargic – OR frisky and restless, too hot makes me irritable and tense. Add hunger to any of these and we have a situation where all basic needs are unfulfilled and the body can only focus on attending to them.

So, the solutions?

Caffeine.

A special note needs to be made about caffeine. While I LOVE coffee, when I have to work, I avoid it like the plague. Instead choosing a good black or green tea which rather than specifically containing caffeine, through the action of theophylline will gradually raise alertness. An energy drink with supplemental additives such as taurine, guarana, ginseng, vitamin B6, protein, vitamin c, and natural sugar or sucralose (my preference over acesulfame K or aspartame). The sugar is an important issue even with tea. I find that high fructose corn syrup in certain energy drinks eliminates the energy boost the caffeine induces by causing a sudden spike in blood glucose levels – making me feel even more drained than before – yet restless and unable to nap if I so choose.

So far I have found a preference for the new Jolt (as in Jolt Cola) formulations – personally I like them all except for grape, but that’s personal preference. A major issue beyond the sugar that I’ve had with energy drinks is the medicinal aftertaste. The Jolts taste great while containing a pretty well balanced set of ingredients. A 23.5oz can lasts me all night – if I’m more thirsty than usual I have water along side it because even to consume that large can quickly would definitely create some attention difficulties while trying to concentrate.

Food

While I work, I am constantly hungry – whether my body uses this as an excuse to create a distraction is to be examined but the bottom line is that if I don’t eat about once an hour and wait until my stomach growls when doing heavy thinking I start to bog down and things get ugly. This is an apparent consequence of having a very fast metabolism and being accustomed to large amounts of carbohydrates. I get restless, then I get tired, then I start to get cold regardless of the ambient temperature and at this point any efforts to do good work are going to be in vain.

The problem comes about in the choice of intake while working. My persistent inclination is always candy and other sweet things – OR a big meal to satisfy the craving for-good but in my experience, the empty calories of candy will destroy my ability to concentrate and a big or heavy meal will punctuate my attempt at doing anything for at least 4 hours.

My favorite thing to do is to have 2 half sandwiches, specifically tuna sandwiches any time I get a craving – around every hour to hour and a half.

Why two half sandwiches and not one whole? Because eating two halves fools me into thinking that I’m eating more than I actually am while not getting too full as result, thereby addressing my latent gluttony.

If for example, my issue is that I’m hungry but I feel full – a strange feeling but it happens (usually if I haven’t made a regular bowel movement), I may choose to eat a bowl of frosted mini wheats or cheerios (i use soy milk to avoid feeling bloated- this is another issue altogether) or any other high fiber moderately sweet cereal or make a bowl of oatmeal depending on the climate or immediate preference. Wash it down with water and two problems will soon be solved.

Sleep

When I’m working and tired, my want for sleep will invariably win — I will rationalize and convince myself that after a certain amount of work, I DESERVE to sleep which usually amounts to committing a very small amount of work before getting frustrated and going to sleep.

Instead what I usually find will work, given that I for my whole life have never had a set steady sleep schedule is that rather than fight the sleep and waste time trying to work, I’ll:

  1. have a small but satisfying meal
  2. drink a small cup of black or green tea
  3. chase those with water
  4. set an alarm clock for one and a half hours to 3 hours
  5. doze off while organizing my thoughts on where to start and the step immediately following, with the mindset that when the alarm goes off, I will wake, and do nothing but that one first step and take it from there.

Usually this works. If for any reason it does not, there is something else amiss and really needs to be evaluated.

Once the ball gets rolling and I achieve the first immediate milestone, such as getting past the starting point and laying down an initial plan PLUS an initial structure the rest comes easily and naturally up to reaching a stopping point. Once the motivation finally hits, I just let it pull me as far as I can physically manage. Sometimes working for 72 hours straight with only 2 or 3 hour naps every 18 hours.

–Always stop all caffeine consumption at least 4 hours before attempting to go to sleep or else just like trying to work while tired, trying to sleep while wired is counterproductive.

After which I will probably feel ragged and may then sleep a whole day – well, maybe 12 hours straight and another few hours after waking up, potty break, and drinking a bunch of water/eating until I feel refreshed and bright eyed (in other words, sleep until my eyes just PING open) — this sleep diet usually addresses the issue of caffeine tolerance which happens quickly as it will all work its way out of my system.

Wake up, shower, shave, eat, take care of any pending real-world matters then the whole process can repeat.

WinSCP Ftp for windows

WinSCP Ftp for windows

May 05

If you like to be able to simply drag and drop between windows explorer folders and programs WinSCP is the program to have.

In fact, even if you like the standard dual pane local | remote setup it’s there as well.

A Must Have for anyone who goes back and forth between Mac (and is used to the simplicity of Cyberduck)and PC. The security connectivity features which it is named for are excellent.

Best of all, it can easily be used as a portable ftp client.