Posts

Showing posts from August, 2014

maven - I want to get the artifact version deployed by Jenkins -

i run maven deploy step (using maven build step) , artifact deployed timestamp. i want create docker image has deployed artifact , docker image tagged artifact timestamp. common scenario tag of docker image has same artifact contains. i have read couple of posts jenkins maven deploy jar nexus - artifact naming jenkins - how can pass parameters upstream downstream sonatype nexus rest api fetch latest build version where [3] gives me list of snapshot-versions server in xml, has parsed. since i'm pushing artifact in jenkins job, possible know full artifact name in build instead of getting server. is there api/any other way, can give name of latest artifact instead of artifact xml the -snapshot part of files (attached on maven deployment 'task') replaced timestamped version @ deploy:deploy phase. 1) create docker image file extend artifact pom docker-maven-plugin (provided spotify @ https://github.com/spotify/docker-maven-plugin ) . [.

node.js - How to use exec-php(node js) in MVC framework like zend? -

basically want on here data node server js, data returned function written zend model. my node js server code below: var socket = require( 'socket.io' ); var express = require( 'express' ); var http = require( 'http' ); var execphp = require('exec-php'); var app = express(); var server = http.createserver( app ); var io = socket.listen( server ); execphp('../application/modules/front/models/dbtable/postcontent.php', function(error, php, outprint){ php.fetchentryall(function(error, result){ io.sockets.emit('showfeeds', result); }); }); server.listen( 7000 ); so when tried execute above code gives me error below: error: command failed: php fatal error: class 'zend_db_table_abstract' not found in /data/www/xxx/application/modules/front/models/dbtable/postcontent.php on line 3 same code works when use core php instead of zend. so believe can't use oop stuff exec-php. is there solution here? reference link

sql - MS Access - Query bringing in "new record" row -

i have query populating form , form allow data set edited. issue having query pulling last row used add new record. results in having row looks shows fields blank, leaves 1 field "null". i played around query , able find workaround selecting "distinct" records, problem when select distinct, cannot edit data set. there other way around this? i can upload example of database if needed. thanks! edit: picture show issue: https://imgbomb.com/i/?ro1sp

ios - Generate song suggestions (auto-complete) -

i'm developing app , want user able start typing song name/artist/whatever , have list/drop-down show suggestions on fly depending on user typed (preferably user typing). i thinking need use sort of api queried itunes database songs available purchase (or other large database song information), i'm open using other source. does know of api can or framework can use. don't need solution in code or anything, i'm asking nod in right direction. let me know if need anymore information. thanks. apple exposes search api itunes store. should you. https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html here's writeup apple describing api: https://www.apple.com/itunes/affiliates/resources/blog/introduction---search-api.html from there, have hit endpoint appropriate parameters , display results. endpoint is: https://itunes.apple.com/search?parameterkeyvalue

vb.net - ThreadStart doesn't accept a parameter -

so guys i'm new @ vb.net , wanted create simple program pings , scans open ports . but, pinging ok scanning ports isn't working keep saying "threadstart not accepting parameter" , dont know how fix .anyways code of port scan part: private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click integer = start1.value end1.value ' tt= temp threading control.checkforillegalcrossthreadcalls = false dim tt new system.threading.thread(addressof scanport) tt.isbackground = true tt.start(i) next end sub ?...so make accept parameter? private sub button2_click(sender object, e eventargs) handles button2.click integer = start1.value end1.value ' tt= temp threading control.checkforillegalcrossthreadcalls = false dim tt new system.threading.thread(addressof scanport) tt.isbackground = true tt.start(i) next end sub private s

java - ListView only displaying first item in arraylist -

list view displaying first item in data. how make display data in array list. think because using the same key in map bur how change , make appear. appreciated. package menu.saryal.example.com.menu; import android.content.intent; import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import java.util.arraylist; /** * placeholder fragment containing simple view. */ public class itemorderedfragment extends fragment { private arrayadapter<string> itemtitle; public final static string extra_text = "menu.saryal.example.com.menu"; public itemorderedfragment getthisitemorderedfragment() { return thisitemorderedfragment; } itemorderedfragment thisitemorderedfragment = this; @override public view oncreateview(layoutinflater

rails model.blank? returns false even though I purged the db -

i have model of journey. refresh db, called following rake db:reset db:migrate which should purge database of existing data , restart database. i called journey.first in console, returns nil expected. but why when called journey.blank? returns false ? database not empty (or blank) @ point? if not, how can check see if journey model empty or not? you want check see if there no elements in database, not if object is blank . for that, make count query instead. journey.count # should return 0

Switch statement with automatic break at each case step in C++ -

if want have switch statement each case need run instructions break this: switch (condition) { case (opt1): // stuff break; case (opt2): // stuff break; case (opt3): // stuff break; // ... default: // stuff } is possible have exclusive switch, without fall through, default every option should break , not have explicitly state break instruction? , if not in c++ idea if such feature available in other imperative languages? c# needs break too, yells @ if don't put it. need goto label; explicitly fall through. in c++, there no way natively (other horrible macros, of course). however, clang has -wimplicit-fallthrough warning. can insert [[clang::fallthrough]]; silence warning deliberate fallthrough. documentation : http://clang.llvm.org/docs/attributereference.html#fallthrough-clang-fallthrough

osx - Linux Mass Storage kernel module g_mass_storage use with FAT -

i configuring portable (embedded linux based) device becomes mass storage provider once plugged computer. mass storage media must compatible windows , mac, therefore choose fat filesystem (file allocation table). the fat produced mkdosfs im facing following issues when connected computer: windows : - want's repair drive, if allow come no errors found.... mac : - drive mounted stays little while mounted , usable vanish again after while. ends in regular attempt remount unmount again. further see following line dmesg usbmsc identifier (non-unique) 0x00000000 0xxxxx 0x300 0x100, 2 if plug windows machine , format exposed drive fat (fat 32) both win , mac boxes happy fat system found on device. implies me mkdosfs not capable of producing valid fat although knowning vfat produces... had similar issues getting cross os compatibility work? cannot believe 1 facing issue. here setup routine g_mass_storage kernel module: kernel : modprobe libcomposite cd /sys/kernel/c

java - Error while invoking mbean in JBoss AS7 -

i trying invoke mbean jboss application using below code: mbeanserver mbeanserver = managementfactory.getplatformmbeanserver(); objectname namingname = objectname.getinstance("naming"+namingport+":type=rmiregistry"); if (mbeanserver.isregistered( namingname)) mbeanserver.unregistermbean( namingname); mbeanserver.creatembean( "mx4j.tools.naming.namingservice", namingname, null, new object[] { new integer( namingport) }, new string[] { "int" }); mbeanserver.invoke( namingname, "start", null, null); //namingport = ((integer)mbeanserver.getattribute(namingname, "port")).intvalue(); string jndipath = "/jmxconnector"; int port = 9999; // management-native port string urlstring = system.getproperty("jmx.service.url","service:jmx:remoting-jmx://127.0.0.1:" + p

r - Unable to launch SparkR in RStudio -

after long , difficult installation process of sparkr getting new problems of launching sparkr. my settings r 3.2.0 rstudio 0.98.1103 rtools 3.3 spark 1.4.0 java version 8 sparkr 1.4.0 windows 7 sp 1 64 bit now try use following code in r: library(devtools) library(sparkr) sys.setenv(spark_mem="1g") sys.setenv(spark_home="c:/spark-1.4.0") sc <- sparkr.init(master="local") i recieve following: jvm not ready after 10 seconds i trying add system variables spark path or java path. do have advices me fix problems. the next step me after testing local host start tests on running hadoop cluster. i think bug has been resolved. try following, sys.setenv(spark_home="c:\\spark-1.4.0") .libpaths(c(file.path(sys.getenv("spark_home"), "r", "lib"), .libpaths())) library("sparkr", lib.loc="c:\\spark-1.4.0\\lib") # use of \\ windows environment. library(sparkr)

Some issues about installing gcc version 4.8.2 in redhat -

n order install caffe,which used deep learing,i need upgrade gcc version 4.4.7 4.8.2 in redhat 6.5。 first run ./configure worked, make -j4, report options.c:11145: error: narrowing conversion of '-0x00000000000000001' 'int' 'short unsigned int' inside { } g++ -std=gnu++0x -c -g -din_gcc -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -w -wall -wwrite-strings -wcast-qual -wmissing-format-attribute -pedantic -wno-long-long -wno-variadic-macros -wno-overlength-strings -fno-common -dhave_config_h -i. -i. -i../../gcc -i../../gcc/. -i../../gcc/../include -i../../gcc/../libcpp/include -i../../gcc/../libdecnumber -i../../gcc/../libdecnumber/bid -i../libdecnumber -i../../gcc/../libbacktrace ../../gcc/hash-table.c -o hash-table.o g++ -std=gnu++0x -c -g -din_gcc -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -w -wall -wwrite-strings -wcast-qual -wmissing-format-attribute -pedantic -wno-long-long -wno-variadic-macros -wno-overlength-string

android - How to execute a operator secret code and receive data in stringbuffer? -

how execute operator code *12345# , receive response data in stringbuffer ? intent intent = new intent(intent.action_call); intent.setdata(uri.parse("tel:*12345*")); startactivity(intent); thank you

c# - Why i'm getting Win32Exception when trying to get info from process inside a backgroundworker? -

dowork event: private void backgroundworker1_dowork(object sender, doworkeventargs e) { backgroundworker worker = sender backgroundworker; while (true) { if ((worker.cancellationpending == true)) { e.cancel = true; break; } else { stopwatch sw = stopwatch.startnew(); populateapplications(); sw.stop(); int msec = 1000 - (int)sw.elapsedmilliseconds; if (msec < 1) msec = 1; // don't consume 100% cpu system.threading.thread.sleep(msec); } } } populateapplications method: private void populateapplications() { this.begininvoke(new methodinvoker(delegate { var icon = icon.extractassociatedicon(getprocessinfo(getprocess

Facebook Register plugin issue -

i've seen many websites facebook register plugin error: unable load registration form [app name]. may have blocked app on facebook. go facebook privacy settings unblock app. (error: 404) i know facebook register plugin stop working on july 30, 2015 ( https://developers.facebook.com/docs/plugins/registration/v2.3 ). does know why there 404 error? i share answer of facebook team: subeesh basheer · · facebook team hi diego, page appears using registration plugin here: http://2x1.co/signup/facebook this plugin part of api v1.0 , has been removed part removal of v1.0 on 30th april 2015. you should instead use facebook login authenticate users app, either using login button or making api calls javascript sdk. docs these linked below. hope helps. login flow web: https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3 unable load registration form 2x1.co. may have blocked app on facebook. go facebook privacy settings unblock a

excel - INDEX MATCH not giving me the desired result -

i need little bit of help. trying use index match formula not giving me desired result. here query. i have 2 tables. table 1 summary sheet , table 2 list of specific customers. in table table 1, there column of customer name , commission amount. i want when there customer name entered in customer column , name listed in table 2, multiply column 3 10 otherwise state 0. what have tried follows: if(match([customer name],table2[commission],0),[quantity]*0.1,"0") it returns value when customer name entered customer column name listed in table 2 doesn't show 0 when other customer name entered name not listed in table 2. kindly review , me out. thanks. generally should not use if that. if evaluating statement determine whether true or false . in case match return #n/a (an error) when match not found, causes expression stop being evaluated because error returned. there several ways deal this, start using iserror determine whether match found. =i

java - How to stop BufferedReader readline()? -

im new java , im trying make client-server form. client , server can chat each other. client have 2 thread 2 mission: send , receive message. want when sendthread read keyboard string "bye", client stop 2 thread. problem thread receive still perform statement readline() of bufferedreader can't reach exit here code of mine: try { br = new bufferedreader(new inputstreamreader(socket.getinputstream())); while (!stop) { string temp = br.readline(); if (temp.length() == 0) { thread.sleep(100); } else system.out.println(" receiving server: " + temp); } } catch (ioexception | interruptedexception e) { e.printstacktrace(); } update: sorry because dont explain more clearly. client have 2 thread run independently. receivethread code in can alway wait message server. , sendthread alway read data keyboard. when

javascript - jquery .on() delegated event, can't access anything using $(this) -

using .on() delegated event of jquery, because of dynamically created link, found myself having trouble using $(this) reference of element clicked. html <div class="container"> <form id="form1" action="" method="post" style="" > <h3><b>cc</b></h3> <input type="radio" name="simple" /> ccca <input type="radio" name="simple" /> cccb <br /> <p style="display:none;"></p> <input class="formsubmit" type="submit" value="repondre" /> <hr /> </form> <form id="form2"

sql server - SQL where clause not getting filtered -

i have following query, not giving regard in p.created_by =@searchby clause, how correct results filtered according @searchby too. alter proc [dbo].[rptcashcollectionouter] @branchid int, @searchby int, @strdate datetime=null, @enddate datetime=null begin select distinct p.created_on paid_date reading re join billing_gen bg on re.id = bg.reading_id join customer_registration cr on bg.account_number = cr.account_number join payment p on bg.bill_number = p.bill_number join customer_category cc on cr.customer_category_id = cc.id p.created_by = @searchby , ( ( @strdate null ) or cast(floor(cast(p.created_on float)) datetime) >= cast(floor(cast(@strdate float)) datetime) ) , ( ( @enddate null )

angularjs - Dynamic route request render in express framework -

i want try dynamic routing. i'm using express framework node js server. here html code <a href="/views/adminpanel?url={{mmenu.webaddress}}" ng-click="description(mmenu.webaddress)">{{mmenu.menuname}}</a> in client side $scope.description = function(url) { $http({'method' : 'get', 'url' : '/views/adminpanel/'+url; }).success(function(data) { }). error(function(data){ }) } and in server side, app.get('/views/adminpanel/url', function(req, res) { res.render('views/adminpanel/url'); }); this our routing process. how route request , mistake. client $http({'method' : 'get', 'url' : '/views/adminpanel/'+url; server app.get('/views/adminpanel/url' unless client url variable = url not match. believe want exposing url param in uri. app.get('/views/adminpanel/:url'

In Java, is constructor non static? -

many people constructor in java non-static..! initialize object need constructor. therefore, can use constructor without object constructor must static. a constructor has instance ( this available). therefore, is, definition, not static. the jre runs constructor after creates instance.

jquery / JavaScript replace xth occurance -

i have string : var str = "a a"; how replace specific else ? eg: replace 3rd : var str = "a 00 a"; of 1st, 2nd, etc.. ? thanks i split str, replace whatever index, join back var str = "a a"; var sp=str.split(' '); var ind=2; sp[ind]='00'; console.log(sp.join(' '));

Weird behavior in python list concatenation -

this question has answer here: why += behave unexpectedly on lists? 7 answers i create python list as >>> list1 = ['a', 'b', 'c'] and set >>> list2 = list1 now perform 2 similar operations list1 , list2 >>> list1 = list1 + [1, 2, 3] >>> list1 ['a', 'b', 'c', 1, 2, 3] >>> list2 ['a', 'b', 'c'] and >>> list2 += [1,2,3] >>> list1 ['a', 'b', 'c', 1, 2, 3] >>> list2 ['a', 'b', 'c', 1, 2, 3] but results different in both cases. reason it? the += operator in python lists, internally calls list.extend() function, , hence list extended in place. whereas when + concatenation operator , new list created , returned, hence actual list there in list1 not change

node.js - NPM not working after initial Node package install -

so i've got brand new macbook pro running 10.10.3 (14d2134). installed node.js via package installer can download on https://nodejs.org/ from there attempted install grunt via npm after getting error -bash: npm: command not found realized npm might need installed in addition initial install of node. i tried removing node following these instructions: how uninstall node.js, , reinstall beginning (mac os x) intention of reinstalling both node , npm via homebrew. however, after following above instructions , attempting install node homebrew, recieved error saying node installed (apparently didn't remove every trace of it) wasn't linked. followed command line prompts link node , did successfully. so here node installed still getting nonsense. please send help. xoxo. last login: mon jun 29 08:36:45 on ttys000 jeremys-macbook-pro:~ jeremypbeasley$ node -v v0.12.5 jeremys-macbook-pro:~ jeremypbeasley$ npm install -bash: npm: command not found jeremys-macbook-pro:~

javascript - inserting html-js in a single wordpress templet page -

hi new web development developing website using word press theme have made html/js code want insert in 1 of page full width template. html/js looks this <!doctype html> <html> <head> <title>google maps api v3 example: distance matrix</title> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script> <style> html, body { height: 100%; margin: 0; padding: 0; } #wrapper { width: 100%; height: 100%; } #map-canvas { height: 100%; width: 100%; position: relative; z-index: -1; } #outputdiv { font-size: 11px; } table { background-color: #828282; border-collapse: collapse; left: 75px; right: 0; bottom: 0; top: 50px; position: fixed; float: left; z-index: 0;

java - 404 error with Rest Service - Jersey/tomcat8 -

i have been trying past couple of days many examples, not able make rest service running. have tomcat8(ubuntu 14.x)/jersey. idea? pom.xml snippet <dependencies> <dependency> <groupid>javax.ws.rs</groupid> <artifactid>jsr311-api</artifactid> <version>1.1.1</version> <scope>provided</scope> </dependency> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-server</artifactid> <version>1.18.1</version> </dependency> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-servlet</artifactid> <version>1.18.1</version> </dependency> </dependencies> web.xml snippet <servlet> <servlet-name>restservice</servlet-name> <!--servlet-class>org.glassfish.jersey.ser

Creating JavaScript Phone Keypad with Alphabet for SMS -

i’m trying create virtual phone keypad alphabet feature sms. i’ve tried far: var button = document.queryselectorall('button'), input = document.queryselector('input'), busy = true, hold, is_busy, delay = 1000, change = -1, click = null; (var = 0, len = button.length; < len; ++i) { button[i].onmousedown = function(e) { var text = this.getattribute('data-text').split(""), number = this.getattribute('data-number'); busy = true; cleartimeout(is_busy); if (click !== e.target) { busy = false; } if (change >= text.length - 1 || click !== e.target) { change = 0; click = e.target; } else { change = change + 1; } if (text[0] === '#') { input.value = input.value.slice(0, -1); hold = settimeout(function() {

Tile based map with php sockets -

this first post here, so.. gentle :d so guys, working on small browser game, , started tile based map. quite big map, 1000*1000 tiles, @ least. i tried few methods of taking map database. example, load 12*12 tiles, cover screen, , when user dragged map, loading more rows/columns database through ajax , deleting opossing ones. slow method on localhost.. can't imagine how on real server. i read more techniques using pseudorandom number generator, random seeds etc don't think fit type of situation complicate things. so thinking of using php socket . using php socket in other projects , pretty reliable , fast. i take map database , put in big 3 dimensional array on single machine, server. , through sockets users take maps, new rows/columns etc. have used sockets task? or there better? kinda frustrated results gained ajax , looking fast solution.

r - Filling histogram by column of color names -

i have function combines data sets , assigns colors each code seen below x1 <- rep(1:10, each = 3, times = 3) x2 <- rep(1:7, each = 7, times = 2) x3 <- rep(6:9, each = 11, times = 4) y1 <- rep(1:5, each = 2, times = 9) y2 <- rep(1:14, times = 7) y3 <- rep(1:11, times = 16) color1 <- rep("blue", times = length(x1)) color2 <- rep("red", times = length(x2)) color3 <- rep ("green", times = length(x3)) data1 <- cbind(x1, y1, color1) data2 <- cbind(x2, y2, color2) data3 <- cbind(x3, y3, color3) alldata <- data.frame(rbind(data1, data2, data3)) colnames(alldata) <- c("x", "y", "color") ggplot(data = alldata, aes(x=x), position = "dodge") + geom_histogram(fill = alldata$color) ggplot(data = alldata, aes(x=x, y=y)) + geom_point(colour = alldata$color) i wondering why colors aren't being assigned histogram, being supplied points of scatter plot. the error i'm g

Delete string element in array (Matlab) -

i have string: pairs = ['aa';'ab';'bb';'ac'; 'cc'; 'cb';'de'; 'bc'] how can delete element has same characters in string 'aa','bb', 'cc' ? the expected output should be: out = ['ab';'ac';'cb';'de';'bc'] use logical indexing , compare first , second column: out = pairs(pairs(:,1)~=pairs(:,2),:) for more general way (to cover rows more 2 characters) can create index of rows have elements equal each other using bsxfun: allsame = any(~bsxfun(@eq, pairs, pairs(:,1)), 2); out = pairs(allsame,:);

objective c - Is there a "touch slop" constant for iOS? -

on android, there "touch slop" concept, representing minimum distance "a touch can wander before think user scrolling". there similar concept / constant on ios can use? reference android: https://developer.android.com/reference/android/view/viewconfiguration.html#getscaledtouchslop() -- edit more information -- here's use case: i'm implementing custom gesture recognizer general uiview. should fire touch down, touch & click event when appropriate. desired effect simulate how uicontrols respond touch gestures on general uiviews. problem is, when uiview inside scrollview, click event should not fire when scrollview starts scrolling. i'm merely seeking read-only access constant, or wondering if such constant commonly agreed. a "touch slop" property applies if using uilongpressgesturerecognizer. (take @ allowablemovement property .) system handles gesture classification logic behind scenes. if need functionality normal uipan

Raspberry camera error: "mmal: No data received from sensor" -

i used raspberry camera times ago. tried again acquire image raspistill -o image.jpg command; red led on camera flashes, error: mmal: no data received sensor. check connections, including sunny 1 on camera board of course camera connections fine. there other way check if camera still working? this error appears because of faulty connection camera. had exact same problem in different camera+pi configurations. following case encountered: the connector not correctly inserted either in camera or in pi. the sunny connector (the small yellow 1 on camera) not connected well. (now gets interesting) if remove , reinsert camera in pi please sure remove power pi. sensor sensitive , spark on wrong pin burn it. (i did unfortunately) trigger problem pi connector pins. confirmed pi2 connector may have bad soldering lead cold contact soldering. can fix using flux on pins , pass soldering iron hot end on pins remake connection. i used longer cable had both connectors on same si

java - Send facebook request from google endpoints -

i've googled around, though can't seem find answer. currently using google endpoints android studio. i'm looking send facebook request via backend server (java). (assume have access token). how can achieve this? please include code , examples of have tried already. questions needs specific programming issue. right general. though i'm not 100% this, believe facebook doesnt allow work. access tokens should not shared. , servers shouldnt able pretend other clients. any allowed uses of fb api done using server's own access token, , not other.

php - Laravel: Call to a member function getParameter() on a non-object -

in appserviceprovider want set object ioc container like: $organisation = organisationhelper::getorganisationbyslug(); $this->app->instance('organisation', $organisation); inside organisationhelper have following code: $slug = \app::make('request')->route()->getparameter('organisation'); return organisation::select('id', 'name', 'slug')->where('slug', '=', $slug)->first(); the error i'm getting is: call member function getparameter() on non-object it's because router has not been dispatched yet, don't know how fix or route parameter in other way. any suggestions on how resolve route here?

python - Trying to understand UnmappedInstanceError using SQLAlchemy -

i'm trying fill table in sql data in dataframe below. code functions expected when use other dataframes same columns , datatypes, dataframe alone error sqlalchemy.orm.exc.unmappedinstanceerror: class 'builtins.list' not mapped results line session.add([yc_node_hist(fk_yc_update = listofindices3[i],curve_date = row1['date'], tenor = row1['year'], abrv = row1['value'])]) . using automap() map table yc_node_hist class. my main problem can't understand error means . date year value abbrv 0 2005-01-04 0.08333333 4.709456 gbp 1 2005-01-05 0.08333333 4.713099 gbp 2 2005-01-06 0.08333333 4.707237 gbp 3 2005-01-07 0.08333333 4.705043 gbp yc_node_hist : create table yc_node_hist ( id bigint identity(1,1) primary key, fk_yc_update bigint not null foreign key references yc_update(id), curve_date date not null, tenor float not null, abrv float no

objective c - How to get objects from array of objects for given key -

i rows database array. , example have in these rows fields ´id´,´section´. possible id´s chosen section array without loops using operators? instance 1 2 b 2 3 4 b and section 'a' i'd [1,2,3] if database array of tuples can this: let database: [(int, string)] = [(1, "a"), (2, "b"), (2, "a"), (3, "a"), (4, "b")] let anumbers = database.filter{ $0.1 == "a" }.map{ $0.0 } or swift 2: let anumbers = database.flatmap{ $0.1 == "a" ? $0.0 : nil }

Install haskell koans on windows -

i trying learn haskell using haskell koans https://github.com/haskvan/haskellkoans . installation instructions found not working , presumably linux. need koans working on windows. if @ top of setup-koans , you'll see: #!/usr/bin/env runhaskell import control.monad (unless) ...etc that first line hashbang indicates unix shell running file program should pass follows (the haskell source file, in case) command specified ( /usr/bin/env runhaskell in case). if have ghc installation, , runghc in path, should able remove line , runghc setup-koans . you might play cygwin, or linux virtual machine (e.g. in docker) familiarize sort of thing.

excel - VBA code slow to run the first time each day -

i have issue, thought network drives have tested , not issue. there 2000 files(totaling 328mb) match, used in test , takes 1.4seconds complete anytime run it, except first time each day, when takes anywhere 30secs 60 secs. i thought dir causing issue definitively inside loop slow. would file caching causing issue? there better way load in first line of large quantity of files 'get filenames sallfiles = dir("c:\folder\" & sfile & "??.???") 'loop through each file while len(sallfiles) > 0 scurrentfilename = sallfiles scurrentfilepath = "c:\folder\" & scurrentfilename 'read 1st line each file open scurrentfilepath input #1 line input #1, sfirstline close #1 vrowdata = split(sfirstline, "~") '(write data array code here) sallfiles = dir loop

php - Laravel 5.1 Seeding with Factories -

i'm trying out new laravel 5.1 model factories seed app's tables. using info on http://laravel.com/docs/5.1/seeding#using-model-factories built this: // account model class account extends model { public function contacts() { return $this->hasmany('app\contact'); } // contact model class contact extends model { public function account() { return $this->belongsto('app\account'); } // account table seeder $accounts = factory(app\account::class(), 25)->create()->each(function($u) { $u->contacts()->save(factory(app\contact::class)->make()); the problem foreign key never gets set (the corresponding account_id should passed in contact table isn't being passed). i tried setting account_id manually this: $u->contacts()->save(factory(app\contact::class)->make([ 'account_id' => $u->id, ]); but fails, , anyway it's not mentioned needed in docs. has

jquery - 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'getElementsByTagName' -

i have simple mvc application in want show location dynamically google map. i getting error in file---- unhandled exception @ line 16, column 59007 in https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js 0x800a01b6 - javascript runtime error: object doesn't support property or method 'getelementsbytagname' the view page contains simple html javascript code , javascript files included---- <!doctype html> <html> <head> <title></title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> <link href="http://ajax.googleapis.com

linux - Why there is `gpio_request` instead of `request_region` in raspberry pi driver? -

in book ldd3 , if 1 driver want control pins of cpu, should call request_region() function declare usage of ports. when want implement simple driver module on raspberry pi, however, found in this example request of ports implemented gpio_request() function. why , when need use gpio_request() instead of request_region() ? and, what's difference purposes these 2 functions. btw: searched ldd3 page page can't find clues gpio ... why there no introductions gpio ? because of 2.6 kernel version? in book ldd3, if 1 driver want control pins of cpu, should call request_region() function declare usage of ports. first, word "port" ambiguous , requires context. port can refer physical connector (e.g. usb port), or logical connection (e.g. tcp port). your understanding of request_region() flawed. routine management of i/o address space. question tagged raspberry-p1 uses arm processor , has no i/o address space manage. arm processors use memory-ma

sublimetext3 - Sublime Text regex to isolate an achor tag -

i'm looking sublime text regular expression enable me find , replace anchors within html file. for example: <a href="#menu">menu</a>) <a href="http://en.wikipedia.org/wiki/breadcrumb_(navigation)"> i've tried finds all links , anchors – want anchors: (?i)<a([^>]+)>(.+?)</a> i've tried selects 2 nearby tags , in between: (<a href="#)(.*)("{1})> here's eventual solution came with: (<a href="#)([^"]+)("{1})> this allows me replace anchors so: $1" onclick="alert('yay')">

java - Publish-Subscribe Event Handlers - Static vs. Singleton -

i'm designing event bus, , stands, methods wishing subscribe events must static , declaring classes registered directly class objects. however, i'm aware guava includes an event bus accepts object during registration , prefers instance methods subscribers. there advantage latter system? in practice i'm not sure of difference, object registered singleton. i'd interested hear pros , cons.

php - Insert into database-Moodle -

i'm trying insert data database i'm getting error though table exist in database. error message table "faculty" not exist more information error debug info: error code: ddltablenotexist stack trace: line 1194 of \lib\dml\mysqli_native_moodle_database.php: dml_exception thrown line 19 of \local\try\process.php: call mysqli_native_moodle_database->insert_record() codes require_once(dirname(dirname(dirname(__file__))) . '/config.php'); global $db; $name = optional_param('name', null, param_text); $uni_id = optional_param('university_id', null, param_text); $record1 = new stdclass(); $record1->name = $name; $record1->displayorder = '10000'; $record2 = new stdclass(); $record2->name = $uni_id; $record2->displayorder = '10000'; // insert 1 record @ time. $lastinsertid1 = $db->insert_record('faculty', $record1); $lastinsertid2 = $db->insert_record('faculty

android - text over Wifi using SSID -

it possible sent message on wifi using ssid,i searched , seen wi-fi peer-to-peer (p2p)api here seeing thread there no ssid in wi-fi peer-to-peer (p2p)api not sending data on ssid send data using socket transfer data once connection established, can transfer data between devices sockets so question how sent text using wifi ssid? if mean send sms addressed wifi ssid answer no, 2 different communication systems , ssid not valid end point address in sms protocol. if want send sms on wifi (because have no gsm/umts etc network connection, wifi) there number of web based applications allow this, plus applications google voices. these provide interface sms network, message has addressed address sms network (or more precisely ccitt no.7 network) understand - i.e. not ssid. if wanted, create web service associate ssid valid sms address (e.g. mobile number). need system keep make sure there unique mapping between ssid , mobile number, , have either disallow or h

ios - Realm primary key migration - objective C -

old rlmobject there below , primarykey attributeid. want change key @"id" next build. useritemobject.m @implementation useritemobject { } + ( nsstring * )primarykey; { return @"attributeid"; } @end useritemobject.h @interface useritemobject : rlmobject @property(nonatomic, copy) nsstring *id; @property(nonatomic, copy) nsstring *attributeid; @end rlm_array_type(useritemobject) and wrote code appdelegate; [rlmrealm setschemaversion:1 forrealmatpath:[rlmrealm defaultrealmpath] withmigrationblock:^(rlmmigration *migration, nsuinteger oldschemaversion) { if ( oldschemaversion < 1 ) { [migration enumerateobjects: useritemobject.classname block:^(rlmobject *oldobject, rlmobject *newobject) { newobject[ @"primarykeyproperty" ] = @"id"; }]; } }]; this code give me error ; *** terminating app due uncaught exception 'rlmexception', reason: 'invalid property

html - pure grid list floating dynamic height doesn't work -

so want archive list dynamic height starts second line @ left side of page. bellow: || || || || || || || || || if use display: inline-block; vertical-align:top works, if put each block 25%, shows 3 blocks on 1 line. use float:left shows 4 blocks on 1 line, supposed to. breaks apart. || || || || || || || || || i tried plain html/css works, guess pure. can ? code: <ul> <li class="pure-u-md-6-24">1teskts<br/>teksts</li> <li class="pure-u-md-6-24">2teskts<br/>tekstteskts<br/>tekststeskts<br/>tekststeskts<br/>tekstss</li> <li class="pure-u-md-6-24">3teskts<br/>teksts</li> <li class="pure-u-md-6-24">4teskts<br/>teksts</li> <li class="pure-u-md-6-24">5teskts<br/>teksts</li> <li class="pure-u-md-6-24">6teskts<br/>tekstteskts<br/>tekststeskts<br/&g