Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 26    Views: 119

GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
01/04/15 05:44 AM (9 years ago)

Instant Database App - connection failed

Hi there, I recently installed the Instant Database App on the self hosted BT server. As far as I can tell I followed all the instructions; edit + uploaded the pl files to my cgi-bin directory uploaded the csv files to the directory I used in all the pl files changed the constants file in xcode. But still get this "Connection error" "Load error" message when changing to a different state. I also tried to add the public_html directory to the path, this was also suggested in the manual, but no result. Can somebody help me on this one? TIA Gert-Jan
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
01/04/15 02:16 PM (9 years ago)
Hi Gert-Jan, Did you change the file permissions on the .pl files to 755?
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/04/15 09:48 PM (9 years ago)
Hi, Yes that's what I did. I followed all the instructions. No result unfortunately. Regards, GJ
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 04:44 AM (9 years ago)
I am in the exact same boat and sinking fast! GJ, Whats the file structure of your hosting? Mine is \ htdocs cgi-bin db > sample diners this is a copy of the instruction (except the htdocs part but thats my hosting default) when i have AN's config in my constant.h it works fine, as soon as i change from <a href="http://www.angryninja.com" target="_blank" rel="nofollow">http://www.angryninja.com</a> to <a href="http://www.mywebsite.co.uk" target="_blank" rel="nofollow">http://www.mywebsite.co.uk</a> it all fails with "Connection error" "Load error" all files uploaded have CHMOD 755 Still stuck!
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/05/15 04:59 AM (9 years ago)
Yep same here. The original constant.h works fine and after changing it to my website it stucks. The structure of my website is: public_html/cgi-bin public_html/db public_html/myplaces (that's the directory I use for my project) public_html/myplacesimages I also changed the names of the csv files but edit all the .pl files with the correct names (no caps). I edited the constant.h with the above mentioned names and tried with and without the public_html Tr
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 05:03 AM (9 years ago)
if i using google chrom to access http://www. angryninjas.com/cgi i get a list of the file structure on AN's web hosting when i try on mine http://www. randalldesigns.co.uk/cgi-bin i get "Forbidden - You don't have permission to access /cgi-bin/ on this server." i think somewhere my hosting is blocking connection do you get the same? (www.yourwebsite.com/cgi-bin/)
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/05/15 09:22 AM (9 years ago)
Yes that's a "Forbidden" to. But actually it is supposed to be forbidden. The CGI (bin) directory is the default dir for al kinds of scripts. I guess that's not the thing causing our problem. Try to add one of the pl files and then see what happens f.e. cgi-bin/database_get_details.pl You see the code?
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 09:50 AM (9 years ago)
yes, i see the code but i think we should see the results?
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/05/15 09:53 AM (9 years ago)
yep, agree on that one. I'll check my provider, see if he knows whats going wrong.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 10:39 AM (9 years ago)
I checked mine today and they said its fine that I see forbidden because they are configured to look for an index.html in each folder and these don't have one. I'm still at a loss and hope AngryNinja can shed some light on his plugin :)
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
01/05/15 12:20 PM (9 years ago)
It just dawned on me an issue I had when I first created it... If I opened, edited and saved the PL files using text editor, it wouldn't work. I used a program called "taco html editor", but I'm sure if you opened and edited the PL files using Xcode or any other editor that is made for code editing that it will work. Or if your FTP program has the option of editing remotely (like FileZilla), that should work as well. It's like it was stripping out the formatting or something when using text editor. If I remember correctly, I think text wrangler also keeps the original formatting. Make sure you start with a clean copy of the PL files first (unzip them again, so you aren't editing ones that were already saved using text editor). I completely forgot about that issue I had back then until now, but I bet that's what's causing it.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 12:24 PM (9 years ago)
I'm not actually editing your pl files. I have created the same file structure so I didn't have to edit. Once I have the basic working then I was planning on tweaking. Any chance the zipped version in the plugin could have this issue already and you need to supply a fresh set of files???
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
01/05/15 01:13 PM (9 years ago)
Nope, I have several apps in the App Store using the exact plugin files. But... You say you have not edited the PL files? You need to edit them to reflect your hosting paths and structure. If you didn't edit them, that will cause the connection error. It's not just the constants.m file that needs to be edited. Use the included files, and edit the PL files accordingly, as per the instructions file, making sure not to use apples default text editor, save and upload.
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/05/15 01:35 PM (9 years ago)
Ok, I started all over. I uploaded the pl files, and edit them online with the directadmin editor, so no new upload was neccesary. I checked the constant.h and this is the code #ifndef TESTING_ENVIRONMENT #define SERVER_ADDRESS @"www.gjvanwijk.nl" //the url of your base website, no http or trailing / #define SERVER_PORT @"" //leave this blank, don't edit it #define SERVER_CGI_PATH @"cgi-bin" //the subdirectory where your cgi scripts are located #define SERVER_DB_PATH @"db/myplaces" //the directory where your CSV databases are located #define SERVER_PHOTOS @"myplacesimages" //the directory where your pictures are located #define MAIL_ADDRESS @"[email protected]" //your email address, used for the forms in the app #else This is a sample of one the pl files (from line 17) my @selection=(); open(DATA,"../db/myplaces/myplaces.csv") || print "<p>Not found: $!</p>"; while(<DATA>) { chomp; my @data=split(/#/); if($data[0] eq $placeid) { @selection = @data; last; } } close(DATA); #now check for pictures in the database and return them #each picture has name photo_id_XX.png where id is the club id and XX can be any string #all these names are returned in the plist as a | separated list opendir(DBDIR,"../diners"); my $id=$selection[0]; my @photos = grep({$_=~/uploaded_($id)_\w+\.png/} readdir(DBDIR)); I checked if the files are writable and if the csv files are in the correct place and writable and named correctly. BTW should the part opendir(DBDIR,"../diners"); not be edited?? It's not in the instructions but it looks like a path to a directory named diners....which in my case I'm not using (myplaces instead)
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 01:43 PM (9 years ago)
When you say we rename to match my hosting path structure.... Is that everything? ../DB/sample/diners.csv for example, should that be http://www.site.com/DB/sample/diners?
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/05/15 01:54 PM (9 years ago)
I guess so.....
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 02:55 PM (9 years ago)
@Ninja? open(DATA,"../db/myplaces/myplaces.csv") || print "<p>Not found: $!</p>"; Should we be changing all of "../db/myplaces/myplaces.csv"? Replacing the .. With or website address?
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/05/15 09:55 PM (9 years ago)
I think it's the absolute path here...seen from within the script its locattion.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/05/15 11:58 PM (9 years ago)
And does that now work for you?
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/06/15 04:54 AM (9 years ago)
Nope, still have the connection error /load error So I shure hope AN has a solution.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/06/15 06:04 AM (9 years ago)
GJ, have you edited any of the xib files?
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/06/15 06:35 AM (9 years ago)
Yes I did. Changed the pictures and buttons
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/06/15 06:44 AM (9 years ago)
ok so did i. ive just opened up a fresh download of app. do not change any xib (yet). change you constants.h then run on device mine now seems to be working (although i think ive found a bug)
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/06/15 10:40 AM (9 years ago)
Well that could be the problem indeed. Let's wait for AN to check this out.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/06/15 11:03 AM (9 years ago)
Mine is all working fine now. Didn't change the PL files at all. Just the constants.h
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
01/07/15 03:01 AM (9 years ago)
So I got mine working, even with my own design (XIB). The problem was the web hoster. They don't really support cgi scripts. So I created an account with a hoster who do support CGI and it all works fine now. Even with the edited XIB files. One small issue but that's my own mistake somewhere is that after I changed the usstates file (to the categories I want to use) and the csv files only one record is shown in the first category. So let's say I changed "Alabama" to "Restaurants" in the usstates list and also changed all the "Alabama" records in the Diners.csv (replacing Alabama with Restaurants). Only the first record shows up.. And there's another question for AN; @AN: how can I put the app in 'automatic pilot' mode so the records that are added from the app are directly written in the database, without any email-handling?
 
0z2000tv
Aspiring developer
Profile
Posts: 315
Reg: Sep 10, 2011
Nashville
11,950
like
07/11/15 12:03 PM (9 years ago)
Thank you Gert-Jan and Bonzo!!!!! It took a couple of day but I was able to run the app from my server. It did not work at all when first compiled. Found a link from SmugWimp on Quick Location Fix for iOS 8. App worked after a couple of tries. I tried for hours to update the cgi files. Found this post and followed Bonzo suggestions. In Constants.h Changed web site url Changed cgi to cgi-bin (this is how bluehost is structured Changed e-mail address. Then I uploaded a clean set of .pl scripts. Changed 2 entries in the DB so I could be sure it is my server that is driving the App. It works. Note @AN auto pilot would be nice or maybe the emails data posted to a CSV sheet for easy editing and approval even if cut and paste was needed? Host Bluehost FTP Upload Filezilla CSV Editor Open Office X-Code 6.4 TextWrangle for txt editing Tested on iPhone 5 running iOS 8.4 Thank you @AN, Bonzo and Gert-Jan, Mike
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.