Posts

Showing posts from August, 2011

android - Smali best place to inject code -

i making python script add trace each method able runtime method call in logcat. my application crashes time, don't ask me copy error log because not point of question. try inject code right after register declaration: .locals the first time used .registers directives got errors because of aliasing of local , parameters registers. i thought use .locals directive instead it's same. the different test made following ones: if difference between local , parameters registers greater 2 use v0 , v1 . else incremented .locals directive 2 , used v0 , v1 . but keep getting vfy errors. why .locals equals 0 there parameters p0 example. p0 should aliased v0 .locals 0, why if change .locals 2 , use v0 , v1 still vfy? i thinking add code before return directive @ least not matter if change local variable long not return variable edit: @jesusfreke thank comments. i trying improve python script suggestion. created customclass copy in root folder fact lo

ruby on rails - Setting attribute equal to another -

so have inventory application api. under specific circumstance need raise unit_price of inventory $10. have named circumstance have set condition either 0 or 10 , variable saved in attribute y factor. testing purposes have set yfactor 10. def price inventory.unit_price= inventory.unit_price + yfactor.to_f respond_to |format| format.json{render} end end i undefined method (unit_price) error. using rails 4.

.net - Pulling out specific text in an html file using vb.net -

i trying 3 values large html file. thought use substring method, informed position of data may change. basically, in following code need pick out "total number of records: 106", "number of records imported:106", , "number of records rejected: 0" <b>total number of records : </b>106</font><br><font face="arial" size="2"><b>number of records imported : </b>106</font><br><font face="arial" size="2"><b>number of records rejected : </b>0</font> i hope clear enough. in advance! simple string operations indexof() , substring() should plenty job. regular expressions approach that'd take less code (and may allow more flexibility if html tags can vary), mark twain say, didn't have time short solution, wrote long 1 instead. in general you'll better results around here showing you've @ least made reasonable attempt

router os - Mikrotik Switch Commands (Create VLAN, Assign PORTS) -

i've been working cisco switch , commands simple; eg/ vlan 100 (will add vlan called 100) interface 1/0/1 vlan 100 (will assign vlan 100 port) it seems mikrotik isn't same. don't have mikrotik switch, commands given me are: //add name=vlan200 interface=ether2 vlan-id=200 //add ports=switch1-cpu, ethernet vlan-id=200 learn=yes these seem overly complex. these correct commands? mikrotik guru know can test commands without switch? so i've found answer. after managing obtain mikrotik switch. there great class connecting mk command prompt - it's linked here: api in c sharp the commands are: /interface ethernet switch vlan add switch="[yourswitch]" vlan-id="[yourvlan]" ports="[porttoassign]" to assign port: /interface ethernet switch port set [yourport] vlan-mode=secure vlan-header=always-strip default-vlan-id=[yourvlan] if using mk class need write separately. looks more this: mk mikrotik = new mk(&

java - How to develop REST and SOAP interface for same web service using MuleSoft? -

Image
right services exposed using rest while using soap. there more 2000 services. requirement expose these in soap 1.2 , rest api (yes both). i wondering if can take build on integration layer (preferable mulesoft) this. integration layer call services , expose/convert "rest soap" , "soap rest" client makes soap call mulesoft mulesoft makes rest call actual service mulesoft receives rest response mulesoft uses above response , send client soap response how may achieve above flow in mulesoft? algorithm very helpful. thanks in advance. for example: changename(string id, string newname) should called soap as: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com"> <soapenv:header> </soapenv:header> <soapenv:body> <urn:changename> <urn:id>1001</urn:id> <urn:newname>steve jobs</urn:newn

regex - Removing double quotes and delimiter from a string in Java -

i have string "abc", "def". how can remove double quotes , comma single regular expression. thanks helping out. tokenize string , delimiter with string yourstring = "\"abc\",\"def\""; string[] data = yourstring.split(","); and remove quotes substring for(string s: data){ string somestring = s.substring(1, s.length()-1); }

asp.net - VB.net .replace start and end of string -

i use dynamically place system variable of url class on body. problem strips first trailing '/' , replaces hyphen, annoying. how prevent , replace first '/' nothing? vb <body class="<%=request.servervariables("url").replace(".aspx","").replace("/","-")%>"> at moment if use: <body class="<%=request.servervariables("url").replace(".aspx","").replace("/","")%>"> i 'userprofileedit' url of /user/profile/edit what want 'user-profile-edit' class on body instead of 'userprofileedit'. first example: <body class="<%=request.servervariables("url").replace(".aspx","").replace("/","-")%>"> does need, starting hyphen due first / '/user..' - hope better explains problem. you can use substring(1) first charac

javascript - UIkit tabs and switcher do not work after partial refresh -

ok, bit special. using uikit in our xpages application. use tabs , switcher component ( http://getuikit.com/docs/tab.html , http://getuikit.com/docs/switcher.html ). work fine until partial refresh of page. reason components initiliazed once after pages loaded. happens directly in lib bind page - no own init script etc. after refresh must re-init whole stuff - not familiar syntax or possibilities. searched uikit lib though , found this: (function(ui) { "use strict"; ui.component('tab', { defaults: { 'target' : '>li:not(.uk-tab-responsive, .uk-disabled)', 'connect' : false, 'active' : 0, 'animation' : false, 'duration' : 200 }, boot: function() { // init code ui.ready(function(context) { ui.$("[data-uk-tab]", context).each(function() { var tab = ui.$(this); if (!tab.data(&quo

ruby on rails 4 - cannot save data using a nested form with the cocoon gem -

i having trouble saving data using nested form cocoon gem, , haven't been able find solution on so. i have 2 models: requests has_many votes. i create single form saves new request, , new vote simultaneously. issue neither new request nor new vote saved using below code. i've pasted terminal output below completeness. terminal output: started post "/requests" ::1 @ 2015-06-25 15:41:17 +0100 processing requestscontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"fchco1rlg2zr6mo8mpmvnmeasvpraqyhay5d2sdrldun83ppnsrhquu33yioz84c4z1xmyqi4gzjlymn1nl3fw==", "request"=>{"firstname"=>"sdf", "lastname"=>"sf", "email"=>"sdf@lskdjf.com", "request"=>"lskdj", "description"=>"sldkjf", "votes_attributes"=>{"1435243272926"=>{"comment"=>"s

ADFS SAML request is not signed with expected signature algorithm -

adfs has unexpected behavior looks bug. i have sp using sha1 hash algorithm digital signing. on adfs sp set on advanced tab use sha256. for me normal these not in correlation each side choose how sign. when did sign out sp did signing sha1. on adfs got exception : saml request not signed expected signature algorithm. saml request signed signature algorithm http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 . expected signature algorithm http://www.w3.org/2000/09/xmldsig#rsa-sha1 i using adfs 3 , windows r2 while i'm using simplesamlphp sp, getting exact same error on logout. solution able people. i added following line config idp in authsources.php file, re-imported metadata on idp (not sure if step required):- 'signature.algorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',

sendto - How can I send a text information to a servlet that creates a text file containing it? -

i created ajax app should send text info tomcat server, , there should have servlet in theory should text , save in file . i created app gets content of text area , transforms json , send tomcat server, there should have servlet receives , save json text file, i'm not sure on how install/deploy servlet in server, plus , don't know how make communicate ajax. can conduct me , me through it? thanks in advance. my "servlet" package servletpackage; import java.io.filenotfoundexception; import java.io.printwriter; import java.io.unsupportedencodingexception; public class servlet { static string position = "that json info should here"; public static void main(string[] args) throws filenotfoundexception, unsupportedencodingexception { printwriter writer = new printwriter("positions.txt", "utf-8"); writer.println(position); writer.close(); } } my app " it's more complicated this, easier

math - A very complex combinations task that has been bugging me for 7 months -

some 7 months ago went job interview @ big company. gave me task solve, , past 7 months can't seem able find solution. here task: database has entries. how many combinations (without repetition) b amount (b < a) elements made out of there, given b (contained in a) different elements contain @ least x% of c entries (c < b) out of b given (c/b)? include pattern obtaining of them. in short, need: formula calculation of how many combinations satisfy above conditions formula listing of them. (any programming language or detailed descriptive , format) note: both mandatory, need set in separate table in db. after 2 hours of being totally clueless given simplified version: database has 50 entries. how many combinations (without repetition) 9 elements made out of 50 there, given 9 different elements (contained in 50) contain @ least 15% of 6 entries out of given 9 (6/9)? include pattern obtaining of them. in short, need: formula calculation of how many combina

how to run a C code with argc argv from python? -

i need run c code python, adviced here , works perfectly: from subprocess import call call(["./code", "args", "to", "code"]) i run code in order run needs argv, number, instance shell should call simply: ./code #certainnumber i pass string @ call function, like: d=1 str = "./code %d"(%d) call([str, "args", "to", "code"]) obviously not work. chose python parameter need insert in c code. thanks as twalberg said works perfectly: call(["./code", str(variablecontainingnumber), "other", "args"])

Folder Browser Dialog in ASP.net -

i'm looking folder browser dialog in asp.net winform's folderbrowserdialog dialogresult result = folderbrowserdialog1.showdialog(); but there no feature in asp.net. way i'm not looking @ treeview list because user has select folder drive or network. so possible run winform in web page? , if so, please provide example?

java - The Date(String) is deprecated -

my date constructor deprecated , highlighted in yellow. how can use calendar.set() resolve issue. have called both import java.util.calendar ; , date . code below. in advance. format f = new simpledateformat("yyyy-mm-dd hh:mm:ss z"); date d = new date(f.format(geostate.getstring("firetime"))); temp.setfiretime(d); use dateformat.parse method convert string date string string = "january 2, 2010"; dateformat format = new simpledateformat("mmmm d, yyyy", locale.english); date date = format.parse(string); system.out.println(date); in case this dateformat format = new simpledateformat("yyyy-mm-dd hh:mm:ss z"); date date = format.parse(geostate.getstring("firetime")); temp.setfiretime(date);

Techniques for populating large databases when testing -

we running 3 oracle databases 100+ tables in each. in order test our code looking alternatives populating them testdata. tools have found far dbsetup , dbunit. the problem having these tools manual work needed specify data. example if test table d required populate tables a, b, c data also. dont care data is, care data in table d. reason have populate b c because concistency checks on derived keys in table d. my questions how type of problem uasually handled? sign of badly designed database testability point of view? if database strictly testing purposes, don't see stopping dropping consistency checks (fk etc), populate data, test it, truncate table, , readd consistency checks again later. other alternative can think of 1. copy table structure (columns etc), , testing there 2. alter fks "deferrable deferred" postpone consistency checking until commit transaction

wso2 - Why DBLookup isn't a custom endpoint rather than mediator -

the dblookup construct implemented mediator in wso2. there reasons why wasn't implemented customer endpoint rather? one way think eps consider them final destination data, while mediators intermediate stops modified and/or enriched. the dblookup, in particular, tought way enrich given message data recovered database (hence name). in theory, 1 write custom endpoint send received messages directly database. however, wso2 has dss product covers kind of scenario , more flexible.

ios - Setting the text of a UILabel -

i'm using new xcode beta (which might issue coming from). i followed online tutorial, making simple counter app. the issue have line followed below: outputlabel.text = "the button has been clicked \ (currentcount) number of times" the whole code followed: class viewcontroller: uiviewcontroller { @iboutlet weak var outputlabel: uilabel! var currentcount = 0 override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @ibaction func addonebutton(sender: uibutton) { currentcount = currentcount + 1 outputlabel.text = "the button has been clicked \(currentcount) number of times" outputlabel.textcolor = uicolor.redcolor() } the issue is: use of unresolved identifier outputlabel why can

apache - Permission denied for loging using django mod_wsgi when running multiple domains -

i'm running 2 local domains under 1 apache installation virualhost following. <virtualhost *:80> wsgidaemonprocess staging python-path=/var/www/staging/src/ipinfra/ipinfra:/var/www/staging/lib/python3.4/site-packages wsgiprocessgroup staging ... </virtualhost> <virtualhost *:80> wsgidaemonprocess ipinfra python-path=/var/www/dev/src/ipinfra/ipinfra:/var/www/dev/lib/python3.4/site-packages wsgiprocessgroup ipinfra ... </virtualhost> everything works fine staging environment not able to write log logs folder. both application have same permission , same code staging unable write code. django app running under user ipinfra , member of group apache logs folder has permission of 766 , log file has 777 permission on both setup.

How can i introduce a method call before every method in geb-spock specification file -

problem statement: how induct code automatically before start , end of test method in geb-spock specification file. geb-spock not have related beforemethod or aftermethod gets executed before start/end of test method. feature provided testng tool. as, geb-spock uses junit internally , junit not have feature aswell, geb-spock not have facility aswell. but, need work out on solution using geb-spock need induct code before start of test method , after completion of test method. how can solve problem. thanks, debasish please follow below code understanding: import spock.lang.specification class samplespockspec extends specification { def setupspec(){ println "inside setupspec method" } def setup(){ println "inside setup method" } def "playactivity1"(){ println "iam activity 1" given: println "executing given stmt" when: println &quo

php - Get 2 posts per slide, Unslider, Wordpress -

i'm trying 2 posts per slide in wordpress theme. posts category "news" , want display 5 pages 2 posts. @ moment displays one. this code i've got @ moment. <div class="banner"> <ul> <?php $logo = new wp_query( array( 'category_name' => 'news', 'posts_per_page' => 10 ) ); ?> <?php while ($logo->have_posts()) : $logo->the_post(); ?> <?php $do_not_duplicate[] = $post->id; ?> <li class="news-item col-1-1 no-pad"> <div class="description"> <a href="<?php echo get_permalink(); ?>"><h4><?php the_title(); ?></h4></a> <p class="post-date">gepubliceerd op: <?php echo get_the_date('d-m-y'); ?></p>

javascript - How to specify module path in node.js -

i new in node.js, installed angularjs , expressjs bower, , have app structure below: --parking --server.js --bower_components --angular --express --lib --express.js in server.js, want import express module, how can specify express module path in server.js, give me suggestions? express node.js module , should installed npm instead bower: $ npm install express --save then simple require in server.js: var express = require(express); as per reference: installing express , basic example

solve a equation in matlab with variable -

i'm trying use 'solve' method solve equations in matlab , have matrix coefficients of variables in called 'a' but when use solve method code (i want a(1,1) coefficients x variable) : w0 = solve('a(1,1)*x+13*y-16*z=1','13*x-10*y+13*z=0','-16*x+13*y-7*z=0') w0 = [w0.x w0.y w0.z] i dont correct answer , shows me answer: [ 11/(11*a(1, 1) + 185), 13/(11*a(1, 1) + 185), -1/(11*a(1, 1) + 185)] meaning value of a(1,1) not recognized in code, can me getting right answer? how about w0 = solve([num2str(a(1,1)),'*x+13*y-16*z=1'],'13*x-10*y+13*z=0','-16*x+13*y-7*z=0')

ios - How to start a single timer and access it from multiple views? -

what recommended approach starting countdown nstimer on 1 view , having accessible stop interactively or have run out in another? i know 1 option have nstimer never turn off once kicked off , use global variable determine whether countdown or not seems inefficient. more details of i'm trying do: in main view have label update count down 00:00:00 , button want open countdown uidatepicker . the second view uidatepicker has start , stop button kick off or stop countdown. this view close , label on original screen display countdown based on user selected previously. it seems timer needed independent of views. can use singleton instance init once accessed anywhere. it's kind of global variable mention above if have more 2 views need access timer singleton might suitable choose

android - Data Transfer from Andread Wear Watch to phone via bluetooth -

i'm trying send textfile wearable (moto 360 android 5.1.1) phone (moto x android 4.4.4) via bluetooth, when execute "onsendtophone" method following error message on watch: no application can handle action maybe can me , find solution ;) this code use transfer data watch: public void onsendtophone(view view) { //... // inside method // check if bluetooth supported bluetoothadapter btadapter = bluetoothadapter.getdefaultadapter(); if (btadapter == null) { // device not support bluetooth // inform user we're done. log.d("tag","bluetooth not found"); return; } file sendfile= new file(environment.getexternalstoragepublicdirectory(environment.directory_downloads) + "<filename>"); // bring android chooser intent intent = new intent(); intent.setaction(intent.action_send); intent.settype

javascript - Reload ng-repeat angular / ionic -

i read discussions problem no 1 works me. i have controller .controller('testfriendctrl', ['$scope', 'apiuser', function($scope, apiuser) { $scope.data.friends = [{username: 'test'}]; $scope.change = function(friend) { apiuser.find(friend, function(success, data){ if (success) { $scope.data.friends = data; console.log($scope.data.friends); } }) } }]); i tried .controller('testfriendctrl', ['$scope', '$timeout', 'apiuser', function($scope, $timeout, apiuser) { $scope.friends = [{username: 'coucou'}]; $scope.change = function(friend) { apiuser.find(friend, function(success, data){ if (success) { $timeout(function() { $scope.friends = data; console.log($scope.friends); } );

google maps - Visualize progress on GoogleMaps Android -

Image
i'm creating small test application visualise progress on google map using google maps android api. (api: here ) my backend serves me data polylines between 2 given coordinates. android application decodes data , draw polylines on googlemaps view. i'd visualise route i've done. (so grey out parts/polylines i've driven on. i've tried coloring polylines i've passed calculating closest distance polyline given treshold. seem unable color polyline with: setcolor() - polyline color() - polylineoptions there seems no way update existing polyline. if remove markers, polylines, .. , redraw polylines updated values on every location change, laggy. i wondering if there better/alternative ways visualise progress on map. private void drawpolyline() { if (polylines == null) polylines = new arraylist<polyline>(); if (mrouteinformation == null) return; log.i("navigationactivity", "drawing polyline"); (int = 0; <

css - robotoslab light font in opencart 2.0.1.1 -

i using opencart 2.0.1.1 , want use roboto slab light fonr in website product name , heading of featured , latest blog. take link google font , add header.tpl <link href='http://fonts.googleapis.com/css?family=roboto+slab:400,300,700,100&subset=latin,cyrillic-ext,latin-ext,cyrillic,greek-ext,greek,vietnamese' rel='stylesheet' type='text/css'> , css font family add in stylesheet "robotoslab", serif; after applying found serif font apply robotoslab not. please me in matter , using opencart 2.0.1.1 default theme. this done , solution add css codes stylesheet ` @font-face { font-family: 'robotoslab'; src: url('../fonts/robotoslab-regular.eot'); src: url('../fonts/robotoslab-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/robotoslab-regular.woff') format('woff'), url('../fonts/robotoslab-regular.ttf') format('truetype'), url('../fonts/robotosl

vba - How can I make an outlook macro run whenever a unread item is in the mailbox? -

so, working on script takes emails , processes them in way. want work automatically without human interaction, part have done this. the issue having if mailbox receives email whilst outlook closed, can not make program kick off because of email. if use private sub application_startup() 'runs @ application start call processcode end sub then runs , message hasn't been received yet can't processed. i have tried private sub application_newmail() 'runs whenever new mail item recieved call processcode end sub but reason doesn't run in scenario (runs when mail received normally) i have tried application_itemload , , application_mapilogoncomplete but neither of these seemed work. what ideally want run code whenever unread mail item present in mail box, regardless of how got there. thanks in advance alex spicer you may consider using timer checking unread emails periodycally. see outlook vba - run code every half hour more informati

javascript - PrismJS Code Highlighting issue -

Image
i try use prismjs http://prismjs.com/download.html code highlighting, not working see fiddle http://jsfiddle.net/939u16ac/ getting rendered html instead of markup pfa markup , screenshot html file: <!doctype html> <html lang="en"> <head> <title> demo</title> <meta charset="utf-8"/> <link rel="stylesheet" href="lib/prism.css"> <script src="lib/prism.js"></script> </head> <body onload=""> <pre class="line-numbers language-markup"> <code class=""> <ol type="1"> <li> href atribute must , id, class, title attribute optional </li> <li> in angular application or not having navigation link, use <b>javascript:void(0)</b> in href attribute value </li> </ol> <a id="optionalid" class="optionalclass" title=

authorization - Jenkins Permission's to user according to jobs -

jenkins have permission's project-based matrix , role strategy read/write/admin.how give access/permission view individual jobs/projects different users ? there existing plugin? please help this functionality inbuilt. on job, select "enable project-based security" , specify permissions per user job only.

rest - How do we Access Java Restful Web services session variables in HTML5 & javascript -

i'm working on hybrid mobile app development. have developed restful web services in java , need session value in html page i.e client side. how maintain session in javascript?. here restful webservice @context private httpservletrequest request; @get @path("session") @produces(mediatype.text_html) @consumes(mediatype.application_form_urlencoded) public string session(@queryparam("lname") string name1) { string response2 = null; string name11 = "kheerthi"; try { // jdbc connection resultset rs = pst.executequery(); resultsetmetadata rsmd = rs.getmetadata(); int cols = rsmd.getcolumncount(); while (rs.next()) { if (rs.getstring(1) != "null") { request.getsession(true); httpsession session = request.getsession(); session.setattribute("name", "value"); session.setattribute("username&qu

Camel FTP Issue Related To Large File Transfer -

i working on requirement related downloading large size files through camel-ftp component. route definition below : from("sftp://host:22?connecttimeout=30000&username=xxx&password=yyyy&localworkdirectory=d:/templocation") .to("file:///d:/mylocation"); i looking answer below questions. does camel sfpt supports resume functionality in case there server disconnect.i have observed .inprogress file gets deleted once sockettimeout/ioexception exception thrown underlying jsch library. expectation camel should re establish connection once available , resume downloading point left. parameters such connecttimeout, timeout , sotimeout have no effect. in windows platform(win 7), if server stays disconnected approximately 21 seconds, camel deletes .inprogress file. there other parameter in camel ftp component has set control consumer timeout. issue if file size large(1 gb or more) , server gets disconnected when more 90% downloaded. any in regard hig

database - MySql 5.5.40 stored procedure @@Identity -

i've problem in stored procedure when try ovverriding variable value of @@identity of last operation. i'll write example: declare out_result bigint(20); set out_result = -1; update tablename set name = "pippo" id = 12; select @@identity out_result; -- here works great , out_result value 12 if out_result > 0 update othetablename set address = "route 666" id = 37; select @@identity out_result; end if; i expect if first operation successfull, variable out_result greater 0 , code second update , it's so. after second update (but may delete example) expect out_result variable take value of second update (in example out_result = 37) it's not so. here out_result still equal 12. idea appreciated. thanks. first of there no @@identity in mysql . must have mistaken , talking sql server . coming case, if still getting out_result = 12 believe corresponding update statement (as pointed below) didn't processed row because the co

.net - Infragistics context menu not closing -

in application use infragistics controls. works perfectly, context menu not closing if clicked anywhere else. example: 1) right click on item 2) click somewhere outside context menu 3) context menu should close, stays open, until click item inside it. any ideas why happening? some code, how contextual menu created , added grid. dim contextualmenu popupmenutool = new popupmenutool(key) contextualmenu.dropdownarrowstyle = infragistics.win.ultrawintoolbars.dropdownarrowstyle.segmentedstatebutton addhandler contextualmenu.beforetooldropdown, addressof me.contextualmenu_beforetooldropdown dim deleteitem buttontool = new buttontool("delete") deleteitem.sharedprops.appearancessmall.appearance.image = imagesresources.delete deleteitem.sharedprops.caption = captions.delete addhandler deleteitem.toolclick, addressof me.deleteclick dim closeitem buttontool = new buttontool("close") closeitem.sharedprops.appearancessmall.appearance.image = imagesresources.close clos

java - JNDI Configuration in context.xml based on Maven profile -

given i'm new doing "funky stuff" maven , i've run quandary. have 2 separate servers need deploy , each different jdni resource profile defined in context.xml my file structure such: ( although can change if there better way ) src/main/webapp/meta-inf/context.xml src/main/webapp/meta-inf/context.devel.xml src/main/webapp/meta-inf/context.prod.xml depending on deployment target use appropriate context.target.xml file. question i understand need setup 2 different build profiles such as: <profiles> <profile> <id>prod</id> </profile> <profile> <id>devel</id> </profile> </profiles> but here confused best solution is. understand war plugin can exclude context.xml point onwards i'm confused do. is there way have variable inside of context.xml can have maven "write" opposed having 2 different configuration files. any suggestions? here hints.

IOS Handoff link from safari to app on phone -

i have problem handoff link safari app in phone. currently, i'm developing app include text field showing link of site. for example: on safari in macbook opened " http://www.stackoverflow.com ". , want show on text field in app. used handoff. however, did not figure out result. could give me solution.

java - How to set the minimum height and icon with of a text menu or context menu item? -

i use big icons in text menus in swing. icons cause menu row expand if icon set menu item. leads inhomogeneous position of following label , different distance between menu items if there menu items without icons or icons of smaller size. i may now: resize icons insert empty, transparent icons menu items without icon ? are there other ways set minimum size of menu items icon spacer icon-less menu items in text menus? best practice add empty/transparent icons menu items w/o icons. can merge icons (to create sames width/height) method: private static icon mergeicons(icon icon1, icon icon2, int x, int y, component c) { int w = 0, h = 0; if (icon1 != null) { w = icon1.geticonwidth(); h = icon1.geticonheight(); } if (icon2 != null) { w = icon2.geticonwidth() + x > w ? icon2.geticonwidth() + x : w; h = icon2.geticonheight() + y > h ? icon2.geticonheight() + y : h; } if (w < 1) w = 16; if (h <

angularjs - access an element inside ng-repeat when dynamic html loaded -

i trying access dom element inside dymanic loaded html http request. code using inside controller is $http.get("/projectmanager/edit?id=" + requestid).success(function (data, status, headers, config) { data = data.trim(); var newdirective = angular.element(data); angular.element(document.getelementbyid("editdiv")).html(newdirective); $compile(newdirective)($scope); var resources = angular.element(document.getelementbyid("projectresources")).val(); (var = 0; < resources.length; i++) { var resourcedata = new projectresourcesmodel(resources[i].resourceid, resources[i].projectresourceid, resources[i].employee, resources[i].isapprover, resources[i].startdate, resources[i].enddate) $scope.resource.push(resourcedata); //$scope.$apply(); var id = "startdate" + resources[i].resourceid; angular.ele

python - Pandas str.extract: AttributeError: 'str' object has no attribute 'str' -

i'm trying repurpose function using split using str.extract (regex) instead. def bull_lev(x): spl = x.rsplit(none, 2)[-2].strip("xx") if spl.str.isdigit(): return "+" + spl + "00" return "+100" def bear_lev(x): spl = x.rsplit(none, 2)[-2].strip("xx") if spl.str.isdigit(): return "-" + spl + "00" return "-100" df["leverage"] = df["name"].map(lambda x: bull_lev(x) if "bull" in x else bear_lev(x) if "bear" in x else "+100" i using pandas dataframe handling: import pandas pd df = pd.dataframe(["bull axp un x3 von", "bear estox 12x s"], columns=["name"]) desired output: name leverage "bull axp un x3 von" "+300" "bear estox 12x s" "-1200" faulty regex attempt "bull" : def bull_lev(x)

c++ - Strange behavior of static global variable -

i know program not using static variable in appropriate way, shows how reproduce behavior have seen : main.cpp : int main(){ myobject* p = new myobject(); header::i = 5; printf("i %i\n", header::i); p->update(); return 0; } myobject.cpp : myobject::myobject(){ } void myobject::update(){ printf("i %i\n", header::i); } extern.h : namespace header { static int i; }; the output : i : 5 : 0 why don't 5 both outputs ? 0 come ? explain how static variables work ? static variables have internal linkage means local compilation unit. since have static variable declared in header included in 2 source files, have 2 distinct variables: 1 i local myobject.cpp , another, different i , local main.cpp

angularjs - code to used to test in jasmine -

i need pass service call test using jasmine.js the code below angular.js service call: var myapp = angular.module('myapp',[]); app.controller('myctrl', function($scope, $http) { $http.get("http://www.w3schools.com/angular/customers.php") .success(function(response) {$scope.names = response.records;}); }); how pass unit test using jasmine.js? tried wasn't successful: describe('myctrl', function() { var $httpbackend, scope, createcontroller, authrequesthandler; // set module beforeeach(module('myapp')); alert("hello there!"); beforeeach(inject(function ($injector) { // set mock http service responses alert("hello there!"); $httpbackend = $injector.get('$httpbackend'); // backend definition common tests alert("hello there!"); authrequesthandler = $httpbackend.whenget('get', 'http://www.w3schools.com/angula

Shortcuts in IntelliJ -

i have changed ide i'm working form netbeans intellij. question right is, why shortcuts don't work. want comment out "crtl+shift+/" nothing happens. there bug? can import shortcuts form netbeans? thx help. go "file" -> "settings" -> "keymap" , chose keymap want use "keymaps" dropdown.

python - Finding prime numbers using list comprehention -

i trying generate prime numbers in range x y. tried simple example first: range(10,11) means check if 10 prime number: here code: prime_list = [x x in range(10, 11) y in range(2,x) if x % x == 0 , x % 1 == 0 , x % y != 0] i know thing missing option tell expression x%y != 0 should checked y in range (2,x) , return true if , if have met condition. how that? use all check elements (from 2 upto x-1) met conditions: >>> [x x in range(2, 20) if all(x % y != 0 y in range(2, x))] [2, 3, 5, 7, 11, 13, 17, 19]

QuickBooks Desktop Integration required in php -

i using quickbooks php devkit. want integrate quickbooks desktop web service. getting customers, invoices , sales receipts. trying customers using file. \dev\dev_ids_customers.php worried how token , realmid. can please me? start quick-start guide: http://www.consolibyte.com/docs/index.php/php_devkit_for_quickbooks_-_quick-start using code github: https://github.com/consolibyte/quickbooks-php specially, should using files in docs/web_connector/ folder: https://github.com/consolibyte/quickbooks-php/tree/master/docs/web_connector the file mention: /dev/dev_ids_customers.php is not related quickbooks desktop at all , , will not work . file quickbooks online , not using. not use file. use files in docs/web_connector/ folder have linked above. quickbooks desktop files do not have realm ids or tokens. not need them.

video - Awesome window manager has horizontal tearing? -

so having issue awesome (running debian doesn't matter because on hardware). video gets ripples along middle(vlc , mplayer , totem), scrolling no matter app. never cared until switched awesome on desktop, problem 100x more annoying on multiple large displays. running nvidia btw, same on intel 4000 graphics laptop thanks! update: compton @ end of ~/.xinitrc solves issue stumbling upon this. sorry question in wrong site update: compton @ end of ~/.xinitrc solves issue stumbling upon this. sorry question in wrong site

Rename duplicates with random alphabets in a column - Excel -

i have list of 500 names in column a. 1 name1 2 name2 3 name3 4 name1 5 name2 6 name3 7 name1 8 name2 9 name3 .. and need add prefix or suffix alphabets duplicates. , should 1 name1 2 a.name1 3 b.name1 4 name2 5 a.name2 6 b.name2 7 name3 8 a.name3 9 b.name3 .. and have selected duplicate values select column -> conditional formatting -> highlight cell rules -> duplicate values how rename duplicate values random alphabets prefix or suffix if prefer use non-random prefix contains next letter, starting in c2:- =if(b2=b1,char(96+countif(b$1:b1,b2))&"."&b1,b2) i'm assuming names sorted, have heading , in column b. if didn't want sort them, still work modification:- =if(countif(a$1:a1,a2)>0,char(96+countif(a$1:a1,a2))&"."&a2,a2) i'm assuming unsorted names in column a, header.

point evaluation of NURBS curve given an axial coordinate -

my question how second coordinate (in 2d) of point lies on curve defined nurbs curve given axial coordinate. have knot vector, control points, weights , basis functions. i looked through similar questions ( how find out y coordinate of specific point in bezier curve in canvas? ) did not find answer far. thanks, m this not easy task if need implement scratch. nevertheless, codes this: each non-null knot interval in knot vector of nurbs { extract bezier curve b(t) nurbs knot interval [a, b]; compute minimum , maximum x values of bezier curve's control points. if ( x0 within [xmin, xmax] ) { t0 = a; t1 = b; epsilon = 1.0e-06; // small value; while ( (t1-t0) > epsilon ) { subdivide b(t) @ t=0.5 generate 2 bezier curves: b1(t) , b2(t); compute [xmin1, xmax1] b1(t) , [xmin2, xmax2] b2(t); if ( x0 within [xmin1, xmax1] ) { b(t) = b1(t); t0 = a;

javascript - Changes before upload in slingshot meteor package -

i using slingshot upload images in amazon s3 , works charm. nevertheless, want use slingshot upload files (text,doc,odf etc) in amazon s3. but, want convert these files pdf first before uploading s3. familiar nodejs package " https://github.com/gfloyd/node-unoconv ", converts file pdf. how able integrate slingshot. eventually text, doc, etc files, client uploads, want them stored in s3 in pdf format. there way that. amateur in meteor, grateful if explanation detailed. thanks. slingshot uploading directly s3 not sure how efficiently convert files before upload. client side, not 100% reliable , can heavy client. for recent application used amazon lambda in order images resizing uploaded s3 bucket. it easy use. have create package code , upload lambda , trigger lambda function when file uploaded s3. the service cheap , tutorial easy follow. file resizing should easy modify in order pdf conversion can use npm package. there lot of steps involved: crea

javascript - How to display a text when mouseover a cilcle -

i have tried code dosent work properly. can suggest method resolve error. new visualization , @ beginning stage of d3.js <!doctype html> <html> <head> <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"> </script> </head> <body> <div id="viz"></div> <script type="text/javascript"> var samplesvg = d3.select("#viz") .append("svg") .attr("width", 100) .attr("height", 100); samplesvg.append("circle") .style("stroke", "gray") .style("fill", "white") .attr("r", 40) .attr("cx", 50) .attr("cy", 50) .on("mouseover", function() {d3.select(this).append("text").attr("fill","blue").text("fill aliceblue");}) </script> </body> </html>

jquery - angularjs template(from ng-repeat) and custom directive on same element issue -

i using ng-repeat on element iterate based on array scope. , having custom directive(to create jquery widget) on same element. now problem custom directive compiled before template ng-repeat evaluated , hence getting raw template string in widget. html <div ng-repeat="o in arr" id="{{o}}" ui-ngrid></div> link link function follows. module.directive("uingrid", ['$compile', function ($compile) { return { restrict: 'cea', priority: 999, link: function (scope, element, attrs) { element.ngrid(processatrr(attrs)); } } }); controller $scope.arr = ["0","1"]; now inside code, getting id values {{o}} instead of evaluated value. what reason behind , how can resolve issue? you can use ng-attr-id='{{o}}' values come after template compilation.

directory structure - Re - structuring android project files in Android Sudio -

since application growing more , more dense each day. thought of re-structuring various files. by re-structuring, mean add folders seperately screen activites, folder dialog xmls, screen xmls, custom adapters, etc. in other words, need segregate files according significance. currently, java files listed in src folder (screen activities, custom adapters, business logic, etc.) , xmls (screens, custom list view design, custom dialogs, etc.) present in layout folder. is feasible? impact have on existing project? folders synonymous packages -- that's how ide interprets them. putting them in separate folders creates separate packages. that's downside, won't have same scope/permissions if in same package.

PHP: How to access Associative Array and solve "Array to String conversion notice"? -

edit: found mistake comments decoding json data. i total rookie in php , couldn't find suitable method access associative array. i have json data: [{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"}] i need fire mysqli query in php code requires 1,2,3... above data. implementing various solutions on site gives me array string conversion error. please help. you can use array_column amd implode as $json = '[{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"}]'; $data = implode(',',array_column(json_decode($json,true),'id')); echo $data;//1,2,3,4,5,

How to django update related fields? -

how updtae data related field. user.objects.filter(id=int(getupdate['uid'])).update(cnf_user__user_code=getupdate['code']) it's not work. this model. class cnf_user(models.model): # field required. user = models.onetoonefield(user) user_code = models.charfield(max_length=50,default='-') user_tel = models.charfield(max_length=50,default='-') user_status = models.integerfield(default=1) user_level = models.charfield(max_length=50,default='-') why not? cnf_user.objects.filter(user_id=int(getupdate['uid'])).update(....) btw, cnf_user not proper name class in python :p better cnfuser or full meaning of "cnf" maybe configuser :p? same fields: user_code -> user_code

Is it possible to track mac address of client with PHP code. If yes how and if no why? -

i want track web app users mac address can give access user device having mac address registered in app. how can this? mac address stands "media access control", address low level in osi model , physical address. so, if running web app in server not in same network of users, impossible, because public address (ip) transmitted. for further information regarding this, please search bit on stackoverflow, this answer . alternatively, , if in same network, there other possible solutions depend directly on networking knowledges, such using php library or linux scripting (assuming using linux).