Posts

Showing posts from February, 2010

parsing - Is there a way to convert expressions to mathematical environments on-the-fly? -

for instance, if type expression a/b in compatible application microsoft word, parsed , rendered automatically expression $$\frac{a}{b}$$. similarly, complex expression 1+(a/(a+b)) converted expression $$1+\frac{a}{a+b}$$. no insert -> object -> equation editor nor services -> typeset needed.

ios - Trouble Populating UISearchBarController Results TableView -

i'm new swift, gentle. i'm using xcode 7 beta, currently. i have tableviewcontroller nested in navigationcontroller. within tableview i've implemented uisearchbar , uisearchdisplaycontroller similar steps here . pretty working expected, except when type search criteria, results table view uisearchdisplaycontroller not getting populated. when hit cancel on search, results have been populated in initial table view. the tutorial linked pre-populating list of items , search bar filtering these items. approach different because i'm populating search external api. my question two-fold: a) how populate results tableview? b) 2 tableviews seem redundant , don't feel first necessary (might wrong). what's proper way achieve functionality? ideally, able put uisearchbar in navigation item lives in uinavigationbar , have had trouble finding resources doing that. import uikit import alamofire import swiftyjson import foundation class dstableviewcontroll...

jQuery return value of deferred.then success when in function -

i've written function want return results of successful deferred function. however, since value want returned in scope of donecallbacks , runsearch() function returns undefined when running console.log(runsearch()) . how can have containing function return returned value of successful deferred.then() ? function runsearch(){ $.get( "search.php" ).then( function() { // want runsearch() return results of function }, function() { console.log( "$.get failed!" ); } ); } edit: everyone. since goal user return value in function, included function in donecallbacks . function runsearch(){ $.get( "search.php" ).then( function() { var returnvalue = 'return value' function dosomethingwithreturn(returnvalue) { console.log(returnvalue); } dosomethingwithreturn(returnvalue); }, function() { console.log( "$.get failed!" ); ...

ios - Could not open my mobile provisioning profile in XCode 6.3 -

background: trying upload application ios app store. have valid developer account , running on xcode 6.4. have been able make certificate , distribution provision file. problem: i have downloaded provision profile , supposedly when double tap provision file, xcode supposed pop connection tab etc. when double tap file, nothing happens. tried: redownloading , re-checking files , updating xcode previous version current version. seems causing problem? note: when archive app says no devices connected provisioning profile etc. don't know if connecting iphone resolve issue? there away around this? such using app loader? if works, how use because hard find resources on internet.

c - Creating .exe that needs no DLLs or Libraries -

i have project requires use of pthreads. on own computer, have pthread-win32 setup, , can compile project follows, , have work fine. gcc -o3 engine.c -o engine.exe -lpthread the problem is, want able send .exe else not have gcc, , not have pthreads. tried sending computer of mine, , unable run it, throwing error message lpthreads not being installed. any appreciated, thanks this may generate gigantic .exe , anyway, use static linking... gcc -o3 engine.c -o engine.exe -wl,-bstatic -lpthread note : strange -wl,-bstatic necessary and correctly typed (it's argument linker). you need specify -wl,-bstatic before -lmystaticlibrary may specify library want statically-linked. if want other libraries dynamically-linked, pass -wl,-bdynamic after static libraries. docs ( long , boring ) here .

html - display: none; won't hide the element when used in media query CSS3 -

here's markup looks like: <aside> <div class="widget"> <div class="widget-title"> <h4>general info:</h4> </div> <div class="widget-body"> <p><?php echo $name; ?></p> <p><?php echo $age; ?></p> </div> </aside> this normal style looks like: aside { float: left; width: 20%; background-color: #9d9d9d; border-top: 1px solid #000; } and here media query style looks like: @media (max-width: 610px) { aside { display: none; } } i know syntax right because when use: @media (max-width: 610px) { aside { background-color: red; } } it turns red when rescale. won't go away when use display: none;

Having problems using Google sheet as a source in SSIS -

i able import data google sheet sql server @ 1 point using method detailed in article . google deprecated clientlogin broke method , have been trying functionality , running. i turned using oauth service account try , authenticate google described here cannot work within integration services project. in project create data flow task script component source. use following code in script: using system; using system.data; using microsoft.sqlserver.dts.pipeline.wrapper; using microsoft.sqlserver.dts.runtime.wrapper; using google.apis.auth.oauth2; using google.gdata.client; using google.gdata.spreadsheets; using system.security.cryptography.x509certificates; using google.gdata.extensions; [microsoft.sqlserver.dts.pipeline.ssisscriptcomponententrypointattribute] public class scriptmain : usercomponent { public class scriptmain : usercomponent { listfeed objlistfeed; public override void preexecute() { base.preexecute(); s...

tfs - Bulk delete "Build Failure" items from Backlog -

while weren't watching, our tfs build server generated 200 "build failure in build" items in our product backlog. there simple way bulk remove them? do want destroy these build failure bugs permanently or want remove them backlog? if want destroy them permanently (remove work items team foundation database), can use following code: var tfctc = new tfsteamprojectcollection(new uri("http://tfsservername:8080/tfs/defaultcollection")); var wis = tfctc.getservice<workitemstore>(); var witodelete = new list<int>(); var wiql = "select * workitems [system.teamproject] = 'teamprojectname' , [title] contains 'build failure in build: ' , [state] = 'new' "; var wic = wis.query(wiql); foreach (workitem wi in wic) { witodelete.add(wi.id); } wis.destroyworkitems(witodelete);

javascript - Sails.js - Postgresql Adapter multiple schemas -

i've been searching lot sails.js multi tenancy capabilities , know such feature not yet implemented. initial idea build multi tenant app creating 1 database per tenant. since realized can't such thing in sails.js yet, tried different aproach creating 1 database ( postgres ) lots of schemas, each 1 representing tenant. problem can't/i dunno ( don't know if possible in sails/postgres adapter ) how dynamically ( on runtime ) define schema given object should query aganist, based on logged user. has faced problem this? how can proceed? sorry english , thanks. i thinks issue of waterline sequel adapter, based in answer . the way add property in model meta: { schemaname: 'schema' }, but not working, can't define multiple schemas, takes user schema, if property schema set in true ins config/models.js, definition of schema every table not working.

php - DOMXPath to find specific image tag -

Image
my question direct. here html dom, <html> ... <div class="a b"> <div class="c"> <img src="..." > </div> <div> ... <div class="a"> </div> ... </html> now want image's src in div[class="a b"]-><div class="c">-><img> using domxpath in php code. the main puzzle not know how write it's path correctly. update i have tried how data html using regex , doesn't work still. the actual html structure : my php code: $doc = new domdocument(); $doc->loadhtml($html); $title = $doc->getelementsbytagname('title')->item(0)->nodevalue; $xpath = new domxpath($doc); $vipimg = $xpath->query('//div[@class="show-midpic active-pannel"]/a/div[@class="zoompad"]/img'); var_dump($vipimg); foreach($vipimg $vip) { var_dump($vip); } and o...

swift - frame issue in UINavigationController class when rotating -

i've used custom uinavigationcontroller class put colour gradient across navbar. custom navclass determines frame size of navbar, puts gradient inside. problem is, when rotate portrait landscape, gradient fills portrait portion of landscape bar. i've assigned custom uinavigationcontroller class navigation view in storyboard. so i'm guessing somehow need call refresh frame size in custom navclass when rotation done, i'm not sure how or where? here's relevant code snippet, override func viewdidload() of custom navclass. let gradientlayer = cagradientlayer() gradientlayer.frame = self.navigationbar.bounds self.navigationbar.layer.insersublayer(gradientlayer, atindex: 1) i tried putting inside viewwillappear(), didn't work. help? viewdidload() , viewwillappear() don't called on rotation, code won't update frame there. you should add gradientlayer.frame = self.navigationbar.bounds viewwilllayoutsubviews() leave other code in vi...

javascript - Struts-JQuery Disable drop down option based on a selection of a different drop down -

in jsp have form multiple drop down items. form using struts-tags declaration. on form, want disable 1 or more options of 1 drop down based on selection of separate drop down on same form. here's simple example demonstrate. how have drop downs coded. <s:select id="vehicletype" name="vehicletype" list="#{'0': 'truck','1':'sedan'}" <s:select id="vehiclelist" name="vehiclelist" list="#{'0':'ford f150','1':'dodge ram','2':'honda accord','3':'nissan altima'}" if select "truck" "vehicletype" drop down, want disable both "honda accord" , "nissan altima" "vehiclelist" drop down. if select "sedan" "vehicletype" drop down, want disable both "ford f150" , "nissan altima" "vehiclelist" drop down. try following: ...

python - Syntax explanation: .join(char for char in n if char.isalpha()), return n == n[::-1] -

def palindrome(n): n = n.lower() n = ''.join(char char in n if char.isalpha()) return n == n[::-1] n = ''.join(char char in n if char.isalpha()) return n == n[::-1] can break syntax of these 2 lines down process process? (char char in n if char.isalpha()) pretty says in almost-english: creates generator - kind of unrealised list, can 1 element @ time - yield every char char comes n , if char.isalpha() (i.e. char alphanumeric). thus, n = "the meth" , t , h , e , m , e , t , h , in order (but not space, not alphanumeric). string.join(iterable) can take iterable (like list, or generator), , slap string between each element. if provide empty string, smoosh elements of iterable without in between. themeth - original string cleared of not letter or number. string[from:to:step] way of slicing substrings string (or subarrays array). can leave out part of it: "012345"[1::3] take every 3rd character staring 1st (we...

javascript - How to hold gif animation on website to play in specified section / anchor? -

i ask how hold animated gif start in specified section / anchor. example goods : http://www.visaeurope.com/tokenisation/# i create animated gif in vertical section describe work scheme, i'm affraid other gif (in bottom) started looping before visitor reach section. thank in advanced :) you test if gif element want animate visible on screen (depending on screen scroll) here stackoverflow post show function detect if element visible on screen : check if element visible after scrolling here code : function isscrolledintoview(elem) { var $elem = $(elem); var $window = $(window); var docviewtop = $window.scrolltop(); var docviewbottom = docviewtop + $window.height(); var elemtop = $elem.offset().top; var elembottom = elemtop + $elem.height(); return ((elembottom <= docviewbottom) && (elemtop >= docviewtop)); } after that, listen on scroll event , if element visible, animate it. hope helped, luck mate

Extracting post from database using PHP -

i can , insert text form input, sql database , able retrieve on separate page, when try retrieve on same page form displays blank white page, none of code showing. i enabled decoder, not displaying anything. feel it's because placed block of code in wrong area. anyway, here's code: http://pastebin.com/nwrwg0xj highlighted block i'm having issue with. put div around way, still did not anything. i've tried moving block of code around many times still not achieve anything. you have $template = "anonymous posted: " . $row[0] <br>; it should $template = "anonymous posted: " . $row[0] . "<br>"; and assume want print it, not store in useless variable. should echo "anonymous posted: " . $row[0] . "<br>";

makefile - Does a '%' in a pattern match an empty string? -

from docs : a vpath pattern string containing % character. string must match file name of prerequisite being searched for, % character matching sequence of 0 or more characters (as in pattern rules). now, although, true % match empty string (string of 0 length) in vpath pattern ( vpath % foo ), not true pattern-rules. so, wrong documentation above, equate between them, as: ...the '%' character matching sequence of 0 or more characters (as in pattern rules. as not true, evident following makefile: all :: al%l : @echo '$@' . executing, get: # evident 'all' doesn't match 'al%l' $ make -r make: nothing done 'all'. # but, 'all' match 'al%' $ make -r -f makefile -f <(echo 'al% : ; echo $@') echo all . in fact, documented : for example, %.c pattern matches file name ends in .c . s.%.c pattern matches file name starts s. , ends in .c , @ least 5 cha...

dtmf - Can I send digits to an incoming twilio call with twiml? -

i have twilio number can process incoming calls twiml. these incoming calls expect recipient press digits after call connected. if making outgoing call, use senddigits attribute of <dial> tag. however, can't figure out how in response incoming call. if receiving call in web client, use connection.senddigits is there way in twiml? should play recording file of various dtmf tones? edit: clarify, i'm receiving calls automated system expects additional numbers dialed after call connected. turns out way to using <play> twiml tag, accepts digits attribute. <play digits="94"></play>

ruby on rails - AWS Opsworks : How to deploy a particular git tag for an App? -

aws opsworks lets deploy app. deployment seems deploy master branch always. how can make deploy git tag? thanks have check this? can check branch/revision section showing how can deploy according branch http://docs.aws.amazon.com/opsworks/latest/userguide/gettingstarted-simple-app.html

c# - Linq order by parent and child -

i have 2 tables: feedback , comments. feedback can have many comments. simple parent child relationship. i have page list feedback , related comments this: feedback comment a1 comment a2 feedback b comment b1 feedback c (note: no comments) each feedback , comments have created date. @ moment order feedback date , comment date have newest feedback in top , comments after that. what i'm trying achieve is: when new comment added feedback feedback should displayed in top, no matter how old feedback or if feedback added without comments feedback should first item in list. let's comment added feedback b , after new feedback no comments added, list this: feedback d (this new feedback) feedback b comment b1 comment b2 (this new comment) feedback comment a1 comment a2 feedback c (note: no comments) now feedback d in top of list because has newest date of feedback , comments , feedback b second has comment b2 have second newest date. this code far: _repositorie...

java - incompatible operand types r.integer and int -

i trying compare integer type list , position in spinner. integer list contains list of ids database , spinner contains list of names respect ids. ids , names stored in database, after comparing id list , position spinner, 2 edit text boxes set values corresponding specific id other name. id set auto increment. here mainactivity: public class loginactivity extends appcompatactivity { button b; edittext ed1, ed2, ed3; spinner sp; string url = "https://web.facebook.com/"; string urltest = "http://www.google.com/"; webview wb; database db; string details[]; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); b = (button) findviewbyid(r.id.button1); ed1 = (edittext) findviewbyid(r.id.edittext1); ed2 = (edittext) findviewbyid(r.id.edittext2); ed3 = (edittext) findviewbyid(r.id.edittext3); wb = (webview) findviewbyid(r.id.webview1); sp = (spinne...

javascript - How do I double every other element in an array? -

i need output 2 arrays @ end of program. the first array user inputs. second array should copy elements of first , replace every other element double. user saves "1, 2, 3, 4, 5" first array. second array should have: "1, 4 , 3, 8 , 5". here have far. head tags function todouble(modarray) { var modified = new array(); for(var = 1; < modarray.length; i+=2) { modified.push(modarray[i] * 2); } return modified; } body tags var origarray = new array(); var modarray = new array(); while() //ignore while loop part; working fine { origarray = parseint(prompt("enter number: ")); document.write(origarray); //output 1 modarray.push(origarray); } var modified = todouble(modarray); document.write(modified); //output 2 i'm receiving doubled numbers , not entire array. example, if enter "1, 2, 3, 4, 5", "4, 8" output. how can fix this? thank in advance! do this:- function todouble(m...

hadoop - Extracting Column name from Twitter JSON File -

i trying analyse twitter data using hadoop. have created hive table according tweet had previously. have again downloaded twitter data , problem new columns came in tweet not present in previous tweet data. question is there way can find maximum number of columns tweet can create hive table it. helpless far kindly if have tweets in json format make table in hive using below query create external table tweets ( id bigint, created_at string, source string, favorited boolean, retweet_count int, retweeted_status struct< text:string, user:struct<screen_name:string,name:string>>, entities struct< urls:array<struct<expanded_url:string>>, user_mentions:array<struct<screen_name:string,name:string>>, hashtags:array<struct<text:string>>>, text string, user struct< screen_name:string, name:string, friends_count:int, followers_count:int, stat...

javascript - EXTJS color a cell when Ext.property.Grid filled with content -

i have propertygrid in extjs. want color cell's text when fill content. init method: initgrid : function(propertyvalues){ this.model = ext.decode(propertyvalues); this.flexcolumngrid.setsource({}); for(var in this.model){ //... var value = (this.model[i].value ? this.model[i].value : this.model[i].defval); this.flexcolumngrid.setproperty(this.model[i].key, value, true); } defval default value property. use that, when value empty , there defval property. have value validate method, use that, when property change. it's afteredit event. edit : function(ed,e) { //validate values } i can color cell's text @ method ext.get(e.row.getelementsbytagname('td')[e.colidx]).addcls('x-grid-wrong-value'); where: .x-grid-wrong-value{color:red} //the css but want validate values when grid filled content. how can this? in general should use getrowclass example how this: how change background in row or ce...

sql - Solution to this error -

i have written query: string sql = "update db " + "set lname = '"+txtlname.gettext()+"'," + "atc_code = '"+txtatccode.gettext()+"'," + "atc_name= '"+txtatcname.gettext()+"'," + "course_name = '"+txtcoursename.gettext()+"'," + "course_fee = '"+txtcoursefee.gettext()+"'," + "where fname = '"+txtfname.gettext()+"' "; and got error like: malformed sql statement: expected ',', found 'anuja'`. statement:update db set lname = 'df',atc_code = '323',atc_name= 'sd',course_name = 'd',course_fee = '534',where fname = 'anuja' remove last , set statement: string sql = "update db " + "set lname = '...

github - JSPM and GIT behind Corporate proxy -

we new angular2 development. tried starter projects github failed install on machine. set npm , tsd corporate proxy jspm failed work. have configured http_proxy , https_proxy system environment variables on windows.whenever install using jspm, following error this. error on locate github:components/component_name error: unable verify first certificate also git have executed following command: git config --global http.sslverify false i couldnt figure out solution. or there other way of configuring jspm , git corporate proxy? what worked me using cntlm , setting http_proxy , https_proxy environment variables in windows http://localhost:3128 note: if use gitbash, remember set environment variables there well.

C++ return std::pair<int *,int *>? -

#include <iostream> #include <string> #include <utility> using namespace std; string num1="123456789123456789"; std::pair<int*,int*> cpy(){ int a[(num1.size()%9==0)? num1.size()/9 : num1.size()/9+1]; int b[(num1.size()%9==0)? num1.size()/9 : num1.size()/9+1]; return make_pair(a,b); } int main(void){ return 0; } ------------------------------------------------------- //if style, can compiled std::pair<int*,int*> cpy(){ const int n=5; int a[5]; int b[5]; return make_pair(a,b); } i writing program calculate big number such 19933231289234783278, need split number using 1 000 000 000 system why can't return pair way? you can't return pair way, because passing wrong types. in case, array doesn't decay pointer. if change last line in function : return make_pair(&a[0],&b[0]); it compile, still not work, returning pointers arrays, destroyed, once function cpy() ends. by way, variable lenght...

python 3.x - django oscar core apps confilicts with my local apps -

i have been working on e commerce website. using django-oscar 1.1 this. here installed app looks : installed_apps = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # local apps 'content', 'usermgmt', 'resources', 'assessment', 'analytics', 'utils', # 'notify', # auth related apps 'oauth2_provider', 'social.apps.django_app.default', 'rest_framework_social_oauth2', # rest 'rest_framework', 'djoser', # misc - third party 'reversion', 'corsheaders', 'notifications', #oscar 'oscarapi', ] + get_core_apps() while running server : traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/home/rss-20/.virtualenvs/k...

http - Web service only works when NO port is specified -

i have tool retrieving rss feeds. test, using http://rss.cnn.com/rss/edition.rss . while browser able retrieve feed, tool getting 404. noticed other rss tools failed same error. investigating wireshark logs, noticed difference tool used host: rss.cnn.com:80 while browser used host: rss.cnn.com . and indeed, removing port fixed it. but mean?

ms access - How make appears a field from the field list automatically? -

Image
i started use access vba. have table roles, years , workload of each role in specific year. each record in table idrole, idyear,workload (number). display table in form doing crosstab table years in columns , roles in rows. number of years can increase. my problem when add new years , display in columns, doesn't appear in form have select field list manually know if there way in vba when form load, automatically appears new columns (years). i misunderstood situation. form's crosstab data source table instead of query. , add columns table, want new columns automatically appear in form when next open form. in case, use approach described below, selected query ( query.qryfoo2 ) in source object dropdown, choose table ... table.yourtablename ... in dropdown. the last 2 paragraphs below apply whether data source table or query. if have crosstab query saved named query, can use source object subform control. then when switch design form view, query ...

How can i open this github project in android studio? -

i trying android gallery multiple image picker program. found lots of sample didnt run on android studio. project in link have problem too. how can running project in link? project here you have go on vcs tab in upper part of android studio -> checkout version control -> github. then have use https://github.com/ host, auth type password , username , password of account. after in git repository url have insert https clone url in right part of webpage (in case https://github.com/yazeed44/multiimagepicker.git ). choose parent directory , name of project. done.

javascript - Scatter google chart - string values in Y axis -

since yesterday try draw chart google charts. have 1 problem. tried put strings on y-axis, , script doesn't display anything. i tried code: <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1.1', {packages: ['scatter']}); google.setonloadcallback(drawchart); function drawchart () { var data = new google.visualization.datatable(); data.addcolumn('number', 'document'); data.addcolumn('string', 'term'); data.addrows([ [1 , 'word1'] , [3 , 'word2'] ]); var options = { width: 900, height: 500, chart: { title: 'weight of terms' }, axes: { x: { 0: {side: 'bottom'} } } }; var chart = new google.charts.scatter(document.getelementbyid('scatter_top_x')); chart.draw(data...

php - How do I get the ErrorCode variable value from the response variable after message sending using CURL? -

after executing curl getting $result variable value as: { "errorcode": "000", "errormessage": "success", "jobid": "6878b812-766d-48a2-9dae-2b0edf2d84d4", "messagedata": [{ "number": "919730842844", "messageparts": [{ "msgid": "919730842844-64a40d7611f94c03bea1045fdfa9bac5", "partid": 1, "text": "\u0027messagecontentsmstest\u0027" }] }] } now need check errorcode == 000 , how can value of individually errorcode ? this response received json. so thought decode json_decode: $chk = json_decode($result); echo $chk->errorcode; or can try in way like, $array = json_decode($result, true); echo $array['errorcode'];

Android - How to use DragShadowBuilder? -

i using dragshadowbuilder.java , class sample. i don't know how can use in activity , parameters should send constructor of drawabledragshadowbuilder : public class drawabledragshadowbuilder extends dragshadowbuilder { private drawable mdrawable; public drawabledragshadowbuilder(view view, drawable drawable) { super(view); // set drawable , apply green filter mdrawable = drawable; mdrawable.setcolorfilter(new porterduffcolorfilter(color.green, porterduff.mode.multiply)); } @override public void onprovideshadowmetrics(point shadowsize, point touchpoint) { // fill in size shadowsize.x = mdrawable.getintrinsicwidth(); shadowsize.y = mdrawable.getintrinsicheight(); // fill in location of shadow relative touch. // here center shadow under finger. touchpoint.x = mdrawable.getintrinsicwidth() / 2; touchpoint.y = mdrawable.getintrinsicheight() / 2; mdrawable.setbo...

Javascript For Loop execution on dom element -

this question has answer here: getelementsbyclassname - strange behavior 3 answers i have javascript code elements class name , iterate on remove class elements. var elements = document.getelementsbyclassname("test"); console.log("length " + elements.length) (var i=0; i< elements.length;i++) { console.log("---- "+i) elements[i].setattribute("class",""); } and there 3 span class name "test". html code <span class="test" id="test1">test1 </span> <span class="test" id="test2">test2 </span> <span class="test" id="test3">test3 </span> but getting 2 class removed. second span class still remains there. the console output is length 3 ---- 0 ...

android - custom font in progress bar -

i use custom font in progressbar message "loading" , "sync data, please wait..." change custom font.here code. how can settypeface method change custom font. private void createprogressbar() { if (progressdialog == null) { string msg = "";string title= ""; if (common.languageinfo.equals("local")) { msg = "အလုပ္လုပ္ေနပါသည္";title="တင္ေန..."; }else { msg= "sync data, please wait ..."; title = "loading..."; typeface tf = typeface.createfromasset(context.getassets(), "fonts/" + fontinfo.default_font); } progressdialog = new progressdialog(this); progressdialog.setprogressstyle(progressdialog.style_spinner); progressdialog.settitle(title); progressdialog.setmessage(msg); progressdialog.setcancelable(false); progressdialog.seti...

jquery - Responsive line label for d3js piechart -

currently working on d3js pie chart. i wanted pie chart have responsive line label. can 1 guide me how can achive it. this have tried. when values less label overlaps can see in below link. fiddle var dataset = { apples: [53245, 28479, 19697, 537, 245], }; var width = 300, height = 300, radius = math.min(width, height) / 2; var color = d3.scale.category20(); var pie = d3.layout.pie() .sort(null); var piedata = pie(dataset.apples); var arc = d3.svg.arc() .innerradius(radius - 100) .outerradius(radius - 50); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .append("g") .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")"); var path = svg.selectall("path") .data(piedata) .enter().append("path") .attr("fill", function(d, i) { return color(i); }) ....

reactjs - react-dnd + proxyquire -> Invariant Violation: Could not find the drag and drop manager in the context MyComponent -

i've been using proxyquire stub out sub-components , stores ran invariant violation components wrapped in react-dnd contexts. warning: failed context types: required context dragdropmanager not specified in dragsource(card). error: invariant violation: not find drag , drop manager in context of card. make sure wrap top-level component of app dragdropcontext. read more: http://gaearon.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context i put repo demonstrate error: see https://github.com/cmelion/react-hot-boilerplate/tree/invariant-violation-dnd to run execute npm install npm test while don't understand why, setting "stub['@global'] = true" on stub returned proxyquire triggered invariant violation. not setting @global prevents react.testutils working correctly, again not sure why. the final solution combination of using boolean conditionally set @global , falling good-old queryse...

Github commit not working on desktop app -

i using latest version of github desktop app(3.0.4) on windows 10 machine. recently, not being able make commits. when trying commit, app goes "committing" mode(loading..) , nothing happens. not work when try commit single file also. i wrote github team , had say. it looks you're running out of memory exception: system.outofmemoryexception: exception of type 'system.outofmemoryexception' thrown. unfortunately github desktop have edge cases can cause oom -- when working large amounts of commits or larger files. we're working on fixing performance reduce these edges cases, in meantime try committing directly git shell: hit ~ open repository in git shell run 'git add -a' stage changes run 'git commit -m "your commit message here"' commit changes i haven't faced problem again after updated desktop app(3.0.9.0 now).

html - resizable column borders in footer -

i want have footer tree columns, title each , links under each title.and want have border line in middle of space between columns, want space between columns flexible(some%of whole page width columns stay next each other far possible when window resized) note adding 15% padding doesn't work bc text in each column has length not change resize window(in case dont understand mean try test code before answering question!) css: div.footer{ padding:15px 8%; margin:0px; display:inline-block; } div#footerr{ float:right; } div#footerl{ float:left; } footer{ text-align:center; } and here html <footer> <div class="footer" id="footerr"> <h1>توضیحات</h1> </div> <div class="footer" id="footerc"> <h1>اخبار</h1> <h4><a>این خبر اولین خبر در این سایت است</a></h4> </div> <div class="footer" id="footerl"> ...

sql server - Add columns to query based on previous queries -

this question has answer here: sql server: examples of pivoting string data 6 answers i have 2 tables: +-----------+ | customer | +-----------+ | id | name | +----+------+ | 1 | jack | +----+------+ | 2 | john | +----+------+ +----------------------------------------+ | bill | +----------------------------------------+ | id | customer_id | date | amount | +----+-------------+------------+--------+ | 1 | 1 | 01.01.2015 | 10$ | +----+-------------+------------+--------+ | 2 | 1 | 01.01.2014 | 20$ | +----+-------------+------------+--------+ | 3 | 2 | 01.01.2015 | 5$ | +----+-------------+------------+--------+ | 4 | 2 | 01.02.2015 | 50$ | +----+-------------+------------+--------+ | 5 | 2 | 01.01.2014 | 15$ | +----+-------------+------------+--------+ ...

javascript - Equivalent word boundary regex for unicode characters -

this question has answer here: utf-8 word boundary regex in javascript 5 answers i'm trying match given word (in case, in greek). word boundary \b won't work here, have this: /(?:[\s;.,!?:-_]?)(αυτοκίνητο)(?:[\s.,!?:-_]|$)/gi the problem still match here: aaa ααυτοκίνητο aaaa (notice repeated α) if remove optional ? , not match: αυτοκίνητο aaaa any suggestions? demo (?:^|(?:[ ;.,!?:-_]))(αυτοκίνητο)(?:[\s.,!?:-_]|$) you need remove ? first group.see demo. https://regex101.com/r/ss2dm8/2

ios - How to add PageviewController inside collectionview -

i have uicollectionview inside uiviewcontroller . now, need add uipageviewcontroller inside custom uicollectionviewcell created. how can ? here's approach. uiviewcontroller.h class -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath{ pviewcollectionviewcell *cell=[collectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath]; [cell.pageviewcontroller addtarget:self action:@selector(changed:) forcontrolevents:uicontroleventtouchupinside]; return cell; } pviewcollectionviewcell.h class #import <uikit/uikit.h> @interface pviewcollectionviewcell : uicollectionviewcell <uipageviewcontrollerdatasource> @property (strong, nonatomic) iboutlet uiimageview *pagebannerimageview; @property (strong, nonatomic) iboutlet uipagecontrol *pageviewcontroller; - (ibaction)pageviewchanged:(id)sender; @end you asking "h...

javascript - How to know whether PartialView is loaded by JQuery? -

my goal simple - add image in next empty div. example, have 3 divs. if first div not empty, add image second div. so, have simple view: <div id="imagedivf"></> <div id="imagedivsecond"></> <div id="imagedivt"></> a simple partial view: <img id="hello"/> ajax code loads partial view div: $(document).ready(function () { datatype:'json', url: '/home/uploadfiles', autoupload: true, done: function (e, data) { if ($("#imagedivf").has("img").length==0) { $('#imagedivf').load('/home/imagepartialview', { address: data.result.name }); // in next row check whether #imagedivf contains image //i should check whether #imagedivf contains image decide whether necessary put image next empty div //pseudo code: if(#imagedivf) not contain image, image should inserted next div #imagedivsecond } how check whether ...

ibm mobilefirst - Protecting Java Adapter -

we making java adapter, , want protect customauthenticator , customloginmodule. we started sample project got from: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/authentication-security/custom-authenticator-login-module/custom-authenticator-login-module-hybrid-applications/ we added simple java adapter. then, in client code, modified getsecretdata() function in main.js calls /adapters/javaadapter/users instead of original /adapters/dummyadapter/getsecretdata . finally, added @oauthsecurity(scope="customauthenticatorrealm") annotation adapter's hello() function. but clicking "call protected adapter proc" button returns data hello() without authentication . what should authentication works java adapter calls? it means client (browser? emulator? device?) still has valid session id server, time tested javascript adapter. i've tried scenario , experienced same thing. able correct behavior clearing ...

tsql - TRIGGER AFTER UPDATE - Get updated data -

i discovering dml triggers in sql server. created trigger registeres inserts 1 table in table. same update statement. my insert trigger: create trigger trgsuppliersloginsert on production.suppliers after insert begin insert [production].supplierslog (supplierid, [action], companynamechangedto, contacnamechangedto, contacttitlechangedto, addresschangedto, citychangedto, regionchangedto, postalcodechangedto, countrychangedto, phonechangedto, faxchangedto) select supplierid, 'insert', companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax inserted end go i tried doing same update: create trigger trgsuppliersloginsert on production.suppliers after update begin insert [production].supplierslog (supplierid, [action], companynamechangedto, contacnamechangedto, contacttitlechangedto, addresschangedto, citycha...

android - MvxWindowsSetup or MvxStoreSetup cannot be resolved -

i started windows10 universal project, aswell xamarin. added current prerelease of mvvm cross project. on android project works without problem. on windows side can't resolve setup symbol. afaik needed start application. references set via nuget android project windows. looks on windows project reference platform missing. the code open source on github: https://github.com/npadrutt/moneymanager/tree/mvx can me? thanks npadrutt edit: suggestion of stephanvs use beta1 1 part of solution. other install mvvmcross.libraries instead of mvvmcross nuget package. this fixed in https://github.com/mvvmcross/mvvmcross/pull/1101 , https://github.com/mvvmcross/mvvmcross/pull/1109 the mvvmcross 4.0.0-beta3 released soon.

ios - How to take snapshot of app running on simulator? -

i used code take snapshot of app running on simulator, quality of snap not good, idea? -(ibaction)btnsave:(id)sender { uigraphicsbeginimagecontextwithoptions(self.view.bounds.size,self.view.opaque,10.0f); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage * screenshot = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); /* render screen shot @ custom resolution */ cgrect croprect = cgrectmake(0,0,320,500); uigraphicsbeginimagecontextwithoptions(croprect.size,brochuresave.opaque,10.0f); [screenshot drawinrect:croprect]; uiimage * customscreenshot = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); /* save photo album */ // uiimagewritetosavedphotosalbum(customscreenshot , nil, nil, nil); [self.library saveimage:customscreenshot toalbum:@"cemara roll" withcompletionblock:^(nserror *error) { if (error!=nil) { nslog(@...

sql server - Insert into different tables depending on parameter value -

i have stored proc this: create procedure [dbo].[insertinput] (@resourcetag int, @element varchar(50), @periodid int, @backpay varchar(50), @inputvalue decimal(18,5), @userid varchar(50), @source varchar(50), @inputdate datetime, @sourceid int, @comments varchar(200), @processid int, @tablecode int, @scopeid int = null output) begin insert [dbo].[input] ([resource tag] ,[element] ,[period id] ,[back pay], [input value], [user id], [source], [input date], [source id], [comments], [process id]) values(@resourcetag, @element, @periodid, @backpay, @inputvalue, @userid, @source, @inputdate, @sourceid, @comments, @processid) set @scopeid = (select scope_identity()) end now have added parameter @tablecode, , depending on value, above insert statement should go different tables. example, if @tablecode = 0, insert [dbo].[input]... if @tablecode = 1, insert [dbo].[input1]... so tried adding case statement snippet: insert case when @tablecode = 0 [dbo].[input] ([resource tag] ,[...

How to use TextBox text in c++ form? -

i want know there knows how can assign textbox text in c++ windowsform string? in c# it's example: string name; name=textbox1.text; but in c++ don't know how works. i've tried this: string name; name = name_2door_txt->text; but visual give me error: intellisense: no operator "=" matches these operands operand types are: std::string = system::string ^ and need string. please help? please include following header file #include <msclr\marshal_cppstd.h> then try msclr::interop::marshal_context context; std::string std_string= context.marshal_as<std::string>(name_2door_txt->text); if want convert managed string system::string^ managed_string = name_2door_txt->text;

android - How to receive notification regarding the BT connection states -

i trying receive notifications when connection state changed "connecting,connected,disonnectig,disconnected". registered action_connection_state_changed, receive log in "default" statement of "switch-case". please let me know how receive notified correctly regarding states mentioned in switch-case in below code? code : final int connstate = intent.getintextra(bluetoothadapter.extra_connection_state, bluetoothadapter.error); switch (connstate) { case bluetoothadapter.state_connected: log.d(tag, logand.show("onreceive", "bluetoothadapter.state_connected")); tvstatus.settext("bt state_connected."); break; case bluetoothadapter.: log.d(tag, logand.show("onreceive", "bluetoothadapter.state_connected")); tvstatus.settext("bt state_connected."); break; ...

wordpress - woocommerce stock, multiple products from same stock -

i'm building woocommerce webshop. it's webshop phonecases , customer wants keep inventory in woocommerce backoffice, there 1 problem: they have different models example iphone 4 & iphone 5. in fact these same cases. added separate products woocommerce. what want there 2 different products have combined inventory. for example, brown iphone 4 case sold, after brown iphone 5 case. means there stock value changes -2. , if stock 0 both products change status "sold out". i can't seem think of anything, have idea? the webshop can found here : http://itzbcause.nl woocommerce has option. add variable products. add iphone 5s 1 variant , iphone 6s another. under inventory tab, enable manage stock , enter total amount of stock. note: not manage stock under variable tab. that's now, expected, iphone 5s + iphone 5s = your stock . can add title "iphone 5s or iphone 6s".

Can php be injected, just like sql? -

i wondering, whether if php can injected way mysql can injected. have rough idea of how sql injection done, , have carried out in development environment. wondering if php injected. though myself have gut feeling not case since if tried more trying inject mysqli prepared statement. and no! not talking injecting javascript input talking plain php-html injection through input/get/post . like stopping current php code execution , inserting own code in between. yes, might possible. if use eval() or output buffering generating output , not escape values stored in database before feed template parser, php code within might executed. if use plain php in templates risk rather high.

java - Dialog Box Input/Output assistance -

the question is: write program prompts user input number. program should output number , message whether number positive or negative or zeros. what have far this: import javax.swing.joptionpane; import java.util.*; public class problem1 { public static void main(string[] args) { scanner scan = new scanner(system.in); string str; int num; str = joptionpane.showinputdialog("enter number "); num = scan.nextint(); str = "the number " + num; if (num >= 1) joptionpane.showmessagedialog(null, str, "you have entered positive integer", joptionpane.plain_message); else if (num <= -1) joptionpane.showmessagedialog(null, str, "you have entered negative integer", joptionpane.plain_message); else joptionpane.showmessagedialog(null, str, "you have entered zero", joptionpane.plain_message); system.exit(0); } } i can input number can't see end result. please me ...

Android: Base Adapter Weird Null Pointer -

sorry title issue cannot seem summarise so made class extends autocompletetextview i made base adapter class implements filterable interface i set adapter i null pointer when getcount called states array list null. things weird this base adapter constructor public piecesearchadapter(context context, arraylist<food> food) { mcontext = context; mfoods = new arraylist<>(); mfoods.addall(food); } the above have after diagnosed issue so impossible array list null now @override public int getcount() { return mfoods.size(); } the null pointer still occurs so debugged @ point in base adapter constructor. items passed in not null , contain items. i not sure issue is. stack trace: java.lang.nullpointerexception @ redacted.foodsearchadapter.getcount(piecesearchadapter.java:36) @ android.widget.autocompletetextview$popupdatasetobserver$1.run(autocompletetextview.java:1291) @ android.os.ha...