Posts

syntax - Why python need parentheses in function call? -

why python can't omit parentheses in function call other language(coffeescript haskell) do? historical reason or what? the parentheses allow disambiguate function object, func , calling of function, func() . function objects first-class objects in python. can, instance, pass them arguments functions, other object. used set callback function -- common practice in gui programming or concurrent programming.

javascript - How to get checkboxes to populate based on selected option in angular? -

<select class="form-control" ng-model="filterforminputs.apps" ng-options="app.application app in d"> <option value="" disabled selected>select application</option </select> i have above code snippet somewhere in index.html. , in corresponding controller have $scope.d = [{"application": "app1", "details":[{"name":"name1"},{"name":"name2"},{"name":"name3"}]}, {"application":"app2", "details":[{"name":"name4"},{"name":"name5"},{"name":"name6"}]}] how make such when select "app1" select form, can populate list of checkboxes corresponding "name" field" ? example, if select app1, want 3 checkboxes name1, name2, , name3 appear. , if select app2 select form, want 3 checkboxes app4, app5, , app6 appear? using ng...

plsql - Parsing string in PL/SQL and insert values into database with RESTful web service -

i reading values want insert database. reading them lines. 1 line this: string line = "6, ljubljana, slovenija, 28"; web service needs separate values comma , insert them database. in pl/sql language. how do that? here pl/sql have used parse through delimited strings , extract individual words. may have mess bit when using web service works fine when running right in oracle. declare string_line varchar2(4000); str_cnt number; parse_pos_1 number := 1; parse_pos_2 number; parsed_string varchar2(4000); begin --counting number of commas in string know how many times loop select regexp_count(string_line, ',') str_cnt dual; in 1..str_cnt + 1 loop --grabbing position of comma select regexp_instr(string_line, ',', parse_pos_1) parse_pos_2 dual; --grabbing individual words based of comma positions using substr function --handling last loop if = str_cnt + 1 select substr(string_line, parse_pos_...

javascript - Appending script with document.write synchronous -

i've encountered problem when appending script html. here sample code: <script>$('body').append("<script type=\"text\/javascript\" src=\"http:\/\/localtest\/test.php\"><\/script>");</script> test.php source <?php sleep(1); ?> document.write('<div></div>'); html inside append function can html, not necessarly script. works unless got html mentioned in example. result js code test.php not executed because it's blocked browser (i'm using ff): "a call document.write() asynchronously-loaded external script ignored." i'm not able modify test.php content, it's loaded external server. wy executed async? how force sync execution? i think must use $(window).ready(function() { //put code here }); berfore appending. so, complete code this <script type="text/javascript"> $(window).ready(function() { $('body...

css - IE11 sometimes not displaying entire H1 -

please take @ following test site: http://adroity.be/ys/test.php when refreshing page in ie11 notice final 'e' not showing. show hover on title. don't have access other versions of ie don't know if limited ie11. i'm using google font (oswald). here's relevant code: html <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=oswald:400,300,700'> <link rel='stylesheet" href='style.css'> </head> <body> <h1><a href="/">yellowsubmarine</a></h1> </body> </html> style.css body { font-family: "oswald",sans-serif; } h1 { font-size: 130px; } h1 { font-weight: 700; text-transform: uppercase; } ...

c - How exactly pointer subtraction works in case of integer array? -

#include<stdio.h> int main() { int arr[] = {10, 20, 30, 40, 50, 60}; int *ptr1 = arr; int *ptr2 = arr + 5; printf("number of elements between 2 pointer are: %d.", (ptr2 - ptr1)); printf("number of bytes between 2 pointers are: %d", (char*)ptr2 - (char*) ptr1); return 0; } for first printf() statement output 5 according pointer subtraction confusion what second printf() statement, output? to quote c11 , chapter §6.5.6, additive operators when 2 pointers subtracted, both shall point elements of same array object, or 1 past last element of array object; result difference of subscripts of 2 array elements. so, when you're doing printf("number of elements between 2 pointer are: %d.", (ptr2 - ptr1)); both ptr1 , ptr2 pointers int , hence giving difference in subscript, 5. in other words, difference of a...

objective c - Making the UINavigationBar Disappear and Appear on a touch, mimicking safari on iOS -

i have uipageviewcontroller called uitableviewcontroller , shows series of images user. the images contain lot of information , while doesn't make sense have uinavigationbar entire time, because it's used share image, or go back, there way mimic safari on ios, uinavigationbar @ top disappears , reappears on touch? i have not tried because don't have first clue on start this. there third-party open source framework, or easy way animate this? perhaps in viewdidload, have timer on uinavigationbar , show @ start , disappear after 2 seconds, etc, reappear on touch? any guidance on appreciated. ios 8 provide default feature self.navigationcontroller.hidesbarsontap = true; [edited] add tap gesture in viewdidload uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(taphandle:)]; [self.view addgesturerecognizer:taprecognizer]; add following method viewcontroller - (void)taphandle:(uitapgesturere...