Posts

Showing posts from May, 2011

jquery - shortcut for event handling doing off+on+return false -

i find myself doing lot of: jelem.off('click').on('click', e => { somefunc(e); return false; } ); or jelem.off('submit').on('submit', e => { somefunc(e); return false; } ); two things repeat here - off before on , return false; is there way me extend jquery add shortcut such 'myon' that: jelem.myon('click', e => somefunc(e)); will equivalent jelem.off('click').on('click', e => { somefunc(e); return false; } ); you may create own jquery plugin. hope problem. $.fn.myon = function(e, option){ //code here }; reference: https://learn.jquery.com/plugins/basic-plugin-creation/

javascript - React not updating JSON feed on re-render -

i'm attempting build small react app pulls baseball scores json feed. json feed gets updated on server cronjob latest results every minute. when view react app initially, date scores. set interval render reactdom every minute well. console.log fires values json feed aren't updated. if reload page, can see information update (for instance stuck saying end of 4th inning when in reality 5th). here index.jsx var reactdom = require('react-dom'); var mlbscores = react.createclass({ getinitialstate: function() { return { hometeam: '', homescore: '', awayteam: '', awayscore: '', status: 'pre-game', inning: '1', inningstate: 'top' }; }, componentdidmount: function() { this.serverrequest = $.get(this.props.feed, function(result) { var scorefeed = result.data, status = scorefeed.games.game[4].status.status, inning = scorefeed.game

ios - Programmatically Setting Constraints Causes Conflict in Swift -

as posted in this github issue , having trouble hidden constraints throw error whenever try add own constraints 2016-04-18 19:22:04.270 metric time[1519:447809] unable simultaneously satisfy constraints. @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. (note: if you're seeing nsautoresizingmasklayoutconstraints don't understand, refer documentation uiview property translatesautoresizingmaskintoconstraints) ( "<nsautoresizingmasklayoutconstraint:0x15e670e70 h=--& v=--& metric_time.view:0x15e692e70.midx == + 115>", "<nslayoutconstraint:0x15e5048c0 metric_time.view:0x15e692e70.centerx == uiview:0x15e6953e0.centerx>", "<nsautoresizingmasklayoutconstraint:0x15e55fd30 h=-&- v=-&- 'uiview-encapsulated-layout-left' h:|-(0)-[uiview:0x15e6953e0] (names: '|'

oracle - Same SQL not ending properly -

i having trouble same ora-00933. code below: select cu.customername customer cu cu.customerid = salestranscation.customerid , salestransaction.tid = soldvia.tid , soldvia.productid = product.productid product.productprice >= 150; essentially trying collect customers bought product greater or equal 150. thanks i think missing and in clause query should be: select cu.customername customer cu cu.customerid = salestranscation.customerid , salestransaction.tid = soldvia.tid , soldvia.productid = product.productid , product.productprice >= 150;

php - Amazon pre signed url, allow only certain file types? -

i need use s3 store content users , govern access, in social network type of service. so far have thought of doing: client tells lamp server wants upload file lamp authenticates, , generates presigned url s3 user can upload. creates encrypted version of key using private key. adds key, along user started in mysql table(along when started) lamp sends key , digital signature 2. client. client uploads file s3 after finishing, tells lamp that file completed. sends in key , digital signature. lamp makes sure both key , signature match. if do, lamp knows client honest key being given him(and has not randomly generated it) lamp checks s3 make sure file key exists, if does,then delete row added in 2. my question is: does above data flow have serious flaw, inefficiency ? how make sure user allowed upload valid files(like png,jpg,pdf etc).i believe checking extension not enough may changed i wouldn't let clients upload s3 directly. upload file server, can vali

javascript - How to AddFile using ActiveX in Plupload? -

my machine connected scanner. scanner can return couple of images , can paths of these images in web page. want upload these images using plupload plugin. can these file using activex. when call addfile function, doesn't work. seems file returned activex not suitable addfile function. how can ? //scanfilepath such as: d:\image001.jpg var fso = new activexobject("scripting.filesystemobject"); var f1 = fso.getfile(scanfilepath); var i_upload = $("#uploader").pluploadqueue(); var tmp = scanfilepath.split("\\"); var filename = tmp[tmp.length-1]; i_upload.addfile(f1, filename);

angularjs - Google map is not working in Angular App -

below code of google map not working in live application using angularjs.locally working.but when upload live app not working there.how solve this? index.html <div class="item item-divider" style="font-size:18px;"> <i class="icon ion-map"></i> &nbsp; <a ng-click="launchgooglemaps()">location map</a> </div> app.js $scope.launchgooglemaps=function(){ var url = "http://maps.google.com/maps?ll="+$scope.temple.latitude+","+$scope.temple.longitude; intel.xdk.device.launchexternal(url); } try this $scope.launchgooglemaps=function(){ var url = "http://maps.google.com/maps?ll="+$scope.temple.latitude+","+$scope.temple.longitude; document.addeventlistener("intel.xdk.device.ready",function(){ intel.xdk.device.launchexternal(url); },false); }

scrollbar - scrollable contents overlaps on fixed non-scrollable content -

i want scrollable part of page scroll within it's height only. overlaps header position has been set 'fixed'. here fiddle: https://jsfiddle.net/3xc9n6jb/ how make them not overlap scrollable content scrolls without touching header? <div class="main-div"> <div class="mybox"></div> <!--this red rectangle header. scrollable content should not overlap this.--> <div class="scrollable-content horizontal"> <ul> <li>first item</li> <li>second item</li> <li>third item</li> <li>fourth item</li> <li>fifth item</li> <li>sixth item</li> <li>seventh item</li> <li>eight item</li> <li>ninth item</li> <li>tenth item</li> </ul> </div> </d

android - Checking the location every 10 minutes in the background -

my requirement check location of device every 10 minutes using background service. basic gist of should happen every 10 minutes - start service. wait minute (maximum) listener location, once location taken, remove listener , stop service. if listener doesn't respond, use getlastknownlocation(), remove listener , stop service. if gps off, reports app (this step working fine) what have tried doing till - made service triggered every 10 minutes using alarmmanager added location listener inside service. onlocationchanged() locationlistener has method - stopself() included, service ends after receiving location. however, method called numerous times. checked while debugging. because there many instances of onlocationchanged() called ? i don't need entire code answer, rather appreciate strategy should adopt fulfil requirements without hurting battery much. approach, unless , until location found, gps remains on draining battery constantly. instead of al

java - Simon Says counter not working properly -

i'm coding simon says game supposed keep track of how many times user completes task. code runs, output incorrect. expected output 4 code puts out 8. import java.util.scanner; public class simonsays { public static void main (string [] args) { string simonpattern = ""; string userpattern = ""; int userscore = 0; int = 0; userscore = 0; simonpattern = "rrgbryybgy"; userpattern = "rrgbbrybgy"; char s; char u; (i = 0; < 10; i++) { s = simonpattern.charat(i); u = userpattern.charat(i); if (s == u) { userscore = userscore + 1; continue; } } system.out.println("userscore: " + userscore); return; } } as said in question output 4 code puts out 8. want how many continuous character matched start of string. i

Css scrollbar not working in firefox -

i use -webkit-scrollbar css code, works safari , chrome: ::-webkit-scrollbar { width: 5px; } ::-webkit-scrollbar-button {width: 8px;height:5px;} ::-webkit-scrollbar-track {background:none;} ::-webkit-scrollbar-thumb {background:#000;} ::-webkit-scrollbar-thumb:hover {background:#000;} how can same thing firefox? (i don't want using jquery)

node.js - npm stuck on old version, but seem to have multiple versions -

i want update npm, seems have 2 versions , i'm not sure how best resolve have one. my main issue right have older yeoman generators in /users/me/.npm-packages/lib/node_modules/ , newer ones have gone /users/me/.npm-global/lib/node_modules/ when run yo , it's finding older generators. i'd have globally installed packages in 1 place under 1 user, , don't want need sudo things shouldn't need to. it seems have node in /users/me/.npm-packages/bin/npm , maybe /usr/local/bin/npm . i've gone both directories , updated npm in both, still returns 2.11.2 rather 3.8.6 claims have installed. here cliing i've done try fix: ➜ ~ npm /users/me/.npm-packages/bin/npm ➜ ~ sudo npm /users/me/.npm-packages/bin/npm ➜ ~ npm install npm@latest npm@3.8.6 node_modules/npm ➜ ~ npm -v 2.11.2 ➜ ~ npm install -g npm@latest npm err! darwin 15.3.0 npm err! argv "/usr/local/bin/node" "/users/me/.npm-packages/bin/npm" "install" "-g&q

c# - "Failed to acquire token silently. Call method AcquireToken" -

Image
try { clientcredential clientcredential = new clientcredential("***********","**************"); useridentifier useridentifier = new useridentifier(userobjectid, useridentifiertype.uniqueid); discoveryclient discclient = new discoveryclient(settingshelper.discoveryserviceendpointuri, async () => { var authresult = await authcontext.acquiretokensilentasync(settingshelper.discoveryserviceresourceid, clientcredential, useridentifier); return authresult.accesstoken; }); var dcr = await discclient.discovercapabilityasync(capabilityname); return new outlookservicesclient(dcr.serviceendpointuri, async () => { var authresult = await authcontext.acquiretokensilentasync(dcr.serviceresourceid, clientcredential, useridentifier); return authresult.accesstoken; }); } catch (adalexcep

c# - How to make so that you can only enter a date? -

so need in "year", can enter date only. pop warning something. here's code, if user enters empty value, need add? if (textbox1.text == "" || textbox2.text == "" || textbox3.text == "" || textbox4.text == "" || textbox5.text == "" || textbox6.text == "") { messagebox.show("Не заполнены все поля!"); return; } put textbox datetimepicker, further: string date=datetimepicker1.value.tostring ("dd.mm.yy")

iis 8 - django on IIS, process exited unexpectedly -

i have read every article find on topic i'm still unable run django project on iis. error message 500 internal server error, c:\program files (x86)\python 3.5\python.exe - fastcgi process exited unexpectedly. tracing rule error 500 provides following: error -fastcgi_unexpected_exit warning -set_response_error_description errordescription c:\program files (x86)\python 3.5\python.exe - fastcgi process exited unexpectedly warning -module_set_response_error_status modulename fastcgimodule notification execute_request_handler httpstatus 500 httpreason internal server error httpsubstatus 0 errorcode system cannot find file specified. (0x2) environment: windows server 2012 r2 iis 8.5 (cgi enabled) wfastcgi installed , enabled (command "c:\program files (x86)\python 3.5\python.exe|c:\program files (x86)\python 3.5\lib\site-packages\wfastcgi.py" opens python shell - right?) web.config under c:\inetpub\wwwroot\testapp: <configuration

javascript - How to detect new row in textarea while typing without setting Line height using JQuery? -

Image
is there way detect in jquery; whether new row got created in text area while end user typing continuously in it? not set line height, max height of minheight of textarea. fiddle: http://jsfiddle.net/5wdzh/113/ note: here not asking \n (enter) new row enteredtext = $( ).val(); numberoflinebreaks = (enteredtext.match(/\n/g)||[]).length; //when press enter value comes not new row. textarea attributes: $(e).css({'height': 'auto', 'overflow-y': 'hidden'}).height(e.scrollheight); there 2 ways 1) if want identify enter press can increase row counter if(e.keycode == 13) { //increment row counter } 2) if using fixed width of textarea can count number of words can fit in 1 row. no of character divide factor give number of rows i think you

html5 - How to convert psd file to html template? -

i have psd files of website design, can convert html template. template should contain html,css code. basically beginner in photoshop don't know, possible or not. please help. well part have static design, means there no interaction user, of website ready. i suggest start 1 or interactive prototyping tool marvel . can prototype functionalities of website , start working on code writing part. step , people, going you, idea want achieve final result. there adobe solutions dreamweaver gives option migrate photoshop layers webpage. solution not free. after finish working prototyping can take free course on udacity developing solutions html5 , css3. codecademy has set of courses on topic. hope helps start journey in learning psd html techniques , web development in general.

php - Laravel migration references between tables -

i've read laravel eloquent relationship & database migration docs, can't understand 1 thing. can create relationship between 2 tables through creating migration file like: public function up() { schema::create('keywords', function (blueprint $table) { $table->increments('id'); $table->string('name'); $table->integer('keyword_group_id')->unsigned(); $table->foreign('keyword_group_id')->references('id')->on('keyword_groups')->ondelete('cascade'); }); } and then, after php artisan migrate command got 2 connected one many relation tables. on other side docs describes process of creating relations between 2 eloquents. in case looks like: class keyword extends model { public $timestamps = false; protected $fillable = array('name'); public function keywordgroup() { return $this->belongsto('app\keywordg

How to use Acra in release build only? -

i trying use http://www.acra.ch/ in android app. how can make such acra used in release build , not in debug builds. i have set dependencies accordingly , have applicationcontroller(extends application) class configured accordingly. how both? i.e. how add dependency release , how configure applicationcontroller(extends application) class configured? i should mention using applicationcontroller(extends application) class functionality of app. just don't initialize acra in debug build: if(!buildconfig.debug) acra.init(this); if want exclude dependency in debug build, use releasecompile

git - Error upon importing SVN repo to GitHub using wizard -

i using github import wizard import number of svn repos. however, fails specific repos (in 80% of repos works, though, it's not me using wrong). i 2 different error types, each occuring specific svn repos (i.e. not happening randomly): right @ start of import, error says there error mapping commits the import drags on while 100%. once enters "optimizing repository , pushing commits github..." phase, fails after time error there error pushing commits github. are these structural problems in svn repos? need out change this? do git svn clone of svn repository , import git repo git svn clone http://mysvn/repo/repofolder (leave away repofolder depending on repo-structure)

javascript - Can I use the typescript without requireJS? -

i have 2 classes in different files: export class actionscollection{ constructor(greeting :string){ this.greet(greeting); } public greet(greeting :string) { return "<h1>"+greeting+"</h1>"; } } and import {actionscollection} "./actionscollection"; class greeter extends actionscollection{ constructor(public greeting: string) { super(greeting); } } alert(new greeter("hello, world!")); greeter generated in such file in there require line ("./ actionscollection") . want make sure files (*.ts) generates in 1 file main.js, not need require . can that? , if so, how? p.s. @ same time, assembly, can use standard webstorm tools , gulp. , nothing more, besides modules gulp. replace import {actionscollection} "./actionscollection"; with /// <reference path="./actionscollection.ts" /> . see triple slashes more info on using tri

A code snippet of netty examples from netty.io seems have bugs -

the code snippet is: final channelfuture f = ctx.writeandflush(time); f.addlistener(new channelfuturelistener() { public void operationcomplete(channelfuture future) { assert f == future; ctx.close(); } }); what happens if ' final channelfuture f = ctx.writeandflush(time); ' executes fast next addlistener code not start yet. when first line of code completes, thread notifies listeners operation done, @ time, there no listener @ all! after that, new listener added no more notifications received! code source: http://netty.io/wiki/user-guide-for-5.x.html the channelfuture retains completion state if listener added after completion, "late" added listener called on addition. see javadoc channelfuture.addlistener(genericfuturelistener) , comment: if future completed, specified listener notified immediately. see impl defaultpromise . late listeners (i.e. liste

r - How to find a data frame in a list from its attribute value? -

i have several data frames each represent data in given condition. for instance, df.1 data measured @ temperature t1, df.2 @ temperature t2, , on. i have set attribute temperature each data frame , stored data frames in list. now want retrieve data frame given temperature. so have 2 questions: is attribute/list approach recommended one? is there elegant way retrieve data frame appropriate temperature? see way loop, wonder if there better solution. here example code: x <- seq(0, 50, = 0.1) y1 <- sin(x) y2 <- cos(x) df.1 <- data.frame(time = x, value = y1) attr(df.1, "temperature") <- 20.0 df.2 <- data.frame(time = x, value = y2) attr(df.2, "temperature") <- 30.0 df.list <- list(df.1, df.2) result <- null (df in df.list) { if (attr(df, "temperature") == 20) { result <- df } } it's advisable provide appropriate names list created, e.g. names(df.list) <- c("t20", "t30

java - JavaFX 2 - Tableview Checkbox not showing value -

i managed track whenever click happens on checkbox in gui. won't load correct value of checkbox gui. can see might wrong? :) roadtraincol.setcellvaluefactory( new callback<celldatafeatures<spot,boolean>,observablevalue<boolean>>() { public observablevalue<boolean> call(celldatafeatures<spot, boolean> param) { return param.getvalue().getroadtrain(); } }); roadtraincol.setcellfactory(col -> { checkboxtablecell<spot, boolean> cell = new checkboxtablecell<>(index -> { booleanproperty active = new simplebooleanproperty(); active.addlistener((obs, wasactive, isnowactive) -> { system.out.println("del"); rettedespots(tableviewid.getitems().get(index).getid()); }); return active ; }); return cell ; }); you're cre

javascript - PDFTron - get data from IndexedDB -

i'm using pdftron library (javascript) download files , store inside indexeddb. pdftron use initofflinedb initializes offline database. know can data inside indexeddb, don't know db name use html5 method. last question, possible download .doc files? there method convert pdf, doc.. in xod type? thanks lot guys , hava day. francesco. please refer our offline library sample here https://www.pdftron.com/webviewer/demo/samples/offline-library/ as can see unique document ids required store , retrieve documents indexeddb. document interface ( https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/corecontrols.document.html ) provides methods check if file in storage isdownloaded or save storage storeoffline etc if wish inspect indexeddb storage use chrome developer tools -> resources -> indexeddb in order open office files webviewer have convert files .xod first pdfnet sdk https://www.pdftron.com/pdfnet/index.html or pws https://www.pdftron.com

angularjs - How to add limit in meteor query? -

i want limit 2 records using query. self.helpers({ avalibility: () => { return setavalibility.find({}).fetch(2); } }) and not working,but same in robomongo working fine. db.avalibility.find({}).limit(2) it better not use .fetch() ;) avalibility: () => { return setavalibility.find({}, {limit: 2}); }

Android ScrollView content disappearing on removing background attribute -

i have scrollview in linearlayout along header linearlayout on top. have given main linearlayout background. if keep background scrollview displays fine. if add lot of content scrollview background stretches. want keep scrollview transparent. but if remove background attribute or if try android:background="@android:color/transparent" content inside scrollview vanishes. can see header , background outer linearlayouts. this how want views: <linear layout background image> <header linear layout> </header linear layout> <scrollview no background> <layouts in scroll view> </scrollview> here code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:backgr

c# - Reading FTDI TTL-232R to USB -

i’m trying read rs232 input via usb using ftdi rs232 usb 5v programmable cable. using ftd2xx_net library. connected smart meter sends telegram every 10 seconds. all seems work fine. can , have set baudrate, databits, stopbits, etc. stops when reading data. below code snippet passes without data. i’m not experienced in electronics it’s bit out of comfortzone. my questions. how flowcontrol influence read capability if device. how numbytesavailable influence the read capability if device. how numbytesread influence the read capability if device. de setting of variables of above properties unknown me. not know how data receive. highly appreciated. cable datasheet found here: http://www.ftdichip.com/support/documents/datasheets/cables/ds_ttl-232r_cables.pdf smart meter datasheet found here: http://files.domoticaforum.eu/uploads/smartmetering/dsmr%20v4.0%20final%20p1.pdf enter code here namespace p1_reader { class program { static void main(string[] args) {

java - pdfBox add different lines to pdf -

Image
i'm looking generating pdf-document. @ moment i'm trying out different approaches. want more 1 line in pdf-document. using helloworld code example came ... package org.apache.pdfbox.examples.pdmodel; import java.io.ioexception; import org.apache.pdfbox.pdmodel.pddocument; import org.apache.pdfbox.pdmodel.pdpage; import org.apache.pdfbox.pdmodel.pdpagecontentstream; import org.apache.pdfbox.pdmodel.font.pdfont; import org.apache.pdfbox.pdmodel.font.pdtype1font; /** * creates "hello world" pdf using built-in helvetica font. * * example taken pdf file format specification. */ public final class helloworld { private helloworld() { } public static void main(string[] args) throws ioexception { string filename = "line.pdf"; string message = "line"; pddocument doc = new pddocument(); try { pdpage page = new pdpage(); doc.addpage(page); pdfont

resize - Java, Image turns black after resizing File in Java -

image turns black after resizing multipartfile in java .. i trying save file in sql db.. need down image quality , size because of memory..after resizing gets black .. any ideas? private static int img_height = 1280; private static int img_width= 860; private static int imgtype = image.scale_smooth; try { bytearr = doc.getbytes(); imageicon imgicon = new imageicon(bytearr); int height = imgicon.geticonheight(); int width = imgicon.geticonwidth(); if(height > img_height || width > img_width){ int newwidth = width; int newheight = height; if(height > img_height){ newheight = img_height; } if(width > img_width){ newwidth = img_width; } system.out.println("img newheight = "+newheight); system.out.println("img newwidth = "+newwidth); image newimage = imgicon.getim

git - Bitbucket need to change last commit author name -

i accidentally made commit on repository different author name. can change last commit author name on bitbucket commit history? note: using git (tortoisegit) , bitbucket. for last commit quite easy. open commit dialog, select "amend", check "set author" , commit , force push. if commit older, need rebase. checkout branch commit on , right click on commit before 1 want change in log dialog , select "rebase onto". in rebase dialog, check force , mark commit want change "edit" , start rebasing process. when commit processed, select "edit/add commit" , update author name.

Twilio Api - Get number of minutes for a number -

i'm trying total number of minutes outbound calls specific twilio number. twilio account use has dozens of numbers. far i've managed total of minutes numbers haven't found way filter phone number. anny suggestions? <?php // download library , copy folder containing file. require('../twilio-php-latest/services/twilio.php'); $account_sid = "xxxx"; // twilio account sid $auth_token = "xxxx"; // twilio auth token $client = new services_twilio($account_sid, $auth_token); $record = $client->account->usage_records->today->getcategory('calls-outbound'); echo $record->usage ; ?> i found answer : retrieving stats phone number not possible while usage api should able supply necessary data use cases, not yet able provide usage phone number. https://www.twilio.com/help/faq/twilio-basics/how-can-i-see-my-twilio-data

ios - Assigning 'class variable' to variable inside 'lazy var' -

i trying understand logic of draggable collection view cells. works dummy data however, couldn't figure out how make work real data. i couldn't know title give question, please feel free edit/improve it if use approach dummy array items , call function class tableviewcontroller: uitableviewcontroller, kdrearrangeablecollectionviewdelegate, uicollectionviewdatasource { lazy var data : [[string]] = { var array = [[string]]() let images = [ "1.jpg", "2.jpg", "3.jpg" ] if array.count == 0 { var index = 0 var section = 0 image in images { if array.count <= section { array.append([string]()) } array[section].append(image) index += 1 } } return array }() func movedataitem(fromindexpath : nsindexpath, toindexpath: nsindexpath) { let name = self.data[fromindexpath.section][fromindexpath.item] self.

firemonkey - Delphi FMX set focus to a particular control so the cursor appears -

i created test new fmx project. added tabcontrol it. used context menu add 3 tabsheets. 3rd tabsheet, added tedit. added onchangeevent handler tabcontrol. coded follows: procedure tform1.tabcontrol1change(sender: tobject); begin if tabcontrol1.activetab = tabitem3 begin self.activecontrol := edit1; self.focused := edit1; edit1.setfocus; end; end; as can see, tried various combinations based on previous vcl experience. input/cursor focus not change edit1 code. of course, @ runtime on win32, if click on edit1, focus rectangle (i'm using style) shows cursor. (as expected) on android. vk comes when shift focus myself. is there way programmatically user can start typing? (without having shift focus tedit themselves). the firemonkey framework prohibits change of focus in events. in order change focus, send delayed message form. this done anonymous thread: procedure tform1.tabcontrol1change(sender: tobject); begin if tabcontrol1.activetab = tab

Generically transforming a type in Scala -

is there way of transforming type in generic manner? have this: class super { type messagestype = product type aggregatortype = product } class sub1 { override type messagestype = (class1, class2) override type aggregatortype = (option[class1], option[class2]) } class sub2 { override type messagestype = (class1, class2, class3) override type aggregatortype = (option[class1], option[class2], option[class3]) } the aggregatortype contain option s of each of types in messagestype . i've been looking @ ways of declaring messagestype in sub , having corresponding aggregatortype generated automatically. while i'm using tuple s, change hlist s, case classes, or whatever. however, have limitation of using shapeless 1.2.4 (due transitive dependencies). any ideas? you use mapped type class shapeless this. it little bit difficult compiler infer of types. used nested class, maybe else can come prettier solution. import shapeless._ import shapele

ios - How to use runscript to load static library dynamically in Xcode? -

i have 2 static libraries, 1 device, , 1 simulator. , don't want merge them.i try use runscript load dynamically.the code it: if [ lib/libmp3lame.a ] rm -f lib/libmp3lame.a fi if [ ${platform_name} = "iphoneos" ] cp lib/libmp3lame_arm.a lib/libmp3lame.a else cp lib/libmp3lame_simulator.a lib/libmp3lame.a fi xcode can not find file. file location

mysql - PHP script not exporting as csv -

Image
working on script having header sent troubles on lines allow download csv. http://pastebin.com/6btjbri5 an error shows: warning: cannot modify header information - headers sent (output started @ /home/briancqc/public_html/config.php:5) in /home/briancqc/public_html/export.php on line 29 warning: cannot modify header information - headers sent (output started @ /home/briancqc/public_html/config.php:5) in /home/briancqc/public_html/export.php on line 30 warning: cannot modify header information - headers sent (output started @ /home/briancqc/public_html/config.php:5) in /home/briancqc/public_html/export.php on line 31 where add <br> after every row new line starts? how looks right now: it goes in constant line export of rows. check config.php file not have blank lines outside (e.g. @ end of file)

sql server - Additional "where column is not null" significantly slows down a query execution time -

in sql server have query: select a, b, year(c), max(convert(date,c)), d some_view not null , b = 'str1' , (x in ('str2','str3', ...) or = 'str4') --and c not null --and d not null group a, b, year(c), d the execution time 6 seconds. if uncomment --and c not null execution time 6 or 5 seconds. if uncomment --and d not null don't know execution time because haven't waited query finish. why uncommenting --and d not null makes execution time soar? have checked execution plan? money on index issue. if query using index has d included column rather indexed column it's force scan of table/index kill performance. run execution plan , without null statements, that's going point towards issue is. check index hints when this.

How to solve intermittent Ansible issues? -

i sure @ point or must have faced situation 1 unable install package via ansible same thing done logging machine , doing so. intermittent persistent. why so? because once in while might happen package refuses installed throuwing error like failed: [10.12.10.57] => {"failed": true, "parsed": false} become-success-yqymkgrsndxbhkcnyfjgvzrxvoxpmads traceback (most recent call last): file "/home/ubuntu/.ansible/tmp/ansible-tmp-1461058305.77-7941776655744/apt", line 2258, in <module> main() file "/home/ubuntu/.ansible/tmp/ansible-tmp-1461058305.77-7941776655744/apt", line 554, in main cache = apt.cache() file "/usr/lib/python2.7/dist-packages/apt/cache.py", line 107, in __init__ self.open(progress) file "/usr/lib/python2.7/dist-packages/apt/cache.py", line 151, in open self._cache = apt_pkg.cache(progress) systemerror: e:unable parse package file /var/lib/apt/lists/us-west-2.ec2.archive.ubuntu.

javascript - infobox.prototype = new google.maps.overlayview() error, google is not defined -

hi got "google not defined" error in infobox.js, , show error in infobox.prototype = new google.maps.overlayview() here code in html, hope include library right. <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="map"></div> <script async defer src="https://maps.googleapis.com/maps/api/js?key=aizasyb9mpf-bwjn8ym13plnrdhsnhymrrvouiw&callback=initmap"> </script> <script src="library/infobox.js" type="text/javascript"></script> <script src="script.js"></script> </body> </html> i called google map api , infobox.js in script.js file. in advance! when call overlayview constructor google map still not loaded. call without async, defer , callback: <script src="https://maps.googleapis.com/maps/api/js?key=aizasyb9mp

Upload image from Android to Google Cloud Storage or Google App Engine Blobstore -

i have gaej , save images, uploaded android device , iphone. why there 2 google services , wich 1 should used gaej? google blobstore https://developers.google.com/appengine/docs/java/blobstore/ google cloud storeage https://developers.google.com/storage/ pseudo code: httpclient base64 encoded data. send image google app engine. from google app engine save decoded image blobstore or cloud storage. httpservletresponse status android. i confused how step 3. thanks in advance regards long time ago when app engine existed, google cloud storage doesn't exists yet way store blobs blobstore. existed made api blobstore work google cloud storage well. both work image serving/manipulations. cloud storage think built in cdn serves closest edge server while blobstore when downloading coming appengine instance. uploading either of works same way, client need request upload url session uploaded directly blobstore/cloud storage when post url send_to_client_url =

amazon web services - RabbitMQ java client load balancing in AWS -

we using amazon elb ha rabbitmq (3.2.4) , client (java spring rabbitmq). if we've connected java client rabbit nodes it's ok. if we've used elb endpoint there new connection every ~10-60 seconds. ps: we using default elb idle connection timeout 60 seconds: http://docs.aws.amazon.com/elasticloadbalancing/latest/developerguide/config-idle-timeout.html the error logs: 2016-04-19 09:14:11|thread-13|[]|error|com.reporter.message.broker.rabbit.consumer.eventprocessor:connection failed com.rabbitmq.client.alreadyclosedexception: connection closed due connection error; cause: java.io.eofexception @ com.rabbitmq.client.impl.amqchannel.processshutdownsignal(amqchannel.java:283) ~[amqp-client-3.5.7.jar:?] @ com.rabbitmq.client.impl.channeln.startprocessshutdownsignal(channeln.java:267) ~[amqp-client-3.5.7.jar:?] @ com.rabbitmq.client.impl.channeln.close(channeln.java:573) ~[amqp-client-3.5.7.jar:?] @ com.rabbitmq.client.impl.channeln.close

how to execute win cmd from php code? -

i have x.exe in path: c:\inetpub\wwwroot\webclient\db\nucleotide , want execute command: blastdbcmd -db nr -entry -outfmt "%g %t" . in windows command line do: cd c:\inetpub\wwwroot\webclient\db\nucleotide blastdbcmd -db nr -entry -outfmt "%g %t" how can php code. know exec($cmd) or shell_exec($cmd) but, how type above 2 statement in $cmd ? edit1: how save output of command in text file? try 3 statement: chdir("c:\\inetpub\\wwwroot\\webclient\\db\\nucleotide"); $cmd = "blastdbcmd.exe -db nr -entry -outfmt "%g %t" -out $text_files_path/newseq_$olddatabasefile$newdatabasefile.txt"; exec($cmd); ,, exec("c:\inetpub\wwwroot\webclient\db\nucleotide\blastdbcmd.exe -db nr -entry -outfmt "%g %t" -out $text_files_path/newseq_$olddatabasefile$newdatabasefile.txt"); ,, exec("cd c:\inetpub\wwwroot\webclient\db\nucleotide && blastdbcmd.exe -db nr -entry -outfmt \"%g %t\" -out $text_

jquery - Linking JavaScript to my HTML -

please help, i'm new web design , want make demo below work seems html not linking javascript. please view code below, demo available @ http://jsfiddle.net/xx9ykonc/ how make work, don't understand whats missing. <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="style1.css"> </head> <body> <table> <tr> <td><div>1</div></td> <td><div>2</div></td> <td><div>3</div></td> <td><div>4</div></td> </tr> </table> <script> $('table div') .on('mouseenter', function(){ var div = $(this); div.stop(true, true).animate({ margin: -10, width: "+=20", height: "+=20" }, 'fast'); }) .on('mouseleave',

java - Static vs non static Activity intent calling method -

here little bit confuse static intent calling method vs direct intent calling. better choice creating new activity memory point of view? as per know if intent method calling static contains memory application lives. true or not? let move take example : in activity b public static intent newintent(context context) { intent intent = new intent(context, b.class); return intent; } calling activity b activity a in activity a startactivity(b.newintent(this)); or in other way direct calling activity can not live after finish() calling activity. right? startactivity(new intent(context, b.class)); still guess second better code point of , memory point of view. see many projects contains first(static calling) method. want know better selection calling new activity? the method public static intent newintent() static, that's static. use of static method can call b.newintent() without having instance of b . the context pass b.newintent(th

swift - how to pass a nil value for one of the parameter in alamofire Post request -

i pass nil value i.e., optional 1 of parameter value. , must proceed nil value in alamofire post request .it helpful if tell me how proceed next? let image: uiimage = uiimage() let imagedata = uiimagepngrepresentation(image) let base64string = imagedata?.base64encodedstringwithoptions(.encoding64characterlinelength) let parameters = [ "first_name": "xxxxx", "email" : "1234@gmail.com", "password" : "password", "profile_picture" : base64string] alamofire.request(.post, "http://abc/public/user/register", parameters: parameters, encoding: .json, headers: nil) .progress { byteswritten, totalbyteswritten, totalbytesexpectedtowrite in print(totalbyteswritten) // closure not called on main queue performance // reasons. update ui, dispatch main queue. dispatch_async(dispatch_get_main_queue()) {

c# - Should one use Assert in a method without TestMethod attribute? -

i taking on legacy code in c# , unit testing of code doesn't work. let me explain following code. [testmethod] public void sampletest() { ... // parallel call of method via threading testutil(args); ... } private void testutil(...) { ... assert.istrue(condition1); assert.istrue(condition2); } when run sampletest in visual studio, instead of marking test failed (because condition fails), vs throws exception in qtagent.exe. do know why qtagent.exe crashes in case instead of failing test? i it's totally fine put asserts private methods in test class. private methods can viewed code logically belongs in main method, has been broken out readability or code reuse. commonly put asserts private methods if asserts identical between multiple tests

iphone - Adapt apple-touch-startup-image javascript code for iphone5? -

i'm doing webpage uses startup image feature ios devices. task, i'm using code placed on footer detects javascript ios device is, , loads startup image it. in way, site saves lot of bandwith because it's downloading 1 image instead of four. but new screen size of iphone 5, code needs changes, can't figure out how these. this code: <script> (function(){ var p,l,r=window.devicepixelratio; if(navigator.platform==="ipad"){ p=r===2?"http://example.com/ipad-portrait-retina.jpg":"http://example.com/ipad-portrait-non-retina.jpg"; l=r===2?"http://example.com/ipad-landscape-retina.jpg":"http://example.com/ipad-landscape-non-retina.jpg"; document.write('<link rel="apple-touch-startup-image" href="'+l+'" media="screen , (orientation: landscape)"/><link rel="apple-touch-startup-image" href="'+p+'" media="