Posts

Showing posts from February, 2011

php - I am not able to show session variables as parameters in iframe Drupal 7 -

i trying values session variables while passing parameters iframe not able value saved in session mail variable .i using drupal 7 iframe module. here code..... <iframe id="if1" width="100%" height="254" style="visibility:visible" src="http://www.w3schools.com/?mail=<?php echo $_session['mail']; ?>" > </iframe>

qml - how to show 2 different active qt application on two different surfaces in a single screen for imx6 board -

how show 2 different active qt application on 2 different surfaces in single screen imx6 board? [edit] suppose there 2 application.mediaplayer , phone app.when mediaplayer running ,if tries call ,a pop show on top of mediaplayer accept or reject.so,there 2 separate surface in single screen , on accepting app change phone app screen , on reject there in player screen. [edit] both application individual i.e media player songs , phone calling.how possible combine in single app because in case if incoming call there pop appear on top of mediaplayer , on accept go phone screen.if can give logic solution better me. any appreciated.

wordpress - How to insert this php instruction into printf result? -

i new in php world , customizing wordpress template. i have following function in php file: function admired_posted_on() { printf( __( '<span class="sep">posted on </span> <a href="%1$s" title="%2$s" rel="bookmark"> <time class="entry-date" datetime="%3$s" pubdate>%4$s</time> </a> <span>blabla</span> <span class="by-author"> <span class="sep"> bla</span> <span class="author vcard"> <a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a> </span> </span> ', 'admired' ), esc_url( get_permalink() ), esc_attr( get...

c# equivalent for c++ vector or deque -

i should duplicate searched time , not find answer. should use in c# replace c++ vector , deque efficiently . need structure supports direct indexing effieciently , supports delete 1 or both ends(depending on vector or deque case) again in efficient manner. in java use arraylist @ least vector c# found this source states: arraylist resizes dynamically. elements added, grows in capacity accommodate them. used in older c# programs. . new way this? , again do deque case? there's no built-in deque container, there several implementations available. here's a 1 stephen cleary . provides o(1) operations index , insert @ beginning , append @ end. the c# equivalent vector list<t> . indexed access o(1), insertion or removal o(n) (other inserting @ end, o(1)).

Remove specific record from Sitecore WFFM using C# -

hi trying remove specific record sitecore wffm. example, delete entry contain email address cant find way it. able delete of record form. is there way remove specific entry using c#? tried replace formitemid entry id not working or in wrong direction? sitecore.forms.data.datamanager.deleteforms(new sitecore.data.id(frm.formitemid), frm.storagename); thank you!

asp.net mvc - Links not displaying properly in ASP MVC3 razor view -

i've implemented solution explained in post how tweet's html linqtotwitter? when display tweets html links appear this <a class="inline" href="http://twitter.com/cgitosh" target="_blank">@cgitosh</a> , how you? instead of showing @cgitosh , how you? @cgitosh linking twitter account. what i'm not doing right? razor code snipet: @{var tweet = twitterextensions.text2html(item.text);} <div>@tweet</div> so pass tweet text text2html function explained in link provided above returns tweet links variable tweet output in view try: @{var tweet = twitterextensions.text2html(item.text);} <div>@(new htmlstring(tweet))</div> ...and unless you're using tweet elsewhere, do <div>@(new htmlstring(twitterextensions.text2html(item.text)))</div> razor default html encodes strings, have explicitly tell render markup. (see here .) hope helps!

c# - RestSharp - Service Unavailable - Maximum number of active clients reached -

i'm using restsharp communication web service. i use code public static object gettagvalue(string url, string tagname, out string resp) { object result = null; resp = string.empty; string thereq = string.format("tags/{0}", tagname); var client = new restclient(url); var request = new restrequest(thereq, method.get); request.requestformat = dataformat.json; irestresponse response = client.execute(request); resp = response.content; if (!string.isnullorwhitespace(resp)) { dynamic json = jvalue.parse(resp); if (null != json.value) { result = json.value; } } return result; } call server get http://ame-hp/tags/int32 http/1.1 accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml user-agent: restsharp/105.2.3.0 host: ame-hp accept-encoding: gzip, deflate response server working call: http/1.1 200 ok ...

need netsh reference for various windows versions -

Image
after searching on , on again can't seem find netsh command reference per windows version. i'm using python run netsh commands customers may have different windows versions: vista ,xp, win7, win10, win8, windows server etc.. did encounter full reference per windows version ? i'm looking since bumped 1 difference today between xp , win7: xp -> netsh interface ip show config win7 -> netsh interfate ipv4 show config ( 1 fail in xp - image below shows why) thanks sivan

java : shift distance for int restricted to 31 bits -

any idea why shift distance int in java restricted 31 bits (5 lower bits of right hand operand)? http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.19 x >>> n i see similar question java bit operations >>> shift nobody pointed right answer the shift distance restricted 31 bits because java int has 32 bits. shifting int number more 32 bits produce same value (either 0 or 0xffffffff , depending on initial value , shift operation use).

masstransit - Why is my Send only bus not creating a temporary queue? -

for testing request/respond saga masstransit created console application initiate saga sending message on bus (rabbitmq). according documentation console application not need have endpoints defined receive response. i create bus following code: context.bus = bus.factory.createusingrabbitmq(x => { irabbitmqhost host = x.host(new uri(configurationmanager.appsettings["rabbitmqhost"]), h => { h.username("guest"); h.password("guest"); }); }); when above code runs, not seeing exchanges or temporary queue being created. sending request result result in executing saga responds never come original sender , timeout exception thrown. sending request: public async task test(testcontext context) { var triggerrequestmessage = jsonconvert.deserializeobject<triggerrequestmessage>messages.mfamessages.validmessage); var clie...

javascript - Checkbox from ajax doesn't appear in angular scope -

i have structure <tr ng-repeat="load in loads"> <td><input type="checkbox" name="selected[]" ng-model="selected[load.id]" /></td> </tr> that comes ajax request. if click checkbox , press submit button don't see "selected" model $scope. i've created static checkbox outside loop , 1 in scope. there i'm missing ajax content? as you've said in comment $scope.selected undefined try initialize it. add contoller $scope.selected = {}; take @ plunkr , should solve problem, if understood correctly

Django admin widget override -

i've write class, 'mywidget', extend foreignkeyrawidwidget , override render method. ( https://github.com/django/django/blob/master/django/contrib/admin/widgets.py line:130) now use mywidget instead of foreignkeyrawidwidget fields in admin site. currently i've tried create modelform lines class meta: model = mymodel widgets = { myfield : mywidget } and 1 so myfield = mywidget() class meta: model = mymodel but none works me, 2 errors: [first form configuration] exception value: error when calling metaclass bases init () takes @ least 3 arguments (1 given) exception location: /home/martin/envs/dmbcau/local/lib/python2.7/site-packages/django/forms/fields.py in init , line 90 [second form configuration] exception value: init () takes @ least 3 arguments (1 given) exception location: /home/martin/projects/dmbcau/storage/admin.py in mywidget, line 244 knows should make working? widget source @catherine m...

python - Unable to unzip a large zip file (3.3GB) in iOS9 using SSZipArchive -

as title, creates zip file django backend server (hosted on ubuntu 14.04.1 lts) using python zipfile module: zipfile.zipfile(dest_path, mode='w', compression=zipfile.zip_deflated, allowzip64=true) i managed open using mac in finder, no success using ssziparchive library. have tried using latest commit of master branch , tag v1.0.1 , v0.4.0. using v0.4.0, got error in line 1506 of unzip.c: if (unz64local_checkcurrentfilecoherencyheader(s, &isizevar, &offset_local_extrafield,&size_local_extrafield)!=unz_ok) return unz_badzipfile; and stucked @ unzipping on same file every time same currentfilenumber . does clues? p.s. think ssziparchive should support zip64 archive file have asked question on github repo. updates [20160129] performed zipinfo check on zip file , have following output: ... -rw-r--r-- 2.0 unx 19...

docker - Dockerhub Repository Description -

does know how dockerhub manages description on automatic build repositories? dockerhub has nice feature readme.md source repository taken repository description. in practise description of repository not latest readme.md master branch. appears quite random or related latest builds. example repository: / dockerfile readme.md branches: master tags: v1.0 v1.1 v2.0 v2.1 now problem: if put tags on autobuild not reproducable readme.md shown in repositories description. is there trick or there api can can set description? my wish latest commit of master/readme.md displayed! the dockerhub doc mentions: the build process looks readme.md in same directory dockerfile . (see instance tombatossals/dockerhub/nodejs ) if have readme.md file in repository, used in repository full description. if change full description after build, overwritten next time automated build runs. make changes, modify readme.md in git repository. note...

ios - Change appdelegate methods from SDK -

hi all. i'm trying develop sdk register on events when app going background [like background fetch or significant location change]. reason need write code in appdelegate methods - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions and: - (void)applicationdidenterbackground:(uiapplication *)application the question is, how can without damaging hosting app app delegate. i tried categorizing, in order need know appdelegate i read bit methods swizzling can't figure out how change appdelegate method , not run over. if can give example sample code or link clear things out appreciated. thanks. you can use 2 notifications: uiapplicationdidfinishlaunchingnotification uiapplicationdidenterbackgroundnotification you can read more them here: https://developer.apple.com/library/ios/documentation/uikit/reference/uiapplication_class/#//apple_ref/c/data/uiapplicationdidfinishlaunchingnotification

android - findFragmentById returns null -

i have activity navigation drawer , empty layout. on create of activity, display fragment(in empty layout of activity). fragment's id datevehiclemaincontent . on selecting navigation items display other fragments. when pressed returns previous fragment. i want display logout dialog when current fragment first fragment displayed( datevehiclemaincontent ). displayed when pressed every fragment. don't want displayed in other fragments occupy empty layout of activity. use findfragmentbyid . maybe not working because display fragment in empty layout of activity . datetimepicker fragment class. this activity empty layout , onbackpressed() check if current fragment fragment id datevehiclemaincontent @override public void onbackpressed() { fragment currentfragment = getsupportfragmentmanager().findfragmentbyid(r.id.datevehiclemaincontent); if (currentfragment instanceof datetimepicker) { alertdialog.builder alertdialog = new alertdialog.builder(dateve...

arraylist - Java: removing word from a list -

i working on making vocable test can make own vocables , translation. have faced problem not know how make option have different translations pick from. public static void writingyourvocables(list<vocablelist> data) { string antal = joptionpane.showinputdialog(null, "write numbers of vocables want have"); int temp = integer.parseint(antal); (int = 0; < temp; i++) { string vocable = joptionpane.showinputdialog(null, "write vocable"); string translation = joptionpane.showinputdialog(null, "write translation vocable"); data.add(new vocabletest(vocable, translation)); } }//writingyourvocables ends the method above the method write numbers of vocables want have in test, write vocables , translation. public static void playwithalternatives(list<alternatives> data) { int = data.size(); (int n = 0; n < a; n++) { int translate2; int translate3; int translate1 = (int)(m...

Open .pdf file in new browser Tab ASP.NET -

i have function named stampasingola: private sub stampasingola() dim rpt new rptlettera ctype(rpt.datasource, sqldbdatasource).sql = "select * vwlettere idlettera in (" & request.querystring("idlettera") & ")" rpt.run(false) if not rpt nothing dim exp new pdfexport ' create new memory stream hold pdf output dim memstream new system.io.memorystream ' export report pdf: exp.export(rpt.document, memstream) exp.dispose() exp = nothing me.context.response .buffer = true .contenttype = "application/pdf" .addheader("content-disposition", "attachment; filename=archilet_lettera_" & request.querystring("idlettera") & ".pdf;") .binarywrite(memstream.toarray) .flush() .end() end rpt.document.dispose() rpt...

api - modify relationship in instagram by using oriceon laravel 5 oauth wrapper -

iam using oriceon/oauth-5-laravel connecting instagram .i authenticated , got name , id through request $result = json_decode($instagramservice->request('users/self'), true); want follow person using oriceon/oauth-5-laravel . how post request follow person using . **note:**dont refer instagram developer page.i reffred lot.but couldnt put post request oriceon/laravel oauth wrapper instagram. help me.tysm in advance try .copy method controller , proper routing. public function followwithinstagram(request $request) { $instagram_id='id of user want follow'; $code = $request->get('code'); $instagramservice = \oauth::consumer('instagram'); if ( ! is_null($code)) { $state = isset($_get['state']) ? $_get['state'] : null; $instagramservice->requestaccesstoken($code, $state); $linkdata = [ 'action' =>'follow...

java - Python: xml.etree.ElementTree.ParseError: not well-formed (invalid token) -

i have given sample code(which contains xml variable) , want read of attributes of xml , update them. once updated want post them using requests.post. error "not formed" token, , not able parse xml. please suggest wrong in code. # -*- coding: utf-8 -*- xml.etree import elementtree etree dataxml = """<apidatamessage messageid="747950743" sensorid=extref messagedate=messagedate state="16" signalstrength=random.randint(40,70) voltage="2.83" battery=random.randint(80,90) data=random.randint(27,40) displaydata="67.1° f" plotvalue="67.1" metnotificationrequirements="false" gatewayid="106558" datavalues="19.5" datatypes="temperaturedata" plotvalues="67.1" plotlabels="fahrenheit" />""" parser = etree.xmlparser(encoding="utf-8") root = etree.fromstring(dataxml, parser=parser) root.set('signalstrength',100) print etree...

Unzip NSData folder from URL Swift -

the code below works downloading single image url. func imageforimageurlstring(imageurlstring: string, completion: (image: uiimage?, success: bool) -> void) { guard let url = nsurl(string: imageurlstring), let data = nsdata(contentsofurl: url), let image = uiimage(data: data) else { completion(image: uiimage(named:"absolut5.png"), success: false); return } completion(image: image, success: true) } however of urls working zipped folder several png files inside. have adjusted above code bring data. seems work func datafordataurlstring(imageurlstring: string, completion: (data: nsdata?, success: bool) -> void) { guard let url = nsurl(string: imageurlstring), let data = nsdata(contentsofurl: url) else { return } completion(data: data, success: true) } usage let imageurlstring = item.valueforkey(url) as! string self.datafordataurlstring(imageurlstring, comple...

sql - Stored procedure causing transaction error while executing from C# application -

i have following stored procedure written in sql database. executes 2 procedures in different databases. inner procedures simple update , insert queries without explicit transaction statement applied. alter procedure [dbo].[usp_1] @userid nvarchar(max), @report nvarchar(max), @sqlerrormsg nvarchar(max) output begin exec @ret = [db1].[dbo].[usp_2] @user = @userid, @msg = @sqlerrormsg output, @date = @reportdate set @sqlerrormsg = 'report update status: ' + @sqlerrormsg exec @ret = [db2].[dbo].[usp_3] @userid = @userid, @msg = @sqlerrormsg output, @date = @reportdate end this procedure runs when execute in sql management studio. when run using c# code calls procedure, following error: the current transaction cannot committed , cannot support operations write log file. roll transaction. current transaction ca...

linux - Why select do not tell me that a client wants to connect? -

i've made simple tcp server can test telnet program. when running on windows, works expected, when running on linux, behavior strange: telnet clients understand connected server, the server not see clients ( select return 0 ), when kill server, clients detect disconnection. i think missed in accept , listen or select . what did missed? thanks. here's program source: #include "headers.h" #define default_port 24891 /** * test_server [ip port] */ int main(int argc, char *argv[]) { sockaddr_in sin; socket_t sock; /* listening socket creation */ sock = socket(af_inet, sock_stream, 0); if (-1 == sock) { die("socket()"); } /* binding */ sin.sin_family = af_inet; sin.sin_addr.s_addr = htonl(inaddr_any); sin.sin_port = htons(default_port); if (3 == argc) { sin.sin_addr.s_addr = inet_addr(argv[1]); sin.sin_port = htons(strtol(argv[2], null, 0)); } if (-1 ...

How to create a hashmap in java class -

this code. intention create hashmap 4 values, export class jar, add project, , use hashmap values there. i'm getting error in "hmap.put". i'm unable understand i'm doing wrong. please help. import java.util.hashmap; public class myfirstclass { private hashmap<integer, string> hmap = new hashmap<integer, string>(); hmap.put(2, "jane"); hmap.put(4, "john"); hmap.put(3, "klay"); hmap.put(1, "deena"); public hashmap<integer, string> gethmap() { return this.hmap; } public void sethmap(hashmap hmap) { this.hmap = hmap; } } there multiple ways this. easiest 1 add brackets put statements: import java.util.hashmap; public class myfirstclass { private hashmap<integer, string> hmap = new hashmap<integer, string>(); { hmap.put(2, "jane"); hmap.put(4, "john"); hma...

windows - Add song to playing queue in Spotify Desktop -

i'm trying queue song spotify desktop (windows 8.1) making use of spotify remote control bridge . want song appended after current playing track. due restrictions spotify applies api, there's no public documentation , can't in contact developers. 1 of posts i've been following understand how api works: https://medium.com/@b3ngr33ni3r/hijacking-spotify-web-control-5014b0a1a360 i've played song https://xxxx.spotilocal.com/remote/play.json?oauth=xxxx&csrf=xxxx&uri=xxxx , jumps playing queue instantly , replaces entirely. when call https://xxxx.spotilocal.com/remote/queue.json?oauth=xxxx&csrf=xxxx&uri=xxxx returns "method not implemented". need special oauth token? or csrf token? queue.json endpoint this endpoint appeared in js-library, although never worked , it's, said, not implemented. doesn't matter arguments supply. play.json endpoint so, endpoint more interesting. first of all, in past use following param...

AngularJS Code Understanding -

can please me explain code segment in angularjs $rootscope.compiledscope = $scope.$new(!0, $rootscope), $scope.variable = "somevalue"; what $new operator serving here what !0? how , used separate 2 statements , assign 1 variable on left from documentation , $new function accepts 2 parameters. first part: $new(isolate, parent); isolate : if true creates isolate scope new scope creating. means wont inherit parent scope. inherit parent scope parent scope properties wont visible it. parent : $scope parent of newly created scope. !0 : in programming languages 0 == false. , negating give true . so deciphering first part of code: $rootscope.compiledscope = $scope.$new(!0, $rootscope) add property called compiledscope $rootscope value new isolate scope parent $rootscope. isolate scope : scope not prototypically inherit parent scope. empty scope , non of parent's properties visible it. second part $scope.variable =...

opencv - Need Haar Casscades for coins (especially euro ones) -

i need haar cascade classifier detect coins, in particular euros, if exists. have been trying generate own days bur results bad. or maybe, know tutorial? thank you you're not going find many cascades pre-made coins, or euros. i'd recommend training own. as tutorials, used opencv 3.0 traincascade tutorial when creating lbp cascade, makes haars. used mergevec inflate positive count. basically did when making mine this: i generated positive vectors using opencv_createsamples (which in opencv install) , mergevec . created vectors off of small batches of individual positive images , negative images, game me positive images work off of. then, used mergevec , merged vectors single vector file opencv_traincascade use. then, ran opencv_traincascade new positive vector mergevec , , negatives had. think ended 7000 negatives , 13000 positives, bit overkill got nice cascade out of it. try keep width , height below 100x100, otherwise take week train.

c - include <time.h>,an error occurred at the start -

i use following code in default.vcl c{#include <time.h>}c an error occurred @ start. message c-compiler: ./vcl.tfbe17rg.c:429:21: time.h: no such file or directory ./vcl.tfbe17rg.c:430:23: string.h: no such file or directory running c-compiler failed, exit 1 c{ #include <sys/time.h> #include <stdio.h> }c try sys/time.h , should work.

arrays - function pointers for objects in C -

typedef struct node{ int term; struct node *next; }node; typedef void(*ptr )(void *); typedef void(*ptr1)(void *,int,int); typedef int(*ptr2)(void *,int); typedef void(*ptr3)(void *,int); typedef void(*ptr4)(void *,void *,void *); typedef struct list{ node *front,*rear; ptr3 insert; ptr *many; ptr display,sort,read; ptr4 merge; }list; void constructor(list **s) { (*s)=calloc(1,sizeof(list)); (*s)->front=(*s)->rear=null; (*s)->insert=push_with_value; (*s)->read=read; (*s)->sort=sort; (*s)->display=display; (*s)->merge=merger; (*s)->many=calloc(2,sizeof(ptr)); (*s)->many[1]=read; } int main() { list *s1,*s2,*s3; constructor(&s1); constructor(&s2); constructor(&s3); s1->many[1](s1); s1->sort(s1); s1->display(s1); return 0; } the void * parameter in such functions gets typecast list * inside function. there...

Separate ending number of a string into variable with Applescript -

i wondering if it's possible detect number on end of random string. example in string: "localfile/random/1" i'd split string 1 variable number on end of string, , second variable rest of path. couldn't google anything. any appreciated. if can split strings around last slash: set x "localfile/random/1" set text item delimiters "/" {(text items 1 thru -2 of x) text, last text item of x} both of these work if strings end numbers: on test(x) set c count of x repeat 1 c if item (c - i) of x not in items of "0123456789" return {text 1 thru (c - i) of x, text (c - + 1) thru -1 of x} end if end repeat end test test("localfile/random/1") shell script "sed -e $'s/([0-9]*)$/\\\\\\n\\\\1/' <<< " & quoted form of "localfile/random/1" set {x, y} paragraphs of result

angularjs - Laravel not detecting auth token sent in the header and JWT package -

i have set ionic app , started using laravel api. works great in postman , ionic until point sent token. using package called satellizer angular, adds token in local storage header. my issue is, receive token not provided error. in postman, if call: /api/v1/authenticate/user?token=tokenkey then works fine, if hard code same url token set in url params in angular http request works. however, when using postman , setting authorisation params in header to: token : tokenkey i missing token error again. in angular, when making request /api/v1/authenticate/user have checked header params , can see authorisation has been set " bearer tokenkey". any why not getting picked laravel? have found information apache removing auth header , added this: rewriteengine on rewritecond %{http:authorization} ^(.*) rewriterule .* - [e=http_authorization:%1] to apache config file on mamp, restarted same issue. any more suggestions? try using rewriterule ^ - [e=h...

javascript - Angular ng-repeat render items on top of list but keeping scroll to currently visible item -

i have following problem: want make items visible in beginning of ng-repeat hidden. when this, list of items becomes longer , elements rendered before move down. want keep scroll position @ item focused before showed new items. <div ng-repeat="item in items | limitto:listendindex" ng-if="$index >= liststartindex"> this code of template. controller decreases value of liststartindex make new items visible. ideas appreciated. thank you!

php - Android JSONObject Post Volley using StringRequest -

i'am bit confuse have asked question related json decoding on php side. focus there on decoding jsonobject posted android volley using stringrequest. able create code concerning inserting data mysql , forgot i'm still having bad configuration on client side. i'm getting "e/volley: [215] basicnetwork.performrequest: unexpected response code 500" post code here both on android , php side. please guide me accordingly. tired here. hope me. client side: public void testorder (arraylist<string> order_id, arraylist<string> uname, arraylist<string> prod_name, arraylist<string> prod_id, arraylist<string> quantity, arraylist<string> branches, arraylist<string> totalprice, ...

java - Unable to add tomcat 8 in eclipse -

this question has answer here: how use tomcat 8 in eclipse? 11 answers http://imageshack.com/a/img907/1062/pdslwn.png screen shot i trying add tomcat 8 in eclipse. unable add same. when click on apache tomcat 8 "server name" tab disable.but in case of 7 enable. please suggest me solve or give tutorials reconfigure same. i think old bug within eclipse. question answered here: eclipse add tomcat 7 blank server name

java - server returned HTTP response code 503 -

i'm getting error when trying build on cordova using node. i'm behind proxy , i've set up. here screenshot. missing. java_home=c:\program files\java\jdk1.8.0_71 running: c:\xampp\htdocs\myapp\platforms\android\gradlew cdvbuildrelease -b c:\xampp\htdocs\myapp\platforms\android\build.gradle -dorg.gradle.daemon=true downloading http:// services. gradle. org/distributions/gradle-2.2.1-all.zip exception in thread "main" java.lang.runtimeexception: java.io.ioexception: server returned http response code: 503 url: http:// services.gradle. org/distributions/gradle-2.2.1-all.zip @ org.gradle.wrapper.exclusivefileaccessmanager.access(exclusivefileaccessmanager.java:78) @ org.gradle.wrapper.install.createdist(install.java:47) @ org.gradle.wrapper.wrapperexecutor.execute(wrapperexecutor.java:129) @ org.gradle.wrapper.gradlewrappermain.main(gradlewrappermain.java:48) caused by: java.io.ioexception: server returned http response code: 503 url: http://servic...

javascript - compare two arrays and remove not matched objects -

i struggling compare 2 arrays of objects , removing not matched objects first array. all need compare 2 arrays (array1 , array2) of objects , remove not matched objects array 1. this have done till remove items. for (var = 0, len = array1.length; < len; i++) { (var j = 0, len2 = array2.length; j < len2; j++) { if (array1[i].id != array2[j].student.id) { array1.splice(j, 1); len= array1; } } } if you're looping on array1 i = 0, len = array1.length; < len; i++ , within loop remove entry array1 think happens on next loop? you appear removing things are found, question sayd want remove ones aren't . in below, in light of comment, i'm removing things aren't found. in case, use while loop. i'd use array#some (es5+) or array#find (es2015+) rather doing inner loop: var = 0; var entry1; while (i < array1.length) { entry1 = array1[i]; if (array2.some(function(entry2) { r...

java - How to refresh the fragment inside viewpager dynamically? -

i have 1 viewpager(mainviewpager) inside mainactivity renders fragment contains viewpager(imageviewpager) , textview. imageviewpager renders fragment contains imageview , button. i've set onclick listener on imageview turns in fullscreen view of image button beneath.now onclick of buttton want return mainactivity condition on same page entered , same image viewed last in fullscreen.i able same page image starts 0. basically hierarchy like: mainactivity --mainviewpager-->taskfragment --imageviewpager-->imagefragment(contains imageview --textview(set text returned mainactivity) my code: mainactivity.java public class mainactivity extends fragmentactivity { private viewpager mviewpager; private custompageradapter mpageradapter; private int changedposition; private string[] vehicles = new string[]{"audi q7", "honda accord", "hyundai i20", "maruti...

css - How to make HTML pages print at a consistent size from Chrome? -

i'm designing set of html pages printed, , want elements of pages end same scale each other. example, there's class of div width defined 200px wide appears on each of several pages. want appear precisely same size when each page printed (suitable for, e.g., cutting out , superimposing). i'm using few things work best in chrome (mainly css zoom rule have smaller copies of elements elsewhere), ideally i'd keep using chrome. (this easier in firefox, because has explicit scale ratio in print dialog.) seems on chrome, keeping same element consistent size when printed different pages far easy. chrome's pdf generation (which printing chrome under hood) appears pick section define page's width, , scale rest of page based on that. or perhaps tries set page size fit "optimal" number of elements on 1 page. if outside framing elements of each page aren't same size in cases, seems elements screen size 200px can come out 3-4 cm down 1.5-2cm or maybe sma...

How can I merge structures/structure arrays in MATLAB? -

i trying merge 2 structs identical fields. tried several ways, such this , this . either turns out sideways or doesn't work @ all. my 2 (simplified) structs are a(1).name = 'x'; a(1).data = 1; a(2).name = 'y'; a(2).data = 2; and b(1).name = 'x'; b(1).data = 3; b(2).name = 'y'; b(2).data = 4; the desired output identical produce: c(1).name = 'x'; c(1).data = 1; c(2).name = 'y'; c(2).data = 2; c(3).name = 'x'; c(3).data = 3; c(4).name = 'y'; c(4).data = 4; what easy way this? in real struct, there more 2 fields on thousand values. this answered tersely in a comment matthias w. , i'll elaborate here... when structures have identical fields, can treat them other object when concatenating them. solution above example be: c = [a b]; since a , b in case 1-by-2 structure arrays, horizontally concatenates them larger 1-by-4 structure array. if sizes/dimensions of a , b weren't kn...

Multivariate GARCH(1,1) in R -

i use r estimate multivariate garch(1,1) model 4 time series. tried rmgarch package. seems i'm using wrong don't know mistake is. first time using. library(quantmod) library(fbasics) library(rmgarch) #load data, time series closing prices, 10 year sample #dax 30 getsymbols('^gdaxi', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31") gdaxi.de=gdaxi[ , "gdaxi.close"] #s&p 500 getsymbols('^gspc', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31") gspc=gspc[ , "gspc.close"] #credit suisse commodity return strat getsymbols('crsox', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31") crsox=crsox[ , "crsox.close"] #ishares msci emerging markets getsymbols('eem', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31...

nonblocking - Reliable TCP server in Linux using C -

i have written simple tcp server c program listens connections on port 4500 , works fine. now while waiting client connect if restart internet services , try connect server should connect. can suggest how not getting it. have read beej's guide make calls non-blocking making read call non-blocking whereas think have make accept() non-blocking.

python - converting numbers to consonant-vowel pairs -

the project asks divide initial set of numbers base 10, 6|30|45|10 using % 100 , // 100 operators, converting last 2 digits quotient between 0-19 , remainder between 0-4 using % 5 , // 5. have, appreciated, thanks! integer = pin number_string = str(integer) number_string2 = str(integer) number_string % 100 number_string2 // 100 vowels = ["a", "e", "i", "o", "u"] consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "y", "z"] ` code should produce in end >>> pintoword(3463470) 'bomejusa' >>> pintoword(3464140) 'bomelela' you code bit strange. example, convert variable named integer string, , attempt perform arithmetic on it. , ...

sql server - SQL - Select statement inside case -

i want select particular columns table when field in other table not null. in other words, have 2 tables, have common fields when field named "salesordrkey" in table number 1 not null need common fields table number 2 otherwise common fields table number 1 here's trying do select slsordr.salesordrkey, whissue.warehissuekey, issuppk.issueprodpackkey, (case when whissue.salesordrkey not null (select slsordr.busipartnerkey, slsordr.contractkey, slsordr.salesmankey, slsordr.customerkey) else (select whissue.busipartnerkey, whissue.contractkey, whissue.salesmankey, slsordr.customerkey) end) warehissues whissue inner join issueprodpacks issuppk on whissue.warehissuekey = issuppk.warehissuekey left join slssalesordrs slsordr on whissue.salesordrkey = slsordr.salesordrkey whissu...

amazon s3 - Create Image magick object from response stream in go lang -

i using following code download , upload images amazon s3 . now, after downloading image want resize using imagick library , without writing on disk. so, how create image magick object directly response stream s3 , upload same on amazon s3. please suggest changes same in below code? also, how change http handler takes value of key query string? i have commented out code of image magick object reason being sure how write it. func main() { file, err := os.create("download_file") if err != nil { log.fatal("failed create file", err) } defer file.close() downloader := s3manager.newdownloader(session.new(&aws.config{region: aws.string(region_name)})) numbytes, err := downloader.download(file, &s3.getobjectinput{ bucket: aws.string(bucket_name), key: aws.string(key), }) if err != nil { fmt.println("failed download file"...