Posts

Showing posts from February, 2012

Remove a space before an argument, while adding '(' and ')' with VIM surround -

using vim plugin vim-surround pretty extensively, , happy it. however, there 1 replacement witch haven't found nice shortcut. the usage case, following. need : def function argument to become (when cursor in middle of 'argument') def function(argument) my attempts didn't fulfil need: i have try ysiw) => def function (argument) # don't space after function ysaw) => def function( argument) # don't space before argument since, there shortcut vim, asking communitity me satisfy style obsession... without vim on hand, think nmap <f6> f xyse) or nmap <f6> ysiw)f x should trick.

javascript - revert object and its properties -

i have object var obj = { prop1 : { dummy1 : 0, dummy2 : 0, dummy3 : 0 }, prop2 : { dummy1 : 0, dummy2 : 0, dummy3 : 0 } }; and need revert dummy becomes object , props becomes it's properties. so need object this var obj = { dummy1 : { prop1 : 0, prop2 : 0 }, dummy2 : { prop1 : 0, prop2 : 0 }, dummy3 : { prop1 : 0, prop2 : 0 } }; sorry if stupid question, i'm tired , stuck on this. every appreciated , reworded. this achievable 2 for..in loops var obj = { prop1 : {dummy1 : 0, dummy2 : 0, dummy3 : 0}, prop2 : {dummy1 : 0, dummy2 : 0, dummy3 : 0} }; // start of interesting code var a, b, o2 = {}; (a in obj) (b in obj[a]) { if (!o2[b]) o2[b] = {}; // if o2 doesn't have yet, make new obj o2[b][a] = obj[a][b]; // swap } o2; /* { "dummy1": {"prop1": 0, "pr

Leaflet Layer Control: select Layer inside Layer Group? -

i have leaflet layer control can select 1 of base layers, , have base layer layergroup can select sublayers display. i'm thinking of setup click radio button select base layer (the layer group), , under see list of checkboxes layers within show. there way using stock layer control? i looked examples , thumbed through leaflet api didn't find this. there no leaflet support layer hierarchies beyond layergroup level. use leaflet.groupedlayercontrol plugin achieve basic grouping in layer control panel, not actual hierarchy.

asp.net - Gridview change select row to an image? -

is possible change gridview select column image? when user clicks on select opens pdf gridview. possible instead have small pdf icon instead of select link? @ same time still able call: protected sub gridview1_selectedindexchanged(sender object, e eventargs) handles gridview1.selectedindexchanged convert select column templatefield , change button inside imagebutton . make sure command="select" stays, because that's gridview uses fire , handle selectedindexchanged event.

asp.net mvc 4 - how to get user info in Forms Authentication Across Applications? -

i have application on main domain user can login domain , authenticate across sub domain use form authentication , works fine. but not know how retrieve users information on sub domain . must have user id or somethings use retrieve user information sql server. how can handle scenario , transfer useful information use on sub domains retrieve user information? my application on mvc4 razor , .net 4.5. if user can authenticate across of subdomains, , leveraging forms authentication, can username in subdomains same way can in main domain: httpcontext.current.user.identity.name

java - Should ServletResponse isCommitted Always Be Checked Before Modifying The Response -

the title speaks itself, valuable check iscommitted() on type servletresponse ? particular example in using filter following if user isn't authorized perform action (csrf checks specific): if (!httpresp.iscommitted()) { httpresp.senderror(httpservletresponse.sc_unauthorized); } in case, feels overkill i've checked response. filter @ top of chain, there should nothing before commit response (let alone allow filter chain continue if did), can't feel assumption in name of defensive programming shouldn't making. feel it's practice check status of response. so, of being said, valuable check response @ point in time? , maybe extend further, practice check every time response modified? in case, can hardly find reason support other exception being thrown when csrf token not match (assuming happen in attack scenario). in general, based on when code executed know response has not been committed. not add check everywhere. some places add it:- a

android - CameraUpdateFactory zoom to does not zoom map -

i have method zooms map user's specified zoom level not zoom using cameraupdatefactory.zoomto(9f); however zoom correctly if this cameraposition position = new cameraposition.builder().target(location).zoom(9).build(); map.animatecamera(cameraupdatefactory.newcameraposition(position)); but requires have location zoom to. according docs looks access zoomto method statically when nothing happens. am using first method incorrectly? the method cameraupdatefactory.zoomto not directly alter map, instead returns cameraupdate value . value have new zoom level set , other parameters target, bearing, etc retained are. value take effect, need apply cameraupdate map using animatecamera(cameraupdate) or movecamera(cameraupdate)

asp.net mvc - Using ModelBinder from action -

i'm using third party reporting engine (stimulsoft) calls action on controller via post. inside of form, many fields sent mechanics of third party. inside of action need parameters parameters inside of url. i want able use model binder inside of action. at moment i'm getting each fields 1 one using methods var querystring = httputility.parsequerystring(request.urlreferrer.query); var preparedby = querystring["preparedby"]; var preparedat = (querystring["preparedat"] != null) ? convert.todatetime(querystring["preparedat"]) : datetime.today; i prefer use model , binding using urlreferrer. i've created urlreferrervalueprovider bind action. i've tried that, i'm getting nullreferenceexception on binder.bindmodel line public class urlreferrervalueprovider : namevaluecollectionvalueprovider { public urlreferrervalueprovider(controllercontext controllercontext) : base(httputility.parsequerystring(controllercontext.http

Making string of 2-d array in scala -

so have following in scala: scala> val example = "hello \tmy \nname \tis \nmaria \tlee".split("\n").map(_.split("\\s+")) example: array[array[string]] = array(array(hello, my), array(name, is), array(maria, lee)) i want take each 1-d array , make string, , make array of these strings (strings should comma separated). how do this? scala> example.map(_.mkstring) res0: array[string] = array(hellomy, nameis, marialee) to make strings comma separated: scala> example.map(_.mkstring(",")) res0: array[string] = array(hello,my, name,is, maria,lee)

CPAN error message -

i trying use cpan, when typed in following command. errors occurred. similar question asked in forum( install cpan module ), tried solution, did not work me. wondering if can drop hint? perl -mcpan -e shell your configuration suggests cpan.pm should use working directory of /home/bq/.cpan unfortunately not create lock file /home/bq/.cpan/.lock due 'permission denied'. please make sure configuration variable $cpan::config->{cpan_home} points directory can write .lock file. can set variable in either cpan/myconfig.pm or cpan/config.pm in @inc path; try: sudo perl -mcpan -e shell

java - Error creating bean with name 'entityManagerFactory' -> Cannot parse persistence unit from class path resource [META-INF/persistence.xml] -

i have problem in j2e application , can't find solution. build successful there thrown runtime exception. tried many advices google nothing can solve problem. severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in servletcontext resource [/web-inf/datasource-config.xml]: invocation of init method failed; nested exception java.lang.illegalargumentexception: cannot parse persistence unit class path resource [meta-inf/persistence.xml] entitymanagerfactory in data-source <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/s

Implementing Test instead of extending TestCase in Junit [Java] -

i have class c must extend class n because provides functionality must have. want c junit test want extend testcase, because using test executor, junit suite object, requires tests being added of type testcase. means have use testcase extension. java, however, not allow multiple inheritance, need to, instead, use interface. there existing interface? or there way dynamically execute junit tests don't extend testcase? i don't extend test or testcase anymore. use @test annotations since version 4.4.

Excel Macros Searching a Cell for Contents and adding them if they are not there (for filepath) -

i working on macro info files , want multiple ways of accessing files (because of less computer literate coworkers have, used existing file) i attempting check cell value see if ends in /report01.xls , , if not add text (obviously said in code cell c1). i have code can add text (the second set of code), unsure appropriate if else statement should used check see if cell contains /report01.xls sub macro1() filepath = application.getopenfilename("excel files(*.xls), *.xls") if filepath <> false range("c1").value = filepath end if 'uses file path data **(wanting insert code here said above)** workbooks.open filename:=worksheets("sheet1").range("c1").value end sub 'code add text end of file path range("c1").select dim c range each c in selection if c.value <> "" c.value = c.value & "/report01.xls" next

java - How can I specify the current schema for sql server in a jboss data source url? -

i've got sql queries this select user_id table_user lower(email_address)=? , password=? the schema application updated don't want update every sql query in application. there way specify current schema jboss connection end? old connection: jdbc:sqlserver://myserver:1433;databasename=db tried: jdbc:sqlserver://myserver:1433;databasename=db;currentschema=abc i tried using currentschema didn't help, missing object exception when run queries (since assume these looking under dbo). there way around updating queries since know queries run on schema abc ? these available connection properties microsoft jdbc 4.0 driver. don't see currentschema in list, , haven't seen driver allows specify particular schema in connection string. since don't want update sql schema, create synonyms in default (dbo) schema each object. example: use tempdb; go -- create test schema create schema test authorization dbo; go -- create table in test schema create

linux - ldapmodify - can't add members to AD group -

i'm wanting add members ad distribution group. enter following command (putting in dummy values in places): ldapmodify -v -h 111.111.111.11 -d "cn=binding_user,dc=example,dc=com" -x -w password -f entrymods the file 'entrymods' contains: dn: cn=group_name, ou=groups, dc=example, dc=com changetype: modify add: member member: cn=smith\, john, ou=users, dc=example, dc=com i'm getting following output: ldap_initialize( ldap://111.111.111.11 ) warning: no attributes change or add (entry="cn=group_name, ou=groups, dc=example, dc=comchangetype: modifyadd: membermember: cn=smith\, john, ou=users, dc=example, dc=com") modifying entry "cn=group_name, ou=groups, dc=example, dc=comchangetype: modifyadd: membermember: cn=smith\, john, ou=users, dc=example, dc=com" modify complete ldap_modify: invalid dn syntax (34) additional info: 00000057: ldaperr: dsid-0c090a5b, comment: error processing name, data 0, vece find user wit

c# - QuickBooks Intuit IPP Issue Check -

i attempting issue check vendor through intuit.ipp api (interop.qbfc12) using following code: imsgsetrequest messageset = session.createmsgsetrequest("us", 7, 0); icheckadd cheque = messageset.appendcheckaddrq(); cheque.accountref.listid.setvalue(vendor.listid.getvalue()); cheque.accountref.fullname.setvalue("myaccountname"); cheque.txndate.setvalue(datetime.today); imsgsetresponse responseset = session.dorequests(messageset); iresponse response = responseset.responselist.getat(0); responsetype = (enresponsetype)response.type.getvalue(); if (responsetype == enresponsetype.rtcheckaddrq) returnmessage = response.statusmessage; the resulting response.statusmessage = "object 80000005-1374598713 specified in request cannot found. " object id specified listid pulled vendor. i'm coding pretty blind i'm not finding ipp documentation helpful or date version 12. what missing? this: cheque.ac

asp.net - Why am I getting a different in div location? -

so i've created image tagger saves coordinates the database, , call coordinates erb block on main page displays div @ said location (.tagged). when tags displayed on main page, not in location in when tagged them in connections page. have ideas why is? in advance. main page results image tagger on connections page erb on main page: <% if @new_manual.present? %> <% n = 0 %> <% @new_manual.steps.each |step| %> <% n += 1 %> <% i_connection = contact.find(step.input_contact) %> <span class="i_contact i_contact<%= n %>" data-pos-x="<%= i_connection.pos_x %>" data-pos-y="<%= i_connection.pos_y %>" data-pos-width="<%= i_connection.pos_width %>" data-pos-height="<%= i_connection.pos_height %>" ="spanid<%= n %>" data-index="<%= n %>"></span> <% o_connection = contact.find(step.output_contact) %>

ruby - Best approach for deleting when using Array.combination()? -

i want compare every object in lectures each other , if some_condition true, second object has deleted: todelete=[] lectures.combination(2).each |first, second| if (some_condition) todelete << second end end todelete.uniq! lectures=lectures-todelete i got weird errors while trying delete inside .each loop, came approach. is there more efficient way this? edit after first comments: i wanted keep source code free of unnecessary things, ask: elements of lectures array hashes containing data of different university lectures, name, room,the calendar weeks in taught , begin , end time. i parse timetables of student groups data, because lectures held in more 1 student group , these differ in weeks taught, compare them each other. if compared ones differ in values, add values second object first object , delete second object. that's why. the errors when deleting while in .each-loop: when using rails hash.diff method, got "cannot convert symbol integer&q

php - Difference between PECL GearmanWorker::addFunction() and GearmanWorker::register() -

so, i'm assuming addfunction() registers "worker function name" w/ server , tells worker callable registered name refers to. http://www.php.net/manual/en/gearmanworker.addfunction.php register() , on other hand, seems register function name w/ job servers. http://www.php.net/manual/en/gearmanworker.register.php guess i'm not understanding why behind ever having worker register function w/ server has no callable for. also, need call register() addfunction() , or assumption above correct addfunction() register w/ server well?

android - Best way to fetch and resize bitmap from phone storage -

it seems there few different ways bitmap storage on phone. i'm reading data images using mediastore query , save both path , imageid in memory. later if want upload small thumbnail of image can either: 1) query mediastore micro/mini kind of thumbnail based on image id, create scaled bitmap fit exact needs (if micro/mini not correct size) bitmap bm = mediastore.images.thumbnails.getthumbnail(context.getcontentresolver(), imageid, mediastore.images.thumbnails.mini_kind, null); bitmap.createscaledbitmap(bm, (int)newwidth, (int)newheight, true); or 2) fetch bitmap file location , create scaled bitmap that bitmap bitmap = bitmapfactory.decodefile(url); bitmap.createscaledbitmap(bitmap, (int)newwidth, (int)newheight, true); i doing #1 because figured thumbnail generation quick mediastore make createscaledbitmap process finish quicker rather creating scaled bitmap fullsize image. there best way or difference negligible? i'm not expert, think difference b

What happens when we send a random byte via UDP to an opened TCP port at another machine? -

what happens when send random byte via udp opened tcp port @ machine? received pc turns sender byte or bytes? happens when try send packet non opened tcp port @ pc? the operation describe impossible. can't send udp datagram tcp port @ all, whether . ergo nothing can possibly happen. open , closed has nothing it, , neither local or remote.

r - Sub Column Names on Grid Extra -

Image
i'm trying create table using gridextra package in r , , want have sub column names under general column name. example have 1 large column titled "urbana-champaign" spans on 2 smaller column names "element" , "number of genes." have looked everywhere on gridextra support site can't seem find way create overall column names encompass subcolumns. know how? it's rather easy basic gtable, , add new text it, you'd have add formatting , styling of cells. that's give -- way many parameters , options take care of. library(gtable) gtable_add_grobs <- gtable_add_grob #misleading name d <- head(iris, 3) extended_matrix <- cbind(c("", rownames(d)), rbind(colnames(d), as.matrix(d))) all_grobs <- matrix(lapply(extended_matrix, textgrob), ncol=ncol(d) + 1) row_heights <- function(m){ do.call(unit.c, apply(m, 1, function(l) max(do.call(unit.c, lapply(l, grobheight))))) } col_widths <- function(m){

actionscript 3 - Can't display video coming in from NetStream properly -

i starting work flex , netstream video calls. able read bit netstreams , streaming , wrote code camera , publish stream in video display below in view though pass through methods without error, display not showing don't know what's going on. here did. <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" applicationdpi="160" creationcomplete="start();"> <fx:script> import flash.media.camera; import flash.media.video; import flash.net.netconnection; import flash.net.objectencoding; import flash.events.asyncerrorevent; import flash.events.netstatusevent; import flash.net.netstream; import mx.graphics.imagesnapshot; import mx.graphics.codec.jpegencoder; public var camera:camera; var video:video; pub

cmd - MeshLab: processing multiple files in meshlabserver -

i'm new using meshlabserver , meshlab in general. created .mlx file , tries run command in meshlabserver 1 file , worked. know how write command hundreds of files? thanks in advance. i've created batch file necessary loops , calls .mlx file run meshlabserver command. 1 should know resulting files saved in same directory meshlabserver.exe is.

php - Text field data from PayPal button payment is not grabbed in Classic API NVP transaction details call -

i'm calling gettransactiondetails nvp using code list of paypal transactions the html paypal button likes <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="xxxxxxxxxxxxx"> placeholder value <table> <tr><td><input type="hidden" name="on0" value="tier selection">tier selection</td></tr><tr><td><select name="os0"> <option value="tier 1">tier 1 $15.00 usd</option> <option value="tier 2">tier 2 $30.00 usd</option> <option value="tier 3">tier 3 $50.00 usd</option> <option value="tier 4">tier 4 $200.00 usd</option> <option value="tier 5">tier 5 $50

javascript - Jscript + jquery + an example of basic difference -

i new learning js , better understanding of concept, apologies in advance ignorance or simplicity of question. trying build simple quiz game learn javascript. basically trying understand difference between these 2 versions: javascript example jquery example basically trying understand difference in these 2 lines: javascript document.getelementbyid("question").innerhtml = "<b>question " + questionindex +"</b>: " + allquestions[0][questionindex-1]; jquery $("#question").text("<b>question " + questionindex +"</b>: " + allquestions[0][questionindex-1]) the javascript version display "question x:" in bold won't in jquery version. why? , how make jquery version bold part work? or other advice in general on this? tks .text() sets text, not html. use .html() instead: $("#question").html("<b>question " + questionindex +"</b>

How to setup trackPageview on the New Google Analytcis? -

we've used analytics trackpageview this: var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-1']); _gaq.push(['_trackpageview', '/step1']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); however, in new analytics, script isn't formatted same way , i'm bit confused how/where should add in trackpageview code. (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytic

php - Rename image according to selected option in form? -

pretty simple question. have select option box made in html when option selected renames uploaded image according name of option. when uploading image s3, needs add rename. this: $actual_image_name = $hoteldir . '-' . date("y-m-d_h:i:s"). "_" . $size . ".".$ext; where $hoteldir room type or whatever set too. here list example wants see it. <select class="typeselect" name="roomtype" id="typeselect" required="true"> <optgroup label="main areas"> <option value="ext" name="ext">exterior</option> <option value="grm" name="grm">guest room</option> <option value="lby" name="lby">lobby</option> <option value="

solrnet - Solr: How to create Facets based on tags -

if have @ following links, camers faceted mega pixels. flash memory faceted memory size. http://www.pricegrabber.com/cameras/digital/p-48/ http://www.pricegrabber.com/computers/flash-memory/p-152/ i guess based on tags assigned each product? ideas how create such facets automatically on runtime? or thinking in wrong direction. how different facets created different products? or predefining everything? p.s. using solr in c# solrnet. the easiest way use dynamic fields , generate facet dynamic fields.

codeigniter - Query error in code igniter ( wrong escape ) -

i try insert row in table on code igniter array, going wrong. that's array: array ( [date] => 2001-08-15 [number] => 962883 [time] => 17:40 [etc1] => 0 [etc2] => 0 ) and insert: $this->db->insert('mytable', $myarray); a new line inserted, columns empty! trying find de error, printed last query echo $this->db->last_query() ." <br>"; and got: insert `mytable` (`date`, `number`, `time`, `etc1`, `etc2`) values ('\02\00\00\01\0-\00\08\0-\01\05\0', '\09\06\02\08\08\03\0', '\01\07\0:\04\00\0', '\00\0', '\00\0') for reason can not get, codeigniter ( or php ) wrongly escaping values. any idea? firstly change array this: $data_array = array ( 'date'=> 2001-08-15 'number' => 962883 'time' => 17:40 'etc1' => 0 'etc2' => 0 ); $thi

java - How to match regex over multiple lines -

this question has answer here: match multiline text using regular expression 3 answers i have body of text , trying find character sequence within it. string.contains() not work im trying use string.matches method , regular expression. current regex isn't working. here attempts: "1stline\r\n2ndline".matches("(?im)^1stline$"); // returns false; expect true "1stline\r\n2ndline".matches("(?im)^1stline$") // returns false "1stline\r\n2ndline\r\n3rdline".matches("(?im)^2ndline$") "1stline\n2ndline\n3rdline".matches("(?im)^2ndline$") "1stline\n2ndline\n3rdline".matches("(?id)^2ndline$") how should format regex returns true? you need use s flag (not m flag). it's called dotall option. this works me: string input = "1stline\n2ndl

elasticity - scrollView layout in android -

i have problem when design layout in android. is: in layout, have 2 components. it's header , content. don't know when scrollview content. header elasticity. this detail restaurant in foodspotting app. can suggestion or show me ? need ! ! thanks ! ! http://www.javacodegeeks.com/2013/06/android-listview-pull-to-refresh.html you can try , maybe thats working .. :)

io - Does it make any sense that I use multi processes to insert data to MySQL? -

i need insert 300 millions data records mysql, wonder make sense use multi-processes make ? situation 1 : 300 millions records insert 1 table. situation 2 : 300 millions records insert multi tables. what bottlenecks on these 2 situations ? the data source 800+ txt files. i know there's command load data infile , want understand question. :d since have lots of data consider using load data . it's the fastest method of importing data files according mysql docs. load data infile load data infile statement reads rows text file table at high speed . speed of insert statements when loading table text file, use load data infile. this 20 times faster using insert statements. see section 13.2.6, “load data infile syntax”. ... insert still slower loading data load data infile , when using strategies outlined. load data infile '/path/to/your/file.csv' table table_name fields terminated ',' lines terminated '\

Have IntelliJ determine if code is only used by tests -

can intellij's code analysis options configured can tell me if code used tests (mostly unit tests) can remove dead code project. specify scope of analysis "project production files", , untick "include test sources". skip unit tests in folders labeled "test".

how to minify a ruby file -

as know, there lot of tools or library minify javascript, css, there tool or library minify ruby file? after searching in google, there no right answer question. thanks lot. use jruby! when packaging application war or jar can pass compiled flag compile .rb files java's .class bytecode file warbler documentation

javascript - How to observe on properties and clear them on reload -

i'm reloading data view every 4 seconds this var app = ember.application.create({ ready: function() { setinterval(function() { app.quotes.find().reload }, 4000); } }); and i'm fetching value in view this: <blockquote> {{#each model}} <p>{{message}}</p> {{/each}} </blockquote> question every 4 seconds new request fired off rest api grab new quote. however, new quote getting appended existing quotes. how can overwrite old quotes , display new, changed, value? see ember model reloading in interval , possibly make minor change: didload: function(){ var self = this; setinterval(function() { self.clear(); // <- clears out existing record self.reload(); }, 4000); } it's bit odd me doing in ember.application object instead of array controller. there reason doing this?

iOS create touch event programmatically -

my goal make gesture event programmatically. for example, there uiwebview, in code: mywebview.gestureleft(5); webview scroll left 5 pixels when touch left 5 pixels didnt touch on webview. is possible? now...i going implement when shake phone, webview's content shake. but dont need use call javascript functions. please me. thanks.

java - Libgdx: random image, like slide show for a loading screen -

i wanted create loading screen present random image , switch/transition other. ask suggestion on how should implement loadscreen random images? there 2 methods can remember right now. in first method have load random images , while assetsmanager loads assets , pick image on random , display period of time , switch other image. in second method if random images loaded using assets manager use method assets.manager.isloaded(filename) know if random image loaded or not. if loaded draw else draw previous image only. and essa rebano , have repeatedly told u in previous questions provide more information . in question should have posted research work have done problem , stuck in .. becomes difficult know how know , wot problem lies. hope u understand . if there not able understand in above sol. welcome ask :)

uniqueidentifier - How to Read Java card Image Number(CIN) within Applet -

i new java card development.i want read uid within applet.then there no way read card uid within applet.then read global platform documentation.they there unique key called card image number(cin).i don't know cin , used jcop 31(2.1.1) java card development.can tell me how use cin , main difference between uid , cin. thanks

jquery - Undefined index: posts_start on one localhost machine, but not on another? with Laravel 4 -

i have been trying set "load-more" functional widget, , successful earlier today on localhost. however, on computer (same mac os, mamp, etc...), getting error session variable: undefined index: posts_start. in javascript, these relevant lines: <?php $number_of_posts = 2; ?>; //<?php $_session['posts_start'] = $_session['posts_start'] ? $_session['posts_start'] : $number_of_posts; ?>; <?php $_session['posts_start'] = 2 ?>; var start = <?php echo $_session['posts_start']; ?>; this using laravel 4, have session running current user (no need use session_start()). not sure why isn't working on machine, working on another. thoughts? thank you. i use laravel's session library. lib can handle situations beautifly... var start = <?=session::get('posts_start', 2) ?>; // or this, if use blade syntax var start = {{ session::get('posts_start', 2) }}; what call do?

Which tool allows to generate such nice source code pictures? -

Image
examples below. pretty sure there online free tool can it. lost link :( may has link? http://habrastorage.org/storage2/c43/58e/013/c4358e0133268ad6afa9a9f9ef11c4af.png this can done tool: http://instacod.es/

Why does my homebutton doesn't resize according to my CSS attribute? -

this how link css entire masterpage in visual studio <link rel="stylesheet" href="css/style.css" type="text/css" /> this how homebutton being created. <div id="homebutton"> <input type="image" src="image/logo.jpg"> </div> and how css like #homebutton { position:absolute; left:0%; top:0%; margin: 0px; height:70px; } however, when change height pixel, homebutton's size still remain same. still dont know why. because changing height of div.. must change height of input #homebutton input[type=image] { height:80px; }

Python inspect.getcomments(module) doesn't return the first comment if it's a shebang -

when python file contains shebang ( #!blabla ), function getcomments module inspect doesn't return it. can shebang module object? the shebang valid if first line of file ... so, seems like: import module fname = module.__file__ open(fname) fin: shebang = next(fin) of course, i've jumped on bunch of subtleties ... (making sure first line comment, making sure we've grabbed .py file instead of .pyc file, etc.). checks , substitutions should easy enough make though if want make more robust. and, suppose alternative using __file__ magic use inspect.getsourcelines : shebang = inspect.getsourcelines(module)[0] if not shebang.startswith('#!'): pass #not shebang :)

java - Unable to add multiple String arrays into array using apache commons ArrayUtils -

i'm trying add multiple string arrays single array using apache commons arrayutils below it's saying unable convert serializable array string array // assigning strings arrays string str1[] = {"hello"}; string str2[] = {"test1"}; string str3[] = {"test2"}; string str4[] = {"hello"}; string str5[] = {"test4"}; string str6[] = {"hello"}; //joining string arrays string[] allarrays = arrayutils.addall(str1, str2, str3, str4, str5,str6); you can use arrayutils.addall in 2 ways: string[] arr1 = {"hello", "bye"}; string[] arr2 = {"good", "bad"}; string[] usage1 = arrayutils.addall(arr1, arr2); string[] usage2 = arrayutils.addall(arr1, "new item", "another item"); the first parameter array. second parameter can either array or single items append first array.

android - How to avoid the API level check on XML files? -

i want add card flip animation shown google in their documentation between 2 activities. project targets api level 10 can't add xml animation files projects res/anim folder because android:interpolator="@android:interpolator/accelerate_decelerate" isn't supported in project target api level. i wouldn't mind if visual enhancement works in devices support animation. how can use animation devices support animation if can't add animation file won't compile because of api level check. you can, probably, copy accelerate_decelerate.xml sdk/platform/... project , use if api level allows that.

ibm mq - Logging MQ Messages -

i want log messages come mq queue database/file or logging queue , can not modify existing code. there methods implement kind of message logging utility act http sniffer? or maybe mq have built-in finctionality log messages? thanks in advance ansers. i think possible creating alias queue points topic. assuming recv.q queue application receives messages , processes. 1) first create topic, log.to.database . 2) create alias queue alias.log.to.database base object set log.to.database , set base type topic . 3) create local queue log.to.database.q 4) create durable subscription, sub.for.recv.q points recv.q destination. 5) create durable subscription sub.for.log.to.dabase points log.to.database.q destination now sender application need put messages alias.log.to.database . since alias queue points topic, messages gets published onto log.to.database . topic have 2 subscriptions registered, both same message. consumer application continue work whereas new appl

asp.net mvc 4 - How to permanently teach Visual Studio to detect my debugging information? -

Image
using visual studio 2012, maybe you've seen message, too: it says: the following module built either optimizations enabled or without debug information: c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\6dce49fa\6c454827\assembly\dl3\95d61873\9871ffdd_4288ce01\noedownloadbereichweb.dll to debug module, change project build configuration debug mode. suppress message, disable 'warn if no user code on launch' debugger option. in past got maybe once week when starting debug asp.net application , resolved recompiling solution. recently switched iis express happens every second/third time want debug code after did changes. i resolve 1 or of following steps: rebuild application (helps of time) close iis express , rebuild application reboot windows 8 , rebuild application i've found similar questions here , on google , still not able permanently resolve this. my question: can imagine causes behaviour eve

Error connecting to local installation of MongoDB thru terminal -

terminal displays following error: $ mongo mongodb shell version: 2.4.5 connecting to: test wed jul 24 14:26:45.779 javascript execution failed: error: couldn't connect server 127.0.0.1:27017 @ src/mongo/shell/mongo.js:l112 exception: connect failed upon running mongod run --config /usr/local/etc/mongod.conf i following error on console: about fork child process, waiting until server ready connections. forked process: 11204 output going to: /usr/local/var/log/mongodb/mongo.log error: child process failed, exited error number 100 the mongo.log shows: ***** server restarted ***** wed jul 24 14:39:57.360 [initandlisten] mongodb starting : pid=11204 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=59.161.67.13.del-cdma.dialup.vsnl.net.in wed jul 24 14:39:57.363 [initandlisten] wed jul 24 14:39:57.363 [initandlisten] ** warning: soft rlimits low. number of files 256, should @ least 1000 wed jul 24 14:39:57.363 [initandlisten] db version v2.4.5 wed

is dlopen use inside a static library in iOS allowed -

i working fat static library uses dlopen() load interal modules(.so) files inside static library. on stackoverflow, developers says dlopen() private api. in case fine use dlopen() or being private api shouldn't used in user libraries irrespective of library nature i.e static/dynamic. if can't use dlopen() can point resource alternative way accomplish same task. note: regarding baresip bsd library. ( http://www.creytiv.com/ ) update: library first trying load configured modules statically , if fails trying load them dynamically using dlopen(). removing dynamic loading code resolve problem. dlopen not allowed on ios versions < ios 8. see e.g. here .

jquery - How make $.ajaxSetup rely on a backbone.js model initialized later -

i have following backbone.js application initialization process : var app = { init: function(arg) { $.when(app.loadstaticfiles('any_file_to_load_before')) .done(function(args) { app.models.current_user = app.models.user(); }); // ... // initializing backbone app , models // ... $.ajaxsetup({ headers: {authorization: 'token token=' + app.models.current_user.get('token')} }) } } $(document).ready( function(){ app.init(args); }; ); then when application initialize $.ajaxsetup evaluates app.models.current_user.get('token') sadly not defined. i guess there missconceptions in design, how should rewrite code in order make work ? i think main problem evaluation of $.ajaxsetup() before $.deferred resolution. deferreds meant control order of application's processes. reading question, seems application's order needs be: app.loadstaticfiles('any_file_to_load_befor

android - How to get item height of ListView without using OnItemClickListener? -

i use piece of code vertically center selected item of listview; @override public void onitemclick(adapterview<?> adapter, view v, int position, long id) { m_listview.smoothscrolltopositionfromtop(position, (m_listview.getheight() - v.getheight()) / 2, 100); } there no problem this. problem can't center default selected item because can't neither listview height nor item height. what tried; creating views inflater (returns 0 height) running performclick() method on default selected item (does nothing, throws no exception) so can do? note: item heights equal. take code: // int totalheight = 0;//it listview height (int = 0, len = listadapter.getcount(); < len; i++) { view listitem = listadapter.getview(i, null, listview); listitem.measure(0, 0); int list_child_item_height = listitem.getmeasuredheight()+listview.getdividerheight();//item height totalheight += list_child_item_height; // }

c++ - Understanding SFINAE -

as far know, sfinae means substitution failures not result in compilation errors, remove prototype list of possible overloads. what not understand: why sfinae: template <bool c, typename t = void> struct enable_if{}; template <typename t> struct enable_if<true, t> { typedef t type; }; but not? template <bool c> struct assert; template <> struct assert<true>{}; from understanding, underlying logic identical here. question emerged comments this answer . in c++98, sfinae done either return type or function's dummy argument default parameter // sfinae on return type functions fixed arguments (e.g. operator overloading) template<class t> typename std::enable_if< std::is_integral<t>::value, void>::type my_function(t const&); // sfinae on dummy argument default parameter functions no return type (e.g. constructors) template<class t> void my_function(t const&, std::enable_if< std::is_integral&l

How does slf4j bind to implementation? Does it really do so during compile time? -

in documentation slf4j says binding happens during complie time: "slf4j not rely on special class loader machinery. in fact, each slf4j binding hardwired @ compile time use 1 , 1 specific logging framework. example, slf4j-log4j12-1.7.5.jar binding bound @ compile time use log4j. in code, in addition slf4j-api-1.7.5.jar, drop 1 , 1 binding of choice onto appropriate class path location. not place more 1 binding on class path. here graphical illustration of general idea." http://www.slf4j.org/manual.html how work? from have seen, expecting class staticloggingbinder in same package (org.slf4j.impl), regardless of implementation - finds in same place.

Python SSL server to provide intermediate CA certificates -

i using python (2.7) ssl module write server code follows: ssock = ssl.wrap_socket(sock, ca_certs="all-ca.crt", keyfile="server.key", certfile="server.crt", server_side=true, ssl_version=ssl.protocol_tlsv1) the 'all-ca.crt' contains signing ca certificate , root ca certificate: -----begin certificate----- ... (signing ca)... -----end certificate----- -----begin certificate----- ... (root ca)... -----end certificate----- the documentation python ssl module states: in general, if using ssl3 or tls1, don’t need put full chain in “ca certs” file; need root certificates, , remote peer supposed furnish other certificates necessary chain certificate root certificate. and experience having written ssl servers in c. doesn't seem work here though. if write client uses root certificate in wrap_socket() call: csock = ssl.wrap_socket(sock, ca_certs="root-ca.crt", cert_reqs=ssl.cert_required, ssl_version=ssl.protocol_t

Write item in a ListView Android -

i'm developing app. in app i'm stored information in class named promo in defined 4 strings , made 4 getter , setters. made class named promotions in defined array of promo. store data in promo model i'm doing so: promo promo = new promo(); promo.setname("promozione"); promo.setdescription("la promozione può essere spesa"); promo.setdate("29 lug 2013"); promo.setimgurl("http://www.pensando.it/wp/wp-content/uploads/2012/11/coupon.jpg"); now in intent show field name in listview , when click on item of listview load intent in show details of promo. write name in listview made method in want read data array promo , display name of promotions in list item. made listadapter , pass class , array of promotions, says me should initialized array promotions. post here code i'm trying use display informations: method loaddatafrommodel private void loaddatafrommodel() { lvtitle

c# - How to move objects (grid + contents) smoothly to a different location on the page -

on 1 of app pages, have listbox containing various grid s, how can move 1 of these grid s (and it's contents) different location (the top of screen in case). i need transition smooth, not jump 1 location another. thanks time. you can use storyboard in can define time interval want move grid , can select type of transition while moving... smooth.... , can start storyboard whenever want move grid ...

How to trace CakePHP errors using the error.log -

i have production environment working , know errors or problems takes place on can not reproduce in testing environment. for it, trying make use of error.log located in cakephp/app/tmp/ folder not able understand of errors or know in code take place. for example: 2013-07-24 10:26:49 error: [missingactionexception] action tablescontroller::fancybox() not found. #0 c:\inetpub\wwwroot\lib\cake\routing\dispatcher.php(186): controller->invokeaction(object(cakerequest)) #1 c:\inetpub\wwwroot\lib\cake\routing\dispatcher.php(161): dispatcher->_invoke(object(tablescontroller), object(cakerequest), object(cakeresponse)) #2 c:\inetpub\wwwroot\app\webroot\index.php(92): dispatcher->dispatch(object(cakerequest), object(cakeresponse)) #3 c:\inetpub\wwwroot\index.php(42): require('c:\inetpub\wwwr...') #4 {main} where error coming from? suppose to calling fancybox() function? in file , line? can not trace indications. is there way read proper

database - How to use Slick's mapped tables with foreign keys? -

i'm struggling slick's lifted embedding , mapped tables. api feels strange me, maybe because structured in way that's unfamiliar me. i want build task/todo-list. there 2 entities: task: each task has optional reference next task. way linked list build. intention user can order tasks priority. order represented references task task. tasklist: represents tasklist label , reference first task of list. case class task(id: option[long], title: string, nexttask: option[task]) case class tasklist(label: string, firsttask: option[task]) now tried write data access object (dao) these 2 entities. import scala.slick.driver.h2driver.simple._ import slick.lifted.mappedtypemapper implicit val session: session = database.threadlocalsession val querybyid = tasks.createfinderby( t => t.id ) def task(id: long): option[task] = querybyid(id).firstoption private object tasks extends table[task]("tasks") { def id = column[long]("id", o.primaryk

android - Sort ArrayList with hashmap with int values -

i have arraylist contains hashmaps several key/value pairs. 1 of key/value pairs contains key "order" , value int. how can sort arraylist according "order" key of hashmaps contains please? (i can string value not int value) something it: list<map<string, integer>> list = new arraylist<map<string, integer>>(); collections.sort(list, new comparator<map<string, integer>>() { final static string compare_key = "order"; @override public int compare(map<string, integer> lhs, map<string, integer> rhs) { integer v1 = lhs.get(compare_key); integer v2 = rhs.get(compare_key); return v1 < v2 ? -1 : v1 > v2 ? 1 : 0; } });

packaging - Conform with File Hierarchy Standard on Linux: where to put binary examples for a library? -

i creating debian package library , install binary samples. thinking put them under /usr/share/libname , lintian complains (arch-dependent-file-in-usr-share). according fhs correct, can put files? it's not correct according fhs; /usr/share quite explicitly "architecture-independent data". /usr/lib arch-dependent equivalent, , that's want ( /usr/lib/libname ). see http://www.pathname.com/fhs/pub/fhs-2.3.html#usrliblibrariesforprogrammingandpa details.

html - Footer bg image repeat horizontally across page -

my bg image header works fine cant seem footer stretch across whole width of website. how can fix this? body{ background-image: url(images/topbg.jpg), url(images/footerbg.jpg); background-position: left top, left bottom; background-repeat: repeat-x; } set body margins , padding 0: body { margin: 0; padding: 0; }

php - How do I get the index of a sub-document retrieved from a query? -

i have code: 'items' => array ( 0 => array ( 'name' => 'paste', 'qty' => 5, 'price' => 2.5, ), 1 => array ( 'name' => 'soap', 'qty' => 5, 'price' => 2.5, ), ) i trying write query find out index of value sub-document items has data entry of name "soap". can me working solution? i think you're after along lines of foreach($items $key => $value){ if($value['name'] == "soap") $output = $key; } where $output key of array item set soap

regex - Divide list and append the list to separate lists python -

i have list divided 2 parts then, each part have written different lists. code tried here , works fine. import sys = ['name','2',3,4,5,'a','b','c','d',10,4,'lol','3'] print len(a) list1 =[] list2 = [] in xrange(0, (len(a)/2)): list1.append(a[i]) list2.append(a[(i)+((len(a)/2))]) list2.append(a[(len(a))-1]) print list1 print list2 i know if there other better alternative way this.. use python slice notation : a = ['name', '2', 3, 4, 5, 'a', 'b', 'c', 'd', 10, 4, 'lol', '3'] n = len(a) print(n) mid = n // 2 list1, list2 = a[:mid], a[mid:] print(list1) print(list2)

How can I make the Text Size adapt to different sized devices/linear layouts in Android -

i working on layout file adjusts android devices of different sizes. far have had success. using "layout_weight" have been able make linear layout take percentage of space in layout. means display can stretched cover whole screen weather on 2'7 inch screen or 10'1 inch screen. however, having problems text size in linear layout @ top. how can make textsize adapt big or small devices? here code. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:baselinealigned="false" android:weightsum="1.0" android:background="#ff0000" > <linearlayout android:orientation="horizontal" androi