Posts

Showing posts from April, 2014

javascript - Parsing a JSON document using JS -

javascript - Parsing a JSON document using JS - here link http://api.frrole.com/locations it returning json document , need parse js, dont know why unable it. here js code print count of "results" array. $.get( "http://api.frrole.com/locations", function(data) { alert(data.results.length); }) .done(function() { alert("done"); }) .fail(function() { alert( "error" ); }) .always(function() { //alert( "finished" ); }); but alerting "error". suggestions why? javascript json

Vectorization of MATLAB/Octave loop -

Vectorization of MATLAB/Octave loop - can for-loop vectorized further? for = 1:length(formula) ttable(i,abs(formula(i,:))) = -1*formula(i,:); end where formula matrix , ttable = nan(length(formula),max(max(abs(formula)))) . thanks! judging code, doing each row of ttable , wish utilize indices accessed abs(formula(i,:)) , set each of these locations -1*formula(i,:) . noting @divakar's clever spot, going assume each row has unique absolute values. in other words, each row should not have instances have a or -a in row, a number 1 size(formula,2) . reason why because in computation of abs(formula(i,:)) , -a , a map same column. conflict , allow overwriting same entry (thanks @divakar!) what can each row of formula , convert these locations column-major indices access ttable . after, assign corresponding values of -1*formula ttable . in other words: %// find columns should accessed columnindices = reshape(abs(formula).', 1, []); %// each col

java - how to trim the characters in an path extracted from XML? -

java - how to trim the characters in an path extracted from XML? - //abc:def/m1/m/123/test im extracting path xml file . want trim characters "/test" (remove these characters path). have tried lastindexof(".") , trim(). unable trim characters . if want _remove /text , can try string path="//abc:def/m1/m/123/test"; path = path.substring(0,path.lastindexof("/")); system.out.println(path); output: //abc:def/m1/m/123 java xml

c# - EF sorting & paging - slow as ordered twice? -

c# - EF sorting & paging - slow as ordered twice? - i have simple entity, , have 100,000 of them in sql sever 2012 database: public class entity { public int id { get; set; } public string field1 { get; set; } public string field2 { get; set; } } i want show these in grid, paged 100,000 far many show on 1 screen (and not efficient). grid should allow sorting , filtering - 3 of these operations best done on server, , ef should translate these. so, lets sec page of 500 sorted field1: var items = context.entities.orderby(e => e.field1).skip(500).take(500); when query executed, takes 12 seconds! dug , found it's translated below: select top (500) [extent1].[id] [id], [extent1].[field1] [field1], [extent1].[field2] [field2] (select [extent1].[id] [id], [extent1].[field1] [field1], [extent1].[field2] [field2], row_number() on (order [extent1

javascript - Rendering regex data to Jade -

javascript - Rendering regex data to Jade - so in code below, write info extracted regex matches onto console. however, need render info jade file user, uploads log file, can view matches himself. ideas or sites information? while ((match = rediabtoa.exec(newarray[j])) != null) { if (match.index === rediabtoa.lastindex) { rediabtoa.lastindex++; } if (match[2] === "error") { console.log(match[2]); console.log("time " + match[1]); console.log("thread name: " + match[3]); console.log("source name & line number: " + match[4]); console.log("log message: " + match[5] + '\n'); console.log("-----------------------------------------------------------------" + "\n"); var logs = [new log(match[1], match[3], match[4], match[5])] } } update: have tried far. jade file: ... form(method="post", action="/upload", enctype="multipart/form-data") input(type=&q

JavaScript - Removing :active CSS selector and making :active -

JavaScript - Removing :active CSS selector and making :active - bit of odd question, possible in javascript stop :active css selector working? mean when click on element, not show visible change. need able turned on , off, property. (for illustration activeselector = true|false) i wondering if possible create :active selector permanent? element clicking on it? need able turned on , off well. and, create things harder, need specific different elements, 1 button beingness clicked, shows no alter when click on it, , other works normally. i know create 3 different css classes ( .fullactive, .alwayson , .nochange ), wondering if there easier way? it's thought separate presentation logic much can. also, it's bad thought futz default element behaviors when don't have to. one strategy utilize creating 1 active class defines appearance of active button. you'd define matching style :active state of element. utilize data attributes helpers logic.

json - Cannot check and handle null value using Play and Scala -

json - Cannot check and handle null value using Play and Scala - i trying build api endpoint test using scala , play framework. the code results in error unable verify if response.json empty. particular endpoint not homecoming , need check such case. protected def apiresponse[t](response: response)(implicit reads: reads[t]): jsresult[t] = { response.status match { case success(code) => json.fromjson[t](response.json) case clienterror(code) => throw apierror(response.body, response.status) case _ => throw apierror(response.statustext, response.status) } } i trying of sort. protected def apiresponse[t](response: response)(implicit reads: reads[t]): jsresult[t] = { response.status match { case success(code) => if(json.fromjson[t](response.json).equals(jsnull)) json.fromjson[t](jsstring(response.statustext.tostring+"1")) else json.fromjson[t](response.json) case clienterror(code) => throw apierror(re

spring - Can I programatically add a qualifier to a bean? -

spring - Can I programatically add a qualifier to a bean? - i registering transaction managers in code, utilize annotation based configuration don't know until runtime how many info sources (and hence transaction managers) there be, have programatically register these, follows: private final void registertransactionmanagerbean(final datasource datasource, configurableapplicationcontext context) { string transactionmanagername = this.getname() + "-transactionmanager"; context.getbeanfactory().registersingleton(transactionmanagername, new datasourcetransactionmanager(datasource)); log.info("registering transaction manager under name : " + transactionmanagername); } assuming this.getname() returned 'mydb', expected able qualify transacton manager this: @transactional("mydb-transactionmanager") what i've realised value of annotation refers qualifier , not name. did quick test declaring bean below , works: @bean @qua

installation - \npm\node_modules\vs-mda\vs-cli is not recognized as an internal or external command -

installation - \npm\node_modules\vs-mda\vs-cli is not recognized as an internal or external command - installed hybrid-app ctp. downloaded backbone sample. set build windows phone , emulator 720 p , tried build. error: 1>------ build started: project: backbonetodo, configuration: debug windows phone ------ 1>c:\program files (x86)\msbuild\microsoft\visualstudio\v12.0\typescript\microsoft.typescript.targets(90,5): warning : typescript compiler given no files compilation, skip compiling. 1> environment has been set using node.js 0.10.29 (x64) , npm. 1> ------ ensuring right global installation of bundle source bundle directory: c:\program files (x86)\microsoft visual studio 12.0\common7\ide\extensions\n4ltjwgz.cbl\packages\vs-mda 1> '"c:\users\<me>\appdata\roaming\npm\node_modules\vs-mda\vs-cli"' not recognized internal or external command, 1> operable programme or batch file. 1>c:\users\<me>\appdata\roaming\npm\node_

java - How do I refer to a variable from a method in the same class -

java - How do I refer to a variable from a method in the same class - i surprisingly find confusing. must missing something. so have simple syntax public class omg{ public static void main(string args[]){ int hi=2; letsdoit(); system.out.println(hi); } public static void letsdoit(){ hi+=1; } } obviously cause error, since hi local variable. judging experience python added this public class omg{ public static void main(string args[]){ int hi=2; letsdoit(); system.out.println(hi); } public static void letsdoit(){ this.hi+=1; } } which adds error when non-static variable cannot accessed static method. i added static hi public class omg{ public static void main(string args[]){ static int hi=2; letsdoit(); system.out.println(hi); } public static void letsdoit(){ this.hi+=1; } } the compiler scolds me illegal expression

How to put the content of all elements with a certain class in a variable with Jquery -

How to put the content of all elements with a certain class in a variable with Jquery - working jquery, want set content of elements specific class variable. here's example: <div class="foo"> <div class="bar"><p>first set of text</p></div> <div class="bar"><p>second set of text</p></div> <div class="bar"><p>third set of text</p></div> <div class="bar"><p>n set of text</p></div> </div> i set content of div elements class "bar" variable named "full". have tried next code grabs first div. var total = $( ".bar" ).html(); i want content of string variable be "<p>first set of text</p><p>second set of text</p><p>third set of text</p><p>n set of text</p>" if have tried looking on net couldn't find ans

webmatrix - C# Get MAX value -

webmatrix - C# Get MAX value - is right way max value (id) database , substrat 6 it? var photoso = db.querysingle("select max(id) photos"); var toto = photoso - 6; it telling me can not utilize '-' opperator between webmatrix.data.dynamicrecord , int photoso homecoming collection of info your. 1 object, utilize name in collection. accessing object in array or list using index number. you code as photoso - 6 webmatrix.data.dynamicrecord , int try code instead var photoso = db.queryvalue("select max(id) photos"); var toto = (photoso - 6); // column id collection info this work. here tutorial mike brind: http://www.mikesdotnetting.com/article/214/how-to-check-if-a-query-returns-data-in-asp.net-web-pages c# webmatrix

node.js - nodejs socket.io server emit with an answer of server on -

node.js - nodejs socket.io server emit with an answer of server on - if emit serverside imperative code can respond "on" @ clientside? my problem if user login gets specific users list object. imagine logs in, gets custom object contents of user b, g , x. problem, users b, g , x each have custom object. of course, on server side. now tried server side emit send these users. emitted should received on server side on. however, not work. i tried this io.sockets.on('connection', function(socket){ socket.on('login', function(){ for(var key in specific_object){ specific_object[key].emit('add user'); } }); socket.on('add user', function(data){ console.log("now please...."); }); }); hopefully can help me :) update .jpg) if understand correctly, may create function , phone call both login , add user events: function adduser(socket, data)

tweepy - Why access_token on twitter's streaming API? -

tweepy - Why access_token on twitter's streaming API? - i trying set cache service , take utilize of streaming api of twitter. confuses me, since server-to-server use, why still need utilize access_token when no user involved in process, application? so twitter can have info on how api , services beingness used. also, prevent dos , other kind of attacks twitter tweepy

ios - How to change background layer gradient color slowly for UIview? -

ios - How to change background layer gradient color slowly for UIview? - in view did load method array loading different colors floating point. - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. backgroundlayerone = [cagradientlayer gradientlayertwo]; backgroundlayerone.frame = self.view.bounds; [self.view.layer insertsublayer:backgroundlayerone atindex:0]; nsm_topx = [[nsmutablearray alloc]initwithobjects:@"0.17",@"0.36",@"0.93",@"0.93",nil]; nsm_bottomx = [[nsmutablearray alloc]initwithobjects:@"0.55",@"0.64",@"0.99",@"0.94",nil]; nsm_topy = [[nsmutablearray alloc]initwithobjects:@"0.62",@"0.63",@"0.50",@"0.10",nil]; nsm_bottomy = [[nsmutablearray alloc]initwithobjects:@"0.91",@"0.79",@"0.73",@"0.51",nil]; nsm_topz = [[nsmutablearray alloc]initwithobjects:@"0.64&qu

javascript multiple ajax calls, single callback? -

javascript multiple ajax calls, single callback? - my first post here, hi :) i have js code access json api: function a() { //does things //... //then calls function b b(some_params); } function b(params) { //calls objects method makes ajax phone call api , response in json someobject.makeajaxcalltoapi(params, function(response) { alertfunction(response); }); } function alertfunction(resp) { console.log ("the response is: "); console.log(resp); } this working ok, need modify in order this: in function a(), instead of making single phone call b(), need phone call b() multiple times in loop, different parameters each time. , want phone call alertfunction() passing array responses, after responses have been received. i have tried utilize $.when , .then, after seeing examples on deferred objects, not working: function a() { //does things //... //then calls function b var allresponses = []; $.wh

c++ - Partially external linkage -

c++ - Partially external linkage - i have next problem deal with: there external component compiled .lib file static linkage the external component requires specific function/operator interface available (i.e., function must nowadays in compilation unit) i not want function accessible code isn't in external component i not have command of specific function interface (or access portion of external component source code), it's given function in global scope is there way accomplish this? if matters, compiler vc++ 2012 . edit: the output binary shall single, dlls , similar won't do. is possible limit symbol visibility among .obj files in single .lib not other .libs? if it's possible, i'd compile function .lib , repackage external .lib. this can't achieved directly. static libs definition not undergo linkage rather supply building blocks executable binaries, there no sense in wanting expose symbol consumed static lib. static libs not 'c

spring - could not establish connection with postgresql database -

spring - could not establish connection with postgresql database - i'm developing web application using spring 4.0.5 , hibernate 4.3.5 . when run xhtml page error : java.sql.sqlexception: no suitable driver and java.sql.sqlexception: connections not acquired underlying database! how can solve these problems ? here application context file spring : <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2

javascript - Select css style from group of styles -

javascript - Select css style from group of styles - i generating div each entry in database. <div class='db-green'>sample code</div> <div class='db-blue'>sample code</div> <div class='db-blue'>sample code</div> <div class='db-yellow'>sample code</div> what want select color in div class random supose defining color's within array. i hoping solution less or sass or should utilize js ? you can utilize javascript function generates random color: function getcolor() { var r = math.floor(math.random() * 256); var g = math.floor(math.random() * 256); var b = math.floor(math.random() * 256); homecoming "#"+ r.tostring(16) + g.tostring(16) + b.tostring(16) ; } and utilize js dom (or jquery) alter css background-color attribute of each div : var divs = document.getelementsbytagname("div"); for(var = 0; < divs.length; i++) { divs.i

matlab - Gaussian Process, negative hyper-parameters? -

matlab - Gaussian Process, negative hyper-parameters? - i'm doing gaussian processes regression using gpml toolbox. however, after optimization using 'minimize.m' (without mean functions), negative hyper-parameters! the initial hyper-parameters are: hyp.cov = [0; 0]; % 2 hyper-parameters in covariance kernel (length-scale & amplitute) hyp.lik = log(0.1); %hyper-parameters of noise the original training data: x=[819 1119 1419 1599 1719 1839 1899 2019 2079 2139]; %coordinates y=[105.00 114.33 126.33 130.33 116.33 103.00 103.00 124.67 122.67 109.00]; %training info in codes, y normalized have 0 mean , unit variance. optimize: hyp = minimize(hyp, @gp, -100, @infexact, [], {@covseiso}, likfunc, x,y); after 100 iterations, negative hyper-parameters!!! quite confusing.... however, if don't normalize y, hyper-parameters positive after optimization. could tell me negative hyper-parameters mean? should normalize data? the er

android - Add Events programatically into calender it worked good but now code give Sqlite Exception -

android - Add Events programatically into calender it worked good but now code give Sqlite Exception - working @ calender adding events programatically worked code give error info pass through method addevents, when check calender event not appear there this error appears: 06-20 16:29:25.137: e/databaseutils(20244): error inserting calendar_id=2 title=rfihcd dtstart=1403866800000 dtend=1403869500000 _id=23 organizer=jsmith16420@gmail.com dirty=1 lastdate=1403869500000 eventtimezone=asia/karachi table events 06-20 16:29:25.137: e/databaseutils(20244): android.database.sqlite.sqliteconstraintexception: primary key must unique (code 19) 06-20 16:29:25.137: e/databaseutils(20244): @ android.database.sqlite.sqliteconnection.nativeexecuteforlastinsertedrowid(native method) 06-20 16:29:25.137: e/databaseutils(20244): @ android.database.sqlite.sqliteconnection.executeforlastinsertedrowid(sqliteconnection.java:775) 06-20 16:29:25.137: e/databaseutils(20244): @ android.d

is it possible to have multiple forms in the same html document? -

is it possible to have multiple forms in the same html document? - is possible utilize multiple form in same html document different method(without getting problem), illustration document devided 3 parts form every single part ? <form id="form1" method="post">..other elements goes here..</form> <form id="form2" method="get">..other elements goes here..</form> <form id="form3" method="post">..other elements goes here..</form> a page can contain infinity of forms. case, see 2 main solutions. 1. using different action addresses indicate action attribute in form tag different url. <form id="form1" method="post" action="/login">..other elements goes here..</form> <form id="form1" method="post" action="/signup">..other elements goes here..</form> 2. using hidden field flag add together hi

mysql - Add (not update) fields into column sql using insert -

mysql - Add (not update) fields into column sql using insert - i have table: create table teams (team char(1) primary key, players text); insert teams('a', 'jhon'); insert teams('b', 'mark'); now, how add together player 'carl' in team 'a'? the column 'players' maybe list? you do: insert teams('a', 'carl'); after remove primary key constraint. actually, want is: create table teamplayers ( teamplayerid int auto_increment, team char(1), players text ); then inserts want. junction table (sort of). suggests want teams table 1 row per team , players table 1 row per player. depending on application, tables may not necessary. mysql sql

java - Unable to use MySQL Connector/J with Servlets using TomCat -

java - Unable to use MySQL Connector/J with Servlets using TomCat - i'm trying utilize mysql in java 8 (using eclipse luna release (4.4.0) tomcat 8.0.9 on windows 7 x64). i set mysql-connector-java-5.1.31-bin.jar web-inf/lib directory. when compiling project normal java application works. however, when seek utilize same code servlet, throws java.sql.sqlexception: no suitable driver found jdbc:mysql://localhost:3306/test moving .jar file tomcat's /lib directory didn't help either (compiling normal application still worked though). i haven't changed anything, upgraded older combination of java, tomcat , eclipse. apparently tomcat doesn't load library/driver correctly; ideas why might be? compiling isn't issue; runtime problem. the tomcat docs clear: jdbc driver jar belongs in tomcat server /lib, not web-inf/lib application. that exception means driver class loaded, syntax of connection url string incorrect. open mysql ad

jar - how to run java file in window powershell -

jar - how to run java file in window powershell - i know there similar questions out there none of solutions work case. tried execute java file using windows powershell. this have java file: public class demo1 { public static void main (string arg[]){ system.out.println("demo1 start running"); seek { thread.sleep(4000); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); system.out.println("unable process"); } system.out.println("demo1 java completed."); } } for easy compilation, have copies of demo1.java, demo1.jar, , demo1.class in desktop directory. for powershell command, have tried: 1st attempt: c:..\desktop> java demo1.java 2nd attempt: c:..\desktop> java -class demo1.class 3rd attempt: c:..\desktop> java -jar demo1.jar all above effort homecoming error: ps c:\users\b003485\desk

Java JPA Hibernate Connection Issue -

Java JPA Hibernate Connection Issue - i'm using netbeans connect database. want utilize java persistence retrieve info database i'm getting these errors: jun 18, 2014 9:41:44 org.hibernate.annotations.common.version <clinit> info: hcann000001: hibernate commons annotations {4.0.2.final} jun 18, 2014 9:41:44 org.hibernate.version logversion info: hhh000412: hibernate core {4.2.6.final} jun 18, 2014 9:41:44 org.hibernate.cfg.environment <clinit> info: hhh000206: hibernate.properties not found jun 18, 2014 9:41:44 org.hibernate.cfg.environment buildbytecodeprovider info: hhh000021: bytecode provider name : javassist exception in thread "awt-eventqueue-0" java.lang.exceptionininitializererror @ controle_entregas.controleentregasui.jmenuitemnovaentregaactionperformed(controleentregasui.java:199) @ controle_entregas.controleentregasui.access$100(controleentregasui.java:18) @ controle_entregas.controleentregasui$2.actionperformed(controleen

mysql - Connecting fields in tables when the tables are already connected through other field -

mysql - Connecting fields in tables when the tables are already connected through other field - i have 2 tables: create table `osoby_dane` ( `os_id` int(6) not null auto_increment primary key, `imie` text, `status` int(1) ) engine=innodb default charset=utf8; create table `osoby_rank` ( `os_id` int(6) not null primary key, `os_rank` int default 1000, `status` int(1), constraint `fk_rank` foreign key (os_id) references osoby_dane(os_id) on update cascade on delete restrict ) engine=innodb default charset=utf8; example: osoby_dane: os_id | imie | status | 1 |john |1 | osoby_rank: os_id | os_rank | status | 1 | 1400 | 1 | my question how can (if can @ all..) connect fields in same rows (status column) 1 1 (if edit status field in 1 table in sec changed automatically). , don't want utilize trigger function make in osoby_rank constraint fk_status foreign key (os_id, status) references osoby_dane(os_id, status) on update

c++ - trouble linking cpp/hpp from cmake -

c++ - trouble linking cpp/hpp from cmake - there's zillions of questions on this, nil have read has helped me resolve problem, apologies in advance if (most likely) have missed something. i working on unit testing on big project, there multiple cmakelists.txt files. created "utilities.cpp" file grew quickly, decided split test_utilities.cpp , test_utilities.hpp. when #include test_utilities.cpp there joy, if #include test_utilities.hpp build fails: linking cxx executable foo cmakefiles/foo.dir/src/foo.cpp.o: in function `foo::bar()': /mydir/trunk/tests/src/foo.cpp:57: undefined reference `exit_on_invalid_config(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)' collect2: ld returned 1 exit status make[2]: *** [tests/foo] error 1 make[1]: *** [tests/cmakefiles/foo.dir/all]

c# - Store reference to an object in dictionary -

c# - Store reference to an object in dictionary - i have been searching way save references of variables of various types dictionary, corresponding key. modify instance of variable accessing reference through dictionary key. storing references, tried utilize <object> , without success. neither dictionaries nor lists take dictionary<string, ref int> . next code compiles, seems update variables value only. ideas or workarounds? here's (tested) code: class test1 { idictionary<string, object> mydict = new dictionary<string, object>(); public void savevar(string key, ref int v) //storing ref int { mydict.add(key, v); } public void savevar(string key, ref string s) //storing ref string { mydict.add(key, s); } public void changevar(string key) //changing of them { if(mydict.gettype() == typeof(int)) { mydict[key] = (int)mydict[key] * 2; } if(mydict.getty

dns - Pointing a domain to AWS Route 53 -

dns - Pointing a domain to AWS Route 53 - i having difficulties getting domain point ec2 properly. searched through few 3rd party guides online, , got swamped in official aws documentation, despite still cant work. ive have route 53 set this: type: value: ??.??.??.?? (ip address) type: ns value: ns-1403.awsdns-47.org. ns-1696.awsdns-20.co.uk. ns-632.awsdns-15.net. ns-431.awsdns-53.com. type: soa value: ns-431.awsdns-53.com. awsdns-hostmaster.amazon.com and on domain host have dns records set this: hostname: www type: ns value: ns-1403.awsdns-47.org ns-1696.awsdns-20.co.uk ns-632.awsdns-15.net ns-431.awsdns-53.com i think doing fundamentally wrong. firstly im not sure if got hostname part right on dns records. on site says .domain after input box hostname, makes me think sub domain specifier. right in thinking @ symbol works no subdomain? (i.e. domain.com instead of www.domain.com ) second

jsf - Multiple file upload with extra inputText -

jsf - Multiple file upload with extra inputText - i need implement following: multiple file upload in ajax style (without refreshing whole page) description field per file it must done jsf 2.0 there isn't problem 2 of 3 requirement in combination. multiple fileupload jsf 2.0 = primefaces, multiple file upload + description possible jsf 2.2 because has native upload element (i guess can ajaxed didn't check because can't utilize it), when 3 requirements stuck. on primefaces's p:fileupload there isn't description field , simple mode doesn't back upwards ajax. jsf 2.0 doesn't have native fileupload component. can bind description field primefaces's p:fileupload can't prevent user take multiple files , cause few files tied 1 description. so, possible multiple file upload in ajax style description field in primefaces , jsf 2.0? primefaces upload based on blueimp/jquery-file-upload. when .serializearray() gets called, info wi

javascript - Sencha touch scroll issue when tabbing between text fields -

javascript - Sencha touch scroll issue when tabbing between text fields - i've got number of text fields on panel in sencha touch (2.3) app. when utilize tab key navigate downwards through panel, scroll position gets updated accordingly. however, after tabbing downwards page, when seek scroll panel (either or down), panel behaving if scroll position still @ top , scrolling gets out of whack. causes scrolling lock or create panel content go off screen. solved attaching listener calls scrollto function when command field gets focus. ensure scroll position set correctly isn't case tabbing in sencha touch. myapp.utils.global.attachscrolltoonfocus([ 'firsttextfield', 'secondtextfield', 'thirdtextfield' ], scroller, container); and utility method: attachscrolltoonfocus: function(inputs, scroller, container){ var i, scroll = function(e){ var po

Custom style for custom font on Android -

Custom style for custom font on Android - i'm able load custom font in android way: mtypeface = typeface.createfromasset(context.getassets(), "fonts/avenirnextcondensed.ttc"); i'm loading fine, issue i'm facing need medium style, doesn't exist. font defaults bold regardless. there way set custom font style custom font? have been digging time, , saw below links: add custom font finish android application accessing font under assets folder xml file in android android fonts textview

mysql - truncate command ( Hive vs SQL) -

mysql - truncate command ( Hive vs SQL) - i expecting same behavior of truncate in sql , hive. different. want confirm if perceiving wrongly 1) in sql, next command drop table , create again. partitions dropped if exist mysql> truncate table t1; 2) in hive, next command delete info table. not drop existing partitions. need drop manually. hive> truncate table t1; i found 1 more issue, if add together column partitioned table altering it. there problem in insert overwrite info table. work around found drop existing partitions on table. is issue in hive(version 0.13)? other difference in using truncate hive , sql? in hive truncate table removes rows table or partition(s). the partitions won't remove.we have manually drop partitions. currently target table should native/managed table or exception thrown. mysql sql hadoop truncate hiveql

symfony2 - Custom message for @Security annotation -

symfony2 - Custom message for @Security annotation - i'm trying utilize @security annotations routes. this: /** * @return response * @route("/action") * @security("has_role('role_user')") * @template() */ public function someaction() { homecoming array(); } when security restriction fires exception, message expression "has_role('role_user')" denied access . this not acceptable shown end user, i'm trying find way customize message annotation. simple workaround not utilize @secutity annotations , write code these: /** * @return response * @route("/action") * * @template() */ public function someaction() { if (!$this->get('security.context')->isgranted('role_user')) { throw new accessdeniedexception('you have logged in in order utilize feature'); } homecoming array(); } but less convenient , less readable. is possible write custom

python - Kivy: Invalid instance in App.root -

python - Kivy: Invalid instance in App.root - i new python kivy, first little project, , don't know did wrong, next log pydev(eclipse): [info ] kivy v1.8.0 [info ] [logger ] record log in c:\users\sudheer\.kivy\logs\kivy_14-06-21_10.txt [info ] [factory ] 157 symbols loaded [debug ] [cache ] register <kv.lang> limit=none, timeout=nones [debug ] [cache ] register <kv.image> limit=none, timeout=60s [debug ] [cache ] register <kv.atlas> limit=none, timeout=nones [info ] [image ] providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored) [debug ] [cache ] register <kv.texture> limit=1000, timeout=60s [debug ] [cache ] register <kv.shader> limit=1000, timeout=3600s [info ] [text ] provider: pygame [debug ] [cache ] register <kv.loader> limit=

Jquery Datatable sending many ajax requests -

Jquery Datatable sending many ajax requests - i using jquery datatable 1.9 , facing weird problem.my code sending many(equal column in table) requests server.below code , using : tablecontainer.datatable({ sdom: '<"row"<"span6"l><"span6">r>t<"row"<"span6"i><"span6"p>>', spaginationtype: 'bootstrap', bprocessing: true, bserverside: true, bstatesave: false, bpaginate: true, olanguage: { slengthmenu: '_menu_ records per page' }, bfilter: true, bsort: false , // setup responsive datatables helper. bautowidth: false, fnpredrawcallback: function () { // initialize responsive datatables helper once. if (!responsivehelper) {

wordpress - Why does this 301 redirect results in redirect to wrong url? -

wordpress - Why does this 301 redirect results in redirect to wrong url? - after relaunching our website, have redirect links to, of them, exclusively new url paths. has lead list of 301 redirects in htaccess posted below. unusual reason though, rules redirect different page written in .htaccess. have searched file other redirect resulting url (which ends in 404, obviously) not formulated. as example, next 301 redirect ends @ wrong url removed due seo this ends at: removed due seo below total .htaccess: removed due seo # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress update: i think has next setup: removed due seo because in first line 'curriculum-vitae-startpagina' changed new structure, automatically redirects scond url before sec rewrite can locat

java - How do I map another column into Hibernate bean? -

java - How do I map another column into Hibernate bean? - i have object mapped hibernate using hbm.xml file. bean/object table includes field, appropriate getter/setters. want like: select t.*, 'xyz' otherdata table t and have info mapped bean, including value of fake/additional column - 'otherdata.' this should simple , maybe i'm missing easy, cant work. i've tried using createsqlquery() addentity(), addscalar(), setresulttransformer() and createcriteria() projectionlist() , setresulttransformer() and whatever else can think of , nil gives desired results. dont want generic list of objects have parse through build objects, , don't want have specify every column of table while building query. is there way can done? you might consider using formula property. can fill sql query data. consider illustration order - order line relation want fill property of order number of order lines, like: public class order { private

Gtk screenshot program wiredness (python) -

Gtk screenshot program wiredness (python) - i found python code online taking continuous screenshots gtk have major problem. when run code: import cv2 import image import numpy np def getscreenbygtk(): import gtk.gdk w = gtk.gdk.get_default_root_window() sz = w.get_size() pb = gtk.gdk.pixbuf(gtk.gdk.colorspace_rgb,false,8,sz[0],sz[1]) pb = pb.get_from_drawable(w,w.get_colormap(),0,0,0,0,sz[0],sz[1]) if (pb == none): homecoming false else: width,height = pb.get_width(),pb.get_height() homecoming image.fromstring("rgb",(width,height),pb.get_pixels() ) cv2.namedwindow('image', cv2.window_normal) while true: screen_img = getscreenbygtk() screen_img_array = np.asarray(screen_img) cv2.imshow('image',screen_img_array) cv2.waitkey(1) cv2.destroyallwindows() it gives me images slanted left: i've been trying find solution online can't. i'm running lubuntu 1

python while loop quit variable -

python while loop quit variable - i trying figure out how quit variable in while loop. learning python, new. should start variable1 variable2 print("press come in continue, or type "quit" press come in stop") while "quit"!="quit" variable1=input("enter input") variable2=input("enter input") i missing huge gap of information. (i feel) sname=input("please come in name: ") inum=int(input("please come in integer: ")) dnum=float(input("please come in decimal number: ")) print("name:",sname) print("value of inum:",inum) print("value of dnum:",dnum) sname=" " inum=" " dnum=" " print("press come in continue, or type "q" press come in stop") while "q"!=quit sname=input("enter input") inum=input("enter input") dnum=input("enter input")

c - Pointer Division possible? -

c - Pointer Division possible? - how can split , multiplicate 2 variables in c pointers? tried this: int multiplicate(int *x,int *y) { *x**y; } int divide(int *x,int *y) { *x/*y; } you missing return statement: int multiplicate(int* x, int* y) { homecoming (*x) * (*y); } int divide(int *x,int *y) { homecoming (*x) / (*y); } c pointers

angularjs - $http POST response from service to controller -

angularjs - $http POST response from service to controller - how response service in below case?? service: app.factory('ajaxservice', function($http) { updatetododetail: function(postdetail){ $http({ method: "post", headers: {'content-type': 'application/x-www-form-urlencoded'}, url: post_url, data: $.param({detail: postdetail}) }) .success(function(response){ //return response; }); } }) controller: updated_details = 'xyz'; ajaxservice.updatetododetail(updated_details); in th above case, post info through controller , working fine want response come in controller. how achive that?? $http returns promise: return promise updatetododetail: function(postdetail){ homecoming $http({ method: "post", headers: {'content-type': 'application/x-www-form-urlencoded'}, u

Context Aware Browsable API Rendering in Django REST -

Context Aware Browsable API Rendering in Django REST - is there easy way create hyperlinks in django rest browsable api, not in other api renderings. clear render fields hyperlinks when viewing page through browsable api render text component when rendering through json. an illustration of utilize case render pk in list view hyperlink detail view (similar to: http://chibisov.github.io/drf-extensions/docs/#resourceurifield) when viewing list view in browsable api mode. in regular json get, render pk. my hope create browsable api more useable/navigable when accessing through browser. is in way relevant: http://www.django-rest-framework.org/api-guide/renderers#browsableapirenderer? more generally, there anyway set excludes dependent on rendering mode? you can homecoming different serializers in different context, overriding get_serializer method on genericapiview or of subclasses. something right... def get_serializer(self, ...): if self.request.accepted

asteriskami - how hold /unhold call with Asterisk-java? -

asteriskami - how hold /unhold call with Asterisk-java? - once connected ami using java-asterisk create phone call : originateaction originateaction; managerresponse originateresponse; getevent event = new getevent(); sipshowpeeraction peer = new sipshowpeeraction(); peer.setpeer("phone1"); managerconnection.addeventlistener(event); originateaction = new originateaction(); parkaction park = new parkaction(); originateaction.setchannel("sip/mark"); originateaction.setcallerid("<6002>"); originateaction.setcontext("default"); originateaction.setpriority(new integer(1)); originateaction.setexten("1304"); managerconnection.login(); managerconnection.addeventlistener(event); originateresponse = managerconnection.sendaction(peer); originateresponse = managerconnection.sendaction(originateaction, 30000); thread.sleep(3000); park.setactionid(originateacti

notifications - InstallShield moved project no upgrade prompt -

notifications - InstallShield moved project no upgrade prompt - i have installshiled project has been moved system. can build install package, upgrades , goes well, if seek minor upgrade deployed application has been installed installation bundle built on previous machine, not prompt user app upgraded. not recognize same product, yet works should, normal upgrade. the product , upgrade codes have not been changed. ideas? thank you. in direct editor: go upgrade table , add together new record having next value in min , max versions according upgrade or downgrade prevention scenario : ***all_versions*** this look evaluates current product version @ runtime. from there can set property can used in custom action run whatever code want dll, vbscript or anything. notifications upgrade installshield prompt

grails - getAll() does not work in unit tests -

grails - getAll() does not work in unit tests - for simple domain class this: class color { string name; } why doesn't getall() work? @testfor(mycolorservice) @testmixin(domainclassunittestmixin) @mock([color, shade, colorshade]) class mycolorservicespec extends specification { def color def setup() { color = new color(name: "red") color.save(flush: true) } def "test colors shade" () { expect: 1 == color.count "red" == color.all[0].name "red" == color.getall([1]).name } } the test fails with: "red" == color.getall([1]).name | | | false [null] [] i've tried on grails 2.2.4 , 2.4.0 try "red" == color.getall([1l]).name you using integer whilst id type domain classes long grails spock

c# - Regexp Multiline -

c# - Regexp Multiline - help write right regexp such piece of text. here needed : to match strings. key figure id 123. necessary cover set policy id 128 exit and how place each of string group, because need each row converted kind of class="lang-none prettyprint-override"> set policy id 128 "trust" "untrust" "lm pool" "172.16.2.2/32" "any" permit set policy id 128 set dst-address "miep" set dst-address "miep ws" set dst-address "radius1" set dst-address "radius2" exit how can supplement creation: streamreader reader = new streamreader(opendialog.filename); string patternpolicy = @"set policy (id)(.+)exit"; var matchespolicy = regex.matches( reader.readtoend(), patternpolicy, regexoptions.multiline); you don't need alternative multiline , need regexoptions.singleline : var matchespolicy = regex.matches(rea

spring - SSL-Login Redirect Domain/Content Mismatch with IE8 -

spring - SSL-Login Redirect Domain/Content Mismatch with IE8 - we have spring 4.0 application spring security handle our login. works fine operating systems , browsers (!). there issue windows xp , net explorer 8 (win 7/ie8 works!). on login (test.example.com) redirected http https, expected. upon looking delivered content see content different subdomain (live.example.com)! header of http-request contain test.example.com, response live.example.com. how possible? , how can prepare this? it sni problem if utilize kind of load balancer, https proxy or more 1 ssl certificate on same ip. ie on windows xp not back upwards sni. test @ https://alice.sni.velox.ch how prepare this: load balancer / proxies: seek match https destination host header , not sni. for apache / nginx: 1 ip per ssl certificate spring internet-explorer-8 spring-security

ios - NSMutableArray in NSMutableArray as a single object -

ios - NSMutableArray in NSMutableArray as a single object - i trying add together nsmutablearray in nsmutablearray. trying nested arrays. my current code is: nsmutablearray *array1 = [nsmutablearray arraywithobjects: @"red", @"green", @"blue", @"yellow", nil]; nsmutablearray *array2 =[[nsmutablearray alloc] init]; [array2 addobject:array1]; this code adding 4 objects in array2 want add together array1 single object. edit: code working know in case in xcode wrong initializing , adding 4 objects. still not figure out. piece of code working properly. problem initialization in loop. i copy/pasted code, , adds 1 object array2, not four. printing description of array2: <__nsarraym 0xc46c7b0>( <-- array has 1 object <__nsarraym 0xc488770>( <-- array has 4 objects red, green, blue, yellowish ) ) you may getting confused fact printing description, prints conten

android - Get values from database to ListView -

android - Get values from database to ListView - i have written fetchdata() method fill listview values database. public void fetchdata() { database = helper.getreadabledatabase(); cursor c = database.query(db.table, null, null, null, null, null, null); string[] fromdb={db.fullname,db.year}; int[] toview={r.id.tvname_lv,r.id.tv_birthday_lv}; adapter = new simplecursoradapter(this, r.layout.listview_all, c, fromdb, toview); lv.setadapter(adapter); } it works fine. when seek utilize way, gives error. public void fetchdata() { database = helper.getreadabledatabase(); cursor c = database.query(db.table, null, null, null, null, null, null); string birthday=db.year+" "+db.month+" "+db.day; string[] fromdb={db.fullname,birthday}; int[] toview={r.id.tvname_lv,r.id.tv_birthday_lv}; adapter = new simplecursoradapter(this, r.layout.listview_all, c, fromdb, toview); lv.setadapter(adapter); } i want [db.year+