Posts

Showing posts from September, 2014

python - run ipython notebook remotely through ssh tunneling -

i wondering if can use ipython notebook remotely ssh twice. scenario is: machine b machine want run ipython notebook. however, allowed access machine b through server (machine a) first. there tutorials using ipython notebook remotely, none of them mentions situation i've encountered. thanks in advance ! assuming referring ssh tunnelling, , ipython notebook servering on port 1234 on machine b: if machine can access machine b on port, can setup machine forward remote port via ssh: ssh -l 9999:machineb.com:1234 -n machinea.com this says ssh machinea.com without executing remote command (-n) , setup machine forward requests client port 9999, on ssh tunnel, machine b port 1234 however if machine can access machine b via ssh, need create 2 tunnels. 1 client pc machinea, , machinea machineb. this, 2 tunnels connect local port on machinea instead of remote port: ssh -l 9999:localhost:8888 machinea.com ssh -l 8888:localhost:1234 -n machineb.com this says

jquery - How can i make the new html 5 datalist input open ‎immediately? -

question hard understand , english not native language, i'll best. new html tag <datalist> allows me create input field dropdown menu (actually not sure how call it). the first time page loaded there only: <input list='chemikalienliste' class="input_search" /> <datalist id='chemikalienliste'></datalist> <a href="#" class="add_button">+</a> as result there no dropdown menu when first click it. (thats good!) when user typing sign input field generates few <option> tags, buuuut not drop menu. have type second sign first. for(var = 0; < data.length; i++){ suchergebnis = suchergebnis+ "<option value='"+data[i].trvialname+" ("+data[i].chemischername+")"+"' />"; } input_search.parent(".add").children("#chemikalienliste").children("option").remove(); //deletes options input_search.paren

javascript - Iframes cannot display https on http site, breaks Google API -

information writing piece of code going on web server not have control over. webserver not have https . in code use google javascript api . when put in example code correct api keys , client id's , whatnot protocols must match error on iframe tries create oath2 information. this protocols must match error of course caused fact webserver http , oath2 url using https . main question there way use google api's on server not have https ? possible shut off security feature , make https oath2 iframe work on http server? note: google api creating iframe giving me problems. you shouldn't creating own iframe. google js library takes care of you.

Will deleting the parent Github repository affect children forks? -

i have repository structure hosted on github: parentrepo | -----childrepo | -----childofchildrepo1 | -----childofchildrepo2 | -----childofchildrepo3 the childrepo "authoritative" repository, far end users go latest code , issue pull requests. forked parentrepo . the childofchildrepon forks made end users, forked childrepo . the parentrepo parent of childrepo authoritative repository fork. push commits childrepo fork parentrepo . i control parentrepo under 1 github account, , childrepo under github account. if delete parentrepo repository, in way affect childrepo , child forks? no, child forks know childrepo , , childrepo still around if public repo . see " github help: deleting repository " deleting private repository deletes of forks . deleting public repository not . however, asking github support confirmation idea. that might affect pending pull request childrepo parentrepo though.

Accessing Django's context when testing with Selenium WebDriver -

i want use selenium in django tests, can't find way access django's context, can django's default test client . for example, using test client, can see if forms have errors , template being used: response = self.client.get('/') self.asserttemplateused(response, 'home.html') self.assertequal(resp.context['form']['code'].errors, [u'this field required.']) how do if i'm using selenium webdriver? driver = self.driver driver.get(self.base_url + "/") # ??? the hint of solution have been able find possibility the django test client can extended . somehow swap out selenium webdriver? the helpful context stuff stripped out time selenium gets response. you write simple middleware class add in, though. like: class addcontextmiddleware(object): def process_response(self, request, response): response['debug_stuff'] = str(response.context_data) return response then response ob

opengl - What is tile based deferred rendering and what is its advantage? -

i read concept here . but did not part: " the key advantage deferred renderer accesses memory efficiently. partitioning rendering tiles allows gpu more cache pixel values framebuffer, making depth testing , blending more efficient ." is tile based rendering happens in parallel? rendering multiple tiles @ time different cores? also advantage of normal tile-based rendering? the mobile gpu apple discuss on page contain small amount of memory physically on gpu chip , fast access. splitting render target tiles small enough fit in memory, , processing 1 @ time, minimise amount of interaction slower main memory - rather having fetch, test, blend etc depth buffer , colour buffer values each pixel in each triangle rasterise triangles, rasterise tile fast memory , write each tile's final raster out main memory done it. additionally, tile based deferred renderer don't rasterise triangles until have calculated triangles visible each pixel/quad in tile, end s

java - Heroku JAX-RS POST -

scenario: recently, our team created application on heroku. got of our environments set inside eclipse , became familiar git. able change code , @ least see manipulate http request return results wanted. mission now, try post working. right now, have simple testservice can retrieve json objects doing this: myurl.com/services/test/test1 , return json object: { "name": "test1", "test": 100 } code: @path("/test") public class testservice { @get @produces(mediatype.application_json) public testobject get() { return new testobject(); } @get @path("/{name}") @produces(mediatype.application_json) public testobject get(@pathparam("name") string name) { return testobject.getobject(name); } @post @path("/post") @consumes(mediatype.application_json) public void post(final testobject object) { testobject.postobject(object.

How to frame a MySql query which return result which has all the values in an array? -

my mysql query looks select * node nd left join term_node trm_nd on trm_nd.nid = nd.nid nd.title = 'gadget - definition' , nd.type = 'help_system' , trm_nd.tid in (434, 456, 25, 293) which returns result ------------------------------------------------------- nid title type tid ------------------------------------------------------- 26986 gadget - definition help_system 25 26986 gadget - definition help_system 293 52421 gadget - definition help_system 25 52421 gadget - definition help_system 293 73061 gadget - definition help_system 25 73061 gadget - definition help_system 293 86071 gadget - definition help_system 25 86071 gadget - definition help_system 293 98596 gadget - definition help_system 25 98596 gadget - definition help_system 293 98596 gadget - definition help_system 434 98596 gadget - definition help_s

performance - How do I parse a large data block into memory in Haskell? -

on reflection, entire question can boiled down more concise. i'm looking haskell data structure that looks list has o(1) lookup has either o(1) element replacement or o(1) element append (or prepend... reverse index lookups if case). can write later algorithms 1 or other in mind. has little memory overhead i'm trying build image file parser. file format basic 8-bit color ppm file, though intend support 16-bit color files , png , jpeg files. existing netpbm library, despite lot of unboxing annotations, consumes available memory when trying load files work with: 3-10 photographs, smallest being 45mb , largest being 110mb. now, can't understand optimizations put netpbm code, decided have own try @ it. it's simple file format... i have started deciding no matter file format, i'm going store final image uncompressed in format: import data.vector.unboxed (vector) data pixelmap = rgb8 { width :: int , height :: int , redchannel ::

Read Registry Keys on different Windows Versions with NSIS -

i'm reading registry key in nsis script detect wether microsoft visual 2010 redistributable installed or not. ... readregstr $r0 hklm "software\microsoft\windows\currentversion\uninstall{da5e371c-6333-3d8a-93a4-6fd5b20bcc6e}" "displayname" ${if} $r0 != "" messagebox mb_ok "c++ 2010 redistributable detected" goto yescpp2010 ${else} messagebox mb_ok "c++ 2010 not found" goto nocpp2010 ${endif} ... i tried on windows 7 , works. won't work on other windows versions if programms have other keys. have same keys? if keys different, there way them? the guid can change service pack's , security updates this blog claims can check installed dword under hkey_local_machine\software\microsoft\visualstudio\10.0\vc\vcredist\x64 . for previous msvc versions suggest querying sxs don't think 2010 uses technology...

javascript - How to make an element scroll when scrolling body -

when mousewheel scrolled on body of page event can captured. i'd event trigger target element scroll. #target scrollable element never height of page. i'd capture mousescroll event anywhere on page if cursor not on element element still scrolls. var mycounter = 0; // capture scroll event on body $( 'body' ).on( 'dommousescroll mousewheel', function () { // todo: scroll #target instead of body }); thanks post showing me how capture scroll wheel events: capturing scroll wheel events you can have @ this. http://jsfiddle.net/ztgva/7/ js $(function () { var mycounter = 0, myothercounter = 0; var scroll = 0; $("#target").scroll(function () { mycounter = mycounter + 1; $("#log").html("<div>handler .scroll() called " + mycounter + " times.</div>"); }); //firefox // $(document).bind(...) works $('#body').bind('dommouse

java - How to format a long json text from Wordpress in Android -

i have asked question before, did not helpful answer. i long json text in android app wordpress , want format have paragraph. text has bullets 1,2,3, - need text display in below format: 1........ 2....... 3....... this how getting in json: public class didyouknow extends sherlocklistactivity { private actionbarmenu abm; private progressdialog pdialog; // url contacts json private static string url = ""; // json node names private static final string tag_query = "posts"; private static final string tag_id = "id"; private static final string tag_title = "title"; private static final string tag_content = "content"; // contacts jsonarray jsonarray query = null; // hashmap listview arraylist<hashmap<string, string>> querylist; @suppresswarnings("deprecation") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.acti

postgresql - ' "length": 147, "severity": "ERROR" ' error while using pg and node.js -

i using node.js , postgresql. on local can create records admin on production getting following error: { "name": "error", "length": 147, "severity": "error" i unable find reason same. i calling following api saving records: savetopic = function (req, res) { logsinconsole(req); db.topic .create({ topic_name: req.body.topic_name, topic_category: req.body.topic_category }) .success(function(result){ res.redirect('/topics'); }).error(function(error){ res.send('failed save topic. went wrong. here error: '); res.send(error); }); }; so when try create record, redirects '/savetopic' url can see error. any appreciated.thanks there duplicate primary key issue due records manually inserted in beginning on server. emptied table , reinserted records , works fine now. guys. hope helps someone.

rebol - How to properly initialize a pointer to a double value within a struct? -

i'm trying pointer double value within struct can pass routine, having trouble getting value other 0 . following has worked other struct! values i've used (such 1 containing binary!), not in case: rebol [] speed1: make struct! [ d [double] ] [0.0] speed1*-struct: make struct! [i [int]] third speed1 speed1*: speed1*-struct/i here evaluation: >> speed1: make struct! [ [ d [double] [ ] [0.0] >> speed1*-struct: make struct! [i [int]] third speed1 >> speed1*: speed1*-struct/i == 0 here working equivalent binary! struct: >> binary: make struct! [bytes [binary!]] reduce [head insert/dup copy #{} 0 8] >> binary*-struct: make struct! [i [int]] third binary >> binary*: binary*-struct/i == 39654648 i can see difference in third function: >> third speed1 == #{0000000000000840} >> third binary == #{f8145d02} however, not sure difference in length means in case. doing wrong? there different way pass p

jquery - Reverting Bootstrap Button Group Click -

i've got bootstrap button group on form, working radio buttons. if user selects 1 of options (in case "single day"), need validation on rest of form. if validation fails, need "unclick" single day - undo radio button selection "multi day" still visually selected. i've created simple fiddle example w/ 3 solutions i've tried: http://jsfiddle.net/u5ab4/ solution 1 - since it's button group, thought might able toggle group change selection solution 2 - since group toggle didn't work, maybe need toggle individual buttons? solution 3 - toggling bust, manually adding/removing active class? jsfiddle code html: <div id="session_type" class="btn-group" data-toggle="buttons-radio"> <button type="button" class="btn">single day</button> <button type="button" class="btn active">multi day</button> </div> js: $('#

javascript - Trying to get td row text when clicking on td after it -

i want contents of row when click on div in row after it html: <td class="ms-cellstyle ms-vb2">10</td> <td class="ms-cellstyle ms-vb2"> <div class="ms-chkmark-container"> <div class="ms-chkmark-container-centerer"><span class="ms-cui-img-16by16 ms-cui-img-cont-float" unselectable="on" style="z-index:0"><img id="2,10,chk" liid="10" shouldanimate="1" lid="{00124e2c-bfcd-4501-8668-efaf8e6416d2}" tabindex="0" title="mark task complete." class="js-chkmark ms-chkmark-notcomplete" src="/_catalogs/theme/themed/626bdbfa/spcommon-b35bb0a9.themedpng?ctag=11" unselectable="on" hascheckmarkhandler="1"></span> </div> </div> </td> js: var itemid = $("div .ms-chkmark-container").click(function () { var id = $(this).close

multithreading - To host functions within a threaded subroutine -

i encountered problem when port fortran project openmp. in original code, there 2 functions named add , mpy being passed threaded subroutine submodel throws respective function subroutine defined in module toolbox . now, new code, wondering whether there way produce same outcome original code tiny twist moves 2 functions add , mpy hosted (i.e., contained) within subroutine submodel . thanks. lee --- original code consists of 4 files: main.f90, model.f90, variable.f90, , toolbox.f90 output: --- addition --- 3 7 11 15 --- multiplication --- 2 12 30 56 press key continue . . . main.f90 program main use model implicit none call sandbox() end program main model.f90 module model use omp_lib use variable implicit none contains subroutine submodel(func,x,y) implicit none interface function func(z) implicit none integer :: z,func end function fu

Email Function (replyBCC) in cakePHP -

is there function in cakephp can set bcc when user reply email? it function repltto want set bcc not to? thanks in advance. see . there's function cakeemail::replyto()

mysql - Read that becomes "dirty" - SQL Isolation Level -

which of sql transaction isolation levels protect against read becomes dirty partway through transaction? for instance, take schedule of 2 transactions, t1 , t2: t1 reads a, t2 reads a, t1 writes a, t1 commits*, t2 writes a, t2 commits after starred command t1 commits occurs, value read t2 kind of "dirty." read committed value @ time did read (assuming other long before transaction committed value a), value no longer reflective of in a. isolation level protect against this? not dirty read, since @ time of read, value of committed value. if t1 , t2 both updating value of a, lets say, adding 20 value, result @ end of schedule not correct... "serializable" protect against this, or other? wouldn't think repeatable read because no reads repeated, not sure...

Replace HTML using php -

i'm trying match section shown below , delete html file, have not been successful using regex , have little knowledge on how match section using php parser , replace it. <table width='100%' class='print_only_wrapper'> <thead class='print_only_header'> <tr> <td align='right' class='print_only_wrapper'> text </td> </tr> </thead> <tbody> <tr> <td> this have tried search string , replace it if(preg_match("/<thead/", $html)) { $string_2_replace="/(<table width='100%' class='print_only_wrapper'>)\s+(<thead class='print_only_header'><tr><td align='right' class='print_only_wrapper'>).+(</td></tr></thead>)\s+(<tbody><tr><td>)/"; $html = str_replace($string

javascript - div is crashing my Internet explorer 8 -

my application having 4 tab, in middle tab have used content editable div. (within fraction of seconds) move tab , click on editable div , press space or character crashes ie8. if wait till cursor (2 3 second) blink once works fine no issues. this issue noted in ie not in firefox. works smooth in firefox. here code <div id = "mydiv" contenteditable = "true" class = "size"></div> .size{ float: left; width: 390px; display: inline-block; height: 30px; background-color: #ffffff; border: 1px solid #cccccc; overflow-x:auto; overflow-y:auto; word-wrap: break-word; /* internet explorer 5.5+ */ white-space : normal; } crash details appname: iexplore.exe appver: 8.0.6001.18702 modname: mshtml.dll modver: 8.0.6001.23543 offset: 00085e7c

arrays - How to get the last number from list in python -

this question has answer here: getting last element of list in python 11 answers suppose have list a = [0.0021, 0.12, 0.1224, 0.22] i have extract last number above list, answer should 0.22 without using a[3] , because number of elements in list keep changing. you're talking list . arrays in python numpy.arrays . different data structure. you can achieve want this: >>> array = [0.0021, 0.12, 0.1224, 0.22] >>> array[-1] 0.22 >>> negative indexing starts @ end of list, array[-1] last element in list, array[-2] second last , forth.

php - Jquery Live Form Validation -

i'm using plugin perform live form validation geektantra this working , validating of form fields bar one. i'm trying see if username entered field matches value in array , if return 'username in use' message. data being collected using php, converted lowercase , written jquery array. checking array using console.log(username) shows : ["bob", "brian", "charlie", "mike", "dave", "simon", "lincoln", "reg", "bill"] the rule i'm using is: jquery("#name").validate({ expression: "if ($.inarray(val.tolowercase(), username)!==-1) return true; else return false;", message: "username in use" }); yet never seem results expected. looking @ array can see reg in use, if enter reg or reg etc in form field, doesn't match array. if enter phil told in use, when it's not. what doing wrong ? thanks update t

How to reload json from remote using jQuery UI? -

i have search form loads suggestions remote: $form.autocomplete({ source: routing.generate('hn_search_suggest'), minlength: 2 }); when enter word, , 1 request term parameter. yet if delete and/or delte input , restart typing new one, reload json repsonse. can configure jqueryui autocomplete reload suggestion list source? you can make autocomplete data controller using source property: $("#myfield").autocomplete({ source: function (request, response) { // request.term term searched for. // response callback function must call update autocomplete's // suggestion list. $.ajax({ url: "/my_url/myservice.xyz", data: { q: request.term }, datatype: "json", success: response, error: function () { response([]); } }); }); }); this callback server every time type it, reloading source.

javascript - SlideTabs for Wordpress autoheight -

if familiar slidetbas wordpress can please me out. it there way autoheight content viewer based on active tab? i tried add this: jquery(document).ready(function () { jquery("#slidetabs_983").setcontentheight(); }); to javascript particular slidetab (id 983) didn't work. http://www.slidetabs.com/ website , can see demo on there. thanks use autoheight: true slider tab setting jquery(document).ready(function () { jquery("#slidetabs_983").slidetabs({ // define options below autoheight: true }); });

Python win32com, How to Hide Gridlines -

is there way hide gridlines in sheet excel 2007 using win32com.client , python? i've been looking through msdn , there's gridline object under excel, refers hiding gridlines in chart: http://msdn.microsoft.com/en-us/library/office/ff835311(v=office.15).aspx code using testing is: import win32com.client excel = win32com.client.dispatch("excel.application") excel.visible = true book = excel.workbooks.add() sheet = book.worksheets(1) sheet.active sheet.displaygridlines == false there's no property displaygridlines . i'm sort of new using msdn site, maybe not searching through , it's quite possible, win32com can't this? ah, came across solution. grab active window after setting sheet object , setting 'displaygridlines' false: import win32com.client excel = win32com.client.dispatch("excel.application") excel.visible = true book = excel.workbooks.add() sheet = book.worksheets(1) excel.activewindow.displaygridline

ERROR: list does not name a type (C++). I don't think so? -

so have been building on small example of classes found floating around better prepare me c++ coding assignments in future. trying compile code gives me error: "classexample.cpp:12:2: error: 'list' not name type". the problem is, assigned it's type of rectangle* can see in code below. doing wrong? // classes example #include <iostream> #include <stdlib.h> #include <string> #include <sstream> using namespace std; class setofrectangles { list<rectangle*> rectangles; }; class rectangle { int width, height; //class variables public: //method constructors rectangle(){width = 0; //constructor rectangle height = 0;} rectangle(int i, int j){width = i; height=j;} void set_values (int,int); string tostring(); int area() {return width*height;} int perimeter(){return (2*width)+(2*height);} }; void rectangle::set_values (int x, int y) { //fleshing out class method width = x; height =

java - annotation configuration - how to say spring configuration class location -

Image
spring doesn't see request mapping controller. try use annotation configuration without xml. project structure: config.java package com.dnn.web.config; //imports @configuration @componentscan("com.dnn.spring") @enablewebmvc public class config { @bean public urlbasedviewresolver setupviewresolver() { urlbasedviewresolver resolver = new urlbasedviewresolver(); resolver.setprefix("/web-inf/views/"); resolver.setsuffix(".jsp"); resolver.setviewclass(jstlview.class); return resolver; } } webinitializer.java package com.dnn.web.config; //imports public class webinitializer implements webapplicationinitializer { public void onstartup(servletcontext servletcontext) throws servletexception { annotationconfigwebapplicationcontext ctx = new annotationconfigwebapplicationcontext(); ctx.register(config.class); ctx

iphone - How can I disconnect all the running sessions in opentok iOS -

i'm using opentok voice call/video call. and connection between user , user b working fine & have 1 problem when time of disconnecting user a's session closed correctly user b's session not closed. showing sample code nice. want call session.disconnect() both user , user b. calling session.disconnect() 1 user disconnect particular user session.

mysql - Reinstalled WAMP, Wordpress Tables Not Found BUT Are in PHPMYADMIN -

Image
ok strange situation , hope not out of luck. upgraded windows 7 8 , when did wamp not work. reinstalled wamp not thinking , followed instructions online wamp working. now though wordpress site redirets me install page. when go phpmyadmin looks of tables there when click on wordpress database says "no tables found in database". if click on 1 of tables listed under wordpress gives me error "table 'wordpress.wp_postmeta' doesn't exist" i check database files , contain data file sizes. see screenshots. appreciated. redoing our business website , prefer not have start scratch. yes, problem old files: ib_logfile0, ib_logfile1, ibdata1. one should backup them, close wamp, copy, paste , remove ones generated installation. after phpmyadmin recognises tables had prior reinstallation of wamp!

Error in read.table in R -

this question has answer here: error in reading in data set in r 7 answers i have txt file 59.6kb. , write scripts did thousand times cancer<-read.table("cancergenes.txt", row.names=1,header=t) and gives me error message: error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 28 elements what went wrong??!! try using table(count.fields( ... ) strategy: table(count.fields("yourpath/filename.txt", sep="", stringsasfactors=false, allowescapes = true, quote="", comment.char="")) then add values 'quote' or 'comment.char' if needed. default values 'quote' 2 character string "'\"" , may want first try quote="\"" keep names single quotes (like "o'malley") causing problems , , def

java - My android app crashing only on Samsung devices. How can I solve it? -

i have app on play store(my first app). first version didn't crash. when released second version crashing on samsung devices. tested on no brand jelly bean device , on emulator , working perfectly. have no samsung devices. can now? i think crashing on launcher activity. launcher activity main. splash screen. code , error provided below. app name : rebel poet nazrul package name : com.xplosive.rebelpoetnazrul copied play store stack traces java.lang.runtimeexception: unable start activity componentinfo{com.xplosive.rebelpoetnazrul/com.xplosive.rebelpoetnazrul.main}: java.lang.nullpointerexception @ android.app.activitythread.performlaunchactivity(activitythread.java:1970) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1995) @ android.app.activitythread.access$600(activitythread.java:128) @ android.app.activitythread$h.handlemessage(activitythread.java:1161) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:1

How to open the search by clicking a custom button in android? -

i want open search (default search), stays on desktop (the google search) clicking button. here xml code: <imagebutton android:id="@+id/btnsearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_action_search" android:text="" /> which used create button. it's simple button. used onclicklistener catch click event of button : imgsearch.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { onsearchrequested(); } } ); but couldn't find out how make work. please let me know do. you can use intent class web search action: private void onsearchrequested() { intent intent = new intent(intent.action_web_search); intent.putextra(searchmanager.query, "your search query"); startactivity(intent); }

linked list beginning and end in python -

here question have linked list of 1->2->3->4->5 my concept print them 1->5->2->4->3 it means first beginning , end how can it? i have idea first take empty node in empty node keep beginning node and after traverse last , end node kept there @ brain stops can guide me this? in advance def mutate_linked_list(head): #node creation s = t = node() t.next = head head = head.next while head none: t.next = head head = head.next # here used recursion concept mutate_linked_list(head) return head but not working.... [head[0]]+[head[-1]] + head[1:-1]

osx - Remove weird 'Iconr' file from the repository -

in git repository i've got weird file in staging area that's refusing reverted, removed, committed - can't make go away .. the file must ancient os 9 file sitting there in folder years. couple days ago i've removed file in file system git tracking deletion of iconr . however, it's stuck there. the error i'm getting via sourcetree (my git ui client) is fatal: pathspec 'folder/iconr' did not match files any idea how make git completely forget file? it best revert command line in order have more precise error message. there can try git add -u , followed git commit , in order register deletion of file in repo. see " git status says file deleted git rm says error: pathspec '…' did not match files " example. you can preview git clean give: git clean -d -x -n (as explained in " why there no “pathspec” when try remove folder in git? ") the other issue when file isn't tracked @ in current bra

CouchDb End Users -

so, i'm trying started couchdb (and nosql in general), coming well-entrenched background in t-sql, , i'm running bit of mental roadblock. i'm unsure how model end user in couchdb database. my main point of confusion, seems me default _users document in couchdb supposed handle types of user. in effect, document should contain user information both sa user, guy on internet registered today. case, or horribly misreading entire thing? you should check out documentation regarding security . _users database contains "registered users" have discovered. however, "system users" (admins) configured seperately , exist in config.ini rather in database itself.

html - How to add a element to HTML5 code with JavaScript -

i've got problem javascript code. beginner in programming ask me. script must do? after clicking submit button must write on site value of 2 form fields. html code: <!doctype html> <html lang="pl_pl"> <head> <title>kidgifter</title> <meta charset="utf-8" /> <link rel="stylesheet" href="css/style.css" /> <script src="js/scripts.js"></script> </head> <body> <div id="list_help"> <img id="smile_help" src="img/smile.png"> <div id="info-form"> <p id="l_h_title">hejka!</p> <p id="l_h_text">tutaj możesz stworzyć swoją liste prezentów udostępnić ją na facebooku lub twitterze. niech twoi znajomi bliscy wiedzą co chcesz dostać!</p> <p id="l_h_formtitle">najpierw wprowadź nazwę prezentu:</p> <form> <input type="

java - Math error switch always ends up zero -

i writing small program find day of week using gregorian math. following code outputs 0 switch statement resulting in same output each time. this code: isum = (centcode + iyear + (iyear /4) + monthcode + iday); ioutput %= isum; switch (ioutput) { case 0: sday = "sunday"; break; case 1: sday = "monday"; break; case 2: sday = "tuesday"; break; case 3: sday = "wednesday"; break; case 4: sday = "thursday"; break; case 5: sday = "friday"; break; case 6: sday = "saturday"; break; } ioutput %= isum; is short form of ioutput = ioutput % isum; which not want. guess want like ioutput = isum % 7;

java - Pass json to dropdown -

how store list in servlet in options of dropdown? equivalent jquery if values of age stored value of option of dropdown , name display in dropdown public class testservlet extends httpservlet { protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("application/json"); printwriter out = response.getwriter(); list<student> studlist = new arraylist<student>(); student s1 = new student(); s1.setname("student 1"); s1.setage(10); student s2 = new student(); s2.setname("student 2"); s2.setage(14); gson gson = new gsonbuilder().setprettyprinting().create(); string json = gson.tojson(studlist); out.print(json); } } try: $(document).ready(function() { $('#student').ready(function(event) { $.get('students

java - int variable comparison returning a boolean value -

i have boolean method doing error checking on string. have int class constant called "numwords" = 8. pass string boolean method word count on string using .split , .length. int called "words" counts number of words in string. after done want if statement comparing words against numwords. if equal in number return true else false. have tried == , .equals nothing works. ideas? public static final int numwords = 8; boolean test = true; string sentence = "i man"; test = check(sentence); public static boolean check (string sentence) { boolean x = true; string[] s = sentence.split(" "); int words = s.length; if (words == numwords) { x = true; } else { x = false; } return x; } i have tried == , never evaluates false i have tried .equals, int cannot dereferenced i have tried =, doesn't compile incompatible types what want if words = 8 equals numwords , returns true. if words 7 or

google app engine - time counter python GAE -

i trying number of seconds betwen when query has been launched, , when refresh page. i'm using following code: import time last_queried = 0 def top_blogs(update = false): blogs = memcache.get(key) global last_queried if update: blogs = gqlquery("select * blog order created desc limit 10") last_queried = time.time() memcache.set(key, blogs) return blogs when display page: class frontpagehandler(handler): def get(self): global last_queried blogs = top_blogs() render_time=time.time() time_lapse = render_time - last_queried self.render("front.html", blogs = blogs, time=time_lapse) it seems i'm getting in time_lapse, not difference in seconds time since epoch, doing wrong? regards edit: clarification purposes, here when call top_blogs function, should update query , variable last_queried in theory: class newposthandler(handler): def post(self): subj

Trying to get a c program to display this in GCC -

how display on screen in c programming? number of days in month: 30 code starting day: 3 mo tu th fr sa 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 i can first part (the numbers of days in month:30 , code starting day:3) but i'm not sure how 2nd part. problem im facing cant use multiple printf due fact calendar (the 2nd part) has related number of days. if able lend me hand (preferably emailing me can have bit of chat) thanks here program far just note cant use arrays + strings #include <stdio.h> int days, number, counter; int main(){ while(true){ printf("enter how many days in month "); scanf("%d",&days); if((days>=28)&&(days<=31)){ break; }else { printf("invalid number of days in month \n"); } } while(true){ printf("enter day of week starts i.e. 1 = mondays. 7= sunday "); scanf("%d", &

javascript - What are some Angularjs based client-side frameworks? -

i want build rich angularjs based applications, don't want invent own framework if don't have to. need can organize , watch angularjs code, i'm writting in coffeescript, auto-compile , link separate modules convention on configuration. isn't going framework concerned building has server side code. purely frontend framework. i'm not looking server side frameworks sails. while angularjs "toolset building framework suited you". sounds more you're looking development stack. there lot of pre-compilers, task runners, development guidelines (not in particular order of favoritism) webpack es6 , traceur compiler yo-grunt-bower requirejs , r.js anything want , tools provided with: grunt - contrib gulp or broccoli while of these collections of tools want. things yeoman give nice baseline can add to, ie -> throw coffee-script compiler in grunt workflow.

php - Cakephp custom query with pagination? -

i developing web application, need custom query.i giving code samples below : function index() { $this->layout = 'reserved'; $info = $this->auth->user(); $user_id = $info["id"]; $club_info = $this->club->find('first', array('conditions' => array('club.user_id' => $user_id))); if ($club_info) { $club_id = $club_info['club']['id']; $club_name = $club_info['club']['club_name']; $this->set(compact('user_id', 'club_id', 'club_name')); $clubtables =$this->clubtable->query("select *from club_tables clubtable left join categories category on clubtable.category_id=category.id left join deals deal on clubtable.id=deal.club_table_id , clubtable.club_id='".$club_id."' , clubtable.status='approved' order deal.status desc"); $this-&g

svg - Change in CSS the background-color for the first rect in my #ID -

i generate svg in gwt application , want modify first rect background-color inside svg in css. here code: <svg id="chart8" width="720" height="350" style="overflow: hidden;"> <defs id="defs">...</defs> <rect x="0" y="0" width="720" height="350" stroke="none" stroke-width="0" fill="#ffffff"> <g>...</g> <g><rect .../></g> <g>...</g> </svg> so want modify in css fill value first rect element #chart8. i tested it's not working: #chart8 rect:first-of-type { fill: #f1f1f1;*/ } have idea? thanks!

javascript - Confusing with Regular Expressions repeaing parts -

i confused regular expressions repeating parts curly braces. consider following example: var datetime = /\d{1,2}\/\d{1,2}\/\d{4} \d{1,2}:\d{2}/; console.log(datetime.test("30/1/2003 8:45")); // true now if change 30 300000 , 45 455555, i'll true again! other parts between outer numbers ok , result expected. can me find problem? thanks. you're not matching beginning , end of string ( ^ , $ ) it's finding match anywhere in string still happens, , giving true. 300000/1/2003 8:455555 dd/m/yyyy h:mm you want /^\d{1,2}\/\d{1,2}\/\d{4} \d{1,2}:\d{2}$/; or more exact; /^(?:0?[1-9]|[12]\d|3[01])\/(?:0?[1-9]|1[0-2])\/\d{4} (?:0?\d|1\d|2[0-3]):[0-5]\d$/; (?:pattern) non capture group pattern? n in pattern optional [1-9] character class; number ranging 1 9 pattern1|pattern2 either pattern1 or pattern2 [12] character class; either 1 or 2 \d same [0-9] pattern{4} n in pattern happens 4 times

sql server - SQL Logic doesn't work -

i have character data stored in column imported data file. character data represents integer value, but.. last (rightmost) character isn't digit character. i'm attempting convert character data integer value using sql expression, it's not working. my attempt @ sql statement shown below, , test case demonstrates it's not working. approach split off rightmost character string, appropriate conversion, , string , cast integer. q: how can fix sql expression convert correctly, or sql expression can used conversion? details the rightmost character in string can 1 of values in "code" column below. "digit" column shows actual integer value represented character, , "sign" column shows whether overall string interpreted negative value, or positive value. for example, string value '023n' represents integer value of +235 . (the rightmost 'n' character represents digit value of 5, positive sign). string value of '104}&

oracle - PL/SQL Error on trigger for auto_increment -

i'm trying auto_increment cust_id field in following table: create table a113222813_customers ( cust_id number(10) primary key, cust_fname varchar2(20), cust_sname varchar2(20), cust_uname varchar2(30) not null, cust_pass varchar2(40) not null ) i create following sequence , trigger handle this: create sequence cust_seq start 1 increment 1 nocycle; create or replace trigger cust_trg before insert on a113222813_customers each row begin :new.cust_id := cust_seq.nextval; end; but keeps throwing following error: error(2,30): pls-00357: table,view or sequence reference 'cust_seq.nextval' not allowed in context any idea doing wrong? this not possible before 11g. can use sequence_name.nextval in regular assignments 11g not before that, , following: select cust_seq.nextval :new.cust_id dual;

how to pass account information to django template in django-registration? -

i want pass account information template when user account activated, there message saying "your account activated; please log in now" link below. if activation days have expired, must "activation days expired". have url , template here, not know how pass account information template. url.py urlpatterns = patterns('', url(r'^activate/complete/$', templateview.as_view(template_name='registration/activate.html'), name='registration_activation_complete'), ......) registration/activate.html {% extends "registration/base.html" %} {% block title %}account activated{% endblock %} {% block content %} <h1>account activated.</h1> {% load humanize %} {% if account %} <p>thanks signing up! can <a href="/accounts/login/">log in</a>.</p> {% else %} <p>sorry, didn't work. ei

c# - Automatically Search in DataGridView -

i want have automatic search in textbox . this code running when i'm searching string when search integer error: cannot perform 'like' operation on system.int32 , system.string i hope can because need now. private void textbox1_textchanged(object sender, eventargs e) { dataview dv = new dataview(datatable); dv.rowfilter = string.format("orderno '%{0}%'",textbox1.text); datagridview1.datasource = dv; } you can't use like operator compare numbers. assume want find matching order id: dv.rowfilter = string.format("orderno = {0}", textbox1.text); you may want use int.tryparse() test value in textbox first. private void textbox1_textchanged(object sender, eventargs e) { int orderid; if (!int.tryparse(textbox1.text, out orderid)) return; // not valid number dataview dv = new dataview(datatable); dv.rowfilter = string.format("orderno = {0}", orderid); datagridview1.