Upon updating your older project to Rails 3.2, one of the first things you will see is a deprecation notice in your logs:
You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this:http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released
Your first thought might be to just rewrite this yourself and get rid of this circa-2006 code anyway, but the lazy sloth in you says "if it ain't broke, don't fix it" so you google for the easy solution... landing here. This post will show you how to quickly convert your simple old-school plugins into simple libs per the Rails 3.2 Release Notes. This might not work for crazy-advanced-super-plugin-eleventeen-point-oh, but for the simple ones it should suffice.
Inspect your vendor/plugins directory. If your old plugin has some crazy-ass structure that doesn't look anything like this, you are on your own. Google for another page or press on at your own risk.
Rename the lib folder to the name of the plugin. When you move it in the next steps, this will help you stay organized.
Rename the init.rb file into the name of your plugin. When you move it in the next steps, this will also help you stay organized.
Move the folder you renamed in step 2 to the main project's lib directory. Now the rename makes sense. A lib folder with a nested lib folder is a naming nightmare.
Move the file you renamed in step 3 to the main project's config/initializers directory. Again, nobody wants to see a config/initializers/init.rb file, hence the rename.
Inspect the initializer file.There are probably some weird requires and other lines here that might need your attention. Look for obvious path errors and fix them. For my old-school can_flag plugin, I had to change the single require to the explicitly require the files in the lib/can_flag directory
Delete the crap from vendor/plugins. You could do something else with the tests folder and integrate the plugin's other files into your app, but since you were using antiquated old-school plugins already, chances are you aren't really concerned with that shit anyway. The new plugins folder structure should be bare.
Test it out in rails console. The first thing you should notice is the lack of the deprecation notice anymore. Then a simple test should tell you if you were successful.
You will have to make sure you didn't fuck anything up, but for my simple plugins, this process was enough.
As seen in Ambiance, UAModalPanel is an alternative modal panel that you can popup in your view controllers to show content that might not need an entire new screen to show. It works on the iPhone and iPad, with or without rotation, and is a non-ARC project.
I recently finished a Mac App called Thumbs and I wanted to upload and submit the binary to the Mac App Store through Xcode. Sounds easy enough right? I ran into this error:
Ok. So after (wrongfully) tinkering with the Base SDK and deployment target, ensuring I was on Xcode 4.2.1 (non-beta), I re-read the error and refocused on the OS. I am running Lion 10.7.2, but it turns out I was on the Beta track! Simple fix right? Nope.
Trying to get back to 10.7.2 official didn't work for me at all. I tried downloading it from the Apple developer site but they redirected me to the Mac App Store. Mac App Store sees that I am already running 10.7.2 and wouldn't let me download. I found an Update on Apple support pages that claimed I could update to 10.7.2, but nope. I thought about partitioning my hard drive and installing fresh, but that would mean that I had to deal with exporting importing my keys, development environment and profiles. Ugh. I decided to hit the twitterverse and a few minutes later, I got a reply from @christian_beer:
Ooooh, a hack. Me likes. I couldn't find the referenced post, but I was able to find the plist anyway at
/System/Library/CoreServices/SystemVersion.plist
The fix was simple: Change the ProductBuildVersion to be 11C74 (or the most current non-beta build of OS X), restart Xcode, and rebuild your project. To verify your change, open About This Mac:
Don't forget to change it back right after you upload. I would not advise restarting your computer or doing anything else. I don't know what else this could affect.
You can Archive and Submit from Xcode now and you won't be held up by the error:
This bundle is invalid. Apple is not currently accepting applications built with this version of the OS.
I manage a file server with a ton of content. When new stuff comes in most of it gets automagically moved into the right directory, but sometimes I need to manually move files into folders and subfolders. I am also a keyboard shortcut junkie. I will always use the shortcut over the mouse to perform the same action if it exists, so I was bummed when I saw that cut was disabled for most Finder files. I am unsure of the conditions that make a file cuttable, I just wanted a solution to my problem.
After doing some research, I found this old Lifehacker post on how to achieve it using Automator, but it wasn't working for me on Lion at all. Not only that, but the cutting and pasting I am doing is mostly on remotely mounted volumes, such as AFP drives and servers. The Lifehacker script did not handle those locations well and ended up taking forever to transfer the remote files. Cutting and pasting a 10GB file should be a simple file pointer redirection, not a copy then a deletion of the original file.
I edited the Automator services to meet my needs and am giving them to you to download and use. 5 simple steps to install:
Download the files, unzip, and double click both "Cut File.workflow" and "Paste File.workflow". When asked what you want to do with the file, choose "Install". This will move the files to your ~/Library/Services folder.
Create a new folder in ~/Library called "Cuttemp". If you are having trouble finding the ~/Library folder, you can open it by holding down the Option key and clicking the "Go" menu in Finder.
This is the place where we will store the temporary file list on "Cut". The way the service works is that when you "cut" a file, it makes a shortcut to that file and places the shortcut in this directory. Nothing is actually removed until you paste into another directory.
Create a new folder in ~/Library called "Sounds". If the folder already exists, you do not need to create a second one. Drag the sound files "Ding.caf" and "DingDing.caf" into the Sounds folder.
Go into System Preferences => Keyboard => Keyboard Shortcuts tab. Hit the plus button to add a new shortcut and choose Finder for the application, "Cut File" (without quotes) for the menu item and anything you want for the shortcut—I use Command+Shift+x, which is similar to the traditional shortcut for Cut. Then, hit the plus button again and do the same, but with "Paste File" (no quotes) as the menu item and anything you want as the shortcut (I use Command+Shift+V).
To cut a file (Folders are not supported), select it in Finder and press your "Cut File" keyboard shortcut. Multiple Files are supported. You will hear a "Ding" to let you know when it has completed. To paste the File(s), you can either navigate to a new directory, or simply select it in Finder and press your "Paste File" keyboard shortcut. You should hear a "Ding Ding" when it has completed.
Obviously try this out on a few files you don't mind losing after you install in case something goes wrong. I am not responsible for any lost porn. Let me know in the comments if you are having any troubles!
I was testing the dynamically loaded dependencies of a static ffmpeg binary today, and I saw that libSystem.B.dylib was indeed a dependency.
coneybeare $ otool -L ffmpeg:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
Attempting to be thorough, I decided to test what happened when I ran this binary on a machine that did not have the libSystem.B.dylib library in this exact path. (WARNING: DO NOT TRY THIS AT HOME)
The library moved and I tried running a command using the ffmpeg binary, when BAM, I got a missing library error. I did some research and found that the libSystem.B.dylib library should exist on any functional OS X install, so I decided to not worry about the error and attempted to move the library back
… Missing Library Error. Then it hit me, sudo, mv and all other bash goodies were dependent on this library and in order to move the library back to its original position, it needed to be loaded. It could not be loaded though because the library was in an unexpected location. Shit. I tried sshing in to see if I could do something that way, didn't work. ssh must also depend on the library. I tried a restart in safe mode, but the safe-mode boot must also depend on the library as it spun on the gray load screen for ever. I tried setting up the computer in target mode, but that did not work as well. I tried to open the cd tray to load in my OS X disc and get the terminal but my bluetooth keyboard was not working, probably because of the missing library. I really thought I was fucked here. At long last I remembered the low level boot disk switcher! I tracked down a USB keyboard and mouse, plugged them in and restarted the computer holding down the Option key. After a short while, I was presented with the Boot Disk selection screen! I tapped the eject button and threw in my Restore disk. After choosing the default language, I went to the title bar and opened up terminal. then I was able to run my command:
It happens more than you think. I mean really, have you ever really read the 43 page long terms of agreement that these sites make you agree to before signing up? Many of them probably say something along the lines of "we may give your email to special partners blah blah blah". While you can't always prevent this from happening, you can figure out how that spammy viagra email landed in your Gmail account.
This trick has been around for awhile now, but I have only recently started using it and it works flawlessly. When you sign up for new services on sites that require an email, you won't use your real Gmail address but a slightly modified one. You take whatever your Gmail name is (before the @ sign) add a "+", then add the site name after that, but before the "@". It is not as hard as it sounds.
Lets say Dexter comes along and wants to setup an account at Phlebotomy Emporium to get a quick discount on needles. He would take his original email, add a "+", then add "phlebotomy_emporium" to it like so:
The trick here is that Gmail will ignore anything after the "+", and send it to your real account. If they ever sell your email to somebody else, you will still see which company it originated from when it is sent to you. In some cases, they might have broken the law when selling your email so check up on it and act accordingly.
Test it out by simply sending an email to yourself with +foobar or something else. This may work with other mail carriers but I haven't tested them out. Perhaps you can comment here if you see it working on somewhere other than Gmail. Happy spam fighting!
I have been using this theme in Xcode and have become quite accustomed to the subtle, light on dark colors of it. It only has 5 colors (KISS) and is easy on the eyes during those late night coding sessions. I really only use Coda for Rails development so, there are only seestyles for Ruby, ERB, HTML and CSS.
Ruby:
ERB:
HTML:
CSS:
Global Colors:
You can download them and install by using the Import button in the Coda "Colors" Preference Panel. Enjoy!
Many people have asked me to writeup some custom HTML code for thier signatures. So many have asked me since writing this article that I have decided to start a custom HTML email signature website to help you all out. For a small fee, I will take your information and appearance requests, generate a few different options to choose from, formulate HTML code that is safe for emails, host any custom images for you, and help guide you through the installation process. Follow through to GiantUser for more info.
ORIGINAL POST
There are plenty of tutorials online to create an HTML signature in Apple Mail with Snow Leopard, but it has changed slightly for Lion. Here is how to do it:
In Mail.app, go to Preferences > Signatures and create a signature with any random content. Name it something meaningful. You will be swapping this out later.
Write an html page inside of your favorite text editor. The page should not have html, head or body tags, should include only inline css, and should only consist of basic html elements (div, span, img, a, etc...). Here is some example code to get you started, but you will need to provide your own images.
Open the file in Safari.
Click "File" > "Save As" and save as a webarchive.
Open the folder ~/Library/Mail/V2/MailData/Signatures/ to show your email signatures in Finder by holding down the Option key and clicking the "Go" menu in Finder. Check here for more tips if you are having trouble opening the ~/Library folder.
Locate the webarchive file you created in step 1 using quicklook (spacebar).
Copy the exact name of the webarchive located in step 6, and delete the file.
Replace it with the webarchive you created in step 4, giving it the exact same name that you copied in step 7.
Restart Mail.app and go to Preferences > Signatures. If you have images in your signature, they will not show here in the preview, but they will show in the real signature if the location is valid.
Open a new compose window and see your new html signature.