Posts

Showing posts from July, 2013

php - While-loop, undefined offset -

i "undefined offset" errors, starting index 20 shown in following output: <b>notice</b>: undefined offset: 20 in <b>/var/www/sso/html/wp-content/plugins/auto-login/papex-auto-login.php</b> on line <b>214</b><br /> <br /> <b>notice</b>: undefined offset: 21 in <b>/var/www/sso/html/wp-content/plugins/auto-login/papex-auto-login.php</b> on line <b>214</b><br /> <br /> <b>notice</b>: undefined offset: 22 in <b>/var/www/sso/html/wp-content/plugins/auto-login/papex-auto-login.php</b> on line <b>214</b><br /> <br /> my array $match - below - has 20 indexes. output sql question correct – have checked multiple times. print_r , output foreach loop echo $value->meta_key . it seems while loop goes through whole $match array, won't terminate. thats why think starts producing "undefined" offsets, starting 20. what

ios - How to include SpritKit SKScene view as the MKAnnotationView -

is there way use ios spritekit skscene , view mkannotationview shown on mkmapview ? you can use view in -(void)didmovetoview:(skview *)view place map view. keep in mind skscene not meant other sknode.

Android Unit Testing with JUNIT Framework -

Image
i have started unit testing in android placed test folder under src path /src/test. my /src/main/java/com/example/prabhu/mathapplication consists of activities , java classes. i want run test check wether method gets executed or doesn't unable resolve error understanding due not finding link.so while writing tests how resolve , how use mocks this. my test code : /** * created prabhu on 12/05/15. */ import com.example.prabhu.mathapplication.calcnative; import com.example.prabhu.mathapplication.mainactivity; import junit.framework.testcase; import org.junit.after; import org.junit.before; import org.junit.*; public class myaddertest extends testcase { private mainactivity mmyadder; // private calcnative do_calculation_in_native; int x,y; @before public void setup() throws exception { // code wish run before each test mmyadder = new mainactivity(); // do_calculation_in_native = new calcnative()

excel - VLOOKUP average a range of cells -

Image
i have standard vlookup formula =vlookup($g28,'analysis 1'!$a$2:$cr$32,$m28+$m28,true) how amend rather return answer want average result of 3 cells, cell above vlookup, cell below vlookup , cell of vlookup? i if can specify number of cells either side of vlookup want average, in case above 1. yes need use match. i think easiest way using offset function:- =average(offset(b1,match(e2,a2:a11,0)-d2,0,d2*2+1)) where lookup value in e2 , number of cells include either side in d2. if d2 contains zero, value corresponding key (25). lookup , return columns don't need together. the example includes cells in column b containing 9,16,25,36 , 49 , gives answer 27. i should add error handling cases cells near end or beginning of range give right answer when time allows. here formula error handling:- =iferror( if(or((match(e2,a2:a11,0)-d2)<1,(match(e2,a2:a11,0)+d2)>rows(b2:b11)), "out of range", average(offset(b1,match(e2

java - Preferred height of a control skin containing a wrapped label -

Image
i wrote basic control , skin. label displayed in hbox in skin. label should wrap text if there isn't enough space. public class labelwrap extends application { public static void main(string[] args) { launch(labelwrap.class); } @override public void start(stage stage) throws exception { basiccontrol basiccontrol = new basiccontrol(); borderpane borderpane = new borderpane(); borderpane.setprefwidth(150); borderpane.setcenter(basiccontrol); stage.setscene(new scene(borderpane)); stage.centeronscreen(); stage.show(); } private static class basiccontrol extends control { @override protected skin<?> createdefaultskin() { return new basiccontrolskin(this); } } private static class basiccontrolskin extends skinbase<basiccontrol> { protected basiccontrolskin(basiccontrol control) { super(control); vbox

ios - UICollectionView reloadData issue - cell's subview issue -

Image
i have maked following view. but when calling -reloaddata , view becomes... i think it's because cells reused. have idea keep view first image if calling reloaddata ? - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { customcell* cell = [collectionview dequeuereusablecellwithreuseidentifier:kcellidentifier forindexpath:indexpath]; if (indexpath.item == 0) { cell.label.text = @"hello"; } else { uiimage *image = dataarray[indexpath.item]; cell.imageview.image = image; } return cell; } customcell.m @property (nonatomic, strong) uiimageview* imageview; @property (nonatomic, strong) uilabel* label; //... - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { self.imageview = [[uiimageview alloc]initwithframe:imgviewframe]; [self.contentview addsubview:self.image

python - Writing sublists in a list of lists to separate text files -

i’m new python find myself working on travelling salesman problem multiple drivers. handle routes list of lists i’m having trouble getting results out in suitable .txt format. each sub-list represents locations driver visit, corresponds separate list of lat/long tuples. like: driver_routes = [[0,5,3,0],[0,1,4,2,0]] lat_long =[(lat0,long0),(lat1,long1)...(latn,longn)] what separate .txt file (named “driver(n)”) lists lat/long pairs driver visit. when working single driver, following code worked fine me: optimised_locs = open('optimisedroute.txt', 'w') x in driver_routes: to_write = ','.join(map(str, lat_long[x])) optimised_locs.write(to_write) optimised_locs.write("\n") optimised_locs.close() so, took automated file naming code chris gregg here ( printing out elements of list separate text files in python ) , tried make iterating loop sublists: num_drivers = 2 p = 0 while p < num_drivers: x in driver_routes[p]:

PEAR QuickForm2 CSRF Protection -

i looking way ensure csrf-protection in quickform2 . i found link it's quickform1 . any ideas how can adapt qf2 ? thanks, ron after fiddling around came solution. maybe helps else well: <?php /** * @uses html_quickform * @desc add automatic csrf mitigation forms incorporating token must matched in session , forcing use of post method * based on: http://www.zapoyok.info/2010/07/17/csrf-et-quickform-de-pear/ */ require_once "quickform2.php"; class html_quickform2s extends html_quickform2 { /** * @property string $_sessiontokenkey name of session variable containing token */ private $_sessiontokenkey; /** * @method __construct * @desc override method use post , pass on parent constructor. create session key token based on form name. * @param $id * @param string $method * @param mixed $attributes * @param boolean $tracksubmit */ public function __construct($id, $method = 'pos

symfony - Apache access log "GET / HTTP/1.1" 404 615 "-" -

when try enter local symfony2 site, loading long time , see white screen. in apache access log see message: "127.0.0.1 - - [12/may/2015:12:38:12 +0300] "get / http/1.1" 404 615 "-" "mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/42.0.2311.135 safari/537.36"". what reason? have enabled rewrite? http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html <ifmodule mod_rewrite.c> options -multiviews rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(.*)$ app.php [qsa,l] </ifmodule> this allow view [domain]/ otherwise access @ [domain]/app.php

hadoop - Pig Json Multistorage? -

using pig (0.14), i'm interested in following use-case: wish process raw json multiple output directories based upon key , store result (aggregated data) json. json has evolving (dynamic) schema read in elephant-bird, , (so-far) has not caused problems. i can either store output in correct directories (using multistorage) or json (using jsonstorage) not both. far can tell, there no publicly available udf purpose. have missed something, or case of writing own udf perform this? seems simple use-case , have thought have been supported. for looking answer this; udf required. it possible (and relatively straight forward) combine piggybank udfs of jsonstorage , multistorage create pseudo "jsonmultistorage" class.

python - TypeError: list indices must be integers, not tuple -

my code:` #!/usr/bin/python open("a.dat", "r") ins: array = [] line in ins: l=line.strip() array.append(l) a1 = array[:,1] print a1 i want read a.dat array take first column.what wrong? for loading numerical data, it's useful use numpy instead of python. import numpy np arr = np.loadtxt('a.dat') print arr[:,0] numpy python library that's suited loading , manipulating numerical data (with bonus when used correctly, it's waaaay faster using python lists). in addition, dealing tabular data mixed datatypes, recommend using pandas . import pandas pd df = pd.load_csv('a.dat', sep=' ', names=['col1', 'col2']) print df['col1'] numpy can found here pandas can found here

get Perl hash keys part of a string/regex without a loop? -

i'm not sure how phrase question in single line, here need: i need element of hash key "subset" of given string. if hash is %h = ( 'ab' => 1, 'cd' => 2); and string abc123 , ab hash. i know do $str = 'abc123'; foreach (keys %h) { print "$_ \n" if $str =~ m/^$_/; } but i'm asking if there's more efficient way, way work if matching other way around %h = ('abc123' => 1, 'def456' => 2); print "$_ \n" grep /^ab/, keys %h well can hide loop inside call grep , in second example my %h = ( ab => 1, cd => 2 ); $str = 'abc123'; print "$_\n" grep { $str =~ /^$_/ } keys %h; but there little or no speed advantage if wanted find one of hash keys build regex them, this my $re = join '|', sort { length($b) <=> length($a) } keys %h; $re = qr/$re/; and find first matching hash key this print "$1\n" if $str =~ /^($re)/;

string - What is the difference between UTF-32 and UCS-4? -

what difference between utf-32 , ucs-4 ? isn't utf-32 supposed fixed-width encoding ? utf-32 has started subset of ucs-4 . identical except utf-32 standard has additional unicode semantics. see details on wikipedia : the original iso 10646 standard defines 31-bit encoding form called ucs-4 , in each encoded character in universal character set (ucs) represented 32-bit friendly code value in code space of integers between 0 , hexadecimal 7fffffff. because 17 planes in use, current code points between 0 , 0x10ffff . utf-32 subset of ucs-4 uses range. since principles , procedures document of jtc1/sc2/wg2 states future assignments of characters constrained bmp or first 14 supplementary planes, utf-32 able represent unicode characters. accordingly, ucs-4 , utf-32 identical except utf-32 standard has additional unicode semantics . however, not excactly sure, additional unicode semantics means. maybe can provide better answer.

angularjs - How to pass parameter with ui-sref between deeply nested objects? -

Image
as have nested object follow: provider(providerid) =>> post (postid)=>> comment (commentid)=>> reply (replyid) so, while in last step of reply can not pass providerid reply step. here shown how works $stateparams in each steps. here reply state. $stateprovider .state('reply', { url: '/blog/providers/{providerid}/posts/{postid}/comments/{commentid}', templateurl: 'app/blog/provider/post/comment/reply/reply.html', controller: 'replyctrl' }); therefore can not pass parameter getting following error: get http://localhost:9000/api/providers//posts/5551b281bcaa20002387fb31/comments/5551b3b4bcaa20002387fb32 404 (not found) this have in comment.html, 1 step before reply in order pass parameter reply step. not sure how retrieve providerid in case don't have here. <div ng-repeat="comment in post.comments track $index" > ....... <a ui-sref="reply({providerid: ..

arrays - C memory allocations -

i wondering how c compiler allocated memory character array initialize yourself, instance: char example[] = "an example string"; if single character 8 byte , example 17 bytes or have more because needs \0 to finish off? or overestimate how memory needs? this code: #include <stdio.h> int main(void) { char example[] = "an example string"; printf("%zu", sizeof(example)); } compiled with: gcc -std=c99 -o proof proof.c returns: 18 (bytes, not bits) because of \0 character @ end of string

ASP.NET Web-Form C# Specified cast is not valid -

i new asp.net , i'm trying make webshop. problem when try execute method, error. i'm wondering if problem in sql tables? here's method produces error public list<product> productread(int product_id) { idatareader data = sqlhelper.executereader(con, "product_read", product_id); list<product> prod = new list<product>(); while(data.read()) { product pr = new product(); pr.product_id=(int)data["product_id"]; pr.product_name=data["product_name"]as string; pr.product_description=data["product_description"]as string; pr.product_image =(char)data["product_image"]; pr.product_price=(int)data["product_price"]; pr.product_count=(int)data["product_count"];

ios - Singleton Swift Shared [String] -

i trying access same [string] in 2 viewcontrollers. first 1 setting array , second viewcontroller want array. here singleton class. class savedpostsbox{ var postnames: [string] = [] class var sharedinstance : savedpostsbox { struct static { static let instance : savedpostsbox = savedpostsbox() } return static.instance } } in first viewcontroller this: savedpostsbox().postnames = savedpostname and in second this: savedpostname = savedpostsbox().postnames the problem when check sizes in different classes 0 in second not in first. tried lot of different methods , search everywhere solutions seems work lot of other people not me. you have sharedinstance. savedpostsbox.sharedinstance.postnames = savedpostname ans use everywhere, instead of instances of savedpostsbox

ios - error using valueForKey in swift -

why error when used valueforkey ... using same trick in objectivec ... in objectivec , code self.strsubscribe =[responseobject[@"subscribe"] valueforkey:@"subscribe_ids"]; in swift , code self.strsubscribe = responseobject["subscribe"].valueforkey["subscribe_ids"] as! string i declare variables var arraysubcategory : nsmutablearray! = nsmutablearray() var strsubscribe:string! and tried access value below response { subscribe = { "subscribe_ids" = "1,14"; } } edit works using amit , eric's solution following data { data = ( { "subscribe_ids" = "1,14"; } ); } let dictionary = responseobject["data"][0] as! dictionary<string,anyobject> self.strsubscribe = dictionary["subscribe_ids"] as! string or// if let dic = responseobject["data"][

Getting an error but still changing value of key in app.config with powershell -

i'm trying simple script change configuration key in app.config using powershell script this dir *.config -recurse -pipelinevariable webconfig | foreach { $doc = [xml] (get-content $_) $environment = $doc.configuration.appsettings.add | {$_.key -eq 'environment'} ($environment).value = "ci" $doc.save($webconfig) } the problem when run i'm getting the property 'value' cannot found on object. verify property exists , can set. at line:5 char:9 but if after running script , getting error run same script without assignment, i.e. dir *.config -recurse -pipelinevariable webconfig | foreach { $doc = [xml] (get-content $_) $environment = $doc.configuration.appsettings.add | {$_.key -eq 'environment'} ($environment).value $doc.save($webconfig) } it displays value changed (which confirmed in actual file). so i'm lost here, thanks

spring integration - jms adapter launch two jms consumer -

i have problem int-jms:inbound-channel-adapter, when start application see in activemq webadmin have 2 consumer queue. <int-jms:inbound-channel-adapter id="jmsadapter" acknowledge="transacted" destination-name="${destinationname}" connection-factory="cachedconnectionfactory" channel="inboundchannel" auto-startup="true" > <int:poller fixed-delay="100" ></int:poller> </int-jms:inbound-channel-adapter> somme thing wrong in conf? problem org.springframework.jms.connection.cachingconnectionfactory create multiple session, , 1 consumer per session . have 3 consumers same queue. to resolve use cachedconsumer Ă  false.

Does dataview in extjs 5.0.1 has prepareData function? -

i use extsj 5.01 , sencha architect 3. there problem bothering me now. dataview of filenames long , pics in mess.i want use preparedata shorten name, not find in architect. deprecated? , there alternative function? sencha architect doesn't support features , has lot of limitations. follow these steps customize preparedata. 1 - in project inspector, click on data view 2 - in config panel, select "process config" , click on + sign next it. 3 - process method created, click on method , go code editor 4 - add code editor return ext.apply(config, { preparedata : function ( data, recordindex, record ) { // code here } }); this should customize preparedata method.

javascript - Trouble with setting jQuery cookie -

first of all, sorry, see there lots of repetitions whole cookie question, yet have add 1 getting quite confused different jquery cookie plugins. i using jquery cookie plugin v1.4.1 i implemented following code on 1 of pages (not home page!) $(document).ready( function() { if ($.cookie('nofadeworks')) { // when initial effect on page enter has been seen } else { // functions here initial page enter effect $.cookie( 'nofadeworks', true ); }; }); now works problems/questions yet: working expected in safari. when browser closed , reopened starts 0 expected , desired. yet: google chrome after close , reopen still has cookie. effect functions not enter game anymore. not desired here. it awesome if points of session tell browser forget cookie , start 0 (with effect on page) again. tried that: $.removecookie( 'nofadeworks' ); on homepage didn’t work @ all. do explain myself? how done correctly? tried expire opt

ios - TextField returning nil with valid value entered. Parse.com Issue -

i have textfield passes value parse object. working great, added tab bar controller tableviewcontroller subclass of pfquerytableviewcontroller. neither self.message.text; or message.text (synthesized) pass correct value, instead passes nil , app crashes. here sample of code trying run: -(bool)textfieldshouldreturn:(uitextfield *)textfield { nsstring *echo = message.text; pfuser *currentuser = [pfuser currentuser]; if (currentuser) { pfobject *echoobject = [pfobject objectwithclassname:@"echo"]; echoobject[@"body"] = echo; echoobject[@"title"] = @"echo"; echoobject[@"user"] = currentuser; [echoobject saveinbackground]; nslog(echo); nslog(@"test"); } else { // show signup or login screen } [self loadobjects]; return yes; } adding tabbarcontroller thing can think of effect view controller in way breaks code. update questio

ios - Updating width of uilabel when subview not -

i have uilabel in uitableviewcell neighboring subview uicontrolswitch . when uicontrolswitch hidden, uilabel's width expected grow. below custom class implementation: - (void)setbounds:(cgrect)bounds { [super setbounds:bounds]; self.contentview.frame = self.bounds; } - (void)layoutsubviews { [super layoutsubviews]; [self.contentview updateconstraintsifneeded]; [self.contentview layoutifneeded]; self.numberlabel.preferredmaxlayoutwidth = cgrectgetwidth(self.numberlabel.frame); self.quotelabel.preferredmaxlayoutwidth = cgrectgetwidth(self.quotelabel.frame); } @end i have uploaded sample code explain constraints on storyboard. the uilabel's width not changing. if set trailing space between uilabel , uicontrolswitch , control partially hidden beyond screen bounds. hence constraint uilabel has trailing space superview instead of uicontrolswitch . when hide view, still takes part in layout process. h

Azure WebJobs: Can't find Trace logging -

Image
i've followed instructions on this microsoft webpage logging messages azure webjob, none of messages appear in log. in webjob write logging messages using trace.traceinformation("blah blah blah"); in configuration file's application diagnostics section have blob storage logging turned on "verbose" option. log files are being created (though have wait several minutes - in 1 case until following morning - until logs appear in blob storage) logs don't contain trace messages. so how log messages these log files, and/or trace written to? here image of configured options logging: and configured blob storage same 1 i'm looking in. to specify storage account web job logs, need add connection string under configure tab > connection string sections, name of connection string has azurewebjobsdashboard . it should below: name : azurewebjobsdashboard value : defaultendpointsprotocol=https;accountname="";accou

Angularjs: how to do javascript based modification in DOM -

i have small angular project, , modify view based on model modifications. however, not handled "ng-xxx" directives specific javascript code. what pattern this? i have 2 options: call in controller global javascript method (which bad!) watch in main page variable change , update view accordingly (a little bit better) i try display part of model on openstreetmap view, question not specific osm (or leaflet)

Loop through excel files in a folder and open it without reference to filenames -

i want loop through excel files in folder , extract information. problem file names of excel files in vietnamese, when use dir function loop, not work. how can loop through files in folder , open them without referring names. i try getfolder method doesn't seem work either. thanks help. sub loopthroughfiles() dim myobj object, mysource object, file variant dim wb workbook set mysource = myobj.getfolder("c:\excel") each file in mysource.files set wb = worksbooks.open(file) next file end sub looks have dim myobj, don't initialize before used. should have set myobj = something

Birt integration in JHipster application -

i'm new jhipster , angularjs , i'm trying integrate birt engine in jhipster application using h2 embedeed database. found this page details how integrate birt engine in spring application don't how applicate application. here modifications performed in jhipster project: add dependency org.eclipse.birt.runtime in pom create classes car, carserviceimpl, birtview, birtenginefactory , birtdataserviceconfiguration in sub-package report described in article. i added birtwebconfiguration class in sub-package config. removed @componentscan line taken account in application class. i created empty report in src/main/webapp/reports/toto.rptdesign my problems are: when accessing application main page "pagenotfound exception" following message "no mapping found http request uri [/] in dispatcherservlet name 'dispatcherservlet'". presume due birtwebconfiguration seems overwritte rest path configuration. how shall define new rest end-point

c - Clarification in getop() -

in dennis ritchie's "c programming language" book, in getop func, states s[1]='\0' why end array on index 1? what's significance , need? in later part uses other parts of array.. int getch(void); void ungetch(int); /* getop: next character or numeric operand */ int getop(char s[]) { int i, c; while ((s[0] = c = getch()) == ' ' || c == '\t') ; s[1] = '\0'; if (!isdigit(c) && c != '.') return c; /* not number */ = 0; if (isdigit(c)) /* collect integer part */ while (isdigit(s[++i] = c = getch())) ; if (c == '.') /* collect fraction part */ while (isdigit(s[++i] = c = getch())) ; s[i] = '\0'; if (c != eof) ungetch(c); return number; } because function might return before remaining input read, , s needs complete (and terminated) string.

c++ - How to insert key and value to map that is inside another map in cpp? -

i have map : std::map<std::string, std::map<std::string, std::string> > objects; as far know, when write objects[key] replace value of key exists, here want add second map if pair doesn't exist. example: current map :("key1",map(<"key_a","value_a">,<"key_c","value_d">)) input: "key1", "key_e","value_f" relsult: ("key1",map(<"key_a","value_a">,<"key_c","value_d">,<"key_e","value_f">)) input : "key1", "key_e","value_g" (replace value "value_f" "value_g") result: ("key1",map(<"key_a","value_a">,<"key_c","value_d">,<"key_e","value_g">)) , if "key2" -> insert new key empty map can : objects[key].insert(std::make_pair(key2,va

ios - Couldn't create log directory -

when test application on ipad run i.e. call database , create folder , perform other task in console show me 2015-05-12 11:25:32.478 myapp[291:19680] [pllogging] couldn't create log directory: operation couldn’t completed. (cocoa error 513.). when search, found answer nsfilemanager creating folder (cocoa error 513.) but not abel remove this. when shutdown , restart ipad line not show question: why statement in console? the above statement can crash app in future? how remove cocoa error 513 ? here code calling database let filemanager = nsfilemanager() var sourcepath = nsbundle.mainbundle().resourcepath?.stringbyappendingpathcomponent("database.db"); let docspath = nssearchpathfordirectoriesindomains(nssearchpathdirectory.documentdirectory, nssearchpathdomainmask.userdomainmask, true)[0] as! string let databasestr = "database.db" let dbpath = docspath.stringbyappendingpathcomponent(databasestr) println(dbpath) if(filema

android - AppCompatActivity as a dialog without title -

i have activity inherited appcompactactivity . in manifest activity set theme: <style name="theme.custom" parent="theme.appcompat.light.dialog"> <item name="android:windownotitle">true</item> <item name="colorprimary">@color/primary</item> <item name="colorprimarydark">@color/primary_dark</item> <item name="coloraccent">@color/accent</item> <item name="colorbuttonnormal">@color/accent</item> <item name="android:buttonstyle">@style/buttonstyle</item> </style> when run activity, shows dialog, title shown! try supportrequestwindowfeature(window.feature_no_title) , requestwindowfeature(window.feature_no_title) title still displayed. please let me know, wrong? edit i solve it, change android:windownotitle windownotitle ! because use appcompactactvity! if having appcompatactivit

ios - UISearchBar doesn't dismiss on push segue -

Image
i'm trying out uisearchcontroller ios 8 right now. when click cell, push segue , show view controller. however, search controller/bar still there on next controller. also, notice status bar background white, while should grey searchbar background color grey. there miss? this codes used initialise search controller override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. searchcontroller = uisearchcontroller(searchresultscontroller: nil) searchcontroller.searchresultsupdater = self searchcontroller.hidesnavigationbarduringpresentation = false searchcontroller.dimsbackgroundduringpresentation = false searchcontroller.searchbar.sizetofit() tableview.tableheaderview = searchcontroller.searchbar } screenshot: manual stop uisearchcontroller in prepareforsegue searchcontroller.active = false or add in viewdidload searchcontroller.definespresentationcontext = true

ios - I would like to localize my constants. Constants are defined and declared the usual way: -

extern nsstring * const kstringname; nsstring * const kstringname = @"whatever..."; how make localizable? can not work... nsstring * const kstringname = nslocalizedstring(@"whatever...", @"whatever..."); answer in question already. constant can not localized, because made constant string @ compile time. don't use constants.

php - YouTube API v3 not retrieving videos for a channel -

ok, i've used following php code try youtube return users list of videos, however, "items" coming empty. $apikey = "my-api-key"; $channel_name = "ucszdpmgfgxdgm4ytnm4arta"; $count = 1; $apiv3 = json_decode(file_get_contents("https://www.googleapis.com/youtube/v3/channels?part=contentdetails&forusername=".$channel_name."&key=".$apikey)); foreach($apiv3->items $item): $uploads = $item->contentdetails->relatedplaylists->uploads; endforeach; $youtube = json_decode(file_get_contents("https://www.googleapis.com/youtube/v3/playlistitems?part=snippet&contentdetails&maxresults=".$count."&playlistid=".$uploads."&key=".$apikey)); return $youtube; and being returned: { "kind": "youtube#channellistresponse", "etag": "\"tbwc5xrsxxe1woax6mk9z4hhsu8/3cxjrxf86g9z5bg7rup3qfcgr

objective c - Xcode:How to import parent's header in a sub-project -

Image
i've project has subproject (an xpc worker). here need import 1 header main(parent) project. how do this? i tried setting(sub project's) header search path, user header search path values $(srcroot) & $(srcroot)/../interface.h . tried changing settings recursive , non-recursive. the way solve these issues @ actual compiler line when building target see folders being specified in -i options , work there. need go build log , find file being compiled , expand command using dropdown button thing on right of line. the structure projects unique, it's impossible provide one-size-fits-all fix this.

What is the difference between hex bytes output using different types of encoding schemes in C#? -

consider following c# code int x = 126; string s = "126"; filestream fs = new filestream("test.txt", filemode.create); streamwriter sw = new streamwriter(fs); sw.writeline(x); sw.writeline(s); the output(in hex bytes stored in test.txt) 31 32 36 0d 0a 31 32 36 0d 0a if make changes line 4: streamwriter sw = new streamwriter(fs, encoding.unicode); the output is: ff fe 31 00 32 00 36 00 0d 00 0a 00 31 00 32 00 36 00 0d 00 0a 00 could me logic. there reference regarding different encoding schemes , behavior file systems using c# i suggest read joel spolsky's excellent article on subject of character sets , encodings . in short: a file sequence of bytes. a string sequence of characters. a character set defines collection of characters , assignes unique code point (an integer represents character - note "integer" not int ) each character. when want store string in file, need convert character s

javascript - Deploy user event script to get all fields and values from all suitelets deployed in Netsuite ERP -

is there way deploy user event script fields , values suitelets deployed in netsuite erp same record types. no it's not possible. can't access fields in user event script suitelet can use javascript event handlers in suitelet.

Get selected drop-down value of a row in html table using javascript/jquery -

i have html table 4 columns , multiple rows column1 : simple text column2 : simple text column3 : select list 2 values column4 : button performs operation at run time, want selected / entered values columns of row against column4 button clicked. know little of javascript/jquery .so, please help. here static table code <table id="invoicetbl" border="1"> <thead> <tr> <th>broker info</th> <th>receivable amount</th> <<th>status</th> <th>action</th> </tr> </thead> <tbody></tbody> </table> and populating table i.e. inserting data on ajax call this: $.ajax({ type: "post", data: $('#searchdetails').serialize(), async: false, cache: false, url: "/opsadmin/search.json", datatype: 'json', success: function (result) {

java - Cannot invoke equals(boolean) on the primitive type boolean -

i want check equality of first , last 2 characters of string have written condition like if (str.length() >= 4 && ((str.startswith(str.substring(0, 2))).equals(str.endswith(str .substring(str.length() - 3, str.length() - 1))))) but getting error cannot invoke equals(boolean) on primitive type boolean so root cause? error coming because : str.startswith() returns boolean value , calling equals() boolean use expression compare : str.substring(0, 2).equals(str.substring(str.length() - 3, str.length() - 1))

javascript - Dexie.js not carrying out .add transaction -

var db = new dexie(app.settings.unpublishedbooksdb); db.version(1).stores({ friends: "++id,name,shoesize" }); db.open(); db.close(); i have precreated indexeddb database using code above, , on view in application, need add row table. var db = new dexie('mydb'); db.open().then(function() { console.log ('opened'); //this works db.friends.add({name:"fredrik"}); //this doesnt , adding catch doesn't throw error either }).finally(function () { db.close(); }); i tried using .transaction still same. if try using chrome's console, error : cannot read property add of undefined your second db instance contains no info tables contain. implicit table property (db.friends) not there. happens throws typeerror: cannot read property 'add' of undefined. if catch call (not finally), typeerror catched. what can reference friends table db.table('friends').add ({name: 'fredrik'}) instead of db.friends.a

javascript - how can i get attribute in div with jquery -

this code firebug, want data-name value <div id="listdata"> name1 <img src="images1" data-name="data01"> name2 <img src="images2" data-name="data02"> name3 <img src="images2" data-name="data03"> how can attribute data-name click jquery you can use data . $('#images1').data('name'); to data-name of clicked image. $(document).ready(function () { $('#listdata').on('click', 'img', function () { alert($(this).data('name')); }); }); demo: https://jsfiddle.net/tusharj/a0468f8k/ store arbitrary data associated matched elements or return value @ named data store first element in set of matched elements. docs: http://api.jquery.com/data/

view - Replacing a TextView with the updated TextView Android -

i dynamically adding textview in activity layout. activity gets values activity using startactivityforresult , creates textview dynamically , add particular value it. problem there update button same activity when again value , come activity responsible displaying textview doesn't update textview , adds textview below previous textview int layout , keeps on adding without updating. know can set visibility gone removes textview child elements of layout or there way destroy text view , create in place? my onactivityresult method: protected void onactivityresult(int requestcode, int resultcode, intent intentdata) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, intentdata); if(requestcode == request_code && resultcode == result_ok){ locationlat = intentdata.getdoubleextra("locationlat", 0.0); locationlng = intentdata.getdoubleextra("locationlang", 0.0);

Is polygon operation in CGAL working with polygon that has duplicated edge? -

Image
i have polygon such: {0}, {1}, {2}, {3},... denote sequence of points on polygon. i wonder whether cgal polygon boolean set-operations work polygon such? from user manual , input polygon must simple or relatively simple in order cgal polygon boolean set-operations work: a relatively simple polygon allows vertices degree >2, of edges disjoint in interior. furthermore, must orientable polygon. namely when inserted arrangement , outer boundary traversed, same face adjacent of halfedges (no crossing on curve during traversal). note while polygon c has same curves polygon b, traversal of curves leads crossing on traversed curve, , therefore neither simple nor relatively simple. not sure means, guess polygon still ( @ least) relatively simple, , hence cgal polygon boolean operation still works... right? if @ condition valid polygon in user manual , you'll see input polygon must simple. yours not since have duplicated edge.

php - Redirect a user to the page they were trying to access after login in Wordpress -

i have page restricted logged in users (say it's called '/authed-page'). when non-authenticated user visits page prompted click button login , taken login url: '/login' now after login want them redirected page had been trying visit, '/authed-url', can't figure out how this! things i've tried: 1) declaring function redirect_to_authed_url in functions.php file this function redirect_to_authed_url( $redirect_to, $request, $user ) { return "/post-a-job"; } then in template authed-url.php when detect user isn't logged in this: <?php add_filter( 'login_redirect', 'redirect_to_authed_url', 10, 3 ); ?> however doesn't work think because user presses button generates http request sends them '/login' url means redirect filter lost. 2) setting cookie when visits '/authed-url' , not logged in called 'redirect_url'. declare in theme's functions.php file function redirec

css - lining up background image that is a fixed attachment among a grid of similar divs and images -

the fiddle isnt rendering exact grid gives idea of i'm going for. each div has fixed background image. problem each background image defaulting top left corner, after trying reposition image using background-position. https://jsfiddle.net/hlu7gvo3/ the styling looks this #thumb1{ background-size: cover; background-position: center; background: url("../img/gal1.png"); background-attachment: fixed; background-repeat: no-repeat; } .gallerythumb { color: white; position: static; float: left; width: 33.333vw; height: 100vh; } and html you'd imagine <div class="gallerythumb" id="thumb2">1</div> i tried setting sizing property container didn't much. have clue how center background image within div?

node.js - Express less-middleware not compiling -

can please me css compiling. don't know why view not getting compiled less index.js // middleware var express = require('express'); var less = require('less-middleware'); var app = express(); // less compiler app.use(less('source/less', { "dest": 'public/stylesheets', "pathroot": __dirname, "force": true, "render": { "yuicompress": true } })); // app config app.use(express.static(__dirname + '/public')); app.set('views', 'views') app.set('view engine', 'jade'); // routes app.get('/', function (req, res) { res.render('index'); }); // page not found app.use(function(req, res, next) { res.status(404).send('sorry cant find that!'); }); // web server var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('example app listening @ htt

.htaccess - Regex not matching the first occurence of my string -

in url: http://example.com/searchresult-empty.html?caty[]=12345&caty[]=45678 i trying use following regex grab first occurence of caty should "12345". however, instead, regex below giving me final occurrence 45678. tried using "?" limiter make non-greedy per other stack overflow questions, isn't working. how can this? ^searchresult(?:.*)(caty)(?:.*)\=([0-9]+)\&?$ as far can tell, 2 things messing up: the anchors ^ , $ seem forcing regex produce bad matches you using greedy .* instead of non-greedy .*? searchresult(?:.*?)(caty)(?:.*?)\=([0-9]+)\&? should job

javascript - different boxes with different checkboxs -

here's example: http://hamzakhan.name/dev/eric/options/five/fiveage.html as can see, there 2 checkboxes in each box. tried adding javascript make checkbox behave radio buttons javascript adding script under html form code: <script> $(".agecb").each(function() { $(this).change(function() { $(".agecb").prop('checked',false); $(this).prop('checked',true); }); }); </script> but it's not working. see, when try click on 1 checkbox , click on checkbox in next panel, first 1 unchecked. how fix that? want work across each panel. bear in mind there context; in case each pair of checkboxes within form element: $('.agecb').on('change', function() { this.checked = true; $(this).closest('form').find('.agecb').not(this).prop('checked', false); }); demo

jquery - Javascript only works locally but doesn't work on live site -

i'm coding website , works fine locally when test live, doesn't work same: http://keirabui.com/kairos2/ - cranes should disappear faster reveal animation of round gold logo - this: https://dribbble.com/shots/2057062-heartbeat the script crane fading out is: $(window).load(function() { $(".craneloader").delay(2200).fadeout(1000); }) also beating heart not clickable @ in firefox works fine in chrome , safari. know why?

mule - Wiretap router versus Async scope -

Image
based on understanding of wire tap router (scroll bottom of link) , async scope , think there significant overlap in functionality both provide. similarities both create copy of message , send across mp's the original flow continues execute on separate thread i looking guidelines understand when use feature. also though wire-tap router documented not available in mule studio version 5.1.0 deprecated ? you should use async , wire-tap legacy , inherited older versions of mule. implications @ threading level, specially difference internal thread pool take thread from. please bear in mind use should simple, otherwise may end being bottleneck in higher loads.

timer - JQuery Countdown to Specific Date -

i'm trying figure out how build countdown timer in jquery countdown set date , once day arrives display message "available now" in place of countdown was. i made animation show example of mean if helps: http://i.stack.imgur.com/qythr.gif can me? or maybe point me towards tutorial or show me how this? :) thank much! look @ this. made comments code. if questions ask, please. greetings andré var availabledate=new date(); //set eg "may 12 2015 05:01:00" availabledate.setdate(12); availabledate.setmonth(4);//january has index 0!!! availabledate.setfullyear(2015); availabledate.sethours(5); availabledate.setminutes(1);//january has index 0!!! availabledate.setseconds(0); var availabledatefield =$("#availabledate"); availabledatefield.text(availabledate); var timefield =$("#time"); var t=setinterval(loop,1000); //(handler,intervall in ms) function loop(){ //get current date (now) var now=new date()