Posts

Showing posts from September, 2014

java - Mistake in HQL query while creating reports through hibernate projection -

i had following query working fine had convert hibernate projection performance issues. namedquery = " select o orderjob o " was converted to:- string hqlquery = "select " + "new jobauditlistvo( o.jobdate, o.jobtype, customer.name, job.street, payment.description, p.paid,o.invoice) " + " orderjob o " + " join o.order ordr " + " join ordr.customer customer " + " join o.jobaddress job " + " join o.payment p" + " join p.paymentreceivedmethod payment"; getentitymanager().createquery(hqlquery).getresultlist(); but list returning 0 results. while name query return 2 results. i have got answer. both queries absolutely equivalent. problem had use left join instead of simple join. because entities returning null.

php mysql get all parents -

i'm trying parents of children. have simple query select sections sectionid = 6 database structure simple sectionid parent 1 0 2 1 3 1 4 2 5 4 6 5 now i'm trying parents sectionid 6, result should string 0/2/4/5/6. children might not have lot of parents, might have 1 result should different. i.e 5/6.. hope understand i'm trying do. have tried couple recursive functions i've found on internet, suck @ , wondering if me on right track. p.s i'm using php , mysql well, far can see have 2 choices, both known. 1) make recursive function, ones have been trying. there tons of them around , won't put him in here. 2) far favourite, database pattern modern orm use, it's called nested set model. basically create few more columns on table, should one: create table nested_category ( category_id int auto_increment primary key, name varchar(20) not null, lft int not null, rgt int not null );

osx mavericks - Apache server on MAMP 3.0.6 not working -

i've updated mamp conf 3.0.6 apache server not work. running os x mavericks. have looked on various posts , forums can t find simple solution doesn't require extensive programming experience.. don't have! any simple solutions out there? here contents of mysql_error_log.err file. 140910 14:18:16 mysqld_safe starting mysqld daemon databases /applications/mamp/db/mysql 140910 14:18:16 [warning] setting lower_case_table_names=2 because file system /applications/mamp/db/mysql/ case insensitive 140910 14:18:16 [note] plugin 'federated' disabled. 140910 14:18:16 innodb: innodb memory heap disabled 140910 14:18:16 innodb: mutexes , rw_locks use gcc atomic builtins 140910 14:18:16 innodb: compressed tables use zlib 1.2.3 140910 14:18:16 innodb: initializing buffer pool, size = 128.0m 140910 14:18:16 innodb: completed initialization of buffer pool 140910 14:18:16 innodb: highest supported file format barracuda. 140910 14:18:16 innodb: waiting background th

objective c - UIView Animating a 2D Bouncing Ball (Squash & Stretch) in iOS -

Image
looking animating view bouncing ball using squash & stretch, in cocoa using core animation... 1 - bouncing ball animation ;;;; cabasicanimation *animmoveup = [cabasicanimation animationwithkeypath:@"position"]; animmoveup.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout]; animmoveup.fromvalue = [nsvalue valuewithcgpoint:_bottom]; animmoveup.tovalue = [nsvalue valuewithcgpoint:_top]; cabasicanimation *scaleanim1 = [cabasicanimation animationwithkeypath:@"transform"]; scaleanim1.tovalue = [nsvalue valuewithcatransform3d:catransform3dmakescale(2.5, 2.0, 1.0)]; scaleanim1.tovalue = [nsvalue valuewithcatransform3d:catransform3dmakescale(2.0, 2.0, 1.0)]; cabasicanimation *bounceanim1 = [cabasicanimation animationwithkeypath:@"transform"]; bounceanim1.fromvalue = [nsvalue valuewithcatransform3d:catransform3dmakescale(2.0, 2.0, 1.0)]; bounceanim1.tovalue = [nsvalue valuewithcatransf

python - how to get the time after two minutes -

i have execute command automatically after 2 minutes current date using shell scripting. lets current time in below format. script should read current time ,add 2 minutes existing time 2014-09-10t09-23-34 , execute remaining script. date +"%y"-"%m"-"%d"t"%h"-"%m"-"%s" 2014-09-10t09-21-34 to date-string in bash: echo "current: " $(date +"%y"-"%m"-"%d"t"%h"-"%m"-"%s") echo "+2 min : " $(date --date="@$(($(date +%s)+120))" +"%y"-"%m"-"%d"t"%h"-"%m"-"%s") prints current: 2014-09-10t15-58-15 +2 min : 2014-09-10t16-00-15 read time string , print +2min string str="2014-09-10t15-58-15" new=$(date --date="@$(($( ifs="-t" read y m d h m s <<< "$str";date --date="$y-$m-${d}t$h:$m:$s" +%s )+120))&q

google areachart cannot access datatable rows -

i'm using google chart api draw area chart. chart represents altimetric profile , when pass mouse on it, shows position (lat , long) underlying data table. so created chart: data = new google.visualization.datatable(json); chart = new google.visualization.areachart(document.getelementbyid("chart-output")); and draw it: chart.draw(data, options); and add handler mouseover event when event triggers, want row underlying data source if (event.row != null && event.column != null){ //data chart datasource var o = data.d[event.row]; var sel_x = o.c[0]["coords"]["x"]; var sel_y = o.c[0]["coords"]["y"]; ... //show x, y } the point when project first released, last year, worked fine , property data.d contained desired value. now, i've found same property undefined , rows array found in property data.tf . i expect gain access datasource rows through getter method, cannot find right one. datatable

ios - How to make transparent modal VC? -

i have 2 vc. on second vc have color rectangle. vc has transparent background. when second called vc (by clicking button modal action), there rectangle, conceived, vc has transparent background. it's not long time, until end of second appearance of vc. when animation ends appearance of second vc, vc of second background black. how make transparent background of second vc after animation?

How to run/debug Ruby Cucumber tests in IntelliJ IDEA? -

i launch cucumber tests shell command bundle exec cucumber -p local features . questions: how same of intellij idea? how debug tests intellij idea? there ruby plugin intellij. i'm not familiar (i use rubymine), expect has dedicated run/debug support cucumber rubymine does.

mysql - Wordpress Custom Meta Query without wp functions (wo. wp_query()) -

i have fetch title, description , attachment out of wordpress database without wp_query. can't how fetch both, attachments , meta_descriptions @ same time... this how query looks far $query="select post_title, meta_value wp_posts p join wp_postmeta pm on p.id=pm.post_id post_status='publish' , post_type='page' , post_parent=2330 , ( meta_key='_wpseo_edit_description' or meta_key='_wp_attached_file' ) order post_date desc"; this query returns "doubled" results have split within loop ______________________________ | post_title | meta_value | |------------|---------------| | title 1 | 1349 | |------------|---------------| | title 1 | description 1 | |------------|---------------| | title 2 | 1348 | |------------|---------------| | title 2 | description 2 | |____________|_______________| you wlil need join onto wp_postmeta table in order of attached information, such file at

javascript - Overwrite ctrl+p in IE 11 -

i unable overwrite ctrl+p in ie-11. please suggest something. tried below code snippet .but, not working code prevent default action document.onkeydown = function(event) { event.cancelbubble = true; event.returnvalue = false; event.keycode = 0; event.stoppropagation(); event.preventdefault(); return false; } its working in compatibility mode on. when compatibility mode off , not working . please suggest solutions of it. try, if(e.ctrlkey && e.keycode == 80){ return false; }

bluetooth - Send AT+COPS command to android phone -

i trying send at+cops=3,0 , at+cops? command android phone android emulator(androidx86). sending command query operator name. not getting response command. getting response other command(at+cind?). not getting at+cops command. have searched google , not getting proper results understand why there no response. can tell me why there no response at+cops command?

sql server 2005 - SQL - Altering the position of field -

i want alter position of field using query, not designer. example - table1 has fieldnames follows field1 field2 field4 field3 field3 should in position of field4 . you can in such way add new col table . copy values of field4 it. drop col field4 , named new col field4 .

ios - UIImageView round border with margin -

Image
i'm using code create rounder uiimageview: -(void) makeimageviewrounded { self.layer.backgroundcolor=[[uicolor greencolor] cgcolor]; self.layer.cornerradius= self.frame.size.height /2; self.clipstobounds = yes; self.layer.maskstobounds = yes; self.layer.borderwidth=1.5; self.layer.bordercolor=[[uicolor graycolor] cgcolor]; } this outcome (ignore background if jpg.. starts rounded border): i want create margin between image , rounded border outcome (ignore background if jpg.. starts rounded border): how can achieve ? i figured way, make uiview subclass called circleview, in implementation, add - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code [self setbackgroundcolor:[uicolor clearcolor]]; } return self; } - (void)drawrect:(cgrect)rect { cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(context, 20.0); cgc

Magento RWD theme - Product images with gallery & lightbox option -

as know, new magento rwd theme using elevate-zoom script on product view page zooming , switching images: magento demo product . i implement 'gallery & lightbox' option elevate-zoom example . i tried edit media.phtml , app.js well, without luck. maybe have solution this? thanks, vlad make sure have fancybox plugin installed dependencies, i.e, mousewheel. best include these in local.xml (app/design/frontend/your_package/your_theme/layout/local.xml), e.g: <?xml version="1.0"?> <catalog_product_view> <reference name="head"> <action method="additem"><type>skin_js</type><name>js/fancybox/jquery.mousewheel-3.0.4.pack.js</name></action> <action method="additem"><type>skin_js</type><name>js/fancybox/jquery.fancybox-1.3.4.patch.js</name></action> <action method="additem">&l

javascript - How to detect if an iframe has moved from one URL to another -

i wondering if can me problem, have iframe url(on subdomain). page in iframe has button page. able resize iframe when user moves other page in iframe. below how sizing first page. $disp = '<div style="border: 0px solid rgb(201, 0, 1); overflow: hidden; margin: 50px auto; max-width: 300px;"> <iframe scrolling="no" src="https://something.com" style="border: 0px none; margin-right: 188px;height: 1036px; margin-top: -380px; width: 297px;"> </iframe> </div>'; echo $disp; using onload can tell if iframe source changes, explained here: iframe src change event detection? the gist is <iframe src="http://www.google.com/" onload="yourjsfunc();"></iframe> or, jquery $('#iframeid').load(function() { alert('frame has (re)loaded'); });

user interface - How to get a Vizify-like data visualization UI control? -

i looked on popular frameworks tableau, fusioncharts, charts.js, etc didn't find chart specific requirement. need visualize data in vizify.com or mind-map manner i.e. 1 big circle @ center, several small circles branching out. each circle have short text inside. it's not network graph 1 node connected multiple node. need not interactive, fluid animation nice. platform : windows 8 (windows store) app or web. please help. i assume embed web page inside of app. if so, use d3.js . extremely powerful , flexible. there ton of examples on examples page.

html5 - Is button in header valid ? <h1><button> Caption </button></h1> -

is possible or not valid? <h1> <button> caption </button> </h1> this header heading of accordion. therefore button opens , closes accordion semantically header important chapters of page. suggest? first of all, try w3c validator instead of opening new question every time want know if html valid. now question - yes valid .

caching - Cassandra -What is really happens once Key-cache get filled -

consider have configured 1 mb of key-cache (consider can hold 13000 of keys ). then wrote records in column family(say 20000). then read @ first (all keys sequentially in same order used write ), , keys started stored in key-cache. when read reached @ 13000 key cache filled completely. what happen key-cache when next keys read? (which key removed newly read key ?). key-cache following fifo or lifo or random out ?. key cache uses concurrentlinkedhashmap underneath , hence eviction policy lru (least used). https://code.google.com/p/concurrentlinkedhashmap/#features https://code.google.com/p/concurrentlinkedhashmap/wiki/design#beyond_lru

delimiters and csv files python -

i'm trying write csv file insert list (['a', 'b', 'c', 'd', 'e']) , puts each item of list single cell, instead of having 5 different cells each letter in it. here's code: output_file = open('output_results.csv', 'wb') writer = csv.writer(output_file, delimiter = ',', dialect = 'excel') writer.writerow(['a', 'b', 'c', 'd', 'e']) instead of printing out each letter in 1 cell, prints out a,b,c,d,e in 1 cell. seems delimiter not being used correctly? hoping have comma 1 separated each letter cell. thanks help! edit: i'm viewing resulting csv file in microsoft excel , i'm using python 2.7.8 there lots type of cvs notation. 1 of them use , , other use ; separete columns. tou can find more information following page. http://en.m.wikipedia.org/wiki/comma-separated_values#example

java - Cannot access my applet on browser because of a security exception -

i've been working on java applet connecting mysql database. i've put url on whitelist, i've signed applet , connects , runs fine in appletviewer. in internet explorer applet doesn't work , following message: java.net.socketexception message: java.security.accesscontrolexception: access denied ("java.net.socketpermission" "[0:0:0:0:0:0:0:1]:3306" "connect,resolve") stacktrace: java.net.socketexception: java.security.accesscontrolexception: access denied ("java.net.socketpermission" "[0:0:0:0:0:0:0:1]:3306" "connect,resolve") @ com.mysql.jdbc.standardsocketfactory.unwrapexceptiontoproperclassandthrowit(standardsocketfactory.java:407) @ com.mysql.jdbc.standardsocketfactory.connect(standardsocketfactory.java:268) @ com.mysql.jdbc.mysqlio.<init>(mysqlio.java:271) @ com.mysql.jdbc.connection.createnewio(connection.java:2771) @ com.mysql.jdbc.connection.<init>(connection.java:

Write my own printf() in c without variadic args -

i'm writing own os using bcc , i'd write printf scratch, without variadic arg macros. there reason can't that? have start, can't first argument after string. void print_f(char *fmt, ...) { char *str = fmt; uint16_t *arg = (uint16_t *)&fmt + 1; uint32_t *long_arg; while (*fmt != '\0') { if (*fmt == '%') { switch(*++fmt) { case 'c': putchar((uint8_t)*arg); arg++; break; default: print_f("malformed printf"); break; } } else { putchar(*fmt); } fmt++; } return; } i think suppose increment pointer 1 address space , go there, returns garbage. incrementing address of first argument access subsequent variadic arguments may work on older architectures, not work in general, , not on on x86-64, assuming

exception - PHP 5.5.16 Illegal offset type in isset or empty -

i'm working laravel here (semi-irrelevant) , running weird php issues i've not seen before. receiving exception error: illegal offset type in isset or empty the code in laravel framework ( illuminate\view\factory.php ), , relevant snippet throwing error is: if (isset($this->aliases[$view])) $view = $this->aliases[$view]; now, understand if pass array or object in array key, throw error. but, dumped out $this->aliases , received: array(0) { } and dumped out $view , received: string(11) "layouts.app" so, regardless of fact array empty, call isset should return false string key not set. i don't believe should error @ all, there setting in php.ini can cause such strict errors can change or not understanding fundamental operation of isset() method? edit this must related mihai stancu's comment below. tested , works fine without exception: $key = 'test-key'; $test = array(); if (isset($test[$key])) var_dump(&#

Scala typeclass and implicit puzzle -

the last statement line below produces error: "type mismatch; found: testexpandablewithlibrary.this.library.type (with underlying type org.typeclass.library) required: v" this trying implicit conversion. preceding line use typeclass function work fine. any ideas on how fix it? package org.typeclass /////////////////////////////////////////////////////////////////////////////// // domain objects case class book(bookname: string) case class library(libraryname: string, books: set[book]) object library { def apply(libraryname: string, booknames: string*): library = library(libraryname, booknames.map(book(_)).toset) } case class treeclass(nodename: string, children: seq[treeclass]) /////////////////////////////////////////////////////////////////////////////// // typeclass definition trait expandable[t, v, r] { def expandwith(template: t, values: v): r } object expandable { def expandwithf[t, v, r](template: t, values: v)(implicit ev: expandable[t, v,

html - Centering <td>'s in a <div> -

i fixing website tech night @ school. navbar on side isn't favorite view bar put on top, can't table data or menu center in div. http://jsfiddle.net/ksta1584/c88qswsx/ <a href="http://jsfiddle.net/ksta1584/c88qswsx/">link<a/> i instead of lines disappearing when scroll on in equally sized boxes , boxes sort of "pop" out. i'm not sure how , can't border appear. do in .nav: .nav { width: 100%; text-align: center; position:relative; top:35%; }

Eclipse Luna EE not highlight mistakes in php -

Image
i wasted time because of mistake in code - not substr subsrt - why eclipse not highlight mistakes this? i have installed pdt: pdt haven't static code analysis. pdt-eg core plugin have initial support classes , unused variables. as workaround (still no warnings in code), can enable internal function highlighting (php/editor/syntax coloring).

php - Insert values into array -

multi-dimensional array: each record has title , array day of week key , value. i'm trying insert values according day of week (based on key) of existing array. code: foreach($records $rec) { $row = array( 'title' => $rec['title'], 'monday' => '', 'tuesday'=> '', 'wednesday'=> '', 'thursday' =>'', 'friday' => ''); foreach($rec['dates'] $dtow) { $dow = explode(' ', $dtow)[0]; $value = explode(' ', $dtow)[1]; if($dow....blah blah that's i'm getting lost... } $data[] = $row; } any advice appreciated. edited: sorry, that's better.

compilation - VBA error when opening spreadhseet "Compile error" -

i have spreadsheet using value in cell d11 (value in d11 derived combobox1) of sheet "inputform" create list combobox74 on same sheet value in d11 matches values in column of sheet "ps_group_level". in ps_group_level sheet there duplicate values in column , unique values in column d. populate combobox list unique values column d there corresponding match column a. hopefully i've explained scenario enough. code i'm using , works great, receiving error upon opening workbook. - "compile error: method or data member not found". i've checked names of comboboxes , sheet names correct, used new boxes different names , same result. vba editor highlighting code clearing combobox74 please help! thanks! private sub combobox1_change() 'finds value ps type , ps area box1val = thisworkbook.sheets("inputform").range("d11") 'loop through col find last row lr = thisworkbook.sheets("ps_group_level").cells

c++ - How to call function defined in template -

i'm in process of trying find polynomial regression set of x , y data. downloaded template below so, have no idea how call it, , attempts met error lnk2019: unresolved external symbol. #pragma once #ifdef boost_ublas_type_check # undef boost_ublas_type_check #endif #define boost_ublas_type_check 0 #ifndef _use_math_defines # define _use_math_defines #endif #include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/lu.hpp> #include <vector> #include <stdexcept> /* finds coefficients of polynomial p(x) of degree n fits data, p(x(i)) y(i), in least squares sense. result p row vector of length n+1 containing polynomial coefficients in incremental powers. param: ox x axis values oy y axis values ndegree polynomial degree including constant return: coefficients of polynomial starting @ constant coefficient , ending coefficient of power ndegree. c++0x-compatible compilers make

php - why ajax call behaves strange in similar situation? -

i'm using ajax call in login.php twice , call ajax.php 2 different parameter: login.php $(function() { $("#slctsys").focusin(function() { $.get("ajax.php" ,{sysuser:$("#sysuser").val(), sysupw:$("#syspswd").val()} ,function(data1) {$("#slctsys").html(data1); }); }) .change(function() { $.get("ajax.php" ,{sysid:$("#slctsys").val()} ,function(data2) {$("#divurl").text(data2);}); }); }); ajax.php <?php include_once('function.php'); if (isset($_get['sysuser'])) { $c=sysselectdb('sysdb'); $sysinfo=$c->prepare('select sysname sysinfo sysuun = "'.$_get['sysuser'].'" , sysupw = "'.$_get

Switching between Databases at will in PHP MS SQL Server -

i'm making page modify values in databases, need able switch databases (sql sever) @ (they exact copies serve different purposes), , want in php, right conexion.php function included in every page, have been asked make page can select db (kinda settings page), , can't figure way tackle this. i have database names, add them list box submit them, need sql query select database names , php db change, here connection file: <?php session_start(); function conex() { $db = "dfsistemasmercietdbtest"; $server = "dfsistemas"; $connectioninfo = array("database"=>$db, "uid"=>"sa", "pwd"=>"sa123456"); $conex = sqlsrv_connect($server, $connectioninfo); if($conex === false) { die(print_r(sqlsrv_errors(), true)); } return $conex; } ?> the function called through pages with: include('conexion.php'); $conex=conex();

sql - Increasing query performance for mysql longtext with like -

as production support developer looking data in mysql db, find myself querying column has type longtext , holds lots of data (100k+ rows each 1000 characters or more of text). when use operator wildcards, query takes hours return. is there can query or table speed up? thanks in advance help.

mysql - Select query with MAX(ad_number) issue -

$r = ca_mysql_query("select max(ad_number) `mytable` `user` = {$user_id} "); $max = $r[0]['ad_number']; echo $max; it should print max ad_number not returning value wheares, if try query removing max(ad_number) returnig field data array. $r = ca_mysql_query("select * `mytable` `user` = {$user_id} "); $max = $r[0]['ad_number']; is returning value given records whats wrong ? use alias column: select max(ad_number) max_ad_number mytable user = {$user_id} then this: $max = $r[0]['max_ad_number']; echo $max; see documentation w3schools here

multithreading - Why is my application not using all cores on Mac OS X? -

i have simple pthread program (should) spawn whole lot of threads spin , consume cpu. however, never see program taking more 1 of 4 cores on mac os x mavericks notebook. theories why happening: is os that's preventing 1 process taking on machine? is os x scheduler tight affinity? is kernel setting can tweak where? is pthread implementation on os x hobbled in way? i have no idea. i'm asking because have serious application (written in d) i'd use cpu parallel work, simplest pthread program doesn't go on 1 core. #include <pthread.h> #include <stdio.h> void *waste_time(void* a) { (int = 0; < 10000000; i++) { printf("%d\n", i); } return null; } int main(void) { const int threads = 100; pthread_t thread[threads]; (int = 0; < threads; i++) { pthread_create(&thread[i], null, waste_time, null); } (int = 0; < threads; i++) { pthread_join(thread[i], null); }

java - Play framework + ebean: Nested models are being saved as null -

i think simple problem: have 2 models, example; @entity case class user(name: string, email: string) extends model { @id var id: int = 0 } and then; @entity case class task( subject: string, body: string, @manytoone user: user) extends model { @id var id: int = 0 } what see when fetch tasks database ( find().all() ), see user = null tasks, while debugging, if set breakpoint @ newtask.save() , see user field of instance correctly set. what's wrong this? thanks @salem, basically, link pointed out him suffices know going on – , can bit confusing. what did define getter/setter references; in task do; @entity case class task (subject: string, body: string) { val userid: int = 0 // setter def user_= (user: user) = userid = user.id // getter def user:user = { user.find().byid(userid) // ensure find() defined in companion object } }

InnerHTML of my custom polymer tag overrides everything in <template> -

i don't know how tell custom element render inner html of custom tag, i.e: <link rel="import" href="../bower_components/polymer/polymer.html"> <polymer-element name="my-element" noscript> <template> <span>hello <b>my-element</b>. shadow dom.</span> </template> </polymer-element> <my-element>hi!</my-element> renders: hi! i want able tell component , how use whatever put between custom element's tags. to bring in elements outside (light dom) , render them inside shadow dom, need define insertion points using <content> tag: <polymer-element name="my-element" noscript> <template> <span>hello <b>my-element</b>. shadow dom.</span> <content></content> </template> </polymer-element> demo: http://jsbin.com/najiquzivofu/1/edit you can select specific children using

php - For loop to print out squares of numbers -

i'm attempting create loop print out square of every number between 1-100. <?php ($count = 1; $count < 100; $count++){ $squared = $count * $count; print("$count squared $squared"); } ?> what im getting this. "1 squared 12 squared 43 squared 94 squared 165 squared 256" etc... i'm not sure i'm doing wrong. edit: lifesavers , dumb, long live stack overflow. you need add newline @ end of print \n should it <?php ($count = 1; $count < 100; $count++){ $squared = $count * $count; print("$count squared $squared \n"); } ?> if output in html page, <br> perhaps way go!

R: Group number string to from-to form -

i have (after long script) value/vector like 258 814 815 816 817 818 819 862 863 864 865 866 867 868 869 870 871 872 1377 1378 1379 1393 1394 1395 1396 1397 1398 1399 1400 ........ this quite difficult controll over. if there way to 258 814-819 862-872 1377-1379 1393-1400 , on.... i have thought sort of loop adds value string if x[i+1]!=x[i]+1, can take time if dataset large... for input x <- c(258, 814:819, 862:872, 1377:1379, 1393:1400) the output should be "258\n814-819\n862-872\n1377-1379\n1393-1400" adding on josh's answer should work: rr <- rle(x - seq_along(x)) rr$values <- seq_along(rr$values) s <- split(x, inverse.rle(rr)) paste(lapply(s, fun = function(x) if(length(x) > 1){paste(x[1], x[length(x)], sep="-")}else{x}), collapse="\n") [1] "258\n814-819\n862-872\n1377-1379\n1393-1400"

java - How to remove an element in an array of strings -

im new @ coding. have array of movies. im trying delete movie least number of sales. in method 'remover' located in box office class, error saying " int cannot dereferenced" on line including code "((movies.get(i).sales).equals(small))". called remove method delete array im guessing remove isnt legitimate in java. call have make remove array , update length. import java.util.*; public class lianglab1p2 { public static void main(string[] argv) { boxoffice bo = new boxoffice(); bo.add(new movie("starboat","pg","action")); bo.add(new movie("bloody banquet","pg-13","horror")); bo.add(new movie("godizilla eats tokyo","pg","horror")); bo.add(new movie("geeks in love","pg","comedy")); bo.add(new movie("bad cop, worse cop","r","comedy")); bo.add(new

java - Confused about writing a program for placing some modified queen-type pieces on an 8 x 8 board -

to question: the superqueen chess piece can move queen, knight. maximal number of superqueens on 8x8 chessboard such no 1 can capture other? i want write brute force algorithm find maximum. here's wrote: public class main { public static boolean chess[][]; public static void main(string[] args) throws java.lang.exception { chess = new boolean[8][8]; chess[0][0] = true; (int = 0; < 8; i++) { (int j = 0; j < 8; j++) { /*loop check various possibilities*/ if (!checkrow(i) && !checkcolumn(j) && !checkdiagonals(i, j) && !checkknight(i, j)) { if (i != 0 || j != 0) { chess[i][j] = true; } } } }/*printing array*/ (int = 0; < 8; i++) { (int j = 0; j < 8; j++) { system.out.print(((chess[i][j]) ? "t" : "x") + &q

html - <select> Popup Windows -

ok have been searching find of similar having no luck.. i want know how can code pop in new window , resized? example: window 250px 250px, no border, no address bar.. compact window. this have found, not sure how work... <form action="../"> <select id="select-box" class="select" name="selectbox" size="6"> <option value="folder1/list_1.html">1</option> <option value="folder2/list_2.html">2</option> <option value="folder3/list_3.html">3</option> <option value="folder4/list_4.html">4</option> <option value="folder5/list_5.html">5</option> </select> <input type="submit" value="open page" onclick="ob=this.form.selectbox;window.open(ob.options[ob.selectedindex].value)"> </form> what know is, data entered in "action" incorrect.. don't know how can mak

Ignore certain urls from logging in nginx -

im trying ignore urls on host (as requested sync clients , i'm not scared of of exposure/volunability here) typical urls like; /cloud/remote.php/caldav/calendars/xxxx@xxxx.com/personlig/ /cloud/remote.php/caldav/calendars/xxxx@xxxx.com/contact_birthdays/ /cloud/remote.php/carddav/xxxx@xxxx.com/ /cloud/remote.php/webdav/xxxx@xxxx.com/ what i'd idealy want achive ignore after /cloud/remote.php/ or /carddav/ or /caldav/ or /webdav/ s these belong sync clients , gets logged seperatedly i've played around with location = /cloud/remote.php/ { access_log off; } location = /caldav/calendars/ { access_log off; } but didnt yield expected turn guys! any suggestions on how can tackle this? use regexps, not equal expression, e.g. /cloud/remote.php/*: location ~ ^/cloud/remote.php/(caldav|webdav|carddav)(.*)$ { access_log off; } as regexps priority, manual says: "the first matching expression stops search , nginx use location

Tomcat6 - Connection has already been closed -

since few days, seeing error 'connection has been closed' in production environment: following datasource configuration: <resource defaultautocommit="true" defaultreadonly="false" driverclassname="oracle.jdbc.oracledriver" factory="org.apache.tomcat.jdbc.pool.datasourcefactory" fairqueue="false" initialsize="10" jdbcinterceptors="connectionstate" jmxenabled="true" logabandoned="true" maxactive="100" maxidle="50" maxwait="30000" minevictableidletimemillis="5000" minidle="10" name="jdbc/oracleapps" password="apps" removeabandoned="false" removeabandonedtimeout="60" testonborrow="true" testonreturn="false" suspecttimeout="60" testwhileidle="true" timebetweenevictionru

ember.js - ComputedProperty on a component only updates the first time the watched property is set to a given value (when the property is a model property) -

i seem having bit of issue computed properties on ember 1.7.0 inside of component. let's have 2 models, & b. has "belongsto" relationships b. on component template have ember.select control allow 1 select b entry a. {{view ember.select class="form-control" content=blist selection=objecta.objectb optionvaluepath="content.id" optionlabelpath="content.name"}} in component have computed property watches changes on objecta.objectb so: issomething: function() { return this.get("objecta.objectb.id") === "some id"; }.property("objecta.objectb"), then in component template conditionally display based on value of issomething : {{#if issomething}} :d {{/if}} if place breakpoint in issomething computed property, , select new value on select control, hits breakpoint expected. hit again after select new value. if select original value again, breakpoint not hit (and component not rerender). seems

html - How do I animate steam from a coffee cup in my SVG icon code? -

i'm graphic designer learning svg animated icons , coding. have illustrated cup of coffee in illustrator exported svg file. trying animate steam rises real steam. problem it's not animating steam if have .steam1 .st1 selected in css. might confused amount of tutorials i've been looking at. @ html code illustration , me animate using css based off of code http://codepen.io/anon/pen/dlmcn here svg code in html http://codepen.io/anon/pen/nihca <body> <?xml version="1.0" encoding="utf-8"?> <!-- generator: adobe illustrator 16.0.0, svg export plug-in . svg version: 6.00 build 0) --> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg version="1.1" id="icon" width="284px" height="284px" viewbox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">