• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
What would you guys recommend for making a frontend for a javaEE backend (EJB and stuff)?
[QUOTE=zero_slo;44146425]What would you guys recommend for making a frontend for a javaEE backend (EJB and stuff)?[/QUOTE] I might be wrong, but doesn't this belong in programming?
[QUOTE=Moofy;44145755]Does Brackets have a proper FTP/SFTP plugin yet? There's FTP sync but honestly it's so bad you have to click an icon and enter your password every time you want o upload. Saving doesn't work, you have to go through this procedure of steps for it to work. [editline]edited:[/editline] Also I love sublime with all my heart but one thing that annoys me is that with the SFTP plugin you can't browse with the sidebar file tree, is there no setting for this of any kind? It would make everything faster, I have looked into some settings but simply can't find it.[/QUOTE] Why do you need an sftp/ftp plugin. You should never directly work with files on a server. Always work on it separately just in case you screw up.
[QUOTE=jung3o;44147310]Why do you need an sftp/ftp plugin. You should never directly work with files on a server. Always work on it separately just in case you screw up.[/QUOTE] What do you mean? I am saving it locally and it's uploading by itself along with it, but it would be nice to have a file tree if my entire server at times and not just the folder I'm working with
[QUOTE=KmartSqrl;44138276]It's really cool seeing this progress! Keep at it :) Definitely start working towards what CBastard is suggesting ASAP as well. The less logic you have in your templates, the better. I would [B][I]really[/I][/B] strive to having nothing but simple conditionals, simple loops, and echo statements in any php file that has HTML in it. Having that really strong separation between your templates and your business logic is incredibly helpful.[/QUOTE] Classes are AWESOME At first I didn't understand, I thought it was a two-step process like functions where you write your function, then run it. Then I understood with the idea that classes are a 3 or more step process; You build a base function, extend it with specifics, then run it. I had the idea in my head to use one PHP document to do various forms of math (data smasher/formatter) then have another render HTML I want to build the squares content first to see what data they share consistently and see if I can have different "layouts" for data. Such as a list that outputs an array, or a showcase for single integers. However at this moment my ideas for these widgets/squares are too abstract to see how they are consistent, so I think I'm going to be including complicated functions related to their inner content. Then try to consolidate after. I've run into a problem as well... Input: [code] <?php if(!file_exists("import.php")) { die("Error! <br />import.php wasn't imported; File cannot be found.<br /> Almost There cannot be loaded"); } else { include 'import.php'; }; // Squares.php by LuckyMonkey // Square Template Class class square { var $squareName="Default"; var $squareID="default"; var $squareIcon="icon-console"; var $squareSize="sq"; // var $squareBackground="none"; var $squareContent="<span class='\'blink\'>Error! No Data Recieved</span>"; // check visibility function function buildSquare() { //global $squareName, $squareID, $squareIcon, $squareSize, $squareContent; // I don't think I need this... echo "<!-- We are now executing " . $squareID . " square -->"; // squareBackground function echo "<div id='" . $squareID . "' class='" . $squareSize . " theBGcolor'> \n"; echo "<div class='sqTitle'><a class='icn " . $squareContent . "'>&nbsp;</a>" . $squareName . "<a class='sqSettings icn icon-settings'></a></div>"; echo "<div class='sqBody'>\n" . $squareContent . "\n</div>"; //Square Settings function echo "<div class='sqBack'><ul><li>Pin Square</li><li>Hide Square</li><li>Share Square</li></ul></div>"; echo "</div>"; echo "<!-- We are no longer executing " . $squareID . " square -->"; } }; class square_youtube extends square { var $squareName="Youtube"; var $squareID="youtube"; var $squareIcon="icon-youtube"; var $squareSize="sqDub"; var $squareContent="hello"; }; function hello() { echo "<!DOCTYPE html><html><head>"; head(); echo "<title class='dynTitle'>Almost There - Squares</title></head><body>"; preBody(); echo "<div id='sqField' class='nudge'>"; $extended = new square_youtube(); $extended->buildSquare(); echo "</div>"; postBody(); echo "</body></html>"; }; hello(); ?> [/code] Output: [code]<!-- We are now executing square --> <div id='' class=' theBGcolor'> <div class='sqTitle'><a class='icn '>&nbsp;</a><a class='sqSettings icn icon-settings'></a></div> <div class='sqBody'></div> <div class='sqBack'> <ul> <li>Pin Square</li> <li>Hide Square</li> <li>Share Square</li> </ul> </div> </div> <!-- We are no longer executing square -->[/code]
[QUOTE=lkymky;44147718]Classes are AWESOME At first I didn't understand, I thought it was a two-step process like functions where you write your function, then run it. Then I understood with the idea that classes are a 3 or more step process; You build a base function, extend it with specifics, then run it. I had the idea in my head to use one PHP document to do various forms of math (data smasher/formatter) then have another render HTML I want to build the squares content first to see what data they share consistently and see if I can have different "layouts" for data. Such as a list that outputs an array, or a showcase for single integers. However at this moment my ideas for these widgets/squares are too abstract to see how they are consistent, so I think I'm going to be including complicated functions related to their inner content. Then try to consolidate after. I've run into a problem as well... Input: [code] <?php if(!file_exists("import.php")) { die("Error! <br />import.php wasn't imported; File cannot be found.<br /> Almost There cannot be loaded"); } else { include 'import.php'; }; // Squares.php by LuckyMonkey // Square Template Class class square { var $squareName="Default"; var $squareID="default"; var $squareIcon="icon-console"; var $squareSize="sq"; // var $squareBackground="none"; var $squareContent="<span class='\'blink\'>Error! No Data Recieved</span>"; // check visibility function function buildSquare() { //global $squareName, $squareID, $squareIcon, $squareSize, $squareContent; // I don't think I need this... echo "<!-- We are now executing " . $squareID . " square -->"; // squareBackground function echo "<div id='" . $squareID . "' class='" . $squareSize . " theBGcolor'> \n"; echo "<div class='sqTitle'><a class='icn " . $squareContent . "'>•</a>" . $squareName . "<a class='sqSettings icn icon-settings'></a></div>"; echo "<div class='sqBody'>\n" . $squareContent . "\n</div>"; //Square Settings function echo "<div class='sqBack'><ul><li>Pin Square</li><li>Hide Square</li><li>Share Square</li></ul></div>"; echo "</div>"; echo "<!-- We are no longer executing " . $squareID . " square -->"; } }; class square_youtube extends square { var $squareName="Youtube"; var $squareID="youtube"; var $squareIcon="icon-youtube"; var $squareSize="sqDub"; var $squareContent="hello"; }; function hello() { echo "<!DOCTYPE html><html><head>"; head(); echo "<title class='dynTitle'>Almost There - Squares</title></head><body>"; preBody(); echo "<div id='sqField' class='nudge'>"; $extended = new square_youtube(); $extended->buildSquare(); echo "</div>"; postBody(); echo "</body></html>"; }; hello(); ?> [/code] Output: [code]<!-- We are now executing square --> <div id='' class=' theBGcolor'> <div class='sqTitle'><a class='icn '>•</a><a class='sqSettings icn icon-settings'></a></div> <div class='sqBody'></div> <div class='sqBack'> <ul> <li>Pin Square</li> <li>Hide Square</li> <li>Share Square</li> </ul> </div> </div> <!-- We are no longer executing square -->[/code][/QUOTE] When you're trying to access a class's member variables from a function in that class you want to write [code] $this->squareID; [/code] instead of just $squareID; The $this-> bit says look for the following property on the object this code is inside of.
Also, in PHP source intended to be templates I'd like to throw in a few things that help me keep logic separate: Use a different extension (i.e. .tpl rather than .php); you can still tell your editor to consider it to be php source, but psychologically you can see the distinction and are less likely to embed a lot of logic (at least in my experience). Never define functions in template source; prefer to inject these sorts of dependencies from PHP source. I highly recommend the [URL="http://php.net/manual/en/control-structures.alternative-syntax.php"]alternative control structure syntax[/URL] for use in template source; it is much easier to read (curly braces don't read well in templates) and allows you to focus on your template as HTML with PHP present only in dynamic sections. Unless a template is inherently specific (for example a wrapper around a specific type of object), try to keep things as general as possible to allow you to reuse it. Of course feel free to disregard all of this, I have limited experience; these are just a few things that have helped me work with PHP.
[QUOTE=Rayjingstorm;44149683]Also, in PHP source intended to be templates I'd like to throw in a few things that help me keep logic separate: Use a different extension (i.e. .tpl rather than .php); you can still tell your editor to consider it to be php source, but psychologically you can see the distinction and are less likely to embed a lot of logic (at least in my experience). Never define functions in template source; prefer to inject these sorts of dependencies from PHP source. I highly recommend the [URL="http://php.net/manual/en/control-structures.alternative-syntax.php"]alternative control structure syntax[/URL] for use in template source; it is much easier to read (curly braces don't read well in templates) and allows you to focus on your template as HTML with PHP present only in dynamic sections. Unless a template is inherently specific (for example a wrapper around a specific type of object), try to keep things as general as possible to allow you to reuse it. Of course feel free to disregard all of this, I have limited experience; these are just a few things that have helped me work with PHP.[/QUOTE] I thought TPL was Smarty or framework specific? It might be that simple to implement, but i'm not completely sure... Isn't using off-filename extensions more of a programming practice violation than some of my previous posts? [editline]6th March 2014[/editline] [QUOTE=KmartSqrl;44149301]When you're trying to access a class's member variables from a function in that class you want to write [code] $this->squareID; [/code] instead of just $squareID; The $this-> bit says look for the following property on the object this code is inside of.[/QUOTE] [url]http://www.almost-there.org/squares.new.php[/url] Oh... Perfect... Now to let my OCD kick in and let things get refuckingdiculious :dance: A reward for you... [code] class square_kmartsqrl extends square { var $squareName="KmartSqrl"; var $squareID="kmartsqrl"; var $squareIcon="icon-grin"; var $squareSize="sqDub"; var $squareContent="<span class='nudge'>Is awesome</span>"; }; [/code] I want to make these go to mySQL soon, then make a web-form gui thing so I never have to touch the code of this again to build squares. Then to delete or add a square I just have to delete/add the row.
I'm not quite sure of CSS is capable of this, but is there any way to use a variable throughout a stylesheet? Basically I'm making a company website but I don't know exactly what colors the company will end up using, so I would like to use a primary, secondary, and tertiary color variable in the stylesheet so I don't have to replace them all individually if the color scheme changes.
[QUOTE=Cep.;44154940]I'm not quite sure of CSS is capable of this, but is there any way to use a variable throughout a stylesheet? Basically I'm making a company website but I don't know exactly what colors the company will end up using, so I would like to use a primary, secondary, and tertiary color variable in the stylesheet so I don't have to replace them all individually if the color scheme changes.[/QUOTE] [url]http://sass-lang.com/[/url] and it does tons more that you will wonder how you ever did without as well.
[QUOTE=Cep.;44154940]I'm not quite sure of CSS is capable of this, but is there any way to use a variable throughout a stylesheet? Basically I'm making a company website but I don't know exactly what colors the company will end up using, so I would like to use a primary, secondary, and tertiary color variable in the stylesheet so I don't have to replace them all individually if the color scheme changes.[/QUOTE] Why can't you use CSS: [code] .theColor {color:red;} .theBGcolor {background-color:red;} [/code] HTML: [code] <p class='theColor'>Red colored text</p> <div class='theBGcolor'><span style='color:white;'>White colored text on red background</span></div> [/code] I've done this on my own site, having a single class to control the accent color(s) allows me to use minimal javascript in order to change the color, and also allows me to apply the class to any element quickly and easily. This paired with SCSS would allow even more fluid control between the stylesheet and HTML but that is optional. [editline]6th March 2014[/editline] How do you use functions for specific extended classes? At this point getting this down is the last thing keeping me from going insane coding the best website ever made... I need to be able to use PHP to generate the content within these squares but its not letting me do that.. (case being youtube square) Click image for source code... [url='http://pastebin.com/dtUqy5ud'][img]http://i.imgur.com/IxCkiIe.png[/img][/url]
[QUOTE=Cep.;44154940]I'm not quite sure of CSS is capable of this, but is there any way to use a variable throughout a stylesheet? Basically I'm making a company website but I don't know exactly what colors the company will end up using, so I would like to use a primary, secondary, and tertiary color variable in the stylesheet so I don't have to replace them all individually if the color scheme changes.[/QUOTE] You can put variables to CSS ([url=https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables]see here[/url]) but you're better off with [url=http://sass-lang.com/]sass[/url]. [editline]7th March 2014[/editline] [QUOTE=lkymky;44155579][img]http://i.imgur.com/IxCkiIe.png[/img][/QUOTE] Theme?
[QUOTE=asantos3;44155889]Theme?[/QUOTE] [url]https://sublime.wbond.net/packages/Fizzy%20Theme[/url]
[QUOTE=asantos3;44155889]([url=https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables]see here[/url])[/QUOTE] looks like only firefox is supported atm.
[QUOTE=lkymky;44155579]Why can't you use CSS: [code] .theColor {color:red;} .theBGcolor {background-color:red;} [/code] HTML: [code] <p class='theColor'>Red colored text</p> <div class='theBGcolor'><span style='color:white;'>White colored text on red background</span></div> [/code][/QUOTE] The only real problem with that is you have a lot of duplication, and also you're not separating your styles from your markup.
lkymky you really ought to implement views, you're still mashing HTML and PHP in a most uncouth manner.
How do I code my site so I can dynamically move the news box around? [url]http://www.elliottcoe.com/agilesignage/school.php[/url] Can't quite get the positioning correct.
I'm guessing you want absolute positioning, although you shouldn't use it unless you really need it. To use absolute positioning, you do it like this [code] position: absolute; top: 100px; left: 100px; [/code] Absolute position works from first placing the element to a corner of the screen, then you push it out a certain number of pixels. The code above pushes it out 100px from the top left corner, 100px down, 100px right. If you wanted to start from the bottom right, you can use bottom: and right: instead of top: and left:
I want to regex this (I bolded it) part of a string. ........<a class="market_listing_item_name_link" href="http://steamcommunity.com/market/listings/730/Glock-18%20%7C%20Dragon%20Tattoo%20%28Factory%20New%29">[b]Glock-18 | Dragon Tattoo[/b]</a>..... My regex is this right now: /<a class="market_listing_item_name_link"[^>][^<]*/ It selects everything right now, how do I fix it?
[QUOTE=01271;44161617]I want to regex this (I bolded it) part of a string. ........<a class="market_listing_item_name_link" href="http://steamcommunity.com/market/listings/730/Glock-18%20%7C%20Dragon%20Tattoo%20%28Factory%20New%29">[b]Glock-18 | Dragon Tattoo[/b]</a>..... My regex is this right now: /<a class="market_listing_item_name_link"[^>][^<]*/ It selects everything right now, how do I fix it?[/QUOTE] /<a class="market_listing_item_name_link".+?>(.+?)<\/a>/ Obligatory "use an html parser"
[QUOTE=01271;44161617]I want to regex this (I bolded it) part of a string. ........<a class="market_listing_item_name_link" href="http://steamcommunity.com/market/listings/730/Glock-18%20%7C%20Dragon%20Tattoo%20%28Factory%20New%29">[b]Glock-18 | Dragon Tattoo[/b]</a>..... My regex is this right now: /<a class="market_listing_item_name_link"[^>][^<]*/ It selects everything right now, how do I fix it?[/QUOTE] Obligatory "steam market bots can get banned at any moment"
Not a steam market bot for selling/buying, just for data collection. Also I was taught that the html xpath parser (that I was using before) on php is slower than regex since regex always uses the optimized assembly libraries. Yes, speed is a factor in my program as I've got to try to capture as much data as possible. (it's data from [url= http://steamcommunity.com/market/recentcompleted]here[/url])
[QUOTE=01271;44165111]Not a steam market bot for selling/buying, just for data collection. Also I was taught that the html xpath parser (that I was using before) on php is slower than regex since regex always uses the optimized assembly libraries. Yes, speed is a factor in my program as I've got to try to capture as much data as possible. (it's data from [url= http://steamcommunity.com/market/recentcompleted]here[/url])[/QUOTE] For a quick scraper, it's faster and easier. For a large application (especially a website), you should use a parser. It's more reliable and easier to use with a large amount of selectors.
[QUOTE=01271;44165111]Not a steam market bot for selling/buying, just for data collection. Also I was taught that the html xpath parser (that I was using before) on php is slower than regex since regex always uses the optimized assembly libraries. Yes, speed is a factor in my program as I've got to try to capture as much data as possible. (it's data from [url= http://steamcommunity.com/market/recentcompleted]here[/url])[/QUOTE] If you're worried about missing stuff that shows up there and need speed for that reason you should stick a queue between the bit that does the scraping and the bit that parses the pages. Save the raw html every x seconds and then have another process that reads the html files and actually does the parsing.
What's the thing called: [IMG]https://dl.dropboxusercontent.com/u/7856270/thing.png[/IMG] I can't remember the name, gods.
I'm trying to develop a simple webapp, but I don't have experience with any web related technologies. I basically want a webpage that displays an image (a top down map) overlayed with points of data loaded from a file/database (serverside). However, this information will be updated very regularly (every second). I would like to be able to update/refresh the page automatically so the users can see the new positions. Is there any particular technology/software I can use to put this prototype together easily?
[QUOTE=Mattz333;44168897]I'm trying to develop a simple webapp, but I don't have experience with any web related technologies. I basically want a webpage that displays an image (a top down map) overlayed with points of data loaded from a file/database (serverside). However, this information will be updated very regularly (every second). I would like to be able to update/refresh the page automatically so the users can see the new positions. Is there any particular technology/software I can use to put this prototype together easily?[/QUOTE] I would just use PHP to retrieve the data from the database then javascript to update the position/data on the webpage. Shouldn't need anything fancy, although if you haven't got any experience then you may want to look into getting database information with PHP and displaying using javascript
[QUOTE=Mattz333;44168897]I'm trying to develop a simple webapp, but I don't have experience with any web related technologies. I basically want a webpage that displays an image (a top down map) overlayed with points of data loaded from a file/database (serverside). However, this information will be updated very regularly (every second). I would like to be able to update/refresh the page automatically so the users can see the new positions. Is there any particular technology/software I can use to put this prototype together easily?[/QUOTE] i'm not sure how easy or quick it'd be, but I'd look into the google maps API and stuff
[QUOTE=Mattz333;44168897]I'm trying to develop a simple webapp, but I don't have experience with any web related technologies. I basically want a webpage that displays an image (a top down map) overlayed with points of data loaded from a file/database (serverside). However, this information will be updated very regularly (every second). I would like to be able to update/refresh the page automatically so the users can see the new positions. Is there any particular technology/software I can use to put this prototype together easily?[/QUOTE] If you want it to be totally realtime check out meteor.js
[QUOTE=KmartSqrl;44169937]If you want it to be totally realtime check out meteor.js[/QUOTE] I'm looking into meteor now, but its proving to be a bit difficult as I've not really used javascript before. Do you know of any good examples of drawing to a canvas with meteor?
Sorry, you need to Log In to post a reply to this thread.