|
Voted Worst Mom posted:Honestly, I doubt that given a code review for this, which was probably one of many files, you would have caught the error on a first pass. Especially since the code is so logically simple. It's like when someone writes the the word "the" twice and your eyes kind of just combine them. I would hope internally there wasn't just one big patch with tons of files and changes. Those kinds of commits are exactly where this kind of thing sneaks through.
|
# ? Feb 25, 2014 03:18 |
|
|
# ? Jun 6, 2024 10:14 |
|
Java code:
|
# ? Feb 25, 2014 03:31 |
|
Every day give me something to laugh (and cry) about - from top of my head:code:
code:
code:
Also, something like this used to happen continuously: code:
code:
until I've went through my predecessors code changing all if ($_POST['save']) to if (isset($_POST['save'])). canis minor fucked around with this message at 14:48 on Feb 25, 2014 |
# ? Feb 25, 2014 14:45 |
|
Steve French posted:If you actually believe this, then the bad peer is you. You've never seen peer review given to someone who is too green to catch the errors? When the guy reviewing is as clueless as the author, review doesn't help that much. Suspicious Dish posted:I hope I never have to work with you. I think we would work great together.
|
# ? Feb 25, 2014 15:11 |
|
Dren posted:You've never seen peer review given to someone who is too green to catch the errors? When the guy reviewing is as clueless as the author, review doesn't help that much. I believe the point is multiple sets of eyes are likely to be better at catching issues than one set of eyes, particularly the set of eyes that wrote the code being reviewed. Not only that but one of the reason to have someone who is green review code is to bring help them learn (granted if the authors code sucks hopefully they're learning not to write code that way).
|
# ? Feb 25, 2014 16:03 |
|
I don't think any engineer who put the duplicate "goto" in was clueless. I think they just didn't notice it. It's an easy error to mistake, and another set of eyeballs certainly would have seen it.
|
# ? Feb 25, 2014 16:07 |
|
Suspicious Dish posted:I don't think any engineer who put the duplicate "goto" in was clueless. I think they just didn't notice it. It's an easy error to mistake, and another set of eyeballs certainly would have seen it. Yeah, I didn't mean to apply the term clueless about to the apple bug. I agree that the goto problem is an easy mistake to make and it's also an easy mistake to miss in code review, even for an experienced person if they happen to be rushed while doing the review. Glimm posted:I believe the point is multiple sets of eyes are likely to be better at catching issues than one set of eyes, particularly the set of eyes that wrote the code being reviewed. Not only that but one of the reason to have someone who is green review code is to bring help them learn (granted if the authors code sucks hopefully they're learning not to write code that way). I don't mean to say that code review is useless, quite the contrary, I believe it should always be done even if the only people available to code review are pretty green. Some code review is better than none. However, code review by people who are not experienced, careful, know to ask questions when they encounter unfamiliar stuff, and familiar with the code base will not be effective at catching bugs. I just reviewed some code at work yesterday where the bug had already been fixed once and I was reviewing the second fix. A junior guy had written the first fix (he wrote the second fix too) and a junior guy had reviewed it, totally missing a threading issue that caused a crash in code we delivered. It was a failure of project management to let a sensitive piece of code be handled entirely by those two junior guys. That is the incident that was coloring my previous two comments and really all I wanted to say is that code review is not a panacea and it's easy for it to fail for a variety of reasons.
|
# ? Feb 25, 2014 16:19 |
|
Less arguing about goto and more funny/go-kill-yourself bullshit.php:<? <!-- BEGIN: JQUERY LIBRARY --> <? if(APP){ ?> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery/1.7.1/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-address/1.5/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-easing/1.3/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-mousewheel/3.0.6/min.js"></script> <? }else{ ?> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery/1.10.2/min.js"></script> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/jquery-library/jquery-migrate/1.2.1/min.js"></script> <? } ?> <!-- END: JQUERY LIBRARY --> <!-- BEGIN: RESPOND LIBRARY --> <script src="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/respond/1.3.0/min.js"></script> <link href="<?=CDN_SERVER_GLOBAL?>/_assets/scripting/respond/proxy.html" id="respond-proxy" rel="respond-proxy" /> <link href="/_assets/scripting/respond/proxy.gif" id="respond-redirect" rel="respond-redirect" /> <script src="/_assets/scripting/respond/proxy.js"></script> <!-- END: RESPOND LIBRARY --> <!-- BEGIN: LOCAL SCRIPTS --> <script language="javascript" type="text/javascript" src="/_assets/js/animations/slideFX.js"></script> <?php if( SITE_SECTION == SITE_SECTION_COMPANY || SITE_SECTION == SITE_SECTION_SOLUTIONS) { ?> <script language="javascript" type="text/javascript" src="/_assets/box-slider/jquery.bxslider.js"></script> <?php } ?> <!--END: LOCAL SCRIPTS --> <? if(APP === true){ $html=''; $html_fb_static=''; switch(ENVIRONMENT){ ### DEVELOPMENT ENVIRONMENTS case ENVIRONMENT_DEV: case ENVIRONMENT_BETA: $html .=' <!-- BEGIN: <codewordforthislibrary> LIBRARY --> <!-- BEGIN: GLOBAL --> <!-- BEGIN: _core --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/_global.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/_main.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/cookieStorage.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/default.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/displays.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/events.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/_core/nodeInfo.js"></script> <!-- BEGIN: url --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/url/data.js"></script> <!-- BEGIN: UI --> <!-- BEGIN: ui --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/ui/default.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/ui/form.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/ui/lightbox.js"></script> <!-- BEGIN: utility: '.PLATFORM.' --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/utility/'.PLATFORM.'.js"></script> '; ### APP DEVELOPMENT if(APP === true){ $html .=' <!-- BEGIN: DATA --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/fabric/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/fabric/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/gallery/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/gallery/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/ioresponse/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/ioresponse/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/material/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/material/dataXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/media/dataSetXML.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/data/media/dataXML.js"></script> <!-- BEGIN: APP: global --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/main.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/carts/default.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/carts/portfolio.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/carts/samples.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/complexSearch.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/buttons.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/display.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/displayItem.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/displaySet.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/image.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/menubar.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/navigation.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/region.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/screen.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/displays/utilitybar.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/app/interfaceManager.js"></script> <!-- BEGIN: APP: '.FRAMEWORK.': '.STAGE_CONTENT.' --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/complexSearch.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/interfaceManager.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/displays/display.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/'.FRAMEWORK.'/'.STAGE_CONTENT.'/displays/displayItem.js"></script> <!-- BEGIN: Dynamic Social Media --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/social-media/dynamic.js"></script> <!-- END: <codewordforthislibrary> LIBRARY --> '; } ### SOCIAL MEDIA STATIC $html_fb_static.='<script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/_objects/_global/social-media/static.js"></script>'; break; ### PRODUCTION ENVIRONMENTS default: $html.=' <!-- BEGIN: <codewordforthislibrary> LIBRARY --> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/core-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/url-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/ui-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/ui-lightbox-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/utility-min.js"></script> <!-- BEGIN: GOOGLE TRACKING DOWNLOADS / CLICKS <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/tracking.js"></script>--> '; if(APP === true) $html .=' <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/data-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/app-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/app-'.STAGE_CONTENT.'-min.js"></script> <script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/social-media-dynamic-min.js"></script> <!-- END: <codewordforthislibrary> LIBRARY --> '; ### SOCIAL MEDIA STATIC $html_fb_static.='<script src="'.CDN_SERVER_GLOBAL.'/_assets/scripting/<codewordforthislibrary>/social-media-static-min.js"></script>'; break; } $html.=' <!-- BEGIN: SOCIAL MEDIA --> <script src="'.PROTOCOL.'//platform.twitter.com/widgets.js"></script> <script src="'.PROTOCOL.'//connect.facebook.net/en_US/all.js"></script> <script src="'.PROTOCOL.'//apis.google.com/js/plusone.js"> {"parsetags": "explicit"}</script> <!-- <script src="'.PROTOCOL.'//assets.pinterest.com/js/pinit.js"></script> <script src="'.PROTOCOL.'//www.youtube.com/player_api"></script> --> '.$html_fb_static.' <!-- END: SOCIAL MEDIA --> '; ### PRINT OUT JS echo $html; } ?> substitute fucked around with this message at 16:48 on Feb 25, 2014 |
# ? Feb 25, 2014 16:46 |
|
What in the flying gently caress is that?
|
# ? Feb 25, 2014 17:55 |
|
ratbert90 posted:https://github.com/boundarydevices/imx_usb_loader/blob/master/imx_usb.c That's like the least-worst vendor code I've dealt with in a while. It's a standalone tool and although single-file it's under 2000 LoC, there's actual error checking, etc etc. Long functions but they're basically linear. I've seen a lot worse. It's also a tool, and the basic requirement for a tool is it builds and does it's thing. There's no excuse to make a library like that, or something that your users are expected to base their projects on, but a USB flashing tool? You can get away with a lot. ratbert90 posted:You should see Freescales kernel code implimentation. That's pretty much standard linux kernel there though. To prevent #ifdef hell your main source just unconditionally uses features that are CONFIG_ gated in the headers. There's hundreds of stub functions that exist to localize a macro-expansion that's built from other CONFIG_ gated macro expansions, etc. The general policy of trying to name things well helps a lot here, and it's not usually that hard to follow the expansion if you really need to debug something specific. The entirety of the kernel is both beautiful and a horror at the same time - self-modifying code, negative-offset pointers, preprocessor tricks used everywhere.
|
# ? Feb 25, 2014 17:59 |
Glimm posted:I believe the point is multiple sets of eyes are likely to be better at catching issues than one set of eyes, particularly the set of eyes that wrote the code being reviewed. Not only that but one of the reason to have someone who is green review code is to bring help them learn (granted if the authors code sucks hopefully they're learning not to write code that way). I agree with this and in some aspects it makes me appreciate pair-programming more although I don't get to do it all that often.
|
|
# ? Feb 25, 2014 19:16 |
|
Dren posted:You've never seen peer review given to someone who is too green to catch the errors? When the guy reviewing is as clueless as the author, review doesn't help that much. It's absolutely the case that more experienced developers will in general be more helpful when reviewing. But it's absolutely not necessary for a reviewer to be an expert, or more expert than the author, in order to be helpful. I was responding to the relatively absolute statement: Dren posted:Peer review doesn't help when your peers are as bad as you. I think peer review almost always helps, within reason. This statement implies a belief that inexperienced or lovely developers won't be helpful at all, which is generally not the case; they just won't be as helpful as a more experienced developer, and unlike actual development, they're not likely to make things worse. And, as someone else already pointed out, its especially valuable for newer people because code review also serves as a learning exercise. That said, I don't think we actually disagree on this, based on your followup posts, which is why my initial statement was couched in an 'if'.
|
# ? Feb 25, 2014 19:55 |
|
pokeyman posted:What in the flying gently caress is that? More awesomeness from the consultant's work that I've posted before.
|
# ? Feb 25, 2014 20:01 |
|
substitute posted:More awesomeness from the consultant's work that I've posted before. Is it meant to be some kind of template that one copies into a new project and modifies as appropriate? Please tell me there isn't a library called "<codewordforthislibrary>".
|
# ? Feb 25, 2014 20:09 |
|
I'd imagine that's substitute taking out the identifying pieces of what he works on. Probably, it's "butts.foo.wang" or some other URL.
|
# ? Feb 25, 2014 20:26 |
|
pokeyman posted:Is it meant to be some kind of template that one copies into a new project and modifies as appropriate? Please tell me there isn't a library called "<codewordforthislibrary>". It's all the JS needed to run his three "apps", that are really just an overblown shopping cart / gallery. I removed the library name to obscure it. This is the flow of these "apps": HTML POST -> PHP -> DB -> PHP -> XML -> JS -> HTML I've had the misfortune of handling the PHP/DB portion for 4+ years now. Suspicious Dish posted:I'd imagine that's substitute taking out the identifying pieces of what he works on. Probably, it's "butts.foo.wang" or some other URL. Close. It's actually "douchebag".
|
# ? Feb 25, 2014 20:28 |
|
Suspicious Dish posted:I'd imagine that's substitute taking out the identifying pieces of what he works on. Probably, it's "butts.foo.wang" or some other URL. He's substituting it.
|
# ? Feb 25, 2014 20:40 |
|
it is posted:He's substituting it. How's the veal?
|
# ? Feb 25, 2014 21:05 |
|
Suspicious Dish posted:I'd imagine that's substitute taking out the identifying pieces of what he works on. Probably, it's "butts.foo.wang" or some other URL. That's what I thought at first, but that code is so lovely I thought it was left intact. What a piece of poo poo.
|
# ? Feb 25, 2014 21:12 |
|
This guy I know went through over a dozen Elance/oDesk devs and an absolute shitload of money to make his plugin app dream a reality (which he just launched and is selling for money). One of the core things it does is take your web content and spit it out into a .doc file, among other file types. This is where the magic happens:PHP code:
Just.. And then the dude talked to his dev about it, and from what his dev told him (backpedaling and bullshit), he concluded that it was actually a "brilliant" implementation and to stop questioning the integrity of his fabulous, awesome developers who have made this novel and amazing app for him. I'm a noob programmer, but I really don't understand what's so loving hard about downloading a free PHP-based Word file generator library and implementing it so you can make Word docs without calling on a script on some other person's website, which seems inexcusably bad. And this Word doc functionality allegedly took many days and lots of money to produce.
|
# ? Feb 25, 2014 22:30 |
|
Suspicious Dish posted:How's the veal? it is amazing.
|
# ? Feb 25, 2014 23:59 |
|
pokeyman posted:That's what I thought at first, but that code is so lovely I thought it was left intact. And, basically it just displays a few pages. A search result, detail of the item, favorites (from DB or cookie written by the JS), and a share via email screen. All the XML data, created from the DB result in PHP, is loaded into and parsed by the JS to output HTML. Yes.
|
# ? Feb 26, 2014 00:43 |
|
Are there competitions held to make the most Rube Goldbergian code and include as many token technologies as possible? You may have a reigning gold medalist in your hands.
|
# ? Feb 26, 2014 01:55 |
|
EntranceJew posted:Are there competitions held to make the most Rube Goldbergian code and include as many token technologies as possible? You may have a reigning gold medalist in your hands. I could fill this thread with code for several pages.
|
# ? Feb 26, 2014 03:26 |
|
substitute posted:I could fill this thread with code for several pages. Pretty please?
|
# ? Feb 26, 2014 03:58 |
|
Authentic You posted:This guy I know went through over a dozen Elance/oDesk devs and an absolute shitload of money to make his plugin app dream a reality (which he just launched and is selling for money). One of the core things it does is take your web content and spit it out into a .doc file, among other file types. This is where the magic happens: Much simpler to let someone else do the legwork of setting up a doc generator on their website, than have to deal with configuring libraries yourself! I hope you at least convinced your friend to never ever talk to these people again.
|
# ? Feb 26, 2014 04:10 |
|
HardDisk posted:Pretty please? Well... gently caress it. Language switcher: php:<? ### Define namespace(s) //namespace _global\_lang\manager; //=============================================================== //-- BEGIN: Include Statements --------------------------------- //=============================================================== //require_once("default_interface.php"); //=============================================================== //-- END: Include Statements ----------------------------------- //=============================================================== //=========================================================== //-- BEGIN: Class: Region ---------------------------------- //=========================================================== class Region{ // BEGIN: Data Memembers public $domain; public $dspText; public $languages; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // Region: // Constructor function __construct($domain, $dspText, $languages){ //trace("Region: CONSTR"); $this->domain=$domain; $this->dspText=$dspText; $this->languages=$languages; } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("Region: DECONSTRUCTOR"); $this->domain=NULL; $this->dspText=NULL; $this->languages=NULL; } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: Region ------------------------------------ //=========================================================== //=========================================================== //-- BEGIN: Class: Language -------------------------------- //=========================================================== class Language{ // BEGIN: Data Memembers public $dspText; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // Language: // Constructor function __construct($dspText){ //trace("Language: CONSTR"); $this->dspText=$dspText; } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("Language: DECONSTRUCTOR"); $this->dspText=NULL; } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: Language ---------------------------------- //=========================================================== //=========================================================== //-- BEGIN: Class: LangManager ----------------------------- //=========================================================== class LangManager{ // BEGIN: Data Memembers const DELIMITER = "_"; ////// Abbreviation const REGION = 'rgn'; const RGN_CN = 'cn'; const RGN_EU = 'eu'; const RGN_NA = 'na'; const RGN_SA = 'sa'; //// Country ////// Abbreviation const COUNTRY = 'country'; const COUNTRY_CN = 'cn'; const COUNTRY_DE = 'de'; const COUNTRY_ES = 'es'; const COUNTRY_FR = 'fr'; const COUNTRY_IT = 'it'; const COUNTRY_NL = 'nl'; const COUNTRY_SE = 'se'; const COUNTRY_UK = 'uk'; const COUNTRY_US = 'us'; //// Languages ////// Abbreviation const LANGUAGE = 'lang'; const LANG_DE = 'de'; const LANG_EN = 'en'; const LANG_ES = 'es'; const LANG_FR = 'fr'; const LANG_IT = 'it'; const LANG_NL = 'nl'; const LANG_SV = 'sv'; const LANG_ZH = 'zh'; ////// Display Text const TXT_DE = 'Deutsch'; const TXT_EN = 'English'; const TXT_ES = 'Español'; const TXT_FR = 'Français'; const TXT_IT = 'Italiano'; const TXT_NL = 'Dutch'; const TXT_SV = 'Svenska'; const TXT_ZN = '中国的'; const WELCOME = 'welcome'; const SELECT = 'select'; const REMEMBER = 'remember'; const TXT_WELCOME_EN = 'Welcome to'; const TXT_SELECT_REGION_EN = 'Select Your Region'; const TXT_REMEMBER_SELECTION_EN = 'Remember Selection?'; const TXT_WELCOME_DE = 'Willkommen auf'; const TXT_SELECT_REGION_DE = 'Wählen Sie Ihre Region'; const TXT_REMEMBER_SELECTION_DE = 'Angemeldet Auswahl?'; const TXT_WELCOME_ES = 'Bienvenido a'; const TXT_SELECT_REGION_ES = 'Seleccione su Región'; const TXT_REMEMBER_SELECTION_ES = '¿Recuerde Selección?'; const TXT_WELCOME_FR = 'Bienvenue à'; const TXT_SELECT_REGION_FR = 'Sélectionnez votre région'; const TXT_REMEMBER_SELECTION_FR = 'N\'oubliez pas de sélection?'; const TXT_WELCOME_IT = 'Benvenuti a'; const TXT_SELECT_REGION_IT = 'Seleziona la tua regione'; const TXT_REMEMBER_SELECTION_IT = 'Ricorda di selezione?'; const TXT_WELCOME_NL = 'Welkom bij'; const TXT_SELECT_REGION_NL = 'Selecteer uw regio'; const TXT_REMEMBER_SELECTION_NL = 'Vergeet Selection?'; const TXT_WELCOME_SV = 'Välkommen till'; const TXT_SELECT_REGION_SV = 'Välj din region'; const TXT_REMEMBER_SELECTION_SV = 'Notera Val?'; const TXT_WELCOME_ZH = '欢迎'; const TXT_SELECT_REGION_ZH = '选择您的地区'; const TXT_REMEMBER_SELECTION_ZH = '记得选择?'; protected static $regions; public static $titles; protected static $languages; protected static $countries; // Flags public static $bDefaults = true; public static $bNewSession = true; public static $bSaveCookies = false; public static $bHubpage = false; // CONST static public static $HUBPAGE='index.php'; // END: Data Memembers /*------------------------------------------------------- BEGIN: CONSTRUCTOR -------------------------------------------------------*/ // LangManager: // Constructor function __construct(){ //trace("LangManager: CONSTR"); } /*------------------------------------------------------- END: CONSTRUCTOR -------------------------------------------------------*/ /*------------------------------------------------------- BEGIN: INIT -------------------------------------------------------*/ // LangManager: // INIT static public function init($rgn){ //trace("LangManager: INIT"); self::$languages=self::region_langs($rgn); //self::$countries=self::region_countries($rgn); return self::lang_switch(); } /*------------------------------------------------------- END: INIT -------------------------------------------------------*/ // get_region_titles: // Retuns an array of region titles based language. public static function & get_region_titles($lang=LANG){ //trace("RegionManager: get_region_titles"); try{ // Declare local variables. $data; switch($lang){ case self::LANG_EN.self::DELIMITER.self::COUNTRY_UK: case self::LANG_EN.self::DELIMITER.self::COUNTRY_US: case self::LANG_EN.self::DELIMITER.self::COUNTRY_CN: case self::LANG_EN: default: $data = array( self::REGION=>"Region", self::LANGUAGE=>"Language", self::RGN_NA=>"North America", self::RGN_SA=>"South America", self::RGN_EU=>"Europe, Africa & Middle East", self::RGN_CN=>"China" ); break; case self::LANG_ES.self::DELIMITER.self::COUNTRY_ES: case self::LANG_ES: $data = array( self::REGION=>"Región", self::LANGUAGE=>"Idioma", self::RGN_NA=>"América del Norte", self::RGN_SA=>"América del Sur", self::RGN_EU=>"Europa, África y Medio Oriente", self::RGN_CN=>"China" ); break; case self::LANG_FR.self::DELIMITER.self::COUNTRY_FR: case self::LANG_FR: $data = array( self::REGION=>"Région", self::LANGUAGE=>"Langue", self::RGN_NA=>"Amérique du Nord", self::RGN_SA=>"Amérique du Sud", self::RGN_EU=>"l'Europe, Afrique et Moyen-Orient", self::RGN_CN=>"Chine" ); break; case self::LANG_DE.self::DELIMITER.self::COUNTRY_DE: case self::LANG_DE: $data = array( self::REGION=>"Region", self::LANGUAGE=>"Sprache", self::RGN_NA=>"Nordamerika", self::RGN_SA=>"Südamerika", self::RGN_EU=>"Europa, Afrika und Naher Osten", self::RGN_CN=>"China" ); break; case self::LANG_IT.self::DELIMITER.self::COUNTRY_IT: case self::LANG_IT: $data = array( self::REGION=>"Regione", self::LANGUAGE=>"Lingua", self::RGN_NA=>"del Nord America del", self::RGN_SA=>"Sud America", self::RGN_EU=>"Europa, Africa e Medio Oriente", self::RGN_CN=>"Cina" ); break; case self::LANG_NL.self::DELIMITER.self::COUNTRY_NL: case self::LANG_NL: $data = array( self::REGION=>"Regio", self::LANGUAGE=>"Språk", self::RGN_NA=>"Nordamerika", self::RGN_SA=>"Sydamerika", self::RGN_EU=>"Europa, Afrika & Midden-Oosten", self::RGN_CN=>"China" ); break; case self::LANG_SV.self::DELIMITER.self::COUNTRY_SE: case self::LANG_SV: $data = array( self::REGION=>"Region", self::LANGUAGE=>"taal", self::RGN_NA=>"Noord-Amerika", self::RGN_SA=>"Zuid-Amerika", self::RGN_EU=>"Europa, Afrika och Mellanöstern", self::RGN_CN=>"Kina" ); break; case self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN: case self::LANG_ZH: $data = array( self::REGION=>"地区", self::LANGUAGE=>"语", self::RGN_NA=>"北美", self::RGN_SA=>"南美洲", self::RGN_EU=>"欧洲", self::RGN_CN=>"中国" ); break; } return $data; }catch(Exception $e){trace("RegionManager: get_region_titles > function block: " . $e);} } // lang_switch: // Needs Description. public static function lang_switch(){ //trace("LangManager: lang_switch"); try{ ///* // Declare local variables. $languages = self::$languages; // Request properties $rqpLang='lang'; $rqpSaveCookies='s'; // URL request properties $url=explode('/',PHP_SELF); $rqURL=$url[1]; self::$bHubpage=self::hubpage(); // Set flags //// GET Request Data: lang & saveCookies if(isset($_GET[$rqpLang])){ $rqGET = $_GET[$rqpLang]; self::$bSaveCookies=(isset($_GET[$rqpSaveCookies]) && $_GET[$rqpSaveCookies] == '1' ); }else $rqGET=NULL; //// Session Data: lang if(isset($_SESSION[$rqpLang])){ $rqSESSION = $_SESSION[$rqpLang]; self::$bNewSession=false; }else $rqSESSION=NULL; // Determine which set of parameters to use: URL, GET, SESSION, or DEFAULTS if(isset($rqURL) && $rqURL!=$rqGET && self::validate($rqURL)){ $lang=$rqURL; self::$bSaveCookies=false; }elseif($rqGET && self::validate($rqGET)){ $lang=$rqGET; self::$bDefaults=false; }elseif($rqSESSION || self::validate($rqSESSION)){ $lang=$rqSESSION; self::$bDefaults=false; }else $lang=LANG_DEFAULT . self::DELIMITER . COUNTRY_DEFAULT; // Set Session values $_SESSION[$rqpLang]=$lang; // Set Titles self::$titles=self::get_region_titles($lang); //*/ return $lang; }catch(Exception $e){trace("RegionManager: lang_switch > function block: " . $e);} } // validate: // Validates lang_country selection. public static function validate($lang){ //trace("LangManager: validated"); return in_array($lang, self::$languages); } // hubpage: // Determines whether page is a hub page. public static function hubpage($url=PHP_SELF){ //trace("LangManager: hubpage"); $url=explode('/',$url); $length=sizeof($url); $b=false; switch($length){ case 2: case 3: $b=($url[$length-1] == self::$HUBPAGE); break; } return $b; } // lang_txt: // Needs Description. public static function lang_txt($lang){ //trace("LangManager: lang_txt"); switch($lang){ case self::LANG_EN: case self::LANG_EN.self::DELIMITER.self::COUNTRY_US: case self::LANG_EN.self::DELIMITER.self::COUNTRY_UK: case self::LANG_EN.self::DELIMITER.self::COUNTRY_CN: $txt=self::TXT_EN; break; case self::LANG_ES: case self::LANG_ES.self::DELIMITER.self::COUNTRY_ES: $txt=self::TXT_ES; break; case self::LANG_FR: case self::LANG_FR.self::DELIMITER.self::COUNTRY_FR: $txt=self::TXT_FR; break; case self::LANG_DE: case self::LANG_DE.self::DELIMITER.self::COUNTRY_DE: $txt=self::TXT_DE; break; case self::LANG_IT: case self::LANG_IT.self::DELIMITER.self::COUNTRY_IT: $txt=self::TXT_IT; break; case self::LANG_NL: case self::LANG_NL.self::DELIMITER.self::COUNTRY_NL: $txt=self::TXT_NL; break; case self::LANG_SV: case self::LANG_SV.self::DELIMITER.self::COUNTRY_SE: $txt=self::TXT_SV; break; case self::LANG_ZH: case self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN: $txt=self::TXT_ZN; break; } return $txt; } // region_langs: // Needs Description. public static function region_langs($rgn){ //trace("LangManager: region_langs"); switch($rgn){ default: case self::RGN_NA: $languages = array( self::LANG_EN.self::DELIMITER.self::COUNTRY_US ); break; case self::RGN_EU: $languages = array( self::LANG_EN.self::DELIMITER.self::COUNTRY_UK, self::LANG_FR.self::DELIMITER.self::COUNTRY_FR, self::LANG_DE.self::DELIMITER.self::COUNTRY_DE, self::LANG_ES.self::DELIMITER.self::COUNTRY_ES, self::LANG_IT.self::DELIMITER.self::COUNTRY_IT, self::LANG_NL.self::DELIMITER.self::COUNTRY_NL, self::LANG_SV.self::DELIMITER.self::COUNTRY_SE ); break; case self::RGN_CN: $languages = array( self::LANG_EN.self::DELIMITER.self::COUNTRY_CN, self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN ); break; } return $languages; } // all_region_langs: // Needs Description. public static function all_region_langs($rgns){ //trace("LangManager: all_region_langs"); $ds=array(); return $ds; } // lang_menu_txt: // Needs Description. public static function lang_menu_txt($lang){ switch($lang) { default: case self::LANG_EN: case self::LANG_EN.self::DELIMITER.self::COUNTRY_US: case self::LANG_EN.self::DELIMITER.self::COUNTRY_UK: case self::LANG_EN.self::DELIMITER.self::COUNTRY_CN: $arr = array( self::WELCOME => self::TXT_WELCOME_EN ,self::SELECT => self::TXT_SELECT_REGION_EN ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_EN ); break; case self::LANG_DE: case self::LANG_DE.self::DELIMITER.self::COUNTRY_DE: $arr = array( self::WELCOME => self::TXT_WELCOME_DE ,self::SELECT => self::TXT_SELECT_REGION_DE ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_DE ); break; case self::LANG_ES: case self::LANG_ES.self::DELIMITER.self::COUNTRY_ES: $arr = array( self::WELCOME => self::TXT_WELCOME_ES ,self::SELECT => self::TXT_SELECT_REGION_ES ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_ES ); break; case self::LANG_FR: case self::LANG_FR.self::DELIMITER.self::COUNTRY_FR: $arr = array( self::WELCOME => self::TXT_WELCOME_FR ,self::SELECT => self::TXT_SELECT_REGION_FR ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_FR ); break; case self::LANG_IT: case self::LANG_IT.self::DELIMITER.self::COUNTRY_IT: $arr = array( self::WELCOME => self::TXT_WELCOME_IT ,self::SELECT => self::TXT_SELECT_REGION_IT ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_IT ); break; case self::LANG_NL: case self::LANG_NL.self::DELIMITER.self::COUNTRY_NL: $arr = array( self::WELCOME => self::TXT_WELCOME_NL ,self::SELECT => self::TXT_SELECT_REGION_NL ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_NL ); break; case self::LANG_SV: case self::LANG_SV.self::DELIMITER.self::COUNTRY_SE: $arr = array( self::WELCOME => self::TXT_WELCOME_SV ,self::SELECT => self::TXT_SELECT_REGION_SV ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_SV ); break; case self::LANG_ZH: case self::LANG_ZH.self::DELIMITER.self::COUNTRY_CN: $arr = array( self::WELCOME => self::TXT_WELCOME_ZH ,self::SELECT => self::TXT_SELECT_REGION_ZH ,self::REMEMBER => self::TXT_REMEMBER_SELECTION_ZH ); break; } return $arr; } /*------------------------------------------------------- BEGIN: DECONSTRUCTOR -------------------------------------------------------*/ // __destructor: // Deconstructs object. public function __destructor(){ //trace("LangManager: DECONSTRUCTOR"); $languages=NULL; } /*------------------------------------------------------- END: DECONSTRUCTOR -------------------------------------------------------*/ } //=========================================================== //-- END: Class: LangManager ------------------------------- //=========================================================== ?>
|
# ? Feb 26, 2014 04:45 |
|
Volmarias posted:Much simpler to let someone else do the legwork of setting up a doc generator on their website, than have to deal with configuring libraries yourself! Not a chance. He got super pissed that I openly called into question the integrity of his developer (who he probably treats like poo poo anyway, as he went through over a dozen of them to make this thing, and he seems like he'd be a micromanaging, terrible client) and by extension, his personal integrity (except I was just telling him how lovely this bit of code was and why). He's the type to take everything extremely personally. He talked to his dev and got fed bullshit, and then was even more pissed that I falsely accused his dev of being lovely because this code was actually totally legit and the dev owned the IP address he was sending these requests to and then was dealing with all these personal tragedies or something and had to pull some shortcuts but that the code was still totally legit and that it was clever and brilliant and that I knew nothing about this app so back off. I think he's just in too deep to accept that he's been fleeced and this purportedly amazing app is really just error-riddled, untenable garbage. Just does not want to hear it. Like people in MLMs. He just knows NOTHING about programming and is naive enough to think that low-bidding overseas devs are actually good coders and won't pull shady poo poo like this.. He also thinks the the concept is this epic novel game-changer. It's useful for the intended market and would probably sell just fine if it didn't throw fatal errors and break people's websites, but it's just not that special or original. Oh yeah, so it threw a fatal error upon installation (due to functions like exec(), which this code uses willy nilly, being disabled on most shared servers), and the dev's solution? Just delete the offending code to make the fatal error go away. So it installs successfully now and merely throws a 'unexpected behavior' and 'headers already sent' warning, but breaks your admin panel if you try to export anything, and requires manual deletion via FTP at that point. He's probably going to keep paying these lovely devs for as long as he has money to maintain this thing and make it work and make back his investment (loving never, ever going to happen).
|
# ? Feb 26, 2014 05:11 |
|
Authentic You posted:I'm a noob programmer, but I really don't understand what's so loving hard about downloading a free PHP-based Word file generator library and implementing it so you can make Word docs without calling on a script on some other person's website, which seems inexcusably bad. And this Word doc functionality allegedly took many days and lots of money to produce. The problem being that creating Word docs in PHP is a non-trivial exercise, and building an HTML-to-Word translator in pure PHP would be utter insanity. The developer is completely right to make this a hosted service. He's probably done the smart thing and is invoking libreoffice behind the scenes or something. Of course, the way it works should be advertised clearly and plainly with the plugin.
|
# ? Feb 26, 2014 06:35 |
|
McGlockenshire posted:The problem being that creating Word docs in PHP is a non-trivial exercise, and building an HTML-to-Word translator in pure PHP would be utter insanity. "Just so you guys know, when you're making a Word doc, you'll notice that it sends you to a different IP address. This is supposed to happen. However, sometimes the offsite script doesn't work, so don't be alarmed if you find yourself on the 404 page of <random real estate website>.com. Just hit back on your browser and try again later, hopefully at a time when the webmaster of <random real estate website>.com is feeling charitable with his site's bandwidth." That is literally what is happening. It's actually a real estate website too. Not a developer's site, not the plugin site, a real estate website.
|
# ? Feb 26, 2014 07:12 |
|
It sounds like someone else has taken a sensible approach for their client (I can see why a real-estate firm would want to make .doc files), forgot to properly secure it, and then some bottom-of-the-market contractors decided to mooch off that instead of figuring it out themselves.
|
# ? Feb 26, 2014 07:59 |
|
Why are all the worst websites real-estate websites?
|
# ? Feb 26, 2014 10:18 |
Pollyanna posted:Why are all the worst websites real-estate websites? Trust me, as someone who has worked in the depths of corporate intranets, any website that has people visiting it is going to be far from "the worst". SQL injections as far as the eye could see, zero data validation, no cross-browser support, multiple java applets on one page, java applets at all, the horror... the horror...
|
|
# ? Feb 26, 2014 10:40 |
Not for the first time I curse the necessity of working in a framework (Moodle) that doesn't adequately separate MVC. The CSS guy who doesn't even know CSS has once again rampaged through some perfectly functional code of mine without telling me and broken everything. The boss and the client have come back and told me that my code is broken and I've just spent the last few hours picking through the aftermath of letting a drunken moose remodel your kitchen while you're away on holiday.
|
|
# ? Feb 26, 2014 11:46 |
|
Sulla-Marius 88 posted:Not for the first time I curse the necessity of working in a framework (Moodle) that doesn't adequately separate MVC. The CSS guy who doesn't even know CSS has once again rampaged through some perfectly functional code of mine without telling me and broken everything. The boss and the client have come back and told me that my code is broken and I've just spent the last few hours picking through the aftermath of letting a drunken moose remodel your kitchen while you're away on holiday. Source control...? Edit: vvv I'm so sorry Jewel fucked around with this message at 13:01 on Feb 26, 2014 |
# ? Feb 26, 2014 12:58 |
Jewel posted:Source control...? What kind of fancy outfit do you think this is? "Set up source control" is on the to-do list for the next project.
|
|
# ? Feb 26, 2014 13:01 |
|
Sulla-Marius 88 posted:What kind of fancy outfit do you think this is? "Set up source control" is on the to-do list for the next project. Even in such situations (where source control is appending _v_10 or whatever at the end of your source directory on some file share), I'd think it makes sense to just maintain a personal git repo locally and just do periodic updates and commits of the source tree...
|
# ? Feb 26, 2014 15:07 |
|
Sulla-Marius 88 posted:What kind of fancy outfit do you think this is? "Set up source control" is on the to-do list for the next project. Set up a local git repo at the very least and use it personally. If you want to get fancy, BitBucket's private repos are free for 5 users. You don't even have to learn all that poo poo about merging and branching, but at least you'll have history of your files.
|
# ? Feb 26, 2014 15:36 |
|
Seriously. Having a personal git repo is nearly free.
|
# ? Feb 26, 2014 15:43 |
|
|
# ? Jun 6, 2024 10:14 |
I really should but for a month or two now the client has made us move development onto the testing server (while still asking for new features they forgot to think of before, and serious re-writes of old features), which is behind a vpn that can only be access externally through citrix. So every time I wanted to modify a file I'd have to find the file on my local machine and copy paste the code from citrix, modify, save, then copy paste back out through citrix, and I just know I'd gently caress up and forget to do it after a little bit. I basically just went "gently caress it, I'll turn up, do the best I can, go home and not think about it" a while back when I realised the true extent of how poo poo the situation is. The clients are all manner of hosed as well and I'm hoping that if I just keep turning up and doing stuff, one day it will be done and I won't have to see this project ever again.
|
|
# ? Feb 26, 2014 16:05 |