Show hidden files in any open / save dialog
As a programmer there are times you need to create files that start with a '.' (period / dot) such as .bash_profile. But what happens when you want to open that file to edit it? The standard Open Dialog does not show hidden or system files.Press Cmd+Shift+. (that is the period) when the dialog is open to show all those bonus files.
Change file association
I wanted to open JPG files in Picasa instead of Preview.Right click on a file and selecte "Get Info"
Change default application to open it with, then click the button [Change All]
Use XML_GREP to quickly pull data from XML files
There are times you are given an XML file and you want to quickly pull small pieces of information out of it. No need to write a full SAX or DOM parser to do that when you can use XML_GREP.
Sample of a record in the XML file
<REPORT_TEMPLATE_LIST><REPORT_TEMPLATE>
<ID>1537005</ID>
<TYPE>Auto</TYPE>
<TEMPLATE_TYPE>Scan</TEMPLATE_TYPE>
<TITLE><![CDATA[Executive Report]]></TITLE>
<LAST_UPDATE>2013-03-08T15:37:07Z</LAST_UPDATE>
<GLOBAL>1</GLOBAL>
</REPORT_TEMPLATE>
...
</REPORT_TEMPLATE_LIST>
Would show:
Executive Report
...
xml_grep --text_only --cond 'TITLE' --cond 'TYPE' assetDataReport.xml
Would show:
Auto
Executive Report
...
Remove the --text_only parameter if you want to see the TITLE tag information too.
How to install XML_GREP
cd XML-Twig-3.42 (use version downloaded here in place of 3.42)
perl Makefile.PL -y
make
make test
sudo make install
Format XML file (pretty print)
Let's say you have an XML file that is all one one line or has no indenting and you want to pretty print it. You can use xmllint which is already installed on you Mac to do that. Here I am converting Sample Report.xml to newfile.xml where Sample Report.xml is the original unformatted file and newfile.xml is the indented pretty version of the file.
xmllint --format --encode utf-8 -o newfile.xml 'Sample Report.xml'
xmllint --format --encode utf-8 -o newfile.xml 'Sample Report.xml'
No comments:
Post a Comment