Posts

Showing posts from June, 2013

php - Propel 2 double join on custom field -

i'm trying create query propel joins first table called entry second table called company have 3 fields related third table called user. entry id field1 field2 company_id company id field1 field2 user_id1 user_id2 user_id3 user id name surname team i want able join entry company company_id , join table user using field userid1. i tried different ways like entryquery::create()->joinwith('company')->joinwith("user") but , error saying entry has no relation user or entryquery::create()->usecompanyquery()->joinwith("user")->enduse() but still error company has no relation user, though user fields in company have relation user in database. there way specify field on join? i found way it, i'm not sure if it's best 1 works. entryquery::create() ->usecompanyquery() ->innerjoinuserrelatedbyuserid1() ->enduse() ->with("company") ->with("userrelate

wpf - Focus first textbox in some ListBox item -

i have listbox listbox.itemtemplate contains labels , textboxes. i want focus first textbox of last item programatically. how can that? i don't know how can access textbox object created dynamically data binding. try use behaviour (code not mine - https://gist.github.com/tswann/892163 ) using system; using system.windows; namespace myproject.wpf.helpers { /// <summary> /// allows arbitrary ui element bind keyboard focus attached property. /// </summary> public static class focusbehaviour { public static bool gethaskeyboardfocus(dependencyobject obj) { return (bool)obj.getvalue(haskeyboardfocusproperty); } public static void sethaskeyboardfocus(dependencyobject obj, bool value) { obj.setvalue(haskeyboardfocusproperty, value); } // using dependencyproperty backing store haskeyboardfocus. enables animation, styling, binding, etc... public sta

How to add Icon To a folder using Java -

i want create folder , want attach icon it. file f=new file(""); f.mkdirs(); // f.addicon() -- there inbuilt method this? or 3rd party lib? is there anyway how can add icon created folder on windows system.

javascript - Google analytics for saas platform -

i've built software works cms/commerce clients. point domain address server , take care of technical details , infra. that said, need way of tracking google analytics clients in way can see client-individual info or consolidate (all domains). considering software same of clients, have same url structure , functionalities. i need able overall conversion rate , compare 1 of clients. my approach change tracker name ga('create', 'ua-xxxxxxxx-1', 'client1'); ga('client1.send', 'pageview'); and filter in ga panel client tracker name or apply no filter , see consolidate data. is possible? missing? i cannot afford use multiple properties (distinct client) because ga limits 50 properties account. goal reach many times limitation. keep in mind i'm dealing multiple domains. thanks! this topic got solved using google analytics custom dimensions. https://support.google.com/analytics/answer/2709828

Can I create different retention policy for different measurements in influxdb? -

is possible treat different measurements in influxdb different retention policy? this entirely possible influxdb. you'll need create database has 2 retention policies , write data associated retention policy. example: $ influx > create database mydb > create retention policy rp_1 on mydb duration 1h replication 1 > create retention policy rp_2 on mydb duration 2h replication 1 now our retention policies have been created simple write data in following manner: sensor 1 write data rp_1 curl http://localhost:8086/write?db=mydb&rp=rp_1 --data-binary somedata sensor 2 write data rp_2 curl http://localhost:8086/write?db=mydb&rp=rp_2 --data-binary somedata

Nativescript: tns run android giving java certificate error -

i following nativescript tutorial sample app, when trying run tns run andorid it giving error exception in thread "main" javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target error log: found peer typescript 1.8.10 project prepared downloading https://services.gradle.org/distributions/gradle-2.8-bin.zip exception in thread "main" javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target @ sun.security.ssl.alerts.getsslexception(alerts.java:192) @ sun.security.ssl.sslsocketimpl.fatal(sslsocketimpl.java:1949) @ sun.security.ssl.handshaker.fatalse(handshaker.java:302) @ sun.security.ssl.handshaker.fatalse(handshake

spring - Overload Post RequestMapping -

i trying overload requestmapping of spring controller. controller got post request method , need pass different params overload it. how this, without changing url ? @requestmapping(method = requestmethod.post, value = "/windparks/import/error") public modelandview handlefileuploaderror(locale locale, @authenticationprincipal springuser authenticateduser, list<regulationevent> reglist, @requestparam("regulations") multipartfile regulations, redirectattributes redirectattributes, @pathvariable string windparkid) throws ioexception, windspeedinterpolator.timeseriesmismatchexception, saxexception { modelandview view = new modelandview("uis/windparks/parkdetail"); view.addobject("failedevents", reglist); view.addobject("windparkid", windparkid); return view; } @requestmapping(method = requestmethod.post, value = "/windparks/import/error") public modelandview handlefileuploaderror(locale locale, @au

java - How to fix Operator button bugs of my calculator app in android studio? -

when click operator buttons( +, -, *, / ) in calculator app made android studio, before putting number buttons, calculator closed, means putting number , putting operator okay. want nothing happens when click operator, before number clicked. case 1 : number buttons click -> operator button click working. case 2 : operator button click or equals button click closed. i've created calculator app in android studio in there 4 buttons: add subtract multiply divide i used decimal number representation , suppose if enter first no. 6.0 , second 5.0 , when click add gives 30.0 buttons not working. please answer me fix this.

linux - Kernel Module: No printk messages showing. Is init function being called? -

i have simple module, written follows: #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> module_license("gpl"); static int __init hellomod_init(void) { printk(kern_debug, "hello, world!\n"); return 0; } static void __exit hellomod_exit(void) { printk(kern_debug, "goodbye, world!"); } module_init(hellomod_init); module_exit(hellomod_exit); and $ cat /proc/sys/kernel/printk 7 7 7 7 so level messages should output. the module loads , can verified lsmod , no output produced when loading or unloading module , checking dmesg . i have tried replacing "kern_debug" lower levels , still no output, don't think log level issue. how else can verify init function called? if not being called, error? i running , compiling against kernel version 4.6.1-2 on arch linux. e: oops there shouldn't comma after kern_debug . should this: static int __i

mysql - INSERT INTO and the subquery with COUNT -

i'd put photo data table articles_photos , condition numbers of photos selected article. both tables exist. below have presented query insert articles_photos(title, filename, photo_order, created, article_id) values ('title', 'filename', (select count(id) articles_photos article_id = 7) + 1, now(), 7) phpmyadmin says: static analysis: 5 errors found during analysis. comma or closing bracket expected (near "select" @ position 109) unrecognized keyword. (near "count" @ position 116) unexpected token. (near "(" @ position 121) unexpected token. (near "id" @ position 122) unexpected token. (near ")" @ position 124) #1093 - table 'articles_photos' specified twic

swift2 - Swift Constraints in Subclass -

Image
i wondering if there way access constraints subclass. have custom view. i'm not sure if can access constraint have set in ui, tried creating constraint subclass itself. class performanceview: uiview { func initialize() { let heightconstraint = nslayoutconstraint(item: self, attribute: .height, relatedby: .equal, toitem: superview, attribute: .height, multiplier: 0.47, constant: 0); superview.addconstraint(heightconstraint) } } the above code not complete. showing attempting do. 2 questions. 1) can access constraint on ui subclass. 2) if not, how can create height constraint in subclass half of superview height. and have performanceview class view can see performance view in left. 4 of them. if understand question correctly, answer yes, there way. can drag outlets constraints performanceview using assistant editor. as adjunct - can modify constraints in code using .constant. modifying priorities not supported though. heightconstrain

javascript - Bootstrap carousel should Fire event on load and slide -

i have function checks colour of image, if dark/light adds class header. i want have function running inside mycaruosel bootstrap . the getimagebrightness should fired each image. i can't working inside carousel function. any appreciated. http://jsfiddle.net/s7wx2/115/ use find event active image src instead of using this.src : $(document).ready(function() { var imgs = document.body.getelementsbytagname('img'); ///load getimagebrightness function $("img").on("load", function() { getimagebrightness(this.src, function(brightness) { if (brightness < 256 / 2) { $('header').addclass('dark'); } else { $('header').addclass('light'); } }); }).each(function() { if (this.complete) $(this).load(); }); var img_src = $('#mycarousel').find('.carousel-item.active img').attr('src'); getimagebrightness(img_src, function(brightness) { consol

c# - callback location does not get called after document signed using RightSignature API -

when send one-off document rightsignature via api, i'm specifying callback location in xml document specified in rightsignature's schema definition. signer-link value api document. display html response signer-link url in iframe on our website. when our user signs document in iframe, rendering responses website, want website post our callback location. can rightsignature api , make sense? so far, i'm getting content in iframe indicates signing successful. callback location not seem getting called. @vishal, got solved now. basically, doing 2 things wrong first have go in rightsignature account , set there callback url account > settings > advanced settings but thing rs unable mention url can not on localhost, should of https mean live url. and in callback write these 2 lines , has complete xml have guid , document status well. byte[] data = request.binaryread(request.totalbytes); string callbackxml = system.text.encoding.utf8.getstring(data);

javascript - slow protoype.js performance using on penny auction website help me -

i ask developer make me penny auction script magento average speed of request 450-500 ms slow.. on cloud server , dedicated( low end) tested other script on internet fast 100 ms prototype.js slow? or code not optimised? here script please me please you function auctiontimer(dt,no,id) { //alert(no); var end = new date(dt); var now_date= new date(no); // alert(now_date); // alert(end); var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour * 24; flag_time = true; timer = ''; setinterval(function(){showremaining();},1000); function showremaining() { var date = no; var = new date(date); var de= now.gettime(); if ( flag_time ) { timer = de; } var d = new date(timer); currentyear = d.getfullyear(); month = d.getmonth()+1; var currentdate = d.

javascript - Dynamically added element not showing in view -

i trying dynamically add element div. element not shown in view. if try inspect element new paragraph not there(this seems normal behavior of inspect element i've read). go in console , select element through javascript , new elements there can't seen. <div id="moving_to_2perf"> da <p> paragraph</p> </div> <style type="text/css"> #moving_to_2perf{ color: red; }; </style> <script type='text/javascript'> function getcookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var = 0; <ca.length; i++) { var c = ca[i]; while (c.charat(0)==' ') { c = c.substring(1); } if (c.indexof(name) == 0) { return c.substring(name.length,c.length); } } return ""; } function setcookie(cname, cvalue, exdays) { var d = new date();

javascript - Load all <script> tags from a different page -

i'm hooking separate page (same domain) , pulling current page using $.load , fine, if doing whole page, i'm not, i'm doing javascript code in page. wondering if it's possible load script tags said page current page? i'm using below code: var newmessageurl = $('#lnkcompose a').attr('href'); $('#hiddenscriptload').load(newmessageurl); is said page on same domain or have access it? run trouble cross domain origin policy otherwise. if have access, way parse html using regex statement or html parser , pull scripts manually. sounds hacky approach though , i'm not sure why you'd want this. if have access, page contents , use below script tag sources. text.match( /<script src="scripts\/(.*?)\.scripts\.js"><\/script>/g ) credit javascript regex src url between script tag

javascript - Html form - reviewing and changing information -

i have type of checkout page asks users payment information, click on review button takes them new "panel" review information can go , change if needed, has happen in same page, have "information-panel" div changes "information-review-panel" via jquery once button clicked, this: $(document).ready(function () { $("form").submit(function () { //save values form fields var fn = $("#first_name").val() + " " + $("#last_name").val(); var cc = $("#credit_card").val(); //switch panels $("div.information-panel").replacewith($("div.information-review-panel")); $("div.information-review-panel").fadein(1000); //place values in new panel $("#review-name").html(fn); $("#review-card").html(cc); }); }); <div class="information-panel">

javascript - Issue with the direction: rtl CSS property -

i have html element , need display folder / file path within can long. i want keep on single line (within width constrained container) need add ellipsis it. another requirement should see deepest folder nodes in path (this helpful when path long, because latest nodes you're interested in). the problem is, quite hard achieve if i'm use direction: rtl; css property, because move other characters around, such / or paranthesis. take @ example: https://jsfiddle.net/r897duu9/1/ (as can see, didn't use text-overflow: ellipsis property will, reason, override direction: rtl property). what i've tried far , works on modern browsers adding unicode-bidi: plaintext; css property, according mozilla developer network experimental , not supported across not-so-modern cough ie browsers. fiddle here: https://jsfiddle.net/n05b3jgt/1/ . does know better way achieve this, supported across wide range of browsers? you may use direction on container reset on t

java - abstract class multiple inheritance -

i have following structure of classes: abstract class class b extends class abstract class c extends class b class d extends class c i have static method has return type a , returns b - ok. want change method, still has return type a , returns d - causes problems: java.lang.error: unresolved compilation problem: d cannot resolved type why happening? should have same interface parent classes don't they? edit: this method im trying modify public static codeformatter createdefaultcodeformatter(map<string, ?> options) { if (options == null) options = ccoreplugin.getoptions(); return new ccodeformatter(options); } it class cdt project ( http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=a83be9db5b41c0a593425798a2af91060588b38a ). instead of ccodeformatter trying return myformatter. class ccodeformatter ( our b in example ) extends codeformatter ( our in example ) , extended abstract class myformatter ( or c

The flash notice message is not displaying " ruby on rails" -

i searched answer before came here found nothing. have in controller def create @article = article.new(article_params) if @article.save flash[:notice] = "article created" redirect_to article_path(@article) else render 'new' end end and add in application.html.erb: <body> <% flash.each |name, msg| %> <ul> <li><%= msg %></li> </ul> <% end %> <%= yield %> and here show.html.erb: <h1>showing selected article</h1> <p> title: <%= @article.title %> </p> <p> description: <%= @article.description %> </p> after submitting form go show page,the flash notice not display. why? i have github repo, seems not using application.html.erb layout, because article controller inherited actioncontroller::base there 2 ways can this. you can either change controller file inherit applicationcontroller:

javascript - Enabling ng-click to open a link in browser window -

i have ng-click producing valid url data struggling open in browser window, trigger 3rd party app open. i have tried options , got few button options(2-6) have found on stack , google, can getting open in browser? here image of app showing console output when click on full width button , code in plunker. http://i.imgur.com/0tfxtue.jpg https://plnkr.co/edit/wbyfa3m19mawobtdbdfu // ionic starter app // angular.module global place creating, registering , retrieving angular modules // 'starter' name of angular module example (also set in <body> attribute in index.html) // 2nd parameter array of 'requires' angular.module('starter', ['ionic','ngcordova']) .run(function($ionicplatform) { $ionicplatform.ready(function() { if(window.cordova && window.cordova.plugins.keyboard) { // hide accessory bar default (remove show accessory bar above keyboard // form inputs)

WSO2 MDM Encrypt sensitive information in .json configuration files -

i cannot find way encrypt keystore password in json configuration files used in wso2 emm. there notable documentation encryption of sensitive information in xml configuration files emm product, nothing json configuration files. my question encrypting keystore password in json configuration files. secure vault uses xpath specify location want encrypt. therefore secure vault not support encrypting .json , properties files.

javascript - Ensuring server app runs before mocha tests start -

this similar ensuring express app running before each mocha test , specified solution still isnt working + i'm using websocket server in short , i'm using websocket framework called socketcluster , server file import {socketcluster} 'socketcluster'; const socketcluster = new socketcluster({ workers:1, brokers:1, port: 3000, appname:null, initcontroller: __dirname + '/init.js', workercontroller: __dirname + '/worker.js', brokercontroller: __dirname + '/broker.js', socketchannellimit: 1000, crashworkeronerror: true }) export default socketcluster running node server.js starts worker process specified in worker.js export const run = (worker) => { console.log(' >> worker pid: ',process.pid); const app = express(); const httpserver = worker.httpserver; const scserver = worker.scserver; app.use(cookieparser()) httpserver.on('request', app); app.get('/',(req,res) =>

switch statement - How can I assign a value based on 2 conditions in R? -

first data, question: df <- data.frame(z=c(1,2,3),y=c(2,3),a=c(1,2,3,4,5,6)) df z y 1 2 1 2 2 2 3 2 3 1 3 4 2 3 5 3 3 6 i using r , generate vector given vector z , y . if (z1==1 & y1==2) , a1=1 , if (z3==3 & y1==2) , a1=3 ....if have 1 condition ( z or y ), generate a switch function, however, how generate a z , y ? if understood question correctly answer follows. if misunderstood please correct me. df <- data.frame(z=c(1,2,3),y=c(2,3),a=c(1,2,3,4,5,6)) df$a <- na # empty out # re-create df$a[df$z == 1 & df$y == 2] <- 1 df$a[df$z == 2 & df$y == 2] <- 2 df$a[df$z == 3 & df$y == 2] <- 3 df$a[df$z == 1 & df$y == 3] <- 4 df$a[df$z == 2 & df$y == 3] <- 5 df$a[df$z == 3 & df$y == 3] <- 6 df <- df[order(df$a),] df z y 1 1 2 1 5 2 2 2 3 3 2 3 4 1 3 4 2 2 3 5 6 3 3 6

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. although there portions of answer apply usage of the mail() function itself, many of these troubleshooting steps can applied php mailing system. th

cassandra - Query-Driven Modelling and Big Data -

i watching 1 of cassandra videos on datasax academy. 1 concept talk lot query driven modelling. makes sense when know queries upfront in killrvideo example. however, in big data cases, hope not 1 think barely know kind of queries analysts perform on data 5 months or 1 year down road. if case, best practices storing data? guess advanced querying of such data, end loading data spark. have consider @ storage time avoid operational troubles , troubles @ retrieval time? retrieval approaches less problematic? cassandra database analytics use cases, not ad-hoc analaytics (only 1 report , query never perform again stuff). for use cases hadoop cluster better option your. (maybe parquete on hadoop) if see queries perform on , on again, cassandra friend. can use cassandra 50 70% of use cases. column keys , secondary indizies can perform wide spectrum of queries. go analytics guys , ask them need. then: create tables :)

ios - Add black spaces between images in a image view -

i have scrollview house images download web. adding these images scrollview having trouble adding black space between them. in vertical scroll not horizontal. have been thinking of trying add space can't figure out how it. appreciated. here have far; private func loadimages() { myimages = 0; imagemanager.sharedinstance.getallimagesfromserver({ promotions in (_,promotion) in promotions { utility.log(self.dynamictype, msg: promotion.picture, function: "viewdidload") self.downloadimage(nsurl(string: promotion.picture)!) }}, onfail: { error_code, detail in utility.log(self.dynamictype, msg: "get iamges fail, error_code: \(error_code), detail: \(detail)", function: "viewdidload")}) } func getmyimage(url: nsurl){ getdatafromurl(url) { (data, response, error) in dispatch_async(dispatch_get_main_queue()) { () -> void in guard let data = data error ==

computer vision - Is image segmentation required with the SURF algorithm? -

i reading image segmentation, , understood first step in image analysis. read if using surf or sift detect , extract features there no need segmentation. true? there need segmentation if using surf? the dependency between segmentation , recognition bit more complex. clearly, knowing pixels of image belong object makes recognition easier. however, relationship works in other direction: knowing in image makes easier segmentation. however, simplicity, speak simple pipeline segmentation performed first (for instance based on simple color model) , each of segments processed. your question asks surf features. however, in context, important surf local descriptor, i.e. describes small image patches around detected keypoints. keypoints should points in image information relevant recognition problem can found (interesting parts of image), points can reliably detected in repeatable fashion on images of objects belonging class of interest. result, local descriptor cares pixels aroun

c++ - Descriptive Error Messages for Lua Syntax Errors -

i have lua interpreter whenever make syntax error in code, error message returned attempted call string value , instead of meaningful error message. example if run lua code: for a= 1,10 print(a) end instead of returning meaningful 'do' expected near 'print' , line number return error attempted call string value . my c++ code following: void luainterpreter::run(std::string script) { lual_openlibs(m_mainstate); // adds functions calling in lua code addfunctions(m_mainstate); // loading script string lua lual_loadstring(m_mainstate, script.c_str()); // calls script int error =lua_pcall(m_mainstate, 0, 0, 0); if (error) { std::cout << lua_tostring(m_mainstate, -1) << std::endl; lua_pop(m_mainstate, 1); } } thanks in advance! your problem lual_loadstring fails load string, since not valid lua code. never bother check return value find out. , therefore, wind trying execute compile e

ReactJS and immutability -

i've learning reactjs while now. 1 of thing puzzles me why reactjs uses immutability in many aspects props, elements etc. there specific reason this? philosophy behind this? when try add new property props i'm getting below error. uncaught typeerror: can't add property me, object not extensible react uses immutability obvious performance reasons. example idea whenever setting state , dont mutate state clone part of , update state for example this.state = { entries: [1,2,3] } you should do this.state.setstate({ entries: this.state.entries.slice().push(9); //not this.state.entries.push(9) }) performance gains achieved when use shouldcomponentupdate in shouldcomponentupdate can compare references , not due deep checking shouldcomponentupdate(prevstate,newstate){ return prevstate.entries != newstate.entries }

encryption - Encrypting connectionStrings in classic ASP -

i'm looking way increase security on older web apps. have connection strings saved in plain text in include.asp file. ideally thinking of moving these web.config file , encrypting using aspnet_regiis.exe , not work classic asp. i've had around internet cannot find seems fit specifically, has run same issue before? the best way protect include.asp use anonymous authentication on site , sure set ntlm security of file can read user used iis. if not possible can obfuscate string in number of ways none secure, can avoid these strings being seen casual nosy user not hacker. you can use own crypt , decrypt function, visible in .asp files, see here , here examples you can use external crypt , encrypt tool run .asp (i use run ruby script , results, replace command executed yours) set objwshell = createobject("wscript.shell") set objcmd = objwshell.exec("cmd.exe /c c:\ruby193\bin\ruby.exe d:\inetpub\site\appl\rmw\import\import.rb") result =

c# - How to use the Columns of dataset -

i have result set of dataset below [![dataset][1]][1] now want add if condition checking below if(dataset rows(usermail) == 10000){then go ahead} this code. dataset ds = new dataset(); using (sqlconnection conn = new sqlconnection(configurationsettings.appsettings["connectionstring"].tostring())) { sqlcommand sqlcomm = new sqlcommand("get_inward_reminder_report", conn); sqlcomm.commandtype = commandtype.storedprocedure; sqldataadapter da = new sqldataadapter(); da.selectcommand = sqlcomm; da.fill(ds); if(dataset rowchecking) { } } so issue, how check , compare dataset columns. you can below: int first = convert.toint32(ds.tables[0].rows[0]["columnname1"].tostring()); string second = ds.tables[0].rows[0]["columnname2"].tostring(); so case can like: foreach (datarow dr in ds.tables[0].rows) {