Posts

Showing posts from March, 2013

internet explorer - IE11 insecure content warning show even there are all https request -

i web developer, our site https://jianguoyun.com . browser prompt insecure content warning while 1 of colleagues visit our site using ie11 (it works in ie11 browser). using https protocol in our site. else encounter situation? how fix this?

osx - Stop git commit in pre-commit hook with exit -

i'm trying stop git commit continuing pre-commit hook. reading manual, should stop when return exit code other 0. i'm testing see if csscomb command returns error, , if break loop , exit, git commit still continues on entering message via git commit (-a) . i've forked , modified script below https://github.com/filtercake/git-pre-commit-csscomb #!/bin/bash # pre-commit hook comb staged .sass , .scss files # save .git/hooks/pre-commit # make executable: chmod +x .git/hooks/pre-commit # sources: # http://www.hagenburger.net/blog/using-git-commit-hooks-to-autocompile-sass-to-css.html # http://stackoverflow.com/questions/8470755/git-pre-commit-hook-add-file-into-index/8471009#8471009 # http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script/677212#677212 # https://gist.github.com/openam/8406343 # check if sass/scss files staged commit # diff-lines http://stackoverflow.com/a/12179492/3019532 # takes line function diff-lines() { ...

html - searchbox and submit button are appearing without borders -

Image
very stupid question, cant solve it... in php project searchbox , submit button looking weird, ones on .jpg picture below, why , how fix this? (search = otsi:). on simple html form same lines of code appearing normally, upper searchbox (with borders / otsi: ) checked css , doesn´t seem affect borders or boxes. code on .php subpage simple: <header id="header"> <div id="logo"><img src="images/logobmw.png"></div> <div id="searchbox"> <form action="search.php" method="get" enctype="multipart/form-data"> <input type="search" name="value" size="25" > <input type="submit" name="search" value=" otsi " > </form> </div> </header> (grey background on search-field set me in css, white, ergo, invisible because header´s background color white. css *, body, wrapper , header pretty s...

swift - Displaying Artwork for .MP3 file -

Image
i trying display album artwork locally stored .mp3 track in imageview. know how fetch artwork in swift in order accomplish this? i have found solution ( ios avfoundation: how fetch artwork mp3 file? ) code written in objective c. want grab image embedded in mp3 , display in imageview. i've looked @ api documentation mpmediaitemartwork , found example accomplishes trying accomplish in objective c here( http://www.codeitive.com/0zhjkujuwx/not-able-to-get-the-uiimage-from-mpmediaitempropertyartwork.html ) cannot come solution. code follows: import uikit import avfoundation import mediaplayer class viewcontroller: uiviewcontroller { let audiopath:nsurl! = nsbundle.mainbundle().urlforresource("sippinonfire", withextension: "mp3") @iboutlet var artistimage: uiimageview! @iboutlet var tracklabel: uilabel! @iboutlet var artistlabel: uilabel! @iboutlet var slidervalue: uislider! var player:avaudioplayer = avaudioplayer() @ibaction func play(sender: anyobjec...

javascript - Use non-specification attribute in React JSX? Such as ng-href -

i'm getting familiar react , thinking of gradually moving angular app on it. now, have 1 react component on site. however, need have element ui-href attribute in react component. tried putting in string, so: <a { "ui-href='" + this.props.statelink + "'" } >...</a> but no joy, says error unexpected string. i read can prefix custom attributes data- make make them work, , that's true, keeps data- attached, e.g. data-ui-href actual final attribute creates. any known workaround? i think unexpected string error occurring because mixing angular & react syntax. try instead: <a data-ui-href={this.props.statelink} >...</a> it keep data- prefix in attribute though. not sure workaround is.

objective c - Searching and Auto-Scrolling UIScrollview with UILabel inside -

i have uiscrollview uilabel inside of populated non-english text. i search scrollview/uilabel word/phrase , auto-scroll point. i know theres no simple way because theres no function uilabel. can't use uitextview because reason regular scrolling on uitextview choppy makes bad user experience (reviews users). uilabel on uiscrollview scrolls extremely smoothly lacks ability of uitextview. ideas? i got answer luke rogers answered so question - (cgrect)boundingrectforcharacterrange:(nsrange)range { nstextstorage *textstorage = [[nstextstorage alloc] initwithattributedstring:[self attributedtext]]; nslayoutmanager *layoutmanager = [[nslayoutmanager alloc] init]; [textstorage addlayoutmanager:layoutmanager]; nstextcontainer *textcontainer = [[nstextcontainer alloc] initwithsize:[self bounds].size]; textcontainer.linefragmentpadding = 0; [layoutmanager addtextcontainer:textcontainer]; nsrange glyphrange; // convert range glyphs. [l...

java - How to force browser to expire cache of a specific page? -

i confused caching. know there different types of caching follows, question how have separate dynamic pages. public - may cached in public shared caches (proxies , users) private - may cached in private cache (users only) no-cache - may not cached no-store - may cached not archived lets have specified 'public cache' , have following 2 addresses , need remove cache user 908. should pass meta new attribute of model? whats best approach? www.example.com/users?id=100 www.example.com/users?id=908 expire cache if(user.cacheexpire){ model.addattribute("meta","<meta name="expires" content=" + user.cachedate + "> "; } model.addattribute("user",user); return "userpage"; does force user's browser remove cache user 908 id only? best approach?

How to make perl throw an error for invalid or nonexistent files? -

using perl -p or -n flags or diamond operator on non-existent files not exit error: $ perl -pe '' badfile || echo error can't open badfile: no such file or directory. $ $ perl -ne '' badfile || echo error can't open badfile: no such file or directory. $ $ perl -e 'print while <>' badfile || echo error can't open badfile: no such file or directory @ -e line 1. $ how can force perl throw error, not warning, when given bad file? use local $sig{__warn__} = sub { die @_ }; set warning handler throw error. $ # put handler code in begin block -p , -n: $ perl -pe 'begin{$sig{__warn__}=sub{die @_}}' badfile || echo error can't open badfile: no such file or directory. error $ $ perl -ne 'begin{$sig{__warn__}=sub{die @_}}' badfile || echo error can't open badfile: no such file or directory. error $ $ perl -e '$sig{__warn__}=sub{die @_}; print while <>;' badfile || echo error can't open badfile...

javascript - Highcharts multiple charts, each with live data -

i have following files: rsrp.txt, sinr.txt, rssi.txt each of them containg information this: [1433289760000,-83.5] i want use multiple charts on same page. i tried use sample script highcharts page: var chart; // global /** * request data server, add graph , set timeout request again */ function requestdata() { $.ajax({ url: 'rssi.txt', success: function(point) { var series = chart.series[0], shift = series.data.length > 30; // shift if series longer 20 // add point chart.series[0].addpoint(eval(point), true, shift); // call again after 1 second settimeout(requestdata, 1700); }, cache: false }); } $(document).ready(function() { chart = new highcharts.chart({ chart: { renderto: 'container', defaultser...

c - Dereferencing pointer type when in sizeof() -

i have following structure: typedef struct _foo_t { int bar; float buzz; char quux[40]; } *const foo_t; is there way size of structure, it's done via sizeof(struct _foo_t) , using name foo_t ? have tried sizeof(*foo_t) , not compile. i don't believe can directly. you'll need define intermediate typedef if want this: typedef struct _foo_t { int bar; float buzz; char quux[40]; } foo_t; typedef foo_t *const foo_tp; // sizeof(foo_t) should work dereferencing type doesn't make sense in c. can dereference variable, not type. in c++, can these kinds of type operations using templates, that's not applicable since indicate c tag. you declare dummy variable of appropriate type invoke sizeof on expression: foo_tp f; // sizeof(*f) should work

javascript - Arithmetic equations in alert? -

this question has answer here: calculate string value in javascript, not using eval 6 answers hello making alert shows addition of number(num1) + number(num2) in alert box comes user inputted , result wondering how code show whole equation, example, "2 + 2 = 4" if user put in 2 , 2. i know how show result how can make show numbers user put in result? assuming understand want do: a = prompt('first number'); b = prompt('second number'); alert( + '+' + b + '=' + (parseint(a)+parseint(b)));

MATLAB eliminate for loop -

is possible following without loop? param1_vary = [-10:5:10] [r,c] = size(param1_vary) = 1:length(param1_vary) new_parms(n,:) = ones(n,c).*param1_vary(i) end okay there 2 ways interpret this: you want variable size(new_parms) = [c, n, c] , new_parms(1, :, :) = param_vary(1) on , forth, if case want use ndgrid param1_vary = [-10:5:10]; c = length(param1_vary); n = 50; [new_parms, ~, ~] = ndgrid(param1_vary, ones(n, 1), ones(c,1)); you want variable size(new_parms) = [n, c] , new_parms = ones(n, c) * param_vary(1) * param_vary(2) * ... if case want prod function param1_vary = [-10:5:10]; c = length(param1_vary); n = 50; new_parms = ones(n, c) * prod(param1_vary); if neither of these correct you're going need clarify question.

debugging - How can I add "Terminate All" to an Eclipse toolbar? -

i regularly use terminate/disconnect all find cumbersome switch debug pane, right click, , find , select in menu. how can add toolbar, or assign hotkey command? it not displayed in customize perspective -> command groups availability .

firebase - Returning 404 on python script https problems? -

i have of app running smoothly trying python code send serial data through 404 when try use python3 issues serialutil far basestring not being defined etc etc in serial libraries. revert python 2.7 , wondering if possible add https string somewhere override whatever happening reverting http? import serial import time import requests import json firebase_url = 'https://ourfleet.firebaseio.com' auth_token = '0sbnzjz4uqvltedogsajsksdksdbnasasjsdl' #connect serial port communication ser = serial.serial('/dev/tty.wchusbserial410', 9600, timeout=0) #setup loop send gps values @ fixed intervals #in seconds fixed_interval = 10 while 1: try: #gps value obtained arduino + ublox gps_c = ser.readline() #current time , date time_hhmmss = time.strftime('%h:%m:%s') date_mmddyyyy = time.strftime('%d/%m/%y') #current location name gps_location = 'ourfleet' print (gps_c + '...

javascript - Return only numbers from string -

i have value in javascript as var input = "rs. 6,67,000" how can numerical values ? result: 667000 current approach (not working) var input = "rs. 6,67,000"; var res = str.replace("rs. ", "").replace(",",""); alert(res); result: 667,000 this great use regular expression. var str = "rs. 6,67,000"; var res = str.replace(/\d/g, ""); alert(res); // 667000 \d matches character not numerical digit. non digit replaced empty string. result digits in string. the g @ end of regular expression literal "global" meaning replaces matches, , not first. this approach work variety of input formats, if "rs." becomes else later, code won't break.

unix - How can I change numbering in all of the file names? -

i have 1000 files, have format of framexxx.dat, such frame0.dat frame1.dat frame2.dat .... frame999.dat i hope change these file's name frame000.dat frame001.dat frame002.dat .... frame999.dat is there anyway simple linux command? also, if files framexx.dat or framexxxx.dat (xx 2digit numbers , xxxx 4 digit numbers) how can change code same? you have handle them groups: group 0: frame100.dat frame999.dat : nothing here. group 1: frame10.dat frame99.dat : add 1 0 for in {10..99}; mv frame$f.dat frame0$f.dat; done group 2: frame0.dat frame9.dat : add 2 0s for in {0..9}; mv frame$f.dat frame00$f.dat; done a general guideline handle big numbers first (in cases complications arise) this can extended bigger numbers...you got idea.

OAuth 2 for native application - what is difference between public and confidential client types? -

i trying implement oauth 2 provider web service , built native application on top of it. want give access api third-party developers. i read oauth 2 specification , can't choose right flow. want authenticate both cli , gui apps well. first of have 2 client types - public , confidential. of course both gui , cli apps public. difference between 2 types? in case need client_secret if can access token without changing client type? i tried @ api implementations of popular services github. use http basic auth. not sure idea. what brink choose between usability (good old login , password in cli more comfortable opening web browser) , security? thanks! as difference between public , confidential clients, see http://tutorials.jenkov.com/oauth2/client-types.html says: a confidential client application capable of keeping client password confidential world. client password assigned client app authorization server. password used identify client authorization s...

html - Ellipsis for overflow text in dropdown boxes -

i'm fixing width of 1 of dropdown boxes (yes know there cross-browser issues doing this). is there non-js way cut off overflowing text , append ellipses? text-overflow:ellipsis doesn't work <select> elements (at least in chrome). example here: http://jsfiddle.net/t5eue/ html limited in specifies form controls. leaves room operating system , browser makers think appropriate (like iphone’s modal select which, when open, looks totally different traditional pop-up menu). it looks operating systems cut selected option off without elipsis. if able change how text gets cut off, strange since that’s not how select boxes work in rest of operating system. if bugs you, can use customizable replacement, chosen , looks distinct native select . or, file bug against major operating system or browser. know, way text cut off in select s might result of years-old oversight copied, , might time change.

Separating PHP and HTML -

Image
i apologize asking such beginner question, i'm unsure on else go such help. i'm creating php website using goggleapp engine. i've created simple form using html in same file php. now, know isn't practice, want break html it's own file. question is, how re-write code assuming html in it's own file? it fine place php code in same file html code. however, if going duplicate code, best have separate files (maybe header , footer file). that way can use require_once("header.php") , require_once("footer.php") in each file wants use top , bottom portions of code. as sven mentioned, can templating. can coding habits such mvc (model view controller) , similar methods.

matlab - how to translate and scale the image? -

Image
my image looks this: the given imrgb = 320*512*3 double; color_map = 64*3 double; after using [x, map] = rgb2ind(imrgb, color_map); i x = 320*512 uint8. image big further processing. question how translate , scale image standard size of 32*32 pixels without losing important information ( mean non-black part of image important information)? here 1 solution make each brain tile 32x32 image. comments explain code. basic idea is... using block proc to split large image 5x8 grid, because has 5 rows of brains , 8 columns of brains. call each of these images tile resize each tile 32x32 using mat2cell split new small tiles individual images , display them here code im = rgb2gray(imrgb); max_rows = 32; max_cols = 32; %i assume every picture has 40 brains, 5 rows , 8 columns rows_brains = 5; cols_brains = 8; [m n] = size(im); %define resize function take 'block_struct' image , resize %it max_rows x max_cols fun = @(block_struct) imresize(block_str...

java - Can't get Json android -

i want output json, have error 06-02 23:10:26.110: w/system.err(23235): org.json.jsonexception: value data of type java.lang.string cannot converted jsonobject 06-02 23:10:26.116: w/system.err(23235): @ org.json.json.typemismatch(json.java:111) 06-02 23:10:26.117: w/system.err(23235): @ org.json.jsonobject.<init>(jsonobject.java:158) 06-02 23:10:26.117: w/system.err(23235): @ org.json.jsonobject.<init>(jsonobject.java:171) i create code whith example, json: { "status": "success", "data": { "users_information": [ { "id": "1", "active": "1", }, { "id": "2", "active": "1", }]}} it's code: jsonobject data = new jsonobject("data"); jsonarray userinform = data.getjsonarray("users_informat...

java - Making a JButton act like a JMenu -

Image
i have following code jmenubar (this code has been taken free java program call jguid , edited personal purposes) import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; import java.awt.dimension; import java.awt.color; public class guidmenubar extends jmenubar { jmenu m_file,m_edit,m_help; jmenuitem mi_f_new,mi_f_open,mi_f_save,mi_f_saveas,mi_f_exit; jmenuitem mi_e_cut,mi_e_copy,mi_e_paste,mi_e_delete; jmenuitem mi_v_motif,mi_v_java,mi_v_windows,mi_v_nimbus; jmenuitem mi_h_help,mi_h_about; jbutton m_code; public guidmenubar() { setborderpainted(true); makefilemenu(); makeeditmenu(); makecodebutton(); makehelpmenu(); } void makefilemenu() { m_file = new jmenu("file"); m_file.setmnemonic('f'); mi_f_new = new jmenuitem("new",new imageicon("icons/new_project.png")); mi_f_new.setmnemonic('n'); ...

c++ - Using the GNU Scientific Library to Find the Kernel of a Matrix -

given gsl_matrix * object, m -by- n matrix, easiest way find kernel of a? tried using singular value decomposition (specifically gsl_linalg_sv_decomp method), doesn't work when m < n , case matrices. the easiest way (if restricted library) pad matrix rows of zeros n x n, can pass function. padded matrix have same null space.

ruby on rails - How to get the responses of an API call (shopify)? -

i've been using rails week , have found numerous tutorials haven't found info current problem. have webshop running , can access via shopify console: shopifyapi::customer.find(674469828) -> return customer id 674469828 if use same code in rails app nothing happens. error message of api call , have no idea how this. mean i'm sending post request service , getting response (http/1.1 200 ok example). how can "catch" http response in code? how can display response header? use simple http requests , responses if there's api, why not use it. i'd thankful help. assuming have set app api credentials etc, can "catch" response assigning variable, so: customer = shopifyapi::customer.find(674469828) # can play around customer object customer.name # => "jimmy" if doesn't / missing point, please post specific error message or server output getting along specific request made.

prolog - Schedule planning strategy -

i going attempt solving scheduling problem prolog. have set of requests people in format req_id, user_id, start_date, end_date, state each of these people in 1 or more groups group_id, user_id and each group defined by group_id, loose, strict where loose , strict integers >= 0 the initial state of each request unknown, , can changed either rejected or approved. to explain loose , strict on groups consider following example group - loose 1 - strict 1 group b - loose 1 - strict 0 group c - loose 0 - strict 1 given these data @ given time need 3 people @ work 1 person can solve both , b loose (given in both of groups) , 1 person needed strict , 1 person c strict. the date span limited 5-6 weeks - never open ended searches. problem 1: how represent available personnel @ given time no group rules can broken problem 2: how "force" prolog searches maximum possible accept actions instead of rejecting requests edit sorry late followup, hurt leg ,...

How do you use variables in a regression formula in R? -

how use variable in regression formula? for example, using 'animals' dataset (in mass), following works fine: data(animals) model <- lm(body ~ brain, data = animals) but want is: data(animals) x <- "body" y <- "brain" model <- lm(x ~ y, data = animals) this doesn't work, can't figure out need do. ultimately, i'm trying put formula inside loop , have run different each time. sorry if answer obvious - i've searched can't solve it. many thanks you need make proper formula character values. easiest way in case reformulate() function reformulate(y,x) # body ~ brain then can use in lm() call lm(reformulate(y,x), data = animals) # # call: # lm(formula = reformulate(y, x), data = animals) # # coefficients: # (intercept) brain # 4316.32258 -0.06594

html - how to delete a file with symbols (Specifically the apostrophe) -

i have database stores teams. each of these team names unique. in event 1 named bob's team. have managed % encode symbols when sent through querystring next file. in file getting error sql due apostrophe , don't know how fix it. not quite sure escaping stuff i'm reading. it's pretty confusing. here line causing problem: strsql = "select * teams teamname='" & theteamname & "'" in event bob's team name of team. error is: microsoft ole db provider odbc drivers error '80040e14' [microsoft][odbc microsoft access driver] syntax error (missing operator) in query expression 'teamname='bob's team''. /deleteteam.asp, line 35 i'd know have in order make delete team apostrophe (and possibly other annoying symbols) in it. to make query work can try following: replace in theteamname single quote ' '' use in query. (@least works in mysql not sure abt db engine give try). note...

Android: How to create a notification from the command line (terminal emulator or shell script)? -

i create notification (icon in notification bar plus message in notification drawer) shell script i'm running on android device. have cyanogenmod11, comes busybox v1.22.1 bionic. i've discovered how create toast ( http://forum.xda-developers.com/showthread.php?t=773232 ) need notification. difference between toast , notification, see excellent thread: https://android.stackexchange.com/questions/52789/popups-dialogs-notifications-toasts-whats-the-difference can point me in right direction? i'm guessing involve android activity manager (am) i've searched every nook , cranny of internet , cannot find way create notification command line on android. source: https://forum.xda-developers.com/showpost.php?p=69859668&postcount=18 date: 30th november 2016, 02:32 pm two years ago in need of simple notification tool have been run command line in script. far best found thread , tiny app made corruptor64. wasn't looking decided try make tool myself. sta...

ms access - Dsum Function in Query Field not working properly -

i have date based query returns 2 fields, week ending date , l2n, , want add third field provides rolling total of l2n field. have tried using dsum follows: runl2n: dsum("[l2n]","occupied apts & l2n", "week ending date=" & "'" & [week ending date] & "'") in code above, l2n field want sum, , occupied apts & l2n query returns fields. query asks week ending date , delivers of records equal or proceed given week ending date. it no worky right. goal runl2n field show rolling total of l2n field each record. in other words, if query returns multiple records, want show l2n field result, , show run2l2n field, sums l2n fields of records above , current record. so if query returns 1 in l2n field, 3 next record, 5 next record , lastly 7 final record, want runl2n field show 1 first record, 4 next record, 9 next record , lastly 16 final record. since field name includes spaces, bracket this: [wee...

node.js - How Can I Make A Public API Route For An AWS Lambda Function? -

does aws lambda provide way make public route/endpoint lambda functions? or have build entire app handle routing , invoking lambda functions? yes do! as of july 9th have api endpoint section allows invoke lambda function anywhere! http://aws.amazon.com/about-aws/whats-new/2015/07/invoke-aws-lambda-functions-over-https/. you can use api gateway lambda design , test api.

XML Query Select After Date -

i've been browsing around various forums trying figure out how restrict windows event log xml queries specific date range, seems xml doesn't play it. query have set is: <querylist> <query id="0" path="application"> <select path="application"> *[system[provider[@name='microsoft-windows-folder redirection'] , (level=2)]] </select> </query> </querylist> basically i'm trying find out how limit query x amount of days ago , forward. i'm trying find computers above error may present problem, , if flagged error year ago or something, doesn't me. can give me little direction on this? try this: <querylist> <query id="0" path="application"> <select path="application"> *[system[provider[@name='application hang'] , (level=2) , (timecreated[timediff(@systemtime) &lt;= 86400000])]] </select> <...

c# - Split string input into jagged array -

string[] listkeys = key.split(','); string[] orkeys; string[][] advlistkeys; (int = 0; < listkeys.length; i++) { orkeys = listkeys[i].split('|'); (int j = 0; j < orkeys.length; j++) { advlistkeys = new string[i][j]; advlistkeys[i][j] = orkeys[i]; } } i trying enter string "glu|com,inf|ina" jagged array in c# in such way it's columns defined length of listkeys (split comas) , rows defined length of orkeys (split '|') , values stored in jagged array {"glu", "com"} column 1 , {"inf", "ina"} column 2! getting error: error 2 invalid rank specifier: expected ',' or ']' can help? the issue cannot instantiate both dimensions of jagged array @ same time. that's because each array in array can have different length. but it's easier linq string[][] advlistkeys = key.split(',') .select(o...

c++ - Qt::WA_TransparentForMouseEvents neither alpha transparency aren't working for wheel events? -

this line this->setattribute(qt::wa_transparentformouseevents); is old friend works qt propagates event widget under current one. also if using transparency in button solid part of gets kind of events. unfortunatly didn't manage make same wheel events, can catch throught eventfilter not fine me. the idea overlay on widget contains 3d data "steals" wheel event.

Php subtract time saved in session with current time -

i using jquery countdown timer problem timer start value set every time on page refresh . want time on first time , save in php session , subtract second time frist time , update session etc. in simple word want create php countdown timer run 50 using php here controller code public function actionviewtimer($id) { $session = yii::app()->session; $this->layout = 'countdownlayout'; if (empty($session['countdowntime'])) { $ordertime = microtime(true); #when user first time enter timer start 50 mins $session->add('countdowntime', array($ordertime)); //replace line } else { $time_end = microtime(true); $ordertime = $time_end - $time_start; unset($session['countdowntime']);//unset old session $session->add('countdowntime', array($ordertime)); //when user enter second } $getminutes = $getminutes_from_ordertime ; #please tell me how extact minutes , pass t...

matlab - Draw a line in a 3D set of images -

Image
in other words same line should appear atop each image. im using imshow3d function preview images. here way without imshow3d (just create new .m file function below). think easier understand going on behind code then. the trick add pushbutton , function imline in callback in order interactively draw line. then, user scrolls through stack use function line draw line using position of drawn line. i used mri data ships matlab should work data/dicom images/whatever. code: function scrollmri(~) clc clear close %// load demo data s = load('mri'); %// dimensions , number of slices. imageheight = s.siz(1); %// not used here imagewidth = s.siz(2); %// not used here numslices = s.siz(3); s.d = squeeze(s.d); %// create gui hfig = figure('position',[100 100 400 400],'units','normalized'); %// create axes handle handles.axes1 = axes('position', [0.2 0.2 0.6 0.6]); %// create y slider handle handles.y_slider = uicontrol('st...

javascript - Parsehub Selection Node Syntax -

i'm trying use parsehub extract data website. using selection tool able isolate title header of each section unable deselect first cell of second header row using alt-click. selection node criteria changes actual selection not. block of html in question <tr> <td width="100%" align="center"> <table width="493"> <tr><td></td></tr> <tr><td colspan="3">&nbsp;</td></tr> <tr bgcolor="#99cc00" height="17"> <th height="17" colspan="3" title="scratcher name"><div align="center" class="txt_white_bold">lucky 7`s #348</div></th> </tr> <tr bgcolor="#99cc00" height="17"> <th height="17"><div align="center" class="txt_white_bold">prize amount</div></th> <...

ANGULARJS: "XMLHttpRequest cannot load http://localhost:62259/Service1.svc/getAllUsers. Invalid HTTP status code 405" -

so, situation: i developing web app angularjs (client-side) , c# (server-side); i have web services running well, no problems (gelallusers, getorderdetails, etc etc); after implement authentication code, web services stop working. here errors messages: options http://localhost:62259/service1.svc/getallusers xmlhttprequest cannot load http://localhost:62259/service1.svc/getallusers . invalid http status code 405 i realized problem due every code lines "$http.defaults.headers.common.authorization = ..." after search, know may need allows authorization header. but what? , how?and where? i found solution, , works article in codeproject. novice in web developing, here detailed procedure had follow in order perform successfully: understand why problem exists , needed enable cors in wcf: read article in http://www.codeproject.com/articles/845474/enabling-cors-in-wcf believe me, it's worth it. wouldn't explain better; as using visual st...

java - testing the order of a collection -

given list of objects i'd test return in correct order, not assert entire object. for example i'd verify they're in order by id 1, id 2, id 3, or in case date mostrecent date older date oldest or in yet case enum valuea enum valueb enum valuec basically want test sort specified went through correctly single property on object affects this, i'd specify test variant of hasfirstitem( withpropertyequalto ... has seconditem( withpropertyequalto i know can write assertequals( property, list.get(0).id ) assertequals( property, list.get(1).id ) but i'd rather makes failure bit more obvious being sort issue, , perhaps declaratively, testing whole collection @ once. possible? you should able use hamcrest's matcher hasproperty this: public class foo { private string a; public foo(string a) { this.a = a; } public object getstr() { return a; } public static void main(string[] args) { ...

Error: Getting symbols in python output -

#i wrote following code making text editor. print "this simple text editor" sys import argv script, name = argv print "you have selected file : %s" %name print "opening file...." t = open(name, 'r+') print "the contents of file are" print t.read() f = open(name, 'w+') print "now truncate file , empty of it's contents" f.truncate() print "now let write our file\n" x = raw_input('what want write\n') #works fine till here f.write(x) print "now read our file again" print f.read() print "and close file" f.close() after promp write in file, script goes awry , produces strange symbols instead of typed text. please help you need close , re-open file. print "this simple text editor" sys import argv script, name = argv print "you have selected file : %s" %name print "opening file...." t = open(name, 'r+') print "the contents of f...

Calling C++ class functions from Ruby/Python -

in specific circumstance, have complex class (a class of classes of classes) want expose scripting language (aka ruby). rather directly pass complex class, gave me idea of opening few functions scripting language ruby, seemed simpler. i've seen rice examples i've seen use simple functions multiply something, rather interfacing class. for simplicity, have simple class functions want expose: class foo { private: //integer vector: std::vector<int> foovector; public: //functions expose ruby: void pushback(const int& newint) {foovector.push_back(newint);} int& getint(const int& element) {return foovector.at(element);} }; also: i'd prefer not have link download page of swig, or article explaining how rice written in 2010, guide work (i haven't had luck yet) aswell: i'm using linux (ubuntu) cross-compatible program, must able compile on windows , os x edit: i understand shared libraries ...

javascript - how to execute google maps event "bounds_changed" only once -

how tell google map event "bounds_change" work when map loaded, , not after user change? from documentation addlisteneronce(instance:object, eventname:string, handler:function(?)) return value: mapseventlistener addlistener, handler removes after handling first event. google.maps.event.addlisteneronce(map,'bounds_changed', function() {});

python - Inserting data in postgreSQL database by Django model -

i found error when insert data postgres database django model,when put csrf package in comment oage found else shows forbidden error code , screen shot below here html file: {% extends "homepage/index.html" %} {% block title %} contact {% endblock %} {% block content %} contact page. <form action="/ins/" method="post"> {% csrf_token %} <table> <tr> <td>created date</td> <td><input type="text" name="cid"></td> </tr> <tr> <td>updated date</td> <td><input type="text" name="uid"></td> </tr> <tr> <td>title</td> <td><input type="text" name="tid"></td> </tr> <tr> <td>text</td> <td><input type="text" name="txid"><...

ios - iTunes Connect Test Flight won't play AdMob Test Ads -

i double checked in xcode project , build uploaded itunes connect has admob test ads on. however, same build during test flight's internal testing not playing admob test ads, it's playing live ads. how make play admob test ads during beta testing? to test admob ads, need specify test device. otherwise, in simulator shows test ads. to specify test device : gadrequest *request = [gadrequest request]; request.testdevices = @[ @"2077ef9a63d2b398840261c8221a0c9a"]; //my iphone's udid [self.bannerview loadrequest:request];

string concatenation - Android send SMS message with two getString() -

i've got problem sending sms android app. in strings.xml have text1 , text2 text. when i'm trying send sms 1 string, e.g sms.sendtextmessage(number, null,message, null,null); where message getstring(r.string.text1) works fine. need send string text = getstring(r.string.text1) + somevariable + getstring(r.string.text2); doesn't work. i've tried make getresources().getstring() in both still nothing, it's not sending;/ doing wrong? you can use string builder append string , put together. stringbuilder sb = new stringbuilder(some_appropriate_size); sb.append(getresources().getstring(r.string.text1)); sb.append(somevariable); sb.append(getresources().getstring(r.string.text2)); string final_string = sb.tostring();

javascript - how to disable dropdown options less than some value using jquery -

below have year dropdown. <select name="from_year" class="col-md-4 form-control" id="from_year"> <option value="0">select year</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option selected="selected" value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select> now ajax call year 2016. want disable options less 2016. tried following: $...

EF6 Entity Data Model Wizard extension gets error after Update Model From Database -

i have custom entity data model extension implements imodelgenerationextension. without getting specific code, have come across situation "a model generation extension made changes model generated database not valid." when updating model database. able step through extension using visual studio experimental instance. xml document representing edmx file modified extension valid xml. error occurs after scope leaves onaftermodelgenerated method. i'm assuming did ef entity data model wizard doesn't like. how can determine actual error is? find info sort of thing not readily available. appreciated. in advance. you can save resulting .edmx new file , open in visual studio. show errors has.

asp.net - How to redirect a client to a website after having authenticated it? -

Image
i have implement simple single sign on (sso) solution between 2 existing internet applications hosted 2 different companies. what should do: the user log application username , password. the user clicks on button in application launch application b. this button in fact link “facade” (an asp.net page) installed somewhere between application , application b. the facade retrieve token (included in url caller) , call web service of application token user's email. email included in response. the facade retrieved user/password of user local database , post them login page of application b. the facade redirect caller application b. the problem is, don’t know how implement last step. response post (step 5) welcome page , cookie. i’ve tried copy response (a httpwebresponse ) response of facade, while user can see welcom page content, there no redirection... httpwebresponse applicationbresponse = postapplicationb(); var reader = new treamreader(applicationbresponse.get...

jquery - Disable page interactions (eg links, inputs) when off canvas menu is open? -

i have off canvas menu. when open menu small amount of normal page content still visible. when click or tap on area menu closes. this working when normal content text , images. when link link gets followed, if input input becomes active. how can disable links, inputs, etc when menu open? can javascript (i'm using jquery)? the javascript simple. toggle class when click or tap menu , animate page css. $('.off-canvas-menu-trigger').click(function() { $('body').toggleclass('off-canvas-menu-is-open'); }); $('.page-content').click(function() { $('body').removeclass('off-canvas-menu-is-open'); }); its not javascript best solution use css disable entire div , contense being clickable: pointer-events: none

angularjs - How to invoke spyOn on a scope function -

i have following jasmine spec. describe('viewmeetingctrl', function () { var $rootscope, scope, $controller , $q ; beforeeach(angular.mock.module('myapp')); beforeeach(inject(function ($rootscope, $controller ) { scope = $rootscope.$new(); createcontroller = function() { return $controller('viewmeetingctrl', { $scope: scope, meeting : {} }); }; })); it('the meeting type should equal object', function () { var controller = new createcontroller(); //some assertion }); }); following viewmeetingctrl.js (function () { 'use strict'; angular.module('myapp').controller('viewmeetingctrl', viewmeetingctrl); viewmeetingctrl.$inject = ['$scope', '$state', '$http', '$translate', 'notificationservice', 'meetingservice', '$modal', 'meeting', ...

c - how do I writing function for this code -

i'm trying write function or method code. i'm lost @ how come loop print out number born , number died in output below. here code: #include <stdio.h> char grid[10][10]; // moved function here int occ(int x, int y) { int i, j, count; char gridcopy[10][10]; // going in future // make function instead of having same code void printgrid() { int i, j; (i = 0; < 10; i++) { (j = 0; j < 10; j++) printf("%c", grid[i][j]); printf("\n"); } } you don't need gridcopy in occ function. please remember array transposed. when access element (x,y) need use grid[y][x] below working code function generatenext() generates next state whole grid array. place need girdcopy . results same in example. #include <stdio.h> #include <stdlib.h> char grid[10][10]; int born,died,generation; // moved function here int occ(int x, int y) { int count; int xm1,xp1,ym1,yp1; x...

Is it possible to program an Android app to automatically divert the user to download a plugin app upon opening it? -

say android app doesn't work without plugin, options available plugin downloaded? would have create dialog user accept , divert them plugin app page on play store download it? can user automatically diverted plugin app page upon opening downloaded app?

c# - What is the fastest way to retrieve a million records from an SQLite database file and display it in the WPF Datagrid? -

i have sqlite3 database file, mydatabase.sqlite having million rows , 50 columns (file size ~200mb). want load data file , display on wpf datagrid . datatable dt = new datatable(); using (sqlitecommand cmd = new sqlitecommand("select * orders", conn)) { using (idatareader rdr = cmd.executereader()) { dt.load(rdr); } } it takes around 54 seconds execute. sqliteadapter.fill(dataset) takes same amount of time. there faster way fetch data sqlite db ? i recommend select sql table chunk chunk. example (top 200 second 200 , etc.). find number comfortable. can using row_number in sql transact has documentation , example here . after re-query new chunk of data database, add new row data table using this .

How fresh is data from the YouTube Analytics API? -

according latency youtube analytics api , data youtube analytics api should update daily. i'm trying pull on time data videos using https://www.googleapis.com/youtube/analytics/v1/reports endpoint. i'm sending parameters ones below: { 'dimensions': 'day', 'end-date': '2015-06-02', 'filters': 'video==my_video_id', 'ids': 'channel==mine', 'metrics': 'views,uniques,averageviewduration,averageviewpercentage,comments,likes,dislikes,shares,subscribersgained,subscriberslost', 'prettyprint': 'false', 'start-date': u'2013-03-18' } i'm setting start-date upload date of video , end-date today, i'm getting data couple days ago. example request above returns 2015-05-31 last date data exists for. have tried setting end-date additional day in future in case range exclusive. according latency youtube analytics api should getting data 2015-06-01 . ...

javascript - Functional Programming in Node.js - Wait for completion of function -

i beginner node.js. syntactically happy javascript having used build web uis. have tones of oop experience in java , c#, , understand functional programming basics. however, once complexity gets above point start find challenging. i building node module incorporates other modules have written. each work fine on own, trying incorporate them together. var miner = require("./miner"), dbpedia = require("./dbpedia"); exports.getentities = function(uri, callback) { miner.extractentities(uri, function (entities) { var final = []; entities.foreach(function (element, index) { var newentity = { id : element.id, title : element.title, weight : element.weight, uri : "" }; dbpedia.getentities(element.title, function(entity) { if (entity.length > 0) { newentity.uri = entity[0].uri[0]; ...