Posts

Showing posts from February, 2015

Cleansing "\312" from file in emacs -

i'm emacs user, if can accomplish on command line acceptable. i've tried query-replace in emacs, emacs can't seem locate character(s) "\312", i've tried few permutations. how go cleansing these file? sample data below: 7/30/15 0:15,1781,4,zima blue , other stories ,2006,\312alastair reynolds 7/30/15 0:23,1782,5,zimmerman's algorithm ,2000,\312s. andrew swann 7/30/15 0:27,1783,1,"zimmermann telegram, ",1958,\312barbara w. tuchman 7/30/15 0:47,1784,2,"zinzin road, ",1966,\312fletcher knebel those not 4 characters: \312 . single character, represented octal digits 312 because emacs not display character otherwise. see emacs manual, node text display . you can use query-replace replace it. use c-q followed 312 insert in string replace. example: m-% c-q 312 ret ret ret the first ret ends inputting octal digits. second ret accepts string (with single character, \312 ) replace. third ret accepts empty string re

svn - Subversion: How to rerun post-commit scripts for all revisions? -

we have installed integration of our svn repository bug tracker. bug tracker called post-commit hook information tickets closed in commit. since have been using bug tracker lot of commits, rerun (on server?) post-commit hook commits in our repository. there convenient way? the bug tracker (fogbugz) not allow scanning. the svn repository on linux instance restricted tools (bash, perl). easy way, cost 1 additional repository , space create full dump of repository ( svnadmin dump ) create new empty repository needed post-commit hook defined load dump step 1 repository-skeleton ( svnadmin load ) --use-post-commit-hook option applying hook , --force-uuid (needed later) delete tree of original repo , copy loaded repository @ location of original (at same place , same uuid this repository old repository svn-clients without switch|relocate)

prolog - parsing an expression using DCG -

i try parse list of identifiers dcg fail it, example ::= | __|____ | | id id,'(',ids,')'. _|_ | | id id, - ids ::= id. ids ::= id(id1,id2,...). example of identifier verify exp1 = 'id_0' exp3 = 'id_1(i)' exp2 = 'id_2(i1,i2)' code edit id([id]) --> [id]. id([id|ids]) --> [id,'('], ids(ids), [')']. ids([id]) --> [id]. ids([id|ids]) --> [id], ids(ids). someone tell me problem ? let first see currently describing (for example) id//1 , using most general query: ?- phrase(id(is), ls). = ls, ls = [_g884] ; = [_g884|_g885], ls = [_g884, '(', ids(_g885), ')']. trying out general query way find out more relation. in

amazon web services - Unable to connect to recently launched PostgreSQL RDS instance -

i have rds instance i'm unable 'psql' (connect) to. i've confirmed following: vpc vpc5525e931 (10.0.0.0/16) subnets bbddfoe2, 96979cec (10.0.0.0/24) (10.0.1.0/24) pointing above vpc above security set rds-launch-wizard3, opened 5432 (same vpc above) i've tried connecting endpoint via hostname , ip address, both of fail w/the following error: psql: not connect server: operation timed out server running on host "x.x.x.x.x" , accepting tcp/ip connections on port 5432? any appreciated! also, thoughts on diagnosing further help. it's missed configuration somewhere.

ASP.NET Chart 2y axis distinct bar color -

i trying display 2 y axis values in asp.net chart. can display both of y axis expecting see can't seem separate them different colors. axisy title="loonies" - can see them. axisy2 title="toonies" - can see them. problem bars in column , in bar graph show same color. have been trying different things , searching google solutions hours stuck. appreciated. aspx code <asp:label id="lblcharttype" runat="server" text="select chart type" width="130"> </asp:label> <asp:dropdownlist id="ddlcharttype" runat="server" autopostback="true"> <asp:listitem text="line graph" value="line"></asp:listitem> <asp:listitem text="bar graph" value="bar"></asp:listitem> <asp:listitem text="column" value="column"></asp:listitem> </asp:dropd

c# - g.i.cs files missing, classes no longer contain a definition for InitializeComponent -

i've been developing uwp project in spare time hang of uwp, mvvm , prism. project classic, no use of mvvm , prism, , i've been working 2 project. i've been relying on https://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx , https://msdn.microsoft.com/en-us/library/gg405494(v=pandp.40).aspx , https://msdn.microsoft.com/en-us/library/ff921098(v=pandp.40).aspx work way through it. some background: had direct function call mainpage.xaml mainpage.xaml.cs codebehind, during conversion mvvm , separate usercontrol, removed function call later using command binding. after removed that, got error somewhere in gamerouletteview.g.i.cs remnant of removed function call, g.i.cs file assumed still bound. rebuilt project , g.i.cs files apparently got removed. i added following lines usercontrol view viewmodel gets added: xmlns:gameroulette="using:gameroulette.designviewmodels" xmlns:prism="using:prism.windows.mvvm" d:datacontext="{d:design

r - rselenium | get the text of the webpage -

is there way plain text remotedriver in rselenium? somethink like: remdr$getplaintext() equivalent remdr$getpagesource() . workarount: i managed save phantomjs's plaintext file follows: require(rselenium) pjs <- phantom() sys.sleep(5) # give binary moment remdr = remotedriver(browsername = 'phantomjs') remdr$open() remdr$phantomexecute('var page = this; var fs = require(\"fs\"); page.onloadfinished = function(status) { var txtfile = fs.open(\"url.txt\", \"w\"); txtfile.write(page.plaintext); txtfile.close(); };') remdr$navigate(some_url) but have read file in afterwords... my workaround done similar https://cran.r-project.org/web/packages/rselenium/vignettes/rselenium-headless.html#id3b i not sure whether if solves problem. library(rselenium) checkforserv

sql - Oracle 11g - Columns To Rows -

i have data coming system (format cannot changed) looking so: row, c001, c002, c003, c029 (columns fy values) 1, name, 0910, 1011 2, eqt1 (speed), 60, 100 3, eqt1 (cost), 20, 30 4, eqt2 (speed), 50, 60 5, eqt2 (cost), 30, 45 i need change : name, start_date, end_date, speed, cost eqt1, 01-apr-2009, 30-mar-2010, 60, 20 eqt1, 01-apr-2010, 30-mar-2011, 100, 30 eqt2, 01-apr-2009, 30-mar-2010, 50, 30 eqt2, 01-apr-2010, 30-mar-2011, 60, 45 i can split date using sub-select row = 1. can replace (speed) (cost) in name. can't right. survey_query ( select * tbl_data ) select (case when upper(sq.c001) '%fleet size%' trim(replace(upper(sq.c001), 'fleet size', '')) when upper(sq.c001) '%flying hours%' trim(replace(upper(sq.c001), 'flying hours', '')) end) equipment_name ,(select to_date(2000+dbms_lob.substr(c002,2,1)||&

JavaScript routine for calling a function every x seconds -

i have javascript want run every 5 seconds. display status of gpio pins on raspberry pi. right don't update if pin chages status script i'm running. tried put in var myvar = setinterval(function(){ change_pin() }, 1000); don't me.. the code looking this; //thefreeelectron 2015, http://www.instructables.com/member/thefreeelectron/ //javascript, uses pictures buttons, sends , receives values to/from rpi //these buttons var button_0 = document.getelementbyid("button_0"); var button_1 = document.getelementbyid("button_1"); var button_2 = document.getelementbyid("button_2"); var button_3 = document.getelementbyid("button_3"); var button_4 = document.getelementbyid("button_4"); var button_5 = document.getelementbyid("button_5"); var button_6 = document.getelementbyid("button_6"); var button_7 = document.getelementbyid("button_7"); //create array easy access later var buttons = [ button_0, bu

Add Up Values in a Map with Multiple Lists in Scala -

i have map in scala in each key maps value list of indeterminate lists. aka map's type [string,list[list[string]]] . need add third value (value3) of each list, in each map key. however, don't know how because each key has different number of lists in it's corresponding value. example: map(string -> list(list(value1, value2, value3, value4), list(value1, value2, value3, value4), list(value1, value2, value3, value4))) how go doing this? you need default value in case 1 of lists has fewer 3 elements. also, need define mean "add" since have strings. list or concatenate them in string. you want key map values. drop 2 items each list optional third (none if list has fewer 3 items, some(x) otherwise). since flatmap, list of "third items" , can concatenate them or else. val map = map("a" -> list(list("a", "b", "c", "d"), list("a", "b"), list("x", "y

c# - Turning a IP Address into a valid URI -

i have been trying navigate webview element in windows store app '192.168.0.1' reason uri class can not parse it, there way make convert ip address uri? the answer add prefix of ip's protocol: http:// or https:// , instance new uri("192.168.0.1") have new uri("http://192.168.0.1/") thanks bob kaufman

app icon is missing for iTunes app accelerator in Xcode Organizer (appcelerator) -

Image
when build titanium app in appcelerator, app icon missing organiser when build app store submission how can resolve thanks edit: in itunes connect, how appears after select build: icon missing. yes need have itunesartwork(512x512) , itunesartwork@2x(1024x1024) in folder resource->iphone-> here need have 2 files.

javascript - Three.js - How to determine if a point is on a line? -

Image
how find out if point (x,y,z) on line between pointa , pointb? what boolean function this: pointa // random three.vector3 pointb // random three.vector3 pointtocheck // random three.vector3 var isonline = three.pointonline(pointa, pointb, pointtocheck) if (isonline) { console.log('point on line'); } here image visualization: cross product of 2 vectors can solve problem. function ispointonline (pointa, pointb, pointtocheck) { var c = new three.vector3(); c.crossvectors(pointa.clone().sub(pointtocheck), pointb.clone().sub(pointtocheck)); return !c.length(); } three.ispointonlineandbetweenpoints = function (pointa, pointb, pointtocheck) { if (!ispointonline(pointa, pointb, pointtocheck)) { return false; } var dx = pointb.x - pointa.x; var dy = pointb.y - pointa.y; // if line more horizontal vertical: if (math.abs(dx) >= math.abs(dy)) { if (dx > 0) { return pointa.

java - Unable to start Spray with AspectJWeaver -

i trying set kamon on spray / akka service not getting far unfortunately. i use sbt-assembly plugin build single jar file run simple java -jar service.jar. i naively thought able weave service java -javaagent:aspectj-1.8.8.jar -jar service.jar : objc[13280]: class javalaunchhelper implemented in both /library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home/bin/java , /library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home/jre/lib/libinstrument.dylib. 1 of 2 used. 1 undefined. failed find premain-class manifest attribute in aspectj-1.8.8.jar error occurred during initialization of vm agent library failed init: instrument and of course, service doesn't start. (it works fine without aspectj. tried aspectj 1.7.4 , paths correct. any / pointer appreciated ! the solution because starting jvm aspectj , not aspectjweaver... !

laravel - Error handling from external request class -

in login system i'm creating in laravel (version 5.2), registration request passed on registrationrequest class, contains validation logic this: public function rules() { return [ "username" => "required|min:3|unique:users", "password" => "required|min:6|confirmed", "email" => "required|confirmed|email|unique:users", ]; } which passed on postregistration function: public function postregistration(registrationrequest $request) { $this->user->username = $request->input('username'); $this->user->mail = $request->input('email'); $this->user->password = password_hash($request->input('password'), password_default); $this->user->save(); $this->auth->login($this->user); return redirect('/dashboard'); } all kind of basic stuff, problem have have no idea how show error when usernam

javascript - Angularjs ui-select (select2) not working with 'Controller as' syntax not getting selected ite -

i'm trying select html control working angularjs ui-select located here on github. reason, able item selected when using $scope syntax, not when use controller syntax. plunker trying working controller syntax located here . i'm not sure missing since $scope syntax works perfectly. i'm not getting errors report. here snippet in plunker. controller var app = angular.module('demo', ['ngsanitize', 'ui.select']); app.controller("mainctrl", mainctrl); function mainctrl() { var controller = this; controller.person = {}; controller.people = [ { name: 'adam', email: 'adam@email.com', age: 10 }, { name: 'amalie', email: 'amalie@email.com', age: 12 }, { name: 'wladimir', email: 'wladimir@email.com', age: 30 }, { name: 'samantha', email: 'samantha@email.com', age: 31 }, { name: 'estefanía', email: 'estefanía@email.co

java - Mediaplayer stopped playing my sound - Android studio -

so trying onclick buttons... whenever user click butto go onclickbutton , , play sound .. button1 play mp1 button 2 play sound2 .... work fine when clicking lot on buttons after while sound stopped played .. code : public void onclick(view v) { final mediaplayer mp1 = mediaplayer.create(this, r.raw.sound1); final mediaplayer mp2 = mediaplayer.create(this, r.raw.sound2); final mediaplayer mp3 = mediaplayer.create(this, r.raw.sound3); final mediaplayer mp4 = mediaplayer.create(this, r.raw.sound4); textview mytv = (textview) findviewbyid(r.id.tvmytimer); int id = v.getid(); if (id == r.id.btcomp1 || id==r.id.btuser1) { mytv.settext("button 1"); mp1.start(); } if (id == r.id.btcomp2 || id==r.id.btuser2) { mytv.settext("button 2"); mp2.start(); } if (id == r.id.btcomp3 || id==r.id.btuser3) { mytv.settext("button 3"); mp3.start(); } if (i

sql - How to get the next number in a sequence -

i have table this: +----+-----------+------+-------+--+ | id | part | seq | model | | +----+-----------+------+-------+--+ | 1 | head | 0 | 3 | | | 2 | neck | 1 | 3 | | | 3 | shoulders | 2 | 29 | | | 4 | shoulders | 2 | 3 | | | 5 | stomach | 5 | 3 | | +----+-----------+------+-------+--+ how can insert record next seq after stomach model 3. here new table suppose like: +----+-----------+------+-------+--+ | id | part | seq | model | | +----+-----------+------+-------+--+ | 1 | head | 0 | 3 | | | 2 | neck | 1 | 3 | | | 3 | shoulders | 2 | 29 | | | 4 | shoulders | 2 | 3 | | | 5 | stomach | 5 | 3 | | | 6 | groin | 6 | 3 | | +----+-----------+------+-------+--+ is there way craft insert query give next number after highest seq model 3 only. also, looking concurrency safe. if not maintain counter table, there 2 options. within trans

admob - Creating custom advertisements on iOS -

i have app sold in high volume. want advertise new app in other app. there simple way bypass admob or iad , put custom advertisements in own application? admob offers in house ads . go admob.com click promote in tab bar click + promote new app in top left click new house ad campaign then, follow setup. can offer impression goal or ecpm-based ads apps or websites. if you're interested in ecpm-based ads, i'd suggest reading this question , answer .

while loop - simple calculation in java - let user know they have to use a valid operator -

i writing basic calculator program in java using joptionpane. new , problem having appreciated! have tried research online come across answers scanner imported or order of user input different mine. my program suppose ask users number, has them select operator use (+,-,*,/,%) , asks users second number. after this, calculation performed , result displayed. is possible use while loop (not while loop) check invalid operator before second number entered? have working code checks invalid operator after second number entered i'd find way check beforehand , re-ask users operator until valid 1 entered. while (!usecalculator) { num1 = joptionpane.showinputdialog(null, "please enter first number:"); numone = double.parsedouble(num1); input = joptionpane.showinputdialog(null, "thank you! do?\nplease choose following options:\n+\n-\n*\n%\n/"); num2 = joptionpane.showinputdialog(null, "thank you!\nplease enter second number:");

node.js - AWS micro instance has 95% + and Nodejs app is not accessible in the browser -

Image
the cpu usage consistently on 95% nodejs app. though nodejs app running, when try access in browser, not accessible @ all. i'm running on micro instance testing purposes. why happening , might solution this? t1.micro , t2 instances use burstable cpu model. while idle, build credits. when active use credits. once hit 0, instance throttled. you can confirm looking @ cpu credit usage , balance in cloudwatch. to fix, use larger instance, maybe t2.small.

opengl - Simulating constant Pixels-Per-Unit in game graphics at different "Zoom Levels" -

i'm trying lay down graphical style game environment working on. meshes rendered @ low resolution in isometric give "sprite-like" appearance. the issue keeping resolution have picked maintain correct pixels-per-unit in game. example, here cube rendered top face equal of 64 32px isometric tile: lets zoom level x1 now in engine unity, can play around screen size , cameras zoom in or out easily. keep original rendering resolution, can think of forcing player fullscreen, changing screen-resolution, , allowing scene scale accordingly. so zoom in, cut resolution in half bring cube twice close screen. intended outcome: zoom level x2 (scaled in image editor). the top face of cube appears still 64 32px though takes 128 64px on screen. i want know if effect can simulated writing own shader , having parameter 'zoom level' (x1, x2, x4, x8). way don't have play magic tricks fullscreen resolution, , can let screen size independent of "render resolution

android - Stopping logcat using batch file -

@for /f "delims=|" %%f in ('dir /b "c:\users\user\desktop\apks\"*.apk') ( adb install "c:\users\user\desktop\apks\%%f" adb logcat > "c:\users\user\desktop\parser\logstoparse\%%f.txt" ) so, right need run bunch of aps , log each of them. problem loop run once , stop log first app, keep going rest of ones after installing them well. any idea how i'd terminate it? know adb logcat -d works opening logcat , seeing whats going on millisecond, problem need open 5 minutes , automated. so far i've tried: sending null or bad request after x amount of time, sleeping, breaking, etc. the thing seems work sending terminal ctrl+c command manually. there way manually after 5 minutes of logging using logcat? thanks. after install apk, wait 5 minutes in batch,then use adb logcat -d. "wait" in batch, can use timeout or ping command, this: ping 1.1 -n 1 -w 3000>nul timeout /t 3 full script: @for /f &qu

Iterating nested json in python -

i have json in format. how can print each value , go inside objects. also, json can vary , name, need generic solution. output = {'name':'stackoverflow', 'competitors':[{ 'competitor':'bing', 'link':'bing.com'}, { 'competitor':'google', 'link':'google.com'}], 'acquisition': {'acquired_day': 16, 'acquired_month': 12, 'acquired_year': 2013, 'acquiring_company': {'name': 'viggle', 'permalink': 'viggle'}}} you can use isinstance check if dict or list. may work, haven't checked it. output = {'name': 'stackoverflow', 'competitors': [{'competitor': 'bing',

server - How to host java app for a domain homepage -

i have application developed in java , located in host http://myhost.com:8080/myapp . using bluehost hosing service. i want access app when hitting http://myhost.com .. i went lot of articles in confused lot. there no clear documentations this. how this? can assist me? use apache server proxy server use server name ( http://myhost.com ) , redirect request running app url ( http://myhost.com:8080/myapp ). ie port forwarding concept. like, use following in apache configuration file. <virtualhost *:80> proxypreservehost on proxyrequests off servername www.myhost.com serveralias myhost.com proxypass / http://myhost.com:8080/myapp/ proxypassreverse / http://myhost.com:8080/myapp/ </virtualhost> to acheive need configure many things.so read appropriate documentation.

ios - Swift - Printing out the current value of a number -

i'm developing counter app every time press button count up. have done , works 100%, i'm trying make button , when press it, shows current number on console prints out 0 because that's default variable assigned value to. my whole class: var counternumber = 0 @iboutlet weak var counterlabel: uilabel! func initcount(){ counternumber = 0 } func numberup(){ self.counternumber++; counterlabel.text = "\(self.counternumber)" } @ibaction func countup(sender: uibutton) { numberup() } @ibaction func restartbutton(sender: uibutton) { initcount() } @ibaction func printbutton(sender: uibutton) { self.numberup(); print(self.counternumber) } override func viewdidload() { super.viewdidload() initcount() } override func didreceivememorywarning() { super.didreceivememorywarning() } } just call method numberup in printbutton: action. var counternumber = 0//this variable of class @iboutlet weak var counterlabel

Scope/Group/Role/Permissions database architecture -

i'm building internal web app , struggling db design theory. i've got roles & permissions set laravel & entrust, i'm trying add functionality of scopes , groups , i'm not quite sure how achieve it. given following scopes : company team and these roles : admin editor author and these groups (teams): sales development design i've added scopes functionality works great, can have permission assigned admin in company scope, want able assign permissions admins in team scope according team belong to. the application quite expansive, keep simple here i'll focus on couple of use cases need satisfy: team , employee profiles. team profiles all employees can view team profiles a company admin can edit team profiles a team admin can edit own team profile employee profiles all employees can view employee profiles a company admin can edit employee profiles a team admin can edit employee profiles within own team an employ

system - Acumatica - Error while inserting/Editing Sales Orders with Items with \ char as part of the InventoryID -

i facing issue while inserting sales orders acumatica via api items has \ char part of inventoryid. if try insert inventoryid \adjustment, api returns following error: px.data.pxfieldprocessingexception: error: error occurred while processing field inventory id : error: 'inventory id' cannot found in system.. ---> px.data.pxsetpropertyexception: error: 'inventoryid' cannot found in system however, item exist in database. any suggestions of how fix issue? thanks, jose "\" escape char in c#. wager bet it's trying treat that. try replacing "\" "\\" , see if works. you try specifying literal @ - @"my\id" seeing how submitted server processing, i'd try escape first as side note though, recommend removing odd chars id's.

c++ - std::experimental::generator write access violation -

i running code on visual studio 2015 update 1 , getting weird access violation error @ place denoted below. if simplify expression int mid = (max - min) / 2; code works fine. #include <experimental/generator> std::experimental::generator<int> range(int min, int max) { int mid = min + (max - min) / 2; // write access violation yield mid; } int main() { (auto x : range(10, 20)) { } } does know might problem? suspecting might compiler bug. this confirmed bug in visual studio 2015 update 1: https://connect.microsoft.com/visualstudio/feedback/details/2337518/std-experimental-generator-write-access-violation it reportedly fixed in update 2

grouping and summing up dummy vars from caret R -

i have data this dataset = data.frame(id = c(1,2,1,4,5,6), class = c('a', 'a', 'b', 'a', 'b', 'b') ) i want convert dummy vars caret's dummy vars doesn't collapse id returns same number of rows input. how group id 1 has both , b variables 1? dummies <- caret::dummyvars(id ~ . , data=dataset) predict(dummies, newdata = dataset) in case use dcast function data.table: library(data.table) setdt(dataset) dataset[,dummy:=1] d2 = dcast(dataset,id~class,value.var = 'dummy',fun.aggregate = length) d2[is.na(d2)] = 0 note solution return number of a's , b's found each id. if need 1 or 0 change example fun.aggregate fun.aggregate = function(x) as.integer(length(x) >0) dummyvars works row wise , doesn't matter value in id

sqlplus - Oracle truncating column -

i have following query. insert order_info(ordinf_pk,ordinf_lgndet_pk_fk,media_type,ordinf_music_fk,dat) values (1,1,'music',21,to_date('14-oct-2015','dd-mon-yyyy')); insert order_info(ordinf_pk,ordinf_lgndet_pk_fk,media_type,ordinf_music_fk,ordinf_series_fk,dat) values (2,2,'series',71,23,to_date('07-nov-2015','dd-mon-yyyy')); however when do: select * order_info; i get: truncating (as requested) before column ordinf_series_fk truncating (as requested) before column ordinf_movies_fk ordinf_pk ordinf_lgndet_pk_fk media_type ordinf_music_fk dat ---------- ------------------- -------------------- --------------- --------- 1 1 music 21 14-nov-14 2 2 series 71 07-nov-15 i understand truncating ordinf_movies_fk because there no entry in column, why truncating column ordinf_series_fk? pay attent

android - How to get Image's string value(or an Image reference) from a ImageView -

i have assigned textview , imageview below, text = (textview) findviewbyid(r.id.textview01); image = (imageview) findviewbyid(r.id.imageview01); now values change dynamically in program (image changed online url), , @ end need store values in db future use. here text value as string textvalue = text.gettext().tostring(); but how store value imageview? string imagevalue = image.somefunctionthatreturnsimagereferenceinstring(); is there such functions?? or how this.. pls help you need convert image-view base64 string below. 1]convert imageview bitmap. imageview.builddrawingcache(); bitmap bmap = imageview.getdrawingcache(); 2]bitmap base64 string. public string getencoded64imagestringfrombitmap(bitmap bitmap) { bytearrayoutputstream stream = new bytearrayoutputstream(); bitmap.compress(compressformat.jpeg, 70, stream); byte[] byteformat = stream.tobytearray(); // base 64 string string imgstring = base64.encodetostring(byt

ios - swift Autolayout 3 button set horizontally width manage according to text -

i have set button in 1 child view max button 3 , minimum 0 try set horizontally button take equal width , try set left aligned , depend on button text width , , 1 more problem if 1 button missing mean if button array count 2 , 1 not show 1 , please give me solution here code let button1 = uibutton() let button2 = uibutton() let button3 = uibutton() print(getchannelname) var = 0; < getchannelname.count; i++ { if(i == 0) { button1.translatesautoresizingmaskintoconstraints = false button1.backgroundcolor = uicolor.greencolor(); button1.tintcolor = uicolor.blackcolor() button1.titlelabel?.textcolor = uicolor.blackcolor() button1.settitle("#\(getchannelname[i])" , forstate: uicontrolstate.normal) button1.titlelabel!.font = uifont(name: "arial", siz

Passing $ in jQuery function. What's the use of $ sign? -

this question has answer here: jquery dollar sign ($) function argument? 4 answers as title says, kindly explain use of $ sign in functoin. using code smooth scroll id in wordpress. when remove $ sign, code not work. have pass $ in function. kindly refer image. note: code works without passing $ in function when using in html website not work in wordpress. well, nothing worry if 1 explain? below code: $(document).ready(function($){ $('.scroll').on('click',function (e) { e.preventdefault(); var target = this.hash; var $target = $(target); $('html, body').stop().animate({ 'scrolltop': $target.offset().top }, 900, 'swing', function () { window.location.hash = target; }); }); }); the $ name of variable. equivalant jquery variable. a

c# - Handle Multiple action with same name in MVC -

in project there action public actionresult lead(int leadid) { return view(); } and in view actionlink created this @html.actionlink("old link", "lead", "home", new { leadid = 7 }, null) but after time, make clean url, have changed name of parameter of action public actionresult lead(int id) { return view(); } and actionlink change accordingly @html.actionlink("new link", "lead", "home", new { id = 5 }, null) but old link shared in multiple social network sites. whenever clicks on old link, redirect page www.xyx.com/home/lead?leadid=7 but in application, no such url exists. to handle problem, thinking of overloading, mvc action doesn't support overloading. i have created action same name parameter, , redirect new action, doesn't work. public actionresult lead(int leadid, int extra=0) { return redirecttoaction("lead", "home", new { id = leadid }); } i have

mongodb query for results -

[ { "userid": "abcde", "dates": { "2-01-2015": { "9-10": { "ava": "yes", "bookibg_id": "null" }, "10-11": { "ava": "yes", "bookibg_id": "null" } }, "3-01-2015": { "9-10": { "ava": "no", "bookibg_id": "null" }, "10-11": { "ava": "no", "bookibg_id": "null" } } } }, { "userid": "abcde", "dates": { "2-01-2015"

c# - OpenFileDialog is not opening the file -

Image
i have bound openfiledialog control button. on button event, calling openfiledialog control. now, when running application, openfiledialog box gets open not select file. open button not working. example code: private void button1_click(object sender, eventargs e) { openfiledialog1.showdialog(); } private void openfiledialog1_fileok_1(object sender, canceleventargs e) { // logic written here } it working fine earlier not working. you need use dialogresult event of open confirmation user. can use stream read file. here sample code (provided ms in msdn - source: https://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog(v=vs.110).aspx ): private void button1_click(object sender, system.eventargs e) { stream mystream = null; openfiledialog openfiledialog1 = new openfiledialog(); openfiledialog1.initialdirectory = "c:\\" ; openfiledialog1.filter = "txt files (*.txt)|*.txt|all

html - Open New Tab Link Facebook From Localhost When Button Onclick -

Image
i have button link in web app. run localhost. source code this, , think (no error): <a href="facebook.com" style="text-decoration:none;" target="_blank"><input type="button" value="pembuatan akun facebook" class="tombol" style="width:200px !important;"></a> what want, when click button, browser open new tab, , connect facebook page. get, link url: http://localhost/dewata/facebook.com (my web app in folder dewata). not facebook.com. any idea happens? you need full href protocol external links, otherwise browser expect file named 'facebook.com' on site. <a href="http://facebook.com">...

javascript - Scroll Automation Wont Stop on Last Link -

i have javascript function that's not quite working properly. works brilliantly links except last. when link triggered scrolls bottom , doesn't allow scroll up...despite best efforts. maybe approach wrong. here markup: <nav> <ul> <li> <a id="home" href="#" onclick="return false">home</a> </li> <li> <a id="services" href="#" onclick="return false">services</a> </li> <li> <a id="portfoliolink" href="#" onclick="return false">portfolio</a> </li> <li> <a id="contactlink" href="#" onclick="return false">contact</a> </li> </ul> </nav> and javascript: function smoothscroll(){ if (window.addeventlistener){ document.getelementbyid('

javascript - Facebook Share dialog without a link -

it possible show facebook share dialog (with javascript) without including link. share dynamic created image current users wall. i know can post image through fb.api following, done in dialog instead. var wallpost = { url: 'http://www.mypagethatgeneratestheurl.aspx', }; fb.api('/me/photos', 'post', wallpost , function(response) { if (!response || response.error) { debugger; alert('error occured'); } else { alert('post id: ' + response); } }); no, there feed dialog (with custom link , picture) , share dialog (with link , rest comes og tags). "sharing" links only, can´t "share" picture, have upload it. , possible api call posted.

How to pass a list to clojure's `->` macro? -

i'm trying find way thread value through list of functions. firstly, had usual ring-based code: (defn make-handler [routes] (-> routes (wrap-json-body) (wrap-cors) ;; , on )) but not optimal wanted write test check routes wrapped wrap-cors. decided extract wrappers def. code became follows: (def middleware (list ('wrap-json-body) ('wrap-cors) ;; , on )) (defn make-handler [routes] (-> routes middleware)) this apparently doesn't work , not supposed -> macro doesn't take list second argument. tried use apply function resolve that: (defn make-handler [routes] (apply -> routes middleware)) which bailed out with: compilerexception java.lang.runtimeexception: can't take value of macro: #'clojure.core/-> so question arises: how 1 pass list of values -> macro (or, say, other macro) 1 apply function? you can make macro that: ;; notice better use quote

ios - Evaluation (NSIntegers) inside if-statement Objective-C -

i in doubt, why work correctly: nsinteger row = indexpath.row; nsinteger preloadtrigger = self.nodes.count - 20; if (row >= preloadtrigger) { [self.loader loadnextposts]; } and not (just skips if-statement): if (indexpath.row >= self.nodes.count - 20) { [self.loader loadnextposts]; } when value of self.nodes.count - 20 negative. however, when value of expression positive, works fine always. a strange behavior, cannot see semantic difference in 2 expressions. update: so, decided test it: (lldb) po self.nodes.count - 20 18446744073709551601 (lldb) po preloadtrigger -15 according apple docs , count property nsuinteger in objective-c. when write : nsinteger preloadtrigger = self.nodes.count - 20; in fact casting count nsinteger object, , can have negative value if count isn't greater 20. but when write : (indexpath.row >= self.nodes.count - 20) count nsuinteger object, , subtract 20 lead positive number (a huge 1 way).

c# - URL Parameters in MVCReportViewer -

as know, in sql server reporting service (ssrs), can pass parameters url ( url access syntax ) , can provide data source credentials in url including dsu:datasourcename=value & dsp:datasourcename=value ( setting data source credentials in url ). now, want open report in web application dynamic data source credencial. i'm using mvcreportviewer , when set mvcreportviewerfluent:reportserverurl parameter http://servername/reportserver/?dsu:myds=user&dsp:myds=password , blank page in iframe. when remove "/?dsu:myds=user&dsp:myds=password" , report work correctly , ask user name , password inside report. going wrong? edit: codes added controller code : public actionresult index() { var model = new { username = "user", password = "pass", reportpath = "/myreportpath", serverurl = "http://serveraddress/reportserver/?dsu:ddst=pdm&dsp:ddst=pdm", parameters = null,

c++ - How to create QSplitter ui class via qt designer? -

i new qt , need implement monitoring interface following considerations: i have main window, on should put multiple screens, qsplitter appears best solution. the interface provides user option of changing number of cameras, qsplitter should created/re-created during run time. the problem have many cameras pre-define widgets them, need create qsplitter ui instances dynamically. problem can't find qsplitter classes when using qt designer , creating qsplitter class programatically not working mainwindow has been created through qt designer (.ui). hear suggestions regarding issue, if there better approaches, please let me know. qsplitter isn't strict ui element, it's parent element controls child elements. if want through designer you'd run headaches, basic gist select number of widgets controlled it, , click layout horizontally/vertically in splitter button in layout buttons group. what might best doing creating child elements programmaticall

Basics: How does a neural network work? (Decision) -

first of all: know there similar questions this. wanna know plain basics. somehow miss important. let's assume have data (x,y) -> z z can 0 or 1 , x,y in [0,1]. wanna train neural network data , desired output should boundary or line or curved line in x,y space splits zeros ones (e.g. male/female or whatever). so, wanna have 1 hidden layer. guess somehow understand how feed network: feed x = (x,y) first layer do computation weights , bias atc. compute error or loss function train network e.g. gradiant descent (i.e. updating weights, etc) yeah, comes problem :d what output in end? given data set network tries reproduce z values given x,y, right? so, how fit or decision boundary or whatever? stuff 1 "plots" in end in x,y space? how generate "new data" network, or not possible? so, main question is: output? , how handle output? , steps logistic regression plot in end (that can found everywhere in internet, not plot in end :d) i not it:

bash - To find latest entry for a particular record in the unix file -

i have file has multiple entries single record. example: abc~20160120~120 abc~20160125~150 xyz~20160201~100 abc~20160205~200 xyz~20160202~90 pqr~20160102~250 the first column record name, second column date , third column entry particular date. now want display in file latest entry particular record. how output should like abc~20160205~200 xyz~20160202~90 pqr~20160102~250 can shell script same? keeping in mind have many records needs sorted first according record name , taking out latest 1 each record according date. sort lines record name , date reversed, use -u unique flag of sort output first entry each record: sort -t~ -k1,2r < input-file | sort -t~ -k1,1 -u

css - Which selector will apply for HTML tag -

this question has answer here: css specificity - how “it” decide styles apply? 3 answers <style> .divnav { font-size:25px; } #divnav { font-size:25px; } </style> <div class="divnav" id="divnav"> both id , class have same style. which apply? , reason? it apply id style. because id have high specificity . check: #divnav { font-size:25px; } .divnav { font-size:15px; } <div class="divnav" id="divnav">test</div> and: .divnav { font-size:15px; } #divnav { font-size:25px; } <div class="divnav" id="divnav">test</div>

vba - How to control the interlinked comboBoxes output? -

i have 2 combobox es in userform . the first combox - combobox1 updated items userform initialized, below. private sub userform_initialize() combobox1 .additem "a" .additem "b" end end sub now once value of comboxbox1 selected, updates second combobox - combobox2 , below - private sub combobox1_change() combobox2 .clear .additem "p" .additem "q" .additem "r" end end sub and combobox2 on change displays current value - private sub combobox2_change() msgbox combobox2.value end sub now when select value combobox1 first time, combobox2 updated , further on selecting value combbox2 , popup message combobox2 value --- this fine . now again select different value combobox1 , time blank popup message, (because cleared combobox2 content). how can handle this, don't want msgbox popup on changing combobox1 , want popup on manually selecting

javascript - AngularJS ignore require if controller not found in directive -

i have directive using require attribute value : '^myctrl' is there anyway can catch error thrown if 'myctrl' isn't found anywhere ? not sure catching error, can make optional , avoid altogether: require: '?^myctrl'

android - set image button background dynamically -

i have defined array of imagebutton dynamically , take buttons background user selected photos, problem when restart app, image buttons not stay, how can make stay "along user selected background it" without define in xml? think of shared preferences not sure if solve problem! icon[count]= new imagebutton(this); icon[count].setimageresource(r.drawable.p1); icon[count].setimagebitmap(photo); to save background color have applied , shared preferences perfect solution. you need save state of background color , retrieve when restarting app(onrestart()) or onpause() or onresume(). how can make stay "along user selected background it" without define in xml? using shared preferences checkout android shared preferences example

VBA: Refresh an Excel page linked with Nielsen -

i discovered vba on excel , wondering if (and how) refresh automatically excel page linked nielsen base vba code. i have succesfully created such vba code excel document linked vba base, ran out of ideas that. have ideas? thanks helping! your sincerely, laurent you should ask companies nielsen contact nitro components reference guide document. has examples , code on this. code in vb have translate vba (minor differences). dim acnnitro new acnnitro dim acnnitroupdate acnielsennitro.acnnitroupdate dim ws worksheet dim bret boolean acnnitro.parentapp = application acnnitroupdate = acnnitro.acnnitroupdate ws = activesheet 'or set ws = worksheets("my sheet") bret = acnnitroupdate.updateallnranges(ws, ntrselectget) acnnitro = nothing acnnitroupdate = nothing wb = nothing

javascript - Drag-and-drop file uploading without AJAX, synchronously in the foreground? -

i have web site regular <input type="file"> file upload, posting data backend when form submitted. i progressively enhance form can drop file outside browser anywhere in viewport (not on file input field, built browsers) upload it. whether or not form autosubmits isn't important. if drag-and-drop selects file in file field, without starting upload, that's fine. don't need support multiple files. don't need show upload progress, thumbnails or fancy. i know there js libs support drag-and-drop uploads, seem upload via ajax. that, need modify backend , frontend handle upload errors, redirect , show right messages on success , on. i want progressive enhancement doesn't require backend changes. should happen synchronously using form in page. js fine, long upload happens "in foreground". synchronous ajax not work, of course. although not "synchronous" (javascript execution won't halt), can set files selected <