Posts

Showing posts from July, 2011

c# - File contents filtering -

i'm trying develop application take data datagrid , based on drop down menu choice return csv file selected client . code shown below , links previous question posted howeever still getting no values , need sort out i'm wondering if can either see i'm going wrong or else provide alternatives //master inventory export private void exportclass_click(object sender, eventargs e) { stringbuilder str = new stringbuilder(); objsqlcommands2 = new sqlcommands("masterinventory", "clientname"); string strstring = str.tostring(); string filepath = txtsaveshareclass.text.tostring(); str.append("isin ,fundname,status,share ccy,benchmark,nav freq,classcode,simulation,hedged,fundccy"); stringmanipulation sm = new stringmanipulation(); foreach (datarow dr in this.calcdataset.masterinventory) { foreach (object field in dr.itemarray) { str

angularjs - How to trigger an event in one view from a different view? -

i trying open angular accordian in header.html clicking button in body.html . triggering event in 1 view different view. have idea how in angular? what can using events let accordion directive know happend or use shared service. considering performance, not make huge difference, if use $emit instead of $broadcast since event fired via $emit bubbles scope hierarchy , $broadcast sends event down. make sure fire event on $rootscope , won't event bubble anymore. so in case want use events have method on component fires event via $emit on $rootscope follows: function openaccordion() { $rootscope.$emit('on-accordion-open', null); } you use in view, e.g. in body.html . remember function above part of directive / component or controller. <button ng-click="vm.openaccordion()">open accordion</button> also note assume using controlleras syntax (set vm ). in accordion directive can hook listeners several events example on-accor

Android RecyclerView using VideoView in ViewHolder -

i want play video using recyclerview , using recyclerview.smoothscrolltoposition() scroll page. when recyclerview using videoview in viewholder , onbindviewholder(viewholder, position) position can't match recyclerview current position, can't control videoview. adapter: interface control { int getcurrentposition() ; } control control; public recyclerview.viewholder oncreateviewholder() { log.i(tag, "oncreateviewholder()...page: " + control.getcurrentposition() ); } public void onbindviewholder(viewholder, position){ log.i(tag, "onbindviewholder()...position: " + position + ", page: " + control.getcurrentposition() ); int page = control.getcurrentposition(); // position maybe difference page value } activity: int page; void oncreate() { adapter = new adapter(new adapter.control() { @override public int getcurrentposition() { return page; } }

c# - Microsoft Access datasource in visual studio -

Image
what should select access database in visual studio ? hera attaching image convenience please help..! how solve problem,it not gives browse option select access database

android - How to jump character with using JoyStick in Mobile Touch Screen? -

Image
i want jump , move character @ same using 1 joystick. there idea? in joystick; left key allow character move left. right key allow character move right. up key allow character jump . currently, character moves left , right using crossplatforminput. want add jump feature up-key of joystick. don't want use jump button. here codes moving character public class platformer2dusercontrol : monobehaviour { private platformercharacter2d m_character; private bool m_jump; private void awake() { m_character = getcomponent<platformercharacter2d>(); } private void update() { if (!m_jump) { // read jump input in update button presses aren't missed. m_jump = crossplatforminputmanager.getbuttondown("jump"); } } private void fixedupdate() { // read inputs. bool crouch = input.getkey(keycode.leftcontrol); float h = crossplatforminputman

c# - IEnumerable state machine larger than return List -

i'm not sure has huge effect on modern day computers. however, interesting know. i've been reading these resources trying find out if on head of using iterator state machine larger returning list. emphasis not on ability lazy load, in example makes no odds on when evaluated. resoures: c# yield return performance when not use yield (return) is there ever reason not use 'yield return' when returning ienumerable? https://blogs.msdn.microsoft.com/wesdyer/2007/03/23/all-about-iterators/ https://coding.abel.nu/2011/12/return-ienumerable-with-yield-return/ is 'yield return' slower "old school" return? now last resource closest. it comes down if know length of list constant is: is footprint of ienumerable<t> state machine > list<t> so: public void ienumerable<customclass> getcustoms(string input) { foreach (var ch in input.tochararray()) yield return new customclass(ch); } does state machine cre

https - Configuring Mamp Pro for SSL (not self-signed) -

i running website proper .com domain name mamp pro. i'd accessible using https. i bought comodo ssl certificate. got mamp pro working fine self-signed certificate, can't recognise comodo ssl cert , key files. when select them in mamp pro's hosts > ssl tab, "save" button greys out can't save change. it's if files being checked , seen invalid or something. the comodo ssl cert came zip file 4 certificate files: 1 domain , 3 "intermediate" certs. combined latter 3 positivessl.ca-bundle per https://www.devside.net/wamp-server/installing-comodo-positivessl-certificate-bundled-with-root-and-intermediate-ca-certificates-on-apache don't know tell mamp file. i'd grateful ideas! sadly appears mamp pro isn't capable of using comodo ssl cert. at point, mamp pro still running apache 2.2, apache < 2.4.8 not accept certificate , ca bundle combined in single file.

php - Adding new field to Laravel boilerplate user model -

i'm trying add new field laravel boiler user model. in fresh laravel have app/user.php can add field using $fillable . in boilerplate have app/models/access/user/user.php , have id guarded protected $guarded = ['id']; . password, remember_token $hidden protected $hidden = ['password', 'remember_token']; else default fillable. but when i'm trying add new field user model , it's not adding database table. table have field called summery . i've added summery field register.blade.php , tried check if it's passing. added return ($request); app\service\access\trait\registersusers.php public function register(registerrequest $request) { if (config('access.users.confirm_email')) { $user = $this->user->create($request->all()); event(new userregistered($user)); dd ($request); // return redirect()->route('frontend.index')->withflashsuccess(trans('exceptions.f

ios - didEnterRegion, didExitRegion not being called -

i've been experimenting region monitoring in order show alert or local notification when user within set region. first step, added print line see if works on debug area. however, while other lines being printed, i'm not getting didenterregion , didexitregion. i simulating location in/outside of given region having no luck. great if @ code below , see i've missed. thank you. import uikit import corelocation class viewcontroller: uiviewcontroller, cllocationmanagerdelegate { var manager = cllocationmanager?() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. manager = cllocationmanager() let latitude: cllocationdegrees = 48.858400 let longitude: cllocationdegrees = 2.294500 let center: cllocationcoordinate2d = cllocationcoordinate2dmake(latitude, longitude) let radius: cllocationdistance = cllocationdis

friendly id - Rails :: Generate slugs with FriendlyId, Globalize and slug_candidates -

i building rails application , stuck when generating slug article second locale defined. main locale (french), checked if article have title , if it’s case add integer (id) @ end second locale (english) it’s generate slug without checking if article exists (which give me duplicated slugs). here model : class post < activerecord::base translates :title, :slug, :content, fallbacks_for_empty_translations: true active_admin_translates :title, :slug, :content, fallbacks_for_empty_translations: true extend friendlyid friendly_id :slug_candidates, use: [:slugged, :globalize, :finders] private def slug_candidates [:title, [:title, :deduced_id]] # works main locale not others end def deduced_id self.class.where(title: title).count + 1 end end how can id added slug secondary locales when article exists same title ? thanks ! my project : rails 4.2.6 activeadmin 1.0.0.pre2 globalize 5.0.1 friendlyid 5.1.0 friendlyid-globalize 1.0.0.alpha2

ajax - Soundcloud likes/favorites -

i trying load soundcloud likes (used favorites), not getting results ajax query. this url trying load: http://soundcloud.com/gazebo-fm/likes function soundcloudtrackdata(linkurl) { var url = soundcloudapiurl(linkurl, soundcloudapikey); $.ajax({ url: url, datatype: 'jsonp', cache: false }).done(function( data ) { console.log(data); }).fail(function(jqxhr, textstatus, errorthrown) { alert('soundcloud process error: ' + jqxhr.responsetext); }); } function soundcloudapiurl(url, soundcloudapikey) { var usesandbox = false; var domain = usesandbox ? 'sandbox-soundcloud.com' : 'soundcloud.com' return (/api\./.test(url) ? url + '?' : 'http://api.' + domain +'/resolve?url=' + url + '&') + 'format=json&consumer_key=' + apikey +'&callback=?'; }; change url http://soundcloud.com/gazebo-fm/favorites /likes used in n

mysql - How come this SQL query works? -

Image
this exercise wikibooks, #6 the table schema the question is: for each piece, find expensive offering of piece , include piece name, provider name, , price (note there 2 providers supply same piece @ expensive price). the solution: select pieces.name, providers.name, price pieces inner join provides on pieces.code = piece inner join providers on providers.code = provider price = ( select max(price) provides piece = pieces.code ); i don't understand subquery part. think typical way find max price select max(price) provides group piece; in way, can not use price = subquery or price in subquery, , sub query in solutions, looks like select max(price) provides, pieces provides.piece=pieces.code; it return biggest number, can not figure out why can 'group' , return right rows. although thomas provide simpler solution, lets original question, why work. select pieces.name, providers.name, price pieces

c# - Passing arrays as parameter -

if modify content of array passed parameter inside method modification done on copy of argument instead of original argument hence result not visible. what process happens when call method have reference type argument? here code sample of want ask using system; namespace value_refrence_type { class program { public static void main() { int[] callingarray = { 22, 200, 25485 }; abc(callingarray); console.writeline("this callingarray"); foreach (int element in callingarray) console.writeline(element); } //method parameter static void abc(int[] calledarray) { console.writeline("method called--------"); foreach (int element in calledarray) console.writeline(element); //here on changing value of elements of calledarray does't afftect value of element of callingarray

objective c - Private API iOS iCloud lock + Find My iPhone status & Uniquely identify devices -

i not looking app-store submission , creating enterprise level app. there few problems have run while trying create in-house application our users , 1 of them uniquely identifying devices can know device list of devices have @ backend. we not planning on using mdm servers- using ota deployment of app, need know when every-time device communicates within app our secure server device is. identification important because should stay intact after device wipe and/or advertising identifier reset. identifying devices using udid/ serial number not possible in app-store apps wanted know if possible using enterprise in-house apps? have seen answers on stackoverflow using various options , have not been able find why have created question here. plus need way find out using method in private apis if device icloud locked account (yes | no) , if find iphone turned on (yes | no) if has idea this? appreciated. i think gist, located here , helpful. specifically, mac address, batt

java - find pairs in int [] b;? -

how find pairs of numbers chosen b, example have int [] b = {1,2,3,5,4,3,2,1,1}; and need print pairs found in integer array , position @ keep in mind tried compare them this for (int = 0; < ia.length; i++) { number = 0; (int j = 0; j < ia.length; j++) { if (ia[i] == ia[j]) { number++; } } if (number%2==0) { system.out.println("found pairs @ ia["+i+"] = "+ia[i] ); } } but problem keeps comparing other numbers if have number can found 3 times first time compare , it's not pair second time not compared previous value instead of 3 find 2 , it's pair thank taking time in responding question you have few errors in there, here go: int[]ia={1,2,1,2,2}; (int = 0; < ia.length; i++) { int number = 0; (int j = 0; j < ia.length; j++) { if (ia[i] == ia[j]) { number++; } }

python - RxPy with_latest_from producing inconsistent results -

i'm using group_by on observable each newly created group, want snap element (with new key) caused group created using with_latest_from : >>> __future__ import print_function >>> rx import observable >>> # sequence 1, 2, 3, ... every half second >>> observable=observable.interval(500).map(lambda x: x + 1) >>> # groups numbers divisible 3 (true) , not (false) >>> grouped = observable.group_by(lambda x: bool(x%3)) >>> # groups paired first element kicked off group >>> grouped.with_latest_from(observable, lambda group, element: (group, element)).subscribe(print) i'm expecting see both of below printed, seeing either 1 each time. (<rx.linq.groupedobservable.groupedobservable object @ 0xabc>, 1) # 1 element created group key=false (<rx.linq.groupedobservable.groupedobservable object @ 0xdef>, 3) # 3 element created group key=true on odd occasion see snapped element 2: (<rx.lin

asp.net - get value from string or store in database? -

this viewcreditrequest html page: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" cssclass="table table-hover table-striped" onrowcommand="gridview1_rowcommand" onselectedindexchanged="gridview1_selectedindexchanged"> <columns> <asp:boundfield datafield="username" headertext="username" sortexpression="username" /> <asp:boundfield datafield="lastname" headertext="lastname" sortexpression="lastname" /> <asp:boundfield datafield="firstname" headertext="firstname" sortexpression="firstname" /> <asp:boundfield datafield="companyname" headertext="companyname" sortexpression="companyname" /> <asp:boundfield datafield="emailaddress&q

vector - Calculate point on a circle in 3D space -

i scratching head time how this. i have 2 defined vectors in 3d space. vector x @ (0,0,0) , vector y @ (3,3,3). random point on line between 2 vectors. , around point want form circle ( amount of points ) perpendicular line between x , y @ given radius. hopefuly clear looking for. have looked through many similar questions, cant figure out based on those. help. edit: (couldnt put comment adding here) @willywonka hi, reply, had moderate success implementing solution, has trouble it. works of time, except specific scenarios when y point @ positions (20,20,20). if sits directly on axis fine. but gets diagonal distance between perpendicular point , origin gets smaller reason , @ specific diagonal positions kinda flips perpendicular points. image here code at public vector3 x = new vector3(0,0,0); public vector3 y = new vector3(0,0,20); vector3 a; vector3 b; list<vector3> points = new list<vector3>(); void findperpendicular(vector3

c# - VB.NET Custom DataGridView control - Duplicate columns at runtime? -

i making control inherits datagridview. adding columns programmaticly in controls constructor, so. public sub new() mybase.new() 'this call required component designer. initializecomponent() optionsform = new frmoptions(me) 'note: add columns programmatically rather via designers properties window, or duplicated when added form! dim colipaddress, colport, colstatus, colspeed, colcountry new datagridviewtextboxcolumn colipaddress.headertext = "ip" colport.headertext = "port" colstatus.headertext = "status" colspeed.headertext = "speed" colcountry.headertext = "country" columns.addrange({colipaddress, colport, colstatus, colspeed, colcountry}) rowcount = 1 me.refresh() end sub when add control form, displays columns correctly. during runtime, columns duplicated. added if statement columns added if current column count 0, still no avail. anyone know whats going on? thanks! :)

java - Recursively reversing a linkedlist -

this question has answer here: reversing linked list in java, recursively 32 answers i'm trying reverse linkedlist using recursive calls, please let me know i'm going wrong, i'm not able catch reversed ll head. llnode linkedlist node , reversellrecursively.reverse function wrote reversing. here code: public class llnode { private int data; private llnode next; public llnode(int data, llnode next) { this.data = data; this.next = next; } public int getdata() { return data; } public void setdata(int data) { this.data = data; } public llnode getnext() { return next; } public void setnext(llnode next) { this.next = next; } @override public string tostring() { return data + "->[" + (next!=null?next.data:"") + "]&q

javascript - How to get the index of button in function when I click button? -

<button class="btn btn-warning delcartitem" onclick="delcartitem(3)"> delete </button> <button class="btn btn-warning delcartitem" onclick="delcartitem(3)"> delete </button> ...so on i'm making button can delete shopping cart item. and parameter of delcartitem() product id. how index of button when click 1 of button in delcartitem() function? supplement: this purpose: when click button => index of button => use $('.item_price').eq(idx).text() price of shopping cart item <thead> <tr> <th> <h3><strong> 項目 </strong></h3></th> <th> <h3><strong> 商品編號 </strong></h3></th> <th> <h3><strong> 商品名稱 </strong></h3></th> <th> <h3><strong> 存貨量 </strong></h3></th> <th> <h3>

Python 3.4: zlib, deflate and shared dict -

any ideas how fix following code (python 3.4.3): import zlib hello = b'hello' co = zlib.compressobj(wbits=-zlib.max_wbits, zdict=hello) data = co.compress(hello) + co.flush() = zlib.decompressobj(wbits=-zlib.max_wbits, zdict=hello) data = do.decompress(data) print(data) fails me with zlib.error: error -3 while decompressing data: invalid distance far what trying decompress deflate compressed shared dictionary. you can't use negative wbits dictionary. negative wbits gets rid of zlib header , trailer, zlib header how decompress knows use dictionary. just rid of wbits options.

angular - Building Angular2 app on top of a platform -

i'm looking documentation/guides/any information angular2 compiler. i'm interested in doing using angular2 on top of different framework (having components templates translate platform code , not regular html). from i've seen on angular2 should possible , that's how angular2 built on top of reactnative , nativescript. the angular2 site doesn't have documentation this. closest thing have @angular/compiler api - no information on subject. anyone know start learning/researching kind of thing?

elixir - Phoenix Framework: What's the correct way to seed database for testing? -

i building first phoenix app , trying write test verify user retrieved jwt in connection's authentication header correct user, authenticated, etc. what correct way seed database single record test? should done: globally, using test/test_helper.exs file, requiring priv/repo/seeds.exs , executing manual ecto operations or per test (in case not how best proceed) finally , correct way clean out test database after running tests, can avoid trying create same record every time run test? usually best way keep tests separated each other , init per test. tests run inside ecto transactions rolled @ end , there no junk left. allows running tests in parallel. means user has inserted @ beginning of every test manually. if have more tests depend on user , current session can extract common code tag. usually data logged in user kept in conn.assigns . lets pretend under key :user . inside app.conncase setup function add this: setup %{conn: conn} = config my

java - Create RMIServer during remote call -

i have following problem: two nodes (a,b) a has rmi client connected b's rmi server a invokes remote method on b during invokation, b changes variables , should create rmi server the problem cannot create rmi server during remote call (fired connects b). new rmi server should created on b's localhost (otherwise error: java.rmi.accessexception: registry.registry.rebind disallowed). so what's solution that? thinking scheduling task on thread runs on b after receives remote method invokation a. possible? you have misstated problem. can create rmi server during remote method call. problem can't bind registry running in remote host. this can mean client doing bind. the solution have new server bind itself, or have remote method creates so.

bash - Run command line script on load of a web page -

i want bash script sits , listens , runs script when load specific web page in browser. wondering if possible, , if so, how go it? i'm thinking should possible somehow. i'm on mac , in /etc/hosts file can specify specific websites should blocked, e.g. " www.facebook.com ". so in short. (and how) possible run bash script when computers browser navigates webpage, example " www.facebook.com "? updated answer if want matching of name of site pre-defined site, , something, script this: #!/bin/bash while :; site=$(osascript -e 'tell application "safari" return url of front document') if [[ $site =~ stackoverflow ]]; "stack overflow! quality site" fi sleep 1 done original answer you aren't specific browser using, page or want do, script sits , watches safari , asks page looking @ , prints in terminal. modify detect pages , run script when navigate them. #!/bin/bash while :; osascript -

ios - Proper use of NSPredicate to retrieve data -

as first attempt guide me , tell me doing wrong. after several tutorials i've tried create mechanism displays search results according user's input. app searching in array multiple element objects: @interface element : nsobject{ nsinteger id; nsstring *ename; nsinteger ecategory; nsstring *edescription; addressbook *eaddress; } i using code below: - (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope{ nspredicate *resultpredicate = [nspredicate predicatewithformat:@"(ename contains[cd] %@)", searchtext]; searchresults = [allelements filteredarrayusingpredicate:resultpredicate]; } my problem that, results not expecting. returns element s ename not match searchtext have noticed given text appeared in edescription ! how above can modified in order given text in ename of element ?

javascript - Subscribe to EventEmitter in Angular2 not working -

i'm learning angular 2. i'm trying send data component other on click of first one. both components siblings. this code far: first component: @component({ selector: 'jsontextinput', templateurl: '../templates/jsontextinput.html', directives: [card, cardtitle, carddescription, icon], providers: [jsonchangeservice] }) export class jsontextinput { json: string = ''; constructor (private jsonchangeservice: jsonchangeservice) { this.jsonchangeservice = jsonchangeservice } process () { this.jsonchangeservice.jsonchange(this.json) } } this service: import {injectable, eventemitter} '@angular/core'; @injectable() export default class jsonchangeservice { public jsonobject: object; statechange: eventemitter<any> = new eventemitter<any>(); constructor (){ this.jsonobject = {}; } jsonchange (obj) { console.log('sending', obj) this.jsonobject = obj this.statechang

jquery - fittext.js does not work and it drives me mad -

i'am intergrating fittext.js in website nothing. , can't find problem. maybe else? this code css code .nav-text { font-size: 24px; font-weight: bold; text-align: center; display: block; margin-top: 5px; padding-top: 0px; } html code <div class="nav small-4 large-2 columns padding_bottom_30"><a href="#"><img src="/img/wat-thumbnail.png" alt="wat"><br/> <p class="nav-text">wat</p></a></div> jquery code <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <!--fit-text--> <script src="/js/jquery.fittext.js"></script> <script> jquery(".nav-text").fittext(); </script> here's link live working version. thanks far! try separate the image , p tag, , use class of p-tag in jquery selector. this: <div> <p><a href="#"><img s

python - Autobahn Asyncio ReconnectingClientFactory -

i make reconnectingclientfactory asyncio. in particular handle case server not available when client started in case reconnectingclientfactory keep trying. asyncio.events.create_connection not do. concretely: the echoclient example fine. crux how connection made. factory = echoclientfactory('ws://127.0.0.1:5678') connectws(factory) in case of twisted version reconnectingclientfactory . vs factory = echoclientfactory(u"ws://127.0.0.1:5678") factory.protocol = secureserverclientprotocol loop = asyncio.get_event_loop() # coro = loop.create_connection(factory, 'ws_server', 5678) coro = loop.create_connection(factory, '127.0.0.1', 5678) loop.run_until_complete(asyncio.wait([ alive(), coro ])) loop.run_forever() loop.close() or similar asycnio version. the problem in asyncio version connection established asyncio.events.create_connection fails if server not available. how can reconcile two? many

java - how to calculate plane equation using three points and two vectors? -

i trying calculate 2 plane equations data of 2 dicom images , intersection line these 2 plane equations. dicom tag imagepositionpatient has 3 coordinates x,y,z , tag imageorientationpatient has 2 vectors each 3 components. how equation of plane can calculated using these 3 coordinates , 2 vectors? this code: public void showlocalizerline(view v) { //getting values infooffirst(); //this gets img position , orientation of src img infoofsecond(); //this gets img position , orientation of dst img string[] src_position_array = new string[3]; src_position_array = firstimg_position.split("\\\\"); src_position_xo = float.parsefloat(src_position_array[0]); src_position_yo = float.parsefloat(src_position_array[1]); src_position_zo = float.parsefloat(src_position_array[2]); string[] src_orientation_array = new string[6]; src_orientation_array = firstimg_orientation.split("\\\\"); src_orientation_vector1_a = float.parsefloa

laravel - Making it mendatory to get email with facebook oAuth with Socialite -

i trying use facebook oauth users login/register website. this, require user's email address facebook oauth dialog has option provide / not provide email if user's doesn't provide email, cannot re-request authorization facebook again considers user logged in , redirects call url. i using laravel , socialite package. any solutions?? socialite allows user information directly after successful authorization using $user = socialite::driver('facebook')->user(); $user->email; i expect $user->email contain users email address if accepted share app , empty if user denied email address sharing. , if $user->email empty throw error , ask user re-authorize. if it's not working try de-authroize user, guide can found here . a convenient way avoid issues display warning user should allow email sharing if wants log in facebook.

shell - Invalid filename given bluetooth transfer bash script -

being lazy bum am, i've been trying make simple bash script transfer files com phone. however, when run following script, keep getting "invalid filename given" for f in *.mp3 bluetooth-sendto --device=<address> ${f} done anyone can point me in right direction? :) one of files contains spaces. when don't quote parameter expansions undergo word splitting , globbing. rule of thumb should always quote: for f in *.mp3; [ -e "$f" ] || continue bluetooth-sendto --device=<address> "$f" done the reason [ -e "$f" ] || continue if no files found literal *.mp3 in f .

javascript - How to toggle jQuery element with a duration AND display? -

when want toggle off component can use $("#donkey").toggle(false); and when need toggled during time period can use $("#emailinvalid").toggle(700); but i'd combine two. want ensure component being toggled off (not toggled , forth) , want specify duration of process. according jquery api , i'm supposed able specify object options, too. however, following $("#donkey").toggle({ duration: 700, display: false }); only toggles donkey , forth (during said time, though), whereas i'd toggled invisibility. when reviewed options, noticed there's none addresses display , fear above treated jquery equivalently with $("#donkey").toggle({ duration: 700, biteme: "in donkey" }); how can make sure toggler hiding component (equivalent first line of code above) and can control time process done (equivalent second line of code above)? short answer - can't. your options build custom , carry out logic i

java - When adding background image : Error inflating class android.widget.ImageButton -

i'm not sure what's causing issue issue, whenever add image resource background imagebutton same error. app started there's barely code. here error: 05-28 12:22:08.158 7186-7186/com.example.myname.appname e/androidruntime: fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.example.myname.appname/com.example.litmo.appname.homescreen}: android.view.inflateexception: binary xml file line #22: error inflating class android.widget.imagebutton @ android.app.activitythread.performlaunchactivity(activitythread.java:2211) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2261) @ android.app.activitythread.access$600(activitythread.java:141) @ android.app.activitythread$h.handlemessage(activitythread.java:1256) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5103) @ java.lang.reflect.meth

In Jquery how to refer javascript's element created by document.createElement -

i have code written in javascript: var objto = document.getelementbyid('krishna') var href1 = document.createelement("div"); href1.setattribute("style","float: left"); objto.appendchild(href1); already many elements appended href1 in javascript. i want add more elements href1 using jquery i tried href1.append("<br>"); it says href1.append not function how use jquery append append element href1. you need turn native element jquery object. native elements don't recognize jquery methods try $(href1).append("<br>"); if want jquery alone code quite simple // create new <div> element , apply style var href1 = $("<div>").css('float','left'); // append id=krishna $('#krishna').append(href1);

sql - java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long -

i want return number of rows using native sql. console says me java.math.biginteger cannot cast java.lang.long . what's wrong? method: public long getnumrows(integer id){ session session = null; session = this.sessionfactory.getcurrentsession(); query query = session .createsqlquery("select count(*) controllnews news_id=" + id + ";"); list firstresult = query.list(); return (long) firstresult.get(0); } use biginteger#longvalue() method, instead of casting long : return firstresult.get(0).longvalue(); seems firstresult.get(0) returns object . 1 option typecast biginteger : return ((biginteger)firstresult.get(0)).longvalue(); but don't this. instead use way provided nambari in comments. i'm no user of hibernate, can't provide hibernate specific solution.

arduino - How can i send data from my android to a adafruit PN532 card reader via NFC? -

im new on working arduino cards , have problem, because have done application send "string" android phone via nfc, , worked well... thing when started work nfc card adafruit pn532, can't recieve , i'd know if can me or if have done before.. thanks! @override protected void onnewintent(intent intent) { if (intent.getaction().equals(nfcadapter.action_tag_discovered)) { /*string result = ""; toast.maketext(this, "etiqueta nfc detectada", toast.length_short).show(); result = bytearraytohexstring(intent.getbytearrayextra(nfcadapter.extra_ndef_messages)); etiqueta = result; medittext.settext(etiqueta);*/ parcelable[] rawmessages = intent.getparcelablearrayextra( nfcadapter.extra_ndef_messages); ndefmessage message = (ndefmessage) rawmessages[0]; // 1 message transferred medittext.settext(new string(message.getrecords()[0].getpayload())); }} @override pub

javascript - code breaks console.log()! -

i don't understand why i'm getting output: var frenchwords; fs = require('fs') var data = fs.readfilesync('frenchverbslist.txt', 'utf8'); frenchwords = data.split('\n'); console.log(array.isarray(frenchwords)); //true var x = frenchwords[0]; console.log("a: " + "look: " + x + typeof(x)); //outputs "stringk: abaisser" i don't understand why output isn't "a: look: abaisserstring" any explanation of what's going on gratefully received :-) gerard it's happening because file's lines of text terminated \r\n, not \n can reproduce with: var x = 'abaisser\r'; console.log("a: " + "look: " + x + typeof (x)); this outputs "stringk: abaisser" because cr (\r) char returns output cursor beginning of line string overrwrites output a: loo chars. so try changing data.split call to: frenchwords = data.split('\r\n'); or isma

Can I use JQuery functions on a variable and not have JQuery reference the DOM over and over again? -

var x = $("element"); $(x).width(95); very, new jquery. want item dom , use jquery functions on item. want make sure not getting item dom on , on again. or getting item dom second time? if can avoid , use jquery functions? how that? do need care? feel should. i want make sure not getting item dom on , on again. or getting item dom second time? no. $() returns jquery object contains collection of elements. have been found in dom. you not need pass $ either, " $ ": var x = $("element"); x.width(95); if pass $ object $ , creates copy of collection - not search items again, clones list. do need care? feel should. yes, , should. executing selector against dom can expensive. don't want executing every time.

angularjs - How do I get the user claims after I have logged in with IdentityServer 4? -

i have used sample setup identityserver4 angular , webapi (asp.net core): https://github.com/damienbod/aspnet5identityserverangularimplicitflow everything working, can login , use api , everything, problem dont user information after login. need subjectid can specific user. thought returned claims or something, thing see in cookies token.

php - Shortcode output always appearing at top of page content -

Image
i have problem shortcode. how can change shortcode location ? instead of printing return return it! [resolved] plugin called via shortcode appears @ wrong place on post https://wordpress.org/support/topic/plugin-called-via-shortcode-appears-at-the-wrong-place-on-post?replies=5

Not able to save Camera Images in Android -

i trying save image camera. not working .. given permission code pasted below. not sure why not saving image code seems fine taken developer.android site . please help! public class cameraactivity extends activity { private camera mcamera; private camerapreview mpreview; private display display; private int previewsizewidth = 640; private int previewsizeheight= 480; public static final int media_type_image = 1; public static final int media_type_video = 2; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_camera); // create instance of camera mcamera = getcamerainstance(); // create our preview view , set content of our activity. mpreview = new camerapreview(this, mcamera,getwindowmanager().getdefaultdisplay()); framelayout preview = (framelayout) findviewbyid(r.id.camera_preview); preview.addview(mpreview); button capturebutton = (but