Posts

Showing posts from June, 2010

packagist - Is there some public mirror for composer packages? -

my company's ips range seems blocked packagist.org's hosting service , can't reach domain. i've contacted them don't know how long take remove blockage. moreover, every external web proxy try use falls company's firewall i'm stuck. is there public mirror composer packages don't have depend on packagist.org domain? any other solution welcome well. i couldn't find public mirror able solve packagist.org dependency editing ~/.composer/config.json , adding dependent projects' github links repositories, eg: { "repositories": [ { "type": "vcs", "url": "https://github.com/smarty-php/smarty" }, { "type": "vcs", "url": "https://github.com/sebastianbergmann/phpunit" }, { "type": "vcs", "url": "https://github.com/sebastianbergmann/php-code-coverage" }, { "type": &qu

transformation - CTM transforms vs Affine Transforms in iOS (for translate, rotate, scale) -

i read through transforms documentation in quartz 2d programming guide. in there appears 2 ways make transformations. 1 way through modifying current transformation matrix (ctm). has methods following: cgcontexttranslatectm cgcontextrotatectm cgcontextscalectm the other way use affine transforms. has methods following: cgaffinetransformtranslate cgaffinetransformrotate cgaffinetransformscale the docs state the affine transform functions available in quartz operate on matrices, not on ctm. but don't understand how affects me practically. seems can same result using either method. when should use ctm transforms , when should use affine transforms? ctm current transformation matrix , ctm methods make operations on current matrix. the other version of functions make transformation on given matrix means need specify matrix trying transform. after did may apply transform ctm way want or use other purpose. for instance these 2 operations same: c

Calculating RMS using fixed point math (C) -

i trying calculate rms value of waveform running problems. i take samples every x microseconds triggered interrupt. sample stored in array , each time sample taken pushes last value next point in array , feeds new value in. take sample square , divide 20 (number of sample per period, assume waveform fixed frequency) put array, add sum value , when reach 20 samples subtract first sample made , add last sample made. value 20 = value 19 //int16 values value 19 = value 18 ... value1 = (sample * sample)/20 sumvalue += value1 sumvalue -= value20 i call rms function takes value, divides last calculated rms value (or if not calculated yet divide 1) add last rms value divide 2. calcrms(sumvalue) int32 tempsum if(rms) tempsum = (sumvalue/rms + rms)/2 else tempsum = (sumvalue + 1)/2 rms = tempsum i output rms screen. problem rms value keeps changing, though waveform constant. if run dc value in there rms stays steady shove in sine wave , goes crazy. hoping can point me in right

javascript - how to return object from protractor -

i have written following code return text table. now, want thing in here: dnassgn page name, after calling function return value coming blank. please suggest me wrong. fetch_text_from_cell_in_table: function(col_val){ var name_var=""; var km = 0; var dm = 0; pointer1 = element.all(by.repeater('row in renderedrows')).then(function(posts) { (ni = 0; ni < posts.length; ni++) name_var= posts[ni].element(by.classname(col_val)).gettext().then(function(name){ //console.log(valdation_value); console.log(col_val); console.log(name); var name_var = name.trim(); return name; }); }); return name_var; }, var dn_num=dnassgn.fetch_text_from_cell_in_table('colt0'); expect(dn_num).tobe('not found'); first of all, not returning function. besides, understand, need filter table , text values of cell in specific column (cell having specific class name, e.g. colt0 ). use map() : function fetch_text_

android - ADB and Genymotion error: "adb server is out of date. killing... cannot bind 'tcp:5037' ADB server didn't ACK" -

Image
trying use adb shell terminal after starting genymotion emulator , error: adb server out of date. killing... cannot bind 'tcp:5037' adb server didn't ack * failed start daemon * error: i read in this answer on stackoverflow run command killall -9 adb so did , says change genymotion settings use custom android sdk tools following: also did can see in above screenshot still keep getting same error message. my android studio adb logs give following message whenever try run adb shell : devicemonitor: adb connection error:eof devicemonitor: connection attempts: 1 i tried creating new virtual device , using without success. update adb 1.0.32 if have 1.0.31 or lower adb version android debug bridge version 1.0.31 wget -o - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb sudo mv adb /usr/bin/adb sudo chmod +x /usr/bin/adb adb version android debug bridge

How to get data of a youtube playlist in JSON format using JavaScript API V3 -

youtube stopped support v2 i'm using till now, can tell me how data of youtube playlist in json format using javascript api v3 v2 url used given below http://gdata.youtube.com/feeds/api/playlists/ {playlist_id}?alt=json-in-script&callback=showmyvideos resolved v3 url https://www.googleapis.com/youtube/v3/playlistitems?part=snippet&maxresults=50&playlistid= {playlist_id}&key={key} there number of sample applications javascript v3 client library can found here: https://developers.google.com/youtube/v3/code_samples/javascript the call after playlistitems:list , can seen here: https://developers.google.com/youtube/v3/docs/playlistitems/list and can called using: get https://www.googleapis.com/youtube/v3/playlistitems?part=snippet&id=your-playlist-id&key={your_api_key} something along these lines details of first 50 records in specified playlist using javascript client library. result stored in response object. <!doctype html

java - Understanding how to decouple -

i've been trying keep coupling down in code, think may not understand it. basic understanding coupling "how dependent classes on each other , know behavior of each other." know dependency injection 1 way reduce coupling , ioc. the following quick example came of student, professor, , course. course has list of students , professor. have controller (using mvc) injects student , professor objects. following still considered coupled, or tightly coupled? example of di, correct? student class public class student { private string firstname; private string lastname; private int studentid; private int address; private int telephone; public string getfirstname() { return firstname; } public void setfirstname(string firstname) { this.firstname = firstname; } public string getlastname() { return lastname; } public void setlastname(string lastname) { this.lastname = lastname; } public int getstudentid() { return studentid; } public void setstudentid(int

c# - LibGit2Sharp get repository changes after pull -

how can following information after git-pull libgit2sharp: which files has been moved which files has been created which files has been deleted the git-pull request self works perfectly: var result = repo.network.pull(new libgit2sharp.signature("admin", "mail@......net", new datetimeoffset(datetime.now)), options); i looked @ result of pull -method, seems not contain needed information. thank much! the mergeresult type exposes commit property not null when merge successful. in order find out files have changed, 1 have leverage repo.diff.compare() method compare commit first parent.

javascript - Use custom image for google signin button -

i want provide users facility sign in google. however, want use image(only image, no css) "sign in google" button. using following code: <div id="mysignin"><img src="images/google.png" alt="google"/></div> i using gapi.signin.render function mentioned on google developer console. code is: <script src="https://apis.google.com/js/client:platform.js" type="text/javascript"></script> <script> function render(){ gapi.signin.render("mysignin", { // 'callback': 'signincallback', 'clientid': 'xxxx.apps.googleusercontent.com', 'cookiepolicy': 'single_host_origin', 'requestvisibleactions': 'http://schema.org/addaction', 'scope': 'profile' }); } the problem google signin popup not opening , cannot figure out how solve it. please suggest. in advance. <script type="

how to tell if user responded to my facebook request? -

i don't understand should after invitable friends call. procedure till im stuck: i have facebook canvas app, app ios/android native canvas redirection only. https://developers.facebook.com/docs/games/invitable-friends/v2.0 according this: *. list of friends when call (i did it) *. tokens, when press friend, token entering array later used "to" in javascript api *. press send , invite. ok see this: rewarding sender 1)upon sending request, store request id returned in response game request dialog , match upon receipt reward sender. 2)read requests receiver , reward sender based on id in "from" field. what exact way 2 ( 'and match upon receipt reward sender' <- , hell mean? )?

upgrade steps from DataStax Enterprise 4.6.1 TO DataStax Enterprise 4.7 with Cassandra 2.1 -

i'm new cassandra, can 1 provide steps upgrade datastax enterprise 4.6.1 datastax enterprise 4.7 cassandra 2.1 this should you'd go: http://docs.datastax.com/en/upgrade/doc/upgrade/datastax_enterprise/upgradedse47.html since you're new cassandra, suggest reading docs on , on - doing in test environment first. while upgrades straight forward (depending on node count , amount of data), there's no real easy way of reverting cassandra 2.1 (dse 4.7) cassandra 2.0 (dse 4.6). make sure have snapshots of sstables dse 4.6 before proceeding.

storing data - How to correctly store and process different measure units of ingredients in food service CMS? -

i have backend system restaurants & food services. on front end people using huge variety of measure units recipes , such (kilo, cup, gallon, pint, small spoon, big spoon, pinch of salt, dash of pepper , on). need convert small , indivisible make calculations, reports , analytics , backend. however, show info , reports user have convert stuff backwards 'user-friendly' measure units. thus can lead errors in numbers (round-off errors , such). what best practice deal that? thank you!

ember.js - Execute JQuery code after view has changed -

i'm using foundation tooltips on page query-parameters - control elements displayed, acts filter basically. when user change filter , new elements displayed tooltip stops work needs reattached new elements - $(document).foundation('tooltip', 'reflow'); wonder correct way execute code after view re-rendered. for sure must go view layer, can't find appropriate event http://emberjs.com/api/classes/ember.view.html#events i can think of few ways export default ember.route.extend({ queryparams: { <name-of-query-param>: { refreshmodel: true } } or have trigger this.refresh() on route . or in controller, observe query param , execute event in loop

javascript - <body onresize="jsUpdateSize()"> not firing -

i'm learning develop sharepoint 2013. have created custom master page , added script element, seen below. function jsupdatesize() { // dimensions of viewport var width = window.outerwidth; if (width >= 1280) { document.getelementbyid('span_title').innerhtml = 'full title'; document.getelementbyid('span_author').innerhtml = 'full author'; } else { document.getelementbyid('span_title').innerhtml = 'short title'; document.getelementbyid('span_author').innerhtml = 'short author'; } }; this called in body tag, both onload , onresize. <body onload="jsupdatesize()" onresize="jsupdatesize()"> the onload call works correctly. if change browser width , refresh page appropriate text. unfortunately not whilst re-sizing browser. i have tried adding window.onload = jsupdatesize; // when

winforms - Image Saving issue from Windows application c# -

i have developed win apps save images in specific folder our exe run from. below used save images protected string getpath(string strfilename) { string strpath=system.environment.currentdirectory+@"\ups\labelimages\"; if (!system.io.directory.exists(strpath)) { system.io.directory.createdirectory(strpath); } strpath = strpath + strfilename; return strpath; } the issue time win apps throwing execption access path 'c:\windows\system32\ups\labelimages\' denied suppose application installed inside c:\programfiles32 , throw kind of error c# exe file. tell me best option save image files result no user exception or error access path 'c:\windows\system32\ups\labelimages\' denied looking suggestion. i'd recommend saving files in safer location, such special folder application data: var safefilepath = path.combine(environment.getfolderpath( environment.specialfolder.applic

jquery - Assigning ID's to dynamic elements which can be added or removed -

i have web interface users can click on 'add item...' button , div appended: $('#item-list').append('<div id="newid" class="item">new item</div>'); as user may create number of these items, must assign unique id each one, have tried following: var idnumber = $('.item').length + 1; $('#item-list').append('<div id="' + idnumber + '" class="item">new item</div>'); this works fine part except 1 important thing: user can delete 1 or more of these items well. introduces possibility of duplicate ids. for example: i have 5 items ids 1,2,3,4 , 5. delete item 3, when create next item counts 4 items , gives new item id count + 1 5 (duplicate). how go resolving issue? usual procedure in situation? try: var lastid = 0; $('.item').each(function (el) { var id = parseint($(this).attr('id').splice(1), 10); if (id > lastid) {

asp.net - PageRequestManagerServerErrorException, typing xml inside a textArea control on C# -

i'm trying have xml text (actually <? breaks already) inside textarea show user, not edit. looks on postback press save button save other control values, on browser console: uncaught sys.webforms.pagerequestmanagerservererrorexception: sys.webforms.pagerequestmanagerservererrorexception: unknown error @ processing... response: 500 the code never reaches load of page postback, don't think it's not error on code. i tried add validaterequest="false" in <%@ page directive didn't work out. is there way show user xml text without having postback blow away?

html - Firefox not recognizing background-size: cover with Cycle2 Slider injections -

so i'm using cycle2 slider , seems slider notorious injecting bad inline styles. to combat have added inline styles !important: <!-- begin .item --> <div id="fullbanner" class="item contain" style="background-image: url('{{ 'slider-item-4.jpg' | asset_url }}'); background-size: contain !important;"> <!-- end .item --> </div> these styles override background size in main rule .main-slider .item { height: 450px; width: 100%; background-position: top center; background-repeat: no-repeat; background-size: cover;} i use cover first 2 slides, , want use contain third. i've tried adding class called contain background-size: contain !important no luck.. you can see slider live http://cirrusfitness.com on 3rd slide (fathers day image). when resize browser in chrome, safari , ie image adheres contain rule not when resizing in firefox... it appears neither cover initia

c# - What is this line of code asking? -

this question has answer here: what question mark , colon (?: ternary operator) mean in objective-c? 12 answers public schedule schedule { { return (contractconsignee == null ? null : contractconsignee.schedule); } set { if (contractconsignee == null) { contractconsignee = new contractconsignee(session); contractconsignee.assignments.add(this); } contractconsignee.schedule = value; } } someone else wrote code. trying solve bug in our system. i'm not familiar with: == null ? null : contractconsignee.schedule ? : conditional operator . if contractconsignee null , getter returns null ; otherwise, return contractconsignee.schedule .

java - Android must implement the inherited abstract method -

i have downloaded project function works well, when coppied function project, errors : the type new asynchttpresponsehandler(){} must implement inherited abstract method asynchttpresponsehandler.onsuccess(int, header[], byte[]) the method onsuccess(string) of type new asynchttpresponsehandler(){} must override or implement supertype method the method onfailure(int, throwable, string) of type new asynchttpresponsehandler(){} must override or implement supertype method i tried tips this question nothing helped. possible solution ? public void syncsqlitemysqldb(){ //create asychttpclient object asynchttpclient client = new asynchttpclient(); requestparams params = new requestparams(); arraylist<hashmap<string, string>> userlist = controller.getallusers(); if(userlist.size()!=0){ if(controller.dbsynccount() != 0){ prgdialog.show(); params.put("usersjson", controller.composejsonfromsql

Android: How can I implement these design components? -

for last 2 days i've been intensely researching android design components. i've learned much. however, i'm baffled how design components implemented app featured in following 2 videos. the first video demonstrates persistent toolbar @ bottom app screen new activities called. https://drive.google.com/file/d/0b0pjd0isytl-ndg4dglzumxfx2s/view?usp=sharing this video shows app lifting apparent toolbar morphs beautiful display. https://drive.google.com/file/d/0b0pjd0isytl-aksydnmzq2kwmk0/view?usp=sharing please, know how can done. link tutorial awesome telling components use.

swift - Error: Immutable value passed on reduce function -

i'm trying following code transforms array of tuples dictionary i'm receiving compile error saying: immutable value of type '[string : string]' has mutating members named 'updatevalue' var array = [("key0", "value0"), ("key1", "value1")] var initial = [string: string]() var final = array.reduce(initial) { (dictionary, tuple) in dictionary.updatevalue(tuple.0, forkey: tuple.1) return dictionary } why if initial declared var ? have @noescape on reduce's signature? func reduce<u>(initial: u, combine: @noescape (u, t) -> u) -> u you can make dictionary parameter mutable preceding var : var final = array.reduce(initial) { (var dictionary, tuple) in ^^^ note using reduce new dictionary created @ each iteration, making algorithm inefficient. might want consider using traditional foreach loop

Outlook 2013 VBA Public Variable Doesn't Persist -

at top of thisoutlooksession define: option explicit public vartest long i have couple of test programs in thisoutlooksession. using debug run test3 program: sub test3() vartest = 42 end sub i run test3b, instead of vartest displaying value of 42, value shows zero. sub test3b() msgbox vartest end sub obviously have misconception scope or persistence. doing wrong? after more searching, found following sue mosher, outlook mvp : remember thisoutlooksession class module . you need add @ least 1 regular code module project , declare global variables in it , not in thisoutlooksession, using public keyword instead of plain old dim sure enough when move public variable definitions module, persistence issue resolved.

linux - GNU Parallel - redirect output to a file with a specific name -

in bash running gnupg decrypt files , output redirected file having same name, different extension. basically, if file named file1.sc.xz.gpg the file comes out after running gnupg tool stored inside file called file1.sc.xz i trying find . -type f | parallel "gpg {} > {}.sc.xz" but results in file called file1.sc.xz.gpg.sc.xz. how can this? later edit: inside 1 single bash command, without knowing filename in advance. you can use bash variable expansion chop off extension: $ f=file1.sc.xz.gpg $ echo ${f%.*} file1.sc.xz e.g.: find . -type f | parallel bash -c 'f="{}"; g="${f%.*}"; gpg "$f" > "$g"' alternatively, use expansion of parallel : find . -type f | parallel 'gpg "{}" > "{.}"'

php - Password protected website -

so want make password protected website , works 1 time website cannot abused , admin me have access generate password without people cannot access index of site , please? you need delete password after used view page, oder add column used tinyint , when used=0 password used view page. when used=1 has used, not valid. the comparison need done in sql validates it. the changing of used or remove of password needs done directly after has been validated. add code answer better , know done till time.

html - Navbar collides with text -

so i'm creating simple blog-like website record activities summer, , need help. i've created dropdown navbar, runs tag. need move upwards line doesn't run tag. first post on stackoverflow i'm not allowed post pictures, can link picture on imgur. http://imgur.com/u0mtso1 here's html navbar <nav> <ul id="menu"> <li><a href="index.html" id="selected">home</a></li> <li> <a href="why.html">about</a> <ul class="hidden"> <li><a href="why.html">why it</a></li> <li><a href="future.html">future plans</a></li> </ul> </li> <li> <a href="#top">archive</a> <ul class="hidden"> <li><a href=&qu

javascript - SAILS.JS : Asked about using js, css in each page sails.js -

i have many files css, js different each different page. if put entire asset in sail.js forder layout. not want that, want able manage files css, js used in particular page. if css, js put layout.js general, separately, included in page please support me on issue

Trying to align upload button with a Textarea in HTML and CSS -

i'm making webpage 1 of projects , i'm trying align upload buttons beside text field. maybe better explained picture. can see 2 buttons aligned on bottom left of submit button. want aligned on left of device id text field. i've tried setting display attributes text field, 2 buttons didn't work. tried setting float properties, didn't work. looking @ grids possibly use purecss.io, i'm not sure if fix problem. i've tried using vertical-align attribute, still no dough. i'm using plain bootstrap theme. html skills pretty basic coming java. know can here? here main container: <div class="container"> <!-- main content here --> <div id="main"> <h1 id="mainheader">send image wearable device</h1> <hr> <form method="post" action="/gcm/gcm.php/?push=true" onsubmit="return checktextarealen()">

android - how to create ripple effect for pre-lollipop -

how apply ripple effect this i have put dependencies in app/build.gradle app/build.gradle dependencies { compile 'com.github.traex.rippleeffect:library:1.3' } build.gradle allprojects{ repositories{ jcenter() maven(url "https://jitpack.io" } xml file: <com.andexert.library.rippleview android:id="@+id/rect1" android:layout_width="match_parent" android:layout_height="wrap_content"> <button android:id="@+id/enterbutton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="save user name" /> </com.andexert.library.rippleview> java class file protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.save_user); edittext=(edittext) findviewbyid(r.id.usernameedittext); button=(button) findv

javascript - Speed up server response for POSTing JSON to an Express.js server -

i trying post base64 string canvas express.js server, console log of post/ takes forever , never logs json content posted. this use on client: saveimage: function(e) { var canvas = document.queryselector('#canvaselement'); var base64 = canvas.todataurl(); $.ajax({ type: 'post', url: '/', contenttype: 'application/json', data: base64, success: function(e){ console.log('success', e) } }); } ...then on server: var express = require('express'), app = express(); app.use(bodyparser.json()); app.post('/', function (request, response) { console.log(request.body); });

javascript - Valid JSON data cannot be parsed -

i'm new javascript , stuck strange problem. when try parse json data variable, variable becomes undefined. my code: document.getelementbyid('searchplayerform').onsubmit = searchplayer; function searchplayer() { var request = new xmlhttprequest(); request.open( "get", '${url}' + '/' + document.getelementbyid('playerid').value, true ); request.setrequestheader('accept', 'application/json'); request.onload = responseavailable; request.send(); return false; } function responseavailable() { switch (this.status) { case 200: alert(this.responsetext); var playerresource = json.parse(this.responsetext); alert(playerresource.name); ... the first alert returns: {"playerid":49,"lastname":"xxx","firstname":"walter","ad

Import google spreadsheet data to google doc app script -

i trying google app script import google spreadsheet data google doc. haven't found in checking api. possible import data doc? how? function createdocfromsheet(){ var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.setactivesheet(ss.getsheets()[2]); var values = ss.getdatarange().getvalues() for(n=2;n<=values.length;++n){ var cell = sheet.getrange(n,3).getvalue(); var row = sheet.getrange(n,2,1,5).getvalues(); var newdoc = documentapp.create(cell); var body = newdoc.getbody(); body.insertparagraph(0,row); newdoc.saveandclose(); } }

php - Adding a user in wordpress with wp_insert_user doesn't work -

i'm trying programmaticaly insert user in wordpress using form input account details. code looks this: $userdata = array( 'user_login' => $_post["post_email"], 'first_name' => $_post["post_voornaam"], 'last_name' => $_post["post_achternaam"], 'user_email' => $_post["post_email"], 'user_pass' => $_post["password_confirm"] ); $user_id = wp_insert_user( $userdata ) ; add_user_meta( $user_id, 'klant_id', $klant_id ); as see i'm using user meta field after create account. sadly none of works. have idea why failing? it doesn't seem return errors either. make sure of post values. var_dump($_post). if have of post values,then try get_error_message() function errors messages while inserting user. $userdata = array( 'user_login' => $_post["post_email"], 'first_name' =&g

c++builder - Alternative to symlink in C++ Builder -

i'm trying integrate c code written unix in c++ builder. part of code using function symlink : if(!fname || (use_real_copy ? real_copy(path, fname) : symlink(path, fname)) i don't know how replace works in c++ builder windows 64 bits, i've found functions createsymboliclinkw , createsymboliclinka seem equivalent windows c++ builder can't find them. do have idea of how can around problem? thank you. createsymboliclink() declared in winbase.h , #include 'd windows.h , #include 'd vcl.h in vcl-based projects. if not creating vcl project, make sure have #include <windows.h> statement in code. either way, make sure _win32_winnt defined @ least 0x0600 (vista+). if compiler still complains createsymboliclink() undefined must using old version of c++builder ( createsymboliclink() added c++builder's copy of winbase.h in c++builder 2007), in case have declare createsymboliclink() manually in own code, eg: #define symbolic_link

python - [Caffe]: Check failed: ShapeEquals(proto) shape mismatch (reshape not set) -

i have error , have tried take in internet got nothing clear. i trained net caffe around 82% of accuracy. now i'm trying try image through code: python python/classify.py --model_def examples/imagenet/imagenet_deploy.prototxt --pretrained_model caffe_mycaffe_train_iter_10000.caffemodel --images_dim 64,64 data/mycaffe/testingset/cat1/113.png foo --mean_file data/mycaffe/mycaffe_train_mean.binaryproto yes, images 64x64, these last lines i'm getting: i0610 15:33:44.868100 28657 net.cpp:194] conv3 not need backward computation. i0610 15:33:44.868110 28657 net.cpp:194] norm2 not need backward computation. i0610 15:33:44.868120 28657 net.cpp:194] pool2 not need backward computation. i0610 15:33:44.868130 28657 net.cpp:194] relu2 not need backward computation. i0610 15:33:44.868142 28657 net.cpp:194] conv2 not need backward computation. i0610 15:33:44.868152 28657 net.cpp:194] norm1 not need backward computation. i0610 15:33:44.868162 28657 net.cpp:194]

excel - Horizontal Index Match (returning column header) -

Image
b c 1 fruit color meat <- column header 2 banana red pork 3 apple black chicken 4 orange white beef from table1 above table2 below: b 1 name what? <- column header 2 banana fruit <- formula should return these values, based on table 1 3 red color 4 beef meat 5 pork meat looking formula return corresponding column name in b2,3,4... tried =index(table1[#headers],match(j:j,table1,0)) it seem 3 columns unique; e.g. there never beef in color column. in case can query each column, passing 1, 2 or 3 case may be. =iferror(index(table1[#headers], isnumber(match([@name], table1[fruit], 0))*1+ isnumber(match([@name], table1[color], 0))*2+ isnumber(match([@name], table1[meat], 0))*3), "no column")      i'm not sure whether port intentional misspelling demonstrate occurs when there no match.

java - Override Jersey 2 invocation behavior -

we have existing implementation of software-level load balancing we'd migrate jersey 2. in jersey 1, needed extend com.sun.jersey.api.client.client , handle() method. we've implemented builder return subclass. execution of of rest methods automatically execute overriden method. any recommendation where's best place same in jersey 2? we're looking @ clientruntime's invoke() or jerseyinvocation's invoke() seem not extensible.

python - How to create polygons with arcs in shapely (or a better library) -

Image
i trying use shapely identify area used shape , area used tools cut on cnc router. shape imported dxf drawing using ezdxf . the tool paths can either rectangles (if cut saw disk follows straight line) or set of segments (if routed milling bit). in both cases can use linestring.buffer() automatically create offsets , find area used tool. i using shapely because think best tool available find out if shapes overlap each other (using union() merge tools 1 shape , overlaps() find interference). please let me know if there better tool purpose. buffer() job @ creating segments represent arcs on corners. is there way create segments represent arcs on shape itself? for example, how create arc on left of shape? need create own (slow) python function? or there optimized shapely way? creating own way of making arc in python isn't slow. numpy excellent operations along these lines, , shapely deliberately intended interoperate numpy. for example, import numpy np

javascript - createElement auto listeners -

when create input color class element, javascript adds listeners authomaticaly, when add "add" function. listeners don't added authomatically. can do? <script type="text/javascript"> function add() { alert("movida"); var child = document.createdocumentfragment(); var tmp = document.createelement('input'); tmp.classname = 'color'; child.appendchild(tmp); document.body.appendchild(tmp); } </script> </head> <body> <input class="color" > <input class="color" > <p onclick="add()" > add</p> </body> here js file http://pastebin.com/yzja4inv i called jscolor.init(); end of function , worked :)

ios - UITextField Caret stops moving around when too large -

uitextfield allows override -caretrectforposition: in subclasses. want caret cover text field's entire height. - (cgrect)caretrectforposition:(uitextposition *)position { cgrect inherited = [super caretrectforposition:position]; inherited.origin.y = -50.0; inherited.size.height = 200.0; return inherited; } if make large (like in example), stop moving around magnifying glass, making user unable switch part of text. why , how can address problem? i figured issue when trying make caret way larger text field was. making cover entire editing rect worked fine. - (cgrect)caretrectforposition:(uitextposition *)position { cgrect const inherited = [super caretrectforposition:position]; cgrect const rect = ({ cgrect rect = inherited; rect.origin.y = 0.0; rect.size.height = cgrectgetheight([self editingrectforbounds:self.bounds]); rect; }); return rect; } bonus: in case you're trying selection ran

javascript - Navigation partial not updating even though controller $scope has new value -

we building project client involves dynamic navigation bar, angular-local-storage module, authorization service, data service, , 2 partial, 1 navigation bar partial , other header partial. logging user in via authservice , retrieving navigation elements server http.get call. value stored in localstorage element called navelements. code follows : index: <div class="main-container"> <aside data-ng-include=" 'views/nav.html' " id="nav-container" class="nav-container" data-ng-class=" {'nav-fixed': admin.fixedsidebar, 'nav-horizontal': admin.menu === 'horizontal', 'nav-vertical': admin.menu === 'vertical'}" > </aside> <div id="content" class="content-container"> <section data-ng-view class="view-container {{admin.pagetr

Merge multiple arrays to form a new array, what php function? -

$image = array( 'src' => array( 0 => 'zero', 1 => 'one', 2 => 'two', ), 'width' => array( 0 => 'zero', 1 => 'one', 2 => 'two', ), 'height' => array( 0 => 'zero', 1 => 'one', 2 => 'two', ), ); i trying merge these array elements form following array. $image = array( array( 'src' => 'zero', 'width' => 'zero', 'height' => 'zero' ), array(

Extension of Python's eval -

this question has answer here: eval not working on multi-line string 1 answer string = "if x > 3 :\n print(\"x greater\")\nelse :\n print(\"x lesser\")" """ prints string indented code of if else statements if x greater 3 x greater else prints x lesser""" x = 6 eval(string) can eval() in python used in way or there i'm missing . eval used expressions. documentation the expression argument parsed , evaluated python expression use exec here >>> string = "if x > 3 :\n print(\"x greater\")\nelse :\n print(\"x lesser\")" >>> x = 6 >>> exec(string) x greater however note both statements quite risky use. (see eval dangerous )

Script All Insert Satements of the table in sql server 2000 -

i wrote procedure creates insert statements passing table name, because of limitation sql server row size has, if statement becomes more row size, can not have complete statement run. want have 2 rows each statement , first row insert [tablename] (column list) , second row values (). if knows how that, please me that. thank set quoted_identifier off go set ansi_nulls on go if exists (select * sysobjects type = 'p' , name ='insertgenerator') drop procedure insertgenerator go create proc insertgenerator (@tablename varchar(100)) declare curscol cursor fast_forward select column_name,data_type information_schema.columns table_name = @tablename open curscol declare @string nvarchar(3000) declare @stringdata nvarchar(3000) declare @datatype nvarchar(1000) set @string='insert '+@tablename+'(' set @stringdata='' declare @colname nvarchar(50) fetch next curscol @colname,@datatype if @@fetch_status<>0 begin print 'table '+@tab

html - Offset first line of a paragraph -

Image
html <p><br />1.2 text text text text text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text text</p> <p><br />1.3 text text text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text text</p> <p><br />1.4 text text text text text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text texttext text text</p> with above code, possible following output text stacked line line in right position same level indented paragraph number? if can remove br tag, can achieve text-indent property (more info on mdn ) p { margin-left: 2em; text-indent: -1.5em; } <p>1.2 text text text text text textte

python - Pull name for file from array when downloading using urllib -

i trying use urllib library python pull various tools urls stored in array. when go option save them location, name each file after entry in separate array. every time try , run code written here: import urllib url = ["http://dw.cbsi.com/redir?ttag=restart_download_click&ptid=3001&pagetype=product_pdl&astid=2&edid=3&tag=link&siteid=4&desturl=&onid=2239&oid=3001-2239_4-10320142&rsid=cbsidownloadcomsite&sl=en&sc=us&topicguid=security%2fantivirus&topicbrcrm=&pid=14314872&mfgid=10044820&merid=10044820&ctype=dm&cval=none&devicetype=desktop&pguid=4ca3cb3823b670cd4386478c&viewguid=v4afv1bqawxd1ku2aku@iehzq6uwztjv6p2f&desturl=http%3a%2f%2fsoftware-files-a.cnet.com%2fs%2fsoftware%2f14%2f31%2f48%2f72%2favg_free_stb_all_5961p1_177.exe%3ftoken%3d1433990253_8690d8cb94b227464de5d6e1d59d78b4%26filename%3davg_free_stb_all_5961p1_177.exe","http://download.piriform.com/ccsetup506.exe"]

regex - Match last occurence of 4 digits htaccess rewrite -

i'm wondering sort of regex use match last occurence of set of 4 digits in url. my url being formatted this /artist/album-4 digits-extra stuff in url, "4 digits" last possible occurence of 4 digits together. thing album may contain sets of 4 digits, needs match last occurrence in url. basically need rewrite rule act follows rewriterule ^(.*)/(.*)-(.* match last occurence of 4 digits)-(.*)?$ album.php?artist=$1&album=$2&releaseyear=$3&extra=$4 is there way this? i use rule: rewriterule ^(.*)\/(.*)-(\d{4})(?:-(.*))?$ album.php?artist=$1&album=$2&releaseyear=$3&extra=$4 try it

git bare - GIT INIT not creating a working tree -

i'm doing simple git init c:\xxx running master machine executed on slave machine. c:\xxx path in slave. assumption create non bare repository did not provide --bare option. looked @ system, global config settings in slave machine , set bare = false option in these. after running git init can see local config having bare = true . from init command takes bare settings default? when run git init <path> on master machine, git app run on master. uses global configs of machine, have bare=true . to solve can use 1 of these options: login slave machine ssh , run git init <path> directly copy premade .git selected path on slave. gives option use tweaked repository. e.g. can add git hooks.

nginx - SQLAlchemy extension isn't registered when running app with Gunicorn -

i have application works in development, when try run gunicorn gives error "sqlalchemy extension not registered". i've read seems need call app.app_context() somewhere, i'm not sure where. how fix error? # run in development, works python server.py # try run gunicorn, fails gunicorn --bind localhost:8000 server:app assertionerror: sqlalchemy extension not registered current application. please make sure call init_app() first. server.py : from flask.ext.security import security database import db application import app models import studio, user_datastore security = security(app, user_datastore) if __name__ == '__main__': # app.app_context(): ?? db.init_app(app) app.run() application.py : from flask import flask app = flask(__name__) app.config.from_object('config.productionconfig') database.py : from flask.ext.sqlalchemy import sqlalchemy db = sqlalchemy() only when start app python sever.py if __name__

angularjs - orderBy not working in HTML divs -

i trying implement ng-repeat functionality divs. need sort data first (according rank has, provided object) , name div. creating custom orderby function . sorting functionality works well. however, getting order of divs same. (infact, opposite of need). tried using reverse functionalities, doesn't work. my sorting code looks this: var res = { "toyota": 2, "ford": 1, "chrysler": 4, "hyundai": 3, "nissan": 5 }; sortedval = object.keys(res).sort(function (a, b){ return res[a] - res[b]; }); my html div looks this, <div class="card" ng-repeat="name in data | orderby: sortedval "> i correct output in console. however, divs arranged in order given below, no matter do. nissan, chrysler, hyundai, toyota, ford. i need them in order: ford, toyota, hyundai, chrysler, nissan. note: don't worry "name in data" part, works well. having p

Can I use Laravel Forge with my Dedicated server? -

i have tried find many way if can use laravel forge ( https://forge.laravel.com/ ) existing dedicated hosting server based on cpanel/who or need purchase package digital ocean or amazon web service ? not enough information on that. i need make sure before make purchase of forge. thanks in advance helping me out on this. best regards forge allows instantly create virtual machines using existing cloud providers digital ocean. own virtual machine or dedicated machine therefor not supported.

javascript - How to prevent postback in beginform asp.net mvc -

in view have beginform, has 2 buttons, 1 save , 1 cancel. when save clicked, validates data in form controls both client side , server side , postback controller. problem when click either save or cancel, tries validate data , shows validation summary. want prevent postback , validation when cancel button clicked. in cancel button calling javascript function named cancel() calls window.history.back(-1); still trying postback. following code. if move cancel button out of form, doesn't postback, styling messed want both save , cancel button side side <div id="updateusercreds" class="items"> @using (html.beginform("savecustomer", "newcustomer")) { <div> @html.labelfor(x => x.address.email) <span> @html.kendo().textboxfor(model => model.address.email) </s

c# - Authentication request returned unexpected result: 404 -

exception details: google.gdata.client.gdatarequestexception: execution of authentication request returned unexpected result: 404 here code: protected void button1_click(object sender, eventargs e) { dataset ds = new dataset(); ds.tables.add("gmailcontacts"); ds.tables[0].columns.add("emailid"); requestsettings rs = new requestsettings("gmail", txtusername.value, txtpassword.value); rs.autopaging = true; contactsrequest cr = new contactsrequest(rs); feed<contact> feed = cr.getcontacts(); foreach (contact contact in feed.entries) { foreach (email email in contact.emails) { datarow dr = ds.tables[0].newrow(); dr["emailid"] = email.address.tostring(); ds.tables[0].rows.add(dr); } } gridview1.datasource = ds; gridview1.databind(); } check own solution steps: go https://console.developers.google.com/project , crea