Posts

Showing posts from January, 2012

objective c - How to use/export Unity project as iOS static/dynamic library/project? -

i have 2 project. unity project 2 views , ios native project using swift main project. want use 2 views/scenes created unity, native ios application other native ios ui component. how can achieve ? the unity's ios build can either exported dynamic(.framework)/static(.a) framework or use whole project subproject/pod. so there can me achieve ? in advance.

Manual size treshold in ImageJ macro -

i using macro measure proportion of images in directory specific color. allows manual adaptation of color treshold. macro "soil cover batch [b]" { run("clear results"); dir1 = getdirectory("choose source directory "); // select directory dir2 = file.getparent(dir1); dirname1 = file.getname(dir1) dirname = file.getname(dir2) list = getfilelist(dir1); run("clear results"); row = 0; (i=0; i<list.length; i++) { if (endswith(list[i], "live.jpg")){ showprogress(i, list.length); open(dir1+list[i]); // opens each image in directory open(dir1+list[i]); print(list[i]); setoption( "blackbackground", false); img = getimageid(); run( "color threshold..." ); waitforuser( "set threshold , click ok." ); // interactive color treshold selectimage(img); run( "make binary" ); // turns binary run( "measure...

asp.net - angular 2 functions in chrome fails in internet explorer 11 -

there example application @ http://www.codeproject.com/articles/1118189/crud-using-net-core-angularjs-webapi functions in chrome async calls seem fail in ie11. have tried adding/removing combinations of following <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="expires" content="-1"> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <script src="../lib-npm/es5-shim/es5-shim.js"></script> <script src="../lib-npm/es5-shim/es5-sham.js"></script> <script src="../lib-npm/es6-shim/shims_for_ie.js"></script> <script src="../lib-npm/es6-shim/es6-shim.js"></script> if open development tools in internet explorer , change emulation 10, page functions expected. (data in list updates on save) if change x-ua-compatible edge 10, call still fails. no errors. project.json { "dependencies...

r - dplyr : how to read a tsv file with headers while skipping some lines? -

this question has answer here: read.csv, header on first line, skip second line 1 answer i have simple tsv file following structure: 0 - headerline 1 - empty line 2 - pig schema 3 - empty line 4 - 1-st line of data 5 - 2-nd line of data i read it, possibly using readr::read_tsv here problem. as can see, first row contains headers. have 3 rows not want read (they contains super weird data coming apache pig), , @ row 4 data starts. in pandas , like df = pd.read_csv('/localpath/data.tsv', sep='\t', skiprows=[1,2,3]) which allows me read headers and skip row one, two, three. i don't see similar option in readr::read_tsv . : df = read_tsv('/localpath/data.tsv', col_names = true, skip = 4) which not parse headers... any ideas? posting comment answer. basically, read in first row our header, , read in remaining row...

lodash - Javascript merge two objects based on key -

i have objects in shape of below. [{ product: 'abc', productid: 'ab123', batch: 'ba1', price: '12' }, { product: 'abc', productid: 'ab123', batch: 'ba2', price: '15' }, { product: 'xyz', productid: 'ab124', batch: 'xy1', price: '124' }] i want merge objects 1 single object in array if key pair ( product , , productid ) mathced, in below format. [{ product: 'abc', productid: 'ab123', batch: ['ba1', 'ba2'], price: ['12', '15'] }, { product: 'xyz', productid: 'ab124', batch: 'xy1', price: '124' }] how can in lodash or in pure javascript. this proposal not alter given data. it creates new objects, first single data, later if more data should grouped, uses array batch , price . var data = [{ product: 'abc...

Dynamic values are not supported as attributes in annotation- AspectJ Android [AOP Android] -

i using custom annotation log id user clicked. getting error " attribute value must constant ". code snippet below. massetid= asset.getcontentid(); @trackevent("track_event") @arrayparams({@params(key = "content_id",value = massetid)}) protected void attributemethod() { } thanks in advance. there way pass dynamic values in annotation rather static variables or constants. using aspectj library android. it's not possible specify runtime values in annotation attributes, constants, , set of possible types limited few types: primitives, string, class, enums, annotations, , arrays of preceding types according java 5 language guide - annotations .

ios - How to auto detect the edges of any object from an image? -

Image
i want auto detect edges of object in image, have captured using camera or uploaded gallery. detected edges selected cropping tool can manually adjust well. there existing application exact same thing (with 60-70% accuracy) not sure how it? https://itunes.apple.com/in/app/tiny-scanner-pdf-scanner-to/id595563753?mt=8

sorting - How to sort association rules by lhs or rhs in R -

i have set of rules apriori algorithm. sorting them lift, confidence or support easy: rules.sorted = sort(rules, by="lift") but let's have small set of rules few different rhs elements. view rules sorted rhs elements (alphabetically). there way that? i.e this: lhs rhs support confidence lift 1 {a} => {b} 0.3919252 0.9431280 1.930940 2 {b} => {a} 0.3919252 0.8024194 1.930940 3 {e,c} => {a} 0.3535204 0.7995546 1.924047 4 {f,i} => {f} 0.3924175 0.9005650 1.868281 5 {h} => {g} 0.4194978 0.9659864 1.864941 6 {c,d} => {a} 0.3653373 0.7141482 1.718525 to this: lhs rhs support confidence lift 2 {b} => {a} 0.3919252 0.8024194 1.930940 3 {e,c} => {a} 0.3535204 0.7995546 1.924047 6 {c,d} => {a} 0.3653373 0.7141482 1.718525 1 {a} => {b} 0.3919252 0.9431280 1.930940 4 {f,i} => {f} 0.3924175 0.9005650 1.868281 5 {h} => {g} 0.4194978 0.9659864 ...

google chrome extension - Open a new tab with a search expression; not URL -

i want create new tab using chrome.tabs.create , "search term" instead of url. when put text in chrome's omnibox, , hit alt + enter (on windows), opens new tab, using text entered "search term". actually, when "search term" can interpreted url, chrome visit url. if can't interpreted, use chrome's default search engine search term. i want same behavior in extension. unfortunately, plugging in text in url property of chrome.tabs.create 's createproperties object, treat term relative url paired extension's settings url base. e.g., term "test" plugged in url value, open tab url: chrome-extension://cinkljgpekgfmlflpdobnacjglddfaap/test. (prepending search term question mark, can in omnibox force search instead of else, doesn't work either.) how can replicate omnibox behavior in extension?

android - Call webservice asynchronously -

i need call web service added webservice web reference , able call it. need make call async because need download lot of data , taking lot of time. tried use async/await method can not since method in webservice not async. original code: public static void validatelogin(jsonparameters _param, ref validatecredentials result, ref string excep_error) { var _mobileservice = new mobileservice(); _mobileservice.url = appparam.iisstring + "/urladdressreference"; try { result = _mobileservice.downloaddata(_param); } catch (exception ex) { excep_error = ex.message; } } i tried add async task in place of void make method async, how can await webservice response? after added webservice web reference can see created each method in async method , completed event. how can make use of them? (ex: downloaddata", method name downloaddataasync`, , event "downloaddatacompleted...

linux - How Ctrl-C propagates through tmux -

i know when hit ctrl-c, operating system pts system interprets , sends sigint foreground process group. wonder how propagates through tmux . say running normal linux x server , window manager. opened xterm , in zsh running tmux . in tmux running bash , in ./a.out . process tree window manager -> xterm -> zsh -> tmux client . tmux server -> bash -> ./a.out . so when hit ctrl-c on keyboard, x server first catches , tells active window xterm "hey guy hit ctrl-c". xterm tells process it's directly running ( zsh ) hit ctrl-c sending pseudo terminal pts/0 "ctrl-c" character. operating system saw "ctrl-c" character in pseudo terminal , translates sigint foreground process group (which zsh , tmux client ). tmux client must have received sigint tells tmux server , tmux server sends sigint foreground process group of pseudo terminal created (with bash , ./a.out in it). sorry if looks confusing. because of how tmux ...

How to change line color based on data range in r plotly -

Image
i trying create plotly line graph can change color based on value threshold. unable find option in r plotly. below code: p2 <- plot_ly(mdata1, x = ~ttime, y = ~value, type = 'scatter', mode = 'lines', color= list(~entity_name,fill.color= ()) , fill = 'tozeroy') %>% layout(xaxis = list(title = 'date',showticklabels = false), yaxis = list(title = 'memory percentage'))

arrays - Gawk distinct and sum column -

i new linux , usage of awk , couldn't find answer following question: i want use awk , file structured that: date id size 2016-11-09 688 47 2016-11-09 688 56 2016-11-09 31640 55 now want sum size each line has date , id , export .csv file. file should that: date,id,size 2016-11-09,688,103 2016-11-09,31640 55 i need help, because not figure out how on own, thank you. if input sorted date , id in sample should use this: $ cat tst.awk begin { ofs="," } nr==1 { $1=$1; print; next } { curr = $1 ofs $2 } (curr != prev) && (nr > 2) { print prev, sum; sum=0 } { prev = curr; sum += $3 } end { print prev, sum } $ awk -f tst.awk file date,id,size 2016-11-09,688,103 2016-11-09,31640,55 rather saving whole file in memory. note approach produce output in same order input whereas for .. in .. loop in end section print output in random (hash) order.

xml - multiple class mapping in CastorMarshaller -

i have 2 pojo classes have create single xml file. project using spring mvc. so, send single class controller , marshaller easy. used return new modelandview("xmlview", "xml", modelname); , define xmlview in appname-servlet.xml remaining stuff. maps modelname.java fields respective fields in xml. now, have requirement map multiple classes. can done single model can returned controller? can create new class nested class in modelname.java if solve problem.

vba - Disable Excel Workbook connections -

my excel spreadsheets work through shared folder. have created connections base files other files. example, customers file connected other documents need retrieve information , updated. thing is, when secondary file open cannot work on base file since open in [read only], tried connection properties , figured out whenever external data reference hasn't been updated can work base files if user refreshes file screwed, tried this: private sub workbook_open() activeworkbook.refreshall application.wait (now + timevalue("0:00:05")) thisworkbook.connections("test1").oledbconnection.enablerefresh = false end sub i thought refresh query , disable connection won't [read only], i'm still getting it. just randomly guessing - can try this: activeworkbook.exclusiveaccess instead of: thisworkbook.connections("test1").oledbconnection.enablerefresh = false

r - Why fitted values do not lie on the fitted line -

Image
i have basic question regarding understanding linear regression model. consider simple case when $y = + bx + e$, $e$ error term. use ols estimate coefficients $a$ , $b$. fitted values $\hat y = \hat + \hat b x$. should not lie on same line, since linear relationship? ask because simple manipulations in r , have counterintuitive results x <- rnorm(20, 3, 1) y <- 12 + 4*x + rnorm(20, 0, 0.5) m <- lm(y ~ x) <- coef(m)[1] b = coef(m)[2] plot(x, y) #plot initial data abline(a = a, b = b, lwd = 2, col = 2) #plot fitted line points(x = m$fitted.values, col = 4, pch = 4) #plot fitted values legend('topleft', c("actual", "fitted line", "fitted values"), col = c(1, 2, 4), pch = c(1, 1, 4), lty = c(0, 1, 0)) why fitted values not lie on fitted line? replace last line with points(x = x, y = m$fitted.values, col = 4, pch = 4) #plot fitted values the fitted values y , not x .

Visual studio error microsoft.vshub.server.httphostx64.exe -

every time work visual studio 2015 same error, microsoft.vshub.server.httphostx64.exe stopped working. screenshot attached . this common bug 2015, not sure if it's hotfixed fix it. stop visual studio if started rename c:\program files (x86)\common files\microsoft shared\vshub\1.0.0.0 microsoft.vshub.server.httphostx64.exe microsoft.vshub.server.httphostx64.exe.bak create copy of microsoft.vshub.server.httphost.exe , rename microsoft.vshub.server.httphostx64.exe re-start visual studio that should fix it

html - Sticking CSS footer on bottom -

i can't seem footer stick on bottom despite trying numerous methods searched for. basically have header @ top box shadow separating rest of page , want same @ bottom, content in middle, ideas doing wrong? have tried position fixed, bottom 0 can't box shadow show using methods or keep centered. thanks! html { overflow-y: scroll; } body { margin: 0; background-color: #ffffff; font-family: 'ubuntu', sans-serif; } div { display: block; } .header-wrapper { -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .container { margin-right: auto; margin-left: auto; width: 940px; } .container:before, .container:after { display: table; line-height: 0; content: ""; } #header { height: 60px; padding: 20px 0 25px 0; } #header .logo { float: left; } #header .logo { display: block; width: 270px; height: ...

c++ - Using Excel through vtable interface -

i learning com programming via c++. understand, on client side of dual interfaces have 2 choices: acquire idispatch interface, query dispids getidsofnames, , use invoke access methods , properties. include .h header files interface definitions , .c source files guids created midl in project , call functions directly through vtable, known compiler .h files. i create quite complex excel workbook c++ program (and insist on using c++ instead of c# or else). using 1. way able write program runs correctly. however, have 2 problems: (a) code quite clumsy because of calls invoke, (b) quite fast faster. so try 2. way. missing .h , .c files because unlike in examples in books read, these files not created example project microsoft. my questions are: where can find these files? how performance improvement can hope way 2. compared way 1.? i recommend not it. and, have reasons... for simple things, spinning excel.exe , marshaling data 1 process process eats of time. ...

javascript - D3 (v3) resetting a previously animated circle after clicking another one -

i have circles dynamically generated on view different sizes (d3.pack()) . added click event on gets clicked expands. now, want elegantly reset when circle clicked? did reset similar answer d3 - resetting svg object animation but here's snippet of code var objects= [ { id: '1477', amounts: 7, color: '#ffd800' }, { id: '1490', amounts: 10, color: '#b65959' }, { id: '1300', amounts: 90, color: '#ff006e' }, { id: '4000', amounts: 50, color: '#ffd800' }, { id: '9000', amounts: 20, color: '#b20101' }, { id: '1212', amounts: 28, color: '#ff006e' }, { id: '2323', amounts: 7, color: '#ffd800' } ] var width = 700, height = 800, color = d3.scale.category20b(), maxdiameter = 500; var container = d3.select(...

google apps script - How do I modify this sending email code to expand the range to multiple columns? -

Image
i want send emails spreadsheet multiple people email them information in columns , not 1. example, want information b2:e2 emailed a2. i using basic template provided in google support have attached below. all changes code have made have not worked: function sendemails() { var sheet = spreadsheetapp.getactivesheet(); var startrow = 2; // first row of data process var numrows = 2; // number of rows process // fetch range of cells a2:b3 var datarange = sheet.getrange(startrow, 1, numrows, 2) // fetch values each row in range. var data = datarange.getvalues(); (i in data) { var row = data[i]; var emailaddress = row[0]; // first column var message = row[1]; // second column var subject = "sending emails spreadsheet"; mailapp.sendemail(emailaddress, subject, message); } } there quite few changes make original script, html our friend in context, nicer. code : function sendemails() { var sheet = spreadsheetapp.g...

Having nginx return a 503 if a file exists -

i'm looking nginx server return 503, if maintenance page exists. server { listen 443 ssl; ssl_certificate /etc/nginx/ssl/xxx.crt; ssl_certificate_key /etc/nginx/ssl/xxx.key; server_name _; client_max_body_size 100m; location / { proxy_set_header x-forwarded-proto https; proxy_pass http://0.0.0.0:8080; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; # return 503 error if maintenance page exists. if (-f /var/www/xxx/shared/public/system/maintenance.html) { return 503; } } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } # redirect server error pages static page /50x.html error_page 500 502 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # return 503 error if maintenance page exists. er...

Why this php code not work when tried to remove script tag? -

normally use code remove data inner img tag. it's work good. <?php $string = "<b>test</b><img src=\"https://www.google.co.th/images/nav_logo242.png\"><script>alert();</script>"; $string = preg_replace("/<img[^>]+>/", "", $string); echo $string; ?> then apply code remove data inner script tag. code. <?php $string = "<b>test</b><img src=\"https://www.google.co.th/images/nav_logo242.png\"><script>alert();</script>"; $string = preg_replace("/<scrip[^>]+script>/", "", $string); echo $string; ?> when test code it's not remove data inner script tag. why ? your code doesn't work because you're parsing <scrip , followed 0 or more characters other > , followed script> . there no such substring in content. in $string, after <scrip have t (which matches [^>]+ ) , have > i...

swift3 - Has Newton’s Cradle playground been ported to use swift 3 code -

i'm looking xcode 8 port of newton’s cradle playground that's been rewritten in swift 3. you can manually menu: edit -> convert -> current swift syntax worked me.

Get first row of dataframe in Python Pandas based on criteria -

let's have dataframe one import pandas pd df = pd.dataframe([[1, 2, 1], [1, 3, 2], [4, 6, 3], [4, 3, 4], [5, 4, 5]], columns=['a', 'b', 'c']) >> df b c 0 1 2 1 1 1 3 2 2 4 6 3 3 4 3 4 4 5 4 5 the original table more complicated more columns , rows. i want first row fulfil criteria. examples: get first row > 3 (returns row 2) get first row > 4 , b > 3 (returns row 4) get first row > 3 , (b > 3 or c > 2) (returns row 2) but, if there isn't row fulfil specific criteria, want first 1 after sort descending (or other cases b, c etc) get first row > 6 (returns row 4 ordering desc , first one) i able iterating on dataframe (i know craps :p). so, prefer more pythonic way solve it. this tutorial 1 pandas slicing. make sure check out. onto snippets... slice dataframe condition, use format: >>> df[condition] this return slice of dataframe can index using iloc . here exampl...

c# - WPF Listview - only highlight part of a ListViewItem -

i'm trying create listview image , textblocks want textblock section show highlights when listviewitem gets focus. i think need set focusable=false , override mouseover highlight style, , implement own highlighting, don't know if it's right approach , what's best way it. here current xaml: <window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wpfapplication1" mc:ignorable="d" title="mainwindow" height="509.468" width="1006.164" loaded="window_loaded"> <window.resources> <local:clonemarginconverter x:key="clonemarginconverter" /...

Google Cloud SQL Restart and Update -

randomly, out of nowhere, stopped being able connect google cloud sql database @ precisely 8:30 et morning. we tried restart instance , have been stuck more hour similar situation this question . seems sort of freak accident has happened before on google cloud sql. the problem instance unresponsive commands - either via gui or command line. to make matters worse, there's no way call support unless pay hundreds of dollars per month join plan. i'm hoping google might trolling threads these tags, or has dealt before can offer advice. just providing update this, comes across future... the issue google cloud sql instance itself. tech support had go in @ lower level , restart entire instance. basically, there's nothing can if encounter exact same situation. this issue happened again few days ago (twice in same 4 weeks), , again, there nothing do. note: when happens, cannot access db backups. serious cause concern. this seems strange hosted db produ...

reactjs - Exports defaults else path not taken with Jest and ES6 -

Image
i'm having issues pass tests 100% coverage. istanbul exports defaults component else path not taken. because of that, see in generated html of istanbul tests not @ 100%. in statements , branches tab. i'm using: react: 15.4.0 jest: 17.0.2 webpack: 1.12.11 any idea? the problem in jest configuration, using preprocessor in order resolve imports: in package json had this: "transform": { "^.+\\.js$": "<rootdir>/cfg/preprocessor.js" }, this file contained this: const babeljest = require('babel-jest'); require('babel-register'); const webpackalias = require('jest-webpack-alias'); module.exports = { process: function (src, filename) { if (filename.indexof('node_modules') === -1) { src = babeljest.process(src, filename); src = webpackalias.process(src, filename); } return src; } }; we updated jest v20 , use module resolver jest, in our package.json ...

oracle - Information about DBMS_METADATA.SET_TRANSFORM_PARAM attribute EXPORT -

i using dbms_metadata.get_ddl utility extract ddl oracle database , need information export parameter procedure dbms_metadata.set_transform_param , can't find in official documentation , apparently it's not case. after testing extracting objects , without parameter thing noticed when export set false views object extracted create or replace view otherwise extracted create view . could 1 explain me export parameter ?? note :i using jdbc generate dll. code snippet below : " dbms_metadata.set_transform_param(dbms_metadata.session_transform,'export',true);"

mysql - strange behavior of php referral function -

i have referral script script <?php ob_start(); define('db_host', 'localhost'); define('db_name', 'dbnamehere'); define('db_user', 'dbuserhere'); define('db_pass', 'dbpasshere'); mysql_connect(db_host,db_user,db_pass); mysql_select_db(db_name); $id = $_request['id']; $uid = $_request['uid']; $oid = $_request['oid']; // completed offer or payment method $new = $_request['new']; $total = $_request['total']; $sig = $_request['sig']; $timestamp = date("y-m-d h:i:s"); // secrete key $key = 'e5870b6ab402d790a5d6bd1cefaee7c4'; // compare results $hash = md5($id.':'.$new.':'.$uid.':'.$key); // output results if ($sig == $hash) { print "1\n"; //users point update query here $users = mysql_query("select points users id=".$uid); $rows = mysql_fetch_array($users); $user_points = $rows['points...

mysql - liquibase rollback always rollsback to a clean empty database -

i've been trying learn liquibase , , trying perform simple roll back. when executes rolls fresh database though i'm trying rollback specific tag. command line below... java -jar liquibase.jar --changelogfile=/media/galactus/documents/changelogs/ch_q_10.xml rollback "1.0.0-release" the change log i'm using pasted below well. expect end going version 1.0.0 database rolls entire thing back. i've confirmed version tag in changelog i"m not sure i'm missing. <databasechangelog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xsi:schemalocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchange...

javascript - configuring django urls and template -

i have django app have load same page twice different content. have login page , forcing user log out if login different machine. logged out , redirected login page time login page should have message " have been logged out because ...". on javascript authentication function have : window.location = /login/?auth =false for redirection . redirect user login page , arguments @ url. i using django.contrib.auth login mechanism. want know changes have make in urls.py , login template make work. if adding parameter need no changes in url config, need take parameter account in view, following example assuming using function based views: def my_view(request): if request.get.get('auth'): alt_login = true else: alt_login = false context = {'alt_login': alt_login} return render(request, 'template_path.html', context) in template can put following around optional block: {% if alt_login %} have been logged out because... ...

Get path from XML File using C# -

i'm needing path c:\sourcefiles\ xml file using c#. i have been trying different escapes methods, nothing seems work correctly. i have tried these: @"c:\sourcefiles\ or c:\\sourcefiles\\ or "c:\\sourcefiles\\" , 'c:\sourcefiles' none of these seem work when reading xml file. xmldocument xdoc = new xmldocument(); xdoc.load(strpath); string strsourcedirectory = xdoc.selectsinglenode("application/setup/sourcedirectory").innertext; here xml file: <application> <setup> <sourcedirectory>"c:\sourcefiles\"</sourcedirectory> <destinationdirectory>@"c:\destinationfiles\"</destinationdirectory> </setup> if has done c# , xml file, please let me know how did it. thanks, your xml file invalid. need escape backslash \\ , close application tag: <application> <setup> <sourcedirectory>c:\\sourcefiles\\</sourcedirectory...

php - SilverStripe unique URL (debug) -

in dataobject there user supplied field title has converted unique url slug. desired result: duplicate url's should suffix value. saving 2 records title foo should result in 1 record foo value column url , second record should have value foo-2 same column. public function onbeforewrite() { parent::onbeforewrite(); // sanitize title field use url $filter = urlsegmentfilter::create(); $this->url = $filter->filter($this->title); // if url not unique, add suffix $i = 1; while($this->uniqueurl($this->url)) { $i++; $this->url = $this->url . "-" . $i; } } method: uniqueurl (within same class) public function uniqueurl($url) { // check if there record same url $existingurl = dataobject::get('newsarticle', "url = '$url'"); if ($existingurl) { // duplicate url return false; } else { // unique url return true; } }...

ruby on rails - ElasticSearch behaves different in production environment -

i have added new search box application. works in development, same feature doesn't work on staging or production environment. missing out, please? i using elasticsearch. have run bundle exec rake users:index . have compared mappings file (elastic_search_mapping.json) on development , staging. there no difference between them. issue the development , staging database in-sync. however, same elasticsearch query returns no results on staging whilst, development gets bunch of results. gotcha: staging environment returns result when exact matching of query has been found. in order words, not allow fuzzy searching. plea can point i'm failing please? ## on development ⤷ curl -v http://localhost:9200/red_development/users/_count?pretty -d '{ "query": { "match": { "registered_name": "sbn" } } }' * trying 127.0.0.1... * connected localhost (127.0.0.1) port 9200 ...

php - Extending Laravel base controller -

i newbie in laravel framework , want extend base controller in turn extends controller. however, discovered when that, controller no longer recognises session variables. here code namespace app\http\controllers\settings; use illuminate\http\request; use app\http\controllers\controller; use app\http\controllers\auth\permissioncontroller; use app\fee; class feecontroller extends permissioncontroller { /** * display listing of resource. * * @return \illuminate\http\response */ public function index(request $request) { dd(session('userdata')['user_urls']); $data['title']="fees"; $data['fees']=fee::all(); return view('settings.fee.index',$data); } and permissioncontroller code <?php namespace app\http\controllers\auth; use illuminate\support\facades\gate; use illuminate\http\request; use app\http\controllers\controller; class permissioncontroller extend...

python - Pyinstaller --windowed or --noconsole .exe not allowing chromedriver to open -

i have python program converting .exe file. have compiled pyinstaller , working fine. want rid of console window have pyqt user interface. have tried: pyinstaller --onefile --windowed --icon=favicon.ico main.py its compiling fine , running when chromedriver activated doesnt show up. works fine when not use --windowed or --noconsole. anyone had problem before? thanks jamie add --noconsole flag script call , remove --windowed , tested , worked me. this : pyinstaller --noconsole --icon=favicon.ico main.py

Scala/Lift- How do I do a page redirect with params? -

i need redirect requests 'toolsearch' page 'search' page parameters so localhost:8080/toolsearch#?q=20 needs redirected localhost:8080/search#?q=20 i trying use boot add liftrules redirect liftrules.statelessrewrite.prepend { case rewriterequest(parsepath("toolsearch" :: nil, "", x, y), z, s) => { rewriteresponse("search" :: "index" :: nil, map("page" -> "search")) //works browser address bar says 'toolsearch' not 'search // s.redirectto("/search") //throws net.liftweb.http.responseshortcutexception: shortcut // jscmds.redirectto("/search") //doesnt compile } } any appreciated. thanks. after spending time trying different things solution found works: liftrules.dispatch.prepend { case req("toolsearch" :: nil, _, _) =>{ () => full(redirectresponse("/search")) } } ref ...

html - Bootstrap nav pushes content below around when hovering over links -

i found similar problems didn't find solution mine, because mine has simple animations on it. lets down it. recorded short 10 second clip showcases problem, please @ here . please take @ bootply . thank help, can't wrap mind around this. html <div class="container"> <nav class="navbar navbar-default" role="navigation"> <div class="row"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> ...

r - Convert a graphNEL graph to a network graph -

i'm trying convert graphnel graph network graph. here's example using topgo 's vignette : library(topgo) library(all) data(all) data(genelist) affylib <- paste(annotation(all),"db",sep= ".") library(package=affylib,character.only=true) topgo.obj <- new("topgodata",description="simple session",ontology="bp",allgenes=genelist,genesel=topdiffgenes,nodesize=10,annot=annfun.db,affylib=affylib) topgo.graph <- attr(topgo.obj,"graph") and trying convert topgo.graph network through intergraph library(network) library(sna) library(scales) library(igraph) library(intergraph) topgo.igraph <- graph_from_graphnel(topgo.graph,name=true,weight=true,unlist.attrs=true) and finally topgo.network <- asnetwork(topgo.igraph,amap=attrmap()) throws error: error in as.data.frame.default(x[[i]], optional = true) : cannot coerce class ""environment"" dat...

c++ - Mouse click lasts too long / clearing event queue -

i create 2d rpg game , managed make there walking of character pointing destination mouse click. now, set enter menu shows after running program , before game loop starts. when press (or release) mouse button start game menu_ev.type == allegro_event_mouse_button_up , leaves enter menu while loop , proceeds game loop not waits mouse click move character moves place mouse clicked (in enter menu). i want wait in game loop mouse click walk. thought allegro_event_mouse_button_up job game loop catches mouse event mouse button down... both in enter menu , game loop there different allegro_event_queue s , event s. tried change allegro_mouse_state changes nothing. thanks in advance!

objective c - Finding Printers with bonjour in iOS -

i got requirement print pdf files directly app shared printers on local network (printers may or may not airprint enabled). got know bonjour , started working on it. according apple have standard service types printers like _printer._tcp. _ipp._tcp. _ipps._tcp. _pdl-datastream._tcp. i have richo printer on network , it's bonjour enabled. bonjour browser on mac can see richo printer advertised under _http._tcp . not under of above mentioned service types apple. along printer there many more shared machines under _http._tcp . problem how can know whether printer or other machine of them listed under _http._tcp . ? when browse programmatically using above 4 service types nothing comes understandable printer under _http._tcp . there way can printers available listed local network ? thanks.

Scala : Idiomatic way of removing set of suffixes (substrings) from a String -

i'm looking idiomatic way of stripping set of suffixes (substrings) string in scala. val inputstring = "abc@xyz.com" val suffixes = list("\"", "@xyz.com") basically, suffixes list loaded externally , hence not static. therefore cannot use approach of chaining stripsuffix methods (p.s. - i'll remove starting " using inputstring.stripprefix("\"") you used foldleft along .stripsuffix() function iterate on dynamic list of suffixes , strip them string one-by-one. val inputstring = "abc@xyz.com" val suffixes = list("\"", "@xyz.com") val strippedstring = suffixes.foldleft(inputstring) { (string, suffix ) => string.stripsuffix(suffix) } outputs: abc with approach order of suffixes impact output.

IBM Bluemix Apache Spark Resource Manager -

reading official documentation couldn't directly see resource manager(spark, mesos, yarn) or how apache spark managed service setup(it says can provision 30 executors no machine/cluster details). does know resource manager of ibm's spark service is? ibm bluemix spark service uses ego resource manager platform symphony in integrated environment. http://www.ibm.com/support/knowledgecenter/ssgsmk_7.1.0/management_sym/yarn_resource_management.html for now, users cannot opt select type of resource manager, since spark service managed service.

java - Hbase Kundera Table with namespace not working -

using kundera wanted create tables in given namespace example foo:bar where foo namespace & bar tablename this not happening below configuration here persistent unit <provider>com.impetus.kundera.kunderapersistence</provider> <properties> <property name="kundera.nodes" value="zookeeperip" /> <property name="kundera.port" value="2181" /> <property name="kundera.client.property" value="user.xml"/> <property name="kundera.keyspace" value="userprofile" /> <property name="kundera.dialect" value="hbase" /> <property name="kundera.ddl.auto.prepare" value="update" /> <property name="kundera.client.lookup.class" value="com.impetus.client.hbase.hbaseclientfactory" /> </properties> </persistence-unit...

git - Is there a way to squash a commits in already merged pull request? -

consider scenario: i working on local feature or defect branch created develop branch. then released changes multiple commits remote branch (as happens in pr review process). my pr approved team reviewing changes. forgot quash commits on remote , local branch , merged remote branch in develop branch. deleted local , remote branch. now realized merged changes in develop without doing squash. so there way me squash commits in develop branch after fact commits merged in develop branch ? option 1: squash commits on remote develop branch. option 2: since merged feature-branch before deleting it, should still have access commits. git revert on develop branch commit right before merge commit. checkout last commit did on feature-branch git checkout <commit reference> . run git rebase -i squash commits before merge feature-branch master .

java - Spring Batch , HSQLDB growing over the time -

i using spring batch monitor rabbit mq . trying stress stress running batch every second. running smoothly far used perm generation space keep on growing. when batch started 30 mb after 30 hours of running @ 300 mb . biggest object occupying memory org.hsqldb.persist.rowstoreavlmemory 28619232 org.hsqldb.database 96661000 this 2 object hold 32% of total memory . can please suggest how configure hsqldb not hold information more 5 mins old don't have requirement of job restarted. you using hsqldb default all-in-memory tables. data held in memory. type of table allows fast operation , ideal use-cases data not grow beyond limit. you can add task delete old rows periodically. can trigger declared on table grows, deletes old rows according timestamp after new row inserted. alternatively, can use cached tables, hold data on disk. can add ;hsqldb.default_table_type=cached end of jdbc connection url. in case url must indicate file-based database, not in-memory o...

R - write value into variable after two statements -

i have loop 2 if statements. works fine, except add values passing second if statement variable v1. assign variable first , variable gets filled lot of na's , 3 values expecting. want 3 values in variable. so instead of writing i fulfills requirements, every single i gets written variable. v1 <- c() for(i in seq_along(y$values)){ if(y$lengths[i] < 500 && y$values[i] == true){ y$values[i] <- false } if(y$lengths[i] > 500 && y$values[i] == true){ print(y$lengths[i]) v1[[i]] <- y$lengths[i] } } i had @ apply functions, couldn't figure out how use both if statements in apply. the data large logical vector. use y <- rle(vec) on vector, gives me y$lengths (everything between 1 , few hundred thousand) , y$values (true , false). the desired result rle lengths >500 , true true.: [1] 5120 [1] 16630 [1] 10188 which print command gives me fine. dput(y$length) gives me: c(129719l, 1l, 79337l, 2l, 4l, 1l, 3...

operating system - How to avoid zombie processes? and what exactly init process does in this situation? -

how avoid zombie processes? , init process in situation? i've seen program,but not able it: how program creates zombie process: #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int main(void) { pid_t p = fork(); if (p != 0) { waitpid(p, null, 0); /* see if child had ended. */ sleep(1); /* wait 1 seconds child end. , eat away sigchld in case if arrived. */ pause(); /* suspend main task. */ } else { sleep(3); /* let child live tme before becoming zombie. */ } return 0; } a child process turns zombie process when did exit parent process did not yet run waitpid , wait or waitid on it. in normal situation parent want know exit status on child process spawned , therefore woud run waitpid on pid got fork . what happens in code above: the child spawned , exits (leaves else clause , returns 0) the parent runs endless pause loop until pre...