w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
stylus is not compiling stylesheets (nodejs express jade stylus and nib)
Figured it out https://github.com/LearnBoost/stylus/issues/122 a request to /css/style.css interprets to /src/css/style.styl

Categories : Node Js

what does the filename option do in stylus.render function?
The filename parameter is used in error reporting, not as an input or output filename. From the docs at http://learnboost.github.io/stylus/docs/js.html: Simply require the module, and call render() with the given string of Stylus code, and (optional) options object. Frameworks utilizing Stylus should pass the filename option to provide better error reporting.

Categories : Node Js

data transferred in calling a user defined function
A call to cellfun() with string inputs would be very fast: sizes = [cellfun('size',varargin,1); cellfun('size',varargin,2)]; or lenghts = cellfun('length',varargin); or numels = cellfun('prodofsize',varargin);

Categories : Matlab

Switch Case Calling A Function Based On The User's Choice
Do you really need to use functions? This seems pretty straight forward: switch (Choice) { case 1: c = a + b; break; ... default: Console.WriteLine("Invalid choice"); break; } But if you really do want to use functions, just define them outside of your Main method (they must be declared as static if you want to call them from Main): public static int add(int x, int y) { return x + y; } And then invoke them like this: switch (Choice) { case 1: c = add(a, b); break; ... default: Console.WriteLine("Invalid choice"); break; }

Categories : C#

Calling a $resource action from inside a user defined $scope function
Introduction I solved my own problem. I used this Github comment from Misko Hevery as reference. Why my PUT request wasn't executing: Apparently, in Angular 1.1.x, if you ever leave the angular execution context, you'll be outside of Angular's $scope.$apply function. In my case, I was working with JQuery UI's sortable function - whenever a Card was placed in a new Deck, I wanted to update the Deck's cards to reflect that update. To the best of my understanding, because of this, I was outside the angular execution context. ngResource wouldn't execute the PUT statement and the $then function of the Angular's promise object will never be called. The solution: Simply wrapping the $scope.$apply function around the Card.updateaction allowed the action to execute, which subsequently allowe

Categories : Ruby On Rails

Rails 3: Forcing HTTP in some parts, and Forcing HTTPS in others?
Not sure if this blog will be of any use to you: Always-On HTTPS With Rails Behind an ELB also this may also be of use to you considering you are trying to force some parts of your application to use https. SSL Requirement. It details under the section about SSL requirement adds a declarative way of specifying that certain actions should only be allow to run under SSL. Should you want to specify the entire controller in SSL then call ssl_exceptions Alternatively you could try and write a before_filter by doing something like class ApplicationController < ActionController::Base before_filter do if request.ssl? || Rails.env.production? redirect_to :protocol => 'http://', status => :moved_permanently end end end Hope this helps

Categories : Ruby On Rails

How can I only upload deltas for version control to my server? Without forcing user to install any tools
Based on the answer here I found jsdifflib which I would suggest could act as the basis of a browser based diff and send the diff/patch tool. A couple of cautions: It is probably worth following the unified diff format so that standard patch tools can be used. Binary files, especially zip files, often get a lot bigger when diff is taken so you will either need to Forbid binary files, test for binary files and upload those directly, check if the patch is bigger than the whole file or a combination of the forgoing.

Categories : GIT

write the newline between Items which user selected from a openfiledialog using TinyXML in C++
A better/neater solution would be to store each item in its own XML element, e.g.: <?xml version="1.0"?> <opencv_storage> <images> <image>./images/cam01.jpg</image> <image>./images/cam02.jpg</image> <image>./images/cam03.jpg</image> </images> </opencv_storage> Then you simply have to enum the "image" tags to build up your full list without having to worry about parsing each separate line.

Categories : C++

forcing definition of a function based on interface implemented
Try using traits. In your classes, just do the following: use TraitWithReturnUrl; then... trait TraitWithReturnUrl { function returnUrl() { // do stuff like it's on the object itself } } Bingo! :) Also check out my Fatty library, which can be useful for stuff like this as well: https://github.com/kirkbushell/fatty In both cases, you'll need PHP 5.4+.

Categories : PHP

db2 how to view the code User-Defined-Function calling C code
There's no "code", just the function definition. You can either use db2look or generate the definition yourself by querying the system catalog views SYSCAT.ROUTINES and SYSCAT.ROUTINEPARMS.

Categories : SQL

What is the use of Environment.NewLine and TextWriter.NewLine properties
If choose to generate the 'linebreaks' your self by sending to the streamwriter there is no way the framework is going to interfer with that. If you want the framework to honor the NewLine property use the WriteLine method of the writer and set the NewLine property of the Writer. Adapt your code like so: sw.NewLine = Environment.NewLine; // StreamWriter uses by default sw.WriteLine("1uf0f1") sw.WriteLine("2ue0e1"); sw.WriteLine("3ud0d1"); Or have a Custom StreamWriter that overrides the Write method: public class MyStreamWriter:StreamWriter { public MyStreamWriter(Stream s):base(s) { } public override void Write(string s) { base.Write(s.Replace(" ",Environment.NewLine)); } } Or if you only have one line that you want to handle: sw.Write("1u

Categories : C#

newline - not added or unable to split by newline
replace this: String lines[] = storedData.split("\n"); with String lines[] = storedData.split(" "); Actually your lines[] is containing only one line no splits occurs. try that.

Categories : Java

Forcing variadic template member function instantiation in class
(Repeating from my comments to the OP.) The actual problem in the line instate force = &Self::memberMethod<ArgTypes...>; is a missing template keyword: instate force = &Self::template memberMethod<ArgTypes...>; See, e.g. Where and why do I have to put the “template” and “typename” keywords? Actually, the explicit template arguments are not necessary here [over.over]/1: A use of an overloaded function name without arguments is resolved in certain contexts to [...] a pointer to member function for a specific function from the overload set. A function template name is considered to name a set of overloaded functions in such contexts. The function selected is the one whose type is identical to the function type of the target type required in the context.

Categories : C++

How do assertion libraries such as Chai work without forcing a call to a function?
I figured it out (or at least, I figured out a method). Use JavaScript getters: var throws = { get a() { throw new Error('a'); }, get b() { throw new Error('b'); }, get c() { throw new Error('c'); } }; When doing throws.a, throws.b, or throws.c, the appropriate error will be thrown. From that point it is rather easy to build the assertions which are contained within Chai.

Categories : Javascript

Using the Translate function to remove newline characters in xml, but how do I ignore certain tags?
You can filter elements in match attributes <xsl:template match="*[name() = 'Instructions']/text()"> <xsl:value-of select="translate(.,'&#xA;','')"/> </xsl:template> which means something like "only in Instruction element replace newline characters". Edit: You could make a external helper xml file containing names of elements indended for replacing. <?xml version="1.0" encoding="UTF-8"?> <Replace> <Description /> <Instructions /> </Replace> Load it into a variable by document() function <xsl:variable name="elementsForReplacing" select="document('replaceNames.xml')/Replace/*" /> Then just check for presence in this variable for decision if replacing should be done. <xsl:template match="text()"> <x

Categories : Javascript

Forcing the return value of a function to be stored in a const variable/to be treated as const
You can use proxy pattern: http://www.oodesign.com/proxy-pattern.html Create a proxy of B that will control access to it and return a proxy instead of B itself from your method. class BProxy { public: BProxy(const B &b) : _b(b) {} void doSomeStuff() {...} private: B _b; };

Categories : C++

Permission Denial: startActivity asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
1)In linux every user has an id number. 0 and -2 are User IDs (UIDs). 0 is root, -2 is some random user (which may not be a person, it may just be a fake account used for internal reasons). 2)Any book on Linux. Android is just a graphical framework on top of Linux. 3)Yes, just add the permission.

Categories : Android

loop for Stylus value
Just remove the {} around your function call, that's for interpolation : calculate_shadow() $shadows = '' for i in 1..6 $shadows += '%spx %spx, ' % (i i) $shadows + '0px 0px' long_shadow() text-shadow: unquote(calculate_shadow()) body long_shadow()

Categories : Misc

wpf stylus mouse event
If you look at this MSDN Input overview documentation. you will see the fact the both events are called. From above link: Because the stylus can act as a mouse, applications that support only mouse input can still obtain some level of stylus support automatically. When the stylus is used in such a manner, the application is given the opportunity to handle the appropriate stylus event and then handles the corresponding mouse event. In addition, higher-level services such as ink input are also available through the stylus device abstraction. Since it does give you the order the events are called you can create a Boolean variable, set it in the StylusDown EventHandler, then check in your Button_Click EventHandler if it is true, set it to false then exit the Handler. something like th

Categories : Wpf

Calling Pure Virtual Function From Abstract Base Class Member Function?
Func is calling the virtual ones, not the pure virtual ones. You would have to qualify the calls with a scope operator, i.e. AbstractClass::Step1() to call THAT (virtual pure) function. Since you are not, you will always get an implementation by a derived class.

Categories : C++

calling function should return default value, if object (or any function result) is null
Not really, any code you would write this way would look horrible and/or use very slow reflection. Unless you use an actual Java preprocessor that can understand and change the code you've written. A better (but associated with quite a bit of refactoring) approach would be to make sure that the values in question cannot possibly be null. For example, you could modify the individual accessors (getSubObject(), getDesiredValue()) to never return null in the first place: make them return default values. The accessors on the default values return default values in turn.

Categories : Java

GDB crashes when calling function with non-const QString reference of temporary from other function
I believe there is a bug open in gdb's bugzilla about this problem. Meanwhile, it's generally better to use gdb's pretty-printing facility rather than helper methods in your program. The pretty-printer approach works in many situations that a helper method cannot: they automatically work in backtraces, in "info locals", and if you are examining core files. Pretty-printers are written in Python. They're generally quite simple to write. There are probably already printers written for QString somewhere... aha: http://nikosams.blogspot.com/2009/10/gdb-qt-pretty-printers.html

Categories : C++

why pthread_create function takes thread function name as a parameter rather than calling it?
The most obvious argument would be that you cannot call thread_fn "as an argument" because then it would need to run to completion before pthread_create could be called -- that is, you would run the code destined for the new thread in the current thread. Another way of looking at things is that creating a thread of execution necessarily taps into OS (kernel) code; the OS needs to set up its internal bookkeeping structures before the new thread becomes effectively usable. A kernel call such as caused by pthread_create needs to know the memory address of the code to be executed in a thread so that it can transfer control to that location after setting everything up, and passing the address of a function (as opposed to its return value) is done with the first syntax.

Categories : C

Can I use query parameters as variables in stylus?
You'll need to code this as a 2-step process: Use regular express code with a simple templating language like ejs or underscore templates to interpolate the color value into the stylus file. Then render the stylus file and respond with the CSS

Categories : CSS

CSS3 Transitions in Stylus - how to degrade for IE9
This question is a bit old, but here's two solutions : • Easy and clean solution : Use Modernizr (http://modernizr.com/). It'll add classes to html tag for each property supported in your browser (ex : csstransitions). Then, with Stylus (or any other stylesheet document) you can easily target any element this way : html.csstransitions .portfolio-wide .image-wrapper img transition all 10s ease • Heavy solution : Use jQuery transit (http://ricostacruz.com/jquery.transit/). It works the same way as animate() but with css3 transition. As a benefit, you can always fallback to animate() when transition is not supported : if (!$.support.transition) { $.fn.transition = $.fn.animate; }

Categories : Jquery

Calling a function using specs2 doesn't call the function
Here is your test little modified showing two ways testing the controller. The reason AnyContentAsXml is not working for you because your testing is mixing two approaches together. "one way" in new WithApplication { val action = controllers.Application.main val req: FakeRequest[scala.xml.NodeSeq] = new FakeRequest( PUT, "some url", new FakeHeaders(Seq("Content-Type" -> Seq("text/xml"))), <xml>xml</xml> ) val x = action(req) status(x) should beEqualTo(200) } "2nd way" in new WithApplication { val Some(result) = route(new FakeRequest("PUT", "/", new FakeHeaders(Seq("Content-Type" -> Seq("text/xml"))), AnyContentAsXml(<xml>xml</xml>))) status(result) should beEqualTo

Categories : Scala

C programming calling a function...passing (float*)X to a function
The notation (float *)X is a cast. The cast is necessary if the matrix multiply function is declared (or defined) before it is used, as it should be, because the types being passed to the function are not float * as the function expects but float (*)[2] (which is a pointer to an array). The casts tell the compiler 'we know more about this C than you do', even though that is a very debatable proposition. Here is a mildly modified version of the code in the question: #define N 2 static float m1[N][N] = {{1.0, -0.02}, {0.0, 1.0}}; static float m2[N][1] = {{1.5f}, {1.5f}}; static float result[1][N]; void matrix_multiply(float *input_matrix1, float *input_matrix2, int m, int p, int n, float *output_matrix); int main(void) { matrix_multiply( m1, m2, N, N, 1, result); matrix_mult

Categories : C

calling a function inside a function that uses prototype property
Pass this keyword as parameter in this.createId(); like following function Node ( name, level, parent ) { this.name = name; this.level = level; this.children = []; this.parent = parent; this.id = this.createId(this); } then in node do this Node.prototype.createId = function (self) { var p = self.parent; return p.name; }

Categories : Javascript

JavaScript: why use prototype to call a function instead of just calling the function?
The key benefits are realized when "arr" is not an array, but something like an array; specifically, something with a "length" property and numerically-keyed properties. Good examples are the arguments object and NodeList objects from a DOM. Those things won't have a "slice" method, but they do have numerically-keyed properties and a "length" property. The trick works because the "slice" method is pretty forgiving. If you see it being used with something that's definitely an array already, then you're looking at code written by a confused person :) Oh, and note also that a short-cut is: var foo = [].slice.call(arguments, 0); You don't have to go to the prototype directly if you don't want to; you can get at it from an array instance just as easily. (Yes, it costs a dummy allocation,

Categories : Javascript

calling a javascript function from a string passed to the function
You should make an object of functions and use indexer notation: var methods = { $say: function() { ... } }; if (!methods.hasOwnProperty(func)) // uh oh else methods[func]();

Categories : Javascript

Need help calling a JQuery function more than once without having to give every selector a function
use $(this) selector and find method to target the correct children: $(document).ready(function(){ $("#articletext h2").click(function(){ $(this).find(".revealTitle").fadeIn(); $(this).find(".revealText").slideDown(); }); });

Categories : Jquery

how do i exit a function which causes segfault and return to calling function
Here's a similar question with an answer (albeit the wrong language, C++): Catch Segfault or any other errors/exceptions/signals in C++ like catching exceptions in Java I believe that what you're looking for is an exception in place of your exit(0) statement, but a Segmentation Fault is not an exception, therefore making it difficult to deal with. This being said, it appears that C does not have built in exception handling. Regardless, here's a reference about receptions in c++: http://www.cplusplus.com/doc/tutorial/exceptions/ I don't know exactly how you're using the function you have here, but perhaps you can return a boolean instead of void, and return from the calling function if the boolean is true?

Categories : C

Calling a random integer into a function which is defined in on other function
It depends on how you plan on using these two functions. Option 1 Pass U into your second function as a parameter and make it a second output of your first. function [tp, U] = Calculate_T_P(); //body of function 1 // here I define U, which is a random integer between 0 and 15 U = randi([15]) and //function 2 function [sp] = Calculate_S_P(U); //Body of function 2 for b=0:U // body of for loop end So you'd now call it like this: [tp, U] = Calculate_T_P() Calculate_S_P(U) Option 2 This is most likely a neater option and that is to pass U into both your functions and calculate it right at the start: function [tp] = Calculate_T_P(U); %//body of function 1, no longer define U here and //function 2 function [sp] = Calculate_S_P(U); //Body of function 2 for b=0

Categories : Matlab

How to do signature using stylus and save it as image in Android?
I have seen this link.Don't know this the exactly the one which you wantPlease visit this and hope this helps.

Categories : Android

Is it possible to accept stylus input on a HTML5 web page
It's perfectly possible as long as the device your client will be using supports touch input using stylus. You can see this tutorial to see how to use <canvas> element to create a simple drawing app. To see which browsers support canvas, see this page.

Categories : Javascript

Node express middleware coffee/stylus
I would highly recommend checking out Asset Rack, which both will give you a consistent interface for compiling files, and has a lot of benefits around running automatically at server startup and fingerprinting to enable forever caching.

Categories : Node Js

Using the same instance of an object as the argument and as the calling object in calling a function
This will not be a problem functionally, but logically if the function must take an object as an argument, you should make this function static. In addition, since you are not modifying the incoming object, you should make the argument const. Finally, since copying the object may be more expensive than copying a reference, you may want to change the argument to be passed by reference. static void Complex::magnitude(const Complex &c); ... Complex myComplex(...); Complex::magnitude(myComplex);

Categories : C++

change default stylus pointer style in android
I got a solution for Smasung devices. After digging into SPen SDK sources, I come to know it is very easy to change hover Icon. You just need to use this function public boolean setSPenCustomHoverIcon(Context paramContext, View paramView, Drawable paramDrawable); you just need to pass, application context, View and Drawable Icon.

Categories : Android

Calling a view function from render function
I don't see a var self = this anywhere so presumably your self is window.self and that's not what you want. You have various options: Grab this in a variable: var _this = this; // Don't use `self` for the reasons noted above Mousetrap.bind(['mod+s'], function(e) { _this.group_save(e); }); Use a bound function: Mousetrap.bind(['mod+s'], _(this.group_save).bind(this)); You can also use $.proxy or Function.bind (or some other library's version of function binding) if you prefer those over _.bind. Bind group_save per-instance: initialize: function() { _.bindAll(this, 'group_save'); }, render: function() { Mousetrap.bind(['mod+s'], this.group_save); //... I don't know anything about Mousetrap but it might allow you to specify a this (possibly referred to as context)

Categories : Backbone Js

C++ - Calling a function inside the same function's definition
A function calling itself is known as a recursive function. This works because the compiler only needs the declaration of a function, not its definition, for you to be able to call it. The first line of the definition also serves as a declaration. (For details, see § 8.4.1.2 of the C++11 standard.) Recursion is well-suited to solve many problems. The typical example of a recursive function is the factorial function. It is defined as factorial(n) = n * factorial(n-1). You can try running this piece of code to get a bit more understanding of what happens when a function calls itself: #include <iostream> int factorial(unsigned int n) { std::cout << "Computing factorial of " << n << " "; int result; if (n == 0) { result = 1; } else {

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.