Posts

Showing posts from March, 2012

javascript - Access child component state in other ways than ref? -

i unable use this.refs.child.state in application access state of child component, hence need alternative way so. main reason pass child contents redux state when button clicked inside such childs parent component, hence function in parent component needs pass childs content 1 of parameters. depending on structure of components (hard tell when don't post code), fix chaining callbacks via props. i.e. var parent = react.createclass({ onchange: function(childvalue){ this.setstate({childvalue: childvalue}); }, render: function(){ return <child onchange={this.onchange} /> } }); var child = react.createclass({ handlechange: function(event){ this.props.onchange(event.target.value); }, render: function(){ return <input onchange={this.handlechange}/> } }); add in many middle-layers needed of form; var middlechilda = react.createclass({ render: function(){ return <middlechildb onc

google chrome - dotnetbrowser with earth plugin too slow -

i testing dotnetbrowser teamdev.com within wpf application. when call google maps 3d functionality this: https://www.google.com/maps/@50.052475,8.7434217,109a,20y,41.07h,76.14t/data=!3m1!1e3 the viewer works slow. takes 5x time in google chrome on same machine. the code same in simple example on teamdev homepage. any tipps? gl teenriot you can try use heavyweight browser mode: browser browser = browserfactory.create(browsertype.heavyweight); if problem persists, please contact our support via email address, provided in evaluation email.

How to check whether android EditText keyboard Auto Suggestion is enabled or not? -

in project working on edittext.i have set input type edittext using below code. medit.setinputtype(inputtype.type_class_text | inputtype.type_text_flag_cap_sentences | inputtype.type_text_flag_multi_line); if disabled auto suggestion using keyboard settings, how know autosuggestion enabled or disabled while editing. need know in ontextchanged listener. you can check if(medit.getinputtype() == inputtype.type_text_flag_no_suggestions){ } but never tried.

php - How to Redirect to the main page from pop up window in html -

i have html page login via gmail account . using pop window login. here menstion code, my html code : <body> <a href="<?php echo $login_url; ?>"target="popup" onclick="window.open('<?php echo $login_url; ?>','popup','width=600,height=600'); return false;"> sign in gmail </a> </body> if click sign in gmail button means gmail opened in pop up. after giving mail id , password , click sign in means next page loaded inside pop only. but want close pop window after sign in , redirect main page . how that. please 1 me just remove onclick handler , popup target: <a href="<?= $login_url ?>> sign in gmail </a>

gcc - Write default values to eeprom -

this setup: atmel studio 7.0 avr-gcc atmega644pa i'm trying write default values eeprom. mean: in code, predefined values @ specific place in eeprom. i can use: __attribute__((section(".eeprom"))) which works put variables in eeprom, links variables automatic location. want manually set location variable stored. how can this? thanks! ps: needs work >300 variables you can place variables in 1 struct. variables placed in eeprom in specified order. struct { uint8_t var1; uint8_t var2; uint16_t var3; ... } eeprom_data __attribute__ ((section(".eeprom")));

android - Apps don't accept that Mock Location is allowed -

i using lg g3 , allowed mock locations in developer options already. yesterday used app "mock locations" fake location , worked fine somehow today tells me need check option "mock location" in developer options. checked. , other apps same thing , cant use them anymore. tried set app systemapp didn't well. someone knows how help? please check in manifest permission defined <uses-permission android:name="android.permission.access_mock_location" /> also check in developer options app selected using mock locations

c# - MVC Razor Custom Binding for DateTime? -

i have patientsearchcriteriabinder , when runs call datetimebinder. the first time occurs, goes well. but, don't know why. when in controller redirecttoaction runs binder again , date format changes dd/mm/yyyy mm/dd/yyyy could me out?

vba - index match return NA value -

i have vba code find value @ intersection of columns , rows. works data except 1 : returns na. value want return same usual, doesn't work intersection. can me figure out why? thank you with perftitres set vmt = data1.range("u:u") set ticker = data1.range("h:h") end ' calculs de perf each sht in perftitres.worksheets if sht.visible = true if sht.cells(1, 1) = "" sht.cells(1, 1) = "date" sht.cells(1, 2) = "code du placement" sht.cells(1, 3) = "valeur marchande t" sht.cells(1, 4) = "valeur marchande t-1" sht.cells(1, 5) = "valeur des achats" sht.cells(1, 6) = "valeur des ventes" sht.cells(1, 7) = "facteur" sht.cells(1, 8) = "rendement 1 mois" end if lastrowsht = sht.cells(sht.rows.count, "a").end(xlup).row lastcolumnsh

scikit learn - Different results sklearn vs statsmodels and sklearn on different machines -

i'm finding 1 real head-scratcher. have python 2 notebook i'm using linear regression on laptop , desktop. on laptop sklearn gives same results statsmodels. however, on desktop, statsmodels gives correct result, sklearn gives wrong result. number of coefficient estimates have blown 8 orders of magnitude larger should be, e.g., 304952680 vs -0.1271 . again, save notebook, pull on laptop, run again , statsmodels vs sklearn linear regression results equal. re-connect , re-run notebook again scratch on desktop and, again, statsmodels correct, sklearn linearregression blows again. mystified. have ideas? here 2 gists, linked through nbviewer. long, compare, example, cells 59 , 62, variable m12_cs_months_since_last_gift . notebook, statsmodels (cell 59) agrees sklearn (cell 62). desktop, disagree (see blow variable in desktop cell 62). 1 thing may worth noting: data characterized large segments of predictor space corresponding same observed value. maybe suggests near co

mysql - Why is this SQL error happening? -

i'm trying install kbaffiliate php script having great troubles trying import sql, advice? error sql query: create table `scraffiliateusr` ( `usrid` bigint(20) not null auto_increment, `usract` int(11) not null default `0`, `usrnam` varchar(100) not null default ``, `usrpwd` varchar(100) not null default ``, `usractkey` varchar(100) not null default ``, `usrip` varchar(100) not null default ``, `usreml` varchar(100) not null default ``, `usrjondtetme` datetime not null default `0000-00-00 00:00:00`, `usrinvby` int(11) not null default `0`, `usrlstvstdtetme` datetime not null default `0000-00-00 00:00:00`, `usrvst` int(11) not null default `0`, `usrvsttdy` int(11) not null default `0`, `usrprflstvstdtetme` datetime not null default `0000-00-00 00:00:00`, `usrprfvst` int(11) not null default `0`, `usrprfvsttdy` int(11) not null default `0`, `usrinvlstsnddtetme` datetime not null default `0000-00-00 00:00:00`, `usrinvsnd` int(11) not null defa

d3.js - d3.html not working with d3.v4 -

Image
in d3 version 3, had code, worked great: d3.html("http://google.com",function(frag){ console.log(frag); }); that code doesn't work in version 4. looking @ api , change log , thought perhaps this: d3.html("http://www.google.com").get(function(error,frag){ console.log(frag); }); but doesn't work either. have working example of d3.v4 d3.html? thanks it's not problem d3. it's because page you're requesting doesn't allow cors . whether it's google.com or server should include access-control-allow-origin header response if want via async call (xmlhttprequest, aka ajax) on page located @ different origin server. as proof see codepen: http://codepen.io/lukaszwiktor/pen/oxqwrk?editors=0011 in case of missing cors headers chrome dev console shows following error:

c# - how to call one service from another service using azure service bus relay -

we using wcf services azure service bus. i referred link: https://azure.microsoft.com/en-in/documentation/articles/service-bus-dotnet-hybrid-app-using-service-bus-relay/ i have following scenarios: i have created service1 directly consumed client (within same namespace path servicepath1). example: sb://mynamespace.servicebus.windows.net/servicepath1 i have created service2 directly consumed client (within same namespace path servicepath2). example: sb://mynamespace.servicebus.windows.net/servicepath2 service1 , service2 consumed client. i had consume service2 within service1 or vice versa (as per business need)and achieved considering service1 client service2. it working fine wanted know better way achieve this. please guide or share pointers.

javascript - How to check bottom of child div touching parent bottom -

i'm trying change position of child element(with varying height based on text) using range input,i stop applying top position once child div touches bottom of parent having fixed height. $('#change_position').on('input', function () { var val = +$(this).val(), scrsize = parseint($('.screen').css('height')), stop = $('.screentip').offset().top, h = parseint($('.screentip').css('height')), tofsset = stop - h; if (tofsset < scrsize) { $('.screentip').css('top', val + "%"); } }); the height expecting jquery return string ending "px". can use function .height(). return height of element integer. have tried modiefied version of code: $('#input').on('input', function () { var val = parseint($(this).val()), scrsize = parseint($('#container').height()), txtsize = parseint($("#t

python 3.x - Markov analysis - Return and recursion role -

i working on solution of markov analysis in think python, not understand role of "return" in block code below. far known when code reach return function cancel immediately, isn't unnecessary in case, because there recursion here random_text(n-i) before code reach return statement, function cancel when recursion finish mean when loop over?? question seem stupid newbie in python , recursion stuff confusing me. try remove 'return' , still run well. def random_text(n=100): start = random.choice(list(suffix_map.keys())) in range(n): suffixes = suffix_map.get(start, none) if suffixes == none: # if start isn't in map, got end of # original text, have start again. random_text(n-i) return word = random.choice(suffixes) print(word, end=' ') start = shift(start, word) the full code below can understand each function do. from __future__ import print_func

Updating media items using Sitecore Powershell Extensions -

i'm looking way can bulk update media items sitecore powershell, happy here of other suggestions. i need way of swapping out blob value of sitecore media item media item. possible sitecore powershell? with 4.0 updated week there great way using new remoting module functionality michael added part of this issue . if cannot hang on few more days feel free contact me directly , can pass release binaries earlier. i wouldn't send remote files server previous implementations files going through serious serialization/deserialization in process. however if files on server there way ingests files server file system media library can check out in gist i've written while here .

jquery - When clicking a button all texts are showing on the same div, i want it differentely -

i have page, when doing small task study, not working. problem is, i have created input box , button, div showing texts typed on input box. when typed texts , clicked on button, working. it means text showing in small div. when typed text , pressed button, div restarting. want duplicate div , should below of first. have listed jsfiddle below. jquery code is $(window).ready(function () { $(".result-box").hide(); }); $("#button4").click(function () { $(".result-box").show(); $(".result-box").animate({ top: '12%', left: '8%' }); var vof = $("#box1").val(); $(".result-box").text(vof); $("#button4").val("next"); }); js fiddle you can way: $(window).ready(function(){ $(".result-container").hide(); }); $("#button4").click(function(){ var vof=$("#box1").val(); var newdiv ='<div cl

asp.net - How to figure out what's been jitted at warmup? -

.net applications, asp.net applications, can have annoyingly long warmup time in part due jitting. i tried dottrace profile such warmup , tells me how time indeed goes jitting. wonder: how can tell what's been jitted? i want know because not code created equal , there maybe toolkits can replace others compile faster or more fine-grained.

java - How to add different image for each group in expandable Listview -

in expandable listview, have 3 groups. want add different 3 image group. tried many codes, not working. my code: main activity: hashmap<string, list<string>> rightdrawerlistdetail = getdata(); list<string> rightdrawerlisttitle = new arraylist<string>(rightdrawerlistdetail.keyset()); adapterr = new customexpandablelistadapter(this, rightdrawerlisttitle,rightdrawerlistdetail); mrightdrawerlist.setadapter(adapterr); private hashmap<string, list<string>> getdata(){ hashmap<string, list<string>> expandablelistdetail = new hashmap<string, list<string>>(); arraylist<string> arraylist = mydb.getalladdress(); list asrider = new arraylist(); asrider.add("hello"); list asridee = new arraylist(); asridee.add("hai"); list recent = new arraylist(); recent.add("success"); expandablelistdetail.put("as rider",asrider); expandablelistde

visual studio 2015 - How to run saved script in Sql Server Data Tools -

i learning ssdt. i connect database, write sql, , save file part of project. works fine. but want open , run script. when open script, toolbar @ top missing use run script. i don't understand how toolbar except selecting "new query" opens sql window toolbar, , copy , pasting sql new window. it seems editor automatically bring toolbar. i using vs15 latest ssdt. the main thing understand idea of ssdt declare how want database (including setting data in pre/post deploy scripts) , make database same project doing publish. a publish is: build project generates dacpac use sqlpackage.exe (or api) compare dacpac database , generate script run (ssms, sqlcmd, etc) or update database you. this called disconnected development, talking connected development , can opening query window , running queries there outside of ssdt - may running them within ssms. for more connected development see: https://www.simple-talk.com/sql/sql-tools/connected-devel

VBA Excel 2010 - Paste graph into excel while keeping source formatting -

im trying paste graph same excel spreadsheet have keeps source formatting. i tried recording macro doesnt display code when paste, after googling found can paste powerpoint ( found here ) executemso can explained in link msdn . the reason need paste charts excel while keeping souce formatting need make multiple charts information them, such legend etc etc edit: code have tried far , comes 1 error or another sheets("sheet1").chartobjects(1).copypicture sheets("sheet1").paste destination:=worksheets("sheet1").range("i18") activesheet.chartobjects(1).activate activechart.chartarea.copy 'application.commandbars.executemso "pasteexcelchartsourceformatting" 'activesheet.pastespecial format:="keep chart source formatting" link:=false _ displayasicon:=false 'activesheet.pastespecial format:="pasteexcelchartsourceformatting" link:=false _ displayasicon:=false keeping source formatting sti

rest - Behat selenium tests trust self signed SSL cerificate -

for our automated testing of our drupal site, using behat test scripts. on our local development machines using self signed ssl certificate created acquia devdesktop. running tests in different browsers behat no problem since can trust certificate in browser itself. rest interfaces no browser being opened different story. behat not accept self signed certificate since "unsecure". when running rest test error get: curl error 60: ssl certificate problem: self signed certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html ) (guzzlehttp\exception\requestexception) with testcase nothing wrong because worked before enabled ssl certificate. tried edit configuration .yml file options documentation , other tickets no luck. is there way trust self signed certificate rest interface tests? if need more information please let me know. edit: added yml config , composer.json file //composer.json { "require": { "drupal/drupal

javascript - onscroll() to open a new tab without pop-up alert -

i need open new tab when user scrolling in website. the problem is, far understand, in order new tab open automatically without pop-up warning browsers, user must first trigger event in dom apparently onscroll() not count one. is there way me trigger when user scrolling in website allow me open new tab without pop-up alert browser? this code: window.onscroll = function(ev) { if(clicked === 1) { return false; } clicked = 1; var win = window.open('<?php echo $redirect ?>', '_blank'); win.focus(); }; that native browser functionality , one. imagine if every site pollute browser number of tabs. for work user has accept , allow popups domain

python - Figure window resize issue Matplotlib - toolbar dissapears -

Image
when try resize figure window in matplotlib, toolbar dissapears. example screenshot given below. bug or there setting missing script ? matplotlib version: 1.5.1 numpy 1.11.1 python 2.7 windows 7 very minimal code : import numpy np import matplotlib.pyplot plt x=np.random.randint(0,5,10) plt.plot(x) plt.show() sorry images blured, can see toolbar shrinking resize.

How can I completely disable CoffeeScript in a Rails 3.1 app? -

at moment when generate new controller, rails generates .js.coffee file controller well. don't use coffeescript want rails instead generate .js files me. is enough comment out coffee-rails gem disable cofeescript in rails 3.1 app? comment out gem "coffee-script" in gemfile use .js instead of .js.coffee javascript files

Control - Z In Python Code -

in idle, there's no clear screen, , after reading forums best method plainly print ton of "\n"s. however, after playing idle, made discovery. when game waiting input after printing out instructions using print statements, instead of inputting useful character, entered 'control-z,' , idle began remove text display print statements, 1 one. my main question is, how manually in code enter 'control-z', can utilize functionality? if you're confused story, here's example code , try hitting control-z. print("some text") print("more text") input("the input (hit control - z here):") ^z bit of mess. ascii control char ^d interpreted eot, end of transmission, on unix , many other systems means end of file, close application. ascii ^z meant interpreted sub, substitute, whatever means. editors ofter use undo (meaning undo ^x cut). microsoft (and few other old systems) @ least interprets ^z end of file, same e

ios - Alamofire cocoapod integration issue in XCTest -

i have integrated alamofire in ios project.while testing app using xctest(uitest),am getting following issue.i have googled , tried solutions.but not getting solutions.plesae me solve this. library not loaded: @rpath/alamofire.framework/alamofire referenced from: /private/var/mobile/containers/bundle/application/da4702f0-6a4c-4eb6-99d0-255abb6e3f57/real estate.app/real estate reason: image not found dyld version: 353.12 this podfile. target 'freshboss' use_frameworks! # pods freshboss pod 'alamofire', '~> 3.4' pod 'mbprogresshud', '~> 0.9.2' pod 'google/signin' target 'freshbosstests' do inherit! :search_paths # pods testing pod 'alamofire', '~> 3.4' pod 'mbprogresshud', '~> 0.9.2' pod 'google/signin' end target 'freshbossuitests' do inherit! :search_paths # pods testing pod 'alamofire', '~> 3.4' pod &#

android - Nexus 6 with developer preview no mobile data -

i don't know if right place ask mobile data 4g/lte not working on nexus 6 , think because of beta preview of android nougat latest version announced today. when marshmallow working fine when asked people in store set apn not working. 2g/3g don't work can receive , give calls other numbers. having same issue? edit: turned out problem mobile operator. should have checked first.

javascript - Is it possible to manipulate the cookies of a remote computer via Chrome extension? -

some background information: i have implemented working chrome extension manipulate cookies within browser, not unlike editthiscookie . basic functionalities include adding, removing, editing, importing , exporting cookies. question: currently, importing , exporting cookies work json flat files have sent around, increased convenience, wondering if possible import cookies on local computer directly remote computer via extension. basically, 'push , set' cookies 1 computer another. simplicity, both signed same google account. of course there needs way identify , authenticate remote computer i'm thinking of possibly using authentication apis might available. as idea still in infancy, ask if technically feasible? there technical limitations regarding chrome extensions (how sandboxed etc.) should know prevent me achieving goal? assuming: both chrome instances signed same account extension installed on both chrome sync enabled extensions (default) in

.htaccess - How can I hide affiliate URL before redirecting to actual store URL using PHP? -

Image
<html> <head> <title>your page title</title> <meta http-equiv=”refresh” content=”0;url=http://your affiliate url”> </head> <body> <p>redirecting, please wait. if you’re not redirected within couple of seconds, click here:<br /> <a href=”http://tracking.vcommission.com/aff_c?offer_id=2371&url=http%3a%2f%2fwww.naturesbasket.co.in%2fonline-grocery-shopping%2ffruits-vegetables%2ffruits%2f32_0_0%3futm_source%3dvcomm%26utm_medium%3dcps%26utm_campaign%3dvcommron”>product name</a> </p> </body> </html> affiliate url or affiliate user code or tracking code not safe visible easily. wanted hide tracking url before redirect store websites. for example, suppose have affiliate link http://tracking.vcommission.com/aff_c?offer_id=2371&url=http%3a%2f%2fwww.naturesbasket.co.in%2fonline-grocery-shopping%2ffruits-vegetables%2ffruits%2f32_0_0%3futm_source%3dvcomm%26utm_medium%3dcps%26utm_campaign%3dvcommron

java - Android Studio: Searchview for images, how? -

i have gridview images on it, , search bar on top of page. know how use search bar filter text, how can filter images? there way somehow "tag" images? thanks! you must create data model images , use id filter them. public class mydatamodel { int resourceid; string imagename public mydatamodel(string name, resourceid); // constructors getters, setters, etc } and in activity can create list data: list<mydatamodel> data = new list(); data.add(new mydatamodel("name", r.drawable.name)) //import data and on searchview query listener add filter adapter ; adapter.getfilter().filter(//name);

ios - How do I change the font of a UISegmentedControl in swift without changing the font size? -

i want change font of uisegmentedcontrol without changing font size. this code but, obviously, in case change font size too: let attr = nsdictionary(object: uifont(name: "avenir", size: 12.0)!, forkey: nsfontattributename) segmentedcontrol.settitletextattributes(attr [nsobject : anyobject] , forstate: .normal) how can solve this? try following code, not proper way, don't have other option, should go via wat int fontsize; (id segment in [segmentedcontrol subviews]) { (id label in [segment subviews]) { if ([label iskindofclass:[uilabel class]]) { fontsize = label.font.pointsize; // here got label, use font size here break; } } } now got fontsize, can use change font face

javascript - Canvas rotating particles -

do might know how make kind of animation. how managed see more word canvas javascript technique. http://cuberto.com/ thank you here's single arc on blue background going around , around. achieved drawing white arc on blue background. fiddle: https://jsfiddle.net/07d69v39/1/ //coordinates of rectangle var xp = 125; var yp = 125; var radius = 45; //how far move arc each time: var anglestep = math.pi * 0.1; //how move arc: var steptime = 50; var currentstep = 0; function dodraw() { var can = document.getelementbyid("mycanvas"); can.width = 250; can.height = 250; var context = can.getcontext("2d"); //erase canvas painting blue: context.fillstyle="#0000ff"; context.fillrect(0, 0, 250, 250); //set drawing color white: context.strokestyle="#ffffff"; context.linewidth=5; context.arc(xp, yp, radius, 0 + currentstep, 1.5*math.pi + currentstep); context.stroke(); //make sure ma

parsing - In MegaParsec is there a way of anding 2 parsers? -

if have parser like: notzeroorone :: parser char notzeroorone = noneof ['0' , '1'] is there way can combine rules of parser digitchar can parser pass if both parsers pass? something like biggerthanone :: parser char biggerthanone = digitchar && notzeroorone as user2407038 suggests in comments, it's achievable using lookahead function. biggerthanone :: parser char biggerthanone = lookahead digitchar *> notzeroorone however, parsers sequential nature, it's both more efficient , comprehendable apply sequential logic. e.g., using monad instance of parser : biggerthanone :: parser char biggerthanone = c <- digitchar if c /= '0' && c /= '1' return c else unexpected "not bigger one" or monadplus : biggerthanone :: parser char biggerthanone = mfilter (\c -> c /= '0' && c /= '1') digitchar which can refactored use ord instance of cha

javascript - Improve this Jquery toggle menu (responsive) -

i want improve jquery toggle menu (responsive). first part: i want when resize window under 768px , click hamburger toggle menu (hamburger icon changes x icon) full "nav ul" menu turn visible in block style , still visible when resize window until break-point 768px , disappears. second part: when resize down 768px , under, "nav ul" must visible in block style , toggle menu icon must "x" (not hamburger). (function($, window, document, undefined) { 'use strict'; $(function() { $(".menu_bar").click(function() { $(this).toggleclass("active"); $("#mobilemenu").slidetoggle(100); }); }); $(window).on("resize", function() { if ($(this).width() > 768) { $("#mobilemenu").show(); $(".menu_bar").removeclass("active"); } else { $(".menu_bar").removeclass("active"); $(&q