Posts

Showing posts from February, 2011

javascript - Retrieving data from sqlite3 via ajax from php to js -

in js want read data sqlite3 dbase. here ajax code: function getheatercfg(rdate){ var data = { isdaterequested : 1, reqdate : rdate }; var jdata = json.stringify(data); alert(jdata); $.ajax({ url: 'getlatestcfgheater.php', type: 'post', datatype: 'json', data: {'querysettings': jdata}, success: function(data) { console.log("success"); //parse data } }); } and here php code: <?php function var_error_log( $object=null ){ ob_start(); // start buffer capture var_dump( $object ); // dump values $contents = ob_get_contents(); // put buffer variable ob_end_clean(); // end capture error_lo

php - retrieve data send via ajax post -

i have following ajax code sending data php via post: checked_id = 10; $.ajax({ url: "/delete_document", type: "post", data: {id:checked_id}, // success: function(data, textstatus, jqxhr){ alert(data); location.href='/delete_document'; }, error: function (jqxhr, textstatus, errorthrown){ //alert('error!') } }); it prepares data successfully, , correct value alerted (10). then should fetch value in php file: $selected_id = $_post['id']; var_dump($selected_id); but var_dump gives me string(0) "" . i know when code doesn't work, it's me 1 that's doing wrong. can not see mistake here. the thing see after code has completed is not result of post ajax call, it is result of redirection in line location.href=

javascript - How to enable the tab while selecting the checkbox -

i have got task jquery tab. on when select check box corresponding tab must show on page , others must disabled.multiple checkbox allowed.then corresponding pages must enabled. my code is <html !doctype> <head> <title>jquerymenu</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script> <script type="text/javascript"> $(function() { $("#tabs").tabs(); $("#tabs").tabs("option", { "selected": 2, "disabled": [1,2,3] }); $( "input[type=checkbox]" ).click(function(){ $('#tabs').tabs("enable", $(this).val()); $('#tabs').tabs("select", $(this).val() ); }); }); </script>

c++ - how to create a vector as an argument -

i have object takes vector 1 of it's constructor arguments. have around 1000 of these objects (contained in vector) in each of 12 files time i'm finished, , i've been experimenting layout. best way can find work create arguments within object definition. here basic version of struct: struct myobject { myobject (vector<int>); vector<int> paralist; } so object definition this: myobject object1 ( {0, 1, 2} ); myobject object2 ( {0, 3, 1} ); myobject object3 ( {5, 7, 5, 6} ); myobject object4 ( {4} ); this works, i'd construct objects within vector definitions instead. so: vector<myobject> objectlist { ( {0, 1, 2} ), ( {0, 3, 1} ), ( {5, 7, 5, 6} ), ( {4} ) }; it feels should work, doesn't. get: error: expected primary-expression before '{' token error: expected ')' before '{' token error: expected '}' before ')' token i feel syntax correct if possible, i'm trying not po

jquery - Chrome checkbox not changing -

i have simple checkboxes in table. checkbox tag see in code: <input type="checkbox" id="ifact123" onchange="submit_status_change(123,$(this).prop('checked'));" > now example in firefox, works fine. in chrome, following happens: when checkbox clicked, checkbox not appear change checked/unchecked. stays same. @ least visually the submit_status_change() runs ok , if reload page, element loaded checked (which info database). since function takes info $(this).attr('checked')) , element must checked @ least @ time parameter send - doesn't appear to. now has idea, or experience such problem? if think has submit function, here is: function submit_status_change(id, val){ //$.post('something.php',{'change_status':id, 'status':val}, function(){}); } update: attr changed prop chrome changes checkbox, @ least visually. onchange event doesn't seem happen. firefox: typeerror: $(...

html - Unwanted padding space created by ul and li -

Image
html <ul> <li><img src="images/yellow.gif" alt="yellow"></li> <li><img src="images/orange.gif" alt="orange"></li> <li><img src="images/purple.gif" alt="purple"></li> <li><img src="images/blue.gif" alt="blue"> </li> <li><img src="images/pink.gif" alt="pink"> </li> <li><img src="images/green.gif" alt="green"> </li> <li><img src="images/black.gif" alt="black"> </li> <li><img src="images/gray.gif" alt="gray"> </li> <li><img src="images/red.gif" alt="red"> </li> </ul> css ul{ display: flex; flex-wrap: wrap; width: 45%; height: 40%; border: 1px solid red; list-style: none;

componentart - Selecting a single row in component art grid not working -

i have question component art grid. have struggled selecting of single row attribite allowmultipleselect="false" still able select multiple rows. i can't seem around because want selected row highlighted ever color selectedrowcssclass color is. here front end code: <%@ register assembly="componentart.web.ui" namespace="componentart.web.ui" tagprefix="componentart" %> <!doctype html> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1" runat="server"> <base target="_self" /> <title>iview trend data</title> <link href="assets/oldcss/gridstyle.css" rel="stylesheet" /> </head> <body> <form id="form1" runat="server"> <asp:hiddenfield id="parama"

c# - appending timeouts to asynchronous requests in WinRT -

i'm using piece of code append timeout request call i'm making ensure don't encounter slow internet connection - , handled appropriately. when meet timeout condition error message i've been unable fix within extended function. how go task in general? code: public static class soextensions { public static task<t> withtimeout<t>(this task<t> task, timespan duration) { return task.factory.startnew(() => { bool b = task.wait(duration); if (b) return task.result; return default(t); }); } } usage: var response = await httpwebrequest .create(request) .getresponseasync() .withtimeout(timespan.fromseconds(1)); i handle aggregateexception (and through webexception ), still generates aggregateexception when timeout fails. i recommend using cancellationtoken timeouts ( new cancellationtokensource(m

regex - displaying paragraphs not containing a pattern using sed/egrep/awk -

i trying separate out paragraphs not containing keywords "validto" or "draft" , other paragraphs should displayed , though have sed/awk 1 liners awk -v rs= '/occurance: 1/' ystdef.txt sed '/./{h;$!d};x;/search/!d' could not find negation of same , display paragraphs not containing pattern : schedule p0015d24#ep_daily_1_p draft on runcycle simple1 07/31/2004,09/30/2006,02/10/2007 except runcycle calendar2 peatoff priority 0 : p0015d24#ep_ea012_bfr p0015d24#ep_ea012_n follows ep_ea012_bfr end schedule p0015d24#ep_daily_2 on runcycle rule1 validto 10/02/2013 "freq=daily" except runcycle calendar2 peatoff except runcycle calendar3 ptdly except runcycle calendar5 tws85off except runcycle exclude 01/20/2007,02/10/2007,03/10/2007,04/21/2007,05/12/2007,06/09/2007,07/21/2007,08/11/2007, 12/23/2007,12/24/2007,12/31/2007,01/19/2008,02/09/2008,01/01/2009,02/07/2009,05/22/2009, 05/25/2009,07/02/2009,07/03/2009,07/04/2009,07/05/2009,09/

Can i get email notification from App Store when my app is downloaded from app store? -

is there way apple can send notification email every time user downloads our app app store? no, can create webservices rest , in method didfinishlaunching save when app first open.. save open boolean value in nsuserdefaults , call api.

FileMaker Pie Chart Labels Overlapping -

Image
filemaker seems pie charts evenly distributed data points well. while styling options limited in comparison excel, still gets job done. undistributed data it's story. example, if 1 item on pie chart takes 95% of room, , 5 other items take remaining 5%, this: notice how labels 5 items overlap? wondering if there way around this? i think, of charting programs struggle output data point labels correctly in case, if can display them @ angle, can't in filemaker. you can remove data point labels making font colour same background or transparent in chart setup/styles/chart text or unchecking chart setup/chart/options/"show values on chart". instead can enable legend checking "chart setup"/chart/options/"show legend" if not enough, might consider using 1 of javascript libraries in webviewer display chart (e.g. highcharts). i checked setup on filemaker 13, 14 chart setup dialogue different.

encryption - Encrypt a string with JavaScript in a Gnome Applet -

is there easy way encrypt example string aes in gnome applet written in javascript? can't find solution in gnome api reference [1]. saw libsecret has aes implementation testing purposes [2], don't know if can use - , if so, how. the way can imagine use openssl on glib.spawn_command_line_ . [1] https://developer.gnome.org/references [2] https://github.com/gnome/libsecret/blob/master/libsecret/mock/aes.py

java - How to Check for empty line while parsing csv file? -

from third party daily reports getting similar kind of csv file shown below 07-jan-2016 better lead behind , put others in front, when celebrate victory when nice things occur. take front line when there danger. people appreciate leadership. main thing have remember on journey is, nice , smile. my requirement need put each paragraph (a line after space) each quote above reference in separate stringbuffer my question how can check empty line ?? i tried if(line.contains(" ")) { system.out.println("hjjjjjjjjjjjjjjjjk"); } but above causing issue ever there space i reading csv file shown below string csvfile = "ip/asrer070116.csv"; bufferedreader br = null; string line = ""; try { br = new bufferedreader(new filereader(csvfile)); while ((line = br.readline()) != null) { if (line.startswith(",")) { line = line.replacefirst(",", ""); } system.out.println(line);

SQL Server 2014 all column properties disabled -

Image
i'm hardly trying change identity increment setting primary key column in sql server 2014. sadly properties greyed out , not changeable @ all! can tell me why , how fix it? thanks the column properties readonly. don't click on "properties" "modify".

Does Windows Azure support the SPDY protocol? -

does know if windows azure (or plan to) support spdy protocol? didn't find guess not supported yet... two answers: 1) support spdy, http/https load balancers must support npn negotiation part of ssl handshake. don't believe existing lb's have support this, hence won't able use platform lb's. 2) if configure load balancers simple tcp proxies, , push ssl negotiation down app servers, can deploy app server can perform npn negotiation (for example, apache mod_spdy, or node-spdy, etc). same strategy applies aws well.

python - How to send keyboard input(strokes) to background process in Linux? -

i have started python script in terminal (this terminal has been closed) , sent background. program expects input keyboard , keeps waiting. how send input, 'y\n'(letter 'y' followed enter) program? assume pid 1234. i have tested method not work. echo 'y\n' | /proc/1234/fd/0 , echo 'y\n' > /proc/1234/fd/0 update: relevant part of python script : ans = raw_input('overwrite?(y/n):') if ans == 'y': do_something() else: do_otherthing() try this: echo -ne 'y\n' > /proc/1234/fd/0 an alternative use command yes . more information use man yes . yes > /proc/1234/fd/0

python - scons and virtualenv import issue -

i have been working ubuntu 12.04 long time , use scons compile code. using virtualenv (and virtualenvwrapper ). today tried ubuntu 14.04 on vm (future here come :) ). when run scons (inside virtualenv) failed because can't find package (psutil doesn't matter one). confused because pip installed -r requirements.txt , know psutil there. to sure tried pip freeze | grep psutil , saw there. after short research found out scons version on 14.04 newer 1 have on 12.04. (2.3.0 , 2.1.0 respectively). i tried understand can cause such thing happen , saw older scons uses #! /usr/bin/env python while new scons uses #! /usr/bin/python . since have not installed psutil on system python scons fails. is there better approach modify new scons use #! /usr/bin/env python ?

c++ - Write a subprogram that calculates n!. While using this subprogram make a program that calculates (a+b)! -

my task write subprogram calculates n! . while using subprogram make program calculates (a+b)! . i wrote following code: using namespace std; int f(int n) { for(int i=1;i<=n;i++){ f=f*i; } return f; } int main() { int a,b; cout<<"a="; cin>>a; cout<<"b="; cin>>b; cout<<"factorial of a+b="<<(a+b)*f; return 0; } and error when compile: in function 'int f(int)': 7:27: error: invalid operands of types 'int(int)' , 'int' binary 'operator*' 8:8: error: invalid conversion 'int (*)(int)' 'int' [-fpermissive] in function 'int main()': 16:34: error: invalid operands of types 'int' , 'int(int)' binary 'operator*' 17:9: error: expected '}' @ end of input here's error return f; returns function pointer of function f() . you're using function pointer calcul

Enable remote connections for SQL Server 2014 Express -

Image
i have sql server 2014 express installed , want allow remote connections. have read answer , can't find configuration manager installed on system. so question: can configuration done? fire sql server management studio, , in object explorer, right-click on server node, choose properties . you should dialog (it might little bit different in express, basically, that's should get): tick checkbox allow remote connections server

Getting Data using JSON & AJAX in Ruby on Rails -

how can data database on entering/changing keywords (like on change command of textfield) usin json & ajax in ruby on rails? please give me tutorial or code how this. jquery change() jquery ajax respond_to

.htaccess - htaccess redirect all traffic to https://www -

i'm trying redirect 3 cases https://www . are: http:// http://www https:// i've been able first two, not last one. here's i'm using that: rewritecond %{https} off rewritecond %{http_host} ^(?:www\.)?(.*)$ [nc] rewriterule (.*) https://www.%1%{request_uri} [l,r=301] you can use rule add www , turn on https in same rule : rewritecond %{http_host} !^www\. [nc,or] rewritecond %{https} off rewritecond %{http_host} ^(?:www\.)?(.+)$ [nc] rewriterule ^ https://www.%1%{request_uri} [r=301,l,ne] to capture value %{http_host} need condition not or condition.

Firebase doesn't send data ordered in my case -

i have ordered data in firebase. order critical me. firebase can't send ordered in case. (ps: persistence enabled. tried @ android , ios client. result same.) first, there 3 items , received them. cache: 1,2,3 firebase:1,2,3 then, closed app , updated data(inserted 3 item). cache: 1,2,3 firebase:1,2,3,4,5,6 i opened app , limittolast(1) method last item. cache: 1,2,3,6 firebase:1,2,3,4,5,6 and error coming.. i registered node childadded event. childadded callback triggered sequence: 1,2,3,6,4,5 i don't want sort items. should do? i finished example project. https://github.com/muzafferyilmaz/firebaseordertesting update relevant code snippet linked github project: private childeventlistener mchildeventlistener = new childeventlistener() { @override public void onchildadded(datasnapshot datasnapshot, string s) { string text = datasnapshot.getvalue(string.class); log.i(tag, "onchildadded: " + text);

How to use Laravel function in regular php -

this pretty basic question. have function in in laravel: {{this::function('arg1', 'arg2')}} now need use inside of echo in regular php im not sure how these laravel's 1 built: <?php echo "blablabla this::function('arg1', 'arg2') blabla"; ?> how correctly it? you can use concatenation operator join 3 string values: echo "blablabla " . this::function('arg1', 'arg2') . " blabla"; or make use of fact echo accepts multiple arguments , output of them: echo "blablabla ", this::function('arg1', 'arg2'), " blabla";

Same Ember.JS template for display/edit and creation -

i writing crud application using ember.js: a list of “actions” displayed; the user can click on 1 action display it, or click on button create new action. i use same template displaying/editing existing model object , creating new one. here router code use. app = ember.application.create(); app.router.map(function() { this.resource('actions', {path: "/actions"}, function() { this.resource('action', {path: '/:action_id'}); this.route('new', {path: "/new"}); }); }); app.indexroute = ember.route.extend({ redirect: function() { this.transitionto('actions'); } }); app.actionsindexroute = ember.route.extend({ model: function () { return app.action.find(); } }); app.actionroute = ember.route.extend({ events: { submitsave: function () { this.get("store").commit(); } } }); app.actionsnewroute = ember.route.extend

python - Flask-security and Bootstrap -

how can style flask-security login site bootstrap? html form looks this: <form action="{{ url_for_security('login') }}" method="post" name="login_form"> {{ login_user_form.hidden_tag() }} {{ render_field_with_errors(login_user_form.email) }} {{ render_field_with_errors(login_user_form.password) }} {{ render_field_with_errors(login_user_form.remember) }} {{ render_field(login_user_form.next) }} {{ render_field(login_user_form.submit) }} </form> bootstrap implemented, dont know how edit fields , submit button.. the render_field_* functions accepts class_ parameter, add html classes field. add in bootstrap styling classes want. render_field_with_errors(login_user_form.email, class_="form-control") }} {{ render_field(login_user_form.submit, class_="btn btn-default") }} and on.

Chef vault - error accessing vault item during kitchen converge -

here call making in recipe: mypassword = chef_vault_item("passwords", "default_pass") here error getting when running kitchen converge on recipe: net::httpserverexception ------------------------ 404 "not found" what need allow kitchen access vault item? make sure configure data_bags_path or put files in default location ( data_bags/ ). error mentions server aren't use default solo-based provisioner, state using.

java - How to map an interger key to an @ManyToOne object within the same @Entity? -

is possible have optional integer column map @manytoone object @ same time? table: id,name,catalogid accordingly class: @entity class mytable { @id private long id; private string name; private integer catalogid; @manytoone @joincolum(name = "catalogid", foreignkey = @foreignkey(name="fk_catalog"), nullable=true) private mycatalog catalog; } @entity class mycatalog { @id private int catalogid; //some more fields... @onetomany(mappedby = "catalog") private set<mytable> mytables; } when create object, know catalogid already, foreign mapped table not yet have content catalogid . question: possible define @manytoone optional? thus, set catalogid value, let hibernate create object if can linked foreign table?

ios - Bind to UIBarButtonItem events in MvvmCross -

what's proper way mvvmcross create binding uibarbuttonitem mvxcommand ? this not work me -> public override void viewdidload () { base.viewdidload (); this.addbindings (new dictionary<object, string> (){ {mybutton, "{'clicked':{'path':'mycommand'}}"} }); } i don't error in console. can work around avoiding bindings, know, it'd best if bound. assuming bar button - mybutton - initialized before call addbindings, think code should work. i modified code in welcomeview in conference sample below , seems work... var s = new uibarbuttonitem() { title = "click me" }; navigationitem.setrightbarbuttonitem(s, false); this.addbindings(new dictionary<object, string>() { { button1, "touchupinside showsponsorscommand" }, { button2, "touchupinside showexhibitors

Java out-of-bounds error -

i keep getting out of bounds error. want check duplicates. there more after this, right thats important says i'm getting outofboundsexception arraylist , index:1 size:1 arraylist lottery = new arraylist(); (int n = 0; n < 4;) { int number = 0; int first = 0; int value = 0; boolean found = false; first = (int) (math.random() * 42 + 1); lottery.add(first); count[first]++; (int = 1; < 6;) { number = (int) (math.random() * 42 + 1); (int k = 0; k < 6;) { // here value = lottery.get(k); if (value == number) { found = true; } else { found = false; } if (found == true) { number = (int) (math.random() * 42 + 1); } else { k++; } } system.out.println("number " + (i + 1) + ": " + number); if (found == false) { lottery.add(

Cannot able to find contacts/form.phtml in magento -

i wanted add texts in contact form page(default magento). googled out , found this tutorial . when tried go path cannot able find file.does knows what's reason behind of it? check in custom theme's template folder if don't have contacts folder on there in base/default/template folder. if thats case copy inside custom theme folder copy contacts.xml custom theme folder ensure theme fallback.

javascript - Asynchronous initialization of express.js (or similar) apps -

consider example: have following express.js app (see code snippet below). want have 1 persistent connection db, , 1 persistent connection own service (which required async call start) during entire app lifetime. , there few entry points, i.e. 1 can access app not via http protocol. of course, want avoid service initialization code duplication , there several such async-initializing services. /* app.js */ var app = require('express')(); // set views, use routes, etc. var db = require('monk/mongoose/etc')(...); // happily, it's sync operation var myservice = require('./myservice'); // however, it's possible have several such services myservice.init(function(err, result) { // here initialization process finished! }); module.exports.app = app; /* http_server.js (www entry point) */ var app = require('app'); // create http server app , start listening /* telnet_server.js (other entry point) */ var app = require('app'); // c

css3 - How to float a word next to animated text -

i'm new animating text in css3, , have 2 problems can't quite figure out. problem 1: i've been trying float regular word next animated text it's in 1 sentence. animated word close end of sentence , take require space depending on length of word. janie lovely girl because (animated text) , cool. problem 2: second issue started when added words total of 12 animated words. caused looping issue words appearing on top of each other i'm not sure change in terms of keyframes make words loop how they're supposed to. any or push in right direction extremely helpful @ point. here's fiddle thanks in advanced! html: <section class="wrapper"> <h2 class="sentence">janie lovely girl because <div class="slidingvertical"> <span>amazing</span> <span>beautiful</span> <span>cute</span> <span>honest</span> <span>cool</span>

ios - IBAction linked to multiple UISliders -

Image
i have view controller 3 sliders. have 1 function needs called every time slider value changes - value change in 1 of 3 sliders should cause call function. how do that? if try use outlets able link 1 uislider. you can connect value changed event of sliders same ibaction : if want connect them outlets (which entirely different) have use iboutletcollection :

android - While running a script as testng in eclipse using appium. It tells me a new session could not be created -

while running script testng in eclipse using appium. tells me new session not created. the error below: failed configuration: @beforeclass setup org.openqa.selenium.sessionnotcreatedexception: new session not created. (original error: not find connected android device.) (warning: server did not provide stacktrace information) command duration or timeout: 27.86 seconds build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52' system info: host: 'emnas-mac.local', ip: '192.168.116.130', os.name: 'mac os x', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_65' driver info: io.appium.java_client.android.androiddriver @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstruct

api - Is there anyway to get the label information by tracking number from UPS, USPS, FEDEX, etc? -

i want know if possible information like: consignee name (destination name) ups (and/or other couriers) tracking number? my final goal scan tracking number , name of receiver using api those. neither ups nor other major carrier returns sender or recipient name in tracking api. you're able location information city, zip code , country, not actual name.

php - if (isset($_POST['add'])) don't work? -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers <?php session_start(); include_once 'dbconnect.php'; if (isset($_post['add'])) { $username = ($_post['username']); $phone = ($_post['phone']); $email = ($_post['email']); $password = ($_post['password']); $address = ($_post['address']); $studing = ($_post['studing']); $birthday = ($_post['birthday']); $stage = ($_post['stage']); $college = ($_post['college']); $department = (['department']); if (mysql_query("insert de (username,phone,email,password,address,studing,birthday,stage,college,department) values ('$username','$phonenumber','$email','$pass

actionscript 3 - GOING MAD SWF ASSETS not loading -

i've read through posts on "swf loading issues" on many sites , nothing helps. maybe environment or tiny thing missed causing loader.content null. swf files in same folder added trusted locations in flash preferences. i'm using mxmlc -static-link-runtime-shared-libraries build both swf files, 1 main, other assets "images, sounds, , code". loader.progress getting triggered: event.bytesloaded equals event.bytestotal "11303918", content elements null, no class attach. have given on loader.complete, because never triggers locally, it's firefox caching issue; thus, triggering completion through progress bytes. to protect innocent names have been changed "main, part, , assets", no code has been harmed in writing of post... yet. 10952 main.swf - includes part.as , main.as 11303918 assets.swf - includes assets.as my flash app simple music mixer. main defines control board. assets provide music, images, , executable code.

Why python do not support element insertion in set? -

i want understand, internal design strategy that, can not allow element insertion in set. following link describe set implemented using dictionary,where every element of set key. https://docs.python.org so,why not supporting similar operation update in dictionary. yes can, look: >>> a=set() >>> a.add(1) >>> {1} >>> a.update([2,3,4,5]) >>> {1, 2, 3, 4, 5} >>>

c - Why this getchar() doesn't work properly? -

this question has answer here: getchar() skips every other char in c 2 answers can tell me why line o = getchar(); works first time , once works, once it's not? #include <stdio.h> int main(void) { char o; (int = 1; > 0; i++) { printf("%d\n", i); if (i % 10 == 0) { printf("do want continue? (y/n): "); o = getchar(); if (o == 'n') break; } } return 0; } first of all, getchar() returns int , may not fit char . change char o; to int o = 0; then, come point of skipping , well, not skip . when press key , press enter , newline press of enter key serves feed getchar() in every second iteration of loop.

xpath 2.0 - XQuery: How to add a comma after sequence except for the last element -

i have following xml: <form> <bibl> <biblscope>1</biblscope> <biblscope>a</biblscope> </bibl> <bibl> <biblscope>2</biblscope> <biblscope>b</biblscope> </bibl> <bibl> <biblscope>38</biblscope> <biblscope>c</biblscope> </bibl> </form> using xquery for $bibl in form/bibl return <div> { $biblscope in $bibl/biblscope/text() return $biblscope } {if ($bibl[position()] ne $bibl[last()]) ',' else '@'} </div> the <biblscope> contents printed 1 after another. after each bibl element, add separator (comma / ",") except last one, code above, is <div> 1a @ </div> <div> 2b @ </div> <div> 38c @ </div> and wrong, because have is <div>1a,</div> <div>2b,</div> <div>38c@</div> (add comma after every bibl element conte

django - Unexpected behavior of static variables in python -

this question has answer here: django models & python class attributes 4 answers i learning django, here model have created class userprofile(models.model): name = models.charfield(max_length=50, verbose_name="name") login = models.charfield(max_length=25, verbose_name="login") password = models.charfield(max_length=100, verbose_name="password") phone = models.charfield(max_length=20, verbose_name="phone number") def __str__ (self): return self.name since name static variable, in method __str__ , can called this def __str__ (self): return userprofile.name but when tried access variable using above method , following error attributeerror @ /admin/tasksmanager/userprofile/ type object 'userprofile' has no attribute 'name' request method: request url: http: