Posts

Showing posts from February, 2011

eclipse - Signed content support in Equinox 3.10 -

in equinox 3.9 (eclipse 4.3) possible configure following properties in eclipse.ini enable authorization. osgi.signedcontent.support=all osgi.signedcontent.authorization.engine.policy=trusted osgi.framework.keystore=file:truststore.jks setting same properties in equinox 3.10 (eclipse 4.4) seems have no effect. can start application regardless wether bundles signed right key or not. reading documentation there has been no changes. when code loaded runtime since 3.4, equinox runtime has had ability check signature of code loaded. benefit feature beyond checking signatures during provisioning ability dynamically remove trust , disable code should exploit exposed in deployed code. in order enable signature-based authorization @ load time, following vm argument must passed: -dosgi.signedcontent.support=authority see runtime options page more information osgi.signedcontent.support runtime variable. any hint or on appreciated. thanks! the signed content

.htaccess - htaccess: replace hypen with plus sign and Redirect -

i have question on redirect url + replacing hypen plus sign before redirect http://www.example.com/new-items/school-first-item/school-second-item i want redirect above url http://www.example.com/web/school+second+item here rule, able redirect, not sure how replace hypen plus before 301 redirect rewriterule ^/?new-items/?([^/]+)/([^/]+) http://%{http_host}/web/$2 [r=301,nc,l,ne] try adding before rule have: rewriterule ^new-items/?([^/]+)/(.*)-(.*)$ /new-items/$1/$2+$3 [l,r]

string - Exam exercise about lists and pointers C -

i need fix exam exercise since teacher ask me how fix tomorrow @ oral test: nodo *cancellatutto(nodo *a, char *k) { nodo *p,*q; p = a; if (p == null) return null; while (p != null) { if (strcmp(p->chiave, k) == 0 ) { if (p->prec == null && p->succ == null) return null; if (p->succ == null && p->prec != null) { q = p; p = p->prec; p->succ = null; free(q); } if (p->prec == null && p->succ != null) { q = p; p = p->succ; p->prec = null; free(q); } if (p->prec != null && p->succ != null) { q = p; p = p->succ; q->prec->succ = p; p->prec = q->prec; free(q); } } else { p = p->succ; } } return a; } this function should see if 2 string equals (one in st

ios - Does UIScreen has notification for screen on? -

i'm trying push notification when screen on, don't know how detect that. if guys know, please tell me, thank you. the short answer no. (public) notifications associated uiscreen can found in uiscreen class reference : uiscreendidconnectnotification uiscreendiddisconnectnotification uiscreenmodedidchangenotification uiscreenbrightnessdidchangenotification none of these tell when device wakes up. however, can implement applicationdidbecomeactive(:) method in app delegate, called when device wakes up. similarly, can implement applicationdidenterbackground(:) method (also in app delegate), called when device goes sleep. note these delegate methods called @ other times (i.e. not when device transitions or sleep). close you're going get. see uiapplicationdelegate protocol reference more information.

swing - Exception in thread "main" java.lang.IllegalArgumentException: illegal component position -

i working on gui code of java media player here. when try run main class, keep getting following error message : exception in thread "main" java.lang.illegalargumentexception: illegalcomponent position @ java.awt.container.addimpl(container.java:1085) @ java.awt.container.add(container.java:465) @ dj2.gui.artistspane.<init>(artistspane.java:19) @ dj2.gui.mainframe.<init>(mainframe.java:36) @ dj2.test.guitest.main(guitest.java:21) i think problem comes artistspane class, since 2 other errors reference it. here code using artistspane : public class artistspane extends jpanel{ public artistspane(){ this.setlayout(new flowlayout()); add(new tracksaddremovetoolbar(),flowlayout.trailing);}} the problem detected @ level of add method. what's wrong it? thanks! you use flowlayout.trailing not when adding components when defining layout itself, , belongs flowlayout constructor parameter. rid o

c# - How to Properly Call an Await Method in Main? -

using system; using system.collections.generic; using system.io; using system.linq; using system.text; using system.threading.tasks; namespace taskconsole { class program { static void main(string[] args) { test(); } static async task<string> readtextasync() { string textcontents; task<string> readfromtext; using (streamreader reader = file.opentext("email.txt")) { readfromtext = reader.readtoendasync(); textcontents = await readfromtext; } return textcontents; } static async task test () { string capture = await readtextasync(); console.writeline(capture); } } } i have following code read text file using async. learned post example microsoft implemented using streamreader incorrect,

loops - How to outreg multiple tables on the same document in stata? -

how can outreg results in separate tables on same document while have outreg in loop. i provided answer found below. need install outreg http://fmwww.bc.edu/repec/bocode/o 'outreg': module write estimation tables word or tex file (note need uninstall previous updates of outreg if found) the documentation of above found here . provides examples on following: placing additional tables in same document using addtable merging multiple estimation results in loop in loop on outreg without outputting results replay on outreg results saved in memory output table. example: outreg, clear forvalues r = 2/5 { quietly reg mpg price weight if rep78==`r' outreg, merge varlabels ctitle("", "`r'") nodisplay } outreg using auto, replay replace title(regressions repair record) merging estimation results in loop 2 separate outreg tables: declare different tables save in @ first, use addtable after loops output 2 seperate tables

java - Why is String Object Instantiation a bad practice? -

this question has answer here: difference between string object , string literal [duplicate] 13 answers why statement bad practice : string colour= new string("blue"); and what's difference statement string colour="blue"; the first discouraged because reads string string intern pool , instantiates new object instance. wikipedia article on string interning says (in part) in computer science, string interning method of storing 1 copy of each distinct string value, must immutable. interning strings makes string processing tasks more time- or space-efficient @ cost of requiring more time when string created or interned. distinct values stored in string intern pool . the second example assigns reference string intern pool.

javascript - Swapping out background images for background gifs -

so have 4 li's contain images inside them gifs in li have "display: none;" inline on them. , when hover on li's, images swap realated gif, seen here in jquery wrote: jquery(".swap").mouseenter(function () { var me = jquery(this); me.attr('src', me.attr('src').replace('.jpg', '.gif')); }); jquery(".swap").mouseleave(function () { var me = jquery(this); me.attr('src', me.attr('src').replace('.gif', '.jpg')); }); and here html: <li> <img class="swap" src="image-box.jpg" /> <img class="swap" src="image-box.gif" /> </li> <li> <img class="swap" src="image-box2.jpg" /> <img class="swap" src="image-box2.gif" /> </li> i noticed these gifs still being loaded site on mobile after hiding elements , containers. decided make image

c# - How to read image inside (as a part of) a stream? -

i have files structure +-------------+-------------+---------------+---------+-------------+ | img1_offset | img1_length | custom info | image 1 | image 2 | +-------------+-------------+---------------+---------+-------------+ now want read image 1 image control. 1 possible way open file in stream ( filestream ), copy image 1 part other stream ( i1_stream ) read image i1_stream . code i'm using: using (filestream filestream = new filestream(path, filemode.open, fileaccess.read)) { using (memorystream i1_stream = new memorystream()) { filestream.seek(500, seekorigin.begin); // i1_offset filestream.copyto(i1_stream, 30000); // i1_length var bitmap = new bitmapimage(); bitmap.begininit(); bitmap.cacheoption = bitmapcacheoption.onload; bitmap.streamsource = i1_stream; bitmap.endinit(); return bitmap; } } because need open many file @ 1 time (ie. load 50 images 50 files wrappanel), think bett

ibm - Like button in Domino Notes -

i creating database want put button form. button can ever pressed once user. once button pressed add 1 field. there way this? the solution of knut needs every user in author- list documnents in question... need secure content differently. i work "like"- documents. when button pressed creates new document unid of "liked" document , user. in form there can computed display field @dblookup "like"- documents. you can hide button then, if document key @documentuniqueid + @username exists (or if username in cfd- field) , show "unlike"- button deletes document. one downside: creating , deleting "like"- documents have written in lotusscript.

c# - Url parameter not mapping -

i have following method in blogcontroller: [httpget] [route("blog/search/{searchtag:string}")] public actionresult search(string searchtag) { // doing search } i want url example blog/search/programming , should me page showing posts tagged programming i have following route: routes.maproute( name: "blogsearchroute", url: "{controller}/{action}/{searchtag}", defaults: new { controller = "blog", action = "search" } ); unfortunately parameter doesn't map correctly , null . update additional information: here routeconfig class: public class routeconfig { public static void registerroutes(routecollection routes) { routes.lowercaseurls = true; routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.ignoreroute("elmah.axd"); routes.maproute( name: "blogsearchrou

html - Div Resive To Fit Text -

this not necessary answer, it's more of problem i've encountered. let's have piece of text , want div element contains resize width property proportionally amount of text. there elegant way so? i've read min-width, doesn't work in case. text typically flows fill it's container. don't think css going best way accomplish this. concept dynamic limitations of css. best way can think use javascript adjust width of div based on length of string contained within.

sqlite - SWIFT use of INTs with SQL -

can pass check i'm doing write thing? know swift have specify type in int using. when create id sql database along lines of (id integer primary key autoincrement) the id needs map var int32(). correct? see sqlite's sqlite3_last_insert_rowid (or fmdb's lastinsertrowid ), returns value assigned integer primary key last inserted row. function returns sqlite3_int64 . for reason, treat these integer primary key autoincrement keys 64-bit integers.

javascript - owl carousel 2 same dots transition speed -

Image
i have 1 item carousel set in way owl.owlcarousel({ items:1, loop:true, autoplay:true, autoplaytimeout:5000, autoplayhoverpause:true, autoplayspeed: 1000, dotsspeed: 1000 }); when go 1 2 (or between 2 points lying next each other) transition delay 1 seconds (expected) when go 1 4 transition takes more time. i want transition speed same (1s) regardless distance of points. to clarify, when in dot 1 , move dot 2, want element in slide 2, delays 1 seconds in showing , , when going 1 4 element in slide 4 delays 1 seconds in showing too. here jsfiddle example note in jsfiddle put span.test has 1s delay animation when slide move in auto play or go 1 2 when finished transition, span.test appear when go 1 4 span.test arrive showing. i grateful if can me

logstash - Email plugin connection refused -

i try use email plugin of logstash. instance of logstash crashes econnrefused error. this content of config.conf file: input { generator { lines => [ "logstash test: line 1" ] count => 1 } } output { email { => "stuff@stuff.com" } } it fails following error: errno::econnrefused: connection refused - connection refused initialize @ org/jruby/ext/socket/rubytcpsocket.java:126 open @ org/jruby/rubyio.java:1178 tcp_socket @ file:/opt/logstash/vendor/jar/jruby-complete-1.7.11.jar!/meta-inf/jruby.home/lib/ruby/1.9/net/smtp.rb:540 do_start @ file:/opt/logstash/vendor/jar/jruby-complete-1.7.11.jar!/meta -inf/jruby.home/lib/ruby/1.9/net/smtp.rb:549 timeout @ org/jruby/ext/timeout/timeout.java:126 do_start @ file:/opt/logstash/vendor/jar/jruby-complete-1.7.11.jar!/meta -inf/jruby.home/lib/ruby/1.9/net/smtp.rb:549 start @ file:/opt/logstash/vendor/jar/jruby-complet

Heroku pricing dyno confusion -

i'd buy "hobby" package on heroku i'm confused pricing. says $7 per dyno per month, says pay fraction of actual processing time. if have thousand 100ms requests day thats 50 minutes month. pay 7/(30*24*60)*50 dollars total? what if dont have single request month @ all? still need pay? thank you edit: meant minutes, less then if dyno runs 24*7 whole month have pay 7$. if dyno runs 1 day in month pay 7/30 $. "fraction of actual processing time" means. hobby dyno won't cost more 7$.

ios - Unable to Compile Parse + Facebook SDK (Apple Mach-O Linker Error) -

Image
i trying use add facebook sdk ios parse project. trying to i followed setup instruction here : in bridging header added: #import <fbsdkcorekit/fbsdkcorekit.h> #import <fbsdkloginkit/fbsdkloginkit.h> #import <parsefacebookutilsv4/pffacebookutils.h> up point compiles fine , when try add logintofacebook code, apple mach-o linker error var permissionarray = ["user_about_me","user_relationships","user_relationships","user_location"]; pffacebookutils.logininbackgroundwithreadpermissions(permissionarray) { (user: pfuser?, error: nserror?) -> void in if (user == nil) { println("canceled facebook login."); } else if (user!.isnew) { println("user signed , logged in through facebook!"); } else { println("login through facebook"); } } any idea have done wrong? i have done parse+fb , here did : my br

sql server - Sqlserver PIVOT to turn a "reconstruct" a flat table into columns - why does this not work? -

the system using allows data entry form created multiple user defined fields satisfy information required on particular group of different "ordes". fields stored in database such entered: guid orderguid userdatacode value 1 100 ordername breakfast 2 100 orderdesc food eat before lunch 3 100 cerealyn y 4 100 toastyn y 5 100 toastdesc white bread 6 100 paperyn y 7 100 paperdesc newsroom 8 101 ordername lunch 9 101 orderdesc food eat before dinner 10 101 cerealyn n 11 101 toastyn y 12 101 toastdesc brown bread 13 101 paperyn y 14 101 paperdesc middaynews (etc) (in fact enterprise hospital software have used simpler examples here) i using sql return table pivoted below orderguid ordername orderdesc cerealyn toastyn toastdesc .... 101 breakfast food you.. y

maven - Having issues running java project through command line -

i new using maven. have created maven project , exported eclipse. maven automatically created src/test/java , src/main/java . created java script , ran in eclipse. when try running through command line, got error says: cannot find or load main class. when checked project directory, there 2 classfile paths: classes , test-classes . script running 1 in 'test-classes' not main class. path main class executes not script located. the command using main classfile is: java -cp target/test-1.0-snapshot.jar com.mycompany.app . the command test classfile : java -cp target/test-1.0-snapshot.jar com.mycompany.apptest . second command gives me error mentioned. please how around issue? by convention, in src/test/java supposed testing only. is, should place test classes in directory. maven run them before building final jar, not include them in it. if absolutely need jar test classes, have @ how create jar containing test classes .

How to post a New Post to Google Blogger In windows Phone 8.1 Universal Apps Using C# Code -

i searched lot got below code service not available in wp8.1...what alternative code post new posts googleblogger.. service service = new service("blogger", "exampleco-exampleapp-1"); service.credentials = new gdatacredentials("user@example.com", "secretpassword"); gdatagauthrequestfactory factory = (gdatagauthrequestfactory) service.requestfactory; factory.accounttype = "google"; i suggest using blogger api v3.0 via rest requests. here nice example on how use webauthenticationbroker class connect oauth 2.0 providers google. https://code.msdn.microsoft.com/windowsapps/web-authentication-d0485122 google documentation on how add blog post. https://developers.google.com/blogger/docs/3.0/using#addingapost

Applying jQuery in XSLT -

i want apply jquery in xslt. jquery function below: $('.expand').click(function() { $('ul', $(this).parent()).eq(0).toggle(); }); ul li ul { display: none; } how can apply below xslt code: <xsl:template match="product/auto"> <ul> <li> <a class="expand">john</a> </li> <xsl:apply-templates select='admin'/> </ul> </xsl:template> <xsl:template match="admin"> <ul> <li> <a class="expand">admin</a> </li> <xsl:apply-templates select=subject> </ul> </xsl:template> <xsl:template match="subject"> <ul> <li> <a class="expand"> <xsl:value-of select="concat('subject : ',.)"/> </a> </li>

java - EJB instance variables thread safety -

as per understanding, stateless ejb thread safety comes fact that concurrent requests same slsb served different intances of particular bean, each 1 own instance variables. for example if stateless ejb has instance variable, such int counter, each pooled ejb using different counter variable. does same apply injected variables in following example: @stateless public class user implements userhomelocal, userhomeremote { @persistencecontext(name="j2ee") private entitymanager manager; } more generally: there case in wich pooled beans can share instance variables result of dependency injection? ejb spec says the container serializes calls each stateful , stateless session bean instance. containers support many instances of session bean executing concurrently; however, each instance sees serialized sequence of method calls. therefore, stateful or stateless session bean not have coded reentrant that means thread-safe, default. no effor

java - Can PermGen leak out into native heap? -

we running glassfish application below settings: -xx:permsize=1g -xx:maxpermsize=2g -xms4g -xmx4g -xx:maxdirectmemorysize=1048576 jdk version 6u45 we're observing memory leak - java process of glassfish grows - res getting > 15gb (our server has 16gb of physical memory, admins restart glassfish before hitting physical limits), never java.lang.outofmemoryerror . the output of jmap -permstat after letting application run long time, showing classloaders occupying ~9.5gb (!!!) : class_loader classes bytes parent_loader alive? type <bootstrap> 4242 24064120 null live <internal> 0x0000000794a4c030 20 274072 0x0000000794a4c098 dead groovy/lang/groovyclassloader$innerloader@0x0000000609cdc9f0 ... <many, many groovy class loaders> 0x000000077f9c80d8 0 0 0x00000007017859f8 dead groovy/lang/groovyclassloader@0x0000000609997f00 0x000000076d63b3e0 0 0 0x00000007017859f8 dead groovy/lang/groovyclassloader@0x00

Using Vbscript, i'm fetching a value from textbox from UI. How to save that value to an xml tag -

below code tried save saleblockenddt tag in xml file, i'm fetching ui textbox. when run i've "object variable not set" error. need solution save tag value dim nspos dim nsparms dim szenddate dim sresult dim senddate senddate = trim(getfieldinput("ctxtenddate")) set nspos = createobject("espace.esnamespace") set nsparms = nspos.applyxml("pos\pos.xpa", 2) szenddate = trim(nsparms.parameters.saleblockenddt.text) if szenddate = "" nsparms.parameters.saleblockenddt.text = senddate end if sresult = nspos.save("pos\pos.xpa",2)

Trade external access token for local one - ASP.Net Identity -

when using asp.net identity , retrieving external access token external provider, how trade-in/issue local access token using external access token? i've seen [hostauthentication(defaultauthenticationtypes.externalbearer)] have not been able working on action method. if send headers authentication: bearer external_access_token it not populate user.identity startup.auth.cs: app.useoauthauthorizationserver(new oauthauthorizationserveroptions { tokenendpointpath = new pathstring("/token"), provider = new applicationoauthprovider(), authorizeendpointpath = new pathstring("/accountapi/externallogin"), accesstokenexpiretimespan = timespan.fromdays(14), allowinsecurehttp = true }); app.useoauthbearerauthentication(new oauthbearerauthenticationoptions()); the workflow of owin middleware external authentication involves redirecting / querying external oauth provider registering new user asp.

vba - How to locate data source for unbound control? -

i've inherited access vba code , there controls on form (such listbox named lstorderid , mentioned below) have no rowsource property set (an empty string). in code , find statements in various places: forms!frm_customer.lstorderid = rstcust!orderid ' set record set forms!frm_customer.lstorderid.requery me.lstorderid = me.lstorderid.itemdata(0) ' set first item in self but in code lstorderid.rowsource being set. how can requery called on listbox has no rowsource? how can listbox set single value ( rstcust!orderid ) record set, unless list of values (although debugger shows integer in lstorderid.value )? here more code: dim rstcust recordset set db = currentdb set rstcust = db.openrecordset("select * orders custid=" & id & _ "and datetaken =date() " & _ "and vendorid='" & forms!frm_customer.cbovendorid & "'") forms!frm_customer.lstorderid = rstcust!order

javascript - how to switch between english and other languages while filling data in rails form -

in ruby on rails application, accepting input in hindi language save in mysql database. want make checkbox switch language while entering data can type in hindi or english according language selected in checkbox. how can using jquery on unicode convertor in rails. me solve out this. thanks we can use google transliteration https://developers.google.com/transliterate/v1/getting_started . it provide keyboard input in both hindi , english language. switching language easy ctrl+g command. thanks.

android - How to show data from a BLE device in multiple Textviews? -

i have humidity sensor broadcasts last ten values single array after fixed time interval. want display these values in ten textview 's. my current code displays values in single textview , how can modify this? how possible? @override public void oncharacteristicread(bluetoothgatt gatt, bluetoothgattcharacteristic characteristic, int status) { if (status == bluetoothgatt.gatt_success) { if (bleuuid.read_sensor .equalsignorecase(characteristic.getuuid().tostring())) { final string values = characteristic.getstringvalue(0); byte[] bytes =values.getbytes(); final string value = new string(bytes); runonuithread(new runnable() { public void run() { statuslv.settext(value); setprogressbarindeterminatevisibility(false); } }); split string receive. depending on format, should able

login - Only able to log in to my local WordPress site's back end by visiting the front end first? -

this weird problem i'm trying figure out. use wamp build wordpress sites locally. of sites work fine except main 1 working on now. using chrome on windows 7 happens on browser. of sudden when go localhost/mysite/wp-admin login screen comes , when type in username , password , hit enter it's page refreshes , login info has reentered. repeat infinity part. first time happened took 10 tries , logged in. still happens daily , found of weird solution. have go sites front end localhost/mysite/ , load up. once it's add /wp-admin url, hit enter , when login again works. not 100% has been way log on of now. experience this? said other sites not have problem. can causing this? plugin perhaps? it's weird problem , don't solution i'm using. thanks. i kinda remember having similar problem, problem me wp installation had trouble database , backed , fresh installed everything. hope 1 works you

html - background color surround image -

i want logo of page on top left corner surrounded black background. however, background color not cover area on right of image. using html , css. this code: #title { width: 100%; height: 100%; background-color: black; } #title img { width: 50%; height: 50%; } <!doctype html> <html> <link rel="stylesheet" type="text/css" href="index.css" media="screen" /> <body> <div id="title"> <a href="index.html"> <img src="http://i.stack.imgur.com/we2r4.png" align="left" /> </a> </div> </body> </html> remove align="left" attribute. acts similar if made image float: left , never clear float after parent collapses , can't see background: #title { width: 100%; height: 100%; background-color: black; } #title img { width: 50%; height: 50%; } &

superclass - Java getClass and super classes -

public boolean equals(object o) { if (this == o) return true; if ((o == null) || (this.getclass() != o.getclass())) return false; else { alunote umaluno = (alunote) o; return(this.nomeempresa.equals(umaluno.getnomeempresa()) && super.equals(umaluno); } } could explain me how fourth line ( (this.getclass() != o.getclass()) ) works when argument super class? because classes have different names. this.getclass return different name o.getclass , right? check following code snippet answers question. object o can hold object. o.getclass() return run time class of object public class main { void method(object o) { system.out.println(this.getclass() == o.getclass()); } public static void main(string[] args) { new main().method(new object()); // false new main().method(new main()); // true new main().method(new string()); // false new main().method(new mainone()); // false } } class main

r - Split dataframe into two groups -

Image
i've simulated data.frame : library(plyr); library(ggplot2) count <- rev(seq(0, 500, 20)) tide <- seq(0, 5, length.out = length(count)) df <- data.frame(count, tide) count_sim <- unlist(llply(count, function(x) rnorm(20, x, 50))) count_sim_df <- data.frame(tide=rep(tide,each=20), count_sim) and can plotted this: ggplot(df, aes(tide, count)) + geom_jitter(data = count_sim_df, aes(tide, count_sim), position = position_jitter(width = 0.09)) + geom_line(color = "red") i want split count_sim_df 2 group: high , low . when plot split count_sim_df , should (everything in green , blue photoshopped). bit i'm finding tricky getting overlap between high , low around middle values of tide . this how want split count_sim_df high , low: assign half of count_sim_df high , half of count_sim_df low reassign values of count create overlap between high , low around middle values of tide here's way generate sample dataset , gr

Using <f:selectitems> in html to make dependent drop down list using javascript -

i able select value 1 drop down , depending on value, able disable drop down list. want when 2nd drop down disabled should show '(select one)'. this code: <h:selectonemenu id="tier" isrequired="true" value="#{allocationtemplatedetailsbackingbean.allocationrule.allocationfulfillparameters.fulfillmenttierstr}"> <f:selectitems id="tierlist" value="#{allocationtemplatedetailsbackingbean.fulfillmenttierlist}" /> .... ... </h:selectonemenu> , javascript function follows: function controlfulfillmenttierdropdownlist() { var strategy = document.getelementbyid('dataform:strategy'); if(strategy != null) { if(strategy.value == 5) { var fulfillmenttierdropdownlist = document.getelementbyid('dataform:tier'

Read from JSON Array into Grails HTML Select tag -

i using grails select tag on gsp. when call backend populate guy, values comes in json array so.. [{"id":1,"display_name":"sarah's site"}, {"id":2,"display_name":"gisele's site"}, {"id":3,"display_name":"mariam's site"} ] so want feed id list keys attribute of tag , display_name list attribute. user sees list of display names , when select 1 id passed backed controller. not sure how this, here code staring @ now... <g:select id="siteid" name="siteid" from="${sitenamelist}" keys="${sitenamelist}" noselection="['':'any']"/> any suggestions appreciated. ok, figured out. extracted 2 lists json array (results) , passed gsp view so.. def keys = []; def values = [] results.each { keys.add(it.get("id")) values.add(it.get("display_name")) } ren

html - How to resize 1000x1000 image into 200x300 image without distorting the aspect ratio -

this question has answer here: css force image resize , keep aspect ratio 17 answers the images in 1000x1000 resolution. want display images in 200x300 resolution without distorting aspect ratio. how can achieve this? currently used method, <img src="<?php echo base_url().$pl['product_image'];?>" style="width:200px;min-height:300px; max-height:300px;"/> put images background-images of div rather putting them img tags. <div style="background: url(http://waveilk.com/product_images/0cd666329a45121a3550611f9496e66fkmtws00064-1.jpg) no-repeat 50% 50%; width: 200px; height: 300px; background-size: cover;"></div> using php code, become <div style="background: url(<?php echo base_url().$pl['product_image'];?>) no-repeat 50% 50%; width: 200px

node.js - Global node modules not recognized -

i reading around , still can't fix it. installed grunt-cli , bower global , when run get bash: grunt: command not found so didn't have . bash_profile , added it. , put inside: export path=/.node/lib/node_modules:$path but still not working. if need prefix is: prefix = "/root/.node" i using debian. did remember reload bash profile after creating it? if not, open terminal , type source ~/.bash_profile this exit shell , log in can recognize changes made it.

RabbitMQ Message Priority Queue Not working -

i run priority queue java program in eclipse, got issue, first time got correct answer. time added 1 more message in queue, time got different result. public static void main(string[] argv) throws exception { connectionfactory factory = new connectionfactory(); connection conn = factory.newconnection(); channel ch = conn.createchannel(); map<string, object> args = new hashmap<string, object>(); args.put("x-max-priority", 10); ch.queuedeclare(queue_update, true, false, false, args); publish(ch, 141); publish(ch, 250); final countdownlatch latch = new countdownlatch(2); ch.basicconsume(queue_update, true, new defaultconsumer(ch) { public void handledelivery(string consumertag, envelope envelope, basicproperties properties, byte[] body) throws ioexception { system.out.println("received " + new string(body)); latch.countdo

php - How can i get all values of particular attribute in woocommerce, It shows invalid_taxonomy in WP_ERROR_OBJECT -

i m new in wordpress, set e-book store of woocommerce, want add custom shortcode in woocommerce plugin fetch list of publishers , display alphabatically. publisher custom attribute of simple product. did $shortcodes = array( 'product' => __class__ . '::product', 'product_page' => __class__ . '::product_page', 'product_category' => __class__ . '::product_category', 'product_categories' => __class__ . '::product_categories', 'add_to_cart' => __class__ . '::product_add_to_cart', 'add_to_cart_url' => __class__ . '::product_add_to_cart_url', 'products' => __class__ . '::products', 'recent_products' => __class__ . '::recent_products', 'sale_products'

how to change font family of Tabhost in android -

Image
i want change font family default font family. it's possible? please me thank you. add font files(.ttf,.ttc,.otf etc ) in assets folder set fonts programatically: textview tv= (textview)findviewbyid(r.id.custom); typeface face=typeface.createfromasset(getassets(), "fonts/heartbre.ttf"); tv.settypeface(face);

facebook - Post on visitors website when ??? accours (WordPress) -

i have website running wordpress. have facebook login plugins, able automatic post on visitors wall, whenevery points or perhaps other scenaries well? there plugin enables me this? there no plugin, , autoposting not allowed. need authorize user publish_actions permission using /me/feed endpoint post on wall. , need publish_actions reviewed facebook before can go public it. never permission approved autoposting. every single post on user wall must approved user, , prefilling not allowed - message must 100% user generated. btw, rewarding user sharing on wall not allowed either. platform policy: https://developers.facebook.com/policy/

android - How can i send either an image or a video file using ACTION_SEND? -

i want share either image or video file using action_send . when users taps on image , selects "share image/video" should send either image selected or video selected. here code using: if (filep != null) { } file sending=new file(filep); intent intent = new intent(); intent.setaction(android.content.intent.action_send); intent.setdataandtype(uri.fromfile(sending),getmimetype(sending.getabsolutepath())); intent.putextra(intent.extra_stream, sending); startactivity(intent.createchooser(intent , "share")); } private string getmimetype(string url) { string parts[]=url.split("\\."); string extension=parts[parts.length-1]; string type = null; if (extension != null) { mimetypemap mime = mimetypemap.getsingleton(); type = mime.getmimetypefromextension(extension); } return type; so when testing, takes me app want use share i.e wh

javascript - codeigniter ajax login error div and session issue -

i have stuck creating login using codeigniter 3.0 appui 2.1 bootstrap theme, show error div in login , everytime logged in, direct maps view when navigate information table view , go maps view, redirect login view. any suggestions? here's code: model/login_model.php class login_model extends ci_model { public function login($username, $password) { $passwordencrypt = sha1($password); $this->db->where('username', $username); $this->db->where('password', $passwordencrypt); $query = $this->db->get('admin'); if ($query->num_rows() == 1) { foreach ($query->result() $row) { $data = array( 'username' => $row->username, 'password' => $row->password, 'logged_in' => true ); } $this->load->library('session'); $this->session->set_userdata($data); re

java - sparkjava and eclipse unresolved compilation problems: -

i have followed tut here http://sparkjava.com/documentation.html#getting-started pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>spark</groupid> <artifactid>spark</artifactid> <version>0.0.1-snapshot</version> <name>spark</name> <description>spark</description> <dependencies> <dependency> <groupid>com.sparkjava</groupid> <artifactid>spark-core</artifactid> <version>2.2</version> </dependency> </dependencies> </project> hello.java import static spark.spark.*; public class hello { public static void main(string[] args) { g

ios - Image to Initially Fill UIImagePickerController -

Image
in ios app i'd grab images photo library , crop them square format. uiimagepickercontroller takes care of nicely, there 1 little problem: when select landscape-oriented photo library not fill crop area (for portrait images does). allows user select non-square area. is there way force image picker fill crop area vertically horizontally - without implemeting own image picker? my code: class addprofileviewcontroller: uiviewcontroller, uigesturerecognizerdelegate, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate { @iboutlet weak var profileimageview: enhancedimageview! let imagepicker = uiimagepickercontroller() override func viewdidload() { super.viewdidload() // ... imagepicker.delegate = self } func profileimagetapped() { imagepicker.allowsediting = true imagepicker.sourcetype = .photolibrary presentviewcontroller(imagepicker, animated: true, completion: nil) } func imagepicker

android - How to add a button to toolbar, and top of menu -

Image
is possible add button toolbar of android firefox, , top of pop menu shown in screenshot below: edit: found screenshot of addon had other addons installed added button there, pleease see addon screenshots: https://addons.mozilla.org/en-us/android/addon/quitnow/ here screenshot: see nightly globe , whatever left of it, im trying same :) top row in second picture toolbar button icons show in top toolbar when there enough screen space im interested in learning how add 1st , second row the documentation developing firefox mobile marks ui apis not supported . mozilla uses native ui of android build firefox android. therefore related xul might not work @ all. now there extensions firefox android api , thing related you'd achieve can found pageactions.jsm , can used like: pageactions.add({ icon: "drawable://alert_app", title: "my page action", clickcallback: function() { win.alert("clicked!"); } }); these added toolbar, disp

android - New AsyncTask correction, app crash -

please, can correct code? i'm getting crazy. app crashes, code seems good. want display progress dialog during pi calculation. reference of strings or order of params ? (or incorrect calculation of pi?). new asynctask<void, void, string>() { progressdialog dialog; @override public void onpreexecute() { dialog.setmessage("calculating..."); dialog.show(); } @override public string doinbackground(void... params) { double max_num = 100000000; double min_num = 1; double = 0; long starttime = system.currenttimemillis(); while (min_num < max_num) { += 4 / min_num; min_num += 2; -= 4 / min_num; min_num += 2; } long endtime = system.currenttimemillis(); long total_time = endtime - starttime; string time = long.tostring(total_time); return time; } @override public void onpostexecu

google chrome extension - Open new tab with POST method -

i want create new tab , send data in post request chrome extension. use request, data going send arbitrarily long, , want json encode it(which means cannot use forms). i've found 2 questions on this, both of them talking using form, not desirable. the reason want because want request further input user before data. totally lost here , have no idea how this, hence can not add code samples i've tried. if cannot url, inject script page , have popup, of last resort. any ideas on how done?

c# - MVC Globalization for DisplayName and DisplayFor -

i developing multilingual (english, arabic) application using mvc. application should display both labels , data based on resources files. database designed store translated fields in same tables example gender[id, name,arabicname] person[id,firstname,fathername,familyname,arabicfirstname, arabicfathername,arabicfamilyname,genderid] i managed display dropdownlist based on resources switching between name , arabicname fields using: viewbag.gender= new selectlist(mentities.genders.tolist(), "id", resources.global.name); // name value in global.resx name , in global.ar.resx arabicname and displaying labelfor using: [display(name="firstname", resourcetype =typeof(resources.global))] public string firstname{get;set;} my question, possible switch between firstname value , arabicfirstname using displayfor , how achieve in mvc? for example display: firstname = antony english , ara

html - What is the difference between &nbsp; and space? -

there 2 snippets of html code: 1. <div>&nbsp;</div> 2. <div> </div> i run them in chrome 43.0.2357.130m separately. the first snippet's div has height(height=18px), second doesn't have height(height=0). i wonder why have different result. thank you:-)! &nbsp non-breakeable space. means interpreted character. exemple, 2 words separated &nbsp: stay together, 2 words separated space can separated new line if container small. a simple space "meh, i'm here if need me, can change if want me <3", &nbsp more "i'm here" in exemple, space seems useless (no words before , after) desappear. &nbsp still here. consider &nbsp same way if invisible letter more space.

html - How to make a button group in to a block in Bootstrap? -

i using bootstrap , have 2 selectors want make block takes complete width, adding btn-block didn't seem in case. is possible native bootstrap? <div class="form-group btn-group" data-toggle="buttons"> <label class="btn btn-default btn-lg"> <input type="radio" name="gender" value="female" required=""><i class="fa fa-female"></i> female </label> <label class="btn btn-default btn-lg"> <input type="radio" name="gender" value="male" required=""><i class="fa fa-male"></i> male </label> </div> bootply: http://www.bootply.com/ifkuysbczi you can use btn-group-justified <div class="form-group btn-group btn-group-justified" data-toggle="buttons"> <label class="btn btn-default btn-lg"

c# - Using await inside a ContinueWith() block -

i have following code: var result = messageboxhelper.msgbox .showasync("press yes proceed", messageboxbutton.yesno) .continuewith((answer) => { if (answer.result == messageboxresult.yes) { task<bool> asynctask = executeasyncfunc(); //asynctask.unwrap(); ?? asynctask.continuewith((a) => { // more }, taskcontinuationoptions.onlyonrantocompletion); } }, taskcontinuationoptions.onlyonrantocompletion); } invoked elsewhere this: public async task<bool> executeasyncfunc() { await callanotherasyncfunction(); } i believe need call unwrap(), have tried to, because calling await inside continuewith() block. however, following error when uncomment it: error cs1929 'task' not contain definition 'unwrap' , best extension method overload 'taskextensions.unwrap(task)' requires receiver of type 'task

wcf - HTTP POST RETURNING BAD REQUEST ERROR 400 FROM ANDROID HTTPURLConnection -

i using httpurlconnection class connect android application wcf web service. using microsoft network monitor trace request , hits server thus. http: request, post /ieservice/service.svc/register_user command: post uri: /ieservice/service.svc/register_user location: /ieservice/service.svc/register_user protocolversion: http/1.1 useragent: dalvik/2.1.0 (linux; u; android 5.0.2; a0001 build/lrx22g) host: win-server connection: keep-alive accept-encoding: gzip contenttype: application/x-www-form-urlencoded mediatype: application/x-www-form-urlencoded contentlength: 183 headerend: crlf payload: httpcontenttype = application/x-www-form-urlencoded last_name: l_one birthday: bd_one email: e_one username: u_one business_location: bl_one security_answer: sa_one security_question: s_one first_name: f_one password: p_one imei_number: imei_one however, bad request error 400. cannot see wrong request. problem? the problem in wcf service method. had add b