Posts

Showing posts from April, 2013

ios - Replace regex match with attributed string and text -

our app api returns field custom format user mentions like: "this text mention @(steve|user_id) " . before display on uitextview , need process text, find pattern , replace more user friendly. final result "this text mention @steve" @steve should have link attribute user_id . same functionality facebook. first i've created uitextview extension, match function regex pattern. extension uitextview { func processtext(pattern: string) { let instring = self.text let regex = try? nsregularexpression(pattern: pattern, options: []) let range = nsmakerange(0, instring.characters.count) let matches = (regex?.matchesinstring(instring, options: [], range: range))! [nstextcheckingresult] let attrstring = nsmutableattributedstring(string: instring, attributes:attrs) //iterate on regex matches match in matches { //properly print match range print(match.range) //a basic id

How to add external dependencies (jar file) to android studio? -

i trying add external libraries(httpmime-4.0-sources.jar) android project irked fact android-studio popping errors error: package org.apache.http.entity.mime not exist error: cannot find symbol class multipartentity error: cannot find symbol class httpmultipartmode i need help. as practice copied jar file lib folder , added library. error not go away. step wise copy jar file libs folder register module in build.gradle file, instructions given in steps 3 through 9 open file menu , click on project structure now in project structure dialog box select app under module now click on dependencies tab in project structure dialog click on + sign in right side corner select file dependency list select jar file libs folder click apply , ok finally click on sync gradle button one more thing, check proxy connection if using it.

android - send emoticons to my webservice -

i trying send emoticons webservice following error: java.lang.illegalargumentexception: illegal character (d83d) @ org.kxml2.io.kxmlserializer.reportinvalidcharacter(kxmlserializer.java:144) @ org.kxml2.io.kxmlserializer.writeescaped(kxmlserializer.java:130) @ org.kxml2.io.kxmlserializer.text(kxmlserializer.java:536) @ org.ksoap2.serialization.dm.writeinstance(dm.java:68) @ org.ksoap2.serialization.soapserializationenvelope.writeelement(soapserializationenvelope.java:656) @ org.ksoap2.serialization.soapserializationenvelope.writeproperty(soapserializationenvelope.java:649) @ org.ksoap2.serialization.soapserializationenvelope.writeobjectbody(soapserializationenvelope.java:595) @ org.ksoap2.serialization.soapserializationenvelope.writeobjectbody(soapserializationenvelope.java:573) @ org.ksoap2.serialization.soapserializationenvelope.writeelement(soapserializationenvelope.java:658) @ org.ksoap2.serialization.soapserializationenv

Xamarin Forms binding collection of strings c# -

i have bind collection of string listiview contains elements these strings, don't know how this: name.setbinding(label.textproperty, ??? ); i know in xaml can this <label text="{binding }"/> but what's equivalent in codebehind? need customcell because listitem has other elements viewmodel: private bindablecollection<string> _wifinetworks; public bindablecollection<string> wifinetworks { { return _wifinetworks; } set { if (value != _wifinetworks) { _wifinetworks = value; notifyofpropertychange(() => wifinetworks); } } } in view: var wifilist = new listview { rowheight = 50 }; wifilist.setbinding(listview.itemssourceproperty, new binding("wifinetworks")); wifilist.itemtemplate = new datatemplate(typeof(customcell)); customcell.cs: public customcell() {

objective c - NSOperation Queue executes only first operation and stop executing after that -

i trying execute custom operations in nsoperation queue, problem executes first operation in queue , not execute rest of them. please resolve issue. here code: for (contentmediamodel *uploadmedia in mediaarray) { amazonupload *customoperation = [[amazonupload alloc] initwithdata:uploadmedia]; [operationqueue addoperation:customoperation]; } here custom operation class: @implementation amazonupload -(amazonupload *)initwithdata:(contentmediamodel *)uploadmedia { if (self = [super init]) { self.uploadmedia=uploadmedia; executing = yes; finished = no; } return self; } -(void)start { nslog(@"** operation starts **"); [self main]; } -(void)main { if ([self iscancelled]) { nslog(@"** operation cancelled **"); } nslog(@"** operation executing **"); [[amazons3manager sharedinstance] uploadfile:self.uploadmedia.media.filename showloader:no]; } -(bool)isconcurrent { return yes; } -(bool)isexecuting { return e

database - Access a particular field in a structure within a Matlab structure -

this question has answer here: creating more complex data structure in matlab? 1 answer i need access structure inside structure: have main structure called globalstruc has many items (my "packets"). each packets contains many info, i.e. has many fields. 1 of structure several fields. need have access each of these fields. idea? to sum up: globalstruc.detailsstruc contains many fields , has many indexes. how can have access these? if more convinient, can create array these fields? characteristicofthepacket = globalstruc(index).detailsstruc.fieldthatiwant here example of how main structure built: ` globalstruc(1).data1 = 1; globalstruc(1).data2 = 12; globalstruc(1).moredata.velocity = 327; globalstruc(1).moredata.bbeta = 3.2; globalstruc(2).data1 = 23; globalstruc(2).data2 = 56; globalstruc(2).moredata.velocity = 442;

c# - Selenium WaitFor Ajax -

i want use solution : public static void waitforajax(this iwebdriver driver) { while (true) // handle timeout somewhere { var ajaxiscomplete = (bool)(drivermanager.driver ijavascriptexecutor).executescript("return jquery.active == 0"); if (ajaxiscomplete) break; thread.sleep(100); } } but error: an exception of type 'system.invalidoperationexception' occurred in webdriver.dll not handled in user code additional information: unknown error: jquery not defined thanks in advanced

javascript - Can't get access to the root directory phonegap -

currently working project have access music directory can found in root. trying directory phonegap/cordova plugin: https://github.com/apache/cordova-plugin-file i tried many things , did research on google couldn't find good.. here code: /* placed in ondeviceready function! */ window.requestfilesystem(window.temporary, 1024*1024, onfilesystemsuccess, function(e) { alert("something went wrong.."); }); alert( "5" ); /*************************************************/ function onfilesystemsuccess(filesystem) { alert("6"); // testing filesystem.root.getdirectory("music", {}, getdirsuccess, function(e) { alert("doesn't work"); } ); } function getdirsuccess(direntry) { alert("7"); var directoryreader = direntry.createreader(); directoryreader.readentries(readersuccess,fail); } hmm... might want try window.resolvelocalfilesystemurl() instead o

android - too much work for one thread(database performance) -

at moment develope android app receives data bluetooth , store these data in local database. therefore wrote class called datamanager manages local database (inserts, reads, deletes...). first checked needed time save local generated data. storing 10000 objects takes 100ms. if receive data bluetooth , store it, takes 1700ms. not fast enough because receive 10000 objects per second. i think it's because receive , store work 1 thread. call datamanager inside thread receives data bluetooth. now asking myself how speed storing while receiving data? i tried call store function of datamanager class in asynctask, more slow without asynctask. how can speedup storing operation during receiving? bounded service storing? can use multi cores? i happy recommendation

python - Shutil not copying all files -

i have folder files named this: sheyenne_19840517.dat sheyenne_19840517.hdr sheyenne_19840704.dat sheyenne_19840704.hdr sheyenne_19840906.dat sheyenne_19840906.hdr sheyenne_19850520.dat sheyenne_19850520.hdr sheyenne_19850621.dat sheyenne_19850621.hdr sheyenne_19860726.dat sheyenne_19860726.hdr sheyenne_19860827.dat sheyenne_19860827.hdr sheyenne_19870830.dat sheyenne_19870830.hdr sheyenne_19870915.dat sheyenne_19870915.hdr the numbers @ end of file names represent date. want seperate files month. files in may (or 05) own folder , on. trying use code right now: import os import shutil hank_out=r'f:\sheyenne\roi\all_sheyenne_julian\by_month\ndvi' pth=r'f:\sheyenne\roi\all_sheyenne_julian\ndvi' f in os.listdir(pth): month=os.path.basename(f)[-8:-6] if not os.path.isdir(os.path.join(hank_out,month)): os.mkdir(os.path.join(hank_out, month)) shutil.copy(f, os.path.join(hank_out, month)) this copies first file encountered month. each fol

apache - htaccess mod_rewrite - Trailing Slash and loop of redirects -

here htaccess code: rewriteengine on rewriterule ^s/(.*)/(.*) /index.php?search=$1&category=$2 [l,qsa] rewritecond %{query_string} ^search=([a-za-z0-9\+]+)$ rewriterule ^(.*)$ /s/%1/? [r=301,l] rewritecond %{query_string} ^search=([a-za-z0-9\+]+)&category=([a-za-z0-9\+]+)$ rewriterule ^(.*)$ /s/%1/%2/? [r=301,l] i need make rewrite rule this: http://mywebsite.com/s/query+term => http://mywebsite.com/?search=query+term or if there category http://mywebsite.com/s/query+term/category => http://mywebsite.com/?search=query+term&category=category i need redirect old urls new one. with rules can obtain have search term , category name joined togheter. in nutshell if had always: http://mywebsite.com/?search=query+term/category if remove conditions (rewritecond), leaving rewrite rule addition of trailing slash: rewriteengine on rewriterule ^s/(.*)/(.*)/ /index.php?search=$1&category=$2 [l,qsa] reaching url of interest in direct way, whole thing wor

python - Django - ManyToMany relation without the cross table -

i have 2 models: city , service. each city record can contain many services , each service can linked each city. class city(models.model): name = models.charfield(max_length=255, unique=true) class service(models.model): name = models.charfield(max_length=255, unique=true) class cityservice(models.model): city = models.foreignkey(city) service = models.manytomanyfield(service) i use manytomanyfield enable multiple selections in django admin. django creates 1 more table store m2m relations.. is possible configure django models reach following table structure: +----+---------------+------------+ | id | city_id | service_id | +----+---------------+------------+ | 1 | 1 | 1 | | 2 | 1 | 2 | | 3 | 2 | 3 | +----+---------------+------------+ why not use structure like: class service(models.model): name = models.charfield(max_length=255, unique=true) class city(models.model):

java - Is there some way to delay (or stream) clipboard operations in AWT / Swing? -

i have table million rows. if select rows , copy, takes approximately 5 minutes before responsiveness returns gui , before can paste application. less great, started looking improvements. if make alternative thread-safe tablemodel, can background operation of building string , push clipboard (on edt, if need be). gui responsive, still 5 minutes before can paste application, in ways worse experience, because @ least when blocked edt, able tell when operation finished. know add gui feedback it, seems wrong action copy. if @ same thing happening between native applications, notice can copy enormous amount of data 1 application no delay. can paste application no delay, caveat can take long time all information end in there. instance, if paste huge text textedit terminal, seems bit @ time somehow. is there way in awt well? i attempted declaring alternate flavours returning reader , inputstream , turns out if this, asks reader one, fetches reader , reads entire stream, storin

javascript - Get the numbers inside two spans and do a calculation? -

i using wordpress plugin outputs numbers span elements. values of these span elements , divide 1 other, display result somewhere on site. don't know javascript, , have tried samples online, can't them work. can please explain how can done? also note, these span elements doesn't have own id's, , because used in plugin, can't edit these directly, i'll need target them in order target each span individually: .container1 .tooltip span .container2 .tooltip span you can use parseint() if values don't have decimals: var = parseint($('.container1 .tooltip span').text(), 10); var b = parseint($('.container2 .tooltip span').text(), 10); console.log(a - b); use parsefloat().tofixed(2); if values have decimals: var = parsefloat($('.container1 .tooltip span').text()).tofixed(2); var b = parsefloat($('.container2 .tooltip span').text()).tofixed(2); console.log(a - b); prefixing + can change string number &quo

node.js - Use zscan on score -

according https://github.com/noderedis/node_redis/issues/896 i have zset , saving tokens(element) corresponding timestamp(score) now want delete tokens older particular timestamp using zscan. redis.zscan('my_key', cursor[i], 'match', '*', "count", count, function(err, console.log(err); console.log(reply); }); problem having zscan return values irrespective of timestamp. 'match' paramter checks pattern on elements(token). want tokens older particular timestamp(score). for example : var startingtime = new date().gettime(); redis.zrangebyscore("iflychat_auth_token", 0, startingtime - 43200000 * 2 * 7, function (error, data) { // return token older 7 days. }); is there way use 'match' on score redis.zscan('my_key', cursor[i], 'match', < timestamp, "count", count, function(err, console.log(err); console.log(reply); }); zscan doesn't ha

ios - Video Streaming in TableViewCell -

i designing table view consist of video streaming in it. first of all, think of application video streaming application. there video queries , users watch them. question i'm downloading videos in table view cell, therefore whenever user scrolls video, starts download. after going video , turning first 1 again, downloads first video again. not efficient both user , our backend. how can solve problem? maybe save part of videos in temporary memory. since developing application first time, feel free give advice. here table view cell code snippet. func explore() { var asset = avasset(url: tablevideourl) var playeritem = avplayeritem(asset: asset) var player = avplayer(playeritem: playeritem) var playerlayer = avplayerlayer(player: player) playerlayer.frame = newrect playerlayer.videogravity = avlayervideogravityresizeaspect contentview.layer.addsublayer(playerlayer) player.play() }

Android WebView with JavaScript enabled -

in webview in app cannot run javascript . tried many ways , searched many stackoverflow pages find answer. cannot show me simple alert message. here's code : webview webview = (webview) findviewbyid(r.id.wv_webviewac); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setjavascriptcanopenwindowsautomatically(true); webview.loadurl(url); eeverything fine in browser in webview doesn't work. this solve problem mwebview = (webview) findviewbyid(r.id.activity_main_webview); websettings websettings = mwebview.getsettings(); websettings.setjavascriptenabled(true); mwebview.loadurl("https://syllabkerala.in"); mwebview.setwebviewclient(new webviewclient() { @override public void onpagefinished(webview view, string url) { //hide loading image findviewbyid(r.id.progressbar1).setvisibility(view.gone);

delimiter - How to delimitate the given string to get output in an array in java? -

how delimit given string output of given string in array in java ? str= "[[["eee","wwww","fff","0","1","3"]]]" output: array[0]=eee array[1]=wwww array[2]=fff array[3]=0 array[4]=1 array[5]=3 i getting above input after json parsing in android studio. values "eee","wwww" stored in mysql database , want retrieve values replacing other. try use this: string[] arr =str.split("\\b(.*?)\\b"); (int = 1; i<arr.length-1;i++) { if(arr[i].endswith(",")) system.out.print(arr[i].subsequence(0, arr[i].length()-1)+ " "); else system.out.print(arr[i]+ " "); } output: eee wwww fff 0 1 3

python error for large number mod operator -

i have data looks : 353: 340122810048577428 354: 363117512048110005 355: 387632532919029223 356: 413766180933342362 357: 441622981929358437 358: 471314064268398780 359: 502957566506000020 360: 536679070310691121 361: 572612058898037559 362: 610898403751884101 363: 651688879997206959 i trying find index divisible 1 million. index = my_data[:,0] values = my_data[:,1] k = 0 in values: k += 1 if % 1000000 == 0 : print break print k-1 for code getting output : 5.02957566506e+17 359 but value @ index 359 502957566506000020 last 6 digits not 0 . mistake making here ? don't use index variables i in python. in 21st century. s = """353: 340122810048577428 354: 363117512048110005 355: 387632532919029223 356: 413766180933342362 357: 441622981929358437 358: 471314064268398780 359: 502957566506000020 360: 536679070310691121 361: 572612058898037559 362: 610898403751884101 363: 651688879997206959""" line in s.split(&qu

ios - Xcode Playground: new pages cannot refer to source files -

i excited view the video on wwdc2015 session 405 authoring rich playgrounds , in seem promise reuse piece of code in sources, among different pages. however, seems not happen automatically. mean, new page cannot aceess func defined in source swift file . what should access func defined in source file? thanks you need make function or class public .

asp.net mvc - EntityFramework concurrecy error at first record -

this object image [key] public int id { get; set; } //primary key public string path { get; set; } //not null public string name { get; set; } //not null public string url { get; set; } //allows null public string secureurl { get; set; } //allows null efdbimagerepository public void uploadtocloud(image image) { system.diagnostics.debug.writeline(image.id); if(image.id == 0) { context.images.add(image); } context.savechanges(); } in controller in uploadimage action ... image image = new image(); image.init(path, "defaultname1", "type"); imagerepository.uploadtocloud(image); ... at moment savechanges have en exception: system.data.entity.infrastructure.dbupdateconcurrencyexception in entityframework.dll also find message: entity of type image in state added not updated as know concurrecy error occures when 2 users try modify 1 data @ same time. in mvc project user load file @ form. form sends post req

unit testing - Python unittest failure when results appear equal -

i'm running series of unit tests on rpn calculator i've put together. calculator can mix integers, floats, , picas. need able calculate using picas typesetting work i'm doing. for reason, 1 of unit tests failing: failure traceback (most recent call last): file "/users/andrew/developer/pyrpn/test_rpn.py", line 112, in test_pica_subtracted_from_pica self.assertequal(self.calc.rpn(['10p3', '2p1', '-']), ['8p2']) assertionerror: lists differ: ['8p2'] != ['8p2'] first differing element 0: '8p2' 8p2 ['8p2'] i can't see why. simplify took list out of equation , compared directly string: failure expected :'8p2' actual :'8p2' <click see difference> traceback (most recent call last): file "/users/andrew/developer/pyrpn/test_rpn.py", line 112, in test_pica_subtracted_from_pica self.assertequal(self.calc.rpn(['10p3', '2p1', '-

How to run Clean and Rerun in Android Studio from keyboard shortcut -

Image
im trying run clean , rerun feature in android studio cmd + control + r nothing happens. who can test shortcut? i used first option on menu, activated option use same device , shortcut worked. not sure why not working expected.

sql - How to pass value in xmltable -

how can pass variable value inside xpath of xmltable? declare v number := 0; begin select * xml_billrun_files t , xmltable('/invoice/ar_items[@elem='||v||']/items/usage_records/session_info' passing t.update_xmldoc columns chrg_duration varchar2(20) path 'duration', amount number path 'amount') x; end; i've tried one. declare v number := 0; begin select * xml_billrun_files t , xmltable('/invoice/ar_items[@elem=$i]/items/usage_records/session_info' passing t.update_xmldoc, xmltype(v) "i" columns chrg_duration varchar2(20) path 'duration', amount number path 'amount') x; end; but returns error: ora-31011: xml parsing failed ora-19202: error occurred in xml processing lpx-00210: expected '<' instead of '0' error @ line 1 ora-06512: @ "sys.xmltype", line 3

office365api - Can we access MS Graph API's, using same credentials as the paid version of Office365? -

we have paid version of office365, can able access ms graph api's, using same credentials or need seperate account? yes, can access ms graph using same credentials you're using access office 365. have @ page started on platform of choice: http://dev.office.com/getting-started/office365apis .

centos - How does yum determine what package is newer with multiple repositories enabled? -

i trying understand how yum able determine particular package newer when system has multiple repositories enabled , particular package may available in 1 or of repos. we trying create custom package management system in order manage our local repos , report if there new updates available on servers vs available on local repos. yum looks "newest" version and release given package name. checks version first, , release. if give multiple repositories have same package name, yum use "newest" version (and release). a comment @msuchy mentions rpmdev-vercmp may find useful analysis of rpm files. further reading: packaging:namingguidelines what's meaning of number appears (when use yum install fedora package) before colon @ beginning of name of package? how programmatically determine highest version kernel rpm installed? comparing rpm versions in shell

Ruby on rails one to many association -

i new rails. have 1 many association. table1 few fields. 1 field title location, 1 title ccode. table2 how ever has 2 fields, first field location, , 2nd ccode. table hold location. in table1 when create object assign ccode , want corresponding location ccode table2. table2 has_many table1 , table1 belongs_to table2. want display location in index view in <table> tag. think view code looks example had found , understand html enough. problem getting table2 object returns nil. here model table1 looks like. class table1 < activerecord::base belongs_to :table_2 require 'csv' def self.import(file) csv.foreach(file.path, headers: true, row_sep: :auto, col_sep: "\t") |row| table1.create! row.to_hash end end end here model table2 looks like. class table2 < activerecord::base self.table_name = 'table_2' self.primary_key = 'ccode' has_many :table1 end here table1controller looks

azure virtual machine size capabilities -

i quite novice on azure , bit stuck trying understand virtual machine size , features. i have deployed "hortonworks sandbox hdp 2.4" virtual machine template on ds3_v2 machine, seems have following features: 4cores, 14gb ram, 8 data disks , 28gb ssds pretty decent run proof of concept, have doubts. not sure total disk size available on machine if 200gb or 100gb, size include os vhd? understand cant attach till 8 data disk storage account sum either 100gb or 200gb. ds3_v2 machine includes azure premium storage think referes 28gb ssds, guess have 2 ssd data disks of 14 gb each? i appreciate insight these doubts. thank much. your os disk different one, 28 gb ssd local disk , temporary disk(think of d:\ os in c:) , data present on not guaranteed during hardware failures. data on 8 disks can attach persisted , can choose (grs or ra-grs geo redundant storage) , each of these disks can upto 1 tb (around 1023 gb) means can attach total of around 8 tb storage dat

d3.js - Show specifig D3 data in ng-repeat, AngularJS and directives -

Image
i followed example d3integration , way use proper d3 custom visualization inside angular me in openmuc framework. i have several devices id. managed data separated bars, updated independetly. surely want show 1 bar specific device, controller holds complete data. is possible show specific bar (either through index, or filter)? ng-model worked index :x. setting index on data="d3data[deviceindex]" throws error. interestingly, bar of deviceindex disappeared, (due error), other worked fine. this: <div class="row"> <div class="col-md-6 col-md-offset-3" ng-controller="democtrl"> <span>{{title}}</span> <d3-bars data="d3data" label="name" on-click="d3onclick(item)"></d3-bars> <br><input type="text" ng-model="d3data[deviceindex].value"></input> </div> </div

angularjs ng-options dictionary filter not empty -

Image
<select ng-model="new_key" ng-change="evaluate($parent.$index, k, new_key)" ng-options="key key+'('+value+')' (key, value) in vars"> vars has 3 keys. 1 value undefined. how create select valid values? you can try add below filter in controller $scope.removenull = function(itm) { if(itm.value)return itm; else return; }; and add filter in ng-options ng-options="key key+'('+value+')' (key, value) in vars | filter : removenull" remove null hope you.

Application slows down over time - Java + Python -

Image
this difficult 1 explain, , not hopeful single, simple answer, thought it's worth shot. interested in might slow down long python job interacts java application. we have instance of tomcat running complex , robust webapp called fedora commons (not confused fedora os), software storing digital objects. additionally, have python middleware performs long background jobs celery . 1 particular job ingesting 400+ page book, each page of book has large tiff file, smaller pdf, xml, , metadata files. on course of 10-15 minutes, derivatives created these files , added single object in fedora. our problem: on course of ingesting 1 book, adding files digital object in java app fedora commons slows down consistently , predictably, can't figure out how or why. i thought graph of ingest speeds might help, perhaps belies common memory management pattern more experienced java might recognize: the top-left graph timing large tiffs, being converted jp2, ingested fedora commons

stdin - reading from different files without keeping old content perl -

so have function open file read from, analyse lines , write in new file. call funktion several times different files. noticed, every new function call, lines of previous files read in too. how can prevent that? content of es.txt: el anarquismo es una filosofía política y social que llama content of dt.txt: der regel mit veränderungen der chemischen bindungen in after program run, created file profilede looks (although should contain tokens "dt.txt", tokens "es.txt"): una ilos ism lític qui lí ti polí socia -- actual code: #! /usr/bin/perl use utf8; use warnings; use strict; use list::util qw(min); use open ':encoding(utf8)'; binmode(stdout, ":utf8"); binmode(stdin, ":utf8"); generateprofile("es.txt", "es"); #function call read file es.txt generateprofile("dt.txt", "de"); #second call read file dt.txt sub generateprofile { $file= $_[0]; #takin

python - Flask App outputting Excel file -

here's have... application outputting excel file, don't know how output excel file has data in it. right it's outputting excel file contains "test" in cell a1, , know that's because of line says strio.write('test') . how can make sure file outputs download user contains of information file processed? thanks. from openpyxl import load_workbook flask import flask, request, render_template, redirect, url_for, send_file import stringio app = flask(__name__) @app.route('/') def index(): return """<title>upload new file</title> <h1>upload new file</h1> <form action="/uploader" method=post enctype=multipart/form-data> <p><input type=file name=file> <input type=submit value=upload> </form>""" @app.route('/uploader', methods = ['get', 'post']) def upload(): if request.method == 'post

laravel 5.2 - which URL pattern is better, action/id or id/action -

i know of these 2 patterns better: /photos/123/edit or /photos/edit/123 currently using first, gives me whoops, looks went wrong. when try /photos/123/editxx instead of 404 not found . routes: i unsure mistake, these photos routes: route::get('photos/randpics','photoscontroller@randpics'); route::get('photos/{id}/edit','photoscontroller@getedit')->middleware(['auth']); route::post('photos/{id}/edit','photoscontroller@postedit')->middleware(['auth']); route::post('photos/{id}/retag', ['as' => 'photos.retag', 'uses' => 'photoscontroller@retag'])->middleware(['auth']); route::post('photos/{id}/delete','photoscontroller@delete')->middleware(['auth']); route::get('photos/{id}/albums', 'photoscontroller@getalbums')->middleware(['auth']); route::post('photos/{id}/albums', 'photoscon

excel - In VBA, how can I send an email with signature and image without the direct path? -

i looking send email containing range of excel document sender's default signature (which contains image). using seems go method, shown below. originally, not email appear without changing .htm file's image src link directly relevant image. worked well, issue need solution doesn't require direct path. @ work, our computers update signature folder on startup , overwrites changes make it. have make program adaptable work computer, can't change each img src path. grateful if knew of method allow access full signature without direct path, or other workaround. thank you. the .htm file represents signature , references image within it's source. kind of looks <img border=0 width=240 height=148 src="mycompany%20signature_files/image001.png" v:shapes="picture_x0020_1"></span><![endif]></span></a><span style='font-size:8.0pt;mso-bidi-font-size:11.0pt;font-family:"arial",sans-serif; color:#a1a0a4'>

html - Insert Space in between a CamelCase String -

i have insert space in between string(camelcase) in view page. in view <span>@model.data</span> the model.date has value equal uploaddatatoserver expected o/p upload data server in advance using: ([a-z]) and replacing $1 (note space before $ ) job. see live demo

R dplyr - Add Column Based on Results in Other Rows -

i have list of item numbers , inventory locations. items can appear in 2 types of inventory locations - warehouse or par locations. add column data indicate if particular item number ever associated warehouse location. sample data below: item_num <- c("item - 1", "item - 2", "item - 3", "item - 1", "item - 3", "item - 2") locs <- c("warehouse", "par", "par", "par", "warehouse", "par") fake_data <- tibble(item_num, locs) fake_data # tibble: 6 x 2 item_num locs <chr> <chr> 1 item - 1 warehouse 2 item - 2 par 3 item - 3 par 4 item - 1 par 5 item - 3 warehouse 6 item - 2 par i add column true item - 1 , item - 3 since there warehouse location both of in data. item - 2 false. this: item_num locs wh_exists 1 item - 1 warehouse true 2 item - 2 par false 3 item - 3

javascript - Equivalent of window.locaton and window.pathname in NodeJS -

what equivalent window.location.protocol , window.location.host in nodejs/expressjs? i'm trying redirect url site using third party api. the nodejs api url.format(urlobject) method returns formatted url string derived urlobject . var url = require('url'); function getformattedurl(req) { return url.format({ protocol: req.protocol, host: req.get('host') }); } res.redirect(getformattedurl(req));

python - MayaVi ValueError, how to run with wx backend? -

at point, i'm trying started using mayavi, can not run within python shell/scripts. mayavi gui does work, however. i'm trying run of examples found online (e.g. [1] ), when attempt run them, seemingly ubiquitous error (e.g. [2] , [3] ) of: value error: cannot set toolkit wx because has been set qt4 the solutions above referenced threads seem be: discard wx , use qt4. however, i'm interested in embedding visualizations wxpython application, , use wx! i have tried adding: import matplotlib matplotlib.use('wxagg') to beginning of example script, not solve issue. i running: windows 7, 64 bit enthought canopy python 2.7.6 (64 bit) wxpython 3.0.2.0 mayavi 4.4.3 matplotlib 1.5.1 unsure else (if anything) may relevant. is there solution can run mayavi wx? sometimes, it's obvious solution. suggested in referenced solutions, rather setting ets_toolkit = "qt4", need set "wx". within script (at start) with: i

symfony - User Object in a one-to-one relationship using primary key shared with foreign key -

iterations of question have been asked in past, presents unique challenges combines of issues in 1 larger problem. i have entity(user) used user class in application, have entity (userextra), in one-to-one relationship user entity, userextra's id same user. foreign key same primary key. when user object loaded (say $this->getuser() or {{ app.user }} , userextra data loaded through join. whole point of having 2 entities don't have load data @ once. i tried defining custom userloaderinterface/userproviderinterface repository user, making sure refreshuser , loaduserbyusername load user data (i'd userextra data sit in proxy unless explicitly need it) when doctrine goes hydrate object, issues query load userextra data, thereby skipping proxy status. is there way out of this? there many solution issue: 1) change owning side , inverse side http://developer.happyr.com/choose-owning-side-in-onetoone-relation - don't think that's right db design pe

Excel VBA - Referencing HTML <div> Attributes -

i've been struggling days write code output value of 'data-full-name' webpages source code (link screenshot below). i know can access value of 'class' instnace using objcollection(i).classname, how access other div attributes? thank you! webpage source code screenshot private sub extract_info() dim long dim ie object dim objelement object dim objcollection object ' create internetexplorer object set ie = createobject("internetexplorer.application") ie.visible = false ie.navigate "http://mywebpage.com.au/" ' wait while ie loading... while ie.busy application.wait dateadd("s", 1, now) loop 'begin extraction set objcollection = ie.document.getelementsbytagname("div") = 0 while < objcollection.length if objcollection(i).classname = "listing listing-search listing-data" 'not sure how code here: e.g. msgbox (objcollection(i).data-full-name) end if = + 1 wend

cloudfoundry - How do I add items to the Bluemix catalog for my space? -

i've been able add service broker space using: cf create-service-broker "service" "<user>" "<password>" "http://<domain>/api" --space-scoped i can use service @ command line with: cf create-service service free service but in bluemix ui, doesn't appear in catalog. how can appear in catalog in ui other users of space see? services advertised space-scoped private broker show in catalog, depending on "catalog" meant. once broker has been registered service can seen in view of marketplace ( cf marketplace ). after service has been provisioned (your cf create-service ) service can seen in bluemix dashboard. i created tutorial explaining steps both space-scoped , standard private brokers: https://github.com/data-henrik/bluemix-servicebroker

stored procedures - How to use COLLATE in MySQL prepared statement -

i need specify collate in connection inside prepared statement inside stored procedure, e.g. <col> ? collate utf8_unicode_ci . i'm getting following error: collation 'utf8_unicode_ci' not valid character set 'binary' i have tried cast parameter of: like _utf8 ? collate utf8_unicode_ci , like convert(? utf8) collate utf8_unicode_ci , like cast(? varchar character set utf8) collate utf8_unicode_ci error like: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'varchar character set utf8) collate utf8_unicode_ci ... any hint appreciated. afaik, _utf8 part of syntax string literals . since don't have, cannot use it. the signature cast() this: cast(expr type) i think you want convert() : convert(expr,type), convert(expr using transcoding_name) [...] convert() using converts data between different character sets. in mysql, transcoding names same corresponding

javascript - How can I forbit editing webix select fields using view: "combo"? -

this piece of js file how can forbit editing webix select fields using view: "combo"? using view: "select" not option. rows: [ { borderless: true, css: "font_bold", height: 35, template: displaycontent }, { view: "combo", id: "myid", tooltip: somevalue, value: someid, options: contactlistoptions, on: { ------ } a similar issue mentioned @ their forum i've tested bit - seems still works same way, following workaround relevant: /* if readonly set true */ suggest:{ on:{ onbeforeshow:function(){ var parent = $$(this.config.master); if (parent.config.readonly) return false; }

javascript - How to make many Node.js requests (using request module) -

main purpose: i'm trying scrape data off of around 10,000 different pages using node.js. problem: scrapes through first 500~1000 fast , turns turtle (its variable slows down) beyond that, , seems stuck forever. i'm using request module in node.js make requests use cheerio start scraping, this code replicates problem: var request = require('request'); var requestscalledcounter = 0; var requestscompletedcounter = 0; var max_requests = 500; var start = function () { while (requestscalledcounter < max_requests) { request("http://www.google.com", function (error, response, html) { requestscompletedcounter++; }); requestscalledcounter++; } }; start(); output: test 1: 447/500 89.4% timed out: no requests completed after 5 seconds 447 completed test 2: 427/500 85.39999999999999% timed out: no requests completed after 5 seconds 427 extra details might help:

android - webview inputfield is getting hidden when softinput keyboard is on -

Image
i searched online , tried, android:windowsoftinputmode="adjustresize|statehidden" android:windowsoftinputmode="adjustresize" android:windowsoftinputmode="adjustpan" and don't have full window theme, still softinput keyboard covers half of textfield. here code, content.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="0dp" android:paddingleft="0dp" android:paddingright="0dp" android:paddingtop="0dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.quads.quanta.quanta" to

authentication - Cross-app session persistence (thoughtbot/clearance) with Rails -

i have web app installed in example.com uses clearance authentication gem , working on stand-alone rails app in jobs.example.com. i wondering if clearance has built in configurations user session persistence across rails apps hosted on different subdomains. need import user authentication details original app (example.com) via api , manipulate cookies so? any help/advice appreciated! you accomplish clearance via use of cookie_domain configration (see documentation) , synchronizing user data required each system, assuredly going real big pain. if apps must separate separate databases may want investigate making main app oauth provider , have jobs oauth consumer. auth live in main app , when jobs app needs authentication delegate main app. assuming auth checks out, main app pass information user.

mysql - Throttling Mule Messages in Mule -

i've polling process in mule queries mysql database every 30 seconds , sends email recipient. how limit sending 1 email regardless of polling cycle whether 30 seconds or 15 seconds? i'm open counter in mysql db if that's option. thank you. write condition send email if emailsentflag == false. use choice router create condition, , objectstore hold emailsentflag value. <flow...> .... <objectstore:retrieve config-ref="objectstore__configuration" key="emailsentflag" defaultvalue-ref="#[false]" targetproperty="flowvars.emailsentflag" doc:name="retrieve emailsentflag"/> <choice doc:name="isemailsent?"> <when expression="#[flowvars.emailsentflag == true]"> <logger level="info" doc:name="log email sent"/> </when> <otherwise> <smtp:outbound-

forms - Truncated data in Access 2010 Memo Fields -

let me start out saying not access person, struggle coding please patient if don't grasp i have created database healthcare organization. purpose of database liaisons record visits other physicians; created forms make easier liaisons. 1 of fields have in form notes section, changed data type of field memo allow them type in more 255 character limit. the liaisons have entered data memo field , data truncated in table itself. there anyway me fix of entered data shows in table , in reports run? thank you

Preventing console window from closing on Visual Studio C/C++ Console application -

this embarasing question no doubt answer blindingly obvious. i've used visual studio years, first time i've done 'console application' development. when run application console window pops up, program output appears , window closes application exits. is there way either keep open until have checked output, or view results after window has closed? if run without debugging (ctrl+f5) default prompts press return close window. if want use debugger, should put breakpoint on last line.

BASH - Splitting string at special occurence of character (underscore), depending on total number of underscores in string -

i have data frame several columns , lines 1 column contains different strings, each string being composed of different number of underscores. want split each string in half, depending on number of occurrences. example: id_1 id_2 haplotypeid ... a_b_a_b a_b_a_b hap.1.1 ... a_b_c_a_b_c a_b_c_a_b_c hap.1.2 ... a_b_c_d_a_b_c_d a_b_c_d_a_b_c_d hap.2.1 ... a_b_c_d_e_a_b_c_d_e a_b_c_d_e_a_b_c_d_e hap.2.1 ... ... ... ... ... the output be: id_1 id_2 haplotypeid ... a_b a_b hap.1.1 ... a_b_c a_b_c hap.1.2 ... a_b_c_d a_b_c_d hap.2.1 ... a_b_c_d_e a_b_c_d_e hap.2.1 ... ... ... ... ... i hope c