w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Post javascript variables to separate .PHP file (Using Ajax?)
Edit: You mentioned in a comment on another answer that you're using jQuery, so I've edited the below. Is this possible to do with out ajax? Yes, but you probably don't want to. You'd do it by creating a form element, setting its action, setting its method, adding fields to it, and submiting it: var form; form = $("<form>") .attr("action", "/path/to/php/file.php") .attr("method", "POST"); $("<input type=hidden>") .attr("name", "fieldName1") // I'm assuming hardcoded field names .val(fieldValue1) // And values coming from variables .appendTo(form); $("<input type=hidden>") .attr("name", "fieldName2") .val(fieldValue2) .appendTo(form); form[0].submit(); // Note the [0], so we're using `submit` on the actual HTMLFormElement

Categories : PHP

How to use included library functions in a C++ header file to define private variables
As has been mentioned by @WhozCraig there is no problem with the classes names, nor the classes are inside a scope. So my best guess is that you are trying to instantiate a member variable (_coreIP) outside a method. You should fist declare the member variable on the class declaration, and then instantiate it on the constructor of the class. So change this. class Codex { ... private: ... IPAddress _coreIP(000,000,0,00); }; for this class Codex { public: ... Codex(); private: ... IPAddress _coreIP; }; Codex::Codex() : _coreIP(000,000,0,00) { ... } You can instantiate member variables directly on the constructor of the class, using the : operator as is showed here. By the way, this is my first answer, so I hope I had done it well :) Greetings

Categories : C++

Reference variables in a separate less file using SquishIt (support dynamic LESS content)?
You are right, SquishIt does the less processing before combining files. There is no way to do what you ask using only SquishIt, but I suppose you could combine the files on your own on the way in (use the .AddString method to add your resulting .less content to the bundle). One of the alternatives may suit your needs better, I'm not sure.

Categories : CSS

What is the most stable and Pythonic cross-platform way to separate a string of path,filename,ext into three separate variables?
I tend to use os.path module, which has several versions depending on the OS that you're running. But importing os.path should always give you the right one. If you can you could check the OS you're using manually: import platform platform.platform() and then import the appropriate path toolkit from os. But it sure is a lot easier to just go import os.path. So what would be of interest to you is: os.path.basename(path) # To get the name of the file with extension. os.path.basename(path).split('.')[0] # To get just the name. os.path.dirname(path) # To get the directory leading to the file. Hope this helps. CAVEAT: I give no guarantee this is THE best way to do it.

Categories : Python

Accessing declared variables inside a #define from another #define
If the struct is declared static within a function, its visibility will be limited to that function. Example (without macros): struct hoppa { int i; }; void start(void) { static struct hoppa one = {1}; } void use_it(void) { one.i = 2; //FAIL }

Categories : C

Define handlebars scripts in a separate directory
IMO if you are not a rails developer then one of the best option would be indeed grunt or much better yeoman (http://yeoman.io/). Using the generator-ember (https://github.com/yeoman/generator-ember) and yeoman togheter will get you up and running in no time. For example after installing yeoman and the generator-ember you can create a full project structure with a simple yo ember, this will create all the necessary folder for views/controller/routes/templates where you can start coding right away. You should give it a try. Edit As stated in the comment of @Toran Billups, the ember core team is working on this project (https://github.com/stefanpenner/ember-app-kit) which will be grunt based and it will work using modules and much more awesome stuff. Hope it helps.

Categories : Ember Js

cannot open file '%f' webstorm
This is something I have no idea why it was showing that message. But upon research,, I found in the menu properties there is the extra "%f" at the end. Remove that, voila. It works with no annoying error.

Categories : Misc

how to define separate controller for an included view in Angular.js?
I think you can use ng-include to achieve it: In view1.html <div ng-include src="'view3.html'"></div> //other template for view1 In view2.html <div ng-include src="'view3.html'"></div> //other template for view2 In view3.html <div ng-controller='controller3'> //template for view3 </div>

Categories : Javascript

How to define separate wsdl for different services in a same spring-WS project?
The easiest, I guess its tedious approach but what I did was that I added a new bean for a different 1+ service in the; i call it wiring config file (also known as application.xml, spring-config.xml). So this what I had: <bean id="SmallBusinessAccount" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true"> <property name="schemaCollection"> <bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection"> <property name="inline" value="true" /> <property name="xsds"> <list> <value>schemas/SmallBusinessAccountSerivceOperations.xsd</value> </list> </property> </bean> </

Categories : Java

WebStorm Linking to a .js file in HTML
No idea what 'Webstorm' is, but your HTML contains no reference to the jQuery library. This is where $ is defined. At the following above your existing <script> tag: <script type="text/javascript" src="[ PATH TO JQUERY ]"></script>

Categories : Javascript

there is __cond_lock(x,c) define in compiler.h file , but no __cond_unlock(x,c) define?
Protecting critical sections using locking is up to the programmer. That means, if you hold a lock to protect a critical reason, you've must have to release the lock when you're finished. There are various types of locking primitives inside Linux kernel like. spinlock(), spinlock_irq(), spin_trylock(). They have their own purposes. Now, spin_trylock() using __cond_lock inside of it, it's because to make sure, whether that particular lock is available for locking or it's been already taken. Take a look at few examples of how spin_trylock or __cond_lock is being used. For ex. at kernel/sched/fair.c::rebalance_domain (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/sched/fair.c?id=d8dfad3876e4386666b759da3c833d62fb8b2267#n5574) see how the balancing is used, it's

Categories : Linux

Webstorm - Link html class reference to scss file
As @Iena said, it's not possible. Try voting for the issue (http://youtrack.jetbrains.com/issue/WEB-6737) and JetBrains may add the feature.

Categories : Intellij Idea

R: How to sum two separate values of two variables?
I think I see what you're trying to do here. You want to treat interactions between the two ageGroup columns as being non-directional and get the mean interaction? The code below should do this using base R functions. Note that since the example dataset is truncated, it will only give a correct answer for the group with index 01. However if you run with the full dataset, it should work for all interactions. # Create the data frame df=read.table(header=T,text=" ageGroup,ageGroup1,mij 0,0,0.012093848 0,1,0.005104852 0,2,0.003749191 0,3,0.003072414 0,4,0.002544871 0,5,0.00213734 0,6,0.001825658 0,7,0.001590367 1,0,0.004750975 1,1,0.007483292 1,2,0.004271233 1,3,0.003196222 1,4,0.002875221 1,5,0.002577734 1,6,0.002303226 1,7,0.00205266 ",sep=",") df # Using the strSort function from t

Categories : R

Separate strings to variables
Simple awk command will give you your output: awk -F ":" '{sub(/^ +/, "", $2); print $1"|"$2}' file But have to say that your question is vague and its not clear if this is really what you need.

Categories : Perl

How to separate variables in to arrays of 3?
I think this post might help: Split string into array of equal length strings Applying it to your code, you could replace: var arr = Array.prototype.slice.call(dna), output = []; while (arr.length) output.push(arr.splice(0, 3).join(''); with: var arr = text.match(/.{1,3}/g);

Categories : Javascript

What is the best way to define dependent variables in an object?
To reference toWhom while creating person, you can either store the value in a separate variable: var toWhom = appv2.prototype.toWhom = 'Mohamed'; appv2.prototype.person = new person(toWhom); Or, reference it from the prototype, as you suspected: appv2.prototype.person = new person(appv2.prototype.toWhom); The reason this.toWhom is undefined is because this doesn't refer to an instance of appv2 there.

Categories : Javascript

How to separate different values and make them variables
If you already use perl, I may suggest something like this: #!/usr/bin/perl use strict; use warnings; my $name; while (<DATA>) { if ($. % 2) { chomp; ($name = $_)=~ s/s+$//; next; } if (/HOST=([^)]+)/i) { print "$name,active,$1 "; } else { print "$name,inactive "; } } __DATA__ db2 Attempting to contact (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=db2))) OK (0 msec) db1 Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL= TCP)(Host= 10.1.1.1)(Port= 1521)) (CONNECT_DATA = (SERVICE_NAME = db1))) OK (0 msec) xdb3 TNS-03505: Failed to resolve name Output: db2,active,server1 db1,active, 10.1.1.1 xdb3,inactive Of course you should use the input file, instead of the DATA file handle.

Categories : Perl

What's the most optimal way to define module variables in nodejs?
...which of the two methods produce the most optimized code... I'd be surprised if there were a difference in the actual machine code V8 produces when it compiles the source (other than debug info). I can't believe there's any difference that has any real-world impact from the difference in character count, and the fact that the one produces a single statement using the comma operator to join multiple expressions and the other produces a series of statements (one expression/statement). It really is just a style thing. For this: // Style 1 var express = require('express') , socketio = require('socket.io') , bench = require('./bench'); The engine actually processes this: // Style 1 var express, socketio, bench; express = require('express'), socketio = require('socket.io'), benc

Categories : Javascript

Using class to define multiple variables in python
A method in Python is a function. If you want to get a value from a member function you have to end it with (). That said, some refactoring may help eliminate boilerplate and reduce the problem set size in your head. I'd suggest using a @property for some of these things, combined with a slight refactor class variable: def __init__(self, length): self.length = length # time length` @property def state_dynamic(self): return self.np_length @property def state_static(self): return self.np_length @property def control_dynamic(self): return self.np_length @property def control_static(self): return self.np_length @property def scheduling(self): return self.np_length @property def np_length(self): return np.zeros(2, np.size(self.length)) That way you can us

Categories : Python

how to define methods that use the variables of some other controller in rails 3
What you need here is an association at the model level in between the Tweet model and Coordinate model, like this: class Tweet < ActiveRecord::Base has_one :coordinate end this tells that a tweet have coordinate. the problem is not about accessing variables from one controller to another(that should never happen unless it is parent-child controllers) but the problem is that you dont associations between models properly setup.

Categories : Ruby On Rails

How do we separate variables from letters in shell scripting
With braces: echo "${ANIMAL}s are the best." With quotes: echo "$ANIMAL"'s are the best.' With printf: printf '%ss are the best. ' "$ANIMAL" I wouldn't use the quotes one most of the time. I don't find it readable, but it's good to be aware of.

Categories : Bash

php pass array to function as separate variables
If I am understanding your question right then try this $return = myfunction($myarray["key"],$myarray["data"]); here we are simply passing the associative array as arguments.

Categories : PHP

How should I define instance variables made up of multiple words?
The common practise among Ruby programmers is to use the snake case notation for variable names, i.e. @instance_variable. See, for example, the GitHub style guide or the Unofficial Ruby usage guide.

Categories : Ruby

What's does it mean of" /* overloaded elements data types */ #define OE_IS_ARRAY (1<<0) #define OE_IS_OBJECT (1<<1) #define OE_IS_METHOD (1<<2)"?
This is usually used to make it unambiguous that you're talking about bit flags. 1, 2, and 4 will make most programmers realize that we're talking about a sequence of powers of 2; not everyone will instantly know that 1<<14 is 16384. The compiler will do these computations for you, so it will not slow the program down. It's all about clarity. You'll sometimes also see these things written in hexadecimal, because that maps more closely to the underlying binary representation than decimal constants and can be more compact.

Categories : PHP

How to use global variables with functions in separate files in python?
Could you please directly use **random2.mine** instead of declaring it global again, which makes separate copy of mine variable in random1's namespace. random2.mine = 50 print(random2.mine) # Another way of modifying attributes of imported module is random2.__dict__[mine] = 100 print(random2.mine) http://docs.python.org/2/tutorial/classes.html#python-scopes-and-namespaces http://stackoverflow.com/questions/6841853/python-accessing-module-scope-vars

Categories : Python

how to store specific output of ec2din in separate variables
Store the output first on a variable then reuse it on other commands: output=$(ec2din "${instance[n]}" --region "$i") ec2url=$(echo "$output" | grep INSTANCE | awk '{print($4)}') size=$(echo "$output" | grep INSTANCE | awk '{print($9)}') comment=$(echo "$output" | grep TAG | awk '{print($5)($6)($7($8)}') And you could actually just exclude grep and just use awk: output=$(ec2din "${instance[n]}" --region "$i") ec2url=$(echo "$output" | awk '/INSTANCE/{print($4)}') size=$(echo "$output" | awk '/INSTANCE/{print($9)}') comment=$(echo "$output" | awk '/TAG/{print($5)($6)($7($8)}') Another way is to use here strings instead of using echo: output=$(ec2din "${instance[n]}" --region "$i") ec2url=$(awk '/INSTANCE/{print($4)}' <<< "$output") size=$(awk '/INSTANCE/{print($9)}' <<

Categories : Bash

Is there an easy way to separate categorical vs continuous variables into two dataset in R
I'm using iris data set avaialbe in R. Then sapply(iris, is.factor) Sepal.Length Sepal.Width Petal.Length Petal.Width Species FALSE FALSE FALSE FALSE TRUE will tell you weather your columns are factor or not. So using iris[ ,sapply(iris, is.factor)] you can pick factor columns only. And iris[ ,!sapply(iris, is.factor)] will give you those columns which are not factor. You can also use is.numeric, is.character and different other versions.

Categories : R

Need to compare 2 variables, each coming from a separate data set, and flag differences
I would do a PROC FREQ on each dataset (or proc whatever-you-like-that-does-counts) and then use PROC COMPARE. For example: proc freq data=rslt1; tables accsnnum*ibtestcd/out=rsltcounts; run; proc freq data=lab1; tables accsnnum*ibtestcd/out=labcounts; run; proc compare base=lab1 compare=rslt1 out=compares /* options */; by accsnnum; run; PROC COMPARE has a lot of options; in this case the most helpful would probably be: outnoequal - only outputs rows for each row that are not identical in the two datasets outbase and outcomp - outputs a row for each of BASE and COMPARE datasets (if OUTNOEQUAL, then only when they differ) outdif - outputs 'difference' rows, ie, one minus the other; this may or may not be helpful for you The documentation lists all of the options. You may also ne

Categories : SQL

barplot x-axis labels with hierarchical grouping variables in separate rows
A bit of manual adjustment of the margins and calling axis() twice can get you there. Saving a barplot like bp <- barplot(...) saves the midpoints of each bar for future reference. oldpar <-par(mar=c(7,5.1,4.1,2.1)) bp <- barplot(a, col=c("blue","red","purple"), ylab="Frequency of Interpretation", xlab="", main="Frequency of BrP and AmE Interpretations of NPs in Neutral Environments", axisnames=FALSE ) You can then use the values stored in bp to align things properly. You can align the group and sub-group labels using the line=... argument to axis() avgpts <- tapply(bp,rep(1:3,each=2),mean) grps <- c("Bare NP","Singular-Marked NP","Plural-Marked NP") subgrps <- c("BrP","AmE") axis(1,at=bp,labels=rep(subgrps,3), cex.axi

Categories : R

How to save variables to a file so that those variables are loaded the next time the site runs?
You can use local storage or even cookies. local storage is your best bet, although it doesn't work in older browsers. cookies are (more) limited in their capacity (4KB vs 5MB for local storage) and also are sent to the server with each request, which may not be what you want. Alternatively, you can store the state on your server (you'll need some server side scripting as well), and only store a user/gamer id in a cookie.

Categories : Javascript

Is it ok to place all JS / jQuery variables at top of file? Global variables?
Global variables are scoped to the program, so if you pull in other javascript that also uses the same global variable names you will almost certainly encounter bugs. If you're writing something fairly small there's certainly nothing (technically) wrong with declaring all of your variables as global, but if you're writing something that's going to grow it might be to your benefit to use some form of module pattern to provide another level of scope to your variables and minimize the use of Globals. With a module pattern you can usually reduce your global variables down to the Module namespace, with what would normally be globals, scoped only up to the module.

Categories : File

Calling Remote EJB3 in separate EAR file from JSF in another EAR file on WAS 8
The @EJB annotation (and corresponding <ejb-ref> in XML) will only automatically link if the target EJB is in the same application. From the javadoc: If no explicit linking information is provided and there is only one session bean within the same application that exposes the matching client view type, by default the EJB dependency resolves to that session bean. To link to an EJB in another application, you need to specify a binding. You can do this in several ways: Specify <lookup-name>targetBindingName</lookup-name> in the <ejb-ref> in ejb-jar.xml. Specify <ejb-ref name="EJB/BelgianBeerSessionBean" binding-name="targetBindingName"/> in the WEB-INF/ibm-web-bnd.xml file of the WAR module containing the ejb-ref. See the InfoCenter for more info

Categories : JSF

Define Log file in Logback
Hey I have written few tutorial, I guess it would help you in understanding logback and how can you achieve you above task. Check https://github.com/abdulwaheed18/Slf4jTutorial

Categories : Misc

File Global Define
It seems you're misunderstanding what a library is and what it's used for. Most (all?) linkers already do what you're trying by not including unreferenced symbols from libraries - it's why with gcc, for instance, you need to put the libraries at the end of the command line after the list of source files that contain references to library functions. What you're doing seems to be confusing this behaviour with compile-time options for the library itself. In that case, you can use the #ifndef blocks as you have in lib.h and lib.c, but you shouldn't need to do anything in main.c - the library will already have been built without complexFunction. You may want to have your library build process generate a header that describes which functionality is available.

Categories : C

Possible to have separate "namespace" in one file?
You can have hiding in the sense that the declaration of the static function or static variable can follow after the function it is hiding from. Using a macro, you can hack your way into hiding a function or variable after it has been defined. static void foo () { /* ... */ } static int g_hidden_from_foo; static void bar () { /* can use foo() */ } #define foo foo_is_now_private /* effectively hides foo */ This may satisfy your curiosity, but I can't say it is convenient (or wise). If you are open to using compiler extensions, GCC has nested functions, which is more or less similar to anonymous functions.

Categories : C

Use Separate Elements From XML File
Parse it into an XmlDocument, then pull the values you require with XPath: XmlDocument xml = new XmlDocument(); xml.LoadXml(yourXmlString); string toolVersion = xml.SelectSingleNode("/DiagReport/LicensingData/ToolVersion").InnerText; string result = xml.SelectSingleNode("/DiagReport/Health/Result").InnerText You can learn more about XPath at W3Schools XPath Tutorial. Or you can use XDocument: XDocument xml = XDocument.Parse(yourXmlString); string toolVersion = xml.Element("DiagReport").Element("LicensingData").Element("ToolVersion").Value; string result = xml.Element("DiagReport").Element("Health").Element("Result").Value; Note that this assumes that all of the referenced elements exist.

Categories : C#

separate log file for exception
Update log4j.properties with the following and check. # add an extra category to a log file log4j.category.yourPackage=ERROR,ERR # Skip to write default logger log4j.additivity.yourPackage=false # ERR is set to be a FileAppender which will log Error actions in the application. log4j.appender.ERR=org.apache.log4j.RollingFileAppender log4j.appender.ERR.Threshold=ERROR log4j.appender.ERR.layout=org.apache.log4j.PatternLayout log4j.appender.ERR.file=logs/error.log

Categories : Tomcat

Define compiler for current file in vim
Use a makefile: au BufNewFile,BufRead *.m map <Leader>r :make -f ~/.vim/global.make %<cr> I think you can write a makefile that will do different stuff based on the type of its argument.

Categories : Vim

How can I define the complexType in XML schema file?
You should move definition of personInfo type under xs:schema element, i.e. on the same level, as definition of xyz. Other constructions should be ok. If your schema doesn't define target namespace (i.e. namespace into which defined elements and types belong) you haven't refer to your complex types with prefix in type attribute. But I think it is better to define target namespace (and corresponding prefix) and then you have to write it in qualified form, like type="myNs:personInfo".

Categories : Xml

Putting a bit of Javascript in a separate file?
Remember that you have to do things in order. You can't include this file if you didn't include jQuery before. <html> <head> <title>...</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript" src="path/to/your/script.js"></script> </head> <body> <!-- your content --> </body> </html> After you have the correct order, you will be able to execute your scripts. If your $(function(){ ... }); call doesn't work, try using it this way: $(document).ready(function() { // Your code here }); and see if it works.

Categories : Javascript



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