Category Archives: coding

Gradle Could Not Normalize Path For File

Gradle Could Not Normalize Path For File

This one is for the windows users out there trying to develop in Android Studio. Trying to compile using the Google API’s. You may be getting the Gradle ‘Project Name’ project refresh fail. Could not normalize path for file ‘Path’ The filename, directory name, or volume label syntax is incorrect. ¬†You will also see the Gradle Project Sync Fail in the bottom right corner.

Gradle project refresh failed Could not normalize path for file

This stems from the filesystem naming rules in windows, and stems from the gradle build tools version 1.1.0. If you open the main build.gradle file and change the 1.1.0 to 1.1.2, this error should go away.

Gradle Build Tools Error

 

Check out my new blog ioiobot.com

Squarespace web hosting with bluehost email hosting

Squarespace web hosting with bluehost email hosting

The problem: Squarespace provides great simple webdesigns/web hosting that work across platforms but they provide no email hosting.

I’ve dealt with several web hosting solutions over the years, and have been happy with bluehost for as a value provider, mainly because you can host unlimited domains with one account which combines great with 1 click install of wordpress for quickly popping up websites. I recently received a request to transfer one of these wordpress accounts to squarespace. This is easy to do and essentially involves giving squarespace your login. You can follow this walk thru to accomplish this. Then you set squarespace to use your domain and change your DNS settings as listed in this walk thru. However you lose your domain specific email servers ie crazyguy@somehowifixedit.com(not a real address).

Email hosting thru bluehost

The addon domain for your website needs to be setup on bluehost before proceeding. Look up the dns zone settings to see how bluehost email hosting is setup.

How to view the bluehost mx entry

This should land you on this page:

bluehost dns zone editor

After selecting your domain it should show you how they have the DNS zone settings for bluehost email hosting.

bluehost dns zone mx records for email hosting

The settings outlined in red can be copied to your dns zone settings with your registrar(ie GoDaddy , network solutions)


Learn how to become an internet millionaire on your drive to work on your iPhone with these books from audible.com!
1 FREE Audiobook Credit RISK-FREE from Audible.com Get Rich Click!: The Ultimate Guide to Making Money on the Internet Internet Riches: The Simple Money-Making Secrets of Online Millionaires The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich 

Best date time picker javascript jquery

Best date time picker javascript jquery

Frequently users are asked to give dates and times for thing. Rather than writing your own code, or dealing with free text and the users idea of how dates and times should be entered you can use a picker. While you could spend a bunch of time writing your own, there are many freely available for download and quick integration into your project. I played with a few different options but my favorite is DateTimePicker jQuery Plugin

1) Ease of use / Inclusion in your code. – Download the code. Include 2 source files and a CSS sheet and your done. No graphics or icons to put in specific directories.

2) Lots of Options for how it runs. Run just for dates or just for times. Use expansion of the input field to the picker, or inline picker already expanded. Specify dates and times that appear etc.

3)Aesthetically appropriate for forms, doesn’t look like it will become dated quickly.

4)Simple documentation and examples on the main page for the plugin.

These input fields will work as regular input fields.
They can be easily converted to PHP time stamps with the strtotime(); of the $_POST input.
To adjust how the date presents itself to a more American Format in the text field:

$(‘#datetimepicker’).datetimepicker({format:’m/d/Y H:i’});

Overall this little plugin for date and time picking is versatile and useful and so I thought I’d share it.


Learn how to become an internet millionaire on your drive to work on your iPhone with these books from audible.com!
1 FREE Audiobook Credit RISK-FREE from Audible.com Get Rich Click!: The Ultimate Guide to Making Money on the Internet Internet Riches: The Simple Money-Making Secrets of Online Millionaires The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich 

Codebird Posting to Twitter Not Working

Codebird Posting to Twitter Not Working

So in the new code that I’m writing I need my application to Tweet. This didn’t seem like a very hard thing to so after trying a few tutorials settled on the codebird library to help do the posting. There is an excellent tutorial here: http://www.pontikis.net/blog/auto_post_on_twitter_with_php

Codebird requires read/write access

Codebird requires read/write access

First thing you have to do is go to https://dev.twitter.com/apps to apply to get permission to use the twitter api. It will ask you for a lot of information as if your app will be used by lots of people other than yourself, and none of this information really matters if it’s just for yourself to use. You will have to set the settings to read and write before you generate your access tokens. The first tutorial I followed was more involved in reading tweets, so it didn’t make a point of putting it into read/write. I changed it to read write but didn’t realize I had to recreate the Access token to get read/write access tokens.

If you don’t have read/write access, you will get the following error when you var_dump($reply) in “$reply = $cb->statuses_update($params);”:

[“error”]=> string(34) “Read-only application cannot POST.”

If you forget to set it to read/write before creating your token, go under the settings tab and set it to read/write, then refresh a couple of times under the details tab till it says read/write and then click on recreate my access token. Place these in your code and it should be working for you.

Of note Codebird requires php 5.3 or greater, CURL extension and open ssl extension all of which can be checked reading through phpinfo();


Learn how to become an internet millionaire on your drive to work on your iPhone with these books from audible.com!
1 FREE Audiobook Credit RISK-FREE from Audible.com Get Rich Click!: The Ultimate Guide to Making Money on the Internet Internet Riches: The Simple Money-Making Secrets of Online Millionaires The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich 

Get a new domain name, or an unlimited hosting service to host multiple websites! Some services are 50% off.
Put your business online!  Get a $8.99 .COM/.NET from GoDaddy!

Using greater than > and less than < in XML

Using greater than > and less than < in XML

In the ongoing saga of me reviving my meager PHP coding skills I ran across a new error as I tried to write my own RSS files in XML. Things worked great on the first few posts, and then Blam:

StartTag: invalid element name

StartTag: invalid element name


So I did some searching around and found out that just like in a programming language there are characters that need to be escaped.

escaped charaters xml

escaped charaters xml

So in writing those to my XML files initially I was going to write a str_replace() for each one of those, but then I figured out about htmlspecialchars() so I can replace the text that is getting written to my XML file.

And back to spaghetti code …


Learn how to become an internet millionaire on your drive to work on your iPhone with these books from audible.com!
1 FREE Audiobook Credit RISK-FREE from Audible.com Get Rich Click!: The Ultimate Guide to Making Money on the Internet Internet Riches: The Simple Money-Making Secrets of Online Millionaires The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich 

var_dump SimpleXmlElement()

How to var_dump SimpleXmlElement() to discover the parameters of the element and children.

I’ve been playing around with some php code trying to grab some RSS feeds so I can manipulate them, and do what I want with the data grabbed out of them. The first example I grabbed read the contents of the RSS file into SimpleXmlElement() and then parsed the individual items out. The example code I snagged looked something like this:

$feed_url = "http://opensourcesurgery.com/blog/feed/;
getFeed($feed_url);

function getFeed($feed_url) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo “<ul>”;
foreach($x->channel->item as $entry) {
echo “<li>” . $entry->title . “</li>”;
echo “<br>” . $entry->link . “”;
echo “<br>” . $entry->description . “”;
}

echo “</ul>”;
}

However I quickly found a lot of variability in what was actually contained in RSS feeds. Some had other fields such as “author” and “citation”. Thus I wanted to know what data was actually in some of these feeds, ie I wanted to know the children of the <item>. Unfortunately I discovered that var_dump() and print_r() do not work on SimpleXmlElement(). Luckily I came across a function called simplexml_dump() written by Rowan Collins that did exactly what I needed while I was debugging what data I could pull from my selected feeds.

I grabbed his code off github and dropped it into my code for debugging purposes and was able to see all the different children of . When run on the feed of this blog, I get the following output:

        SimpleXML object (1 item) [ Element { Name: ‘item’ String Content: ‘ ‘ Content in Namespace dc Namespace URI: ‘http://purl.org/dc/elements/1.1/’ Children: 1 – 1 ‘creator’ Attributes: 0 Content in Namespace content Namespace URI: ‘http://purl.org/rss/1.0/modules/content/’ Children: 1 – 1 ‘encoded’ Attributes: 0 Content in Namespace wfw Namespace URI: ‘http://wellformedweb.org/CommentAPI/’ Children: 1 – 1 ‘commentRss’ Attributes: 0 Content in Namespace slash Namespace URI: ‘http://purl.org/rss/1.0/modules/slash/’ Children: 1 – 1 ‘comments’ Attributes: 0 Content in Default Namespace Children: 7 – 1 ‘category’, 1 ‘comments’, 1 ‘description’, 1 ‘guid’, 1 ‘link’, 1 ‘pubDate’, 1 ‘title’ Attributes: 0 } ] VAR_DUMP of entry
        The Children in default namespace are the ones I was after, and now coding can continue.

 


Get a new domain name, or an unlimited hosting service to host multiple websites! Some services are 50% off.
Put your business online!  Get a $8.99 .COM/.NET from GoDaddy!


Learn how to become an internet millionaire on your drive to work on your iPhone with these books from audible.com!
1 FREE Audiobook Credit RISK-FREE from Audible.com Get Rich Click!: The Ultimate Guide to Making Money on the Internet Internet Riches: The Simple Money-Making Secrets of Online Millionaires The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich 

setTimeout not working in Chrome and Firefox

setTimeout not working in chrome causing me to tear my hair out and waste several hours.

I was working on a piece of code opening a new window and writing data to it. The first time a part time coder tries this they will tear there hair out trying to figure out why it won’t work. Your code doesn’t wait for the window to load to try to write to it. So functions such as setTimeout or .onload are used to make sure the window is loaded before writing to it. I had this struggle several years ago and figured it out however in reusing my old code it would work in internet explorer but not in Chrome or Firefox:
setTimeout(myfunction(htmloutput)}, 200, "Javascript");

function myfunction(htmloutput){
if (poutput.document.readyState === "complete") {
poutput.document.getElementById("output").innerHTML = htmloutput;
poutput.focus();

return;
}
else{
setTimeout(writetothepopup(htmloutput), 200, "Javascript");
return;
}
}

Finally I found that using “function(){myfunction(htmloutput)} instead of myfunction(htmloutput); fixed my problems in Firefox and Chrome.
setTimeout(function(){myfunction(htmloutput)}, 200, "Javascript");

function myfunction(htmloutput){
if (poutput.document.readyState === "complete") {
poutput.document.getElementById("output").innerHTML = htmloutput;
poutput.focus();

return;
}
else{
setTimeout(function(){myfunction(htmloutput)}, 200, "Javascript");
return;
}
}


Check out these MacBooks