Calguns.net  

Home My iTrader Join the NRA Donate to CGSSA Sponsors CGN Google Search
CA Semiauto Ban(AW)ID Flowchart CA Handgun Ban ID Flowchart CA Shotgun Ban ID Flowchart
Go Back   Calguns.net > GENERAL DISCUSSION > Technology and Internet
Register FAQ Members List Calendar Mark Forums Read

Technology and Internet Emerging and current tech related issues. Internet, DRM, IP, and other technology related discussions.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2017, 11:55 AM
Kestryll's Avatar
Kestryll Kestryll is offline
Head Janitor
 
Join Date: Oct 2005
Location: Occupied Reseda, PRK
Posts: 21,508
iTrader: 23 / 100%
Default Programing help needed

Calguns has run on vBulletin for 12 years now, mostly on the 3.x.x version. It's past time to update to at least vB4, in order to keep vB3.x.x alive we've had to make some odd tweaks and such to the servers and it's getting more difficult.

The two hold ups have been making sure iTrader would work on vB4, it's an old and unsupported mod, and getting the advertising to work.

I can make iTrader work in vB4, it runs and functions whether it will transfer current ratings to a new install is anyone's guess.

What I am having problems with is the advertising, vB4 makes some fundamental changes that the current process can not adapt to.
Currently the ads make use of the 'random' setting in php to present ads in each cell from a specific list, vB4 no longer supports php random so the current system can not work.

What I need is something with a table similar to what is at the top of the page with different sections displaying linked banners in a random order that allows me to add and removed linked banners as advertisers come and go.
Banner images are stored on the Calguns server and the display code would be placed in an advertising header space that vB4 has as an integral part of the software. We currently have two rows of eight spaces at 120x60 however we are looking at going to 2 or three rows of 5 at 234x60, keeping the same or similar height for the overall table but allowing for larger banners.

The advertising is essential to paying for the hosting costs as well as for supporting efforts like CGSSA classes and outreach programs so I can't upgrade unless I have a verified way of continuing with them.

I have no idea what something like this costs or what to expect in that regard but we'll see...
__________________
NRA Benefactor Life Member / CRPA Life Member / SAF Life Member
Calguns.net an incorported entity - President.
The Calguns Shooting Sports Assoc. - Vice President.
The California Rifle & Pistol Assoc. - Director.
DONATE TO NRA-ILA, CGSSA, AND CRPAF NOW!
Opinions posted in this account are my own and unless specifically stated as such are not the approved position of Calguns.net, CGSSA or CRPA.
Reply With Quote
  #2  
Old 05-09-2017, 1:08 PM
wes.crockett's Avatar
wes.crockett wes.crockett is offline
Member
 
Join Date: Jun 2014
Location: Fresno, CA
Posts: 193
iTrader: 1 / 100%
Default

It's been quite a while since I've done anything like this, but I can think of a way it can be done...

How is advertisement data stored? I assume there is a table in the database that contains fields for image location, image alt text, and pointer URL?

Would larger banners be just larger horizontally, or vertically too? Either way, I believe values would need to be stored in order to identify sizes for them.

Finally, did you happen to ask about this on the vBulletin site? Perhaps someone has already invented this wheel for vB4.
Reply With Quote
  #3  
Old 05-09-2017, 1:16 PM
oktavist oktavist is offline
Member
 
Join Date: Aug 2015
Location: Santa Cruz County
Posts: 391
iTrader: 0 / 0%
Default

Quote:
vB4 no longer supports php random so the current system can not work.
It would be simple to implement your own rand function.
Most rand implementations just use something like this.
https://en.wikipedia.org/wiki/Linear...tial_generator
Only take you a few lines of code.
__________________
Calguns Lurker
Reply With Quote
  #4  
Old 05-09-2017, 1:18 PM
wes.crockett's Avatar
wes.crockett wes.crockett is offline
Member
 
Join Date: Jun 2014
Location: Fresno, CA
Posts: 193
iTrader: 1 / 100%
Default

Quote:
Originally Posted by oktavist View Post
It would be simple to implement your own rand function.
Most rand implementations just use something like this.
https://en.wikipedia.org/wiki/Linear...tial_generator
Only take you a few lines of code.
The rand function itself would be easy, but he also wants the ability to support adds that take up 2, 4, (more) of the predefined tile spaces... That functionality would be FAR more difficult.
Reply With Quote
  #5  
Old 05-09-2017, 1:21 PM
Cincinnatus's Avatar
Cincinnatus Cincinnatus is offline
Senior Member
 
Join Date: Mar 2008
Location: East Bay Area
Posts: 701
iTrader: 8 / 100%
Default

Have two rows of tiles, one row is the length of two or three small tiles, the other row being small tiles.

I'm not a programmer, more of a systems analyst, but that's how I'd do it.
__________________
Active Army 1976-1986, Army Reserve 2005-2015, Afghanistan 2010-2011
http://www.thepolemicist.net/2013/01...t-for-gun.html
https://www.thereligionofpeace.com/
“This decision is a freedom calculus decided long ago by Colonists who cherished individual freedom more than the subservient security of a British ruler. The freedom they fought for was not free of cost then, and it is not free now.” - Hon. Roger T. Benitez, United States District Judge, March 29, 2019
Reply With Quote
  #6  
Old 05-09-2017, 1:22 PM
wes.crockett's Avatar
wes.crockett wes.crockett is offline
Member
 
Join Date: Jun 2014
Location: Fresno, CA
Posts: 193
iTrader: 1 / 100%
Default

Quote:
Originally Posted by Cincinnatus View Post
Have two rows of tiles, one row is the length of two or three small tiles, the other row being small tiles.

I'm not a programmer, more of a systems analyst, but that's how I'd do it.
That could work, assuming they want to handle something so statically set. It would be easier to do this, though.
Reply With Quote
  #7  
Old 05-09-2017, 1:31 PM
oktavist oktavist is offline
Member
 
Join Date: Aug 2015
Location: Santa Cruz County
Posts: 391
iTrader: 0 / 0%
Default

Oh, multiple sized adds at once that all fit together. I get it now. That's much more fun.

You will need a fitting algorithm that can reject an ad if it's to big for the remaining space, or a selection algorithm that will only pick a random ad that is guaranteed to fit. The implementation details will depend upon the actual allowed ad sizes you want.
__________________
Calguns Lurker
Reply With Quote
  #8  
Old 05-09-2017, 1:32 PM
Cincinnatus's Avatar
Cincinnatus Cincinnatus is offline
Senior Member
 
Join Date: Mar 2008
Location: East Bay Area
Posts: 701
iTrader: 8 / 100%
Default

I'm patting myself on the back over here.
__________________
Active Army 1976-1986, Army Reserve 2005-2015, Afghanistan 2010-2011
http://www.thepolemicist.net/2013/01...t-for-gun.html
https://www.thereligionofpeace.com/
“This decision is a freedom calculus decided long ago by Colonists who cherished individual freedom more than the subservient security of a British ruler. The freedom they fought for was not free of cost then, and it is not free now.” - Hon. Roger T. Benitez, United States District Judge, March 29, 2019
Reply With Quote
  #9  
Old 05-09-2017, 1:40 PM
wes.crockett's Avatar
wes.crockett wes.crockett is offline
Member
 
Join Date: Jun 2014
Location: Fresno, CA
Posts: 193
iTrader: 1 / 100%
Default

Yeah, the easiest way would to have set grid sizes... i.e: If you wanted a total height of 3 and width of 6, you could have them arranged like below in a very static method... There are three different sizes below. You would just need each cell to have a call to the database and the table would need a static value indicating the size of the image. That size would be specified in a filter when calling for a random ad.

Reply With Quote
  #10  
Old 05-09-2017, 2:04 PM
UEDan UEDan is offline
Member
 
Join Date: Jul 2016
Posts: 164
iTrader: 2 / 100%
Default

Any specific version of vBulletin 4?
Where are the current ads?
Reply With Quote
  #11  
Old 05-09-2017, 2:17 PM
Kestryll's Avatar
Kestryll Kestryll is offline
Head Janitor
 
Join Date: Oct 2005
Location: Occupied Reseda, PRK
Posts: 21,508
iTrader: 23 / 100%
Default

Quote:
Originally Posted by UEDan View Post
Any specific version of vBulletin 4?
Since this would be an initial install I'd go with the most recent version, might as well get a jump on the inevitable updates..

Where are the current ads?
Funny you should mention that, I was just about to post them!
These have been somewhat 'genericized' to protect the innocent...

This is the code that is inserted in to the vBulletin Header Template:
Quote:
<table
style="width: 978px; height: 122px; text-align: left; margin-left: auto; margin-right: auto;"
border="2" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner11[$random_number11]</td>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner12[$random_number12]</td>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner13[$random_number13]</td>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner14[$random_number14]</td>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner15[$random_number15]</td>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner16[$random_number16]</td>
<td style="width: 120px; text-align: center; height: 60px;">$random_banner17[$random_number17]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner18[$random_number18]</td>
</tr>
<tr>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner19[$random_number19]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner20[$random_number20]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner21[$random_number21]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner22[$random_number22]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner23[$random_number23]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner24[$random_number24]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner25[$random_number25]</td>
<td style="height: 60px; width: 120px; text-align: center;">$random_banner26[$random_number26]</td>
</tr>
</tbody>
</table>
This is the code for the plugins in the Header:
Quote:
$random_number16 = rand(1, 3);

$random_banner16[1] = '<a href="http://www.vendor1.com/" target="_blank"><img src="/images/ads16/vend1120x60.gif" alt="" border="0" /></a>';
$random_banner16[2] = '<a href="http://www.vendor2.com/" target="_blank"><img src="/images/ads16/vend2120x60.gif" alt="" border="0" /></a>';
$random_banner16[3] = '<a href="http://www.vendor3.com/" target="_blank"><img src="/images/ads16/vend3120x60.gif" alt="" border="0" /></a>';
__________________
NRA Benefactor Life Member / CRPA Life Member / SAF Life Member
Calguns.net an incorported entity - President.
The Calguns Shooting Sports Assoc. - Vice President.
The California Rifle & Pistol Assoc. - Director.
DONATE TO NRA-ILA, CGSSA, AND CRPAF NOW!
Opinions posted in this account are my own and unless specifically stated as such are not the approved position of Calguns.net, CGSSA or CRPA.
Reply With Quote
  #12  
Old 05-09-2017, 5:38 PM
Marauder2003's Avatar
Marauder2003 Marauder2003 is online now
Waiting for Abs
CGN Contributor - Lifetime
 
Join Date: Aug 2010
Location: NV
Posts: 2,204
iTrader: 1 / 100%
Default

Please consider an automatic photo resizer to the board. Like
http://vbulletin-mods.com/forum/showthread.php?t=2456
__________________
#NotMyPresident
#ArrestFauci
Reply With Quote
  #13  
Old 05-09-2017, 6:33 PM
Cincinnatus's Avatar
Cincinnatus Cincinnatus is offline
Senior Member
 
Join Date: Mar 2008
Location: East Bay Area
Posts: 701
iTrader: 8 / 100%
Default

Quote:
Originally Posted by wes.crockett View Post
I was thinking something along these lines:
Attached Images
File Type: jpg Calguns Ad Layout.jpg (7.4 KB, 34 views)
__________________
Active Army 1976-1986, Army Reserve 2005-2015, Afghanistan 2010-2011
http://www.thepolemicist.net/2013/01...t-for-gun.html
https://www.thereligionofpeace.com/
“This decision is a freedom calculus decided long ago by Colonists who cherished individual freedom more than the subservient security of a British ruler. The freedom they fought for was not free of cost then, and it is not free now.” - Hon. Roger T. Benitez, United States District Judge, March 29, 2019
Reply With Quote
  #14  
Old 05-09-2017, 7:15 PM
reverser reverser is offline
Senior Member
 
Join Date: Dec 2009
Location: New Hampshire
Posts: 710
iTrader: 7 / 100%
Default

What makes you say this? Have you properly preregistered your variable? What hook are you using? Are you getting any output at all from the template?

Quote:
Originally Posted by Kestryll View Post
What I am having problems with is the advertising, vB4 makes some fundamental changes that the current process can not adapt to.
Currently the ads make use of the 'random' setting in php to present ads in each cell from a specific list, vB4 no longer supports php random so the current system can not work.
Reply With Quote
  #15  
Old 05-09-2017, 7:31 PM
Cokebottle's Avatar
Cokebottle Cokebottle is offline
Señor Member
CGN Contributor - Lifetime
 
Join Date: Oct 2009
Location: IE, CA
Posts: 32,373
iTrader: 14 / 100%
Default

Quote:
Originally Posted by Kestryll View Post
it's an old and unsupported mod,
Ivanimal is stepping down?
__________________
- Rich

Quote:
Originally Posted by dantodd View Post
A just government will not be overthrown by force or violence because the people have no incentive to overthrow a just government. If a small minority of people attempt such an insurrection to grab power and enslave the people, the RKBA of the whole is our insurance against their success.
Reply With Quote
  #16  
Old 05-09-2017, 7:59 PM
Kestryll's Avatar
Kestryll Kestryll is offline
Head Janitor
 
Join Date: Oct 2005
Location: Occupied Reseda, PRK
Posts: 21,508
iTrader: 23 / 100%
Default

Quote:
Originally Posted by reverser View Post
What makes you say this? Have you properly preregistered your variable? What hook are you using? Are you getting any output at all from the template?
When I tried it out on a test install it didn't work so I asked on the vBulletin support forums if something changed in how 4.x.x deals with PHP that would prevent this from working and was told by one of the developers 'Yes, we've made some changes to how things work in 4.x, you'd need to go over and post @ vBulletin.org for assistance with custom coding.'

I was referred to this link which may address what you're referring to but to be honest it's a bit beyond my current knowledge: https://www.vbulletin.org/forum/showthread.php?t=228078
I can do a lot of things within the vBulletin software but I'm not a coder or programmer. After a few moments of trying to follow it my eyes glaze over and I become Homer Simpson thinking about donuts.

Quote:
Originally Posted by Cokebottle View Post
Ivanimal is stepping down?
*OUCH*
__________________
NRA Benefactor Life Member / CRPA Life Member / SAF Life Member
Calguns.net an incorported entity - President.
The Calguns Shooting Sports Assoc. - Vice President.
The California Rifle & Pistol Assoc. - Director.
DONATE TO NRA-ILA, CGSSA, AND CRPAF NOW!
Opinions posted in this account are my own and unless specifically stated as such are not the approved position of Calguns.net, CGSSA or CRPA.
Reply With Quote
  #17  
Old 05-09-2017, 8:16 PM
cyclopes85 cyclopes85 is offline
Member
 
Join Date: May 2015
Posts: 191
iTrader: 0 / 0%
Default

Tried to view the forum linked but the code snippets are only for members.

Sent from my SM-G955U using Tapatalk
Reply With Quote
  #18  
Old 05-15-2017, 4:23 PM
bellts's Avatar
bellts bellts is offline
Senior Member
 
Join Date: Sep 2011
Location: Boise, Idaho
Posts: 2,377
iTrader: 65 / 100%
Default

I would try to accomplish this in Javascript. Maybe using this jquery library:

Justified.js
http://nitinhayaran.github.io/Justified.js/demo/

Pretty easy task...
1) Have an javascript array of images which you can edit (when you add or drop an advertiser).
2) Write a tiny (smart) random selector (which will give back the right amount of small banners, if one or more big banners was selected).
3) Then use justified.js to arrange the banners to fit.

------------------------------------

If I'm bored I might play with this tomorrow (and have a working demo). Something to keep my mind off of not having a job!

Last edited by bellts; 05-15-2017 at 4:42 PM..
Reply With Quote
  #19  
Old 05-16-2017, 4:40 PM
bellts's Avatar
bellts bellts is offline
Senior Member
 
Join Date: Sep 2011
Location: Boise, Idaho
Posts: 2,377
iTrader: 65 / 100%
Default

Alright.... here's my (javascript based) proof of concept:

http://www.pathient.com/bellts/calguns/index.html

The demo uses images (ads) which are sized in increments of 60px (to mimic current ops - standard ad right now is 120x60). I'm only using one image for the demo (each resized based on advert size) but each image that shows up is a unique advertisement (entry) which are selected randomly, and no duplicates. Each time the page is displayed it will randomly select images, and randomly place them in the table. Sometimes there will be a bunch of small ads. Sometimes large ads. Sometimes a good mix.... it's all random.

There's a array of ads that someone must change when ads are added or dropped.

Ex. of array entries:

Quote:
//really small ads
ads.push({"id":"0","width":60,"height":60,"name":"Addax Tactical","img_url":"http://www.pathient.com/tbell/calguns/ads/Addax120x60.gif","link":"http://www.addaxtactical.com/"});

//small ads
ads.push({"id":"8","width":120,"height":60,"name":"Addax Tactical","img_url":"http://www.pathient.com/tbell/calguns/ads/Addax120x60.gif","link":"http://www.addaxtactical.com/"});

//large ads
ads.push({"id":"17","width":240,"height":60,"name":"Addax Tactical","img_url":"http://www.pathient.com/tbell/calguns/ads/Addax120x60.gif","link":"http://www.addaxtactical.com/"});

//even larger ads
ads.push({"id":"27","width":360,"height":60,"name":"Addax Tactical","img_url":"http://www.pathient.com/tbell/calguns/ads/Addax120x60.gif","link":"http://www.addaxtactical.com/"});

//even larger larger ads
ads.push({"id":"28","width":420,"height":60,"name":"Addax Tactical","img_url":"http://www.pathient.com/tbell/calguns/ads/Addax120x60.gif","link":"http://www.addaxtactical.com/"});

.... and on and on up to 960px in width (or whatever ads_width_of_rows is set to -- see below).
There are also two variables which must be changed if you want to add rows or change the width of the advertising table (in increments of 60 of course):

Quote:
var ads_num_of_rows = 2;
var ads_width_of_rows = 960;

Last edited by bellts; 05-17-2017 at 8:09 AM..
Reply With Quote
  #20  
Old 05-17-2017, 6:38 AM
bellts's Avatar
bellts bellts is offline
Senior Member
 
Join Date: Sep 2011
Location: Boise, Idaho
Posts: 2,377
iTrader: 65 / 100%
Default

Small update: added the ability always include a certain ad(s).

To include a specific ad, call the "getRandomAds(specific_ad_id)" before calling the "showAds()" function.

I.E.
Quote:
$(document).ready(function(){
getRandomAds("4");
getRandomAds("29");
showAds();
});
If anyone needs a programmer (I've been doing this a long time) I'm in dire need of a job. I started/co-founded a business 7 years ago and it recently went under (investor pulled funding). I was working as the company's CTO (but basically doing everything). I'm also an ex-marine (combat vet) if that helps any.

Last edited by bellts; 05-17-2017 at 7:05 AM..
Reply With Quote
  #21  
Old 05-17-2017, 12:00 PM
deephouse deephouse is offline
Veteran Member
 
Join Date: Sep 2012
Location: Somewhere in CA
Posts: 3,719
iTrader: 49 / 100%
Default

You can also call a file in the header and put all the custom ad edits in a separate file so that when it comes time to upgrade (again) you only have to know about that one insert line, and then the extra file with all the ad coding. Generally it's easier to call a separate file than to remember where all your in line edits are...


Sent from my iPhone using Tapatalk
Reply With Quote
  #22  
Old 05-17-2017, 2:03 PM
deephouse deephouse is offline
Veteran Member
 
Join Date: Sep 2012
Location: Somewhere in CA
Posts: 3,719
iTrader: 49 / 100%
Default

If you're also monitoring the click through rate on those header ads, I'm guessing you send reports to the advertisers so they can see how much traffic is going to their site via Calguns. That said a 300x250 "side bar" type ad is more visible and could be used for different types of ads (say) affiliate links for products. Or your could charge more from advertisers for impression based visibility that's not in contention with the other randomized ads in the header.

I'm not saying what you're doing is wrong but there are other ways... "newer ways" if you will, to monetize ad space.

The viewer pays the price being that the look starts to become cluttered, but in all honestly side ads are pretty standard on content pages, and I see them often in forums now too.
AND obviously you run the risk of the viewer clicking off your site, but you could also run internal promotions in that ad space.... "click here to donate to Calguns"...contests, meetups, PSAs, etc.

You'll have to ask yourself if that's the direction you want to head down - a more prominent ad as the viewer reads content. Or continue displaying ads that (for the most part) disappear once we scroll down to read content.

Lastly - its possible that the newer version of BB has a plug-in or module designed for ads, and you wont have to customize things moving forward, just keep the ad module updated.

Food for thought. I've run a CMS before, it's a lot of work, and you can't please everyone.

Last edited by deephouse; 05-17-2017 at 2:13 PM..
Reply With Quote
  #23  
Old 05-19-2017, 8:20 AM
Noble Cause Noble Cause is offline
Veteran Member
 
Join Date: Jan 2013
Location: California
Posts: 2,633
iTrader: 0 / 0%
Default

Quote:
Originally Posted by Marauder2003 View Post
Please consider an automatic photo resizer to the board. Like
http://vbulletin-mods.com/forum/showthread.php?t=2456


This would be a nice feature to have.



Noble
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -8. The time now is 12:14 PM.




Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Proudly hosted by GeoVario the Premier 2A host.
Calguns.net, the 'Calguns' name and all associated variants and logos are ® Trademark and © Copyright 2002-2021, Calguns.net an Incorporated Company All Rights Reserved.
All opinions, statements and remarks made by Calguns.net on this web site and elsewhere are solely attributable to Calguns.net.



Seams2SewBySusy