{"id":244,"date":"2011-02-07T19:30:56","date_gmt":"2011-02-08T03:30:56","guid":{"rendered":"http:\/\/stevenrbrandt.com\/wordpress\/?p=244"},"modified":"2012-08-15T11:07:06","modified_gmt":"2012-08-15T19:07:06","slug":"geekiness","status":"publish","type":"post","link":"http:\/\/stevenrbrandt.com\/?p=244","title":{"rendered":"Geekiness"},"content":{"rendered":"<p>Java is a great language, but it&#8217;s missing a feature present in its cousin languages, C++ and C. The feature is the builtin macros __FILE__ and __LINE__. These are often quite useful for debugging, etc. Well, even though Java doesn&#8217;t have them as builins, you can still make your own.<\/p>\n<pre>\r\npublic class MacroHack {\r\n   public static String __FILE__() {\r\n      return new Throwable().getStackTrace()[1].getFileName();\r\n   }\r\n   public static int __LINE__() {\r\n      return new Throwable().getStackTrace()[1].getLineNumber();\r\n   }\r\n}\r\n<\/pre>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-244\" class=\"share-twitter sd-button share-icon\" href=\"http:\/\/stevenrbrandt.com\/?p=244&amp;share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\" ><span>Twitter<\/span><\/a><\/li><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-244\" class=\"share-facebook sd-button share-icon\" href=\"http:\/\/stevenrbrandt.com\/?p=244&amp;share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\" ><span>Facebook<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Java is a great language, but it&#8217;s missing a feature present in its cousin languages, C++ and C. The feature is the builtin macros __FILE__ and __LINE__. These are often quite useful for debugging, etc. Well, even though Java doesn&#8217;t &hellip; <a class=\"more-link\" href=\"http:\/\/stevenrbrandt.com\/?p=244\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-244\" class=\"share-twitter sd-button share-icon\" href=\"http:\/\/stevenrbrandt.com\/?p=244&amp;share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\" ><span>Twitter<\/span><\/a><\/li><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-244\" class=\"share-facebook sd-button share-icon\" href=\"http:\/\/stevenrbrandt.com\/?p=244&amp;share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\" ><span>Facebook<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[65],"tags":[],"class_list":["post-244","post","type-post","status-publish","format-standard","hentry","category-computers"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pgWoS-3W","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=\/wp\/v2\/posts\/244"}],"collection":[{"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=244"}],"version-history":[{"count":4,"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=\/wp\/v2\/posts\/244\/revisions"}],"predecessor-version":[{"id":706,"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=\/wp\/v2\/posts\/244\/revisions\/706"}],"wp:attachment":[{"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=244"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/stevenrbrandt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}