Posts

Showing posts from April, 2013

javascript - Jquery Cannot get datepicker value -

on code: <input type="text" id="datefrom1" name="datefrom1" class="form-control datepicker"/> <i class="ace-icon1 fa fa-calendar"/> <script type="text/javascript"> $('.datepicker').datepicker(); </script> when submit form, params.datefrom1 hold value of datepicker. however, when used way, cannot value of datepicker <input type="text" id="datefrom1" name="datefrom1" class="form-control datepicker" disabled/> <i class="ace-icon1 fa fa-calendar" onclick="showpicker('#datefrom1')"/> <script type="text/javascript"> $('.datepicker').datepicker(); function showpicker(ele) { $(ele).datepicker('show'); } </script> the fact input box shows value after picked date, , when alert($('#datefrom1')) alerted value of date when

composer php - autoload psr-4 gets lost during install -

this composer.json of bundle (shortened) { "name": "acme/my-bundle", "type": "library", "version": "0.5.0", "autoload": { "psr-4": { "acme\\mybundle\\": "" } } } and in project: "require": { "acme/my-bundle": "dev-master" }, then run composer install resulting in installed.json like [ { "name": "acme/my-bundle", "version": "dev-master", "version_normalized": "9999999-dev", "type": "library", "installation-source": "source" // // here must this: // "autoload": { // "psr-4": { // "acme\\mybundle\\": "" // } // }, // these lines missing!

java - Struts2 interceptor session get null value when authenticate login page -

i beginner in struts2 , i'm trying scenario on own web project : when user access login page, server authenticate whether he/she has login "admin" / "user" accessing session using interceptor, if user has no privilege data (it's null) inside session, passed login page. if user has login "admin", user redirected "admin" page. if user has login "user", user redirected "user" page. i trying these codes, if don't use interceptor, can access session, if use interceptor is, session still null , giving error 500 instead npe. don't know wrong it. thanks of me. struts.xml <struts> <constant name="struts.action.extension" value=","/> <constant name="struts.custom.i18n.resources" value="global" /> <constant name="struts.devmode" value="true" /> <!-- configuration default package. --> <in

objective c - Trouble hooking up AVAudioUnitEffect with AVAudioEngine -

i've been poking around avaudioengine , i'm having trouble integrating avaudiouniteffect classes. example, avaudiounitdelay... @implementation viewcontroller { avaudioengine *engine; avaudioplayernode *player; } ... - (ibaction)playbuttonhit:(id)sender { if (!player){ nsurl *bandsurl = [[nsbundle mainbundle] urlforresource:@"bands managers" withextension:@"mp3"]; avaudiofile *file = [[avaudiofile alloc] initforreading:bandsurl error:nil]; engine = [[avaudioengine alloc] init]; player = [[avaudioplayernode alloc] init]; [engine attachnode:player]; avaudiounitdelay *delay = [[avaudiounitdelay alloc] init]; delay.wetdrymix = 50; [engine connect:player to:delay format:file.processingformat]; [engine connect:delay to:[engine outputnode] format:file.processingformat]; [player schedulefile:file attime:nil completionhandler:nil]; [engine prepare]; [engine startandreturnerror:nil]; } [player play]; }

ios - Run Two urls in single method -

i finding way run 2 services in method 1 after post images 1 one . after 1st service need response need pass response 2nd service. the code i've used post run single service post single image nsstring *url=[nsstring stringwithformat:@"http://37.187.152.236/userimage.svc/insertobjectimage?%@",requeststring]; nslog(@"url1%@",url); nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init] ; [request seturl:[nsurl urlwithstring:url]]; [request sethttpmethod:@"post"]; // create 'post' mutablerequest data , other image attachment. nsstring *boundary = @"---------------------------14737809831466499882746641449"; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@", boundary]; [request setvalue:contenttype forhttpheaderfield:@"content-type"]; nsdata *data = uiimagejpegrepresentation(chosenimage1, 0.2f); [request addvalue:@"image/jpeg" forhttpheaderfield:@"

install - Multiple entry in C# custom action dll in WIX -

can have multiple dll entry below example : i have 1 binary entry : <binary id="sqlbrowse" sourcefile="..\sqlbrowse\bin\debug\sqlbrowse.ca.dll"/> calling custom action <customaction id="sqlbrowsevalidate" binarykey="sqlbrowse" dllentry="sqlvalidate" execute="immediate" return="asyncwait"> </customaction> <customaction id="sqlbrowseid" binarykey="sqlbrowse" dllentry="customaction1" execute="immediate"> </customaction> i have 2 ca : public static actionresult customaction1(session xisession) {} public static actionresult sqlvalidate(session sqlsession) {} yes, can that. add logging information using session.log : first create .net custom actions: public class customactions { [customaction] public static actionresult customaction1(session session) { session.log(&quo

Spring Security custom filter registration with Java config -

i trying setup pre-authentication authorisation using spring security, similar site minder external system authentication , saves login information in cookie. happen need redirect external url. i tried doing implementation of abstractpreauthenticatedprocessingfilter doesn't work because httpservletresponse object not available. a more appropriate way seems to add custom filter checks cookie , redirection , once cookies available passes control forward spring security filter. how can register custom filter in java configuration based spring security application? appreciated. the common way redirect user external authentication interface using authenticationentrypoint , example loginurlauthenticationentrypoint . entry point automatically invoked spring security whenever determines user needs authenticated. once user returns application, should hit custom filter extends abstractpreauthenticatedprocessingfilter , extracts username cookie/header/token (after perhap

python 2.7 - Web2py application: How to reference .yaml file in controller? -

i have app running online under web2py . now, adding names.yml file need call in controller file (default.py) on web2py server. should keep .yml/.yaml files. have kept them in views default/names.yml when call in default.py like: dicttagger = dictionarytagger([ 'default/names.yml', 'default/surname.yml']) i no such file error. tried below: dicttagger = dictionarytagger([ 'views/default/names.yml', 'views/default/surname.yml']) same error class snapshot under: class dictionarytagger(object): def __init__(self, dictionary_paths): files = [open(path, 'r') path in dictionary_paths] dictionaries = [yaml.load(dict_file) dict_file in files] map(lambda x: x.close(), files) any suggestions how or making mistake of using yaml/yml file in we2py , doesn't work in web2py app hosted online? question 2 thank you. resolved error not sure how add nltk.download() hosted app. keep getting below error. can p

ruby on rails - CanCan skip authorization for some action -

i have problem cancan gem can't solve. in controller have action "confirm" member route "reservations" resource. don't want authorize resource cancan in action in controller: load_and_authorize_resource except: :confirm but have error: this action failed check_authorization because not authorize_resource. add skip_authorization_check bypass check. how can skip authorization proper action in cancan? i think might work in controller, skip_authorization_check only: :confirm load_and_authorize_resource except: :confirm hope helps!

angularjs - how to access angular $scope from a javascript function -

i have added functionality parse csv file in javascript. want assign parsed data $scope.data.arr. currently, below code gives error " uncaught referenceerror: scope not defined ". newbie angularjs , have followed official angular tutorials. the code is: application.js 'use strict'; /* application module */ var ddvapp = angular.module('ddvapp', ['ddvcontrollers']); datacontroller.js 'use strict'; /*data controller*/ var ddvcontrollers = angular.module('ddvcontrollers', []); ddvcontrollers.controller('datacontroller', ['$scope', function($scope){ $scope.data = {}; //created empty data object. }]); read-csv.js function handlefiles(files) { // check various file api support. if (window.filereader) { // filereader supported. getastext(files[0]); } else { alert('filereader not supported in browser.'); } } function getastext(filetoread) { var reader = new filereader(); /

javascript - how to make the vAxis and hAxis number in integer -

Image
here code: var rawdata='".$performances."'; var mydata=jquery.parsejson(rawdata); if(mydata){ var realdata=[]; realdata=[ ['activities', 'performance'], ]; (x in mydata) { var a=parsefloat(mydata[x]['activities']); var b=parsefloat(mydata[x]['performance']); realdata[x]=[a,b]; } var data = google.visualization.arraytodatatable(realdata); var options = { title: 'overall performance', legend: { position: 'top', maxlines: 3 }, haxis: {title: 'activities'}, vaxis: {title: 'performance'} }; var chart = new google.visualization.linechart(document.getelementbyid('chart_div_line')); chart.draw(data, opt

android - How to implement price range seekbar? -

Image
i need price range seekbar or slider have mentioned in below image. or sample code appreciated. thanks in advance. android has no such view. can create custom components based on need. particular case, this one should fine. more complex scenario, can refer this one on github.

javascript - Extract date part from a string -

is there way extract date part string if other text not fixed: input: "6/27/2014 - today" expected: "6/27/2014" try following snippet: var input = "6/27/2014 - today"; var expected = input.match(/\d{1,2}\/\d{1,2}\/\d{4}/)[0]; console.log(expected);

javascript - Get Mouse Pointer coordinates relative to some div -

i trying mouse pointer position on mousedown , mouseup event. there div named test , want position when mousedown , mouseup happen within div area. , taking div surface mousedown , mouseup position should related div. have pdf inside div so, coordinates me highlight pdf. i tried this, not working fine. function getposition(element) { var xposition = 0; var yposition = 0; while (element) { xposition += (element.offsetleft - element.scrollleft + element.clientleft); yposition += (element.offsettop - element.scrolltop + element.clienttop); element = element.offsetparent; } return { x: xposition, y: yposition }; } $("#test").mousedown(function(e){ var parentposition = getposition(e.currenttarget); startx = e.clientx - parentposition.x; starty = (e.clienty - parentposition.y)*2.5; }); $("#test").mouseup(function(e){ var parentposition = getposition(e.currenttarget); endx = e.clientx - parentposition.x; e

Rails array exclude -

i have array feature date + time , temperature. i looking count number of temperature below 25 degrees fall between specific time frame (16:00:00 - 20:00:00), unsure on how best tackle scenario. data json file {"status": "ok", "data": [{"2014-06-16 16:00:00": 24.2},{"2014-06-17 12:00:00": 30.2},{"2014-06-18 17:00:00": 42.9}]} etc controller @data = json.parse(open(@temperature.url).read) dates = [] temps = [] @data['data'].each |data| dates << data.keys temps << data.values end @nights25 = dates.flatten.count {|i| ["16:", "17:", "18:", "19:", "20:"].include?(i) if i.temps > 25 end } maybe this: temp = @data['data'].reduce({}, :merge) temp.count { |time, deg| (16..20).include?(time.parse(time).hour) && deg < 25 }

How to get a pdf into the java code from a url? -

i have java code parses pdf. loads pdf locally. want source pdf url, " https://www.abc.com/xyz.pdf " instead of "c:\xyz.pdf", if change strings, throws error. url url = new url("https://www.abc.com/xyz.pdf"); inputstream in = url.openstream(); fileoutputstream fos = new fileoutputstream(new file(temp.pdf)); int length = -1; byte[] buffer = new byte[1024];// buffer portion of data // connection while ((length = in.read(buffer)) > -1) { fos.write(buffer, 0, length); } fos.close(); in.close(); also, java.net.unknownhostexception when try above code @ line 2. link works fine in browser. in java if want read directly url, can use this : url oracle = new url("http://www.oracle.com/"); bufferedreader in = new bufferedreader( new inputstreamreader(oracle.openstream())); string inputline; while ((inputline = in.readline()) != null) system.out.println(inputline); in.close(); basically have use url.openstr

grid - Hide column not working in ExtJs GridColumn -

in extjs have gridpanel. i want hide of columns of gridpanel, using hidden="true" , working fine. the problem is, when click on grid menu, there option called 'columns'. when mouseover 'columns' can check/uncheck columns want show/hide. i want display hidden columns in list(unchecked) user can check them , manually display on grid. i tried setting hideable="true" still these columns not displying in 'columns' list. please suggest solution the configuration option hidden:true (lowercase), example: ,columns:[{ text:'company' ,dataindex:'company' ,flex:10 },{ text:'price' ,xtype:'numbercolumn' ,dataindex:'price' ,align:'right' ,width:80 },{ text:'last updated' ,xtyp

c++ - ShellExecute Does not open Default Web Browser -

the problem exe started service, , in exe gave call shellexecute open link. in case shellexecute open link in ie instead of default web browser. i think when execute exe through service not run in user context not open link in default web browser. can 1 me how open link in default web browser in case. you need impersonate user account/context within service. use this link know how impersonate active user context in service.

java - open Lotus Notes and attache file from website -

i want this: click on link or button on website (especially on alfresco share) the email client (ibm notes) should opened , automatically attach document repository of alfresco (document management system) i can grab document java using cmis api. how can open email client , programatically attach document clicking on link? have suggestions on how can this? thank in advance! edit: because not familiar xpages trying java web start.

java - File upload services using jersey in tomcat without maven -

i want upload images server using restful jersey web services.i have included jersey-multipart-1.9.jar , jersey-bundle-1.14.jar , asm-3.3.1.jar jar files , i not using maven . below code snippet upload function. @post @path("/uploadimage") @consumes(mediatype.multipart_form_data) public response uploadfile(@formdataparam("file") inputstream fileinputstream, @formdataparam("file") formdatacontentdisposition contentdispositionheader) { string filepath = server_upload_location_folder + contentdispositionheader.getfilename(); savefile(fileinputstream, filepath);//method save file. string output = "file saved server location : " + filepath; return response.status(200).entity(output).build(); } but getting following error when deploy or run in apache tomcat 7. severe: missing dependency method public javax.ws.rs.core.response com.sec.samsung.fileupload.uploadfile(java.io.inputstream,com.sun.jersey.

r - semPLS package backcalculating influence -

Image
i'm doing pls regression using sempls package in r , wondering something this example ?sempls : library(sempls) data(ecsimobi) ecsi <- sempls(model=ecsimobi, data=mobi, wscheme="pathweighting") ecsi we see imag1-5 connected latent variable of image . each 1 has outer loading between 0.57 , 0.77. image connected variable expectation , has beta coefficient of 0.505. question is: possible "back-calculate" influence of 0.505 each imag1-5 -variable? after looking @ model specifications , formula 0.505/0.77, , on. doesn't make sense because higher correlation between imag1-5 , image lower influence on expectation doesn't make sense. i'm not sure this, since there no answer here, i'll give shot. if understand correctly, want kind of effect size. this can calculated in structural model exogenous latent variables according cohen,1988, p.410-413 effect size f². so if want effect of exogenous variable on endogenous v

ios - Converting from JSON string to UIImage always gives null? -

i kind of json: note: put dots in "content" because long byte array abd explain situation. { "id":"53abc6a7975a9c10c292f670", "nfcid":"testse", "company":"test", "qrid":"testvalue", "address":"ajs;ldfh", "mimetype":"image", "url":"", "content":"ivborw0kggoaaaansuheugaa....." } and im trying json , diplay information "content" field has byte array converted on server image byte array. i use code in xcode convert bytes nsdata, uiimage able display in uiimageview: nsdata *dataimage = [jsonarray[key] datausingencoding:nsutf8stringencoding]; nslog(@"data = %@", dataimage); uiimage *img = [uiimage imagewithdata:dataimage]; nslog(@"img = %@", img); the image gives me null.although, data give me array of data. i tried kinds of encodings ns

javascript - HTML drop down bar does not work on internet explorer -

css , javascript @ moment , on html have made dropdown bar , works on chrome , firefox not internet explorer. need drop down bar work on internet explorer. this css code: <body bgcolor='#52cc7a'> <style type="text/css"> * { padding: 0; margin: 0; } body { padding: 5px; font-family: arial, helvetica, sans-serif; } ul { list-style: none; z-index: 999 } ul li { float: left; padding-right: 1px; position: relative; } ul { display: table-cell; vertical-align: middle; width: 100px; height: 50px; text-align: center; background: #69c; color: #fff; text-decoration: none; } ul a:hover { background: #09c; } li > ul { display: none; position: absolute; left: 0; top: 100%; } li:hover > ul { display: block; } li > ul li { padding: 0; padding-top: 1px; } li > ul li > ul { left: 100%; top: 0; padding-left: 1px; } li > ul li > ul li { width: 100px; } li:hover > { background: #09c; } <

json post httppost parameter missing for android -

in below code posting json string server. though have writtenn postparams.add(new basicnamevaluepair("json_data", jsonstr)); gives error parameter json_data not passed. i not sure why giving me error. orderjsonarray.put(order1); locationjsonarray.put(location1); locationjsonarray.put(location2); order1.put("locations", locationjsonarray); jsonobject ordersobj = new jsonobject(); ordersobj.put("orders", orderjsonarray); string jsonstr = ordersobj.tostring(); string contenttype = "application/json"; list<namevaluepair> postparams = new arraylist<namevaluepair>(); postparams.add(new basicnamevaluepair("json_data", jsonstr)); httpget httpget = null; try { urlencodedformentity entity = new urlencodedformentity(postparams); entity.setcontentencoding(http.utf_8); entity.setcontenttype("application/json"); httppost.setentity(entity); httppost.setheader("content-type", contenttype)

ios - UITableview HeaderView reloading -

Image
i have created dropdown tableview multi sections & each section 1 header view. tapping button in header view, inserting 1 row section & tapping on same button in removing row section. on removing row section. dequeued headerview getting changes custom view native view. code : [self.rtable registerclass:[headercell class] forheaderfooterviewreuseidentifier:@"cellheader"]; - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section{ headercell *detailview = nil; detailview = (headercell *)[tableview dequeuereusableheaderfooterviewwithidentifier:@"cellheader"]; return detailview; } button action function : -(void)detailviewbuttonselectedatindex:(int)index; { if(selectedsection != -1){ previousselected = selectedsection; [self.rtable beginupdates]; [self.rtable deleterowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:0 insection:previousselected]] withrow

xmpp - Not getting unavailable presence of User A when User B is also unavailable -

i working on chat application. adding functionality unavailable status of user. following situation not getting unavailable presence of user there 2 users user , user b , both available first user goes unavailable , user b gets unavailable presence of user , working fine, user b goes unavailable , user become available here problems occur user not receive offline unavailable presence of user b. but when user unavailable , user b become available , user become available in case user getting offline available presence of user b working fine. so here problem in case of offline unavailable presence of other users not coming. offline available presence coming below code using going available , unavailable - (void)goonline { xmpppresence *presence = [xmpppresence presence]; // type="available" implicit [[self xmppstream] sendelement:presence]; } - (void)gooffline { xmpppresence *presence = [xmpppresence presencewithtype:@"unavailable"]; [[self xmpp

How to resolve CORS ie same origin policy in angularjs -

i developing mobile application in angularjs have make call web service. but, when making call $http.get giving following error. xmlhttprequest cannot load http://example.com/first_step.json. no 'access-control-allow-origin' header present on requested resource. origin 'http://127.0.0.1:8020' therefore not allowed access. my function follows: $scope.firststepclick = function() { appsvc.selecteditem = "firststep"; $rootscope.go('parent/firststep', 'slideleft'); delete $http.defaults.headers.common['x-requested-with']; $http.get("http://example.com/first_step.json").success(function(data) { $scope.firststepdata = data; }).error(function() { alert("an unexpected error occured"); }); }; so, please me solve cors problem. using html5, css3 , angularjs mobile app development. thanks in advance you don't have in angular side. the server side 1

jquery - + and - to show and hide sub lists -

i'm working on showing conversation thread, each comment there list of comments, show comments have , sub comments add (+) , (-) allow user show sub comments he/she needs, i'm having trouble that. here code: html: <body> <div class='limit'> <div class='comment'> <div class='titre'>titre d'un commentaire statique 1</div> <div class='content'>qui cum venisset ob haec festinatis itineribus antiochiam, praestrictis palatii ianuis, contempto</div> <div class='subcomments'> <div class='reduce'>__</div> <div class='reduce' style="display:none;">+</div> <div class='comment'> <div class='titre'>titre d'un sous commentaire statique 1.1</div> <div class='content&#

css - Unable to align HTML tables parallel to each other -

i have created 2 html grid tables finding difficulty while placing/aligning them parallel each other. i using align = right table getting aligned downwards(one below other) , not shifting right in parallel order . can suggest making mistake in below code , how can rectify it? p.s : below code issue can checked copying , saving in notepad test.txt , renaming test.html , open in ie or firefox browser. <table id="ss" class="easyui-datagrid" style="width:380px;height:auto;"> <thead> <tr><th field="name2" width="80">status</th></tr> </thead> <tbody> <tr> <td>india</td></tr> <tr><td>canada</td></tr> <tr><td>usa</td></tr> <tr><td>uk</td></tr> </tbody> </table> <table id="vv" class="easyui-datagrid" style="width:380px;height:a

c++ - CListCtrl class override and OnTimer -

i'm not sure if i'm doing undocumented. created own class derived clistctrl , overrode ontimer handler in it: void clistctrl2::ontimer(uint_ptr nidevent) { // todo: add message handler code here and/or call default switch(nidevent) { case my_timer_id: { //do processing domyprocessing(); } break; default: { //default clistctrl::ontimer(nidevent); } break; } } but seems strange me ontimer() routine called timer ids not mine. instance, quick debugger checkpoint research turns out default handler called nidevent set 45 , 43 . are there timer ids reserved should avoid using myself? from clistctrl documentation see text: also see: knowledge base article q200054 : prb: ontimer() not called repeatedly list control and article, pertinent excerpts: if call settimer function send periodic wm_timer messages list contro

git - Openshift: get commit or build id during build/deploy? -

i'm building openshift app downloads directory full of dependencies , backs existing database on every build. i'd name directory , database dump commit id (or build id), since there's no actual repository on remote, can't use git rev-parse --short head it. can think of way retrieve during build? -- chris the best able create backup reasonably precise timestamp (e.g. backup-201411042116.tar.gz). there's consequently no direct connection specific commit, app @ least sufficient (rolling app pretty rare occurrence). if want, can make manual backups local machine using rhc command line tools prior commit. see rhc snapshot save --help details.

c++ - How to get rid of insecure functions (sprintf, ...) -

i want rid of uses of insecure functions sprintf , in large c++ project. have errors or @ least warnings , show me occurrences further reviewing. know, on openbsd there such warning, i'm on linux. if try define macro sprintf errors in <cstdio> header. ideas, besides patching system headers? edit: additional challenge is, there sprintf function in homegrown c++ string class. so, grepping sprintf results in lot of false positives. even though concurr @matt functions not bad, , quite indiscriminate in banning, here ways so. today patch headers day: copy headers, run grep find functions fear. add __attribute__ ((deprecated)) them. recompile project. profit??? not patching headers? still, might better go direct way: grep own project files. can save search script re-application. use preprocessor (beware, changing reserved identifiers, bad!): add file "explosive_security.h" this: inline static int my_deprecated() __attribute__ ((depr

android - Add tabs in a View Pager -

how can add tabs swipeview fragments? here oncreate method of main activity in 2 fragments initialized: myfragmentpageradapter pageradapter; /** * pager adapter, provides pages view pager widget. */ viewpager pager = null; myfragmentpageradapter adapter = null; @override protected void oncreate(bundle arg0) { super.oncreate(arg0); this.setcontentview(r.layout.activity_main); // instantiate viewpager this.pager = (viewpager) this.findviewbyid(r.id.pager); // set custom animation this.pager.setpagetransformer(true, new depthpagertransformer()); // create adapter fragments show on viewpager this.adapter = new myfragmentpageradapter( getsupportfragmentmanager()); this.adapter.addfragment(inactivitypagefragment.newinstance(getresources() .getcolor(r.color.red), 0)); this.adapter.addfragment(listactivitiespagefragment.newinstance(getresources() .getcolor(r.color.white), 1)); this.pager.setadapte

Lua script to stop firing a query in mysql via mysql proxy -

i beginner lua language.the main concept when user fire drop table command in mysql should not executed.but can fire other commands usual in mysql.but don't want use grants this.is there luascript perform action via mysql-proxy ? for example: mysql> drop table t1; please wait authentication also luasql helpful perform task via mysql-proxy ? hope made idea clear.someone me solve out issue.thanks in advance. yes, can that. idea here check query whether or not fulfills requirements want filter , if not sending server function read_query(packet) if string.byte(packet) == proxy.com_query query = packet:sub(2) if condition(query) proxy.response = { type = proxy.mysqld_packet_ok, } return proxy.proxy_send_result end end end this checks each query proxy receives condition , if matches return success client witho

java - Can't use some of L SDK features -

i'm trying use new activity transitions in new sdk. i tried line: getwindow().requestfeature(window.feature_content_transitions); but problem window doesn't include feature_content_transitions . i tried line: getwindow().setexittransition(new explode()); and explode class doesn't exist... i set project compiled l sdk (android-l) , use new sdk tools (20.0.0) build.gradle: apply plugin: 'com.android.application' android { compilesdkversion 'android-l' buildtoolsversion '20.0.0' defaultconfig { applicationid 'com.tester' minsdkversion 'l' targetsdkversion 'l' versioncode 1 versionname '1.0' } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } productflavors { } } dependencies { compile filet

c# - Need help to understand polymorphism -

the classes below consist of a - father class b - child class holder - contains list of a's i want reach child property list of fatherobjects. why cant this? or better question, how do this? public class { public int var = 0; } public class b : { public int property1 { get; set; } public int property2 { get; set; } public b() { } public b(b p_b) { property1 = p_b.property1; property2 = p_b.property2; } } class holder { private list<a> m_objects = new list<a>(); public void addobject(a p_object) { m_objects.add(p_object); } public void addobjectproperty1(b p_b) { // @ point, m_objects holds b-object. , want add value property1 // there no property1 in a-class cant this. how use base.values // statement 1 below? int index = m_objects.findindex(item => item.property1 == p_b.property1); if (index > -1) m_objec

php - How to prevent spamming to my api server? -

i have been thinking of way make secured request client server (not in terms of implementing ssl) way can prevent spamming. allow me explain looking for. i have clients make http request on rest talk server , access apis. have provided separate unique api keys customers use authenticate user. use api key 1 of parameter , make post / request server. now problem sees api key can make spam request server acting customer. is there way prevent this? private , public key concept? if yes, can link me ready made algorithm written in php can use , easily implement in web app? many in advance.

html - animate from left to right and right to left -

i have problem css3 animate; have 2 animations : 1 on top , 1 on bottom. top animation load 0 width 100% , works great second animation should load 0 100% width right left , not working :( can explain me why ? here fiddle exaple: .left-to-right {animation:myfirst 1s ease;} .right-to-left {animation:mysecond 1s ease;} @keyframes myfirst { 0% {width:0; margin-left:100%;} 100% {width: 100%; margin-left: 0;} } @keyframes mysecond { 0% {width:100%; margin-left: 0;} 100% {width: 0; margin-left:100%;} } you made mistake on margins second animation. can remove them : demo @keyframes mysecond { 0% {width:0;} 100% {width: 100%;} }

Gitlab password reset in rails -

i'm trying login web panel of forgotten gitlab install somehow password not working. have tried reset in console following sudo -u git -h bundle exec rails console production user = user.where(email: 'myemail@mail.com').first user.password = 'password' user.save and can confirm new encrypted password set in user table of database, still cannot log in. using gitlab 6 on ubuntu. what else reset password or find out why cant login. you need save password confirmation too: user = user.find_by(email: 'admin@local.host') user.password = 'secret_pass' user.password_confirmation = 'secret_pass' user.save! (exclamation point important)

How to connect Liferay Portal with mysql database using eclipse? -

i have liferay 6.2 , want connect mysql database using eclipse ide.how connect them , have use. please give me example startup. follow below steps-> create new liferay server (point liferay portal). start server. when server start hit localhost:8080. a page displayed database configuration , user configuration. provide db name , usename , password. once provide that, liferay use database.(obviously db should in database) else can create portal-setup-wizard.properties file in \liferay-portal-6.2.0-ce-ga1 directory. add following entries. admin.email.from.name=test test jdbc.default.password=root liferay.home=d:/5555555/liferay-portal-6.2.0-ce-ga1 admin.email.from.address=test@liferay.com jdbc.default.driverclassname=com.mysql.jdbc.driver jdbc.default.username=root jdbc.default.url=jdbc:mysql://localhost/project_monitor_liferay?useunicode=true&characterencoding=utf-8&usefastdateparsing=false setup.wizard.enabled=false else can follow below link ht

Windows Phone Image Pinch & Zoom Reset -

i using code pinch , zoom , working correctly have reset on double tap. my xaml code; <grid x:name="contentpanel" grid.row="1" margin="12,0,12,0"> <viewportcontrol x:name="viewport" manipulationstarted="onmanipulationstarted" manipulationdelta="onmanipulationdelta" manipulationcompleted="onmanipulationcompleted" viewportchanged="viewport_viewportchanged"> <canvas x:name="canvas"> <image x:name="testimage" source="/assets/test.jpg" rendertransformorigin="0,0" cachemode="bitmapcache" imageopened="onimageopened"> <image.rendertransform> <scaletransform x:name="xform"/> </image.rendertransform>

Javascript alert when customer fill in the wrong price -

i have form ( input type="text" name="amount" ) customer need fill in total price. because price 1 19,95 dollar. when need 2 39,90 dollar etc. so: 1= 19,95, 2= 39,90, 3= 59,85 is possible when customer fill in wrong price (for example 20,00 instead of 19,95) there javascript alert. if can me code. thanks created js bin you: http://jsbin.com/sidakata/2/ just sample, have add complete logic yourself! html: <input id="total" type="text" onkeyup="validateinput();" /> javascript: function validateinput() { var total = parsefloat($('#total').val()); if(!isnan(total)) { // add logic here // sample: if(total > 19.95) { alert('wrong price dude!'); } } }

java - Regular Expression to Replace All But One Character In String -

i need regular expression replace matching characters except first 1 in squence in string. for example; for matching 'a' , replacing 'b' 'aaa' should replaced 'abb' 'aaa aaa' should replaced 'abb abb' for matching ' ' , replacing 'x' '[space][space][space]a[space][space][space]' should replaced '[space]xxa[space]xx' you need use regex replacement: \\ba working demo \b (between word characters) assert position \b (word boundary) doesn't match a matches character a literally java code: string repl = input.replaceall("\\ba", "b"); update second part of question use regex replacement: "(?<!^|\\w) " code: string repl = input.replaceall("(?<!^|\\w) ", "x"); demo 2

java - Add Custom Calculations in the Column Footer using DynamicJasper in Excel report -

i using dynamicjasper ver 4.0.2 , i've created report in excel format. the report having 3 columns let a, b , c. in footer want total of column i.e. sum(a) , column b i.e. sum(b) while total of column c=(sum(b)/sum(a))*100. however able add total column , b using drb.addglobalfootervariable(columna, djcalculation.sum) , drb.addglobalfootervariable(columnb, djcalculation.sum) . but i'm not able find solution columnc per formula explained above. i googled didn't relevant post. please me. i got solution using customexpression class in dynamic jasper.here example below, private abstractcolumn column_c; dynamicreportbuilder drb = new dynamicreportbuilder(); column_c = columnbuilder.getnew().setcolumnproperty("columnc",double.class.getname()).settitle("c").setheaderstyle(headerstyle).setfixedwidth(false).setstyle(detailcurrencystyle).setpattern("###0.00;-###0.00").build(); drb.addglobalfootervariable(col

android - my logcat displays stuff continuosly -

i tried implement gcm client in android , display registration id on logcat.but logcat continuosly display stuff other intend display. package in.myreceiver.gcm; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.util.log; public class seriousbroadcastreceiver extends broadcastreceiver{ @override public void onreceive(context context, intent intent) { try{ string action=intent.getaction(); if(action.equals("com.google.android.c2dm.intent.registration")) { string registrationid=intent.getstringextra("registration_id"); log.i("uo",registrationid); string error=intent.getstringextra("error"); string unregistered=intent.getstringextra("unregistered"); } else if(action.equals("com.google.android.c2dm.intent.receive")) { string data1=intent.getstringextra("data1");

google chrome - Running GUI program from within Javascript -

is there way can start standalone gui program within javascript code? intend display button when in particular website, when clicked, opens gui program , passes url it, kinda internet download manager(idm) it. if app registers handler specific url schemes, opening link using 1 of url schemes should do. for instance, if app says can handle myscheme scheme, opening myscheme:somedata url should trigger opening app.

android - Opengl es 2.0 null pointer from findViewByID -

i'm trying set application using opengl es 2.0, using following tutorial: http://androidblog.reindustries.com/a-real-open-gl-es-2-0-2d-tutorial-part-1/ so able successfuly compile application , run in emulator, launches, app crashes... have 2 layout files: activity_main.xml: <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.openglproject1.mainactivity" tools:ignore="mergerootframe" /> and fragment_main.xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gamelayout" android:layout_width="fill_parent" android:layout_height="