Posts

python - Populate wx.StaticText controls with dictionary key:value pairs -

i have wxpython gui application contains 13 pairs of statictext controls able set labels problematically. in terms of regression analysis, each pair of statictext controls represents independent variable , coefficient. these key:value pairs stored in python dictionary, allowing me use dictionary comprehension of work. right now, struggling display contents of python dictionary inside of gui. thoughts? i happy concatenating key:value pair inside 1 statictext control label, think less messy. i'm sure there lots of different ways this. use listctrl or better yet, objectlistview. went ahead , created example using statictext controls: import wx ######################################################################## class mypanel(wx.panel): """""" #---------------------------------------------------------------------- def __init__(self, parent): """constructor""" wx.panel.__in...

PHP : Post get method, need some advice -

i new php , need understand how post method useful code. scenario is, have 3 webpages, 1st webpage html form , using post method here take firstname , last name form , enter in sql query(for e.g. $_post[firstname] ) on 2nd webpage generates data me , printing data. now need pass same parameters 3rd page generates graph based on firstname , lastname entered in 1st html form? how can persist these values on 3rd php page? referencing url page 3 on page , believe not sufficient, tried google search , found out post useful need expert advice. thanks you can use this: 1st page (page1.php) <form action="page2.php" method="post"> <input type="text" name="firstname" value="" /> <input type="text" name="lastname" value="" /> <input type="submit" value="submit" /> </form> 2nd (page2.php) retrieve , validate $_post['firstname...

css - Twitter Bootstrap Navigation Bar Fixed -

Image
what must change make navigation bar fixed when screen size under 940px? don't want make responsive. if resize browser windows under 940px see scroolbar-x (bottom-scrollbar) appear, when scroll right, navigation bar position still fixed, , menu won't appear. maybe picture explain problem. this can't done in css alone. the example give (twitter) has navbar fixed position , fixed size @ screen sizes. fixed position means scrollbars not affect position of navbar, , why can't use x-scrollbar see part of navbar which, once it's less 940px wide, hidden 'under' right border of browser window. so have choose, either have fixed position , fixed size navbar present @ top no matter how far user scrolls down , accept under small enough screen won't able scroll horizontally see all, or have fixed position , fluid size navbar adjusts width accommodate different screen sizes, mitigate need scroll horizontally in first place, if let grow verti...

hierarchical namespaces in custom python modules -

tried searching site, cannot find answer problem: lets have module, named mymodule.py contains: def a(): return 3 def b(): return 4 + a() then following works: import mymodule print(mymodule.b()) however, when try defining module contents dynamically: import imp my_code = ''' def a(): return 3 def b(): return 4 + a() ''' mymodule = imp.new_module('mymodule') exec(my_code, globals(), mymodule.__dict__) print(mymodule.b()) then fails in function b(): traceback (most recent call last): file "", line 13, in <module> file "", line 6, in b nameerror: global name 'a' not defined i need way preserve hierarchical namespace searching in modules, seems fail unless module resides on disk. any clues whats difference? thanks, rob. you're close. need tell exec work in different namespace (see note @ bottom python 3.x): exec my_code in mymodule.__dict__ full example: imp...

amazon ec2 - Join performance on AWS elastic map reduce running hive -

i running simple join query select count(*) t1 join t2 on t1.sno=t2.sno table t1 , t2 both have 20 million records each , column sno of string data type. the table data imported in hdfs amazon s3 in rcfile format. query took 109s 15 amazon large instances takes 42sec on sql server 16 gb ram , 16 cpu cores. am missing anything? can't understand why getting slow performance on amazon? some questions tune hadoop performance: what io utilization on instances? maybe large instances not right balance of cpu / disk / memory job. how files stored? single file, or many small files? hadoop isn't hot many small files, if they're combinable how many reducers did run? want have 0.9*totalreducecapacity ideal how skewed data? if there many records same key go same reducer, , you'll have o(n*n) upper bound in reducer if you're not careful. sql-server might fine 40mm records, wait till have 2bn records , see how does. break. i'd see hive more cle...

php - facebook extended access token login -

i have following code: $facebook = new facebook(array( 'appid' => id, 'secret' => secret, 'cookie' => true)); $fb_uid = $facebook->getuser(); if($fb_uid) { // check if person fb_uid facebook id in database, // if log them in. if not, register them. $fb_user = $facebook->api('/' . $fb_uid); email address using $fb_user['email'] , facebook_id , store in database means log them in future sometimes $fb_uid returns false though person logged in using facebook ... think because access token expires. how can change code incorporate extended access token log in user site? offline access token deprecated, need use extended access token. your cookie expiring. instead of using cookie , screen-scraping, use oauth. see example here: http://eggie5.com/20-getting-started-w-facebook-api

python - What is the easiest/correct why to change the width of django_tables2 table -

i want table rendered django-tables2 drawn on whole screen. i'm using included paleblue css. class pooltable(tables.table): class meta: model = simple attrs = {'class': 'paleblue','width':'100%'} is possible easy in code , if how? if can't in code, must change in css or html or other place? this more of css question. here how did easy way: chang width on 100% class pooltable(tables.table): class meta: model = simple attrs = {'class': 'paleblue','width':'200%'} this change size of table not pagination. if wont change size have change in css. did find easiest remove borders pagination.