Posts

Showing posts from August, 2011

python - Use IOSTREAM instread of file in Pygmentize -

i have following in python script: what try is read partial source code(e.g. line 20 line 40) buffer , pip/apply iostream pygmentize can generate code highlighting partial source code.(e.g. line 20 line 40) currently, create partial tmp file partial source code(e.g. line 20 line 40) , use tmp file on pygmentize . subprocess.call(["pygmentize", "-f", "html", "-o", htmlfile, tmpfilename]) tmpfilename file name code want highlight. my question: how can create iostream , pip/apply iostream pygmentize don't have create tmp file in /tmp directory any suggestion appreciated!

How to generate list of random integers, but only using specified integers? (Python) -

this question has answer here: how randomly select item list? 11 answers this question generalized randomly creating list of size n, containing pre-specified integers (assuming uniform distribution). following: perhaps syntax like randlist([list of integers], size) which produce along lines of: randlist([1,-1], 7) >>> [1,-1,1,-1,-1,-1,1] #(random) or randlist([2,3,4], 10) >>> [4,3,4,2,2,4,2,3,4,3] #(random) i bit new python , everywhere returning range of values between low , high, , not specific values. thanks vals = [random.choice(integers) _ in range(num_ints)]

c++ - Can't initialise an array -

okay, i'm pretty new when comes c++ (having moved on vb) , can't seem work out how populate array without doing: array[0] = 1 array[1] = 2 etc etc so expected, have tried this: float posvector[3]; //declared outside of int main() needs global posvector = {0.0f,0.0f,0.0f}; //inside int main() which causing error displayed: extended initializer lists available -std=c++0x or -std=gnu++0x [enabled default] nothing have been able locate online far has been of help. advice can give me on fixing appreciated! once array declared cannot initialized using initializer list. can go with float posvector[] = {0.0f,0.0f,0.0f}; or better go std::vector : #include <vector> std::vector<float> posvector = {0.0f,0.0f,0.0f};

javascript - AJAX is running error function instead of success function -

i trying database login work. ajax call keeps running error function instead of success, , struggling understand why. function dologin() { var formdata = convertformtojson("#login-form"); console.log('login data send: ', formdata); $.ajax({ url: 'php/login-session.php', type: 'post', datatype: 'json', data: formdata, success: function(logindata) { console.log('login data returned: ', logindata); var status = logindata['status']; if(status == "fail"){ $("#loginerror").html(logindata['msg']); $("#loginerror").cs('display', 'block'); } else { getuserprofileinfo(); $("login-form").trigger('reset'); } }, error: function(jqxhr, textstatus, errorthrown){ co...

javascript - Flot Bar Chart multiple series issue -

Image
i've been using flot charts short period of time , need display bar chart 1 or 2 series depending on selection: if (lc2 != 'none') { values = [ { label: lc1, data: arrc1, color: cc1 }, { label: lc2, data: arrc2, color: cc2 } ]; bwidth = 0.15; } else { values = [{ data: arrc1, color: cc1 }]; bwidth = 0.3; } and function draws chart is: function barcharth(id, data, ticksl) { $.plot(id, data, { series:{ bars: { show: true, barwidth: bwidth, order: 1, horizontal: true } }, grid: { hoverable: true , align: "center" //,horizontal: true }, legend: { show: true } , yaxis: { ticks: ticksl } }); } but when needs display both series ( lc2 != 'none' ) appears second 1 (the bars become stacked). the thing if remove 'order:1' function , add order each data like:...

Take User input to perform calculation in javascript -

i have written piece of code not working. want use value entered user perform following calculation... function calculatebasic() { var uservalue = form.size.value; var powerfororganic = math.pow(uservalue,1.05); var effortfororganic = 2.4 * power; var powertdevorganic = math.pow(effortfororganic,0.38); var tdevfororganic = 2.5 * powertdevorganic; var averagestafffororganic = effortfororganic / tdevfororganic; var productivitylevelfororganic = averagestafffororganic / effortfororganic; alert( "effort :" + effortfororganic + "tdev :" + tdevfororganic + "average staff :" + averagestafffororganic + "productivity :" + productivitylevelfororganic); } <input type="text" id="size" placeholder="enter size in kloc"> <input type="button" id="enterinfo" value="submit" onclick="calculatebasic(this.form);"> ...

directx - DirectXTk GeometricPrimitive texture coordinates -

i'm using geometricprimitive scene elements, it's draw() call uses tx coords of 0-1 no opportunity (i think) change it. if change texcoords in directxtk code itself, can textures repeat using larger texture coordinates; though don't want dependent on hacking toolkit code. so, since draw() provides lambda callback, i'm wondering if there's opportunity remedy updating texture coordinates. i'm using basiceffect rendering, if helps. they use vertexpositionnormaltexture publicly accessible. if somehow provides me way walk vertex buffer , update tx coords, work me. i'm wondering if can map() or somehow else access buffer, walk vertices, update tx coords, , hope best. is best (only) approach or there better 1 geometricprimitive? i wound writing own shader render primitives , added uv transform. allowed me pass in xmmatrixscaling(10,10,10) example scale coords , larger repeat.

javascript - socket.io best way to track if a user is online -

i need update client side stuff if user has socket connection. currently broadcasting when user connects "logged in" client side (could server side , same result) // announce user online socket.on('connect', function() { socket.emit('im online'); }); server side io.sockets.on('connection', function (socket) { socket.on("im online", function (data) { // announce online status of new user socket.broadcast.emit('connected user', {"name": socket.handshake.headers.user.username}); }); }); the problem is, load page let know "online" because loading of page triggers event, if idol , user reloads his/her page nothing triggered on end, there no indication online. so thinking server side can capture array of users made connection , send array down new clients connecting , use compare users friend list see if username matches (usernames 100% unique in each case btw) then w...

Spark Cassandra connector saveToCassandra() is sending data to driver and causing a OOM exception -

i trying use spark cassandra connector. here code: javardd<userstatistics> rdd=cassandrajavautil.javafunctions(sparkcontext).cassandratable( configstore.read("cassandra", "keyspace"), "user_activity_" + type).where("bucket =?", date).select("user_id", "code").maptopair(row -> new tuple2<string, integer>(row .getstring("user_id"), 1)).reducebykey((value1, value2) -> value1 + value2).map(s -> { list<userstatistics> userstatistics = new arraylist<>(); userstatistics userstatistic = new userstatistics(); userstatistic.setuser_id(s._1); userstatistic.setstatistics_type(type); long total = s._2; int failurecount = 0;//s._2._2().iterator().next(); int selectedcount = 0; //s._2._2().iterator().next(); userstatistic.settotal_count((int) total); userstatistic.setfailure_cou...

java - How can i check if there is incoming data from a TCP Socket without receiving it? -

basically need notification, proceed receive data using class datainputstream , method read(). the problem datainputstream not have method check if there read , doing tests read() method interfere further calls read(). i can hack make test reading 1 byte , append further data it, see if there more elegant solution. datainputstream not have method check if there read yes does. missed available() method, doesn't return non-zero, depending on you're connected to. have @ pushbackinputstream .

c - floating point while loop -

int main() { float x = 50; float y = 1/x; float result = y * x; float test = 41; float z = 1/test; float testres = z * test; while (result == 1) { x--; } printf("%f\n", x); printf("%.6f\n", testres); } my while loop infinite, never ends, should end @ 41 because when test 41, equals 0.99999404 result never changes within loop, therefore there no reason believe that, once starts, loop ever end.

php session does not persist -

i have strange situation while trying make site work on bluehost someone. have built simple example illustrate this. have 2 files: <?php session_start(); $_session['x'] = 'yes'; var_dump($_session); and: <?php session_start(); var_dump($_session); now problem is, when call first file this: array(1) { ["x"]=> string(3) "yes" } but if after call second file this: array(0) { } so, session doesn't seem persist between calls. idea might cause this? the phpinfo session settings are: session support enabled registered save handlers files user registered serializer handlers php php_binary wddx directive local value master value session.auto_start off off session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_httponly off off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure off off session.entropy_file no v...

How do I authorize my ephemeral Google Container Engine instances in Cloud SQL? -

i test-driving google container engine (gke) , kubernetes possible replacement aws/elasticbeanstalk deployment. understanding virtue of dynamic servers being in same project cloud sql instance, they'd naturally included in firewall rules of project. however, appears not case. app servers , sql server in same availability zone, , have both ipv4 , ipv6 enabled on sql server. i don't want statically assign ip addresses cluster members ephemeral, i'm looking guidance on how can enable sql access docker-based app hosted inside gke? stopgap, i've added ephemeral ips of container cluster nodes , has enabled me use cloudsql i'd have more seamless way of handling if nodes somehow new ip address. the current recommendations (ssl or haproxy) discussed in [1]. working on client proxy use service accounts authenticate cloud sql. [1] is possible connect google cloud sql google managed vm?

ruby on rails - Nested routes that do not imply resource association -

is considered bad practice (or un-restful) create nested routes resources otherwise have no association? example have: resources :foos resources :bars end but have no business logic elsewhere in database or application associates :foos :bars . the reason want this: many of routes created resources nested under :groups resource. can grab group_id param , show layout matches group user "in". i'm comfortable when resource belongs_to group: /groups/1/comments/1 but when other comment not belong_to group (group1) , want @ through layout "branded" group1, impulse route this: /groups/1/comments/2 is ok do, maybe i'm overthinking this? i maintain app similar requirements. along lines of: class user has_and_belongs_to_many :groups belongs_to :active_group, class_name 'group' def active_group return super unless super.nil? group = groups.first update_columns(active_group_id: group.id) group ...

What is a C++ object of the type vector<char,allocator<char> > and how can it be used? -

i have c++ object of type vector<char,allocator<char> > . conceptually, expect list of boolean values. how should access (for example, print boolean value of each of elements)? if able use range for , can use: for ( auto el : v ) { // use el } if still using c++03, can use: vector<char,allocator<char> >::const_iterator iter = v.begin(); vector<char,allocator<char> >::const_iterator end = v.end(); ( ; iter != end; ++iter ) { char el = *iter; // use el }

How to calculate Cell phone bill in java, calculation issues -

my task calculate monthly cell phone bill in java, new java , still learning. can't seem understand calculations , how there. have named variables , constants , initiliazed them, need make calculations find cost of total bill. output i'm trying reach : run: minutes used = 675 text messages sent/recieved = 1031 data used = 605 megabytes. have data play? (y/n) : y have text message plan (y/n)?: y monthly cell phone charges : monthly plan = 39.99 text message plan = 15.00 data plan = 20.00 addidtional minutes charged = 79.85 charge data overage = 40.00 public static void main(string[] args) { // todo code application logic here scanner user_input = new scanner(system.in); final double monthly_plan_voice; final int allowable_minutes; final double additional_minute_rate; final double text_msg_plan; final double text_msg_rate; final double data_plan_rate; final int allowable_data_incr; monthly_pl...

c# - Can't use ResourceType - Reference installed -

Image
i trying use: system.componentmodel.dataannotations.displayattribute.resourcetype and visual studio not recognize it. have reference installed: and in model cannot use it: i have no idea why happening. can me? thanks in advance you have closing ) after name property. attribute needs be [display(name = "name", resourcetype = typeof(...))] public int email { get; set; }

algorithm - C - Perceptron school project - single data set, error not converging -

hello everyone, i'm stuck working on school project described such: your program should read in file in.csv, , adjust weights of perceptron when given inputs trained with, provides corresponding outputs. in reality, error may never 0 when training ann; goal make smart enough recognize instances. project start error of 5%, or 0.05. mean, example, ann correctly identified 95/100 of inputs, , 05/100 mistakenly classified. see if can modify parameters of ann training process better 5%, program should not continue trying modify weights after 500,000 iterations. sample run: c:\percy in.csv 100 5 10 where executable percy.exe, input file in.csv, learning rate 100/1000=0.100, error 5/100, , max iterations in thousands, 10 corresponds 10,000. the input file formatted per example below. first 16 characters in line represent sensor inputs, , last char either 0 or 1, , represents class input corresponds to. 0000000001000000,0 0000000001000001,1 0000000001000010,1 00...

units of measurement - Does java -Xmx1G mean 10^9 or 2^30 bytes? -

and in general, units used -xmx , -xms , -xmn options ("k", "m" , "g", or less standard possibilities "k", "m" or "g") binary prefix multiples (i.e. powers of 1024), or powers of 1000? the manuals represent kilobytes (kb), megabytes (mb) , gigabytes (gb), suggesting powers of 1000 defined in original si system. informal tests (that i'm not confident about) suggest kibibytes (kib) , mebibytes (mib) , gibibytes (gib) , powers of 1024. so right? e.g. java code show current size? using multiples of 1024 not surprising ram sizes, since ram typically physically laid out doubling hardware modules. using units in clear , standard way ever more important bigger , bigger powers, since potential confusion grows. unit "t" accepted jvm, , 1 tib 10% bigger 1 tb. note: if these binary multiples, suggest updating documentation , user interfaces clear that, examples " append letter k or k indicate kibiby...

Pickling issue with python pathos -

import pathos.multiprocessing mp class model_output_file(): """ class read model output files """ def __init__(self, ftype = ''): """ constructor """ # create sqlite database in analysis directory self.db_name = 'sqlite:///' + constants.anly_dir + os.sep + ftype + '_' + '.db' self.engine = create_engine(self.db_name) self.ftype = ftype def parse_dgn(self, fl): df = pandas.read_csv(...) df.to_sql(self.db_name, self.engine, if_exists='append') def collect_epic_output(self, fls): pool = mp.processingpool(4) if(self.ftype == 'dgn'): pool.map(self.parse_dgn, fls) else: logging.info( 'wrong file type') if __name__ == '__main__': list_fls = fnmatch.filter(...) obj = model_output_file(ftype = 'dgn') ...

uitableview - iOS Change color of label affected by UIVibrancyEffect -

Image
is there way somehow affect color of label under vibrancy effect or @ least bring contrast setting tint/alpha/background/whatever properties? can see below, in case vibrancy created unreadable text... when went through 2014 wwdc video found @ least way affect appearance of vibrancy. can set background color of original blur view's contentview this: blurview.contentview.backgroundcolor = [uicolor colorwithred:0 green:0 blue:0 alpha:0.01]; which unfortunately affect whole blur (by tinting) on vibrancy based. @ least text more readable after that.

indexoutofboundsexception - Java Array index out of bounds exception fix -

i getting array out of bounds exception while executing line name.firstname = this.firstnames[rand.nextint(num_names)]; dont have issues finding source of these exceptions have been stuck on 1 time now. appreciated, class , stacktrace pasted below: public class namegenerator { private static final int num_names = 200; private static final file names_file = new file("resources/info.dat"); /** random number generator */ private random rand; /** array of first names */ private string[] firstnames; /** array of last names */ private string[] lastnames; /** * default constructor */ public namegen() { super(); this.rand = new random(); try { readfile(); } catch (ioexception exp) { this.first = new string[] { "foo" }; this.last = new string[] { "bar" }; } } /** * read names file */ private void readnfiles(...

node.js - how to fix $PATH in Virtual Box Ubuntu 14.04 after npm global install -

i've been trying install npm globally in virtual box ubuntu 14.04 , apache 2.4 various problems laravel 5.1 reading through docs on npm adn following through these instructions https://docs.npmjs.com/getting-started/fixing-npm-permissions know have completed wrecked $path previously when ran echo $path got this; /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games now when echo $path following; /usr/local/bin:/bin i have managed stuff on laravel install, composer no longer works, php artisan no longer works - wondering if able me was... for novices may struggling this, got path, composer, artisan , laravel functioning first, replacing .bashrc non corrupt 1 in terminal /etc/skel directory (in local indicated $) $cp /etc/skel/.bashrc ~/ commit changes with $source ~/.bashrc then used following export /usr/bin path - error attempted in terminal "the command not located because '/usr/bin' not included in path...

java - While loop with iteration -

i trying create while loop user has total of 3 tries enter valid number. i'm not understanding how system recognizes 3 invalid attempts have been made before displaying message. classes, variables, , scanner objects made. after 3 attempts, want "no more tries". have program written use user's input quantity if valid. if input 3 invalid attempts.   updated code: int quantity = 0; // user's desired amount of lemonade cups system.out.print("hello " + name + ". how many cups of lemonade can you? "); quantity = keyboard.nextint(); // store amount of cups wanted int attempts = 0; int maxattempts = 3; double subtotal = quantity * lemonadecost; double totaltax = subtotal * 0.08; double totalprice = subtotal + totaltax; while (attempts < maxattempts) { if (quantity < 1 || quantity >= 20) { system.out.println("that invalid amount...

How to output MySQL query results in csv format in Windows environment? -

is there easy way run mysql query powershell command line , output results csv formatted file? this question same how output mysql query results in csv format? except in windows. had figure out in powershell answer didn't belong on linux question. here's windows+powershell sibling. stan's answer how output mysql query results in csv format? , adapted windows powershell mysql my_database_name -u root | out-file .\my_output_file.csv this gives me mysql prompt, without usual mysql > @ start. type: source c:\aboslute\path\with spac es\without\quotes\to\my_select_statement.sql it gives error message , exits if there problem command, or gives me empty prompt if command executed successfully. type exit finish up.

implementing pretty time to format Date time in android -

i implementing pretty time library site http://www.ocpsoft.org/prettytime/ formatted date string text in android application. i feeding date string local sqlite database, string datestring="2015-09-25 15:00:47"; simpledateformat dateformat = new simpledateformat("mm/dd/yyyy hh:mm:ss aa"); date converteddate = new date(); try { converteddate = dateformat.parse(datestring); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } prettytime p = new prettytime(); string datetime= p.format(converteddate); textview.settext(datetime); i want able date formatted parsetext 2 minutes ago 1 day ago ... however snippet codes above gives me text , avoids time. gives minutes ago ... please there need do, grateful if help. thanks you're not passing date prettytime object, because date-conversion fails. confirm in logcat. the problem y...

How to ignore duplicate Primary Key in SQL? -

i have excel sheet several values imported sql (book1$) , want transfer values processlist. several rows have same primary keys processid because rows contain original , modified values, both of want keep. how make sql ignore duplicate primary keys? i tried ignore_dup_key = on rows duplicated primary key, 1 latest row shows up. create table dbo.processlist ( edited varchar(1), processid int not null primary key (ignore_dup_key = on), name varchar(30) not null, amount smallmoney not null, creationdate datetime not null, modificationdate datetime ) insert processlist select edited, processid, name, amount, creationdate, modificationdate book1$ select * processlist also, if have row , update values of row, there way keep original values of row , insert clone of row below, updated values , creation/modification date updated automatically? how make sql igno...

jquery - Javascript vertically centering the active element -

i have carousel in website doing, need implement function center image vertically when item active, function this: function vertically_centred(first_box_id, second_box_id){ window.onresize = function() { var height1 = document.getelementbyid(first_box_id).offsetheight; var height = document.getelementbyid(second_box_id).offsetheight; var total = (height / 2 ) - (height1 / 2); var color = document.getelementbyid(first_box_id); color.style.top = total + "px"; }; } i have 3 items 2 box inside different ids, function works perfectly, when carousel changes next item function doesn't work have implemented function adding in html file: <script> vertically_centred('text-1', 'item-1'); vertically_centred('text-2', 'item-2'); vertically_centred('text-3', 'item-3'); </script> i think needs detect if item active use function , not know how it. html...

android - How to get radio Button values number -

i making application has list , radio buttons. layout contains of following : list , button . the list contains of radio buttons. 2 radio buttons. after checking buttons. want make loop reads values of how many in button 1 , how many in button two. how have done far. listviewstudenteditabsence country ; for(int i=0;i<listviewstudentnames.size();i++) { country = listviewstudentnames.get(i); if (country.getabsence()==1) { absence[i] = "1"; } else { absence[i] ="0"; } } but doesn't seem work. in customadapter getview() method int value=0; //globally radiogroup radiogroup = (radiogroup) convertview.findviewbyid(r.id.yourradiogroup); radiogroup.setoncheckedchangelistener(new oncheckedchangelistener() { @override public void oncheckedchanged(radiogroup gr...

python - Get topological ordering of graph from Adjacency list -

having file adjacency list of graph g like: 0 -> 13,16,20,22,4,5 1 -> 12,13,16,17,19,22,23,24,25,3,4 10 -> 13,14,17,20,23,24 11 -> 12,19,20,22,23 12 -> 15,20,24 13 -> 20,21,22 15 -> 23 17 -> 25 19 -> 20,25 2 -> 16,19,3,7 20 -> 22,23 21 -> 22,23,24 22 -> 25 24 -> 25 3 -> 15,21,4 4 -> 10,12,14,15,16,17,18,19,21,23,5 5 -> 11,16,17,20,23,8,9 6 -> 12,14,18,22 7 -> 14,17,22 8 -> 21,24 9 -> 12,14 i want it's topological ordering, graph g directed acyclic graph. first of want parse txt file , put in dictionary. having issues, first when reading file missing thati miss first element after -> : f = open('topo.txt', 'r') line_list = f.readlines() g = {int(line.split('->')[0]): [int(val) val in line.split(',')[1:] if val] line in line_list if line} i get: ('g:', {0: [16, 20, 22, 4, 5], 1: [13, 16, 17, 19, 22, 23, 24, 25, 3, 4], 2: [19, 3, 7], 3: [21, 4], 4: [1...

java - 'A resource was acquired at attached stack trace but never released ' error when a receiver is starting an IntentService -

i have broadcastreceiver calls intentservice . getting following error when receiver code finished running. error 'a resource acquired @ attached stack trace never released. see java.io.closeable information on avoiding resource leaks. java.lang.throwable: explicit termination method 'release' not called' here code: public class restartreceiver extends broadcastreceiver { private static final string tag = "restartreceiver"; @override public void onreceive(context context, intent intent) { android.os.debug.waitfordebugger(); connectivitymanager connmgr = (connectivitymanager) context.getsystemservice(context.connectivity_service); final networkinfo wifi = connmgr.getnetworkinfo(connectivitymanager.type_wifi); final networkinfo mobile = connmgr.getnetworkinfo(connectivitymanager.type_mobile); if (wifi.isconnected() || mobile.isconnected()) { intent downloadintent=new intent(context...

r - Speed up tapply with changing groups -

i writing function calculate difference in mean of 2 groups, groups changes each time, simple results, problem have rather large data set, speed key. "readable" version, using iris data example. loopdif = function(nsim) { change = numeric(nsim) var = iris$sepal.length (i in 1:nsim){ randomspecies = sample(c("a","b"), length(var), replace=true) change[i] = diff(tapply(var, randomspecies, mean)) } return(change) } > system.time(loopdif(10000)) user system elapsed 2.06 0.00 2.06 the tried vectorise code: slowdif <- function(nsim) { change = numeric(nsim) randomspecies = replicate(nsim,sample(c("a","b"), length(var), replace=true)) var = iris$sepal.length change = diff(unlist(lapply(split(randomspecies, col(randomspecies)), function(x) unlist(lapply(split(var, x), mean))))) return(change) } > system.time(slowdif(10000)) user system elapsed ...

javascript - Is there any plugin that encrypt/decrypt a base64 URL? -

i have created chrome app , want store encrypted base64 url of video file using chrome.storage.local api no 1 can use url play video in offline mode authenticated user can play . i have search chrome.storage api, there find statement "confidential user information should not stored! storage area isn't encrypted." thats why want encrypt base64 url. thanx. base64 not encryption, it's encoding . difference being encryption uses secret key control access data, while encoding requires no key. without key involved in process, knows algorithm can decode data. base64, other encoding algorithms, should not used protect confidentiality of data. daniel miessler has article goes more detail differences , use cases of encryption vs encoding, , covers hashing.

java - How to convert large integer number to binary? -

sorry possible duplicate post, saw many similar topics here none needed. before posting question want explicitly state question not homework. so question is: how convert large integer number binary representation? integer number large enough fit in primitive type (java long cannot used). input might represented string format or array of digits. disclaimer, not going solution of production level, don't want use biginteger class. instead, want implement algorithm. so far ended following approach: input , output values represented strings. if last digit of input even, prepend output "0", otherwise - "1". after that, replace input input divided 2. use method - dividebytwo arithmetical division. process runs in loop until input becomes "0" or "1". finally, prepend input output. here's code: helper method /** * @param s input integer value in string representation * @return input divided 2 in string representation **/ static string...

javascript - jQueryMobile Tap to Stop Scrolling -

hi i'm using jquery mobile build cross platform mobile app , have following issue: whenever there list many items, user scrolls down , when taps stop scrolling, item gets clicked instead of stopping scroll, should do? i had same issue, solved creating flag variable gets turned off on stopscroll jqm event. var tapflag = true; $(document).on("scrollstart",function(){ tapflag = false; }); $(document).on("scrollstop",function(){ tapflag = true; }); and allow items tapped if tap flag true.

xampp - I can not generate iReport report in php java bridge -

use tomcat-7 java bridge, xampp php phpmyadmin, ireport 5.6 design , included libraries jasperreport-library-6.1.1 javabridge. already set catalina_home, java_home, jre_home, php_home , path =% php_home% environment variables. the report in ireport working 100% , normal php script. but when go generate report php java bridge gives me error. , no longer can be. i'm new @ this, if can give help, thank you. i apologize english error: warning: require_once(): http:// wrapper disabled in server configuration allow_url_include=0 in c:\xampp\htdocs\prueba_report\index.php on line 24 warning: require_once(http://localhost:8080/javabridge/java/java.inc): failed open stream: no suitable wrapper found in c:\xampp\htdocs\prueba_report\index.php on line 24 fatal error: require_once(): failed opening required 'http://localhost:8080/javabridge/java/java.inc' (include_path='.;c:\xampp\php\pear') in c:\xampp\htdocs\prueba_report\index.php on line 24 i thin...

java - EntityManager find method with proper arguments returns null -

i'm trying emails entity in 1 of dao's method method: emails mail = entitymanager.find(emails.class, email); //test system.out.println("code: " + code + ", email: " + email); system.out.println(mail == null ? "mail equal null" : ("mail:" + mail.getconfirmationcode() + ", " + mail.getemail() + ", " + mail.getuser_id())); where entitymanager's find method returns null. i'm sure both arguments of method proper , row exists in database method shuld return entity, not null. and what's important. when i'm using same method in method of same dao class same arguments works fine , entitymanager's find method returns proper entity. methods annotated transactional. i note when call find method referencing row returns proper entity. problem 1 entity, same find mathod entity still works in anothers dao's method. update: let's primary key of row "adrian@domain.com...

javascript - Threejs - How to raycast and get barycentric coordinates of triangle in mesh? -

i'm using r71 , need click raycast scale three.geometry plane according user uploaded photo , barycentric coordinates of point inside clicked triangle on mesh. know there three.triangle.barycoordfrompoint (point, optionaltarget) function don't desired result guess because mesh scaled according image uploaded. var scaleratio = 0.1; var loader = new three.objloader(); loader.load( 'obj/plano_tri.obj', function(object) { var scaletexture = 1; scalegeometryx = texture.image.width / texture.image.height ; var desiredheight = 144 * 0.08; if (texture.image.height > texture.image.width) { scaletexture = desiredheight / texture.image.height; } var plane = object; plane.scale.setx( scaleratio * scalegeometryx ); plane.scale.sety( scaleratio ); scene.add( plane ); }); my code attempts transform face3 indexes obtained @ raycast in triangle , call function point raycast: raycaster.setfromcamera( ...

java - Inject the values with singleton scope using class name -

i new spring. class diagram this public abstract class cache{ refreshcache() { clearcache(); createcache(); } clearcache(); createcache(); getname(); } @component @scope("singleton") @qualifier("category") class category extends cache implements icategory{} @component @scope("singleton") @qualifier("attr") class attr extends cache implements iattr{} @component @scope("singleton") @qualifier("country") class country extends cache implements icountry{} by default scope of spring beans singleton. want create cache management service. reflection classes extends cache class cache singleton scope if instantiate them " new " getting new object other different object , other class inject following. class { @inject country c } class b { @inject attr attr } every injection using same cache if create " new " refresh not reflect them. p.s. - main goal create cla...

calling a function from oracle in C# giving error -

i calling function oracle package return string below using(oracleconnection con = appconn.connection) { oraclecommand cmd = con.createcommand(); cmd.commandtype = commandtype.storedprocedure; cmd.connection = con; cmd.commandtext = "select p_pkg.found(@p_id) dual"; oracleparameter p_id = new oracleparameter(); p_id.oracledbtype = oracledbtype.int64; p_id.direction = parameterdirection.input; p_id.value = requestheader.approval_id; cmd.parameters.add(p_id); try { con.open(); string found = cmd.executescalar().tostring(); } catch(exception ex) { } { con.close(); } } but getting below error . can't find problem after lot of search. please help. ora-06550: line 1, column 51: pl/sql: ora-00936: missing expression ora-06550: line 1, column 7: function signature in oracle p_pkg.found(p_id in number) return varchar2 //(yes , no) i run oracle below ,...

android - Jsoup with big XML -

i'm using jsoup on android application, read xml file webservice restful. the jsoup library works until xml file contains few number of records. but when xml 50k or 60k of records, observed jsoup allocate memory until 230mb 240mb. problem because android:largeheap="true" i have 256mb of memory allocable. this saple code, try yourself public class mainactivity extends actionbaractivity { private static handler mhandler = new handler(); private static context context; static textview textview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview = (textview) findviewbyid(r.id.textview); textview.settext("5 seconds start task"); context = this.getapplicationcontext(); mhandler.postdelayed(new runnable() { public void run() { new syncdataws(context).execute(); } }, 5000); } @override public bo...

android - Convert JSONArray to ArrayList of Custom Object Through GSON -

i getting response in form of json string.in response 1 field array of object or simple object eg. type 1. [{"0":1, "1":"name1", "id":1, "name":"name1"} , {"0":2, "1":"name2", "id":2, "name":"name2"}] type 2. {"0":1, "1":"name1", "id":1, "name":"name1"} to handle case have created 2 model classes 1 array of object , 1 single object. is there smart way handle this. ok. so, want use gson. first, go http://www.jsonschema2pojo.org/ , create relavent 1 pojo class. below model class : example.java public class example { @serializedname("0") @expose private integer _0; @serializedname("1") @expose private string _1; @serializedname("id") @expose private integer id; @serializedname("name") @expose private string name; /** * * @return * _0 */...

c++ - Initializing private member variables of a class -

i apologize in advance because of verbiage may not 100% correct. i have class this: class classname { private: anotherclass class2; public: classname(); ~classname(); ... in constructor of class, among other things, put line classname::classname() { anotherclass class2; } which how thought supposed initialize objects in c++, noticing (through gdb) 2 anotherclass objects being created. once on constructor definition again on initialization line. reasoning behind this? if wanted use more complicated constructor anotherclass(int a, int b) , create temporary object create correct 1 shortly after? anotherclass class2; creates local object inside constructor body, gets destroyed @ end of body. not how class members initialized. all class members initialized before entering constructor body, is, in member initializer list between constructor signature , body, starting : , separated , s, so: classname::classname() : class2(argumentstop...

c# - is it possible to create a windows service which pop up a windows application -

is possible create windows service pop windows application , can save values list through application. want create windows service running every 2 hours , save values share point list. yes, can, don't think should. typical user interactions create startup application easier manage , interact user, or use task scheduler. to answer question, windows services can user interactive, means can have access user's user interface (aka desktop). can use show messages users , ask input. read more on how enable , how internals work on msdn: interactive services . from msdn: use createprocessasuser function run application within context of interactive user so can start external application interact user, save information in list or database, , move on.

eclipse - How to put label item on rowLayout in SWT? -

Image
i want put items on row layout. take error. error image here: my example code below: gridlayout parentlayout = new gridlayout(1, true); parent.setlayout(parentlayout); // design filter composite layout composite filtercomposite = new composite(parent, swt.none); rowlayout filtercompositelayout = new rowlayout(); filtercompositelayout.wrap = true; filtercompositelayout.pack = false; filtercompositelayout.justify = true; filtercompositelayout.type = swt.horizontal; filtercomposite.setlayout(filtercompositelayout); // design filter composite label lbl_type = new label(filtercomposite, swt.border); lbl_type.settext("type :"); combo cmb_type = new combo(filtercomposite, swt.border); cmb_type.settext("-- choose --"); label lbl_severity = new label(filtercomposite, swt.border); lbl_severity.settext("severity :"); combo cmb_severity = new combo(filtercomposite, swt.border); cmb_sev...

Android: Make scrollable TextView always focus first line? -

how make scrollable textview focus on first line/focus top? problem: when scroll textview third line @ first page,it assume there 3 lines of text in second page, causing text "disappears" when second page has 1 line of text. txtcaptions.scrollto(0,txtcaptions.getlayout().getlinetop(0)); doesn't work me.

python - Change indescriptive axis names of Pandas Panel and Panel4D -

the standard axis names of panel items, major_axis , minor_axis in [2]: pd.panel() out[2]: <class 'pandas.core.panel.panel'> dimensions: 0 (items) x 0 (major_axis) x 0 (minor_axis) items axis: none major_axis axis: none minor_axis axis: none that indescriptive hell, , gets worse panel4d, labels added fourth axis. there way change them during initialization? or can use pd.core.create_nd_panel_factory create new panel4d factory different axis names? edit: have is out[3]: <class 'pandas.core.panel.panel'> dimensions: 0 (items) x 0 (major_axis) x 0 (minor_axis) x axis: none y axis: none z axis: none since answer given in pandas access axis user-defined name old pandas version , not provide full functionality, how works: from pandas.core.panelnd import create_nd_panel_factory pandas.core.panel import panel panel4d = create_nd_panel_factory( klass_name='panel4d', orders=['axis1', 'axis2', 'axis3', ...

Cannot configure Websphere Liberty Profile 8.5.5.7 -

i'm trying configure websphere liberty profile 8.5.5.7 eclipse mars when start following errors: [error ] cwwkf0002e: bundle not found com.ibm.ws.javaee.el.2.2/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.javaee.jsp.2.2/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.org.apache.jasper.el.2.2/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.org.eclipse.jdt.core.3.10.0.v20140902-0626/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.jsp.factories.2.2/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.javaee.jstl.1.2/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.jsp-2.2org.apache.jasper/[1.0.0,1.0.100). [error ] cwwkf0002e: bundle not found com.ibm.ws.jsp/[1.0.0,1.0.100). there server.xml file: <server description="new server"> <!-- enable features --> <featuremanager> <feature>jsp-2.2</feature> ...