Posts

Showing posts from September, 2011

java - Best approach to generate a dynamic key in security -

this question has answer here: how create secure random aes key in java? 3 answers a defined key used in this example : byte[] keybytes = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }; secretkeyspec key = new secretkeyspec(keybytes, "aes"); i need know recommended approach generate dynamic enhanced unpredictable key, when security working jax-ws , jax-rs web services. that's securerandom class in java for: securerandom random = new securerandom(); byte[] key = new byte[24]; // 24 or whatever key length random.nextbytes(key); securerandom provides " a cryptographically strong random number generator (rng) " according javadoc documentation. it's faulted being slow, not being insecure.

How to encrypt/decrypt javascript array, while using php -

i creating javascript array dynamically using php instance take 1 example here <?php echo "<script> var array={ 'a' : { 'a':123 , 'b':[[1,2],[3,4]] } }; function dum(arr) { window.alert(arr); } dum(array['a']['a']); </script>"; ?> in case array created holds important information not want share of client, since impossible mask view source in browser understood previous post, encrypt before echo in view source client won't able understand array is, array contains, , sending array function in case dum , inside function dum descrypt it, , process. i hope approach clear, negative voters kindly comment understand mistake. while encrypt data before sending client, if want you'll have send client instructions on

javascript - MultiSelect Dropdwon list value Move To Text Box -

i using javascript code copying field value field. when use check box in dropdown, have click check box value copy text-box. but selects single not multiple value in text box... <script> $(document).ready(function() { $("#dropdown").on('change',function(){ var dropdownval=this.value; $("#textbox").val(dropdownval); }); }); </script> <form> <p> <select multiple="multiple" name="dropdown" id="dropdown" style="width:370px"> <option value="red">red</option> <option value="green">green</option> <option value="blue">blue</option> <option value="orange">orange</option> </select> </p> <input type="text" class="normal" id="textbox" n

javascript - GetBoundingClientRect doesn't work outside the window -

i making script should measure distances in post. example, if have 3 posts: post 1: two lines of text, image want see. post 2: just image want see. post 3: the image want see followed 2 lines. the reason want this, because think tumblr displays nonsense in discriptions. making chrome extension crop nonsense around images have scroll less. on every posts apear button see whole post. as of today, works great! getboundingclientrect can top, left, bottom , right offset window. there 1 problem. can not posts on page right away, because if post 700px or more away of visible part of document, part you're viewing in browser, values provided gbcr 0. these values not valid, , 0 because post isn't rendered on screen. , make extension try dimensions if scroll, when post gets in visible part of window, processed. doesnt have preference. mean js functions have triggered every time user scrolls, bad practice. rather start functions when dom loaded, if new posts added, functi

c++ - Determining cascaded shadow map split ranges -

i'm doing cascaded shadow maps, , believe have problem concerning way split comparison select proper shadow map. stands, shadow mapping works overall in few cases @ angles not work. currently lighting shader stage looks this: "#version 420 const float depth_bias = 0.00005; layout(std140) uniform unifdirlight { mat4 mvpmatrix[4]; mat4 mcamviewmatrix; vec4 msplitdistance;

How to use JSON to parse data into android application -

i can not understand code. i beginner of android , java. how work doinbackground(void... params) , onpostexecute(string result) . how pass value on method mainacitivity. please me.thanks class downloadtask extends asynctask<void, void, string>{ @override protected string doinbackground(void... params) { string result=null; try { httpclient client=new defaulthttpclient(); httpget get=new httpget(urlstring); httpresponse response=client.execute(get); if(response.getstatusline().getstatuscode()==httpstatus.sc_ok){ inputstream in=response.getentity().getcontent(); bufferedreader reader=new bufferedreader(new inputstreamreader(in)); string line=reader.readline(); log.v(getclass().getsimplename(), line); return line; } } catch (exception e) { e.printstacktrace(); return null

objective c - iOS navigate from inital view to second view from the last view -

Image
below see view hierarchy. view green color last view. last view want show view, indicated black arrow. however when user wants navigate view, initial view (indicated yellow arrow) should presented. make segue last view "black arrow" view. how can show initial view (yellow arrow) when user goes back? method1: well, depends on segues, if of them push type, green vc embedded too. if is, can navigate through hierarchy via [self.navigationcontroller poptoviewcontroller:desiredviewcontroller animated:yes] . here method does: pops view controllers until specified view controller @ top of navigation stack. reference: uinavigationcontroller class method2: if still want use modal presentation, create weak delegate property bind greencontroller controller, presented (or use nsnotificationcenter listen dismiss modal view controller event). once user pressed on dismissing, controller presented greencontroller redirects no animation yellow one. create illusio

angularjs ng-model inside nested ng-repeat -

i don't know whether duplicate question or not. have started exploring angularjs. right facing problem. here example demo example when ever click first select drop down below gets updated. know due same ng-model. so, how generate different ng-model 2 different select drop down. please guide me new angularjs world you can bind color object you're displaying: <select ng-model="color.levelmodel" ng-options="c.id c in levels"> <option value="">-- choose color --</option> </select> or selecteds object this: <select ng-model="selecteds[$index].levelmodel" ng-options="c.id c in levels"> <option value="">-- choose color --</option> </select> where $index current index of color object inside colors collection.

Read and print string - Assembly -

i'm trying create program in assembly read character character, store in array , print character character. know can use interrupts read , print strings, want own code learn more. the code read, not know why not printing: buff dw 0,0,0,0,0,0 len equ 5 mov ah, 1 mov si, 0 read:               mov al b.buff[si]      int 21h      inc si      cmp si, len      jl read      jmp print      mov si, 0 mov ah, 2     print:      mov dl, b.buff [si]      int 21h      inc si      cmp dl, 0      je end      jmp print      end: you've done quite bit wrong. don't feel bad - nobody born knowing stuff. 1) don't tell assembler you're using. they're different! (looks maybe eric isaacson's a86?) 2) buffer declared "word"s, you're using "byte"s. won't harm. 3) buffer should in "data" section. you're going try execute buffer. mess quite badly. 4) in "read" loop, put 0 buffer al , read

javascript - Taking a screen shot from the console window to check if google tag manager has fired or not -

to check if google tag manager has fired or not go web console , take @ output shows if gtm has fired or not. first need go google tag manager preview view, , put in url (which need check gtm) in address bar , later have @ web console says if gtm particular url has got fired or not. since quite time taking, automate process taking snapshot of output in web console. body please advice how can done. thought of doing via phantom js, wasn't sure how, because there 2 things involved - (1) first, need go google tag manager preview view , key in url in address bar (2) need snapshot of output in console window. please advice how can go doing , if automation possible. try google tag assistant, chrome app store. it's decent tool helps lot troubleshooting , validating google tags such adwords, tag manager, analytics, etc. https://chrome.google.com/webstore/detail/tag-assistant-by-google/kejbdjndbnbjgmefkgdddjlbokphdefk?hl=en it offers tips how fix issues , verifies whe

javascript - making background inactive when a button is pressed -

Image
when click user name on twitter background becomes inactive , dark.just that: i want make website's background inactive when button pressed, how can that? note : , want solution should use make box appear/disappear middle of site when button pressed?i doig this. //in css .visible{ display: inline; } .hidden { display: none; } //in jquery $("#div1").click(function() { $('#div2').removeclass("visible").addclass("hidden"); } this called lightbox. first hit should make happy: https://www.google.nl/search?q=lightbox

c# - Can not apply indexing with[] to an expression of type method group." -

i working itextsharp c#.net , dealing rendertext method getting "can not apply indexing with[] expression of type method group." error in below "chunk location" section. here code: public virtual void rendertext(textrenderinfo renderinfo) { linesegment segment = renderinfo.getbaseline(); textchunk location = new textchunk(renderinfo.gettext(), segment.getstartpoint(), segment.getendpoint(), renderinfo.getsinglespacewidth()); **"//chunk location:"** debug.print(renderinfo.gettext()); location.posleft =renderinfo.getdescentline().getstartpoint[vector.i1])); //in below 4 lines getting error. location.posright = renderinfo.getascentline().getendpoint[vector.i1]; location.posbottom = renderinfo.getdescentline().getstartpoint[vector.i2]; location.postop = renderinfo.getascentline().getendpoint[vector.i2]; //chunk font size: (height)

html - media query device width or resolution -

i have problem media queries. i targeting (to start with) max-device-width of 1024px 1 stylesheet, , min-device-width of 1025px another, using percentages content adapts browser resizing. however, large 20inc screen uses same stylesheet 11.6inch screen, assume due resolution old computer 15inch screen uses other, smaller stylesheet? because usingpercentages main content area, area appears fine on large screen don't want content spread on whoe 20inch screen, on small 11.6inch screen looks tiny. what doing wrong? there best practice targeting devices , using percentages viable option? way content adapts browser resizing bit bit. i understand decent amount how media wueries work, love have method use sites, using device-width, width or resolution etc, @ minute find need keep adding stylesheets. thanks in advance it 11.6 inch screen has high pixel density screen (hidpi). give resolution equal 20 inch screen. have same style (max-device-width/min-device-width) t

jquery, why var won't add up and why I cannot see the added img -

just 2 things: why var check won't add up(it's 0), , fix it? second, why cannot add xmark images, after table. the setup of html have alphabet imgs inside td. user should click imgs alphabetically, every correct click img removed. if wrong, xmark appear. (not yet in code: after 3 wrongs, it's game over, , ask user if wants play again or go home) this jquery code: $("img").click(function(){ var error = 0; var check = 0; var letterarray = new array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); var clickedvalue = $(this).attr('name'); alert(check); if(clickedvalue ==letterarray[

handlebars.js - ember.js attribute binding and the event object -

so far, looks ember not work expected, , i'm hoping i've missed something. need iterate on model, blob of json made of arrays , objects, , build out form. when user marks checkbox, controllers action updates model. here's how want work... <form {{action 'answersupplied'}}> {{#each model.questions}} <h3>{{text}}</h3> {{#each answers}} {{input type='../type' answerid='id' data-bind-questionnum='../id' text}} {{/each}} {{/each}} </form> here's how can close that... <form {{action 'answersupplied' this}}> {{#each model.questions}} <h3>{{text}}</h3> {{#each answers}} {{formbuilder ../type id ../id text}} {{/each}} {{/each}} </form> ================== handlebars.registerhelper('formbuilder', function(type, id, qnum, text, options) { // console.log(options); var q_t

The exact meaning of [offset someData] in assembly language -

my question offset in assembly language i have written code below :(emu8086) data segment data1 dw 6 data2 dw 5 ends stack segment dw 128 dup(0) ends code segment start: mov ax, data mov ds, ax mov es, ax mov bx, [offset data1] mov ax, [offset data2] mov ax, 4c00h ; exit operating system. int 21h ends end start ; set entry point , stop assembler. i excepted when type [offset data1] receive 6 , when type [offset data2] receive 5. my reason : offset gives address of data , sign [] give content of mentioned place of memory. when use [offset data1] should receive data1 (here 6) but result thing else. after running code ax 0006h , bx 0000h , can't understand why. can please me understand meaning of [offset somedata] ? i know basic i'm new in assembly. thanks in advance attention i tried assemble code tasm , received bx=0 , ax=2 expected: cs:0000 b88f4e mov ax,4e8f cs:0003 8ed8 mov ds,ax cs:0005 8ec0

python - How to build an xml template with variable attributes from scratch -

my goal build xml template placeholders variable attributes. reasons, template not take in new data placeholders. here's example: x=2*5 xmltemplate=""" <personal reference="500.txt"> <others:sequence> <feature:name="name" age="age" dob="dob"/> </others:sequence> </personal>""".format(name='michael', age=x, dob=15/10/1900) print xmltemplate output: <personal reference="500.txt"> <others:sequence> <feature:name="name" age="age" dob="dob"/> </others:sequence> </personal> ideal output: <personal reference="500.txt"> <others:sequence> <feature:name="michael" age="10" dob="15/10/1900"/> </others:sequence> </personal> any ideas? thanks. your template needs curly braces:

How to create a custom POST request service in Angularjs -

i have simple service that: packlightapp.factory('hike', ['$resource', function ($resource) { return $resource('app/rest/hikes/:id', {}, { 'query': { method: 'get', isarray: true}, 'get': { method: 'get'}, }); }]); i want add new method send array backend in order save it. don't know right syntax usecase , how can catch in backend. backend coded in java. example (case of simple post request): @requestmapping(value = "/rest/hikes", method = requestmethod.post, produces = "application/json") public void create(@requestbody hikedto hikedto) {...} thanks help. you can use de 'save' method $resource app.controller('postctrl', function($scope, hike) { var objectarray = [{data: 1}, {data: 2}]; hike.save({id: 'yourid'}, objectarray, function(response) { console.log(response);

python - Read entire group in an HDF5 file using a pandas.HDFStore -

i have hdf file that: >>> dataset.store ... <class 'pandas.io.pytables.hdfstore'> ... file path: ../data/data_experiments_01-02-03.h5 ... /exp01/user01 frame_table (typ->appendable,nrows->221,ncols->124,indexers->[index]) ... /exp01/user02 frame_table (typ->appendable,nrows->163,ncols->124,indexers->[index]) ... /exp01/user03 frame_table (typ->appendable,nrows->145,ncols->124,indexers->[index]) ... /exp02/user01 frame_table (typ->appendable,nrows->194,ncols->124,indexers->[index]) ... /exp02/user02 frame_table (typ->appendable,nrows->145,ncols->124,indexers->[index]) ... /exp03/user03 frame_table (typ->appendable,nrows->348,ncols->124,indexers->[index]) ... /exp03/user01 frame_table (typ->appendable,nrows->240,ncols->124,indexers->[index]) from want retrieve users (userxy) 1 of experiments (exp0z) , append them single big dataframe. have tried s

java - Using FileWriter with try catch, for IOExeption with several issues -

as said above have several issues. trying export array list 'inventory' .txt file. here code, more welcome! import java.io.filewriter.*; import java.io.*; private void exportgoactionperformed(java.awt.event.actionevent evt) { filewriter writer; try { writer = new filewriter("inventory.txt"); for(string str: inventory) { writer.write(str); } writer.close(); }catch (ioexeption e){ alertout.settext("i'm afraid file not writen @ time."); } { try { writer.close(); } catch (ioexception ignore){} } public static void main(string args[]) { on line 12: can not find symbol: class ioexeption. on line 18: reached end of file while parsing. on line 20: illegal start of expression. here full code: /* * change template, choose tools | templates * , open template in editor. */ import java.util.*; import java.io.

java - Android Object Animation xml -

i trying create translate image (ball) using xml objectanimator. when try reference objectanimator xml file, says getapplicationcontext() might return null. when flash phone, crashed immediately. when take out line , setanimationlistener line, works. however, if there 1 of lines, not work. mainactivity.java public class mainactivity extends actionbaractivity implements animation.animationlistener{ imageview ball; button moveb1; animation move; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ball = (imageview) findviewbyid(r.id.ball); moveb1 = (button) findviewbyid(r.id.move1); move = animationutils.loadanimation(getapplicationcontext(), r.animator.move); move.setanimationlistener(this); } } move.xml <set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="together"> <objectanimator

angularjs - How to watch a function return value in JavaScript -

in browser, object, property has getter , setter. can override them watch attribute. how return value of function? in angularjs, use 'ng-show' control visibility of component. can write this: <any ng-show="afunction()"> ... </any> the function may defined as: var tmp = false; $scope.afunction = function() { return tmp; }; if in runtime, 'tmp' changed true, < > show up. how angularjs know return value changed? there timeout function check changes regularly? there no timeout function. there angularjs-specific concept, called "digest-cycle". can learn more scope life-cycle docs. have found this article quite useful introduction mechanism. finally, sure there plenty of related answers here on so. in general, should try find out functions $apply() , $digest() , $watch() do.

javascript - How do i make a simple graph for each correct answer -

i have big test coming tomorrow, , i'm not quite sure how draw graph each time correct answer, nor can find/search solution. simply, want cavas add x height on column/pillar each time answer correct, in javascript. if show me how it, while using code on site: http://www.javascriptsource.com/miscellaneous/basic-javascript-quiz.html amazing! edit: column/piller this: (not sure). var c=document.getelementbyid("mycanvas"); var ctx=c.getcontext("2d"); ctx.fillstyle="#ff0000"; ctx.fillrect(0,0,150,100); edit 2: <script> var score = 0; var questions = [ ['how many moons earth have?', 1], ['how many moons saturn have?',31], ['how many moons venus have?', 0] ]; (var i=0; i<questions.length; i++) { askquestion(questions[i]); } function askquestion(question) { var answer = prompt(question[0],''); if (answer == question[1]) { alert('correct!'); score++; } else

php - can't get stream_set_timeout to work in foreach array loop -

i'm not familiar php have been able script running check if port open number of local network computers. downside pc's offline , can't timeout of fsockopen function lower 1 second (0.001 second enough) i've found *stream_set_timeout* function can't seem work. i'm pretty sure it's in wrong place, , hope can point out should go. now error: warning: stream_set_timeout() expects parameter 1 resource, boolean given snippet: $timeout = 1000; foreach ($farm $pc){ $check = @fsockopen($pc, $port); stream_set_timeout($check,0,$timeout); if (is_resource($check)) { echo $pc . " online"; fclose($check); } else { echo $pc . " offline"; } } current solution: foreach ($farm $pc){ $check = @fsockopen($pc,$port,$errcode,$errstr,0.001); if (is_resource($check)) { echo $pc . " online"; fclose($check); } else { echo $pc . " offline"; } }

.htaccess - htaccess 301 redirect /%C2%A0/ -

i trying 301 redirect via htaccess http://www.domainname.co.uk/%c2%a0/ http://www.domainname.co.uk/ can not work i having lot of trouble /%c2%a0/ great thanks try: rewriteengine on rewriterule ^\xc2\xa0/?$ / [l,r=301] or if have use mod_alias: redirectmatch 301 ^/\xc2\xa0/?$ /

c# - How to add an array to a list by value not by reference? -

is there way add array list of arrays value , not reference? example: following prints out "6, 7, 8, 9, 10". want write out "1, 2, 3, 4, 5". int[] testarray = new int[5] { 1, 2, 3, 4, 5 }; list<int[]> testlist = new list<int[]>(); testlist.add(testarray); testarray[0] = 6; testarray[1] = 7; testarray[2] = 8; testarray[3] = 9; testarray[4] = 10; foreach(int[] array in testlist) { console.writeline("{0}, {1}, {2}, {3}, {4}", array[0], array[1], array[2], array[3], array[4]); } make copy: testlist.add(testarray.toarray());

javascript - Executing or reloading a script after another sript was loaded -

i've written code have choice between images , when click on 1 of them appears in placeholder: home.php <div id="templates" class="row"> <?php while ($one = $templates->fetch()) { ?> <div class="col-xs-3 col-md-2"> <a class="thumbnail" data-price="<?= $one['price'] ?>" data-id="<?= $one['id'] ?>"> <img id="imgtemp" onclick="changeimage('../files/templates/blank/<?echo($one['id'])?>.jpg');changesize();" src="/files/templates/example/<?= $one['id'] ?>.jpg" alt="<?= $one['titlep'] ?>"> </a> </div> <?php } ?> </div> <div> <img id="imgdi

javascript - uploading form data with a binary image to sql server -

my goal user able upload image data fields. far can 1 or other work. code below enables me upload image sql database binary. need uploading data fields , image in same form. in advance view <form ng-submit="submititem()" enctype='multipart/form-data'> <input class="form-control" type="text" ng-model="itemname" placeholder="name" /> <input class="form-control" type="text" ng-model="itemcategory" placeholder="category" /><br /> <input class="form-control" type="text" ng-model="itemdescription" placeholder="description..." /> <input id="fileupload" class="form-control" type="file" ng-model="imageurl" placeholder="image" /> <input class="form-control" type="number" ng-model="itemprice" placeholder="price" /><br

php - 24 hours time are only showing 12 hours time -

i'm working on php i'm making 24 hours format script including year, month , day date format. however, have got little problem code. in code, shows have 24 hours time can hours 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 , 23 shows 12pm, 1pm, 2pm...etc. when have 24 hours supposed have 00 12am, can 12. the same things goes 1am (hour show 1), 2am (hour show 2), 3am (hour show 3). here output: <tv generator-info-name="www.myscript.com/xmltv"> <channel id="101 abc family"> <display-name>101 abc family</display-name> <programme channel="101 abc family" start="20140406153000" stop="20140406183000"> <title lang="en"/> <sub-title lang="en"/> <desc lang="en"/> <category lang="en"/> </programme> <programme channel="101 abc family" start="20140406183000" stop="20140406210000"> <title lang=&q

Python % Percent -

i wondering if can me understand following python calculation answer calculates 97 : 100 - 25 * 3 % 4 i understand % sign in python represents remaining of amount, however, i'm still not seeing how answer comes out 97 . if break calculation down understand grateful.. thanks! it's evaluated in order python: explanation of sum * , % take precedence on - , first evaluate 25 * 3 % 4 . * , % have same priority , associativity left right, evaluate left right, starting 25 * 3 . yields 75 . evaluate 75 % 4 , yielding 3 . finally, 100 - 3 97 .

geofencing - Android: Trigger an event when the user exits a geofence -

is there way define geofence (center , radius) around device's current location, , have system trigger callback function in app when device exits geofence? i avoid extensive gps usage, prefer system message on periodic gps polling, @ price of reduced accuracy. use geofence api in google play services . here can find documentation use it. can have 100 geofences @ time.

bytearray - In Java, how do you iterate over the bits of two byte arrays? -

for 2 byte arrays , b of equal length, i'd find first unset bit in byte array set in byte array b, , return zero-based index or position of bit. how can so? for example: a: 1111 0000 0101 b: 1111 0000 1010 ^ try this: int length = a.length<b.length? a.length:b.length; (int i=0; i<length; i++) { int x = a[i]^b[i]; if (x != 0) { (int j=0; true; j++) { if ((x&1) == 1) return byte.size*i+j; x >>= 1; } } } return -1;

android - Iterating through rows of SQLite table to update ids -

i'm working on android app sqlite database. i have table called reminder (with 2 columns: reminder_id , reminder_value) , allowing user delete record table. reasons take bit explain, need reminder_id column have sequential numbers. so, if user deletes row 2, need eliminate gap, row 3 becomes row 2, row 4 becomes row 3, etc.. i wrote method in dbhelper class update of db whenever row deleted, i'm not sure whether best way it. below method delete row reminder table. can see, before delete row, check whether it's last row or not, because if don't have bother updating ids. public void deletereminder(int reminder_id){ sqlitedatabase db = this.getwritabledatabase(); string selectquery = "select max(" + column_reminder_id + ") " + reminders_table; cursor cursor = db.rawquery(selectquery, null); int maxid = cursor.getint(cursor.getcolumnindex(column_reminder_id)); db.delete(reminders_table, column_reminder_id + "= ?&quo

meteor - How to redirect after user has just logged in or just logged out -

it seems deps.autorun way go router.go doesn't seem work within deps.autorun. here example 3 routes: index , signin , dashboard : router.configure({layouttemplate: 'layout'}); router.map(function() { this.route('index', {path: '/'}); this.route('signin'); this.route('dashboard'); }); var mustbesignedin = function(pause) { if (!(meteor.user() || meteor.loggingin())) { router.go('signin'); } else { this.next(); } }; var gotodashboard = function(pause) { if (meteor.user()) { router.go('dashboard'); } else { this.next(); } }; router.onbeforeaction(mustbesignedin, {except: ['signin']}); router.onbeforeaction(gotodashboard, {only: ['index']}); if user on index page , logged in, automatically routed dashboard page. on page except signin , if user not logged in routed signin page. onbeforeaction reactive these rules enforced if user logs in or out. of course

python - Why isn't the ball bouncing back? -

i'm making simple pong game, when ball drops ceiling, doesn't bounce , forth. goes off screen. can't figure out why happening! concerned ball bouncing off top , bottom of screen , want bounce , forth in straight path. appreciated! edit: i've found problem! help! here's base code: import math import random import sys, pygame pygame.locals import * import ball import colors import paddle # draw scene def draw(screen, ball1, paddle1) : screen.fill((128, 128, 128)) ball1.draw_ball(screen) paddle1.draw_paddle(screen) #function start main drawing def main(): pygame.init() width = 600 height = 600 screen = pygame.display.set_mode((width, height)) ball1 = ball.ball(300, 1, 40, colors.yellow, 0, 5) paddle1 = paddle.paddle(250, 575, colors.green, 100, 20) while 1: event in pygame.event.get(): if event.type == quit: sys.exit() elif event.type == pygame.keydown: if event.key == pygame.k_right:

dynamics crm - MS CRM 2013 Online OAuth unsupported_grant_type - authorization_code -

we have asp.net mvc 4 application runs inside iframe in ms crm 2013. web application uses ms crm web services (organization web service) retrieve , save data. so, needs authenticate. on-premises using windows authentication , impersonate logged user in ms crm (user id passed iframe url). works charm. however ms crm 2013 online, since want avoid storing user credentials in our application, have chosen use oauth. suggestion how achieve same in different way welcome since not seam right use method non-dot-net clients. we able code calling: https://login.windows.net/{0}/oauth2/authorize?response_type=code&resource={1}&client_id={2}&redirect_uri={3} . when ask token, 400 bad request error. request method: post url: https://login.windows.net/{0}/oauth2/token?api-version=1.0 header: user-agent: fiddler host: login.windows.net content-length: 563 content-type: application/x-www-form-urlencoded body: grant_type=authorization_code&code={0}&redirect_uri={

python - Segmentation Fault? No error I’ve seen… -

i have code: from tkinter import * def get_info(key): pass#do more later def create_new(): create = toplevel(root) create.title('create new contact') label(create, text='name: ').grid(row=0, sticky=w+e) name = entry(create, width=8).grid(row=1, sticky=w+e) label(create, text='address(ex. 1111 main st, mycity, anystate 12345): ', wraplength=1).grid(row=2, sticky=w+e) address = entry(create, width=8).grid(row=3, sticky=w+e) def access(): access_window = toplevel(root) access_window.title("access contact") label(access_window, text="enter first name: ").grid(row=0, sticky=w+e) access_key = entry(access_window, width=8).grid(row=1, sticky=w+e) button(access_window, text="submit", command=lambda: get_info(access_key.get('0.0', 'end-1c'))).grid(row=2, sticky=w+e) root = tk() root.title('address book') button1 = button(root, text="create new", command=c