Jul 29, 2013

[Solved] Zurb Foundation and Google Custom Search Engine layout problem

Posted Jul 29, 2013
When adding a Google Custom Search box in your site that uses Zurb Foundation 4, it is most likely that the search button will be distorted and the search box won't have proper padding and you'll see various styling issues.

For a demo of a working zurb + custom search, just visit pesobility.com

The solution is to add this into your CSS:

.gsc-control-cse  * {
 -moz-box-sizing: content-box !important;
 -webkit-box-sizing: content-box !importantx;
 box-sizing:  content-box !important;
}

.gsc-control-cse input {
 box-shadow: none !important;
}

.gsc-control-cse input:focus {
    outline: none;
}

.gsc-control-cse table {
 border: none;
 background: transparent;
}

.gsc-input-box, .gsc-search-box .gsc-input>input, .gsc-input-box-hover {
 -moz-box-shadow: none !important;
 -webkit-box-shadow: none !important;
 box-shadow: none !important;
}

Jul 28, 2013

How to Add Responsive Google Ad Code

Posted Jul 28, 2013
Many asked before if it's legal to change the ad size through javascript, now it's official, Google allows modification of its ad sense code for responsive design.  You won't be breaking any terms and conditions when you do this.

Do note that the adsense javascript code below is not really responsive in a sense that when you resize the browser, the ads change size dynamically; no it doesn't do that. It only checks the window size at start and set the appropriate ad size. You have to refresh the page after resizing the browser to see the ad size change.

The code:
<script type="text/javascript">
    google_ad_client = "your publisher id"; //change
    width = document.documentElement.clientWidth;
    google_ad_slot = "111"; //change
    google_ad_width = 320;
    google_ad_height = 50;
        if (width > 500) {
        google_ad_slot = "111"; //change
        google_ad_width = 468;
        google_ad_height = 60;
    }
    if (width > 800) {
        google_ad_slot = "111"; //change
        google_ad_width = 728;
       google_ad_height = 90;
    }

</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

At least it's getting there, maybe soon we'll see a truly responsive ad.

Jul 16, 2013

XCode 4.2 and Phonegap / Cordova and CDVInvokedUrlCommand compile error [Solved]

Posted Jul 16, 2013
When you download Cordova / Phonegap and create an iOS project using the create command, the resulting project has many compile errors if you do not use XCode 4.5. It is also written in their documentation and at least XCode 4.5 is needed to run their project.

Those using Snow Leopard OS are stuck with XCode 4.2, so it would be helpful if phonegap / apache cordova runs in XCode 4.2.

The first error you will encounter is Automatic Reference Counting Issue of CDVInvokedUrlCommand for instance message does not declare a method with selector... on line 62 of CDVInvokedUrlCommand.m with the code: [self massageArguments];

Found out that the compatibility issue was just due to declarations, position of methods, and use of new syntax (The "at" syntax of new iOS @{} for NSDictionary). So I just changed the code to be compatible with older version of compiler / SDK and it worked! I was able to compile and run it in my simulator.



I uploaded the working sample project in github: https://github.com/mannyvergel/cordova-ios-xcode-4.2


Jul 4, 2013

XML nodes over 64K in size cannot be printed when using Binary XML Storage [Oracle] [Solved]

Posted Jul 4, 2013
If you're using Binary XML Storage and you used DBMS_XSLPROCESSOR's CLOB2FILE method to write to file, there is a chance that you'll encounter the 64K limit of nodes.

The workaround is to use another method to write XMLType to file: DBMS_XMLDOM's WRITETOFILE:

Declare your desired directory:

create or replace DIRECTORY XMLDIR AS 'C:\tmp';


Use dbms_xmldom to write XMLType column to file:

declare
  doc DBMS_XMLDOM.DOMDocument;
BEGIN
  for c in (select xml_col from xml_table x where key_col='mykey') loop
    doc := DBMS_XMLDOM.NewDomDocument(c.xml_col);
    DBMS_XMLDOM.WRITETOFILE(doc, 'XMLDIR/output.xml');
end loop;
/