
ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Please post your code.
-
$this->load->library('layout'); if (!isset($this->layout)) $this->layout = get_instance()->load->library('layout'); var_dump($this->layout); What does this tell you?
-
Write it down very thoroughly how everything works and how future components should be structured. Any programmer should be able to commence working on the project after reading it. Use the below document for inspiration, not copying since most will go beyond what you need, to create your own document: http://www.cmcrossroads.com/bradapp/docs/sdd.html
-
How about: $this->configure() ->option('name')->required()->unless('event') ->option('params')->required()->unless('event')->type('array') ... The Option dependency is than hidden and allows for some abstraction. interface Option { public function option($name); }
-
The first question that comes to mind: did you try it? Are you afraid a syntax/runtime error may crash your computer? A small test-case: switch ('will the switch correctly handle this string?') { case 'will the switch correctly handle this string?': echo 'yes'; break; case 'oh NOES!!': echo 'no'; break; default: echo 'at this point you should start running...'; break; }
-
Just like any JS library just create a normal and a minified version. You can control which version is used through something like: PHP define('USE_MINIFIED', getenv('USE_MINIFIED') ?: true); .htaccess SetEnv USE_MINIFIED 0 In your code: <script src="<?php print asset('js/script.js'); ?>"></script> function asset($script) { $info = pathinfo($script); // you can also do other stuff here, like append the last modified time: '.' . filemtime($script) return $info['dirname'] . '/' . $info['filename'] . (USE_MINIFIED ? '.min' : '') . '.' . $info['extension']; } You can download the jar files to compress CSS and JS. Just create a little shell script to minify CSS and JS. JavaScript http://code.google.com/intl/nl/closure/compiler/ JS+CSS http://developer.yahoo.com/yui/compressor/ You can also find a few minifiers for your images online. If you use PageSpeed or YSlow you'll get a few links to online services to minify your images while preserving quality.
-
'Twas the night before Christmas, and mySQL won't accept my Update query.
ignace replied to Mavent's topic in PHP Coding Help
I LOL'ed when I saw your code. For your database to actually ever receive the query you need to call mysql_query() with your actual query as a parameter. Something like this: $result = mysql_query($query) or trigger_error('ERROR: ' . mysql_error() . '<br>QUERY: ' . $query, E_USER_ERROR); if ($result && mysql_num_rows($result)) { // query executed successful AND it returned a result. } -
1) The best thing to do is load jQuery from a CDN (like: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js). Chances are that the user visited another website that also used the same CDN and thus using the file from cache when visiting your website. 2) Use at your own discretion: Have one CSS file with all your CSS rules for all your pages (publicly visible ones) and one JS file with all your JS functions for all your pages (publicly visible ones), minify it, enable gzip on your server, and cache them till the end-of-days (that's till 12-21-2012 12:00:01 as some believe). Pro: - You have access to every defined function (no need to lazy-load extra JS files when you need access to another set of functions) - No need to share/duplicate CSS rules between pages - Subsequent visits use the cached CSS and JS regardless of page Con: - First-time visit may take a while to load the files - Too much data can crash the user's browser
-
Probably because 1 page has multiple states now across multiple requests which is otherwise not the case. if (isset($_GET['new_game'])) { // user wants to start a new game // store info in sessions header('Location: /'); } else if (isset($_GET['guess'])) { // user has guessed a letter or word // store info in sessions header('Location: /'); } else if (isset($_SESSION['game_over'])) { if ($_SESSION['game_over']) { // game over, try again? // clear session data } else { // display game progress } } else { // display main menu }
-
UPDATE negative_words SET word = TRIM(word);
-
Censorship doesn't work on the internet. In Belgium a few websites have already been blocked, but we just register new DNS names, and they are back at square one. The same with the copyrighted material. All links will be encoded/indirectly linked to the copyrighted material. For every item they block/censor. 1000 new appear. Bureaucrats don't understand why we have called it the Web --> There is more than one way to get to it.
-
Start out by identifying your pages and what they will do. What will the user see? Does it have a form, how does it different states look (submit error, submit success, ...)? Does it have AJAX, how will it communicate state changes (service unavailable, service hang, ..)? It isn't rocket science, you know/can think of this stuff.
-
The code for the shopping cart module has to be completely ignorant of the 3 systems. Once this is complete you need to write a specific script for each of the 3 shopping cart systems that proxies to your own code. This is a bad idea as this will prohibit you from using it on another website once it is added unless additional code is written.
-
Web 3.0 is when the web becomes your personal assistant. You ask it: I'm in the mood for a good action movie released in the last 5 years with an IMDB rating of no less than 7 and got great reviews and I'm also out of popcorn where can I get some? And the web would reply with good action movies with an IMDB rating of no less than 7 that got great reviews and on which channels they play and when, and it also points me to a store where they have popcorn in stock! That may also just be my imagination toying with me when I read that memo It may also have been an april fools but it stuck with me Web n.0 is not colors, rounded corners, or some other techno gizmo. Web 2.0 was/is social publishing for example (in other words: people with no clue can publish stuff on the internet). Web 1.0 is when only those gifted with the knowledge of HTML could publish stuff on the internet.
-
Try this: var $cc = $('.cc'); $(window).scroll(function() { var yScrollOffset = window.pageYOffset; $cc.each(function() { var $this = $(this); $this.css({top:$this.position().top + yScrollOffset}); }); });
-
http://freedcamp.com is an online solution. It's not open-source though, but offers all that you need. Some more examples can be found at: http://www.denbagus.net/fresh-open-source-project-management-invoice-and-tracking-you-should-know ArgentumInvoice is what I think you are looking for.
-
NetBeans: Expand Tabs to Spaces
ignace replied to doubledee's topic in Editor Help (PhpStorm, VS Code, etc)
Obviously, if you are the only one developing. Try opening that in notepad++ or another IDE. Behold the almighty SHIFT + TAB. Which tabs in the other direction. Maybe take a day off to learn the tools you are working with? Pretty hard to punch a nail if you hold the hammer backwards. -
Uninstall - reinstall has gone horribly wrong
ignace replied to JohnMike's topic in PHP Installation and Configuration
CTRL + SHIFT + ESC --> Services tab, below press Services button. Look for Apache and MySQL. It's called experimenting, and is generally a good thing. You can't break anything if you never do anything. Just look at what you all learned by just uninstalling something. -
Question on the best way to set up OOP class relationships
ignace replied to dgruetter's topic in Application Design
$brides = new BrideRepository($db); $brides->addBride($_POST); $vendors = new VendorRepository($db); $vendors->findByCategory($_POST['category']); $vendors->findByRegion($_POST['region']); $vendors->findByRegionAndCategory($_POST['region'], $_POST['category']); OR $vendors = new VendorRepository($db); $find = new VendorSpec; $find->whereCategoryIs($_POST['category']); $find->inRegion($_POST['region']); $find->matchAny(); $vendors->findBySpec($find); $brides = new BrideRepository($db); $brides->find($id)->bookmarkVendor($_POST['vendor']); $brides = new BrideRepository($db); $brides->find($id)->publishReview($_POST['title'], $_POST['body']); $vendors = new VendorRepository($db); $vendors->addVendor($_POST); $vendors->find($id)->.. I do not encourage though that you will start to use this as it's serious overkill for your needs. OOP should only be used when your application has some serious business rules that are harder to accomplish/maintain when programming procedural. The above may seem to be not that much work, but that's because you are only looking at the abstracted layer. The BrideRepository for example communicates through different Table Data Gateway's to retrieve it's data: bride table, bride_bookmarked_vendor table, and bride_published_article table. defining/finding new responsibilities and boundaries are easy for me, it's always figuring out a damn name that clearly communicates what the class does that trips me up. Having conventional names kinda helps but not entirely. -
To get "around" the binary math problem of close-enough. You can use the BC Math extension. Be sure though that the number is always a string both when storing (or use DECIMAL if your precision is smaller than 65) and manipulating or your result may be off: $var = bcdiv(1, '0.0015625'); // note the quotes
-
I think this will do what you want. public function getBonusChildren($userID) { // retrieve all children of $parent $sql = <<<SQL SELECT userID, (SELECT count(userID) FROM jos_backoffice_users T2 WHERE T2.parentID = T1.userID) child_count FROM jos_backoffice_users T1 -- WHERE mem_status = ? SQL; $rows = conn::getInstance()->query($sql)->fetchAll(); return $rows; }
-
I don't know how I should phrase this so everyone understands what I want to do, so I'll try an example: http://www.zimmo.be/nl/Leuven/Te-Koop/Woning/7QVD7/ Take a look at the above website. The lower part of the webpage is an iframe although it doesn't "appear" to be since there is only 1 scrollbar that covers both the iframe and the website. That is what I want to achieve, the above website uses a iframe with a height of ~2300px, I want to be able to do the same thing except without having to set the iframe to 2300px. I found the HTML5 iframe attribute seamless="" but it's not supported in any browser. So is there anyone who knows how I can do this without having to go the "use a proxy script" way? Since there is no support for seamless, maybe there is a CSS way in how to do this? @scootstah If you read my post you would have found that I have put quite an amount of time in finding a solution before coming here to ask a question. It's quite hard to find something if you don't know what you are looking for. If I add 100% to the iframe, I get a double scrollbar and I want to avoid that.
-
I have an annoying problem: I want to show an external webpage on my website in an iframe with no scrollbar (as if it were part of the parent document). I have looked around but due to the XDomain Policy I can't access the height of the webpage. I currently want to exclude the proxy method to resolve the issue and see if someone's has any bright ideas. I thought there would be a CSS3 rule that I could use to tell the browser how it should render the iframe.. but I didn't find any. I found the seamless attribute for HTML5 but it is not supported in ANY browser. http://www.maxdesign.com.au/2011/03/10/iframe-scrollbars-and-html5/
-
That you are missing a few tables No need though to separate age and sex from other member info. members (member_id, group_id, member_firstname, member_lastname, member_username, member_password, member_age, member_sex) addresses (member_id, address_id, address_type_id, address_street, address_number, ..) address_types (address_type_id, address_type_name) groups (group_id, group_name)