Posts

Showing posts from June, 2013

c++ - Iterating through a vector without begin and end -

i have vector of keywords , need iterate through it. my attempt : bool iskeyword(string s) { return find(keywords, keywords + 10, s ) != keywords + 10; } however works array not vector. how can change + 10 iterate through vector? need since can't use end , begin because not have c++11 support. error given above code: error: no matching function call 'find(std::vector<std::basic_string<char> >&, std::vector<std::basic_string<char> >::size_type, std::string&)'| use begin() , end() this: find(keywords.begin(), keywords.end(), s ) here example: #include <iostream> #include <vector> #include <string> #include <algorithm> // std::find using namespace std; bool iskeyword(string& s, std::vector<string>& keywords) { return (find(keywords.begin(), keywords.end(), s ) != keywords.end()); } int main() { vector<string> v; string s = "stackoverflow"; ...

jquery - Abort ajax load() from ajaxError -

i have lot of places in code fragment being loaded that: $('<div />').load('/some/thing/', function() { /* put somewhere */ }); i have ajaxerror handler: $(document).ajaxerror(function(event, jqxhr, settings, exception) { if (jqxhr.status = 401) { return alert('401!!'); } if (jqxhr.status = 404) { return alert('404!!'); } return alert('boo!'); }); however, if ajaxerro r triggered, handler associated load still fired. there way cancel "completed" handler (which used fire load handler) ajaxerro r. i have played around deferred, problem seems cannot access completedeferred object. in jquery ajax.js: jqxhr.complete = completedeferred.add; the .add() method, however, useless. if somehow call .empty() method of underlying deferred object.. any ideas? edit: not care aborting http request. done, fine. keep callback (that attached via .load() ) firing. you have either ...

php - Can't get RewriteEngine URL to work -

currently links like: http://config.website.nl/?show=home , want this: http://config.website.nl/home now have been looking @ lot of rewriteengine scripts, way more advanced , don't seem work... this current code: rewriteengine on # rewritebase / rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . index.php rewriterule ^/(.*)/ index.php?show=$1 keep .htaccess this: rewriteengine on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^ http://%1%{request_uri} [r=301,l,ne] rewritecond %{the_request} \s/+(?:index\.php)?\?show=([^\s&]+) [nc] rewriterule ^ /%1? [r=302,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ index.php?show=$1 [l,qsa]

ibm mobilefirst - Problems updating Worklight to FP1 (6.1.0.1) on WAS 7 -

we have upgraded worklight server 6.1.0.1 via ibm installation manager , shows updated. however, worklight console still shows 6.1.0.0 was 7.0.0.31 about: server version: 6.1.0.00.20131126-0630 project war version: 6.1.0.01.20140311-2356 adapter name: xxxxxxx. version: 6.1.0.01.20140311-2356 application name: xxxxxxxx. version: 6.1.0.01.20140311-2356 any ideas on may wrong? worklight console nothing war. re deploy war build 6.1.0.01 , check again.

Embed MySQL in shell script -

how insert data table using mysql using shell script? maximum number of records change based on parameter. should use for loop in shell script embedded mysql? i have attached attempt below, , not inserting record. can review , correct me please? #!/bin/bash mysql -u root -p"" << eof use school; eof echo -n "enter numebr of students enroll" read echo -n "enter marks" read marks (( i=1; i‹= 10; i++ )) for((sub=1; sub‹= 8; sub++ )) echo "enter subject name" read subject if [$marks=y | y<=100 | y>=0] << eof insert students('id$i',$subject,$marks) eof echo record inserted you can use mysql command in shell script execute query shown below: $./script.sh 10 limit=$1 for(i=1;i<limit;i++){ //input value $v1 //input value $v2 //input value $v3 mysql --host=database_host_name --user=mysql_user --password=mysql_user_password your_db_name << eof insert your_ta...

php - How can I redirect inside helper class -

in magento, have helper class data class my_advert_helper_data extends mage_core_helper_abstract { where i have function such public function callvalid($arrerror){ ..... and in function trying redirect user login... $this->_redirect($strreturnpath); the seturl not redirecting. how can redirect?.. $strreturnpath getting */ path. need go homepage receiving error below fatal error: call undefined method my_advert_helper_data::_redirect() in you can set redirects within helper class following mage::app()->getresponse()->setredirect($strreturnpath); that should trick.

date - Access datediff using calculated first day of the year -

i'm creating new form in access 2010. need create field calculate year date timeframe, in months, using calculated value first day of year. scenario user input date. then, access calculate value months ytd, based on date user keys. catch user may input date current year, or date previous year. so, cannot hard code baseline date, 1/1/2014, perform calculation. need access generate first day of year, based on date entered, perform calculation. example: user enters '4/10/2013' access calculates months ytd '1/1/2013' '4/10/2013'. expected result: 3.25 months i need assist calculating income, utilize dates on multiple years. i created function you: public function calcmonths(datecalc date) double calcmonths = round(datediff("d", dateserial(year(datecalc), 1, 1), datecalc) * 12 / datediff("d", dateserial(year(datecalc), 1, 1), dateserial(year(datecalc) + 1, 1, 1)), 2) end function you can use input form. ...

osx - Terminal - How to open window at a certain directory -

when open terminal on mac, starts in root directory. don't want have type cd change directory every time open terminal, want in directory begin with. how make terminal start in specific directory? also, how make terminal start full screen , in particular color? also, command open text mate in terminal? this perhaps better belongs on ask different , here 2 options start terminal session @ particular location: open terminal preferences settings section, , in window tab check "run command", , enter cd yourdirectorypath in command field. automatically run new terminal window. edit ~/.bash_profile , add cd yourdirectorypath line @ end. as starting fullscreen, if quit terminal fullscreen window open, launch way. you can set colour schemes in preferences, there many built-in "profiles".

java - Query working on SQL*Plus but not in jdbc program -

i executed query on sqlplus (oracle 11g) select bookdetails.title,bookdetails.price bookdetails inner join orderdetails on bookdetails.bookid=orderdetails.bookid orderdetails.username ='divya.grg'; i got output: title price ------------------------------------------------------------ ---------- mastering c++ 876.2 construction material reference book 2nd edition 332 let c++ 793 but when did same query on jdbc program: preparedstatement ps=conn.preparestatement("select bookdetails.title,bookdetails.price" +"from bookdetails" +"inner join orderdetails" +"on bookdetails.bookid=orderdetails.bookid" +"where orderdetails.username ='"+username+"'"); resultset rs=ps.executequery(); i getting exception: >ja...

standards - Not declaring a loop counter up front in Fortran -

as part of assignment, i've been given (old) code fortran program. have experience c++ (and oberon) , knowledge have of fortran, i've obtained through various (parts of) tutorials, aren't consistent 1 another. however, despite basic knowledge code hurts eyes lack of elegance or consistency. more disturbing: seems full of programming malpractices. the particular piece of code want ask looks similar example: program foo implicit none call bar(0.0,-1) end program foo subroutine bar(t,i) dimension(5) :: r = 0.5 real :: s = 0.5 k = 1, 5 r(k) = k * end call random(s) ! random well-behaved pseudorandom number generator ! on interval ]0,1[ implemented elsewhere. k = 1 + (s * 5) t = r(k) end subroutine bar i'll explain believe idea is. random(s) stores value between 0.0 , 1.0 in s . means 1 + (s * 5) yield real number between 1 , 5 (some testing of prng shows maximum leads ~5.992 , minimum ~1.0016, say). if left hand side...

ms access - How do take the value from a combobox and use it to run an SQL query -

i trying take value combo box (in case 'cbofullname' located on form 'frmmasternotebook') , cross reference table 'tblsearchengine01' update gets made column 'query05contactselect' records in column 'contact' value matches selected combobox ('cbofullname'). below code getting syntax error message. private sub cbofullname_afterupdate() st_sql = "update tblsearchengine01, set tblsearchengine01.query05contactselect = '1' (((tblsearchengine01.[contact])=([forms]![frmmasternotebook]![cbofullname]))))" application.docmd.runsql (st_sql) your code builds update statement includes comma after table name ... update tblsearchengine01, set ^ remove comma , see whether access complains else. however suggest start creating , testing new query in access' query designer. paste statement sql view of new query ... update tblsearchengine01 set query05contactselect = ...

C# multithreading code not hitting break point -

please @ sample code below, when place break point inside "testmethod" , run application, not hitting breakpoint. code good? static void main(string[] args) { thread[] testthreads = new thread[3]; list<int> testdata = new list<int>(); testdata.add(1); testdata.add(2); testdata.add(3); int = 0; foreach (int data in testdata) { testthreads[i] = new thread(new threadstart(() => testmethod(data))); testthreads[i].name = string.format("working thread: {0}", data); i++; } } static void testmethod(int i) { try { //datatable dt = db.getdata(i); if (dt.count > 0) { console.writeline("count: {0}", dt.count); } } catch (exception ex) { throw ex; } } i tried method , returns name of fir...

python - Should list item type be defined in cython? -

if send python list cython function iterate over, suppose declare type list items are? best way loop on list in cython? example: #cython function, passed list of float items def cython_f(list example_list): cdef int in range(len(example_list)): #do stuff #but list item type not defined? pass #alternative loop cdef j float #declaration of list item type j in example_list: #do stuff pass *edit: speed gained trying define list item type? preferable pass numpy arrays instead of python lists? apologies asking many questions. in cython not obliged declare anything. declaring types usually helps performance. usually because if declare types, don't use them, may induce type checks , pack-unpack. way sure measure. to declare types of list, put @ beginning cdef float value , , in loop value = example_list[i] . should use list or numpy array? array uniform data container. means can declare being float32_t , , ...

java - Weblogic Web Services - EJB (not a jar) returns NoClassDefFoundError -

i very new development , have inherited 10-year old application converted oas weblogic. 1 of operations of web service not work, while 2 do. when examining source, looks difference between 2 work , 1 not ejb-ref in web.xml the ear deployed built ant , there no jar files within ear file or it's war file. when non-functioning operation called correct arguments weblogic web services testing page, returns: java.lang.noclassdeffounderror: not initialize class org.geotools.cs.geographiccoordinatesystem the ear file contains /lib directory, meta-inf directory , war file. the war file contains classes directory, meta-inf directory , number of xml documents. the library in question error exists in /lib folder of ear. the application xml looks this: <?xml version='1.0' encoding='utf-8'?> <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" version="5"> ...

arrays - name property of object, javascript -

i have question regarding name property of object, here situation: im creating custom object (called notka) prototype.constructor , methods added prototype, im pushing array of objects, converting array json object , saving on external server. far good. when im getting external server json , converting array of objects name property of object lost , im getting anonymous object dont recognize methods. have few ideas avoid converting arrays objects , viceversa , avoid mess im asking out of curiosity, there way preserve name of object or change name of anonymous object. i tried creating new object of custom type, like: var nt = new notka(); // custom object nt = tab[index]; // tab array containing objects fetched external sever but not work, newly created notka has constructor.name notka when ill assign object have anonymous object again. thank in advance answer :) kuba no, can't serialize json object , preserve name or methods of function (which notka is, not...

html - Optimizing above-the-fold CSS -

i want fix "eliminate render-blocking javascript , css in above-the-fold content" requirement better pagespeed insights score i'm not quite sure best approach problem is. how can best balance page load new visitors , returning visitors? when should load css asynchronously, when not? should maybe inline css small screens? relevant presentation: optimizing critical rendering path example since inlining lots of css leads slower page loads on subsequent visits, serve different versions recurring visitors based on cookie. detecting above-the-fold css use bookmarklet article: paul.kinlan.me/detecting-critical-above-the-fold-css/ for new visitors: <!doctype html> <html> <head> <title>new visitor</title> <style><!-- insert above fold css here --></style> <noscript><link rel="stylesheet" href="style.css"></noscript> </head> <body> <!-- insert content he...

jquery - Parsing Datepicker Data in PHP -

to begin with, have code looks in view: <input type="text" class="datepicker" name="start1"> <input type="text" class="datepicker" name="end1"> i using start , end date how long person staying in hotel. currently, example, if person chooses may 16, 2014 start date , may 24, 2014 end date, being stored in database 1 row such: 'name of person' 'room number' 'start date' 'end date' so previous example, stored as: john doe 100 5/16/2014 5/24/2014 instead of however, want each row represent date such: john doe 100 5/16/2014 john doe 100 5/17/2014 john doe 100 5/18/2014 and on , forth until 5/24/2014. my question this, how can parse data can store data such? this achieved using php's datetime methods. $from = new datetime('2014-05-16'); $end = new datetime('2014-05-24'); $end = $end->modify('+1 day'); ...

sql - row_number or rank similar data -

i have table this: col1 col2 a a f b b b b b h c l a a a e c c c c c c c c c c c j and want result this: col1 count 3 b 3 c 1 4 c 6 if col1 <> col2 reset count... want sql code not pl-sql etc. maybe row_number() over(reset when col1<>col2). please me. ok freinds thank you. sorry bad english. in fact table : id col1 col2 1000 2000 3000 f 4000 b b 5000 b b 6000 b h 7000 c l 8000 9000 10000 11000 e 12000 c c 13000 c c 14000 c c 15000 c c 16000 c c 17000 c j id column unique , has ordered values always. maybe solve problem. sorry missing information you. , want solution above. i want col1 , count. not col1...

backbone.js - Fetch Backbone.Collection by JSON object -

in jquery can supply json when perform get operation. don't see options in backbone supply object backbone.collection.create or update collection.fetch({ data: { ip_id: this.column }, success: this.constructing }); this can think of right now since this.column json object, need stringify it. try this collection.fetch({ data: { ip_id: json.stringify(this.column) }, success: this.constructing });

jquery call user function from plugin -

i'm trying create simple jquery plugin project i want call user function plugin, how my code when user passes below options want call ss function {id:"today",value:"today",func: "ss()"}, here plugin code $('#drop1').append("<li id='"+options.items[i].id+"' onclick='"+options.items[i].func+"'>"+options.items[i].value+"</li>"); this not calling user function, how this? demo use event delegation when add dynamic dom element . here made simple sample related questions var options={id:"today",value:"today",func: ss} $('#drop1').append("<li id='"+options.id+"'>"+options.value+"</li>"); $('#drop1').on("click","#"+options.id,options.func); // here can bind event function ss(){ alert(1); }

python - Why isn't this regexp working -

i have source code of webpage formatted this: <span class="l r positive-icon"> turkish </span> <span> the.mist[2007]dvdrip[eng]-axxo </span> <span class="l r neutral-icon"> vietnamese </span> <span> the.mist.2007.720p.bluray.x264.yify </span> as can see, there either spans class of "l r positive-icon" or "l r neutral-icon" . want languages, between span class. use regexp gives me empty list: alllanguages = re.findall('<span class=".*">\s(.*)\s</span>', alllanguagestags) alllanguagestags contains source code shown above. can give me hint? don't use regular expressions. use actual html parser. recommend use beautifulsoup instead: from bs4 import beautifulsoup soup = beautifulsoup(yourhtml) languages = [s.get_text().strip() s in soup.find_all('span', class_=true)] demo: >>> bs4 import beautifulsoup >>> soup = bea...

java - Appengine Taskqueue Auto Restart in new instance -

i using task queue handle requests long time. faced 1 problem in doing this. sometimes, while task running, same task started in new instance, resulting these 2 run in parallel makes duplication of process intended in application. i wondering why same process running in 2 different instances simultaneously , what's reason making app engine create instance serve same request. the following info logs says : 2014-05-16 23:05:39.479 /tasks/handlerequest 200 414808ms 0kb appengine-google; (+http://code.google.com/appengine) module=default version=new 0.1.0.2 - - [16/may/2014:10:35:39 -0700] "post /tasks/handlerequest http/1.1" 200 243 "http://xxxxx.appspot.com/tasks/dothis" "appengine-google; (+http://code.google.com/appengine)" "xxxxx.appspot.com" ms=414808 cpu_ms=11656 cpm_usd=0.022667 queue_name=handlerequestqueue task_name=7287390692361099748 app_engine_release=1.9.4 instance=00c61b117cf4e0fae1562997464c2608f682c5fd 2014-05-16 23:0...

python - How do I create a custom window title bar using PyQt4? -

Image
i finding way customize window title bar pyqt4 application. far understand, not possible use style-sheet purpose. instead have hide title bar with .setwindowflags(qtcore.qt.framelesswindowhint) and implement own title bar. puzzled have seen did use qhboxlayout qlabel (for window title name) , qbutton (for exit,max,min actions) make 1 this and used style-sheets decorate each individual widgets. that's fine simple title bar. if want more complicated title bar this? i don't think altering style-sheets properties give me kind of looks. so,my question is, possible create such complicated title bar in pyqt4 ? if so, beginner, should looking at? dig , learn concept myself, needs directions. perhaps late in replying, anyway, i'll let know few thing have pickup myself. one, quite easy create such "complicated" title bar, , ui using pyqt4. recommend read post stacking qpushbuttons on other side of qmenubar the ui max/min/close buttons m...

regex - RegExp Javascript HEX Colors Light and Dark -

i want use regular expression replace first f of each of 3 hex sets make hex color e. ffffff become efefef fefefe become eeeeee you can use this: str = str.replace(/f(?=[a-f0-9](?:[a-f0-9]{2}){0,2}$)/g, 'e'); pattern details: f (?= # lookahead assertion: means "followed by" # trick use relative position end of string [a-f0-9] # hexadecimal character (?:[a-f0-9]{2}){0,2} # number of hexadecimal characters $ # until end ) # close lookahead assertion. note in lookahead checked, not part of match result. reason why replacement string e .

php - log in system with sessions and mysqli done something wrong -

hello guys trying make simple log-in system school project, got work when didn't implement database. can see tried implement database don't work since can't make php tags @ start , end of echo's, anyway can me out? said worked when wrote random username , password, , didn't have database thing on it. <?php session_start(); include('../inc/dbconnection_inc.php'); $result=mysqli_query($dbconnection, 'select * users'); $row=mysqli_fetch_array($result); $p=$_post['password']; $u=$_post['username']; if ($u==echo $row["username"] , $p==echo $row["password"]); { $_session['username'] = echo $row["username"]; header("location: admin.php"); } else { header("location: ../index.php"); } i not sure need echo there. according manual, echo returns nothing. try removing echo 's code, like ....

video.js - Video always looping in VideoJs -

i using videojs play video , plays without issue. but video keeps on looping don't want. not stop after playing once. have not provided options video play in loop; does. i tried adding data-setup loop false. <video id="video5" class="video-js vjs-default-skin" controls preload="none" width="500" height="400" data-setup='{ "loop" : "false" }' > <source src="http://localhost/~~video(4).mp4" type="video/mp4" codecs="avc1.42e01e, mp4a.40.2" /> </video> i using version 4.5.2 latest build. what doing wrong?

SQL relational database advantages? -

i know concept of relational database , why necesary , agree. know foreign key , everything. question adventages? mean when create relation diagram nothing. doesn't add foreign key automaticly. doesn't provide specific select command including both main dable , relatet table. or @ least couldn't figure out. can explain it, please? too mention - search on 1 of search engines real way - if want know. below highlights: the many advantages of relational databases can summed 1 major advantage: relational databases dynamic. if compare relational database flat file database, static data table, instantly see advantage former. ability bring connections within database surface makes data within more valuable. some additional links benefit: http://www.ehow.com/list_5985480_benefits-relational-database_.html http://benefitof.net/benefits-of-relational-databases/ i forgot note "sql" database, means subject of standards ansi sql, know vast majority of lea...

objective c - Save persistent data easily and read in iOS -

wanted ask if objective-c exists store data on device , recover other sqlite android have option: sharedpreferences prefs = getsharedpreferences("mispreferencias",context.mode_private); int idusuario = prefs.getint("idusuario",0); int idtipoauto = prefs.getint("idtipoauto",0); there in objective-c fast can read without problem or change @ time, if close app information persist in app nsuserdefaults / core data / file on disk (either plist or binary) / keychain there many options depending on data is, how you're going use , how long should survive for...

Is there a Google Apps Admin API for configuring the URL Blacklist and URL Blacklist Exception? -

i configure url blacklist , url blacklist exception settings organization in google apps domain via api. possible? don't see obvious @ https://developers.google.com/admin-sdk/ understanding companies promevo have written products this. thanks. just confirm, you're referring chrome blacklist settings, correct? if so, there's no api modify these settings. promevo , others, believe they've written extensions report type of management environment outside of google apps admin console. via these consoles, they're able enforce other policies on devices. a popular example of in edu guardian edu (goguardian.com).

ajax - CORS Logging into an expressjs/passportjs app 401 Unauthorized -

i converting web app cordova app thing stopping me fact app expressjs based, since cordova requires index.html need use cors render app , provide login session. i can use ajax/cors regular pages when comes authorization stuck. i use passportjs authenticate on post route app.post('/login', passport.authenticate('local-login')); on client side cordova app make ajax call make request me. $('body').on('submit', '#login', function(e){ e.preventdefault(); var formdata = $(this).serialize(); console.log(formdata); $.ajax({ url: "http://mysite.io:3300/login", data: json.stringify(formdata), type: "post", crossdomain: true, datatype: "json", async: true, success: function(response){ alert('succeeded!'); console.log(response); alert(response); }, failure: function(message){ ...

linked list - C LinkedList printing -

i writing program reads txt file , adds contents linked list. then, user interface in command prompt, should able view list, add/delete list, , search item in list using part number see full detail. currently encountering 2 problems: 1.in switch case 1 in main function, insert node, tempnode->item.dataitem = getinfo(); line works correctly outside of while loop, when put inside while loop, skips taking name of new item , goes directly part number. cannot figure out why this. 2.in switch case 3 in main function, cannot figure out how print contents of searched node, displaynode function won't work on because of union inside structure of node (i want figure out how print without changing struct of node). this current code: #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <stddef.h> typedef struct inventory { char invname[36]; int invpartno; int invqoh; float invunitcost; float invprice; }stock; st...

ruby on rails - mailboxer gem & db setup -

i'm trying deploy rails 4 app mailboxer gem. i getting pg error says: pg::dependentobjectsstillexist: error: cannot drop table conversations because other objects depend on detail: constraint notifications_on_conversation_id on table notifications depends on table conversations hint: use drop ... cascade drop dependent objects too. : drop table "conversations" i don't want drop table. advice how resolve issue appreciated. thank you.

angularjs - Angular: Using $scope vs calling a controller attribute -

i've been reading ng-book , worked through code school angular course other day , confused when use $scope in controller , when use attribute of controller. in code school course, controllers setup this: app.controller('librarycontroller', function(){ this.books = getbooks //some function gets array }); but in ng-book , elsewhere, i've seen done scope: app.controller('librarycontroller', function($scope){ $scope.books = getbooks //some function gets array }) from can tell, these 2 approaches same. first used in view this: <div ng-controller="librarycontroller libraryctrl"> <ul> <li ng-repeat="book in libraryctrl.books"> while second be <div ng-controller="librarycontroller"> <ul> <li ng-repeat="book in books"> am not understanding fundamental here? there difference in these 2 approaches , why $scope approach used exclusively? i see 2 reaso...

jquery - Automatic, intelligent correction of input text field to positive integer -

apologies if has been asked before, have not found previous questions ask satisfactorily comprehensively, or answers cover it. i want client-side javascript (or jquery) solution forces users use whole number in input field. (for quantity of item in shopping basket: when adding items on product page, , when reviewing basket before checkout). perhaps in order of difficulty, requirements are: only accept characters 0-9. allow cutting-and-pasting, across browsers , os's, key shortcuts and/or right-click menus etc allow entry via other methods (are there other ways number can entered?) allow user delete characters before entering in new value (while preventing empty value @ stage, e.g. when losing focus in short, want designed. have server-side code check validity, want focus on usability. this procedure have in mind, issues raised potential pitfalls, , on, comprehensively covering use-cases. the client-side algorithm split 2 3 chunks: validate/filter on keypress, v...

json - Meteor.http.call (call URL API) -

so i'm trying make call bible verse api in meteor application. made template name="display" , simple {{checkitout}} in template. then template, tried make call in corresponding helper. looks (in coffeescript, javascript readers should understand well): @template.display.helpers checkitout:-> result = meteor.http.call("get","http://labs.bible.org/api/passage=john%203:2&type=json") console.log(result) the url json of bible verse, problem is, meteor.http.call requires third argument, "callback" (because in client folder). read documentation + examples , have no idea means. also, if call this, result json file, or need fit within new hash? , callback mean? can give me example? as helpers synchronous , api calls not, need store call result in reactive variable , return helper: verse = "loading..." verseloaded = false versedep = new deps.dependency() template.display.checkitout...

Prolog unifying two lists -

alright, trying unify 2 lists: [2] , [1,_,3] giving answer of [1,2,3] . code below: unify([],[],_). unify(list1, [head|rest], list2) :- member(list1,head),!, unify([x|_], rest, [x|list2]). unify(list1, [head|rest], [head|list2]) :- unify(list1, rest, list2). when put ?-unify([2],[1,_,3],l) gives me false, want give l=[1,2,3] . how can improve above code? i tried trace couldn't figure out. [debug] 5 ?- unify([2],[1,_,3],l). t call: (6) unify([2], [1, _g512, 3], _g520) t redo: (6) unify([2], [1, _g512, 3], _g520) t call: (7) unify([2], [_g512, 3], _g602) t call: (8) unify([_g607|_g608], [3], [_g607|_g602]) t redo: (8) unify([_g607|_g608], [3], [_g607|_g602]) t call: (9) unify([3|_g608], [], _g602) t fail: (9) unify([3|_g608], [], _g602) t fail: (8) unify([_g607|_g608], [3], [_g607|_g602]) t fail: (7) unify([2], [_g512, 3], _g602) t fail: (6) unify([2], [1, _g512, 3], _g520) false first, need fix base case: rather using ...

sockets - PHP Socket_recvfrom -

ok im editing code written but seem struggling, did try search on here, not find looking for. anyway. $recv = socket_recvfrom($sock, $buf, 2036, 0, $ip, $port); if($recv == false){ echo "failed recv ".socket_last_error()."<br>\n"; return ''; } else { echo "<br>buf recieved: ".$recv." bytes\n\n"; echo"<br><br>"; echo $buf . "\n"; } now issue seem able receive 1036 bytes of information, randomly cuts off displaying part of should. can see have tried increasing says 2036, increased 65k , still nothing. maybe need kind of delay has chance retreive information? heres get buf recieved: 1036 bytes then list of players, not whole player list. randomly cuts off after 1036 bytes. thanks in advance advice. you should try recive multiple times socket, maybe sending server splits message.

chocolatey - Unable to extract tar.gz package using Install-ChocolateyZipPackage function -

problem extracting tar.gz package using install-chocolateyzippackage results in creation of file packagenameinstall containing directory, while directory should extracted. $url = "http://packagename.tar.gz" $extractionpath = "c:/$packagename" install-chocolateyzippackage "$packagename" "$url" "$extractionpath" it possible include 7zip.commandline dependency , subsequently extract tar.gz package multiple times , removing downloaded package afterwards. question which chocolatey function able extract tar.gz packages? chocolatey v0.9.10.1+ : chocolatey's built in install-chocolateyzippackage , get-chocolateyunzip use vendored 7z.exe full, take advantage of widest amount of formats able uncompressed. original answer you can build dependency on 7z.commandline package , use extract tar.gz file in powershell installation steps. there not built-in command @ least have move forward right now. here's example...

html - 2 column website sidebar full height -

i'm making 2 column webpage layout. wanna make border takes 100% of page height. have tried few different things alwys same result, adds border whenever there's content. has advice in this? html <body> <div id="top"> <nav> <a class="navitem" href="#">stream</a> <a class="navitem" href="/discover">discover</a> </nav> <form action="#" class="form-wrapper cf"> <input type="text" placeholder="search..." onfocus="this.placeholder = ''" onblur="this.placeholder = 'search...'" required> <button type="submit">search</button> </form> </div> <div id="wrapper"> <div id="content"> <h1> content</h1> </d...

Lisp graph data structures -

Image
i'm reading jorge gajon's trees linked lists in common lisp , includes description of tree done in lisp. author gives basic example: then gives lisp list representaton: (1 (2 6 7 8) 3 (4 (9 12)) (5 10 11)) where position implies hierarchy level: 1 first in list, i.e., it's @ top, 2 @ next level, it's top of level, etc. gives caveat: please note, if need represent trees in production program shouldn’t use lists described here unless have reason. exercise in understanding how cons cells work. all right, how should 1 represent tree data structure in "production" code? btw, i'd see example of acyclic directed graph, i.e., tree-like has "multiple parent" capabilities. example in diagram above, 8 child of 2, 3. i'm guessing this: (1 (2 6 7 8) (3 8) (4 (9 12)) (5 10 11)) but seems i've created "shadow" twin of 8 , not relating how 8 child of 3 same 8 has 2 parent. problem gets worse if wanted have 3 12's par...

sql - How to export into a file all records from the tables of a database ? -

Image
this question has answer here: script data sql server database 3 answers i have lot of records stored multiple tables in database , example contosouniversity . i want export records file , , restore time want . any idea how in sql server 2012 ? please note don't want code of creating db , meaning don't want : use [master] go /****** object: database [contosouniversity] script date: 5/18/2014 7:46:01 pm ******/ create database [contosouniversity] containment = none on primary ( name = n'school', filename = n'c:\program files\microsoft sql server\mssql11.mssqlserver\mssql\data\school.mdf' , size = 3328kb , maxsize = unlimited, filegrowth = 1024kb ) log on ( name = n'school_log', filename = n'c:\program files\microsoft sql server\mssql11.mssqlserver\mssql\data\school_log.ldf' , size = 3136kb , maxsize = unlimite...

Haskell Linked List Algebraic Datatype -

i attempting implement haskell algebraic datatype linked list (or perhaps more accurately linked list-like since don't know of way memory addressing using haskell) helper functions converting , haskell's naive list type , wrote following: data linkedlist = nill | node (linkedlist a) deriving show hlisttolinkedlist :: [a] -> linkedlist hlisttolinkedlist [] = nill hlisttolinkedlist x:[] = node x nill hlisttolinkedlist x:xs = node (x) (stringtolinkedlist xs) linkedlisttohlist :: linkedlist char -> [char] linkedlisttohlist (node b) = ++ linkedlisttostring b linkedlisttohlist nill = '' i following compiler error: @5:1-5:21 parse error in pattern: hlisttolinkedlist i'm not sure what's wrong function. please explain? the minimal change needed make compile add parentheses patterns non-empty lists; e.g. hlisttolinkedlist (x:xs) = ... by requiring parentheses complex patterns, compiler need not know how many arguments each constructor take...

bash - Console output suppressed. Why? -

in bash script have function that: contains expect script spawning ssh connection remote device and depending on whether connection timed-out or not echo 's string effect (as return value) when run script terminal , bash script reaches statement of: myexpectfunc [further code...] why can see console output of expect script, if following: retval=$(myexpectfunc) [further code...] there no console output? suppressed until retval has been assigned value. i'd keep local variables functions , return values of these variables return value me able case on. of course if don't declare local variables function variable global , can case on global variable. i'd rather not this. there way able maintain console output , assign return value retval ? so there way able maintain console output , assign return value retval? yes. use tee : retval=$(myexpectfunc | tee /dev/tty) all of standard output myexpectfunc sent standard input of tee . ...

visual studio - unable to start debugging on web server VS2013 WebAPI -

i struggling popular error. believe have looked @ related questions , not found 1 fits problem. i have visual studio 2013 webapi project trying run. code works fine other team members. computer windows 7, , haven't had problems running web sites locally. if run in debug, "unable start debugging on web server" if start without debugging "{ "errormessage": "the resource requested not found." }" this happens running "local iis". if select "iisexpress" runs (but on port). i have tried: checking app pool .net 4 changing identity of app pool login stopping , starting app pool checking permissions on local folder commenting out code in application_start of global.asax any other suggestions welcome

Can not create South database models in Django 1.7 -

django 1.7 has built-in database migration mechanizm. however, i'd run south migrations ols third-party django apps. i failed to 'syncdb' management command django 1.7 in order create south models: /south/management/commands/syncdb.py", line 82, in handle_noargs old_app_store, cache.app_store = cache.app_store, sorteddict([ attributeerror: 'apps' object has no attribute 'app_store' on official south site : south not work django 1.7 ; supports versions 1.4, 1.5 , 1.6. the solution can see create django 1.7 third-party applications within project using migration_modules setting. when these third-party applications supply django 1.7 migrations. should remove migrations , migrate --fake application migrations.

c# - Visual Studio 2013 complains on neutral culture -

after having migrated c# solution visual studio 2008 visual studio 2013 stuck following problem: 1 of migrated projects fails rebuild following error excuse: invalid argument. culture not supported. parameter name: name neutral invalid culture identifier. this error presented without specifics exact part of code causes it, except project name. i have found , replaced occurrences of culture=neutral culture=en-us of no help. error remains. can cause?

ios - Using NSURLConnection to retrive data -

i've got api ( http://www.timeapi.org/utc/now ) gives time string , want use nsurlconnection retrieve it, except i'm confused how nsurlconnection works. current code: +(nsstring *) fetchtime { nsstring *timestring=@"not_set"; //code url request here nsurl *timeurl = [nsurl urlwithstring:@"http://www.timeapi.org/utc/now"] return timestring; } the method called view controller in turn display on screen per mvc, need example me in right direction. in order make request api need this: nsurl *timeurl = [nsurl urlwithstring:@"http://www.timeapi.org/utc/now"] nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringcachedata timeoutinterval:120]; nsdata *urldata; nsurlresponse *response; nserror *error; urldata = [nsurlconnection sendsynchronousrequest:urlrequest ...

solrj - Error in executing solr search query from a CloudSolrServer object -

here trying fire solr search query, using cloudsolrserver class pass zookeeper instance , creating instance of solrquery object search. cloudsolrserver solr = new cloudsolrserver("host_name:port"); system.out.println(solr.getzkstatereader()); solrquery solrquery = new solrquery(); solrquery.set("q", "abc"); solrquery.addfilterquery("type:*"); solrquery.set("deftype", "edismax"); solrquery.set("start", 0); solrquery.set("rows", 10); solrquery.set("qf", "name^10.0 description^5.0"); solrquery.addsortfield("name_sort", solrquery.order.asc); queryresponse response = solr.query(solrquery); when running getting error: null org.apache.solr.client.solrj.solrserverexception: error executing query @ org.apache.solr.client.solrj.request.queryrequest.process(queryrequest.java:98) ...

installation - Bundle invalid payload reason: 0x80070570 -

wix 3.6. i'm trying run bundle : <bundle name="setup" version="1.0.0.0" manufacturer="bentley" upgradecode="37d68094-0b98-4b16-bfbe-7f0d3015064a"> <bootstrapperapplicationref id="wixstandardbootstrapperapplication.rtflicense" /> <chain> <msipackage sourcefile="path/to/mymsifilewhichisfine.msi" cache="yes" compressed="no" installcondition="1"/> </chain> result execution : 0x800b0109 certification chain processed, terminated in root certificate not trusted trust provider. the log file says : detected partially cached package: mymsifilewhichisfine.msi, invalid payload: mymsifilewhichisfine.msi, reason: 0x80070570 i signed msi. bootstrapper signed using (cf link ): insignia -ib setup.exe -o engine.exe signtool engine.exe (extra parameters excluded simplicity) insignia -ab engine.exe setup.exe -o setup.exe signtool setup.exe one ...

javascript - Force browser to ignore cache -

my code crops photo. cropped photo replaced browser ever loads first crop. have scoured web nothing has worked. have added random strings php - new.jpg?time=t - prevents cropped image saving. have included <head> <meta charset="utf-8"> <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="expires" content="-1" /> </head> but browser still loads cache. html javascript , php follow. other suggestions? <html> <head> <title>image crop</title> <style> body{ margin: 0; padding: 0; } #container{ width: 300px; ...