Posts

Showing posts from April, 2013

c++ - ofstream is writing date and time only -

i trying write text file after code executes can see time , date written in file rather actual data need written file. what strange when run program can see data stored in memory until close windows console not storing data file. i have code uses ifstream , has close @ end not sure if might keeping file open. when writing file program writes @ last position of cursor rather end of file. here code write file. void createperson (person persons[], int* count) { char fullname[100]; char personaddress[200]; int marks1; int marks2; int marks3; int marks4; int marks5; int personnumber; string persongender; ofstream outfile("testfile.txt", std::ios_base::app); if(outfile.fail()){ cerr << "file cannot opened" << endl; } cout<<"enter person's number: "<<endl; cin>>personnumber; cout <<"enter person's full name: "<<endl; cin.ignore();

JavaDoc generation in Android Studio: NullPointerException -

when trying generate javadoc in android studio, acts , shows countless errors concerning non-existing packages , unknown symbols (mostly android-related stuff). finally error message: standard doclet version 1.7.0_55 building tree packages , classes... java.lang.nullpointerexception @ com.sun.tools.javadoc.typemaker.gettype(typemaker.java:83) @ com.sun.tools.javadoc.typemaker.gettype(typemaker.java:44) @ com.sun.tools.javadoc.classdocimpl.superclasstype(classdocimpl.java:496) @ com.sun.tools.doclets.internal.toolkit.util.util.getallinterfaces(util.java:459) @ com.sun.tools.doclets.internal.toolkit.util.util.getallinterfaces(util.java:497) @ com.sun.tools.doclets.internal.toolkit.util.classtree.processtype(classtree.java:194) @ com.sun.tools.doclets.internal.toolkit.util.classtree.buildtree(classtree.java:146) @ com.sun.tools.doclets.internal.toolkit.util.classtree.<init>(classtree.java:91) @ com.sun.tools.doclets.internal.toolkit.abstra

java - Best way to hack the return type on an implemented method? -

i'm implementing service through maven dependency takes data , spits out @ virtual location, provided conforms strict type requirements. however, i've swapped out 1 of fields (let's call field buzz , implementation of buzzer ) , wondering if can make work rest of service. the service call factory requires type buzz , diff between buzz , buzzer few added member fields. there hack can make factory accept buzzer ? looking through code, service not seem dependent on hashcode of buzz being correct. edit: examples class buzz { public string id public string name public string title public iterable<profile> profiles public myconstructor(string id, string name, string title, iterable profile) { this.var = var; } } and class buzzer { public string id public string name public string title public profile profiles public myconstructor(string id, string name, string title, profile profiles) { this.var = var; }

Multithreading in SPIN model checker -

how parametrize spin model number of threads? using standard spin model checker. have options set number of parallel threads? checked reference didn't find useful you can dynamically spawn promela process using run operator. can iterate as: #define try_count 5 byte index = 0; :: index == try_count -> break :: else -> index++; run theprocess() od you can define file like: active [try_count] proctype foo () { printf ("pid: %d\n", _pid); assert (true) } init { assert (true) } and run spin simulation: $ spin -dtry_count=4 bar.pml pid: 2 pid: 0 pid: 1 pid: 3 5 processes created or verification $ spin -dtry_count=4 -a bar.pml $ gcc -o bar pan.c $ ./bar hint: search more efficient if pan.c compiled -dsafety (spin version 6.3.2 -- 17 may 2014) + partial order reduction ...

sql server - Generate XML from Query with a certain XSD definition? -

i have following query select a,b,c,d,e,f,g,h view1 = '....' and want generate following xml. possible use sql server for xml it? or there other approach can implemented in sql server? <root> <a>....</a> <!-- appear once --> <b id="1"> <type c="..." d="..."> <subtype> <element e="..." f="...."> <g>...</g> <h>...</h> </element> ..... </subtype> .... <type> ..... </b> <b>..... yes for xml path can used desired result declare @test table ( int, b int, c int, d int, e int, f int, g int ) insert @test values (1,2,3,4,5,6,7) insert @test values (1,3,4,4,5,6,7) select (select top 1 @test a=1 ) 'a/text()', ( select b '@id', (select c '@c', d '@d',

windows - New to batch programming. Help on setting new variables -

i trying perform below. if try setting accname variable letter rather /p facing syntax error. can tell me why cannot use other variable letter please? @echo off echo -create set /p program= want do?: goto %program% :create set /b accname= please type in username: echo %accname% > usernames.txt pause /p not variable letter, rather switch tells "prompt user enter new value of program variable". without /p , set program= want do?: , set value of variable program string what want do?: . and syntax error because there's no /b switch set command. for full syntax of set command, use set /? .

powershell - Where does Pester's Invoke-Pester reside? -

according this documentation should possible measure code coverage using pester. ps c:\path\to\codecoverage> invoke-pester .\coveragetest.tests.ps1 -codecoverage .\coveragetest.ps1 invoke-pester : term 'invoke-pester' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. @ line:1 char:1 + invoke-pester .\coveragetest.tests.ps1 -codecoverage .\coveragetest.ps1 + ~~~~~~~~~~~~~ + categoryinfo : objectnotfound: (invoke-pester:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception after reading this documentation clear pester module needs imported before running invoke-pester ps c:\path\to\codecoverage> import-module "c:\programdata\chocolatey\lib\pester.3.1.1\tools\pester.psm1" ps c:\path\to\codecoverage> invoke-pester .\coveragetest.tests.ps1 -codecoverage .\coveragetest.ps1 executing tests in &#

session - isset and empty functions are executing code when they shouldn't be - PHP -

i have come across problem isset , empty in php textarea box. first test see if $_post array contains text. if does, stores text in $_session array index comments . i've tried hitting submit empty textarea , instead of bypassing conditional statement, executing , putting blank data in database. heres html: <p class="center"><textarea placeholder="450 characters max!" rows="10" cols="50" name="message" maxlength="450"></textarea></p> this executes in script related form: if (isset($_post['message']) || !empty($_post['message'])) { $_session['comments'] = $_post['message']; } this part of function in script: if (isset($_session['comments']) || !empty($_session['comments'])) { $comment = $_session['comments']; // comment_id, user_id, comments $sql

python - Create pypy process -

i create process runs pypy. tried following , works: import os os.chdir('<path-to-pypy-download>/bin/') os.execl('pypy', 'pypy', '-c', 'print "hi!"') however, when remove chdir as: import os os.execl('<path-to-pypy-download>/bin/pypy', 'pypy', '-c', 'print "hi!"') i get: debug: warning: library path not found, using compiled-in sys.path. debug: warning: 'sys.prefix' not set. debug: warning: make sure pypy binary kept inside tree of files. debug: warning: ok create symlink somewhere else. debug: operationerror: debug: operror-type: importerror debug: operror-value: no module named os please, know how spawn pypy process without changing working directory? this may not correct (in case i'll delete it), i'm pretty sure need is: os.execl('<path-to-pypy-download>/bin/pypy', '<path-to-pypy-download>/bin/pypy'

using loops or lapply in R -

i'm trying iteratively loop through subsets of r df having trouble. df$a contains values 0-1000. i'd subset df based on each unique value of df$a, manipulate data, save newdf, , concatenate (rbind) 1000 generated newdf's 1 single df. my current code single iteration (no loops) this: dfa = 1 dfa_1 <- subset(df, == dfa) :: ddply commands on dfa_1 altering length , content :: edit: clarify, in single iteration version, once have subset, have been using ddply count number of rows contain values. not subsets have values, result can of variable length. thus, have been appending result skeleton df accounts cases in subset of df might not have rows containing values expect (i.e., nrow = 0). ideally, wind subset being fixed length each instance of a. how can incorporate single (or multiple) plyr or dplyr set of code? my issue loops length not variable, rather unique values of df$a. my questions follows: 1. how use loop (or form of apply) perform operation? 2. can th

how to keep data from lines in file until condition met later in file python -

i suspect repeat question, have searched while , don't seem have wording right find answer question. sorry if repeat in advance! i trying print following information file reading in line line. gene-1 gene-2 gene 0* gene1 gene2 *referred ncrna gene in code i have been able gene0, gene1, gene2, having trouble trying figure out how buffer gene-1 , gene-2 until condition gene 0 (data[2] = ncrna) met. in other words, need have variable information previous lines, when condition in current line met. have thought in commented out section below, seems there must better way (it nesting mess). file looking through gff file. i don't know how make placeholder 'previous information' until condition met. import sys import re gff3 = sys.argv[1] f = open(gff3, 'r') ncrnagene= false fgene_count=0 while true: line = f.readline() if not line.startswith('#'): data = line.strip().split("\t") ### not important question, me

Very Basic Query on Java Array processing -

trying self teach java here, complete beginner. im trying select , print multiples of 10 array. its surely simple if know how? thanks can give....! on side note think glass of whiskey might necessary me through learning this?? my (very dodgy) code is: //print multiples of 10 in array double dangermouse[] = { 1,2,4,8,16,32,64,128,256,512 }; double total = 0; if (total %10 = 0) { (double x : dangermouse) { total = x; } } system.out.println (total); dangermouse you should stop drinking whisky while coding. for (int = 0; < dangermouse.length; i++) { if (dangermouse[i] % 10 == 0) { system.out.println(dangermouse[i]); } } loop goes through array. if statement checks current array member if multiple of 10. if print , move next element in array , repeat until run out of array.

file - Make a Directory witout prompt -

this first question. i follow intruction example , created batch set name=%date:/=_% xcopy /s/y "c:\user\debuglogs\*.*" "%c:\user\desktop\log backup\%name%" it works great job when prompt ask specify d)directory or f)file what can add batch directory no prompt? put ending slash output location in: xcopy /s/y "c:\user\debuglogs*.*" "%c:\user\desktop\log backup\%name%\" that tell xcopy place files specified directory.

c++ - Code with multiple inheritance and too much public access -

i have following chunk of code defining functor composition... #pragma once #include <tuple> template<typename args,std::size_t a,typename...f> class _compose{}; template<typename...args,std::size_t a,typename f,typename...g> class _compose<std::tuple<args...>,a,f,g...> :private _compose<std::tuple<args...>,a-1,g...>{ const f f; public: _compose(f _f,g...g):_compose<std::tuple<args...>,a-1,g...>(g...),f(_f){}; constexpr auto operator()(args...args) const{ return f(_compose<std::tuple<args...>,a-1,g...>::operator()(args...)); } }; template<typename...args,typename f> class _compose<std::tuple<args...>,1,f>{ const f f; public: _compose(f _f):f(_f){}; constexpr auto operator()(args...args) const{ return f(args...); } }; template<typename...args> struct compose{ template<typename...fs> constexpr auto operator()(fs...f){ r

Spotify check if access_token is expired -

a small questions. @ moment i'm using spotify webapi, , want know there web api endpoint check if access_token expired? @ moment i'm using get https://api.spotify.com/v1/me to check if access_token expired. there's no endpoint check how long time there's left until token expires, can use response access token request find out. as explained in web api authorization guide , response including access token contains expires_in int time period (in seconds) access token valid.

html - Read more link in wordpress -

Image
i've been trying change read more buttons in front page while i've narrowed down html text. printf('<p>%s</p>', get_the_excerpt($post->id)); printf('<a href="%s" class="button">read more</a>', post_permalink($post->id)); i wondering how come read more buttons/links don't have urls? , post id mean? there's info on treatment of wordpress variables here . in case, %s string variable within printf being generated functions get_the_excerpt() , post_permalink() both of functions using id of post (post id) retrieve results print.

ssms - SQL Server Management studio won't start - Type library could not be found -

i running sql server management studio developer edition 2012, , program not start morning. have tried online, no avail. when (attempt to) start application, greeted message: "the proper type library not found in system registry an attempt repair condition failed because not have permissions write tot system registry or because thetype library not loaded" if click "ok" on message, followed "the application cannot start" error. i running administrator, , have tried repairing sql server 2012, uninstalling , reinstalling it, error message persists. have tried right clicking , running administrator, "application cannot start" message. between these 2 related questions, appears permissions issue: the proper type library not found in system registry (vs2012 rc) the proper type library not found in system registry sql 2008 r2 management studio error change ownership in parent folder in registry. give full control local admi

iPhone Simulator Keyboard iOS7.0 -

i installed xcode 6.0. i'm trying replicate problem users having keyboard covering items. have target set 7.0 , simulator set ipad2. however, keyboard still looks ios 8.0 keyboard - row @ top device tries guess word typing. row covers textfield in app don't think older keyboard would. is there way simulator to, know, simulate 7.0 instead of 8.0? missing setting? your deployment target sets minimum supported os version project. need choose ios 7.0 device run destinations menu in xcode. make sure you've installed ios 7.0 runtime xcode's preferences. note 7.0 supported on mavericks. ios 7.1 supported on both mavericks , yosemite.

java - Android Images Folder in a ImageView -

sorry in advance english. i want import images folder of smartphone. want used these images gallery. problem when put images in array, after can't put each images of array in imageview. it's code using gallery public class seegallery extends activity { file[] listfile ; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_see_gallery); file folder = new file(environment.getexternalstoragedirectory() + "/projectkozaimages"); listfile = folder.listfiles(); // note gallery view deprecated in android 4.1--- gallery gallery = (gallery) findviewbyid(r.id.gallery1); gallery.setadapter(new imageadapter(this)); gallery.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position,long id) { // display images selected imageview imageview = (imageview) findviewbyid(r.id.image1);

ExtJS/JavaScript - how to post list of grid records to download url? -

Image
i need pass record or list of records post param download action... possible? a seemingly straight forward question complex answer. mdn has written better ever do: https://developer.mozilla.org/en-us/docs/web/guide/html/forms/sending_forms_through_javascript for extjs approach create form without rendering it: var formpanel = ext.create('ext.form.panel', { url: 'https://www.sencha.com/img/learn/extdesignergettingstarted_html_m4fab468.png', standardsubmit:true, baseparams: { param1: 'textfield', param2: 123 } }); formpanel.form.submit(); delete formpanel; this creates post params this: note header have respond specific headers trigger download in browser, see: https://stackoverflow.com/a/3358583/1861459

Excel: Search for text-string in a row, return value of adjacent column cell (columns will differ frequently) -

i have tried use vlookup , hlookup , lookup , index , match haven't far been able solve problem. want fill column value adjacent value left of string might found in each row. column of interest differs. e.g. return value of f1 if g1=string, f2 if g2=string, e3 if f3=string, d4 if e4=string picture i managed solve by: =iferror(index($s2:$bj2, match("string", $s2:$bj2,0)-1),"") now, if want extract 2nd, 3rd , 4th value (if happens more 1 match) adjecent "string" changes have made?

r - How to populate missing match value -

i using match function when match not found want text returned: input map<-c("hi","bye") r<-data.frame(x= c("bye","hi",3909090)) r$y<- c(100,200,300) r r$matchcolumn <- map[ match(r$x,map) ] r is.na(r$matchcolumn) output > r x y 1 bye 100 2 hi 200 3 3909090 300 > r$matchcolumn <- map[ match(r$x,map) ] > r x y matchcolumn 1 bye 100 bye 2 hi 200 hi 3 3909090 300 <na> ####################### can see na here > is.na(r$matchcolumn) [1] false false true i want r this: > r x y matchcolumn 1 bye 100 bye 2 hi 200 hi 3 3909090 300 missing data i want thinking use is.na(r$matchcolumn) somehow idea? thank you. is you're looking for? r$matchcolumn[is.na(r$matchcolumn)] <- 'missing data'

jquery - Get HTML Divs From PouchDB -

i'm saving html divs pouchdb "board" object. have function of saved divs: window.viewboards = function() { var results = db.alldocs({include_docs: true}, function(err, response) { }); } the results have divs pretty buried in them: promise {cancel: function, [[promisestatus]]: "resolved", [[promisevalue]]: object}cancel: function (){return this}__proto__: promise[[promisestatus]]: "resolved"[[promisevalue]]: objectoffset: 0rows: array[5]0: object1: object2: object3: object4: objectdoc: object_id: "2014-12-05t20:48:57.327z"_rev: "1-68823c9c66374d831b482b9a67354301"board: "↵ <div class="square" style="background-color: rgb(162, 136, 99);"></div><div class="square" style="background-color: rgb(25, 108, 184);"></div><div class="square"></div><div class="square"></div><div class="square"></div&

node.js - Mongoose grouping error -

i got trouble filter , group on mongodb. didn't undertanded how works. for example, in query: room.aggregate( [{ "$where": { "roomid" : myidhere }, "$group": { "_id": '$mobileuser.gendertype', "gendertypecount": { "$sum": 1 } } }] room model: var roommodelschema = mongoose.schema({ roomid: string, mobileuser: { facebookid: string, email: string, name: string, photourl: string, gendertype: string, birthday: date, city: string }, insertdate: date }) what should filter roomid , group gendertype? use $match instead of $where , , put each pipeline operation own object: room.aggregate([ { "$match": { "roomid" : myidhere } }, { "$group": { "_id": '$mobileuser.gendertype', "gendertypecount": {

variadic functions - C++: va_list error generic thunk code fails for method -

this class: class controlboard : public ilcd { virtual void print(const gfx_string &string, ...); // ... this interface: class ilcd { virtual void print(const gfx_string &string, ...) = 0; // ... this method: void controlboard::print(const gfx_string &string, ...) { va_list args; va_start(args, string); // ... va_end(args); } and compilation error: error: generic thunk code fails method 'virtual void controlboard::print(const gfx_string&, ...)' uses '...' if method "print()" not in ilcd interface, compilation fine. need add it, don't understand why error appears ? thank ! a simple c code va_list int writelog ( const char *pszbuffer, ... ) { file *fp; int iret = fail; va_list valistarguments = null; fp = _tfopen( logpath, "a" ); if( null == fp ) { return fail; } if( null != pszbuffer ) { va_start( va

python - Turning DataFrameGroupBy.resample hierarchical index into columns -

Image
i have dataset contains individual observations need aggregate @ coarse time intervals, function of several indicator variables @ each time interval. assumed solution here groupby operation, followed resample: adult_resampled = adult_data.set_index('culture', drop=false).groupby(['over64','regioneast','pneumo7', 'pneumo13','pneumo23','pneumononpcv','penr','levr', 'erythr','pens','levs','eryths'])['culture'].resample('as', how='count') the result awkward-looking series massive hierarchical index, perhaps not right approach, need turn hierarchical index columns. way can hack hierarchical index (by pulling out index labels, contents of columns need). any tips on ought have done instead appreciated! i've tried new grouper syntax, not allow me subsequently change hierarchical indices data columns. applying unstack table:

java - Read a .txt file and return a list of words with their frequency in the file -

i have far prints .txt file screen: import java.io.*; public class readfile { public static void main(string[] args) throws ioexception { string wordlist; int frequency; file file = new file("file1.txt"); bufferedreader br = new bufferedreader(new inputstreamreader(new fileinputstream(file))); string line = null; while( (line = br.readline()) != null) { string [] tokens = line.split("\\s+"); system.out.println(line); } } } can me prints word list , words frequency? do this. i'm assuming comma or period occur in file. else you'll have remove other punctuation characters well. i'm using treemap words in map stored natural alphabetical order public static treemap<string, integer> generatefrequencylist() throws ioexception { treemap<string, integer> wordsfrequencymap = new treemap<string, integer>(); string file = &quo

Best way to ID an Android Device -

i have 10 devices have same android id. whoever set these devices must have copied on id when installing operating system. application i've created using android id distinguish between devices. is there way me change id using application? since didn't wrote more details guess talk gingerbread devices. time there bug ended in many devices had same id. check this question android ids.

php - How to cache this mysql query for the make and model of a vehicle? -

i have php code queries mysql database of year makes , models. year hard coded in php small amount of data. make , model queried database based on previous choices. ie: selecting 2012 allows makes of cars made in 2012 , after selecting make lists models made chosen make. below code have creates query select make. how can cache after called set amount of time speed subsequent queries? or possible? i should mention hosting provider doesn't allow me turn caching on mysql. why try in php. $year = $_post['year']; // year post - sent via ajax $vehmakes = $cl->getmakes($year); $output = '<option value="">-- makes --</option>'; while($row = mysql_fetch_row($vehmakes)){ $output .= '<option value="'.$row[0].'">'.$row[0].'</option>/n'; }; echo $output; thanks! i write flat file comma separated list of makes given year , check if file exists before making db query. perhaps set timest

marklogic - How to set the value of one field to another filed in using XQuery -

very new xquery , marklogic, xquery version of following statement? update all_the_records set b_field = a_field b_field null , a_field not null something might started. remember you're working trees, not tables. things more complicated because of dimension. for $doc in collection()/doc[not(b)][a] let $a element() := $doc/a return xdmp:node-insert-child($doc, element b { $a/@*, $a/node() })

java - Accept only unique input from a user into an ArrayList -

i @ loss of how allow user enter 3 unique numbers. have tried create array adds input , checks damage array make sure numbers unique, not seem work. thank help!! arraylist<integer> damage = new arraylist<integer>(); arraylist<integer> unique = new arraylist<integer>(); (int k = 0; k<=10; k++) { unique.add(k); } { system.out.print("attack or defend? (a or d) "); option = keyboard.nextline().touppercase(); system.out.println(); switch (option) { case "a": system.out.println("enter 3 unique random numbers (1-10)"); for(int = 0; i<3; i++) { system.out.print("number " + (i+1) + ": "); input = keyboard.nextint(); if (input < 1 || input > 10) { system.out.

PHP fgets() to array -

i want first line of foo.csv array. foo.csv: i, like, chocolate and, also, milk i tried //$foo foo.csv $file = fopen($foo, "r") //first attempt $fgetsfile = fgets($file) //other way $streamlinefile = stream_get_line($file, 10000, "\n"); fclose($file) var_dump($fgetsfile) // (string) "i", "like", "chocolate" var_dump($streamlinefile) // (array) [0] => (string) "i", "like", "chocolate" i end array this: array([0] => "i", [1] => "like", [2] => "chocolate) you can accomplish more using fgetcsv(). take @ the documentation , corresponding example, maybe use (tested): if(($file = fopen($foo, "r")) !== false){ if(($data = fgetcsv($file)) !== false){ var_dump($data); } } fclose($file);

sql - How to manage a contact relation in database -

i have create database schema manager user contacts. explain... i have simple user table primary key (named id). i have contact table having 2 foreign keys (senderid user, receiverid user) constituting primary key. my problem if user send contact invitation user b, have following entry : contact(a,b) in case, can have entry contact(b,a) similar other entry. how can manage case ? thanks help. i create 2 separate tables, 1 pending requests contactrequests(senderid, receiverid) , , contact lists named contact(user_id,contact_id) . i store contact requests in contactrequests did , upon request validation, create 2 entries in contact this: contact(a,b) contact(b,a) , delete pending request. doing able user contact list independently sent request. googling "many many relationship" design database.

shell - How do I correctly pass double quotes to an awk subprocess in Python? -

i trying run simple awk shell command , capture output (using python2). here try do: import subprocess sb shell = ["awk '!/<tag>/ {print \"\\"\"$1\"\\"\", \"\\"\"$2\"\\"\"}' test.txt"] p = sb.check_output(shell, shell=true) print p test.txt content: a, b, 5 a, c, 3 d, d, 1 i want following output awk , store variable: "a" "b" "a" "c" "d" "d" however lack knowledge of how handle double quotes . tried escaping them several backsplashes, didn't work. how correctly escape double quotes example above work? when use shell=true pass list, you're asking python merge list of strings if separate arguments. means may own quoting, on top of whatever quoting did, in hopes shell reverse things properly. going nightmare right. if want use shell=true , pass string. but raises question of why you're using shell=true in

Can't find Flyway maven plugin -

in pom.xml, have: <plugin> <groupid>org.flywaydb</groupid> <artifactid>flyway-maven-plugin</artifactid> <version>3.1</version> <configuration></configuration> </plugin> to test plugin, i'm doing: mvn flyway:migrate but error: [error] no plugin found prefix 'flyway' in current project , in pl ugin groups [org.wildfly.plugins, org.flywaydb.plugins, org.apache.maven.plugins , org.codehaus.mojo] available repositories [local (c:\users\me\. m2\repository), central (https://repo.maven.apache.org/maven2)] -> [help 1] what missing pom? flyway plugin in central. you should run mvn compile flyway:migrate inside project class path. suppose has project name bar store inside c:\project directory. you should open command prompt , change change directories c:\project\bar . then, run mvn compile flyway:migrate instead of use mvn flyway:migrate see also, first steps: flywayd

javascript - jQuery to extract 'Click Me' from <a href="http://example.com">Click Me</a> -

my code looks this.. $(row).children("td").eq(index).html() and gives me: <a href="http://example.com">click this</a> from console taking above element var item = $(row).children("td").eq(index); item[0].innertext() // outputs "click me" doesn't work in app. but doesn't work in js in rails app , generates error. how structure code outputs 'click me' im wanting? for background i'm developing rails4 app , using coffeescript, don't think that's relevant here. [edit 1:] when use code: $(row).children("td").eq(index)[0].text() produces error: 'uncaught typeerror: undefined not function' it's table sorter i'm building. i'm addressing fact sorter working fine table entries built plain text, eg city field, it's incorrectly sorting name field processing whole field string. i need able have extract text field within address tag if there 1 , otherwis

Perl script clarification -

i have following perl script , observed statement @ line number 5 taking 30 sec execute. not have clue how investigate why taking time. can please suggest me on reason? sub parse { $self = shift; $parse_options = $self->get_options(@_); $method = $self->can('_parse_systemid'); return $method->($self, $parse_options->{source}{systemid}); # takes 30 s } the code provided: sub parse { $self = shift; $parse_options = $self->get_options(@_); $method = $self->can('_parse_systemid') return $method->($self, $parse_options->{source}{systemid}); # takes 30 s } can refactored this: sub parse { $self = shift; $parse_options = $self->get_options(@_); return $self->_parse_systemid( $parse_options->{source}{systemid} ); # still takes 30s. } in either case, if _parse_systemid isn't member function of object referred $self, script dies, use of can useless. anyway, code taking long time exe

ruby on rails - Is there a way to set the controller action for resources defined with only: or except:? -

i have nested nested resources: resources :assessments member 'result' end resources :respondents, only: [:new, :create] collection post "invite", to: :invite_all "invite", to: :new_invite end end end for line resources :respondents, only: [:new, :create] possible set action new , crate actions? can use to: set action single resource. i'd avoid writing match statements if can , keep things resourceful. what motivates me ask i'd able specify action nested resource rather have route child resource's action. example: if define resources :assessments resources :respondents end the path /assessments/:id/respondents/new route respondents#new . problem forces me add logic new action determine if route contains assessment id or not , render correct view. i'd able send nested resource different action. there "rails way" this? why not not nest resources this

javascript - RangeError: call stack exceed on async .eachSeries -

at last, actual stack overflow error reported on stackoverflow! i following error in code below: var m = patha.substr(-(pathb.length)); // var ^ rangeerror: maximum call stack size exceeded i'm sure answer reported here, towards bottom: https://github.com/caolan/async/issues/75 however, don't understand how fix code. not calling sync functions inside async functions, far know. can clarify have fix code? i'm iterating on cross-product of result-set concatenate path strings 1 substring of other. var = 0; async.eachseries(results.rows, function (r, next2a) { var patha = results.rows[i].id_path; var j = 0; async.eachseries(results.rows, function (r2, next1a) { var pathb = results.rows[j].id_path; //check i=j if (!(i == j)) { var m = patha.substr(-(pathb.length)); // var m = (patha || '').substr(-((pathb) ? pathb.length : 0));

android.os.NetworkOnMainThreadException in onHandleIntent method of IntentService -

i'm using broadcastreceiver , intentservice background operations , pass data activity . know, intentservice executing in different ui thread, nevertheless i've got android.os.networkonmainthreadexception method registering broadcastreceiver : private void registerreceiver() { // создаем broadcastreceiver bcarbroadcast = new broadcastreceiver() { // действия при получении сообщений public void onreceive(context context, intent intent) { int status = intent.getintextra(constants.car_search_status, 0); int task = intent.getintextra(constants.car_search_task, 0); log.d(tag, "onreceive: task = " + task + ", status = " + status); if (status == constants.status_running) { beginprogresstask(); } if (status == constants.status_finished) { string data = intent.getstringextra(constants.car_search_data);

ember-simple-auth-torii Facebook provider never returns promise from open function -

Image
i'm using ember-simple-auth-torii custom facebook oauth2 authenticator, never seem able have promise return data (for data.authorizationcode ). popup window hangs until close it, @ point popupclosed error message. what missing should doing? thanks! facebookauthenticator = oauth2.extend torii: null provider: "facebook-oauth2" authenticate: (credentials) -> = new ember.rsvp.promise((resolve, reject) -> that.torii.open(that.provider).then((data) -> data = facebook_auth_code: data.authorizationcode that.makerequest(that.servertokenendpoint, data).then ((response) -> ember.run -> expiresat = that.absolutizeexpirationtime(response.expires_in) that.scheduleaccesstokenrefresh response.expires_in, expiresat, response.refresh_token resolve ember.$.extend(response, expires_at: expiresat, access_token: response.access_token, u

Returning String Arrays and Arrays operations in JAVA -

i writing using java. putting objects vehiclelist array , having issues returning array in getvehiclelist class. vehiclelist array of vehicle[]. keep getting "string cannot converted string[]. hope making sense. here usetaxlist class. appreciated. thank you. this have far , keep getting error "string cannot converted string[]". know error means, don't know how resolve it. public vehicle[] getvehiclelist() { string[] result; (int = 0; < vehiclelist.length; i++) { result += vehiclelist[i].tostring(); } return result; } if want convert elements vehiclelist string-objects, can write string[] result = new string[vehiclelist.length]; (int = 0; < vehiclelist.length; i++) result[i] = vehiclelist[i].tostring(); return result; simply write code getvehiclelist()-method. might have add custom tostring()-method in vehicle-class!

html - Display: inline removes blocks -

i've been learning html , css around 2 months, apparently i'm still neophyte. i'm trying create of header nav bar here, when ever set property display:inline , poof ! disappear. i'm pretty sure problem rudimentary input have helps. div { border-radius: 5px 55px 5px 55px; } #header { height: 50px; width: 200px; background-color: #f38630; margin-bottom: 10px; margin-top: 10px; display: inline; } .left { height: 300px; width: 150px; background-color: #a7dbd8; float: left; margin-bottom: 10px; } .right { height: 300px; width: 450px; background-color: #e0e4cc; float: right; margin-bottom: 10px; } #footer { height: 50px; background-color: #69d2e7; clear: both; } in nutshell, should not using display: inline not intended displayed inside block of text. this site learning layout basics: http://learnlayout.com if want learn stuff though, best place know: https://d

mysql - ORDER BY Count(p.id) is it possible? -

i have following query: $querybuilder = $em->createquerybuilder()->select('s') ->from("mainbundle:style", 's') ->select('distinct s') ->leftjoin('s.picturestyle', 'ps') ->leftjoin('ps.picture', 'p') ->leftjoin('p.category', 'pc'); if ($category instanceof instagramtopcategory) { $querybuilder->leftjoin('pc.picturetopcategory', 'category'); } else if ($category instanceof instagramfirstlevelcategory) { $querybuilder->leftjoin('pc.picturefirstlevelcategory', 'category'); } else if ($category instanceof instagramsecondlevelcategory) { $querybuilder->leftjoin('pc.picturesecondlevelcategory', 'category'); } $query = $querybuilder->

C code to get the interface name for the IP address in Linux -

how can interface name ip address in linux c code ? e.g. i'd interface name ( etho , eth1 , l0 ) assigned ip address 192.168.0.1 you can use getifaddrs . see man 3 getifaddrs usage information. work on unix-like systems.

html5 - create this shape using css3 and html -

Image
this demo image how create button in css3. please me anyone. funny exercise, this? div { height: 40px; width: 20px; border-radius: 8px; background: rgb(231,76,60); position: relative; } div:before { content: ''; height: 16px; width: 8px; border-radius: 3px; background: rgb(221,221,221); display: block; position: absolute; top: 6px; left: 6px; } <div></div>

c# - Apply validation for few sections in the same view in mvc -

i developing mvc project using c#. have 1 model called employeeeducationdetails . lets have @ have created public class educationlist { public list<employeeeducationdetailtable> employeeeducationlist { get; set; } public educationlist() { employeeeducationlist = new list<employeeeducationdetailtable>(); } public virtual employeemaintable employee_maintable { get; set; } public icollection<employeequalificationtypetable> employee_qualficationtypetable { get; set; } } public class employeeeducationdetailtable { public int employeeid { get; set; } public int employeeeducationdetailid { get; set; } [required(errormessage = "select qualification")] public int? employeequalificationtypeid { get; set; } [required(errormessage = "enter institute name")] public string employeeinstitutename { get; set; } [required(errormessage = "enter year of pass")] public datetime? employeeyearofpass { get; set; }

php - My server cannot send email even though the mail function is returning true -

this question has answer here: php mail function doesn't complete sending of e-mail 24 answers i trying send email server. using php's mail function. function returning true. not receiving email. have checked logs. , logs not showing error. domain "islamerkotha.com". code given below - <?php $msg = "first line of text\nsecond line of text"; $msg = wordwrap($msg,70); $headers = "from: test1@islamerkotha.com"; mail("erfan.bashar.13@gmail.com", "my subject", $msg, $headers); thank you. there many points along path email message takes yours failing, take @ php mail() function page ; says function returns true if message accepted delivery , "it important note because mail accepted delivery, not mean mail reach intended destination." edit: here more information on php err

Deploying Django/Gunicorn to Nginx server with Python 3.4 found the wrong path for templates -

Image
not sure if question should in serverfault or stackoverflow think there more people here. i have built django project called 'to_pm' , decided put on vps server uses centos 7 operating system. want deploy django project nginx server have setup , running on server. originally put project /root/ newbie of linux system administration. realized nginx using nginx user , needs owner of project folder , parent directories access project's static contents moved project /www/ , change owner of /www/ nginx:nginx. unable access website. i error:(all templates in to_pm/templates/ folder) django tried loading these templates, in order: using loader django_jinja.loaders.filesystemloader: /root/to_pm/templates/index.jinja (file not exist) and shows python path is: python path: ['/root/to_pm', '/usr/local/bin', '/usr/local/lib/python34.zip', '/usr/local/lib/python3.4', '/usr/local/lib/python3.4/plat-linux', '/usr/lo

Python Using mysql connection from super class -

below example code provides error hoping on fixing, or getting understanding of better way write this. have mysql "super" class called mysql_connection. in class, connection database made. have few methods within it. 1 runs "select version()" show connection/query works. have "chktable" method in example instantiates new subclass called "table" inherits super class. after instantiating class, call method within subclass attempts use the query method in superclass run "show tables 'tbl name'". error. import mysql.connector mysql.connector import errorcode mysql.connector.cursor import mysqlcursor class mysql_connection(object): def __init__(self, **kwargs): self.connection_options = {} self.connection_options['user'] = 'root' self.connection_options['password'] = '' self.connection_options['host'] = '192.168.33.10' self.connection_o

matlab - Legacy MEX infrastructure is provided for compatibility -

there warning kind of message when compiling mexfunction files using mex command in matlab 2014b. legacy mex infrastructure provided compatibility; removed in future version of matlab. what supposed mean? there comes link message, did not find useful. this question did not make me more wise. will mex api vanish? there different interface? what going change exactly? can tell? the message legacy mex infrastructure provided compatibility; removed in future version of matlab. means way of setting mex mexopts.bat (windows) , mexopts.sh (*nix , mac) deprecated , xml based configuration system ("infrastructure" in words) used going forward. note not removed yet, deprecated - can continue configure mexopts.bat bug it. for suggestions on how make own xml, see this answer , started. have trial , answer since intuitive makefile-like organization of mexopts.bat gone , replaced more complicated system involving automated searches, environment variable reads,

Can node-webkit or atom-shell take screenshot of entire desktop screen? -

i want take screenshot of entire screen ( printscr ), not browser window. possible either node-webkit or atom-shell? atom shell can't natively, you'd have write native node module this, include in project

c# - How to detect double-keyboard with ReactiveUI -

how detect double-key board (like double key-enter) reactiveui how this: doubleenter = somewindow.events().keyup .where(x => x.eventargs.key == key.enter) .buffer(timespan.frommilliseconds(650), rxapp.mainthreadscheduler) .where(x => x.length > 1);

multithreading - Synchronizing multiple threads JAVA -

i have 200 students waiting enter room 200 seats (25 rows , 8 columns). door capacity 4 people. when student enter room, chooses random seat (row , column). if chosen seat @ 9th row or less takes 1 second sit, on 18th , less takes 2 seconds, , if 18 25 takes 3 seconds. when of them take seat person must come in room. problem when first 4 people enter room take seat 1 one , not @ once. how can fix that? example if 2 people choose seat @ 5th row both need sit 1 seconds , 2 new students must enter room. public class student { int row; int column; volatile static int mutex; //generating random numbers row , column public student(seats[][] seats) { this.row = (int) math.ceil(math.random() * 25); this.column = (int) math.ceil(math.random() * 8); if (!seats[row][column].istaken) { seats[row][column].istaken = true; } else { { this.row = (int) math.ceil(math.random() * 25); this.column = (int) math.ceil(math