Posts

Showing posts from January, 2011

Complex animations on android -

Image
im trying make animations , feel lost. i have screen 3 buttons, when click 1 want translateanimation move top , 3 more buttons appears behind, im having trouble make animations. i explain more pictures. so, initial image , final image, on button 1 click want translate above of button 1-1 , button 1-1 1-2 , 1-3 have slide form right. most animations i´ve used before sliding elements out of screen, how can slide position new position? and how can without buttons 1-1 1-2 1-3 on screen, im using relativelayout button 1 above button 2 , have change above button 1-1 button 1-1 not created yet. im lost, appreciated.

split - String splitting in the D language -

i learning d , trying split strings: import std.stdio; import std.string; auto file = file(path, "r"); foreach (line; file.byline) { string[] parts = split(line); this fails compile with: error: cannot implicitly convert expression (split(line)) of type char[][] string[] this works: auto file = file(path, "r"); foreach (line; file.byline) { char[][] parts = split(line); but why have use char[][] ? far understand documentation, says split returns string[] , prefer. use split(line.idup) ; split template function, return type depends on argument. file.byline.front returns char[] reused performance reasons. if need parts after current loop iteration have dup or idup , whatever need.

java - How to specify a default value for an enum using avro IDL? -

i haven't found in documentation this, generic bla default values. assumption should work this: enum myenum { unspecified, specified } record test { myenum e = "unspecified"; } the genericdatumreader in java unfortunately complains finding string expects myenum. can confirm correct way use enum default value using avro idl? in case have bug elsewhere. can confirm not way , correct me? input appreciated! update: in real world version of this, seems newly added enum record causing issue though has default value. means reader schema expects enum, whereas record not contain one. schema evolution should able resolve this, seems fail. more detail: working pig here, not direct java. ok, turns out indeed correct way specify default value enum in avro idl. in case union {null, string} had been replaced enum causing trouble. remember: do not change type of field in avro !

android - Why my ViewPager's Fragments are retained by FragmentActivity -

in fragmentactivity , have fragment (let's call hubfrag) has viewpager using fragmentstatepageradapter (which create fragments, let's call them 'itemfrag'). when replace hubfrag new fragment ,hubfrag destroyed expected it's not case itemfrags objects. using eclipse mat see itemfrags objects retained fragmentmanagerimpl of fragmentactivity ... why???? i explain why don't want them still in memory: each itemfrag launch picture download , downloader (which has weakreference of itemfrag imageview )don't want process bitmap if weak reference null(to reduce memory use). but downloader decode bitmap weak reference never null... thanks! i found cause problem: populate hubfrag's viewpager using getsupportfragmentmanager , using getchildfragmentmanager resolved problem.

Arrays with same element and grab one in php -

i have array consist of further sub arrays like array ( [0] => mm [1] => cm [2] => inch ) array ( [0] => mm [1] => cm [2] => inch ) since both arrays have same elements try fetch 1 that.i try array_unique(),merge function didn't succeed.i can remove 1 array using foreach loop want know if possible single statement, bulitin function or 1 line code not more that.hopes got point.i trying reduce code if question, trying remove duplicate subarrays. try this $input = array_map("unserialize", array_unique(array_map("serialize", $input))); array_unique removes duplicates array. array_map takes 2 arguments array_map ( callable $callback , array $arr1 [, array $... ] ) it recursively runs callback on array basically code serializes array's content (each sub-array in case), removes duplicates unserialize content recreate original array more here: how remove duplicate values array in php

django - permission_required not working on view -

i have problem permissions on view of django. my code on view.py: @login_required(login_url='/kullanicigirisi/') @permission_required('reservationapp.change_reservation', login_url='/') def rezervasyonduzenle(request, id): there 2 app: app1: userlogin, app2: reservationapp i assigned permissions on userlogin , used permission_required on reservationapp assignments: username = request.post['username'] password = request.post['password'] user = authenticate(username=username, password=password) pr = permission.objects.get(codename='change_reservation') group = group.objects.get(name='rol1') group.permissions.add(pr) usern = user.objects.get(username=username) usern.groups.add(group) permission_required not working, everytime return login_url :/ have idea problem? if you're being redirected login_url , either user not logged in, or user doesn't have permission reservationapp.change_r

tsql - Sql server - recursive delete -

i'm trying delete user's data , it's related data located in different tables. tables have foreign keys without cascade delete. i investigated options: enable cascade delete on fk, delete , remove cascade delete. delete bottom up, loop leaves delete , repeat operation till root. are there more smart option or other techniques? i'm using microsoft sql server 2012 (sp1) oracle solution: how generate delete statements in pl/sql, based on tables fk relations? sql server solution: generate delete statement foreign key relationships in sql 2008? hope helps

Date compression -

i got problem in project uncompress date. (no documentation available) i have convert date, shown 6 bytes: 0xfd 0x77 0x59 0x51 0x10 0x00 did know, how uncompress ? date today, ~ 10:30 gmt programm language doesn´t matters. (it question of understanding. not question programming) christian added again examples 11:09 --> 0x fd 77 59 fd 10 00 11:09 --> 0x fd 77 79 05 28 00 11:05 --> 0x fd 77 59 fd 28 00 the solution was, convert data byte array not via java hex. in several cases (byte > 127) result ..fd hex value. if convert otherwise, log result i.e.: 0x dd7719b33a00 dd7 -> 7dd -> 2013 7 -> 7 -> month 19 -> 25 (dec.) --> day b -> 11 -> hour 33 -> 51 -> min. -> 10 -> seconds 0 -> 0 -> ms

vb.net - What is the impact of multiple cookies in my asp.net site -

i have vb.net website, cant seem declare global variables, impact have on both client , server side if create cookies global variables ? you have first investigate why can not have global variables. in asp.net can not "declare" global variables instead need add them to session object or application objects: session("myvariable")=12 and later can read as: dim b integer=session("myvariable") cookies created on client machine , not proper way storing of global variables user preferences. impact client browser may not allow cookies , program fail @ storing it. cookies safety debatable.

Android custom action bar remove icon -

Image
below screenshot of current setup. i have created custom action bar view, set in code below, , 2 images, 1 left aligned in title bar, other right aligned. the problem is, when hide app icon, hides it, not removes hence gap on left. found couple of other questions show how remove icon, removes tabs want keep. can 1 offer me solution? from oncreate() function: final actionbar actionbar = getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); layoutinflater inflater = (layoutinflater) this.getsystemservice(context.layout_inflater_service); view v = inflater.inflate(r.layout.action_bar_title, null); view homeicon = findviewbyid(android.r.id.home); ((view) homeicon.getparent()).setvisibility(view.gone); ((view) homeicon).setvisibility(view.gone); actionbar.setdisplayshowcustomenabled(true); actionbar.setdisplayshowtitleenabled(false); actionbar.setdisplayshowhomeena

python - Pygame, efficient collision handling for rpg game? -

i'm programming little snes-like rpg pygame. on map have 4 layers : 0 : terrain, no collision (under char) 1 : on terrain no collision (under char) 2 : collision objects (under char) 3 : on char objects i wanted create rect every tile in second layer prevent character go on these objects. there efficient way not check every rectangle each time character moves ? thanks. pygame has bunch of optimized functions this, rect.collidelist : collidelist() test if 1 rectangle in list intersects collidelist(list) -> index test whether rectangle collides in sequence of rectangles. index of first collision found returned. if no collisions found index of -1 returned. if still encounter performance problems, use quadtree . here's implementation in python using pygame. from pygame import rect class quadtree(object): """an implementation of quad-tree. quadtree started life version of [1] found life of own when re

Android ScrollView Performance Jellybean 4.2 -

i running following layouts on android 4.2 when having buttons in single linearlayout runs fine: <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:orientation="horizontal" > <button style="@style/auth_primary_button_split" android:id="@+id/startup_login" android:text="@string/login_label" /> <button style="@style/auth_primary_button_split" android:id="@+id/startup_signup" android:text="@string/signup_label" /> </linearlayout> but when wrap same linearlayout scrolview, button clicks delayed (button background state, onclick function, etc). <scrollview android:layout_width="match_parent" android:layout_

search array element in LIKE mysql -

i have stored procedure searches bellow: begin #at first, search in name of job: (select * tb_job `name` '%some%' , `name` '%thing%') union # second, search tags: (select * tb_job id in ( select idjob ( (select 2 priority1, count(tb_job_tag.idtag) priority2, idjob tb_job_tag idtag in (select tb_tag.id tb_tag tag '%some%' or tag '%thing%') group tb_job_tag.idjob) union (select 1, count(tb_job_tag.idtag), idjob tb_job_tag idtag in (select tb_tag.id tb_tag tag '%some%' , tag '%thing%') group tb_job_tag.idjob) ) t order priority1, priority2 desc ) ) end now have 2 questions: how can pass array of words , separate them in mysql , use them in like ? second, how can make search better? (i have 3table: tb_job, tb_tag, tb_job_tag stores job's id , tag's id). help. /** * http://www.aspdotnet-

reporting services - ssrs with custom rows in Matrix -

Image
i have raw data: in data "act" actual number, "fct" forecasted, , have create row called "var" calculate (act-fct). "cum" accumulated variance. "prev" refers previous year data , the"varyoy" refers variance year on year (prev-act). i not sure how "var", "cum" , "varyoy" rows matrix. guidance or sample solution i'm looking for.

css - html map area hover effect -

<img alt="" src="img/immagini di base nopain project/parti donna/corpo-donna-fronte.png" width="477" height="672" usemap="#woman-body" id="corpo_d" /> <map id="woman-body"> <area shape="rect" coords="260,140,200,50" href="#" id="body_one" /> <area shape="rect" coords="200,150,160,220" href="#" id="body_two" /> </map> when mouse on 1 of 2 areas, area highlighted border. this css, not work. area#body_one:hover { border:1px solid #0f0; } i don't think work. need plugin imagemapster — it's quite easy set , use , can lot of nice things it.

javascript - FOR LOOP in Angular Service NOT Working - While Loop Works -

i've worked around problem while loop thought i'd explain here - because seems odd i tried iterating through string in service using loop, cannot work when service defined this .service('xtratxt', function() { var x = 0; var = ""; this.convert = function(srctxt) { this.a = ""; this.x = 0; (this.x=0; this.x++; this.x<srctxt.length) { this.a = ans + "x"; } return ans; }; }) if call in controller $scope.newvalu = xtratxt.convert("hello"); i should string of x's eg xxxxx instead empty string "" if change while loop - no problems works treat anyone know why ? i no errors in console either. afaik doesn't seem enter loop @ all this.convert = function (srctxt) { var = "", x = 0, ans = ''; (x = 0; x < srctxt.length; x++) { ans += "x"; } return ans; }; shorter version var str

mysql - Diacritic Sensitive Search PHP -

hlo... i've been making spell checker of punjabi. working fine except diacritics of punjabi language. e , é , punjabi has diacritics ਸ , ਸ਼ . problem when search in database, considers word ਸ਼ , ਸ same. database stored words in utf-8 format. using collation utf8_unicode_ci database , tables well. mysql_query("set charset utf8"); $exists = mysql_query("select count(word) unicode word = '$str'"); if count 0, says word wrong. $str word. when try search, says word both ਸ , ਸ਼ correct. word ਸ਼ correct. i've tried change collation utf8_bin collate utf8_bin , says both words wrong ਸ , ਸ਼ . i've tried utf8_general_ci , changing collation of table , database. it either says both incorrect, or both correct. 1 of them correct. my main problem diacritic sensitive search doesn't work utf8_bin either... plzz help..thxx in advance.... select count(word) unicode binary word = '$str' the binary keyword cause

ruby - Adding a new method to the Array class -

i have new requirement on array object. need add own method built-in array class. how add new method whatever array object create, have instance method? use ruby open classes : class array def mymethod #implementation end end

java - What is the substitue for Resteasy ProxyFactory class -

i realized proxyfactory class marked deprecated in resteasy version 3.0.0. sadly approach deprecates class not documented anywhere. used initialize services way new way? protected static final string url = "http://localhost:12345"+"/api"; protected static final myservice myservice = proxyfactory.create(myservice.class, url); resteasy 3.0.2.final ( http://howtodoinjava.com/2013/08/03/jax-rs-2-0-resteasy-3-0-2-final-client-api-example/ ) resteasyclient client = new resteasyclientbuilder().build(); resteasywebtarget target = client.target(url); myservice myservice = target.proxy(myservice .class);

php - how to display data with ajax in diffrent dom elements? -

i want display data ajax function receive php file different html elements. function getdetails(x) { if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("fname").value=xmlhttp.responsetext; } } use jquery this: $.ajax({ type:'get', url:'url/to/the/file.php', }.done(function( msg ) { $('#id-of-element').html(msg); $('.class-of-other-element').html(msg); // element $('.class-of-another-element').html(msg); // element }); explanation: type: // type of http request file, post url: 'url/to/the/file.php' // provide file , path file communicate .done (function(msg)) { // when ajax request completed (if), as

linux - Starting pppd from cron doesn't work -

i want start pppd whenever disconnects. trying setup shell script run every 1 minute see if it's down , reconnect. i have bash script called vpn-check.sh : ping -c3 10.8.3.0 > pingreport result=`grep "0 received" pingreport` truncresult="`echo "$result" | sed 's/^\(.................................\).*$/\1/'`" if [[ $truncresult == "3 packets transmitted, 0 received" ]]; pon vpnname fi when run script cli directly, works , starts ppp when run same through cronjob (for root user), doesn't work. i tried below , didn't work */1 * * * * bash /root/vpn-check.sh > /root/cronlog.txt 2>&1 i tried below , didn't work */1 * * * * /root/vpn-check.sh > /root/cronlog.txt 2>&1 finally, tried: */1 * * * * /usr/sbin/pppd call vpnname> /root/cronlog.txt 2>&1 can't figure out wrong. i fixed it. while running crontab -e user name added, needs added syste-wide cron file f

apache - different htpasswd files per domain -

i've 2 domains e.g. foo.com , bar.com share same document root. sites protected .htaccess file authuserfile ../.htpasswd authname "no access" authtype basic <limit post put> require valid-user </limit> how can set authuserfile depending on host? pseudocode: if (host == foo.com) { authuserfile ../.htpasswd_foo } else { authuserfile ../.htpasswd_bar } authname "no access" authtype basic <limit post put> require valid-user </limit> if not possible there other ways different logins 2 domains? try setting this: #site1.com setenvifnocase host site1\.com pass_1 authtype basic authname "site1.com login required" authuserfile "/home/userdir/.htpasswds/site1.pwd" require valid-user order allow,deny allow deny env=pass_1 satisfy #site2.com setenvifnocase host site2\.com pass_2 authtype basic authname "site2.com login required" authuserfile "/home/user_dir/.htpasswds/site2.p

java - How to GET and POST requests separately with HttpRequestHandler -

i'm using httprequesthandler inject spring beans servlets: @component("myservlet") public class myservlet implements httprequesthandler { @autowired private myservice myservice; httpservlet has separate methods doget, dopost etc different request methods. httprequesthandler has one: public void handlerequest (httpservletrequest req, httpservletresponse resp) so how handle , post requests in method separately? need have different logic different request methods. update: have question: there possibility restrict handlerequest method support post requests configuration , sendhttp error 405 automatically other requests? the httpservletrequest provides method getmethod() returns name of http method request made, example, get, post, or put. same value of cgi variable request_method.

sql - narrowing down rows added on a date in mysql -

i have following statement: select count(*), firstadded db.table date(firstadded) between '2013-07-01' , '2013-07-10' group firstadded order count(*) when execute it, returns data every time row has been added table. 1 | 2013-07-03 15:22:14 1 | 2013-07-03 15:23:14 1 | 2013-07-03 15:22:42 1 | 2013-07-03 15:45:29 i arrogate down amount of rows added daily (without m:s time, entire day). e.g. 345 | 2013-07-03 7482 | 2013-07-04 1237 | 2013-07-05 is possible? this group by query: select date(firstadded), count(*) db.table group date(firstadded); the function date() converts datetime value date value, seems want. your complete query be: select count(*), date(firstadded) db.table date(firstadded) between '2013-07-01' , '2013-07-10' group date(firstadded) order count(*)

Jmeter - timeout exception -

i ran script 100 concurrent users in non - gui mode java -jar apachejmeter.jar -n -t c:\xxx\jmeter\yyy\zzz.jmx -l c:\xxx\jmeter\zzz\testresult\log${__time(ddmmyy_hhmmss)}.jtl i saved jtl file generate during run after run complete, loaded jtl file in view results tree listener see few error below: response code: non http response code: java.net.sockettimeoutexception response message: non http response message: read timed out response code: non http response code: java.net.connectexception response message: non http response message: connection timed out: connect is there problem jmeter script or application connection. please help it has application. indicated aplication no more responsive , refuse connections or long answer connections. did put timers in jmeter script, maybe violent in load.

php - Possible to have a dynamic Content-type in header for downloading files? -

is possible have php detect content-type should prior downloading? i'm new thinking of extracting extension filename , using case statement set content-type. is there better way? if interested in downloading , not opening particular application can use application/octet-stream.

for loop - How can I echo the third condition in this php IF STATEMENT? -

i have developed school mark-sheet application using phpmysql. in mark-sheet, if student fails in 1 of subjects, he/she declared 'failed' in result section of mark-sheet. job code. today principal of school has come me , said not in use today, , told me change code like: if student fails in 2 subjects, should declared 'failed', if fails in 1 subject, echo 'simple`, , if passes in subjects, should declared 'passed'. have been spending long hours trying figure out how modify code still not come solution. so, come here asking help. suggestion warmly welcome. lot in advance. here code: <?php $all = array(41, 55, 56, 39, 29, 47); //mark in each subject. pass mark 30 // second, iterate on them till find 1 value -30 for($i=0; $i < count($all); $i++){ if($all[$i] < 30) $sum = 1; } echo (!empty($sum)) ? 'failed' : 'passed';//'simple' must included here, still not find solution. ?> just create counter k

php - TWIG Date Time locale language -

in twig file {{ comments.created|date('l, f j, y') }} thursday, july 25, 2013 displays default locale english. how can display in other language format. german, turkish etc. simply set needed format {{ comments.created|date('d.m.y') }}

c++ - Create a struct instance only if conditions are met in its constructor -

i want create instance of struct if conditions inside constructors met. if conditions not met, want not create instance. not sure if possible, , if not alternate way of doing it? class consumer { struct samplestruct { myclass * m_object; routingitem() { m_object = null; } myclass(std::string name) { if (! objsetting()->getobj(name, m_object))//this function supposed populate m_object, if fails, dont want create instance return; //i dont want create object if getobj() returns false } }; std::vector<samplestruct> m_arrsample; void loadsettings(std::string name) { samplestruct * ptrs; samplestruct s(name); //i tried following 2 lines did'nt work. looks returning struct constructor still creates instance ptrs = &s; if (

package - can we install cloudstack in centOS 32-bit -

i want install cloudstack on centos. have installed centos6.3 32-bit(i686) in system. want know if can install cloudstack on centos 32-bit. waiting reply. thank you. no not possible install cloudstack in 32-bit centos, 64-bit mandatory bcoz similar setting server, u can have devcloud virtual box based installaion if u have oracle virtual box possible. . . . . .

Vim run command over text object -

i know can use visual mode run command :sort on selection. appears expand command to: :'<,'>sort . is there way run internal or external command on text-object, paragraph? ideally able ip + sort sort paragraph of text without manually creating visual selection. possible? you can use text-object selections in visual mode, eg. vip:sort . guess didn't think doing that.

php - Calling other function in the same controller? -

i'm using laravel. here class i'm working on: <?php class instagramcontroller extends basecontroller { /* |-------------------------------------------------------------------------- | default home controller |-------------------------------------------------------------------------- | | may wish use controllers instead of, or in addition to, closure | based routes. that's great! here example controller method | started. route controller, add route: | | route::get('/', 'homecontroller@showwelcome'); | */ public function read($q) { $client_id = 'ea7bee895ef34ed08eacad639f515897'; $uri = 'https://api.instagram.com/v1/tags/'.$q.'/media/recent?client_id='.$client_id; return sendrequest($uri); } public function sendrequest($uri){ $curl = curl_init($uri); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_ssl_verifypeer, 0); curl_setopt($curl, curlopt_ssl_verifyhost, 0);

What is the best/fastest way of calling java jar from php with passing large text? -

this scenario: have php script builds html , echoes browser. before html echoed, need call executable java jar file , pass html process , return php echoed out. the way can come save html temporary file, pass java file name, let modify , load again in php. i'm guessing can quite slow , requires file being written disk, read, modified, written again , read again. my question this: in given scenario there faster way of passing java html file , returning php? my current stack: apache 2.4, php 5.4.7, java 7, os: ubuntu i've used marc b suggested solution , since there no clear example of particular situation online, i'm pasting php , java code in case needs in future: php code: <?php $process_cmd = "java -jar test.jar"; $env = null; $options = ['bypass_shell' => true]; $cwd = null; $descriptorspec = [ 0 => ["pipe", "r"], // stdin pipe child read 1 => ["pipe", "w"], // stdout p

c# - Entities' does not contain a constructor that takes 1 arguments -

public class connection { public static string getconecction() { return configurationmanager.connectionstrings["dcassetentities"].connectionstring; } } i have 1 "connection" class configure web entity framework model entities public class connectiondal { private dcassetentities db; public connectiondal() { db = new dcassetentities(connection.getconecction()); } } then intialize database in "connectiondal" class constructor,, it's working in visusal studio 2010 in visusal studio 2012 showing error "dc_asset_maintenance.dal.dcassetentities' not contain constructor takes 1 arguments " your class dcassetentities needs have constructor following definition. public dcassetentities(string connectionstring){}

ios - NSTimer initWithFireDate not working properly -

i use nstimer periodically download data in background, when wifi enabled. there option press button downloads data manually. therefore possible enable , disable autoupdater. when period "interrupted" diabling autoupdate, want schedule next update when remaining time of period after point of time when enabling over. because nstimer has no pause method, use nstimer's initwithfiredate method. timer = [[nstimer alloc] initwithfiredate:firedate interval:updatefrequency target:self selector:@selector(timertick:) userinfo:nil repeats:yes]; [[nsrunloop currentrunloop] addtimer:timer formode:nsrunloopcommonmodes]; the firedate after given date: nsdate *firedate = [nsdate datewithtimeintervalsincenow:remainingwaitingtime]; despite that,the timer scheduled after timer's initialization. disabling timer , calculating remaining time following way: nsdate *lastfiredate = [timer firedate]; nsdate *current = [nsdate date]; [timer invalidate]; double timesincelastfi

CSS positioning change resulting from resizing brower window -

i have 1 more problem solve before can call first website done, , appreicate of community. you can see website @ www.dylanbisch.com the problem trying solve occurs on homescreen between class artdesign , tumblr-wrapper . basically, class "artdesign" contains 2 circular buttons , class "tumblr-wrapper" contains black , white photos on homescreen. my problem occurs if shrink browers window , try scroll left , right. instead of scrolling left , right across entire page, black , white photos in "tumblr-wrapper" class scroll left , right. i looking solution stop tumblr-wrapper being thing scroll when brower window small, , create full page left right scrolling. i hope have explained problem adequately, if need explain differently please let me know. on line 370 of style.css , have position:fixed applied .artdesign . im not sure logic putting there exactly, if remove it, page scroll expect. the fixed position means div fixed , not

PHP/MySQL Order by column in a different table -

i running sql code: sql=" select * channel_did "; $rs=mysql_query($sql,$pbx01_conn) or die(mysql_error()); $counter=0; $display=''; while($result=mysql_fetch_array($rs)) { $sql2="select * client id = '".$result["client_id"]."' "; $rs2=mysql_query($sql2,$pbx01_conn) or die(mysql_error()); $result2=mysql_fetch_array($rs2); } so in channel_did table client_id column number lookup in client table id equals channel_id.client_id how can list (from channel_did) order company column in client table? **channel_id** id did client_id **client** id name company client.id = channel_did.client_id write query inner join both tables, select fields first table, , use column of second table sort rows select a.* channel_did inner join client b on a.client_id = b.id order b.company of course in case have 1 , 1 row in client corresponding ea

Unable to start a tomcat debug session from Eclipse -

i'd start tomcat debug session on remote host eclipse, fails error: failed connect remote vm com.sun.jdi.connect.spi.closedconnectionexception my tomcat is, think, correctly configured received debug session on port 8000: tomcat 18771 1 1 17:18 ? 00:00:16 /usr/lib/jvm/java/bin/java -xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -djava.rmi.server.hostname=10.30.0.17 -dcatalina.ext.dirs=/usr/share/tomcat5/shared/lib:/usr/share/tomcat5/common/lib -djavax.sql.datasource.factory=org.apache.commons.dbcp.basicdatasourcefactory -djava.endorsed.dirs=/usr/share/tomcat5/common/endorsed -classpath /usr/lib/jvm/java/lib/tools.jar:/usr/share/tomcat5/bin/bootstrap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/share/java/mx4j/mx4j-impl.jar:/usr/share/java/mx4j/mx4j-jmx.jar -dcatalina.base=/usr/share/tomcat5 -dcatalina.home=/usr/share/tomcat5 -djava.io.tmpdir=/usr/share/tomcat5/temp org.apache.catalina.startup.bootstrap start there firewall

css - How to anchor a dynamic div to the screen? -

Image
i'm looking way devide screen 2 divs. 1 small fixed sized on left , 1 dynamic width on right. i didn't figured out how yet. because width in percentage not proportional. for example: http://jsfiddle.net/acmnu/2/ if resize result field or overall width see green div not resize in proportion screen. if field gets small green div slips under red one. what need kind of anchor. green div fill entire screen without getting big. html: <body> <div id="content"> <div class="left">left</div> <div class="right">right</div> </div> </body> css: body { height: 300px; } #content { height: 100%; } .left { float: left; margin-left: 10px; background-color: red; height: 100%; width: 200px; } .right { float: left; margin-left: 10px; background-color: green; height: 100%; width: 80%; } i hope have interpreted question cor

Hive database convert epochtime into YYYY-MM-DD format -

i have access hive database.in database time stored epochtime inside bigint column.i retrive data in yyyy-mm-dd format.can please me this table description temp_table name string ts bigint age int ts column stores data in epoch time stamp format when give select * temp_table values retrived are bob 1374752536 12 i need output as bob 2013-07-25 12:14:17 12 you make use of from_unixtime() date function provided hive. converts timestamp string representing timestamp. usage : hive> select from_unixtime(1374752536) demo; example : input : bob 1374752536 12 tariq 1374778369 25 query : hive> create external table demo2(name string, ts bigint, age int) row format delimited fields terminated ' ' location '/inputs/date/'; hive> select from_unixtime(ts) demo2; output : ok 2013-07-25 17:12:16 2013-07-26 00:22:49 time taken: 6.3 seconds hth

javascript - Why does this simple drag and drop code cause the element to flicker? -

i've got simple drag , drop jquery code vertical drag , drop: function drag(ele){ $(document).mousemove(function(e){ ypos = ele.offset(); ypos = ypos.top; diff = (ypos + ele.height()) - e.pagey; ele.css('top', e.pagey - diff); }).mouseup(function(){ $(this).unbind('mousemove'); }); } it works well, except starts flickering through small changes , diff variable jumps around. have no idea may causing this, perhaps else does? http://jsfiddle.net/gtgmn/2/ the problem more prominent in jsfiddle. it's because you're changing top property on element , @ same time you're using info move element. try example: function drag(ele){ $(document).mousemove(function(e){ ele.css('top', e.pagey); }).mouseup(function(){ $(this).unbind('mousemove'); }); } $('.box').mousedown(function(){ drag($(this)); }) this code put element directly cursor

c# - NUnit: TestClass does not have any tests -

i’m trying test out nunit running few unit tests. however, noticed 1 thing. in nunit version 2.6.2 (the latest version), when imported test dll file, tests passed , failed in appropriate places , gave me correct warnings, messages , indicators. however, in nunit version 2.4 rc1, same unit tests ignored. error message reads: “testclass not have tests” contain tests. why this? i'm trying validate older version of software , need run unit tests on older version. i used example run tests: http://www.codeproject.com/articles/178635/unit-testing-using-nunit if had copied snippet code referenced url, must have this: [testfixture] public class testclass { [testcase] public void addtest() { mathshelper helper = new mathshelper(); int result = helper.add(20, 10); assert.areequal(30, result); } [testcase] public void subtracttest() { mathshelper helper = new mathshelper(); int result = helper.subtract(20

c# - Error when extracting from a dotnetzip created zip file - "Windows cannot complete the extraction." -

Image
i'm using dotnetzip create zip file on fly returned via mvc stream. i'm able add files streams, ie file created on fly. i'm adding files created base64 strings. creating , downloading zip file fine, when open zip file using windows explorer (windows 7 or 8) can see of entries expected. opening file created memorystream opens without issue, when try open file created base64 string, windows explorer returns error windows cannot complete extraction. destination file not created. if try drag file zip file in windows explorer folder, error: if open same zip file or extract using winrar , open of entries don't have issues. any ideas? i'm thinking maybe need add content type base64 string or stream maybe? dotnetzip doesn't seem have parameter specify content types... i've made sure there's no encryption on zip file or of it's entries it appears you're trying extract , save file has colons in file name (the name in

android - How can I access the second argument in the list? -

i'm wondering how can access second item in list? mean string outputs : 07-17 21:15:38.723: d/my app(15806): {feeling=joyful} but want read "joyful" here code: public class feelingsmain extends activity { private static final string tag = "my app"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initlist(); listview lv = (listview) findviewbyid(r.id.pagelayout); // design listview adapter simpleadapter simpleadpt = new simpleadapter(this, feelingslist, android.r.layout.simple_list_item_1, new string[] { "feeling" }, new int[] { android.r.id.text1 }); lv.setadapter(simpleadpt); lv.setonitemclicklistener(viewneeds); } list<map<string, string>> feelingslist = new arraylist<map<string, string>>(); private void initlist() { // populate feelingslist feelingslist

java - NullPointerException on getting ManyToMany relation -

i got entity account manytomany entity role. @entity public class account { @id @generatedvalue(strategy=generationtype.sequence) private long id; @manytomany(cascade= {cascadetype.persist,cascadetype.merge,cascadetype.refresh}, fetch=fetchtype.eager) @jointable(name="account_role") private set<role> roles; // getters, setters } when try access relationship collection got nullpointerexception roles null: account account = new account(); account.getroles().size(); shouldn't empty set injected roles ? or default behaviour , should control roles creation by: private set<role> roles = new hashset()<>; you created object account account = new account(); that wasn't managed jpa. how expect not null? reference type instance variables are, default, assigned null . set reference type. should create set (as you've suggested). private set<role> roles = new hashset()<>; or retrieve

vba - Search a series of contiguous row cells in a worksheet -

search series of contiguous row cells in worksheet h1 h2 h3 h4 h5 h1 h2 h3 h4 h5 1 2 3 6 7 1 2 3 8 9 2 2 2 4 5 3 3 3 2 1 table 1 table 2 how code loop search first 3 cells in each row of table2, in table 1? given tables have same format. range , cells dont seem work because cant use counter them dim tlb1 range,tbl2 range dim rw1 range, rw2 range set tbl1=range("your table1 range here") set tbl2=range("your table2 range here") each rw1 in tbl1.rows each rw2 in tbl2.rows if rw1.cells(1)=rw2.cells(1) , rw1.cells(2)=rw2.cells(2) _ , rw1.cells(3)=rw2.cells(3) 'do whatever want on match... 'exit 'if want stop when find first match... end if next rw2 next rw1

Android Lint producing invalid xml files -

i have large android project trying run android lint on. works fine when run lint --html , produce html file. when run lint --xml though produces invalid xml file. problematic because try integrate android lint our jenkins server , jenkins requires xml files. error getting is: org.xml.sax.saxparseexception; linenumber: 144334; columnnumber: 141; invalid xml character (unicode: 0x{2}) found in value of attribute "{1}" , element "0". explanation="you can replace strings, such 1/2, , 1/4, dedicated characters these, such ½ (&amp;#189;) , strangely appears failing illegal character in lint explanation. realize turn particular warning off less ideal. there way prevent happening? thanks! so looks may have found bug in plugin. going post work around came in hopes can others while resolved. issue causing problem jenkins xml parser cannot read of characters in warning explanation. thus when run lint suggest outputting file such 'l

ios - Do I need to completely scrap my application to add Core Data? -

i beginner , when first made application (simple to-do list app) did not know core data. trying implement core data seems if want so, have change application completely. example, created new master detail application core data , compared current application, , none of same. one confusing part in current table view, have 2 sections objects 2 different arrays. if add core data, have no idea how so. have eliminate arrays , use nsfetchedresultscontroller? also, in application have modal view controllers. in master detail application seems core data works in master view. have no idea how implement core data in modal view controller (which defines values task object). have declare properties managedobjectcontext, managedobject, entitydescription, fetchrequest, etc. again in modal view controller.h? here of code if care: tableviewcontroller.m -(nsmutablearray *)taskarray { if (!taskarray) { taskarray = [nsmutablearray array]; } return taskarray; } -(nsmutablear

c++ - Linking against a debug version of a library with CMake -

i've got problems linking against debug version of lib. use cmake make library: project(mylib) ... add_library(mylib shared ${sources}) i launch build 2 times release , debug version of lib. add 'd' suffix name of debug lib , have mylib.dll , mylibd.dll . in app explicitly link against debug dll: project(myapp) add_executable(myapp win32 ${sources}) target_link_libraries(myapp mylibd.dll) the build finishes successfully, when open resulting exe file dependency walker unresolved dependency mylib.dll file, though debug version ( mylibd.dll ) located in same folder. so, why app try use release version of lib @ runtime? , how link against debug version? you should not rename file manually. use cmake's cmake_debug_postfix variable or debug_postfix target property instead: add_library(mylib shared ${sources}) set_target_properties(mylib properties debug_postfix "d") [...] add_executable(myapp win32 ${sources}) target_link_libraries(

mongodb - Error Handling with Spring Data and Mongo Java Driver -

i'm having trouble understanding how correctly receive , handle db constraint errors when interacting mongodb. i'm using: mongodb java driver - 2.11 spring-data-mongodb - 1.2.1.release spring-framework-core - 3.1.0.release i'm using mongotemplate.insert , giving "persistentteam" object represents football team. custom generating document's _id field per business rules. it's possible algorithm generating _id match existing object, in case want fall error handling. with default configuration, if insert object duplicate id no error returned db. contradicts mongo documentation, says default mongo driver configuration "acknowledged" should raise exception in case: http://docs.mongodb.org/manual/release-notes/drivers-write-concern/ looked @ 2.11 mongo driver code , sure enough, in mongo.java default write concern writeconcern.normal (equivalent unacknowledged). fine, i'll work around. edit: additional notes on code/documen

python - Shallow copy: why is list changing but not a string? -

Image
i understand when shallow copy of dictionary, make copy of references. if this: x={'key':['a','b','c']} y=x.copy() so reference of list ['a','b','c'] copied y. whenever change list ( x['key'].remove('a') example), both dict x , y change. part understand. when consider situation below: x={'user':'admin','key':['a','b','c']} y=x.copy() when y['user']='guest' , x['user'] not change, list still shares same reference. question makes string different list? mechanism behind this? you're doing 2 different things. when do x['key'].remove('a') you mutate object x['key'] references. if variable references same object, you'll see change point of view, too: however, in second case, situation different: if do y['user']='guest' you rebind y['user'] new object. o

ember.js - Change model type to subclass -

my app deals ton of data call 'subdata' (because it's child of real data , not independent). follow similar format: have ids, type , pointer parent element. works fine in ember.js way have now. server has no notion of type (just field of object), client does. have different ember.js models each type can each have different properties. my problem need convert normal subdata typed subdata. in adapter , transform json gets in. found more elegant way using filterproperty method. can make properties filter based on mixed subdata array. ignoring performance (which i'm not worried about), seems cleaner method. however, resulting array returned filterproperty array of subdatamodel s. how can convert models particular subclass of subdatamodel ?

jQuery best practice checkbox show/hide table rows and keep state on page refresh -

what best practice writing in jquery? script below works fine, tells me there’s better. have checkbox base triggers toggle function hides couple rows in table when checked , vice-versa when unchecked. $("#checkboxid").change(function(){ $("#tableid tr.rowclass").toggle(); }); whenever checkbox checked , page refreshes row display should stay hidden. solved issue add script. if($("#checkboxid").attr("checked")){ $("#tableid tr.rowclass").hide(); }else{ $("#tableid tr.rowclass").show(); } $("#checkboxid").change(function(){ $("#tableid tr.rowclass").toggle(); }); is acceptable or there better(proper) way of going this. advance insight. why not simply: $("#checkboxid").change(function(){ var self = this; $("#tableid tr.rowclass").toggle(!self.checked); }).change(); js fiddle demo . with given html: <label for="checkbox

c# - WinForms button default style changed? -

Image
i'm writing small winforms project. i've written "main" formbox (self made controls eg) derive other forms. i've problem default button design / style changed old "flat" design , not new "3d-style" (since vista). that's have that's should i never changed design manually realy don't know why has happend. i've searched solution in google , here belive i'm using wrong words search. does know how change design new 3d-style or how change design globally ? best regards alex you're missing call application.enablevisualstyles in main method, should this: [stathread] public static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); using(mainform form = new mainform()) { application.run(form); } }

sql - Copy the Result Set Into another table -

i want copy result set of query table using java: select basescore, count(*) log group basescore ;;;;;suppose________into log2 log i have tried lot gives me errors can please. in advance! try way: select basescore, count(*) cnt log2 log group basescore

locationmanager - Android: Location Manager -

run location updates different criteria 1 after another how can run location updates using "requestforlocationupdates" diferent criteria's 1 after another. the problem facing when run locationupdates 3 criteria's, code begins execution first criteria, seperate thread seems initiated waits location change , works listener. before removeupdates first criteria, have second criteria begining execution in main thread , again requesting location updates using new criteria. result can run last criteria. the locationmanager.getbestprovider() function returns best provider available. if there isn't provider matching criteria, loosened till provider found. can see definition of criteria upper boarder. if wanna use different criteria, can check in locationlistener.onstatuschanged() callback provider actual in use. if don't provider (because it's network , wanna gps f.e.) there place start new request provider.

c# - Multiple Insert statements in one connection -

i need tips on how better, inserting multiple queries using 1 connection. i understand not programming , being prone sql injection, wanted mention it's not going out on internet run locally. this have far.. public partial class modify : system.web.ui.page { oledbconnection connection; oledbcommand command; public void openconnection2() { connection = new oledbconnection(""); command = new oledbcommand(); connection.open(); } protected void btnsave_click1(object sender, eventargs e) { if (acctnumlist.selectedvalue == "3") { string query2 = string.format(@"insert ach (rptid, tableid, name, amount, stat, create_date) values ('{0}','{1}','{2}','{3}','{4}','{5}')", id, newguid, name1txtbox.text.replace(&q