Nativescript get value of textfield

I had to get the value of a textfield using JavaScript in NativeScript; I tried a bunch of things and ended up just using a global variable to bind it.

XML:

<TextField id=”searchBox” text=”{{searchContents}}” />

And in the <Page> tag, add in:

loaded=”loaded”

JavaScript:

var model = {searchContents: “”};

exports.loaded = function(e){
var page = e.object;
page.bindingContext = model;
}

 

Then I could get it with model.searchContents;

Read the article

nativescript doesn’t scroll

I’m creating an app with NativeScript.  I’m using the Grid Layout, but I’m noticing that my content doesn’t scroll.

 

Solution: enclose everything in a <ScrollView>

Ex.

<ScrollView orientation="vertical" height="100%"  width="100%">
  <GridView Here...>
</ScrollView>

Read the article

reference google font locally

I have a web app that I want to use Google Fonts, but I want to download (and reference it) locally from the device.  You can’t use the normal CSS style/import tags.  I found  this link that can generate the CSS code you need: https://google-webfonts-helper.herokuapp.com/fonts

Read the article

NativeScript installation error

I was getting an error trying to install NativeScript (on my Mac).  Here’s (part of) the error I got:

TypeError: Object function Object() { [native code] } has no method ‘assign’ at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/cmd-list.js:113:33)

 

The solution: I thought I had the right version of Node installed; but I didn’t.  Even after doing “brew update”.  I manually re-installed Node (going to the official site) to make sure I had the latest version; then I was able to run npm correctly.

Read the article

GoDaddy Cron Job PHP include files

As a follow-up to figuring out how to get Cron Jobs to actually run in GoDaddy with a PHP script, I ran into another error:

I have a PHP Cron job that worked on HostGator, but it didn’t work on GoDaddy.  After I figured out the correct command to use, I noticed that it wasn’t actually connecting to the database.

At first, I didn’t notice this because I typically “include” files instead of “require” them.  I read somewhere that it takes up less processing power; so I figure once I know the location of the file, I can just “include” it (instead of “require” it).  Unfortunately, changing hosts caused an unforeseen inssue!  So that was the first mistake…

Going to the URL (in the browser), everything worked (i.e. it would connect to the database).  However that when running the Cron job, it didn’t work.  I found this out by printing out (in the email) the current working directory ( cwd(); ).  On the web server, it was as expected:

 /home/<username>/public_html/<sitename>/file.php

However the Cron job runs it from the root!

/home/<username>

Usually I just reference a configuration file with “include(“../path/relative/to/here”).  But that didn’t work!  The solution was to explicitly state the entire path of the file you want to include.

However then I ran into another problem:

I typically have code that detects the URL to determine if I’m in a sandbox or production environment.  GoDaddy’s Cron job, the PHP function $_SERVER[‘SCRIPT_FILENAME’] doesn’t return anything, so you can’t use that to determine which environment you’re in.  For now, I think I’ll have to just have 2 version of the file and comment/uncomment out the appropriate database connection to serve the correct data source.

By the way: if you thought this blog post was helpful, check out the book I wrote on PHP, geared toward intermediate web developers.

Read the article

GoDaddy PHP Cron Job (shared server)

I recently wrote about writing a (PHP) Cron Job on Host Gator.  Now I had to do one for GoDaddy.  I’m on a shared server (not sure if that makes a difference?).

I’m using CPanel with PHP version 7.1… and at the time of writing, GoDaddy’s documentation only has CPanel for a lower PHP version.  I called tech support, but they only pointed me in the right direction…

Here’s the right syntax:

/usr/bin/php-cli /home/<username>/public_html/<site>/file.php

I reluctantly turned on sending emails; good thing I did, because I found out there was an error.

BIG GOTCHA: you can’t have a period in the directory name; as in, if you’re working in “/username/public_html/yoursite.com/cronjob.php” that won’t work – it doesn’t like the “yoursite.com” part.  Remove that so it’s just “/username/public_html/yoursitecom/cronjob.php” (or some variation that doesn’t have the period).  The script wasn’t even running, and I didn’t realize this until I turned on the email notifications.

Once I did turn on the notifications, I was getting this error:

Failed loading /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so:  /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so: cannot open shared object file: No such file or directory

Failed loading /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ZendGuardLoader.so:  /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ZendGuardLoader.so: cannot open shared object file: No such file or directory
Content-type: text/html; charset=UTF-8

Thanks to Stack Overflow – https://stackoverflow.com/questions/40109716/cronjob-not-starting-in-godaddy-shared-hosting) for pointing out that you need the “-cli” in the command to avoid that error.

UPDATE: there’s another “gotcha” in GoDaddy’s PHP Cron Job usage; I wrote about it here.

By the way: if you thought this blog post was helpful, check out the book I wrote on PHP, geared toward intermediate web developers.

Read the article

High Charts Graph has missing data point

With the title as the main issue; and additional background being that my graph was using an HTML data table, the solution was to add a THEAD and TBODY to the table.

Read the article

FileZilla download adds extra blank lines

I’m using FileZilla as my FTP client.  When I download some of my files (text-based files; specifically, with a .php extension), an extra blank row was added throughout the file.

The solution was to update:

Edit >> Settings >> Transfers >> file Types >> change “default transfer type” to binary.

Read the article

Sublime Text SFTP can’t validate remote folder

I have the SFTP plugin for SublimeText.

I’m able to connect to the FTP server, but it won’t validate the remote folder.  After a couple of tries, I get the error: “Multiple disconnection errors, giving up”.  I tried shutting down SublimeText and even restarting, but that didn’t work.

There were 2 things I did to solve this problem; not sure which one actually fixed it:

  1. I downloaded the non-64 bit version (even though I’m on a 64-bit computer
  2. When the Windows Firewall came up, I allowed it to access over a public hotspot.  I’m using a desktop connected by ethernet, so I knew it wouldn’t make a difference.

I’m guessing it was the first one that solved the problem.

 

Read the article

excel where to find circular reference

MS Excel >> “Formula tab” >> “Formula Auditing” section >> “Error Checking” – click the little arrow next too it.

Read the article