Posts

Showing posts from August, 2011

How to check the previous record in CursorAdapter - Android -

i have chat application , i'm looking way hide profile image of chat when there 2 or more consecutive chat same person, how can that? or may use different chat bubble facebook or other chat apps below sample of have, private static class chatcursoradapter extends cursoradapter { private chatcursor chatcursor; public chatcursoradapter(context context, commentscursor cursor) { super(context, cursor, 0); chatcursor = cursor; } @override public view newview(context context, cursor cursor, viewgroup parent) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); return inflater.inflate(r.layout.chat_layout, parent, false); } @override public void bindview(view view, context context, cursor cursor) { imageview imgview = (imageview) view.findviewbyid(r.id.imageview1); chat chat = chatcursor.ge

java - Save ArrayList Between activity transtion -

im having lot of trouble here. problem: have 2 activities , b. in activity have listview custom items. have data of these items storage in arraylist. when user clicks on listview item, activity b called displaying details item. when user comes activity a, items inside listiview gone . know need save listview state, need save data of arraylist. question: how solve problem? notes: have tryed onsaveinstancestate , onrestoreinstancestate, since transition between these 2 activities , b fast, activity not destroyed. cannot save arraylist in bundle object. have tryed use sharedprefereces , contentvalues nor of these classes have support parcelable objects , lists. thanks help! @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); lstview = (listview) findviewbyid(r.id.lstview); connectivitymanager cm = (connectivitymanager) getsystemservice(context.connectivity_servic

c# - li with runat server -

i have problem creating dynamic <li> elements codebehind. need assign runat server li, didnt find way assign runat server, can't find li control when need change attributes code behind. there answer problem? new asp.net c#. here code: <ul class="nav nav-tabs" runat="server" id="tablist"> //first got ul control assign runat=server in aspx page </ul> //then create li code behind in page_init() system.web.ui.htmlcontrols.htmlgenericcontrol tab = new system.web.ui.htmlcontrols.htmlgenericcontrol("li"); tab.id = "tab" + (i + 1); tab.attributes.add("runat", "server");//this not working tab.controls.add(new literalcontrol("<a href=\"#customer" + (i + 1) + "\" data-toggle=\"tab\">penumpang " + (i + 1) + "</a>")); //then add li ul controler called tablist this.tablist.controls.add(tab); my problem is, when page loads, can see

regex - Using regular expression in CSS to match numbers -

i have bunch of rows have id contains number name this: <tr id="839" class="stock"> ... <tr id="2493" class="stock"> ... <tr id="4156" class="stock"> ... my css rule fails when apply this: tr[id=^['[0-9]'] { //css rules goes here } with example you'd better off targeting them tr.stock {} note: ids shouldn't start number jquery option: jquery selector regular expressions

c# - How do I re-access the usercontrol that i've been declared before in a child control? -

i want reaccess of child usercontrol main form..i want access object "watch" i've declared watchlistuc watch = new watchlistuc(); from main i've declared user control on panel of main form private void mylist_load(object sender, eventargs e) { loginscreen screen = new loginscreen(); panel2.controls.clear(); panel2.controls.add(screen); loaddb(); grid.contextmenustrip = opendetails; } after created login , there able call watchlistuc watch = new watchlistuc(); want recall later on login screen here's code private void login_click(object sender, eventargs e) { suspendlayout(); try { mysqlconnection conn = new mysqlconnection(myconnection); conn.open(); mysqlcommand command = new mysqlcommand("select * maindatabase.users user=?parameter1 , pass=?parameter2;", conn); command.parameters.addwithvalue("?parameter1&quo

Translate AFNetworking POST constructingBodyWithBlock from Objective C to Swift -

i'm trying implement put version of below code in swift (so can implement put attachment), found here: https://github.com/afnetworking/afnetworking/blob/master/afnetworking/afhttpsessionmanager.m i'm having trouble getting compile, says variable task used within own initial value . thoughts? objective c - (nsurlsessiondatatask *)post:(nsstring *)urlstring parameters:(id)parameters constructingbodywithblock:(void (^)(id <afmultipartformdata> formdata))block success:(void (^)(nsurlsessiondatatask *task, id responseobject))success failure:(void (^)(nsurlsessiondatatask *task, nserror *error))failure { nserror *serializationerror = nil; nsmutableurlrequest *request = [self.requestserializer multipartformrequestwithmethod:@"post" urlstring:[[nsurl urlwithstring:urlstring relativetourl:self.baseurl] absolutestring] parameters:parameters constructingbodywithblock:block error:&

arrays - how to handle synchronization using mutex in a child thread in c programming -

i continuing yesterday's help, , have added code in child thread. basically, when user enters stdin, child thread should read , return parent thread. however, after printing output, code should redirected child thread , wait user press enter, once user press enter, code should exited. working, have used sleep() , want use mutex(), when comment sleep(), following codes print first ("press enter") parent code prints actual input. /*required header files added*/ #include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <unistd.h> /*this structure hold string of user input , lock variable has created*/ struct thread_main { char *buffer; char *bufferparent; pthread_mutex_t lock; pthread_mutex_t lock1; } td; /*it child thread, , store user value in buffer variable has been declared in thread_main structure*/ static void *thread(void *buff) { /*the pointer has assigned structure, can values of buffer array*/

javascript - How to use jQuery and CSS to write vertical drawer -

i working on drawer component in ember.js. here jsbin http://jsbin.com/wulija/8/edit what want in beginning looks this +---------------------------+ | b c | +---------------------------+ ... other page content ... if click on option, corresponding component show up. drawer slide down reveal content a, , overlap following page content +---------------------------+ | _a_ b c | +---------------------------+ | | | click a, slide down reveal content | content | v following page content covered drawer +---------------------------+ then if click on b, content slide toward left, content b slide in right, drawer height adjust according content b. +---------------------------+ | _b_ c | +---------------------------+ | | | if content b has more content | | | slide down further |nt <-- <-- content b | v |

Android AlertDialog: TYPE_SYSTEM_ALERT -

i have tried out know , can find, still cannot alert dialog show type_system_alert. shows on app when open it, not pop if app not on front. i've got: final alertdialog.builder d = new alertdialog.builder(this); d.settitle("app name"); d.setmessage("message"); d.setpositivebutton("ok", null); d.seticon(r.drawable.ic_launcher); alertdialog dialog = d.create(); dialog.getwindow().settype(windowmanager.layoutparams.type_system_alert); d.show(); and have in manifest: <uses-permission android:name="android.permission.system_alert_window" /> what missing?? the function flow before alert following: broadcast receiver listens incoming sms messages. once received, passes message function in mainactivity using "runonuithread". the message parsed , alert dialog shown. why type_system_alert not working?? can see logcat message parsed ok still alert dialog not showing system alert. anyone? the required permis

CASE IN SQL SERVER WHERE CLAUSE -

i need query below contains case in clause declare @billback int set @billback=1 select coloumn1, coloumn2, coloumn3, [project_id] [purchase_details] (case when @billback = 0 [project_id] = 0 when @billback = 1 [project_id] != 0 end or [project_id] in (1, 2, 3) ) above query gives error, please me in different way based on positioning of case ... when , appears trying following: select colomn1, column2, column3, [project_id] [purchase_details] [project_id] in (1,2,3) or ((@billback = 0 , [project_id] = 0) or (@billback = 1 , [project_id] <> 0));

algorithm - How to find independent points in a unit square in O(n log n)? -

consider unit square containing n 2d points. 2 points p , q independent in square, if euclidean distance between them greater 1. unit square can contain @ 3 mutually independent points. find 3 mutually independent points in given unit square in o(n log n). possible? please me. can problem solved in o(n^2) without using spatial data structures such quadtree, kd-tree, etc? use spatial data structure such quadtree store points. each node in quadtree has bounding box , set of 4 child nodes, , list of points (empty except leaf nodes). points stored in leaf nodes. the point quadtree adaptation of binary tree used represent two-dimensional point data. shares features of quadtrees true tree center of subdivision on point. tree shape depends on order in data processed. efficient in comparing two-dimensional, ordered data points, operating in o(log n) time . for each point, maintain set of points independent of point. insert points quadtree, iterate through points , use

javascript - Access / process (nested) objects, arrays or JSON -

i have (nested) data structure containing objects , arrays. how can extract information, i.e. access specific or multiple values (or keys)? for example: var data = { code: 42, items: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }] }; how access name of second item in items ? preliminaries javascript has 1 data type can contain multiple values: object . array special form of object. (plain) objects have form {key: value, key: value, ...} arrays have form [value, value, ...] both arrays , objects expose key -> value structure. keys in array must numeric, whereas string can used key in objects. key-value pairs called "properties" . properties can accessed either using dot notation const value = obj.someproperty; or bracket notation , if property name not valid javascript identifier name [spec] , or name value of variable: // space not valid character in identifier names

php - how to pass multiple text box values in javascript variable? -

<input type="hidden" name="email" value="website_list"> <input type="hidden" name="name" value="john.doe@foo.com"> <input type="hidden" name="fname" value="john"> <script type="text/javascript"> var subscriber_details = { email : 'john.doe@foo.com', name : 'website_list', fname : 'john' } </script> i want pass hidden value in javascript variable in same manner "subscriber_details" . so should do? <script type="text/javascript"> var subscriber_details = { email : "'"+ document.getelementsbyname("email").value +"'", name : "'"+ document.getelementsbyname("name").value +"'", fname : "'"+ document.getelementsbyname("fname").value +"'" } &l

java - Hibernate multitenancy test fails with NPE -

i'm using schema based multi-tenancy providing implementations both multitenantconnectionprovider & currenttenantidentifierresolver. trying hibernate session single tenant fails npe. looking hibernate's source code, seems jdbcservicesimpl initializes connectionprovider null in else block private jdbcconnectionaccess buildjdbcconnectionaccess(map configvalues) { final multitenancystrategy multitenancystrategy = multitenancystrategy.determinemultitenancystrategy( configvalues ); if ( multitenancystrategy.none == multitenancystrategy ) { connectionprovider = serviceregistry.getservice( connectionprovider.class ); return new connectionproviderjdbcconnectionaccess( connectionprovider ); } else { connectionprovider = null; final multitenantconnectionprovider multitenantconnectionprovider = serviceregistry.getservice( multitenantconnectionprovider.class ); return new multitenantconnectionproviderjdbcconnectionaccess( m

c# - The function has a parameter that has a data type 'table type' which is not supported for the target .NET Framework. The function was excluded -

i trying pass table valued parameters through entity framework. know when imported stored procedure in entity framework gave me warning that "warning 1 error 6005: function has parameter has data type 'table type' not supported target entity framework version. function excluded." but still stored procedure imported , worked fine. did in vs2013 , entity framework 5.0. trying same in team foundation server in vs2012. shows me similar warning difference like the function has parameter has data type 'table type' not supported target .net framework version. function excluded. and time particular stored procedure not imported , not listed. can explain me why happening , how can work around it?? i have not resolved issue in vs2012 worked around using comma separated values instead of table valued parameters stored procedure , created split string function insert values table reference link http://stackoverflow.com/questions/14811316/separate-

compiler errors - Is there a rustc equivalent of -Wall -Werror? -

first 10 minutes learning rust, i'm given 58 lint options , i'm thinking: gcc has solution this. something go in .toml file? workaround? gcc’s -werror becomes rustc --deny warnings or crate attribute #![deny(warnings)] . -wall or -weverything aren’t necessary in rust; of sorts of things covered compilation errors or lints default deny or warn. should understand lints that: lints . matters @ least slightly, , very, subjective. lints allow default should so—they’re useful tools specific purposes, enabling lot of them doesn’t make sense. (the box-pointers lint, example: in type of library may wish able “i guarantee uses no heap memory”, it’s not that’s bad .)

javascript - Nesting ng-repeat on one element for filtering -

i have page built of tiles (imagine list of div's thumbnail , title) - each 'tile' can have several tags attributed them.. e.g: tile 1 has following tags: foo , bar , baz , quz tile 2 has following tags: foo , bar , baz tile 3 has following tags: bar , baz tile 4 has following tags: baz , quz .. , on.. at top of page there simple filter menu - each tag clickable in list. when clicking tag in filter menu e.g. foo , hide tile hasn't got foo tag attributed it. in case, tiles 3 , 4 removed view. each tile has following template, need extend incorporate tag filtering... <div ng-repeat="tile in tiles" class="col-md-2" ng-show="showfiles.filters[tile.filetype]"> <div class="sc-file-container"> <h3>{{tile.name}}</h3> // add image here </div> </div> very new angular way, in order use ng-hide/ng-show i've been creating arrays in controller $scope - see above, when sho

javascript - How to give Node.js server a command from php script? -

sorry bother you, i've been looking answers , couldn't find them anywhere... i'm fresh dude in field of javascript , node.js , here's problem: i've created application based on tutorial of socket.io - here's link completed project of chat example. working should, need trigger somekind of command while node server running... command should triggered via php script. the command should trigger emit event - every client in our case see new message sent via php. i saw couple of suggestions server php/using curl . problem don't know how fetch post data sent php node.js server. any solution command node php more welcome , again i'm sorry bother :) you can use bridge exchange data between nodejs , php. need implement php server exposes remote procedures , nodejs client calls remote procedures. can send data nodejs application php using these remote procedures. here few links started: http://bergie.iki.fi/blog/dnode-make_php_and_node-js

ios - Setting content offset of a UITableView not working when it's scrolling -

here's code // 1 func scrollviewdidenddragging(scrollview: uiscrollview, willdecelerate decelerate: bool) { scrolltableview() } // 2 @ibaction func buttonpressed() { scrolltableview() } // 3 func scrolltableview() { tableview.setcontentoffset(cgpointzero, animated: false) // tableview.scrollrecttovisible(cgrect(x: 0, y: 0, width: 1, height: 1), animated:true) // not work either } even method 1 (who calls method 3) being called, table view continues natural scrolling decelerating until stops. not position want. when table view not scrolling , call method 2 pressing button content offset set , positions should. how can work being called in method 1 ? thanks if got right following should work: func scrollviewwillbegindecelerating(scrollview: uiscrollview) { scrolltableview() }

c# - Validating an if-condition with bitwise operators -

i facing problem in dealing basic if else statement in c#. i have 2 variables of type uint. need check whether first variable in range of second one. also, first variable can have value null. output comes fine in case of put value first value. desired output fails in case put null in first variable i did in manner. using system; public class test { public static void main() { uint var1 = 0x00000000; uint var2 = 0x0ffffffa; if (!((var1 == null) || (((var1 != null) && (var1 & var2)) > 0))) console.writeline ("no"); else console.writeline ("yes"); } } the code when output coming no : using system; public class test { public static void main() { uint var1 = 0x00000000; uint var2 = 0x0ffffffa; if (!(((var1 != null) && ((var1 & var2) > 0)) || (var1 == null))) console.writeline ("no"); else console.write

Should database schema changes increment the major version in Semantic Versioning? -

semantic versioning 2.0.0 says: for system work, first need declare public api my web application not expose public api, uses database. can database schema considered public api , should change in database schema increment major version? according this answer yes . database schema can considered public api .

PHP sessions with shopping cart -

i modifying simple shopping cart learn. problem session arrays. have index page product page required using require statement show. i require cart.php (where cart summary located). when add product first time, not show on required cart.php . when add product, shows recent 1 in actual cart.php , shows 2 items in cart. does have idea going wrong? here have: <div id="leftcolumn"> <?php require("cart.php"); ?> <div id="rightcolumn"> <?php require($page . ".php"); ?> </div> thank you please try read documentations first before asking questions. please try implementing first , show code you're having problems with. example in w3schools: <?php // start session session_start(); ?> <!doctype html> <html> <body> <?php // set session variables $_session["favcolor"] = "green"; $_session["favanimal"] = "cat"

javascript - returning false not stopping the submission of form -

my purpose: if user field , password field blank, want stop form submitting. code trying: <!doctype html> <html> <head> <script> function doit() { var usr = document.getelementbyid('ur').value; var psw = document.getelementbyid('pw').value; if ((usr.trim() == '') && (psw.trim() == '')) { alert("cannot submit form"); return false; } } </script> </head> <body> <form action="post.php" method="post" onsubmit="doit()"> user: <input type="text" id="ur" name="user"> <br> <br> pass: <input type="password" id="pw" name="pass"> <br> <br> <button>submit</button> </form> &

c++ - E_INVALIDARG in D3D11 -

i have tried figure out why keep getting e_invalidarg error when running code. id3d11buffer * cbperobjectbuffer; cbperobject cbperobj; cbperobjectbuffer = 0; d3d11_buffer_desc cbbd; zeromemory( & cbbd, sizeof(d3d11_buffer_desc)); cbbd.usage = d3d11_usage_default; cbbd.bytewidth = sizeof(cbperobject); cbbd.bindflags = d3d11_bind_constant_buffer; cbbd.cpuaccessflags = 0; cbbd.miscflags = 0; cbbd.structurebytestride = 0; hr = device - > createbuffer( & cbbd, null, & cbperobjectbuffer); if (hr == e_invalidarg) { messagebox(0, l "[cbperobjectbuffer] invalid parameter passed returning function.", l "error", mb_ok); return; } else if (hr == e_outofmemory) { messagebox(0, l "[cbperobjectbuffer] out of memory", l "error", mb_ok); return; } else if (failed(hr)) { messagebox(0, l "[cbperobjectbuffer] unknown error occured", l "error", mb_ok); return; } i keep getting e_invalidarg error when runn

javascript - Compiling HTML string from directive at the time of loading the page -

in html: <vs-context-menu id="contextmenu" class="dropdown-menu pointer-cursor" context-menu-hide></vs-context-menu> in angular js directive: directive('vscontextmenu', function ($compile) { var defaulttemplate = '<ul style="list-style-type: none; padding-left: 20px;" ><li>aa</li></ul>'; return { restrict: 'e', link: function(scope, element, attrs) { element.html(defaulttemplate).show(); $compile(element.contents())(scope); } }; }); context menu showing on click fine. flashes @ loading of page. how hide @ loading of page? instead of rendering using link function, use template parameter of directive, not show flickering effect & add ng-cloak on element. directive directive('vscontextmenu', function($compile) { var defaulttemplate = '<ul ng-cloak style="list-style-type: none; paddi

javascript - JQuery display XSLT into my html page -

can me please? trying display result of transformed xslt existing page, transformation seem working, it's not displaying results when run html page. have tried run xsl independently , it's seem display correctly on own, leave me jquery. thank you this code: $(document).ready(function(){ displayresult(); }); function loadxmldoc(filename) { var deferred = $.deferred(); var promise = deferred.promise(); $.ajax({ url: filename, type: 'get', datatype: 'xml', success: function(data) { console.log("resolved"); deferred.resolve(data); }, error :function(v1, v2) }); return promise; } function displayresult(){ var xmlpromise = loadxmldoc("my.xml"); var xslpromise = loadxmldoc("my.xsl"); $.when(xmlpromise, xslpromise).done(function(xml, xsl){ if (document.implementation && document.implementation.createdocument) { var xsltprocessor = new xsltprocessor(); xsl

ajax - How to post to external url from rails app without using form -

i able post payment gateway using html form. got new requirement. now, on click of "payment" button, have validate whether item still available purchase , if available automatically post payment form gateway. so say, want execute rails controller code on button click , want redirect external url ( payment gateway ) params if validation succeed. i read, not possible post using redirect_to in rails. not possible post using ajax external url. how should achieve ? you can use ruby’s net::http this: require "net/http" require "uri" uri = uri.parse("http://example.com/search") params = {"foo" => "value one", "bar" => "value two"} # shortcut way response = net::http.post_form(uri, params) # more control http = net::http.new(uri.host, uri.port) request = net::http::post.new(uri.request_uri) request.set_form_data(params) response = http.request(request) puts response.code

node.js - EventEmitter memory leak on running MEAN app on AWS -

Image
i working on mean stack based application , when try host project on aws every thing goes , when run app server started on port 80 in command promt. when try run provided ip on browser start showing following error. possible eventemitter memory leak detected. 11 listeners added. use emitter. setmaxlistener() increate limit. i have tried set emitter.setmaxeventlistener didn't able resolve issue.

java - HttpUrlConnection: Cookies Show in CookieStore but not in the POST Header -

in code below running post request on website. dont understand why cookie shows via cookiemanager, not show in post header. see comments in code. can kindly explain missing? cookiemanager cm = new cookiemanager(null, cookiepolicy.accept_all); cookiehandler.setdefault(cm); ... connection = (httpurlconnection) url.openconnection(); connection.setrequestmethod("post"); outputstream outputstream = connection.getoutputstream(); outputstream.write(urlparams.getbytes(charset)); // clear cookies prove not old request. cm.getcookiestore().removeall(); if (connection.getresponsecode() != httpurlconnection.http_ok) throw new exception("invalid response code."); // no cookie prints here: log.d("aero", connection.getheaderfields().tostring()); list<httpcookie> cookies = cm.getcookiestore().getcookies(); (httpcookie cookie : cookies) { if (cookie.getname().equals("asp.net_sessionid")) { // cookie he

c# - Can anyone tell me if my unit test to this function is correct? -

the fillupwater function test follows? public bool fillupwater() { watertap tap = new watertap(); if (tap.fillupcontainer()) { level = 5; return true; } else { return false; } } public void fillupwater() { throw new notimplementedexception(); } my unit test: [testclass()] public class watercontainer { [testmethod()] public void whenwatercontainerisempty_fillingitup_causescorrectwaterlevel() // uppgift 4: vattenbehållaren fylls av { // vattenkranen automatisk om den är tom // arrange watercontainer waterc = new watercontainer(0); watertap tap = new watertap(); // act waterc= tap.fillupcontainer(); // assert assert.areequal(5, waterc.level); //assert.istrue(tap.fillupcontainer()); } } i can see few problems here. have placed each issue in comment... [testc

c# - Log off Remote Desktop Session on a non admin account programmatically -

i making tool displays remote desktop sessions , spesific process , show if process running on session. , need log off user. launch application right clicking , selecting "run admin", can't set requestedexecutionlevel admin because when don't have admin rights still have ability see sessions. i first tried disconnect session(but works when run application on admin account, right clicking , selecting "run admin" doesn't work): static public bool logoff(string sessionid) { process process = new process(); processstartinfo startinfo = new processstartinfo(); startinfo.windowstyle = processwindowstyle.hidden; startinfo.filename = "cmd.exe"; startinfo.arguments = "/c logoff " + sessionid; process.startinfo = startinfo; process.startinfo.verb = "runas"; process.start(); return true; } next tried using this(this works when account i'm running application on admin): static public b

nuget - TeamCity - Behind Proxy causing build failure -

Image
below error message getting trying build current project, behind enterprise proxy has happened morning after building fine past couple of months. the current installed version of nuget 2.8.3 , nuspec 3.0.0. i see says needs credentials has never happened before , not sure how around in teamcity. also other solutions building fine makes more confusing built on same template. okay, if less impatient , did tracking on check-ins, have noticed had checked in .nuget/packages.config. had dependencies on these packages above. i removed these .nuget/packages.config , resolved issue. hope if in future having similar issues too.

c++ - How to filter only the longest line after Hough Transform -

i'm using hough transform straight lines. there lot of lines detected. can know how filter , longest line output? houghlinesp(dst, lines, 1, cv_pi/180, 50, 20, 10 ); //left lane for( size_t = 0; < lines.size(); i++ ) { vec4i l = lines[i]; double theta1,theta2, hyp, result; theta1 = (l[3]-l[1]); theta2 = (l[2]-l[0]); hyp = hypot(theta1,theta2); line( cdst, point(l[0], l[1]), point(l[2], l[3]), scalar(255,0,0), 3, cv_aa); } imshow("detected lines", cdst); } as far can see, you're literally step away: the hypot function gives distance between start , end points. now, find longest such distance, , corresponding line longest. vec4i max_l; double max_dist = -1.0; for( size_t = 0; < lines.size(); i++ ) { vec4i l = lines[i]; double theta1,theta2, hyp, result; theta1 = (l[3]-l[1]); theta2 = (l[2]-l[0]); hyp = hypot(theta1,theta2); if (max_

javascript - How do I export multiple html tables to excel? -

i have webpage has 3 tables , i'd export 3 of them same excel file. i'd each table in own sheet, having them on same sheet ok well. after googling, i've seen exporting 1 table 1 excel sheet. var tablestoexcel = (function () { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/tr/rec-html40"><head><!--[if gte mso 9]><xml><x:excelworkbook><x:excelworksheets>' , templateend = '</x:excelworksheets></x:excelworkbook></xml><![endif]--></head>' , body = '<body>' , tablevar = '<table>{table' , tablevarend = '}</table>' , bodyend = '</body></html>' , worksheet = '<x:excelworksheet><x:name>' , wor

java - How to save space with maps -

i have store large amounts of data in maps , total size critical. number of maps high, size of each individual map small (<10 mappings of them) , maps not change after creation. i see 2 ways (let's assume know n mappings stored): use hashmap of initial size n , load factor 1 use arraylist of size n , store (key, value) pairs. implement get() method map is there better way (maybe guava immutablemap )? see perfect hash function for map no longer keys added, 1 go optimized hash function: array small feasible, , collisions minimal influence. besides academical treatises out there, hash function can build n different smaller functions/value entities, , optimal can found trying combination on data set. , varying array sizes. as area broad (like rehashing), search further, or yourself. if have gotten many values, taking same object instance instead of having many different objects equal. done identity map map<t, t> using first put key.

spring mvc - How to access normal java objects in FTL? -

i using spring 4 freemarker template. have helper class methods want access in ftl template file. don't want pass model. how can it? look @ this, can pass helper class: http://www.javawebdevelop.com/1389653/ // ftl public static templatehashmodel usestaticpackage(string packagename) { try { beanswrapper wrapper = beanswrapper.getdefaultinstance(); templatehashmodel staticmodels = wrapper.getstaticmodels(); templatehashmodel filestatics = (templatehashmodel) staticmodels.get(packagename); return filestatics; } catch (exception e) { e.printstacktrace(); } } // //data.put("list", list); data.put("helper",usestaticpackage("com.test.helper")); // ftl ${helper.method()}

How do I copy to the clipboard in JavaScript? -

what best way copy text clipboard? (multi-browser) i have tried: function copytoclipboard(text) { if (window.clipboarddata) { // internet explorer window.clipboarddata.setdata("text", text); } else { unsafewindow.netscape.security.privilegemanager.enableprivilege("universalxpconnect"); const clipboardhelper = components.classes["@mozilla.org/widget/clipboardhelper;1"].getservice(components.interfaces.nsiclipboardhelper); clipboardhelper.copystring(text); } } but in internet explorer gives syntax error. in firefox, says unsafewindow not defined . edit nice trick without flash: how trello access user's clipboard? browser support the javascript document.execcommand('copy') support has grown, see links below browser updates: ie10+ (although this document indicates support there ie5.5+). google chrome 43+ (~april 2015) mozilla firefox 41+ (shipping ~september 2015) ope

php - Insert into Select with group concat -

hi have table has values domain user groups test_at_test.com john first test_at_test.com mary second test_at_test.com john second etc.. i want group concat table , insert values new table or update current table dont have problem , have new table this domain user groups test_at_test.com john first,second test_at_test.com mary second i write following command error column count doesn't match value count @ row 1 insert newtable select * , group_concat(groups) from table group by user order domain your new table has 3 columns in select result set have 4 columns need specify columns in select statement insert newtable select `domain`, `user`, group_concat(groups) table group user order domain demo note result truncated maximum length given group_conc

javascript - Strange Angular-ChartJS issue, not displaying correctly in Ionic App -

i'm building ionic app angularjs. in app want line-chart of data. yesterday asked question ( angular-chart not rendering anything ) answered, there's new problem. sometimes chart instantly visible, when rotate screen between landscape/portrait keeps getting bigger every rotation. other times graph not visible @ (except legend) till rotate screen times. when check out web inspector on iphone see html-attributes height gets bigger everytime. same css-height style. the html in web-inspector looks this: (this when graph on inactive tab) <div ng-show="graph.visible &amp;&amp; finishedloading" class="ng-hide" style=""> <div class="chart-container"><canvas class="chart chart-line" data="graph.data" labels="graph.labels" options="graph.options" series="graph.series" colours="graph.colours" getcolour="graph.getcolour" click="graph.click&

ios - UI Page View Controller Scroll Won't Scroll Backwards -

i have implemented uipageviewcontroller want able scroll infinitely right (as in user swipes left) , able scroll backwards in other direction way start. don''t want user able scroll left (as in user swipe right) on first page, though have 3 pages loop, how can this? i have figured out how make infinite scroll 3 view controllers right ( in user scrolls left) when user tries scroll left (as in user swipes right) bugs out , screen goes white? can improve on code user can infinitely scroll both ways, not one? , if possible prevent user scrolling backwards on first panel? thanks. pageviewcontroller.h #import <uikit/uikit.h> @interface pageviewcontroller : uipageviewcontroller <uipageviewcontrollerdelegate, uipageviewcontrollerdatasource> @end pageviewcontroller.m #import "pageviewcontroller.h" @interface pageviewcontroller () @end @implementation pageviewcontroller { nsarray *myviewcontrollers; } - (void)viewdidload { [super vie