Posts

Showing posts from August, 2013

d - Execute compile time-compiled regex at compile time -

i compile error when try compile code: import std.regex; enum truth = "baba".matchfirst(ctregex!`[ab]+$`) ? true : false; void main() {} /usr/local/cellar/dmd/2.067.1/include/d2/std/regex/package.d(671): error: malloc cannot interpreted @ compile time, because has no available source code how around this? you can't, regex can compiled @ compile time, not run. you'll have write match other way, maybe combination of indexof or other simpler functions. (the reason isn't because regex complicated, because internally calls malloc efficiency, not supported @ compile time since external c function.) understanding ctregex needs explanation phobos' regular expression engine. works in 2 steps: given regular expression, first compiles bytecode, match on string, runs code. in ordinary regex , both steps happen @ runtime. when construct regex object, compiles bytecode. then, when match on string, runs code. with ctregex , first part happens @ com...

javascript - React - superagent request per mapped item -

i fire off superagent request each item mapped in search results. check if item id in array: i have these methods; 1 map results, , other superagent fetch: renderresultnodes: function () { if(!this.props.results) return; return this.props.results.map(function (result) { // fire off request here? // show tick icon if id exists var showicon = this.isschool(school.id) ? <i classname="icon item-icon-right ion-checkmark-circled"></i> : ''; return ( <a classname="item item-icon-right" key={result.id} href="#" data-school-id={result.id} data-school-name={result.school_name} onclick={this.selectschool} > <h2>{result.school_name}</h2> <p>{result.s_address1}</p> {showicon} </a> ); }.bind(this)); }, // check id exi...

How to match exact value using match function in excel? -

Image
i have cell value 0.00% in row , have 0 in before 0.00% in same row . when try match =match(0.00%,$b22:$eu22,0) . return 0 value position not 0.00% position. 1 suggest me . before match, need convert values in range $b22:$eu22 text first. then, either use following =match("0.00%",$b22:$eu22,0) =match("0.00",$b22:$eu22,0) =match("0",$b22:$eu22,0) or =match(text(b20,"0.00%"),$b26:$eu26,0) =match(text(c20,"0.00"),$b26:$eu26,0) =match(text(d20,"0"),$b26:$eu26,0) to find match position. cells b20, c20, , d20 blank or zero.

How to set focus on controls inside TabPage in DevExpress MVC tabpage? -

i using devexpress mvc application.in using 3 tabpages.the content of tab pages in different partial views.my question how set focus on controls in each tab page when tab page clicked? you can try html.renderaction. example: @html.devexpress().pagecontrol( settings => { settings.name = "mytabs"; settings.callbackroutevalues = new { controller = "tabs", action = "callbacktabs" }; settings.tabpages.add("tab1").setcontent(() => { viewcontext.writer.write("<div class='tab1content'>"); html.renderaction("gettab1", "tabs"); viewcontext.writer.write("</div>"); }); settings.tabpages.add("tab2").setcontent(() => { viewcontext.writer.write("<div class='tab1content'>"); html.renderaction("gettab2", "tabs"); viewcontext.writer.write("...

android - Configuration with name 'default' not found when Importing from Git -

i'm working in project first began in eclipse. migrated in android studio. i work in mac, , ok. then, when try download git rep in pc, message: configuration name 'default' not found here project organization: sp-mobile progresswheel ( lib project ) spmobile ( main project ) build.gradle (1) build.gradle (top) settings.gradle (top) build.gradle (1) apply plugin: 'com.android.application' android { compilesdkversion 'google inc.:google apis:21' buildtoolsversion "21.1.2" lintoptions { abortonerror false } defaultconfig { applicationid "com.spmkt.mobile" minsdkversion 16 targetsdkversion 22 } buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } packagingoptions { exclude 'meta-inf/dependencies.txt' exclude 'meta-inf/license.txt' exclude 'meta-inf/n...

File not found 404 Error should be thrown using AngularJS when the user enter the invalid webpage url after login into the webpage -

i trying throw 404 error when user enter invalid url after permitting user webpage. example home login page , allowing user login page as( home/ )and can throw 404 error. after login page user enter url called (/employee) , struggling in throwing 404 error when user enter (/employee/invalid url). can guide me how , code here: app.run(function ($rootscope, $window, $location, sessionservice, $cookies, $cookiestore) { $rootscope.$on("$routechangestart", function (event, nextroute, currentroute) { var currentpath = $location.path(); currentpath = currentpath.split('/'); if (currentpath[1] === "") { $location.path("/home"); } else if (currentpath[1] === "employee") { if ((nextroute.access && nextroute.access.requiredlogin) && !$window.sessionstorage.boid) { $location.path("/employee"); } } else if (currentpath[1] === "department") { ...

How to pass variable filename to python ete? -

i trying load newick string file using following code: filename = templist[1].lower().replace(" ","") + ".nwk" tt = tree(filename, format=1) but getting following error: tt = tree(filename, format=1) # loads tree structure newick string. returned variable tt root node tree. file "/python2.7/dist-packages/ete2-2.2.1072-py2.7.egg/ete2/coretype/tree.py", line 225, in __init__ read_newick(newick, root_node = self, format=format) file "/python2.7/dist-packages/ete2-2.2.1072-py2.7.egg/ete2/parser/newick.py", line 237, in read_newick 'unexisting tree file or malformed newick tree structure.' ete2.parser.newick.newickerror: unexisting tree file or malformed newick tree structure. i have verified file format, , ok. think passing variable in wrong way, can please guide me pass filename variable. when pass filename string without using variable working fine, need use variable value load tree. are sure ...

How do I convert to list of lists after reading from file in python -

this question has answer here: how can convert string list of lists? [duplicate] 6 answers i append-writing lists text file through iterations using writelines(str(list)). short, use 2 lists illustrate: list1=['[#1]:', (4, 8, 16, 29), (4, 8, 16, 30), (4, 8, 16, 32)] list2=['[#2]:', (3, 9, 13, 20), (3, 9, 13, 36), (3, 9, 13, 38)] and in text file, have pile of separate lists: ['[#1]:', (4, 8, 16, 29), (4, 8, 16, 30), (4, 8, 16, 32)] ['[#2]:', (3, 9, 13, 20), (3, 9, 13, 36), (3, 9, 13, 38)] when read text file list using readlines(file.txt), single list of string: ["['[#1]:', (4, 8, 16, 29), (4, 8, 16, 30), (4, 8, 16, 32)], ['[#2]:', (3, 9, 13, 20), (3, 9, 13, 36), (3, 9, 13, 38)]"] this expected. want remove ' " ' (quotation marks) @ beginning , end of list can iterate through li...

javascript - Real time data graphing on a line chart with the help of rickshaw and d3.js -

i want make real time dynamic graph on line chart of rickshaw , d3.js, gives fresh data without refreshing whole page. in following example build graph on random data. in problem data not fresh refreshing of browser fresh data please see link . ajax request using reference here please see it i copied whole code below. want make graph movable, real time update flot , don't want use flot, rickshaw. <!doctype> <head> <title>rickshaw greaph examples</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link type="text/css" rel="stylesheet" href="../src/css/graph.css"> <link type="text/css" rel="stylesheet" href="../src/css/legend.css"> <link type="text/css" rel="stylesheet" href="../src/css/detail.css"> <link type="text/css" rel="stylesh...

python - While loops in Procedures -

i trying output 1 30 days isn't working , says code didn't display output here code: def nextday(year, month, day): day = 0 while (day < 30): day = day + 1 print day this having me do. stuck on day portion. sorry noticed put month instead of day fixed it, trying @ end. define simple nextday procedure, assumes every month has 30 days. for example: nextday(1999, 12, 30) => (2000, 1, 1) nextday(2013, 1, 30) => (2013, 2, 1) nextday(2012, 12, 30) => (2013, 1, 1) (even though december has 31 days) def nextday(year, month, day): """ returns year, month, day of next day. simple version: assume every month has 30 days. """ # code here return well if you're trying output 1 through 30 work... for x in range(1, 31): print 'day: %d' % x i literally don't function @ all, makes no sense. in addition, don't why use while loop slowe...

javascript - Catch onclick adsense event ? -

i wan't send ajax request if user clicked on adsense . because adsense code in iframe can't find way catch onclick event .. ideas plz ??! the simple answer you can't . since adsense on domain, access inside of iframe cut off. cross-domain security feature built modern browsers. may able catch click event on iframe (haven't tried before), it's not going tell inside of iframe.

uiimagepickercontroller - Getting a crash due to NSXPCDecoder didHideZoomSlider on iOS 8 after taking a picture -

any idea crash about?in ios app using imagepickercontroller launch camera.after take few images crashes saying this:- [nsxpcdecoder didhidezoomslider:]: unrecognized selector sent instance here code using uiimagepickercontroller *imagepickercontroller = [[uiimagepickercontroller alloc] init]; #if target_iphone_simulator imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypephotolibrary; #else imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypecamera; #endif imagepickercontroller.editing = yes; imagepickercontroller.delegate = (id)self; [self presentviewcontroller:imagepickercontroller animated:yes completion:nil];

model - How to join 3 tables using laravel eloquent -

how can apply query in laravel 5? have 3 table, post, profile, comments post{id,title,body,user_id} profile{user_id,last_name,first_name} comments{comments,user_id,post_id} i want kind of structure: post_id title post last_name first_name and below comments comments last_name fist_name //post model public function comments(){ return $this->hasmany('app\comments', 'post_id', 'id'); } //comments model public function user(){ return $this->belongsto('app\profile', 'user_id'); } //profile model public function comments(){ return $this->hasmany('app\comments'); } and call in controller using: $posts = posts::with('userprofile','comments', 'comments.user')->get(); then works:) thank , idea :)

html - can't resize containers with youtube and responsive -

http://m.mits.remax.ca/ above link, there's huge gap between youtube , header. tried looking everywhere , still couldn't find went wrong. at first, used regular youtube iframe , centered video found out it's not responsive way found online css , added worked fine tried making video 75% instead of 100% 75% gap happened. can give me hand please? the css found , used is .video-container { position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0; } .video-container iframe, .video-container object, .video-container embed { position: absolute; top: 0; left: 12.5%; width: 75%!important; height: 75%!important; } height: 75%; in video causing huge gap between video , header. can adjust that, e.g: 100% . if want adjust height, don't set video height 75% set padding-bottom on .video-container . edit i tried this: .video-container { padding...

algorithm - Recursion to get maximum difference in array -

return pair of numbers p , q in array. p must appear before q in array, , q-p must highest possible value a=[1,4,12,5,9,1,3,8] the return values p=1 & q=12 someone suggested below solution. not sure should return in 'third case' suggested below: suggestion: divide evenly 2 smaller arrays a1,a2, , solve problem (recursively) on a1 , a2. can find optimum on a? don't forget you're allowed use processing costing o(n).suppose p,q optimal pair a. either p,q∈a1, or p,q∈a2, or neither of these cases true. can in third case p , q? below code divides array , minimum first half , maximum second half. there 0(n) solution interested in recursive 1 learning recursion. please don't suggest other solution. #define min_f(a, b) (a)>(b)?(b):(a) #define max_f(a, b) (a)>(b)?(a):(b) #define max 1 << 30 #define min -1 int get_min(int *a, int start, int end) { int t_min = max; while(start <= end) { ...

html - Layout viewport with fixed height using divs tags -

i try create layout "viewport" fixed heigh top, fixed height footer, , middle part remaining height. need using div tags. here's happened html: <div class="table-cui-a2c"> <div class="row-cui-a2c" style="height: 50px;"> <div class="cell-cui-a2c"> </div> </div> <div class="row-cui-a2c" > <div class="cell-cui-a2c" > <div class="block" ></div> </div> </div> <div class="row-cui-a2c" style="height: 50px;"> <div class="cell-cui-a2c"> </div> </div> css: html {display:block; position:static; width:100%; height:100%; margin:0px; padding:0px; border:none; overflow:hidden;} body {font-family:helvetica, "open sans", "helvetica neue", helvetica, arial, sans-serif; font-size:14px; width:100%; height:100%; font-weight:300; padding:0px;...

html - CSS * selector but exclude a particular tag -

background so found line of code in our ext js's css removes focus every element in webkit. unfortunately has been 2 years , still haven't addressed todo. // todo: remove outline individual components need instead of resetting globally .#{$prefix}webkit { * { &:focus { outline:none !important; } } } which compiles .x-webkit *:focus { outline: none !important; } what take away browsers default focus (ua styles) on links when user tabs anchor tag have no ui indication on tag. want use native browser behavior don't want override a:focus in particular , using initial doesn't work. removing entire style causes ui components handle focus ui differently not acceptable. tldr what best approach applying style tags except tag(s). know can make selector has of tags except tag don't want tedious, best approach ? if there list of valid ui tags html ? you use css :not selector, , apply style descend...

Android screen flash when removeView -

i have activity , several fragments. 1 fragment, want disable screenshot function. in oncreate function, set flags window, found doesn't work. maybe system needs reload window. try remove current window , add back. work, find screen black 1 second. how can solve screen flash problem? oncreate fragment. can't set flag in activity since disable screenshot fragments. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (build.version.sdk_int >= build.version_codes.honeycomb) { getactivity().getwindow().setflags(layoutparams.flag_secure, layoutparams.flag_secure); window window = getactivity().getwindow(); windowmanager wm = getactivity().getwindowmanager(); wm.removeviewimmediate(window.getdecorview()); wm.addview(window.getdecorview(), window.getattributes()); } } i believe correct need set flag before setcontentview(...) on activity, otherwise 1 thing can try using getactiv...

osx - How to set screensaver thumbnail in Settings panel on Mac? -

Image
i'm making custom *.saver application, , add own thumbnail show above name of screensaver (the ladybug pictures in left column). how do that? by examining default screensavers, figured out need add 2 files: thumbnail.png, 58x90px thumbnail@2x.png, 116x180px when compiled xcode, automatically included in .saver resources folder "thumbnail.tiff" 2 subfiles.

python - How do I access the contents and names of files being committed from within a Git hook script? -

i'm bit confused how implement git hooks correctly, , cannot figure out how access type of information need within script. have little experience scripting/using python. i want access filenames of files (and later contents of file) committed in pre-commit hook, can check if match naming convention. i've seen posts such 1 git server hook: contents of files being pushed? , poster mentions how got list of files calling git diff --cached --name-status --diff-filter=am . i'm sorry if stupid question, how call line within script , set equal something? recognize line git command i'm confused how translates coding it. in python? here's have template pre-commit. test print , in python. #!/usr/bin/env python import sys print("\nerror details\n") git diff-index --name-status head | grep '^[ma]' that's reliable way know. prints out names m or prefix, followed whitespace, followed name, indicate whether or not file "modified...

sql - In PostgreSQL how can I return the entire row that corresponds with the min of a value? -

so if have table this id | value | detail ------------------- 12 | 20 | orange 12 | 30 | orange 13 | 16 | purple 14 | 50 | red 12 | 60 | blue how can return this? 12 | 20 | orange 13 | 16 | purple 14 | 50 | red if group id , detail returns both 12 | 20 | orange , 12 | 60 | blue sql fiddle postgresql 9.3 schema setup : create table test( id int, value int, detail varchar ); insert test values ( 12, 20, 'orange' ); insert test values ( 12, 30, 'orange' ); insert test values ( 13, 16, 'purple' ); insert test values ( 14, 50, 'red' ); insert test values ( 12, 60, 'blue' ); query 1 : not sure if redshift supports syntax: select distinct first_value( id ) on wnd id, first_value( value ) on wnd value, first_value( detail ) on wnd detail test window wnd ( partition id order value ) results : | id | value | detail | |----|-------|--------| | 12 | 20 | orange | | 14 | 50 | ...

go lang plugin for Intellij IDEA 14.0.x -

is possible setup go language pluing intellij idea 14.0.3 version? i tried download binary plugin (jar) https://plugins.jetbrains.com/plugin/5047?pr=idea version 0.9.15.3 listed here old , not recognize goroot , gopath. tried build latest plugin using sources https://github.com/go-lang-plugin-org/go-lang-idea-plugin using intellij failed setup sdk. is there latest binary version of go lang plugin available? update idea 14.1+ or use intellij community. original answer: can use free version of intellij community latest version of plugin , should work fine. also, android studio example compatible plugin well. unfortunately plugin has internal dependencies makes hard port , maintain multiple idea versions. hope helps

mysql - Error 1064 in stored procedure -

i'm not expert mysql , i've problems stored procedure. i'm trying sp conditions don't know wrong here, have mistake: error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'declare done int default 0; declare continue handler sqlstate '02000' set' @ line 16 delimiter $$ create procedure getlistprsn(in idequipo int, in tipo char, in puesto int) begin declare varjefe int; declare eqpsupjefe int; declare jefeono cursor select tblpuesto.ptolidereqp tblequipo inner join tblpuesto on (tblequipo.eqpid=tblpuesto.ptoeqp) inner join tblplaza on (tblpuesto.ptoid=tblplaza.pzapto) inner join tblpersona on (tblplaza.pzaprsn=tblpersona.prsnid) tblequipo.eqpid=idequipo , tblpuesto.ptoid=puesto; declare equiposuperiordemijefe cursor select tblequipo.eqpeqpsup tblequipo inner join tblpuesto on(tblequipo.eqpid=tblpuesto.ptoeqp) tblpuesto.ptoid=puesto; if tipo=...

wordpress - WooCommerce Query for products -

i'm creating page shown when user add product in cart. once user click on "add cart" button, template shown. the goal show other products other customers have bought based on item added. it's same functionality amazon. i know how make queries in woocommerce not know how other products contained in other orders contain product selected. anyone can me? finally created own template show products bought bu other users related item added cart: <?php /* template name: template_products_orders */ get_header('shop'); global $woocommerce, $wpdb; $items = $woocommerce->cart->get_cart(); $ids = array(); foreach($items $item => $values) { $product = $values['data']->post; $ids = $product->id; } $product_selected_id = $ids; // query orders item selected.... $query = array(); $query['fields'] = "select distinct id {$wpdb->posts} p"; $query['join'] = " inn...

swift - NSTimer does not invoke a private func as selector -

i working on gist: pasteboardwatcher.swift in invoked nstimer object this: func startpolling () { // setup , start of timer timer = nstimer.scheduledtimerwithtimeinterval(2, target: self, selector: selector("checkforchangesinpasteboard"), userinfo: nil, repeats: true) } where definition of checkforchangesinpasteboard function is: func checkforchangesinpasteboard() { // definition continues.. } i don't want expose function checkforchangesinpasteboard other classes, therefore want mark private reason when so, throws below exception: -[pasteboardwatcher.pasteboardwatcher checkforchangesinpasteboard]: unrecognized selector sent instance if don't mark private works perfectly. is there way can keep method private, hiding other classes? according using swift cocoa , objective-c : “ declarations marked private modifier not appear in generated header. private declarations not exposed objective-c unless explicitly marked ...

ios - Xcode 7.0 watchkit only finds previously deleted images? -

i'm trying set image of button in watchkit using setbackgroundimagenamed. have image named kone. have checked targets correct image , location correct, pretty of possible troubleshooting related questions ensure it's being added extension/app. however, watchkit won't find image or new images i'm adding it. find images few builds ago. instance, can set button image named k1 few builds ago, deleted image project entirely! whenever try set kone says "unable find image named "kone" on watch". weirder, of code works on watchkit 1.0 in xcode 6.3, , have no trouble setting kone image. in case you're wondering, tried logging cached images on watch, there none. tried clearing cache using code: [[wkinterfacedevice currentdevice] removeallcachedimages]; nslog(@"%@", [[wkinterfacedevice currentdevice] cachedimages]); i've shut down computer, reset contents , settings on simulator (edit: comment below, had reset iphone simulato...

asp.net - SqlDataSource insert error - too many arguments -

i want insert row infragistics grid. has 2 columns, id , name. both bound. when insert want use name column parameter. when use both, insertion works. have id parameter don't use because identity column. when use 'name', error, many arguments stored procedure. this markup: <ig:webhierarchicaldatagrid runat="server" height="600px" width="875px" clientidmode="static" autogeneratebands="false" autogeneratecolumns="false" datakeyfields="id" datamember="sqldatasource9_defaultview" stylesetname="windows7" id="wdgprivileges" datasourceid="webhierarchicaldatasource7" key="sqldatasource9_defaultview"> <columns> <ig:bounddatafield datafieldname="id" key="id" hidden="true"> <header text="id" /> <header text="id" /> ...

c - Why does this code always print "not matched"? -

#include <stdio.h> int main(int argc, char const *argv[]) { file *ls = popen("tmp.sh", "r"); char char_array[256]; while (fgets(char_array, sizeof(char_array), ls) != 0) { //nop } char *ptr_somechar = &char_array[0]; char *pointer = "high"; if (strcmp(pointer, ptr_somechar) == 0) { printf("%s\n", "match"); } else { printf("%s\n", "not matched"); } pclose(ls); return 0; } i want compare output line. tmp.sh returns "high". why code print "not matched"? it seems string "high" in file followed newline character , fgets reads \n too. need remove character before comparison.

android - Map fragment filling almost all the screen -

Image
i trying share height of screen's layout between mapfragment , simple textview , in such way small textview @ bottom of screen takes space needs, while googlemap fragment fills rest of available screen. like this: the problem able obtain such result statically specifying fragment's android:layout_height @ 450dp , , haven't found way dynamically, layout adapt both landscape mode , mobiles different screen sizes. this i've tried do: <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" android:layout_width="match_parent" tools:context="madapps.bicitourbo.detailsfragmenttwo"> <linearlayout android:id="@+id/map" android:layout_height="wrap_content" android:layout_width="match_parent" android:orientation="vertical" andr...

javascript - Calling shared services or libraries from a Polymer 1.0 custom element -

with angularjs it's possible share functionality between directives e.g. injecting common service each directive wishes consume it. i'm learning polymer 1.0 custom elements , wondering how shared javascript service/library consumed custom element? service/library isn't 3rd-party can modify please, should possible invoke legacy/non-polymer code. examples of shared services dialog service, or service responsible formatting date/time etc. offer arbitrary behaviour may involve remote call to, say, web service. what best practices in regard? implement behaviour described in following link? https://www.polymer-project.org/1.0/docs/devguide/behaviors.html the javascript functions in polymer element can consume library available them. libraries expose global variables through can consumed, e.g. jquery's $ , lodash's _ can used globally. similarly, library can expose global variable, e.g. mylib through can consume api, e.g. mylib.formattime , mylib.d...

web services - namespace duplicate issue in xml -

i encountering namespace duplicate issue in response xml of webservice. have responder.xsd uses customer.xsd , common.xsd response xml structured using elements in these 2 xsds. sample xml response below: ... <ns:roletype></ns:roletype> <ns:addresses> <ns:postalinfo> <comm:addressline></comm:addressline> <comm:city></comm:city> </ns:postalinfo> </ns:addresses> <ns:validflag></ns:validflag> ... where ns: customer namespace , comm: common namespace. but response below ... <ns1:roletype xmlns:ns1="urn:customer:domain:5"></ns1:roletype> <ns2:addresses xmlns:ns2="urn:customer:domain:5"> <ns2:postalinfo> <ns3:addrline xmlns:ns3="urn:common:domain:5"></ns3:addrline> <ns4:city xmlns:ns4="urn:common:domain:5"></ns4:city> </ns2:postalinfo> </ns2:addresses> <ns5:validflag xmlns:ns3="u...

c++ - g++ not finding boost libraries -

i trying compile program using cgal , linked boost. when run linker: g++ -wl,-o1 -wl,-rpath,/home/name/qt/5.4/gcc_64 -wl,-rpath,/home/name/qt/5.4/gcc_64/lib -o meld main.o mainwindow.o test.o moc_mainwindow.o -lcgal -lgmp -lmpfr -lboost_system -l/home/name/qt/5.4/gcc_64/lib -lqt5widgets -lqt5gui -lqt5core -lgl -lpthread and error main.o: in function `global constructors keyed main.cpp': main.cpp:(.text+0x3f): undefined reference `boost::system::generic_category()' what doing wrong? saw couple of answers similar questions none seem work me.

excel - VBA Email with pasted chart and text in body -

the goal of following code paste selected chart email body below text. however, continues paste above text. how can change make paste below? thanks! set outapp = createobject("outlook.application") set outmail = outapp.createitem(0) outmail .cc = "xyz@anc.com" .bcc = "abc@xyz.com" .subject = "test" .body = "dear" & "macro " activesheet.range("p36:x46").copy set weditor = outapp.activeinspector.wordeditor weditor.application.selection.paste .display change selection start , end. adding line break might idea. should use mailitem.getinspector instead of application.activeinspector since message not yet displayed. set outapp = createobject("outlook.application") set outmail = outapp.createitem(0) outmail .cc = "xyz@anc.com" .bcc = "abc@xyz.com" .subject = "test" .body = "dear" & "macro " ...

Javascript (Google Scripts) value from a function is not returning -

i think simple 1 solve, stuck working simple issue out. i have called createevent function create google calendar event. part of function google calendar event id eventid , want return it. for reason dont quite understand, eventid value not return. var eventid; createevent(calendarid,title,startdt,enddt,desc,eventid); logger.log('id after func = '+eventid); sheet.getrange(lr,eventidholder,1,1).setvalue(eventid); }; function createevent(calendarid,title,startdt,enddt,desc,eventid) { var cal = calendarapp.getcalendarbyid(calendarid); var start = new date(startdt); var end = new date(enddt); //manually set location, can modified dynamic modifying code if need //var loc = sheet.getrange(lr,destid,1,1).getvalue(); var loc = "some location" //set options, in case using description , location, not need guests or sendinvites var event = cal.createevent(title, start, end, { description : desc, location : loc }); logger.log(...

java - Swagger - Issue using @ApiParam with @CookieParam -

i'm using swagger 1.3.10 , trying swagger ui functionally accept cookie parameter rest service. here's example of java code: public response getuserinfo( @context httpheaders headers, @apiparam(value="enter brand code integer", defaultvalue="101", required=true) @cookieparam(value = "userbrand") string brand) now actual swagger ui renders fine actually...it populates default value "101" in case. problem when click "try out" brand parameter coming through null. seems i'm missing simple here...any thoughts? thanks lot! cookie parameters not supported swagger. swagger-core generates them cookie parameters, not supported other tools that's not official part of spec.

Rails 4 "Pretty" JSON output -

i got new computer @ work , have been noticing things different work computer , home computer. one perplexing me @ moment json output rails. @ home, puts out json automatically in way easy read. (with color, indentation etc) instead, 1 lump block -_-; [{"id":1,"title":"ratione fuga perferendis","is_completed":false,"created_at":"2015-06-19t16:48:27.947z","updat‌​ed_at":"2015-06-19t16:48:27.947z"}] anyone know how fix it? that's browser being nice you. there lots of extensions chrome , firefox automatically format json you: chrome: json formatter chrome: json viewer firefox: jsonview firefox: jsonovich safari json formatter you don't want rails handle pretty printing since dramatically increase size of json responses.

c# - Linq where on include -

i'm stuck linq query. i've tables. id b c d 1 data 2 other data then, every record on table may have none or many rows id tablea_id r 1 1 1 2 1 2 3 1 5 4 2 2 for example. row 1 (some data) has 3 rows on table b. i tried using tablea.include(x => x.tablebchilds.where( d => d.r == 1)).tolist() but not working. many others varation. the objective of query return tablea.row #1 if pass 1 value (value of r ). number <> 2 won't give result. tables linked on ef. tableb.tablea_id foreign key of tablea.id edit #1 i tried answers in question marked duplicated no luck. give 2 tablea.rows if user insert 1 parameter, linq query should return row #1, data . if 2 passed parameter, nothing return. a working sql statement is: select [tablea].* [tablea] join [tableb] on [tablea].[id] = [tableb].[tablea_id] [tableb].[r] = 1 thanks! if have database relationship configured have work...

Background theme of error of EditText in Android -

Image
i sent error seterror in edittext, how can change theme of edittext black theme error: here code: edittext et_email = bla...; et_email.seterror(mres.getstring(r.string.invalid_email)); i this: i need this. what theme using ? think right theme.appcompat.light.darkactionbar keyword here light, because seems using dark.

php - Replace multiple items in a string -

i've scraped html string website. in string contains multiple strings color:#0269d2 . how can make str_replace code replace string color ? for instance looping through color:#0269d in fulltext string variable? str_replace("color:#0269d","color:#000000",$fulltext); you pass array str_replace function , no need use loop $a= array("color:#0269d","color:#000000"); $str= str_replace($a,"", $string);

linux - Install third-party C library on Mac OS X -

i'd install third-party c library ( http://cgm.cs.mcgill.ca/~avis/c/lrs.html ) on mac os x. however, binaries won't seem install on mac os x (10.9.5). library intended unix/linux platforms. here couple example of errors when trying install make file. first, here's error when running make all out of box (for reason, running make all64 nothing): ld: library not found -lgmp i installed gmp library ( https://gmplib.org/ ) via macports in /opt/local . however, library not appear found: cc 2nash-gmp.o -l. -llrsgmp -l/opt/local/include -lgmp -o 2nash ld: library not found -lgmp clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [2nash] error 1 rm 2nash-gmp.o how can around , install on mac? i'll mention intend call function c library many, many times within functions (matlab) code i've written. i'd prefer potential solution allow this. update #1: i've since done following: in makefile, changed libdir /usr/li...

c - Translational Limits on Enum Constants -

i have specific question translation limits of c (as defined in ansi/iso 9899:x standards family) regarding enumeration constants. i have thousand individually indentifyable data sources, i'd enumerate. want respect minimal translational limits of c-standard, actual limits implementation defined, , exceeding undefined behavior (see is undefined behavior exceed translation limits , there checker tools find it? ). i know there translation limits on number of enumeration constants within same enum (c90: 127), number of identifiers specified within same block (c90: 127) , external identifiers within translation unit (c90: 511). i think enumeration constants not have linkage (please correct me), , surely can place them out of block scope ... puts translation limit constraints following pattern (besides limits of integral types of target plattform, , of course number of constants within 1 single enum) - , if so, why? myenumeration.h --------------- enum e1 { val11 = ...

excel - How to make VBA click a button in a different workbook? -

workbook 1 contains macro 1, wrote. i'm using macro 1 send input data workbook 2, , retrieve calculations workbook 2. workbook 2's calculations require exercising macro 2, activated clicking command button button 6 in workbook 2. the button name "button 6" , know name of macro initializes. how click button 6 macro 1? instead of clicking button in other workbook run button's click event function or intended function using application.run method. application.run "workbookname!functionname"

How continuous Azure Web Jobs can be idempotent and send email? -

after reading tons of information on web azure webjobs, documentation says job should idempotent, on other hand, blogs use webjobs actions such "charging customer", "sending e-mail". this documentation says running continuous webjob on multiple instances queue result in being called more once. people ignore fact charge customer twice, or send e-mail twice? how can make sure can run webjob queue on scaled web app , messages processed once? i using database, update query row lock , transactionscope object. in order table, create column manage state of action taking in webjob. i.e. emailsent. in queuetrigger function begin transaction, execute update query on customer order rowlock set, sets emailsent = 1 emailsent = 0. if return value sqlcommand = 0 exit function. webjob has sent email. otherwise, send email , call complete() on transactionscope object if sent successfully. that should provide idempotency want. hope helps.

c# - ASP.Net WebApi Help Pages Sample Generation -

i'm using asp.net pages webapi. on of response format samples i'm receiving errors have formatter. i've looked @ various tutorials , seem show how override form-url-encoded format. haven't found override other formats: application/json, text/json, text/html, application/xml, text/xml in order set sample specific type used config.setsamplefortype("messagegoeshere", new mediatypeheadervalue("application/x-www-form-urlencoded"), typeof(typegoeshere)); and worked set sample form-urlencoded response formats. tried replacing mediatypeheader value application/json or 1 of other examples , had no effect. my question: how set samples response formats other form-urlencoded on asp.net pages? the issue having was not using exact type in typeof parameter. using generic collection when should have been using iqueryable. config.setsamplefortype("messagegoeshere", new mediatypeheadervalue("application/...

ios - Performance with a lot of string operations comparing objective C and swift -

i have lot of string operations concatenating, replacing , finding indexes of large texts (10000 characters) ... the operations slow. same doing in java/android faster. i asking if same in objective c faster. i ios newby , know swift far (so cant try simply), thats why asking if objective c swift-bridging faster ? update have lot of substring operations in loop (also replace), concatenates new string. newtext & stext of type string, stext has 10000 characters, loop have 100 iterations: newtext=newtext + stext.substring(istart,endindex: iend); func substring(startindex: int, endindex: int) -> string { //println("substring" + self); var start = advance(self.startindex, startindex) var end = advance(self.startindex, endindex) return self.substringwithrange(range<string.index>(start: start, end: end)) } update 2 performance test (replace string) string, nsstring, cfstring from information provided (thanks lot), seems not differen...

jquery - Using Bootstrap 3 DateTimePicker in ASP.NET MVC Project -

Image
i want use bootstrap 3 datetimepicker. added asp.net project using nuget. here's bundleconfig.cs: bundles.add(new stylebundle("~/content/bootstrap").include("~/content/bootstrap.css", "~/content/bootstrap-theme.css", "~/content/bootstrap-theme.min.css", "~/content/bootstrap.min.css", "~/content/less/_bootstrap-datetimepicker.less", "~/content/less/bootstrap-datetimepicker-build.less")); bundles.add(new scriptbundle("~/scripts/bootstrap").include( "~/scripts/moment.min.js", "~/scripts/bootstrap.js", "~/scripts/bootstrap.min.js", "~/scripts/bootstrap-datetimepicker.js", "~/scripts/bootstrap-datetimepicker.min.js")); and i'm using in view this: <div class="container"> <div...

graphhopper - Re-use EdgeIterator -

if understand well, edgeiterator can used 1 time. if correct, why can't reset avoid creating new instance of edgeiterator each time need loop on same node edges ? thanks ! the edgeiterator reused if use edgeexplorer: // store somewhere explorer = graph.createedgeexplorer(); // use somewhere edgeiterator iter = explorer.setbasenode(x); while(iter) {..} still careful need 1 edgeexplorer every thread , every loop e.g. having double for-loop 1 explorer fail :)

wordpress - Can someone confirm this htaccess is valid? -

i have following in .htaccess file on server. <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> i'm confused doing index.php. looks me rewriting url twice index.php? correct, have issue our server spawning lots of processes index.php , im looking being caused. these log lines causing me worry: jun 19 15:06:34 server lfd[9809]: *excessive processes* user:ftpew1ng kill:0 process count:14 jun 19 15:06:34 server lfd[9809]: *user processing* pid:398 kill:0 user:serveruser time:560914 exe:/usr/bin/php cmd:/usr/bin/php /home/serveruser/public_html/index.php jun 19 15:06:35 server lfd[9809]: *user processing* pid:19556 kill:0 user:serveruser time:455723 exe:/usr/bin/php cmd:/usr/bin/php /home/serveruser/public_html/index.php jun 19 15:06:35 server lfd[9809]: *user processing* pid:32005 kill:0 user:serveruser time:68753...

c# - Changing TimeZone on Azure Web Apps Doesn't work for DateTimeOffset.Now? -

according to multiple postings , microsoft enabled ability use application setting - website_time_zone - control timezone of web server. to try this, set value "eastern standard time" local time zone. on asp.net mvc razor page, added following code: datetime.now: @datetime.now datetimeoffset.now: @datetimeoffset.now datetime.utcnow: @datetimeoffset.utcnow when ran last night @ 5:10:07pm eastern standard time, gave following output: datetime.now: 6/18/2015 5:10:07 pm datetimeoffset.now: 6/18/2015 5:10:07 pm +00:00 datetime.utcnow: 6/18/2015 9:10:07 pm as can see, setting correctly allowed datetime.now return correct value in timezone rather utc azure websites/web apps do. datetime.utcnow has returned correct value obvious reasons. however, datetimeoffset.now returns local time, offset of +00:00 - if clock changed rather timezone. occurs though documentation says (emphasis mine): gets datetimeoffset object set current date , time on current compu...