Posts

Showing posts from July, 2014

java - How to pass a many string different parse rule in ANTLR 4? -

i trying develop tool using antlr 4.0. new antlr , advance java. had downloaded package i.e antlr-4.2.2-complete.jar . antler working fine. have few doubts. i took basic grammar , give below: grammar test; start : (aa) | (bb); aa : c d; bb : c b; : 'a'; b : 'b'; c : 'c'; d : 'd'; ws : [ \t\r\n] ->skip; now using command prompt parse string in it.. c:\javalib\test>java org.antlr.v4.tool test.g4 c:\javalib\test>javac test*.java c:\javalib\test>java org.antlr.v4.runtime.misc.testrig test start -gui -tree **acb** ^z (start (bb c b)) string acb parsed , output obtained (start (bb c b)) . now, want know how can parse manystrings/ file in antlr. each line in file have different start rule. example , file have parse (input file) start : acb bb : acb aa : acd i can't take advice of changing grammar accordingly 1 start rule can used strings, because grammar on working vast. i can change format of input string, can parse in an...

jquery - Issue facing when trying to fix the navigation bar at the top when user scrolls the page -

i trying fix navigation bar @ top when user scrolls page. facing problem it. while doing found elements overlaps on i.e hides navigation bar , displays on it. say have nav bar of background-color blue , div somewhere down background color yellow. when scroll down div overlaps nav , hide blue color of nav bar , shows yellow color.. any regarding helpful. sounds want set position: absolute , z-index. without code cant give specific answer should in right direction

JavaScript: Splitting and joining dates in mm/dd/yyyy format -

i'm having bit of difficulty comparing 2 dates entered in mm/dd/yyyy format. have following code written try convert them yyyy-mm-dd format, , display error div if start date greater end date: for(i=0; i<=9; i++) { datefrom+i = document.getelementbyid('projdatefrom'+i).value; dateto+i = document.getelementbyid('projdateto+i').value; datefrom+i = datefrom+i.split("/").reverse().join("-"); dateto+i = dateto+i.split("/").reverse().join("-"); if(datefrom+i > dateto+i) { document.getelementbyid('dateerror').style.display = ''; return false; } when enter dates on form in mm/dd/yyyy format, , deliberately enter projdatefrom greater projdateto, nothing happens. missing? moment.js fantastic date tool: http://momentjs.com/docs/#/displaying/difference/ here's fiddle take date format, convert proper javascript object wrapped many convenient date methods. exa...

c - Better way to discard output from function tested by glib test -

if test functions glib's testharness, face ugly fact, output of functions i'm testign mixed output of glib's functions. code: #include <stdlib.h> #include <glib.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> void to_test(void) { printf("this function being tested"); } void test_to_test(void) { to_test(); } int main(int argc, char *argv[]) { g_test_init(&argc, &argv, null); g_test_add_func("/test", test_to_test); return g_test_run(); } generates: /test: function being testedok the solution found redirecting filedescriptors of standardout/-err /dev/null time function called , resetting them afterwards, like: void test_to_test(void) { int backup, new; new = open("/dev/null", o_wronly); backup = dup(stdout_fileno); dup2(new, stdout_fileno); to_test(); fflush(stdout); close(new); dup2(backup, stdout_fileno); } the output looks intended: /test: ok u...

oracle - How can I serve the collection to cursor parameter? -

please find rc1 in code. want return v_teminatkayit collection cursor. how can it? this not work; open rc1 select * table(cast(v_teminatkayit t_teminattip)); this not working? how can return collection cursor out parameter!?3 create or replace procedure krd_sel_gnakdiriskdetay_sp ( p_musterino in number default 0, rc1 in out sys_refcursor, rc2 in out sys_refcursor ) v_rcrteminat sys_refcursor; v_urunadi varchar2(80); v_risktutar number(26, 2); v_gnakdirisktoplam number(26, 2) := 0; v_kullandirimtarih date; v_vade date; v_muhatap varchar2(300); v_konu varchar2(600); type t_teminattip record( v_urunadi varchar2(80), v_mektupttr number(26, 2), v_mektuptar date, v_kkrvade date, v_muhatap varchar2(300), v_konu varchar2(600)); type t_t...

javascript - Developing a full public facing enterprise app with AngularJS -

good day all, working on public facing web app, work in progres, front-end 100% based on angularjs, uibootstrap, css, html. so, have user form-action invoking restful web service using $resource service , injecting json object different form control or html dom. also, things shopping checkout , basket crud operation done via service invocation using angularjs. but, getting concerned accessibility issues visually impaired, java scrip disabled browsers etc please, need practical ideas, challenges , solutions gurus , enthusiasts out there. post saw regarding dated , things have moved on in resolving accessibility issues ..... input . angular not work in javascript disabled environment. cannot worked around , if requirement not suggest using angular. however, can make web pages more screen reader friendly use of semantic aria enabled html. semantic html means layout dom in logical way. tables data. lists lists. forms in appropriate form tags. example: don't want use ...

vba - How to erase a multidimensional variant array holding objects and numbers -

i have following array want erase, or @ least clear: dim arrfiles() variant the array has 2 columns, lngindex , objfile. i remember reading somewhere erase works in conditions. erase work on type? also, what's best way amount of memory used array? thanks dim arrfiles() variant indicates dynamic array it's not declared dimensions erase free memory using, e.g. attempting retrieve dimensions error. as size, array of variant each number 16 bytes , each string 22 bytes + lenb(thestring) if concerned size, don't use variants; mix strong types in array structure use array of user defined type allow typearray(i).index / .file

pagination - jQuery list to start at 1, not 0 -

i've read previous questions haven't found solution. i have slideshow ck module installed on joomla 3 modified it's css show numbers instead of circles in pagination. the problem: the module shows pagination starting @ number 0. need start @ number 1. the question: is there way display pagination if 0 1, 1 2, 2 3, ect.? the function one: if($(pagination).length) { $(pagination).append('<ul class="camera_pag_ul" />'); var li; (li = 0; li < amountslide; li++){ $('.camera_pag_ul',wrap).append('<li class="pag_nav_'+li+'" style="position:relative; z-index:1002"><span><span>'+li+'</span></span></li>'); } you can try: if($(pagination).length) { $(pagination).append('<ul class="camera_pag_ul" />'); var li; (li = 0; li < amountslide; li++){ $('.cam...

math - Weighted random coordinates -

Image
this may more of search term, solutions welcome. i'm looking create n amount of random x,y coordinates. issue having coordinates "weighted" or have more of chance of falling closer specific point. i've created close using pseudo code: x = rand(100) //random integer between 0 , 100 x = rand(x) //random number between 0 , previous rand value //randomize x positive or negative //repeat y this works pull objects toward 0,0 - if create enough points, can see pattern of x , y axis. because if x manages 100, chances high y closer to. i'm looking avoid formation of x,y line. bonus points if there way throw in multiple "weighted coordinates" random coordinates sort of gravitate to, instead of statically 0,0. this easier in polar coordinates. have generate uniform random angle , power distributed distance. here's example in python: import math random import random def randompoint(aroundx, aroundy, scale, density): angle = random()*2*mat...

facebook - Determine if Friend is in a Friends List -

so can list of friends via https://developers.facebook.com/docs/graph-api/reference/v2.0/user/friends , list of friends lists via https://developers.facebook.com/docs/graph-api/reference/v2.0/user/friendlists . is there way determine if friend in list or friends in list? no. according api v2.0 changelog: "the permission read_friendlists no longer allows read list of friends in friendlist, lets access name of list. useful people building custom audience selectors when posting stories."

php - Getting "APINotAllowedError" when requesting medias on a private profil, even with all scopes allowed -

i'm using php instagram api https://github.com/cosenary/instagram-php-api i retrieve feed of user, if has private profil. first, i'm generating url scopes granted $instagram->getloginurl(array('basic','likes', 'relationships', 'comments')); then, once user approved application, try retrieve feed // grab oauth callback code $code = $_get['code']; $data = $instagram->getoauthtoken($code); // set token $instagram->setaccesstoken($data->access_token); // medias $medias = $instagram->getusermedia($data->user->id, -1); i apinotallowederror error object(stdclass)#5 (1) { ["meta"]=> object(stdclass)#6 (3) { ["error_type"]=> string(18) "apinotallowederror" ["code"]=> int(400) ["error_message"]=> string(29) "you cannot view resource" } } what doing wrong? thank much! update , fix ok comes php librar...

Pass null to integer in SQL Server from ASP.NET -

datatable dt = new datatable(); dt=//calling sp return datatable dt.rows[i]["requestid"] = system.dbnull.value; // problem here i tried system.data.sqltypes.sqlint32.null but without success. error: object cannot cast dbnull other types. please me out of this. i implemented own simulation , have c# code calls function runs sp , returns datatable column of integers. i'm able set cell dbnull.value without problems. this makes me wonder if you're dealing datatable column types think are. wish reproduce experiment further. if you, next thing try using debugger @ datatable dt , see types of columns are.

All fonts too small with bootstrap-3.0 -

in converting twitter bootstrap 2.3.2 3.1.1, , after working through several migration guides, find fonts small (around 75% of 2.3.2 size). doesn't seem have screen size (assessed on same screen, 1920x1080). according inspector (both safari , firefox), old , new should same font-size. since universal fonts, seems there's global scaling going on, somewhere not revealed inspector. be? how can undo it? web inspector example: bs3 version: <html> <body class="me"> <div class="jumbotron home-feature"> <div class="alert alert-info text-center"> <small> styles in inspector: small: type.less:85: font-size: 85%; small: normalize.less:159: font-size: 80%; (overridden) small: user agent stylesheet: font-size: smaller; inherited body.me: .me: me.css: font-size: 1em; (overridden) body: scaffolding.less:37: font-size: 14px; (overridden) inherited html: html: scaffolding.less:29: font-size: 62.5% ...

JAVA JAX-WS Deployment (JAVA Eclipse EE IDE) -

this question has answer here: creating simple jax-ws webservice in eclipse 2 answers i working on tutorial: http://java.dzone.com/articles/jax-ws-hello-world , i'm new of , looking assistance. step 5) run wspublisher. have project set in dynamic web project , when run wspublisher file use (1) run on server. im using apache tomcat/7.0.53. , end getting http status 404 - error. tips on 5 minute tutorial great understand further. package juma.mohammad; import javax.jws.webmethod; import javax.jws.webservice; @webservice public interface greeting { @webmethod string sayhello(string name); } .. package juma.mohammad; import javax.jws.webservice; @webservice(endpointinterface = "juma.mohammad.greeting") public class greetingimpl implements greeting { @override public string sayhello(string name) { return "hello, welcom j...

automation - AutoIt - ControlClick on Flash content -

ok, i'm trying automate closing multiple tickets on job's ticketing system, browser based , built on flash (it's atrocious). using autoit v3 window info, able of information, clicks aren't registering. understand window has active controlclick work, nothing progresses. code: while 1 $msg = guigetmsg() select case $msg = $gui_event_close exitloop case $msg = $autoclose $numtickets = guictrlread($numticketsbox) $istate = 1 $i = 0 case else if $istate = 1 if $i >= $numtickets $istate = 3 continueloop endif controlclick("[class:macromediaflashplayeractivex]", "", "", "left", 1, 143, 474) $istate = 2 $itimer = timerinit() elseif $istate = 2 if timerdiff($itimer) < 2000 continueloop controlclick("[class:macromediaflashplayeractivex]", ...

osx 10.8.5 - Ruby on Rails - rmagick error on rails s -

i'm trying run project uses rmagick, bundle running fine on rails s get: => booting webrick => rails 4.0.3 application starting in development on http://0.0.0.0:3000 => run `rails server -h` more startup options => ctrl-c shutdown server exiting /users/evo/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': dlopen(/users/evo/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/rmagick-2.13.2/rmagick2.bundle, 9): library not loaded: /usr/local/lib/liblzma.5.dylib (loaderror) referenced from: /usr/local/lib/libmagickcore-6.q16.2.dylib reason: image not found - /users/evo/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/rmagick-2.13.2/rmagick2.bundle (you may need install rmagick gem) the error indicates you’re missing dependency on liblzma, in homebrew contained in xz formula. try this: brew install xz

r - accessing inputs created in renderUI in Shiny -

i trying utilize bit of dynamic gui activity in application on shiny server. application needs variable number of sliders created, depending on data input application. specifically, trying create sliders set value, 1 each unique category in input data table. able read input table , create sliders, using render ui, stuck on how best manipulate variable number of created input values set sliders - how go accessing them (as list, preferably?) appreciate advice or pointers. code snippet below. output$sliders <- renderui({ # if don't need sliders, return if (input$unequalpts == "no") return(null) # go panel sliders appear updatetabsetpanel(session, "intabset", selected = "unequal") # number of unique entries field f interest create sliders thedata <- mydata() thefields <- unique(as.character(thedata$shnystr)) return ( lapply(1:numstrata, function(i) { sliderinput(inputid = paste0("strata", i), label = paste(...

java - How to load Google Cloud Datastore private key in Google PlayN -

we developing game using playn framework , we'll have global leaderboard stored in google cloud datastore. acquired private key needed accessing database, it's in .p12 file, assume it's in pkcs#12 format. right added file our game project's assets. (the structure of our projects standard hierarchy generated maven archetype). seems have 2 choices: 1: somehow create privatekey object , supply that: // code copied datastorehelper source // note; 1 of setaccountprivatekeymethods must used. public credential getdatastorecredentials(string accountid) throws generalsecurityexception, ioexception { nethttptransport transport = googlenethttptransport.newtrustedtransport(); jacksonfactory jsonfactory = new jacksonfactory(); return new googlecredential.builder() .settransport(transport) .setjsonfactory(jsonfactory) .setserviceaccountid(accountid) .setserviceaccountscopes(datastoreoptions.scopes) .setserviceaccountprivate...

javascript - Why is this on('resize') event triggered at load and not on window resize? -

i have following code wrapped in $(document).ready(function(){}); : var sizemapcontainer = function(n) { var w = $(window).innerheight(); var h = $('#sl-header-container').outerheight(); var f = $('.oev-form-container').outerheight(); var m = w - h - f; $('#map-container').outerheight(m); } sizemapcontainer(1); $(window).on('resize', sizemapcontainer(2)); why sizemapcontainer gets called twice when page loads not when resize window? you're calling function, not binding event function. should be: $(window).on('resize', function() { sizemapcontainer(2); });

php - Codeigniter data passing to landing page, but not to other page -

i trying use image crud in codeigniter. following have working: controller: public function view($page = 'home') { $image_crud = new image_crud(); $image_crud->unset_upload(); $image_crud->unset_delete(); $image_crud->set_primary_key_field('id'); $image_crud->set_url_field('url'); $image_crud->set_table('example_4') ->set_image_path('assets/uploads'); $output = $image_crud->render(); $this->load->view('pages/'.$page,$output); } view: <html> <body><div class="container_main"> <?php echo $output; ?> </div> the page display code. however, once add additional page page give me error: a php error encountered severity: notice message: undefined variable: output filename: pages/gallery.php line number: 7 new controller: public function view($page = 'home') { if($page == 'gallery'){ $ima...

c - How can I watch a specific path? -

is possible 'watch' specifc path , have kernel notify me whenever file or directory of name deleted / written / read / created / etc.? note: looking answer in c. accept answer points me underlying implementation in different language though (provided find c code) on linux, kernel supports inotify , allows monitoring of specific files , directories. appears similar thing available freebsd called pnotify based on linux 'inotify' interface. (i have used inotify; however, have not used pnotify myself). inotify not require write kernel module. apis available in user-space. once initialized, application calls read() inotify file descriptor monitor file and/or directory activity. read events come in structure: struct inotify_event { int wd; /* watch descriptor */ uint32_t mask; /* mask of events */ uint32_t cookie; /* unique cookie associating related events */ uint32_t len; /* size of name field */ char ...

javascript - Alter dynamically-generated SVG to make it responsive? -

i'm trying use svg library two.js or svg.js , alter (on-the-fly) dynamically generated svg elements in order make them responsive. have basic example here, showing how predefined, inline svg can responsive. it involves wrapping svg element in container, assigning css values, adding viewbox , preserveaspectratio attributes. appears common way responsive svg elements: http://jsfiddle.net/n4pk4/ <div class='container'> <div class='svg-container'> <svg version="1.1" viewbox="0 0 500 500" preserveaspectratio="xminymin meet" class="svg-content"> <circle fill="#f7941e" stroke="#231f20" stroke-width="10" cx="250" cy="250" r="200" opacity="1" /> </svg> </div> </div> .svg-container { display: inline-block; position: relative; width: 100%; outline: 1px solid red;...

java - Catch any Eclipse IDE event -

i have plugin in working group, shows last activities made on shared project (like version control, more features specific our group). , want display current actions, user doing (opening dialogs, focusing views, editing, opening package explorer, refactoring, searching , on). is there general mechanism catch kind of event in eclipse? mean, there 'global' event creator or something, on can listen , kind of event? it appears so. haven't used myself, there seems eventbus can use. eclipse/osig events pass through it. there tutorial here , wikipage there . not sure kind of events catch there. doubt specific examples listed. that, sounds want udc, usage data collector, discontinued in eclipse 3.5/3.6. seems there no alternative available .

php - how to link radiobuttons with enumeration? -

im making webshop assemble pc , have radiobuttons each part of computer. example: <form name ="formprocessor" method ="post" action ="radiobutton.php"> <input type = 'radio' name ='processor' value= 'b1'>intel® core™ i3 4130 3,4 ghzu</br> <input type = 'radio' name ='processor' value= 'b2'>intel® core™ i5 4670k 3.40 ghz </br> <input type = 'radio' name ='processor' value= 'b2'>intel® core™ i7 4770k 3.5 ghz </br> </form> now dont know how add enumeration form. an example of form handler:- // submitted form data $processor = $_post['processor']; $ram = $_post['nameforramhere']; // connect mysql $con = mysqli_connect("host","user","password","database"); // check connection if (mysqli_connect_errno()) { echo "failed connec...

javascript - Disable hide modal window when click out of the modal jquery -

i have modal div: <div class="modal fade" id="window_modal"> ..... </div> but when click out of window, modal window close, , want windows close using close button inside modal window. give modal data-attribute backdrop="static" e.g. <div class="modal fade" id="window_modal" data-backdrop="static"> ..... </div> all find here: http://getbootstrap.com/javascript/#modals-usage

vb.net - Saving Bitmaps In a list always return the same image -

im creating ctrl + z undo feature image editor, each click on screen save image code: private sub savemap(byval sender object, byval e eventargs) handles picturebox1.click dim asd new bitmap(form6.picturebox1.image) globalvariables.backup.add(form6.picturebox1.image) asd.dispose() end sub and everytime user press ctrl + z code executed private sub picturebox1_keypress(byval sender object, byval e keyeventargs) handles me.keydown if e.keycode = keys.z , e.control globalvariables.backup.removeat(globalvariables.backup.count - 1) form6.picturebox1.image = new bitmap(globalvariables.backup.last) form6.picturebox1.refresh() end if end sub but seens bitmaps im saving in public shared backup new list(of bitmap) same. because no matter index return globalvariables.backup.item() , every of them return exact same image. why bitmaps on list getting replaced, , not added 1 after another? you not saving new bitmap, reference...

javascript - Binding to service property only via reference? -

consider service: app.service('myservice',function(){ this.strprop = ''; this.objprop = { content: '' } }) and controller: app.controller('myctrl',function($scope,myservice){ $scope.str = myservice.strprop; $scope.obj = myservice.objprop; }) also consider markup binds both scope properties <input type="text" ng-model="str"> <input type="text" ng-model="obj.content"> when values updated through view via user input, service show changes made object, while string property stays empty. am right in assuming caused fact object bound via reference , string not? thats right, in example strprop bound value. when passing in primitive type variable string or number, value passed in value. means changes variable while in function separate happens outside function. passing in object, however, passes in reference. in case, property of object a...

ajax - Run jquery on newly created content without duplicating code -

when document ready, want run javascript function on elements class "test". $(document).ready(function { $('.test').dosomething(); }); imagine dynamically load contents div jquery/ajax. content may contain elements class test. how make sure dosomething called on them well. in other words, want function called on elements class test appear, regardless of whether there in first place or loaded later dynamically. of course, write $('.test').dosomething(); inside ajax callback well, i'm hoping avoid writing same code in every ajax callback. possible? make sense? an expansion of comment above: jquery has couple methods let register global handlers ajax requests http://api.jquery.com/ajaxsuccess/ . use , call dosomething every time make successful request, filtering .test elements have had method called. there lot of ways accomplish "filtering", absolute simplest way add class every .test element after fire method. $(d...

trigger.io - how can i play a notification sound in IOS -

can give example of playing sound (eg, notification beep) triggered via javascript or forge? have tried everything, fails on ios!! if (newtweets) { playsound('beep.wav'); } any appreciated driving me insane!!! cheers. add media module trigger.io app. looking @ documentation, following code should trick: forge.file.getlocal("music.mp3", function (file) { forge.media.createaudioplayer(file, function (player) { player.play(); }); });

sql server - Checking if a Point is inside a Polygon not working -

Image
using sql server 2012 following query keeps telling me point i'm looking not inside polygon i'm using, when know is. using same data in qgis 2.2.0, see point inside polygon (screenshot). declare @polygon geography = geography::stpolyfromtext('polygon ((-111.0498046875 33.966142265597391, -110.9124755859375 33.472690192666633, -110.94268798828125 32.983324091837417, -111.7364501953125 32.680996432581921, -112.587890625 32.731840896865656, -113.0657958984375 33.307577130152978, -112.9010009765625 33.811102288647007, -112.32147216796875 34.1890858311723, -111.4453125 34.129994745824717, -111.0498046875 33.966142265597391))', 4326); declare @point geography = geography::stpointfromtext('point (-112.0685317 33.4491407)', 4326); select @point.stisvalid() [pointisvalid], --true @polygon.stisvalid() [polygonisvalid], --true @point.stwithin(@polygon) [pointwithinpolygon], --false @point.stintersects(@polygon) [pointintersectspolygon], --fa...

html - CSS border differences between browsers -

Image
i'm making dropdown menu in pure css , i'm encountering difficulties making dropdown same in every browser. i've tried can think of - setting margins zero, setting padding zero... , nothing seems work. http://jsfiddle.net/mf9cs/ safari renders perfectly: firefox has mysterious gap between title , dropdown: and chrome missing 1 pixel out of border on top right concave corner: css: .container { position:absolute; top:50px; left:50px; margin:0px; } .title { position:relative; display:inline-block; height:25px; overflow:hidden; font-size:15pt; padding:0px; padding-top:1px; margin:0px; } .title:hover { height:200px; } .title:hover > .links { width:150px; } body { font-size:14pt; } .links { width:0px; border:1px solid grey; visibility:hidden; padding-top:0px; margin-top:0px; } .titletext { margin-left:0px; margin-top:0px; height:25px; margin-bottom:0px; }...

delphi - WH_SHELL Hook do not recognize other processes' messages on Windows 8 -

i'm trying notice, when onenote opened or set foreground. searched old source files , found dlls hooks, did job on win xp. awefully, not on windows 8. messages own application including buttons , textfields, no other application triggers callback function :-( running hook-starting exe administrator, doesn't change issue. var hookhandle: cardinal = 0; windowhandle : cardinal = 0; function hookproc(ncode: integer; wparam: wparam; lparam: lparam): lresult; stdcall; var s:pchar; begin result := callnexthookex(hookhandle, ncode, wparam, lparam); // debug if callback function triggerd... sendmessage(windowhandle,wm_user+999,wparam,lparam); case ncode < 0 of true: exit; false: begin if ncode=hshell_windowcreated begin sendmessage(windowhandle,wm_user+999,wparam,lparam); getmem(s,getwindowtextlength(wparam)+2); getwindowtext(wparam,s,getwindowtextlength(wparam)+2); //if (ansiendsstr('onenote',s)) begin callnexthookex(hookhandle, ncode, wparam...

regex - PHP Parsing/explode Bible search string into variables or tokens -

i need breaking bible search string php variables or tokens. i'd explicit usage example of solution offered in post: php preg_match bible scripture format . edit: chapter , verses (from, to) optional. for example: i'd able split of following strings: 'john 14:16–17'; //book chapter:fromverse-toverse 'john 14:16'; //book chapter:fromverse 'john 14'; //book chapter 'john'; //book the following: <?php $string = 'exodus 1:3-7'; // exodus book, 1 chapter number, 3 starting verse , 7 ending verse. [book chapter:startverse-endverse] $pattern = '/[ :-]/'; list( $book, $chapter, $from, $to ) = preg_split($pattern, $string ); echo $book; allows me nbook name: exodus. retrieve chapter number same way (echo $chapter), etc. the problem i'm having solution when book name has more 1 word. example '1 samuel 3:4-5'. if echo $book example, offset 3 not defined or similar error. it suggested in post linked above r...

ios - Unwind segue not working -

Image
i'm doing tutorial apple's start developing ios apps . on tutorial: storyboards page (link above), i'm told make custom classes 2 views. simplicity i'll call them table view (has table) , add view (has text field add items table). the table view has button links opens add view, , add view has 2 buttons on navigation bar: cancel , done. i told write empty method unwindtolist in .m file of add view: - (ibaction)unwindtolist:(uistoryboardsegue *)segue { } then told link both cancel , done buttons exit item in scene dock (see image @ bottom), , pick method unwindtolist . result, what's supposed happen, quoted tutorial: now, run app. @ launch, see table view—but there’s no data in it. can click add button , navigate [the add view] [the table view]. can click cancel , done buttons navigate [the table view]." however, when click cancel or done, nothing happens @ all. i'm sure both linked. thanks in advance! if read tutorial see...

php - ajax call to set/update session shopping cart does not fire -

i've used stackoverflow answer every question ever had on php scripting, , it's here learned ajax calls, jquery , javascript related problems. i've got 1 cannot seem find answer to, , i'm not sure doing wrong. basically, it's shopping cart stores product id in session using ajax call - after ajax call successful shopping cart tray should appear if hidden (when hasnt been set). issue however, basic ajax call breaks. html looks (per product), shortened url's not matter example, link product page: <article> <a href="#"> <img nopin="nopin" alt="#" src="#"> </a> <h5> <a href="#">product name</a> </h5> <p class="price"> <a href="#">&euro; 0,00</a> </p> <input type="button" name="bestelknop" id="bestelknop" data-id="'.$product['p_id'].'...

javascript - jQuery hide when clicked on anything but div -

this question has answer here: how close-hide div clicking outside of (but not inside) 2 answers i've tried answers similair questions of without success. in jsfiddle: http://jsfiddle.net/h2hzn/6/ i have set when press escape goes away using this: $(document).keyup(function(e) { if (e.keycode == 27) { $("#signup").fadeout(250); $("#window").slideup(450); } }); but want go away when click anywhere black box. in advance. this should demo $(window).click(function() { if(this.id !== "window") { $("#signup").fadeout(250); $("#window").slideup(450); } }); $("#window").on("click", function(e){ e.stoppropagation(); }); for latest fiddle you've provided, modified fiddle latest solution me, $("#popup").add("#signup_sign...

TypeScript - best syntax for adding new properties to a typed object without declaring a new interface? -

i've been using typescript angular half year now. when need add $scope, follow imho best practice of defining interface this: interface imyscope extends ng.iscope { myaddedprop:string; } ... link:($scope:imyscope ){ $scope.myaddedprop = "foo"; } however, @ times still convenient add properties $scope on fly (mainly when i'm prototyping). cases this: link:($scope:iscope ){ (<any>$scope).myaddedprop = "foo"; //or $scope["myaddedprop"] = "foo"; //if have add many props, use this: var $scopea: = $scope; $scopea.myaddedprop1 = "foo"; $scopea.myaddedprop2 = "bar"; $scopea.myaddedprop3 = "baz"; } i've had problem in nodejs , other libraries - when need add few properties , don't want bother interface. so search gives options, isn't there better way it? $scope*.newprop = "foo"; ? if put class on scope: interface im...

clojure liberator - returning json from a put request -

i struggling return json put! request: my code looks this: (defn body-as-string [ctx] (if-let [body (get-in ctx [:request :body])] (condp instance? body java.lang.string body (slurp (io/reader body))))) (defn orbit-world [dimensions ctx] (let [in (json/parse-string (body-as-string ctx))] (json/generate-string in))) (defn init-world [params] (let [dimensions (integer/parseint params) world (vec (repeat dimensions (vec (take dimensions (repeatedly #(rand-int 2))))))] (json/generate-string world))) (defresource world [dimensions] :allowed-methods [:get :put] :available-media-types ["application/json"] :available-charsets ["utf-8"] :handle-ok (fn [_] (init-world dimensions)) :put! (fn [ctx] (orbit-world dimensions ctx))) i want return passed put request json until understand going on. but if make put request, following response: http/1.1 201 created date: sun, 18 may 2014 15:35:32 gmt content-t...

linux - difference between console log level and default log lovel -

in module programming read , if log level less console log level displayed , higher mentioned in log files , if dont specify log level in printk statement default log level taken . i saw default , console log level by cat /proc/sys/kernel/printk and result 4 4 1 7 here both default , console same . i dont understand why default log level created . going use default log level in anywhere . what exact difference between console log level , default log level . i new module programming. as know have different kernel level logs: #define kern_emerg "<0>" /* system unusable*/ #define kern_alert "<1>" /* action must taken immediately*/ #define kern_crit "<2>" /* critical conditions*/ #define kern_err "<3>" /* error conditions*/ #define kern_warning "<4>" /* warning conditions*/ #define kern_notice "<5>" /* normal significant condition*/ #define k...

yaml - Date doesn't work in front matter defaults in Jekyll -

i want posts same date. put following in _config.yml file: defaults: - scope: path: "" type: "post" values: layout: "post" date: "31.05.2014" when build site, posts post layout, instead of date specified in front matter defaults, date specified in names of posts initially. although when add date manually front matter of each post, works. so idea whether date can set in front matter defaults or not? if yes, how can it? based on want, think jekyll's data feature may of better use here. specify last_updated_at field date in data file , use throughout site. allow post filename indicate when knowledge base article created, or bump post date (if it's not part of permalink) indicate when each article last updated.

c# - BayazitDecomposer inaccessible when upgrading from Farseer 3.3.1 to Farseer 3.5 -

i used following code in farseer 3.3.1 , worked correctly, in farseer 3.5, error message in following line: list = bayazitdecomposer.convexpartition(texturevertices); 'farseerphysics.common.decomposition.bayazitdecomposer' inaccessible due protection level what wrong? why code not working farseer 3.5? how can use decomposition tools in farseer 3.5? well, it's author of package has changed class public internal . far can see, happened in commit 101636 . this breaking change, should not have been done in minor version imo - perhaps author isn't following semantic versioning. should file feature request made public again. alternatively, try find alternative approach can use achieve same thing. suspect want: list = triangulate.convexpartition(texturevertices, triangulationalgorithm.bayazit);

stream - Read field of chars from BufferReader in Java -

how read 1 line of chars in field of chars in java? private char[] w; int i=0; bufferedreader br = new bufferedreader(new filereader("pathtofile...")); char c = '-1'; while (c!='\n') { w[i++] = (char) br.read(); } i got java.lang.nullpointerexception i use arraylist here. private list<character> list = new arraylist<character>(); int i=0; bufferedreader br = new bufferedreader(new filereader("pathtofile...")); char c = '-1'; while (c!='\n') { list.add((char) br.read()); } something that.

asp classic - How to configure PostgreSQL 32bit ODBC? -

i running classic asp page , trying connect postgresql database. installed 64 bit , having issues - realized need 32 bit because of asp. did ftp.postgresql.org/pub/odbc/versions/msi/… now i'm getting "specified driver not loaded due system error 5: access denied" when loading asp page. went manager %systemroot%\syswow64\odbcad32.exe , when try add new dsn, getting "the setup routines postgresql unicode odbc driver not loaded due system error code 126: specified module not found. (c:\program files(x86)\psqoodbc\0903\bil\psqlodbc35w.dll)". does know of link step step setup of 32 bit postgresql odbc driver because having many issues. or has else had these issues might able lead me in right direction? thanks much, denise i ran same issue, saw solution comments , tried no avail, did keep searching , fixed situation. wasn't 2008 redist rather 2010 x86 1 me.

javascript - Refresh div and randomly change text color -

i have div, pulling random testimonial shortcode in wp. <div id="testimonial-refresh"><?php echo do_shortcode('[random-testimonial]'); ?></div> i have script refreshes div every 3 seconds. <script type="text/javascript"> var auto_refresh = setinterval( function () { $("#testimonial-refresh").load(location.href+" #testimonial-refresh>*",""); }, 3000); </script> i know how can set 5 colors , have text color change randomly every time div refreshes. i've set changes color when window reloads. want change color when div reloads. thank you. i've been searching 2 hours , have not come solution. update this takes care of it, it's little glitchy: <script type="text/javascript"> var colors = ['yellow', 'black', 'orange', 'red', 'blue']; var auto_refresh = setinterval(function () { // load testimonial $(...

.net - Google.Apis.Requests.RequestError Login Required [401] Message[Login Required] Location -

so downloaded .net client cloud storage nuget (google.apis.storage.v1, version=1.8.1.10), created project using developer console, generated api key, enabled billing, created bucket. when i'm trying list objects in bucket, i'm getting error (login required). ideas why may be? cloud storage , json api enabled in console. here's full code sample app: https://gist.github.com/chester89/5d6a62633abab3969c32 an api key simple marker says "this call associated project." useful managing quota, not secret , not authenticate caller particular user. bucket presumably not browsable anonymous callers, , call made anonymously. you fix granting anonymous users read access bucket, better idea authenticate requests. have several options on how this, depending on whether want make calls own personal credentials or whether want use service account associated application. full instructions documented here: https://developers.google.com/api-client-library/dotnet/guide...

asp.net - Unable to correctly save DateTime into SQL Server 2012 -

i have 2 controls taking input of date , time separately. namely txtdateoutgv date , txtnewactiontimeoutgv time in hh:mm tt format time picker control. i have tried many ways insert sql server 2012 database , have never been able save time. saved time 2014-10-04 00:00:00 what approach this? have tried using stored procedures , didn't work either. dim stractiontimeout string = directcast(gvactions.footerrow.findcontrol("txtdateoutgv"), textbox).text + " " + convert.todatetime(request.form(directcast(gvactions.footerrow.findcontrol("txtnewactiontimeoutgv"), textbox).uniqueid)).tostring("hh:mm:ss") dim actiontimeout datetime actiontimeout = datetime.parseexact(stractiontimeout, "yyyy-mm-dd hh:mm:ss", cultureinfo.invariantculture) actiontimeout = format(convert.todatetime(stractiontimeout), "yyyy-mm-dd hh:mm:ss") insertaction string = "insert actions([timeout]) values ("+ convert(da...

Ruby Array Intersection Issue -

i've been attempting intersect array using "&" interesection method twitter api in ruby. i've tried several different ways , says... "undefined method `&' twitter...". same "|" , "-". documentation i've read says need use "&" intersect arrays , new array values of same values. i'm new ruby, missing?... @var = @array1 & @array2 my controller code below: class userscontroller < actioncontroller::base def index redirect_to :controller => 'users', :action => 'show', :id => params[:id] end def show begin @users = $client.user_timeline(params[:id])[0..9] #gets last 10 tweets @userinfo = $client.user(params[:id]) @friends = $client.friend_ids(@userinfo.id) rescue twitter::error::notfound redirect_to :controller => 'users', :action => 'show', :id => '404' end end def...

android - Error inflating class fragment while trying to use Google Maps -

i'm trying run simple demo app of google maps. i've referred standard article. but i'm getting error inflating class fragment exception. i've updated mt manifest properly. registered map api key. install google-play-services , linked current project. extended activity fragmentactivity, still doesn't work. am doing wrong? i referred error inflating class fragment no avail. appreciated. my code follows: activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.mapfragment" /> ...

android - Overlaying a view does not disable actions on underlying view -

i have 2 views : view , view b. view rendered , has actions input text value. im displaying overlay view - view b on top of this. expect actions on view disabled not , im still able type in input field on view a. how can disable ? the reason overlay not consuming touch events , design if view not consuming touch events events passed underlying view in view model. long answer make overlay touchable, focusable , , touch listener , return true . short answer add android:clickable="true" overlay view.

css - Space between images grows on browser shrink -

i have images smaller browser size does. works me images smaller space between them gets bigger. when browser @ smallest, space between images size of image. if resize browser down smallest see media queries kick in , see mean. ive tried many things ive lost track. ive tried replicating in fiddle requires of code so, can offer link page http://www.techagesite.com/page-1work1112211.htm .top_grow{ display:inline-block; vertical-align:top; font-size:0; margin:0 auto; overflow:hidden; white-space:nowrap; } .cats {width:100%; height:100%; display:block; font-size:0; } .text{ font-size:11px; letter-spacing:1px; word-spacing:1px; } <div class="top_grow"> <a href="http://www.techagesite.com/hd-wii-wallpapers-mario-kart-super-mario-galaxy-2.htm"> <img class="cats" src="http://freephonewallpapersfo...

javascript - Preserving Execution order in nested for loop and callbacks in NodeJS MongoDB -

scenario: there users , users has many posts. particular group of users, need fetch 10 recent posts per user , send them in response. here have come with: users array having user info. var allposts = []; for(var i=0; i<users.length; i++){ (function(i){ //level-1 db.collection('posts', function(err, postcollection){ (function(i){ //level-2 postcollection.find({"user_id": users[i]['user_id']}).sort({"created": -1}).limit(10).toarray(function(err, post) { (function(i){ //level-3 for(var j =0; j< post.length; j++){ (function(j){ post[j]['created'] = objectid(post[j]['_id'].tostring()).gettimestamp(); allposts.push(post[j]); ...

selection - Selecting multitple, specific lines in Sublime Text using the keyboard -

let's have file 1000 lines , place 3 cursors on, say, lines 1, 456 , 849. there no common words in these 3 lines select cmd-d. i know possible using mouse (cmd+left click), can using keyboard? there might other ways, @ least here 1 use. there plugin called powercursor , allows adding cursors keyboard mouse click. use between normal jump line keyboard.

android - Service Stop from mainActivity -

i have service calls alarm manager in period time , want stop service. cancel alarm manager service still running in background. this code in main activity start.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { if (!cd.isconnectingtointernet()) { showdialog(nointernetdialog); } else if (start.gettext().tostring().equalsignorecase(getresources().getstring(r.string.start_interval))) { countlimit.setenabled(false); timelimit.setenabled(false); start.settext(r.string.stop_interval); start.refreshdrawablestate(); // save send configuration savesendconfiguration(); // show sms send xmlparser read = new xmlparser(); string numberofunsend = read.getxmlfromurl(baseurl + smscount); status.settext(numberofunsend); intent ...