Posts

Showing posts from February, 2012

Is posible define range of port to use in expose `-P` in docker? -

is posible limit range of ports expose -p parameter, as: docker daemon --range-ports=2000-2099... docker run -p... <- ports used between 2000 , 2099 or docker daemon... docker run -p --range-ports=2000-2099... <- ports used between 2000 , 2099` you can give range of ports mapped; docker run -d -p 8000-9000:5000 training/webapp python app.py

python - Np.Argwhere To Produce Numbers -

i working on price weighted indexes class , although simple calculation hand figured practice novice python skills. edit code working now stockbprice = np.array([35.1, 45.6, 41.5, 47.8]) stockcprice = np.array([52, 67.6, 61.5, 67.7]) stockdprice = np.array([89.5, 107.4, 53.7, 64.4]) quantityb = np.array([300,300,300,300]) quantityc = np.array([400,400,400,400]) quantityd = np.array([100,100,200,200]) pricearray = [] in range(0,1): if np.argwhere(stockbprice) < 2: pricearray.append((stockbprice+stockcprice+stockdprice)/3) else: d = (stockbprice[2]+stockcprice[2]+stockdprice[2])/((stockbprice[1]+stockcprice[1]+stockdprice[1])/float(3.0)) pricearray.append((stockbprice+stockcprice+stockdprice)/d) pricearray = np.array(pricearray) print pricearray i want use indices condition np.argwhere gives boolean general idea want use. very easy if len(stockbprice) < 2:

sql - MySQL. Issue with: INTERVAL 60 MINUTES + last_run < NOW() -

Image
i attempting select row database based on time value. my database contains table of actions. these actions run ever x number of minutes. when action ran, row updated , it's last_run column timestamp containing value of now() here valid row in database. can see row last run days ago. it's set run every 60 minutes. i use interval last_run + interval_minutes < now() . so, last run time, plus sixty minutes, less value of now() if 60 minutes has passed. the query trying run below: select * routine_actions routine_actions.routine_id = 12 , interval routine_actions.interval_minutes minute + routine_actions.last_run < now() group routine_id but, i'm getting no results. idea's doing wrong? the query you're trying looks ok in first part of question, following interval last_run + interval_minutes minutes < now() should be interval interval_minutes minutes + last_run < now()

lua - Spawn multiple images in grid evenly -

Image
i have 40 objects placed in 5x8 grid style. object's image 50x50. code use spawning following: local spawnimage=function(x,y) circle[bcircle] = display.newimage( "dot1.png" ) circle[bcircle].x =-5+x*55 circle[bcircle].y = 60+y*55 scenegroup:insert(circle[bcircle]) circle[bcircle].value = bcircle circle[bcircle].tag=false numcircle[bcircle]= display.newtext( circle[bcircle].value, spx+x*55, spy+y*55, "helsinki", 16 ) circle[bcircle]:addeventlistener( "touch", touchi ) bcircle = bcircle + 1 end y=1,8 x=1,5 spawnimage(x,y) end end the thing cant place them evenly in different devices(simulator) ipad iphone 6 iphone 5 any help? how can place objects evenly in different devices? ideas? help? thanks! you don't take display resolution consideration different devices. you're using fixed offsets , sizes different results. corona can handle scaling if def

Android Studio Java - Which modifier should I use? -

i'm kind of new android studio , java bear me please. i'm making app can keep scores dart game. have switch statement button clicked. when enter button pressed, want go java file while using 1 argument, input. apparently use both static , non static methods , wrong. how fix this? here first java file, witch screen file: package com.example.jeroe.darts; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.textview; import com.example.jeroe.darts.score; public class matchscreen extends appcompatactivity implements view.onclicklistener{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.content_match_screen); defineeventhandlers(); } public void onclick(view v) { textview inputtrue = (textview) findviewbyid(r.id.textviewinput); textview edittextscore = (textview) findviewbyid(r.id.edittextscore); swit

java - Binding a key to a JButton -

this question has answer here: add key bindings jbuttons actions action commands? 1 answer i have been looking answer attach keybinding jbutton many-many hours, , still didn't manage it. have following simple program consisting of 2 classes. tried using getinputmap() , getactionmap() several ways, without success. want following: when press key "1" on keyboard, press jbutton btn1, , when press key "2", press jbutton btn2 (and 1 or 2 appear on jlabel consequently). //class1:// import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; public class event06 extends jframe { event06b base = new event06b(this); jbutton btn1 = new jbutton("1"); jbutton btn2 = new jbutton("2"); jlabel label = new jlabel(""); public event06() { super(); setbou

ctypes - Using zlib crc32_combine in Python -

i trying use crc32_combine function zlib in python. although various other zlib functions available, 1 isn't part of "batteries included" standard library. i've tried 2 approaches: port c code python , calling zlib python ctypes. both give me different results, although not result i'm expecting. i'm presenting ctypes code since think executes faster , has smaller chance additional programmer errors. the algorithm can combine 2 crc32 hashes when length of data of second hash provided. crc32_combine defined follows: crc32(crc32(0, seq1, len1), seq2, len2) == crc32_combine( crc32(0, seq1, len1), crc32(0, seq2, len2), len2) this output: expected crc: 45e57586 combined crc: 567ee4e4 the second line different when ran python 3.5.1 on win32. not python 2, result never expect either. put zlib1.dll in same directory script try out. import zlib def crc32_combine_ctypes(crc1, crc2, len2): import ctypes ctypes import util lib = util.

Displayng latex equation in gitlab wiki using the markdown editor -

Image
i interested in building wiki scientific computing code on gitlab needs me write equations , render them in wiki in gitlab. how this. tried paste mathjax rendering script doesn't work. can katex used anyhow ? $$ \partial_t \int_{\omega} \mathbf{q} d \omega = \int_{\partial \omega} \mathbf{f} ( \mathbf{q}) \cdot \mathbf{n}d \partial \omega - \int_{\omega} hg \nabla z_b $$ gitlab supports katex gitlab ce 8.15 using code backticks. documentation here , relevant discussion on merge request 8003 . here current way use equations in gitlab

html - Why do I need to add a class two times to make justify work? -

i'm wondering why menu-items correctly show when class menu added direct parent , again parent of parent. when remove 1 of menu classes span items won't justify. http://codepen.io/anon/pen/vlvwjv <nav> <div class="top-nav"></div> <div class="bottom-nav"> <div class="container"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <h1>portfolio van dirk</h1> </div> </div> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 menu"> <div class="menu"> <span>concepten</span> <span>ontwerp</span> <span>artikelen </span> <span>programmeren</span> <span>curriculum vitea</span>

Infix to Postfix reading from file stuck in infinite loop c++ -

this program reads input file, , input file changes each incoming infix line postfix notation. seems working except nested while loop in main() deals operation symbols (* / + -). when commented out output lot better. unsure of why entering infinite loop. i left of pseudo-code on main reader can see line of thought, there better way execute program. tests.txt contains: 4 5+7 7*5 (5-3) 5/5 8*5+3 8*(5+3) 8+3*5-7 (8+3)*(5-6) ((8+3)*(2-7)) ((8+3)*2)-7 (8*5)+((3-2)-7*3) ((8*5+3)-7)-(5*3) 7*9+7-5*6+3-4 node.h #pragma once template <class t> struct node { // data members t data; node<t>* next; // constructor node(t d); };// end node struct template<class t> node<t>::node(t d) { data = d; next = nullptr; } stack.h #pragma once #include "node.h" template <class t> class stack { private: node<t>* head; public: // constructor stack(); // destructor ~stack(); // push

windows - Manipulate cmd ping color based on time -

my internet not working , i'd check quality based on cmd windows tool. believe it's task simple enough handle. i've begun making shortcut can have easy access command: c:\windows\system32\ping.exe 8.8.8.8 -t now trying transform cmd ping command visually responsive 1 based on output. i'd make color change according time response. after looking , not finding related, believe it's either impossible or no 1 has ever tried. thank :) pd: (in case there unclear ask , i'll gladly answer) @echo off setlocal set loops=10 :loop /f "tokens=3delims==" %%a in ('ping 8.8.8.8 -n 1') /f "delims=m" %%b in ("%%a") echo %%b&color %%b&goto cchgd :cchgd pause set /a loops-=1 if %loops% gtr 0 goto loop color goto :eof a simple demonstration - repeats ping 10 times, changing colours depending on response. manipulate wish...

Python error: TypeError: 'str' object is not callable -

i new python , stackoverflow, apologies if don't know much. have picked python, , got started it. have been attempting make login admin thing, seem getting error. have tried using statement, seem error: typeerror: 'str' object not callable here's code... username = input("please enter username: ") name in username (3): if username == 'admin': break else: print("you've given incorrect credentials thrice.") import sys sys.exit("exiting...") while true: password = input("please enter password: ") if password == 'khs9': break print("welcome admin!") any on this? edit apologies if not clearer, attempting try , make in need type in. loop used try , sentence "please enter username" repeat 3 times, show sentence "you've given incorrect credentials 3 times" if input not match have set (i set 'admin') w

Java same function name with different type of HashMap input variable? -

this question has answer here: method has same erasure method in type 6 answers these 2 functions in same class identical names not cause error, because input variable types different. ( string , int ) public static int samename(hashmap<integer, string> _map, string _var) { return 42; } public static int samename(hashmap<integer, string> _map, int _var) { return 42; } in case, variable types different, still causes error. first 1 uses hashmap<integer, string> , second uses hashmap<integer, integer> . public static int samename(hashmap<integer, string> _map, int _var) { return 42; } public static int samename(hashmap<integer, integer> _map, int _var) { return 42; } why this? apart choosing different function name , flipping order of variables, there more professional ways solve this, without manipulating c

python replace string method in read file as binary -

i opened image file in readbinary("rb") mode , stored data in variable. want replace values in binary values.. not working using usual replace method of string f=open("a.jpg","rb") a=f.read() ''' first line '\xff\xd8\xff\xe0\x00\x10jfif\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xe1\x00*exif\x00\x00ii*\x00\x08\x00\x00\x00\x0 ''' a=a.replace("ff","z") print #but there's no change in can tell iam going wrong.. tried a=a.replace(b'ff',b'z') but still output unchanged. can tell iam supposed perform replacement? i don't know version of python you're using (this kind of operations different between 2 , 3), try a = str(a) before executing replace method. edit: python 2.7 reasonable way i've discovered want use built-in function repr . example: >>> picture = open("some_picture.jpg", 'rb') >>> first_line = picture.readl

How can I get the height and width and length of an SVG path using Python? -

i have svg tons of paths basically: <path fill="#fb6430" opacity="1.00" d=" m 0.70 0.00 l 14.60 0.00 c 16.36 3.76 19.56 6.54 21.77 9.99 c 21.37 11.15 20.65 12.15 20.02 13.20 c 18.65 11.77 17.81 9.99 17.51 8.04 c 16.28 8.93 15.13 9.92 14.08 11.01 c 13.93 9.08 13.77 7.16 13.62 5.23 c 13.03 5.22 11.84 5.20 11.25 5.19 c 11.35 6.73 11.45 8.26 11.58 9.79 c 10.84 9.90 9.37 10.13 8.63 10.24 c 7.87 9.37 7.10 8.51 6.36 7.63 c 6.08 7.25 5.53 6.51 5.25 6.13 c 3.75 4.08 2.19 2.06 0.70 0.00 z" /> i want height, width, area, length, , else can path. there python library? or there overlooking manually? you can use svgpathtools find measurements these (assuming know mean). # create svgpathtools path objects svg file svgpathtools import svg2paths paths, attributes = svg2paths('some_svg_file.svg') # let's take first path example mypath = paths[0] # let's find length print("length = ", mypath.length()) # find height, wid

node.js - Error: Cannot find module 'res' in server.js -

i'm trying output "hello world" text . i'm using expressjs , using view engine called "ejs" . i'm beginner in nodejs var express = require("express"); var app = express(); var path = require('path'); var res = require("res"); var port = process.env.port; app.set('view engine'); app.set('views',path.resolve(__dirname,'client','views')); app.get('/',function() { res.render('index.ejs'); }); app.listen(port,function(){ console.log('server running in port '+port); }); here error: module.js:338 throw err; ^ error: cannot find module 'res' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:286:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ object. (/home/ubuntu/workspace/server.js:4:11) @ module._compile (module.js:434:26) @ object.module._extensions.

persist - jqGrid applying sort from known values not working -

i have jqgrid , want apply user's sort values after loads. these values saved , retrieved in jquery cookies. storing data in cookies because user go url , come initiates page load , want in same spot left. i have loadpreferences function being called within loadcomplete. see code snippet below(i left several jqrid properties out keep posting short). // set jquery grid $("#jqgridtable").jqgrid( { // ajax related configurations url: jqdataurl, datatype: "json", mtype: "get", autowidth: true, // configure columns colmodel: columnmodels, // grid total width , height height: "100%", // customize jqgrid post init gridcomplete: function() { cref.updatejqgridpagericons("jqgridtable");

Deleting Rows in R -

this question has answer here: subsetting dataframe in r multiple conditions 7 answers i'm trying delete rows in dataframe when average of vector > individual number in vector. reason seems pick , choose ones deletes. appreciated thank you, here code. k<-c(hw2$age) j<-mean(k) (i in hw2$age) if (j>i){ hw2 <- hw2[-i, ] } don't need vectorise. instead use below sample data x <- data.frame("a"= runif(10), "b" = runif(10)) calculate mean xmean <- mean(x[,"a"]) exclude rows y <- x[x$a < xmean,] this obvious way of excluding unwanted rows

html - Change color of checkbox in Materialize framework -

i working materialize framework , wondering possible change colour of filled-in checkbox green on default. <input type="checkbox" class="filled-in" id="filled-in-box" checked="checked" /> <label for="filled-in-box">filled in</label> any ideas appreciated. thanks add class checkbox input style after pseudo-element of label .checkbox-orange[type="checkbox"].filled-in:checked + label:after{ border: 2px solid #ff9800; background-color: #ff9800; } <input type="checkbox" class="filled-in checkbox-orange" id="filled-in-box" checked="checked" /> <label for="filled-in-box"></label>

maven - Windows Batch script to read pom.properties file within .jar -

i'm looking simple way read 2nd line of pom.properties file placed within meta-inf folder of compiled .jar. (see here: http://maven.apache.org/guides/getting-started/index.html#how_do_i_add_resources_to_my_jar ). need know date in file , it's pain have open jar every time , dig down it. want windows batch script can run via right-clicking on .jar (so i'll need windows registry command well). result of batch command can displayed in cmd window (a nice bonus value being copied clipboard, too). in short: want able right-click on .jar file in windows explorer > select 'get maven generated date' (or whatever) > , have 2nd line of pom.properties file printed console (and copied clipboard). i know can't hard, don't know quite :). thanks in advance help. note .netv4.5 required use system.io.compression.filesystem class. add-type -as system.io.compression.filesystem; $sourcejar = <source-jar-here>; $jararchive = [io.compression.zipfi

visual studio 2013 - Is it possible to statically link against dynamically linked Qt? -

Image
i have been wondering wether possible link different libraries dynamically , statically @ same time? when have been trying link qt5 (dynamically linked) against other libraries can compiled statically , couldn't work because of error , few other errors complaining multiple definitions of symbols in msvcrtd.lib : qtmaind.lib(qtmain_win.obj):-1: error: lnk2038: mismatch detected "runtimelibrary": value "mdd_dynamicdebug" doesn't match value "mtd_staticdebug" in main.obj detailed error messages: i absolutely sure built libraries statically , added qmake_cflags_debug += /mtd , qmake_cxxflags_debug += /mtd .pro file. is not possible mix dynamic , static linking (in qt) or doing wrong? qt version: qt 5.5.1 64bit compiler: msvc2013 64bit

regex - Sliding window pattern match in perl or matlab regular expressions -

i trying use either perl or matlab parse few numbers out of single line of text. text line is: t10_t20_t30_t40_ now in matlab, used following script str = 't10_t20_t30_t40_'; = regexp(str,'t(\d+)_t(\d+)','match') and returns a = 't10_t20' 't30_t40' what want return 't20_t30', since match. why doesn't regexp scan it? i turned perl, , wrote following in perl: #!/usr/bin/perl -w $str = "t10_t20_t30_t40_"; while($str =~ /(t\d+_t\d+)/g) { print "$1\n"; } and result same matlab t10_t20 t30_t40 but wanted "t20_t30" in results. can tell me how accomplish that? thanks! [update solution]: colleagues, identified solution using so-called "look-around assertion" afforded perl. #!/usr/bin/perl -w $str = "t10_t20_t30_t40_"; while($str =~ m/(?=(t\d+_t\d+))/g) {print "$1\n";} the key use "zero width look-ahead assertion" in perl. whe

how to send a variable from PHP to jQuery -

the idea is: <script type="text/javascript"> var supervar = 'u can reach me anywhere on page'; </script> [...some php , html...] <script type="text/javascript"> $('#output').html(supervar); </script> so basicly need because use php includes , need send exact location of php file jq. your supervar variable in scope inside jquery, because declared above jquery script. question how assign variable php , pass on supervar . inside .php file, can escape php when needed within <script> element. for example, if want assign public path of php script, can like: <script type="text/javascript"> var supervar = <?php echo $_server['php_self']; ?>; </script> your server execute php script before serving following output client: <script type="text/javascript"> var supervar = '/your-app/your-file.php'; </script>

math - Summing a number's digits in Java -

this question has answer here: separating digits in integer - exercise deitel's java book 6 answers let's have integer '75'. normally, in head, can add '7' '5' in order '12'. split number '75' 2 different numbers 7 , 5 add them together. leads question, how can perform in java? there math method you? you can use plain maths int = 75; int = / 10; // 7 int b = % 10; // 5 int c = + b; // 12

uitableview - Xamarin throws NullReferenceException when using custom UITableViewCell in iOS -

i having similar problem 1 discussed @ xamarin custom uitableviewcell throws system nullreferenceexception . nevertheless, after following answer there, issue has not been solved. i have custom uitableview boardlistcell . in storyboard, have uitableview . accessible in viewcontroller via outlet tableview . in view controller, data. tableview.source = new boardstableviewsource(sourcedata); my boardstableviewsource : using system; using system.collections.generic; using foundation; using uikit; public class boardstableviewsource : uitableviewsource { private list<list<object>> data; boolean normalboards; public boardstableviewsource (list<list<object>> data, bool normalboards) { this.data = data; this.normalboards = normalboards; } public list<list<object>> getdata() { return data;

javascript - set selected value for dropdowns -

the below code works 1 time not every time var selectedval = $('#drpgender_0').find("option:selected").text(); if (selectedval == "male") { $('#drpgender_1').find("option:contains('male')").text('male').attr("selected", false); $('#drpgender_1').find("option:contains('female')").text('female').attr("selected", "selected"); } else if (selectedval == "female") { $('#drpgender_1').find("option:contains('female')").text('female').attr("selected", false); $('#drpgender_1').find("option:contains('male')").text('male').attr("selected", "selected"); } }; thanks in advance $('#drpgender_0').on('change', function() { var selectedval = $('#drpgender_0').val(); if

php explode file extension name giving null -

Image
so, when upload files, want check file extension is: $files = $_files['files']; $files_name = $files['name']; shows: `"img.jpg"' $files_name_explode = end(explode('.', $files_name)); getting null . what doing wrong? thanks use below code : $path = $_files['files']['name']; $ext = pathinfo($path, pathinfo_extension); hope :)

javascript - How to import special less file form another meteor package? -

for example, want import @gray-lighter color less file varables.less twbs:bootstrap package how loading.less file is: @import 'bootstrap.variables.less'; .loading { padding: 48px 0; text-align: center; { color: @gray-lighter; } } but there error: c:\users\sheng\appdata\local\.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\lib\node_modules\fibers\future.js:245 throw(ex); ^ error: eperm, unlink 'g:\workspace\meteor-admin-lte\.meteor\local\build\programs' @ object.future.wait (c:\users\sheng\appdata\local\.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\lib\node_modules\fibers\future.js:398:15) @ object.rm_recursive (c:\tools\fs\files.js:270:9) @ object.files.rename (c:\tools\fs\files.js:1406:13) @ object.files.renamediralmostatomically (c:\tools\fs\files.js:812:11) @ builder.complete (c:\tools\isobuild\builder.js:571:13) @ c:\t

java spring URL mapping -

i using maven web application, framework spring. using netbeans ide , tomcat server. when run web in netbeans, url in browser is: http://localhost:8080/mywebsite with url website cannot read event servlet mapping. when change url http://localhost:8080/mywebsite/ run good. what reason case? why website don't auto add character "/" in url? {update} config.java public class config extends webmvcconfigureradapter { @bean public urlbasedviewresolver setupviewresolver() { urlbasedviewresolver resolver = new urlbasedviewresolver(); resolver.setprefix("/web-inf/html/"); resolver.setsuffix(".jsp"); resolver.setviewclass(jstlview.class); return resolver; } @override public void addresourcehandlers(resourcehandlerregistry registry) { registry.addresourcehandler("/resources/**").addresourcelocations("/web-inf/resources/*"); } } initializer @override public void onstartup(servletcontext serv

angularjs - How to draw a nvd3 line chart inside an angular directive -

how draw line chart using nvd3 angular directives. i've followed url . to data,i'm unable draw graph.do need change code on here. can please me out regarding issue ... myscope: $scope.data = [{ "x": "2015-10-01", "y": "244" }, { "x": "2015-07-01", "y": "0" }, { "x": "2015-06-01", "y": "117" }, { "x": "2015-05-01", "y": "5353" }, { "x": "2015-04-01", "y": "11159" }, { "x": "2015-03-01", "y": "7511" }, { "x": "2015-0

c# - Selectedindexchanged does not show in the Web -

i have dropdownlist whenever data selected ddl, autofills textboxes specified. it values not show in web. here asp.net <table class="col-lg-12" align="center" width="900"> <tr> <td align="center" class="style2" valign="middle"> name </td> <td align="center" class="style4" valign="middle"> productid </td> <td align="center" class="style4" valign="middle"> price </td> <td align="center" class="style4" valign="middle"> quantity </td> </tr> <itemtemplate> <tr> <td class="style3"> <asp:dropdownlist id="ddlname" runat="server" class="form-control" autopostback="true" onsele

JavaScript canvas: write within box -

in js canvas, how can place text within "box", ora have stay in rectangle? mean, can place text @ x, y coordinate, i'd lay in surround box x0, y0, x1, y1, have line breaks when text go out of box, can center within rectangle , possibly have text scaled fit as box possible. is there such library so? hope you <!doctype html> <html> <head> <style> body { margin: 0px; padding: 0px; } </style> </head> <body> <canvas id="mycanvas" width="578" height="200"></canvas> <script> function wraptext(context, text, x, y, maxwidth, lineheight) { var words = text.split(' '); var line = ''; for(var n = 0; n < words.length; n++) { var testline = line + words[n] + ' '; var metrics = context.measuretext(testline); var testwidth = metrics.width;

unclassifiable statement at (1) Fortran Error -

at line 64 confirmed errors began i asked modify legacy code. have found these errors when compiling error compiling picture . know how solve these errors? use gfortran compiler. the source code: * spectral analysis of measured data * parameter (nd=86400,nsp=43200,nnd=86400) common /wdata/ wd(nnd),wd2(nnd) common /spec/ wsp(nsp) common /tsdata/ ts(nd*2),ctts(nd*2) common /spdata/ p(nsp),df real mean data dt/1.0/ data cotl/14400.0/ data cots/600.0/ pi=3.141593 open(32,file="pw.txt",status="old") open(12,file="output1",status="unknown") open(13,file="output2",status="unknown") j=1,nnd read(32,*)wd(j) end total=0.0 mean=0.0 j=1,nnd total=total+wd(j) end mean=total/float(nnd) j=1,nnd wd(j)=wd(j)-mean end numerical filtering , spectral

text - URL semantic analysis using R -

i have dataset like url keywords impressions clicks http://www.thetelegraphandargus.co.uk/sport/sportbcfc sports|football 5500 456 i wanted explode data set in following format: url url keyword keyword impressions clicks http://www.thetelegraphandargus.co.uk sport sports 5500 456 http://www.thetelegraphandargus.co.uk sportbcfc football 5500 456 i have tried splitting them using stringr , urltools libraries. ee <- as.character(data$url) eee <- strsplit(ee, "/") maxlen <- max(sapply(eee, length)) l <- t(sapply(eee, function(x) c(x, rep(na, maxlen - length(x))) )) f=data.frame(l) and d<-url_parse(as.character(data$url)) i able split urls not getting in desired format. being split in same row. ps:

javascript - how change the link form action a accordance with the `<option>`? -

this form search form. when click <option> "alfamart" or "bca", want link change. this, link: /en2/maps(alfamart)or(bca)/ in accordance <option> how? thanks <form action="/en2/maps".$id."/"><!--relative url page map on--> distination: <select name="textsearchterms" class="selectpicker" data-live-search="true"> <option value="alfamart">alfamart</option> <option value="bca">bca</option> </select> <input type="submit" value="search"> </form> <?php $id = $_get['textsearchterms']; ?> you don't need value url, can change form action select box value. $('.selectpicker').change(function(){ if($(this).val() == 'alfamart'){ $('form').attr('action','alfamart.html'); alert(

windows - code coverage that can be along along with QT for C++ -

i want use proper tool code coverage compatible qt windows. tried using gcov , lcov faced issues. what alternate tools can install free apart gcov? in advance edit: my lcov.bat contains @echo off :: full dirname of current executable set idir=%~dp0 set perl=c:\perl\bin\perl.exe md "%cd%\gcov" echo creating gcov\lcov.info ... %perl% %idir%lcov.perl -b . -d . -c -o gcov/lcov.info :: echo cleaning ... :: %perl% %idir%lcov.perl --remove gcov/lcov.info "*_unneeded_*" -o gcov/lcov.info echo fixing slashes ... type "gcov\lcov.info"|%~dp0repl.bat "\\" "/" >"gcov\lcov.info.tmp" move /y "gcov\lcov.info.tmp" "gcov\lcov.info" >nul echo generating html ... %perl% %idir%genhtml.perl -o gcov/html/ gcov/lcov.info -p "%cd%" i running through cmd, giving me error: .gcda:version '409*', prefer version '501*' finished .info-file creation fixing slashes ... generating html ...

hash - Need to create a new admin login for codeigniter through phpmyadmin -

i new codeigniter , have copied on website admin users not have login details for. want create new admin through phpmyadmin can login backend of website. i have inserted new admin name , tried both a) typing in password , using md5 hash dropdown , b) using third party md5 hash , copying field. once saved admin login doesn't work. the other thing can see different ip address field appears encrypted differently hash 7 characters long, i'm not sure if should affect or encryption method might be. any appreciated. thanks. if have website code database in phpmyadmin can find website link/url signup controllers... try signup link... put desired password , complete signup... after signup go in phpmyadmin , database of website , find user table.. find newly inserted user row... copy password of row , and paste in default admin user password column data... able login website password... edit: please comment out below line /* if (!$this->ion_auth->logg

kerberos - What cipher is used on encrypted NFS? -

for securing nfs (network file system), mount option krb5p can used encrypt traffic between file server , nfs client. authentication , key exchange based on kerberos. here example on how configure debian: https://wiki.debian.org/nfs/kerberos unfortunately, there seems no way configure cipher used transport enryption. cipher used , how can configured, selected, or enforced? without having used nfsv4 kerberos used in many other places, referring confidentiality provided gss-api through kerberos implemented gss_wrap(3)/gss_unwrap(3) . provides quality of protection parameter quite nfsv4 leave null => @ discretion of mechanism. anyway, given gss-api abstracts mechanism, have no choice still can it. enable in kdc @ least rc4, @ best aes128 , aes256. implementations use best available cipher. can scan traffic between client , tgs ( tgs-req , tgs-rep ), client , server ( nfs ) see encryption type has been negotiated , highly used wrapping/unwrapping. can read rfcs did ta

android - why i should add dependencies that in aar file to my project? -

i created android archive library aar file have it's own dependency in it's gradle. use library in many projects of mine, why should add aar dependency application dependencies? know benefit of using aar vs jar aar can have , hold it's own resources , dependencies. the aar file doesn't contain nested (or transitive ) dependencies , doesn't have pom file describes dependencies used library. it means that, if importing aar file using flatdir repo have specify dependencies in project. you should use maven repository (you have publish library in private or public maven repo), not have same issue. in case, gradle downloads dependencies using pom file contains dependencies list.

python - Pip not able to find wheel -

i have virtual environment. since couple of days cannot run pip commands , getting error: file "env/bin/pip", line 7, in <module> pip import main file "/env/lib/python2.7/site-packages/pip/__init__.py", line 15, in <module> pip.vcs import git, mercurial, subversion, bazaar # noqa file "/env/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module> pip.index import link file "/env/lib/python2.7/site-packages/pip/index.py", line 30, in <module> pip.wheel import wheel, wheel_ext importerror: no module named wheel i have wheel in site-packages , installed earlier. how resolve this? cannot use pip commands. your pip installation appears broken. not wheel project problem here, pip.wheel package (part of pip itself) fails import; looks /env/lib/python2.7/site-packages/pip/wheel.py either missing or has been corrupted somehow. i'd reinstall pip @ point.

objective c - 'sizeWithFont:constrainedToSize:lineBreakMode:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context: -

my app old. now, want update latest ios. deployment target 6.0 when change deployment target 6.0 7.1. app throws many warnings. , 1 of them : 'sizewithfont:constrainedtosize:linebreakmode:' deprecated: first deprecated in ios 7.0 - use -boundingrectwithsize:options:attributes:context: the warning occur in line: cgsize expectedlength = [str sizewithfont:str.font constrainedtosize:max linebreakmode:str.linebreakmode]; i try code. don't know how add line break mode. please check: cgsize mysize = [str sizewithattributes:@{nsfontattributename: str.font}]; i checked in stackoverflow. not satisfied checked answers because of linebreakmode . may missed of answers. tell me stackoverflow link me. thanks in advance. thanks of you. of questions solved problem @ last. here code replace old code : cgsize max = cgsizemake(str.frame.size.width, 500); cgrect expected1 = [str boundingrectwithsize:max options:nsstringdrawinguseslinefragment

javascript - HTML code not working on jquery call, instead it outputs HTML code -

i call jquery function on link click , function uses post() method call page. expect see rendered html result other page instead shows me html code of other page. $(document).ready(function(){ $('a.thumbnail').click(function(){ $("div.albums").hide(); $("div.pics").show(); var albumid = $(this).siblings('input[name=albumid]').val(); $.post("gallery-pics-temp.php", { albumid: albumid }, function(data) { $('p#myid').text(data); }); }); }); the other page: (gallery-pics-temp.php) <?php if (isset($_post['albumid'])) { echo $_post['albumid']; //just checking if albumid correct $openalbumid = $_post['albumid']; include "config.php"; //$openalbumid = $_get['albumid']; $querypics = $con->prepare("select * images img_albumid='$openalbumid'")

iis - WebApi Http requests returning 404 -

Image
i using webapi 2 .net framework 4.5 building api , iis(7.5 integrated) , iis(8 integrated) deployment local , live environments. i using system.web.http.cors cross domain requests. webapi.config public static void register(httpconfiguration config) { var cors = new enablecorsattribute("*", "*", "*"); config.enablecors(cors); config.maphttpattributeroutes(); config.filters.add(new unhandledexceptionfilterattribute()); config.bindparameter(typeof(datetime), new datetimemodelbinder()); } authentication resource [datacontract] public class authentication : baseresource { public authentication() { } [datamember(emitdefaultvalue=false)] public string username { get; set; } [datamember(emitdefaultvalue = false)] public string password { get; set; } } authentication controller [routeprefix("sessiontoken")] public class authenticationcontroller :

angular - OWL Carousel 2 with AngularJS 2 - How To -

does know how use owl carousel 2.0 angular 2 ? needs done when trying load carousel items observable (async!). how re-initialize carousel? items appear way large. there seems solution angular 1.x in this post angular 2 newbie failed find out how migrate solution angular 2.0. any highly appreciated!

swift - Reduce instances of an object in an array by rule -

i have simple array of custom objects. i reduce array 1 instance of each color selected largest size. the solutions have come seem long unwieldy, best approach, i've tried looking @ reduce , filter couldn't work out how apply here. class foo { var color: string var size: int var shape: string init(color:string, size:int, shape:string){ self.color = color self.size = size self.shape = shape } } var array = [foo]() array.append(foo(color: "blue", size: 2, shape: "round")) array.append(foo(color: "red", size: 3, shape: "square")) array.append(foo(color: "blue", size: 5, shape: "round")) array.append(foo(color: "yellow", size: 1, shape: "triangle")) array.append(foo(color: "blue", size: 1, shape: "hexagon")) you can avoid brute-force o(n^2) nested looping (and enumeration) solution first sorting array, , thereafter