Posts

Showing posts from July, 2015

vb.net - Boxedapp packer packed executable finds for file outside package -

i have 2 files 1 main executable , other run first one. want pack these files 1 executable, boxedapp packer or enigma virtual box main executable file searches other file outside packed exe file. tried option share virtual environment child processes did not work. way main exe made vb.net needs file in current directory. please me.

Assigning variables with dynamic names in Java -

i'd assign set of variables in java follows: int n1,n2,n3; for(int i=1;i<4;i++) { n<i> = 5; } how can achieve in java? this not how things in java. there no dynamic variables in java. java variables have declared in source code (*). period. depending on trying achieve, should use array, list or map ; e.g. int n[] = new int[3]; (int = 0; < 3; i++) { n[i] = 5; } list<integer> n = new arraylist<integer>(); (int = 1; < 4; i++) { n.add(5); } map<string, integer> n = new hashmap<string, integer>(); (int = 1; < 4; i++) { n.put("n" + i, 5); } it possible use reflection dynamically refer to variables have been declared in source code. however, only works variables class members (i.e. static , instance fields). doesn't work local variables. see @fyr's "quick , dirty" example. however doing kind of thing unnecessarily in java bad idea. inefficient, code more complicated...

java - Parsing android resources from xml -

i facing problems parsing xml-file android app. i need layout ids , color ids xml file. have no problems in reading string values dont know how convert xml layout reference layout id? help!! my xml file looks that: <program name="programname" color="@color/white" preflayoutid="@layout/pref" /> my parsing code works that. parsing of color/layout not work: xmlpullparser xmlparser = getresources().getxml(r.xml.programlist); int event = xmlparser.geteventtype(); while (event != xmlpullparser.end_document) { string name = xmlparser.getname(); switch (event) { case xmlpullparser.start_tag: { break; } case xmlpullparser.end_tag: { if(name.equals("program")) { programinfo pi = new programinfo(); pi.name = xmlparser.getattributevalue(null, "name"); // here need color.black; pi.color = integer...

guzzle - Can't install guzzlehttp for Laravel -

i using php 5.4 , have laravel 5.1 development. when try install guzzlehttp through composer laravel error php 5.4 doesn't specify requirements. tried install lowering version composer require "guzzlehttp/guzzle": "5.0" but still no luck. thank you. try, composer require "guzzlehttp/guzzle:~5.3"

javascript - Creating a sliding image gallery that does not glitch on image change -

i have created sliding image gallery , when button pushed slides picture across , updates image attribute relevant sections. works 50% of time. other times there second glitch , images go in place expected. have attached javascript methods animate method , array change method. have looked elsewhere , cannot see else similar issue or going wrong, when doesn't happen often. imagegallery.leftselect.onclick = function () { window.settimeout(imagegallery.rightclick, 250); imagegallery.animateimages('.image1', '.imageright'); imagegallery.animateimages('.imageright', '.imagenoneright'); imagegallery.animateimages('.imageleft', '.image1'); imagegallery.animateimages('.imagenoneleft', '.imageleft'); }; animateimages: function (classfrom, classto) { var classmoving = $(classfrom); var classgoingto = $(classto); classmoving.animate({ top: classgoingto.css('top'), ...

java - TabLayout get stuck with viewpager when screen orientation change -

i using design support library. i've fragment , inside fragment have fragment has view pager 3 new fragment my fragment code - <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@color/colorprimary" app:tabindicatorcolor="@android:color/white" app:tabindicatorheight="4dp" app:tabmode="fixed" /> <android.support.v4.view.viewpager android:id="@...

multithreading - Python - Running multiple mysql inserts without waiting for completion using a queue -

problem in basic form. have multidimensional list generating csv. have operates so: data = [['hello', 'world'],['hello','universe']] in data: try: cursor.execute("""insert mytable (word1,word2) values ('%s','%s')""" % (i[0],i[1])) cursor.execute("""insert random command here""" % ()) conn.commit() except exception: conn.rollback() this works. however, has wait response before attempts commit next one. takes fair amount of time complete going 1 @ time, hoping use queue/threading in order send multiple of these queries (10 or so) @ time while goes through list of several hundred of these. i have read several tutorials on queues , multithreading, can't wrap head around how address specific items out of list (or how queuing , multithreading work). tried below (and couple of other variations) unable comprehend how work values being...

.net - How to handle intermittent errors in Console output to network file -

i've written console application typically run via task scheduler no user present. if appropriate, redirects console output file (with app-start timestamp in name) happens on network. i've seen few cases -- rare -- seems file contents ends prematurely (that is, later messages generated program not there). output third-party logging tool (gibraltar loupe) has shown me calls console.writeline can fail if there network glitch causing output file unavailable temporarily, causing unhandled exception. (once, normal app's normal exception handling -- remarkably -- able write message unhandled exception resulted when console.writeline failed due "the specified network name no longer available" -- must have been temporary glitch!) i can't think of approach other replace calls console.writeline calls of own traps such errors, waits until network again available, , tries again. (or possibly redirect output local file rest of run, other things fail if network st...

html - Dropshadow not appearing on background-image div -

i'm having issue drop shadow not showing on header , i'm not sure if has background-image tag or being in div. it's header section @ top surrounded in homeheader div , shadow below isn't showing. here's css header; #homeheader { text-align: center; font-family: 'lato'; color: white; width: 100%; height: 380px; background-image: url(http://i.imgur.com/zjv1pxt.jpg); -webkit-box-shadow: 0px 3px 5px rgba(100, 100, 100, 0.49); -moz-box-shadow: 0px 3px 5px rgba(100, 100, 100, 0.49); box-shadow: 0px 3px 5px rgba(100, 100, 100, 0.49); } the webkit-box-shadow, moz-box-shadow , box-shadow don't seem have effect on div , can't seem find out why. i'm still new coding in general thank helps out! edit: html; <div id="homeheader"> </br> <!--nav bar @ top right--> <div id="navcontainer"> <ul> ...

javascript - Possible to add a loop while appending to the DOM? -

i'm appending information dom, realized of information need nested within object. when below bit of code, part within loop returns undefined. there way iterate on , pull out information can append page: function placeonpage(allstopswithroutes){ allstopswithroutes.foreach(function(stop){ $('#stops').append("stop: " + stop.crossstreets + "<br>" + // loop here stop.routes.foreach(function(route){ "bus name: " + busname + "<br>" + "stops away: " + stopsaway + "<br>" + "destination: " + destination + "<p>" }); // end loop ); }); } i don't think strings can concatenated way. change approach concatenate before hand , store in variable. append variable function placeonpage(allstopswithroutes) { allstopswithroutes.foreach(function(stop) { var concatenatedstr = ''; ...

r - What's the proper way to handle a github script dependency in a CRAN package? -

there's great r script on github build correlation heatmaps via ggplot2 (doesn't matter, wanted hat tip). this script function, it's not on cran (as such), , not package. (it is part of upstream cran package, crucial bugfixes in script don't seem make upstream repo, let alone cran. without bugfixes, it's unusable.). this function used internally package, , never directly exposed users. what's proper way use script in package? i'd to: properly recognize script's authors work have pass cran (obviously) be able merge in upstream changes (from script ) script should sourced (or whatever) on library(mypkg) , that's ready go , not remote-sourced via internet anytime uses function (that bad). i thinking of copy/pasting file, a) recognition, , b) there has better way .

java - Wrong double variable incrementing -

this question has answer here: is floating point math broken? 20 answers i made simple code whis keeps adding 0.1 zero. code: static double num = 0; public static void main(string[] args) { num+=0.1; system.out.println(num); try { thread.sleep(100); } catch (interruptedexception e) { e.printstacktrace(); } main(null); } } this outputs: 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999 1.0999999999999999 ... but want output this: 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 ... any ideas why or how fix please? try: system.out.printf("%.1f" , num); instead of: system.out.println(num); this limit decimal places right of decimal 1 place. if wanted 3 decimal places use %.3f

javascript - jQuery remove highlight only if already selected -

this should basic fix. im wanting remove selected class when clicking on highlighted button. 1 button highlighted @ given time. http://jsfiddle.net/7wy7sjm5/1/ the reason have remove class of them execute first because when 1 clicked, 1 highlighted, , not have previous clicked ones still highlighted. , when clicking on same button highlighted, remove highlight. hope makes sense. $(".details-btn").on("click", function(){ var $this = $(this); //add/remove selected button $(".details-btn").removeclass("selected"); $this.toggleclass("selected");}); possibly using .each() cycle through each instance of button , if has class remove? ive tried different approaches , none working way want. in case can make use of .not() . basically, remove .selected .details-btn except current 1 not(this) . then, use toggle() $(".details-btn").on("click", function() { var $this = $(this); $(".details-btn...

Python key error - for key in dictionary: dictionary[key] -

i programming graph class handle pathing in game. graphs have 1 field, mapping, dictionary maps nodes edges. in 1 of functions, have following bit of code: for key in self.mapping: connected_edges = self.mapping[key] at 1 point in program, call code , following error: keyerror: <node.node instance @ 0x00000000026f3088> how possible? i'm looping through keys in dictionary, how can key not in it? sanity check, took length of dictionary , saw 5, ie: not 0. ideas? thanks! i implement own eq , hash method both node , edge. here parts of classes: class node: """ node connects other nodes via edges form graph each node has unique identifier (id) can mathematically distinct. optionally, node has x , y coordinate. """ n_nodes = 0 def __init__(self, x=0, y=0): """ create node own unique identifier. :param x: x coordinate :param y: y coordinate :return...

jquery - How to properly use multiple :not selectors using variables -

i have these 3 variables , , need use 3 in :not selector var donotcounts = 'td.player:contains(s)'; var donotcounti = 'td.player:contains(i)'; var donotcounto = 'td.player:contains(o)'; here have snippet of script , have 1 variable working fine, when add 2nd or 3rd doesn't work if ($(this).find("td.player:not("+donotcounts+")").length i have tried these , none have worked if ($(this).find("td.player:not("+donotcounts+"):not("+donotcounti+"):not("+donotcounto+")").length if ($(this).find("td.player:not("+donotcounts+"),("+donotcounti+"),("+donotcounto+")").length if ($(this).find("td.player:not("+donotcounts+","+donotcounti+","+donotcounto+")").length also , on note.....currently variables td.player:contains() , more specific. how can write , td.player hasclass span , contains() ? to s...

html - Formatting div in partials using bootstrap -

total newb question: i've created partial calling 3 of same div per row. div dynamic tho feel shouldn't have repeat same code 3 times. how can condense loops? product index <div class="container"> <%= render 'products/product' %> </div> product partial <div class="row"> <h2 class="text-center">products</h2> <% @products.each |category, products| %> <h3><%= category.name %></h3> <% products.each |product| %> <div class="col-md-4"> <div class="thumbnail"> <%= image_tag product.default_image.path %> </div> <div class="caption"> <h4><%= link_to product.name, product_path(product.permalink) %></h4> <p><%= product.short_description %></p> <p>...

closures - What is the purpose of a self executing function in javascript? -

in javascript, when want use this: (function(){ //bunch of code... })(); over this: //bunch of code... its variable scoping. variables declared in self executing function are, default, available code within self executing function. allows code written without concern of how variables named in other blocks of javascript code.

c - TWI and DS3231 library in avr-gcc -

could tell me if library correct? function (rtcreadminutes(uint8_t* minutes)) returning (5). means (i2cstart()) returning (0) why. tried written in datasheet. using atmega 328 , rtc ds3231. connected corectly. i2c.h #ifndef i2c_h #define i2c_h #include <avr/io.h> #include <util/delay.h> #define start 0x08 #define start_rep 0x10 #define mt_sla_ack 0x18 #define mt_data_ack 0x28 #define mr_sla_ack 0x40 #define mr_data_nack 0x58 void i2cinit(void); uint8_t i2cstart(void); uint8_t i2cstartrep(void); uint8_t i2cstop(void); uint8_t i2csendaddress(uint8_t); uint8_t i2csenddata(uint8_t); uint8_t i2creadack(void); uint8_t i2creceivedata(uint8_t*); #endif i2c.c #include "i2c.h" void i2cinit(void) { //set scl 400khz twsr = 0x00; twbr = 0x0c; //enable twi twcr = (1<<twen); } uint8_t i2cstart(void) { twcr = (1<<twint)|(1<<twsta)|(1<<twen); while(!(twcr & (1<<twint))); if (...

mysql - Python MySQLdb upload UnicodeEncodeError -

i have problem can upload csv files mysql, happens , encoding error. can 1 please review code , tell wrong? i'm new enconding. the following snippet how write csv files uploaded, data extracted mdb file using mdn tools (mdb-export): tableindex = 1 tname in tablenames: filename = os.path.join(csvpath, os.path.basename(mdb).split('.')[0] + '_' + tname + '.csv') try: p = subprocess.popen(["mdb-export", "-h", mdb, tname], stdout=subprocess.pipe, stderr=subprocess.pipe) tablecontent, error = p.communicate() if(p.returncode != 0): _logger.error('[%3d] export subprocess %d %s' % (tid, p.returncode, tablecontent)) sendmdberror(tid, mdb, _logger, 'alert: export subprocess') return(['', false]) if(error): _logger.error('[%3d] export communicate %d %s' % (tid, p.returncode,...

java - Using transient for both Gson and Hibernate in the same file -

i have entity need of fields not persisted , of fields not serialized. i using @transient on of fields when want mark transient gson. issue hibernate picks , not persist since keyword in hibernate . i use hibernate-jpa-2.1-api javax.persistence.transient i trying prevent addresses being serialized , getdefaultaddress should not saved. code: @entity @table(name="business") public class business{ @onetomany(mappedby="business") private transient list<phone> addresses; @transient public phone getdefaultphone() { return phones.get(0); } } any solution? you can use @expose @expose(serialize = false) @onetomany(cascade=cascadetype.all, mappedby="business") private list<address> addresses; in order able work annotation, final gsonbuilder builder = new gsonbuilder(); builder.excludefieldswithoutexposeannotation(); final gson gson = builder.create(); source : http://www.javacreed.com/gson...

ruby on rails - Sass::SyntaxError: Invalid CSS after -

hey trying add rails 4.2 project heroku. keep coming error this log trace anish-laptop:wise-owl anish.patel$ rails_env=production bundle exec rake assets:precompile rake aborted! sass::syntaxerror: invalid css after "*, :": expected pseudoclass or pseudoelement, " after, :before" (sass):152 /users/anish.patel/.rvm/gems/ruby-2.2.1/gems/sass-3.4.14/lib/sass/scss/parser.rb:1162:in `expected' /users/anish.patel/.rvm/gems/ruby-2.2.1/gems/sass-3.4.14/lib/sass/scss/parser.rb:1098:in `expected' /users/anish.patel/.rvm/gems/ruby-2.2.1/gems/sass-3.4.14/lib/sass/scss/parser.rb:1093:in `tok!' /users/anish.patel/.rvm/gems/ruby-2.2.1/gems/sass-3.4.14/lib/sass/scss/static_parser.rb:277:in `pseudo' /users/anish.patel/.rvm/gems/ruby-2.2.1/gems/sass-3.4.14/lib/sass/scss/static_parser.rb:154:in `simple_selector_sequen production.rb 'rails.application.configure config.cache_classes = true config.eager_load = true config.consider_all_req...

windows - Unable to connect to a subversion edge server remotely -

i have following configuration: windows 7 enterprise x64 host running vmware workstation v11.0.0 build 2305329 client (vm) windows server 2008 r2 x64 symantec endpoint protection client (unmanaged) v12.1.5337.5000 using collabnet subversion edge v5.0.1-4144.7 i can connect subversion's admin port of 3343/4434 host computer, when attempting connect client 2 external servers, page cannot displayed. can connect default web port of 80 , default iis 7 page. i think may firewall configuration situation, have tried opening tcp/udp ports in both windows firewall rules , sep rules , still unable connect. i might able working if install tfs on port 8080 , uninstall tfs. rather not.

java - Cannot find the symbol class R even after adding import com.example.app.R; -

i using intellij idea , tried build android application , giving error saying 'cannot find symbol class r' @ places used r in code. included 'import com.example.app.r' line in classes , code correct , showing no errors. checked file->project structure->modules , both gen , src included sources. me fix this. could please try way file-> invalidat caches/restart , click on invalidate , restart button. sometimes, takes cache , screws operation, restarting , invalidating cache works, please try out , inform.

java - JPA Findby.<property> in many to many relation -

i have many:many relationship between 2 classes. trying find products customer. e.g. class customer { @manytomany @jointable private list<product> products; } class product { @manytomany (mappedby="products") private list<customer> customers; } public interface productrepository extends jparepository<products, integer> { list<customer> findbyproducts(product aaa); } where "findbyproducts" products property in customer class. in every case getting 0 size list of customers. have tried pass product list no success. i not sure doing wrong or approach wrong in many many relation. appreciated. thanks in advance.

ipython - Zeppelin: Constructor org.apache.spark.api.python.PythonRDD does not exist -

ipython notebook started per docs ( pyspark_driver_python=ipython pyspark_driver_python_opts="notebook" ./bin/pyspark ), filled in with: from os import path tempfile import gettempdir #from pyspark import sparkfiles filename = path.join(gettempdir(), 'somefile.txt') open(filename, 'w') f: f.writelines(['foo\n'*500]) #sc = sparkcontext(appname="pythonsort") sc.addfile(filename) print 'sc.textfile(filename).count() =', sc.textfile(filename).count() sc.stop() output: sc.textfile(filename).count() = 500 apache zeppelin notebook %pyspark # same "ipython notebook" output: (<class 'py4j.protocol.py4jerror'>, py4jerror(u'an error occurred while calling none.org.apache.spark.api.python.pythonrdd. trace:\npy4j.py4jexception: constructor org.apache.spark.api.python.pythonrdd([class org.apache.spark.rdd.mappartitionsrdd, class [b, class java.util.hashmap, class java.util.arraylist, class jav...

javascript - KnockoutJS submit binding not working with foreach -

hello unable use knockout 'submit' binding 'foreach' binding. cannot figure out mistake here. please me find mistake. my view model this: function poreceivingmodel(){ var self = this; var initial_row = new poreceivingrowmodel(); self.rows = ko.observablearray([initial_row]); self.saveandadd = function(formelement){ alert('entered function'); var row = new poreceivingrowmodel(); self.rows.push(row); }; }; function poreceivingrowmodel(){ var self = this; self.building = ko.observable(); self.isele_abc = ko.observable(); self.isele_num = ko.observable(); self.isele_floor = ko.observable(); }; and html binded 'viewmodel' this: <tbody data-bind="foreach: rows"> <form data-bind="submit: $parent.saveandadd"> <tr> <td> <!-- input field here --> </td> <td> ...

javascript - How to check really width with "auto" value on css -

i have loop: var takediv = document.getelementbyid('eye'); for(var i=0; i<kategoria.length; i++){ takediv.innerhtml +=^ '<img alt="'+(kategoria.length-i)+'" '+ 'onclick="changef(this.alt)" '+ 'src="mobile/img/pic/'+loc+"/mini/"+kategoria[kategoria.length-i-1][0]+'" '+ 'style="cursor: pointer;"/>'; } all images having css: height: 80px; width: auto; and after loop need give div css document.getelementbyid('eye').style.width which sum of inner img widhts it first post here sorry mistakes. please help, , thanks! you can use several approaches, example getboundingclientrect() returns absolute values position , width/height: var width = document.getelementbyid('eye').getboundingclientrect().width; just note not include border or padding, inner box. then there getcomputedstyle() - return ...

user interface - Old Linux gui framework? -

some old linux programs seems use different gui framework gtk or qt, it? like old netscape linux: http://www.gis.usu.edu/unix/howtos/netscape6.gif http://www.gis.usu.edu/unix/howtos/netscape6.gif or project manager (objective c ide) http://home.gna.org/pmanager/screenshots/0.2/filemanagermodule.png http://home.gna.org/pmanager/screenshots/0.2/filemanagermodule.png and possible theme it?

php - Symfony2 FosUserBundle is loosing session -

i using fosuserbundle register , authenticate users in website. having troubles cause user session loosen soon. 5 minutes, 10 minutes, , user redirected login form again, causing many users left website. this have in project: composer.json {"require": { "php": ">=5.3.3", "symfony/symfony": "2.6.*", "doctrine/orm": "~2.2,>=2.2.3,<2.5", "doctrine/dbal": "<2.5", "doctrine/doctrine-bundle": "~1.2", "twig/extensions": "~1.0", "symfony/assetic-bundle": "~2.3", "symfony/swiftmailer-bundle": "~2.3", "symfony/monolog-bundle": "~2.4", "symfony/yaml": "2.7.*@dev", "symfony/filesystem": "~2.6", "sensio/distribution-bundle": "~3.0,>=3.0.12...

javascript - AngularJs - $digest() iterations reached with $cookieStore -

app.controller('appctrl', function ($scope, $cookiestore) { $scope.$watch(function(){return $cookiestore.get('currentuser');}, function(newvalue, oldvalue){ if(newvalue !== oldvalue){ $scope.currentuser = $cookiestore.get('currentuser'); } }); }); i have developed code above intention watch value saved in $cookiestore. when user singed in successfully, json object saved in $cookiestore, of $watch function, user information display on top corner of page. $cookiestore.put('currentuser', response); i having 2 issues solution: the $watch function not update $scope.currentuser hoping to. gets updated when refresh whole web page. somewhere in solution, $digest() functions called repeatedly. tried resolve problem adding if(newvalue !== oldvalue){} , not work. if change solutions use $cookies instead of $cookiestore, seems working expected, $cookies not allow me save json object, why prefer use $cookiestore instead....

javascript - Node.js / Express routing doesn't work properly -

first of all, i'm new node.js. here thing; i'm making mobile application need use routes login or register. on android side, i'm using android volley library accomplish post method. here code on server side. server.js; var express = require('express'), validator = require('express-validator'), app = express(), bodyparser = require('body-parser'); // configure app use bodyparser() data post app.use(require('express-method-override')()); app.use(bodyparser.json()); app.use(bodyparser.urlencoded({ extended: true })); app.use(validator); app.use(express.static(__dirname + '/public')); var http = require('http'); var ip = process.env.openshift_nodejs_ip || '127.0.0.1' || 'localhost', port = process.env.openshift_nodejs_port || '8080'; // register routes app.use('/', require('./routes').router); http.crea...

excel - Pivot table formula -

i working on excel report (excel 2013 pivot table). have field called [day of month] dragged onto columns in pivot layout. at end of column added new field usd (usd=total item qty/no.of days). my problem when select 2 or 3 days in filter[day of month], column width reducing formula field usd not reducing. here have far : day 1...........................2 qty usd qty usd total usd 10 50 20 30 50+30/count of days i.e 2 so should 40... here date field filtered..if select 10 days column width increases.but formula field i.e total usd not increasing accordingly how can write dynamic formula usd field increase /decrease according filter selection? i want make clear previous question day 1...........................2 qty usd qty usd total usd 10 50 20 30 50+30/count of days i.e 2 so should 40... here date field filtered..if select 10 days column width increases.but formula field i.e total usd not inc...

Can I disable LCD module by disconnecting Power to it -

i designing development board atmega328. want keep lcd module optional (hitachi hd44780, 2x16) . means solder lcd module on board, may not use if want use port pins other purpose. thinking of providing 1 jumper link vcc line of lcd (instead of providing several jumpers data , other signals) can remove jumper link , use port pins other purpose if lcd not needed. can this? port pins loaded if remove power lcd module or lcd module gets isolated? looked @ datasheet, not see internal connectivity of pins. may question applies many other devices well. disabling power device, can isolate device? most lcd module have chip select or slave select pin (cs). if pin asserted (usually pulling low) module listen or send out data on data/address lines , sensitive clock. other modules connect controller can have cs well. by connecting cs pin gpio can select component want talk to, allowing connect multiple components same parallel data/address bus , multiplex communications. how it...

c# - Creating List from Linq filter -

i'm filtering out list populated json data : list<rootobject> flighttimes = (list<rootobject>)gridview1.datasource; foreach (var v in p in flighttimes p.direction == "a" select new { p.date, p.time, p.sorttime, p.direction, p.flightnumber, p.endpoint, p.status, p.status2 }) ; i'm having trouble trying data foreach new list. can this? the problem loop produces elements of anonymous type, cannot declare typed list it. can solve problem not using foreach , , sending results of query tolist : var mylist = ( p in flighttimes p.direction == "a" select new { p.date , p.time , p.sorttime , p.direction , p.flightnumber , p.endpoint , p.status , p.status2 } ).tolist(); now compiler has enough information capture type of list, producing result expect. if need perform additional processing in loop, use mylist in separate foreach loop. ...

objective c - Convert NSValue to NSData and back again, with the correct type -

i able convert objective-c object, such nsarray or uiimage nsdata object, can use write disk. first converted them nsvalue , planned on converting nsdata . this question provided part of answer, working nsnumber , didn't have need convert nsvalue . i have seen other questions such this one relies on nskeyedarchiver , steer away due vast size inflation occurs. therefore code @ moment encoding nsdata object nsvalue , first question, follows: +(nsdata*) datawithvalue:(nsvalue*)value { nsuinteger size; const char* encoding = [value objctype]; nsgetsizeandalignment(encoding, &size, null); void* ptr = malloc(size); [value getvalue:ptr]; nsdata* data = [nsdata datawithbytes:ptr length:size]; free(ptr); return data; } my question how go decoding nsdata object has been encoded in manner , original objctype nsvalue ? i assume using along these lines [nsvalue valuewithbytes:[data bytes] objctype:typehere]; how type information...

javascript - bootstrap popover wont close in mobile -

i have simplified html code post here. first have empty p-tag. table-tag containing popover-anchor. , empty p-tag. when on desktop, after click anchor , popup displays, wherever click on page, popover closed. however, when on mobile (safari ios), popover close if click/tap @ end of page. means, area after last empty p-tag. have researched lot. im not sure, maybe listening "tap" instead of "click"? dont understand why click outside tags inside body makes popover disappear. <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="/components/bootstrap/dist/css/bootstrap.css" rel="stylesheet"> <link href="/components/bootstrap/dist/css/bootstrap-theme.css" rel="stylesheet"> <script type="text/javascript" src="/components/jquery/dist/jquery.js"> </script> <script type=...

Qweb Report Printing -Odoo 8 -

in odoo 8 qweb report quotation use custom css styles in xml, i receiving error below when select more 1 quotation , click print. if print single quotation fine. if remove custom css style xml working again. here original file in module's "view" folder. <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <template id="sale_account_report1"> <!-- multicompany --> <t t-if="o , 'company_id' in o"> <t t-set="company" t-value="o.company_id"></t> </t> <t t-if="not o or not 'company_id' in o"> <t t-set="company" t-value="res_company"></t> </t> <div class="header"> <div class="row"> <div class="col-xs-3"> <img t-if="company.logo" t-att-src="...

model view controller - Reading from database in Laravel 4 -

how can image url stored in database , render on page in laravel 4? very vague question, answer. please clarify if it's not need. assumptions: have item model stored in db. in relevant controller method add code below find item id 1 , display field named "url". $item = item::whereid(1)->first(); echo $item->url;

node.js - SyntaxError: Unexpected identifier in manacc.ejs while compiling ejs -

i'm working new project , i'm using node.js mongodb. in project i'm trying to data database , show in table of manacc.ejs file. shows error below: syntaxerror: unexpected identifier in e:\etsp\nodetest1\views\manacc.ejs while compiling ejs @ function (native) @ object.template.compile (e:\etsp\nodetest1\node_modules\ejs\lib\ejs.js:455:12) @ object.compile (e:\etsp\nodetest1\node_modules\ejs\lib\ejs.js:288:16) @ handlecache (e:\etsp\nodetest1\node_modules\ejs\lib\ejs.js:147:16) @ view.exports.renderfile [as engine] (e:\etsp\nodetest1\node_modules\ejs\lib\ejs.js:348:14) @ view.render (e:\etsp\nodetest1\node_modules\express.io\node_modules\express\lib\view.js:76:8) @ function.app.render (e:\etsp\nodetest1\node_modules\express.io\node_modules\express\lib\application.js:504:10) @ serverresponse.res.render (e:\etsp\nodetest1\node_modules\express.io\node_modules\express\lib\response.js:798:7) @ promise.<anonymous> (e:\etsp\nodetest1\...

android - Delete all the notifications on click -

in app i'm creating 3 notifications (with id 0,1, 2) depending on data. i use setcancel(true); on notification in order let system cancel on user click. cancell notifications (id 0,1,2) on userclick on 1 of them. possible? this code notification creation: notificationmanager notificationmanager = (notificationmanager) context.getsystemservice(context.notification_service); intent notificationintent = new intent(context, activitymain.class); pendingintent contentintent = pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_cancel_current); notification.builder builder = new notification.builder(context); notification notification = null; builder.setcontenttitle(title) .setcontentintent(contentintent); notification = new notification.bigtextstyle(builder).bigtext(mex).build(); notificationmanager.notify(id, notification); take @ notificationmanager#cancelall method

php - How to allow only pass predefined values from HTML form? -

i have html form select input , predefined values. actually, job noticed in chrome if change in code, via built-in addon "search elements", value 100000005555555 , accepted should accept predefined values function. a validation select input doesn't exist, because don't know how realize that. the html code: <select id="category1" name="category1" class="levels"> <option value="">category</option> <?php $listings->listcategoriesname();?> </select> the listcategoriesname function: class listings{ /* * categories mysql */ public function listcategoriesname(){ global $pdo; $result = $pdo->query("select * class_categories"); $row = $result->fetchall(); foreach($row $row) {echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';}} } } the function's ou...

c - Why Unicode characters are not displayed properly in terminal with GCC? -

Image
i've written small c program: #include <stdio.h> #include <stdlib.h> #include <locale.h> int main() { wprintf(l"%s\n", setlocale(lc_all, "c.utf-8")); wchar_t chr = l'┐'; wprintf(l"%c\n", chr); } why doesn't print character ┐ ? instead prints gibberish. i've checked: tried compiling without setlocale, same result the terminal can print character, can copy-paste terminal text-editor, it's gnome-terminal on ubuntu gcc version 4.8.2 wprintf version of printf takes wide string format string, otherwise behaves same: %c still treated char , not wchar_t . instead need use %lc format wide character. , since strings ascii may use printf . example: int main() { printf("%s\n", setlocale(lc_all, "c.utf-8")); wchar_t chr = l'┐'; printf("%lc\n", chr); }

javascript - How can I update text-label in d3 donut according with my array's data -

i trying add percentage instead of labels here according array. need label updated after every donut's transition. if insert .text(function (d) { return d.data.value;}); shows me second array's value , doesn't change. how can fix it? ps: saw similar questions here - cant intergate solution donut. update label on end of transition: slice .transition().duration(1000) .each("end", function(d,i){ d3.selectall('.labels text') .text(function(d) { return (((d.endangle - d.startangle) / (2 * math.pi)) * 100).tofixed(0) + '%'; }) }) .attrtween("d", function(d) { this._current = this._current || d; var interpolate = d3.interpolate(this._current, d); this._current = interpolate(0); return function(t) { return arc(interpolate(t)); }; }); updated example .