Posts

Showing posts from August, 2012

asp.net - How to read in a Bit field to create a checkbox -

i have field in sql database bit field. i want read in field. if 1 checkbox true, else false. i started off code, getting error. advice on how this? if (myreader["tarchive"] == 1) regards tea try this: mycheckbox.checked = convert.toboolean(myreader["tarchive"]);

jsf 2 - Delete event not updating datatable rows -

in primefaces have confirm dialogue box , when confirm delete button rows in database deleted page not updated. missing not updating page. dialogue box defined below. <h:form id="searchform"> <p:commandbutton id="showdialogbutton" value="delete data" onclick="confirmation.show()" style="margin:20px" type="button" immediate="true" /> <p:confirmdialog id="confirmdialog" message="are sure want delete data submission?" header="initiating delete process" severity="alert" widgetvar="confirmation"> <p:commandbutton id="confirm" value="yes sure" update=":searchform:rowdatatable" oncomplete="confirmation.hide()" actionlistener="#{mydatabean.deletedata}" immediate="tr...

jsp - Single checkbox generated with iterator not working while it is not checked -

in 1 of struts2 test application, created multiple checkboxes using iterator tag like <s:iterator value="valueaddedservicesmap"> <s:checkbox name="reportdata.valueaddedservices" id="valueaddedservices" fieldvalue="%{key}" value="%{key in reportdata.valueaddedservices}"/>&nbsp;<s:property value="value"/><br/> </s:iterator> where valueaddedservicesmap map having key-value pairs {"1", "vas 1"}, {"2", "vas 2"} , have list<long> in action class reportdata.valueaddedservices in case of more 1 checkboxes working fine. populates list in action values associated wit selected checkboxes or keeps null if no checkbox selected. it populating single value in case of 1 checkbox dispaly , selected gives exception while 1 checkbox display , not selected. exception : [09 may 2013 10:48:45,081] [debug] unable convert value using type converter [...

android - Unexpected namespace prefix "xmlns" found for tag fragment Unexpected namespace prefix "map" found for tag fragment -

why unexpected namespace prefix "xmlns" found tag fragment unexpected namespace prefix "map" found tag fragment? <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".main"> <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map" android:name="com.google.android.gms.maps.mapfragment" map:maptype="satellite"/> </relativelayout> why unexpected namespace prefix "xmlns" found tag fragment unexpected namespace prefix "map" found tag fragment ? remove xmlns:android="http://schemas.android.com/apk/res/andr...

uuid - How unique are the ids generated with CFUUID , in iOS? -

the title question actually. apple doesnt allow more use of uuid decided go cfuuid. however have questions regarding it. is unique every device? if yes how different uuid? is random generator? if yes how it? can sure in 10000 devices there wont duplicate? i between in solution of using cfuuid , , having server generating random unique identifier can sure of. need unnecessary coding , http requests between server , devices. any ideas? when apple doesn't allow use of uuid, must referring udid, or unique device id. a uuid unique every time generate one. it's not udid. uuids unique globally. is unique every device? if yes how different udid? yes, it's unique every device because part of uuid devide id, though it's not entire udid. udid same. each time create uuid, it's different last, need store uuid if wanted use device id. is random generator? if yes how it? can sure in 10000 devices there wont duplicate? a uuid computed, not...

javascript - Add function to prototype of $(this) -

i'm extending jquery.contentcarousel plugin , , i've reached specific point i'm defining new functions via __prototype__ . shrunk code down demonstrate essential part: (function($) { var aux = { navigate : function(){ //... }, } methods = { init : function( options ) { return this.each(function() { var $el = $(this); //this slippery line: $el.__proto__.scrolloneleft = function() { aux.navigate( -1, $el, $wrapper, $.extend(settings, {sliderspeed: 10, slidereasing: ''}), cache ); }; }); } } $.fn.contentcarousel = function(method) { if ( methods[method] ) { return methods[method].apply( this, array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments )...

java - Why my JDBC call is consuming memory 4 times more that actual size of data -

i wrote small java program loads data db2 database using simple jdbc call. using select query data , using java statement purpose. have closed statement , connection objects. using 64 bit jvm compilation , running program. the query returning 52 million records, each row having 24 columns, takes me around 4 minutes load complete data in unix (having multiprocessor environment). using hashmap data-structure load data: map<string, map<string, gridtradestatus>> . bean gridtradestatus simple getter/setter bean 24 properties in it. the memory required program alarmingly high. java heap size goes 5.8 - 6gb load complete data while actual used heap size remains between 4.7 - 4.9gb. know should not load data memory business requirements in way only. the question when put whole data of table in flat file comes out equivalent ~1.2gb. want know why java program consuming memory 4 times more actual size. there nothing surprising here (to me @ least). a.) strings i...

probability - How can I distinguish between two different users who live near to each other? -

how can distinguish between 2 different users, 2 different neighbours lives in same address , goes same office, have different patterns of driving , have different office schedules. wanted find out probability of 2 persons behaves more or less exactly. depending on resolution of map, wants figure them, are, how are. can create pattern ´for each drivers signatures, identity can traced upon. i assume, way asked question, haven't had plausible ideas yet. i'll make answer purely based on idea might try out. i thought of suggesting along line of word-similarity metrics, because order not important here, maybe it's worth trying simpler start. in fact, if ever find myself considering complex when developing model, take step , try simplify. it's quicker code, , don't attached that's dead end. so, how histograms? if divide time , space larger blocks, can increment value in relevant location each time interval. 2d histogram of person's location. ...

python - "argument must be a callable function" when using scipy.integrate.quad -

i've written code enables me take data dicom files , separate data individual fid signals. from pylab import * import dicom import numpy np import scipy sp plan=dicom.read_file("1.3.46.670589.11.38085.5.22.3.1.4792.2013050818105496124") all_points = array(plan.spectroscopydata) cmplx_data = all_points[0::2] -1j*all_points[1::2] frames = int(plan.numberofframes) fid_pts = len(cmplx_data)/frames del_t = plan.acquisitionduration / (frames * fid_pts) fid_list = [] fidn in arange(frames): offset = fidn * fid_pts current_fid = cmplx_data[offset:offset+fid_pts] fid_list.append(current_fid) i'd quantify of data so, after applying fourier transform , shift i've tried use scipy's quad function , encountered following error: spec = fftshift(fft(fid_list[0]))) sp.integrate.quad(spec, 660.0, 700.0) error traceback (most recent call last) /home/dominicc/experiments/in vitro/glu, cr/phantom 1: 10mm cr, 5mm glu/w...

Download Qt sdk on windows-32 bit system: which one to choose between MinGW 4.7, VS 2010, VS 2010 OpenGL? -

i download qt sdk (libraries+ ide qt creator). i'm on win-32 system there 3 choices windows 32-bit system : qt 5.0.2 windows 32-bit ( mingw 4.7 , 650 mb) qt 5.0.2 windows 32-bit ( vs 2010 , 485 mb) qt 5.0.2 windows 32-bit ( vs 2010, opengl , 476 mb) what differences between them , 1 choose having qt sdk on win-32 system ? thanks in advance! depends on compiler. use mingw 4.7 if compiler mingw 4.7 vs 2010 if you're on visual studio 10 compiler the decision binaries download decision compiler you'll use too. if not sure or use one, better download sourcecode of qt , compile own. here's how so: building qt desktop windows mingw building qt desktop windows msvc hint: realy make shure use mingw version mentioned in documentation, else can this problem.

python - Why is reversing a list with slicing slower than reverse iterator -

there @ least 2 ways reverse list in python, iterator approach faster (at least in python 2.7.x). want understand contributes speed difference. >>> x = range(1000) >>> %timeit x[::-1] 100000 loops, best of 3: 2.99 per loop >>> %timeit reversed(x) 10000000 loops, best of 3: 169 ns per loop i suspect speed difference due @ least following: reversed written in c reversed iterator, less memory overhead i tried use dis module better view of these operations, wasn't helpful. had put these operations in function disassemble them. >> def reverselist(_list): ... return _list[::-1] ... >>> dis.dis(reverselist) 2 0 load_fast 0 (_list) 3 load_const 0 (none) 6 load_const 0 (none) 9 load_const 1 (-1) 12 build_slice 3 15 binary_subscr 16 return_value >>...

php - send message to selected friends in facebook -

i have following code send messages selected friends custom made $friends = $facebook->api(array( "method" => "fql.query", "query" => "select uid,name user uid in (select uid2 friend uid1 = me())" )); where $facebook 1 having details of application & key values., & friends list $friends i'll having textarea enter message has sent, now i'll passing selected list of friends & message function follows function facebook_send_message(to,message) { fb.ui({ app_id:'my app id', method: 'send', name: 'abcdef', link: 'http://apps.facebook.com/', to:to, message:message },function(response){alert(response);}); } when function called, facebook popup opens, form in these content placed gets submitted, i'm not able send message selected friends, can...

iphone - Get total number of filled row in table in SQLite -

my question similar mysql, count number of "filled" fields in table but can not got proper solution. how possible in sqlite? i know using loop. want query. please me on issue. thanks in advance. a query work: select count(*) raw rawdata <> '' , rawdata not null this assumes there table called "raw" , column you're checking against "rawdata"

iphone - iOS - Turning my Dates into Hyperlinks -

for reason not find on topic. i'm not 1 having issue, perhaps i'm not using correct search terms. my problem ios turning strings (i have dates display fields). for example: 10/4/2011, 12/6/2001 turn hyperlinks (of course don't go anywhere), can select them , try add contacts or copy. i'd string not hot. what's super strange 10/18/2011 isn't hot, guess pattern (starts 1 , has 9 characters, similar phone number) any ideas? edit: sorry folks should have mentioned displaying data within browser. this tag in header might work. stops numbers behaving phone number or address. <meta name="format-detection" content="telephone=no"> if doesn't work, try these also: <meta name="format-detection" content="date=no"> <meta name="format-detection" content="address=no">

multithreading - Spring Batch multithread throwing java.lang.Thread.State -

i have web application developed using grails , spring , java , hibernate . it contains batch job implemented using spring batch . when run job without multithreading works fine. introduce partitioning (and every partition handled different thread/multi threading) after processing of thread stuck in infinite loop , never comes back. following stack trace when thread gets stuck. java.lang.thread.state: runnable @ org.apache.commons.collections.map.abstracthashedmap.getentry(abstracthashedmap.java:440) @ org.apache.commons.collections.map.abstractreferencemap.getentry(abstractreferencemap.java:405) @ org.apache.commons.collections.map.abstractreferencemap.get(abstractreferencemap.java:230) @ org.grails.datastore.mapping.core.abstractdatastore.getobjecterrors(abstractdatastore.java:160) @ org.grails.datastore.mapping.core.datastore$getobjecterrors.call(unknown source) @ org.codehaus.groovy.runtime.callsite.callsitearray.defaultcall(callsitearray.java:42) @ org.grails.datastore....

fadein - jQuery Fade in trouble (Works in second rotation but not first) -

ok, deal content , front end design trying throw nice image slider iframe our website. able construct using jquery having small problem it. supposed have fade in , fade out during first rotation uses fade out. next rotation works perfectly. here code i'm using <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ slideshow(); }); function slideshow() { var showing = $('#contentcontain2 .isshowing'); var next = showing.next().length ? showing.next() : showing.parent().children(':first'); showing.fadeout(800, function() { next.fadein(1600).addclass('isshowing'); }).removeclass('isshowing'); settimeout(slideshow, 5000); } </script> here link hosted can see problem. http://ksee.bimedia.net/sites/community/index.html try hiding them first (before...

Show validation errors on another page in Rails -

i have webapplication in rails 3, want users able sign on frontpage. frontpage controlled pagescontroller , sign process controlled registrationcontroller (i use devise). have no problem adding sign form on frontpage, , works when submit form correctly. have render form partial: <%= render "/users/registrations/form" %> and in form have <%= simple_form_for(@user, :url => registration_path(@user)) |f| %> however if user try submit errors (eg. missing information), user redirected standard sign page. errors displayed fine, want user stay on frontpage, error messages shown there. so first of need render frontpage again, when sign process fails, , want error messages shown, still want standard sign page work normally. how can best way, , still keep dry? hope can me i think need customize page redirected after devise log-in failure. this answered in question: devise redirect after login fail if have 2 different pages signup form , w...

android - ListActivity force closes -

whenever button opens class, app force closes. i've followed video tutorial exactly, shouldn't errors. so want have list have 3 items in it. , when click on of them, take specific activity. there missing? know haven't set onclicklisteners, want list work before continue. here's java file: package com.heavyfork.sq; import android.app.listactivity; import android.os.bundle; import android.view.menu; import android.widget.arrayadapter; public class extends listactivity { protected string[] aboutlist = { "more apps", "about", "help" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_about); arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, aboutlist); setlistadapter(adapter); } @override public boolean oncreateoptionsmenu(menu menu) { // inf...

javascript - linkedin apply button callback and jquery (or ext callbacks in general) -

i'm adding linkedin apply button site , use callback track applications https://developer.linkedin.com/apply-processing-applications linkedin docs/example: <script type="text/javascript"> function myonclickfunction(r) { alert("click"); console.log(r); // here } function myonsucesssfunction(r) { alert("success"); console.log(r); // else here } </script> <script type="in/apply" data-email="apply-test@linkedin.com" data-companyid="1337" data-jobtitle="chief cat herder" data-onclick="myonclickfunction" data-onsuccess="myonsuccessfunction"> </script> i'm able conventional javascript, try first jquery project, have no idea how start. could give me start on how can go here (just give outline - not expecting have written me!) $(document).ready(function() { // stuff when do...

asp.net - Changing KML Placemark Color with JavaScript -

hello stack overflow people!! i don't know if there's way this, i'm hoping there since alternative more complicated , i'm not positive how accomplish it. @ moment, i've got google earth plugin running on page other controls. page supposed show chart latency , signal-to-noise data modem grid tons of additional information isp little better when comes trouble shooting modems. the question have is: there way in javascript modify color of google earth placemark without messing kml? i know can in kml <style id="normalplacemark"> <iconstyle> <color>ffffff00</color> <scale>5</scale> <icon> <href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</href> </icon> </iconstyle> </style> but i've been having trouble appending right place in overall xml using c# or addkmlfromstring() in javascript (which i'm unfamiliar with) page recognize it....

java - Difference between @Mock and @InjectMocks -

what difference between @mock , @injectmocks in mockito framework? @mock creates mock. @injectmocks creates instance of class , injects mocks created @mock (or @spy ) annotations instance. note must use @runwith(mockitojunitrunner.class) or mockito.initmocks(this) initialise these mocks , inject them. @runwith(mockitojunitrunner.class) public class somemanagertest { @injectmocks private somemanager somemanager; @mock private somedependency somedependency; // injected somemanager //tests... }

How to erase CustomMarker from google maps v2 android -

Image
i have problem custom markers in google maps. i'll try explain best can. i have markers, , did 1 asyntask, clusterize if necessary, returning linkedhashmap<point, arraylist<markeroptions>> clusters have clusters. each position represents cluster (it's possible have cluster 1 marker) when got list, add clusters map: here activity call clusterizer. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); map = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); map.getuisettings().setmylocationbuttonenabled(true); cameraupdate camupd1 = cameraupdatefactory.newlatlngzoom(new latlng(41.40520680710329,2.191342011603923),map_zoom_level); map.animatecamera(camupd1); loadmarkers(); map.setoncamerachangelistener(new googlemap.oncamerachangelistener() { @override ...

activerecord - Codeigniter Active Record - WHERE inside IFNULL and COUNT -

i have application simulates locker. inside each locker have n racks. inside each rack have n boxes, n folders , n books. of objects not acessible (they have boolean attribute called acessible). i want show each locker , sum of objects ordering type (book, folder , box). like: rack_id: 1 rack_number: 001 locker_number: 54 sum_boxes: 10 sum_folders: 20 sum_books: 10 my query: $this->db->select('r.id rack_id, r.number rack_number, l.number locker_number) ->select('ifnull(count(distinct `box`.`id`), 0) `sum_boxes`', false) ->select('ifnull(count(distinct `book`.`id`), 0) `sum_books`', false) ->select('ifnull(count(distinct `folder`.`id`), 0) `sum_folders`', false); $this->db->from('rack r'); $this->db->join('locker l', 'l.id = r.locker_fk', 'inner'); $this->db->join('box box', 'box.rack_fk = r.id', 'left'); $this->db->join('book book'...

active directory - AD returns Objectsid as String and SecurityIdentifier is failing interprete this -

usually ad returns 'objectsid' byte[] . type cast value returned ad in byte[] . procedure worked against several ad not in 1 case. in ad environment, following exception. exception: unable cast object of type 'system.string' type 'system.byte[]'. (system.invalidcastexception) to debug started checking data-type of value returned ad, , system.string not byte[] . printed string , garbage. passed string securityidentifier() , got exception again. exception: value invalid. parameter name: sddlform (system.argumentexception) code: //using system.directoryservices.protocols objects object s = objsrec[k1].attributes[(string)obj3.current][0]; string x = s.gettype().fullname; if (x.tolower() == "system.byte[]") { byte[] bsid = ((byte[])s); if (bsid != null) { securityidentifier sid = new securityidentifier(bsid, 0); string objectsid = sid.value; } } else if (x.tolower() == "system.string") { securityidentifi...

css - Bootstrap: ordered list with divs not aligning -

i'm using bootstrap create website. need create ordered list has text image next it. reason, content of list shifted 1 line looks this: 1. text here [ image here ] 2. text here [ image here ] how align properly? here code: <ol> <li> <div class="span12"> <div class="span6">test</div> <div class="span6"><img src="asdfd.png"></div> </div> <div class="clearfix"></div> </li> <li> <div class="span12"> <div class="span6">test</div> <div class="span6"><img src="asdfds"></div> ...

java - Sort arraylist of letters and numbers -

this question has answer here: natural sort order string comparison in java - 1 built in? [duplicate] 9 answers java: sort string array in numeric way 5 answers i'm trying sort arraylist of strings made of numbers , letters, example of list once sorted be: name 1 name 2 name 3 name 11 name 12 name 13 but when use collections.sort() sorts way: name 1 name 11 name 12 name 13 name 2 name 3 any ideas type of sort i'm looking called or how it? string s ordered alphabetically default. need implement own comparator<string> or use object implements comparable (or use comparator it) solve this, since string s using mixtures of words , integers.

Android ADT Eclipse (Juno) How to apply Dark UI Theme? -

hello downloaded android adt (eclipse) i have found theme: https://github.com/rogerdudler/eclipse-ui-themes the instructions provided follows: download zip package , extract eclipse dropins folder: https://github.com/downloads/rogerdudler/eclipse-ui-themes/com.github.eclipsecolortheme.themes_1.0.0.201207121019.zip restart eclipse , go preferences > general > appearance , choose dark juno i have done that, restarted eclipse, when go windows -> preferences -> general , click on "appearance" following error message: title: not accept changes message: displayed page contains invalid values. even if didn't still error got fixed after updating eclipse color theme plugin 0.13.1.20140504130

Why doesn't Google Plus pick up link description? -

when paste link google plus post (using link option), title , image appear there no description. i've noticed on many links display description. i'm not sure difference is. the links i'm trying formatted opengraph , work fine on facebook. understand g+ should pick info well. doesn't description. any ideas on fix? it looks google+ stopped including description when posting i did not find official place confirmed this i tried using schema, open graph , meta description - failed

facebook graph api - FQL Query capabilities -

just getting started fql , graph api. is there way run query performs same kind of search on facebook graph search? for example, user logs in fb. wants find users named lisa smith live in florida (regardless of connection her). can app search users in florida first name "lisa" , last name "smith", without relating query specific userid? refer to: http://developers.facebook.com/docs/reference/api/search/ search available via graph api, there not connection via fql documented. some queries can emulate, fql tables not provide indexing or tables in areas. searching users via fql. http://developers.facebook.com/tools/explorer?fql=select%20uid%20from%20user%20where%20uid%20%3d%20732484576 select uid user uid = 732484576 { "data": [ { "uid": 732484576 } ] } note shawnsspace username facebook , should return uid, since username documented indexed. select uid,name,birthday,about_me user username = ...

linux - Android privileges to execute native applications? -

i downloaded c4droid app android , running commands through system(); . i'm learning somethings work while others don't. of cool stuff don't work , appears due user profile not being given rights execute such commands @ linux os level. so tried experiment. got special gnu compiler arm processor , compiled simple hello world app. put on phone , tried execute through c4droid app system("./myapp.bin"); . got permission denied message. so i'm trying understand can , can't on phone paid money for? can execute such hello world app or not? need root access execute application made? there way code run wrapping in android/java code? have go through dalvikvm run? i'm looking way without rooting or downloading busybox , using su. many many different issues. permission denied 1 of few error messages primitive shell knows, , it's used many other types of failures including not finding requested command. the toolbox suite m...

node.js - NPM - Can't install socket.IO -

i trying install socket.io on windows npm use on nodejs server. first, when typed "npm install socket.io" had error in log saying python , node-gyp. installed python 2.7.3 , set environment variables. now got new error, has visual studio (what hell vs have npm ? compiler? ). the error same here npm install packages (sqlite3, socket.io) fail error msb8020 on windows 7 when use option in answer instead of error tells me possible data loss (c4267) doesn't log error. then when start app, tells me cannot find module socket.io still come ? oh , when npm config root tells me "undefined" have ? should install modules globally or locally ? at least 1 of packages in socket.io's dependency tree c/c++ addons needs compiled on system it's installed. and, since it's dependency, if doesn't succeed in installing, neither socket.io. to enable cross-system compilation, node.js uses node-gyp build system. you'll need have installed g...

VBA - open excel, find and replace, delete row, save as csv -

i trying write program in vba can remotely manipulate excel file sas (a statistical programming software). want program accomplish following: open specified excel file find , replace blanks in header row nothing (e.g., "test name" become "testname") delete second row if first cell in row (i.e., a2) blank save file csv i not know vba, have dabbled little, know other programming languages, , have tried piece together. stole code make 1 , 4 work. cannot 2 , 3 work. have: i put following in sas call vba program - x 'cd c:\location';/*change location of vbs file*/ x "vbsprogram.vbs inputfile.xls outputfile.csv"; the vba program - '1 - open specified excel file if wscript.arguments.count < 2 wscript.echo "error! please specify source path , destination. usage: xlstocsv sourcepath.xls destination.csv" wscript.quit end if dim oexcel set oexcel = createobject("excel.application") dim obook set obook = ...

How can I list function calls by using exec in python? -

i want use exec simple python code , list functions called instead of calling them. if know functions called, can create dictionary defines named functions print , use second argument of exec . i'm trying use custom dictionary class prints called functions overwritting getitem , exec not helping issuing: typeerror: exec: arg 2 must dictionary or none is there way customize function call in generic way? edit : for instance, suppose have following configuration file, written in python: user('foo') password('foo123') home('/home/foo') user('bar') password('bar123') home('/home/foo') i need run file , print information contained therein. can following python program: d = { 'user': print, 'password': print, 'home: 'print } execfile(filename, d, {}) the problem approach have initialize d functions present in file. tried use custom dictionary did different on getitem, , got typeerror above...

sql - Save huge array to database -

first introduction , in case there's better approach: have product table *product_id* , stock , stock can big 5000 or 10000, need create list (in table) have row each item, is, if *propduct_id* has stock 1000 i'll have 1000 rows *product_id*, , plus, list needs random. i chose php (symfony2) solution, found how random single product_id based on stock or how random order product list, didn't find how "multiply" rows stock. now, main problem : so, in php it's no difficult, product_id list, "multiply" stock , shuffle, problem comes when want save: if use $em->flush every 100 records or more memory overflow after while if use $em->flush in every record takes ages save this code save maybe can improve: foreach ($huge_random_list $indice => $id_product) { $preasignacion = new listapreasignacion(); $preasignacion->setproductid($id_product); $preasignacion->setorden($indice+1); $em->persist($preasignacio...

bash - How to convert a directory to a string? -

this question has answer here: extract file basename without path , extension in bash [duplicate] 9 answers i have symlink named current pointing directory , lets current -> $home/local/java/jdk1.8.0 i want extract jdk1.8.0 part string. first, directory : current_dir= $(readlink -f $current) and then, tried extract last part of path : last_part= ${current_dir##*/} or when try print via : echo $current_dir i error : bash: /home/tarrsalah/local/java/jdk1.8.0: directory how can convert directory string ? use basename : $ basename /home/tarrsalah/local/java/jdk1.8.0 jdk1.8.0

java - Byte [] used as a BufferInputStream ok but -

ok know buffer array of byte, have never seen following declaration (taken here ) urlconnection con = new url("http://maps...").openconnection(); inputstream = con.getinputstream(); byte bytes[] = new byte[con.getcontentlength()]; is.read(bytes); is right way avoid using bufferinputstream object? here have unbuffered stream reading byte []? should not other way around? in advance. no, not right way. method read() reads n bytes n length of array. can read less bytes (even 0) if no more byte available. number of bytes have been read returned method read() . when end of stream reached method returns -1 . therefore right way read bytes in loop: byte[] buf = new buf[max]; int n = 0; while ((n = stream.read(buf)) >= 0) { // deal n first bytes buf }

ruby on rails - How to get database to read form value, not option number -

for profile fields such ethnicity. user 1 has selected 'asian' ethnicity. in users database show numbers selected ethnicity (such asian = 1, dutch = 2, etc based on order of ethnicities options list) , search database recognizes ethnicity itself...not number ethnicity. search trying find users asian selected, technically there none since user database goes number instead of name of ethnicity. i believe user database showing numbers because what's used in form best_in_place gem. show.html: <p>ethnicity: <%= best_in_place @user, :ethnicity, nil: 'what ethnicity?', :type => :select, :collection => [[1, "asian"], [2, "biracial"], [3, "indian"], [4, "hispanic/latin"], [5, "middle eastern"], [6, "native american"], [7, "pacific islander"], [8, "white"], [9, "other"]] %></p> i have tried doing: collection: ["asian", "biracial"...

javascript - Why does backbone fetch not work for me -

i trying solve issue backbone fetch. getting 'failed fetch!' in console. i think not issue connected same origin policy because json returned server , according jsonlint valid [{"name":"spanish a1"},{"name":"spanish a2"}] code in gist: https://gist.github.com/konradmasalski/bfaac7d481d890ca5c54 update - code var fishe = {}; fishe.deck = backbone.model.extend({ initialize: function () { alert("welcome world"); } }); fishe.deckcollection = backbone.collection.extend({ model: fishe.deck, url: 'http://fishes.localhost/deck.json', sync: function (method, model, options) { console.log('syncing'); var params = _.extend({ type: 'get', datatype: 'jsonp', url: this.url, success: function (data, textstatus, jqxhr) { console.log(data) }, error: function (jqxhr, t...

openlayers - Open Layers + jquery -

i doing master thesis on internet mapping. task display research work @ department on webpage on top of google maps. far successful in that, problem not able find way connect layers on map individual row on table in same page. trying use jquery how link row in table layer on map. can body me how that. can see work below: [http://130.237.175.39/goran_1.html][1] in page have created 2 div elements map object , table. posting 2 elements of code here. if want see full code can see in page source. <!doctype html> <html> <head> <title>land uplift</title> <script src="http://193.10.6.144/api/openlayers.js"></script> <link rel="stylesheet" type="text/css" href="http://130.237.186.211/geoserver/scalebar.css"> <link rel="stylesheet" type="text/css" href="http://130.237.186.211/geoserver/mousepos.css"> </head> <body> <div id="...

deployment - Does the type of deploy affect the application in any way? -

my team , trying automatize of our proccesses , includes programmatically remote deployment. colleague of mine asked me question jboss' deployment: does type of deploy in jboss, jmx or filesystem (copy app package deploy folder), affect application in way? i know jmx deployment temporary , filesystem not. other this, there difference? did research, didn't found useful or understand (i'm beginner-to-intermediate java programmer), how-to's different ways deploy application. peharps shed light on this? thank you. i using both kind of deployments in applications , mean of deployment doesn't affect app in way. maybe jmx has enabled (but default). find jboss maven plugin useful (it can handle deployment, redeployment , on).

Can a primary key in Cassandra contain a collection column? -

can primary key in cassandra contain collection column? example: create table person ( first_name text, emails set<text>, description text primary key (first_name, emails) ); collection types cannot part of primary key, , neither can counter type. can test yourself, reason might not obvious. sets, list, maps hacks on top of storage model (but don’t mean in negative way). set number of columns same key prefix. part of primary key value must scalar, , collection types aren’t.

android - Corona SDK animation not working with the director class? -

hey there trying use animations in game reason error here code used animation local function animate( event ) gear.rotation = gear.rotation + 10 end runtime:addeventlistener("enterframe", animate); this works if use without director class director class change scene scene i error message when try leave class or when go other class rotates until try leave class the error = attempt perform arithmetic on field 'rotation' (a nil value) any please in advance! try this: gear.rotation = 0 local function animate( event ) gear.rotation = gear.rotation + 10 end runtime:addeventlistener("enterframe", animate);

node.js - Limit number of data streamed to a webpage with node.jsand socket.io -

i'm working on streaming app using node.js , socket.io. moment app works need 1 thing: since it's streaming app there data push client, want display 10 recent object pushed server. how can ? should on client code or directly on server ? have no idea. here's code of client <script src="/socket.io/socket.io.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script> <script> var socket = io.connect('http://192.168.1.29:5000'); socket.on('stream', function(tweet){ $('#tweetd').append(tweet+'<br>'); }); </script> <div id="tweetd"></div> </div> server code : var express = require('express') , app = express() , http = require('http') , server = http.createserver(app) ,twit = require('twit') , io = require('socket.io').listen(serv...

java - Associate multiple class mappings with a given context map id -

i specifying mappings dozer following code shows error java.lang.illegalargumentexception: duplicate map id's found. . understand wrong want have 1 set of mappings admin context , user context. can't done? have write dogadmin, catadmin etc map-id? <mapping map-id="admin"> <class-a>cat</class-a> <class-b>catview</class-b> <field> <a>name</a> <b>firstname</b> </field> </mapping> <mapping map-id="admin"> <class-a>dog</class-a> <class-b>dogview</class-b> <field> <a>name</a> <b>firstname</b> </field> </mapping> unfortunatelly, can't that, tried too.

javascript - Retain hover over effect on link -

i have 5 links act bit of navigation bar, light blue start with, when 1 of them hovered on or clicked them change color , retain color until link selected. i have had search solution , there many seem particular case , can't seem adapt them. any appreciated. heres html here, have css file making pretty well. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org /tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function() { $( "#tabs" ).tabs({ event: "mouseover" }); }); </script> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <title>menu bar<...

javascript - Mobile web, how to retain selected text on touch -

i have been looking @ using jquery text editor ( http://jqueryte.com/ ) provide simple html editing capabilities on mobile app using mobile web. when use jq te on mobile device, can select text, moment try bolden or italicize selected text (i.e. subsequent touch event has occurred) highlighted text "lost" , cannot acted on. so far, best can do, first select bold, , type text, , not great not allow editing. how can retain selection on touch. imagine there javascript way of doing this.

objective c - UIWebView crashing -

i have problem using uiwebviews in objective-c app we're developing. crashes retina ipad. both ipad 1 , 2 behave fine. the web view loaded local html/css/js , dynamic content contains pricing information needs mirror of website pre-downloaded device. the page contains lots of images think memory related. i've tried reducing payload on page stops crashes. stupidity of apple choose quadruple resolution whilst doubling memory root cause of why works fine on non-retina devices, how can manage memory within page prevent ios destroying entire app? does ios automatically store imagery 2048x1536x32bpp bitmap (theoretically 12mb per image?) irrespective of file format? i've tried converting jpg / png no effect on crashes. reducing volume of images present on page stops crashes. it's first foray ios development, please gentle! ios won't change resolution of original images page loads, of course de-serialize them .png/.jpg bitmap in memory display, shoul...