Fix Finder’s contextual “Services” menu

I sometimes add or remove “services” to my ~/Library/Services directory. Unfortunately this alone doesn’t make the changes being reflected in the menu…

It might be caused by the fact that I keep things I want to have on all machines in a Dropbox folder and link to it. Or it may be due to some other reasons. In any case. I am not alone as this old hint shows. It was posted in the times of the OSX version 10.6. At the time of writing I use 10.9 and the problem remains. Luckily almost the same solution applies. The only difference is that one has to add an option to the command:

/System/Library/CoreServices/pbs -flush

should do the trick and bring your “Services” menu back to what you want it to be.

From the

$ man pbs

pbs is an agent for the Services menu.  It scans for and vends available Services, to populate the Services menu [and] is NOT related to the pasteboard.

Who would have guessed?

Posted in OSX | Tagged , , , , , , | Leave a comment

HTTP query strings in Laravel routes

So you read the documentation back and forth, and again, and even more again. And you still can’t make your

Route::get('myroute?querystring=myquerystring', function()

work?

Well – you don’t find it in the docs but what you have to do is:

Route::get('myroute', function()
{
    $myvariable = Input::get('myqueryparameter');
    // do whatever you want with the variable now
});
Posted in Uncategorized | Leave a comment

Why git is sometimes more gitty than any other git you are ever about to encounter…

So you work on a project which is version controlled and moreover it is version controlled by the almighty git himself. No matter whether you just got around all the teething problems and a steep learning curve of using git or you are a seasoned git professional – at one point or another you may find yourself in a situation where you want (or need) to:

No problem – you say? Sure – no problem as you can see if you follow the links above – nobody has ever got any problem with any of those operations. And no – using

$ git --follow

is not a solution either. Neither one knows when/where to try using some extra command line switches nor can one do it with non-command-line interfaces.. And no, unless you are a git geek, don’t even try to follow the discussions on those topics out there. The closest to something, which I felt could somehow work were a few discussions involving “filter-branch” command of git but God only knows what those dudes were really talking about. You know, this single big PITA alone can make one scream “GIVE ME MY SUBVERSION BACK!!!”

And you think there are no heroes anymore these days, don’t you? I tell you – There ARE! This awesome dude somehow made something out of this whole pile of conflicting, half-truth, semi-baked, scruffy-looking “advices” or just studied the matter on his own ;-) and came up with a shell script, which does the hardest part for you. I tried it. Sure I made a fresh pull to be up to date as action zero. Then backup of the whole directory first, then –dry-run second, then

$ git-mv-with-history myfile=mysubdirectory/

Rewrite cbb1a3111387949c0efde1540aa4565918f12f9b (1/117)

Rewrite ebb01ba7b2454a83f4e1b916384735a76cea15f9 (2/117)

[...]

Rewrite 18222fce98839724338fcdc833f3e307875eb6eb (115/117)

Rewrite 0b229d7fefa417f5b2e4975a87ea5ae69a2ebfe0 (116/117)

Rewrite e1ea07ce21b4a7ec6ba8e28dc1f5baba512bdbf2 (117/117)

Don’t forget the trailing slash if you want to move the file to a subdirectory or you may end up with your file being renamed into what you wanted a directory to be named!

I eyeballed all the files (checking them against the original clone of the repository) and the git status results..

silverdr$ git status

On branch master

Your branch and 'origin/master' have diverged,

and have 110 and 110 different commits each, respectively.

(use "git pull" to merge the remote branch into yours)

DON’T! DO! IT! I meant don’t “use git pull to merge the remote branch into yours”! Unless you want to ask for trouble, that is. Don’t try to simply push the changes either (but since your push will be most probably rejected anyway – it shouldn’t at least do much harm if you insist and try anyway). Now – what I did and it worked (but remember: YMMV!!) was:

silverdr$ git push --force origin master

Counting objects: 428, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (398/398), done.

Writing objects: 100% (409/409), 562.33 KiB | 0 bytes/s, done.

Total 409 (delta 154), reused 0 (delta 0)

To https://github.com/yourowner/yourrepository.git

+ e1ea07c...8879fe2 master -> master (forced update)

silverdr$

YES – there are still heroes. Even these days…

Posted in Coding, Git, Rants | Tagged , | Leave a comment

Making Github’s “fork & pull” model palatable

When collaborating with other people using Github’s “fork & pull” collaboration model, it is a real PITA to have to re-fork and re-merge upstream repository changes all the time. The solution is to set your “forked” repository to use different pull (fetch) and push repositories. This way one can always pull/update from the upstream but keep pushing own changes (AND the upstream updates) to the forked repository of his own. This single, simple (when you know it and you know how to do it) step makes a major change in the efficiency and perception of the “fork & pull” collaboration model.

Posted in Coding, Git | Tagged , , | Leave a comment

Give me my Save As… back!!

No, I don’t want any “Duplicate”. I don’t want to duplicate anything! The work I have done on the file makes it different than the original file. NOT A DUPLICATE! I want to simply Save [my work] As… [different file]. Understood, Apple?! NO, I don’t want to push Command + Shift + Option + S (thanks God somebody kicked your butt so that at least the function is back there again!) – this is not a convenient shortcut for one of the often used functions. Neither is fiddling with mouse and keyboard (alt key) at the same time. Will you get it?

So much for the rant. Now a (partial but still good) solution to this small part of Apple’s-After-Leopard loss of reason, by tjluoma:

$ defaults write -globalDomain NSUserKeyEquivalents -dict-add 'Save As...' '@$S'

Gosh… thank you TJ!

Posted in OSX, Rants | Tagged , | Leave a comment

Woes of an Android “switcher” – continued

OK – so here’s another one. If you run e.g. one of the Samsung Android phones and suddenly realise that you don’t receive any notifications whenever new text message (SMS based) arrives, and you tried everything, including rebooting, taking out battery, wiping cache partitions (Gosh! How Microsoft® Windows™ – alike all this is), every trick you read on the web or remember from your Symbian/Windows times, and still no luck (and no SMS messages notifications) – then…

When everything else fails, you may still try the one below. It helped restoring proper SMS messages notifications from the built-in “Messaging” application on a Galaxy S4 mini.

The thing you’d never thought of… Google’s “Hangouts” (how “socially” desperate Google has to be in order to invent such  names for their applications/services?!). Find Google’s “Hangouts” application (hint: it might be in a folder called “useless stuff” or it might be one of those that don’t show in the list of applications because you decided long time ago to hide it), open it and double check if you haven’t happily agreed (and even more happily forgot about it) to the irresistible offer to receive SMS messages with “Hangouts”. Of course at the time when you agreed, you thought it would be like with any other SMS application you can find in the Android Market… erm… “Playstore” or whatever it is called now, even if there are many people who never “played” with anything from there. Unfortunately this time you were wrong. Google’s “Hangouts” in its ultimate desperation to take over Facebook messaging, takes over all your incoming SMS activity on the way. And if you turned off notifications there (because you thought that whatever application you are going to use in the end, will notify you anyway) then you are out of  luck and Samsung’s “Messaging” will not inform you about incoming SMS messages, regardless of how many times you try to turn its notification settings “on”.

What you have to do in such case is to disable receiving SMS with Google’s “Hangouts”. After that you can safely hide it again or keep it in the “useless” folder…

Posted in Android, Rants | Tagged , , , , | Leave a comment

Get MPEG-2 footage into FCPX

So.. you got that important video from somebody. He gave you the files and asked politely “just do it quick!”. Video is stored nicely in some MPEG-2 based transport stream files (typical thing with some Canon, SONY, whatever… cameras). You try to import those files into your latest and greatest version of Final Cut Pro and it seems… that you just simply can’t! FCPX doesn’t want to let your footage in urgent need for edit into its powerful editing domain. No matter how you try to adapt, demux, convert to mpeg, headed mpeg, ts, vid, rec, m2v, dit (damned it!), yni (you name it) the file is not accepted by your shiny iMovieX.. erm, sorry… Final Cut Pro X.

Sure, you can follow smart people’s advice and convert all the footage to another format, like Apple’s ProRes for example, at some sizeable cost of time and storage space. But what if both of those are at premium in your situation? Or you don’t have any software that could do that outside of FCPX? Or you don’t have enough knowledge or administrative privileges to install FFmpeg? Or you have the (fantastic tool, BTW) MPEG Streamclip from Squared 5 but you don’t have (and can no longer buy) the QuickTimeMPEG2.component required by MPEG Streamclip in order to be able to handle MPEG-2 data. Or..

So what now?

OK, a little background first: “traditional” UNIX (or Amiga) way of recognising what the file contains, is… to check what the file contains (sic!). Strange? Yeah, I think so too. But that’s what people had been doing with their data for a long time, before the dark times, before the Empire… but with MS-DOS popularity and everything that followed from Microsoft® Corp, computers no longer check what the content of the file is in order to know what the content of the file is. What they do in order to know what the content of the file is, is they check the name of the file! Then they take whatever the guy in a severe katzenjammer state incidentally typed into the filename field, as the ultimate pronouncement about what kind of data the given file contains. As illogical as it sounds – file’s name (metadata) is one thing and file’s content (actual data) is a very different thing – this is what the brightest minds from Redmond endowed the world with. And you know what? The world accepted it! Impossible to imagine but true. Even the rebel GNU/Linux systems more and more bow to this brain-dead approach. Apple is not an exception either. Quite the contrary. It wholeheartedly embraced this utter stupidity long time ago.

Now, what all of this has to do with Final Cut Pro not being able to import your MPEG based footage? Well – as found out by one smart and persistent dude – all you have to do to get your MPEG-2 transport streams into FCPX is to… yes, rename the files you want to import (or should I say more politically correct: “unshare”?)!

So… go ahead change the names of the files in such way that they end with a sequence of a dot, a letter “M”, a letter “O” and a letter “D” and you should be an all happy video editor in no time. Just don’t say that out loud to anyone! Somebody at Apple may hear it and decide that files, which have their names ending with “.MOD” sequence of characters must be banned from Final Cut Pro domain too…

Posted in Rants, Video | Tagged , , | Leave a comment