View - viewPracticeCode.php
When I am passing
#include <stdio.h>int main(){printf("Welcome to GLB Coding Club");return 0;}
through ajax to following controller
Controller - cntrlPractice.php
print_r($this->input->post("script",true));
giving
#include <stdio>int main(){printf("Welcome to GLB Coding Club");return 0;}
that is breaking my code execution. Actually .h is missing from stdio.h.
Related
I'm trying to verify the CSS used in a Stylesheet that utilizes custom csspropertys but they don't seem to be working. I can't tell if I'm writing it all correctly and I'd like to check to see what is actually being used. Is there a way to print out a Stylesheet?
Edit: To be clear, these are TornadoFX classes, not just plain CSS. I am trying to verify type-safe CSS, not trying to print a CSS file.
Moving my comment to an answer
To see the CSS that will be generated by a Stylesheet, instantiate it and call the its render() function:
class MyStyles : Stylesheet {
...
}
fun main() {
println(MyStyles().render())
}
I am planning to use SASS by creating [_partial] and use [#import].
Question: How can I create selectors with no declaration?.
I will of course populate the selectors with declaration,
but that input comes from the other [_partials]. Have I understood correctly that SASS will delete a selector that has no declaration? Is there any workaround?
My partials structure looks as below.
#import '_1-partial_variables.sass'
#import '_2-partial_divs_only.sass'
#import '_3-partial_wrapper.sass'
#import '_4-partial_divs_layout.sass'
What I have tried so far:
In [_2-partial_divs_only.sass] I have tried:
.div-1
(the build executes without errors, but the div itself is not created).
.div-1 {};
(the build script says, "Error: Expected newline".
What about same scenarios using SCSS as source file?
The results are exactly same, a selector with blank declaration, is not created.
My build-line is:
sass --no-source-map main.sass main.css
Seems this works in order for the SASS compiler to create the selector [.div-1]:
.div-1
/*! keep */
This works also:
.div-1
/**/
As the source is a SASS file, I do not add [{}] nor [;].
Those characters are being created automatically when building from SASS to CSS.
In javascript, I usually write as follow to make code clean.
(function(){
doThing1(()=>{doThing2()});
doThing3();
function doThing1(){...}
function doThing2(){...}
function doThing3(){...}
})();
By moving the functions to the end, it make other dev eaiser to read just by look at the first lines to determine how the main function works.
My questions is how can I do this in sass?
I try following and doesn't work:
#include style1();
#include style2();
#include style3();
#mixin style1(){}
#mixin style2(){}
#mixin style3(){}
It complaint that cannot find mixin named 'style1'
You can't do exactly what you're asking for in part because Sass still works off of the cascade part of CascadingStyleSheets. What's below overrides what is above or, in this case, it uses what's above.
There's still a way to separate your logic from your implementation though, through partials. If you put all your mixins in one scss file, _mixins.scss then you can #import it at the top of your actual style rules. That way someone can jump into your project, see that you're using some hypothetical #include make-container(); mixin, then only go into the mixins file if they actually need to see how it works.
You'd have something like:
#import "mixins";
#include style1();
#include style2();
#include style3();
Here's a good article talking about the general ideas of Sass file organization and partials.
Well.. Im a little familiar with LESS and when im trying to move up to SASS.
In less i create some framework this way:
.w(#x){width:#x;}
.h(#x){height:#x;}
.f(#x,#y){font:#x '#y'}
i save it framework.less and #import it on my main.less
I just searched but i didnt found how to do it in SASS.. Just read the docs in the official site but no success.
Can anybody explain me or send me a tutorial link? All the links i found on google was a little hard to understand even to make SASS work.
LESS' docs are very simple to understand but SASS is too complicated..
Those are called mixins. You would write them like so:
#mixin w($x){width:$x;}
#mixin h($x){height:$x;}
#mixin f($x,$y){font:$x $y}
Mixin invocation looks like this:
.foo {
#include f(1.5em, sans-serif);
}
However, your f mixin has redundant arguments:
#mixin f($x){font:$x}
.foo {
#include f(1.5em sans-serif);
}
I have a link that call a specific ajax action and in return it render the partial view on the screen that always update inside the div. Using this normally works but when i am using CHTML class to use static function like below
<?php echo CHTML::linkButton("Like",array("href"=>"http://www.aa.com","id"=>"link-button-shrinked"))?>
then ajax call does not work and gives strange error
<h1>PHP Error [2]</h1>
<p>YiiBase::include(CHTML.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory (C:\AppServ\www\abc.com\framework\YiiBase.php:418)</p>
my render view function is like this
$this->renderPartial('_character_actions',array("actionRecords"=>$actionRecords),false,true);
if i remove the CHTML function calls then everything works fine....kindly help me.
You got the class name wrong.
Just change CHTML to CHtml and you should be good.