Posts

Showing posts from September, 2012

javascript - Using JQuery to inject an ejs template into html -

can html ejs template injected via jquery? i have index file has navbar , content area, sample testbutton template trying render. index.ejs <ul> . . <li id="listitem"><a href="#test_page">nav bar item</a></li> </ul> <div id="display"> </div> <script> $('#listitem').click( function(){ // note - testbuttontemplate being passed in routes $('#display').html( <%- render( testbuttontemplate, {} ) %> ); }); </script> testbutton.ejs: <a href="#" class="btn btn-primary" id="test-button"> click me! </a> i did best simplify code, basically, when click on link nav bar, want dynamically load page in display div. the nav bar works. click functionality works. if manuallay display ejs template in div, works. ex: <div id="display"> <%- render( testbuttontemp

android - SharedPreferences from one Fragment isn't registering data for a Login Activity on another Fragment -

i have fragment called loginfragment through user can register first time clicking on register button. upon clicking button new fragment, called registerfragment, opens user chooses , enters new username , password registered. when run app , enter fields under register , select ok, shows "saved info" in toast it's supposed to. when try logging in using username , password registered for, app doesn't recognize info , displays toast "please check entries , try again" should displayed when username exists or password incorrect, in case not case. is sharedpreferences not saving username , password values because working 2 different fragments? appreciated! registerfragment.java public class registerfragment extends fragment { button register_btn; edittext username_signup_et, password_signup_et; private string key_uid = "uid"; private string key_password = "pwd"; private final string prefer_name = "reg

java - Argument state after the thread is completed -

question: suppose pass arraylist runnable constructor. in runnable class add strings list. run thread main() , wait completion. after thread execution over, possible when iterate list in main() strings(values) added list runnable class because reference arraylist created in heap. when iterate list, empty. explain why list empty. thanks in advance: vijay k public class getlistthread implements runnable{ private list<string> names; public getlistthread(list<string> names) { super(); this.names = names; } @override public void run() { for(int i=0;i<4;i++){ try { names.add(threadlocalrandom.current().nextint(1,10) + "a"); thread.sleep(2000); } catch (interruptedexception e) { e.printstacktrace(); } } //system.out.println(names); } } public class testthread { public static void main(string[] args) { list<string> names = new arraylist<string>(); get

Where to make http request for every route in angularjs? -

suppose web app needs make http request site title, site description , on. since these variables common pages, makes sense request every time user enter site. the question is, make calls? in run block? or create root controller these tasks? you can use 1 of these 2 approaches: make call in run block , store value in $rootscope , use anywhere want, in states, use resolve page title , details , , in views , ease use resolve in root state , use resolved variable dependency in other child or sibling routes values.. $stateprovider.state('root', { resolve:{ // example using function simple return value. promiseobj: function($http){ // $http returns promise url data return $http({method: 'get', url: '/someurl'}); } }) .state('sibling',{ controller:function($scope,promiseobj){ $scope.title = promiseobj.title; } })

arrays - Converting strings to uppercase to compare with user input in C -

i attempting create program allow user search name in file. program successfully, occurred me not type in name capitalized in file. is, may search "sarah," name listed "sarah" in file name not found. around have attempted convert both strings upper case @ time of comparison. very, new teaching myself c, not if heading in right direction. @ point cannot program compile getting 2 errors "array initializer must initializer list or string literal." i'm assuming mean syntax not invalid in wrong direction. best way approach goal? #include <stdio.h> #include <ctype.h> #include <string.h> int main(void) { file *infile; infile = fopen("workroster.txt", "r"); char rank[4], gname[20], bname[20], name[20]; printf("enter name: __"); scanf("%s", name); int found = 0; while(fscanf(infile, "%s %s %s", rank, bname

shell - How to capture a process Id and also add a trigger when that process finishes in a bash script? -

i trying make bash script start jar file , in background. reason i'm using nohup . right can capture pid of java process need able execute command when process finishes. this how started nohup java -jar jarfile.jar & echo $! > conf/pid i know this answer using ; make command execute after first 1 finishes. nohup java -jar jarfile.jar; echo "done" echo "done" example. problem don't know how combine them both. if run echo $! first echo "done" executes immediately. while if echo "done" goes first echo $! capture pid of echo "done" instead of 1 of jarfile. i know achieve desire functionality polling until don't see pid running anymore. avoid as possible. you can use bash util wait once start process using nohup nohup java -jar jarfile.jar & pid=$! # getting process id of last command executed wait $pid # waits until process mentioned pid complete echo "done, execute new c

Ember.js - Can the root url link to two routes, one for authenticated users and one for guests? -

is possible root path, example.com , display landing page( application/index ) not logged in users profile page ( users/show ) users logged in? guest user -> example.com -> application/index authenticated user -> example.com -> users/show i know goes against ember's philosophy of app state being reflected url, still, know if/how situation possible? cheers! yes, can it. firstly, should check user logged in or not in "beforemodel" of "application" route. if user logged in transits "profile" page using "transitionto" method otherwise transits "login" page. beforemodel: function(transition) { var user; //put here method check if user logged in or not if (!user) { //if no user transist login this.transitionto('login'); } else { //other wise profile page this.transitionto('profilepage'); } }

oauth 2.0 - External login using Identity Server 3 - Setting Given Name claim from facebook -

im trying setup identityserver able login facebook. works fine except cant retrieve of user info facebook.the mvc app expected givenname , lastname claim. have added scope public_profile not back. after lots of research seems might need setup userservice not sure how this. help appreciated. here code configure external providers in statup of idenity server app: private void configureidenityproviders (iappbuilder app, string signinastype) { var facebookoptions = new microsoft.owin.security.facebook.facebookauthenticationoptions { authenticationtype = "facebook", caption = "sign in facebook", signinasauthenticationtype = signinastype, appid = "xxxxxxxxxxxx", appsecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", provider = new microsoft.owin.security.facebook.facebookauthenticationprovider() { onauthenticated = (cont

javascript - My anchor tags are not working. -

Image
the issue says in title, clicking on image wrapped anchor tag doesnt work. here example of on grid list item: <li class="grid-list-item"> <h3 class="grid-trail-name">marshall canyon</h3><span class="grid-loc">mt baldy, california</span> <div class="grid-overlay"> <span class="grid-close">close</span> <div class="grid-trail"> <div class="open"> <div class="info-flex info"> <div class="info-sum info-flex-child"> <h3 class="info-sum-header">marshall canyon...</h3> <p class="info-sum-text">lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque imperdiet massa sed augue posuere aliqu

visual studio - Omni-directional light in raytracing program gives wrong render c++ -

i trying implement omni-directional light source (a.k.a., point light source) in raytracing program in c++. not getting expected results, can't figure out problem. maybe can see doing wrong. have included 2 functions responsible raytracing , light. closestintersection function finds closest intersection , triangle. used later in directlight function. appreciate help. #include <iostream> #include <glm/glm.hpp> #include <sdl.h> #include "sdlauxiliary.h" #include "testmodel.h" #include "math.h" using namespace std; using glm::vec3; using glm::mat3; // ---------------------------------------------------------------------------- // global variables const int screen_width = 500; const int screen_height = 500; sdl_surface* screen; int t; vector<triangle> triangles; float focallength = 900; vec3 camerapos(0, 0, -4.5); vec3 lightpos(0.5, 0.5, 0); vec3 lightcolor = 14.f * vec3(1,1,1); // translate camera float translation =

Generating all combinations of 6 Xs with 3 Qs in Haskell -

i trying generate list of strings consist of 6 xs , 3 qs. a subset of list trying generate follows: ["xxxxxxqqq", "xqxxqxxqx", "qxqxqxxxx",... what way go this? here dynamic programming solution using data.array . mem stores memoized values. import data.array strings :: int -> int -> [string] strings n m = strings' n m mem :: array (int,int) [string] mem = array ((0,0),(n,m)) [ ((i,j), strings' j) | <- [0..n], j <- [0..m] ] strings' 0 m = [replicate m 'x'] strings' n 0 = [replicate n 'q'] strings' n m = (('q':) <$> mem ! (n-1,m)) ++ (('x':) <$> mem ! (n,m-1))

Logical NOT on Boolean Object always return false in Javascript -

this question has answer here: why !new boolean(false) equals false in javascript? 2 answers why logical not operator in javascript returns different result between boolean value , boolean object ? consider following example. !true // false !false // true !(new boolean(true)) // false !(new boolean(false)) // false from spec , says value being evaluated converted toboolean . toboolean return true if argument object, , return if argument boolean. digging further, toboolean being used in other places if statement , conditional operator, consider following example: var = (new boolean(false)) ? "unexpected" : "expected"; console.log(a); // unexpected the question: boolean object object, or boolean? should not evaluate boolean object boolean? update my question marked duplicate question this . question doesn't have satisfactor

android - spinner set selection doesn't working -

i need add setselection method spinner using position database. i try both( in position of text) spinner.setselection(in); spinner.setselection(in,true); but shows first object in array used spinner thanks help make sure setselection() called after done spinner's setadapter() .

html5 - IE-Edge Compatible mode issue with AngularJS -

my angularjs web application working fine in dev environment expected once deployed higher environment . while running/browsing application in ie edge application default selecting 8 , application not working since ie 8 wont support angularjs. so tried changing meta tag override compatible view setting in code follows trial 1 <!doctype html> <html> <head> <meta http-equiv="x-ua-compatible" content="ie=edge"> here in place of content tried possible options like ie=edge,11,emulateie11,10,emulateie10,9,emulateie9 trial 2 <system.webserver> <httpprotocol> <customheaders> <add name="x-ua-compatible" value="ie=edge" /> </customheaders> </httpprotocol> </system.webserver> i tried in possible ways while browsing application default selecting ie mode 8 , application not working. note: it's intrane

C++ string management convert raw string through dictionary matching -

what code given string, through array attached @ bottom if string matches 1 of array element, new bits of string combined form new string , gets returned! in other words, converts long , raw string looking in "dictionary" return interpreted new strnig. i trying add code @ // comment if encounter raw strings don't match on record, in array, call function deal it. thinking logging can updated dictionary. thanks! string string_look_up(string data) { string loc_string = ""; std::stringstream ss(data); std::string line; while (std::getline(ss, line, '0')) { if (line.empty()) { continue; } cout << line << endl; (int = 0; < 82; i++) { if (line == dictionary_array_strings_raw[i]) { loc_string = loc_string + dictionary_array_strings_digits[i]; } } /// new code want should cout << loc_string << endl; cout << "######" <&l

c# - No type was found that matches the controller named in asp.net website project -

i'm facing below error while ruing asp.net website project. error: no type found matches controller named 'xxxx'. route config: void application_start(object sender, eventargs e) { // code runs on application startup // authconfig.registeropenauth(); routeconfig.registerroutes(routetable.routes); system.web.http.globalconfiguration.configuration.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{action}/{id}", defaults: new { id = system.web.http.routeparameter.optional }); } webapi controller: public class samplewebcontroller : apicontroller { public object sampleaction(dictionary<string, string> jsonresult) { } } url: serviceurl="../api/sampleweb" please 1 provide idea on come error. also let me know if i'm doing think wrong here. thanks in advance. if have multiple post actions in same controller should make r

normalization - Normalize double array in java -

i have double arraylist dataset in java. want normalize data data clustering , function normalize data clustering in here normalization data cluster input = {{-1.3,2.4,5.3.2.1,0.7},{6.4,-3.3,1.9.4.1,0.3}} below code i've tried far, i'm not sure it's right normalization method public void getminmax(){ min = new double[input.size()]; max = new double[input.size()]; for(int i=0; < input.size(); i++){ min[i] = 0; max[i] = 0; for(int j = 0; j < input.get(i).size(); j++){ if(input.get(i).get(j) >= max[i]){ max[i] = input.get(i).get(j); } else if(input.get(i).get(j) <= min[i]){ min[i] = input.get(i).get(j); } } } } private void normalizemaxmin() { for(int i=0; < input.size(); i++){ for(int j = 0; j < input.get(i).size(); j++){ input.get(i).set(j, (input.get(i).get(j) - min[i]) / (max[i] - min[i])); }

c# - Data table to multiple CSV files -

i'm fetching records sql server 2012 table. i've used datatable . want write fetched records multiple csv files . i've used stringbuilder write column headers , fields csv file (single csv file). but, new requirement first filter records based on columns , write multiple files. suppose i've 5 columns col1 , col2 , col3 , col4 , col5 . i need write col1 , col2 , col5 once csv file , col1 , col3 , col4 csv file. i want include column - col0 first column added through code , not present in database. column derived col3 , col5 . this: dt.columns.add("col0", typeof(system.string)).setordinal(0); row["col0"] = row["col3"] + "_" + row["col5"]; issue point 3 can't derive col0 unless i'm fetching both rows - col3 , col5 datatable (dt). it's giving me error system.argumentexception: column 'col3' not belong table selected. please let me know how proceed? code: public s

java - How to get the array that text belongs in -

i have multidimensional array follows: [[acid exposure (ph), upright], [recumbent, total], [, upright normal recumbent normal total], [normal],] [[bolus exposure (impedance)upright], [, recumbent, total], [, upright normal recumbent normal total], [normal]] [[postprandial data], [, postprandial interval: 120 min]] i want create new array if inner array contains line "acid exposure (ph)" end [acid exposure (ph), upright], [recumbent, total], [, upright normal recumbent normal total], [normal],] in new array. i tried this: arraylist<string> matches = new arraylist<string>(); pattern p = pattern.compile("acid exposure \\(ph\\)"); (list<string> row:twodim) { (string cell:row){ if (p.matcher(cell).matches()) { matches.add(cell); system.out.println(matches); } } } but gave me [acid exposure (ph)] you checking if had match in list , add 1 specific it

java - In intellij idea, how to browse a file locally after I configured an FTP? -

Image
before make ftp configuration, when right click on "index.html" file , select run "index.html" , file opened in browser window address localhost:8080/index.html . run tool window pops up: however, after configured ftp: every time when right click on index.html file , select run , file opened address vimer2.java.jspee.net/index.html. want opened locally before, don't know how. can follow steps listed on page below: open settings / preferences dialog choosing file | settings windows , linux or intellij idea | preferences os x, , click web browsers under tools. more details can seen here: https://www.jetbrains.com/help/idea/2016.1/configuring-browsers.html

What does `/usr/bin/cmake -E cmake_depends "Unix Makefiles" <SOME_PATH>` mean? -

could explain /usr/bin/cmake -e cmake_depends "unix makefiles" <some_path> means? couldn't find description of cmake_depends on cmake.org ... thanks in advance. as cmake_depends not documented in documentation, call internal interface, should not used users. if use it, might fail new version without warning or deprecation period. grepping through cmake's source code reveals following comments, might you. cmake/source/cmmakefiletargetgenerator.cxx: // generate call signature: // // cmake -e cmake_depends <generator> // <home-src-dir> <start-src-dir> // <home-out-dir> <start-out-dir> // <dep-info> --color=$(color) // // gives dependency scanner enough information recreate cmake/source/cmcmd.cxx: // full signature: // // -e cmake_depends <generator> // <home-src-dir> <start-src-dir> //

Saml: Is it necessary to trust and verify public key for ssl when the artifact response is signed? -

i've made implementation based on filesystemmetadataprovider: https://github.com/vdenotaris/spring-boot-security-saml-sample to make ssl handshake artifact binding work put ssl sertificates endpoint in idps metafile(i tried put both leaf , ca in cacerts on jre , trust store of server didn't work). i don't want maintenance generating certificates , modifing idps metafile when leaf certificate changes. is necessary mess transport layer? isn't enough check ssl certificate valid , after check signature of assertion? i asked idp. few choose trust ssl certificate , should enough validate ssl certificate , check signature in assertion.

javascript - How to create Fixed page links in angularjs dir-pagination-controls? -

i new angularjs , have trying create fixed page links in dir-pagination-controls in angularjs have try use 'total-items=100' not working , getting values web services , what have tried app.controller('listdata',['$scope', '$http', function($scope, $http) { $scope.xxxx = []; //declare empty array data = []; function getresultspage(pagenumber) { console.log('please wait while data loadind'); $http({ method: 'post', url: ajaxurl, params: { 'action': 'get_xxxx', 'pagenumber': pagenumber, 'usersperpage': $scope.usersperpage } }).success(function (data, status, headers, config) { $scope.xxxx = $scope.xxxx.concat(data); $scope.totalusers = 100; }); } $scope.user

Retrieving latest associated record in LINQ? -

i have 3 entities entitya, entityb , entityc entitya can have many entityb entityb have 1 entityc , createddate i want retrieve entityas latest entityb if 1 exists , associated entityc. i'm struggling on linq (lambda or otherwise). can help? entityas.select(a=>new entitya { entitybs=a.entitybs.orderbydescending(b=>b.createdate).take(1)}); if ef entity, might need include c, this: entityas .include(a=>a.select(b=>b.entityc)) .select(a=>new entitya { entitybs=a.entitybs.orderbydescending(b=>b.createdate).take(1)});

Cannot Read JSON request body parameters in wso2 ESB as an api -

Image
i have created api in wso2 esb (4.8.1) , wanted send put request api request body. have tried sample , wanted log property values in insequence of defined api. this request body: this way how tried log location name: but i’m getting error this: (error - synapsejsonpath #stringvalueof. error evaluating json path . returning empty result. error>>> invalid path) so how can read these values? to achieve requirement, should send "content-type" http header request below, "content-type : application/json" enter image description here then can log specific json element below. <log> <property name="location" expression="json-eval($.coordinates.location[0].name)"></property> </log> then can see following log, enter image description here thanks.

jquery - Dropdown Subcategories in WooCommerce -

Image
by default woocommerce show categories , subcategories image posting. is possible hide subcategory test , show test sub category when click main category furniture? here html code page , css have used: aside#woocommerce_product_categories-2 ul li:nth-child(4) ul { display: none; } aside#woocommerce_product_categories-2 ul li:nth-child(4):hover > ul { display:block } <aside id="woocommerce_product_categories-3" class="widget woocommerce widget_product_categories"> <h5 class="widgettitle">product categories</h5> <ul class="product-categories"> <li class="cat-item cat-item-28"><a href="http://saltandpepper.workshopcy.com/product-category/accessories/">accessories</a></li> <li class="cat-item cat-item-29"><a href="http://saltandpepper.workshopcy.com/product-category/clothes/">cl

java - Web Application in Tomcat, how to connect to MongoDb -

i wondering correct way access mongodb server web application inside tomcat. mongodb documentation describes how connect mongoclient, possible define datasource , manage connection pool? far see, not. guess entire managing of connection pool has done manually, parametrical configuration of server ip , port?

android - What does it mean "the content provider can be instantiated by the system"? -

a few times in android's components i've encountered sentence ... can instantiated system in particular here whether or not content provider can instantiated system — "true" if can be, , "false" if not so mean regard content provider ? (btw content provider component new me - know other android components) when can happen content provider instantiated system? why can happen? what benefit app gets by-system instantiation? all android application components activity, service, contentprovider , broadcastreceiver(except dynamic) instantiated system when ever request comes. ex: activity instantiated system when ever calls startactivity() intent similarly, contentprovider instantiated system when request access data provided contentprovider using contentresolver.query or contentresolver.insert passing respective uri.

ios - how to get full path of file in dropbox in swift programatically -

i want display image dropbox item in imageview, want complete path image item can image nsdata of theat url. following code using: client.files.getmetadata(path: "/hello.txt").response { response, error in print("*** file metadata ***") if let metadata = response { if let file = metadata as? files.filemetadata { print("this file path: \(file.pathlower)") print("file size: \(file.size)") } else if let folder = metadata as? files.foldermetadata { print("this folder path: \(folder.pathlower)") } } else { print(error!) } here file.pathlower returns relative path , not full path. if want display image dropbox, you'll first need download it. search "download

cron - php does not create a file when executed with cronjob -

i have simple php file, creates text document everytime runs: $date = date('y-m-d h-i-s', time()); $log_name = "cronjob". $date; if($fh = fopen($log_name,'w')){ fwrite($fh, print_r($date)); fclose($fh); } when run file using browser txt file created on server. when run file cronjob, not create txt file. when go private > cron.log on server see cronjob works fine , result printed cron.log. can tell me why? need write file on server :) when executed in cronjob, need provide full path. script noch executed in directory it's located in , therefor relativ paths won't work. $absolut_path = "whatever absolutpath is"; // maybe /var/www/html/ $log_name = $absolut_path."cronjob". $date;

jquery - How can i place a button always center of the graph -

enter image description here i have 1 start button.how can place start button center of graph when resize window should center of graph.how can it? js: $( window ).resize(function() { var chart = $('#container').highcharts(); var textx = chart.plotleft + (chart.plotwidth * 0.5); var texty = chart.plottop + (chart.plotheight * 0.5); $('. placebtn').css('left', textx + (span.width() * -0.5)); $('. placebtn').css('top', texty + (span.height() * -0.5)); }); var chart = $('#container').highcharts(); var textx = chart.plotleft + (chart.plotwidth * 0.5); var texty = chart.plottop + (chart.plotheight * 0.5); $('. placebtn').css('left', textx + (span.width() * -0.5)); $('. placebtn').css('top', texty + (span.height() * -0.5)); jsfiddle: https://jsfiddle.net/7skvx8l5/2/ remove position: absolute , , add text-align: center row. .plac

python - Error handling in Django REST framework - empty file returned instead of Error view -

i have piece of code in django rest framework looks following. works if request arguments valid, if specify non-valid search keyword, browser returns empty python file length of 0 bytes instead of html error code. doing wrong respect error catching? from rest_framework.response import response rest_framework.views import apiview rest_framework.renderers import jsonrenderer, statichtmlrenderer rest_framework.exceptions import parseerror class getdataseriesid(apiview): renderer_classes = (jsonrenderer, statichtmlrenderer) def get(self, request, format=none): # check format keyword , overrule default rendering format if 'format' in request.query_params: request.accepted_renderer.format = request.query_params['format'] # build keyword arguments (left out clarity) search_dict = {'station_name':'example'} # render query try: res = dataseriesidserializer(**search_dict)

javascript - jHow to replace string from a part of given string? -

var ans = '#1>2,2,2,0,#2>3,2,1' i want remove 2 immediate after #1> not #2>. expected result is: ans = '#1>0,#2>3,2,1' how can using jquery? try one var ans = '#1>2,2,2,0,#2>3,2,1' ans.replace(/#1>(2,{0,})+/g,function() { return "#1>" }) output: #1>0,#2>3,2,1 test here

C# html agility pack get elements by class name -

i'm trying divs class contains word: <div class="hello mike">content1</div> <div class="hello jeff>content2</div> <div class="john">content3</div> i need divs class contains word "hello". this: resultcontent.documentnode.selectnodes("//div[@class='hello']")) how can agility pack? i got it: resultcontent.documentnode.selectnodes("//div[contains(@class, 'hello')]"))

How to check whether an rdn exists in LDAP or not using java -

i created role following rdn: erglobalid=3224285689051620393,ou=roles,erglobalid=00000000000000000000,ou=org,dc=com i deleted above role now above rdn not exists in ldap. but want check whether exists or not in ldap? there method such in this? i checked search() , lookup() methods, these methods throwing exceptions,.. because of whcih according requirement of application have write code in catch block not ideal can please me this i created role following rdn: erglobalid=3224285689051620393,ou=roles,erglobalid=00000000000000000000,ou=org,dc=com no didn't. dn (distinguished name), not rdn (relative distinguished name). rdn part of erglobalid=3224285689051620393. i deleted above role good you. now above rdn not exists in ldap. the above dn doesn't exist in ldap. i want check whether exists or not in ldap? it doesn't. deleted it. if delete had failed have thrown exception. if didn't fail, it's deleted, doesn

node.js - nodejs gm using stream twice -

i need make 2 resized images one. var fs = require('fs') , gm = require('gm') , async = require('async'); var worker = function(filename) { img = gm(fs.createreadstream(filename)); img.flip(); this.run = function() { async.series([ function(callback) { img.resize(640, 480); img.tobuffer(function(err, buffer) { if (err) { callback(err); return; } callback(null, true); }) }, function(callback) { img.resize(320, 240); img.tobuffer(function(err, buffer) { if (err) { callback(err); return; } callback(null, true); }) }, ], function(err, results) { console.

selenium - Replace a portion of url in python -

i need replace portion of following url in selenium webdriver+python: https://ve-215:8443/cloudweb/dropbox_authorized?oauth_token=l8eyufg8nux3tuhm&uid=69768040 i need replace ve-215 ip address 192.168.24.53 i tried using replace doesnt work. following code using: current_url=driver.current_url print(current_url) #prints url of current window. current_url.replace("ve-215", "192.168.53.116") print(current_url) #print url replaced string driver.get(current_url) #open window replaced url can me wrong above code? replace method not modify string (strings immutable in python) returns new string. try current_url = current_url.replace("ve-215", "192.168.53.116") that being said, advised use urlparse module ( urllib.parse in python 3) parsing , reconstructing urls.

javascript - lodash find matching keys/nested keys -

i have standard object, nested objects. i trying find keys contain 'gmt' , format corresponding epoch value via moment. var myobject = { "suffix" : "mr", "fname" : "jullian", "lname" : "exor", "dobgmt" : 145754294700000 "addressline1" : "flat 8a", "street" : "hoxley close", "rentstartedgmt" : 145754294700000, "deposit" : "50.00", "occupation" : "math teacher", "profession" : { "careerstartedgmt": 1458755224800000, "careerendgmt": 1459854224800000, }, "salary" : 28000, "votingdetail" : { "location" : "virgina", "votedongmt": 1874585224800000, "votedfor" : "world wildlife foundation" } } i can use standard js loop thr

c# - Could not find file 'c:\windows\system32\inetsrv\xxx.xlsx' -

i have mvc application reads , uploads excel file , processes file in app, works fine on local machine, deploy server,i following error above. have added permissions iis app pool user root folder, browse file through app on local machine, fails above error. if test on deployed server works fine. idea is, have seen lot of posts on this, tried suggestions no luck. ideas, please see code below. try { if (file.contentlength > 0) { var filename = file.filename; var targetfolder = server.mappath("/"); string targetpath = path.combine(targetfolder, filename); file.saveas(targetpath); you should use tilde symbol(~) point root of application server.mappath("~/"); and it's better use subfolder (make sure there folder) server.mappath("~/uploads/")

YCSB Mongodb _id -

i use ycsb test mongodb. after load 3000000 documents, try run insert step, encounter problem below: exception while trying bulk insert 0 com.mongodb.mongowriteexception: insertdocument :: caused :: 11000 e11000 duplicate key error index: ycsb.usertable.$_id_ dup key: { : "user451605437247003858" } i find when execute load step, _id of each document somehow "_id" : "user1136", "_id" : "user1130" and on. not meet commonly "_id" : objectid("55753c547e2596a4d07c2219"), so conflict when try insert lot documents easy understand. so can solve conflict? i assume key used see below : "_id" : objectid("55753c547e2596a4d07c2219") is generated python driver pymongo . the mongo module in ycsb uses java driver . when call insert, calling : com.mongodb.client.mongocollection<tdocument>.insertone which throw com.mongodb.mongowriteexception: e11000 duplicate

Removing Java packages in IBM Integration Toolkit (Eclipse-based) -

i'm working on project in ibm integration toolkit 10.0.0.3 (formerly known ibm integration bus) based on eclipse. have restructured couple of java libraries , part of restructuring add level in package structure. this, created new package , moved source files old package new. next step delete old (empty) package has proved quite challenging. it seems version of eclipse ibm integration toolkit based on quite limited. the problems have are: packages not contain files not visible in package explorer. it not possible change in filter (package explorer -> view menu -> filters...). it not possible delete packages contain files, , remove files in package disappears package explorer. if delete package outside of eclipse, don't show in eclipse, eclipse still recognizes package exist. (i've tried creating new package old name , stops me doing saying exists). i've tried installing new version of vanilla eclipse , deleting packages using that, ibm integration t

qt - How to create layered project structure in c++ using qmake -

under windows using mingw, c++11, qt 5 , qmake have following project structure: /my-project my-project.pro /my-app my-app.pro main.cpp /module-a module-a.pro modulea.h modulea.cpp /module-b module-b.pro moduleb.h moduleb.cpp the dependencies between modules should this: my-app ==> module-a ==> module-b what want achieve my-app uses module-a, module-a uses module-b , my-app doesn't know module-b. module-a references module-b through implementation (the #include module-b located in .cpp of module-a). i've tried implement configuring module-a , module-b static libraries in qmake. unfortunately while compiling receive linker error saying 'undefined reference moduleb::dosmthb()' i understand reason of linking problem, question if somehow possible achieve similar proposed layered structure? sources: my-project.pro: template = subdirs subdirs += module-b subdirs += module-a subdirs += my-

osx - Row text moves up when row is deselected in NSOutlineView source list -

Image
in app have set nsoutlineview displays categories sort of menu. works fine there problem when deselect item, titles in each row move in image below: her code using: - (nsinteger)outlineview:(nsoutlineview *)outlineview numberofchildrenofitem:(id)item { return [sectionsarray count]; } - (bool)outlineview:(nsoutlineview *)outlineview isitemexpandable:(id)item { return no; } -(bool)outlineview:(nsoutlineview*)outlineview isgroupitem:(id)item { return no; } - (nsview *)outlineview:(nsoutlineview *)outlineview viewfortablecolumn:(nstablecolumn *)tablecolumn item:(id)item { nstablecellview *cellview = [outlineview makeviewwithidentifier:@"datacell" owner:self]; cellview.imageview.image = [nsimage imagenamed:@"point.png"]; cellview.textfield.stringvalue = item; sectioncellcountfield *number = [[sectioncellcountfield alloc] initwithframe:nsmakerect(cellview.frame.size.width-50, 4, 35, 16)]; [cellview addsubview:number];