Posts

Showing posts from May, 2015

mysql - SQL Stored Procedure Syntax error missing 'end' -

i've been working on sql stored procedure , new process. i'm trying write procedure retrieves value 1 table , inserts part of new row. i'm using mysql workbench, , it's giving me error @ line where blockid = blk; as part of following code: create definer=`root`@`localhost` procedure `add_userblock`(in user int(11), in blk int(11)) begin -- determine how many blocks can add declare blocknum int default -1; select addcount blocknum block blockid = blk; -- determine if block exists user declare entryexists int default 0; select count(*) entryexists userblock blockid = blk , userid = user; if (entryexists = 0) -- new entry begin insert userblock (userid, blockid, num) values (user, blk, blocknum); select last_insert_id() 'id'; end else -- existing entry begin update userblock set num = (num + blocknum)

html5 - Creating a link from my DB saved text with PHP -

i bit stumped. want get "directory/filename space.pdf" db (done) create page displays list of available pdf's (here fault lies) $stringoptions= $stringoptions. "<li><a href=". rawurldecode ($row['doccontent']) .">". $row['docdata'] ."</a></li>"; display php page in html. (done) the links generated www.thedomain.com/documents/filename , rest with space.pdf lost. or creates link /documents/filename+with+a+space , .pdf cut off , domain lost. i tried encodeurl , rawencodeurl correlating rawdecodeurl , decodeurl functions url never created. have read php manual not enough coder see other functions could/should use. or direction please.

Sorting items in a text file in python -

i've been trying figure out how sort results in text file in order of test scores small task i'm doing using lambda sort function. i'm unsure if best way or not recommended me friend. the results entered text file so: text_file = open("results.txt", "a") text_file.write("\n") text_file.write(str(score)) text_file.write(" ") text_file.write(username) text_file.write(" ") text_file.write(userclass) text_file.close() my current sorting system looks this: with open("results.txt") inf: data = [] line in inf: line = line.split() if len(line)==4: data.append(line) = sorted(a, key=lambda x: x.modified, reverse=true) and text file looks this: 5 test b 4 test b 6 test c 7 test (score username userclass) i sort results in descending order score , i'm not sure correct way go it. thanks in advance. if need list element sublists, above answers ok

Variable Name in SAS -

i have variable name called a_flag (1=y,0=n) . however, when try rename variable, sas says can't find variable. is variable name a_flag (1=y,0=n) or a_flag ? if variablename "a_flag (1=y,0=n)", need refer "a_flag (1=y,0=n)"n. e.g: proc freq; tables "a_flag (1=y,0=n)"n; run; you need validvarname=any option set in order work.

Getting data from a php file using Javascript and Ajax -

hi trying create survey personal project working on teach self web development. survey f1 website , want able ask users 5 questions , based on there answers want able tell them grand prix best suited them. my questions users are: what grand prix’s closest you? (i have given them option select 3 grand prix’s suing select boxes) what countries visit? (i have given them option select 2 countries suing select boxes) when available go grand prix (i have given them option select 3 months suing select boxes) what favorite team? (one option using select box) who favorite driver? (one option using select box) so far have created database tables countries, grand prix’s, months, teams , drives. i have survey.php file populates select boxes database. so question how create javascript file link php file populates select boxes input user , display result out refreshing page using ajax? my survey.php <?php $link = mysqli_connect("localhost","

android - Cannot compile project after adding library -

i have added today library ( same gith developer branch there few things changed , wanted use both libraries ) after fixing have tryed run project , following error: error:execution failed task ':app:dexdebug'. > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.8.0_40\bin\java.exe'' finished non-zero exit value 2 my gradle files are: apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.example.marian.digimusicstream" minsdkversion 14 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependen

localhost - I update my xampp and i face this errors Notice: Undefined variable: session in -

i update xampp , face errors notice: undefined variable: session in try php.ini no solution have more 30 scipts in localhost , want ignore errors. how can this put @ end of php.ini error_reporting = e_all & ~e_notice & ~e_deprecated & ~e_strict make right php.ini

c++ - GNU gcc/g++ compiler version on solaris for supporting C++11/14 -

i need know gnu gcc/g++ version alongwith gmake, gdb , other gnu build tools upgrading c++11 first , c++14. please suggest stable version at/download? requiring compiler/build suite solaris 32-bit. please suggest. for c++11, version 4.8.1 or later: https://gcc.gnu.org/projects/cxx0x.html . for c++14, version 5 or later: https://gcc.gnu.org/projects/cxx1y.html .

Need regex for url pattern -

i need regex validate urls: bad: www.*.com www.abc* *.* good: *abc.com *.com www.abc.com you use regex like: ^(www\.)?([a-za-z0-9\-]+?)(\.com)$ here's breakdown of how regex works: ^ matches begining of string (www\.)? checks either nothing, or string www. literally. [a-za-z0-9\-] matches letter (capital , lowercase), numbers , hyphen. ([a-za-z0-9\-]+?) matches above 1 or more times, , tries find smallest match. (\.com) matches string .com literally. $ matches end of string. here's live preview of regex in action on regex101.com this allow urls like: www.google.com www.apple.com jojodmo.com stackoverflow.com 99-fake-websites.com but not allow urls like: mail.google.com data.stackexchange.com microsoft.net redirect.affiliate.scam.hop.clickbank.gov if allow subdomains other www (and more 1 of them), allow tlds other .com , above, use: ^(([\w\-]+\.)+?)?([a-za-z0-9\-]+?)(\.[a-za-z]{2,}

Python anaconda conda issue: updating anaconda package impossible because processes are running -

i have issue updating anaconda's packages conda. when make conda update --all there issue says me: error: unable remove files package: cryptography please close processes running code cryptography , try again. however, none process running, have cmd window open. same story when want update dateutile instance. if conda uses package , cannot update them? knows method close or remove packages in order reinstall them? for information: c:\anaconda3\scripts>conda info -a current conda install: platform : win-64 conda version : 3.11.0 conda-build version : 1.11.0 python version : 3.4.3.final.0 requests version : 2.6.2 root environment : c:\anaconda3 (writable) default environment : c:\anaconda3 envs directories : c:\anaconda3\envs package cache : c:\anaconda3\pkgs channel urls : https://conda.binstar.org/juanlu001/win-64/ https://conda.binstar.org/juanlu001/noarch/ https://repo.continuum.io/pkgs/free/win-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum

cypher - Neo4j: Why are paths of length 0 not returned? -

imagine simple scenario company has products, , data: (c:company {name: 'uber'})-[:has_product]->(p:product {name: 'uber app'}) i expect query match (c:company)-[:has_product*0..1]->(p:product) return c.name, p.name; to return uber, null uber, uber app since path can of length 0. however, returns only uber, uber app am misunderstanding how paths work in neo4j? i think confusing how 0 length match works. 0 length relationship hop match start node itself. in query though end node in path specifies :product label. since first node has :company label query never yield 0 length match. if try following query without label specified on end node should return few rows: 1 'uber' in both columns , other 'uber' in 1 column , other column had product 'uber app' . match (c:company {name: 'uber'})-[*0..1]->(p) return c.name, p.name;

php - MYSQL get data BETWEEN AND condition OR condition -

i trying fetch data json between 2 id's have userid either get['id'] or user follow get['id'] other table . my url - http://localhost/aditya/m/login?id=1&&start=6 if(isset($_get['start'])) { $query2 = "select * post (id between '".$_get['start']."' , '".$_get['start']."' + 3) , userid = '".$_get['id']."' or userid in (select userid frndlist followers = '".$_get['id']."') "; } data coming in between id 6 9 why 5 coming ?? (postid in json id) !! { "result":[ { "like":"</a>", "like_no":"0</span>", "time":"th , ", "pro_pic":"members/boykiller654@gmail.com/win_20150115_125206.jpg", "userid":"2", "fname":"aditya", "

selenium webdriver - Protractor expect an element to not be present and receive an error saying it cannot be found -

i've searched numerous forums users similar issue no avail. issue follows: i'm writing protractor test expects html element not present: expect(result[0].$('#edit').ispresent()).tobe(false); when run test, throws following error: no element found using locator: by.cssselector("#edit") am wrong find hard wrap head around this? imagine pass test since expect element not available. if somehow available, say: expected true false or similar. any clarification appreciated! i approach iselementpresent() calling on result[0] : expect(result[0].iselementpresent(by.css('#edit'))).tobe(false);

mobile - MobileIron SSO with custom auth provider -

is possible have sso across multiple apps, installed through mobileiron, connect back-end services/sites protected siteminder or custom authorization provider ? looking @ stackoverflow discussion , mobileiron video , seems mobileiron sso can against kdc only. as far know, you're quiet right: sso capabilities intranet applications located behind mobileiron sentry provided via kcd. possibility via user certificates managed through mobileiron seems not work (look @ thread ios client certificates , mobile device management ).third party / custom authentication providers saml not supported @ moment mobileiron.

html - Centering buttons dynamically as added with bootstrap -

i'm using angular bootstrap. @ top of our page have section used various control dropdowns. want have 3-4 dropdowns ng-if on them, having appear or disappear depending on rather or not given page allows functionality of dropdowns. i these dropdowns centered. may define btn 1, 2, 3, , 4 in order, if btn 3 , btn 4 active should show on middle of page, not on right side. in other words if dropdowns disabled due ng-if argument visible dropdowns should center align if other's never existed. each dropdowns should standard width, i'm confident dropdowns fit on single row if active. i'm having horrible time getting done, despite feeling should trivially simple behavior. i've tried pagnation-centered, didn't seem anything. i've tried placing them in button groups, doesn't seem working either. can point me appropriate bootstrap classes make work? sure thing, take css/html example: css .form-inline .form-control.w140{ width:120px;

oracle - PL/SQL convert string to number -

i want convert string numbers checksum. string consists of universitycode || ' ' || countrycode || ' ' || studentnumber. an example string be: tue nl 123456789 i have convert sample string numbers, , tried to_number function, keep getting error. this code create (or replace) function in pl/sql: -- een functie om een international student identification number (isin) te genereren create or replace function generateisin( countrycode country.code%type, universitycode university.code%type, studentnumber varchar2 ) return varchar2 newstudentnumber varchar2(50) := ''; begin -- zorgen voor de goede waarde voordat de checksum beginnen newstudentnumber := universitycode || ' ' || countrycode || ' ' || studentnumber; -- newstudentnumber omzetten naar enkel getallen newstudentnumber := to_number(newstudentnumber); -- spaties weghalen in newstudentnumber newstudentnumber := trim(' ' newstudentnumber); return newstudentnum

html - Is it possible to create a new xml file using Javascript? -

i want store html text box data periodically restore save time of retyping in event of browser crash or submit failure, can using html5 localstorage or javascript cookies want access data across different browser , must client side process, can create xml or file in client machine save input field data periodically , access browser ?? no. anywhere can save client side sandboxed (and accessible browser stored it). the closest come periodically synchronise local store server.

ruby - How to use Lazy enumeration to control processes? -

in talk https://www.youtube.com/watch?v=5zjwepupybw pat shaughnessy says it's possible use lazy enumeration control processes not sure when should end. i'm curious real or theoretical possibility of doing this? if know real world example or open source project please drop me link. if have own explanation/implementation please share me. i'm curious, nothing more :-) thanks in advance. pat's blogged @ length lazy enumerator. may have found in case not: http://patshaughnessy.net/2013/4/3/ruby-2-0-works-hard-so-you-can-be-lazy appreciate it's not real world example thorough intro , explanation.

multithreading - In Scala/Playframework, how does "Future" and "Future.map" work under the hood? -

the demo codes here object proxycontroller extends controller { def proxy = action { val responsefuture: future[response] = ws.url("http://example.com").get() val resultfuture: future[result] = responsefuture.map { resp => // create result uses http status, body, , content-type // example.com response status(resp.status)(resp.body).as(resp.ahcresponse.getcontenttype) } async(resultfuture) } } as understand, workflow looks this: one of listener threads (threads process http request), t1 , executes proxy action, running through code top bottom. when runs @ ws.url("http://example.com").get() , t1 delegate web request thread (worker thread) w1 , go the next line. t1 skip contents of function passed map method, since depends on non-blocking i/o call has not yet completed. once t1 returns asyncresult , moves on process other requests. later on, worker thread w1 finished web request " http://example.com &q

javascript - how to check if the print is done -

i printing webpage using javascript code: window.print() , need execute function after printing webpage in chrome browser. i stuck, can suggest me how proceed here please? it sounds me trying write webpage using javascript. you should read on basic javascript, recommend attending free course @ codecademy . following basic example of how document.write() on button click. please note printing tag used printing documents on physical paper. <!doctype html> <html> <body> <h1>my first web page</h1> <p>my first paragraph.</p> <button onclick="document.write(5 + 6)">try it</button> </body> </html>

sql server - Selecting Substring SQL -

i need select substring found between (). starting , ending position vary, length of substring. have had moderate success following not 100%. it work values not others, return blanks , change values capitalization format, in other words if value 'test' display 'test'. select substring(columnname, charindex('(', len(columnname)), charindex(')', columnname) - charindex('(',columnname)) input tablename update there 1 set of parentheses () this work provided have single occurence of ( , ) : select substring(columnname, charindex('(', columnname)+1, charindex(')', columnname) - charindex('(', columnname)-1) tablename if have values not have (...) content, add clause: where charindex('(', columnname) > 0 , charindex(')', columnname) > charindex('(', columnname)

python - How to access object instance from mocked instance method when unit testing? -

in code below says foo_obj = ???? , how can reference foo object instance, or better approach? class foo(object): def __init__(self): self.hello = "hey!" def bar(self): return self.hello + " how's going?" def side_effect_foo_bar(*args, **kwargs): foo_obj = ???? return foo_obj.hello + " what's up?" class testfoo(unittest.testcase): @patch.object(foo, 'bar') def test_bar(self, mocked_bar): mocked_bar.side_effect = side_effect_foo_bar foo = foo() self.asserttrue(foo.bar() == "hey! what's up?") i figured out this: http://mock.readthedocs.org/en/latest/examples.html#mocking-unbound-methods the trick add autospec=true in @patch.object(foo, 'bar', autospec=true) . class foo(object): def __init__(self): self.hello = "hey!" def bar(self): return self.hello + " how's going?" def side_effec

php - Words in different languages in the url -

i have website in 3 languages. have 1 page code , change text each language. just simplified example of same page in english , french: mydomain.com/tap.php/?lang=en mydomain/tap.php/?lang=fr to clean url use: rewriterule (mydomain)\/(\w{2})\/(.*) $1\/$3.php?lang=$2 this redirects pages from: mydomain/en/tap mydomain/fr/tap this works question is: is possible have words in different languages in url? instance, if user writes in french: mydomain/fr/robinet note: "robinet" "tap" in french could redirected to: mydomain/tap.php/?lang=fr (remember have 1 page both languages, mydomain/fr/robinet.php/lang=fr not exist. make redirect last mydomain/fr/tap.php/?lang=fr doesn't seem efficient solution) maybe solution not in .htaccess ? so question is: how use words in different languages in url? well seems pretty simple, in order not affect performance, make sure put rewrites in order going called leas

What Packages should I download for IBM Cognos Reporting -

i have install cognos developing reports , analytics on our web portal. our team has required licenses. however, on download page, there number of packages available. not sure packages need download. requirement below: develop reports on our portal allow users customize reports provide analytics capabilities on our portal

asp.net - Clean way to truncate QueryString from a relative Uri c# -

given uri like: /path/page/?param1=value1&param2=value2 as generated using: url.action("page","path", new { param1 = "value", param2 = "value2" }) what cleanest way strip query string result in /path/page/ ? after searching in , more wide google search, best answer found create uri object , use uri.getleftpart(uripartial.path) know , use absolute uris. problem is, not work relative uris, , both doing uri uri = new uri(new uri("http://www.fakesite.com"), myrelativeuri) string cleanuri = uri.absolutepath and string cleanuri = myrelativeuri.substring(0, myrelativeuri.indexof('?')) look sloppy. i use string clearnuri = myrelativeuri.split('?')[0]; it's clean you're going get.

ios - bundle format is ambiguous (could be app or framework) while making Archive -

Image
i have integrated this oauth library have followed installation instruction, app builds fine in developing mode, while making archive getting this, codesign /users/shujaathaider/library/developer/xcode/deriveddata/jamesappv2-hhfnrydqoghbzpgsvepxtuzarqrc/build/intermediates/archiveintermediates/home\ automation\ sys\ swift/intermediatebuildfilespath/uninstalledproducts/oauth2.framework cd "/users/shujaathaider/desktop/workspace_qadir/jamesapp - development/oauth2-master" export codesign_allocate=/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/codesign_allocate export path="/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" signing identity: "iphone developer: ghulam hemani (hb4llmx2dd)" /usr/bin/codesign --force --sign c72d0e8eebe104d1ea0aa0d15558ef38808250f3 /users/shujaa

ios - Weird behavior when reloading cells containing textFields in dynamic tableView -

Image
i have dynamic tableview custom cells each contain textfield , label. want following behavior: a user taps "add" button, , table inserts cell @ index 0, cell's textfield becoming first responder. when user finishes inputting data, one-lined textfield resigns first responder , hides itself. the cell's label becomes visible, filled user input, , auto-resizes it's height accommodate input. cell resized @ time too. i have code first time cell added, when more cells added gets weird. second added cell s textfield not become first responder , filled text previous textfield. subsequent added cells appear blank, except every 6 blank cells, first cell's text shows up. what's going on, , how can fix this? edit: @rayfleck, have resolved issue of second added cell being filled text previous textfield, second cell gets added (and subsequent added cells) still isn't becoming first responder. here's demo showing behavior: here's code

sql - Comparing two dates and avoiding duplication -

i working on hp alm try perform query : select one.id, one.num_qc_edf, one.statut, two.proprietaire, one.changedate (select b.bg_bug_id id, b.bg_user_15 num_qc_edf, ap.ap_new_value statut, bg_responsible proprietaire, al.au_time changedate bug b inner join audit_log al on al.au_entity_id = b.bg_bug_id inner join audit_properties ap on al.au_action_id = ap.ap_action_id , al.au_entity_type = 'bug' , al.au_action_id= ap.ap_action_id , ap_field_name= 'bg_status')one, (select b.bg_bug_id id,b.bg_user_15 num_qc_edf, ap.ap_new_value proprietaire , bg_status statut , al.au_time changedate bug b inner join audit_log al on al.au_entity_id = b.bg_bug_id inner join audit_properties ap on al.au_action_id = ap.ap_action_id , al.au_entity_type = 'bug' , al.au_action_id= ap.ap_action_id , ap.ap_field_name = 'bg_responsible' , b.bg_status = 'tu leger ok')two, bug b one.id= two.id , one.num_qc_edf= two.num_qc_edf , one.statut= two.statut , one.proprietair

css - Is it possible to relatively position an element OVER a relatively positioned canvas? -

Image
here problem: i have canvas element center in documentelement using javascript. has relative position can still flow nicely p elements above , below it. put p element on top of canvas. right i'm doing this: var element=document.getelementbyid("my_canvas_element"); while(element.parentelement){ offset_x+=element.offsetleft; offset_y+=element.offsettop; element=element.parentelement; } my_p_element.style.left=offset_x+"px"; my_p_element.style.top=offset_y+"px"; this accurately position my_p_element @ top left corner of canvas element long set my_p_element 's css position absolute. there way position my_p_element in top left corner of relatively positioned canvas element using css? that is, there way place p element in top left corner of relatively positioned canvas using css? thanks! how wrapping canvas , paragraph elements in div div position:relative. then can position:absolute canvas , paragraphs needed r

javascript - how to deal with slow Ajax request / people with slow connection -

here 'hypothetical' situation. let's have : websocket tell's me send ajax on url http://localhost/whatever every 10 sec. the ajax call on http://localhost/whatever take 45 seconde reply (exagerate number situation). i wonder how browser react? in mind 3 case: (good one): browser smart : understand ajax same url won't stack ajax call until current call finished. browser understand ajax same url , make abort() on ajax 1st call , start new 1 (if browser that, rubbish in mind). (worst case): browser send ajax on url each time websocket ask him , wait answer. moreover, suppose there problem limitation of parralel ajax request? (i wonder how browser if case happens ?) so, case happen , why ? the answer case 3. the browser send requests in order make them. speaking computer carry out instructions in order issue them. if want or need special behavior such throttling rate of requests or not sending subsequent requests until prior ones have fin

ruby - How can I get all the responses by a particular user to posts on a particular topic -

i have user, micropost , response model. the user has many microposts , has many responses. microposts have tags using acts taggable gem. i need find number of responses user has, microposts tagged specific tag. clear, example, how many responses has user 1 given microposts on "exercise" there basic ruby syntax , relationship logic missing. haev in user model. def user_responses_on_topic tag microposts = self.microposts.tagged_with(tag, :on => :tags) responses_count = 0 microposts.each |micropost| count = micropost.responses.where("user_id = :user_id", user_id: self.id).size responses_count = responses_count + count end end its giving me value know wrong because when add responses on particular topic users value doesn't increase. i sure there simple "ruby" way @ using responses = user.microposts.responses but need know how tagged logic on microposts code i have tightened b

javascript - Basic tic tac toe JS -

i want create simple tic-tac-toe game in using html table. able add "x" , "o" values onto html table changing variable either true or false. unable add function take turns. when user clicks on of table cell should start "x" "o". have tried nested loops (for loops & while) can't seem work. here code: function x() { this.innerhtml = "x"; } function o() { this.innerhtml = "o"; } function xdo() { (i = 1 ; <=9;i++) { document.getelementbyid("cell"+i).onclick = x; } } function odo() { (i = 1 ; <=9;i++) { document.getelementbyid("cell"+i).onclick = o; } } var turn = true; if(turn==true) { xdo(); } else if(turn==false) { odo(); you should add onclick event handler cells set value of cell either x or o depending on global flag and invert flag (provided want game played on same computer). like this: function oncellclick()

java - IntelliJ plugin creates files in wrong folder -

i've started work on else's codebase developing intellij plugin. uses apache commons fileutils class create files retrieved external service. service provides relative path file (e.g. src/stuff/file.txt ) , contents strings, used create file. when debug plugin, files created using fileutils.writestringtofile , instead of in current project, end in intellij ide install directory ( c:\program files (x86)\jetbrains\intellij idea community edition 14.1.2\bin ) is there setting i've missed or have current project's source directory in code somehow? update happening plugin lets me create new module type. this, steps added modulewizard. 1 of these steps involves selecting, downloading , creating files used in project. when wizard has run through custom steps, ends asking project name , directory (this seems default module step provided intellij?). means @ time project files downloaded, project root did not exist files located in default folder somewhere. documentatio

java - Decrease clickable area for JComponent -

so, in program have several jcomponents laid out on map. jcomponents filled fillarc's, meaning actual arc covering lets 25% of jcomponent. there way decrease clickable area jcomponent better matches fillarc? right able click outside arc , still interact it... thanks in advance! should clarify fillarc shaped triangle , requirement assignment! there general solution wrote handle issue located at: http://sourceforge.net/p/tus/code/head/tree/tjacobs/ui/shape/ this solution uses area s standard solution interacting shapes in component. in particular, should @ areamanager, , mouselistener defined there.

jshint - Which tool can I use to generate a .jshintrc file with default options? -

i've being using jslint time , found jshint. reading docs learned can configured using .jshintrc file not found if it's possible generate file using cli . is there flag in cli generate such file (preferably options set) or tool allows me that? not going answer question found jshint use on article code style guides, in free html ebook speakingjs - style guide . they talk google's guideline, airbnb's guideline, jquery's guideline, , others, of time links provide ready use jshint file ... may :). if want generate own jshint, don't know if familiar yeoman project re looking : https://github.com/losingkeys/generator-jshint after generating it, text editor can used edit such simple file.

php - Sort Joomla / Virtuemart generated address list -

i'm trying make list generated virtuemart 2 ordered alphabetically. found list rendered in view, can't code, have work this: <?php echo $this->lists['shipto']; ?> i found code @ components/com_virtuemart/views/user/tmpl/edit_address_addshipto.php i tried using js need class ul generated, ul not class. can explain me how can list sorted?

Meteor template: What's the simplest way to check if a user is logged in? -

i'm using meteor's accounts-ui. there way check if user logged in on template without writing custom helper code? pseudo code: {{#if userisloggedin }} you're logged in {{/if}} if not, what's cleanest, idiomatic way of doing it? i care client-side here. thanks. simple answer: check if currentuser object exists. {{#if currentuser }} you're logged in {{/if}} yes, default helper, no need write else!

javascript - Extjs Creating a tagfield without the list -

i know might not way intended used, i'm going ask anyway: is there way create tagfield without drop down list? what have custom control combination of tagfield , itemselector. itemselector inside panel appears via toggle button. after have selected values, hide panel , values selected in tagfield. not using tagfield's combobox properties, want keep ability remove records pressing "x" beside records. there configuration or other way block tagfield showing drop down list when clicked? imo easiest way override extend method (it might empty) , set hidetrigger true : { xtype: 'tagfield', store: store, expand: ext.emptyfn, hidetrigger: true } fiddle: http://jsfiddle.net/mmvg1bl2/

PHP: Issue with namespaces and files required exist in subfolder -

this file tree: /lib |- /external |- /email |- /mandrill |- templates.php |- exceptions.php |- // others files |- mandrill.php (with mandrill.php under folder "email" , folder "mandrill" under folder "email") i'm using f3 framework autoload function ( http://fatfreeframework.com/routing-engine#thef3autoloader ) this autoload: $f3->set('autoload','app/controllers/|app/models/|app/services/|lib/external/'); this mandrill.php : <?php namespace email; require_once 'mandrill/templates.php'; require_once 'mandrill/exports.php'; require_once 'mandrill/users.php'; require_once 'mandrill/rejects.php'; require_once 'mandrill/inbound.php'; require_once 'mandrill/tags.php'; require_once 'mandrill/messages.php'; require_once 'mandrill/whitelists.php'; require_once 'mandrill/ips.php'; require_once 'mandri

Add a custom parameter to Solr while using Spring Data Solr -

is possible add additional parameter solr query using spring data solr generates following request? "params": { "indent": "true", "q": "*.*", "_": "1430295713114", "wt": "java", "authenticatedusername": "user@domain.com" } i want add parameter needed apache manifoldcf, authenticatedusername , value, alongside other ones automatically populated spring data solr (q, wt). thank you, v. i managed make work looking @ source code of solrtemplate class wondering if there less intrusive solution. public page<document> searchdocuments(documentsearchcriteria criteria, pageable page) { string[] words = criteria.gettitle().split(" "); criteria conditions = createsearchconditions(words); simplequery query = new simplequery(conditions); query.setpagerequest(page); solrquery solrquery = queryparsers.getforclass(query.getclass(

recursion - What's wrong with my Python code containing recursive function? -

i using recursive find happy number . the following python code: deepth = 0 def is_happy_number(number): astring = str(number) global deepth digits = [int(char) char in astring] sum_digit = sum([digit**2 digit in digits]) if sum_digit == 1: deepth = 0 return true else: deepth += 1 if deepth >800: return false return is_happy_number(sum_digit) print '7',is_happy_number(7) number in range(1,11): print number,is_happy_number(number) the results : 7 true 1 true 2 false 3 false 4 false 5 false 6 false 7 false 8 false 9 false 10 true when test number 7 alone, returns 'true'. while run last 2 raws code, number 7 return 'false' . i don't know part wrong. after few minutes, find wrong part in python code. , add: deepth = 0 after: if deepth > 800: with remind of @will, find solution problem. code modified following: def is_happy_number(number, deepth=0):

java - How to store a List with own data type in an object array list -

i have list listobject , want store list pointlistforobject every object of listobject. how can make work? class points { private int start; private int stop; public points() { start = 0; stop = 0; } setter , getter... } list<object[]> listobject = new arraylist<object[]>; list<points> pointlistforobject = new arraylist<points>; ... points point= new point(); point.setstart(1); point.setstop(2); pointlistforobject.add(point); listobject.get(0)[1] = pointlistforobject; and want points in method back, don't know how cast or convert in right way. idea is: list<points> usepointsofobject = (list<points>) listobject.get(0)[1]; and here an: exception in thread "main" java.lang.classcastexception: [ljava.lang.object; cannot cast java.util.list i tried different possibilities(to cast or convert) know doesn't work have no ideas.. after pointlistforob

java - CreateProcess error=740, The requested operation requires elevation -

i have web applet update regularly , decided make updater. when download update in java downloads fine. when try unpack + run update using runtime.getruntime().exec(pathtofile); createprocess error=740, requested operation requires elevation how can fix if program web applet? can't tell them run browsers administrators. how can fix this? one of friends having exact same problem month ago (he unrolling update via .exe file), , remember link helped him tremendously: http://mark.koli.ch/2009/12/uac-prompt-from-java-createprocess-error740-the-requested-operation-requires-elevation.html i make comment under question (doesn't seem worthy of straight answer/solution), don't have enough rep yet comment. :-p

javascript - Bind this argument to named argument -

this question has answer here: using bind partial application without affecting receiver 1 answer in case have code structure follows : thing.prototype = { dosomething: function() { $(selector).click(this.handleclick.bind(null, this)); }, handleclick: function(self, event) { console.log(this); //window console.log(self); //thing } } how 1 bind thing this context self argument , still keep behavior of this object if no arguments bound using bind method? note : know can bind this , use e.originalevent.target behaviour want i'm curious if there way i hope i'm getting through want achieve, leave comment if ambiguous. how 1 bind thing context self argument , still keep behavior of object if no arguments bound using bind method? you wouldn't use bind that, because want this dynamic. instead:

Compiler error using java generics with a List as a method parameter and throws generic Exception -

i'm getting compiler error when using generics in project. generate sample code: my bean interface package sample; public interface mybeaninterface { long getid(); string getname(); } my bean concrete class package sample; public class mybean implements mybeaninterface { private long id; private string name; @override public long getid() { return id; } public void setid(long id) { this.id = id; } @override public string getname() { return name; } public void setname(string name) { this.name = name; } } my manager interface package sample; import java.util.list; public interface mymanagerinterface<t extends mybeaninterface> { <exception extends exception> list<t> sortall(list<t> array) throws exception; list<t> sortall2(list<t> array); <exception extends exception> list<t> sortall3() throws exception; } my mana

c - get clock_sec from nibobee-library <clock.h> -

i trying access variable clock_sec library nibobee/clock.h . seems variable zero. does have hint? uint32_t time = clock_sec; unfortunately did not find documentation in english.

php - `Type L: not enough input` when to unpack the target data -

Image
i job done parse data target file in binary form of stackoverflow's friends. <?php $handle = fopen('data', 'rb'); fread($handle,64); while (!feof($handle)) { $bytes= fread($handle,32); print_r(unpack("la/fb/fc/fd/fe/ff/fg/fh",$bytes)); echo "<br/>"; } echo "finish"; fclose($handle); ?> i got result ,one last bug remains here can't solve myself. 1.why unpack(): type l: not enough input, need 4, have 0 ? 2.how fix it? change loop to: while ($bytes = fread($handle, 32)) { print_r(unpack("la/fb/fc/fd/fe/ff/fg/fh",$bytes)); echo "<br/>"; } feof($handle) doesn't become true until after you've tried read @ end of file. so you're performing fread() , returns false , , trying unpack empty byte string.

Android cropper library slows with big images -

i use library cropper here all work cool. if use big image work slows com.edmodo.cropper.cropimageview xmlns:custom="http://schemas.android.com/apk/res-auto" android:id="@+id/imagecrop" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_above="@+id/linearlayout5"/> crudeimage = bitmapfactory.decodefile(picturepath); how fix it?

java - Break servlet-filter work -

i have securityauthorisationfilter , following part of code: for(string anonymousrequesturi : anonymousrequesturis) { if(httprequest.getrequesturi().equals(anonymousrequesturi)) { //allow request } } string authtoken = gettokenfromrequest(httprequest); if equals true need skip next filter operations , send request controller. but, if write filterchain.dofilter(servletrequest, servletresponse) , there no result. filter continue operations find token. how can break out of filter? as understand comment, wish "break out" of current filter if condition anonymous request uri true. return; after calling chain.dofilter() : for ( string uri : anonuris ) { if ( ... ) { chain.dofilter( ... ); return; } } string authtoken = gettokenfromrequest( httprequest ); ... cheers,

python - NameError: name 'ResidentialReference' is not defined [Django - ImageKit] -

for reason error once try apply imagekit onto model create thumbnail imagefield. using imagekit library django can find here my code below : from django.db import models pil import image import os django.contrib import admin imagekit.models import imagespecfield imagekit.processors import resizetofill # create models here. class residentialreference(models.model): image = models.imagefield(upload_to='images', blank="true",null="true") thumbnail = imagespecfield(source='image', processors=[resizetofill(100,50)], format='jpeg', options={'quality':60}) title = models.charfield(max_length = 1000, default = 'title here...' ) postcode = models.textfield(max_length = 1000, default='postcode here...') description = models.textfield(max_length = 12000, default = 'technical description here...')

jquery ui - How to sort prime-ui datatable, based on more than one column -

i want sort datatable based on 2 columns. if use following property, {sortfield: 'columnheader'} its not working. it not work current primeui (at time of answer 1.1 ). have @ sort function: sort: function(field, order) { if(this.options.selectionmode) { this.selection = []; } if(this.options.lazy) { this.options.datasource.call(this, this._onlazyload, this._createstatemeta()); } else { this.data.sort(function(data1, data2) { var value1 = data1[field], value2 = data2[field], result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0; return (order * result); }); if(this.options.selectionmode) { this.selection = []; } if(this.paginator) { this.paginator.puipaginator('option', 'page', 0); }

debugging - Avoiding source-level "jumping around" in gdb -

with c++ code built debugging g++ (i.e. options "-o0 -ggdb") , using newest gcc (5.1.0) , gdb (7.9) display of source code in gdb still painfully non-linear when using "next" command. example function call might expected step through single "next": 7757| sdvalue newroot = tli->lowerformalarguments( 7758| dag.getroot(), f.getcallingconv(), f.isvararg(), ins, dl, dag, invals); however takes four, displayed execution line being first 7757, 7758, again 7757, again 7758. if function call condensed single line 1 "next" needed. if call absurdly inflated 7 "next"s needed (shown '#' annotations) 7757| sdvalue 7758| newroot 7759| = #1,6 7760| tli 7761| -> 7762| lowerformalarguments( #5 7763| dag.getroot(), 7764| f.getcallingconv(), #3 7765| f.isvararg(), 7766| ins, 7767| dl, 7768| dag, 7769| invals #2,4,7 7770| ); so it's r

Conditional BAT File (If Drive Exists) - Run Exe -

i'm trying application run if drive available, or run same application locally if it's not. currently it's launching application both locations, missing something? @echo off rem bat file determine launch app if exist i:\ goto launchfromnetwork else goto launchlocally :launchfromnetwork start i:\application.exe :launchlocally start c:\applicationfolder\application.exe in batch files labels place call or jump, don't create barrier code execution. @echo off rem bat file determine launch app if exist i:\ goto launchfromnetwork :launchlocally start c:\applicationfolder\application.exe goto :eof :launchfromnetwork start i:\application.exe goto :eof no need else clause if if not evaluated true, code continues execution on next line, , labels not barriers. that reason goto :eof in sample, avoiding code execution continue when next section reached

ruby on rails - error.full_messages are hidden and I can't figure out why -

i'm working through rails tutorial , seem stuck on getting error messages display on signup window when e-mail address, or password typed in incorrectly. i've included user controller, new user erb, , error message erb below. great. feel i've been staring @ forever , getting nowhere. in advance helping. error_message erb <% if @user.errors.any? %> <div id="error_explanation"> <div class="alert alert-danger"> form contains <%= @user.errors.count %> errors. </div> <ul> <% @user.errors.full_messages.each |msg| %> <li> <%= msg %> </li> <% end %> </ul> </div> <% end %> user controller class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end def new @user = user.new end def create @user = user.new(user_params) if @user.save # handle succesful save else render "new"

c# - check Windows Update is Turn ON or OFF -

this question has answer here: check .net if windows update enabled 6 answers how know if update on opearting system turned on or off ? possible know wmi ? thanks in advance wuapilib.automaticupdatesclass wauc = new wuapilib.automaticupdatesclass(); bool active = wauc.serviceenabled; based on active variable know if windows update turned on or off. note: need wuapi.dll reference code work.

Multi-part identifier error in SQL SERVER using UPDATE -

i having error : msg 4104, level 16, state 1, line 2 multi-part identifier "minus.groupby" not bound. whenever try using code: update chadothercharges set jan = (select jan chadothercharges chadothercharges.groupby = minus.groupby) chadothercharges chadothercharges , minus both table chadothercharges table column: acctcode | acctdesc | type | orderby | groupby | jan minus table column: groupby | min | max i think should definition of minus table, there not groupby column. after watching table structure query : update chadothercharges set jan = (select jan chadothercharges inner join minus on minus.groupby = chadothercharges.groupby)

c# - Why i can't get to the events of the global keys hooking ? -

i created new form tried before new class same problem. created new form , added: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace capture { public partial class hook_keys : form { globalkeyboardhook gkh = new globalkeyboardhook(); public bool onoff = false; public hook_keys() { initializecomponent(); } private void hook_keys_load(object sender, eventargs e) { gkh.hookedkeys.add(keys.a); gkh.hookedkeys.add(keys.b); gkh.keydown += new keyeventhandler(gkh_keydown); gkh.keyup += new keyeventhandler(gkh_keyup); } void gkh_keyup(object sender, keyeventargs e) { onoff = true; e.handled = true; } void gkh_keydown(object sender, keyeventargs e) {

hibernate session.get gives proxy object -

does hibernate session.get gives proxy object. based on below link see returns real object , not proxy object. today saw strange behavior giving proxy object if proxy object exists in cache otherwise real object. understanding if object exists or doesn't exist in cache session.get give real object , not proxy object. can 1 explain on this. http://www.mkyong.com/hibernate/different-between-session-get-and-session-load

javascript - Can I put a <select> function in a table via innerHTML? -

this have been attempting do. has not worked far. don't know if possible hope can help. willing take advice going. thanks cell1.innerhtml = "<b>" + (i+1) + "</b>"; cell2.innerhtml = "<b>" + array1[j] + "</b>"; cell3.innerhtml = '<select id="hgls"> <option selected="">-</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select>'; cell4.innerhtml = <select id="agls"> <option selected="