Posts

Showing posts from February, 2011

html - How to keep scroll-bar hidden and show it when max-height is over? -

i have structure this: pre { word-warp: normal; display: block; padding: 5px 8px; width: auto; background-color: #eee; margin-bottom: 1em; max-height: 300px; line-height: 1.8; direction: ltr; overflow: scroll; } <pre> <code> in case both x , y scroll-bar(s) has hidden </code> </pre> <hr> <pre> <code> in case y-scroll-bar has appears <br> in case y-scroll-bar has appears <br> in case y-scroll-bar has appears <br> in case y-scroll-bar has appears <br> </code> </pre> <hr> <pre> <code> in case x-scroll-bar has apears ------------------------------------------------------------------------------------------------------------------- </code> </pre> actually i'm trying create stackoverflow-code-method-ui. how can that? you need set max-width x scrollbar, changeing overflow:scroll overflow:auto works how ...

java - split function doesn't return -

string str ="|m4oho5kspqikkfn2may72osnfzmn3gutwzqctblzqy6rygwzxbra6bjkmy|113|70|"; string[] tokens = str.split("|"); system.out.println(tokens[0]); system.out.println(tokens[1]); result in white:: 0 i need thing want come is: m4oho5kspqikkfn2may72osnfzmn3gutwzqctblzqy6rygwzxbra6bjkmy sorry not english using google translator | regex protected character. need escape when splitting so: str.split("\\|"); regards

sql server - Date difference between events in same column -

i new ms sql , having difficulty in getting correct results. have table headers updateddate (date), addedby (number), operationid (number) , servicereqno (number) have been selected 3 different tables. the operationid event , servicereqno job number. want able time difference taken between events , once established calculate average. for example: opid 512 @ 20:15 - servicereqno 1 opid 535 @ 21:23 - servicereqno 1 my first task determine difference in time is, ensuring within same job number. many thanks in order timespan between events, need number operations sequentially (one increments without leftout), , join on offset of 1. you'll n-1 rows result timespan inbetween. something this: with cteops ( select row_number() on (partition servicereqno order updateddate) seqid, updateddate, servicereqno yourdatasource ) select datediff(millisecond, o1.updateddate, o2.updateddate) updateddatediff, servicereqno cteops o1 join cteops o2 on o1.seqid=o2...

java - data filtering from db to match with UI -

this question more of approach question. having more theory. apologies that. i have string getting api call queryparam in method. rest call. string has columns name of table present in ui. lets string this: string columnsname= "columns1,column2,column3,column4" now have method call backend. there list of object. these objects ones going fill in rows table columns date have got. problem that, cannot change db call exact columns want. db call getting columns , in fixed order. columns getting front end might have less no of columns , in different order. data getting backend list of object, have iterate through , use writer make csv out of that. csvcompletedata getting backend. list of object. objectdto dto object. for (object csvrowdata : csvcompletedata) { objectdto dtoobj = (objectdto )csvrowdata; writer.append(dtoobj.getip()); writer.append(','); writer.append(dtoobj.getname()); writer.append(','); writer.append(stringescapeutils...

python - Django populate a class model from command, working in DB but not showing on the page -

so, problem might bit specific, not sure think missed in way fill class in commandbase. and have @ moment : in office, in sources / articles list right. in page, articles parsed fro .csv not displayed. here model : class article(modelmeta, translatablemodel): taints_cache = true """ press article element, """ date_created = models.datetimefield(auto_now_add=true) date_modified = models.datetimefield(auto_now=true) date_realization = models.datefield(_('realised in'), default=timezone.now) image = filerimagefield(verbose_name=_('featured image'), blank=true, null=true, on_delete=models.set_null, related_name='image_press_article', help_text=_('set if article featured')) sources = models.manytomanyfield(articlesource, verbose_name=_('source'), ...

android onActivityResult vs getIntent -

both onactivityresult , getintent receives intent other activities. when 1 used on another? i think onactivityresult called after call startactivityforresult receive result. i guess getintent used receive intent sent other me. correct? below understanding how it's used, wonder if understanding correct. i register listen intents (probably in manifest) when registered intents delivered, responsible activity resumes (or gets created) getintent should placed in onresume check intent one should dispose used intent removing whatever data inside intent i think onactivityresult called after call startactivityforresult receive result. on onactivityresult called when finish() activity started startactivityforresult . can provide intent setresult , part of onactivityresult i guess getintent used receive intent sent other me. correct? getintent() returns intent started current activity

grails - Passing the value of textbox as form id -

trying pass value entered in textbox user id of form. code snippet below. passes params.id = "index" in controller. if hardcode form id="sometext" passes params.id = "sometext" controller. due constraints have use button element instead of g:actionsubmit. <g:form controller="search" action="index" id=${searchtext} method="post"> <div> <g:textfield name="searchtext"></g:textfield> <button type="submit" class="btn"> <i class="icon-search"></i> </button> </div> </g:form> any solutions? <g:form controller="search" action="index" method="post"> <div> <g:textfield name="id"></g:textfield> <button type="submit" class="btn"> <i class=...

ios - How to play video inside a UIView without controls, like a background/wallpaper? -

the goal playback video file (*.mp4) inside uiview without controls. it serve background/wallpaper on viewcontroller , other controls, i.e. tableview, text fields, images shown on view video playedback. what better way this? thank you i've reached goal native avplayer 1.used avfoundation: #import <avfoundation/avfoundation.h> 2.used property player: @property (nonatomic) avplayer *avplayer; 3.added video file "video" folder , added "video" project 4.initialized player nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"shutterstock_v885172.mp4" oftype:nil indirectory:@"video"]; nsurl *fileurl = [nsurl fileurlwithpath:filepath]; self.avplayer = [avplayer playerwithurl:fileurl]; self.avplayer.actionatitemend = avplayeractionatitemendnone; avplayerlayer *videolayer = [avplayerlayer playerlayerwithplayer:self.avplayer]; videolayer.frame = self.view.bounds; videolayer.videogravity = avlayervideogravi...

Create multiple classes or multiple objects in Python? -

i have following problem , need advice on how solve best technically in python. new programming have advice. so have following object , should store something. here example: object 1: cash dividends (they have following properties) exdate (will store list of dates) recorddate (will store list of dates) paydate (will store list of dates) isin (will store list of text) object 2: stocksplits (they have following prpoerties) stockplitratio (will ration) exdate(list of dates) ... i have tried solve this: class cashdividends(object): def __init__(self, _gross,_net,_isin, _paydate, _exdate, _recorddate, _frequency, _type, _announceddate, _currency): self.gross = _gross self.net = _net self.isin = _isin self.paydate = _paydate self.exdate = _exdate self.recorddate = _recorddate self.frequency = _frequency self.type = _type self.announceddate = _announceddate self.currency = _currenc...

z3 - Keep getting "unknown" result with :pattern usage in SMTLIB v2 input -

i'm encountering problem when using smtlibv2 input format , patterns z3: keep getting result "unknown" following input: (declare-datatypes () ((l l0 l1))) (declare-fun path () (list l)) (declare-fun checktransition ((list l)) bool) (define-fun iscons ((p (list l))) bool (not (= p nil)) ) ; configuration options :pattern, taken z3 tutorial (set-option :auto-config false) ; disable automatic self configuration (set-option :smt.mbqi false) ; disable model-based quantifier instantiation (assert (iscons path)) (assert (iscons (tail path))) (assert (= nil (tail (tail path)))) (assert (= l0 (head path))) ; initial state constraint (assert (forall ((p (list l))) (! (implies (and (iscons p) (iscons (tail p))) (and (= l0 (head p)) ; transition l0 (= l1 (head (tail p))))) ; l1 :pattern ((checktransition p)) ) ) ) (assert (checktransition path)...

html - css nth child from element with class -

i there way of selecting (using css) nth child element class. example, following, how select li element id="this" (shown explanation purposes)? want 2nd element element class="selected" <ul> <li></li> <li class="selected"></li> <li></li> <li id="this"></li> <li></li> <li></li> <li></li> </ul> actually + selector. bit dirty, works in case. need know exact position of element need. .selected + li + li (adding + li times need)

ios - Wrong values for self.view.frame even after adding Launch Images and a Launch Screen -

i have been frustratingly stuck on issue last 2 days. have gone through , followed of stackoverflow questions regarding adding launch images and/or launch screen app isn't zoomed on iphone 6/6s , iphone 6 plus sizes. i have made sure add launch images correct dimensions, 750x1334 , 1242x2208. even after doing , adding launch screen, when print self.view.frame.size.height , self.view.frame.size.width , 568 , 320 respectively. can please me this. don't know i'm doing wrong. first screen shown used subclass of uiviewcontroller called baseviewcontroller not changed , made first screen subview of uiviewcontroller . i not sure if have missed important step in allowing app function on bigger screen sizes. any great! i forward responses. thank in advance!

android - Why does transparent stroke display with only half of width? -

Image
i'm trying use <shape> displaying pressed state of button. that, use stroke transparent color in normal state , colored 1 in pressed state: button.xml : <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/button_pressed" android:state_pressed="true"/> <item android:drawable="@drawable/button_normal"/> </selector> button_pressed.xml : <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#0f0" /> <stroke android:width="@dimen/size_medium" android:color="#f00" /> <padding android:left="@dimen/size_medium" android:top="@dimen/size_medium" android:right="@dimen/size_medium" ...

Filter every character in Kendo Grid -

how force kendo grid filter data after every character typed, in after every letter, not when press enter button? i noticed kendo sends requests after every character typed, without page size, , request used autocomplete. want change bind data not autocomplete, main grid instead. i using built in filters, 1 each column. sorry later response, didn't have time. anyway mentioned in comment, functionallity not supported telerik. have create yourself. in following example have used filtermenuinit event fired after click on filter icon (and once!). in event have modified filter elements add custom classes , ids. in jquery catching keyup events , adding items filter. here small example . have implemented equals filter, have modifications. hope can in next work.

android - Google token life time for GoogleSignInApi -

is possible increate token life time or update token without user interaction? googlesigninresult result googlesigninaccount acct = result.getsigninaccount(); email = acct.getemail(); idtoken = acct.getidtoken(); gives me token lifetime 1hour. best way force update token? yes, right now, google issues 1hr long id token. if want use id token identity assertion session management, can use silentsignin ( javadoc ), doesn't involve user interaction. if old token hasn't expired yet, (cached) version (optionalpendingresult returned have isdone()==true); if expired already, refreshed 1 (but take little longer , optionalpendingresult isdone() false). also, depending on whether call silentsignin on ui thread or worker thread. if call on worker thread, take @ post blockingconnect() + await() simplifies code lot: silent sign in retrieve token googleapiclient

slowcheetah - XML transformation not working -

i have installed slowcheetah extension , nuget package console app project. have used context menu add uat build configuration , updated test setting check value being transformed. unfortunately not, when try preview transform via context menu showing me non transformed app.config. what steps can check see why extension not working? in main app config have specified appsetting. <appsettings> <add key="tomtesttransform" value="local" /> </appsettings> in app.uat.config overwrite it <appsettings> <add key="tomtesttransform" value="uat" /> </appsettings> when preview transform, or build , check configuration output, using non transformed version. setting equals local. you need use xdt: attributes match , adapt elements, so: <?xml version="1.0" encoding="utf-8" ?> <!-- more information on using transformations see web.comfig examples @ http://go.m...

sql server 2014 install after visual studio 2015 -

i have visual studio 2015 installed on windows10 , want install sql server 2014. remember had have sql server before visual studio. as seem have sql server , sql server compact edition under program folders. will run trouble if attempt install proper sql server? there way uninstall them or need complete install of visual studio install sql server first? or best case scenario, sql server installation won't create issues, besides windows firewall exception , .net 3.5 have checked installed. well, didn't seem matter, install , run sql server after having visual studio installed first :)

graph algorithm - How to find same edges of two paths? -

a path represented vector, containing node id. edge in path has direction. given 2 paths, example : <1,6,11,7,2,5 ...> , <3, 4, 8, 2, 7,3, 1,6...>, here <1,6> same edge. edges successive, times not. it's better put flag between these edges. example, (1,2) * (5,7,9) * (6,11,12), same edge 1->2, 5->7,7->9, 6->11, 11->12, there no edges 2 5 or 9 6. put '*' or other symbol flag. is there has ideas? appreciate it. assuming each node has 1 incoming , 1 outcoming edge. call p1 first path of length n , p2 second path of length m. can turn p2 hashmap startedge -> endedge (e.g <3,4,5> become [3->4, 4->5] ). then each element of p1, number i , compare p1(i+1) hashmap(key= p1(i)) . if hashmap doesn't have key or has different value, don't have common edge, otherwise do. (if have multiple edges 1 node, values of hashmap can sets of ints, , check whether p1(i+1) contained within hashmap(key=p1(i)) ). ...

osgi - Karaf Feature install throwing Unsupported 'Bundle-ManifestVersion' value: 1 -

hi guys getting below error while using feture install in karaf org.apache.karaf.features.internal.util.multiexception: error @ org.apache.karaf.features.internal.download.impl.mavendownloadmanager$mavendownloader.<init>(mavendownloadmanager.java:84)[9:org.apache.karaf.features.core:4.0.3] @ org.apache.karaf.features.internal.download.impl.mavendownloadmanager.createdownloader(mavendownloadmanager.java:72)[9:org.apache.karaf.features.core:4.0.3] @ org.apache.karaf.features.internal.region.subsystem.downloadbundles(subsystem.java:358)[9:org.apache.karaf.features.core:4.0.3] @ org.apache.karaf.features.internal.region.subsystem.downloadbundles(subsystem.java:355)[9:org.apache.karaf.features.core:4.0.3] @ org.apache.karaf.features.internal.region.subsystemresolver.resolve(subsystemresolver.java:191)[9:org.apache.karaf.features.core:4.0.3] @ org.apache.karaf.features.internal.service.deployer.deploy(deployer.java:263)[9:org.apache.karaf.features.core:4.0...

php - Can't hide post in wordpress -

i want exclude category homepage. tried below code, it's working site in local server after moved code production server won't work @ all. function exclude_category($query) { if ( $query->is_home() ) { $query->set( 'cat', '-505' ); } return $query; } add_filter( 'pre_get_posts', 'exclude_category' ); i tried install 'wp-hide-post' plugin, yet, it's not working. what missing?

Java tracing confusion -

can me understand why java trying make instance of before b. , also, why looping between line 2 , line 3? public class winterfell { private winterfell a= new winterfell(); public winterfell() throws exception { throw new exception("fire , ice"); } public static void main(string[] args) { try { winterfell b = new winterfell(); system.out.println("surprise!"); } catch (exception ex) { system.out.println("i told so"); } } } this cause stackoverflowerror . by having field referencing new object of same class or making new object of same class in constructor have infinite number of calls create new winterfell object. that why looping. to fix want remove private winterfell a= new winterfell(); single winterfell object created.

java - how to update information on a popup window while the execution continues -

i have cancel popup custom ok button confirmation , i'd update progress information on execution goes on. popup follows <af:popup id="confirmationpopupsend" binding="#{pageflowscope.bean.confirmationpopup}" contentdelivery="immediate"> <af:dialog id="confirmationdialogsend" modal="true" title="confirmation" type="cancel"> <f:facet name="buttonbar"> <af:commandbutton id="confirmdialogbuttonsend" text="ok" action="#{pageflowscope.bean.submitaction}"/> </f:facet> <af:outputtext value="are sure? might take while."/> <af:outputtext visible="#{pageflowscope.bean.someprogress> 0}" value="#{pageflowscope.bean.someprogress}" /> </af:dialog> </af:popup> my submitaction method follows public string submitaction() { for(so...

android - MonkeyRunner instrumentation sends a ShellCommandUnresponsiveException during test execution -

i trying run test instrumentations using monkeyrunner, somehow can't work should. after few seconds of test, execution stops shellcommandunresponsiveexception , while test still running on device. my monkeyrunner script following : # -*- coding: utf-8 -*- # imports monkeyrunner modules used program import os com.android.monkeyrunner import monkeyrunner, monkeydevice # connects current device, returning monkeydevice object device = monkeyrunner.waitforconnection() # variables commands params = dict() params['class'] = 'com.foo.test.testcases#testmethod' device.instrument('com.foo.test.test/android.test.instrumentationtestrunner', params) and exception 160205 17:33:48.856:s [mainthread] [com.android.chimpchat.adb.adbchimpdevice] error executing command: instrument -w -r -e class com.foo.test.testcases#testmethod com.foo.test.test/android.test.instrumentationtestrunner 160205 17:33:48.856:s [mainthread] [com.android.chimpchat.adb.adbchimpdevice]...

How can I modify the color used for Flot zoom selection? -

i've based graph on example shown @ http://www.flotcharts.org/flot/examples/visitors/index.html , works fine, users complaining pink color showing selection light them use well. i can find plenty of docs series colors, linechart colors, can't determine can modify pink used in example. possible in options somewhere? you can change color in selection options: selection: { mode: null or "x" or "y" or "xy", color: color, shape: "round" or "miter" or "bevel", minsize: number of pixels } but can't change opacity this, hardcoded 0.4 in flot.selection.js file in line 323. change there if selection light.

google chrome extension - Be able to load Polymer on any existing page -

i developing extension uses polymer. if polymer exists on page, things start break. trying figure out solid strategy of loading polymer in way doesn't conflict current page's polymer (if 1 exists). i loading polymer , components such: function loadres(res) { return new promise( function(resolve, reject) { var link = document.createelement('link'); link.setattribute('rel', 'import'); link.setattribute('href', res); link.onload = function() { resolve(res); }; document.head.appendchild(link); }); } loadres(chrome.extension.geturl("polymer/polymer.html")) .then( loadres(component1url)) ) .then( loadres(component2url)) ) ... in addition, have gulp job obfuscate names of custom elements within extension such: gulp.task('build:polymer', function(){ gulp.src(polymer) .pipe(replace('polymer', 'polymer' + app_key)) ...

git - Can i push a new local branch to remote 'feature/new_branch'? -

based on : how push new local branch remote git repository , track too? i have local branch named 'new_branch' , push local branch remote following: $ git ls-remote origin 433ecee11614bcda452ddf5817ebb56212d96192 head 94d6b198dd6bbba9520e8aa11a1d6fc67aed818a refs/heads/feature/f1 76d6b198dd6bbba9520e8aa11a1dafc67aed818a refs/heads/feature/f2 $git push -u origin feature/new_branch the git reports following errors: fatal: 'origin/feature/new_branch' not appear git repository fatal: not read remote repository. i try following , works me not want. $git push -u origin new_branch my local environment has not installed 'git flow'. possible can directly push non-feature local branch feature branch in remote? thank you if want push feature/new_branch, git push origin new_branch:feature/new_branch -u . however, recommend rename local branch git branch -m new_branch feature/new_branch first, push origin, avoid confusion...

android multiple fragments communicating to the activity through the same interface -

i working on application expect migrate multiple platforms. facilitate porting, i'm using fragments streamline process. have right single activity , several fragments . in 1 case have several instances of same fragment , different data. each of these instances of same fragment use same interface functions. i've added parameter "tag" interface function identify each instance of fragment (using tag used in creating fragment). guess 1 use resource id . my question : way this? there better or more accepted method? activity code snippet: public class sailboatraceactivity extends fragmentactivity implements sr_commandsfragment.onsr_commandsselectedlistener, sr_subcommands_fragment.onsr_subcommandsselectedlistener, fleetlistfragment.fleetlist_widthchange, fleetlistfragment.fleetlistchange, fleetscoringfragment.onfs_selectedlistener, fleetspinnerfragment.fleetspinner_selection { // state variables private int msubcommandpositon; priv...

For loop with If and elif or else in python -

question 1: just tried execute program getting syntax error i=input('enter value of i') j in range(10): if i==j: print'the value of %d'%(i) elif i!=j: print'please enter valid value' else: print 'this not number' the difference between below 2 codes code 1 ask input once , loop trying compare, while code 2 ask input each loop (10x)...

eclipse - Get human readable name of extension point contributor -

how can human readable name iconfigurationelement ? i've found out can use lement.getdeclaringextension().getdeclaringplugindescriptor().getlabel() last 2 methods marked deprecated. there alternative? to name of declaring plugin (the bundle-name in manifest.mf) use: iconfigurationelement element = ... string contributorname = element.getcontributor().getname(); bundle bundle = platform.getbundle(contributorname); string bundlename = bundle.getheaders().get("bundle-name");

scripting - Remove spam from loop command in batch file -

this i'm doing, , works...but it's not pretty. :scan<br> echo "running scan again..."<br> /f %%i in ('%systemroot%\system32\schtasks.exe /query /s server /fo list /tn "task" ^| %systemroot%\system32\find.exe /c "running"') if "%%i" == "3" goto :scan if gets return of 3, repeats on , on until result changes. that's working. i'm wondering is, how make doesn't spam window running scan again... on , on until ends? can have 1 instance of running scan again... shown, have task continue? to elaborate on stephan's response. put label below text want omit, change goto point that. example, see :scannolabel changes below :scan echo "running scan again..." :scannolabel /f %%i in ('%systemroot%\system32\schtasks.exe /query /s server /fo list /tn "task" ^| %systemroot%\system32\find.exe /c "running"') if "%%i" == "3" goto ...

sql - MySQL get the nearest future date to given date, from the dates located in different table having Common ID -

i have 2 tables - client , banquet client table ---------------------------- id name 1 john 2 jigar 3 jiten ---------------------------- banquet table ---------------------------- id client_id dated 1 1 2016.2.3 2 2 2016.2.5 3 2 2016.2.8 4 3 2016.2.6 5 1 2016.2.9 6 2 2016.2.5 7 2 2016.2.8 8 3 2016.2.6 9 1 2016.2.7 ---------------------------- :::::::::: **required result** ---------------------------- id name dated 2 jigar 2016.2.5 3 jiten 2016.2.6 1 john 2016.2.7 the result generated such that 1. date future : closest or equal current date, further related respective client should filtered , ordered in format given in required result curdate() current case 5.2.2016 failed: query logic 1 select c.id, c.name, b.dated client c, banquet ...

excel - Mismatch Error when adding a new workbook -

update #2: have split line set excelbook = workbooks.add 2 separate lines ( workbooks.add , set excelbook = activeworkbook ) , still randomly receiving error. not happen every time, when directs me line workbooks.add (still receiving same type mismatch error). sub newworkbook(companyname string, outputdirectory string, scenario string) dim excelbook workbook dim copyarea range set copyarea = range("copyarea") workbooks.add set excelbook = activeworkbook copyarea.copy excelbook.sheets("sheet1").range("a1").pastespecial xlpastevalues excelbook.sheets("sheet1").range("a1").pastespecial xlpasteformats excelbook.sheets("sheet1").columns(2).entirecolumn.delete excelbook.sheets("sheet1").rows(6).entirerow.delete excelbook.sheets("sheet1").cells.entirecolumn.autofit application.displayalerts = false excelbook.close savechanges:=true, filename:=outputdirectory + "\" + replace(replace(replace...

jquery - Making a tab sleeted on an event -

i making tabs using $("#tabs").tabs(); but have button on page on clicking button 3rd tab should made selected. how can that? use active options of tab ... doc here try this $('#buttonid').click(function(){ $("#tabs").tabs({ active: 2 }); //2 because zero-based index of panel });

batch file - How to write passed variables using sendkeys -

brief explanation: trying use sendkeys type 2 variables/keys output of batch file. i keep getting syntax or out of subscript errors. two variables passed batch script, via: cscript //nologo sendkeys.vbs !config! !arguments! rem yes, both variables defined, , delayed expansion in enabled. my attempts put them in sendkeys doesn't seem work. i'm not familiar vbs... vbscript: set wshshell = wscript.createobject("wscript.shell") wshshell.run "notepad.exe", 9 ' start notepad in order test failure. wscript.sleep 500 ' give notepad time load wshshell.sendkeys & wshshell.arguments(0) ' write passed !config! variable wshshell.sendkeys "{tab}" ' tab key wshshell.sendkeys & wshshell.arguments(1) ' write passed !arguments! variable wshshell.sendkeys "{enter}" ' enter key the .arguments belong wscript object, not shell. & co...

java - Can't Get address using Longitude & Latitude Android -

i trying address longitude , latitude unable address. getting longi. , lati. value when pass function of getaddress stop working kindly me if guys can. here code mainactivity.java file package com.example.mygps; import java.io.ioexception; import java.util.list; import java.util.locale; import android.app.activity; import android.location.address; import android.location.geocoder; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; import android.widget.toast; public class mainactivity extends activity { button btnget; gps_class gps; textview adr,cty,ctry; double longi, lati; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btnget = (button)findviewbyid(r.id.btngo); adr = (textview)findviewbyid(r.id.adr); cty = (textv...

How to retrieve output of a JSON request in Java? -

i looking use json interface: https://translate.yandex.net/api/v1.5/tr.json/translate ? key=<api key> & text=<text translate> & lang=<translation direction> & [format=<text format>] & [options=<translation options>] & [callback=<name of callback function>] more info it returns json object. how json object in java ? i know there implementation exact api, it's old , not working anymore. i've had results using google's gson library . depends on doing json data - rest payload, jms message or what? lot of stuff understands json natively don't reinvent wheel.

emacs - Change autoindent offset in C after inserting a curly bracket -

i relatively new emacs environment , have trouble find solution problem. what happens when insert curly bracket e.g. foo( , automatically adds 4 spaces in front of current line. i using bsd c style. there setting can change behavior? have tried changing c basic offset has no effect far. emacs isn't adding spaces, instead it's "fixing" indentation, thinks 4 spaces per indentation level. c-basic-offset variable want change, should put in .emacs : (setq-default c-basic-offset 2) you need setq-default . if use setq , change current buffer.

php - Codeigniter dropbox api -

i tried make upload in codeigniter jimdoescode library got error: a php error encountered severity: 8192 message: curl_setopt(): usage of @filename api file uploading deprecated. please use curlfile class instead filename: libraries/dropbox.php line number: 493 code in library curl is: private function _connect($url, $header, $request, $postdata = false, $destination = false) { $ch = curl_init($url); curl_setopt($ch, curlopt_httpauth, curlauth_basic ) ; curl_setopt($ch, curlopt_sslversion, 1); // require tls curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_cainfo, __dir__."/certs/trusted-certs.crt"); curl_setopt($ch, curlopt_capath, __dir__."/certs/"); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_customrequest, $request); curl_setopt($ch, curlopt_httpheader, explode(self::line_end, $header)); ...

python - django-markupfield returns string -

Image
i'm trying set django app has markupfield in it's model, this: from django.db import models markupfield.fields import markupfield class recipe(models.model): instructions = markupfield(default_markup_type='markdown') then render field in jinja2 template, this: {% if recipe.instructions %} {{ recipe.instructions }} {% else %} no instructions have been added yet. {% endif %} rendering of markdowned text works flawless, placed string inside dom browser doesn't interpret html tags, can see here: i don't feel missed relevant in django-markupfield's docs, somehow need rid of string representation. anyone of guys got idea? in advance. thanks @doru's advices stumbled across jinja2 documentation , found autoescaping statement: {% autoescape off %}{{ recipe.instructions }}{% endautoescape %} this 1 worked me. it's possible make work globally setting autoescape option false . { 'backend': 'djan...

c# - LINQ with List<object> -

i trying fetch few rows db. with code, 1 specific row. int mid =1; classa obja = obj1.exp.values.firstordefault(i => i.id == mid); classb objb = obj1.pol.values.firstordefault(i => i.gid == obja.mgid); but, want have list of rows, remove firstordefault list. how can ? list<classa> l_obja = obj1.exp.values.where(i => i.id == mid).tolist(); list<classb> l_objb = obj1.pol.values.where(i=> l_obja.contains(i.mgid)); // rows l_obja.mgid = i.mgid i tried this, not work can please me this. you want use any since l_obja not list of ids. list<classa> l_obja = obj1.exp.values.where(i => i.id == mid).tolist(); list<classb> l_objb = obj1.pol.values.where(i => l_obja.any(a => a.mgid == i.gid));

shell - Bash Script to check host status -

i have file 1.txt has 1 line per ip or host, ie: yahoo.com 8.8.8.8 i trying write bash script parse through text file see if host or not. need store status of host on namesake text file , loop process indefinitely. here progress far, somehow doesnt seem working, not sure why. while read ip ; ping -c 1 $ip | grep -e -o '[0-9]+ received' | cut -f1 -d' ' > $ip-status $status=$(cat $ip-status) if [ $status = "1" ]; echo "$ip up" fi echo "$ip down!" done < 1.txt any appreciated. why not take different approach , this: while true; in $(cat test); dig +short +timeout=2 +tries=3 "$i" && echo "$i" || echo "$i" not responding; sleep 2; done; done; here tested output: $ while true; in $(cat test); dig +short +timeout=2 "$i" && echo host "$i" || echo host "$i" not ...

mongodb - Deploying Meteor + Angular2 app to Heroku -

i have app i'm writing using meteor, angular2 (using angular-meteor package), typescript, , mongodb. i'm trying put on heroku , running difficulties. i'm using meteor buildpack . i'm not sure whether problems meteor, heroku, or angular2, though suspect it's heroku isn't configuring correctly angular2. site @ http://alfred-zahner.herokuapp.com/ , error i'm getting is: exception: no provider t! (e -> t) i've checked heroku logs , there no sign of trouble there. part of problem can't see t , e are, (heroku?) uglifying javascript. i'm not sure how proceed in debugging this. one way solve problem figure out , fix error, i'd happy if there's better build pack, or better (must free!) hosting environment using. edit it's not heroku's problem. same thing happens when deploying meteor's built in deployment testing ( meteor deploy site.meteor.com ). if deploy using meteor deploy --debug site.meteor.com , however,...

android - Animate views before activity finished -

i use view animations in predrawlistener animate activity start. exist similar listener animate views before activity finished? i know overridependingtransition method animations in xml want use viewpropertyanimations in programmatically way specific views. i suggest override finish() method, add animation there: @override public void finish (){ // animation super.finish(); } you can call youractivity.finsih(); when want finish activity code.

c# - Best design pattern for integrating third-party api or services -

i integrating outside apis layered application. usual layered apps, has 3 layers , hooking apis business layer. "thrid party api , services", mean payment gateways, postcode ups, etc. currently, each api, create service contract interface , api wrappers inherit interface class. , interface injected business classes' constructors , ioc container resolve @ entry point of application. i decouple api layers business layers , make them re-usable in other projects well. question that, there better way or design pattern use integrating outside services. appreciate link guides or code snippets. for each third party api create interface put in separate project. create new project implementation of each interface. for example project structure like yoursolution ... -company.interfaces.thridpartyapi1 -company.interfaces.thridpartyapi2 -company.interfaces.thridpartyapi3 -company.services.thridpartyapi1 -company.services.thridpartyapi2 -company.serv...

ruby on rails - CSV file appearing backwards and RSpec failing -

i new ruby in general , cannot find solution why entries_2.csv imported backwards. other .csv import appears same syntax , working fine. here portion of rspec .csv method: require_relative "../models/address_book" rspec.describe addressbook let(:book) {addressbook.new} def check_entry(entry, expected_name, expected_phone_number, expected_email) expect(entry.name).to eq(expected_name) expect(entry.phone_number).to eq(expected_phone_number) expect(entry.email).to eq(expected_email) end describe "#import csv" "imports correct number of entries" book.import_from_csv("entries.csv") book_size = book.entries.size expect(book_size).to eq 5 end "imports 1rst entry" book.import_from_csv("entries.csv") entry_one = book.entries[0] check_entry(entry_one, "bill", "555-555-4854", "bill@blocmail.com") end "...

QBasic pass type as function argument -

went old qbasic nostalgic reasons , have never used types , functions in qbasic before young time. type vector2 x single y single end type function vector2mag (a vector2) vector2mag = sqr((a.x * a.x) + (a.y * a.y)) end function function vector2add (a vector2, b vector2) dim r vector2 r.x = a.x + b.x r.y = a.y + b.y vector2add = r end function but get illegal sub/function parameter on current line using qb64 in both first function lines. google didn't looks doing right. checked passing multiple variables, specifying type parameter, how use types nothing helped. thanks guys. it has been while, believe problem can't return udt (user defined type, a.k.a. "any type not built in"). need pass third argument vector2add , make sub . example: sub vector2add (r vector2, vector2, b vector2) r.x = a.x + b.x r.y = a.y + b.y end sub the sub exact translation equivalent c code, aside syntax differences. reasoning add...