Posts

Showing posts from April, 2013

ios - Why not change my background and title after accelerometer data is recieved? SWIFT -

print , func call successful both time, background , title change when restart app , works 1 times. here code: var motionmanager = cmmotionmanager() override func viewdidappear(animated: bool) { super.viewdidappear(animated) startmotionmanager() } func startmotionmanager() { if motionmanager.accelerometeravailable { motionmanager.accelerometerupdateinterval = 0.2 motionmanager.startaccelerometerupdatestoqueue(nsoperationqueue(), withhandler: { [weak self] (data, error) in print(data!.acceleration.z) if(data!.acceleration.z > 0.8) { self!.win() print("win") } if (data!.acceleration.z < -0.9){ self!.pass() print("pass") } return }) } } func pass() { print("passfunction") self.testlabel.text = "pass" self.view.backgroundcolor = uicolor.redcolor() } func win() { testlabel.text

javascript - Add function to set of DOM elements using jQuery? -

my journey being @ least on above basic level in front end still on , stumbled upon quite big problem recently. i can select dom element, like var element=document.getelementbyid("elementid") and add function it, this function testfunction() { alert(this.getattribute('data-self')); } element.customfunction=testfunction; but there chance way of doing using jquery? tried attr() , prop() , data() , without luck on matter. data() close 1 though, because allows me execute function using $('#my-element-id').data('customfunction')(); example, still doesn't solve problem, new property of selected buttons not accessible other way. to sum up: simplest way add generic function (like in example) collection of dom elements in way it's accessible other property? adding function directly dom element not considered practice variety of reasons. i'd suggest jquery plugin method pretty easy: jquery.fn.mymethod = function(

database - Insert query into Access C# -

i'm working access data base, have users table. i have insert query : database.execute("insert users(userid,firstname,secondname,username,password,permission) values(" + obj.personid + ",'" + obj.firstname + "','" + obj.lastname + "','" + username + "','" + psw + "'," + permission + ")"); i checked parameters' values same table's ones... says there syntax error in insert query. parameters, parameters, parameters. first benefit code, forget single quotes. second, avoid dreaded sql injection vulnerability. third, code easier read. consider this: string insertquery = "insert table (field1, field2, field3) values (@par1, @par2, @par3)"; database.execute(insertquery, var1, var2, var3); where var1 , var2 , var3 variables containing values need insert. there's simpler (but worse, because it's still vulnerable s

VBA (Excel): Step Over debug and crash down with application.run -

i'm working vba excel. have following function: function (...) ... application.run "subname"... ... end function first question: while i'm debugging step on (shift f8) @ application.run line, debugger go "subname" sub that's step debug (f8 alone) instead of step on (shift f8). so question is: possible step on debug application-run? second question: if stop macro during execution of application.run command excel automatically close! so question is: there alternative application.run command? thanks i have been experiencing same problem mentioned , tested creating application object run method, solved crash. an example: function addspace(val1) string addspace = val1 & " " end function sub testrunanotherfunction() dim result, o set o = application() result = o.run("addspace", "one") result = result & "detail" end sub but not satisfied , wanted figure out why

how can I access the javascript variable value in my qt-code -

i'm beginner in qt. tell me how use javascript variable value in qt-code? in advance. here documentation should answer question: http://qt-project.org/doc/qt-4.8/qwebframe.html#evaluatejavascript http://qt-project.org/doc/qt-4.8/qtwebkit-bridge.html http://qt-project.org/doc/qt-4.8/qwebframe.html#addtojavascriptwindowobject http://qt-project.org/doc/qt-4.8/qwebframe.html#javascriptwindowobjectcleared just looking @ docs, need call addtojavascriptwindowobject() , , maybe need make sure object doesn't cleared when javascript finishes. hope helps.

ruby on rails - Website screen capture on Linux server -

i have webpage written in angularjs needs turned image , sent email once week clients. webpage on s3 , backend server written partly in rails , partly in node. ideas how this? you can use phantomjs (or based on phantom casperjs) - library selenium, headless browser. possible create screenshots different device resolution , user-agent. http://phantomjs.org/screen-capture.html

javascript - Angular - Only show a div if something is present -

im trying make div appear if there no comments on article not sure how use ng-if correctly here. in scope have "comments" empty array if there no comments on article im not sure how check im using ng-repeat list comments id hide div if there no results in ng-repeat. this code default articles hide div if there no articles overall doesnt narrow down individual items comments. ng-if="articles.$resolved && !articles.length" how can change comments on article? the comments not embedded in article model. separate model article id value in comments model. if understand correctly want hide div if there no articles , no comments. if case, try this: <div ng-if="articles.length> 0 && comments.length>0"> <!-- content --> </div>

Certificate identity 'iPhone Developer: appears more than once in the keychain. The codesign tool requires there only be one -

i deleted old certificate. again , again error come. in keychain have 1 certificate. im using ios6.1 once remove copy of certificate keychain, again install in keychain. it'll solve problem. hope helps. thanks.

c# - CRUD MVC web application on top of Web API 2 -

i developed web api 2 web service, providing lot of endpoints, several pages , modules asking information. this approach sincei'm providing lot of data in way lot of different clients. now, i'd create simple crud page myself show information. i'd start using asp.net 5, , i'm start looking tutorial , resources, found info ef interaction, not case. can collect resources study , reach goal? thanks, roberto i have written application of architecture; asp.net 5.0 mvc application using asp.net 4.5 web api 2 crud operations. as other folks have said, api call can achieved via httpclient. the way i've created mvc pages in scenario before use scaffolding against model (right click project > add > new scaffolded item > mvc controller etc), substitute entity framework code in controller own api calls. way scaffolded views , controller structure.

javascript - Getting started with angular assistance -

i trying output hello world, {{"hello world"}}. first attempt of angular app. can tell me what's missing in code? imported angular.min.js, declared app in app.js , attached html tag, still can't output hello world. ideas? <!doctype html> <html ng-app="app"> <head> <title>bootstrap 3</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <link href="index.css" rel="stylesheet" type="tex

unity3d - Unity Shader: Deform a 3D model using vertex shader then apply specular using surface shader -

i need in applying specular shade in 3d model after deformed in cg vertex shader. don't know how in unity shader. searched in google , there no hits of looking for. below current solution. 3d object rendered twice. shader "myshader/deformspecular" { properties { _color ("main color", color) = (1,1,1,0.5) _shininess ("shininess", range (0.01, 1)) = 0.7 _maintex ("base (rgb)", 2d) = "white" { } _bumpmap ("normalmap", 2d) = "bump" {} _cubesize("cube size", range (1, 10)) = 1 } subshader { tags { "rendertype"="opaque" } lod 250 pass{ cgprogram #pragma vertex vert #pragma fragment frag #include "unitycg.cginc" #include "myshaderfuncs.cginc" s

javascript - Google App Help? Can't make button -

this question has answer here: onclick within chrome extension not working 3 answers i extremely new java script , html , project right make simple calculator, however, cannot button output answer , cannot seem figure out why my html code is: <html> <head> <title>calculator</title> <link rel="stylesheet" href="styles.css"> </head> <body> first number:<br> <input type ="number" id="num1"><br> second number:<br> <input type ="number" id="num2"><br> answer:<br> <input type= "number" id="answer"><br> <button id ="add" onclick="add()"> + </button> <button id ="subtract" onclick="subtract()"> -

android - Getting Image from drawable and adding to PDF using iText -

i want add image android pdf using itext. want achieve without saving image sdcard first. put image res/drawable folder proving image path doesn’t work , throws filenotfound exception. path this: string path = “res/drawable/myimage.png” image image = image.getinstance(path); document.add(image); now please suggest me solution how add correct file path getinstance(…) method. thanks of course it'll not work @ way. move image assets folder access getassets() method // load image try { // input stream inputstream ims = getassets().open("myimage.png"); bitmap bmp = bitmapfactory.decodestream(ims); bytearrayoutputstream stream = new bytearrayoutputstream(); bmp.compress(bitmap.compressformat.png, 100, stream); image image = image.getinstance(stream.tobytearray()); document.add(image); } catch(ioexception ex) { return; }

php - How do you get the payKey from a transactionId? -

i've been using paypals ipn receive , process payments, storing transactionid reference. the time has come able refund payments through system i'm developing , here lies struggle. when using entering transactionid paykey field on getpaymentdetails.php sample in updated php sdk, correct authentication details , application id, get: error id: 580022 domain: platform severity: error category: application message: invalid request parameter: paykey value [removed (transactionid)] parameter: array this understandable, expecting paykey. now, can change $pdrequest->paykey = $paykey; $pdrequest->transactionid = $paykey; per specification. should send transactionid transactionid , work, in response: error id: 520002 domain: platform severity: error category: application message: internal error ok, broken. suspect not allow transactionid used reference , haven't updated documentation (typical). reason suspect original sdk used included field transactionid, tra

javascript - How to automate selecting certain codes in an html? -

hi have question automating selecting content in html. if save webpage html only , we'll html codes along other stylesheets , javascript codes. however, want extract html codes between <div class='post-content' itemprop='articlebody'> and </div> , create new html file has extracted html codes. there possible way it? example codes down below: <html> <script src='.....'> </script> <style> ... </style> <div class='header-outer'> <div class='header-title'> <div class='post-content' itemprop='articlebody'> <p>content want</p> </div> </div></div> <div class='footer'> </div> </html> while i'm typing, i'm thinking javascript, seems able manipulate html dom elements..is ruby able that? can generate new clean html contains content between <div class='post-content' itemprop='articlebody'&

sql - Informix - Delete temp table if exists -

i'm trying delete temp table when run query. cannot find answer , searched documentation. basically, want check if table exists; if exist, delete , proceed select results can inserted temp table. if doesn't exist, well, create temp table results can inserted. i'm using informix 11.70 if supported in 11.70 (it in 12.10), syntax is: drop table if exists temp_table_name; the 11.70 manual drop table indicates exists in 11.70 12.10. then run query into temp temp_table_name clause recreate table.

c# - Diagnosing Sonarqube with Roslyn analyzers -

i setting sonarqube team , have run issues working the sonarqube roslyn sdk found on github . following instructions on github page, have compiled solution. however, when running generator tool @ [directory]/sonarqube.plugins.roslyn.plugingenerator.exe, getting following error when attempting create plugin per instructions microsoft.codeanalysis.analyzers: c:\users\[homedirectory]\src\github\sonarqube-roslyn-sdk\roslynplugingenerator\bin\debug\sonarqube.plugins.roslyn.plugingenerator.exe /a:c:\users\[homedirectory]\src\github\sonarqube-roslyn-sdk\roslynplugingenerator\bin\debug\microsoft.codeanalysis.analyzers:1.0.0 roslyn analyzer plugin generator sonarqube 0.1.0.0 [debug] parsed nuget reference. id: c:\users\[homedirectory]\src\github\sonarqube-roslyn-sdk\roslynplugingenerator\bin\debug\microsoft.codeanalysis.analyzers, version: 1.0.0 [debug] fetching nuget config files... [debug] enabled package sources: [warning] no enabled package sources. please update nu

ASP.NET MVC 5 Identity 2 PasswordSignInAsync method always returns false -

i'm writing come code external app. i'm trying use microsoft identity 2.0 , asp.net mvc 5. i've customized userviewmodel hold firstname , lastname , couple of other parameters. whenever register user logs in when try normal login email/password. signinmanager.passwordsignasync returns false. since code checks internal framework i'm trying figure out how debug situation. provide code here who's willing @ it. in advance! that generic login function provided microsoft in examples. i've not changed there. function has error message. public async task<actionresult> login(loginviewmodel model, string returnurl) { if (!modelstate.isvalid) { return view(model); } // doesn't count login failures towards account lockout // enable password failures trigger account lockout, change shouldlockout: true var result = await signinmanager.passwordsigninasync(model.email, model.password, mo

canvas - Javascript: toDataURL really slow, how to speed up? -

i have animation being generating using three.js , being piped out c++ application via websockets. grabbing each frame canvas, encoding via base64 , sending out string. problem is, .todataurl() function calling cutting fps in half 60 30, know why have such dramatic effect , if there's other canvas data? let me know if need more info. here's html/js code: <!doctype html> <html lang="en"> <head> <title>three.js canvas - geometry - cube</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <style> body { font-family: monospace; background-color: #f0f0f0; margin: 0px; overflow: hidden; } </style> </head> <body> <script src="../build

ios - Video player in subview using an external source, isn't scaling -

Image
i following video: https://developer.apple.com/videos/play/wwdc2014-503/ and made quick demo , tried add container view , changing subview avplayer showed. added code, although in swift form. the difference in constructor avplayer in prepareforsegue function wrote following: playerviewcontroller.player = avplayer(url: nsurl(string: "http://jplayer.org/video/m4v/big_buck_bunny_trailer.m4v")!) the video wide , happens half video player expands past screen i tried playerviewcontroller.view.sizetofit() , on properties video controller i've tried different videogravity settings (disclaimer: bad ides. avoid them, ios appears impossible) all of code: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "showmovie" { nslog("im in!!"); //self.view.translatesautoresizingmaskintoconstraints = false let playerviewcontroller = segue.destinationviewcontroller as! avp

node.js - How to install forever-monitor module using npm in ubuntu -

in application want restart node js server programmatically.for need install forever-monitor while installing module using npm im getting error "no compatible version found: forever-monitor".my node version v 0.6.17.can fix issue. you need upgrade 0.8 atleast. forever-monitor requires node 0.8.x. see here . you can check node version required particular package looking engine field npm view forever-monitor { name: 'forever-monitor', description: 'core forever process monitor', 'dist-tags': { latest: '1.1.0' }, ... engines: { node: '0.8.x' },

mod rewrite - php mod_rewrite Permalinks -

i looking way access to: http://myurl.com/?file=random_token with http://myurl.com/random_token/ i read mod_rewrite in . htaccess don't know how setup pattern. i tried this: options +followsymlinks rewriteengine on rewriterule /(.*)/$ /index.php?file=$1 it nice if can me. rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]*)/$ /?file=$1 [l]

Phonegap - jquery Mobile : button click event not able catch in android -

i developing sample app using phonegap jquery mobile plugin android. created page, main.html. main.html, able catch event. once button pressed in main page, change contents using( $.mobile.changepage("path") ) function signup.html. have button in signup.html when click button click event not fired. have loaded js file in signup.html well. doing wrong? please guide me. clarification: should keep 1 html (main.html ) , through have page navigation.? in case second page javascript placed inside head content if understood correctly, using ajax load page dom ? if true understand problem. see, when ajax used page loading body content loaded dom . you can fix problem if initialize second html page javascript inside first html file or move script block inside second html body content. also, have described problem in other article more details , few examples, or can found here . in case have several buttons same id this little different problem. see, if

ruby - How do I get Puppet Master to run a manifest against a Puppet Agent node when there are different errors? -

i have set puppet master , puppet agent server in 1 network. have signed puppet agent's cert request puppet master server. trying run manifest puppet master against puppet agent server, failing. newmanifest.p p on both puppet master servers calls puppet agent through fqdn . /etc/hosts file on both servers has entries of fqdn of both servers , ip addresses. can ping each server other. can ssh each server other. all 4 of these servers in both networks have centos 7 os open source puppet version 3.8.4 . firewalls turned off on 4 machines. these ports not blocked on intermediate path: 22, 443, 8140, , 61610 on either network between puppet master , puppet agent servers. in network one, expect manifests compile. never have. i tried sshd_config` use ports 22, 443, 8140, , 61610 on both puppet master , puppet agent. when use puppet master: puppet agent -t newmanifest.pp --server='foobar.acme.com' i error: unable fetch node definition, agent continue: warning: co

dubts about security with passwords in database -

i have read article: http://crackstation.net/hashing-security.htm and in section hash password, says better hash password in server, because if stole hash database can access user account without need of password. but if can stole hash database, can access whole database, correct? if correct, can access data, no of user information. why want part of information? an attacker tries steal database able access application. of course, if database contains sensitive information (like credit card numbers) not need access application if stole database. (the pci dss standard explains how store credit cards information) if found plain text password – able access application without problem. if database contains hashed value attacker need found plain text value corresponds hashed value. if use weak hash algorithms md5 or sha1 attacker can easier fine plain text value. for better protection recommended use strong hash algorithms sha128 or sha 256. in addition, recommend use d

R Piecewise Function with Multiple Outputs -

i have 2 functions, each of return 2 values (as list) , operate on limited domain: # x >= 0 f <- function(x) { return(list(a=x,b=2*x)) } # x < 0 g <- function(x) { return(list(a=x/2,b=x/4)) } i want this: fg <- function(x) { return(ifelse(x < 0, g(x), f(x))) } and i'd this: > fg(c(1,2)) a$ [1] 1 2 b$ [2] 2 4 > fg(c(-1,-2) a$ [1] -0.5 -1.0 b$ [2] -0.25 -0.50 instead, getting this: > fg(c(1,2)) [[1]] [1] 1 2 [[2]] [1] 2 4 > fg(c(-1,-2)) [[1]] [1] -0.5 -1.0 [[2]] [1] -0.25 -0.50 the "$a" , "$b" labels getting lost. with single input, it's worse: > fg(1) [[1]] [1] 1 what doing wrong? how can achieve objective? i have modified code, # x >= 0 f <- function(x) { return(list(a=x,b=2*x)) } # x < 0 g <- function(x) { return(list(a=x/2,b=x/4)) } fg <- function(x) { tmp <- lapply(x, function(y) switch(as.character(y > 0), 'true' = f(y), 'false' = g(y)))

how to write package name in android manifest? -

i working on application had created 3 packages in application , put 3 package in 1 particular package , had updated android manifest still force closed.i had tried lots of things no working please me. how solve that? android manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mayank.com" android:versioncode="1" android:versionname="1.0" > <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="mayank.com.onlinerecharge.mainactivity" android:label="@string/app_name" android:theme="@style/tabtheme"> <intent-filter> <action android:name="android.

c# - How To Play Youtube Videos in Windows Phone using Silverlight Media Framework -

i have link, id (all metadata youtube url) , want play video, using smf player in windows phone 8 app. possible? i think can use media element stream videos audio , video windows phone

Why does Bootstrap 4 card images use data-src and not src for image tags? -

in demo code below uses data-src no img src. how image applied? javascript modify somehow? http://v4-alpha.getbootstrap.com/components/card/ <div class="card"> <img class="card-img-top" data-src="..." alt="card image cap"> <div class="card-block"> <h4 class="card-title">card title</h4> <p class="card-text">some quick example text build on card title , make bulk of card's content.</p> <a href="#" class="btn btn-primary">button</a> </div> </div> bootstrap 4 documentation uses holder.js, see http://imsky.github.io/holder/ also see: https://github.com/imsky/holder#usage include holder.js in html: holder process images specific src attribute, one: the above tag render placeholder 300 pixels wide , 200 pixels tall. to avoid console

Static mutlidimensional arrays in C vs pointers and addresses -

i'm learning c , got stuck on following piece of code: int a[num_rows][num_cols], (*p)[num_cols], i; (p = &a[0]; p < &a[num_rows]; p++) { (*p)[i] = 0; } according author supposed assign 0 i-th column of 2d array. i understand in reality it's not rows , columns continuous block of memory - pretty 1d array each element 1d array. also: array name equivalent of address of first element of array (according book i'm reading). 1d arrays makes sense me, 1st element can int or char or whatever. in 2d arrays however, each element array, again address of first element of array - time "inner" one? mean "a[0]" gives address of 1st element of array, , use "&" operator on it? give me, address of address? :/ could please explain what's happening here, step-by-step? what's address here, what's pointer, etc. went on number of chapters on pointers in various c books compare how authors explain this, looks use "point

scripting - My automatic phonegap installer needs jdk download with wget, I have it working in command prompt but not in .hta file -

i have written vbscript based .hta installer install phonegap/cordova automatically pre-requisites(ant/jdk/bada sdk etc). done stuck @ part need download jdk directly. if copy paste (long) line in commandprompt , works wget --header "cookie: gpw_e24=http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html;" ""http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-windows-i586.exe -o jdk.exe it download jdk directly , absolutely fine . when paste code snippet in notepad e.g , save .vbs , run doesnt work set objshell = createobject("wscript.shell") objshell.currentdirectory = "c:\" 'inquotes function puts quotes around command parameters objshell.run inquotes(workingdir & "\wget.exe") & " " & " --header " & inquotes("cookie: gpw_e24=http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html; ") & "http://

sql server 2008 - How to pass more than one values as parameter to sql statement? -

i have 1 big sql query , want pull out data using query declare @period varchar(10) = 'mtd' declare @date datetime = '2011-08-31' and have big select statement i'm passing above parameters , executes output. now have 10 different dates need pass here each time see result. how can pass date above parameter declare @date datetime how can hard code ? so desired output selected dates, give me hint @ least 3 dates ? use table-valued parameter. first, create type: create type dbo.dates table(d date); now stored procedure can take type parameter: create procedure dbo.whatever @d dbo.dates readonly begin set nocount on; select t.columns dbo.tablename t inner join @d d on t.[date] = d.d; end go then application can pass parameter in datatable , example.

msbuild - MSTests fail on build server after passing locally -

this bit odd me, i've worked through several micro-services unit tests , haven't experienced problem this. issue unit tests pass locally some fail on our build server. oddity if single out failing test in build script pass. if run test running before failure result. if remote test server , access test result file , rerun tests, pass. me says has build environment - "runner" context. specific error on failed tests is: system.data.entity.core.entityexception: underlying provider failed on open. ---> system.data.sqlclient.sqlexception: network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. again, test had ran , passed accessing db right before failing test. additionally should noted these tests using stored procedures access data , using linq sql (.dbml). thought had context not being disposed of

angularjs - Can't set angular $scope variable from a callback function in Ionic -

i new in angular js. working web sql in test project learning purpose. insert operation working fine. problem when fetch records can't store in $scope.todos=results.rows code is tx.transaction(sql,[],mycallback) function mycallback(tx,results) { console.log(results.rows); // shows objects in console $scope.todos=results.rows; } in view todos not working ng-repeat. it might show of controller, or service. if it's controller make sure included $scope parameter example: .controller('mycontroller', function ($scope){ })) if doing inside service, save in variable inside service, controller "$scope" available include service call variable containing results. helpful if need share results other controllers @ later time. .service('mydataservice',function(){ var todos; return { .... set , functions access variable ... gettodos: function() { return todos; } }; }); and in controller

c# - How to use custom trace listener to log traces in .net -

i have come across link http://www.codeproject.com/articles/447238/advanced-tracing#_comments . , author did quite nice job of creating custom listener logs database. while researching more on tracing/logging read (from here https://blogs.msdn.microsoft.com/bclteam/2005/09/20/a-tracing-primer-part-ii-b-mike-rousos/ ) trace source calls following methods when needs trace through listener. void traceevent(traceeventcache eventcache, string source, traceeventtype eventtype, int id) void traceevent(traceeventcache eventcache, string source, traceeventtype eventtype, int id, string message) void traceevent(traceeventcache eventcache, string source, traceeventtype eventtype, int id, string format, params object[] args) void tracedata(traceeventcache eventcache, string source, traceeventtype eventtype, int id, object data) void tracedata(traceeventcache eventcache, string source, traceeventtype eventtype, int id, params object[] data) void tracetransfer(traceeven

javascript - Primefaces dialog to set height half screen size -

i using primefaces 5.1. in page use dialog , height attribute. need set screen size 70% of height dialog because screen height differ system need set dynamic height. need javascript or css used set screen based height? <p:dialog widgetvar="dialogwidget" id="dialogid" position="center,top" height="height set"> ........ </p:dialog> first define css class .autowidthdialog { width: auto !important; } then use above css in dialogbox <p:dialog id="dialog" styleclass="autowidthdialog" header="my dialog"> ... content ... </p:dialog> this old workaround this, may in latest primefaces have added autosize attribute. another solution can use style style attribute <p:dialog ... modal="true" style="width:50% !important; height:40% !important; top:25% !important; left: 30% !important;"> </p:dialog>

how to send and receive back the user_id in the success link of payPal? -

i'm confused paypal sequences. want add in website donation paypal link "for members only" it's client demand , want store in db if user have made donation or not , how much. using in website link https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6senm6tba5epl means have account on paypal , have created button id "6senm6tba5epl". know button config. in paypal site can set cancel , success links,it's ok. want send user_id , receive paypal variable on success link if donation made. so it's add url variable https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6senm6tba5epl &user_id=123 or can use paypal form <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="user_id" value="123"> <input type="hidden" name="cmd" value="_s-xclick"> &l

string - Using Arduino C++ libraries on PC platform -

arduino has c++ libraries use on pc platform. advantage 1 can test , debug arduino code on pc. easier debugging on pc. one library particularly keen on string library. https://www.arduino.cc/en/reference/string is possible somehow import arduino string library c++ ide visual studio given arduino library open-source? how can done? the string library free of platform-specific dependencies, add wstring.h , wstring.cpp source files. have little bit of porting (cleaning macros, suspect), there's no reason shouldn't build. many other libraries going considerably more difficult port on pc; touches peripherals of mcu not going port well.

architecture - Way to communicate between backend server ? -

Image
i have work on 3 distinct applications instead of big one. question : "can jms used communicate between different servers (wildfly)" ? this way can add more servers second application if see take longs process. here simple exemple 15 servers. 5 first app take data , them. 5 second app calculate , last application format them , store them second db. if second app takes long, able add 3 servers on fly , let them connect first jms q , second jms q. maybe other suggestion how build ? thanks this pretty standard messaging. might depend on jms server, if use queues, each server should able consume individually , message process. the bigger issue going design of applications. need stateless message can picked server in order , processed without regard else happening. [of course, if there's shared back-end data provider shared among servers, provide context.] another issue going transactionality , recovery. if message picked server but, whatever r

c++ - how to use user defined structure in opencl -

i trying explore way use structure in opencl i first try struct (defined on host) typedef struct userstruct { cl_int x; cl_int y; cl_int z; cl_int w; } userstruct; and structure (defined on device) typedef struct userstruct { int x; int y; int z; int w; } userstruct; using defined structure, create 2 buffers (para_input , para_output) , init them different values. kernel function copies value para_input para_output. the example works fine. but, when add cl_int16 in struct, copying kernel not work. here modified structure: typedef struct userstruct { cl_int x; cl_int y; cl_int z; cl_int w; cl_int16 vn16; } userstruct; and structure (defined on device) typedef struct userstruct { int x; int y; int z; int w; int16 vn16; } userstruct; is there requirement align structure on both host , device? or popular way use structure in opencl? thanks. expanding on comment: it seems proble

ASP.NET Membership - Add extra field to ASP.Net Login page -

Image
currently in application, validating users using asp.net membership provider , asp.net default login page contains username , password. working fine 2 fields. per current requirement, need field "company" display dropdownlist in asp.net login page , validate 3 company, username , password using asp.net membership provider. possible or not, customize asp.net login page field using asp.net membership provider? please give me ideas how approach? membership provider's validateuser method accept 2 parameters - username , password. if override it, cannot pass 3 parameters. validateuser(string username, string password) basically, cannot use login control validate user. instead, want validate user yourself. here sample code - note: strip out codes in login control demo purpose. <asp:login id="loginuser" runat="server" onauthenticate="loginuser_authenticate"> <layouttemplate> <asp:textbox id="use

ruby on rails - RubyMine - Creating the testing folders after initially creating the project without them -

i created project excluding tests , want have tests web application. application not extensive, big enough such don't want re-start project. is simple creating folder 'test' in application directory? are there other things have adjust in other parts of program? thanks in advance. one option choose test framework , add app (probably adding gem , runing rake task depending of framework) another option edit config/application.rb , uncomment line: # require "rails/test_unit/railtie" also can create empty rails project , compare current app empty 1 copy/modify files different: config/application.rb , test/test_helper.rb

iphone - Get one by one character (value) from NSString -

i have nsstring in store value 2534568 i want first number 2 , 5 , then 3 , on..... thanks advance since no correct answer has been provided far, must answer if didn't otherwise. don't want misleaded: nsuinteger len = string.length; unichar buf[len]; [string getcharacters:buf range:nsmakerange(0, len)]; here, buf contain characters can iterate through. alternatively, can use charateratindex: method too, although i'm not sure that's not slower plain array indexing. (thus should benchmarked if it's bottleneck, don't perform premature optimization, though.)

node.js - Expect array to be array -

writing tests , ran across error. array's seem same me, apparently not. error i'm getting. idea on fix it? expected array [ 'a2t1511300361', 'a2t1511300362' ] array [ 'a2t1511300361', 'a2t1511300362' ] test.js var should = require('should'), io = require('socket.io-client'), path = require('path'), express = require(path.resolve('./config/lib/express')), mongoose = require('mongoose'), sinon = require('sinon') ... client.on('printerlist', function(list){ var temparray = []; temparray.push('a2t1511300361'); temparray.push('a2t1511300362'); console.log(temparray); list.should.equal(temparray); }); you cannot directly test array quality in manner doing. [1,2] , [1,2] may have same elements, different arrays. more formally: [ ] !== [ ] [ ] != [ ] you trying test deep equality. this, need check each array element. many

android - How to animate image in RecyclerView's item? -

gmail (supposedly using recyclerview) in inbox displays items contain images , text. when given item selected/tapped triggers animation of image 'transitions' checkbox. i've seen examples of animations apply whole items (viewholders). however, have no idea how gmail app able animate images only. any appreciated. if there image in recycler view item , want start new activity animating image when recycler item clicked, add same transition name image view in recycler item image view in next activity. <imageview android:layout_width="100dp" android:layout_height="120dp" android:layout_margintop="10dp" android:id="@+id/image" android:scaletype="fitcenter" android:transitionname="bookimage"/> then through onclick listener start activity using activity options compat animate image. itemview.setonclicklistener(new onclicklistener() { @o

javascript - How to close dashboard programmatically using AppleScript? -

i'm developing small dashboard widget allows user open system preference pane. opening preference pane no problem (but looks awful :p) widget.system('osascript ' + '-e \'tell app "system preferences" activate\'' + '-e \'<snip…> open correct pane\'') the problem if preference pane opens, dashboard stays open too. i have found ways of opening it: tell app "dashboard" launch but no way close it, close raises exception , quit nothing :/ does know how this? try: tell application "dashboard" launch delay 3 tell application "finder" activate or maybe keystroke... tell application "system events" key code 53

python - Twython returned a 400 (Bad Request) when tweeting an image -

i'm writing small script in python running in raspbian tweet speedtest result , i'm trying attach image, code: import sys, urllib, cstringio pil import image twython import twython ... file = cstringio.stringio(urllib.urlopen(url_img_).read()) imagen = image.open(file) print imagen image_ids = twitter.upload_media(media=imagen) print image_ids twitter.update_status(status=message_, media_ids=[image_ids['media_id']]) but getting error on twitter.upload_media : traceback (most recent call last): file "twitter_phy.py", line 29, in <module> image_ids = twitter.upload_media(media=imagen) file "/usr/local/lib/python2.7/dist-packages/twython/endpoints.py", line 140, in upload_media return self.post('https://upload.twitter.com/1.1/media/upload.json', params=params) file "/usr/local/lib/python2.7/dist-packages/twython/api.py", line 269, in post return self.request(endpoint, 'post', params=params, v

objective c - Flip view controllers inside bigger view controller will flip the main view controller -

i want flip view controller has smaller size screen. using transitionfromviewcontroller flip whole screen. , want smaller view controller flipped. first login should visible, after flipped register view should available! my code is - (void)showlogin { vclogin = [[loginviewcontroller alloc] initwithnibname:@"loginviewcontroller" bundle:nil]; [self.view addsubview:vclogin.view]; [self addchildviewcontroller:vclogin]; if (is_ipad()) { vclogin.view.center = self.view.center; } } - (void)showregister { vcregister = [[registerviewcontroller alloc] initwithnibname:@"registerviewcontroller" bundle:nil]; [self.view addsubview:vcregister.view]; [self addchildviewcontroller:vcregister]; if (is_ipad()) { vcregister.view.center = self.view.center; } [vclogin willmovetoparentviewcontroller:nil]; [self transitionfromviewcontroller:vclogin toviewcontroller:vcregister duration:0.5f options:uiviewanimatio