Posts

Showing posts from May, 2010

ios - fill part of a UIView with color with animation -

i need create effect of filling uiview color, animation. example battery image filled background color . so can see problem 2 : background color of uiview part of ( 10% / 45% /etc ) make animation how color part of uiview natively? (obj-c) uiview *view=[uiview alloc] init]; view.backgroundcolor=[uicolor redcolor]; //is colouring of . creating 2 views problem,because need animate whole thing fills color . you use 2 views, not problem if put second view subview first. way can animate outer view , inner follow. to show battery level animate frame of inner view.

java - Format a string and replace %s with html element in scala play framework -

i have string "user: %s" , want format , replace "%s" <a href="#">john</a> . how should in view files? p.s. using "user: %s".format("john") browser render i <a href="#">john</a> instead of "i john". to output raw html in template: <p> @html(article.content) </p> from play docs

c - Solve warning: passing 'const void *' to parameter of type 'AV *' -

compiling xs-module including libmba cannot solve warning beginners level experience in c: helmut@helmuts-macbook-air:~/github/lcs-xs$ make "/users/helmut/perl5/perlbrew/perls/perl-5.18.2/bin/perl" "/users/helmut/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/extutils/xsubpp" -typemap "/users/helmut/perl5/perlbrew/perls/perl- 5.18.2/lib/5.18.2/extutils/typemap" xs.xs > xs.xsc && mv xs.xsc xs.c cc -c -i. -fno-common -dperl_darwin -fno-strict-aliasing -pipe - fstack-protector -i/usr/local/include -i/opt/local/include -o3 - dversion=\"0.01\" -dxs_version=\"0.01\" "- i/users/helmut/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin- 2level/core" xs.c xs.xs:55:26: warning: passing 'const void *' parameter of type 'av *' (aka 'struct av *') discards qualifiers [-wincompatible-pointer-types-discards-qualifiers] sv *line = *av_fetch(a, idx, 0);

python - PyQt4: Graphics View and Pixmap Size -

Image
i'm developing gui using qtdesigner image processing tasks. have 2 graphic views beneath each other in grid layout. both should display image , later on add overlays. i create pixmap img_pixmap , add scene. scene added graphics view. since image larger screen size apply fitinview() . in code: self.img_pixmap_p = self.img_scene.addpixmap(img_pixmap) self.img_view.setscene(self.img_scene) self.img_scene.setscenerect(qtcore.qrectf()) self.img_view.fitinview(self.img_scene.scenerect(), qtcore.qt.keepaspectratio) so far, how rid of white space around image view? ideally, want pixmap use full width of graphics view , keep aspect ratio, graphics view should adjust height accordingly. ideas on how achieve in straight forward fashion? here image better idea of get: as can see, there white borders, want avoid. okay, did suggested pavel: img_aspect_ratio = float(pixmap.size().width()) / pixmap.size().height() width = img_view.size().width() img_view.setfixedhei

ios - Auto layout issue with dynamically loaded XIB -

i have issue auto layout , particular ui flow trying build. essentially, have following: a storyboard a xib called updateyou.xib a xib called updatefilter.xib within storyboard scene uiviewcontroller called updateviewcontroller in turn has uisegmentedcontrol 2 options , scrollview. the general premise when uisegmentedcontrol in option1 loads updateyou.xib in scrollview. constrained width of parent view , expanded vertically required. however, when option2 of uisegmentedcontrol selected updatefilter xib loaded not constrained width of parent view. below print out of constraints (the first *** separated log correctly laid out view): 2015-06-20 08:39:27.514 [42981:1543261] ************************************************* constraint: <nslayoutconstraint:0x7fc691d7eeb0 uiview:0x7fc691d7d720.leading == uiview:0x7fc691d7d5f0.leadingmargin - 16> constraint: <nslayoutconstraint:0x7fc691d7ef00 uiview:0x7fc691d7d720.top == uiview:0x7fc691d7d5f0.topmargin&

c# - Setting values and handling concurrency in EF 6 -

i using ef 6.1 , service update method looks so public async override task<int> updateasync(module updated) { var entity = await _context.modules .where(e => e.id == updated.id) .firstordefaultasync(); // update existing values _context.entry(entity).currentvalues.setvalues(updated); // not update _context.setmodified(entity, "addonlyproperty", false); return await base.updateasync(entity); } my base updateasync looks so public async virtual task<int> updateasync(t updated) { var results = await validateasync(updated); if (!results.isvalid) { throw new validationexception(results.errors); } if (_context.getstate(updated) == entitystate.detached) { _context.set<t>().attach(updated); _context.setstate(updated, entitystate.modified); } // not want createddate change when update being done _context.setmodified(updated, "createddate", f

php - Does not show newly created module in Layout -

Image
i'm trying list newly created module (account_test) copied "account" module in opencart 2.x ( account module shows in backend system->design->layouts-> edit home layout ). have duplicated account php & tpl files account_test & tpl files , change references account account_test in both admin & catalog module/language/view folders. also, noticed in admin\controller\design\layout.php if statement add account & category modules layouts setting: if ($this->config->has($code . '_status') || $module_data) { $data['extensions'][] = array( 'name' => $this->language->get('heading_title'), 'code' => $code, 'module' => $module_data ); } if remove if condition : $data['extensions'][] = array( 'name' => $this->language-

animation - android pop out (zoom) view on focus -

Image
i have group of views, want 'pop-out' of screen when focused; sort of thing might see in menu on video game, example. to achieve adding onfocuschaned listener these views runs zoomin animation on focus, , zoomout animation on losing focus: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); viewgroup base = (viewgroup) this.getlayoutinflater().inflate(r.layout.gridtest, null); viewgroup container = (viewgroup) base.getchildat(0); this.animzoomin = animationutils.loadanimation(this, r.anim.zoomin); this.animzoomout = animationutils.loadanimation(this, r.anim.zoomout); int x=0; for(view child:this.getviews(container)) { imageview = (imageview) child; i.setpadding(10,10,10,10); if(x==0) { i.setbackgroundcolor(color.red); x++; } else if(x==1) {i.setbackgroundcolor(color.green); x++; } else if(x==2) {i.setbackgroundcolor(color.blue); x=0; } i.set

ios8.3 - Keyboard not resign after resigning it in ios 8.3 -

i resigning text field once response server. on ios 8.3 not resigning keyboard. here doing .i have resigned text field , after getting response server not getting resign though. , showing me alert , keyboard simultaneously. its working on ios 8.2 this code -(void)reciveresponseforemail { [internetdowntimer invalidate]; [self.emailtextfield resignfirstresponder]; //resign text feild [activityindicatorutility finishedwaiting]; if ([[responsedictionary valueforkey:@"success"] integervalue]==1) { registryconfirmviewcontroller *objregconfirmvc=[[registryconfirmviewcontroller alloc]initwithnibname:@"registryconfirmviewcontroller" bundle:[nsbundle mainbundle]]; objregconfirmvc.signregistrydetailinfodict=(nsmutabledictionary*)[[nsdictionary alloc]initwithdictionary:responsedictionary]; objregconfirmvc.isfromemail=yes; objregconfirmvc.signregistryaray=[[nsmutablearray alloc]initwitharray:self.serviceobjectar

c - scanf GCC for long double -

this question has answer here: scanf not taking in long double 5 answers i'm using gcc 4.8.1 std=c99 on windows 7. what's correct place holder long double when using scanf , fscanf ? tried %lf , %lf , neither working. compile command gcc -std=c99 main.c -o main.exe . when omit std=c99 works fine. #include <stdlib.h> #include <stdio.h> int main() { long double x = 0; scanf("%lf", &x); printf("x = %lf\n", x); return 0; } it works fine me, on centos 6.6, or without -std=c99: $ gcc --version gcc (gcc) 4.4.7 20120313 (red hat 4.4.7-11) copyright (c) 2010 free software foundation, inc. $ gcc x.c -o x -std=c99 -wall -pedantic $ ./x 123.456 x = 123.456000 $ gcc x.c -o x -wall -pedantic $ ./x 123.456 x = 123.456000 i'm assuming you're on linux (or mac osx), , assume you're using lib

Communicating with GSM modems using PySerial in python -

Image
i have dwm-156 gsm modem . below can see list of devices added computer after plugging gsm modem usb port: note every time connect modem computer, use different com port numbers. now want send @ commands modem using python or other language. want answer/make call from/to dial phone , record raw data transfers during communication. after doing search found this question in so. 1 of answerers suggested below code: import serial serialport = serial.serial(port=port_number,baudrate=115200,timeout=0,rtscts=0,xonxoff=0) def sendatcmd(cmd): serialport.write('at'+cmd+'\r') print 'loading profile...', sendatcmd('+npsda=0,2') i replace port_number 9 , 10 , 12. these results: >>> ================================ restart ================================ >>> loading profile... >>> #for port = 9 >>> ================================ restart ================================ >>> loading profile... >

php - Cannot DROP TABLE in mysql -

i insert data php pdo like: begintransaction -> execute query -> commit , going well. found that, after insert data steps. can't run drop table in mysql command line. when type : mysql> drop table accounts; terminal keep running nothing change. must ctrl+c abort it. i want know reason these. , how fix it?

android - Google Maps V2 is not working in sherlockFragment -

i working on app have customize navigation drawer of sherlock library. in navigation drawer using sherlock fragment not getting object of google when try maps. using line googlemap = ((supportmapfragment)fragment).getmap(); app crashes @ line. without line maps can show on screen have location. public class location extends sherlockfragment implements view.onclicklistener { googlemap googlemap; fragment fragment; button arrived_mbtn; textview current_mtv,request_mtv; linearlayout btn_mlayout,journey_mlayout; view rootview; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { rootview = inflater.inflate(r.layout.fragment_location, container, false); fragment = getfragmentmanager().findfragmentbyid(r.id.map); googlemap = ((supportmapfragment)fragment).getmap(); googlemap.setmylocationenabled(true); googlemap.addmarker(n

Error when invoking method - java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any> -

i've been working on project described in this question asked previously. i'm trying invoke method class who's name dynamically generated (and class compiled while program runs). call class watchface = class.forname("pebbleos.pebbleos_" + filename); followed currentwatchface = watchface.newinstance(); in method loadwatchface() , , in method runwatchface() try invoke method using this: method method = null; try { method = currentwatchface.getclass().getmethod("initializeface"); } catch (securityexception | nosuchmethodexception e) { system.out.println("error"); } method.invoke(currentwatchface); my watch face's code being taken text file, looks this: package pebbleos; public class pebbleos_default { public pebbleos_default () { } public void initializeface() { system.out.println(“hello world”); } } just quick note, above supposedly "caus

command line - Iterate over specific files in a directory using Bash find -

shellcheck doesn't like for on find loop in bash. for f in $(find $src -maxdepth 1 -name '*.md'); wc -w < "$f" >> $path/tmp.txt; done it suggests instead: 1 while ifs= read -r -d '' file 2 3 let count++ 4 echo "playing file no. $count" 5 play "$file" 6 done < <(find mydir -mtime -7 -name '*.mp3' -print0) 7 echo "played $count files" i understand of it, things still unclear. in line one: '' file ? in line six: empty space in < < (find). < redirects, usual? if are, mean redirect do block? can parse out? right way iterate on files of kind in directory? in line one: '' file? according help read , '' argument -d parameter: -d delim continue until first character of delim read, rather newline in line six: empty space in < < (find). there 2 separate operators there. there < ,

php - First getElementsByTagName() returns all elements in HTML (Strange behaviour) -

i using php parse html provided me wordpress. this post's php returned wordpress: <p>test</p> <p> <img class="alignnone size-thumbnail wp-image-39" src="img.png"/> </p> <p>ok.</p> this parsing function (with debugging left in): function get_parsed_blog_post() { $html = ob_wp_content(false); print_r(htmlspecialchars($html)); echo '<hr/><hr/><hr/>'; $parse = new domdocument(); $parse->loadhtml($html, libxml_html_noimplied | libxml_html_nodefdtd); $xpath = new domxpath($parse); $ps = $xpath->query('//p'); foreach ($ps $p) { $imgs = $p->getelementsbytagname('img'); print($imgs->length); echo '<br/>'; if ($imgs->length > 0) { $p->setattribute('class', 'image-content'); foreach ($imgs $img) {

html - Can HTML5 <aside> be displayed in the bottom of the document? -

i displaying articles on document, , displaying links other articles @ bottom. html looks this: <article>...</article> <article>...</article> ... <article>...</article> <aside> other recent articles <div> ... </div> </aside> i think links other articles should , because defined in mdn as: a section of page content connected tangentially rest, considered separate content. but name <aside> seems imply element should either on left or right side. can in bottom? with html, should think of usage of tags structural , not presentational . so don't think of <aside> 's name physical description. think of in terms of purpose in structuring content: associate tangentially related content main content. has nothing it's placed on physical page design. if you're designing page media queries, example, bet mobile view isn't going put <aside> on either side of screen be

Create table in MySQL based on reflected metadata from MSSQL using SQLAlchemy -

i'm trying use sqlalchemy copy table schemas between different rdbms - in example mssql mysql. is there way take table object , copy , convert metadata different dialect? i tried tometadata() function type info columns remains in original mssql dialect. it works ok long column types compatible, breaks when column type doesn't exist in mysql eg. uniqueidentifier, varchar(max), etc import sqlalchemy sa # source table details source_table_name = 'customer' source_schema_name = 'adventureworkslt2008.saleslt' db_uri_mssql = "mssql+pyodbc://{user}:{password}@{dsn}" db_uri_mysql = "mysql+mysqlconnector://{user}:{password}@{host}:{port}/{db}" source_db = db_uri_mssql.format(user=source_user, password=source_password, dsn=source_dsn) target_db = db_uri_mysql.format(user=target_user, password=target_password, \ host=target_host, db=target_db, port=target_port) so

jquery - Newly added item to chosen.js make it selected automatically -

i have text field , button, user can enter name in text box , press button. currently stands code adds item options available user select. $("#btnaddcast").click(function () { $('#listactivities').append('<option>'+ $("#txtcast").val() + '</option>'); $('#listactivities').trigger('chosen:updated'); return false; }); what want / can't find within chosen.js documentation how make newly added item selected automatically know how such thing? it looks selects still act normal selects. i'd select last item so: $("#btnaddcast").click(function () { $('#listactivities').append('<option>'+ $("#txtcast").val()+ '</option>'); $('#listactivities :last').attr('selected','selected'); return false; });

Call php from javascript -

i have index.php contains both js , php code. php code reads gps coordinates ios app , js reads these coordinates displayed on web app. i stuck on figuring out how call php every few seconds can new coordinates. clueless how approach , seems recursion if need call same file purpose. what best way "refresh" php code , read new coordinates? here code: <?php include_once('location.php') ?> <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>my geolocation</title> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script> <script> var map; google.maps.visualrefresh = true; function in

Displaying a table from MySQL database onto webpage with Ruby Sinatra -

i have mysql database display table onto webpage using sinatra. sort data based on column well. kind of content management. know gem or point me in right direction? not gem, datatables.js used same situation. it's couple lines add sinatra project , provides sorting , searching default. https://www.datatables.net/

Add daterange to Google Search Appliance without displaying daterange in input -

i'm using gsa iframe , have date selection user can choose date range. there way add daterange without changing value of user's query? know can add daterange:yyyy-mm-dd..yyy-mm-dd query input box right before user clicks submit don't want appear in input box. thought add hidden input field named 'daterange' date value doesn't seem work. update: have tried adding as_q hidden form element. work seems add date input box. i tried adding daterange hidden form field , modifying xslt have tried using as_q parameter? http://www.google.com/support/enterprise/static/gsa/docs/admin/72/gsa_doc_set/xml_reference/request_format.html

jquery - javascript function ready code not working -

i trying determine why script not working -- working until added function ready element make page load before running - think maybe did not add correct closure. new js if has ideas, great! <script> //a simple function used make ajax call , run callback target page source argument when successful function getsubpagesource(url, successcallback) { var xhr = xmlhttprequest(); xhr.onreadystatechange = function() { if (xhr.readystate == 4 && xhr.status == 200) { //when source returned, run callback response text successcallback(xhr.responsetext); } }; xhr.open('get', url, true); xhr.send(); } function readyfn(jquery) { // code run when document ready. //find categories sub categories var categories = document.getelementsbyclassname('has-subcategories'); //loop through each category (var ii = 0, nn = categories.length; ii < nn; ii++) { //use closure pass in static ii

java - Labeled and Unlabeled break, continue in C# or C++ -

i have experience in c# works on java project take tour in java features. haired labeled , unlabeled break (it available in javascript) it's feature , shorten lot of time use labeled break in cases. my question is, best alternative of labeled break in c# or c++, think can use goto keyword go out scope, don't prefer it. tried write code in java search in number in 2 dimensional array using labeled break it's easy: public static void searchintwodimarray() { // here hard coded arr , searchfor variables instead of passing them parameter easy understanding only. int[][] arr = { {1,2,3,4}, {5,6,7,8}, {12,50,7,8} }; int searchfor = 50; int[] index = {-1,-1}; out: for(int = 0; < arr.length; i++) { (int j = 0; j < arr[i].length; j++) { if (arr[i][j] == searchfor) { index[0] = i; index[1] = j; break out;

HTTP POST REQUEST using python -

this question has answer here: getting ip address http post request using python 2 answers i've web server setup in separate location , wanted access remotely using http post request. can please guide me how proceed it. need use python runs http post request , modifies contents of web page although not particularly practical, use socket. script on server receives post request have modify desired web pages content upon receipt. import socket sock = socket.socket() sock.connect(('server_domainname.com', 80)) sock.sendall(b'post / http/1.1\r\nhost: server_domainname.com:80\r\n\r\n')

jquery - How to finish Javascript Validation Form -

i need create validation form matching passwords, no empty fields, letters/numbers in right fields, date (from , before), age numbers , email appropriate format. managed email thing can me complete javascript code? body { line-height: 30px; } .error { color: red; font-size: 0.8em; font-style: italic; } #erroremail { visibility: hidden; } #errorfname { visibility: hidden; } $(document).ready(function() { $("input[name='email']").blur(function validateform() { var x = $("input[name='email']").val(); var pat = /.+@.+\.\w\w\w/; if (pat.test(x)) { document.getelementbyid("erroremail").style.visibility = "hidden"; } if (!pat.test(x)) { document.getelementbyid("erroremail").style.visibility = "visible"; return false; } }); }); <form ... method="post" action="" onsubmit=&q

mysql - SQL transactions sum for each year -

this question has answer here: group year in date field in mysql 3 answers i have table tranaction date , transaction price. so: 12/01/08 $1500 20/05/08 $1200 09/08/15 $2000 12/09/15 $3000 i want able find sum of transactions each year. how add them together. know how add example + example "example". select transaction_id, transaction_date, transaction_amount transactions_table thanks! you'll need like: select sum(transaction_amount), transaction_date transaction_table group year(transaction_date) this sum transactions , group them year.

go - Handle response from post request to Json -

i'm using following code response server after post request: type responsefrompost struct { n_expediente string enviar string } func main(){ ...... res, err := client.do(req) if err != nil { return } defer res.body.close() body, err := ioutil.readall(res.body) var re responsefrompost err = json.unmarshal(body, &re) fmt.println(re.enviar); } with get: error: &{%!e(string=array) %!e(*reflect.rtype=&{32 2509985895 0 8 8 25 0x608170 [0x7703c0 <nil>] 0x730b80 0x69acb0 0x6116c0 0x7732c0})} the value sent server is: [{"n_expediente":"9","enviar":"2"}] how can use json variables? the json array of objects having strings n_expediente , enviar on each instance. in go you'll need array of type; re := []responsefrompost{} err := json.unmarshal([]byte(`[{"n_expediente":"9","enviar":"2"}]`), &re) fmt.

php - .htaccess requests correct login twice with .htpasswd and wordpress -

i use .htaccess ask credentials access members data. .htaccess file stored in 1 of directories , protects in directories below it. .htaccess file simple: authname "members area" authtype basic authuserfile /home/xxxxx/public_html/xxx/data/.htpasswd require valid-user problem is, when moved new server (and built new website within directory using wordpress), authentication box comes twice , requires users enter same correct login information both times. i've read in other strings here trailing / , since don't have redirect or else in .htaccess, i'm not quite sure do. anybody have suggestions on workaround or rewrite?

python - How to use the sklearn.cluster.MeanShift algorithm? -

i have problem need predict list of objects based on previous history of usage of objects. recommendation system in short. i figured can use clustering on existing data, , try find pattern among clusters. for came acros scikit-learn library in python, , think work. but need know how use 1 of clustering algorithms(say meanshift) , since examples provide work on own datasets provided in library itself. so, how organize data can use meanshift class sklearn.cluster package? my data points multidimensional, able use sklearn package in first place? haven't mentioned constraints. if can cluster multidimensional data points, have dimensionality reduction? ( don't know how either, aware of concept) i have done data mining in 1 of courses, these new waters me, in terms of pointing resources/tutorials appreciated hightly. thank you.

c# - DbExtensions - WHERE parameter with byte[] value (timestamp) -

i using code updatebuilder .update("mytable") .set("updateddate = {0}", updated.updateddate) .set("updatedbyuserid = {0}", updated.updatedbyuserid) .where("id = {0}", updated.id) .where("rowversion = {0}", updated.rowversion); and sql generates this exec sp_executesql n'update mytable set updateddate = @p0, updatedbyuserid = @p1 id = @p2 , rowversion = @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10 i guessing adding value each element in byte array, property rowversion = byte[], how fix this? in entity framework byte[] added in sql this @3=0x0000000000560f94 how can byte array this? this known issue, answer here .

c# - deserialize `Dictionary<string, Tuple<string, List<string>>>` from custom XML using XElement -

i have dictionary<string, tuple<string, list<string>>> email in want write xml (serialize) , load xml dictionary. i got write xml such: public void writetoxml(string path) { var xelem = new xelement( "emailalerts", email.select(x => new xelement("email", new xattribute("h1", x.key), new xattribute("body", x.value.item1), new xattribute("ids", string.join(",", x.value.item2)))) ); xelem.save(path); } but i'm stuck on loadxml takes xml path , loads dictionary inside email class this have far: public void loadxml(string path) { var xelem2 = xelement.parse(path); var demail = xelem2.descendants("email").todictionary(x => (string)x.attribute("h1"), (x => (string)x.attribute("body"), x => (string)x.attribute("body"))); } background information xm

eclipse - run a single integration test from a test class -

i have tried run command given in documentation: -dgrails.env=development test-app -integration myclass.\"create new test thingy search page\" however, results in integration test running class, instead of running named test. have tried rename test no spaces, toi same result. it same behavior in eclipse or command line (windows). has else experienced issue, and, if so, did find workaround? this facility not available yet. workaround, can use ignorerest annotation ( indicates feature methods except ones carrying annotation should ignored ), like @ignorerest def "should test something"() { ... } ref. run single spock test in grails

asp.net mvc - Custom Telerik DataViz chart tooltip color -

i have chart many colors. tooltip should appear black or white depending on background color of chart's bar. option can think of handle series.name . nothing works. this code accurately put white or black piece of text onto screen tooltip: .tooltip(tooltip => tooltip.visible(true).template("# if ((series.name === 'foo') || (series.name === 'bah')) { return '<strong style=\"color: black\">bar</strong>'; } else { return '<strong style=\"color: white\">bar</strong>'; } #") ) however, once plug in #= series.name # #= value # instead of bar function breaks down , no longer works. next, tried both sharedtemplate , template such (one @ time of course): .tooltip(tooltip => tooltip.visible(true).template("mytemplate") tooltip.visible(true).sharedtemplate("mytemplate") ) <script id="mytemplate" type="text/x-kendo-template"> #

Simple loop iterator in jQuery -

a simple question. how can make following script in simple for loop: jquery(document).ready(function(){ jquery("#toggle-0").click(function(){ jquery("#toggle-list-0").slidetoggle(500); }); jquery("#toggle-1").click(function(){ jquery("#toggle-list-1").slidetoggle(500); }); jquery("#toggle-2").click(function(){ jquery("#toggle-list-2").slidetoggle(500); }); }); the for loop intended in python: for in range(3): a, b = "#toggle-" + str(i), "#toggle-list-" + str(i) thanks! your code violates dry principle. there no need have 1 separate ready block each event handler. you should consider using classes , class selector instead of id selectors , use power of dom traversing methods of jquery selecting target elements. using loop here bad option/not necessary. jquery methods have been designed iterate through collection behind scenes. h

python - using requests to login to a website that has javascript login form -

let me preface saying have little programming experience. i've learned bunch in last few days trying write program. running python 2.7 on windows 7 using pycharm, requests, beautiful soup, , lxml. i trying scrape data website relies heavily on javascript. have 2 options: 1) data need populated through javascript , not need login. have not been able figure how @ data. i've live monitored headers live http headers chrome plugin , think i've found javascript i'ts beyond means figure out. long bit of code, i'll post if interested in taking look. or 2)on 1 of main pages found series of id numbers can use generate url's each of individual items analyzing. problem have logged in see these individual item pages. code follows: from requests.adapters import httpadapter requests.packages.urllib3.poolmanager import poolmanager beautifulsoup import beautifulsoup import ssl # request date user udate = "06/22/2015" # raw_input('enter date mm/dd/yy

c++ - Using boost asio stream_handle with sequential like file based devices -

i considering using asio perform "overlapped" (completion ports) style io on windows "device handle" created createfile(...overlapped...) i have quite particular design though, because of specifics of application must maintain different thread pool performing actual processing of data(work pool) , pool (a small one, 1 thread maybe) of actual io completions triggered processing pool. basically, @ beginning want trigger handful of io requests device initiated io pool. when these complete notify scheduling component posts completion packets content different threads in work pool. these completion notifications return because actual processing happen in work pool -> , particular work pool thread after processing takes place new "read" initiated should trigger completion on io pool. is dissociation possible using windows::stream_handle ? in general seems asio api associates read completions same io_service associated stream object. edit been lo

objective c - Which is a better way: retrieve images from AWS S3 or download it and store locally in a temp folder to be displayed? -

problem: retrieve image s3 , load uibutton. i'm doing research on issue , can't seem make mind. better way in terms of performance , security issue? also, need caching or store these images in core data? thanks! it depends on how use them. if app going retrieve images similiar instagram, or twitter, it's download them user requested images via app. if once images retrieved, application going use images again , again multiple times, it's idea store images after downloaded. for example, let's think application "social networking" concept, , app, let's say, has chat interface functional after users add each other. users add each other, download images of users , store them on device, can use profile images of users retrieving locally stored images rather retrieving them server, thus, each time chat each other, dont use bandwidth nothing. , should use push notification or has similiar functionality scenario, when user changes profile

javascript - Object Prototype: Case Insensitive Getter On All Properties -

i trying make object who, when search property, performs "look-up" of property case-insensitively. var x = new caseinsensitiveobject(); x.firstproperty = "hello!"; alert(x.firstproperty); //alerts hello! i've tried using object.defineproperty() this, yet requires string literal property parameter ( object.defineproperties() have same problem if think it) . is there way can generic set getter object properties of object without providing key name? i.e: object.defineallproperties(obj, { get: function(prop) { if(!prop.tolowercase && prop.tostring) prop = prop.tostring(); if(prop.tolowercase) prop = prop.tolowercase(); return this[prop]; } }); if not properties, how set even 1 property of object case insensitive?! note: i understand extending object.prototype bad thing do, have reasons. need quick fix due database changes. eventual fix take days do, , need running software

android layout - Error Parsing XML: not well formed (invalid token) -

i'm receiving following message when compiling android project: error parsing xml: not well-formed (invalid token) this xml layout file error supposed be: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0.5" android:layout_marginend="5dp" android:layout_marginstart="5dp"> <textview android:id="@+id/ph_view" android:text="ph= " android:layout_width="wrap_content" andro