Posts

Showing posts from April, 2014

python - Django runserver, and s3boto backend -

django's "manage.py runserver" has wonderful ability magically gather altered css, js, , image files it's running. makes save changes-reload cycle incredibly fast when doing front-end development (css especially). it's wonderful. however, we've moved heroku recently, , installed django-storages s3boto handle static files. works wonderfully too. however, "manage.py runserver" no longer automatically showing updated files. have run "manage.py collectstatic" -- works, adds step, , slows down development while wait collectstatic step upload files s3. is there way old behavior of runserver back, while keeping django-storages?

MySql localhost vs Amazon RDS instance -

i have surprise of mysql performance. when run simple query 'select 1;' on local host (mysql 5.6.x) using workbench, execute in 0.000s, same query ran on amazon rds (medium mysql 5.5.x) tooks 0.094s. i can not understand behavior of mysql. the query select 1 requires no parsing , no table access execution quick. remote servers there's time transmit request , shared resources rds not real-time resources, might take millisecond or 2 task executed. if there's no bigger difference ignore little time.

ios - Why tiny memory leak in this func related to UIGraphicsBeginImageContext? -

i have simple function create uiimage special size : - (uiimage*)imagewithsize:(cgsize) imsize { uigraphicsbeginimagecontext( imsize ); float r = 0.5f; float g = 0.5f; float b = 0.5f; cgcontextref cxt = uigraphicsgetcurrentcontext(); cgcontextsetrgbstrokecolor(cxt, r, g, b, 1.0); cgcontextsetrgbfillcolor(cxt, r,g,b, 1.0); cgcontextfillrect(cxt, cgrectmake(0.0, 0.0, imsize.width, imsize.height)); uiimage* retimg = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return retimg; } and call many times in way (i'm using arc): for(int i=0;i<3000;i++) { uiimage* im = [self imagewithsize:cgsizemake(256,192)]; } it receive memory warning several times, crash on iphone4 ;( wrong simple function? this typical when using large loops no have local autorelease pools. since function not return control main loop, hence giving os chance drain pool of autoreleased objects, memory occupation keeps

database - Hibernate - my table is not mapped -

i want make simple query getvaluebylabel method: here code: public config getvaluebylabel(string label) throws entitypersistexception{ try { query query = em.createquery("select id config config_label=:label",long.class); query.setparameter("label", label); list<long> config = query.getresultlist(); return em.getreference(config.class, config.get(0)); } ... when want start method get: org.hibernate.hql.internal.ast.querysyntaxexception: config not mapped [select id config config_label=:label] any ideas how fix that? update i using: hibernate 4.0.1.final , postgresql db 1.16.1 syntax of hql case sensitive. please see if table/entity , column/instance variable names used in query same of object.

java - Tomcat's webdav repeated 401 when it's deployed on Mac OS X -

i have deployed tomcat 7.0.39 on mac os x 10.7 java 1.7.0_04-b21, , turned on webdav shipped tomcat. try connect finder using either basic or digest authentication, connection fails , tomcat's access log repeatedly reports 401 (propfind /webdav/ http/1.1 401 951) if stop connection. when deploy same tomcat on linux machine using java 1.6, works fine mac's finder. , if connect webdav deployed on mac os x browser or linux's nautilus, works fine. edit: repeated 401 messages seems infinite redirects. edit2: when connect webdav running on mac os x openoffice, it's fine too. weird. edit3: in previous situation, used localhost connect webdav servlet. changed localhost ip, such 192.168.2.103, same machine localhost, finder correctly made connection. it's weird. maybe cache interferes finder, since i've changed webdav's configurations of same url several times. could help? thanks. problem solved. the reason unclear me, it's possible credentia

html - Pair programming application for two or more people -

i'm teaching web development basics free , i'd give kind of live interactive tutorials. i'd find app can connect server's ftp defined folder , let users edit files live other can see or can edit , can see it. should have chat can talk them , tell them what. want editor simple possible. it's html, css, php , javascript. it should immidiettely save files whenever edited user's can see difference while have opened page. example, have opened myserver.com/tutorial/index.html , everytime edit file, see difference. sorry if question doesn't fits here don't know else ask. thank you. what cloud9 ide ? doesn't use ftp, can (and freely) put code on 1 or more github projects, , let users hack them in c9.

algorithm - My puzzle on Project Euler # 25 about java.lang.NullPointerException -

i working on project euler #25. intending save fibonacci number in biginteger array. however, there throws nullpointerexception, don't know why , how avoid it. know there more simple algorithm solve question. want know mistake, thank much! here question states: fibonacci sequence defined recurrence relation: fn = fn−1 + fn−2, f1 = 1 , f2 = 1. hence first 12 terms be: f1 = 1 f2 = 1 f3 = 2 f4 = 3 f5 = 5 f6 = 8 f7 = 13 f8 = 21 f9 = 34 f10 = 55 f11 = 89 f12 = 144 12th term, f12, first term contain 3 digits. what first term in fibonacci sequence contain 1000 digits? my code below: private static biginteger[] fibonacci; public static void main(string[] args) { for(int = 0; fibonacci[fibonacci.length-1].tostring().length() < 1000; i++){ if(i == 0) fibonacci[i] = biginteger.zero; if(i < 3) fibonacci[i] = biginteger.valueof(1); else fibonacci[i] = fibonacci[i - 1].add(fibona

javascript - Draw in a SVG that was already drawn -

i want know if it's possible , how draw in drawn svg. let's i've drawn svg something, want add element, without draw again map or modify original cod. yes, can done. actually, 1 of advantages of svg. here example: <!doctype html> <html> <head> <title>html5 svg demo</title> </head> <body> <h1>svg demo</h1> <svg id="circle" height="200" xmlns="http://www.w3.org/2000/svg"> <circle id="greencircle" cx="30" cy="30" r="30" fill="green" /> </svg> <script type="text/javascript"> var rect = document.createelementns('http://www.w3.org/2000/svg', 'rect'); rect.setattributens(null,"id", "myrect"); rect.setattributens(null,"fill", "red"); re

.net - WMI query in VB.NET - access denied -

i getting access denied when running below code alternate credentials ('access denied (exception hresult: 0x80070005 (e_accessdenied)). if run whole program under standard credentials, pass administrator username & password wmi connection options, access denied. if right-click on program , choose "runas" , put in administrator username & password (without passing credentials wmi options) works! gather account has required privileges , required ports open don't believe dcom issue. i have tried wbemtest program , can connect remote pc entering username , password. can connect no matter options choose impersonation & authentication level. in program, have experimented putting various parameters these options (see commented lines) , have tried .enableprivileges option no combination of these make program work. missing here? sub main() dim myconnectionoptions new system.management.connectionoptions myconnectionoptions '.ena

google maps - NullPointerException when drawing getting path in android -

i'm trying ask google path between 2 geographic points draw. have nullpointerexception. here, call method makes peticion: latlng start = new latlng(13.6871, 100.5352); latlng end = new latlng(13.6836, 100.5390); stringbuilder sbdoc = null; try { sbdoc = getdocument(start, end, mode_driving); if (sbdoc != null){ string doc = sbdoc.tostring(); }else {log.e("the route of line null","");} } catch (ioexception e) { e.printstacktrace(); } and method: public stringbuilder getdocument(latlng start, latlng end, string mode) throws ioexception { string url = "http://maps.googleapis.com/maps/api/directions/json?" + "origin=" + start.latitude + "," + start.longitude + "&destination=" + end.latitude + "," + end.longitude + "&sensor=false&units=metric&mode=driving"; stringb

javascript - How to hide element using "this"? -

pardon stupidity can please explain me how can hide element using this keyword? example working: jquery(document).ready(function($){ if($('.someclass').length==1){ $('.someclass').hide(); } }); but no go me: jquery(document).ready(function($){ if($('.someclass').length==1){ $(this).hide(); } }); thank you! do need use this (in case, see other answers) or seek avoid selector duplication? this? jquery(document).ready(function($){ var elem = $('.someclass'); if(elem.length == 1){ elem.hide(); } });

linux - Cutting the column including size -

i want cut column include size of files . use ls -l view info files in current localization . save info file in txt file ls -l > info.txt , , want cut column including size . cat info.txt | cut -d'' -f6 don't work . wrong ? this include info.txt : -rwx------ 1 s10891 domain users 2188 may 4 14:51 info.txt -rwx------ 1 s10891 domain users 1640 mar 10 07:43 code.txt -rwx------ 1 s10891 domain users 68 mar 4 11:59 sorted.txt drwx------ 1 s10891 domain users 0 jan 11 09:48 ppj drwx------ 1 s10891 domain users 0 sep 7 2012 public_html drwx------ 1 s10891 domain users 0 apr 15 11:16 rbd drwx------ 1 s10891 domain users 0 jan 7 09:45 rdb drwx------ 1 s10891 domain users 0 apr 15 12:00 sop drwx------ 1 s10891 domain users 0 apr 8 12:53 sop_ex3 -rwx------ 1 s10891 domain users 122 feb 25 11:48 sop_info.txt drwx------ 1 s10891 domain users 0 jan 14 09:41 windowsformsapplicati drwx------ 1 s10891 domain users 0 jan 14

jsf 2 - JSF sample project managed beans error, unable to print managed beans message to html -

i started implement basic jsf application unable print jsf managed beans message html.. here code : helloworld.java : package com.project.managedbeans; import javax.faces.bean.managedbean; import javax.faces.bean.requestscoped; @managedbean(name="helloworld", eager=true) @requestscoped public class helloworld { private string message; public helloworld(){ system.out.println("hello world managed bean created"); } public string getmessage(){ return "hello world ! "; } public void setmessage(string message){ this.message = message; } index.html : <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <body> #{helloworld

c# - need help on Button event -

i have used 3-tier architecture insert database.i dont know code should write on button click event in .cs file.can some1 please me? extension.cs public static dbparameter createandsetparameter(this dbcommand cmd,string parametername,dbtype dbtype,int size,parameterdirection direction) { dbparameter p = cmd.createparameter(); p.parametername = parametername; p.dbtype =dbtype; p.size = size; p.direction = direction; cmd.parameters.add(p); return p; } public static dbparameter createandsetparameter(this dbcommand cmd, string parametername, dbtype dbtype, int size,object value) { dbparameter p = cmd.createparameter(); p.parametername = parametername; p.dbtype = dbtype; p.size = size; p.direction = parameterdirection.input; p.value = value; cmd.parameters.add(p); return p; } datageneric.cs public static int addslider(string @imgname,string @imgalt) { int rows=-1; string query="insert [slider](

php mysql calculate distance between 2 points -

i have map page contains google map , form calculate distance between 2 selected points database, don't know how calculate distance between 2 locations using php or ajax , jquery. i have village table contains: id village_name latitude longitude this have in code far: map.php <?php require_once('include/connect.php'); ?> <?php session_start(); if(isset($_session['login']) != 'true'){ header("location: index.php"); var_dump( $_session['login']); } $login = ($_session['login']); $userid = ($_session['user_id']); $login_user = ($_session['username']); $fname = ($_session['first_name']); $lname = ($_session['last_name']); ?> <?php require_once('header.php'); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="ht

java - How can I add a JPanel directly over another one in an array? -

i'm trying make board game cs course.. i've built basic board putting jpanels next each other, want add checkers on top of jpanels whenever move them, original jpanel making basic board appears.. possible? that's code: import java.awt.*; import javax.swing.*; public class loa extends jframe{ static jpanel[][] board; static color temp; static color col1 = color.dark_gray; static color col2 = color.light_gray; public static void main (string [] args){ jframe loa = new jframe(); board = new jpanel[8][8]; loa.setlayout(new gridlayout(8, 8)); for(int i=0; i<8; i++) { if (i%2 == 0) { temp = col1; } else { temp = col2; } for(int j=0; j<8; j++) { board[i][j]= new tiles(temp); loa.getcontentpane().add(board[i][j],i,j); if (temp.equals(col1)) { temp = col2;

maven - Can't build neo4j/spatial -

running: git clone git://github.com/neo4j/spatial.git cd spatial mvn clean compile yields following error: [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project neo4j-spatial: fatal error compiling: invalid target release: 1.7 -> [help 1] do have wrong version of something? update: can not replicate error on other machines. so, consider issue moot. problem must path variable or such.

javascript - Keep getting NaN in Google Script while adding numbers -

Image
i have gui designed using ui services in google apps script. has 2 text boxes entering numbers, named "number1" , "number2". when ever run app , enter 2 number in field , click button answer textbox says nan , instead of showing answer expect. why? here's of code, can find here .: function doget() { var app = uiapp.createapplication(); app.add(app.loadcomponent("calcgui")); return app; } function buttonclicked(userinput) { var app = uiapp.getactiveapplication(); var = userinput.parameter.number1; var b = userinput.parameter.number2; var answer = parseint(a, 10) + parseint(b, 10); app.getelementbyid('answer').settext(answer); return app; } thanks sharing i solved issue on script. when using gui builder, need add callbackelement server handler. can done in gui interface shown in first image (see properties of + button, down list, near function name there little + can add relevant widget id or parent. in case

crating a graph on matlab - using the graph function -

i trying create graph in matlab, not plot of function actual graph vertex , edges, thing wont let me create graph according examples. doing wrong? there library need install or something? when try code: g1 := graph([1,a,3], [[1,a],[1,3]]): graph::printgraphinformation(g1) its documentation, gives me error: undefined function 'g1' input arguments of type 'char'.

Android: Exception usin iText -

i trying read pdf using itext. below code snippet getting exception "not found file or resource": public void readfrompdf(){ string content =""; pdfreader reader = null; try { //string filename string path .pdf file, example resources/pdfs/preface.pdf reader = new pdfreader("c:\\test\\demo.pdf"); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } int numberofpages = reader.getnumberofpages(); numberofpages = numberofpages + 1; (int page = 1; page < numberofpages; page++){ try { string content1page = pdftextextractor.gettextfrompage(reader, page); content = content + content1page; } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } could please figure out whats goi

java - NullPointerException Error stopping listview -

hello trying populate list view sqlite database. im using custom cursor class adapt data , inflate layout public customcursoradapter(context context, cursor c) { super(context, c); } @override public view newview(context context, cursor cursor, viewgroup parent) { // when view created first time, // need tell adapters, how each item layoutinflater inflater = layoutinflater.from(parent.getcontext()); view retview = inflater.inflate(r.layout.suspect_list, parent, false); return retview; } @override public void bindview(view view, context context, cursor cursor) { // here setting our data // means, take data cursor , put in views textview textviewid = (textview) view.findviewbyid(r.id.suspect_id); textviewid.settext(cursor.getstring(cursor.getcolumnindex(cursor.getcolumnname(0)))); textview textviewpersonname = (textview) view.findviewbyid(r.id.suspect_name); textviewpersonname.settext(cursor.getstring(cursor.getcolumnindex

java - How to Read SMPP UDH message -

i new smpp protocol usage, getting message in log below. sending udh message... smpp udh 0500031b0301004d00 how can convert udh message normal text ( java program or tool ). udh not meant interpreted text. because contain non printable characters 0x00 or 0x01. ought decoded byte byte. more details udh here. http://en.m.wikipedia.org/wiki/user_data_header however if don't want complexity involved bits , bytes can instead use network capture tool tcpdump capture smpp packet , use wireshark decoding you.

html - which browsers dont send the referer header? -

i read fact, user-agents dont have send referer header cant rely on it. limit others "stealing" pictures page , generating load without gaining that, using referer check if user on page way circumvent stealing (there other techniques sessions require cookies). so wondering if has data/numbers on distribution of user-agents omit referer header?!

c++ - Invalid use of non-static data member -

i want create file in can add persons personlist including counter makes sure capacity of personlist not exceeded. commented functions make clear task(s) should perform. during compilation following error: invalid use of non-static data member 'personlist::m_capacity' unfortunately cannot figure out what's wrong in code: main.cpp #include <iostream> #include "person.h" #include "personlist.h" int main() { person p1 = person("john", 21); person p2 = person("elham", 19); personlist p_list = personlist(); p_list.add(p1); p_list.add(p2); std::cout << p_list.get_size() << std::endl; person p = p_list.get(0); std::cout << p.get_name() << " " << p.get_age() << std::endl; return 0; } person.h #ifndef person_h #define person_h class person { public: person(); person(std::string name, int age); void set_na

c# - base.Method() with multiple levels of inheritance not being called? -

i've searched , not been able find solution problem. scenario simple: public class { public virtual void methodone() { console.log( "a" ); } } public class b : { public override void methodone() { base.methodone(); console.log( "b" ); } } public class c : b { public override void methodone() { base.methodone(); console.log( "c" ); } } what trying have instance of class c (we'll name 'instancec') call both overridden method of parent, , grandparent. i'd expect this: instancec.methodone(); // output: // "a" // "b" // "c" but instead getting this: instancec.methodone(); // output // "a" // "c" with class b's method being skipped over. not possible? thought whole point of inheritance/polymorphism. in advance! your example works expected me. see b c. think issue c doesn't extend b.

asp.net - Display validation error when TimeSpan model binding exceptions occur -

in asp.net mvc 4 application have view model contains nullable timespan property: [displayname("my time")] public timespan? mytime { get; set; } it bound input element in view: @html.editorfor(model => model.mytime) the input box gets rendered of custom editor template timespan.cshtml : @model nullable<system.timespan> @html.textbox("", (model.hasvalue ? model.value.tostring(@"hh\:mm") : string.empty), new { @class = "text-box single-line hastimepicker" data_timepicker = true }) now, if enter following 2 kinds of invalid times , submit page following different behaviour of model binder: if enter letter, "a" input element modelerror property when drill modelstate.values collection has errormessage property set message ( "the value \"a\" \"my time\" invalid." ) , exception property null . bound value of mytime null . this errormessage displayed in validation summ

php - Call a member function on a non object -

i want display informations object activity function getcurrent() listactivity should returns. when try it, works perfectly, have information needed class, but, have error message on top of page : fatal error: call member function getidentifiant() on non-object in /applications/xampp/xamppfiles/htdocs/site/prototype/administration.php on line 34 line 34 here : while($listactivities->next()) { $current = new activity(); $current = $listactivities->getcurrent(); echo $current->getid(); // line 34 } and getcurrent() function return activity object. public function getcurrent() { if(isset($this->activities[$this->current])) return $this->activities[$this->current]; } i don't understand why have problem since returns me object want. please me figuring out. thanks. echo $current->getid(); // line 34 fatal error: call member function getidentifiant() on non-object in /applications/xamp

Simplifying summary statistic output stratified by a categorical variable in R -

program being used i using statistical program r analyze data , have simple question. background problem i have variable full of numeric values called study_data$ln_reviewed . have variable called study_data$gender has sex of each subject in study. compute simple summary statistics stratified gender. easy using code shown below: > by(study_data$ln_reviewed, study_data$gender, summary) study_data$gender: female min. 1st qu. median mean 3rd qu. max. 2.00 13.00 19.00 27.77 35.50 125.00 study_data$gender: male min. 1st qu. median mean 3rd qu. max. 1.00 12.00 19.00 26.98 34.00 122.00 my question how can r display information in easier digest format? specifically, table has 2 rows, entitled "female" , "male", , 6 columns, entitled "min.", "1st qu.", "median", "mean", "3rd qu.", , "max.", shown below. min. 1st qu. median

github - when compiling, conf/routes still refers to old path -

Image
first had local repository https://github.com/tenzan/pfj_ch03.git . then made copy of whole folder , renamed pfj_ch05 cd pfj_ch05/ play ~run on browser localhost:9000 i'm having error, refers in /users/askar/work/playforjava/work/ pfj_ch03 /conf/routes @ line 10 in picture. for reason stil refers pfj_ch03 instead of pfj_ch05 . you can refer https://github.com/tenzan/pfj_ch05.git pfj_ch05 code. execute play clean , try again.

angularjs - benefit of using angular js on top of asp.net mvc -

is there point using angular js on top of asp.net mvc since they're kind of both doing same thing? advantages using angular on asp.net mvc + jquery? kind of scenario pick angular in? if pick angular in microsoft environment, run on server side? web api? or there still benefit of using traditional asp.net mvc? on site http://www.reviewstoshare.com , using angularjs along asp.net mvc. the main reason did not go way angularjs seo not achieved angularjs. keep in mind site built using asp.mvc + jquery in page interaction needed. on other hand there still "ajaxy" nature site comments, voting, flagging etc. not different stackoverflow itself. before angularjs mess of jquery plugins , functions within $(document).ready() callback, not mention js code not testable much. in end, went both.

jquery - PHP doesn't receive $_POST -

i have problem php, i'm doing ajax post jquery. problem: php doesnt receive post, there no problems. i'm using last jquery version. ajax doesnt throw error, tried error:function(...) , console.log. idcat number, example: 3 $nuevafila , other undeclared variables declared, aren't constructive. php returns html because try html , receive ok the ajax code one: $.ajax({ cache:false, type:'post', url:'admin/categoria_ajax_ad', data: {id: idcat}, success: function(htmlfila) { var nfila=$cfilas.find(".fila").size()+1; $nuevafila.html(htmlfila); $nuevafila.appendto($cfilas); }, }); try using datatype (xml, json, script, or html) setting parameter depending on return data type - $.ajax({ cache:false, type:'post', url:'admin/categoria_ajax_ad', data: {id: idcat}, datatype : "string" success: function(htmlfila) { var nfila=$cfilas.find(".f

java - BubbleSort StackOverflowError -

i added recursive bubblesort algorithm game runs on lwjgl. i'm trying sort arraylist of "cloud" objects float speed of cloud. for reason "java.lang.stackoverflowerror" @ line invoke method in itself. here's code: public void sort() { (int = 0; < clouds.size() - 1; i++) { cloud cl1 = clouds.get(i); cloud cl2 = clouds.get(i + 1); if (cl1.getspeed() < cl2.getspeed()) { continue; } clouds.set(i, cl2); clouds.set(i+1, cl1); this.sort(); } } and here errors i'm getting: sat may 04 20:28:45 cest 2013 error:null java.lang.stackoverflowerror @ backgrounds.clouds.sort(clouds.java:224) [...] // line above repeated hundred times. that happens when 2 consecutive clouds have same speed. cl1.getspeed() < cl2.getspeed() is false, clouds swapped , sort called again. in call, cl1.getspeed() < cl2.getspeed() is still false, swap again , call sort

zend framework2 - Class not recognized by initializer -

i'm pretty new zf2 setup site working it. got understanding of servicemanager i'm stuck. here context : want implement logger available on class of zf2 application. in global.php create factory logger : 'service_manager' => array( 'factories' => array( 'zend\db\adapter\adapter' => 'zend\db\adapter\adapterservicefactory', 'zend\log\logger' => function($sm){ $logger = new zend\log\logger; $writer = new zend\log\writer\stream('./data/log/'.date('y-m-d').'-error.log','wb'); $logger->addwriter($writer); return $logger; }, ), now want have injected in every class implementing loggerawareinterface. in module.php have initializer in getserviceconfig function 'initializers' => array( 'logger' => function($service, $sm) { i

c++ - Segmentation Fault when accessing a struct -

i have header file define methods. trying implement doubly linked list store data of pairs. cont.h template <class key, class t> class storage; template < class key, class t, class compare = std::less<key> > class cont{ private: storage <key, t> data; public: typedef size_t size_type; typedef key key_type; typedef t mapped_type; //default constructor cont(){} cont(key_type k, mapped_type m) { std::pair<key, t> x = std::make_pair(k,m); data.begin_list(x); //std::pair<key, t> = std::make_pair(k,m); //data.push(a); } }; template <class key, class t> struct node { node *prev, *next; std::pair<key, t> node_data; }; template <class key, class t> class storage{ private: node <key, t> *head; node <key, t> *tail; node <key, t> *curr; int s

python - Finding a tuple with greatest value -

given these 2 lists: first = [('-2.50', '1.91', '2.03'), ('3.00', '1.83', '2.08')] second = [(('-2.50', 0.889258, 1.069258), ('3.00', 0.931381, 1.021381))] it's two-task challenge. firslty, in list second , need identify tuple greatest value in (while values @ position 0 here: -2.50 , 3.00 must ignored). then, second task, need output corresponding tuple form list first . should result in: ('-2.50', '1.91', '2.03') this because greatest value found in step first should 1.069258 inside 1st tuple. the snag face here finding tuple greatest value (i know can use max() find value need whole tuple), 2nd part of problem think i'll cope using if statement. in 1 line: >>> max(zip(first,second[0]),key=lambda x:max(x[1][1:]))[0] ('-2.50', '1.91', '2.03')

html - table-layout fixed not working -

with following code css table supposed hide content exceeds table height (200px). unfortually doesn´t work , table vertically expanded. knows why ? <div style='display:table; border:1px solid blue; width:200px; table-layout:fixed; height: 200px'> <div style='display:table-row'> <div style='display:table-cell; overflow:hidden'> contents<br/>contents<br/>contents<br/>contents<br/>contents<br/> contents<br/>contents<br/>contents<br/>contents<br/>contents<br/> contents<br/>contents<br/>contents<br/> </div> </div> </div> <div style='display:inline-block;width:20px;height:200px; border:1px solid red; position:absolute;top:8px;left:220px'> </div> thanksç from see, need add class or id divs . also, if want create table, without heaps of divs without classes or ids. here reference on how make

c# - mvc3 getting a DB model remove error -

i doing database check see if rows expired getting system.data.entity.dbset error on db.servicers.remove(servicer) saying piece of code has invalid arguments .my little code is var servicer = (from s in db.servicers datetime.now >= s.expired select s).tolist(); if (servicer.any()) { db.servicers.remove(servicer); db.savechanges(); } the expired field datetime , want loop database , delete record expires today or has expired; whats best way solve error. like lews therin said remove takes type t should enumerate list. var servicer = (from s in db.servicers datetime.now >= s.expired select s).tolist(); if (servicer.any()) { foreach(var s in servicer) { db.servicers.remove(s); } db.savechanges(); }

c++ - Alsa library read normalize value -

i reading sound value alsa library. values not normalized. can read normalize value library? reading 116bit little endian snd_pcm_readi(capture_handle,buffer,frame)); you can floating-point values between -1 , 1 configuring device sample format snd_pcm_format_float .

visual studio 2010 - Where is my Entity Framework 5 Generated Database? -

i can't find database file anywhere. can hit database know there. i used connection string: <connectionstrings> <add name ="testpocotimeentrycontext" connectionstring="data source=.\sqlexpress; integrated security = true;" providername="system.data.sqlclient" /> </connectionstrings> in code, if run line: console.writeline(db.database.connection.database + " exists " + db.database.exists()); i output: " exists true" i cannot understand why database there has no name , there no file it. let me know if need provide further info. thanks!

api - Services that get facebook emails -

i've noticed android phone, iphone, outlook.com, , yahoo mail can import friends' email addresses (and phone numbers) facebook. however, don't see anywhere in documentation of api suggest can email. do these services have special agreements facebook or not finding specific api "contact" importing? i've not had luck using "email" field friends api. any ideas? these services have special agreements facebook , able retrieve email ids of friends of user. of them don't allow further exporting of data obtained there directly. and per email permissions documentation here states app developers note: there no way apps obtain email addresses user's friends. as per phone number, there no access no matter permission. may though ask user fill you.

python 3.x - Code not working trying to write the content of a StringVar to a file -

i've got lot of experience basic programming, none gui programming, , teaching myself python 3 tkinter purpose. i've got great answers checking stackoverflow posts, i've got problem doesn't seem have been covered. want program user input entry widget , write data file. after stripping out nonessential lines, current code is from tkinter import * tkinter import ttk root = tk() sheetid = stringvar() def finish(): open('c:/python33/data.txt', 'w') f: f.write('first line of text\n') open('c:/python33/data.txt', 'a') f: f.write(sheetid) main = frame(root).grid() ttk.entry(main, textvariable="sheetid").grid(row=0, column=1) ttk.button(main, text="close", command=finish).grid(column=1) root.mainloop() i've used label widget write variable "sheetid"in window, know combination of entry widget , "close" button widget working. first write statement works, kn

c# - Why is my network read/write speed so slow on my app? -

ok, have made server\client app file transportation using single-thread in console app. whenever run both client , server on same network runs perfectly, whenever try across internet very, very, slow running @ 130000 bytes second. client using high-speed ethernet connection , server using wireless connection. using port forwarding send requests port 54321 computer running server. using tcplistener listen connection, tcpclient accept connection, streamreader , streamwriter attached networkstream send/receive data. ideas on why might slow? way, know fact not wireless network causing lag, think program. here code : server : using system; using system.collections.generic; using system.linq; using system.text; using system.net; using system.net.sockets; using system.io; namespace server { class program { static bool dontloop; static string selectedfile; static string[] filearray; static bool authgood; static bool goodexit;

php - How to determine which checkbox is checked? -

i have html table of 4 columns: studentid , first_name , last_name , 5 checkboxes grades. how can determine in php (or maybe using jquery?) check box(grade) checked each studentid ? <tr> <td> <?php print $stud_row['student_id']; ?> </td> <td> <?php print $stud_row['first_name']; ?> </td> <td> <?php print $stud_row['last_name']; ?> </td> <td> <input type="checkbox" name="id" value="a"> <input type="checkbox" name="id" value="b"> b <input type="checkbox" name="id" value="c"> c <input type="checkbox" name="id" value="d"> d <input type="checkbox" name="id" value="f"> f </td> </tr> here functional ex