Posts

Showing posts from May, 2012

asynchronous - Node.js Async mapLimit and memory -

solved, see answer please. i have list of urls fetch using request , reason unable save more 1720 records database when try fetch 2000 or more url's @ time. if try 1000 2000 , 2000 3000, 3000 results in total. when try 1000 3000 or 4000 6000, script stops after fetching 1720th result. what reason that? i use maplimit in order limit concurrent connections. app.get('/asynctest', function(req, res) { var people = []; (var = 1000; < 3000; a++) { people.push("http://www.example.com/" + + "/person.html"); } async.maplimit(people, 20, function(url, callback) { // iterator function var options2 = { url: url, headers: { 'user-agent': req.headers['user-agent'], 'content-type': 'application/json; charset=utf-8' } }; request(options2, function(error, response, body) { if (!error && response.statuscode == 200) { async.series([ ...

oracle - How can I get the PK of the Max Row in SQL -

Image
i have sql query gets order items. did this: select max(ab.num) anzahl ( select auf.anr anr,count(*) num auftrag auf, table(auf.positionen) po group auf.anr ) ab ; my result this: i want know how order-id [auf.anr] of order. how can modify query desired result? this order table (auftrag): one way use row_number analytic function: with cte ( select auf.anr anr, count(*) num auftrag auf, table(auf.positionen) po group auf.anr ) select anr (select anr, row_number() on (order num desc) rn cte) rn = 1 ... or, using method juan carlos proposing (using rownum ), syntax: with cte ( select auf.anr anr, count(*) num auftrag auf, table(auf.positionen) po group auf.anr ) select anr (select * cte order num desc) rownum = 1

php - Wordpress $wpdb->get_results not returning anything -

i'm looking pull out array of option names wordpress database of test site setup i'm running in debug mode. once i've got part of functionality down intend use expand upon plugin built. so far in searching here , on wordpress.org seems below code should working isn't: global $wpdb; $table_name = $wpdb->prefix . "options"; $sql = "select `option_name` " . $table_name . " `option_name` '%domain_%'"; $doms = $wpdb->get_results($sql, array_n); foreach($doms $dom){ echo $dom; } every time run above code following errors: notice: undefined variable: doms in /sitepath/test.php on line 38 warning: invalid argument supplied foreach() in /sitepath/test.php on line 38 i have several items in option_name column of options table fit query criteria , query works fine in mysql. what missing here?

c# - Taking screenshots with Windows Service in Windows 7 -

this question has answer here: windows service couldnt screenshot in windows 7 2 answers i know it's old question screenshots in win 7 winservice on c#. have read articles on stack overflow , lot on codeproject...i know 0 session services , starting win vista & allow service interact desktop checking... i'm stuck (i can't take screenshot service, because don't know display image(screen)) saved. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.diagnostics; using system.linq; using system.serviceprocess; using system.text; using system.timers; namespace mythirdtry { public partial class third : servicebase { private static mytimer atimer; public third() { initializecomponent(); if (!system.diagnostics.eventlog.sourceexists(...

C# Client - Server Socket Disconnect Handling -

i've got client - server code going on @ moment while working on thesis. , can spawn connection , send data, client disconnects , tries reconnect goes sideways , can't seem figure out why. many exceptions being thrown , have no idea start catching them all. doing wrong or not doing isn't allowing nether client nor server handle disconnections ?! this serverside code: using system; using system.net; using system.net.sockets; namespace server.networking { public class serversocket { private socket _socket; byte[] _buffer = new byte[61144]; public serversocket() { _socket = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); } public void bind(int port) { _socket.bind(new ipendpoint(ipaddress.any, port)); } public void listener(int backlog) { _socket.listen(backlog); } public void accept() { _socket.beginaccept(acceptedcallback, null); } private vo...

c++ - Perceptron converging but returning odd results -

i made simple perceptron in c++ study ai , following book (pt_br) not make perceptron return expected result, tryed debug , find error didnt succeed. my algorithm , gate results (a , b = y): 0 && 0 = 0 0 && 1 = 1 1 && 0 = 1 1 && 1 = 1 basically working or gate or random. i tried jump peter norving , russel book , goes fast on , dont explain on depth 1 perceptron training. i want learn every inch of content, dont want jump multilayer perceptron without making simple 1 work, can help? the following code minimal code operation explanations: sharp function: int signal(float &sin){ if(sin < 0) return 0; if(sin > 1) return 1; return round(sin); } perceptron struct (w weights): struct perceptron{ float w[3]; }; perceptron training: perceptron starttraining(){ //- random factory generator long int t = static_cast<long int>(time(null)); std::mt19937 gen; gen.seed(std::r...

time series - Recursive daily forecast -

i doing recursive one-step-ahead daily forecast different time series models 2010. example: set.seed(1096) datum=seq(as.date("2008/1/1"), as.date("2010/12/31"), "days") r=rnorm(1096) y=xts(r,order.by=as.date(datum)) list.y=vector(mode = "list", length = 365l) (i in 1:365) { window.y <- window(y[,1], end = as.date("2009-12-30") + i) fit.y <- arima(window.y, order=c(5,0,0)) list.y[[i]] <- forecast(fit.y , h = 1) } the list looks this: list.y [[1]] point forecast lo 80 hi 80 lo 95 hi 95 732 -0.0506346 -1.333437 1.232168 -2.012511 1.911242 [[2]] point forecast lo 80 hi 80 lo 95 hi 95 733 0.03905936 -1.242889 1.321008 -1.921511 1.99963 .... [[365]] point forecast lo 80 hi 80 lo 95 hi 95 1096 0.09242849 -1.1794 1.364257 -1.852665 2.037522 and want extract forecast value each period [1]-[365], can work forecast data. however, not sure how this. tried sa=sapply(list.y[1:3...

Meteor.setTimeout() memory leak? -

i've created new project 1 file (server.js) on server tiny piece of code nothing. but, after running it, node process using 1gb of memory. know why? for (var = 1000000; >= 0; i--) { meteor.settimeout(function(){},1000); }; apparently meteor.settimeout() function or uses (closure?) prevents gc clearing memory after has been executed. ideas? since calling on server side, meteor.settimeout lot more complex appears on surface. meteor.settimeout wraps settimeout meteor.bindenvironment(), binding context of current environment timeout callback. when timeout triggers, pull in context of when called. a example if called meteor.method() on server , used meteor.settimeout() within it. meteor.method() keep track of user called method. if use meteor.settimeout() bind environment callback timeout, increasing amount of memory needed empty function(). as why there isn't garbage collection occurring on server, may not have hit it's buffer. tried running test , v...

filenames - Python - WindowsError: [Error 2] The system cannot find the file specified -

i have folder full of pdf files. i'm trying remove spaces files name , replace them underscores. here's have far: import os, sys folder = path folder filelist = os.listdir(folder) files in filelist: if ' ' in files: newname = files.replace(" ", "_") os.rename(files, newname) when run script following error: windowserror: [error 2] system cannot find file specified i'm guessing there pretty simple fix, i've on , cannot find solution life of me. thanks help! ... os.rename(os.path.join(folder, files), os.path.join(folder, newname))

How to read a .seq file from s3 in Spark -

i trying .seq file s3. when try read using sc.textfile("s3n://logs/box316_0.seq").take(5).foreach(println) it outputs - seqorg.apache.hadoop.io.text"org.apache.hadoop.io.byteswritable'org.apache.hadoop.io.compress.gzipcodecp and bunch of encoded characters. format , how should go decoding file ? first time hadoop please generous :) update : tried sc.sequencefile[text,byteswritable]("s3n://logs/box316_0.seq").take(5).foreach(println) so data json blob stored in sequence file , gives me - serialization stack: - object not serializable (class: org.apache.hadoop.io.text, value: 5) - field (class: scala.tuple2, name: _1, type: class java.lang.object) - object (class scala.tuple2, (5,7g 22 73 69 6d 65 43 74 71 9d 90 92 3a .................. – user1579557 5 mins ago try: val path = "s3n://logs/box316_0.seq" val seq = sc.sequencefile[longwritable,byteswritable](path) val usablerdd = seq.map({case (_,v : byt...

Freemarker - How to indirectly recognize a missing list -

in freemarker, how can indirectly identify missing list variable? indirectly, mean have string value containing name of list; need convert string variable name (of list) , check see if list present. indirection critical application. for example, code works: <#assign existing_list = ["a","b"]> <#assign existing_list_name = "existing_list"> <#assign ref_existing_list = existing_list_name?eval> <#if ref_existing_list?has_content> correctly identified existing list. <#else> failed identify existing list. </#if> producing output: correctly identified existing list. but if list not present, cannot convert string variable name check if list present. example: <#assign nonexistent_list_name = "nonexistent_list"> <#assign ref_nonexistent_list = nonexistent_list_name?eval> <#if ref_nonexistent_list?has_content> failed identify list non-existent. <#else> ...

swift2 - Swift chained assignment through computed property or subscript: Where is this documented? -

i surprised find assigning member of value type through either subscript operation or computed property in swift worked 1 expect reference type: e.g. expected myarrayofvaluetype[0].somefield = value either disallowed or no-op assign copy discarded. in fact call both getter and setter: performing mutation , assigning value type automatically. my question is: behavior documented? can rely on behavior? struct foo { var : int = 1 } struct fooholder { var foo : foo = foo() var afoo : foo { { return foo } set { foo = newvalue } } subscript(i: int) -> foo { { return foo } set { foo = newvalue } } } var fh = fooholder() fh.afoo.a // 1 fh.afoo.a = 42 // equivalent: var foo = fh.afoo; foo.a = 42; fo.afoo = foo fh.afoo.a // 42! // same true of subscripts var fh = fooholder() fh[0].a // 1 fh[0].a = 42 fh[0].a // 42! edit: to state question in way: swift makes both subscript , computed property access transparent far va...

python - ObjectPath: trouble with "in" operator -

i learning objectpath python , have found out, e.g., how exact match on attribute: >>> import objectpath >>> >>> tree = objectpath.tree({'doc': {'title': 'purple best color'}}) >>> >>> tree.execute('$..*[@.title "purple best color"]').next() {'title': 'purple best color'} this makes sense me; want start root ( $ ) , recursively ( .. ) find ( * ) items ( @ ) title == "purple best color". , works! but try similar in operator: >>> tree.execute('$..*["purple" in @.title]').next() traceback (most recent call last): file "<stdin>", line 1, in <module> stopiteration huh? seemed natural way tweak condition, it's not quite right. in manual, read in checks if result of left side of expression in array, object or string , , in objects, keys matched. (maybe that's issue, not sure quite means here). think curr...

css - HTML img tag with hover issue -

am having hard time trying figure why cannot images here change color on hover. images svg files , should adopt color. code: html: <div class="tooltile col-md-3"> <a href="#/cards"> <img src="ppt/assets/toolicons/requestnewcard.svg" > <p>manage debit card</p> </a> </div> <div class="tooltile col-md-3"> <a href="#/recurclaim"> <img src="ppt/assets/toolicons/recurring.svg" > <p>recurring claims</p> </a> </div> and associated css: .tooltile { height: 200px; float: left; } .tooltile img { color: #ab2328; height: 100px; width: 93px; margin-left: auto; margin-right: auto; display: block; } .tooltile img:hover { color: yellow; } color related text elements, want border. .tooltile img:hover { border: yellow 1px solid; } ...

perl - Why does ${fh} behave differentially than $fh when reading line by line? -

this script: #!/usr/bin/perl use strict; use warnings; ${fh}; open($fh, '<', "some_file.txt") or die "fail\n"; while(my $line = <${fh}> ) { print $line; } close $fh; outputs: glob(0x5bcc2a0) why output? if change <${fh}> <$fh> , print some_file.txt line line expected. thought braces used delimit variable names, , my ${var} same my $var . are there other scenarios adding {} around variable name causes problems? i tried on perl 5.8.8 on red hat , cygwin perl 5.14. from section on <> in perlop : if angle brackets contain simple scalar variable (for example, $foo ), variable contains name of filehandle input from, or typeglob, or reference same. example: $fh = \*stdin; $line = <$fh>; if what's within angle brackets neither filehandle nor simple scalar variable containing filehandle name, typeglob, or typeglob reference, interpreted filename pattern globbed, , either list of ...

windows - Installing python modules in TideSDK -

i trying install external dependency python tidesdk. current module trying install redis-py . to install tried following steps: open command prompt in regular administrative mode change directory downloaded module of redis-py provide path python module used tidesdk followed standard compile , install source command prompt. command used: "c:\program files (x8 6)\tidesdk developer\modules\python\1.3.1-beta\python.exe" setup.py install the setup looked promising. redis-py module egg file confirmed installed both installer exited no errors , visual check on directory. so gives? correct files installed in lib/site-packages . tidesdk gives me importerror: no module named redis . suggestions? i solved module: simplejson . guess workaround should work module of kind. btw, simplejson may used support json, actual version (tidesdk 1.3.1-beta) comes python 2.5 doesn't support standard json module, comes in python 2.6 (or higher). first, path using ...

jquery - How can I select data from a json object in mysql/php? -

i'm sending json server via jquery's ajax method. here's jquery, , im pretty sure fine: function stuffs() { this.fname = document.getelementbyid("fname").value; this.lname = document.getelementbyid("lname").value; this.email = document.getelementbyid("email").value; } $(function() { function ajaxhelper(data){ //console.log(json.stringify(data)); //this returns "{"fname":"mike","lname":"smith","email":"a@a.a"}" expect $.ajax({ url: 'postdb.php', type: 'post', data: {data : json.stringify(data)}, success: function(data) { console.log(json.stringify(data)); console.log("success"); }, error: function(e) { console.log(e); } }); } $("form").on('submit', function(e){ e.preventdefault(); var data = n...

Proper pagination in c# by days in asp.net mvc environment -

following scenario: have x amount of elements different dates. want group elements date , display elements each day. want display 3 days per page. data loaded on page refresh in model. what doing load elements in global.asax , have list of objects using relation between page id , date. when open page id 1, videos date according id. when add item database, i'd have redo whole process. wondering if there better way handle whole thing. well marianne, there's no code in question nobody able speak that. your architecture use few tweaks. things stick out are: using global.asax controller . that's big no-no. use controller it's meant used. if absolutely need cache of database results, take @ sqldependency . if reading post correctly, appear not using where clause in sql query. big no-no. i bet 2 changes find of issue goes away. if after making changes find still have issue, feel free post new question.

html - How to align aside as sidebar? -

i working on page employees biography 1 picture. biography (content) display on left , photo of employee on right sidebar. page have footer full width. i used css layout page, , float:left both content , photos , set width divided accordingly, photo (aside) not display on right , appear under content, used display:inline properties both content , aside. trying display aside on right side of article . article, h1, aside, footer { padding: 20px; } h1 { width: 100%; background-color: gray; } article { width: 60% float: left; display: inline; } aside { width: 40%; float: left; display: inline; } footer { width: 100%; background-color: gray; clear: both; } <body> <article> <h1>biography</h1> <p>general information goes here</p> <p>rest of information goes here</p> </article> <aside> <h2>employee photo</h2> <img src...

BrowserSync with gulp and wamp not refreshing php files -

my gulp file: var gulp = require('gulp'); var browsersync = require('browser-sync').create(); //server gulp.task('run', function() { browsersync.init({ proxy: "http://localhost/test-site/" }); gulp.watch("./*.php").on('change', browsersync.reload); }); when running gulp run terminal it's fire browser , shows page expected without "connected browsersync" msg , when saving changes gulp watch fires , terminal shows [bs] reloading browsers... browser not refreshing page now on other hand when i'm changing file extension "html" , gulp watch gulp.watch("./*.html").on('change', browsersync.reload); work expected: when running task it's fire browser, time "connected browsersync" msg , when saving changes refresh page. today did manage refresh page on php file change lost , can't find reason why it's not working more, couldn't find ...

Multi Applications as Docker Containers in a Cluster, Ways to Handle MySQL -

most of articles online regarding setting docker containers seem written around idea of breaking application micro services , allocating them various containers , deploying them cluster. i find out best way handle databases (e.g. mysql) multiple unrelated applications, written different clients, deployed same cluster. say have 10 unrelated small applications (like wordpress), requiring access mysql database. could: deploy applications containers cluster, containing application code, , setting dedicated mysql server or google cloud sql instance , asking each of application containers connect database 3rd party services. deploy applications containers cluster. each applications, deploy separate database container cluster , linking two. deploy separate database container cluster , link container various application containers in cluster. which of these solutions best in turns of application architecture design , of these best use of computer resources? have feeling while d...

c# - KendoGrid not populating but it should be -

Image
i have kendogrid in view , reason, not populating , have no idea why, things show should, isn't wanting to, maybe missing something? this order of events... $(document).ready(function () { getcataloginfo(); }) function getcataloginfo() { $.ajax({ type: "get", url: urlparams.getthecatalog, datatype: "json", contenttype: "application/json; charset=utf-8", success: function (data, textstatus, jqxhr) { thecataloggrid(data); } }) } here grid function thecataloggrid(catalogdata) { $("#cataloggrid").kendogrid({ datasource: { catalogdata }, columns: [{ field: "globalgroupid", title: "globalgroupid", hidden: true }, { field: "globalgroupname", title: "groupname" }], scrollable: true, sortabl...

c# - ASP.NET how does markup access to variables in code-behind? -

i have webform button: <asp:button id="btn1" runat="server" text="click me" onclientclick="printvideos(new object(),new eventargs(),url,linkname)"/> and onclientclick event is <script language= "c#" type="text/c#" runat= "server"> private void printvideos(object sender, eventargs e, string url, string linkname) { (int = 0; < 4; i++) { response.write("<a href='"+url+"'target_blank>'"+linkname+"</a>"); } } </script> where url , linkname defined in c# code-behind private string s within class. the button not work, , there warnings showing url , linkname not used. should let markup access code-behind variables? your first problem trying run server side code on client - change onclientclick onclick . next, need set protection level of linkname , url properties aspx ma...

interceptor - Retrofit 2.0 headers authentication -

private void setuprestclient() { okhttpclient client = new okhttpclient(); client.interceptors().add(new interceptor() { @override public response intercept(chain chain) throws ioexception { request original = chain.request(); request request = original.newbuilder() .header("accept", "application/pyur.v1") .header("authorization", new sharedpreferencesutil(getbasecontext()).gettoken()) .header("content-type", "application/json") .method(original.method(),original.body()) .build(); return chain.proceed(request); } }); restclient.getinstance().configurerestadapter(this, getresources().getstring(r.string.base_url),client); } 'public void configurerestadapter(final context context, string baseurl, okhttpclient ...

ruby on rails - Using a frozen constant as a hash key? -

i built small api makes few calls have similar payloads, have base payload merge in call-specific elements, so: def foo_call base_payload.merge({"request.id" => request_id}) end def biz_call base_payload.merge({"request.id" => some_other_thing}) end def base_payload { bar: bar, baz: baz, "request.id" => default_id } end my coworker suggested make "request.id" frozen constant, arguing making constant means can freeze means wont allocating new string object on each call, saving bit of memory. this: requestid = "request.id".freeze def foo_call base_payload.merge({requestid => request_id}) end def biz_call base_payload.merge({requestid => some_other_thing}) end def base_payload { bar: bar, baz: baz, requestid => default_id } end i'm little apprehensive, can't quite pin down reason why not (other latent resistance @ having new commit :> ). feel might cause...

With a simple http server in node.js, how to find out why it's crashed? -

i running basic http server serve static files in node.js express : var setting = require('../setting') var express = require('express'), app = express(), port = setting.http.port; app.use(express.static(__dirname + '/' + setting.http.static_dir)); app.listen(port); i know can use forever restart server if it's dead reason. but, there way log when server crashed can know reason why it's crashed , when it's crashed? with forever : forever -o out.log -e err.log my-script.js see this answer more details . if want log express server errors, use error handler generated express cli tool: server.on('error', onerror); /** * event listener http server "error" event. */ function onerror(error) { if (error.syscall !== 'listen') { throw error; } var bind = typeof port === 'string' ? 'pipe ' + port : 'port ' + port; // handle specific listen errors friendly m...

virtualbox - Getting timeout on vagrant up -

today have started learning vagrant. creating first, base virtual machine ( hashicorp/precise32) went pretty smooth. wanted test box, time :puppetlabs/ubuntu-14.04-32-puppet. im getting msg : default: warning: connection timeout. retrying... have read might because of disabled virtualization, understand virtualization it's needed 64bit machines. can problem here? me, please? in advance. try increase 'ssh_wait_timeout' increase 'boot_wait' activate vb.gui options in vagrantfile increase 'config.vm.boot_timeout options in vagrantfile disable shared folder line config.vm.synced_folder '.', '/vagrant', disabled: true in vagrantfile update vagrant (latest 1.8.1) update virtualbox (latest 5.0.12) cross finger

android - Compile error building project with multiple flavors and Play Services -

when trying build play services enabled project multiple flavors, compile errors. think might related package names not matching, not sure. have hints doing wrong? i using newer gradle plugin allows ( per gh issue ) i seeing error when try build multiple flavors: error:(115, 50) error: cannot find symbol variable global_tracker i double checked package names match expectation, wonder if still not correct. my build.gradle looks this: productflavors { app1 { applicationid "com.examplea.app" manifestplaceholders = [domain:"examplea"] } imore { applicationid "com.exampleb.app" manifestplaceholders = [domain:"exampleb"] } crackberry { applicationid "com.examplec.app" manifestplaceholders = [domain:"examplec"] } an example of 1 of google-services.json files (which located @ main/src/examplea) i...

Order list item on Rails update with jQuery -

i have sidebar list of room names. can edit room's name in modal. when click update in modal, room name should updated in sidebar , should appear in proper order in list. happen on refresh because of server side rails code. need make work on client side. it's working fine except sorting. i've tried in update.js.erb file: $("ul.rooms li").detach().sort(asc_sort).appendto('ul.rooms'); function asc_sort(a, b){ return ($(b).text()) < ($(a).text()) ? 1 : -1; } that results in each list item appearing twice , newly updated room sorts bottom of list. here's html looks list item (the room name 1): <li> <a href="#" class="room" id="room-11"> 1 <span class="badge counter"></span> </a> <a class="cog-link pull-right" style="padding:0 20px 0 2px;" data-remote="true" href="/rooms/11/edit"><i class="glyphic...

ios - Need a completion block for SnapKit constraints in a UIView -

i have uiview in swift using snapkit layout it's views. want blur 1 of views, need put blur code in method runs after layout code finished , 1 view has it's proper size. i can't seem figure out right place blur code go. since snapkit based on blocks, it's asynchronous , don't know when finished. callback method can use? edit: reported issue on snapkit , blocks synchronous after all. however, in layoutsubviews (and after synchronous blocks) frames still cgrectzero , blur code can't snapshot , blur view of 0 width or height. i don't know snapkit there's technique can use code executed after last of bunch of asynchronous blocks has been completed. the trick create class hold piece of code , have each block hold reference it. in class's deinit code, execute code. example: class completionblock { var completioncode:()->() init?(_ execute:()->() ) { completioncode = execute } func deferred() {} deinit { ...

objective c - uisearchbar in grouped section uitable -

i've pieced several tutorials create grouped table sections , i'm trying uisearchbar work. problem i'm having how search within grouped sections. i've read similar questions post suggested can't this code create grouped sections #import "job.h" // model data #import "address.h" // model data - (void)viewdidload { [super viewdidload]; self.thetable.delegate = self; self.thetable.datasource =self; _searchbar.delegate = (id)self; fmdbdataaccess *db = [[fmdbdataaccess alloc] init]; jobs = [[nsmutablearray alloc] init]; jobs = [db getjobs:1]; _sections = [[nsmutabledictionary alloc] init]; nsmutablearray *jobstemparray = [db getjobsasdictionary:1]; bool found; // loop through books , create our keys (nsdictionary *book in jobstemparray) { nsstring *clong = [book objectforkey:@"addraddress"]; nsstring *c = [clong substringtoindex:1]; found =...

ios - Dynamically changing the height of the cell and UIImage based on the ratio of actual image -

this have tried far i defined global variable float imgheight; then in - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath this size_t pixelswide = cgimagegetwidth(scribbleimage.image.cgimage); size_t pixelshigh = cgimagegetheight(scribbleimage.image.cgimage); cgfloat ratio = 312/pixelswide; pixelshigh = pixelshigh*ratio; then in - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath return pixlesheight; now since heightforrowatindexpath called before cellforrowatindexpath , pixelsheight 0 . i cannot figure out way of doing this. should redefine uiimage in heightforrow , this [scribbleimage setimagewithurl: [nsurl urlwithstring:scribble[@"scribble_image"]] placeholderimage:[uiimage imagenamed:@"default.png"]]; in there well?! there should easier way of doing this. do in heightforrowatindexpath. understand conce...

php - How to import XML feed with multiple images -

i have xml feed ... <products> <product> <title>mini piscina</title> <description>mini piscina penru copii pana la 6 ani.</description> <price>22.00</price> <images> <image1>produs_1402038969.jpg</image1> <image2>produs_1402382460.jpg</image2> </images> </product> </products> ... , part of script ... $xml=simplexml_load_file("../feed/feed") or die("error: cannot create object"); $partener = 'toys'; foreach($xml -> product $row) { $magazin = $partener; $titlu = $row -> title; $descriere = $row -> description; $pret = $row -> price; $imagine1 = $row -> images1; $imagine2 = $row -> images2; $sql = "insert toys (magazin,titlu,descriere,pret,imagine1,imagine2) values ('$magazin','$titlu','$descriere','$pret','$imagine1',...

python - How can I change this div with same search_key when I click next button? -

this views.py retrieve 6 image urls instagram.first time ok how can change shown 6 images in home.html file(that retrieve 6 new images) when click next button? def home(request): trends = [] if request.method == 'post': if request.post.get('q'): search_key = request.post.get('q').replace(" ","") getimagefrominstagram(search_key) else: search_key = '' veriler = hashtags.objects.values_list('hashtag',flat=true) line = hashtags(hashtag=search_key,trends=search_key,image_url=tagurl) line.save() return render(request, "home.html", {'trends':trends,'urls':urls,'hashtags':veriler}) def getimagefrominstagram(): tagurl = 'https://api.instagram.com/v1/tags/'+ search_key +'/media/recent?client_id=hidden security' q = requests.get(tagurl).json() urls = [ q['data'][i][...

In R, is it possible set the title of a Cairo window? -

i'm outputting several plots via cairo package in r. having 5 windows titled "cairo graphics" makes hard find right 1 in taskbar. is there anyway change text in title bar? these did not work: cairowin(title="hello") windows.options(title="hello"); cairowin() unfortunately, window title hard-coded in cairo source code (in w32-backend.c ): window gawin = newwindow("cairo graphics", rect(20,20,width,height), document|standardwindow); so answer no, unless want patch , recompile package.

Issue with printing space with single quotes in a int array in Java -

i want print int[] in specific format (within space between each numbers, etc) however found java not print spaces in single quotes, , change numbers in int[] . same things happened bracket character. for example: int[] test = {1,2,3,4,5}; system.out.println('(' + test[0]+ ' ' +test[1] + ' ' + test[2] + ' ' +test[3] + ' ' + test[4] + ')'); //224 system.out.println("(" + test[0]+ " " +test[1] + " " + test[2] + " " +test[3] + " " + test[4] + ")"); //(1 2 3 4 5) i think space , bracket characters, , wonder why need use double quotes print them , why single quotes space character change output? thank you! the reason is, characters fundamentally stored numbers. when add characters other numbers, you'll receive number result. // prints 97 system.out.println('a' + 0); the situation character...

centos - How to install php55-php-mcrypt with scl-utils? -

it's known fact on fedora/rhel/centos 7.x based systems php 5.4.16 supported version. however, application needed php 5.5 , installed rhel-recommended scl-utils repository explained on https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/developer_guide/scl-utils.html the problem have installed required packages except php55-php-mcrypt : yum install php55-php-mcrypt loaded plugins: fastestmirror loading mirror speeds cached hostfile * base: mirrors.sonic.net * epel: mirror.hmc.edu * extras: mirror.keystealth.org * updates: mirrors.easynews.com no package php55-php-mcrypt available. error: nothing could recommend way package installed? explanation why "mcrypt" bad idea, , not part of standard repository : about libmcrypt , php-mcrypt for people want use official rhscl packages on rhel (which available in centos-scl repository), can find additional packages in community repositories: php55 => php55more rh-php56 =...

c# - Proving my contracts are validating the right thing -

i have interface so: [contractclass(typeof(contractstockdataprovider))] public interface istockdataprovider { /// <summary> /// collect stock data cache/ persistence layer/ api /// </summary> /// <param name="symbol"></param> /// <returns></returns> task<stock> getstockasync(string symbol); /// <summary> /// reset stock history values specified date /// </summary> /// <param name="date"></param> /// <returns></returns> task updatestockvaluesasync(datetime date); /// <summary> /// updates stock prices latest values in stockhistories table. /// </summary> /// <returns></returns> task updatestockpricesasync(); /// <summary> /// determines last population date stockhistories table, , /// updates table available after that. /// </summary> /// <returns></...