Posts

Showing posts from February, 2014

DbUnit H2 in memory db with Spring and Hibernate -

hi i'm trying little poc jpa , unit test verify db schema created. i'm working h2 db , set hibernate create schema entities, when dbunit tries initialize db dataset table ... not found in tablemap. read have add property db_close_delay=-1 db url after hibernate creates schema db losted when dbunit tries initialize. any ideas? highly appreciated. this config: application-context.xml <bean id="entitymanagerfactory" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean"> <property name="datasource" ref="datasourceh2" /> <property name="packagestoscan" value="com.xxx.model" /> <property name="jpavendoradapter"> <bean class="org.springframework.orm.jpa.vendor.hibernatejpavendoradapter"> <property name="generateddl" value="true" /> <property name="showsql" va

django - Solr issues with searching -

i using apache solr quite time , started running severe issues it. i'm using haystack , django project. when manage.py shell i'm getting below: >>> haystack.query import searchqueryset >>> emps = searchqueryset().filter(django_ct='web.employer').filter(name__icontains='mi')[:10] traceback (most recent call last): file "<console>", line 1, in <module> file "/usr/local/lib/python2.7/dist-packages/haystack/query.py", line 241, in __getitem__ self._fill_cache(start, bound) file "/usr/local/lib/python2.7/dist-packages/haystack/query.py", line 140, in _fill_cache results = self.query.get_results(**kwargs) file "/usr/local/lib/python2.7/dist-packages/haystack/backends/__init__.py", line 469, in get_results self.run(**kwargs) file "/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py", line 501, in run results = self.backend.search(final_q

java - How to report AWT/Swing event queue length programmatically? -

ideally, answer platform independent, platform specific, particularly oracle jvms, useful well. project i'm working on still running version 6 jvm. the particular need has gui "freezing" time time. i'm aware of doing on gui work on edt. program working on windows, after moving linux, these "strange" gui issues began happen. actually, issue has occurred on 2 applications, both after windows linux move. jvisualvm shows on 10 million java.awt.eventqueueitem objects. suspicion awt queue growing faster it's being served on linux, idea put awt queue length indicator on app , see shows queue grows/shrinks. a bit of googling found this , linear scan of queue. maybe there's better way? interesting subject. i've investigated eventqueue code bit, , while haven't solved problem, may have useful pointers: oracle's implementation of eventqueue doesn't keep size variable, unless take on complete control of eventqueue (see 3), th

Import data file from folder image to excel columns -

i have folder several images. import name of file on first column, image note ( can add note , fill image) , pixel dimension ( es: 800x600) on second columns. it possible ? have many images work with. lot! sub tgr() const strfolderpath string = "c:\test" dim rngdest range dim oshell object dim varfilename variant dim strdimensions string set oshell = createobject("shell.application").namespace(strfolderpath) sheets.add range("a1:b1") .value = array("name", "dimensions") .font.bold = true .borders(xledgebottom).linestyle = xlcontinuous end set rngdest = range("a2") on error resume next each varfilename in oshell.items strdimensions = oshell.getdetailsof(varfilename, 26) if len(strdimensions) > 0 rngdest .resize(, 2).value = array(varfilename, strdimensions) .comment.delete

java - AWS S3 key issue for uploaded file -

i've question on s3 file key. i'm uploading image file key being url of image. here's code snippet. amazons3 s3 = new amazons3client(new basicawscredentials(access_key, secret_key)); putobjectrequest putobj = new putobjectrequest(bucket, key, createinputstream(image_path), createmetadata("image/jpeg")); putobj.setcannedacl(cannedaccesscontrollist.publicread); putobjectresult result = s3.putobject(putobj); now, here's sample key : image/staging/file/guid1234 and image name : test.jpeg now, how looks in s3 after upload. testbucket/image/staging/file/guid1234 there's no reference of image name. image url shows http://testbucket.s3.amazonaws.com/image/staging/file/guid1234 as can see, there's no reference of image name, though shows image in browser correctly. need embed url in html page, , doesn't lool ok if image name missing. just wondering, if there's way preserve image name url looks http://testbucket.s3.amazonaws.com/image/

sql - why is this prepare statement vulnerable -

i learning sql-injection , understand prepare statement can protect against it. had example below 1 of vulnerable usage of prepare statement there no explanation on why. below code preparedstatement psproblem =connection.preparestatement( "select user,password, tbl_user," + userinput.addtablename + " (user=?)" ); any sql statement unsanitized user input vulnerable same reason: user can input string terminate sql early, , replace sql of own. for example, entering tbl_user 1=0; drop table tbl_user;-- drop user table: resultant sql this: select user,password, tbl_user,tbl_user 1=0; drop table tbl_user;--where (user=?) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ | | | original query nothing because of condition | | | |

php - Generate a sql string inside of a MY_Model -

i'm using jamie rumbelow's my_model develop model's modules. i'm running issues when i'm trying use relationships within module model's. i'm trying learn how debug this. view sql generated string see being ran query. know how this. try: echo $this->db->last_query(); this echo last sql query.

Android Studio: Gradle: error: cannot find symbol variable -

i working on app , normal until tried display image in java. i ran app once , ran normally, picture displayed. after asked me import libraries , imported them. after got errors activities. errors like: gradle: error: cannot find symbol variable activity_main gradle: error: cannot find symbol variable button1 gradle: error: cannot find symbol variable button2 gradle: error: cannot find symbol variable textview gradle: error: cannot find symbol variable secondactivity in mainactivity have imported these libraries: import android.r; import android.content.intent; import android.os.bundle; import android.app.activity; import android.view.menu; import android.widget.button; and in secondactivity these: import android.r; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; does know how fix this? edit: deleted import android.r; , works normally. you shouldn't importing android.r . should automatica

php - echo html only if the variable is not empty -

i trying print content of variable , <hr> tag after doing check if variable not empty. <hr> getting echoed if variable empty. here have <?php if (!empty($content['relationship_graph'])){ print render($content['relationship_graph']); echo '<hr>'; } ?> not pro in php looked @ documentation...cant seem figure out might doing wrong value in blank space. try.. <?php if(!empty($content['relationship_graph']) && $content['relationship_graph']!=''){ print render($content['relationship_graph']); echo '<hr>'; } ?>

html - Weird sizing issues with h1 and span elements -

i have code: <h1><a href="">windows store<br /><span class="smallsubtext">apps</span></a></h1> and: #windowsstoreapplications { float: right; width: 50%; font-size: 16pt; text-align: center; height: 182px; background-color: #9dca87; border-top: 6px solid #aedf66; } .smallsubtext { font-size: 16pt; } as can see, both h1 , span set same font-size - not how want it's how made because noticed font-sizes not matching how should be. i made them both same size demonstrate both same size in code, when run site , @ - they're different sizes. is due size weirdness h1 element? well first, if havn't declared font-size h1's (and rest) browser defaults implemented vary in size. second, should not using pt size, should using px , em or % . #windowsstoreapplications h1 { font-size:16pt; /* or preffered unit */ }

javascript - Making AJAX Applications crawlable without backend control -

i've built tool leverages emberjs , github pages create blogging application rendered in-browser. uses javascript fetch markdown files , render them body of application. because content fetched via ajax requests, i'm not sure of best way make content crawlable google, etc. i've read many articles suggest using phantomjs handle _escaped_fragment_ requests, since content hosted on github, there's no way run server-side. is there possible work-around (such rendering ahead-of-time before pushing content github) or experiencing shortcomings of javascript applications? the question is, can googlebot basic javascript? if not, then, no. read you, app requires js support render page. leaves without bot-friendly access method. if yes, then, yes: because javascript can access url parameters via location.search , can create plausible urls google fetch in href attributes interpreted js app, , overridden users in onclick attributes. <a href="

html5 - JavaScript KeyDown event not triggered when multiple keys are held down -

i experiencing strange problem javascript. working on html5 canvas game uses keyboard input. 2 player mode of game involves 6 keys on keyboard being pressed , held down. it seems "keydown" event stops being called after hold 4 or 5 keys down on keyboard. the code using below: window.onkeydown = function (event) { console.log(event.keycode); input.onkeydown(event.keycode); }; the console should log key code each key press down. however, seems report keycode first 4 or 5 hold down. causing controls 2 player version of game not work when both players press many keys. is bug, limitation of javascript/html5, or doing wrong? this limitation of usb keyboard not of code!

button - email extractor android program crashes aide -

public class mainactivity extends activity { public static linearlayout layout = null; public static edittext urlstring = null; public static button submit = null; public static listview emailsfound = null; public static arraylist<string> emaillist = new arraylist<string>(); public static arraylist<string> urllist = new arraylist<string>(); public static arrayadapter<string> adapter = null; /** * called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); layout = new linearlayout(this); urlstring = new edittext(this); submit = new button(this); submit.settext("submit"); emailsfound = new listview(this); layout.setorientation(linearlayout.vertical); layout.addview(urlstring); layout.addview(submit); layout.addview(emailsfound); se

Bootstrap: how do I make horizontal form's "inline-help" look better when it's too long? -

Image
i feel line being inconsistent pretty ugly. there easy way can beautify it? here basic example of i'm talking about: http://jsfiddle.net/tybwc/1/ <form class="form form-horizontal"> <div class='control-group'> <label class='control-label' for='inputwarning'>input warning</label> <div class='controls'> <input id='inputwarning' type='text'> <span class='help-inline'>something afdaf da</span> </div> </div> <div class='control-group'> <label class='control-label' for='inputwarning'>input warning</label> <div class='controls'> <input id='inputwarning' type='text'> <span class='help-inline'>something afdaf da afdaf da afdaf da afdaf da afdaf da afdaf da </sp

java - input system where the user inputs the array position of the object followed by a # to indiacte quantity but it gives me an error -

its tuck shop program! public void sale() { if (!ingredients.isempty()) { printfood(); string choice = joptionpane.showinputdialog("enter choices seperatad # indicate quantity"); string[] choices = choice.split(" "); string[] ammounts = choice.split("#"); (int = 0; < choices.length; i++) { int foodpos = (integer.parseint(choices[i])) - 1; int ammount = integer.parseint(ammounts[i+1]); try { foods.get(foodpos).sale(ammount); } catch (indexoutofboundsexception e) { system.out.println("ingredient not exsist"); } } } } http://paste.ubuntu.com/5967772/ gives error exception in thread "main" java.lang.numberformatexception: input string: "1#3" @ java.lang.numberformatexception.forinputstring(numberforma

Kendo UI Scatter Chart Grouping -

i'm new kendo , javascript, , having problems getting scatter chart group properly. chart render, no grouping. here sample of data get: "gradelevel": "12", "studentcount": 7, "studentriskfactor": 5.18 }, { "gradelevel": "12", "studentcount": 10, "studentriskfactor": 5.18 }, { "gradelevel": "9", "studentcount": 1, "studentriskfactor": 5.18 }, { "gradelevel": "9", "studentcount": 2, "studentriskfactor": 5.18 }, { "gradelevel": "9", "studentcount": 3, "studentriskfactor": 5.18 here code i'm using create chart: kcschoolcrosstab =

mongodb - Setting value of an array element in Mongoose using index -

i trying update element @ specific index in mongodb array mongoose. db.comment.findoneandupdate( {_id: '51fc9c329e87bf0000000001'}, {$set: { 'body.0' : 'comment body'}}).exec(...); this works fine, however, when use variable set index doesn't seem work. know why? var indexstring = "'body.0'"; db.comment.findoneandupdate( {_id: '51fc9c329e87bf0000000001'}, {$set: { indexstring : 'comment body'}}).exec(...); and how working can set index needed? use object instead: var myindex = { 'body.0' : 'comment body'}; var myindex1 = { 'body.1' : 'xxx'}; db.comment.findoneandupdate( {_id: '51fc9c329e87bf0000000001'}, {$set: myindex}).exec(...); db.comment.findoneandupdate( {_id: '51fc9c329e87bf0000000001'}, {$set: myindex1}).exec(...);

javascript - Using a Pyramid view for an AngularJS dialog template -

i have written web application using pyramid , python web framework. in 1 page of web application, i'd implement dialogs. i'm trying learn angularjs angularui bootstrap achieve ( here example of dialogs angularui ). my page show total of 7 dialogs. these dialogs display text , images, , receive , validate input. dialog flow not linear; there conditional dialogs , multiple branches of execution. please @ this example of displaying angularui bootstrap dialog . example.js:5-21 configures dialog display options. parameter template contains html displayed: template: t, // or: templateurl: 'path/to/view.html', where, in example, var t contains static example markup: var t = '<div class="modal-header">'+ '<h3>this title</h3>'+ ... now, in pyramid, urls not mapped directly files or folders; instead, urls compared registered routes . so, example, not make sense request http://site.com/path/to/

linker - trying to build a PortMidi example in Mingw -

Image
im trying build portmidi example in mingw depends on 2 libraries portmidi , winmm, recompiled portmidi portimidi.a im getting errors of missing code. is posible link winmm mingw, , have use ".a" or ".lib" libraries? im using command compile source: g++ -o prg latency.c -iheaders -llib -lportmidi -lwinmm thanks help. you don't need winmm.a build latency.c you need libpmjni.dll.a , libportmidi.dll.a or libportmidi_s.a to build portmidi wit cmake takes 5 minutes. portmidi source : c:/src/portmidi217/ portmidi build : c:/mingw/portmidi then can compile following command. gcc.exe -c -g -i/c/src/portmidi217/pm_common -i/c/src/portmidi217/porttime -mmd -mp -mf build/debug/latency.o.d -o build/debug/latency.o latency.c mkdir -p dist/debug gcc.exe -o dist/debug/latency build/debug/latency.o -l/c/mingw/portmidi -lpmjni.dll -lportmidi.dll building portmidi cmake download or use cmake in c:\cmake\bin folder double c

javascript - How to handle multiple languages in AngularJS for form validation messages / alerts? -

i'm trying develop app using angularjs should work in multiple, user selected languages. put views in views/en , views/fr , etc, if user viewing in english, template url controllers views/en/somefile.html , , french /views/fr/somefile.html , , on. the question is, how can handle displaying random form validation messages / alerts displayed javascript, displayed in correct language? e.g in controllers have $scope.title variable sets <title> in browser. if user selects different language, want <title> updated shown in selected language well. what's best way of achieving this? textservice i have updated answer reflect current solution problem. removing textual data dependence in templates important problem feel , have gone ahead , wrote own little module this. if want use text insertion options (state text , relative text), you'll need use ui-router , configure routes. here's usage. i'll put module @ end of answer. include text

ssis - How to set the excel border to blank in c# -

Image
basically, using script task within ssis format excel cells. excel template contains blank formatting cells : . but when add row using c# code in script, formatting appears this: . i have tried setting border none using following script: _borders[excel.xlbordersindex.xledgeleft].linestyle = excel.xllinestyle.xllinestylenone; _borders[excel.xlbordersindex.xledgetop].linestyle = excel.xllinestyle.xllinestylenone; _borders[excel.xlbordersindex.xledgeright].linestyle = excel.xllinestyle.xllinestylenone; _borders[excel.xlbordersindex.xledgebottom].linestyle = excel.xllinestyle.xllinestylenone; _borders here of type excel.borders have tried setting weight , value = 0. nothing seems work. not accomplish want. idea how this? dont want set line color white. want blank. got no answers one, figured out needed uncheck "show grid lines" check box. felt may trying this.

email - Java Mail with Attachment-Attachment file location not found -

my code sending email without attachment works fine. when try send email wth attachment, getting error message 'c:\temp\test.txt (the system cannot find file specified)' code below: ' package com.abe.test; import java.util.properties; import javax.mail.*; import javax.activation.*; import javax.mail.internet.internetaddress; import javax.mail.internet.mimebodypart; import javax.mail.internet.mimemessage; import javax.mail.internet.mimemultipart; public class testjavamail { /** * @param args */ public static void main(string[] args) { final string username = "from@gmail.com"; final string password = "xxxx"; properties props = new properties(); props.put("mail.smtp.auth", true); props.put("mail.smtp.starttls.enable", true); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", &quo

python - Place a timeout on calls to an unresponsive Flask route -

i have route in flask app pulls data external server , pushes results front end. external server slow or unresponsive. what's best way place timeout on route call, front end doesn't hang if external server lagging? or there more appropriate way handle situation in flask (not apache, nginx, etc)? update: goal timeout route call, not keep arbitrary long process alive question: time out issues chrome , flask . options websockets run background processes/threads until finish; however, want stop slow route call after fixed amount of time has elapsed. timeout on function call , python timeout within flask context. celery's task decorator ( concurrent asynchronous processes python, flask , celery ) seems great solution, don't want require large dependency use small amount of functionality. i reopened question here: place timeout on calls unresponsive flask route (updated) .

Chrome Extension - Custom design for the chrome action button -

i customize design (view) of extension action button of chrome extension. i know if possible use html , not picture. button show text , number. able update text , number. i did happy if generate image needed informations , change default button icon. did not found anything. in advance thanks to create dynamic browser action icon, use html5 canvas element ; create canvas, add images and/or text it, pass canvas' image data chrome.browseraction.seticon . here's small example (please note uses jquery create canvas element): $('body').append('<canvas id="mycanvas" width="19" height="19"></canvas>'); var mycanvas = document.getelementbyid('mycanvas'); var context = mycanvas.getcontext('2d'); context.fillstyle = "blue"; context.font = "normal 9px arial"; context.filltext("foo", 0, 19); chrome.browseraction.seticon({ imagedata: context.getimagedata(0, 0, 19, 1

Fixing C++ Multiple Inheritance Ambiguous Call -

i have 3 classes structured this: #include <iostream> using namespace std; class keyword { public: virtual float getvalue() = 0; }; class characterkeyword : public keyword { public: virtual float getvalue(){return _value;} private: float _value; }; class measurementkeyword : public keyword { public: virtual float getvalue(){return _value;} private: float _value; }; class addresstype : public characterkeyword, public measurementkeyword { private: float address; float addresext; }; int main() { addresstype *a = new addresstype(); a->getvalue(); return 0; } i getting following: in function ‘int main()’: error: request member ‘getvalue’ ambiguous error: candidates are: virtual float keyword::getvalue() error: virtual float measurementkeyword::getvalue() error: virtual float characterkeyword::getvalue() i have done reading multiple inheritance , know has lot of pitfalls

osx mavericks - Python crashing when running two commands (Segmentation Fault: 11) -

python interpreter crashing when run second command. have searched web error , did not found anything. error showed below: python 2.7.5 (v2.7.5:ab05e7dd2788, may 13 2013, 13:18:45) [gcc 4.2.1 (apple inc. build 5666) (dot 3)] on darwin type "help", "copyright", "credits" or "license" more information. >>> print 1 1 >>> print 2 segmentation fault: 11 why? i'm using mac os x mavericks. think that's relevant since it's beta version. edit: forgot problem details provided osx: process: python [11053] path: /library/frameworks/python.framework/versions/2.7/resources/python.app/contents/macos/python identifier: python version: 2.7.5 (2.7.5) code type: x86-64 (native) parent process: bash [9217] responsible: terminal [3148] user id: 501 date/time: 2013-08-10 00:29:28.571 -0300 os version: mac os x 10.9 (13a524d) report version: 11 anonymous uuid:

security - htaccess rewrite to secure folder path -

i have application in folder want keep hidden. instead want able access folder secret path, example: current path: example.com/myfolder change path myfolder.example.com when visits example.com/myfolder want return page not found. i want make new path accessible ip. have tried various methods having no success. suggestions/examples appreciated. thanks in advance. 1st can use htaccess hide floder, put code inside of folder (the folder want hide), allow ip order deny,allow deny allow 127.0.0.1 (your ip) 2nd use htaccess set password authname "private zone" authtype basic authuserfile /pub/home/your_login/.htpasswd require valid-user .htpasswd (make anther file pw) username:your password 3rd www.example.com/myfolder->www.myfolder.example.com something.example.com sub domain it become public_html/all files , floder something/others files read 1 http://www.htpasswdgenerator.com/apache/htaccess.html

javascript - animating html elements - flexslider -

how animate html elements on each slide of flexslider after animations of slides. searched internet hours. not find tutorial or can help. couldsomeone show me , example of how it. link jsfiddle html <div class="flexslider"> <ul class="slides"> <li> <img src="http://placehold.it/350x150"> <div><h1>heading</h1></div> <div><h2>heading</h2></div> </li> <li> <img src="http://placehold.it/350x150"> </li> <li> <img src="http://placehold.it/350x150"> </li> <li> <img src="http://placehold.it/350x150"> </li> </ul> </div> js $('.flexslider').flexslider({ animation: "slide" }); $("div h1").fadein(3000); $("div h2").animate({left:'250px'}); you c

c# - Identifying class instances created without any variable name -

i going program windows phone app in c# , xaml. have created usercontrol called boxcontrol. means can create variables type. i create instances of control in nested loop, seen below. problem when create instances of control way have done it, how reference them in code later? how uniquely identify each instance? // = column, j = row (int i=0; i<4; i++) { (int j = 0; j < 3; j++) { boxlist.add(new boxcontrol()); grid.setcolumn(boxlist[(i*3)+j], i); grid.setrow(boxlist[(i*3)+j], j); boxgrid.children.add(boxlist[(i*3)+j]); boxlist[(i * 3) + j].addhandler(uielement.tapevent, new eventhandler<gestureeventargs>(boxcontrol_tap), false); } } for instance, if tap 1 of them on screen, specific control. have added handlers that, can't reference object. hope can help... not sure windows phone-app eventhandler, wpf , windows

c++ - Filesystem hooking -

im making virtual filesystem library want add .exes accomplish need hook windows file functions. i know there lot of functions high level api, there comprehensive list of low level functions used these ? what mean zwopenfile <- ntopenfile <- openfile etc (but usermode) what need minimal possible set of funcs hook cover whole filesystem handling. bit hard reversing windows api. i have basics covered (file reading , sure not complete) need file write / directory enum. what wierd example findfirstfilea uses zwopenfile zwopenfile hook. objectname : \??\d:\vfs\* handle : 20 ntquerydirectoryfilehook hook. handle : 20 ntquerydirectoryfilehook hook. handle : 20 d:/vfs/test d:/vfs/test2.txt d:/vfs/test3.txt ntquerydirectoryfilehook hook. handle : 20 zwopenfile hook. objectname : \??\d:\vfs\test\* handle : 24 ntquerydirectoryfilehook hook. handle : 24 ntquerydirectoryfilehook hook. handle : 24 d:/vfs/test/huh.txt ntquerydirectoryfilehook hook. handle : 24 zwopenfile hook.

html5 - preserve-3d not working in IE10 -

<body> <article class="viewport"> <section class="cube"> <div> <div class="part psm"><span data-href="#test">c1a</span></div> <div class="part rm"> <span data-href="#test">c1b</span></div> <div class="part ims" style="background: #f0e200;"><span data-href="#test">c1c</span></div> <div class="part bsm"><span data-href="#test">c1d</span></div> </div> <div> <div class="part ims" style="background: #f0e200;"><span data-href="#test">c2a</span></div> <div class="part bsm"><span data-href="#test">c2b</span></div> <div class="part pm"> <span data-href="#test&quo

algorithm - C++ Quick Sort Implementation, not having the right output -

i implementing quick sort algorithm cormen's algorithm book(clrs). vector<int> numbers = {5, 6, 3, 4, 1, 2, 7, 13, -6, 0, 3, 1, -2}; my_quick_sort(numbers.begin(), numbers.end()); it has no error, can not sort numbers. the pseudo code in book following. quicksort(a, p, r) if p < r q = partition(a, p, r) quicksort(a, p, q-1) quicksort(a, q+1, r) partition(a, p, r) x = a[r] i = p - 1 for j = p r - 1 _ _ _i= i+1; _ _ _exchange a[i] a[j] exchange a[i+1] a[r] return + 1; my implementation following. template<typename t> void swap(t a, t b) { typedef typename std::iterator_traits<t>::value_type value_type; value_type temp; temp = *a; *a = *b; *b = temp; } template<typename t> int partition(t begin, t end) { typedef typename std::iterator_traits<t>::value_type value_type; value_type x; x = *end; t = begin - 1; t j; for(j = begin; j != end+1; ++j) {

c - pointer changes value without being passed as argument -

following code snippet code involving transformations on binary tree. void fixprevptr(struct node *root) { static struct node *pre = null; if (root != null) { fixprevptr(root->left); root->left = pre; pre = root; fixprevptr(root->right); } } here 'pre' initialised in every function null. when function entered 'if' clause , root->left=pre , executed, pre being assigned not null. somehow changed function fixprevptr(root->left) . my question how changed without being passed function. thanks in advance. pre static keeps it's value call call. fixprevptr() recursive (calls itself) change pre "sticks".

python - Append to a list within a dictionary -

i want obtain output like {'episodes': [{'season': 1, 'plays': 0, 'episode': 11}, {'season': 2, 'plays': 0, 'episode': 1}], 'title': 'showname1', 'imdb_id': 'tt1855924'} {'episodes': [{'season': 4, 'plays': 0, 'episode': 11}, {'season': 5, 'plays': 0, 'episode': 4}], 'title': 'showname2', 'imdb_id': 'tt1855923'} {'episodes': [{'season': 6, 'plays': 0, 'episode': 11}, {'season': 6, 'plays': 0, 'episode': 12}], 'title': 'showname3', 'imdb_id': 'tt1855922'} but stuck on append line need append value inside dictionary. if title not in dictionary creates first entry title {'episodes': [{'season': 1, 'plays': 0, 'episode': 12}], 'title': 'third reich: rise & fall', '