Posts

Showing posts from January, 2015

javascript - One CSS class with jQuery Click Function Exception -

.box { width:45px; height:45px; line-height:45px; border:1px solid #808080; border-radius:8px; text-align:center; color:#000; font-weight:bold; font-size:24px; font-family:arial, helvetica, sans-serif; cursor:context-menu; } i have css class called .box , have php loop creating div layers referring class this: <div class="box">content</div> i have jquery click function listens clicks on div layer class="box" this: $(".box").click(function(){ my question within loop there div layers still need styled .box class not want click function apply to. way have solved creating clone of .box , calling .box2 , seeing there not .box2 click event jquery click function applies .box class div. however, wondering if there better way , stick 1 class rather two, code , everytime want change style, have replicate twice. there maybe way add parameters , make class="box active" ? hope m...

javascript - JS semicolon removes 'Uncaught SyntaxError: Unexpected identifier' error why? -

my code this: message.labels.foreach(/…/) container.data.push(message); it throws uncaught syntaxerror: unexpected identifier when add semicolon after foreach function doesn't throw anymore. change semicolon there, checked git. why it? feels i'm missing js fundamentals here. the semi-colon ends statement . if leave out, 2 statements treated single one, doesn't make sense , compiler throw error.

typescript - How do I hide and/or unhide the TabViewItem component in NativeScript? -

how display , hide component in nativescript using tag tabviewitem? want able have option display and/or hide tab. <tabview> <tabview.items> ... <tabviewitem title="logoff"> <tabviewitem.view > ... </tabviewitem.view> </tabviewitem> </tabview.items> </tabview> below examples of have tried: <tabview> <tabview.items> ... <tabviewitem title="logoff" [visibility]="settings.showlogin ? 'collapsed' : 'visible'"> <tabviewitem.view > ... </tabviewitem.view> </tabviewitem> </tabview.items> </tabview> with css: <tabviewitem title="logoff" class="hidetab"> .hidetab{ display: none; } and <tabviewitem title="logoff" [class.hidetab]="true"> th...

jquery - ajax is not working in perl cgi script -

hi trying execute ajax with cgi script , not sure work or not.i trying content file. here code: #!/usr/bin/perl use warnings; use strict; use cgi; use cgi::carp qw(fatalstobrowser); $cgi = cgi->new; print $cgi->header( -type=> "text/html" ); print <<eof; <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"> $(document).ready(function(){ $("button").click(function(){ $.ajax({url:"test1.txt", datatype:"text", success: function(result){ $("#div1").html(result); }}).fail(function( jqxhr, textstatus, errorthrown ) { console.log(textstatus,errorthrown)}); }); }); </script> </head> <body> <div id="div1"><h2>let jquery ajax change text</h2></div> <button>get external content</button> </body> ...

ember.js - Controlling component data across multiple routes -

i have mapping app has full-screen map sidebar information. app has 2 routes: one route should display list of places markers on map, example /places/ one route should display single place particular place's marker centered on map, example places/1/ my map component in application.hbs , "outside" of route templates , persists across route changes. looks like: <div class="page"> <aside class="sidebar"> {{outlet}} </aside> <div class="content"> {{places-map ... }} </div> </div> and routes looks like: router.map(function() { this.route('index', { path: '/' }); this.route('place', { path: "/place/:place_id" }); this.route('places'); }); so while have set , working (i can see list of places , move single particular place, in both cases map in "background"), can't understand how routes can feed information componen...

android - Show fragment after calling dragndrop -

in app fragment(first fragment) user can press on item , app show fragment list(second fragment), user can drop caught item. code: public void startdragndrop(){ showfragmentwithlist(); jsonobject object = new jsonobject(); object.put(constants.param_id, getid()); clipdata data = clipdata.newplaintext("", object.tostring()); view.dragshadowbuilder shadowbuilder = new view.dragshadowbuilder(mmainlayout); mmainlayout.startdrag(data, shadowbuilder, mmainlayout, 0); } and when second fragment catches action_drop close himself. , works well, if user remove finger faster method finish work, dragndrop won't start , second fragment won't receive dragndrop event, result new fragment won't disappear. i tried fix via setting dragndrop listener @ first fragment , when catch action_drag_started call showfragmentwithlist() , fragment show. faced of new problem, view.ondraglistener doesn't work views inside of second fragme...

javascript - $(document).ready or window.onload for hiding/showing a video -

i'm running script (hack) trick safari correctly sizing video on responsive page. script below waits moment hides, , shows video, causing safari realize should expand video proper size. i'm worried $(document).ready may fire script (i.e., before video loaded), causing script not supposed video. possible $(document).ready script may fire since video isn't loaded after set milliseconds video not hidden/shown? should use window.onload (or method?) instead ensure hide/show sizing hack works? in tests, script works, on reloads when clear cache. few times when i've loaded page on random computers video not size correctly until reload page. using window.onload seems less ideal in user may notice incorrectly sized video while page content loading, or see hack in action after does. <script><!-- super hack toggle display block/none tricks safari sizing video--> $(document).ready(function() { $("#video1").delay(3000).hide(0, function...

javascript - removeClass alike logic in angularjs -

.. ng-repeat <li ng-class="{'active':selindex==$index}"> <span ng-click="selindex=$index">click</span> </li> the problem above code is, doesn't reset li's class before adding active class clicked one. how apply removeclass logic in angluarjs? you don't actively remove class in angular. tell angular under circumstances class must active, , figure out. ng-class , do. if condition true , class present on element, else won't. whenever state changes, angular recalculates classes elements. classes removed angular condition becomes false . more logic doesn't work somewhere. wouldn't use $index anything, since index of 1 item might change @ time. rather use data itself: $scope.items = [{ id: 1 }, { id: 2 }]; $scope.activeitem = null; $scope.selectitem = function (item) { $scope.activeitem = item; } <li ng-repeat="item in items" ng-class="{ active: item.id == activeitem.id ...

powershell - How can I generate the same checksum as artifactory? -

as art.exe (the artifactory cli interface) hangs whenever call build script, rewriting bash script page on topic in powershell 2.0. i'm using code generate checksum: $sha1 = new-object system.security.cryptography.sha1cryptoserviceprovider $path = resolve-path "catvideos.zip" $bytes = [system.io.file]::readallbytes($path.path) $sha1.computehash($bytes) | foreach { $hash = $hash + $_.tostring("x2") } $wc=new-object system.net.webclient $wc.credentials= new-object system.net.networkcredential("svnintegration","orange#5") $wc.headers.add("x-checksum-deploy", "true") $wc.headers.add("x-checksum-sha1", $hash) the problem consistently produces different checksum on local artifactory generates. it's not 'corruption during transmission' error because i'm generating checksum on local , i've manually deployed several times. how can generate checksum in same manner artifactory (2.6.5) our ch...

dataframe - Cumulative count of blocks of 1 with 0 separators in a binary vector in R -

i have data frame binary vector want cumulative count of. count 'groups of 1's' rather each individual 1 , create new vector of count while retaining 0 separating values. i.e. df1 <- data.frame(c(0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1) n bin 1 0 2 1 3 1 4 1 5 1 6 0 7 0 8 0 9 1 10 1 11 1 12 1 13 1 14 0 15 0 16 0 17 1 18 1 19 1 becomes n bin cumul 1 0 0 2 1 1 3 1 1 4 1 1 5 1 1 6 0 0 7 0 0 8 0 0 9 1 2 10 1 2 11 1 2 12 1 2 13 1 2 14 0 0 15 0 0 16 0 0 17 1 3 18 1 3 19 1 3 how go this? you can use rleid function package data.table: df1 <- data.frame(bin = c(0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1)) library(data.table) setdt(df1) df1[, cumul := rleid(bin)] df1[bin == 0, cumul := 0] df1[bin == 1, cumul := rleid(cumul)] # bin cumul # 1: 0 0 # 2: 1 1...

ios - Show login Screen when hitting Homebutton -

Image
i have swift project wich needs switch login viewcontroller when user hits homebutton or appswitcher (like bankingapps or 1password does). login viewcontroller initial vc. searched since few days, couldn't find information that. how implement in project? thank you dirk simplifying little on @holex , comments (and working without notifications) solution require navigation based on uinavigationcontroller login viewcontroller set rootviewcontroller . edit : ensure app using uinavigationcontroller described above: open main.storyboard if see layout you're set: otherwise select current root view controller from menu choose editor > embed in > navigation controller if don't want navigation bar visible, disable "shows navigation bar" option end of edit in constellation in application delegate: // called before uiapplicationwillresignactivenotification posted func applicationwillresignactive(application: uiapplication) { if le...

actionscript 2 - Flash - Keyboard event doesn't fire -

i'm working on website multiple flash animations. 1 of them visual numeric keyboard want catch physical keystrokes also. the problem when try adobe flash works great when it's running in browser (firefox or ie11) physical inputs not caught. here keylistner (in as2 sorry ^^'): clavierlisten = new object(); clavierlisten.onkeydown = function() { keya = key.getcode(); if (keya>=48 && keya<=57) { switch (keya) { case 48: chiffrage(0); btn_clavier0.gotoandplay(2); break; case 49: chiffrage(1); btn_clavier1.gotoandplay(2); break; case 50: chiffrage(2); btn_clavier2.gotoandplay(2); break; case 51: chiffrage(3); btn_clavier3.gotoandplay(2); break; case 52: chiffrage(4); btn_clavier4.gotoandplay(2); break; case 53: chiffrage(5); btn_clavier5.gotoandplay(2); break; case 54: chiffrage(6); btn_clavier6.gotoandplay(2); break; case 55: chiffrage(7); btn_clavier7.gotoandplay(2); break; ...

error using directory_entry in boost filesystem -

i'm starting use boost library in c++ programs using code blocks on ubuntu. i encounter problem while manipulating files, following code returns segmentation fault : #include <iostream> #include <boost/filesystem.hpp> using namespace std; int main() { boost::filesystem::path my_file("/home/malinou/workspace/grunbaum2/grunbaum/bases/config.txt"); cout << "my_file path : " << my_file.string() << endl; cout << "my_file exists : " << boost::filesystem::exists(my_file.string()) << endl; cout << "my_file path : " << my_file.string() << endl; return 0; } i'm using gcc compiler flags -lboost_system , -lboost_filesystem , , console output : my_file path : /home/malinou/workspace/grunbaum2/grunbaum/bases/config.txt my_file exists : 1 segmentation fault (core dumped) process returned 139 (0x8b) execution time : 0.093 s press enter continue. any ...

sql server - SQL: Return first non null value from the string -

problem : want retrieve first non null value string, substring separated , separator. scenario : string 1 - ,1002682657 string 2 - 1002682683, string 3 - ,,1002682684 string 4 - ,,, string 5 - 1002682664,1002682663 expected result resultstring 1 - 1002682657 resultstring 2 - 1002682683 resultstring 3 - 1002682684 resultstring 4 - null value resultstring 5 - 1002682664 so retrieve wrote function below script create function [dbo].[return_first_nonnull_value_from_list] ( @list nvarchar(max) ) returns nvarchar begin -- declare return variable here declare @returnlistpart nvarchar(max) declare @start int declare @end int declare @length int declare @length_string int set @start = 1 set @end = charindex(',',@list,@start) set @length = (@end - @start) + 1 set @length_string= (@end-@start)+1 set @pos = 0 set @nextpos = 1 while @start>0 , @end>0 , @length_string>0 begin if (substring(@list, @start, 1) <> '') , ...

establish connection from python to matlab -

Image
i trying transfer data in real time python matlab using udp protocol (as post suggested: real-time data transfer python matlab ). right have, , dosent work: on python (sender): import socket my_socket= socket.socket() my_socket.connect(('127.0.0.1', 8821)) message='test1' in range(1,10): my_socket.send(message) print my_socket.close on matlab (reciver): u = udp('0.0.0.0','localport',8821); fopen(u); while(1) = fread(u,10); end fclose(u) it dosent work, , errors get: python: and matlab: warning: unsuccessful read: specified amount of data not returned within timeout period. any idieas? it works me if tell socket want udp connection: my_socket= socket.socket(socket.af_inet, socket.sock_dgram) (hat tip https://wiki.python.org/moin/udpcommunication )

c# - How to get All MS Word running process by name -

i trying running ms word processes, returns 1 . how can exact number of processes? have more 1 file open. process[] localbyname = process.getprocessesbyname("winword"); foreach (process p in localbyname) { if (!string.isnullorempty(p.mainwindowtitle)) { rect notepadrect = new rect(); intptr ptr = p.mainwindowhandle; getwindowrect(ptr, ref notepadrect); objschemedetail.top = notepadrect.top; objschemedetail.bottom = notepadrect.bottom; objschemedetail.left = notepadrect.left; objschemedetail.right = notepadrect.right; } } the entire premise on question based wrong. believe each word top level window associated distinct process. belief incorrect. architecture of word has 1 process multiple windows. simple enough verify using task manager program. what want find top level windows associated specific process. question has been asked here many times before. instance: how enumerate windows belongi...

ruby - How do I retrieve innerhtml using watir webdriver -

i have following html, , need text outside of bold tag. instance 'submitted at:' need timestamp follows. see 'submitted at: surrounded bold tags , timestamp follows , can not retrieve it. <body> <h2> … </h2> <b> … </b> jenkins <br></br> <b> … </b> <br></br> <b> … </b> <a href=""> … </a> <br></br> <b> … </b> <br></br> <b> submitted at: </b> 29-jan-2016 17:12:24 things have tried. @browser.body.text.split("\n") @browser.body.split("\n") body_html = nokogiri::html.parse(@browser.body.html) body_html.xpath("//body//b").text returned: "user: jobname: jobconf: job-acls: users allowedsubmitted at: launched at: finished at: status: analyse job" i have tried several things such xpath, plain old text retrieval,...

apache - Wordpress websites doesn't load assets behind a company firewall -

i encounter problem our wordpress websites assets doesn't load getting 403 forbidden in company network uses firewall. the thing same websites in production, managed company (but still in amazon aws servers) load fine, same website in our server fails. that's why think related server configuration. and doesn't happen other kind of websites angular app have. and server ip or domain isn't blacklisted. what happen?

Printing json in swift after download/parse -

i'm trying json website , parse before printing it. i've got class called "jsonimport", should handle json import server , print it. second class should make call start import , print content of json. the following code have far (i took question downloading , parsing json in swift ) so "jsonimport.swift": var data = nsmutabledata(); func startconnection(){ let urlpath: string = "http://echo.jsontest.com/key/value"; let url: nsurl = nsurl(string: urlpath)!; let request: nsurlrequest = nsurlrequest(url: url); let connection: nsurlconnection = nsurlconnection(request: request, delegate: self, startimmediately: false)!; connection.start(); } func connection(connection: nsurlconnection!, didreceivedata data: nsdata!){ self.data.appenddata(data); } func connectiondidfinishloading(connection: nsurlconnection!) { // throwing error on line below (can't figure out error message is) do{ let jsonresult: ns...

android - Invalid URI after closing calling Activity -

i have activity multiple imageviews showing images retrieved calling camera intent. on onactivityresult store image uri returned later background processing. the thing is: once finish calling activity, of stored uris (passed asynctask) invalid , when try load them (i.e. glide), raise nullpointerexception. i can't keep activity running during background processing, takes time , gives users bad experience. i've tried other methods when acquiring images thinking read permission availability , life cycle have calling method (created myself file in file system , passed camera intent, example), none of worked. i've tried different devices , different android version , issue persists, , implicit pattern of android? has of experienced problem? tha camera , gallery intent calls: public static void getcameraimage(activity activity) { intent takepictureintent = new intent(mediastore.action_image_capture); if (takepictureintent.resolveactivity(activity.get...

javascript - Remove clipPath on hover -

in short have image masked using clippath works in ie 9+. issue need have mask hide on hover reveals full image, reapply on mouseout. script have right not work. pen included below. new svg , clippath . http://codepen.io/omgdracula/pen/ejpzqx $(document).ready(function() { $('.finish') .mouseover(function() { $(this).find('svg').find('clippath').css('display', 'none'); }).mouseout(function() { $(this).find('svg').find('clippath').css('display', 'block'); }); }) <div class="col-xs-3 finish" style="position:relative;border:1px solid red;"> <img src="http://placehold.it/297x252" class="img-responsive" /> <svg preserveaspectratio="xmidymin slice" style="width:100%;height:252px;top:0;left:0;position:absolute;border:dotted 2px blue" version="1.1" xmlns="http://www.w3.org/2000/svg...

Converting Exponential value to Decimal Android -

i have string in format of "6.151536e-8" how can convert string or int 0.000000061 ? use if want have 2 significant digits: string str = "6.151536e-8"; bigdecimal bd = new bigdecimal(str); bd = bd.round(new mathcontext(2, roundingmode.half_up)); system.out.println(bd.toplainstring()); this prints: 0.000000062 if want round down 0.000000061 use roundingmode.down

java - Different Tomcat Instances on Windows -

i have apache tomcat 7 running on windows 7 professional laptop working java 6 jdk etc , works project setup for. have requirement have tomcat 8 running java 8 jdk. have windows environment variables set follows; catalina_home c:\apache\tomcat classpath java_home\lib java_home c:\java\jdk6_30u jre_home c:\java\jre6_30u i have downloaded java 8 , installed jdk , jre fine in c:\java\java8 , left java environment variables alone. @ command prompt says java version 1.8.0.7 project running java 6 still works fine. have extracted tomcat 8 c:\apache\tomcat8 , know can't have conflicting port numbers how set tomcat 8 use java 8 jdk , not conflict catalina_home environment variable? i have googled there conflicting feedback saying set setenv.bat file , saying amend catalina.bat file or startup.bat file. how set environment variables use appropriate ones different tomcat instances? create new file startup-with-java8.bat in tomcat's bin folder: @echo off set ca...

java - Android dlopen failed: file offset for the library "libnexplayerengine.so" >= file size: 0 >= 0 -

hello guys need help. i'm stuck problem 3 days , cannot go forward. i'm trying integrate nexplayer app, i'm getting error msg: java.lang.unsatisfiedlinkerror: dlopen failed: file offset library "/data/app/com.abscbn.iwanttv-1/lib/arm/libnexplayerengine.so" >= file size: 0 >= 0 i have put .so files libs folder sourcesets.main { jni.srcdirs = [] jnilibs.srcdir 'src/main/libs' } any idea how debug , fix problem? gladly appreciate help. thanks!

sublimetext2 - How do I create a open folder keyboard shortcut in Sublime Text? -

i know add keyboard shortcuts, go keyboard bindings - user , edit json file. have lot of keyboard customizations. [ { "keys": ["ctrl+shift+."], "command": "erb" }, { "keys": ["alt+i"], "command": "expand_tabs" }, { "keys": ["alt+ctrl+w"], "command": "close_all" }, { "keys": ["ctrl+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, // swap keybindings paste , paste_and_indent { "keys": ["ctrl+v"], "command": "paste_and_indent" }, { "keys": ["ctrl+shift+v"], "command": "paste" }, // swap keybindings save , save_all { "keys": ["ctrl+s"], "command": "save_all" }, { "keys": ["ctrl+shift+v"], "c...

c# - Does using Async programming paradigm improve performance all time -

this question has answer here: does async , await increase performance of asp.net application 5 answers i started read docs , blogs .net async programming model. in documents says use async if operation blocking work(access file system, access network, access sql etc. remote data storage (if have more examples blocking works please share them) ). what if system has enough power run works without using async model. need still need async? i know don't waste thread calling blocking work, think have lots of free threads on threadpool. please threat question asp.net application perspective async (by async assume mean tap ) code not parallelization, not same of using threads thread pool offload other work. async makes more efficient use of thread; rather blocking thread while wait disk or network work, free thread else while waits disk or network finis...

php - list friend from sql -

Image
i trying echo friends table not echoed. put following sql: $sql="select user2 , user1 friends user1 = '$log_username' or user2 = '$log_username' , accepted ='1' , isblocked='1' "; $query = mysqli_query($db_conx, $sql); and table: and $log_username = mtest , highlight rows corresponding result didn't get. there know there logic error. please me out this. select user2 , user1 friends; fetch friends user1,user2 column , after (user1 = '$log_username' or user2 = '$log_username') condition , fetch user match atleast 1 column last condition filter accept 1 , friend blocked 0. $sql="select user2 , user1 friends (user1 = '$log_username' or user2 = '$log_username') , (accepted ='1' , isblocked='0') "; $query = mysqli_query($db_conx, $sql);

java - glassfish embedded v4.1.1 and lambda -

i have junit test (integration test) embedded glassfish server. test failed if use lambda in stateless ejb. without lambda expression test works fine. is there fix or snapshot version of embedded glassfish server? have not found info snapshot version of glassfish-embedded-all :( used dependency: <dependency> <groupid>org.glassfish.main.extras</groupid> <artifactid>glassfish-embedded-all</artifactid> <version>4.1.1</version> <scope>test</scope> </dependency> if uncomment line (1) or (2) reference of example bean null in junit test (lookup failed exception appears) :( bean/ejb: @stateless @localbean public class examplebean { @persistencecontext private entitymanager em; public person get(long id) { optional<person> p = optional.ofnullable(em.find(person.class, id)); list<person> persons = new arraylist<>(); persons.add(p.get()); /...

Send image data to android app from App Engine -

in app engine backend have method gets image google cloud storage @apimethod( name = "getprofileimage", path = "image", httpmethod = apimethod.httpmethod.get) public image getprofileimage(@named("imagename")string imagename){ try{ httptransport httptransport = googlenethttptransport.newtrustedtransport(); googlecredential credential = googlecredential.getapplicationdefault(); storage.builder storagebuilder = new storage.builder(httptransport,new jacksonfactory(),credential); storage storage = storagebuilder.build(); storage.objects.get getobject = storage.objects().get("mybucket", imagename); bytearrayoutputstream out = new bytearrayoutputstream(); // if you're not in appengine, download whole thing in 1 request, if possible. getobject.getmediahttpdownloader().setdirectdownloadenabled(false); getobject.executemediaanddownloadto(out); ...

Nginx : Cannot listen on port 80 ... only port 8080 works on OSX 10.11 -

osx 10.11 installed latest nginx 1.9.9 (from source , compiled ) configuration file /usr/local/conf/nginx.conf syntax ok when listening on port 8080 no problem can request http://example.local:8080 server { listen 8080; server_name example.local; root html; sudo lsof -i -p | grep -i "80" nginx 8254 root 10u ipv4 0x643a3abbad7bf485 0t0 tcp *:8080 (listen) nginx 8392 yves 10u ipv4 0x643a3abbad7bf485 0t0 tcp *:8080 (listen) but when change port 80, cannot reach http://example.local:80 ================================================ server { listen 80; server_name example.local; root html; sudo nginx -s reload nginx 8254 root 10u ipv4 0x643a3abbad7bf485 0t0 tcp *:8080 (listen) nginx 8254 root 18u ipv4 0x643a3abbadbb9485 0t0 tcp *:80 (listen) nginx 8430 yves 10u ipv4 0x643a3abbad7bf485 0t...

scala - Json4S Recursive method parse needs a result type -

i using json4s library in scala program. my build.sbt looks like librarydependencies ++= seq( "org.json4s" % "json4s-native_2.11" % "3.3.0" ) in code, have function import org.json4s._ import org.json4s.native.jsonmethods._ import org.json4s.jvalue class foo { def parse(content: string) = { val json = parse(content) } } but ide complains "recursive method parse needs result type" the scala compiler infers return type of methods based on implementations, has trouble inferring type of recursive methods. the message recursive method parse needs result type due shortcoming. def parse(content: string) recurses calling parse(content) . makes method recursive (infinitely so, i'm assuming planning on changing later). in order compile, you'll need explicitly state return type, e.g. def parse(content: string): unit . i'm going take further guess , there parse method being imported either json4s o...

python - IndexError: list index out of range, but each string can be printed out -

i writing script pool lines filea when first 2 columns same fileb. filea txt file 3 column separated tab, , fileb txt file 2 column separated tab. keeps showing error following: "site=a[0]+’\t’+a[1] indexerror: list index out of range" can print a[0], a[1], a[2] , site. here code: fileb=open('atog_mock.txt').readlines() filea=open('depth_ice.txt').readlines() outfile=open('atog_depth_ice.txt','w') dict1={} line in filea: a=line.strip().split('\t') site = a[0]+' '+a[1] if site not in dict1: dict1[site]=a[2] line in fileb: b=line.strip().split('\t') site=b[0]+' '+b[1] if site in dict1: outfile.write(b[0]+'\t'+b[1]+'\t'+dict1[site]+'\n') outfile.close() i appreciate help! we can't give definitive answer because don't have access data files, can debug wrapping problematic line in try/except block: try: site = a[0]+...

How can I maintain stylesheets during Elm development? -

i'm new elm , trying build web app elm-html . i'm having trouble setting workflow develop , see results quickly. i've used elm-reactor serve , reload changes serves app localhost:8000/foo.elm doesn't include external stylesheets. have use inline styles components, discouraged html guidelines. i'd rather use css (or css preprocessor). i can use elm-make build *.js file , include in index.html maintain, won't watch changes. is wrong approach include css files in elm project, , if not, how maintain stylesheets outside of elm , still serve project locally, while watching changes? you're better off not using elm-reactor main development because of limitations. acceptable use own external css file , agree, that's better practice embedding styling in output html. i've used gulp , gulp-elm package set file watching task compiles elm code (as scss files) on save, , works wonderfully. there grunt plug-in elm if you're that. ...

linux - Mercurial unbundle error: abort: ... unknown bundle version 20 -

i'm on linux ubuntu 14.04 lts , use mercurial distributed scm (version 3.3.2). try unbundle mercurial hg bundle made on mac osx command line: hg unbundle xxx.hg abort: xxx.hg: unknown bundle version 20 does have clue going on? google research has not been providing informations that. i had add type='bzip2-v1' bundle call from mercurial.commands import bundle bundle(ui, repo, tmpfile.name, dest=none, base=(parentc.rev(),), rev=(c.rev(),), type='bzip2-v1')

raspbian - RasberryPi A2DP Sink - pause issue (PulseAudio, Bluez) -

i'm trying create bluetooth a2dp sink (receiver) output audio vorbis radio stream (lan only). want bluetooth add-on squeezebox (squeezelite) multi-room music system. a2dp-sink-radio-transmitter standalone raspberry pi can added system easily. i'm relatively new linux. i have achieved working setup, falls on when pause audio on bluetooth source (phone). the setup: bluetooth phone -> received bluez/pulseaudio [pa] -> pulseaudio bluez source through pa 'module-loopback' alsa audio card sink -> darkice encode vorbis stream using pulseaudio source (device = pulse) -> icecast2 broadcast this works when pause phone stream (as received vlc/squeezebox) stops (time stamp stops ticking). resuming audio gives huge latency (i think it's same length pause duration). after long pauses stream can fail restart. darkice seeing audio input has stopped. i think need tell pulseaudio fill pause silence somehow. i've tried routing through alsa dummy (snd-dummy)...

python - Open Android Studio Project into Android Studio from the command line -

i trying create shortcut in windows launch latest version of android studio , load given project in shortcut. i want able create shortcuts different project , click open straight project. if can done in batch script or python script, work also. is possible? doesn't android studio takes command line arguments opening project.

javascript - Get the previous and next values of a string in lexicographic order -

i'm working nosql database , reasons can't use equality filtering in queries e.g select database id = 10 is not allowed but inequality filtering allowed e.g select database id > 1 my id's unique strings (emails) , need use equality filtering thought convert inequality statements equality statements (e.g id = 10 written id > 9 , < 11). if ids numbers use code such key: function(id) { //assuming no id can 0 , no id can larger 2^53-1. return row id = 10 var result = sendtodatabasequery('select * database id > ' + (id-1) + ' , ' id < ' (i+1)'); } with numbers easy this, strings have found more challenging. if have email such mysuperfakeemail.gmail.com how previous , next lexicographic string (i assuming mysuperfakeemail.gmail.co l , mysuperfakeemail.gmail.co n respectively)? there established algorithm type of function already? writing on nodejs server utf-8 characters.

c# - How to colorize current cell only in DataGridView -

the code have got colorizing cells of row need colorize certain/current cell. how can done? private void datagridview1_cellpainting(object sender, datagridviewcellpaintingeventargs e) { if (e.rowindex > -1) { themecolorview tc = (datagridview1.rows[e.rowindex].databounditem themecolorview); if (tc != null) { color c = color.fromname(tc.colortype.trim()); brush b = new solidbrush(c); // know shoud changed here ;) e.graphics.fillrectangle(b, e.cellbounds); e.paintcontent(e.clipbounds); e.handled = true; } } } try comparing painted cell currentcell of grid: if (e.rowindex > -1 && datagridview1.currentcell != null) { if (e.columnindex == datagridview1.currentcell.columnindex && e.rowindex == datagridvie...

ruby - using the _was method in rails -

so trying use _was method on attribute. lets have object person : person.name = "new name" person.name_was = "old name" if call person.changed? return ["name"] . so question is: can somehow use values person.changed this: person.changed.each |x| person.x => returns undefined value x person['x'] => returns new name person["#{'x'}_was"] => errors end is there way can use _was method string variable x ? i'm not quite sure example code trying achieve, think looking #changes method; person = person.create(first_name: 'john', last_name: 'doe', sex: 'male') person.first_name = 'jane' person.sex = 'female' person.changes.each |attribute, change| puts attribute puts change.first puts change.last end # => 'first_name' # => 'john' # => 'jane' # => 'sex' # => 'male' # => 'female' pe...

javascript - How to run a protractor browser.sleep for 15 minutes -

i have run tests agains live site. have pretty make tasks wait on website time out (15 minutes), run task, once has passed. longest got wait 26.6 seconds (26600 ms) on firefox, , 30 on chrome. i following error : error: timeout - async callback not invoked within timeout specified jasmine.default_timeout_interval. so need adjust specified timeout jasmine run this: browser.get('www.page.com'); browser.sleep(900000); browser.dosomethingelse(); this jasmine timeout happening in case. need tell jasmine it's okay takes time. can set timeout globally in jasminenodeopts in config: jasminenodeopts: { defaulttimeoutinterval: 200000, } or, can set on spec level ( example here ).

elasticsearch can't start service in ubuntu 15.10 -

i trying setup elasticsearch on system.i installed seems process not starting. cant response via curl. read problem regarding pid owner not correctly setup, tried steps still isnt working. if put "set -x" in /etc/init.d/elasticsearch , try /etc/init.d/elasticsearch restart i output root@sid-laptop:/etc/init.d# /etc/init.d/elasticsearch restart + id -u + [ 0 -ne 0 ] + . /lib/lsb/init-functions + run-parts --lsbsysinit --list /lib/lsb/init-functions.d + [ -r /lib/lsb/init-functions.d/01-upstart-lsb ] + . /lib/lsb/init-functions.d/01-upstart-lsb + unset upstart_session + _rc_script=/etc/init.d/elasticsearch + [ -r /etc/init//etc/init.d/elasticsearch.conf ] + _upstart_job=elasticsearch + [ -r /etc/init/elasticsearch.conf ] + [ -r /lib/lsb/init-functions.d/20-left-info-blocks ] + . /lib/lsb/init-functions.d/20-left-info-blocks + [ -r /lib/lsb/init-functions.d/40-systemd ] + . /lib/lsb/init-functions.d/40-systemd + _use_systemctl=0 + [ -d /run/systemd/system ] + [ -n...

Instagram API Approval -

my application in legacy mode. (active until june 2016) if apply instagram api approval, , it's denied, application still function until june 2016, or disabled? it function, in sandbox mode. people listed admins app able use it.

php - slim framework sending and recieving json -

im doing simple post, reason no matter do, cant read json data $.ajax({ url: 'server/account/session', type: 'post', data: { "username": name, "password": password} , contenttype: 'application/json; charset=utf-8', datatype: "json", success: function (data) { sessionstorage.accesstoken = data["token"]; sessionstorage.userid = data["userid"]; alert ( sessionstorage.accesstoken ); }, error: function () { } }); data: {"username": "chips", "password": "potato"} my php: $result = json_decode($app->request->getbody(), true); var_dump($result); would result in null. don't why return null, sent json decode in php a. array, isnt im doing? question two: 2) related question: if send through jquery.post jquery.post("server/ac...

java - Struts error - can not find package -

having error: com.opensymphony.xwork2.actionsupport; package not exist i using struts2.3.8 , not using eclipse or net beans, have made directory structure: code\chapter\struts2application\web-inf\src\comm\kognet\action\clientaction.java and unzipped struts2 , copied , stored jar files in: code\chapter\struts2application\web-inf\lib common-logging1-1-1 freemarker-2.3.19 ognl3.0.6 xwork core-2.3.8 struts2 core-2.3.8 i have set catalina_home as: c:\program files\java\jdk1.7.0_07\apache-tomcat-7.0.37 path as: c:\program files\java\jdk1.7.0_07 classpath . i new struts , first program. please help you're missing commons-io , commons-fileupload, and... ...please don't try dependency management hand: use maven, ivy, etc. and... ...please don't builds hand, use maven, ant, etc. setting classpath (using either preferred -classpath or -cp or classpath environment variable, imo should avoided) . insufficient. need add dependent jars expl...

Python & Pandas: series to timedelta -

m col in dataframe df indicates number of month. m 1 0 15 i trying find number of days between 2015-01-01 , 2015-01-01 + df.m. following col want get. daynum 31 0 456 i know how using loop , list: int((datetime.strptime("2015-01-01", "%y-%m-%d") + relativedelta(months=df.m[i]) - datetime.strptime("2015-01-01", "%y-%m-%d")).days) is there build-in function in pandas can solve problem easily? you can use same approach in question, using automatic vectorized operations instead of looping. first convert series of integers relativedelta's: in [76]: m = pd.series([1, 0, 15]) in [77]: m2 = m.apply(lambda x: dateutil.relativedelta.relativedelta(months=x)) in [78]: m2 out[78]: 0 relativedelta(months=+1) 1 relativedelta() 2 relativedelta(years=+1, months=+3) dtype: object then can same calculation: in [80]: (pd.timestamp('2015-01-01') + m2) - pd.timesta...

node.js - Running a node express server using webpack-dev-server -

i'm using webpack run react frontend using following config: { name: 'client', entry: './scripts/main.js', output: { path: __dirname, filename: 'bundle.js' }, module: { loaders: [ { test: /.jsx?$/, loader: 'babel-loader', exclude: /node_modules/, query:{ presets: ['es2015', 'react', 'stage-2'] } } ] } } i'm trying put node.js express backend well, , run through webpack well, have single server running both backend , frontend, , because want use babel transpile javascript. i made quick testserver looking this: var express = require('express'); console.log('test'); var app = express(); app.get('/', function(req, res){ res.send("hello world express!!"); }); app.listen(3000, function(){ cons...

if statement - Type-juggling and (strict) greater/lesser-than comparisons in PHP -

php famous type-juggling. must admit puzzles me, , i'm having hard time find out basic logical/fundamental things in comparisons. for example: if $a > $b true , $b > $c true, must mean $a > $c always true too? following basic logic, yes i'm puzzled not trust php in this. maybe can provide example not case? also i'm wondering strict lesser-than , strict greater-than operators (as meaning described strictly knew in past equality comparisons) if makes difference if left , right operands swapped strictly unequal values: # precondition: if ($a === $b) { throw new exception( 'both strictly equal - can not compare strictly greater or smaller' ); } ($a > $b) !== ($b > $a) for of type comparison combinations these greater / lesser comparison operators not documented, reading manual not helpful in case. php's comparison operators deviate computer-scientific definitions in several ways: in order constitute equiv...

postgresql - Postgres unique key with multiple null columns -

i'm running postgres 9.5 , trying create unique constraint based on 3 fields. problem i'm having 2 of columns can nullable rows these fields null not seen breach unique constraint. i'm aiming constraint trying update on conflict (upsert). the table structure this product_id integer not null colour text null size text null i found question here can along lines of following create unique index idx_1 on table (product_id, colour, size) colour not null or size not null; create unique index idx_2 on table (product_id, colour, size) colour null or size null; i'm not sure if work having 2 fields in clause how can call unique index on conflict? or maybe should approach different way? if treating null empty string acceptable, can try with: create unique index idx_1 on table (product_id, coalesce(colour,''), coalesce(size,''));