Reputation Activity
-
Yakindo reacted to rbrtsmith in Review my code.A few things here - Beware this might hurt your feelings but if you follow what I suggest it will make you a better coder.
I say it often but it's good advice: Don't use ID's for styling - ever. It halts re-useability and makes it much harder grow the project over time. The DRY principle is not possible in CSS if you're using IDs. Hence layer13 and layer5 have the same properties & values you could have targetd both of these elements with a single class. Spans are used to contain text, divs can contain anything, they have no semantical meaning, spans have almost none also. An important difference is that a span is an inline element and a div is a block level element. If you donät know the difference I highly suggest you learn the CSS box-model, it's critical to know and understand this for layout. Use indentation, it's really really hard to spot missing closing tags, errors like that without indentation. The DOM is a tree-like structure, we need to be able to see immediatley what is a parent, what is a sibling etc we struggle to visualise this without indentation. Magic numbers are occuring frequently in your CSS. Here's a snippet about them in CSS-WIzardry: http://csswizardry.com/2012/11/code-smells-in-css/#magic-numbers Why is your footerBottomContainer 200px high? What if the content were to change? It would break. Let your content dictate heights and the widths, were do those numbers come from? Sometimes magic numbers are unnavoidable, but in the rare occasion that you use them leave a commont to explain what it's doing. As soon as I see uncommented magic numbers I know I cannot trust that code. Why have you commented out border-box for you box sizing? Border-box is a far nicer box-model to work with than content-box - Most modern frameworks depend upon border-box. -
Yakindo got a reaction from Weedy101 in Reading associative arrays?In answering the title of your thread, the best way I've found to read arrays is using the function print_r();:
<?php $array_var = array(); // the var which stores the array ?> <pre><?php print_r($array_var); ?></pre> This will output the array in an easy-to-read format, where all the keys you need to access the array items are defined.
For this array:
<?php $new_invoice = array( array( "Type"=>"ACCREC", "Contact" => array( "Name" => "Income" ), "Date" => "2013-12-31", "DueDate" => "2013-12-31", "Status" => "DRAFT", "LineAmountTypes" => "Exclusive", "LineItems"=> array( "LineItem" => array( array( "Description" => "Sales - Wet", "Quantity" => "1.0000", "UnitAmount" => "2500.00", "AccountCode" => "200" ), array( "Description" => "Sales - Pool Table", "Quantity" => "1.0000", "UnitAmount" => "325.25", "AccountCode" => "200" ) ) ) ) ); ?> <pre><?php print_r($new_invoice); ?></pre> The following is outputted in the HTML:
Array ( [0] => Array ( [Type] => ACCREC [Contact] => Array ( [Name] => Income ) [Date] => 2013-12-31 [DueDate] => 2013-12-31 [Status] => DRAFT [LineAmountTypes] => Exclusive [LineItems] => Array ( [LineItem] => Array ( [0] => Array ( [Description] => Sales - Wet [Quantity] => 1.0000 [UnitAmount] => 2500.00 [AccountCode] => 200 ) [1] => Array ( [Description] => Sales - Pool Table [Quantity] => 1.0000 [UnitAmount] => 325.25 [AccountCode] => 200 ) ) ) ) ) As you can see all of your information is stored in the 0 array key:
$new_invoice[0] Instead of:
$new_invoice So to access your description you will need to do the following:
$new_invoice[0]['LineItems']['LineItem'][0]['Description']; // first line item $new_invoice[0]['LineItems']['LineItem'][1]['Description']; // second line item To add new items into your "LineItem" key, use the following code:
$new_invoice[0]['LineItems']['LineItem'][] = array( "Description" => "", "Quantity" => "", "UnitAmount" => "", "AccountCode" => ""); To loop through the "LineItems" section, using a foreach like so would be plausable:
<?php foreach($new_invoice[0]['LineItems']['LineItem'] as $lineItem) { $lineItem['Description']; // this is the description of the line item being looped $lineItem['Quantity']; // this is the quantity of the line item being looped $lineItem['UnitAmount']; // so on and so forth $lineItem['AccountCode']; } ?>
I hope you've found this useful.
-
Yakindo got a reaction from pbb76 in Reading associative arrays?In answering the title of your thread, the best way I've found to read arrays is using the function print_r();:
<?php $array_var = array(); // the var which stores the array ?> <pre><?php print_r($array_var); ?></pre> This will output the array in an easy-to-read format, where all the keys you need to access the array items are defined.
For this array:
<?php $new_invoice = array( array( "Type"=>"ACCREC", "Contact" => array( "Name" => "Income" ), "Date" => "2013-12-31", "DueDate" => "2013-12-31", "Status" => "DRAFT", "LineAmountTypes" => "Exclusive", "LineItems"=> array( "LineItem" => array( array( "Description" => "Sales - Wet", "Quantity" => "1.0000", "UnitAmount" => "2500.00", "AccountCode" => "200" ), array( "Description" => "Sales - Pool Table", "Quantity" => "1.0000", "UnitAmount" => "325.25", "AccountCode" => "200" ) ) ) ) ); ?> <pre><?php print_r($new_invoice); ?></pre> The following is outputted in the HTML:
Array ( [0] => Array ( [Type] => ACCREC [Contact] => Array ( [Name] => Income ) [Date] => 2013-12-31 [DueDate] => 2013-12-31 [Status] => DRAFT [LineAmountTypes] => Exclusive [LineItems] => Array ( [LineItem] => Array ( [0] => Array ( [Description] => Sales - Wet [Quantity] => 1.0000 [UnitAmount] => 2500.00 [AccountCode] => 200 ) [1] => Array ( [Description] => Sales - Pool Table [Quantity] => 1.0000 [UnitAmount] => 325.25 [AccountCode] => 200 ) ) ) ) ) As you can see all of your information is stored in the 0 array key:
$new_invoice[0] Instead of:
$new_invoice So to access your description you will need to do the following:
$new_invoice[0]['LineItems']['LineItem'][0]['Description']; // first line item $new_invoice[0]['LineItems']['LineItem'][1]['Description']; // second line item To add new items into your "LineItem" key, use the following code:
$new_invoice[0]['LineItems']['LineItem'][] = array( "Description" => "", "Quantity" => "", "UnitAmount" => "", "AccountCode" => ""); To loop through the "LineItems" section, using a foreach like so would be plausable:
<?php foreach($new_invoice[0]['LineItems']['LineItem'] as $lineItem) { $lineItem['Description']; // this is the description of the line item being looped $lineItem['Quantity']; // this is the quantity of the line item being looped $lineItem['UnitAmount']; // so on and so forth $lineItem['AccountCode']; } ?>
I hope you've found this useful.
-
Yakindo reacted to Sam G in Best Keyboard (Preferably for Design/Development)? -
Yakindo reacted to ChrisSoutham in Which is the best php frame work for developing a large scale professional network like linkedin or xing?'large scale professional' and 'shared hosting' don't go hand in hand very well at all.
Having said that, give Laravel a try.
-
Yakindo reacted to Jack in Moan, Grumble, Whinge...Not really web related, but I was still pissed off.
Basically I went to the cinema to see that Alan Partridge film, but first I had a bunch of hassle at the counter, just trying to get some popcorn and a coke. I asked for a small for both and the girl at the counter said that it was cheaper to up-size, but I said no. She kept asking me as if I didn't understand what I was talking about. I don't want 1.5 liters of coke and a shopping bag of popcorn. I didn't even want anything but I was queuing and it took ages, so I thought screw it.
These people do my head in.
-
Yakindo reacted to teodora in htmlshiv or modernizrI use both of them + conditionizr.
What modernizr does is detects what browser and operating system are being used and adds a class to your html tag. For example if the site is viewed on IE7, your html will have a class of ie7 ( <html class="ie-7"> ). Modernizr detects many other features, like touch screen, retina, etc - http://modernizr.com/docs/#features-css
Html5shiv "enables" html5 in older versions of IE.
Conditionizr allows you to use conditional stylesheets and scripts, for example if IE7, you can have ie7.css.
The 3 of them make browser support really easy Hope that helps
-
Yakindo reacted to rbrtsmith in My first JavaScript appI already sort of knew JavaScript and used JQuery quite often in my builds, and recently I was looking to take this further an learn some more advanced frameworks such as backbone.js and node.js. I quickly found out that I needed a stronger grasp on JavaScript fundamentals so I've been hard at work studying.
I recently started a new weight training routine where are lifts are based around percentages of my maximum lifts. I thought this would be a great opportunity to actually make something that is useful to me from my new found knowledge.
I wanted to make the app purely from JavaScript without the use of libraries to further my knowledge in JavaScript DOM manipulation.
Here is the link, I am sure it could be coded in a more efficient manner - If so please tell me how as this is a learning exercise for me
http://www.rwsmithdesigns.com/lifting/calc.html
-
If it seems worthwhile I'll create a little survey to determine what people are after, locations, where people would be willing to travel to ect.
-
Yakindo got a reaction from PumpkinHead in Please Help with WHERE clauseIf you're going to be building a big website, you want to be testing your queries before you implement them into PHP code.
Try testing your query first with MySQL Workbench. It allows you to connect to a DB and test your queries before you put it into code. This is great for getting the exact data you want from your query, reducing load times etc.
Where is your function getting these two array items from?
$query .= " WHERE position = {$sel_catergorie['Id']} "; $query .= " AND sub_pos = {$sel_sub['Id']}"; Also, concatenating your variables being used in the query like so:
$query = "SELECT * FROM stock WHERE position = " . $sel_catergorie['Id'] . " AND sub_pos = " . $sel_sub['Id'] . ""; Have you got the spelling correct of your variables etc?
-
Yakindo reacted to teodora in What are you working on - Sneak Peek?If you are not yet sick of constantly seeing my posts in this thread, here is something I am working on. Pricing table and sign up process:
-
Yakindo reacted to BrowserBugs in Hunt the Wabbit"come here wittle bunny wabbit"
-
Yakindo got a reaction from Hermes in Adding to an existing Php script to allow more fields to be added to a contact form<p class="institution"> <select name="institution" id="Institution"> <option selected disabled>Please choose your status</option> <option value="Private Client">Private client</option> <option value="Institutional Client">Institutional client</option> </select> You add values to the select options, otherwise the PHP $_POST["institution"] won't contain any information, since there aren't any values
-
Yakindo reacted to teodora in Music while workingPerfect for a Tuesday afternoon
http://www.youtube.com/watch?v=w9TGj2jrJk8&list=RD02X5iOiLX5ppA
-
I've put something together in jQuery for you. Pretty basic but you can use it as a starting point
http://jsfiddle.net/LyndseyB/udKGq/
-
Yakindo reacted to Lyndsey in SlideShow not showing images liveThe problem is that the JavaScript cannot find the images you are rotating.
Just ensure that all image files have been uploaded to the server and are in the same directory as your HTML page.
If they are in a different directory e.g. Images, then you will need to change the image path to reflect that, like so:
items[0]="<a href='quote.html' ><img alt='image1' src='Images/lamp1.gif' height='200' width='200' border='0' /></a>"; //a linked image -
Yakindo got a reaction from teodora in What time of the day / night are you most productive?What is this productive you speak of?
Probably when I first get up, get a coffee and crack on with whatever I need to do then off to Uni or work, or on weekends when I've got no hassle
-
Yakindo reacted to throzen in best way to design+1. You get more thumb's up with CSS versions since it'll work on any browser and version and CSS ones tend to be more challenging making them more rewarding. JavaScript/jQuery are arguably easier to code since it's purpose-built for this kind of thing, but doesn't mean CSS is a bad way to go, not at all. It's like fitting a bog standard family car with a turbo-charger that can keep up with a brand new BMW M5 (which is made for speed) - they both do the same thing, but somehow CSS is cooler. Hope my metaphor made sense.
-
Yakindo got a reaction from cairns84 in best way to designGo for a CSS version,
-
Yakindo got a reaction from throzen in The interview shakesWhat areas are you struggling with?
as long as you can explain how HTML, CSS and Javascript are able to effect the web page, talk about some developments in it such as SASS / LESS, HTML5 and what it's capable of, so on and so forth, you'll be fine
Just talk about it like you would to another developer, have confidence and you'll be fine!
Edit: also reusable code, people love that ****.
-
Yakindo reacted to inlinedivblock in Bored of notepad ++Yep if you just use the code preview, I wouldn't recommend the design/split preview though!
-
Yakindo got a reaction from Precise Estimating Ltd in Has anyone had success with this tutorial?Will edit later, watching Weeds aha
<script type="text/javascript"> jQuery(document).ready( function($) { function toggleTarget ( param, param_2 ) { $(param).toggle('fade', 300); $(param).removeClass('hide'); $(param_2).addClass('hide'); } $( "#triggershare" ).click(function() { toggleTarget('#share','#follow'); }); $( "#triggerfollow" ).click(function() { toggleTarget('#follow','#share'); }); }); </script> -
Yakindo reacted to teodora in What are you working on - Sneak Peek?Looks good
You need to give it max-width though, atm it takes full width of the screen and doesn't look very good on large screens.
-
Yakindo reacted to JackDanielTracy in What are you working on - Sneak Peek?Ahh, ditch those skill graphs/bars.
Seriously, if a client/person was to view it and see that your 60% etc they are going to stay away from you. Often clients will want someone to do it all, and they expect you to be 100%, at everything! Even though no-one ever is, that's what they expect.
Also, how would you define how good your are? How do you know that your 95% good at HTML? How do you know your 85% CSS?
Just my two pennies' worth.
Ahh nice!
-
Yakindo got a reaction from teodora in Has anyone had success with this tutorial?Will edit later, watching Weeds aha
<script type="text/javascript"> jQuery(document).ready( function($) { function toggleTarget ( param, param_2 ) { $(param).toggle('fade', 300); $(param).removeClass('hide'); $(param_2).addClass('hide'); } $( "#triggershare" ).click(function() { toggleTarget('#share','#follow'); }); $( "#triggerfollow" ).click(function() { toggleTarget('#follow','#share'); }); }); </script>