Posts

Showing posts from April, 2010

c# - How to send a proper message to Console application using user32.dll's SendMessage -

i'm trying send text console when requires console.readline() input, different thread (windows form textbox). problem can't seem figure out how send text , have show wrote it. example: "test test 123" show in console as: test test &é" image: http://puu.sh/gijw8/e9f4d94bd5.png using system; using system.windows.forms; using system.io; using system.runtime.interopservices; using system.diagnostics; namespace consoleapplication1 { public partial class form1 : form { [dllimport("user32.dll", entrypoint = "postmessagea")] private static extern bool postmessage(intptr hwnd, uint msg, intptr wparam, int lparam); [dllimport("user32.dll")] static extern short vkkeyscan(char ch); [dllimport("user32.dll", entrypoint = "sendmessagea")] public static extern int sendmessage(intptr hwnd, int umsg, int wparam, string lparam); [dllimport("kernel32

Use of All CAPS in Scala Code -

the common practice in java use caps static final variables: static final int my_constant = 24 i believe common practice in scala val use: val myconstant = 24 is there accepted place use caps, in java, in scala? according the official guidelines : no. in practice all_caps means "all caps, separated underscores," , scala doesn't want using underscores in names. generally speaking, scala uses “camelcase” naming conventions. is, each word (except possibly first) delimited capitalizing first letter. underscores ( _ ) heavily discouraged have special meaning within scala syntax.

Swift and watchkit: pushControllerWithName not being called at all -

i have used pushcontrolledwithname method in swift/watchkit move interface controller, this: self.pushcontrollerwithname("newinterfacecontroller", context: nil) in of projects, when put in function (like user presses button) doesn't called @ all. no errors, if code isn't there @ all. if create new test project , try it works. baffled what's going on here. example of happens: @ibaction func button1action() { println("test") self.pushcontrollerwithname("newinterfacecontroller", context: nil) } pressing button print "test" in console, doesn't try move new interface controller (with identifier "newinterfacecontroller") @ all. i think you've figured out comments, page-based interfaces technically modals , not navigation-stack interfaces. you can present modals anywhere, can push onto navigation stack non-modal.

using Regex and linux commands(grep or egrep?) to find specific strings -

note : not sure regex's correct since textbook @ school not explain/teach regex's of form of math form such dfa's/nfa i appreciate suggestions or hints question: (a) find occurrences of 3 letter words in text begin `a' , end 'e'; (b) find occurrences of words in text begin `m' , end 'r'; my approach: a) ^[a][a-za-z][e]$ (how distinguish between 3 letter words , words?) b) ^[m][a-za-z][r]$ also want use these regex's in linux following command work?: grep '^[a][a-za-z][e]$' 'usr/dir/.../text.txt' or should use egrep in way: find . -text "*.txt" -print0 | xargs -0 egrep '^[a][a-za-z][e]$' you can use word boundary \b match start , end of word: a) find occurrences of 3 letter words in text begin `a' , end 'e'; grep -o '\ba[a-za-z]e\b' the pattern matches word boundary, following a , single character , following e , word boundary. b) find occurrence

jquery - Overlapping table td elements using E-shopper template -

Image
i using template little project , have been stuck on part while, elements of table overlapping when there many words inside td. link specific page: here also if resize browser notice overlapping if there not many words inside description td. for tried using max-width set width still not favorable result since there still overlapping present. is there anyway me around problem or solve it? also responsive template. the content of description this: tired of bones while eating? try our boneless chicken breast can swallow whole , no bones worry about. you need set width .cart_info table tr td . example: .cart_info table tr td{ width: 30%; } or if want target .cart_description .cart_info table tr .cart_description{ width: 30%; } i made width: 30% testing purposes. can specify whatever width want.

cron - perl search replace is appending not replacing -

i have perl script in cron runs every x minutes. suppose find string , replace string more data: s/remote_phonebook.data.1.name =/remote_phonebook.data.1.name = users/; i expect this: before: remote_phonebook.data.1.name = after: remote_phonebook.data.1.name = users the first time runs works fine. however, each additional time appends end of line 3 cron jobs later see: remote_phonebook.data.1.name = users users users how can make if "users" doesn't exist, add it, if exists, ignore? if each 1 of these new line try: $s =~ s/remote_phonebook\.data\.1\.name =( users|$)/remote_phonebook.data.1.name = users/; if not, please let me know on comments.

arrays - using python itertools to manage nested for loops -

i trying use itertools.product manage bookkeeping of nested loops, number of nested loops not known in advance. below specific example have chosen 2 nested loops; choice of 2 clarity, need solution works arbitrary number of loops. this question provides extension/generalization of question appearing here: efficient algorithm evaluating 1-d array of functions on same-length 1d numpy array now extending above technique using itertools trick learned here: iterating on unknown number of nested loops in python preamble: from itertools import product def trivial_functional(i, j): return lambda x : (i+j)*x idx1 = [1, 2, 3, 4] idx2 = [5, 6, 7] joint = [idx1, idx2] func_table = [] items in product(*joint): f = trivial_functional(*items) func_table.append(f) at end of above itertools loop, have 12-element, 1-d array of functions, func_table , each element having been built trivial_functional. question: suppose given pair of integers, (i_1, i_2), these integers inte

drupal - Google Maps - Lock Position -

i use content management system (drupal) work website , wondering if there way lock google map position doesn't jar on place when user clicks on balloons? i'm aware there helpful suggestion here disable mouse scroll wheel zoom on embedded google maps can't manipulate javascript or css. any give appreciated. i think can add event listener listen event center_changed there sample event example in documentation map listen center_changed , wait 3 seconds before recenter map. i think can implement similar no time delay "lock" position of map. you can refer documentation regarding center_changed here.

javascript - Why is jQuery deleting last character of text? -

i have following jquery working in confluence page user input , auto-suggested links, , post them both forms in external page. user input coming out last character truncated. no matter length, lops off last letter. for example if user types foobar post sends fooba . if user types foobar foobar foobar , turns foobar foobar fooba , on. the code matters following: $( document ).ready(function() { $('form.aui').on('keypress', showhead); function showhead() { $('.suggesthead').delay(500).fadein(300); $('.alertreq, .asterisk').css('visibility', 'hidden'); var dropdowntext = ($( "div.searchcontainer2 a.content-type-page span" ).text()); $('#capture').val( dropdowntext ); var inputvalue = $("#input2").val( ); $('#describe' ).val( inputvalue ); }; }); it's #describe value that's problem. there's built-in confluence field gave id of "#in

Dynamic partitioning in google cloud dataflow? -

i'm using dataflow process files stored in gcs , write bigquery tables. below requirements: input files contain events records, each record pertains 1 eventtype; need partition records eventtype; for each eventtype output/write records corresponding bigquery table, 1 table per eventtype. events in each batch input files vary; i'm thinking of applying transforms such "groupbykey" , "partition", seems have know number of (and type of) events @ development time needed determine partitions. do guys have idea partitioning dramatically? meaning partitions can determined @ run time? why not loading single "raw" bigquery table , using bigquery api determine different number of events , export each event type own table (e.g., via https://cloud.google.com/bigquery/bq-command-line-tool#createtablequery ) or api call? if input format simple, can without using dataflow @ , more cost efficient.

java - TextArea not responsing -

i have tried setting text in textarea while clicking on button, no text shows up. can do? i want find prime numbers number textfield, textarea not responding? package primnum; import java.awt.borderlayout; import java.awt.dimension; import java.awt.flowlayout; import java.awt.font; import java.awt.gridlayout; import java.awt.scrollpane; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.*; public class pframe extends jframe { private jlabel l1,l2, l3; private jtextfield f1 ; private jbutton b; private jtextarea t; private jpanel p ,p1,p2; private string s, s2, s3; private int m ; private font f; public pframe(){ super("prime numbers"); //setlayout(new gridlayout(3,1)); s = new string("enter number (n)"); f = new font("sansarif" , font.bold,14); l1 = new jlabel(s); l3=new jlabel(" "); l1.setfont(f); p = new jpanel();

python - Creating a log-linear plot in matplotlib using hist2d -

Image
i wondering if can done. have tried set bins explicitly using numpy logspace, , have tried set xscale 'log'. neither of these options work. has ever tried this? i want 2d histogram log x-axis , linear y-axis. the reason it's not working correctly plt.hist2d uses pcolorfast method, more efficient large images, doesn't support log axes. to have 2d histogram works correctly on log axes, you'll need make using np.histogram2d , ax.pcolor . however, it's 1 line of code. to start with, let's use exponentially spaced bins on linear axis: import numpy np import matplotlib.pyplot plt x, y = np.random.random((2, 1000)) x = 10**x xbins = 10**np.linspace(0, 1, 10) ybins = np.linspace(0, 1, 10) fig, ax = plt.subplots() ax.hist2d(x, y, bins=(xbins, ybins)) plt.show() okay, , good. let's see happens if make x-axis use log scale: import numpy np import matplotlib.pyplot plt x, y = np.random.random((2, 1000)) x = 10**x xbins = 10**np

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

c++ - Static classes C ++ -

#include"stdafx.h" #include"iostream" using namespace std; static class base{ public: int = 3; }; int main(){ base ob; system("pause"); return 0; } please tell me, "static" in class declaration? "please tell me, "static" in class declaration? thank." it nothing, ignored compiler (with vs 2013 seems). there's warning issued this: source_file.cpp(9) : warning c4091: 'static ' : ignored on left of 'base' when no variable declared see live compiler sample here please .

javascript - Building an HTML Widget to embed paid content - how to secure communication with the backend? -

i'm creating widget shows content when page visitor pays it. i'm handling payment form inside widget , i'm using stripe credit card handling, charges, etc. my problem is: want make easy user pay content, right now, i'm working proof of concept ask email, then: check if have email on system, check api server if has payment product associated , let user content. if email not present in system, created, , return stripe publishable key. if email present, has no payment associated product, return stripe publishable key. when widget gets stripe key, shows payment (credit card) form, used stripe token, , token, along email, sent api server. if ok, widget retrieves content , shows user. now, question(s): how secure communication between widget , server, besides using https? have support application id/secret pairs, how can use them to authenticate requests widget server? widget inserted in pages on arbitrary domains, using referer / origin headers out of questio

python - Idiomatic way to process lists and dicts -

recently i've been discovering "the python way" of processing lists, dicts, sets, etc. extent i've modified function calculate first n prime numbers, let's call 'pure dict' version: def findprimeuptog(x): n_primes = {} in range(2, x): if not in n_primes.values(): n_primes[i]=i k, v in n_primes.items(): if > v: n_primes[k] += k return sorted(n_primes) this function works follows: maintain list of primes , list of integer multiples of same primes in dict those multiples should bigger or equal integer i if number not present in list of integer multiples of existing primes must prime , added list of primes increase i starting 2 (smallest prime), x return list of primes i've rewritten function several times using lists, sets, version seems idiomatic one. short , reads easily. if kind enough let me know if written more clearly, please comment love read it. and

azure - How to delete a document in documentdb using c# where i have variable with timestamp by quering it -

i have document in data following format. [ { "timestamp": "3/18/2015 7:57:21 pm", } ] i need query document date(3/18/2015) , delete document using c#. time in timestamp (7:57:21 pm) should not queried. how can it? if there multiple records same date, need delete documents. thanks naveen today need know doc._self delete document. query document(s) based on criteria like, including timestamp (no reason not use this, it's there reason). execute delete statement against each document found. if want in batch minimize server roundtrips, consider doing in stored procedure, similar our published bulkimport.js script.

java - IllegalArgumentException: Unknown URL content:// CONTENT -

illegalargumentexception: unknown url content:// ^ having nightmare above. i've checked variables , paths can't see issue is? appreciate pointers! here's trace. java.lang.illegalargumentexception: unknown url content://com.purewowstudio.topmovies.data.filmprovider/film_data @ android.content.contentresolver.insert(contentresolver.java:1203) @ com.purewowstudio.topmovies.data.databasehelper.addfilm(databasehelper.java:52) @ com.purewowstudio.topmovies.fragments.filmlist$getfilms.onpostexecute(filmlist.java:72) @ com.purewowstudio.topmovies.fragments.filmlist$getfilms.onpostexecute(filmlist.java:62) @ android.os.asynctask.finish(asynctask.java:632) @ android.os.asynctask.access$600(asynctask.java:177) @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:645) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.ap

java - Android: Double-Tap zooms out bitmap image when it's not supposed to...? -

i'm building app generate circles on bitmap when user double taps screen. when user pinches in or pinches out, image zooms in , zooms out, , when use 1 finger image can dragged around. i wrote code draw circle on bitmap when user double-taps, , works except image gets zoomed way out after draws circle...is wrong gesturedetector class wrote (the class @ bottom of following code:) public class zoominzoomout extends imageview { private static final string tag = "zoomableimageview"; private bitmap imgbitmap = null; private int containerwidth; private int containerheight; paint background; //matrices used move , zoom image matrix matrix = new matrix(); matrix savedmatrix = new matrix(); pointf start = new pointf(); float currentscale; float curx; float cury; //we can in 1 of these 3 states static final int none = 0; static final int drag = 1; static final int zoom = 2; int mode = none; //for animating stuff float targetx; float targety; float targetscale; float

java - Android service stops after less than 5 minutes -

i creating android application needs send udp packets server. the problem after 2-5 minutes, after screen off, service stops sending data, until turn screen on (can confirm on server side). here service start command: startservice(new intent(getbasecontext(), service.class)); the onstartcommand: @override public int onstartcommand(intent intent, int flags, int startid){ toast.maketext(this, "armed!", toast.length_long).show(); (new thread(new app())).start(); return start_redeliver_intent; } and run method, app thread: public void run(){ vibrator alarm = (vibrator) mainactivity.getappcontext().getsystemservice(context.vibrator_service); string ip = getwifiip(mainactivity.getappcontext()); while(true){ while (ip.equals(wifiaddr)){ //confirm presence on local network, host //unlocked door system.out.println("started locally!"); senddata(key, hostaddrlocal); try {

angularjs - Mapping array items to repeated list -

here's unsophisticated version of want achieve: $scope.colors = [{ "name": "red" },{ "name": "orange" },{ "name": "yellow" }]; <ul> <li>{{colors[0].name}}</li> <li>{{colors[1].name}}</li> <li>{{colors[2].name}}</li> <li></li> <li></li> </ul> but i'd more dynamically. is, repeat 5 list items each containing item array colors may contain 5 items (in case 3). you way span here.. <ul> <li ng-repeat="i in [1,2,3,4,5]"> <span ng-if="i<=colors.length">{{colors[i].name}}</span> </li> </ul>

matlab - Replace each element in a matrix with a diagonal matrix -

say have matrix of dimension nxv. want create larger matrix of size ntxvt, i.e. want replace each element e of matrix a(e) diag(t)*a(e)., while keeping general orientation of matrix (for instance, a(e) left of a(e-1), diag(t)*a(e) left of diag(t)*a(e-1). is there trick accomplish in matlab? (making each diagonal matrix , concatenating them take forever). many ^^ a = magic(3); t = diag([-1 1]); kron(a,t) gives -8 0 -1 0 -6 0 0 8 0 1 0 6 -3 0 -5 0 -7 0 0 3 0 5 0 7 -4 0 -9 0 -2 0 0 4 0 9 0 2 ps. copied idea this example

OpenStreetMap SDK for Android -

hello everybody, search openstreetmap sdk android development. can offer something... thanks. the android cookbook (www.androidcookbook.com) has openstreetmap articles .

command line - Yeoman generator issues Error: spawn ENOENT -

i went start new project though yeoman , wouldn't let me saying don't have generators installed. though have run yeoman , generated projects no issues before. when go install new generator's error. /home/darryl/dev/npm/lib/node_modules/yo/lib/routes/install.js:161 throw err; ^ error: spawn enoent @ errnoexception (child_process.js:988:11) @ process.childprocess._handle.onexit (child_process.js:779:34) and frank have no clue means, understand , fix great help. **update okay posted questions didn't help. error getting seemed have been red herring npm had become uninstalled. re-installing has fixed issues re-installing npm has fixed issues.

how to implementation "graph.facebook" in php file -

i want use http://graph.facebook.com/xxx in site how php file have use system , show facebook details when enter link? xxx = userrname i want site show details of facebook user enter site i tried nothing, dont want make ap this: <?php session_start(); require_once 'autoload.php'; use facebook\facebooksession; use facebook\facebookrequest; use facebook\graphuser; use facebook\facebookrequestexception; use facebook\facebookredirectloginhelper; $api_key = 'facebook_app_id'; $api_secret = 'facebook_app_secret'; $redirect_login_url = 'http://www.yoursite.com/somefolder/file.php'; // https://www.webniraj.com/2014/05/01/facebook-api-php-sdk-updated-to-v4-0-0/ // initialize app using key , secret facebooksession::setdefaultapplication($api_key, $api_secret); // create helper opject needed create login url // $redirect_login_url page visitor come after login $helper = new facebookredirectloginhelper( $redirect_login_url); // first check i

ios - UITableViewCell header display drawing issue with NSFetchedResultsController delegate using NSManagedContextDidSaveNotification implementation -

Image
i have implemented nsfetchedresultscontroller delegate nsmanagedcontextdidsavenotification push managed objects changes nsmanagedobjectcontext connected common nspersistentstorecoordinator . when managed objects first batch imported , after nsfetchedresultscontrollerdelegate methods called, result of cell drawing contains section looks this: it display/drawing bug section header gets drawn cell. header , cell actual valid header , cell appear further down. it happens first time managed objects created in batch. if restart app , managed objects imported controller displays fine it's import process, typical nsfetchedresultscontrollerdelegate implementation (pasted below): - (void)controllerwillchangecontent:(nsfetchedresultscontroller *)controller { [_tableview beginupdates]; } - (void)controller:(nsfetchedresultscontroller *)controller didchangesection: (id <nsfetchedresultssectioninfo>)sectioninfo atindex:(nsuinteger)sectionindex for

php - Yii active record relation limit to one record -

i using php yii framework's active records model relation between 2 tables. join involves column , literal, , match 2+ rows must limited ever return 1 row. i'm using yii version 1.1.13, , mysql 5.1.something. my problem isn't sql, how configure yii model classes work in cases. can classes work (simple eager loading) not (never lazy loading). first describe database. goal. include examples of code i've tried , why failed. sorry length, complex , examples necessary. the database: table sites columns: id int name varchar type varchar rows: id name type -- ------- ----- 1 site foo 2 site b bar 3 site c bar table field_options columns: id int field varchar option_value varchar option_label varchar rows: id field option_value option_label -- ----------- ------------- ------------- 1 sites.type foo foo style site 2 sites.type bar bar-li

ios - How to play 2 video at the same time? -

i'am trying play 2 video in 1 screen via mpmovieplayercontroller everytime 1 of them plays. playvideo function: func playvideo() { let url = nsurl(string: videourls[videonumber]) movieplayer = mpmovieplayercontroller(contenturl: url) if let player = movieplayer { player.view.frame = cgrect(x: 0, y: 200, width: 200, height: 200) player.shouldautoplay = true player.preparetoplay() player.scalingmode = .aspectfill player.controlstyle = .none player.allowsairplay = false self.view.addsubview(player.view) } let backurl = nsurl(string: videourls[videonumber+1]) backplayer = mpmovieplayercontroller(contenturl: backurl) if let player = backplayer { player.view.frame = cgrect(x: 0, y: 0, width: 200, height: 200) player.shouldautoplay = true player.preparetoplay() player.scalingmode = .aspectfill player.controlstyle = .none player.allowsairplay = false

java - Android: Draw Rectangle Over Another Rectangle on Canvas -

i'm trying draw 1 rectangle that's light gray on rectangle that's white on canvas, doesn't seem anything. here's i've got: public void ondraw(canvas c) { paint paint = new paint(); paint.setcolor(color.ltgray); c.drawrect(0, 0, width, height, paint); paint.setcolor(color.white); c.drawrect(10, 10, width - 10, height - 10, paint); //this smaller gray rectangle, looks kinda border. } to display this, use setcontentview() in main activity set view new class extending surfaceview. when surface created in custom surfaceview, starts thread executes ondraw() every 100 milliseconds. got canvas using holder.lockcanvas(), ondraw()ing , holder.unlockcanvasandpost(c). where initializing width , height ? set 0? try calling canvas.getwidth() or canvas.getheight() .

xcode - Fitting UIPicker and 3 text fields on 3.5 and 4 inch devices -

i have (from top bottom) 2 uilabels, 1 uipickerview, 3 uitexfield, , 1 button. given size of picker, upon keyboard appearing overlaps text fields on 3.5 , 4 inch devices. used code pop text fields when keyboard shows, i'm unsure picker. tried hiding upon keyboard it's sudden , user may want change choice can't easily. should picker given size limitations? override func viewdidload() { super.viewdidload() countypicker.delegate = self countypicker.datasource = self nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillshow:"), name:uikeyboardwillshownotification, object: nil); nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("keyboardwillhide:"), name:uikeyboardwillhidenotification, object: nil); } func keyboardwillshow(sender: nsnotification) { self.view.frame.origin.y -= 150 } func keyboard

ios - Do something While view receives gestures -

i want change view backgroundcolor while receiving uilongpressgesture , how can properly? code below freezes forever, if lift finger won't unfreeze. - (void)longpress:(uilongpressgesturerecognizer *)gesture { while ([gesturerecognizer state] == uigesturerecognizerstatechanged) { [self.row2view setbackgroundcolor:[uicolor colorwithwhite:0.5 alpha:0.2]]; } } edit need is: while uilongpressgesture change color , when finger lifts screen change color back. you use while! when enter loop, condition true! first,change while if . according apple document: long-press gestures continuous. gesture begins ( uigesturerecognizerstatebegan ) when number of allowable fingers ( numberoftouchesrequired ) have been pressed specified period ( minimumpressduration ) , touches not move beyond allowable range of movement ( allowablemovement ). gesture recognizer transitions change state whenever finger moves, , ends ( uigesturerecognizerstateended ) when of finge

store a matrix created by a function opengl -

i wondering if there easy way store created matrix variable later called glloadmatrix(), point being reset matrix earlier state. for example: void reshape(int w, int h){ glviewport(0, 0, (glsizei)w, (glsizei)h); glmatrixmode(gl_projection); glloadidentity(); gluperspective(dist, (glfloat)w / (glfloat)h, 1.0, 20.0); glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(x_shift, y_shift, z_shift); } the goal being store matrix produced separate variable save current matrix state before multiplying on top of it. i recommendet stop using gl matrix stack @ all. depracted , has been removed core profile of modern opengl. libraries glm used instead. however, ask can done matrix stack. use glgetfloatv() gl_modelview matrix, gl_projection_matrix or gl_texture_matrix query current respective matrix: glfloat m[16]; glgetfloatv(gl_modelview_matrix, m); // other gl code modifying modelview matrix // ... glmatrixmode(gl_modelview); // make

class - Creating Objects from input file -

i'm trying somehow create objects reading text file. however, seem doing wrong, , can't put finger on it. main: import java.util.*; import java.io.*; public class project2 { public static void main(string[] args) throws ioexception { scanner sc = new scanner((new file("project2datafile.txt"))); sc.usedelimiter(","); arraylist<baseballplayer> myplayer = new arraylist<baseballplayer>(); while (sc.hasnext()) { string str = sc.nextline(); for(int cnt = 0; cnt < 4; cnt++){ baseballplayer player = new baseballplayer(); if( player.batavg < 0 || player.batavg > 100 ){throw new illegalargumentexception ("illegal batting avg");} player.pnumber = sc.nextint(); player.lastname = sc.next(); player.firstname = sc.next(); player.batavg = sc.nextfloat(); } continue; } system.out.println(myplayer); } clas

actionscript 3 - Add Child Behind existing object AS3 -

i have made game using flash cs5 (as3) , trying add child stage behind objects there. example, have bar @ bottom of screen there time start game , have falling objects want fall behind it, instead fall in front of because added them stage after. there way of adding falling objects behind without having keep re-adding bar stage? in advance. you can create sprites act layers, , add different objects them. here example adds layer adding whatever want behind bar layer, , adds bar layer, on top. it's super rough since don't have code reference: package { import flash.display.*; public class test extends movieclip { var barlayer:sprite; var objectlayer:sprite; public function test() { var objectlayer = new sprite(); //add object layer main class this.addchild(objectlayer); //now can add movie clips or sprites objectlayer whenever //then create bar layer var bar

Javascript assign property from function -

i don't know if possible, i'd accomplish assign property value object function called. when function active ran, i'd assign either true or false value object being created. can use self-executing functions in way? here's code, still in-progress, there of sort accomplish able in javascript? graphobj.list.push({ name: graphdata[i].name, value: math.floor(graphdata[i].time / graphdata[graphdata.length - 1] * 100), str: graphdata[i].strtime active: (function(){ if (activeactivityname != "" && graphdata[i].name == activeactivityname){ return true; } else { return false; } }) }); i want discourage using iife here since believe inappropriate use of iife. how assigning result of condition: graphobj.list.push({ name: graphdata[i].name, value: math.floor(graphdata[i].time /

javascript - Bundling with subdirectories and Areas not working in release mode -

i have mvc web site has area called admin. use tinymce in both root pages , in admin pages. in dev environment work correctly in release environment tinymce.js file gets loaded part of bundle plugins , other js files go along don't load. if set debug true works correctly. my bundle looks this: bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-{version}.js" )); var tinymcebundle = new scriptbundle("~/tinymce").includedirectory("~/scripts/tinymce", "*.js", true); bundles.add(tinymcebundle); why doesn't work? you try this: bundles.add(new bundle("~/tinymce") .includedirectory("~/scripts/tinymce", "*.js", true)); it works me on project.

How to parse a string using a CSV parser in Python? -

i need parse string using csv parser. i've found solution in many places, doesn't work me. using python 3.4, changed 2.7.9 , still nothing... import csv import stringio csv_file = stringio.stringio(line) csv_reader = csv.reader(csv_file) data in csv_reader: # could please suggest me way parse string using csv parser? or how can make work? obs: have string in csv format, fields have commas inside, that's why can't parse in standard way. you need put double quotes around elements contain commas. the csv format implements rfc 4180 , states: fields containing line breaks (crlf), double quotes, , commas should enclosed in double-quotes. so instance (run code here .): import stringio import csv # text between double quotes treated # single element , not parsed commas line = '1,2,3,"1,2,3",4' csv_file = stringio.stringio(line) csv_reader = csv.reader(csv_file) data in csv_reader: # output: ['1',

android - Crash on changing action bar color -

i'm adding actionbar bar = getactionbar(); bar.setbackgrounddrawable(new colordrawable(color.parsecolor("#0000ff"))); to main activity oncreate. app's execution starts, stops responding. doing wrong? my androimanifest <application android:theme="@style/apptheme" > my styles <style name="apptheme" parent="theme.appcompat.light.darkactionbar"></style> using minsdkversion 21. assuming using actionbaractivity (as corresponds appcompat theme), should always use getsupportactionbar() instead of getactionbar() - of revision 21, getactionbar() return null actionbaractivity .

pycharm - source.developers.google.com authentication issue -

i trying check out code base on google app engine code repository pycharm. its asking me authenticate, when supply gmail creds , can't check out. i getting authentication issues. am missing ? your password google code repository not same gmail password. can find google code password on this page .