Thursday 15 August 2013

c# - Multiple files in .NET Resources -



c# - Multiple files in .NET Resources -

you can have 2 resources files in visual studio resources same name, 1 of intended test environments , other production environments?

no, depending on "resource".

if edit application's resources in resources tab of application's properties. can see there no way add together flag debug or release.

if resource file, could add together 2 files project, 1 debug , other release, in application's pre-build event re-create right 1 on after adding 3rd filename resources.

c# visual-studio-2013 resources

jquery - Popup message with location.replace -



jquery - Popup message with location.replace -

i trying redirect user page upon registeration using next line:

window.location.replace(value2);

where value2 url. attach message appears popup window it. thought how can achieved?

try this

var value2 = "samp2.php?success=yes"; window.location.replace(value2);

in samp2.php

write in first line

if(isset($_get['success']) && $_get['success'] == "yes") { print '<script type="text/javascript">'; print 'window.onload = function(e){'; print 'alert("welcome page 2")'; print '};'; print '</script>'; } //header("refresh:1,url=samp.php"); // optional

jquery ajax window

java - javax.servlet.UnavailableException: EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap - running Struts 1.3.5 on Jetty 9.2.2 -



java - javax.servlet.UnavailableException: EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap - running Struts 1.3.5 on Jetty 9.2.2 -

i in process of migrating jetty 8.1.5 9.2.2. our app uses spring , back upwards of old struts controllers.

we utilize struts 1.3.5. when start server, maintain getting next exception.

does mean, need migrate struts well? there solution prepare this?

i tried on java 7 , 8. same thing happens. please suggest.

javax.servlet.unavailableexception: edu/oswego/cs/dl/util/concurrent/concurrenthashmap @ org.apache.struts.action.actionservlet.init(actionservlet.java:399) @ javax.servlet.genericservlet.init(genericservlet.java:244) @ org.eclipse.jetty.servlet.servletholder.initservlet(servletholder.java:600) @ org.eclipse.jetty.servlet.servletholder.getservlet(servletholder.java:462) @ org.eclipse.jetty.servlet.servletholder.handle(servletholder.java:742) @ org.eclipse.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1667) @ org.eclipse.jetty.websocket.server.websocketupgradefilter.dofilter(websocketupgradefilter.java:172) @ org.eclipse.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1650) @ org.eclipse.jetty.servlet.servlethandler.dohandle(servlethandler.java:583) @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:143) @ org.eclipse.jetty.security.securityhandler.handle(securityhandler.java:553) @ org.eclipse.jetty.server.session.sessionhandler.dohandle(sessionhandler.java:223) @ org.eclipse.jetty.server.handler.contexthandler.dohandle(contexthandler.java:1125) @ org.eclipse.jetty.servlet.servlethandler.doscope(servlethandler.java:515) @ org.eclipse.jetty.server.session.sessionhandler.doscope(sessionhandler.java:185) @ org.eclipse.jetty.server.handler.contexthandler.doscope(contexthandler.java:1059) @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:141) @ org.eclipse.jetty.server.handler.contexthandlercollection.handle(contexthandlercollection.java:215) @ org.eclipse.jetty.server.handler.handlercollection.handle(handlercollection.java:110) @ org.eclipse.jetty.server.handler.handlerwrapper.handle(handlerwrapper.java:97) @ org.eclipse.jetty.server.server.handle(server.java:485) @ org.eclipse.jetty.server.httpchannel.handle(httpchannel.java:290) @ org.eclipse.jetty.server.httpconnection.onfillable(httpconnection.java:248) @ org.eclipse.jetty.io.abstractconnection$2.run(abstractconnection.java:540) @ org.eclipse.jetty.util.thread.queuedthreadpool.runjob(queuedthreadpool.java:606) @ org.eclipse.jetty.util.thread.queuedthreadpool$3.run(queuedthreadpool.java:535) @ java.lang.thread.run(thread.java:722)

the class missing war's web-inf/lib

edu/oswego/cs/dl/util/concurrent/concurrenthashmap

that original implementation of concurrenthashmap of became java.util.concurrent bundle in java 1.5

just checked 8.1.5.v20120716

[jetty-distribution-8.1.5.v20120716]$ find lib -name "*.jar" -exec jar -tvf {} \; |\ grep -i edu.oswego

jetty not come these classes (nor have exceptions in webappclassloader allow them used server classloader)

something else in configuration must have added them you.

look backport-util-concurrent jars , add together them web-inf/lib directory.

java jetty struts struts-1 jetty-9

c++11 - C++: Parsing a string of numbers with parentheses in it -



c++11 - C++: Parsing a string of numbers with parentheses in it -

this seems trivial can't seem around this. have stl strings of format 2013 336 (02 dec) 04 (where 04 hour, that's irrelevant). i'd extract day of month (02 in example) , month hour.

i'm trying cleanly , avoid e.g. splitting string @ parentheses , working substrings etc. ideally i'd utilize stringstream , redirect variables. code i've got right is:

int year, dayofyear, day; std::string month, leftparenthesis, rightparenthesis; std::string examplestring = "2013 336 (02 dec) 04"; std::istringstream yeardaymonthhourstringstream( examplestring ); yeardaymonthhourstringstream >> year >> dayofyear >> leftparenthesis >> day >> month >> rightparenthesis >> hour;

it extracts year , dayofyear alright 2013 , 336 things start going badly. day 0, month , empty string, , hour 843076624.

leftparenthesis (02 contains day when seek omit leftparenthesis variable while redirecting yeardaymonthhourstringstream stream day 0.

any ideas on how deal this? don't know regular expressions (yet) and, admittedly, not sure if can afford larn them right (timewise).

edit ok, i've got it. although billionth time when create life much easier regex, guess it's time. anyway, worked was:

int year, dayofyear, day, month, hour, minute, revolution; std::string daystring, monthstring; yeardaymonthhourstringstream >> year >> dayofyear >> daystring >> monthstring >> hour; std::string::size_type sz; day = std::stod( daystring.substr( daystring.find("(")+1 ), &sz ); // convert day number using c++11 standard. ignore ( may @ beginning.

this still requires handling of monthstring, need alter number anyway, isn't huge disadvantage. not best thing can (regex) works , isn't dirty. knowledge vaguely portable , won't stop working new compilers. everyone.

the obvious solution is utilize regular expressions (either std::regex, in c++11, or boost::regex pre c++11). capture groups you're interested in, , utilize std::istringstream convert them if necessary. in case,

std::regex re( "\\s*\\d+\\s+\\d+\\s*\\((\\d+)\\s+([[:alpha:]]+))\\s*(\\d+)" );

should trick.

and regular expressions quite simple; take less time larn them implement alternative solution.

for alternative solution, you'd want read line character character, breaking tokens. along line:

std::vector<std::string> tokens; std::string currenttoken; char ch; while ( source.get(ch) && ch != '\n' ) { if ( std::isspace( static_cast<unsigned char>( ch ) ) ) { if ( !currenttoken.empty() ) { tokens.push_back( currenttoken ); currenttoken = ""; } } else if ( std::ispunct( static_cast<unsigned char>( ch ) ) ) { if ( !currenttoken.empty() ) { tokens.push_back( currenttoken ); currenttoken = ""; } currenttoken.push_back( ch ); } else if ( std::isalnum( static_cast<unsigned char>( ch ) ) ) { currenttoken.push_back( ch ); } else { // error: illegal character in line. you'll // want throw exception. } } if ( !currenttoken.empty() ) { tokens.push_back( currenttoken ); }

in case, sequence of alphanumeric characters 1 token, single punctuation character. go further, ensuring token either alpha, or digits, , maybe regrouping sequences of punctuation, seems sufficient problem.

once you've got list of tokens, can necessary verifications (parentheses in right places, etc.), , convert tokens you're interested in, if need converting.

edit:

fwiw: i've been experimenting using auto plus lambda means of defining nested functions. mind's not made whether it's thought or not: don't find results readable. in case:

auto pushtoken = [&]() { if ( !currenttoken.empty() ) { tokens.push_back( currenttoken ); currenttoken = ""; } }

just before loop, replace of if pushtoken(). (or create info construction tokens, currenttoken , pushtoken fellow member function. work in pre-c++11.)

edit:

one final remark, since op seems want exclusively std::istream: solution there add together mustmatch manipulator:

class mustmatch { char m_tomatch; public: mustmatch( char tomatch ) : m_tomatch( tomatch ) {} friend std::istream& operator>>( std::istream& source, mustmatch const& manip ) { char next; source >> next; // or source.get( next ) if don't want skip whitespace. if ( source && next != m_tomatch ) { source.setstate( std::ios_base::failbit ); } homecoming source; } }

as @angew has pointed out, you'd need >> months; typically, months represented class, you'd overload >> on this:

std::istream& operator>>( std::istream& source, month& object ) { // sentry takes care of skipping whitespace, etc. std::ostream::sentry guard( source ); if ( guard ) { std::streambuf* sb = source.rd(); std::string monthname; while ( std::isalpha( sb->sgetc() ) ) { monthname += sb->sbumpc(); } if ( !islegalmonthname( monthname ) ) { source.setstate( std::ios_base::failbit ); } else { object = month( monthname ); } } homecoming source; }

you could, of course, introduce many variants here: month name limited maximum of 3 characters, illustration (by making loop status monthname.size() < 3 && std::isalpha( sb->sgetc() )). if you're dealing months in way in code, writing month class , >> , << operators you'll have sooner or later anyway.

then like:

source >> year >> dayofyear >> mustmatch( '(' ) >> day >> month >> mustmatch( ')' ) >> hour; if ( !(source >> ws) || source.get() != eof ) { // format error... }

is needed. (the utilize of manipulators technique worth learning.)

c++ c++11 stringstream

Python combine two for loops and not over repeat -



Python combine two for loops and not over repeat -

when

import itertools x, y in itertools.product([1,2,3], [1,2,3]): print x, y

it prints

1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3

but want out set

1 1 2 2 3 3

then why utilize itertools.product? sounds need zip.

for x,y in zip([1,2,3],[1,2,3]): print(x,y) 1 1 2 2 3 3

python loops

lua - Corona SDK physics body based on image -



lua - Corona SDK physics body based on image -

i need create lot of custom physics bodies , bad way if create custom borders manually. there way create physics body based on image or mask? images complexly, can't utilize body based on outline.

lua corona physics

python - Use sklearn to find string similarity between two texts with large group of documents -



python - Use sklearn to find string similarity between two texts with large group of documents -

given big set of documents (book titles, example), how compare 2 book titles not in original set of documents, or without recomputing entire tf-idf matrix?

for example,

from sklearn.feature_extraction.text import tfidfvectorizer sklearn.metrics.pairwise import cosine_similarity book_titles = ["the bluish eagle has landed", "i fly eagle moon", "this not how should fly", "fly me moon , allow me sing among stars", "how can fly eagle", "fixing cars , repairing stuff", "and bottle of rum"] vectorizer = tfidfvectorizer(stop_words='english', norm='l2', sublinear_tf=true) tfidf_matrix = vectorizer.fit_transform(book_titles)

to check similarity between first , sec book titles, 1 do

cosine_similarity(tfidf_matrix[0:1], tfidf_matrix[1:2])

and on. considers tf-idf calculated respect all entries in matrix, weights proportional number of times token appears in corpus.

let's 2 titles should compared, title1 , title2, not in original set of book titles. 2 titles can added book_titles collection , compared afterwards, word "rum", example, counted including 1 in previous corpus:

title1="the book of rum" title2="fly safely bottle of rum" book_titles.append(title1, title2) tfidf_matrix = vectorizer.fit_transform(book_titles) index = tfidf_matrix.shape()[0] cosine_similarity(tfidf_matrix[index-3:index-2], tfidf_matrix[index-2:index-1])

what impratical , slow if documents grow big or need stored out of memory. can done in case? if compare between title1 , title2, previous corpus not used.

why append them list , recompute everything? do

new_vectors = vectorizer.transform([title1, title2])

python scikit-learn

c++ - Append extension to a string passed by reference -



c++ - Append extension to a string passed by reference -

in code, next i.e. pass name of string becomes filename write to, when string name passed reference, unable utilize + operator overloading append *.txt filename, same code shown below:

void myfunction (string &filename){ (1) filename += ".txt"; fstream file; file.open(filename, iostream::out); }

vs2012 intellisense shows error @ += saying "no operator matches these operands" tried passing adding, mean += operator can't used on string names passed reference. @ to the lowest degree thats understand.

but when re-create filename reference string , utilize that, produces file without name i.e. .txt file.

string myname = filename; filename += ".txt"; @ (1)

the file produced without name. thought have gone wrong?

c++ file visual-studio-2012

c# - How to reuse style with two different bindings? -



c# - How to reuse style with two different bindings? -

i have style:

<style x:key="blinkstyle"> <style.triggers> <datatrigger binding="{binding path=blinkforerror, relativesource={relativesource findancestor, ancestortype={x:type loc:devicesrepositoryeditorusercontrol}}}" value="true"> <datatrigger.enteractions> <beginstoryboard name="blinkbeginstoryboard"> <storyboard> <coloranimation to="red" storyboard.targetproperty="(background).(solidcolorbrush.color)" fillbehavior="stop" duration="0:0:0.4" repeatbehavior="forever" autoreverse="true" /> </storyboard> </beginstoryboard> </datatrigger.enteractions> <datatrigger.exitactions> <stopstoryboard beginstoryboardname="blinkbeginstoryboard" /> </datatrigger.exitactions> </datatrigger> </style.triggers> </style>

whenever bound dependency-property blinkforerror set true, start blinking. works great, this:

<!-- when blinkforerror set true, textbox, named "one", blinks: --> <textbox name="one" style="{staticresource resourcekey=blinkstyle}"/>

thing want same thing, bound dependency-property, anotherblinkforerror:

<!-- when anotherblinkforerror set true, textbox, named "two", blinks: --> <textbox name="two" style="{staticresource resourcekey=anotherblinkstyle}"/>

i can duplicate whole style , alter datatrigger's binding part.

is there way avoid duplication, reuse same style twice 2 different bindings?

you seek , create utilize of tag properties on textboxes , bind them blinkforerror , blinkforanothererror. in style definition binding check tag value (you'd have utilize relativesource , findancestor options) instead of blink properties.

but honest, if there 2 textboxes , respective error properties go 2 separate styles it's less hassle.

c# wpf xaml binding wpf-style

Linux shell scripting - Simple awk script issue -



Linux shell scripting - Simple awk script issue -

i'm trying simple awk script exercise , cannot figure why isn't working.

the awk script should used display entries begining 2012, given next input file:

2009 dec x 29.44 2009 dec y 32.32 2012 jan x 321.11 2012 feb y 1.99 2012 feb x 32.99 2012 mar x 11.45 2010 jan x 14.75 2011 feb y 21.00 2011 mar x 7.77

the output should follows:

% awk -f awkscriptfile inputfile info year 2012 ================== jan : 321.11 feb : 1.99 feb : 32.99 mar : 11.45 =================== volume 2012 is: 367.54 4 records processed %

however, this:

% awk -f awkscriptfile inputfile info year 2012 ================================== 2009 dec x 29.44 2009 dec y 32.32 2012 jan x 321.11 jan : 321.11 2012 feb y 1.99 feb : 1.99 2012 feb x 32.99 feb : 32.99 2012 mar x 11.45 mar : 11.45 2010 jan x 14.75 2011 feb y 21.00 2011 mar x 7.77 ================================== volume 2012 is: $sum $count records processed %

so awk script printing out lot more should, , reason sum , count variables aren't beingness printed.

this code awk script:

begin { print "data year 2012" print "==================================" count = 0 sum = 0 } $1 ~ /2012/ { print $2, " : ", $4 count++ sum += $4 } end { print "==================================" print "volume 2012 is: $sum" print "$count records processed" }

from i'm looking @ reference, see no reason why code shouldn't work. else can tell me i'm doing wrong.

awk -v y="2012" '$1==y{a[nr]=$2":"$4;s+=$4;c++} end{line="==================="; printf "data year %s\n%s\n",y,line; for(i=1;i<=nr;i++)if(a[i])print a[i] printf "%s\nvolume %s is: %.2f\n%d records processed\n", line, y, s, c}' file

with data, outputs:

data year 2012 =================== jan:321.11 feb:1.99 feb:32.99 mar:11.45 =================== volume 2012 is: 367.54 4 records processed

linux shell awk

ios - Correct Certification but provisioning profile invalid -



ios - Correct Certification but provisioning profile invalid -

is there bug in xcode 6.1 because happen 2nd time now. provisioning profile became invalid has right certification.

this way update provisioning profile

create new certrequest create new distribution/development cert

edit: these first 2 steps executed once.

update old provisioning profile newly created cert

edit: step of import because old cert has expired.

open xcode 6.1 xcode > preferences > accounts >view details > refresh open iphone configuration utility check if updates

and when compile app compiles fine after 24hrs , checked 1 time again in fellow member center it's invalid has right cert

additional info: have 2 distribution cert oct 19,2015 , oct 20,2015 , i'm using oct 20,2015 because has certrequest in there

i'm still investigating far problem when revoke force cert create new 1 provisioning profile became invalid.

ios xcode provisioning-profile

Created nodes don't appear to be added to the neo4j database -



Created nodes don't appear to be added to the neo4j database -

i’ve created couple of nodes in neo4j database within groovy app, when connect database using shell client don’t appear there.

the database i’m creating described in http://neo4j.com/docs/stable/tutorials-java-embedded-hello-world.html:

def graphdb = new graphdatabasefactory().newembeddeddatabase("/tmp/foo.db"); transaction tx = graphdb.begintx() def firstnode = graphdb.createnode(); firstnode.setproperty("message", "hello, "); def secondnode = graphdb.createnode(); secondnode.setproperty("message", "world!"); tx.success(); system.err.print(firstnode.getproperty("message")); system.err.print(relationship.getproperty("message")); system.err.print(secondnode.getproperty("message")); graphdb.shutdown()

after running app, can see database has been created on filesystem, when connect shell client, appears there no nodes in database:

$ ./neo4j-community-2.1.5/bin/neo4j-shell -path /tmp/foo.db/ -v neo4j-sh (?)$ match (m) homecoming m; +---+ | m | +---+ +---+ 0 row

what might doing wrong?

you didn't close transaction. tx.success() marks transaction beingness successful won't commit it. finishing transaction utilize tx.close(). best practice utilize try-with-resources blocks when doing java - cares calling close() automatically.

graphdatabaseservice graphdb = ...; seek (transaction tx = graphdb.begintx()) { // stuff tx.success(); }

since code has def assume you're using groovy, not back upwards try-with-resources. hence code looks like:

def graphdb = .... transaction tx = graphdb.begintx() seek { // stuff e.g. create nodes tx.success() } { tx.close() }

neo4j

angularjs - Change view and controller without updating url or history -



angularjs - Change view and controller without updating url or history -

i creating quiz game using angularjs, there 3 layouts. 1 intro, question , bonus questions. trying create without changing url or history since users not allowed go , alter answer. possible or should trying in same route, controller , view, show hiding layouts.

or there improve way accomplish this.

thanks in advance.

you can utilize nginclude (https://docs.angularjs.org/api/ng/directive/nginclude) alter template according quiz progress, please see sample demo here http://plnkr.co/edit/jq63ulx2zrrc9rbjjzoy?p=preview

<body ng-controller="mainctrl"> <a href="" ng-click="next()">next question</a> <hr/> <div ng-include="template"></div> </body>

js:

var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) { $scope.name = 'world'; $scope.q = 1; $scope.template = "view1.html"; $scope.next = function() { if ($scope.q < 4) { $scope.q++; $scope.template = "view" + $scope.q + ".html"; } } });

angularjs

.htaccess - php url without extension -



.htaccess - php url without extension -

my subject different deprecated one, need string url without showing php filename. have items click , go edit.php page trying clicked string url.

e.g. if click 'abc' , want go page edit.php , browser displays :

http://localhost/abc

not

http://localhost/edit.php?item=abc

it's routing in symfony.

here illustration .htaccess file specific illustration above:

# turn on rewriting rewriteengine on # check request isn't real file (e.g. image) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # redirect requests blah /edit.php?item=blah rewriterule ^(.*)$ /edit.php?item=$1 [nc,l]

here docs need else http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

php .htaccess url-rewriting

Undefined Variable in template-contact.php on line 92 -



Undefined Variable in template-contact.php on line 92 -

i have wordpress website, , getting error message above form on contact page.

error message reads:

notice: undefined variable: success in /home/crea6303/public_html/westafricanplumbing.com/wp-content/themes/waseps-custom/template-contact.php on line 92

template-contact.php code is:

<?php if($success) { echo " <div class=\"info-message\" style=\"background-color: #75a226;\"> <a href=\"#\" class=\"close-info\"><i class=\"fa fa-times\"></i></a> <p><strong>".__('success:', dat_name)."</strong>".__('the message has been sent', dat_name)."</p> </div>"; } ?>

i don't have clue how prepare this...can help?

thank kindly ferg

variables undefined

r - Fine control of bar width in barplot -



r - Fine control of bar width in barplot -

i want combine 4 figures in same plot. each barplot related image plot. want bar width same width grid width in image plot. up-barplot , left-barplot.

i have pasted code follow. how can modify purpose? or can utilize ggplot2 this?

datmat <- matrix(rep(1, 100), nrow=10) op=par(oma=c(1, 1, 1, 1), mar=c(1, 1, 1, 1), lwd=0.2, cex=.5) nf <- layout(matrix(c(0, 1, 0, 2, 3, 4), 2, 3, byrow=true), widths=c(1, 6, 1), heights=c(1, 3), respect=true) par(mar=c(3, 0.5, 3, 0), mgp=c(0, 1, -2.2)) barplot(seq(1, 10), width=1, xlim=c(0, ncol(datmat)), xlab="", space=0, col="blue", border="white" ) box("inner", lty="dotted", col="green") box("outer", lty="solid", col="green") par(mar=c(0, 0, 0, 0), mgp=c(0, 1, -1)) barplot(-seq(1, 10), ylim=c(0, nrow(datmat)), width=1.025, horiz=true, ,axes =t, space=0, col="blue", border="white" ) par(mar=c(1, 0, 0, 0)) x.len <- ncol(datmat) y.len <- nrow(datmat) single.col <- 'chartreuse4' double.col <- 'blue4' triple.col <- '#ffff33' four.col <- '#ff7f00' five.col <- '#e41a1c' colors <- c('grey90', single.col, double.col, triple.col, four.col, five.col) image(x=1:x.len, y=1:y.len, z=t(datmat), col=colors, breaks=c(-0.5, 0.5 , 1.5 , 2.5 , 3.5 , 4.5 , 5.5), axes=false, ann=f) abline(h=seq(0.5, 0.5+y.len), col='white', lwd=0.5); abline(v=seq(0.5, 0.5+x.len), col='white', lwd=0.5) par(mar=c(0, 0, 0, 0), mgp=c(0, 1, 0)) barplot(seq(1, 10), ylim=c(0, nrow(datmat)), width=.5, horiz=true, axes=false, space=0, col="blue", border ="white" ) axis(side=1) sessioninfo() # r version 3.1.1 (2014-07-10) # platform: x86_64-apple-darwin13.1.0 (64-bit) # # locale: # [1] c/utf-8/c/c/c/c # # attached base of operations packages: # [1] datasets utils stats graphics grdevices methods base of operations # # other attached packages: # [1] xlsx_0.5.7 xlsxjars_0.6.1 # [3] rjava_0.9-6 nutshell_2.0 # [5] nutshell.audioscrobbler_1.0 nutshell.bbdb_1.0 # [7] faraway_1.0.6 mass_7.3-35 # # loaded via namespace (and not attached): # [1] tools_3.1.1

if don't specify xlim , ylim, plots fill available space. it's matter of providing xaxs='i' upper plot, , yaxs='i' left , right plots.

par(oma=c(1, 1, 1, 1), mar=c(1, 1, 1, 1), lwd=0.2, cex=0.5) nf <- layout(matrix(c(0, 2, 0, 3, 1, 4), 2, 3, byrow=true), widths=c(1, 6, 1), heights=c(1, 3), respect=true) par(mar=rep(0, 4)) m <- matrix(runif(100), ncol=10) image(x=seq_len(ncol(m)), y=seq_len(nrow(m)), z=t(m), axes=false, ann=f) abline(h=seq(0.5, 0.5 + nrow(m)), v=seq(0.5, 0.5 + ncol(m)), col="white") par(mar=c(1, 0, 0, 0)) barplot(seq(1, 10), xlab="", space=0, border="white", xaxs='i') par(mar=c(0, 0, 0, 1)) barplot(-seq(1, 10), horiz=true, space=0, border="white", yaxs='i', xaxt='n') axis(1, at=axticks(1), labels=-axticks(1)) # right x-axis tick labels left plot par(mar=c(0, 1, 0, 0)) barplot(seq(1, 10), horiz=true, axes=f, space=0, border="white", yaxs='i') axis(1)

r plot width bar-chart

php - MYSQL SUM, IF and result to be 0 -



php - MYSQL SUM, IF and result to be 0 -

i have problem mysql syntax, i have table like

gnt6988 rawabuaya 30000000 gnt3429 purwacaraka 100000 gnt1326 clara 15000000 gnt9059 bensugih1 6100000 gnt9620 bensugih2 6100000 gnt9851 abdulfattah 500000 gnt3927 sukses01 10000000 gnt4469 sukses02 10000000

and have mysql syntax

select trx, sum(jmlgf) jumlahgf gf_start grouping trx having jumlahgf < 4000000 order tgl asc limit 40

i got result

gnt3429 100000 gnt9851 500000 gnt1405 1000000 gnt9660 100000 gnt7222 100000 gnt2407 2100000 gnt3383 100000 gnt5586 100000 gnt1419 100000 **i want result like** gnt3429 100000 gnt9851 500000 gnt1405 1000000 gnt9660 0 gnt7222 0 gnt2407 0 gnt3383 0

if sum(jmlgf) >= 1600000

what should mysql syntax ?

i using php mysql

either utilize variable, this:-

select trx, @sum_so_far:=@sum_so_far + jumlahgf, if(@sum_so_far >= 1600000, 0, jumlahgf) jumlahgf ( select trx, sum(jmlgf) jumlahgf gf_start grouping trx having jumlahgf < 4000000 order tgl asc ) sub0 cross bring together ( select @sum_so_far:=0 ) sub1 limit 40

or bring together results query sum far, this:-

select trx, if(rolling_cnt >= 1600000, 0, sum(jmlgf)) jumlahgf gf_start ( select a.trx, sum(b.jmlgf) rolling_cnt gf_start inner bring together gf_start b on a.trx = b.trx , a.tgl <= b.tgl grouping a.trx ) sub0 on gf_start.trx = sub0.trx grouping trx having jumlahgf < 4000000 order tgl asc limit 40

php mysql

javascript - How to get identical colors for categories between different plots in Dimple -



javascript - How to get identical colors for categories between different plots in Dimple -

i have 2 plots displaying different aspects of same data. both have same attribute lastly in array:

chart_scatter.addseries(["time", "valuea", "valueb", "category"], dimple.plot.bubble); chart_scatter2.addseries(["time", "valueb", "valuea", "category"], dimple.plot.bubble);

you can find image in comment, not allowed post inline images yet.

i points colored same in both charts. if category 1364 should greenish in first plot , greenish in sec plot. how can accomplish that? using interpolated coloraxis not alternative colors not looking , imply order while info categorical.

you can pass assignments this:

chart_scatter.draw(); chart_scatter2._assignedcolors = chart_scatter._assignedcolors; chart_scatter2.draw();

javascript d3.js dimple.js

c++ - Difference between this. and this-> -



c++ - Difference between this. and this-> -

is there difference between this. , this-> ?

if yes, please elaborate differences ?

one compile, 1 won't. this pointer, , can't apply . pointer. utilize -> access members of object points to.

c++ operators this operator-keyword

algorithm - Is this a special case of the NP-complete set packing? -



algorithm - Is this a special case of the NP-complete set packing? -

i'm problem equivalent set packing, , thus, np-complete, verify. have next situation: there set of pens (i.e. universe). store sells bundles of these pens, subsets of universe. know guy has pens (also subset of universe) store, have no thought bundles bought. might have lost pens , gotten others other bundles friends gave him. want map bundles sold store subset of pens friend has cover highest amount of pens , chosen bundles must not contain pen friend doesn't have. example:

possible pens: {0, 1, 2, 3, 4, 5} bundles sold store: {0, 1} | {0, 1, 2} | {2, 3} | {3} | {3, 4, 5} | {4, 5} friend has: {0, 1, 2, 3} here, there perfect matches: {{0, 1, 2}, {3}} , {{0, 1}, {2, 3}}. these equivalent friend 2 has: {0, 2, 3} in case, there no perfect match. possible matches {{3}} , {{2, 3}}. best match {{2, 3}}.

i problem np-complete given number m of pens, number n of bundles , number l of friend's pens ?

algorithm np

ExtJS5 tree dragdrop deep copy -



ExtJS5 tree dragdrop deep copy -

in extjs5 have treepanel drag drop enabled. when drag node children source tree target tree parent node copied.

if seek deep clone in 'beforedrop' listener, fails next error: ext.data.model.constructor(): bad model constructor argument 2 - "session" not session

the view has viewcontroller not have viewmodel.

tree definition in view:

xtype: 'treepanel', itemid: 'myprojectstree', rootvisible: false, viewconfig: { plugins: { ptype: 'treeviewdragdrop', enabledrag: false, enabledrop: true }, listeners: { beforedrop: 'dodrop',....

in controller:

dodrop: function(dropnode, dragnode, overmodel) { var node = dragnode.records[0]; var clonednode = node.copy('111', true);<--- failed here

i have seen sessions defined in viewmodel scenario. re-create function need have viewmodel session defined ? there way around this. there bug in extjs5.

any help appreciated!

afaik there bug in ext js related copying tree nodes (extjs-13725). should modify/override copy method in ext.data.nodeinterface:

// copy: function(newid, deep) { copy: function(newid, session, deep) { var me = this, result = me.callparent(arguments), len = me.childnodes ? me.childnodes.length : 0, i; if (deep) { (i = 0; < len; i++) { // result.appendchild(me.childnodes[i].copy(undefined, true)); result.appendchild(me.childnodes[i].copy(undefined, session, true)); } } homecoming result; }

basically in original code there no session argument, while there should be.

tree extjs5

Android google maps cant zoom with compass active -



Android google maps cant zoom with compass active -

hee guys,

i'm using sensorlistener create screen adjust compass. can't zoom in or out because updating photographic camera when onsensorchanged called. there way create able zoom?

private sensoreventlistener mysensoreventlistener = new sensoreventlistener() { @override public void onaccuracychanged(sensor sensor, int accuracy) { } @override public void onsensorchanged(sensorevent event) { if(routestarted == true) { if(event.sensor.gettype() == sensor.type_rotation_vector) { sensormanager.getrotationmatrixfromvector( mrotationmatrix , event.values); float[] orientation = new float[3]; sensormanager.getorientation(mrotationmatrix, orientation); float bearing = (float) (math.todegrees(orientation[0]) + mdeclination); float tilt = 30; updatecamera(bearing, tilt); } } } }; private void updatecamera(float bearing, float tilt) { // todo auto-generated method stub latlng post = new latlng(mgooglemap.getmylocation().getlatitude(), mgooglemap.getmylocation().getlongitude()); cameraposition pos = new cameraposition(post, 15, tilt, bearing); mgooglemap.movecamera(cameraupdatefactory.newcameraposition(pos)); }

you should utilize currentzoom level obtained map instead of static value 15. this:

float zoom = map.getcameraposition().zoom; cameraposition pos = new cameraposition(post, zoom, tilt, bearing);

if want initialise view on 15, somewhere else illustration when activity starts.

android google-maps zoom

javascript - Writing .htm file name to the contents of the file in HTML -



javascript - Writing .htm file name to the contents of the file in HTML -

e.g. have file named: page1.htm

in html need show link google result of search file name. i.e.:

https://www.google.co.uk/?gfe_rd=cr&ei=6mhcvogvhmnh8gej8ocqdq&gws_rd=ssl#q=page1

obviously if need lots of pages, easier if there way amend end of search string depend on filename (without extension).

please tell me there simple way produce result!

thanks

because serving static html page, 'active' behavior, (like automatically reusing file's name in content) need happen @ runtime on client side. means javascript:

<!-- in html, utilize id tag create link selectable javascript...--> <a id="googlesearchlink" href="#">search google name of file</a>

then @ bottom of body content (so happens after tag rendered) add:

<script> // grab after lastly "/" location bar... var filename = window.location.href.substr(window.location.href.lastindexof("/")+1); // chop off lastly "." , right of it... var withoutextension = filename.replace(/\.[^/.]+$/, ""); // build link destination string... var hreftargetforgooglelink = "https://www.google.co.uk/#q=" + withoutextension; // finally, set link destination googlesearchlink.href = hreftargetforgooglelink; </script>

javascript html html5 filenames

r - How to group data and then draw bar chart in ggplot2 -



r - How to group data and then draw bar chart in ggplot2 -

i have info frame (df) 3 columns e.g.

numeric1: numeric2: group(character): 100 1 200 2 b 300 3 c 400 4

i want grouping numeric1 group(character), , calculate mean each group. that:

mean(numeric1): group(character): 250 200 b 300 c

finally i'd draw bar chart using ggplot2 having group(character) on x axis =nd mean(numeric) on y axis. should like: http://i.stack.imgur.com/ifrme.png

i used

mean <- tapply(df$numeric1, df$group(character), fun=mean)

but i'm not sure if it's ok, , if it's, don't know supposed next.

try like:

res <- aggregate(numeric1 ~ group, info = df, fun = mean) ggplot(res, aes(x = group, y = numeric1)) + geom_bar(stat = "identity")

data df <- structure(list(numeric1 = c(100l, 200l, 300l, 400l), numeric2 = 1:4, grouping = structure(c(1l, 2l, 3l, 1l), .label = c("a", "b", "c"), class = "factor")), .names = c("numeric1", "numeric2", "group"), class = "data.frame", row.names = c(na, -4l))

r ggplot2 group bar-chart

java - how do I create a program that uses a for loop to print the first 1000 perfect squares? -



java - how do I create a program that uses a for loop to print the first 1000 perfect squares? -

this have far. have write loop prints first 1000 perfect squares , determines time of execution. timer working don't know how show 1000 perfect squares.

public class whileloop { public static void main(string[] args) { long time_start, time_finish; time_start = time(); int i; for( =0; i< 1000; i++){ { system.out.print(""); } system.out.println(i);

}

time_finish = time(); system.out.println(time_finish - time_start + " milli seconds"); } public static long time(){ calendar cal = calendar.getinstance(); homecoming cal.gettimeinmillis(); }

}

you got break downwards problem 1 1. long story short... want following:

get start time: print 1*1 print 2*2 print 3*3 ... first 1000 squares print total execution time

here code snippits need work:

then using tools java provides... can

retrieve current time (store starttime variable) loop through 1000 elements , print results retrieve current time (compare starttime total runtime)

i don't want give away much... provide force in right direction.

java loops for-loop

android - Plural NotFoundException on Huawei phones only -



android - Plural NotFoundException on Huawei phones only -

i've noticed many crash reports app in production huawei phones related plurals handling. no other phones have problem huawei.

all plural forms exist , work fine on other devices.

it seems huawei cannot handle plurals @ all:

android.content.res.resources$notfoundexception: plural resource id #0x7f060000 quantity=4 item=few @ android.content.res.resources.getquantitytext(resources.java:290) @ android.content.res.resources.getquantitystring(resources.java:397) ... android.content.res.resources$notfoundexception: plural resource id #0x7f060000 quantity=6 item=many @ android.content.res.resources.getquantitytext(resources.java:290) @ android.content.res.xresources.getquantitytext(xresources.java:667) @ android.content.res.resources.getquantitystring(resources.java:397) ...

did have problem too?

android android-resources

WMIC command not working in .bat file -



WMIC command not working in .bat file -

i'm new wimc there simple reply question.

if open cmd , run command:

wmic /output:c:\logservices.txt service "not pathname '%windows%'" displayname,name,pathname,state,startmode

this generate file services not in windows folder.

if save above command in bat file , run generate list services somehow ignoring where statement. running administrator not changing anything.

in batch script have double pump % signs they'll treated literal percent signs. alter command , it'll work:

wmic /output:c:\logservices.txt service "not pathname '%%windows%%'" displayname,name,pathname,state,startmode

wmic

ruby - Weird behaviour copying objects -



ruby - Weird behaviour copying objects -

i'm trying deep re-create object holds 3d array. isn't working expected.

class def initialize @a = [[[1]], [[2]]] end def modify3d @a[0][0] = @a[1][0] end def modify2d @a[0] = @a[1] end def dup re-create = super copy.make_independent! re-create end def make_independent! @a = @a.dup end def show print "\n#{@a}" end end = a.new b = a.dup #a.modify2d b.show a.modify3d b.show

in case b changed modify3d phone call on a.

[[[1]], [[2]]] [[[2]], [[2]]]

if uncomment modify2d line works fine.

[[[1]], [[2]]] [[[1]], [[2]]]

could pls explain happening here?

your re-create isn't deep enough. array#dup duplicates array itself, not array elements. end 2 different arrays still share same elements.

in this answer showed how utilize marshaling deep copy. method work:

def deep_copy(o) marshal.load(marshal.dump(o)) end

deep_copy works object can marshaled. built-in info types (array, hash, string, &c.) can marshaled. object instance variables can marshaled can marshaled.

having defined deep_copy, replace line:

b = a.dup

with this:

b = deep_copy(a)

and ought work expect.

ruby deep-copy

javascript - Issue with ajax file upload (Node.js, express, jQuery) -



javascript - Issue with ajax file upload (Node.js, express, jQuery) -

i struggling file upload script working. using node/express backend jquery firing off ajax request.

markup:

<input id="audio" type="file" name="audio">

front end js:

var formdata = new formdata(); formdata.append("audio", e.data.audio, 'testname'); $.ajax({ url: 'api/upload', data: formdata, cache: false, contenttype: false, processdata: false, type: 'post', success: function(data){ alert(data); } });

using custom written module executes next , places e.data.audio

if(has('filereader')){ homecoming this.$input[0].files[0] || ''; }

when select little sound file upload , submit, e.data.audio has next value @ point set ajax function argument object:

lack of streetcred means need set images on imgur http://i.imgur.com/mz5mnxr.png

after request sent using files property of request object (req.files) access file, in order save it.

exports.upload = function(){ homecoming function(req, res){ console.log(req.files); if (req.files && req.files.audio){ var file = req.files.audio; fs.readfile(file.path, function(err, data){ if (err){ res.send(err); } var newpath = __dirname + 'public/audio'; fs.writefile(newpath, data, function(err){ if (err){ res.send(err); }else{ res.send(true); } }); }) }else{ } } };

however issue path seems clients local path.

lack of streetcred means need set images on imgur http://i.imgur.com/9e82xv1.png

ive done fair amount of googling , cant seem find along same lines. missing basic , need point me in right direction.

file.path path temporary file created on server holds uploaded file data, it's not path of file uploader's system.

on unrelated note, __dirname not include trailing slash you'll want this:

var newpath = __dirname + '/public/audio';

instead of:

var newpath = __dirname + 'public/audio';

also should utilize fs.rename move file instead of reading whole file memory , writing out again. example:

var file = req.files.audio; fs.rename(file.path, __dirname + '/public/audio', function(err) { res.send(err ? err : true); });

javascript jquery ajax node.js file-upload

javascript - autoedit not working with frozen colummn -



javascript - autoedit not working with frozen colummn -

i trying utilize frozen column setup , 1 time got working autoedit setting not working anymore. come in edit mode cell have double click activate cell, there setting or need add together editing on single click of cell versus double click.

the source handling click

if (hasfrozenrows) { if ((!(options.frozenbottom) && (cell.row >= actualfrozenrow)) || (options.frozenbottom && (cell.row < actualfrozenrow)) ) { scrollrowintoview(cell.row, false); } setactivecellinternal(getcellnode(cell.row, cell.cell)); }

wraps editor display phone call setactivecellinternal in check on hasfrozenrows. furthermore, check defaulted false , changes for

if (options.frozenrow > -1) { hasfrozenrows = true; //...removed remaining code }

so without setting grid alternative of frozenrow: 0 you'll have double-click edit. note first "data" row corresponds value 1.

javascript slickgrid

c# - Website doesn't see newest session values until I refresh page, but refreshing resets values of controls -



c# - Website doesn't see newest session values until I refresh page, but refreshing resets values of controls -

my asp.net website doesn't see newest session values. when form beingness sent server after clicking button, result sent browser depends of session values. process them in page_load method. doesn't see lastly alter od session values, 1 before last. looks button's event handlers executed before page's event handles i'm not sure if that. tried code in other methods page_preinit etc, it's still same that. thing works me refreshing page: response.redirect(request.url.absoluteuri); after alter of session value, resets values of controls, want same before. there improve solution?

example: when runs first time, label's text "click button", when click of buttons 1 time, nil happens. when click of button sec time, label's text value of first click (even if click , b, value changes after clicking b).

form:

<form id="form1" runat="server"> <div> <p> <asp:label id="label1" runat="server" /> </p> <p> <asp:button id="button1" runat="server" text="a" onclick="button1_click" />&nbsp; <asp:button id="button2" runat="server" text="b" onclick="button2_click" /> </p> <p> <asp:textbox id="textbox1" runat="server"></asp:textbox> </p> </div> </form>

event handlers:

protected void page_load(object sender, eventargs e) { label1.text = session["letter"].tostring(); } protected void button1_click(object sender, eventargs e) { session["letter"] = "a"; } protected void button2_click(object sender, eventargs e) { session["letter"] = "b"; }

global method:

void session_start(object sender, eventargs e) { session["letter"] = "click button"; }

without code difficult, sounds setting session collection value in code of button's click event( or other control/event ), , expecting in session collection during page_load event.

it doesn't work - when page request comes in, page_load happens before control's events.

instead of page_load utilize page_prerender event occurs before page prepared sent client.

your add-on of code confirms above.

normally wouldn't utilize session_start initialize stuff this, utilize page_load , ispostback property

protected void page_load(object sender, eventargs e) { if(!ispostback){ label1.text = "click button"; } }

c# asp.net .net session

c# - Win 8.1 ComboBox Display the "ToString" Function Result when the SelectedItem is Null or Empty String -



c# - Win 8.1 ComboBox Display the "ToString" Function Result when the SelectedItem is Null or Empty String -

i have xaml combobox this:

<combobox x:name="combobox" itemssource="{binding items}"/>

and bond info items defined below (the defaultviewmodel observabledictionary object used info binding):

defaultviewmodel["items"] = new[] {"this", "that", null};

the info binding working fine. when click "this" or "that" options, selected values displayed correctly; when click empty alternative (namely null), tostring() result of bound object (testapp.common.observabledictionary) shown instead of beingness empty.

what going wrong here? thanks!

c# windows-8 combobox windows-8.1

excel - Broken VBA Loop -



excel - Broken VBA Loop -

i'm sure simple can't find on web.

i'm writing macro format xl spreadsheets download 3rd party application. come formatted wacky i'm trying create easier info need them.

this simple vba loop causes cells in column bl update. info in these cells contain line breaks don't show until double click in cell. vba below causes update cells achieves same effect, less work. crashing excel , can't figure out why. works in single instance, when loop -- boom!!! -- frozen. help gently appreciated.

sub updatecell() dim currentvalue string activesheet.range("bl1").select until activecell.value = "" activecell.offset(1, 0).select currentvalue = activecell().value activecell().value = currentvalue & "" loop end sub

try bit more direct:

with activesheet lrow = .range("bl" & .rows.count).end(xlup).row '~~> find lastly row on bl .range("bl1:bl" & lrow) '~~> work on target range .value = .value '~~> assign current value end end

above code manually pressing f2 pressing enter.

edit1: explanation on getting lastly row

activesheet.rows.count '~~> returns number of rows in sheet 1048576 msgbox activesheet.rows.count '~~> run confirm

so line concatenates bl 1048576.

.range("bl" & .rows.count) '~~> count property of rows collection

same as:

.range("bl" & 1048576)

and same as:

.range("bl1048576")

then lastly row, utilize range object end method.

.range("bl" & .rows.count).end(xlup)

so basically, above code go cell bl1048576 manually pressing ctrl+arrow up. homecoming actual row number of range, utilize range object row property.

lrow = .range("bl" & .rows.count).end(xlup).row

see here more with statement. has same effect (with code) without loop. hth

but if want remove line breaks produced alt+enter on cell, seek below:

dim lrow long, c range activesheet lrow = .range("bl" & .rows.count).end(xlup).row each c in .range("bl1:bl" & lrow) c.value = replace(c.value, chr(10), "") next end

where chr(10) equivalent of line break replaced "" using replace function.

excel vba loops excel-vba

ios - Change width of UISearchBar -



ios - Change width of UISearchBar -

i'm having hamburger menu i'm showing viewcontroller tableview. problem i've added uisearchbar titleview , u can see searchbar hiding. there way i' can create navigationbar smaller or searchbar fit ?

searchbar = uisearchbar(frame: cgrectmake(0, 0, self.revealviewcontroller().rearviewrevealwidth-30, 44)) searchbar?.delegate = self searchbar?.showscancelbutton = false var textfield = searchbar?.valueforkey("searchfield") uitextfield textfield.backgroundcolor = uicolor(rgba: "#414e5c") textfield.leftviewmode = uitextfieldviewmode.never textfield.layer.cornerradius = 5 textfield.clipstobounds = true searchbar?.placeholder = "søg efter produkter" searchbar?.setpositionadjustment(uioffsetmake(0, 0), forsearchbaricon: uisearchbaricon.search) textfield.borderstyle = uitextborderstyle.none searchcontroller = uisearchdisplaycontroller() searchcontroller?.delegate = self searchcontroller?.searchresultsdelegate = self var buttonsearchbar:uibarbuttonitem = uibarbuttonitem(customview: searchbar!) self.navigationitem.leftbarbuttonitem = buttonsearchbar

ios objective-c iphone swift uinavigationbar

python - How to edit a class instance through a WTForm -



python - How to edit a class instance through a WTForm -

i trying set settings page, logged in user able adjust few (currently two) attributes of user class. using sqlalchemy handle database queries. settings page , form displays , works before effort tie in user class, believe it's issue flask code. attempted follow illustration code in wtforms crash course of study documentation, still resulted in error. help or guidance appreciated.

flask code:

class settingsform(form): topics = textfield('topics') emailfrequency= radiofield('email frequency', choices = [('daily', u'daily'), ('weekly', u'weekly'), ('monthly', u'monthly'), ('never', u'never')], default='weekly') submit = submitfield("save changes") @application.route('/settings', methods = ['get', 'post']) @login_required def settings(request): user = current_user form = settingsform(request.form) if request.method == 'post' , form.validate(): user.emailfrequency = form.emailfrequency.data user.topics = form.topics.data db.session.commit() homecoming render_template('settings.html', page_title = "success", form=form, success=true) elif request.method == 'get': homecoming render_template('settings.html', page_title = 'customize settings using form below', form = form)

html

{% extends "base-layout.html" %} {% block content %} {% if success %} <h2> settings updated! </h2> {% else %} <h2> customize settings</h2> <form class="form" action="{{url_for('settings')}}" method="post" role="form"> {{form.hidden_tag()}} <div> {{form.topics.label}} </div> <div> {{form.topics(placeholder="e.g. gas, oil, renewables", class="form-control")}} </div> <div> {{form.emailfrequency.label}} </div> <div> {{form.emailfrequency}} </div> <div> {{form.submit}} </div> </form> {% endif %} {% endblock %}

hope helps if else has same issue, form worked when removed request input settings function follows:

@application.route('/settings', methods = ['get', 'post']) @login_required def settings(): user = current_user form = settingsform(request.form) if request.method == 'post' , form.validate(): user.emailfrequency = form.emailfrequency.data user.topics = form.topics.data db.session.commit() homecoming render_template('settings.html', page_title = "success", form=form, success=true) elif request.method == 'get': homecoming render_template('settings.html', page_title = 'customize settings using form below', form = form)

if explain why worked, helpful in future.

python flask-sqlalchemy flask-wtforms

excel - Populate a column with 3 different values based on 4 conditions in spreadsheet -



excel - Populate a column with 3 different values based on 4 conditions in spreadsheet -

i have 2 sheets named "first" , "second" on spreadsheet.i populate status column 3 different value based on 4 conditions. next conditions;

first: if b:b=0 --> a second & third: if a:a<second!a2 , (index(a2:a,count(a2:a)))<today())) --> c fourth: if a:a<today() --> b

(if 3 fails, leave empty.)

following sample tables working on.

first

second

the next desired results on respective tables.

first

second

here have tried, says less 3 arguments allowed.

=if(b2>0, if(a2<today(), "b", ""), if(b2=0,"a", ""), if((and((a:a<second!a2),((index(a2:a,count(a2:a)))<today()))),"c",""))

please help me desired results based upon conditions.

just made few little changes , worked.

=if(b:b=0, "a", if(a:a<today(), if((and((a:a<second!a2),((index(a2:a,count(a2:a)))<today()))),"c","b"), ""))

excel google-spreadsheet spreadsheet openoffice-calc

java - How does tomcat resolve resources? -



java - How does tomcat resolve resources? -

i develop web application.

spring+hibernate on tomcat servlet container.

today on pc deploy application , see css doesn't load.

in jsp utilize relative paths this(example)

<link href="/resources/css/ui-lightness/jquery-ui-1.10.0.custom.min.css" rel="stylesheet">

respective request browser sends:

http://localhost:8080/resources/css/ui-lightness/jquery-ui-1.10.0.custom.min.css

and request returns 404 http error.

for jsp:

<link href="/resources/css/bootstrap.min.css" rel="stylesheet">

browser sends:

http://localhost:8080/terminal-company/resources/css/bootstrap.min.css

thus can see first jsp project name doesn't add together url

why? , how prepare it? request me detail should add together relevant answer.

project structure:

spring related part of web.xml:

<servlet> <servlet-name>appservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring/webcontext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appservlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>

if goal able utilize absolute paths, without caring (and knowing) context path of webapp (/terminal-company in sec example), utilize the jstl <c:url> tag generate urls:

<link href="<c:url value='/resources/css/bootstrap.min.css'/>" rel="stylesheet">

the sec illustration send request /resources/css/bootstrap.min.css, , not /terminal-company/resources/css/bootstrap.min.css, unless there <base> tag in generated html page.

edit: original question didn't using spring, , mapped / dispatcher servlet. spring in charge of service resources. the documentation explains how configure it. doesn't alter above answer: independant of context path, utilize c:url.

java jsp tomcat servlets

publish subscribe - Creating method dependency in java -



publish subscribe - Creating method dependency in java -

i have 2 methods names sendsdata() , sendcdata() in myclass.

class myclass { public void sendsdata() { // receiving response database } public void sendcdata() { // send c info } }

i'm calling these 2 method main method

public static void main(string ... args) { myclass obj=new myclass(); obj.sendsdata(); obj.sendcdata(); }

it possible me send sendcdata request after if , if got success response sendsdata() method.

how can accomplish in java?

senddata() publishing info server . if success response server possible me send sendcdata(). i'm usung pub/sub model. i'm not calling web service or rest service. receiving respose have separate subscriber

public boolean sendsdata() { // handle whether or not function returns true or false homecoming true; } public static void main(string ... args) { myclass obj=new myclass(); if (obj.sendsdata()) { obj.sendcdata(); } else { // obj.sendsdata() did not respond } }

with above code obj.sendcdata() run if sendsdata() returns true (successfully responded).

java publish-subscribe

How to run a Custom Sharepoint Timer Job on alternate day? -



How to run a Custom Sharepoint Timer Job on alternate day? -

i have perform action using custom timer job on alternate day? code create , start timer job(in feature receiver) below,but runs daily , i have run on alternate days?

how it?

private bool createjob(spsite site) { bool jobcreated = false; seek {

timerjob job = new timerjob(jobname, site.webapplication); job.title = jobname; spminuteschedule schedule = new spminuteschedule(); schedule.beginsecond = 0; schedule.endsecond = 59; schedule.interval = 15; job.schedule = schedule; job.update(); } grab (exception) { homecoming jobcreated; } homecoming jobcreated; }

i think code above run every 15 minute, have spminuteschedule, must utilize spdailyschedule. see msdn documentation

however when job run can current dayofweek , run code when want

switch (datetime.now.dayofweek) { case dayofweek.friday: break; case dayofweek.monday: break; case dayofweek.saturday: break; case dayofweek.sunday: break; case dayofweek.thursday: break; case dayofweek.tuesday: break; case dayofweek.wednesday: break; default: break; }

or can save within job property bag lastly run. @ this link can find illustration spweb same spjob.

sharepoint sharepoint-2010 sharepoint-2007 timer-jobs sharepoint-timer-job

Reading lines from c file and putting the strings into an array -



Reading lines from c file and putting the strings into an array -

i'm trying add together each line of c file array. contents of files.txt is

first.c second.c third.c fourth.c

i want code print each of these lines, add together line array, , print out each entry in array. right doing first part correctly adding fourth.c array. can tell me wrong code?

#include <stdio.h> #include <stdlib.h> int main(void) { int i=0; int numprogs=0; char* programs[50]; char line[50]; file *file; file = fopen("files.txt", "r"); while(fgets(line, sizeof line, file)!=null) { //check sure reading correctly printf("%s", line); //add each filename array of programs programs[i]=line; i++; //count number of programs in file numprogs++; } //check sure going array correctly (int j=0 ; j<numprogs+1; j++) { printf("\n%s", programs[j]); } fclose(file); homecoming 0; }

you need alter

programs[i]=line;

to

programs[i]=strdup(line);

otherwise pointers in programs array point same location (that line).

btw: if files.txt contains more 50 lines, run trouble.

c arrays file-io

android - Deleting folders on git repository that were kept when I tried to manually rename -



android - Deleting folders on git repository that were kept when I tried to manually rename -

in eclipse, renamed android project , pushed git repository...so there's 2 different bundle folders same project. can't figure out how delete 1 of folders. i'm using bitbucket.

i figured out solution. got directory locally , remove git rm -r directory

android eclipse git bitbucket

c# - WPF - Uri to content images -



c# - WPF - Uri to content images -

i spent 1 hr on browsing net , trying find way how load uri content image , create bitmapimage.

that have:

{ uri x = new uri("/images/appbar.chevron.up.png", urikind.relative); bitmapimage bi = new bitmapimage(x); homecoming x; }

images in solution explorer under project:

and each image have build action content

i'm recieving the given system.uri cannot converted windows.foundation.uri. please see http://go.microsoft.com/fwlink/?linkid=215849 details. on creating bitmapimage, debugger showes me uri created:

please tell me, how can load selected image?

as noted, load image app bundle you'll utilize ms-appx protocol. see uri schemes documentation on msdn

uri x = new uri("ms-appx:///images/appbar.chevron.up.png"); bitmapimage bi = new bitmapimage(x);

then you'll want homecoming bitmapimage rather uri caller:

return bi; // not: homecoming x;

or set on image control. bitmapimage info , doesn't show on own.

img.setsource(bi);

where img created in xaml:

guessing names of images trying set them in appbar buttons. can utilize segoe ui symbol font instead of loading images:

<appbarbutton> <appbarbutton.icon> <fonticon fontfamily="segoe ui symbol" glyph="&#57361;"/> </appbarbutton.icon> </appbarbutton> <appbarbutton> <appbarbutton.icon> <fonticon fontfamily="segoe ui symbol" glyph="&#57360;"/> </appbarbutton.icon> </appbarbutton>

or if want set appbarbuttons images in xaml:

<appbarbutton> <appbarbutton.icon> <bitmapicon urisource="images/appbar.chevron.up.png"/> </appbarbutton.icon> </appbarbutton> <appbarbutton> <appbarbutton.icon> <bitmapicon urisource="images/appbar.chevron.down.png"/> </appbarbutton.icon> </appbarbutton>

c# image windows-runtime

AngularJS doesn't refresh the page after rerouting -



AngularJS doesn't refresh the page after rerouting -

i have

mainapp.config(function ($locationprovider, $routeprovider) { $locationprovider.html5mode(true); $routeprovider .when('view1', { controller: 'simplecontroller', templateurl: 'views/page.html' }) .otherwise({ redirectto: '/views/page.html'}); });

which works, when go in browser main page

http://localhost:8080/web/main.html

it alter url

http://localhost:8080/web/views/page.html

but without refreshing page still see old content main.html instead

did miss step?

you redirecting to, shouldn't seeing .html,

you need start root if plan on doing spa type routing:

$routeprovider .when('/', { templateurl: 'main.html', controller: 'mainctrl' }) .when('/login', { templateurl: 'login.html', controller: 'loginctrl' }). .otherwise({ redirectto: '/' });

angularjs

ruby - Assigning multiple values to setter at once: self.x = (y, z) results in a syntax error -



ruby - Assigning multiple values to setter at once: self.x = (y, z) results in a syntax error -

i'm trying define class method using 2 arguments - title , author. when seek pass arguments i'm getting argument error

syntax error, unexpected ',', expecting ')' book.set_title_and_author= ("ender's game", "orson scott card")

class book def set_title_and_author= (title, author) @title = title @author = author end def description "#{@title}was written #{@author}" end end book = book.new book.set_title_and_author= ("ender's game", "orson scott card) p book.description

am not allowed pass more 1 argument in setter method or there else i'm missing?

you indeed can't pass more 1 argument method ends in =. setter method doesn't need end in =, though, naturally: can set_title_and_author(title, author).

another alternative have method take array:

def set_title_and_author= (title_and_author) @title, @author = title_and_author end #... book.set_title_and_author= ["ender's game", "orson scott card"]

if latter, stylistically i'd recommend removing set , calling method title_and_author=. set redundant =.

ruby syntax setter getter-setter

html - Is it possible to override properties within a CSS class only? -



html - Is it possible to override <strong> properties within a CSS class only? -

i want create div contains 3 words, , want 1 of words in div emphasized in different font , size. possible override default <strong> in div's class can use, example, hello there <strong> world word "world" emphasized differently other "strong-ed" words aren't in div?

don't forget advertisement in container are. can still utilize <strong> element elsewhere.

<div id="container"> hello there <strong> world </strong> </div> #container strong { font-weight: normal; color: red; }

html css

python 2.7 - Boundaries of rectangles / plots in matplotlib -



python 2.7 - Boundaries of rectangles / plots in matplotlib -

i attempting create set of graphs using patches.rectangle in matplotlib, seems blur in boundaries of rectangle cause overlap. example, if utilize these 2 greenish rectangles:

http://puu.sh/cpzfw/fe6ed8834d.png

(i didn't have rep straight insert image)

i not sure how remove boundaries. in addition, how adapt subplot coordinates well, plot too.

thanks!

edit: sorry, here illustration code:

in range(nrows): (count, num) in enumerate(listx[2 * + 1]): if count == 0: rect_start = count elif num == listx[2 * + 1][count-1]: length += 1 elif listx[2 * + 1][count] != listx[2 * + 1][count-1]: if listx[2 * + 1][count-1] == '0': r1 = ptch.rectangle((rect_start,i), length, 1, color="blue", fill=true) rect.add_patch(r1) length = 1 rect_start = count if listx[2 * + 1][count-1] == '1': r1 = ptch.rectangle((rect_start,i), length, 1, color="black", fill=true) rect.add_patch(r1) length = 1 rect_start = count if listx[2 * + 1][count-1] == '2': r1 = ptch.rectangle((rect_start,i), length, 1, color="red", fill=true) rect.add_patch(r1) length = 1 rect_start = count if listx[2 * + 1][count-1] == '3': r1 = ptch.rectangle((rect_start,i), length, 1, color="green", fill=true) rect.add_patch(r1) length = 1 rect_start = count if not listx[2 * + 1][count-1].isdigit(): r1 = ptch.rectangle((rect_start,i), length, 1, color="yellow", fill=true) rect.add_patch(r1) length = 1 rect_start = count

i've had luck setting ec='none'. border drawn line (which has thickness in points), cause imprecise overlap. btw: if want precise size , edge-like effect, can set smaller colored rectangle on top of rectangle of different color (both ec='none').

python-2.7 matplotlib matplotlib-basemap

javascript - I just want to create simple menu links inside some divs? -



javascript - I just want to create simple menu links inside some divs? -

i want create simple menu links within animated divs , problems div disapper if mous move on (li) within if div empty works fine ?

first thing come mind have prevent event propagation , added elements within sum menu ( (li)) still face same problem.

class="snippet-code-js lang-js prettyprint-override">function hidemneu() { $('#submenu1').hide('fold', 'slow'); $('#submenu2').hide('fold', 'slow'); $('#submenu3').hide('fold', 'slow'); $('#submenu4').hide('fold', 'slow'); } $('#submenu1, #submenu2, #submenu3, #submenu4 ').on('mouseout', hidemneu); $('#btn1').on('mouseover', function() { hidemneu(); $('#submenu1').offset({ left: $('#btn1').offset().left }); $('#submenu1').show("fold"); }); $('#btn2').on('mouseover', function() { hidemneu(); $('#submenu2').offset({ left: $('#btn2').offset().left }); $('#submenu2').show("fold"); }); $('#btn3').on('mouseover', function() { hidemneu(); $('#submenu3').offset({ left: $('#btn3').offset().left }); $('#submenu3').show("fold"); }); $('#btn4').on('mouseover', function() { hidemneu(); $('#submenu4').offset({ left: $('#btn4').offset().left }); $('#submenu4').show("fold"); }); $("a").on('mouseover', function(event) { event.stoppropagation(); }); $("li").on('mouseover', function(event) { event.stoppropagation(); }); $("ul").on('mouseover', function(event) { event.stoppropagation(); }); class="snippet-code-css lang-css prettyprint-override">#btn1, #btn2, #btn3, #btn4 { display: inline-block; background-color: #ff8d73; width: 100px; outline: 1px dashed #000000; padding-right: 30px; } #menu-wrapper { width: 100%; background-color: #b7dcff; text-align: center; } #submenu1, #submenu2, #submenu3, #submenu4 { width: 300px; height: 200px; outline: 1px dashed #000000; float: left; left: 0; position: absolute; display: none; } #submenu1 { background-color: #f00700 } #submenu2 { background-color: #a6baf0 } #submenu3 { background-color: #7af044 } #submenu4 { background-color: #f0dc35 } #sub_wrapper:after { clear: both; } li, { outline: 1px dashed #000000; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <div id="menu-wrapper"> <div id='btn1'>button 1</div> <div id='btn2'>button 2</div> <div id='btn3'>button 3</div> <div id='btn4'>button 4</div> </div> <div id="sub_wrapper"> <div id="submenu1"> <ul> <li>option 1</li> <li>oprion 2</li> </ul> </div> <div id="submenu2"> <a href="#"> clcik me 1 </a> </div> <div id="submenu3"></div> <div id="submenu4"></div> </div>

changing line 8 of javascript seems trick:

from:

$('#submenu1, #submenu2, #submenu3, #submenu4 ').on('mouseout', hidemneu);

to

$('#submenu1, #submenu2, #submenu3, #submenu4 ').mouseleave(hidemneu);

class="snippet-code-js lang-js prettyprint-override">function hidemneu() { $('#submenu1').hide('fold', 'slow'); $('#submenu2').hide('fold', 'slow'); $('#submenu3').hide('fold', 'slow'); $('#submenu4').hide('fold', 'slow'); } $('#submenu1, #submenu2, #submenu3, #submenu4 ').mouseleave(hidemneu); $('#btn1').on('mouseover', function() { hidemneu(); $('#submenu1').offset({ left: $('#btn1').offset().left }); $('#submenu1').show("fold"); }); $('#btn2').on('mouseover', function() { hidemneu(); $('#submenu2').offset({ left: $('#btn2').offset().left }); $('#submenu2').show("fold"); }); $('#btn3').on('mouseover', function() { hidemneu(); $('#submenu3').offset({ left: $('#btn3').offset().left }); $('#submenu3').show("fold"); }); $('#btn4').on('mouseover', function() { hidemneu(); $('#submenu4').offset({ left: $('#btn4').offset().left }); $('#submenu4').show("fold"); }); $("a").on('mouseover', function(event) { event.stoppropagation(); }); $("li").on('mouseover', function(event) { event.stoppropagation(); }); $("ul").on('mouseover', function(event) { event.stoppropagation(); }); class="snippet-code-css lang-css prettyprint-override">#btn1, #btn2, #btn3, #btn4 { display: inline-block; background-color: #ff8d73; width: 100px; outline: 1px dashed #000000; padding-right: 30px; } #menu-wrapper { width: 100%; background-color: #b7dcff; text-align: center; } #submenu1, #submenu2, #submenu3, #submenu4 { width: 300px; height: 200px; outline: 1px dashed #000000; float: left; left: 0; position: absolute; display: none; } #submenu1 { background-color: #f00700 } #submenu2 { background-color: #a6baf0 } #submenu3 { background-color: #7af044 } #submenu4 { background-color: #f0dc35 } #sub_wrapper:after { clear: both; } li, { outline: 1px dashed #000000; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <div id="menu-wrapper"> <div id='btn1'>button 1</div> <div id='btn2'>button 2</div> <div id='btn3'>button 3</div> <div id='btn4'>button 4</div> </div> <div id="sub_wrapper"> <div id="submenu1"> <ul> <li>option 1</li> <li>oprion 2</li> </ul> </div> <div id="submenu2"> <a href="#"> clcik me 1 </a> </div> <div id="submenu3"></div> <div id="submenu4"></div> </div>

javascript jquery html css

c++ - include class and compile with g++ -



c++ - include class and compile with g++ -

im beginner in c++ , working unix. here question.

i`ve written few lines in main-function, , needed function, defined in c_lib - library.

main.cpp:

#include <iostream> #include "c_lib.cpp" int main() { homecoming 0; }

i want execute on terminal, wrote

g++ -c c_lib.cpp g++ -c main.cpp g++ -o run c_lib.o main.o

until here, there no error report.

then

./run

i error

error: ./run: no such file or directory

what's wrong?

including .cpp not done, headers included. headers contain declarations define interface code in other .cpp can show source of c_lib? may help.

as source of c_lib #included, there no need compile seperately. in fact can/will cause errors (multiple definitions beingness first come mind). should need do:

g++ -o run main.cpp

to compile code in case. (when using header (.h), need compile implementation (.cpp) seperately)

compile warnings turned on:

g++ -wall -wextra -o run main.cpp

and more output if there problems code.

is run file beingness output gcc? can test calling ls in terminal (or ls run show executable if present).

if executable present, isn't marked runnable. i'll go if problem outside general scope of site (though still related)

c++

c# - share a global variable to a class in asp.net application -



c# - share a global variable to a class in asp.net application -

i developping asp.net application. have page called "home.aspx" contains 2 buttons called "button1" , "button2". each button has onclick method, respectively called "button1_click" , "button2_click". goal share mutual variable between these 2 methods, tried add together property class associated page :

public partial class home : syste.web.ui.page { private int myproperty=0; protected void button1_click(object sender, eventargs e) { myproperty++; } protected void button2_click(object sender, eventargs e) { myproperty++; } }

with code, thinking "private int myproperty=0" called first time load , page. , when on page, if click on button1 or button2 myproperty incrementated one. when debugging, see each time click on button1 or button2 "private int myproperty=0" called 1 time again don't understand. has solution?

thanks in advance help.

in asp.net if want utilize global variables you'll have utilize session object(if variable different every single user, count how many time user click button) or application object(if variable mutual users count how much user visit site). example:

//set variable session["myvariable"] = value //get variable var myvariable = session["myvariable"]

the syntax equal application replace session application

c# asp.net

Camelcase Component name Not working in Yii + Ubuntu Server -



Camelcase Component name Not working in Yii + Ubuntu Server -

my component name admingeneralcomponent.php. when deployed code in ubuntu server, component stopped working , not throwing error @ all.

kindly suggest me how can traced problem , resolve it.

thanks lot.

yii yii-components

amazon web services - Make elastic beanstalk ELB listen on port other than 80, 443 -



amazon web services - Make elastic beanstalk ELB listen on port other than 80, 443 -

is possible utilize options customization create elb instance created using elastic beanstalk hear illustration on port 8000 ? tried next , instruction seems ignored ?

resources: awsebloadbalancer: type: "aws::elasticloadbalancing::loadbalancer" properties: listeners: - {loadbalancerport: 8000, instanceport: 80, protocol: "https", sslcertificateid: "arn:aws:iam::redacted"}

amazon-web-services elastic-beanstalk amazon-elb

android - How Onstop Method work for this demo? -



android - How Onstop Method work for this demo? -

i making demo understand stack , activity life-cycle.

i made:

mainactivity mainactivitydialog (another activity theme dialog) bactivity

i launched app , main activity shown. press button show dialog, mainactivitydialog opened. 1 time again press button on mainactivitydialog bactivity opened. finally, pressed button.

mainactivity -> mainactivitydialog -> bactivity ---back---> mainactivitydialog

here log of app :

my question are:

why mainactivity stopped after launching bactivity mainactivitydialog? after bactivity lifecycle method called, why mainactivitydialog stopped?

after pressing button in bactivity, mainactivity starts first mainactivitydialog starts , mainactivitydialog resume?

the order of calls onstop() , ondestroy() on multiple activities indeterminate.

if have multiple activities in activity stack no longer visible on screen, android may phone call onstop() on them whenever wants , in whatever order wants to. indication activity no longer visible user. cannot rely on order of onstop() calls multiple activities.

the same goes ondestroy(). android may phone call ondestroy() on activity 1 time activity has finished. if have multiple finished activities in task, android may phone call ondestroy() on them whenever wants , in whatever order wants to. indeterminate. phone call ondestroy() inform activity no longer active , should release resources may have.

there no guarantee onstop() or ondestroy() ever called. lastly lifecycle phone call guaranteed onpause(). after that, android can kill process without calling farther lifecycle methods.

in sec question want know why, after user presses button on bactivity, mainactivity starts first followed mainactivitydialog. reason mainactivity visible on screen first , mainactivitydialog visible on screen on top of mainactivity (because mainactivitydialog dialog-themed, doesn't cover entire screen , can see parts of mainactivity underneath it).

android android-activity android-lifecycle

ocaml - opam fails trying to install lwt looking for pthreads -



ocaml - opam fails trying to install lwt looking for pthreads -

on ubuntu trusty vm, i've installed opam (version 1.2.0) ppa recommended real world ocaml set docs.

when running

opam install lwt

the build fails, , examing .out file shows:

testing pthread: ........................... unavailable not checking glib next recquired c libraries missing: pthread.

i have ubuntu bundle libpthread-stubs0-dev installed. need install allow install succeed?

according https://github.com/realworldocaml/book/wiki/installation-instructions:

14.04 [trusty] comes recent versions of ocaml , opam. no ppa needed.

the instructions worked me in trusty vm.

also, create sure have aspcud bundle installed. otherwise, opam chooses wrong versions of packages, , i've seen error 1 time in case.

ocaml opam

javascript - How to get the raw value an field? -



javascript - How to get the raw value an <input type="number"> field? -

how can "real" value of <input type="number"> field?

i have input box, , i'm using newer html5 input type number:

<input id="edquantity" type="number">

this supported in chrome 29:

what need ability read "raw" value user has entered in input box. if user has entered number:

then edquantity.value = 4, , well.

but if user enters invalid text, want color input-box red:

unfortunately, type="number" input box, if value in text-box not number value returns empty string:

edquantity.value = "" (string);

(in chrome 29 @ least)

how can "raw" value of <input type="number"> control?

i tried looking through chrome's list of other properties of input box:

i didn't see resembles actual input.

nor find way tell if box "is empty", or not. maybe have inferred:

value isempty conclusion ============= ============= ================ "4" false valid number "" true empty box; not problem "" false invalid text; color reddish

note: can ignore after horizontal rule; it's filler justify question. also: don't confuse illustration question. people might want reply question reasons other coloring box reddish (one example: converting text "four" latin "4" symbol during onblur event)

how can "raw" value of <input type="number"> control?

bonus reading jsfiddle of of above (updated) quirkmode.org entry new input types

according whatwg, shouldn't able value unless it's valid numeric input. input number field's sanitization algorithm says browser supposed set value empty string if input isn't valid floating point number.

the value sanitization algorithm follows: if value of element not valid floating-point number, set empty string instead.

by specifying type (<input type="number">) you're asking browser work you. if, on other hand, you'd able capture non-numeric input , it, you'd have rely on old tried , true text input field , parse content yourself.

the w3 has same specs , adds:

user agents must not allow user set value non-empty string not valid floating-point number.

javascript html5 validation input

javascript - How do I add setTimeout to delay the fading animation in the following code? -



javascript - How do I add setTimeout to delay the fading animation in the following code? -

i'm using next fade in , fade out elements on hover:

$(".hidden").hover(function() { $(this).animate({ opacity: 1 }); }, function() { $(this).animate({ opacity: 0 }); });

i add together delay between opacity 1 , opacity 0 (wait moment , fade out element).

how can accomplish that?

yuu can utilize .delay() function http://api.jquery.com/delay/.

$(".hidden").hover(function() { $(this).delay(1000).animate({ opacity: 1 }); }, function() { $(this).delay(1000).animate({ opacity: 0 }); });

http://jsfiddle.net/gk14nqrx/

javascript jquery css

swiftmailer - How to use php monolog -



swiftmailer - How to use php monolog -

i've heard lot monolog(https://github.com/seldaek/monolog) & trying utilize in 1 of our app. but, can't able fig. out how utilize that. don't know it's i'm can't able documentation of or has no documentation @ all.

we want log our errors in db & send email notification error when it'll generate. sending email using swiftmailer(swiftmailer.org).

i can able run sample code github link,

<?php utilize monolog\logger; utilize monolog\handler\streamhandler; // create log channel $log = new logger('name'); $log->pushhandler(new streamhandler('path/to/your.log', logger::warning)); // add together records log $log->addwarning('foo'); $log->adderror('bar');

but can't able understand how utilize db & other email library.

you posted illustration yourself. instead of streamhandler utilize 1 or more of other handlers monolog offering.

you have code of handlers see dependencies need. within monolog directory , you'll find handler classes. code reliable documentation.

<?php utilize monolog\logger; utilize monolog\handler\swiftmailerhandler; utilize swift_mailer; // ... more dependencies need // create swift_mailer , swift_message instances $handlers = [ new swiftmailerhandler($swiftmailer, $swiftmessage), // add together more handler need ]; $log = new logger('name', $handlers); $log->warning('foo'); $log->error('bar');

you have create swift_mailer , swift_message instance swiftmailerhandler. instead of pushhandler, can add together array of handlers logger constructor.

the swift_message instance used every log message message replaces every time mail service body.

i can suggest read monolog code info farther documentation missing.

php swiftmailer monolog

c# - Error with using Bitmap class in project -



c# - Error with using Bitmap class in project -

hi trying split logic of simple wpf programme projects in .net. created project type class library. after tried utilize class bitmap in class of project validator find error "the type or namespace name 'bitmap' not found (are missing using directive or assembly reference?) c:\users\Микола\documents\visual studio 2013\projects\dragndrop\businesslogic\util.cs" how solve trouble?

p.s. sorry i'm started studing .net, , types of projects

using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.drawing; namespace businesslogic { class util { public bitmap cropimage(bitmap img, rectangle croparea) { bitmap bmpimage = new bitmap(img); homecoming bmpimage.clone(croparea, bmpimage.pixelformat); } } }

open solution explorer. in project folder, right-click 'references'. click 'add reference'. in list, check system.drawing. assembly reference added project. combined using line have, compiler should not complain anymore.

c# .net bitmap

javascript - Node Mustache: How to get each value of an Array on a separate Radio Button? -



javascript - Node Mustache: How to get each value of an Array on a separate Radio Button? -

environment: node, express, mu2express, mongoose

what want array mongoose , have template render each value own radio button.

can't find example.

what have:

the route in app.js:

app.get('/mutest',function(req, res){ var info = [1,2,3,4]; res.render('mutest',{ 'locals': { data: info }}); });

the template (mutest.mustache)

<form name="test" action="mutest" method="post"> {{#data}} <input type="radio" name="choice" value={{data}}>{{data}}<br/> {{/data}} <input type="submit" value="submit"> </form>

the result:

1,2,3,4 1,2,3,4 1,2,3,4 1,2,3,4

and, of course, choosing of buttons submits value of "1,2,3,4".

what want: page rendered this:

1 2 3 4

with single value (e.g. string "3") submitted.

tia suggestions!

the trick have refer current item beingness pointed at:

in first case, you're using {{data}} value (and text of radio button) refers info array.

in sec case, you're using {{data[0]}} refer first element of array.

for mustache (super spec compliant) have wrap values (1,2,3,4) object:

data = [ {value: 1, label: 1}, {value: 2, label: 2}, .... ];

then:

<form name='test' action='mutest' method='post'> {{#data}} <input type='radio' name='choice' value={{#value}}>{{#label}}</input/><br/> {{/data}} <input type='submit' value='submit'/> </form>

in mustache.js, {{.}} operator using 'this' object in javascript (or self in python, etc):

<form name='test' action='mutest' method='post'> {{#data}} <input type='radio' name='choice' value={{.}}>{{.}}</input/><br/> {{/data}} <input type='submit' value='submit'/> </form>

and output is:

<form name='test' action='mutest' method='post'> <input type='radio' name='choice' value='1'>1</input><br/> <input type='radio' name='choice' value='2'>2</input><br/> <input type='radio' name='choice' value='3'>3</input><br/> <input type='radio' name='choice' value='4'>4</input><br/> <input type='submit' value='submit'/> </form>

javascript node.js express mongoose mustache

hash funcion in C -



hash funcion in C -

i need create hashing function... can u help me ?

the input sequence of numbers.your task determine number of how many numbers repeated.

its string of numbers , letters (*a[]). n number of digits -input.

returns number of repetition.

int function(char *a[], int n) { int i,j; int same=0; for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(!strcmp(a[i],a[j])) same++; } } homecoming same; } int main(void) { char *a[] = {"aa123456", "ba987689", "aa123123", "aa312312", "bb345345", "aa123123"}; printf("number of duplicates: %d\n", function(a, 6)); homecoming 0; }

read wikipage on hash functions & hash tables.

often, linear combination prime coefficients (see bézout's identity) , involving components , partial hash gives plenty result.

for example, like

int basile_hash(const char*str) { int h = 65537; while (*str) { h = 75553*h + 5531* (*str); str++; }; homecoming h; }

i don't claim hash, plenty needs. constants 65537, 75553, 5531 primes (given /usr/games/primes bsdgames debian package)

you create variant bitwise xor ^, or take business relationship more 1 component:

h = 65579*str[0] ^ 5507*str[1] + 17*h; str += 2;

but should care -and special-case when s[1] terminating null byte.

read md5

notice lot of standard or popular libraries gives many hash functions. of time particular selection of hash function not important. on other hand, can still earn phd on studying , inventing hash functions. have 1 in values.c file, function mom_cstring_hash near line 150 (i imagine might improve optimized, since big strings of instructions might run "in parallel" within processor).

i don't claim expert on hash functions.

study source code of hash functions in free software libraries glib, qt, etc.... see gperf

c hash