Posts

Showing posts from January, 2011

javascript - Passing a controller to a directive in angularJS. Gives undefined error -

i working add modals directives using ui-bootstrap , did fine on previous directive. don't believe doing differently in 1 referenceerror: milestonecontroller not defined when run edit() function within directive. milestone.html (this template html directive below) : <div ng-controller = "milestonecontroller"></div> milestone directive: angular.module('ireg').directive('milestone', function (milestonefactory,$modal) { return { restrict:'e', scope: { objectid:'@objectid' }, templateurl: '/ireg/components/milestone/milestone.html', link: function ($scope, element, attrs) { $scope.edit = function(data) { milestonecontroller.editmilestonedialog(data); }; } } }); angular.module('ireg').controller('milestonecontroller', function ($scope, $modal){ $scope.editmilestonesdia...

ios - Cannot Add PFRelation values to a specific objet -

i creating app user can create group, , add information within group. this, pfrobject created in parse database , pfrelation created object containing group info. having trouble adding relation info object want. instead of app adding info existing object, creates new object , relation, , adds info there. how can add data existing object? appreciate suggestions. @ibaction func createnewgroupaction(sender: anyobject) { var groupinfo = pfobject(classname: "groupinfo") groupinfo["user"] = pfuser.currentuser()?.username groupinfo["interest"] = "cars" groupinfo.save() let relationinfo = pfobject(classname: "beatergroups") relationinfo["groupname"] = "carguys" let relation = relationinfo.relationforkey("groupinfo") relation.addobject(groupinfo) relationinfo.save() } var dataparse: nsmutablearray = nsmutablearray() func loaddata (){ var findgroups: pfquery ...

Extract Regression P Value in R -

i performing multiple regressions on different columns in query file. i've been tasked extracting results regression function lm in r. so far have, > reg <- lm(query$y1 ~ query$x1 + query$x2) > summary(reg) call: lm(formula = query$y1 ~ query$x1 + query$x2) residuals: 1 2 3 4 7.68 -4.48 -7.04 3.84 coefficients: estimate std. error t value pr(>|t|) (intercept) 1287.26 685.75 1.877 0.312 query$x1 -29.30 20.92 -1.400 0.395 query$x2 -116.90 45.79 -2.553 0.238 residual standard error: 11.97 on 1 degrees of freedom multiple r-squared: 0.9233, adjusted r-squared: 0.7699 f-statistic: 6.019 on 2 , 1 df, p-value: 0.277 to extract coefficients, r-squared , f statistics use following: reg$coefficients summary(reg)$r.squared summary(reg)$fstatistic i extract p-value of 0.277. is there piece of code this? thanks i recommend using "broom" package practice go forward ca...

javascript - How to use slider project from GitHub? -

i use following project on github website: https://github.com/andreruffert/rangeslider.js . first me please bare me have looked @ threads , can't pinpoint code wrong. <head> <title> slider </title> <link type="text/css" rel="stylesheet" href="https://github.com/andreruffert/rangeslider.js/blob/develop/src/rangeslider.scss" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src = "http://andreruffert.github.io/rangeslider.js/assets/rangeslider.js/dist/rangeslider.min.js"> </script> then in body section have: <input type="range" min="10" max="1000" step="10" value="300"> <script> $('input[type="range"]').rangeslider({ polyfill: false }); </script> with code, cant see slider on page. doing wrong? i'v...

python - How can I add a new language auto complete and suggestions for sublime text? -

i'm trying create new language support sublime text 3. i've been creating syntax highlighting using yaml , i'd when i'm writing code, sublime text css or php , start typing command , recognizes , shows list possible commands , when choose it, they're written in code automatically. fill it. how can this? maybe if have tips make syntax highlight, great! thanks would snippets work your? declare snippet like <snippet> <content><![cdata[-content want fill here-]]></content> <tabtrigger>-implicit key binder-</tabtrigger> <scope>source.php</scope> </snippet> and save under packages/user .

error handling - Catching all bad signals for called commands in Bash script -

we creating bash script build server. want ensure when execute bash command inside script, returns signal of 0. if not, want execution stop. our solution far do: #some command if [ $? -ne 0 ] ; #handle error fi after every command cause problem. makes code quite long , doesn't seem elegant. use bash function, perhaps. although working $? can bit tricky, , still have call function after every command. there better way? i've looked @ trap command seems signal handling bash script writing, not commands call. the robust, canonical way of doing is: #!/bin/bash die() { local ret=$? echo >&2 "$*" exit "$ret" } ./configure || die "project can't configured" make || die "project doesn't build" make install || die "installation failed" the fragile, convenient way of doing set -e : #!/bin/bash set -e # script exit in many (but not all) cases if command fails ./configure make ...

user interface - How to create a UI in Python -

so have code... name = raw_input("full name: ") and supposed allow me type in name , use name activate "if" statements. however, want have program open window, simple gui, can type word. experience creating gui in java , through processing, lost when comes python. appreciated. for start suggest start tkinter library (built in library). this simple program using tkinter gui. import tkinter class simpleapp_tk(tkinter.tk): def __init__(self,parent): tkinter.tk.__init__(self,parent) self.parent = parent self.initialize() def initialize(self): self.grid() self.entryvariable = tkinter.stringvar() self.entry = tkinter.entry(self,textvariable=self.entryvariable) self.entry.grid(column=0,row=0,sticky='ew') self.entry.bind("<return>", self.onpressenter) self.entryvariable.set(u"enter text here.") button = tkinter.button(self,text=u...

c# - Getting people across projects -

i using bcxapi .net , trying list of people project doesn't seem available in api. i found documentation shows it's possible: get /projects/#{project_id}/people.xml but hoping not have break pattern , stick using api. can validate suspicion can't done bcxapi? i have been trying piece bits , pieces different articels , i'm trying approach: var basecampprojects = s.getprojects(a.id); foreach (var proj in basecampprojects) { var client = new restclient() { baseurl = new uri("https://basecamp.com/" + a.id + "/api/v1/projects/" + proj.id + "/people.json/") }; client.authenticator = new oauth2authorizationrequestheaderauthenticator(accesstoken.access_token); var request = new restrequest(method.get); request.requestformat = dataformat.json; ...

javascript - How do I go back to the previous tab only when I hit back or click on the link the brings me back to the page? -

i have page. page has tabs. 1 of tabs (lets call tab 4) has links opens other pages (and takes away page tabs). secondary page has link on when clicked brings tabbed page on tab last left off on (tab 4). if hit button also. issue is, each time initialize page (i.e. visit page first time in day, or visit page later on (without hitting or "previous page" link, end remaining on last tab on when last visited page (tab 4). can tell me add , when type url in @ later time default me tab 1 (but go tab 4 if hit or previous page link). basically want state refresh if visit page @ later time not refresh if hit or "click previous page". how set expiry date local storage (i.e. instance on connecting page) here code. <script> jquery('#lmd_create_tabs > ul li').click(function(e) { var = jquery(this).prevall().length; localstorage.activetab = i; }); jquery(function() { var myactivetab if (typeof localstorage.activetab !== 'undefined...

PHP Built Multidimensional Array after explode function -

i try found function build multidimensional array after explode. for example : here create array explode. $str = 'root/foo/bar/file.jpg'; $ar = explode('/', $str); $ar => array('root', 'foo' , 'bar', 'file.jpg'); then want ouput : array(3) { ['root']=> ['foo']=> ['bar']=> "file.jpg" } any idea ? thx here 1 way problem can approached. <?php $str = 'root/foo/bar/file.jpg'; $parts = explode("/", $str); $leaf = array_pop($parts); $tree = array(); $branch = &$tree; foreach($parts $v){ $branch[$v] = array(); $branch = &$branch[$v]; } $branch = $leaf; print_r($tree); try here

java - Extended Jersey Generated WADL: do not see jaxb classes -

i struggling couple of days following problem. created simple jersey 2 project. here mine jerseyconfig public class jerseyconfig extends resourceconfig { public jerseyconfig() { property(serverproperties.wadl_generator_config, "com.platform.config.jersey.epwadlgeneratorconfig"); register(projectpolicycounterwebservice.class); } } also have generator config: public class epwadlgeneratorconfig extends wadlgeneratorconfig { @override public list<wadlgeneratordescription> configure() { return generator(wadlgeneratorapplicationdoc.class) .prop("applicationdocsstream", "ws/wadl/application-doc.xml") .generator(wadlgeneratorresourcedocsupport.class) .prop("resourcedocstream", "resourcedoc.xml") .generator(wadlgeneratorgrammarssupport.class) .prop("grammarsstream", "ws/wadl/application-gramma...

Android Remove Shadow On Navigation Drawer -

see here mean hi, i'm using stock navigation drawer v4 , ask how can delete background shadow when navigation drawer open. this code of navigationdrawerfragment.java public void setup(int fragmentid, drawerlayout drawerlayout) { mfragmentcontainerview = getactivity().findviewbyid(fragmentid); mdrawerlayout = drawerlayout; // set custom shadow overlays main content when drawer opens mdrawerlayout.setdrawershadow(r.drawable.trasparent, gravitycompat.start); // set drawer's list view items , click listener actionbar actionbar = getactionbar(); actionbar.setdisplayhomeasupenabled(true); actionbar.sethomebuttonenabled(true); and mainactivity.xml <android.support.v4.widget.drawerlayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- main layout --> <framelayout android:id="@+id/main_fragment_conta...

Make the logo transparent in Python tkinter 3.4 -

this question has answer here: removing tk icon on tkinter window 5 answers i wanted insert icon in gui. have tried inserting 1 need , want make transparent . can make icon transparent in way? appreciated. i've voted close question duplicate; in meantime, here working code first answer trying do: python 2.x : from __future__ import with_statement import tkinter import tempfile import base64 import zlib icon = zlib.decompress(base64.b64decode('ejxjygaeqgebbidjwzdby' 'sagxsdaoaheqcegbqaioag4sdigacmuj4jrmapgwqgf/ykeafxxqrc=')) _, icon_path = tempfile.mkstemp() open(icon_path, 'wb') icon_file: icon_file.write(icon) tk = tkinter.tk() tk.iconbitmap(default=icon_path) label = tkinter.label(tk, text="window transparent icon.") label.pack() tk.mainloop() python 3.x : import tkinter import tempfile import base6...

sql server - Join sql table on Datename -

i have select statements looks select count(*) 'total', datename(dw, [callstart]) 'totaldayname' #totals [warehouse].[dbo].[voice] (nolock) select datename(dw, [callstart]) 'day1' [warehouse].[dbo].[calls] ref (nolock) join #totals total on **ref.day1** = total.totaldayname i have simplified query question. need join #totals calls table on totaldayname = ref.day1 . know can't use alias join table. have tried totaldayname = ref.datename(dw, [callstart]) gives me error well. i think you've got syntax wrong, said i have tried totaldayname = ref.datename(dw, [callstart]) but should have been totaldayname = datename(dw, ref.[callstart]) it should work fine

jquery - Select element by id name ending on OpenLayers -

i trying select element id on openlayers map. have checked element id " openlares_map_4_openlayers_container " number changes (4 8 or 10). trying select element jquery selector finds element ends ( see link ). but doesn't seem work. , example can seen in jsfiddle following javascript code: // osm var osmlayer = new openlayers.layer.osm("osm map"); // map var map = new openlayers.map('mapdiv', { layers: [osmlayer], center: new openlayers.lonlat(0, 0), zoom: 0 }); // elements var = document.getelementsbytagname("*"); (var i=0, max=all.length; < max; i++) { console.log('document.elements: ' + + ' -> ' + all[i].id) } // select elements var mapcontainer = document.getelementbyid("openlayers_map_4_openlayers_container"); $("#tag1").text(" -> "+mapcontainer); console.log('mapcontainer: ' + mapcontainer); var id_ol_container = $("div[id$='_openla...

asp.net mvc 4 - Can a SQL Server connection be reused on two different concurrent requests? -

our setup asp.net mvc using ninject , instantiate , open new connection on per request basis using same connection string every time. based on msdn article connection pooling reuse connections, wondering if it's possible connection in used on 1 request reused on concurrent request @ same exact time. the reason question have query set isolation level read uncommitted run query , set was. since setting isolation level @ connection level wondering if it's possible other requests reading "dirty" data during time frame when isolation read uncommitted . whenever connection placed pool, reset via call sp_reset_connection . unfortunately, not affect isolation level. there complaints behavior here: https://connect.microsoft.com/sqlserver/feedback/details/243527/sp-reset-connection-doesnt-reset-isolation-level if must change isolation level, i'm afraid you'll need to: explicitly set isolation level on every query use different connection strin...

c++ - Not deleting dynamically allocated memory and let it get free by the OS after programme termination -

i have read question , answer dynamically allocated memory after program termination , , want know if okay not delete dynamically allocated memory , let freed os after programme termination. so, if have allocated memory objects need thoughout programme, ok skip deleting them @ end of programme, in order make code run faster? the short answer yes, can, long answer possibly better not that: if code needs refactored , turned library, delivering considerable amount of technical debt person going job, you. furthermore, if have real, hard-to-find memory leak (not memory leak caused intentionally not freeing long-living objects) it's going quite time consuming debug valgrind due considerable amount of noise , false positives. have @ std::shared_ptr , std::unique_ptr . latter has no overhead.

windows - Batch/cmd: stop glassfish, copy file, start glassfish -

my objective simple. have glassfish server. made change jar need put domains/lib folder. have stop-domain, copy file over, start domain. thought using batch file efficient way that; however, seem struggling. here i've got rem ##### set paths ##### set glassfish_home=c:\glassfish-4.1\bin set target_folder=c:\dummypath\target set domain_lib=c:\glassfish-4.1\glassfish\domains\domain1\lib set jar=dummyfile.jar pause rem ##### stop glassfish server ##### cd %glassfish_home% asadmin stop-domain rem ##### copy dataaccess jar ##### cd %target_folder% copy %jar% %domain_lib%\ rem ##### start glassfish server ##### cd %glassfish_home% asadmin start-domain however, happening right seems stop domain, not proceed else. doesn't start again. i've attempted comment out stop-domain , manually stopped it. ran batch file , copied file, started domain, did not close , remained on cmd screen "command start-domain executed successfully." message. any insight why batch ...

javascript - Split string by colon but ignore URL's -

i need split string colons, ignore colons within urls presented in string. example: var str = 'www.website.com:http://website.com/'; the result should be: ["www.website.com", "http://website.com/"] it may lot of addresses in row. i have tried javascript split() regex (:)(?:[^\/][^\/]) not helping much. if use negative lookahead can filter out protocols (colons followed double slash) , ports (colons followed digit: var str = 'www.website.com:http://website.com/:test.com:5000:test.co.uk'; var split = str.split(/:(?!\/\/|\d)/);

python - Issue in setting the background color in pyqtgraph -

i've got issue when using pyqtgraph module in python. when put white background color glscatterplot, scatter dots vanish. if color of background added color of scatterplot therefore white. here piece of code use: w = gl.glviewwidget() w.setbackgroundcolor('w') w.show() sp3 = gl.glscatterplotitem(pos=np.transpose(pos3), color=rgba_img, size=1, pxmode=false) w.additem(sp3) if replace ('w') ('k') in setbackgroundcolor method color of scatter fine , background black. did else ever issue? i think reason haven't set foreground colour. try: import pyqtgraph pg pg.setconfigoption('background', 'w') pg.setconfigoption('foreground', 'k')

python 2.7 - HOw to get dummy scrapy stuts count in scrapyd -

how the "dummystatscollector" in scrapyd. have studied link " http://doc.scrapy.org/en/latest/topics/stats.html#dummystatscollector ".. there no brief explanation scraped status in scrapyd. i able curl http://localhost:6800/stats.json -d project=default -d spider=somespider , return {"pages_crawled": "650","pages_per_min":"342","items_scraped":"286","items_per_min":"156"} but getting error : <html> <head><title>404 - no such resource</title></head> <body> <h1>no such resource</h1> <p>no such child resource.</p> </body> </html> thanks

linux - Setup private networking between two hosts and two VMs with libvirt / openvswitch -

i have 2 nodes , 2 vm's kvm01 -nic1 123.123.123.1 vm1 -vnet1 123.123.123.2 (public) -vnet2 10.0.0.1 (private) kvm02 -nic1 123.123.123.2 vm2 -vnet1 123.123.123.4 (public) -vnet2 10.0.0.2 (private) how possible setup openvswitch network vm1 , vm2 on private network hosts in 2 different locations? edit: running command: # ovs-vsctl add-port br-private vxlan1 -- \ set interface vxlan1 type=vxlan options:remote_ip=123.123.123.2 resulted in ovs configuration: root@backup01:~# ovs-vsctl show 6276bd0a-920b-469d-a4e0-90d990dd8f94 bridge "br-private1" port "vxlan1" interface "vxlan1" type: vxlan options: {remote_host="107.150.29.72"} port "br-private1" interface "br-private1" type: internal ovs_version: "2.3.0" root@kvmssd01:~# ovs-vsctl show da6399d4-1435-437d-90d7-3e75c443389b bridge br-private ...

java - Using Parceable to pass Objects in android -

wrote class helps pass object, working fine until wanted pass more generic object myself. public class stepparceble implements parcelable { private step mstep; private jsonobject mstepdata; private onscreen monscreen; public stepparceble(step step, jsonobject stepdata, onscreen onscreen) { setmstep(step); setmstepdata(stepdata); setmonscreen(onscreen); } public stepparceble(parcel parcel){ } public onscreen getmonscreen() { return monscreen; } public void setmonscreen(onscreen monscreen) { this.monscreen = monscreen; } public void setmstep(step mstep) { this.mstep = mstep; } public void setmstepdata(jsonobject mstepdata) { this.mstepdata = mstepdata; } public jsonobject getmstepdata() { return mstepdata; } public step getmstep() { return mstep; } @override public int describecontents() { return 0; } @override public void writetoparcel(parcel dest, int flags) { try { dest.writearray(new object[]{mstep, mstepdata,monscr...

regex - JavaScript - Remove Minecraft Color Codes from String -

i'm trying remove minecraft color codes string: [§aannouncement§r] §4test and searched here, tried own, no avail. code: module.exports.regextest = function (message) { var regex = '(?i)§[0-9a-fk-or]/g'; return message.replace(regex,''); }; now, accounts tells me that regular expression works, when parse message in post doesn't remove anything. what wrong regex code? edit: @anubhava help. turns out source recieving sending wrong unicode. fixed code: console.log(message.replace(/\u00a7[0-9a-fk-or]/ig,'')); thanks help, everyone! (?i) not supported in javascript regex, try regex: var regex = /\u00a7[0-9a-fk-or]/ig; demo

c# - Register Endpoint on Cisco ISE with RestSharp -

i'm trying register(post) endpoint on cisco ise 1.3 via restsharp client in c# console application. i got working requests. code used: string xml = "<?xml version='1.0' encoding='utf-8' standalone='yes'?> <ns3:endpoint name='name' id='id' description='desc' xmlns:ns2='ers.ise.cisco.com' xmlns:ns3='identity.ers.ise.cisco.com'> <groupid>04f3c120-f42f-11e2-bd54-005056bf2f0a</groupid> <mac>00:00:cc:ac:bb:cc</mac> <profileid>576bf7b0-f42f-11e2-bd54-005056bf2f0a</profileid><staticgroupassignment>true</staticgroupassignment> <staticprofileassignment>true</staticprofileassignment> </ns3:endpoint> "; var client = new restclient(); client.baseurl = new uri("https://" + ip + ":9060/ers/config/endpoint"); client.authenticator = new httpbasicauthenticator(user, pw); var request = new restrequest(); ...

excel - Assign cell background color to rgb from referenced cells -

Image
i'm working in excel on programatically setting cell's background color specific rgb color referenced in nearby cells. here's i'm trying do: you can see manually set background color rgb values specified in cells in same row on left, highlighted in picture. first purple cell has rgb (148,91,128). i want in vba or maybe conditional formatting if possible. far have tried simple vba line of code see if work: range("f1").interior.color = rgb(c1, d1, e1) however line of code sets cell have black background this: if code had worked correctly, cell should have been white color, not black. ideas on why isn't working? making mistake way reference cells rgb? it nice able assign range "f1:f__" reference cells left on each row too, not 1 cell. thanks! try this: range("f1").interior.color = rgb(range("c1"), range("d1"), range("e1")) in version of code c1 , d1 , e1 taken variables , have...

powershell - Add-AzureInternalLoadBalancer command in "Azure Resource Manager" mode -

i'm interested achieve solution described in this post. therefore, wanted add internal load balancer in ms azure virtual network. created vnet in resource manager mode , added 3 vms it, don't have access add-azureinternalloadbalancer powershell command in arm mode. if switch service management mode, the problem don't see vms anymore. how can add internal load balancer in resource manager mode? assume have setup ps subscription , user account. # add load balancer cloud service wrapping vms add-azureinternalloadbalancer -servicename apptier ` -internalloadbalancername apptierplb -subnetname appsubnet ` -staticvnetipaddress 192.168.1.25 # add endpoints vms # vm1 get-azurevm -servicename apptier -name apptier01 | ` add-azureendpoint -lbsetname 'httpin' -name 'httpin' ` -defaultprobe -internalloadbalancername 'apptierplb' -protocol tcp ` -publicport 80 -localport 80 -loadbalancerdistribution sourceip | ` update-azurevm # vm2 g...

cocoa touch - touchesBegan function in Swift doesn't need override -

i'm new xcode , i've been playing around making spritekit game in swift. in every tutorial or stack overflow topic i've looked at, touchesbegan function has override before it, when copy code gamescene.swift, error, "override can specified on class members," auto-fix of deleting "override." so instead of this: override func touchesbegan(touches: set<nsobject>, withevent event: uievent) {...} wants me have this: func touchesbegan(touches: set<nsobject>, withevent event: uievent) {...} i'm not sure why happening, , don't know if affect how function works. my current code in gamescene.swift is: import spritekit class gamescene: skscene { required init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override init(size: cgsize) { super.init(size: size) backgroundcolor = skcolor.blackcolor() let stars = stars() var starnode:sknode! starnode = stars.createstars(cgfloat(30), direction: 1, s...

asp.net core mvc - How important is the global.json and src folder? -

in vs 2015, when create new mvc 6.0 application using approach: file-->new-->project-->asp.net web application-->asp.net 5 preview templates you end have following file structure on disk: artifacts src myproject.sln global.json instead if decide create blank solution first so: file-->new-->project-->other project types-->visual studio solutions-->blank solution and start adding new asp.net web application project solution; end having file structure doesn’t have global.json file , no src folder. according documentation , the global.json file used configure solution whole. includes 2 sections, projects , sdk default. the projects property designates folders contain source code solution. default project structure places source files in src folder, allowing build artifacts placed in sibling folder, making easier exclude such things source control. the sdk property specifies version of dnx (.net execution environment) visual studio...

javascript - How to call an external function from within casper.start or casper.thenOpen -

i trying split following code such callback function stored in own file. var casper = require('casper').create(); casper.start("http://www.google.com/", function() { this.echo(this.gettitle()); }); casper.run(); // "returns google" following this example , define function in separate file called "getpagetitle.js"; function getpagetitle(casper) { casper.echo(casper.gettitle()); } exports.getpagetitle = getpagetitle; and call function in file called "main.js" passing casperjs object function directly; var casper = require('casper').create(); var casperfunctions = require('./getpagetitle.js'); casper.start("http://www.google.com/", casperfunctions.getpagetitle(casper)); # error: caspererror: casper not started, can't execute `gettitle()` further, if replace last line in above thenopen() call; casper.start(); casper.thenopen("http://www.google.com/", casperfu...

How to login to a site using OAuth, python? -

so have script needs access features of website requires login via oauth. i have oauth client secrets file dev console- right script can retrieve list of user's youtube videos- have now __author__ = 'anish' import httplib2 import sys googleapiclient.discovery import build oauth2client.client import flow_from_clientsecrets oauth2client.file import storage oauth2client.tools import argparser, run_flow import requests requests_oauthlib import oauth1session # of code sourced https://developers.google.com/youtube/v3/guides/uploading_a_video client_secrets_file = "client_secrets.json" youtube_read_write_scope = "https://www.googleapis.com/auth/youtube" youtube_api_service_name = "youtube" youtube_api_version = "v3" missing_client_secrets_message = "missing client secrets" def get_credentials(args): flow = flow_from_clientsecrets(client_secrets_file, scope=youtube_read_write_scope) storage = storage("%s...

asp.net - Can not find image path in web application -

i using asp.net mvc 4.0 application. using ii7/ii8. have configured web application under following way in iis in following way default web site\mywebapp when trying browser page in local machine http://localhost/home in following image rendered. image surely available @ /content/images/ not loaded properly, when in browser inspect element , alter path /mywebapp/content/images/ loading image properly. <img alt="close" style="cursor: pointer;" src="/content/images/ic-delete.png" onclick="closepopup('dvclose');"> while in live server iis , have website www.xxx.yzx , when trying browse www.xxx.yzx/home loading image properly i trying somthing don't want bother change path(remove mywebapp) of image when deplying. don't want move application default site what loading image in local machine? posting comment answer: ~/content/images/ic-delete.png try src.

Android : Setting default zoom level for an area with com.google.android.gms.maps.GoogleMap -

Image
i working on android application in show user nearby area location. unfortunately, when map data googlemaps, shows me entire world , dot on present location , need keep zooming in. tried set zoom factor upto 100, didn't change anything. there doing wrong. kindly let me know. here code : public class mapsactivitiyfragment extends fragmentactivity implements locationlistener { static googlemap googlemap; locationmanager locationmanager; string provider; latlng myposition; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.fragment_maps_activitiy); supportmapfragment fm = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.googlemap); googlemap = fm.getmap(); googlemap.setmylocationenabled(true); locationmanager = (locationmanager) getsystemservice(location_service); criteria criteria ...

Parse a CSV file and insert its content as new lines before the last matching pattern using sed or awk or any unix utils -

i parse csv file , insert content new lines before last matching pattern (matching pattern ) in file. csv file contents 10.200.1.20,255.255.255.0 10.200.1.30,255.255.255.0 second file insertion required: <!-- example ip list <iplist> </iplist> example end --> <iplist> <ip node_id="100.10.10.10" netmask="255.255.255.0"/> <ip node_id="100.10.10.10" netmask="255.255.255.0"/> </iplist> please me in how achieve this to handle xml, use proper xml handling tools. example, task can accomplished following xsh script: open input.xml ; perl { open $fh, '<', 'file.csv' or die $! } ; while { $line = <$fh> } { $line = normalize-space($line) ; # remove final newline. $ip := insert element ip append /iplist ; set $ip/@node_id substring-before($line, ",") ; set $ip/@netmask substring-after($line, ",") ; insert text {"\n"} ...

numpy - Why does python keep crashing when plotting with matplotlib? -

i running python code simulates , predicts conditions inside rapid compression machine (such temperature, pressure, chemical species, etc.). code set calculates time evolution of these parameters (which saved in numpy arrays) , outputs them function, creates , saves plots of these parameters against time. these arrays large, , function creates 14 plots using matplotlib. function 7th plot (sometimes more, less), when error reading "python.exe has stopped working". not sure if it's memory issue because plots big or what's going on. i have tried both (as you'll see in sample code) plt.figure.clf() , plt.close() . i've tried doing time.sleep inbetween plots. following example snippet of function plotting (not real code, example necessary illustrate problem). i using windows, python 2.7, , matplotlib 1.4.2 def graph_parameters(time, a, b, c, d, e): #a,b,c,d,e parameters delay = 10 plt.figure(1) plt.figure(facecolor="white...

ios - iOS8 incorrrect value of UIView.systemLayoutSizeFittingSize with Size Classes -

Image
i've faced strange issue method uiview.systemlayoutsizefittingsize when size classes being on on ios 8. example i'm usign paul's tutorial project auto height cell. project mine modifications demonstrate purpose, can found here so on ios 7 looks nice. but on ios 8 method return more lesser value , cells starting breaking apart. this issue gone when size classes being off. don't know how aproach , @ point solution know turn of size classes . code viewcontroller.m (108 lines) #import "viewcontroller.h" #import "customtableviewcell.h" @interface viewcontroller () <uitableviewdatasource, uitableviewdelegate> { nsmutablearray *_fontarray; nsmutablearray *_quotearray; } @property (weak, nonatomic) iboutlet uitableview *tableview; @property (strong, nonatomic) customtableviewcell *customcell; @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after load...

javascript - AngularJS Show typeahead on button click -

i using typeahead directive in angularjs , works fine. however, have button outside of input when clicked show typeahead dropdown. here snippet of after... <li class="input"> <input focus-me="click" ng-model="something" typeahead="state state in suggestions | filter:$viewvalue:statecomparator" typeahead-focus typeahead-focus-first="false" typeahead-on-select="updatetaginput(newtagname)"> <a href="" ng-click="opentypeahead()">open</a> </li> ok, having absolutely terrible time trying create jsfiddle or plunkr this, give code directive. this directive comes from.. this epic bootstrap library! ..and stole , played it. if use it, need "bootstrap" (its subset of angular directives) library linked to. can make own subset of library, not entirely sure of of dependencies directive has using entire library in project. basically, need directive st...

c# - merge properties from two lists -

i have code: ienumerable<carresultsviewmodel> priceresults = price.select(p => new carresultsviewmodel { priceperday = p.priceperday, priceperdaydelayed = p.priceperdaydelayed, totalprice = (double)p.total_price }).tolist(); ienumerable<carresultsviewmodel> results = car.select(c => new carresultsviewmodel { creationyear = c.creationyear, manufacturername = c.manufacturername, modelname = c.modelname, gear = c.gear, currentkm = c.currentkm, picture = c.picture, startdate = model.startdate, returndate = model.returndate }).tolist(); i implement 3 properties in priceresults results list. there elegant way that? ...

javascript - image slicing, only saves (via Filesaver.js) last slice in sequence -

hi i'm writing function break large image individual smaller tiles, , save tiles locally via filesaver.js. however, reason, for-loop keeps writing last tile in. example, if have image , break 4 blocks, , decide write out 2 blocks in first row, both saved image tiles display 2nd image tile. i write out block number image name (testimage_0.jpg & testimage_1.jpg), both tile image names testimage_1.jpg. have no clue why!, tried context.clearrect , no success. can please me out here silly problem? here function: var canvas = document.createelement('canvas'); var tilewidthpx = parseint(document.getelementbyid("horizppt").value); var tileheightpx = parseint(document.getelementbyid("vertppt").value); canvas.setattribute('width', tilewidthpx); canvas.setattribute('height', tileheightpx); for(var = 0; < 2; i++) { var context = canvas.getcontext('2d'); context.clearrect(0,0,canvas.width,canvas.height); contex...

java - Why does the scanner gets te wrong input? -

this question has answer here: how compare strings in java? 23 answers the input word. if word hello should print: hello sir etc if input not hello should print: why dont hello? problem prints: why dont hello? why this? scanner input =new scanner(system.in); string word=input.nextline(); if(word=="hello"){ system.out.println("hello sir have day"); } else{ system.out.println("why dont hello?"); } you have use method equals() instead of comparing 2 strings operator == the == operator check identity of 2 operands. in case new string created when call method nextline on scanner . calling operator == results in false results, instead calling equals check internal content of both strings returns true.

python - Loop through csv rows and check for a specific value -

hello got question regarding loops. situation got csv file check whether in column3 (row[2]) value "1" present. if not skip , loop again add value: i = 1 maxuserid = 7255 result_liked = [] open('source/to/file/user_id%i.csv' %i,'r') fin: row in csv.reader(fin, delimiter='\t'): if int(row[2]) >= 1: result_liked.append(row) += 1 else: += 1 #more code the thing need loop runs code , after run completed add value "1" i variable. the goal of code run whole code , after done want add value 1 2 , run loop again, untill maxuserid of 7255 reached. how can loop 1 till 7255? edit: import csv maxuserid = 7255 result_liked = [] in range(maxuserid): open('source/to/file/user_id%i.csv' %(i+1),'r') fin: row in csv.reader(fin, delimiter='\t'): if int(row[2]) >= 1: result_liked.append(row) training_data = r...