Posts

Showing posts from August, 2010

Currency Formatting with Delphi -

Image
i trying writte code in delphi, displaying given number in currency format this: now works if filled whole number , field until paramater updated. i'd happy have code displaying number in currency format writte it. i've tried manage typing this: procedure tform1.editzakladchange(sender: tobject); var zaklad: currency; begin zaklad := strtofloat(editzaklad.text); editzaklad.text := floattostrf(zaklad, ffcurrency, 10, 2); end; end. but everytime when someting typed in (zaklad field), error appears: could me that, please? make sure maxlength of edtzaklad 0. var form21: tform21; check:string; //to break loop. function getcurrency(num: string):string; var i: integer ; str:string; zaklad: currency; begin result := ''; := 1 length(num) begin if (num[i] in ['0'..'9']) begin str := str + num[i] ; zaklad := strtofloat(str); result := floattostrf(zaklad, ffcurrency, 10, 2); check := ...

xcode6.3.2 - Xcode crashes on selecting tab in color panel -

i facing strange issue few hours , started suddenly. whenever try select different tab in color panel in xcode,the whole xcode crashes error, uncaught exception (nsrangeexception): cannot remove observer <nscolorpickerpageablenamelistscrollview 0x7fb8f6ce0910> key path "contentlayoutrect" <highlightcolorpanel 0x7fb8f6c94af0> because not registered observer. following full stack trace error, process: xcode [1958] path: /applications/xcode.app/contents/macos/xcode identifier: com.apple.dt.xcode version: 6.3.2 (7718) build info: ideframeworks-7718000000000000~2 app item id: 497799835 app external id: 812404257 code type: x86-64 (native) parent process: ??? [1] responsible: xcode [1958] user id: 501 date/time: 2015-06-20 13:50:18.080 +0530 os version: mac os x...

asp.net mvc - How to Pass Kendo DropDownList DataTextField value to Controller -

i have kendo dropdownlist on view , want pass datatextfield value controller , pass , them on labels in view . although can pass datavaluefield values controller , cannot pass datatextfield values. tried apply different scenarios not. idea? on other hand, if not possible, should datatextfield values populated again on controller , return other view ? view: @model issueviewmodel ... @html.labelfor(m => m.projectid) @(html.kendo().dropdownlist() .name("projectid") .datatextfield("projectname") .datavaluefield("projectid") .datasource(source => { source.read(read => { read.action("getprojects", "issue"); }); }) ) controller: public jsonresult getprojects() { var projects = repository.projects; return json(projects.select(m => new { projectid = m.id, projectname = m.description }), jsonrequestbehavior.allowget); } /* want pass datatextfiel...

smartface.io - Smartface in action does not work on android devices -

i have opened smartface in action application on ide, not work on android devices. when application opens white , empty page appeared on device screen. and objects must in pages in project disappeared. pages have white screen. smarface emulator takes lot of memory (i think because js files loaded in memory). try clear (close apps from) memory of android phone , try again. hope helps.

Why is lazy evaluation in Haskell "not being lazy"? -

when tried following code in cghi: take 1 $ take 1 $ repeat [1..] i expecting result of 1 instead of [[1,2,3,4,5,6,7,8,9,10,... printing on terminal. why lazy evaluation not functioning i'm hoping under such situation? take of type int -> [a] -> [a] , i.e. returns list. seems you’re looking head , returns 1 element. head $ head $ repeat [1..]

javascript change timestamp value '1434460015' to 'y-m-d' -

i know how change date readable format in php below $jobpostdate = date("y-m-d", '1434460015'); how can same thing javascript if have unix timestamp value 1434460015 or other unix timestamp value value , have within ajax success function, can syntax? simple use new date(1434460015000) //if it's in second convert millisecond *1000 for format need in manual way var today=new date(1434460015000); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear(); if(dd<10){ dd='0'+dd } if(mm<10){ mm='0'+mm } var today = dd+'/'+mm+'/'+yyyy; alert(today);

pdf - PDFCreator V2.1 C++ COM startup -

i'm trying use new pdfcreator (v2.1). clspdfcreator no longer there, , examples i've found in searches use old system. they supply examples in other languages, none in c++ (mfc windows). think once have established connection pdfcreator can follow examples in other languages. a fragment of old version: ccomptr<pdfcreator::_clspdfcreator> pdfobject; hresult hr = pdfobject.cocreateinstance(l"pdfcreator.clspdfcreator"); pdfobject->cstart("/noprocessingatstartup", 1); and i've been trying guess new version equivalent should be, no success. example: ccomptr<pdfcreator::ipdfcreator> pdfobject; hresult hr = pdfobject.cocreateinstance(l"pdfcreator.ipdfcreator"); compiles hr signals failure... hr gives me "incorrect interface string" (i'm translating italian): hr = 0x800401f3 stringa dell'interfaccia non valida. – pdfcreator makers have told me documentation , proper support com available in v2.2 ...

jquery - Loading bootstrap3 menu items from json response -

i trying show items send server bootstreap munu items. trying following code html <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <span id="info-count"></span> <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="get-info-list"> <i class="fa fa-list-alt"></i> </a> <ul class="dropdown-menu" id="infolist" role="menu"> <!--items should loaded here--> </ul> </li> </ul> script $(document).on('click', '#get-info-list', function(event) { event.preventdefault(); alert('hiiiiiii'); $.getjson('getnotification', function(data) { console.log(data); $("#infolist").append(data); }); }); i trying here load data in li menu items. tried code h...

php - %%Include{ }%%Error accessing windows share through a Java application -

Image
i developed java application gives access shared folders network. scenario application accessing includes search field. accessing file using following code: try { file file = new file("//192.x.x.x/asfa/asfa dvd 2000 upto 2015 - q1/cdrun.exe"); desktop dt = desktop.getdesktop(); dt.open(file); } catch (exception e) { joptionpane.showmessagedialog(null, "unable access remote database, please try after time!!!"); e.printstacktrace(); } i have tried (only 1 of these lines @ time): file file = new file("\\\\server\\asfa\\asfa dvd 2000 upto 2015 - q1\\cdrun.exe"); file file = new file("\\\\192.x.x.x\\asfa\\asfa dvd 2000 upto 2015 - q1\\cdrun.exe"); file file = new file("//server/asfa/asfa dvd 2000 upto 2015 - q1/cdrun.exe"); for these above mentioned scenarios, application cdrun.exe opens up(which fine) server , gives error message : so, few similar posts in so[ link1 , link2 ] , googling around, found %...

c++ - Need to shift elements in deque. Code not working -

i want function shifts according input index u. if u negative, shift right, else left. using code below resulting deque same input. deque<float> move(deque<float>p, int u) { if(u==0 || p.size()==1) return p; else if(u<0) { for(int i=0; i<abs(p.size()); i++) { int temp = p.back(); p.pop_back(); p.push_front(temp); } } else { for(int i=0; i<p.size(); i++) { int temp = p.front(); p.pop_front(); p.push_back(temp); } } return p; } another variation code seems work fine in python not in c++ this: deque<float> move1(deque<float>p, int u) { deque<float> q; for(int i=0; i<p.size(); i++) q.push_back(p[(i-u) % p.size()]); return q; } you not shifting 1 step left or right, shifting left or right many times there items. this, of course, result i...

javascript - Losing line break when displaying text -

i can see line breaks "↵" string in chrome developer tools <br>↵↵<br>event status: confirmed↵<br>event description: hog day (night )and hog day (day)↵↵friday... if double click , paste notepad, line breaks preserved. when save string object so, var summary = el.find("summary").text(); var volunteerevent = {title: title, summary: summary} and display on page, $('#volunteereventdescription').empty().html(event.summary); the line breaks gone , it's huge chunk of text. how keep newlines? i see 2 obvious options. 1 right 1 depends on how control on formatting want. use pre tag , new lines respected. pre preformatted text , use non-proportional font may not render wish. see pre on mdn more details. replace new lines br tag. can regular expression: stringvalue.replace(/\n/g, '<br/>') . more robust regular expression present on question: jquery convert line breaks br (nl2br equivalent) . ...

iphone - iOS / Play audio when screen is locked but not when phone on silent mode -

i have developed chat app , problem notifications can heard if phone on silent mode (1). thing is, want notifications played when screen locked (2). checked avaudiosession categories, , seems can have either 1 of following: sounds disabled when phone on silent mode or screen locked; sounds enabled when phone on silent mode or screen locked. how can sounds disabled when phone on silent mode, enabled when phone not on silent mode , screen locked? possible tweak avaudiosession further, or (apparently cannot) detect silent mode programmatically? ok, fixed it. solution use audiotoolbox , system sound services. behavior of audiotoolbox looking for, i.e. respects ring/silent switch, can play in background or when screen locked. since wanted use avaudioplayer, first check ring/silent switch playing short blank system sound (let half second sound). if completion callback made within less 0.15 seconds, know on silent mode. if not, go on , play whatever sounds have avaudiopl...

perl - Make Check Page Reverse Proxy Nginx | Like Cloudflare's I'm Under Attack Mode -

i have large server ddos protection. have setup stopping layer 7 attacks. i want set reverse proxy website on other server , have check page similar cloudflare's i'm under attack mode. which after displaying check page , passing check nginx reverse proxy pass request onto other server website. there absolutely 0 documentation on this. i have found https://index.hm/hashcat.html although there many problems need perl modules. apt-get install nginx-extras doesn't have. i looking guidance, thank you! this question better on serverfault (but can't move don't have enough rep) hashcat isn't production-ready software, developer can give overview on how prepare server it: it needs ngx_http_perl_module module run correctly, think identified. far i'm aware, though, debian not compile nginx embedded perl module default. think red hat though, if makes life easier. you can activate module building nginx flag --with-http_perl_module . check...

node.js - Webworker-threads: is it OK to use "require" inside worker? -

(using sails.js) i testing webworker-threads ( https://www.npmjs.com/package/webworker-threads ) long running processes on node , following example looks good: var worker = require('webworker-threads').worker; var fibo = new worker(function() { function fibo (n) { return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1; } this.onmessage = function (event) { try{ postmessage(fibo(event.data)); }catch (e){ console.log(e); } } }); fibo.onmessage = function (event) { //my return callback }; fibo.postmessage(40); but add code query mongodb, throws exception: (not using sails model in query, make sure code run on own -- db has no password) var worker = require('webworker-threads').worker; var fibo = new worker(function() { function fibo (n) { return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1; } // db test -- works fine outside worker function...

jquery - how to make part of an output in italic - JavaScript -

there quite few questions on web , on website making italic fonts, non mentions how italic part of string. in case, there form enter book title, author's name , number sold. after clicking button want author's name , number sold normal book title in italic in text area (output). coding form: <label for="txtname">author name</label> <input type="text" id="txtname" size="50" placeholder="eg, darwin" maxlength="50"> <label for="txttitle">book title</label> <input type="text" id="txttitle" size="40" placeholder="eg, origin of species" style="font-style:italic" maxlength="100"> <label for="txtnumber">number sold</label> <input type="text" id="txtnumber" size="4" placeholder="eg, 50000" maxlength="9"> when user enters book title, ...

linux - CENTOS 6.6 "Errno -1 repomd.xml does not match metalink for updates " when trying to use yum command to install openssl -

platform: centos release 6.6 (final) when trying yum install openssl, error: epel 4 kb 00:00 http://mirror.symnds.com/distributions/fedora-epel/6/x86_64/repodata/repomd.xml : [errno -1] repomd.xml not match metalink epel trying other mirror. i have tried : yum clean all , yum info kernel . but still see similar error epel | 4.4 kb 00:00 http://mirror.symnds.com/distributions/fedora-epel/6/x86_64/repodata/repomd.xml : [errno -1] repomd.xml not match metalink epel trying other mirror. it looks cannot use yum command install anything. have used yum clean all yum makecache still see same problem. why see error: [errno -1] repomd.xml not match metalink epel ...

html - Pulsating color change on svg image -

i came across awesome design today: http://codepen.io/tmrdevelops/pen/jplplj i pulsating color change. on website have .svg logo change color when hover on image. actual svg change color, not background or anything. don't need on-click animation. is possible css? know have source right there in codepen little above skills. note: doesn't have based on code. long looks sort of same it's ok. html: <canvas id="canv"></canvas> <h4>click random squiggle</h4> css: @import url(http://fonts.googleapis.com/css?family=poiret+one); body { width: 100%; margin: 0; overflow: hidden; cursor: pointer; background: hsla(0, 0%, 10%, 1); font-family: 'poiret one', serif; } h4 { width: 100%; position: absolute; text-align: center; bottom: 0; left: 0; color: hsla(255, 255%, 255%, .5); font-size: 2em; letter-spacing: 15px; user-select: none; } javascript: window.requestanimframe = (function() { return ...

python - How to create mongoengine filter query from fields listed as string rather DocumentFields -

i trying write function can take filter query string , later want parse , create respective filter query used in mongoengine. tried using q() not working string. working: return q(id__istartswith=value) not working: _query = 'id__istartswith=' + value return q(_query) any highly appreciated. you can use keyword expansion. _query = {'id__istartswith': value} return q(**_query)

vba - Python Script to Turn Outlook E-Mail Rules on and Off -

i'm trying write python script/program turn off e-mail rules i've created in outlook 2010. through vba, i've managed write function turn array of rule names on , off based on passed in boolean. function togglerules(rulenames() string, tf boolean) boolean dim olrules outlook.rules dim olrule outlook.rule dim blnexecute boolean each rule in rulenames() set olrules = application.session.defaultstore.getrules set olrule = olrules.item(rule) olrule.enabled = tf if blnexecute olrule.execute showprogress:=true olrules.save set olrules = nothing set olrule = nothing next rule end function this works, , turn on/off rules send name other vba functions. if you're curious, when task reminder subject fires call function. i'd accomplish via python can trigger more sophistication reminder timers, , general cause i'd prefer way. seems can done pywin32 extension: http://sourceforge.net/projects/pywin32/ however i'm having hard time trying...

python - Flask-Login `user_callback` not being set, `user_loader` seems to be called twice -

i'm building simple python application using flask. i'm running trouble flask-login. seemed working until upgraded projects dependencies morning , can't figure out going on. the error i'm getting typeerror: 'nonetype' object not callable . here full stack trace: traceback (most recent call last): file "c:\users\acrowder\venv\lib\site-packages\flask\app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) file "c:\users\acrowder\venv\lib\site-packages\flask\app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) file "c:\users\acrowder\venv\lib\site-packages\flask\app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) file "c:\users\acrowder\venv\lib\site-packages\flask\_compat.py", line 33, in reraise raise value file "c:\users\acrowder\venv\lib\site-packages\flask\app.py", line 1817, in wsgi_app response = self.full_dispatch_request()...

sql server - SQL Update Query to update a table with aggregate value from another table using multiple fields -

i have table contains distinct name, dept, state worked, , empty field called earnings. have second table has many rows name, dept, , state worked match table , earnings field. i'd run update query total earnings distinct name, dept, state worked records , place value in earnings field in table a. table a: alan, sales, co alan, sales, ca paul, development, co paul, development, ca table b: alan, sales, co, $100 alan, sales, co, $150 alan, sales, ca, $200 paul, development, co, $100 paul, development, ca, $200 paul, development, ca, $300 desired result (table a): alan, sales, co, $250 alan, sales, ca, $200 paul, development, co, $100 paul, development, ca, $500 update set a.earning = b.totalearning tablea inner join (select name, dept, state , sum(earning) totalearning tableb group name, dept, state ) b on a.name = b.name , a.dept = b.dept , a.state = b.state

python - Tricontour with triangle values -

i produce tricontour plot similar these matplotlib. difference between these examples , situation don't have values of function in grid points: defined in triangles (e.g. in centroid of each triangle). i plot result of finite volume simulation, values defined each control volume, not each grid point. i suppose 1 simple solution average values @ each grid point. know if there more direct solutions. maybe not looking for, tripcolor function designed use case (value defined @ triangle centroid) see instance: http://matplotlib.org/examples/pylab_examples/tripcolor_demo.html

Send google analytics event in ruby -

Image
i have following code google analytics real time, in ruby: # execute query sa_visitcount = client.execute(:api_method => analytics.data.realtime.get, :parameters => { 'ids' => "ga:" + saprofileid, 'metrics' => "ga:activevisitors", }) followed with: send_event('sa_realtimevisitors', current: sa_visitcount.data.rows) this works great , returns active visitor count. trying change return event have created on google analytics. here event looks like. find under real-time , events. trying use event category "ad" listed #2 in screenshot. the code using attempt in ruby follows. phonehub_visitcount = client.execute(:api_method => analytics.data.realtime.get, :parameters => { 'ids' => "ga:" + saprofileid, 'metrics' => "ga:sessionswithevent", }) followed with: send_event('phonehub_event', current: phonehub_visitcount.data.rows) this return...

android - how to dynamically add image to imageView -

i wondering if of know how this. have activity has key value pair , trying display image if key equal string else don't show image. does know how or start trying work right? final string spliteddouble[] = companystring.split(",,"); string[] arrayofstring = { "beard vape co;beard_vape_co", "two;zwei", "three;drei" }; hashtable<string, string> hashtable = new hashtable<string, string>(); for(string s: arrayofstring){ string[] array = s.split(";"); string skey ="", svalue=""; if(array.length > 1){ skey = array[0]; svalue = array[1]; hashtable.put(skey, svalue); if(skey.tostring().equals(liquidcompany)){ imageview.setimageresource(integer.parseint("r.drawable." + svalue.tostring())); } } this have loop if have layout imageview set, can use view.setvisibility show o...

rotation - iOS: How I can make edges of sprite smooth when it is rotated? -

i making simple sprite kit game. when rotate sprite edges jagged. try texture images , image assets results same. here code filtering mode: let sprite = skspritenode(imagednamed: "texturename") sprite.texture!.filteringmode = sktexturefilteringmode.nearest // try .linear changing sprite's size original value or smaller scale, result not change. is possible use antialiased property sprite nodes ? there suggestion? similar problem on link: make edges of skspritenode smooth after rotation

php - generating a pseudo unique number(code) based on a sequence of numbers with no repetition within 4 digits -

i'm generating unique code don't want repeat within @ least 1000 consecutive numbers this function. take number multiply number take last $length=5 digits before decimal point function createpseudouniquestring($input,$length) { return substr( intval($input*738510.93067),-$length) ; } is there way validate resulting numbers not repeat other testing possibilities? is there alternative known not have repeating you can design custom linear congruential generator generates random 5-digit numbers , guaranteed not repeat until has generated of them. an lcg generates random numbers using following formula: xn+1 = ((xn * a) + c) mod m to generate 5-digit numbers m should 100000 (range of 0-99999). to guarantee no repeats (a "full period") have select values , c using following criteria: c , m relatively prime a - 1 divisible prime factors of m a - 1 multiple of 4 if m multiple of 4. the prime factors of 100000 2 , 5, , it...

Contact Google+ friends on behalf of user -

i'm trying send message, on behalf of user, subset of google+ friends. right now, can list of google+ friends separately can list of contacts' email addresses. is there way match two? or there better way of sending message contacts?

Why is this PHP / mySQL query giving me an error? -

i generating first part of query this: while ($all_products = $db->fetch_array($all_prods)) { $filter_string .= 'and product_id !='; $filter_string .= $all_products['item_id']; $filter_string .= ' '; } and second part this: $sql_more_items = $db->query("select * db_products owner_id='" . $user_id . "' , active=1 '" . $filter_string . "' order rand() limit 10"); however it's giving me mysql syntax error , $filter_string part strangely adds ' twice before , after string, runs this: where user_id='12345' , active=1 'and product_id !=0001 , product_id !=0002 ' order rand ... what doing wrong? $filter_string adds ' because put there. :p try double quotes around $filter_string : $sql_more_items = $db->query("select * db_products owner_id='" . $user_id . "' , active=1 " . $filter_st...

java - GWT arabic rendering -

i have problem sidebar items when set item text arabic text output looks ������� , not rendered lielement item1=new sidebaritem().addsidebaritem("fa fa-fw fa-dashboard","العملاء","index.html");//here problem sidebar.appendchild(item1); sidebar.appendchild(new sidebaritem().addsidebaritem("fa fa-fw fa-bar-chart-o","charts","charts.html")); sidebar.appendchild(new sidebaritem().addsidebaritem("fa fa-fw fa-table","tables","tables.html")); this function use public lielement addsidebaritem(string icon, string text,string target){ anc.setinnerhtml("<i class=\"" + icon + "\"></i> " + text); anc.settarget(target); return sidebarlistitem; } so how set inner text of element or widget arabic string example settitle("عربي"); i had change format in eclipse saves it's source files link helped me gwt: characte...

nest - Elasticsearch - how to get sum of field with terms? -

i'm trying sum of field, term (lets say, number of files of specific user id). first tried: _mainmanager.client.search<object> (q => q .type("mail") .filter(c => c.term("sentmail_sender_id", userid)) .aggregations(a => a.terms("sum", g => g.field("sentmail_upload_files_count"))) .size(1)); but no luck in agg property :( _mainmanager.client.search<object> (q => q .type("mail") .aggregations(a => a.filter("fil", b => b.filter(c => c.term("sentmail_sender_id", userid))).sum("sum", f => f.field("sentmail_upload_files_count")))); but again, no luck there. can help? the following code gives result need thing: put /mail/message/1 { "sentmail_sender_id":1, "sentmail_upload_files_count":10 } put /mail/message/2 { ...

mysql - Single row UPDATE query in SQL takes more than 3 seconds -

update `productdata`.`productlist` set `datelastupdated` = curdate(), `totalreviews` = 100 `productlist`.`name` = 'firstchefproultrasharpdualjuliennepeelervegetablepeelerstainless'; this query takes 2.93 seconds , affects single row. the table ~75k rows long. don't have experience in sql, there better way this? updating single row shouldn't take long i'm using latest version of sql on ubuntu server if need more information ask , i'll add post. thanks edit: i didn't know sql , mysql different things. the select statement select * `productlist` `productlist`.`name` = 'firstchefproultrasharpdualjuliennepeelervegetablepeelerstainless'; takes 2.88 seconds, guess problem index. edit: thankyou help when try create index on name says this: error 1170 (42000): blob/text column 'name' used in key specification without key length edit: switched name varchar(64) its faster now thanks everyone ...

web services - Added a folder to www. Appears as Folder structure on browser -

a buddy of mind developed image viewer website. have web server contains www/webdev folder development work done. the image viewer has own folder , file called viewer.php own images folder , css , scripts. want append folder webdev directory , see runs correctly. when type webdev/viewer should the webpage viewer (viewer.php) the problem when so, indexing of directories , files in webdev. how come website displays directories instead of web page? you need turn of indexing in .htaccess in root. put @ top. options -indexes additionally can create .htaccess file in /webdev/viewer/ , in put this. directoryindex viewer.php that should make default page /viewer.

ios - Smooth switching between texture atlas animations -

how can make smooth transitions between multiple animations on same character without delay? i'm developing game in ios swift jumping character. character has few animations, basic animation, jump animation , landing animation. i set texture atlas every animation follows: // basic let surferbasicanimatedatlas = sktextureatlas(named: "surfer_basic.atlas") let numimages = surferbasicanimatedatlas.texturenames.count var i=0; i<numimages; i++ { let surferbasictexturename = "surfer_basic_000\(i)" self.surferbasicframes.append(surferbasicanimatedatlas.texturenamed(surferbasictexturename)) } // jump let surferjumpanimatedatlas = sktextureatlas(named: "surfer_jump.atlas") let numjumpimages = surferjumpanimatedatlas.texturenames.count var i=0; i<numjumpimages; i++ { let surferjumptexturename = "surfer_jump_000\(i)" self.surferjumpframes.append(surferjumpanimatedat...

Yeoman and Bower not adding Bootstrap CSS (AngularJS generator) -

i following along codelab on yeoman webpage, , far i've managed follow along (with few major hiccups getting development environment going, doesn't return errors). so made project folder , ran yo , selected angularjs , run thing. process got prompt ? overwrite package.json? answered y , got following warnings: npm warn package.json codelab@0.0.0 no license field. npm warn peerdependencies peer dependency karma@>=0.9 included karma-jasmine no npm warn peerdependencies longer automatically installed fulfill peerdependency npm warn peerdependencies in npm 3+. application need depend on explicitly. npm warn peerdependencies peer dependency jasmine-core@* included karma-jasmine no npm warn peerdependencies longer automatically installed fulfill peerdependency npm warn peerdependencies in npm 3+. application need depend on explicitly. npm warn peerdependencies peer dependency karma@>=0.9 included karma-phantomjs-launcher no npm warn peerdependencies longer automati...

javascript - Adding new element to the object based on the comparison -

i have following objects: var empary= [{"empid":"101","name":"david"},{"empid":"102","name":"sam"}..];//2000 records var empary2= [{"empid":"101","name":"david"},{"empid":"105","name":"kevin"},{"empid":"109","name":"robert"},{"empid":"110","name":"rob"}..];//30000 records i need add new element empary object , populate new element value based on availability of particular record in empary2 . expected output:- empary= [{"empid":"101","name":"david", **"founinempary2":"yes"**},{"empid":"102","name":"sam", **"founinempary2":"no"}**..];//2000 records if can jquery good. please me. it's hard make sense of f...

symfony - Symfony2 and FOSRestBundle - Only Allow Users to Edit Data That They Own -

symphony version 2.2 (yah, know). fosrestbundle: 1.5.3 current scenario i have rest api driving angular page. let's each user has token associated w/ user record. consider following urls. get /api/user/{token}/messages post /api/user/{token}/messages get /api/messages/{messageid} get /api/user/{token}/votes post /api/user/{token}/votes so user can , post messages. user can make votes , see them. (i have 30 diff routes - urls on place). question how can verify user allowed get/post data token they're providing? i realize copy/paste code check given user vs user url. or write service w/ checkuser() function on each endpoint. my hope, though, there way of doing doesn't require me check user on each endpoint's entry point. don't send authentication in endpoint. endpoint typically should idempotent, , should individually identify particular resource. send authentication tokens in http headers. with said, strategy, baking...

mysql - Performing Alter Table on Large Innodb table -

i've been thrust position of db admin our server i'm having learn go. found 1 of our tables had maxed out id column , needs migrated bigint. innodb table roughly 301gb of data. running mysql version 5.5.38. command i'm running migrate table alter table tb_name change id id bigint not null; i kicked off migration , 18 hours migration, i'm not seeing our disk space on server change @ makes me think nothing happening. have plenty of memory no concern there, still shows following message state when run "show processlist;" copy tmp table does have ideas or know i'm doing incorrectly? please ask if need more information. yes, take looooong time. disks spinning fast can. (ssds employ faster hamsters.) you can kill alter, since doing is, says, "copying tmp table", after rename tmp table real table , drop old copy. i hope had innodb_file_per_table = on when started alter . else expanding ibdata1 , won't shrink aft...

java - Android - RecyclerView onClick not work -

i try change background of imageview clicking them, isn't work. i've in viewholder i attempt invoke virtual method ..streamviewholder.getadapterposition() on null object erference import java.util.list; import de.caglar.aqua.r; import de.caglar.aqua.objects.streamobject; import de.caglar.aqua.views.circularimageview; import android.support.v7.widget.cardview; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.imageview; import android.widget.textview; import android.widget.toast; public class streamadapter extends recyclerview.adapter<streamadapter.streamviewholder> implements view.onclicklistener { public static list<streamobject> streams; public streamadapter(list<streamobject> s){ streams = s; } public static class streamviewholder extends recyclerview.viewholder { cardview cardview; ...

php - Version Git Repo for Composer Use - Git/Composer -

scenario i have plugin in php i've written , want keep private repository. want set versioning in git. know there tags this, don't know how convention works composer. current composer.json package/plugin: { "name": "test/upload", "description": "useful functions image uploading.", "minimum-stability": "dev", "require": { "php": ">=5.3.0" } } current composer.json project include above package/plugin: { "name": "multistepform", "require": { "cakephp/cakephp": "2.6.*", "cakephp/debug_kit": "2.2.*" }, "config": { "vendor-dir": "vendor/" } } currently have no tags in package/plugin. qs 1) composer require tags in repository in order use it? 2) how should 1 tag private repository use composer? 3...

objective c - Set NSTableCellView and subviews to have dynamic width programmatically -

i have nstableview cells contain various nstextfields , nsprogressindicators. set cells programmatically , control behavior programmatically. way have implemented cells prevents me being able use interface builder. works great except when resize nswindow, nstablecells , subviews within nstableview not resize width equal width of table contained in. any advice on how accomplish dynamic change in width nstableview's subviews appreciated. here code creating cells: func tableview(tableview: nstableview, viewfortablecolumn tablecolumn: nstablecolumn?, row: int) -> nsview? { var data = nsmutabledictionary() data = xloaddata(data) if data.count == 0 { data.setobject((homedir + "/library/messages/attachments"), forkey: "message attachments") data.setobject((homedir + "/library/caches"), forkey: "application caches") xsavedata(data) } let array: nsarray = data.allkeys.sorted(){($0 as! string) ...

javascript - How to get pdf title using pdf.js? -

this question has answer here: javascript closures. access in loop current i, j variables [duplicate] 5 answers the question is: how can name of pdf file using pdf.js? i'm running variation of pdf.js example node, , wondering if it's @ possible it. i've been searching through pdf.js's docs/source, couldn't find obvious. i'm using code, (so far) shows number of pages of each file found on given folder (in case, directory code being run from): var fs = require('fs'); var glob = require('glob'); global.window = global; global.navigator = { useragent: "node" }; global.pdfjs = {}; global.domparser = require('./domparsermock.js').domparsermock; require('../../build/singlefile/build/pdf.combined.js'); glob("**/*.pdf", function (er, files) { for(var = 0; < files.length; i++){ var data = new ui...

java ee - What are the techniques to manage "session" or invocation context for Stateless EJBs during Remote calls? -

i writing application uses rmi invoke ejbs. ejbs stateless; business requirements not require conversational state client. one of parameters ejb method calls "user" object used determine if user associated call has permission perform action. not using container-managed auth-auth: user object pojo provided remote client. i make user object globally available/injectable within "session" or invocation context. aware stateless ejbs not have "session" in ejb sense; mean "session" "the current invocation". example, have 1 remote ejb 2 methods: mystatelessejb.add(thing, user) mystatelessejb.update(thing, user) these methods call many more methods: there other ejbs involved, bean validators, etc. rather passing-around user object everywhere, make user object globally available/injectable context of current remote ejb invocation. i of course pass around user object or encapsulate "thing", thought maybe better design no...

c# - How to detect black Bullets in Image? -

Image
given following image, how can detect black bullets (90 bullet) in image using c#, emgucv or aforge? i tried use getpixel(x,y) method checks pixel pixel, slow , need detect bullets not pixels. algorithm/idea 1 can divide image in squares shown in sample: with logic have check every 20th pixel. know first dot is, know every other dot have in same horizontal line (in provided sample). a sample algorithm similar (please note need further improvement): bitmap mybitmap = new bitmap ("input.png"); int skipx = 12; int skipy = 12; int detecteddots = 0; (int x = 0; x < mybitmap.width; x += skipx) { (int y = 0; y < mybitmap.height; y += skipy) { color pixelcolor = mybitmap.getpixel (x, y); if (pixelcolor.r + pixelcolor.g + pixelcolor.b == 0) { mybitmap.setpixel (x, y, color.red); detecteddots++; } } } mybitmap.save ("output.png"); console.writeline (detecteddots + " dots detected...