Posts

Showing posts from February, 2012

ruby on rails - Creating user invite button with Facebook API -

i'm trying create button on 1 of pages allows users invite friends use web app them. when click on link i've created invite button, nothing happens. missing? i'm new coding i'm little bit lost next. show.html.erb file: <% if current_user %> <div id="friends"> <p> <%= link_to "invite facebook friends", '#', :id => 'invite_fb_friends' %></p> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_us/all.js"></script> <script> $(function(){ $("a#invite_fb_friends").click(function(){ fb.init({ appid:'my app id', cookie:false, status:true }); fb.ui({ method: 'apprequests', message: '<%= @user %> invited collaborate on story.'} requestcallback;); };) }); </script> </div> <% end %> i'm using these ge...

python - Select all adjacent elements without copying the numpy array -

i have bunch of points format point = [time, latitude, longitude] . so, have got myself numpy array looks - points = numpy.array([ [t_0, lat_0, lon_0], [t_1, lat_1, lon_1], [t_2, lat_2, lon_2], ... [t_n, lat_n, lon_n], ]) now, need gives me next , previous points each of these points like: next_points = numpy.array([ [t_1, lat_1, lon_1], [t_2, lat_2, lon_2], ... [t_n, lat_n, lon_n], [nan, nan, nan], # note how `nan` put next not exist ]) prev_points = numpy.array([ [nan, nan, nan], [t_0, lat_0, lon_0], [t_1, lat_1, lon_1], [t_2, lat_2, lon_2], ... ]) so, can apply distance function - next_distances = distance_function(points, next_points) prev_distances = distance_function(points, prev_points) now, task appears in function gets called in loop around 1000 times, it nice if next_points , prev_points without creating copy of points . is there way this? if understand correctly, shifting ...

weblogic12c - Stop weblogic server forcefully using command line -

i want shutdown weblogic server using command line forcefully. have specific scenario. have written batch file stuff , shutdown weblogic server using stopweblogic.cmd follows: "%weblogic_domain_path%\bin\stopweblogic.cmd" i have gone through this document. can't follow approach since don't want change stopweblogic.cmd . there way achieve this? a wlst script way go. see shutdown command has optional 'force' parameter. n.b. on unix/linux can send sigterm signal pid of weblogic server perform force shutdown. i.e. kill -term pid

javascript - Insert jsonobject into new array -

say have following jsonobject var arraywithvaluesandgroups = [{ "testobject": "object1", "graphgroup": { "test": { "group": "a", "value": "6" }, "test2": { "group": "b", "value": "5" } } }, { "testobject": "object2", "graphgroup": { "test": { "group": "a", "value": "9" }, "test2": { "group": "b", "value": "12" } } }, { ...

jQuery Snake Carousel Effect -

Image
i can't seem find this, asking see if point me in right direction. i need products slide around conveyor belt/with snake effect. view on js fiddle: http://jsfiddle.net/nlgopodt/2/ crude diagram of functionality required attached. i going css only, couldn't :nth-child selector work correctly. anyhow, updated jsfiddle every column in row. every even row floats columns right the javascript prepends columns first row , cascades overflowing columns next row if there no next row, removes overflowing elements. .container .row:nth-child(even) .col { float: right; } var $rows = $('.container .row'); setinterval(function(){ var $col = $('<div class="col new">new col</div>'); $rows.eq(0).prepend($col); $col.removeclass('new').addclass('animated bouncein') $rows.each(function(idx, elem){ var $row = $(elem), $cols = ...

c# - Retrieve document template type from SPList -

when working in sharepoint creating custom splist using following method: from msdn : public virtual guid add( string title, string description, string url, string featureid, int templatetype, string doctemplatetype, splisttemplate.quicklaunchoptions quicklaunchoptions ) the doctemplatetype passed declare document template type. possible retrieve document template type existing splist? can useful i.e. when copying list. thanks in advance. use splist.basetemplate property list definition type on list based, example: splist list = web.lists.trygetlist(<list title>); splisttemplatetype templatetype = list.basetemplate; int templatetypeid = (int) templatetype; how document template associated list splist list = web.lists.trygetlist(<list title>); var doctemplate = web.listtemplates.oftype<splisttemplate>() .firstordefault(lt => lt.type == list.basetemplate); console.writeline(...

php - mysqli_prepare() expects parameter 1 to be mysqli, object given -

alright. basically. here's code. login.php require_once("./libs/db_cxn.php"); $cxn = new newconnection(); $stmt = "select users.username users username=$username , password=md5($password)"; $qry = \mysqli_prepare($cxn, $stmt); $res = mysqli_execute($qry); db_cxn.php class newconnection{ function __construct(){ $conf = array( "host" => "localhost", "username" => "root", "password" => "root", "dbname" => "db_bookworm", "port" => ini_get("mysqli.default_port"), "socket" => ini_get("mysqli.default_socket"), "prefix" => "bworm_" ); $cxn = new mysqli($conf["host"], $conf["username"], $conf["password"], $conf["dbname"]); ...

Blur image in specified area of an imageview android -

i having problem in blurring specific area of image. ex. blur image except area, determined coordinates. tried find way achieve solution. didn't clear way. having problem apply renderscript blur selected area. complete image blur. check out article. there examples of 2 diff ways that. http://trickyandroid.com/advanced-blurring-techniques/

javascript - Disable image compression in Chrome mobile browser -

when using chrome mobile on ios , android, noticed when "reduce data usage" turned on, images on our modelling agency website compressed significant amount. somehow disable this, since our portfolio has consist of high quality photos. is there html meta tag, css rule or js hack force disable function? try <img src="example.png" pagespeed_no_transform> the 'optimize images' filter won't optimize image (though might still cache extend it) if has pagespeed_no_transform attribute.

html - Expand div outside container - overflow-x mobile issue -

recently tried this method increase div background-color outside container.everything ok except applying overflow-x body ,on mobile browsers not working.i mean when swipe left still scrolling ( same effect can achieve on desktop if press right arrow on keyboard ) .so how can disable scrolling horizontally on mobiles when using method? here jsfiddle: http://jsfiddle.net/kzgvl6ba/ here's example: html: <body> <article> <div class="extendfull">full-width bars</div> </article> </body> css: body { overflow-x: hidden; } article { background-color: #dddddd; border-left: 1px solid #ccc; border-right: 1px solid #ccc; display: block; margin: 0 auto; padding: 0 10px; width: 60%; } div.extendfull { background-color: #ccf; border: 1px solid #66c; font-size: 1.8em; font-weight: normal; padding-left: 3000px; margin-left: -3000px; padding-right: 3000px; margi...

Comparing Multi and single dimensional arrays in php -

i new php playing array. want following things array of different dimensional the following multidimensional array $a = array( array( 'productsid' => 90, 'couponid' => 50 ), array( 'productsid' => 80, 'couponid' => 95 ), array( 'productsid' => 80, 'couponid' => 95 )); the following single dimensional array: $b = array(80,90,95); i want compare productsid index of array single dimensional array , wants fetch data equal it. i have tried following loop print gives values of productsid want full array. comparing productid second array. for ($i = 0; $i < 3; $i++) { foreach ($a[$i] $key => $value) { foreach ($b $c) { if ($value == $c) { echo $value .'<br>'; } } } } looks you're looking in_array() : $result = array(); foreach($a $item) if(in_array($item['productsid'], $b)) $result []= $item; ...

android - How to get network status changes with BroadcastReceiver? -

when change wi-fi 3g or vice versa asynctask cause error. want trace , restart loading progress(or stop , proceed asynctask if possible) when happens. looked on google , find broadcastreceiver onreceive called when happens. problem still don't exact moment when happens. oncreate registerreceiver(mconnreceiver,new intentfilter(connectivitymanager.connectivity_action)); asynctask point of error(it's called on httpclient line): @override protected string doinbackground(string... params) { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(params[0]); try { if(!iscancelled())//i have set after found error { httpresponse response = httpclient.execute(httppost); jsonresult = inputstreamtostring( response.getentity().getcontent()).tostring(); } } the broadcastreceiver private broadcastreceiver mconnreceiver = new broadcastreceiver() { @override...

javascript - JQuery, sort array of tiles using data attribute -

given landing page of product slot tiles, goal reorder these tiles based on priority value. i'm using following call return array of tiles sewing class , show class: $(".show.sewing.tile-wrap").parent(); now sort returned array, ordered values found in each tile's data-prioritysort attribute. here typical html product slot tile: <div class="c3 tile-96 border" data-prioritysort="11" > <div class="tile-wrap show sewing clearfix"> <div class="slug"> <div class="c3 tile-slug-1 "></div> <div class="c3 tile-slug-2 "></div> <div class="c3 tile-slug-3 "></div> </div> <div class="c12 proofing"></div> <div class="slot-cta"> <h2><a href="tbd?icn=tbd&ici=96" title="25% off description." alt="25%...

c# - How to convert ADO.NET SQL Server parametrized query to ORACLE query (in Regex)? -

queries can like: select * atable acolumn = @acolumn; select * atable acolumn >= @acolumn; select * atable acolumn between @acolumn1 , @acolumn2; //not necessary support if better option regex available i'm open suggestions. there must method/delegate, adds dbparameter dbcommand when match found. way beyond regex skills. edit: happy restrict =, <, >, >=, <= in way column can 1 time. leaving in, not in , between out of this. more complex queries can made other way (explained in comment). -m ok. did basic implementation, if has might idea in basic case. here query written in oracle format , in case of sql-server change : "placeholder" @. public void addparameters(string query, list<object> valuelist) { int ordernr = 0; string newquery = regex.replace(query, @"(?<operator>=|<=|>=|<|>)\s?(?<placeholder>:)(?<columnname>([a-za-z0-9\-]+))", new matchevaluato...

sql server - Creating Trigger for Insert row and Delete row -

i attempting create trigger if row inserted , if row deleted. if row inserted print statement give 1 message, , if row deleted print statement give message. teacher used example, ddl statements instead of dml statements put in. question how can obtain equivalent, making dml statements can work? far output says else print statement whether row inserted or deleted. don't beleive counts insert statement @ all. here schema. create table dbo.customers ( customerid int not null identity primary key, customerfname varchar(30) not null, customerlname varchar(30) not null, customeraddress1 varchar(50) not null, customeraddress2 varchar(50) null, customercity varchar(50) not null, customerstate char(2) not null, customerzipcode int not null, customerhome varchar(20) not null, customercell varchar(20) not null, customeremail ...

Python os.walk() loop directories for attribute -

i have text file containing directory names on each line (1, 2, 3), how can iterate through text file , have result inserted os.walk? so far, have import os os import listdir dir_file = open("list.txt", "r") root, dirs, files in os.walk(dir_file): name in files: print(os.path.join(root, name)) name in dirs: print(os.path.join(root, name)) i have used combination of while loops , loops , if statements try , perform this, i've had no luck. any help? thanks how about: rdf = [] fff in dir_file: r, d, f in os.walk(fff): rdf.append(r, d, f)

JSF 2.0 - How to show in a label the text value of java enum? -

this first post in forum. have java enum class identifier (value) , description (text). criteriexlusio.java: public enum criteriexclusio{ c1(1, "< 10"), c2(2, "low grade"), c3(3, "medium grade"), c4(4, "high grade"), c5(5, "> 250"), private final int value; private final string text; private criteriexclusio(int value, string text) { this.value = value; this.text = text; } public int getvalue() { return value; } public string gettext() { return text; } } and controller: @named(value = "auxcriteriexclusiocontroller") @applicationscoped public class auxcriteriexclusiocontroller { public criteriexclusio[] getcriteriexclusio(){ return criteriexclusio.values(); } } i load values-text in selectonemenu , stored in table (values-int) when submit form. .xhtml <h:selectonemenu value="#{mbvcriteriexclusio.criteriexclusio.idcriteriexclusio}" id="cmbcriteriexclusio...

linux - encoding: unrtf SYMBOL.charmap needs to be altered -

i'm trying convert files rtf text. originals created windows application (probably word) conversion taking place on linux server. tool wish use unrtf since comes linux distro (sles !!.x) pre-installed... or @ least didn't have intall it. there isn't lot of doco on unrtf . works , there man page limited info. problem encoding coming out iso-8859-1 , need iso-8859-15 in order euro symbol (€). i'm getting not symbol (¬). viewing document in hex-mode see there value of xac00 @ point symbol € should be. searching web found out € has unicde value of x20ac , ¬ has unicode value of x00ac. bit more searching suggested encoding of iso-8859-15 correct value x00a4. lot of information found contradictory , confusing (not mention way off topic unrtf after all). amongst commands i've tried are: unrtf --text $rtf > $xrtf unrtf --text $rtf | iconv -c -f utf-8 -t iso-8859-15 > $xrtf where $rtf , $xrtf input , output files respectively. checked supposed encodin...

Gitlab pushing via https doesnt succed because of iptables -

i installed gitlab-omnibus bundle , opened iptables port 80, 443, 9418 , temp. 22. why doesn't pushing via https work? when put iptables in default open works. here rules 80, 443, 22 , 9418 # 1. allow incoming http $iptables -a input -p tcp --dport 80 -j accept $iptables -a output -p tcp --sport 80 -j accept # 2. allow outgoing http $iptables -a output -p tcp --dport 80 -j accept $iptables -a input -p tcp --sport 80 -j accept # allow incoming https $iptables -a input -p tcp --dport 443 -j accept $iptables -a output -p tcp --sport 443 -j accept # 10. allow outgoing https $iptables -a output -p tcp --dport 443 -j accept $iptables -a input -p tcp --sport 443 -j accept # allow git $iptables -a output -p tcp --dport 9418 -j accept $iptables -a input -p tcp --sport 9418 -j accept #ssh: client --> server $iptables -a input -p tcp --dport 22 -j accept $iptables -a output -p tcp --sport 22 -j accept the result is: pushing https://tld/user/repo.git post git-receive-pack (44...

html - Why are my div's not placed "inside" the wrapper div? -

in following code, #wrapper div contains #left , #right div. not turn out contained inside #wrapper div. i want them treated content of #wrapper div, contained inside it, leaving 10px padding applied #wrapper . why displaced? jsfiddle here. <div id="wrapper"> <div id="left">alpha</div> <div id="right">bravo</div> </div> the css follows. #wrapper { background-color:grey; border-top: 1px solid black; border-botton: 1px solid black; padding:10px; } #left { background-color:yellow; float:left; } #right { background-color:pink; float:right; } i want solve without manipulating position attributes of #wrapper might disrupt normal structure of page (i'm afraid so). because floating them sit outside of dom flow. if want parent consider them, add overflow: hidden parent css or add div @ bottom of container rule clear: both; demo : http://jsfiddle.net/...

c# - Creating restrictions on multiple objects that use joints -

Image
i got problem little concept: let's say, have 4 objects: 2 rectangles , 2 spheres. link 1 rectangle 1 sphere, using joint, 1 sphere rectangle, using joint. then, put rotation (using simple constant force test it) on rectangle. how end this: simple rotating doublewheel: the thing is, know want add last rectangle on top of 1 of spheres, , still have structure rotating, not last rectangle: so, add rectangle sphere, using joint, , end this: the thing second rectangle rotate too, , block whole structure (logically) when hits ground. not rotate keep moving, top of car isn't rotating wheels. i tried use configurable joints put restrictions, didn't find worth. found linear limit, which, when put 100, block item rotating moving, falls , nothing.. does have idea ? thanks in advance, regards, em edit: still searching configurable joint, guess have trick x/y/zmotions..

looping to make new variables R -

is there cleaner way following using loop solution in r? of now, resorting cutting , pasting, changing reference column want result attached existing data set new variable. thank in advance. library(tm) library(snowballc) data <- data.frame(c("asd"), c(3)) list <- c("eat", "drink") text <- c("i eat , drink day") text <- corpus(vectorsource(text)) text <- tm_map(text, content_transformer(tolower)) text <- tm_map(text, removepunctuation) text <- tm_map(text, removenumbers) text <- tm_map(text, removewords, stopwords('english')) text <- tm_map(text, stemdocument) text <- tm_map(text, stripwhitespace) text <- as.data.frame(text) text <- text$text text <- strsplit(as.matrix(text), ' +') text <- lapply(text, lapply, function(z) paste0(' ', z)) text <- lapply(text, unlist) implode <- function(..., sep='') { paste(..., collapse=sep) } wordproportion <- function...

javascript - How to make image upload directly while choosing image rather than pressing upload button in JQuery -

how make script make upload file rather pressing upload button in below script detail : in below <input type="file" id="pimage" name="image" class="upload-img" style="opacity:0"> display image uploaded , <input name="image" type="file"/> choose file. , <button>upload</button> upload image. and in <input type="file" id="pimage" name="image" class="upload-img" style="opacity:0"> choose file, don't want upload image every time after clicking on upload button how can make image upload while choosing file itself html : <div id="image" class="upload-img-span"></div> <input type="file" id="pimage" name="image" class="upload-img" style="opacity:0"> <span class="upload-txt-span">upload img</span> </div> </t...

visual studio - TFS/GIT in VS Cannot switch to master because there are uncommitted changes -

Image
i've setup git repository vs 2013 solution on visualstudio.com. repository worked great while becoming accustomed using tfs (in git mode). then decided familiarize myself branches, created branch off of master. i've made quite few changes in branch. i've committed changes on time , have performed sync push local commits visualstudio.com repository. works. the problem having somehow lost ability of switching master branch. cannot merge newly created branch master. every time try involves master following error in vs: cannot switch master because there uncommitted changes. commit or undo changes before switch branches. see output window details. the output window never contains 'details'... what "uncommitted changes" message refer to? since cannot master branch have no way of committing of changes (nor sure want to?). , current (only other) branch in has been committed , sync'ed. i'm learning tfs, git , source control. how safely ...

How this field injected in github android? -

i know github android app using roboguice, , field injection needs module bind. but can not found module supposed bind field "accountdatamanager" in com.github.mobile.ui.user.homeactivity . , not 1 this. it uses @inject attribute, no module can found. can tell me how works? for using @injectview need use butterknife view injection library. check link more butterknife

java - JavaFX Split Menu Button Arrow Trigger Event -

i have splitmenubutton , , can't seem find way trigger event when user clicks arrow next button. i dropdown fill items database when dropdown arrow clicked. i not sure event can that, , can not find info on either. short answer: register listener showing property . import javafx.application.application; import javafx.beans.property.integerproperty; import javafx.beans.property.simpleintegerproperty; import javafx.scene.scene; import javafx.scene.control.menuitem; import javafx.scene.control.splitmenubutton; import javafx.scene.layout.borderpane; import javafx.stage.stage; public class splitmenubuttontest extends application { @override public void start(stage primarystage) { integerproperty count = new simpleintegerproperty(); splitmenubutton splitmenubutton = new splitmenubutton(); splitmenubutton.settext("action"); splitmenubutton.showingproperty().addlistener((obs, wasshowing, isnowshowing) -> { ...

Timestamp from String in android -

i have problem timestamp. string: 2014-09-20 18:49:48.773829+00:00 , need timestamp string. when use timestamp.valueof(string) get: java.lang.illegalargumentexception: timestamp format must yyyy-mm-dd hh:mm:ss.fffffffff; '2014-09-20 18:49:48.773829+00:00' @ java.sql.timestamp.badtimestampstring(timestamp.java:507) @ java.sql.timestamp.valueof(timestamp.java:467) @ com.android.volley.toolbox.jsonrequest.deliverresponse(jsonrequest.java:65) @ com.android.volley.executordelivery$responsedeliveryrunnable.run(executordelivery.java:99) @ android.os.handler.handlecallback(handler.java:733) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5017) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) ...

Linq Select Into using T-SQL Function -

i have following t-sql working : select * #visibletasks [#alltasks] [dbo].[func_gettaskvisibility](taskid, state) = 1 i pass in temp table 100's of tasks , run function func_gettaskvisibility against tasks. the function checks against several requirements , each #alltask returns 1 , 0 bad. i collected return = 1 , place new temp table called #visibletasks. how can same call within linq? non working code var visible = ( f in alltasks select new { // lookup foreach , return clean visibletasks = func_gettaskvisibility(taskid,state) = 1 } ).tolist(); well, select into used insert data, linq not designed for, query part be: var visible = ( f in alltasks // lookup foreach , return clean func_gettaskvisibility(taskid,state) = 1 select f ).tolist();

javascript - Why does this && not short-circuit? -

this code node module templatizer . if (i === 3 && node.type === "expressionstatement" && node.expression.callee.object.name === "buf" && node.expression.arguments.length === 1 && node.expression.arguments[0].type === "literal") { // save simple string simplestring = node.expression.arguments[0].value; cnt++; } the value of node.type 'variabledeclaration' logical expression false , node.expression shouldn't evaluated appears so... typeerror: cannot read property 'object' of undefined @ /node_modules/templatizer/lib/simplifytemplate.js:34:89 @ array.foreach (native) it means 'object' in 'callee'. expression , callee both undefined. step on conditional node crashes. edit i think javascript works fine , perhaps async code resulting in strange results form debugger. if put console.log @ top of loop gives output makes sense.....

python - Misaligned columns in Pandas dataframe from pandas.ExcelFile import -

Image
i have excel spreadsheet contains transactional data. tried importing pandas dataframe: >>> import pandas pd >>> xlsfile = pd.excelfile("/data/transactions.xls") >>> data = xlsfile.parse('data') ... and, @ first glance, looked ok. noticed column (i.e. 'ship region') should contain 1 of 4 possible values: ... had values didn't make sense. although values, part, end in correct columns, there thousands of instances not case: >>> len(data['ship region'].unique()) 5007 values neighboring cells somehow creeping wrong columns. >>> value in data['ship region'].unique(): ... print value ... americas emea apac nan ship name justin bieber marie curie industries bks iyengar [...etc...] can see i'm doing wrong? that strange. version of pandas using? by way, can use pd.read_excel() , in 1 line.

bitbake - How can I replace OpenSSL package in Yocto? -

i replace default package in yocto . specifically, replace openssl. i used image_install_remove , , added preferred_provider_virtual/openssl=<my version> . reason, original openssl keeps getting built , used other recipes. how can build of openssl default provider system? well, there's no global selection of ssl-provider in yocto. you'll have @ recipes drags in openssl, , check if support switching gnutls (or whatever want use) instead. if take @ curl_7.37.1.bb: packageconfig ??= "${@bb.utils.contains("distro_features", "ipv6", "ipv6", "", d)} gnutls zlib" packageconfig_class-native = "ipv6 ssl zlib" packageconfig_class-nativesdk = "ipv6 ssl zlib" packageconfig[ipv6] = "--enable-ipv6,--disable-ipv6," packageconfig[ssl] = "--with-ssl,--without-ssl,openssl" packageconfig[gnutls] = "--with-gnutls=${staging_libdir}/../,--without-gnutls,gnutls" packageco...

spring - Ask about how to insert data into many tables (with relationship) and avoid duplicate data error -

currently i'm developing application import data xml mysql using spring batch ( https://github.com/samuelwilsone/filmdata ). this first time i'm working spring batch please guide me how resolve problems below: i have 5 tables (actors, directors, films, film_actors, film_directors). each director can have more 1 film, want implement program insert new director "directors" table , id use insert "film_directors" table. if director has existed, program id , insert "film_directors" table. actor similar. example: with 2 files (avatar.xml, titanic.xml), want insert database this: --- table "films": avatar, avatar 2009, 7.9 titanic, titanic 1997, 7.7 --- table "director": 1, james cameron --- table "film_directors": avatar, 1 titanic, 1 when run program in second time, error because duplicate data (data existed in database). how can avoid this? i'm appreciated help. why error, if datas exeist ...

How to create GeoTagging image / location tagging application for android with google maps using eclipse with ADT -

hello name james, i self-learning how develop android applications, have designed few basic apps – name few calculator app, notepad, percentage calculator android. after developing few small basic apps, planning on making more advance apps, planning on creating app allows user tag location on google map or geotag images using application, visible them. example, user can tag location map , later on directions location or take image of location , geotag map , add sort of description it. i have been searching on google time now, on how can go designing app haven’t found tutorial / guides how implement image geotagging / location tagging google map. please can give me guide, read upon or maybe correct me if not searching right materials. so far, have carried out searches including: how add google maps android application (i found guide , understand how can this) how implement geotagging on android application (haven’t found useful material apart few applications released on pla...

Get first pixel (0,0) of image with jQuery -

i need first pixels (0,0) of image jquery (rgba or hex) pls me :d you have draw image in canvas element. can use getimagedata method return array containing rgba values. var img = new image(); img.src = 'image.jpg'; var context = document.getelementbyid('canvas').getcontext('2d'); context.drawimage(img, 0, 0); data = context.getimagedata(x, y, 1, 1).data;

Access Denied when creating RDS during init of Elastic Beanstalk -

Image
being new platform i've followed setup tutorial: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_python_django.html when tried created rds db wouldn't let me message: invalidparametervalue. access denied api version: api20120423 output in commandline: what reason happening? as workaround can answer 'n' question "create rds db instance", in way should able complete init step of environment. then create actual rds db go aws console, in elastic beanstalk section you'll find newly created env. click on env , in "configuration" page you'll find "data tier" section, you'll able create rds db, associating env.

text processing - How to remove last character from grep output? -

i have text file following content in (for example): in first line "one", second"two " & " 3 " , also"four ". in second line nested "foo "bar" baz""zoo" patterns. i tried had strings between pair of quotes , ended command: grep -po '"\k[^"]+"' file what command gave me following: one" 2 " 3 " 4 " foo " baz" zoo" and what want above result desired output be: one 2 3 4 foo baz zoo please me remove last " above grep output. don't want remove spaces output. don't have words expanded multiline. e.g: ... "foo "bar" ba z""zoo" ... please, please don't suggest me can use multiple commands, know can. i'm ask if can grep , options alone? this possible through below grep one-liner. $ grep -op '"\k[^"]+(?="(?:[^"]*"[^"]*")*[...

ios - UIWebView scrolls under navigation bar for text inputs -

i have uinavigationcontroller uiviewcontroller in stack. view controller shows 1 uiwebview extends nicely under uinavbar und uitabbar have in app. great! if tap textarea input in web view , iphone/ipad in landscape orientation web view scrolls position cursor in textarea under nav bar , user can't see typing. how can fix this? ios 8 bug or need set scroll inset manually this? bests, philip ok helps set contentinset scroll view (for me heightofbar + heightofstatusbar) if keyboard shows , remove again if keyboard hides

Does every Android device contains all previous SDK versions? -

i'm wondering, if latest android sdk installed on device contains code of previous versions well? so if target api level 10 in app , install on device lollipop, take , use gingerbread sdk 3 years ago? or there 1 codebase versions lot of checks , switches run kind of compatibility mode picking correct code , enabling methods of version of sdk target? i read article android:targetsdkversion specified in manifest still know how works internally. ok, surfed bit around on source code (which can find here: https://github.com/android/platform_frameworks_base ). i'm not engineer of android framework, curious question , here found. it not contain different versions of source code. can imagine result in nightmare if more , more versions become available. foremost, have different (buggy) versions of same method without fixing them keep them same. in source code, can find places these: (see https://github.com/android/platform_frameworks_base/blob/59701b9ba5c453e327b...

php - I try to open a url from a txt file but javascript wont open it -

i use script <?php $file = fopen("url.txt", "r"); $urls = array(); while (!feof($file)) { $urls[] = fgets($file); } fclose($file); $url = $urls[1]; ?> <html> <head> <script type="text/javascript"> var mywindow; var url = '<? echo $url?>;' function openwin() { mywindow = window.open(url,"_blank","width=100,height=411"); } </script> </head> <body align="right" onload="openwin()"> <br> <br> <br> </body> atm in url.txt have 2 urls google.com , yahoo.com but when got page wont open url if put var url = 'google.nl' doest work guys have idea on how fix this greetings john

java - Exception, table not mapped -

when run command in mysql prompt works properly. select d.lastupdateddate,c.phonenumber1,d.simimea1, d.simimea2,d.model,c.latitude, c.longitude connectiondetails c inner join devicedetails d on (c.deviceuniqueidentity = d.deviceuniqueidentity , d.rowstatus='0') exception exception in thread "main" org.hibernate.hql.internal.ast.querysyntaxexception: connectiondetails not mapped [select d.lastupdateddate,c.phonenumber1,d.simimea1, d.simimea2,d.model,c.latitude, c.longitude connectiondetails c inner join devicedetails d on (c.deviceuniqueidentity = d.deviceuniqueidentity , d.rowstatus='0')] @ org.hibernate.hql.internal.ast.querysyntaxexception.generatequeryexception(querysyntaxexception.java:96) @ org.hibernate.queryexception.wrapwithquerystring(queryexception.java:120) connectiondetails.hbm <hibernate-mapping> <class name="com.mypackage.cconnectiondetails" table="connectiondetails"> ...

uiviewcontroller - dismissViewControllerAnimated:completion: on iOS 8 -

in ios <= 7, directly after calling dismissviewcontrolleranimated:completion: result in presentedviewcontroller being nil . in ios 8, presentedviewcontroller still points presented viewcontroller, right until completion block executed. [self dismissviewcontrolleranimated:no completion:^{ //self.presentedviewcontroller nil }]; //self.presentedviewcontroller nil on ios 7, not nil on ios 8 so in ios 8 cannot rely on property presentedviewcontroller in order find out viewcontroller top visible viewcontroller. in ios 8, alerts need presented onto viewcontroller (which poses problem ). not show if viewcontroller try present on presents viewcontroller. if dismissed presented viewcontroller , show uialertcontroller on top visible viewcontroller (by recursively searching last presentedviewcontroller ), of course not show log error message: "warning: attempt present on view not in window hierarchy!" is bug in ios 8 or new way? how can find out viewcontroll...

wpf - C# XAML Binding of a default with IValueConverter -

i'm looking reason why code isn't doing job: in xaml use: <textbox text="{binding path=txt_8, converter={staticresource defkonverter}, converterparameter='useralias'}"/> in c# there ivalueconverter giving me default value when converterparameter='useralias'. ex. string 'jettero'. works point see in textbox text 'jettero'. saving record database, in record txt_8 still null ! (other fields saved well) looks binding not updating record field behind textbox. =========== update start conclusion: not working because binding working in 1 direction. converter showing special things makes user experince better not save it. =========== update end a similar issue backward happens also, in xaml: <textbox text="{binding path=date_1, converter={staticresource defkonverter}, converterparameter='\{0:yyyy-mm-dd\}timestamp'}"/> this working should in record behind: when write in textbox '.' charac...

java - LinkedHashSet iteration not in ascending order? -

in following code, if parameter {1,3,2}, in while loop, 1, 3, 2. i using linkedhashset, why order not 1, 2, 3? else need make iteration in ascending order? cannot use treeset add, remove, contains() in o(log n) time. public static void iterate(int[] num) { linkedhashset<integer> set = new linkedhashset<integer>(); (int : num) { set.add(i); } iterator<integer> iter = set.iterator(); while (iter.hasnext()) { // why same order inseration order, not assending order? int = iter.next(); } } because linkedhashset iterates in insertion order , not sorted! javadoc: this implementation differs hashset in maintains doubly-linked list running through of entries. linked list defines iteration ordering, order in elements inserted set (insertion-order). you want use treeset sorted set, have @ sorted set javadoc: https://docs.oracle.com/javase/7/docs/api/java/util/sortedset.html

json - jquery not parsing data held in data attribute -

i'm trying parse data held in data attribute defined follows html <div data-details="{'value':'2.38', 'image':tesco.png }"></div> jquery var details = $(this).data('details'); when trying parse json $.parsejson(details) it returns in console syntaxerror: json.parse: unexpected character @ line 1 column 1 of json data any guidance apreciated. *edit when html declared (all variables wrapped in single quotes) <div class="transaction-panel matched" data-details="{'value':'2.38', 'image':'tesco.png' }" ></div> the same error reurned your details not valid json, $.parsejson can't read it. need use double quotes around keys , (string) values. valid json needs double quotes . <div data-details='{"value":2.38, "image":"tesco.png"}'></div> note: can use either single or doubl...