Posts

Showing posts from February, 2012

java - Passing $routeParams from angularjs to spring controller -

this have in angularjs controller .when("/mutualfriends:topicid", {templateurl: "mutualfriends", controller: "conmfriends"}) app.controller('conmfriends',function($scope,$routeparams){ $scope.otherid = $routeparams.topicid; }); this spring controller @requestmapping(value="/controlerm", method = requestmethod.get) public modelandview controlerm(httpservletrequest request, httpservletresponse response) throws exception { modelandview model = null; session=request.getsession(true); user = (user) session.getattribute("user"); list<ends1> ends=(list<ends1>) ifriendlistservice.getends(user.getid(),5); session.setattribute("mutualfriends", mutualfriends); model = new modelandview("ends"); return model; i able fetch topicid angularjs page in angularjs controller (with $scope.otherid), unable pass value spring controller, redirecting new page. please help.

JavaCC expects nothing and found nothing -

i'm trying bottom of parser problem, begin, i'd know why happens: encountered "" @ line 1, column 1. expecting 1 of: here subset of grammar causes problem: options { static = false; debug_parser = true; debug_lookahead = true; lookahead = 64; } parser_begin(myparser) package myparser; public class myparser { } parser_end(myparser) /* skip whitespace */ skip : { " " | "\t" | "\n" | "\r" } /* other symbols */ token : { < comma: "," > | < semicolon: ";" > | < left_paren: "(" > | < right_paren: ")" > | < left_bracket: "[" > | < right_bracket: "]" > | < left_brace: "{" > | < right_brace: "}" > } /* type specifiers */ token : { < type_specifier: "void" | "int" | "float" > } /* identifiers */ token [ignore_case] : { <id

import - Using Dream Factory with Android Studio -

i'm trying use dreamfactory github android studio, attempts haven't been successful far. how can import library , use connecting dream.factory.cloud ? the guide eclipse, , not android studio. also, sample app not use gradle. don't know how fix this, , need pointers. the solution uploaded here me, followed instruction here after have download project here https://github.com/segunmicheal27/dreamfsctorysample-androidstudiosample/tree/master don't need modification need study code , modified want

php - readfile function returning file content in non ASCII characters -

when execute following code, image not displayed in browser , rather non ascii symbols , characters displayed instead.few lines follows: ����jfif��6photoshop 3.08bimgqaridey1blfs2krgbsou��icc_profilelcmsmntrrgb xyz �)9acspappl���-lcms desc�^cprt\wtpthbkpt|rxyz�gxyz�bxyz�rtrc�@gtrc�@btrc�@descc2textfbxyz ���-xyz 3�xyz o�8��xyz b����xyz $����curv��c�k�?q4!�)�2;�fqw]�kpz���|�i�}���0����c ! $( %2%(,-/0/#484.7 ./.��c what doing wrong here? <?php session_start(); if (isset($_session['logsyscuruser'])) { // logged in $id = $_session['logsyscuruser']; $imglocation = '/applications/xampp/im/'; include "include/specificproductdb.php"; $data = new specificpro(); $out = $data->select($query, $id, $pid); $count = count($out); } else { //not logged in header("location: loginsystem/login.php", true, 302); die(); } ?> <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http

Android - Window leak error on ProgressDialog when device is in landscape -

i have looked @ many questions here , searched on internet couldn't find specific solution. main problem other questions refer is, window leak error when go portrait landscape or vice versa. , answer mainly, because activity destroyed , recreated, hence window leak error . but problem is, device in landscape, , app working fine, previous activities smoothly running, when try display progressdialog , window leak error thrown. exact same code works fine when in portrait orientation. class downloadyearchartasynctask extends asynctask<string, integer, boolean> { private string username; private string city; private resources resources; private location locationofcity = null; private progressdialog progressdialog; public downloadyearchartasynctask(string username) { this.username = username; } @override protected void onpreexecute() { super.onpreexecute(); resources = getresources(); setrequeste

java - Creating only 1 instance or a Singleton -

i used class called 'city' & there 1 city in entire game; beneficial create instance, if 1 or singleton. the class contain methods won't static, & i've read singletons consist of static attributes , methods & can bad practice or mistaken? singleton common pattern , can deal 1 instance of object inside entire runtime environment. don't warry distinguish static , non-static methods... make of them non-static, because if invoke them city.getinstance().method() , sure method() (and other method) invoked on same instance. previous answer correct, have implement singleton in different way if in multi-thread environment (as web application) , need sure 1 instance created. infact, in prevoius code possible several concurrent threads create new city instance... threads created later use last instance (because overrides first 1 in static field). there several options overpass problem... common make synchronized getinstance() method: publi

javascript - Place text/image on svg path centroid using D3 -

Image
ive looked , read suck in, im still having trouble centroid. similar question of mine, more precise. i need put text / image on centroid of these regions: the svg data in html file in format this: so need select path, , use centroid function on d attribute, , place dot/text/image etc. ive attached jsfiddle see regions, dont mind class´s/id´s. <svg id="gamemap"> <g> <path id='1613' class='faction2' d='m541.02,336.29l541.71,336.09l543.77,338.27l543.53,338.58l545.92,338.99l546.76,340.12l548.44,340.06l548.55,341.76l549.62,342.38l549.24,343.35l550.58,344.54l551.35,344.98l553.38,344.66l554.17,345.63l555.37,345.08l556.2,346.28l556.8,345.6l557.82,347.73l558.51,347.76l558.17,350.15l560.8,350.12l561.12,349.61l563.89,349.94l562.98,351.84l562.99,353.94l562.06,353.97l560.77,357.72l561.33,357.73l562.06,359l563.49,358.5l563.75,357.85l564.17,358.09l564.64,361.19l565.52,361.68l564.51,362.21l564.67,363.38l565.17,363.21l565.3

ruby - How to use gem to install Rails on Ubuntu -

the error message: building native extensions. take while... error: error installing rails: error: failed build gem native extension. /usr/bin/ruby2.1 -r ./siteconf20150328-1540-hff2f0.rb extconf.rb checking if c compiler accepts ... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby2.1 --help --clean /usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': compiler failed generate executable file. (runtimeerror) have install development tools first. /usr/lib/ruby/2.1.0/mkmf.rb:571:in `block in try_compile' /usr/lib/ruby/2.1.0/mkmf.rb:522:in `with_werror' /usr/lib/ruby/2.1.0/

javascript - How to wrap a html tag around a text selected in an input? -

the problem is: have input text type element, , button beside it. once button clicked, selected text inside input must wrap html element. example, when button clicked, selected text wrapped <span style='color:red'></span> ! does has solution ? as @rémyj wrote, can use jquery select event, selection. try this: var start, end; $('#tf').select(function(e) { start = e.target.selectionstart; end = e.target.selectionend; }); $('.wrap').click(function() { var val = $('#tf').val(); var newval = val.substr(0, start) + '!' + val.substr(start, (end-start)) + '!' + val.substr(end); $('#tf').val(newval); }); html: <input type="text" id="tf"> <button type="button" class="wrap">wrap</button> http://jsfiddle.net/qh95xyeq/

c - Consumer/Producer with pthreads having waiting times -

i trying implement modified version of consumer/producer program code i picked on internet. follows own modifications: /* * solution producer consumer problem * using ptheads, mutex , condition variables * tanenbaum, modern operating systems, 3rd ed. */ /* in version buffer single number. producer putting numbers shared buffer (in case sequentially) , consumer taking them out. if buffer contains zero, indicates buffer empty. other value valid. */ #include <stdio.h> #include <pthread.h> #define max 3 /* # of item produce */ pthread_mutex_t the_mutex; pthread_cond_t condc, condp; int consumetimes[max] = { 1, 4, 3 }; int toconsume = 0; void* producer(void *ptr) { int i; (i = 0; < max; i++) { pthread_mutex_lock(&the_mutex); /* protect buffer */ /*while (buffer != 0) /* if there in buffer wait pthread_cond_wait(&condp, &the_mutex);*/ printf("producer: produced item %d \n&

c# - WhenAny for current null values -

is there way use whenany property of value null , set later? this: public server selectedserver {get;set;} public testclass() { this.whenany(selectedserver.items.changed, x => x).subscribe(/*do something*/); } selectedserver null, set through user interaction , therefor nullreferenceexception in constructor. this typo instead produces runtime crash, should be: this.whenanyvalue(x => x.selectedserver.items.changed); but given name of variable, i'm guessing better thing be: this.whenanyobservable(x => x.selectedserver.items.changed);

java - simple timer, starting from 0 to whatever number -

i trying make simple timer, starting 0 whatever number.i want interrup timer when press button. i've done far, i'n not interested button part yet.when run, don't displayed. import java.util.arraylist; import javax.swing.*; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; /*lista clienti care asteapta avem timer->creaza action event care il tratam in action performed--crestem timpul simu;larii cu 1 in action performed,apoi parcurgem lista de clienti care ast si verificam care clienti au timpul de arival = timpul simulatrii --fiecare client e distribuit la una din cozi-for pt fiecare client. gasim coada cu timpul min de asteptare si il adaugam acolo--tot in action performed daca timpul de servire ajun l;a 0 clientul e scos din coada */ public class magazin extends jframe{ //protected arraylist<clienti> arrayclienti = new arraylist<clienti>(); public magazin(){ } class event implements

r - Is there any way to automatically choose correct read.csv parameters? -

i have number of csv files different file format - columns added (which don't need), header there or not, time format %y-%m-%d %h:%m:%s or %y%m%d%h%m%s . there way pre-analysis of csv file choose correct parameters read.csv ? for ex., have following logics used read files: # file 1 dataft <- read.csv("file1.csv", header = true, colclasses = c("factor", "factor", "factor", "factor", "integer", "factor", "integer", "factor", "factor", "factor", "integer", "factor", "factor")) dataft[,"ddate"] = as.date(dataft[,"ddate"],"%y-%m-%d") # file 2 datagae <- read.csv("file2.csv", header = false, colclasses = c("factor", "factor", "factor", "factor", "integer", "factor", "integer", "factor", "factor", "fact

user interface - SKButton not working -

so made button programmatically spritekit thinks button node larger button. here have. override func didmovetoview(view: skview) { let button = skspritenode(color: skcolor.greencolor(), size: cgsizemake(100, 44)) button.position = cgpoint(x: cgrectgetmidx(self.frame), y: cgrectgetmidy(self.frame)) self.addchild(button) } override func touchesbegan(touches: nsset, withevent event: uievent) { touch: anyobject in touches { let location = touch.locationinnode(self) if button.containspoint(location) { println("tapped") } } } when run game allows me click button detects touch anywhere below button.

excel - How to fill a combobox with a dataset that matches a specific date -

i creating userform in excel allows user review records entered on selected date. date selected using combobox populated dates current week. other actions triggered command button. i trying figure out how populate review combobox and/or review listbox data named range matches selected date. appreciated. following code includes vlookup command deadend. worksheet: data_entry named range: records_entered userform: ufrmdataentry1 date combobox: cboreviewweek command button: cmdreviewcount review combobox: cboreviewrecords review listbox: lstreviewrecords private sub userform_initialize() 'fill combobox me.cboreviewweek.list=[index(text(today()-weekday(today(),2)+row(1:7),"mm/dd/yyyy"),)] end sub private sub cmdreviewcount_click() 'step 1) pass selection of cboreviewweek "formulas" sheet activeworkbook.sheets("formulas").range("a4") = me.cboreviewweek 'step 2) return count of total records en

angularjs - Character issue for external directive template -

i've used angularjs php projects no issues @ before. trying learn jsf , running tomcat , using eclipse, both first time. got simple html file template angularjs directive turkish characters ğ Ğ İ ı ç Ç . when open file alone in browser, can see characters fine. in main page after directive loaded saw them ��� all. in directive, json data page $http.get causes no character issues @ all. when @ file props template file in eclipse says iso 10646/unicode(utf-8) encoding. couldnt decide share code or not because dont know put here think should do?

java - How to set an ImageIcon using a Switch statement -

alright, pretty brand new @ coding, trying. i need create imageicon use switch statement determine image show. i looked @ thread here: change image if statement which recommended switch statement on if statement, thought help. when edit code, , change had before, error says "imageicon cannot resolved variable". i've tried variety of capitalization combos none of them working.i left code had underneath first case. code not giving me error messages i'm thinking should not creating new imageicon each case, since need pull 1 in program , have switch statement determine image display. revised code public imageicon dieimage(string string) { imageicon dieimage = new imageicon(""); switch (facevalue){ case 1: dieimage = new imageicon ("src/1.jpg"); break; case 2: dieimage = new imageicon("src/2.jpg"); break; case 3: dieimage = new imageicon("src/3.jpg"); break;

java - LibGDX Angle/Rotation Issue -

i'm using tiled map editor create simple tiled map. within map have several rectangles, if create rectangle width of 50 , height of 10 , rotate 90°, save map , load in libgdx project, shape rendered correctly - if use random angle, let's 26° example , render map again, not desired result, in fact exact opposite desired angle. i'm reading tiled map float directly map using: map map = new tmxmaploader().load(maplocation + mapname + mapextension); (maplayer maplayer : map.getlayers()) { (mapobject mapobject : maplayer.getobjects() { mapproperties objectproperties = mapobject.getproperties(); float objectrotation = objectproperties.get("rotation") != null ? float.parsefloat(objectproperties.get("rotation").tostring)) : 0.0f; objectrotation = mathutils.degrad * objectrotation; } } the mathutils.degrad converts degrees read directly map properties radians, somewhere along line there's misread happen

homebrew - Can't link pcre thru brew in max os yosemite -

when install watchman using brew install watchman , got error: must brew link pcre before watchman can installed . try brew link pcre , brew link --overwrite pcre , got linking /usr/local/cellar/pcre/8.36... error: not symlink share/man/man3/pcre.3 /usr/local/share/man/man3 not writable. can help? by design homebrew (brew) requires contents of /usr/local owned you. can fix running: sudo chown -r `whoami` /usr/local from terminal. see here further explanation.

c# - DeferRefresh is not allowed during an AddNew or EditItem transaction -

i have window containing 2 datagrids. , if click 1 specific column in first datagrid column of other datagrid, error deferrefresh not allowed during addnew or edititem transaction what going wrong here? the first datagrid is <datagrid x:name="firstdatagrid" itemssource="{binding parts, mode=twoway}" selecteditem="{binding selectedpart, mode=twoway}" celleditending="datagrid_oncelleditending" > <i:interaction.behaviors> <views:scrollintoviewbehavior /> </i:interaction.behaviors> <datagrid.resources> <style targettype="{x:type datagridcell}"> <eventsetter event="previewmouseleftbuttondown" handler="datagridcell_previewmouseleftbuttondown"></eventsetter> </style> </datagrid.resources> <datagrid.columns> <

java - Hibernate storing identifiers of another entities not whole entities? -

i'm building restful service on java using jersey , need implement relationships between entities storing identifier on entity not whole. there way implements in hibernate? i'm using not working. @entity @javax.persistence.table(name = "manager_user") public class manageruser extends user { @manytoone(targetentity = shopadminuser.class) private integer shopadminuserid; //... } @entity @javax.persistence.table(name = "shop_admin_user") public class shopadminuser extends user { @lob private string contactdata; public string getcontactdata() { return contactdata; } public void setcontactdata(string contactdata) { this.contactdata = contactdata; } } @entity @inheritance(strategy= inheritancetype.table_per_class) public abstract class user { @id @generatedvalue(strategy = generationtype.table) private integer id; //... } it comfortable me implement this.

ember.js - Configure CSP in an Ember CLI application which uses http-mock -

i'm using http-mock ember cli suggested on http://www.ember-cli.com/#ember-data . understand basic concept of csp don't understand configuration of within ember cli application. how can configure application either accept requests localhost:4200/api/ avoid during development: content security policy violation: { "csp-report": { "document-uri":"http://localhost:4200/products", "referrer":"", "violated-directive":"style-src 'self'", "effective-directive":"style-src", "original-policy":"default-src 'none'; script-src 'self' 'unsafe-eval' localhost:35729 0.0.0.0:35729; font-src 'self'; connect-src 'self' ws://localhost:35729 ws://0.0.0.0:35729 http://0.0.0.0:4200/csp-report; img-src 'self'; style-src 'self'; media-src 'self'; report-uri http://0.0.0.0:4200

variables - How to define procedures in Wolfram correctly? -

Image
here algorithm finding trailing zeros in n! variables n = number , zeros = 0 while n >= 1, do n = floor[ n /5.] , zeros += n print out zeros most doing wrong variables inside procedure, because line line code works !

wordpress - How to customize this theme's ingredient amount/quantity? -

i purchased , installed this theme on themeforest. the author said going solve issue in next upgrade of theme 1 month ago. i not want wait him need on own. my problem is: amount of ingredients ends double digit ".00" example, if type 6 grams, looks 6.00 grams , it's pretty annoying. do have idea how change it? you can try "hack" echo 6.00 + 0; // echos 6 or proper way , this $val = floatval(6.00); change line echo "<dt>" . $ingredient_result->amount . " $unit_name</dt>"; with this echo "<dt>" . floatval($ingredient_result->amount) . " $unit_name</dt>";

android - Link in alert dialog fragment -

i'm using code show simple dialog link: string msg = "http://www.google.com" final spannablestring s = new spannablestring(msg); linkify.addlinks(s, linkify.all); fragment dialogfrag = mydialogfragment.newinstance(title, msg); getfragmentmanager().begintransaction().add(dialogfrag, key).commit(); the mydialogfragment class: public class mydialogfragment extends dialogfragment { public static mydialogfragment newinstance(string title, string message) { mydialogfragment frag = new mydialogfragment(); bundle args = new bundle(); args.putstring("title", title); args.putstring("msg", message); frag.setarguments(args); return frag; } @override public dialog oncreatedialog(bundle savedinstancestate) { string title = getarguments().getstring("title"); string msg = getarguments().getstring("msg"); return new alertdialog.builder(getactivity()) .settitle(title)

Forgein key constraint in mysql. I cannot fix it? -

i created following table in mysql follow: create table employee ( fname varchar(15) not null, minit varchar(1), lname varchar(15) not null, ssn char(9), bdate date, address varchar(50), sex char, salary decimal(10,2), superssn char(9), dno integer(4), primary key (ssn), foreign key (superssn) references employee(ssn) ); then tried insert following information: insert employee values ("bob","b","bender","666666600", "1968-04-17","8794 garfield, chicago, il","m","96000.00","null","8"); sadly, got error: error code: 1452. cannot add or update child row: foreign key constraint fails (`test`.`employee`, constraint `employee_ibfk_1` foreign key (`superssn`) references `employee` (`ssn`)) i tried alter table superssn can null no solution working. alter table employee modify column superssn char(9) default null;

android - Getting the response code 200 while sending message to gcm server but the result displays error -

i have created application server sends message gcm server via http post. after executing code response code of 200 result displayed error=missingregistration . i not able understand why registration id missing. have obtained registration id of emulator creating google account on it. have verified project id , keys , have used gcm-server.jar create server. have tried using server key instead of browser key still getting same result. here code of application server sends message through http post gcm server. package com.example.gcmserver; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.util.arraylist; import java.util.list; import org.apache.http.httpexception; import org.apache.http.httprequest; import org.apache.http.httprequestinterceptor; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.auth.authscope; import org.a

c# - Consume soap services using WSSE security with sign & encrypted header/body -

i have web service wsdl document @ http://www.foistest.indianrail.gov.in/fois/foisservice?wsdl how consume c#.net . i have username , password , security certificate(.der file) , keystore file(.jks file) , i have alias , storepassword , keypassword i want connect sayhello method.

How to perform multi-class cross-validation for LIBSVM in MatLab -

i want use libsvm in matlab multi-class classification. have read libsvm use 1 vs. 1 default when provided multiple labels, , fine it. my question parameter search , model validation. when doing 2-class validation find parameters c , gamma (when using rbf kernel), use built-in cross validation find best (c,gamma)-pair, using simple grid search. have read libsvm documentation have no idea how validation works multiclass svm. does built-in option returns multi-class accuracy? how can provide best parameters each of ovo models automaticaly built? the answer given there http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#f507 . did not read faq of libsvm enough.

jquery - How to show all content and why can't filter by id -

<div class="filter hidden-xs hidden-sm hidden-md"> <a href="?type=all" id="all">view all</a> <a href="?type=zoologist" id="zoologist">zoologist</a> <a href="?type=hobbyist" id="hobbyist">hobbyist</a> <a href="?type=judge" id="judge">judge</a> </div> <div id="accordion"></div> json var jsonobject = [ { "name": "jonathan suh", "type": "zoologist, hobbyist" }, { "name": "william philbin", "type": "judge, hobbyist" }, { "name": "allison mckinnery", "type": "hobbyist" } ]; jquery $('.filter a').on('click', function(e){ e.preventdefault(); var filter = $(this

bash - use file comand instead of -name -

i want write shell script searches in .txt files word cat , replaces mouse.i wrote following code: !/bin/bash read directory f in ` find $directory -name '*.txt' -type f` echo $f `sed -i "s/\<cat\>/mouse/g" $f` done i supposed use "file" command.i searched , seems file command finds files of type.i want know how can include command in script. assuming in directory *.txt files are. can execute following command: find . -name *.txt -exec sed -i "s/\<cat\>/mouse/g" "{}" \;

javascript - Making a webapp with listboxes based on Google Spreadsheets with Google Apps Script -

note: question has been rewritten due changes in original code. hi, have code.gs file , index.html file. trying create listbox in index.html file data code.gs. i did testing, , following code gives results want: <select multiple> <option> <?= articlenumbers(0)[[0]]?> </option> <option> <?= articlenumbers(0)[[1]]?> </option> <option> <?= articlenumbers(0)[[2]]?> </option> <option> <?= articlenumbers(1)[[0]]?> </option> <option> <?= articlenumbers(1)[[2]]?> </option> </select> however, making 12 - , counting - listboxes hundreds of values inserted spreadsheet, need make them loop. tried following code, hoping option-tag go in loop, doesn't seem work. <select multiple> <? (i=0; < 11; i++){ (j=0; j < articlenumbers(i).length; j++){ ?> <option><?=articlenumbers(i)[[j]]?> </option> <?} } ?> </sele

javascript - Firefox html5 validation anomaly with dynamic select options -

here simple html5 form 2 select controls. changing selection in first select generates new list of options second select. both have "required" attribute, , selected blank option. odd bit red validation outline around second select control, without submitting form. no tool-tip error message, outline. <!doctype html> <body> <script language="javascript" type="text/javascript"> function select_update(srcctrlid, dstctrlid) { //alert(srcctrlid+','+dstctrlid+','+url); sel1 = document.getelementbyid(srcctrlid); srcvalue = sel1.value; sel2 = document.getelementbyid(dstctrlid); while(sel2.options.length > 0) { sel2.remove(0); } if (srcvalue == '') { var ooption = new option( '(no matches)', '', true, true ); sel2.add(ooption); } else { var ooption = new option( '-- select2 --', '', tr

matlab - What is a spectrogram and how do I set its parameters? -

Image
i trying plot spectrogram of time domain signal given: n=5000; phi = (rand(1,n)-0.5)*pi; = tan((0.5.*phi)); = 2.*a./(1-a.^2); plot(i); spectrogram(i,100,1,100,1e3); the problem don't understand parameters , values should given. these values using, referred matlab's online documentation of spectrogram . new matlab, , not getting idea. appreciated! before go matlab command does, want know spectrogram is. way you'll more meaning how each parameter works. a spectrogram visual representation of short-time fourier transform . think of taking chunks of input signal , applying local fourier transform on each chunk. each chunk has specified width , apply fourier transform chunk. should take note each chunk has associated frequency distribution. each chunk centred @ specific time point in time signal, bunch of frequency components. collection of of these frequency components @ each chunk , plotted spectrogram. the spectrogram 2d visual heat map horizonta

javascript - jQuery on external text requesting images -

i'm working on chrome extension uses jquery parse source of page specific things. in example i'm looking through wikipedia categories. i source of page via chrome.tabs.executescript(tabid, { code: "chrome.extension.sendmessage({action: 'getcontenttext', source: document.body.innerhtml, location: window.location});" }, function() { if (chrome.extension.lasterror) console.log(chrome.extension.lasterror.message); }); i listening message (successfully) , use jquery parse source key of object, so if (request.action == "getcontenttext") { //console.log(request.source); $('#mw-normal-catlinks > ul > li > a', request.source).each(function() { console.log("category", $(this).html()); }); } this works expected , logs list of category links innerhtml. issue happens jquery selector tries load images contained in request.source . results in errors such get chrome-extensi

java - String comparaison difference between two sentences -

please can tell me exactely difference between this if(mystring.equals("test")) { } and if("test".equals(mystring)) { } if mystring null , have null.equals("test") --> nullpointerexception "test".equals(null) --> false (if mystring != null expressions equivalent.)

charts - Highcharts - how change JSON to csv -

i have small problem... $(function () { $.get('../../../abc-test.csv', function(data) { // split data set ohlc , volume var ohlc = [], volume = [], datalength = data.length, // set allowed units data grouping groupingunits = [[ 'week', // unit name [1] // allowed multiples ], [ 'month', [1, 2, 3, 4, 6] ]], = 0; (i; < datalength; += 1) { ohlc.push([ data[i][0], // date data[i][1], // open data[i][2], // high data[i][3], // low data[i][4] // close ]); volume.push([ data[i][0], // date data[i][5] // volume ]); } $('#test').highcharts({ ra

How can I get a file in a Go web project for testing and production? -

i working on web project use go (with martini) backend. contains reverse-geocoder maps coordinates city names. so, reverse-geocoder has read cities.csv . the structure is handlers/city/create.go services/geo/reverse.go services/geo/cities.csv main.go now main.go started start web service. handler handlers/city/create.go makes use of services/geo/reverse.go city cities.csv . the problem cities.csv . what i've tried plain filename however, when use csvfilename := "cities.csv" : the tests work the handler doesn't work go assumes /home/me/go/src/github.com/githubuser/backend/cities.csv adjusted filename when adjust filename relative root ( csvfilename := "services/geocalc/cities.csv" ), tests fail. assume /home/me/github/go/src/github.com/githubuser/backend/services/geocalc/services/geocalc/city-names-geocoordinates.csv . args[0] this doesn't work either: filename := filepath.dir(os.args[0]) filedirectory := filepath.dir(

php - $_SESSION['var'] won't set with ajax -

i'm having strange problem. i'm trying set session vars , , won't set through ajax call. here code html <form id="sjcc_payment" onsubmit="return concatexp();" action="https:www.url.com" method="post"> <table width="100%"> <tr> <td style="font-family:tahoma,geneva,sans-serif;color:#888888">name</td> </tr> <tr> <td><input type="text" id="first_name" name="first_name" ></td> </tr> <tr> <tr> <td style="font-family:tahoma,geneva,sans-serif;color:#888888">email</td> </tr> <tr> <td><input type=&q