Posts

Showing posts from May, 2011

php - Assigning abilities in Laravel 5.1 Authorization -

recently upgraded laravel 5.1 , have read new features authorization . using entrust before decided use using basic permission/abilities anyway. doc explains how define , check abilities didn't find line attach ability user. guessing these abilities should saved , pulled db, not sure how attach these. unfortunately authorization service doesn't assign abilities/permissions coming database. docs seem mislead in direction. you can opt package deal part, such https://github.com/spatie/laravel-permission

laravel - Request Data to Model Function -

i'm trying find out why when dd($request->all()) in store method of controller correct, when send model function register() no seen. i'm not quite sure i'm doing wrong. <?php namespace app\http\controllers; use app\user; use illuminate\http\request; use app\http\requests; use app\http\controllers\controller; class userscontroller extends controller { public function store(request $request, user $user) { $this->authorize('delete', $user); $this->validate($request, [ 'firstname' => 'required|min:3', 'lastname' => 'required|min:3', 'displayname' => 'required|min:3', 'emailaddress' => 'required|email|unique:users,email', 'password' => 'required|min:3', 'role' => 'required|exists:roles,id' ]); $userregistered = $user-...

java - The udp server throws OOM exception when feed data in a high rate -

in order recieve maximum 64kb of data , reduce packets loss, config udp server following netty 4.0 public class udpserver { public void run() throws exception { eventloopgroup group = new nioeventloopgroup(); try { bootstrap b = new bootstrap(); b.group( group ).channel( niodatagramchannel.class ).option( channeloption.so_broadcast, true ) .option( channeloption.udp_receive_packet_size, 1024 * 64 ) .option( channeloption.so_rcvbuf, 1024 * 1024 * 100 ).handler( new userhandler() ); b.bind( 5141 ).sync().channel().closefuture().await(); } { group.shutdowngracefully(); } } public static void main( string[] args ) throws exception { new udpserver().run(); } } when feed data in 20kmsg/s udp sercer, throws oom exception. found cause config param udp_receive_packet_size larger direct buffer memory ran out quickly. if set 102...

Redirecting merge of single file in git -

is possible explicitly tell git during merge file has been renamed or moved? the background have done refactoring class has been generalized instead of having 1 class called "myclass", have 2 classes "myclassbase" , "myclass". logic in "myclass" has been moved "myclassbase" virtual method has been added "myclass" implements. "myclassbase" , "myclass" reside in separate files ("myclassbase.cs" , "myclass.cs"), , classes in respective files. now problem when merge, lot of conflicts in "myclass.cs" there has been changes in class on master. if somehow able tell git changes file "myclass.cs" on master should merged file "myclassbase.cs", merging trivial. since commit has been done already, can add dummy commit (add empty line or comment line explaining change) explaining commit message tell in details change. correct way such thing next time h...

php - Cannot search string in elastic search after adding synonym -

i have implemented synonym in elasticsearch facing problem. whole string splited on whitespace , can not search "see result option". here settings. $indexsettings['analysis']['analyzer'] = array( 'std' => array( // allow query 'shoes' match better 'shoe' stemmed version 'tokenizer' => 'standard', 'char_filter' => 'html_strip', // strip html tags 'filter' => array('standard', 'elision', 'asciifolding', 'lowercase', 'stop', 'length'), ), 'keyword' => array( 'tokenizer' => 'keyword', 'filter' => array('asciifolding', 'lowercase'), ), 'keyword_prefix' => array( 'tokenizer' => 'keyword', ...

python - Negative infinity and negative zero in numpy -

this more of general understanding question a = np.array([-0, 5, 0]).astype(float) b = 1 / print b returns [ inf 0.2 inf] but a = np.array([-0.0, 5, 0]) b = 1 / print b returns [-inf 0.2 inf] i expected first 1 return -inf first element well, why doesn't it? integers on machines have no concept of negative zero, -0 0 . since build array integers before cast float, [0.0, 5, 0.0] . in [2]: np.array([-0, 5, 0]).astype(float) out[2]: array([ 0., 5., 0.])

html - Vertical scrollbar appearing involuntarily -

vertical scrollbar appearing in page. have no iea causing it. i've tried adding display: block , display: block-inline children did not work. had set these width weird % values seem stop working anyway. <!doctype html> <html> <head> <title>code together</title> <!--reference css--> <link href="/styles/frontpage.css" rel="stylesheet" type="text/css" /> <!--reference jquery library--> <script src="/scripts/jquery-2.2.1.js"></script> <!--reference signalr library. --> <script src="scripts/jquery.signalr-2.1.2.min.js"></script> <!--reference autogenerated signalr hub script. --> <script src="/signalr/hubs"></script> <!--reference ace--> <!--<script src="~/scripts/roomfunctions.js" type="text/javascript" charset="utf-8"></script>...

node.js - stormpath express-session logout not deleting session -

i'm using stormpath-express along express-session in express application. login part works fine. however, when log out, previous session property still there in session. can see session property connect.sid remain same i invoked /logout <button class="btn btn-default btn-default navbar-btn" onclick="$.post('/logout', function(data) {location.href='/'})"> it's ajax post call /logout. per stormpath documentation, session destroyed. however, when login different user, previous session cookies still there. var session = require('express-session'); app.use(session({ genid: function(req) { return uuid.v1(); }, secret: 'xxxxx', resave: false, saveuninitialized: false })); after logout, previous session property still there var sess = req.session; if(sess.phonenumbers) { console.log('reuse phonenumbers session'); // why still here??? ...

javascript - Jquery result display issue -

i trying create bmi calculator , tried following . $(document).ready(function() { // convert ft inches function convertheight(ft) { return ft * 12; } // calculate total height function showbmi() { var weight = document.getelementbyid('weight').value * 1; var height_ft = document.getelementbyid('height_ft').value * 1; var height_in = document.getelementbyid('height_in').value * 1; var height = convertheight(height_ft) + height_in; var female_h = (height * height) / 30; var male_h = (height * height) / 28; var gender; var x = document.getelementsbyname("gender"); (var = 0; < x.length; i++) { if (x[i].checked == true) { gender = x[i].value; break; } } var bmi = "?"; if (gender == "female") { bmi = (math.round((weight * 703) / (height * height))); if (isnan(bmi)) bmi = "?"; } else { bmi = (math.rou...

c++ - qt5.5 doesn't show system tray -

Image
here similar problem , can't answer it. i try official example , see following screenshot(in shot, qt app system tray doesn't exist) how make system tray show? here cmakelists.txt cmake_minimum_required(version 3.3) project(systray) set(cmake_cxx_flags "${cmake_cxx_flags} -std=c++11") set(cmake_include_current_dir on) set(cmake_automoc on) set(cmake_autorcc on) set(qt5widgets_dir /home/roroco/qt/5.5/gcc_64/lib/cmake/qt5widgets) set(qt5gui_dir /home/roroco/qt/5.5/gcc_64/lib/cmake/qt5gui) find_package(qt5widgets) add_executable(main main.cpp window.cpp systray.qrc) target_link_libraries(main qt5::widgets) my linux version(desktop environment xfce) roroco@roroco ~/pictures $ lsb_release -a no lsb modules available. distributor id: linuxmint description: linux mint 17.2 rafaela release: 17.2 codename: rafaela i solution this then under 'session & startup' created new autostart entry following command: bash -c...

ssl - Reusing certificates -

i have website (public facing) , message queue (internal only) on same server. traffic both on ssl. there reason why not use same certificate run both site , mq? there might restrictions dns names used in certificates. public website uses certificate cn=somedomain.org internal mq have certificate cn=myinternalserver.local. according ca browser forum publicly trusted ca (that distributed browsers default) can not issue certificate on dns name. another reason don't want reveal mq service world , therefore issue 2 different certificates. has advantage. if private key websites uses stolen (like in heartbleed attack if remember correctly) have revoke , make new certificate (and private key) website. mq unaffected because not public. but imho in general can reuse same certificate if can secure private key (i.e. stored in hsm).

c++ - What make upcasting and downcasting illegal -

during lecture student said upcasting , downcasting lacks logic , illegal. how teacher got confused , agreed , said review , lecture again dont know wrong code , there scenario illegal. #include <iostream> using namespace std; class base { public: int a,b; base(){ a=0; b=1;} }; class derived : public base { public: int c,d; derived(){ c=2; d=3; } }; int main(){ derived der; base baseob; derived *derptr=new derived; derptr=(derived*)&baseob; base *baseptr=new base; baseptr=&der; } edited: scratch above code working on pointed out memory leak occurring(stupid of me not see that) here new code want know legal or not? (dynamic cast taught after no examples of dynamic cast please) #include <iostream> using namespace std; class employee { public: employee(string fname, string lname, double sal) { firstname = fname; lastname = lname; salary = sal; } string firstname; string la...

No email received when sending email from gmail using PHP Mailer -

below php mailer code use send email gmail mail server. require 'phpmailerautoload.php'; $mail = new phpmailer; $mail->smtpdebug = 1; $mail->issmtp(); $mail->host = 'smtp.gmail.com'; $mail->smtpauth = true; $mail->username = 'distechktn@gmail.com'; $mail->password = 'mypassword'; $mail->smtpsecure = 'tls'; $mail->port = 587; $mail->from = 'distechktn@gmail.com'; $mail->fromname = 'server'; $mail->addaddress('amalina@distech.com.my'); $body = "test server <br>"; $body = "thank you"; $mail->subject = 'test'; $mail->body = $body; $mail->ishtml(true); if(!$mail->send()) { echo 'message not sent.'; ...

node.js - Filter multiple arrays with $redact -

i m trying make mongodb request fill filters first on list , on list. explanations i have following objects in database : { "_id": objectid("..."), "title": "mysuperproject", "files": [ { "title":"my skiing day !", "right":[{ "role":"user", "access":["read"] }] }, { "title":"my little dog, cute !", "right":[{ "role":"other", "access":["read"] }] } ], "people": [ { "username":"borat", "role":"otherone", "right":[{ "role":"user", "access":["read"] }] }, { "username":"thomas", "role":"other", ...

html - Using the object operator in PHP -

i looked @ post try , understand object operator better: where use object operator "->" in php? but when copied , pasted php in 2nd response, blank page when run it. here code: php: <?php class simpleclass { // property declaration public $var = 'a default value'; // method declaration public function displayvar() { echo $this->var; } } $a = new simpleclass(); echo $a->var; $a->displayvar(); ?> html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <form action ="process.php" method ="post"> first name: <input type="text" name="fname"> <input type="submit"> </form> <p> click objectoperator.php <b...

C# Selenium - write an own click() method -

i wanna write own click() method , override different types. problem don´t know datatypes of: id xpath name value normally write: driver.findelement(by.id("gui-id").click(); and want method this: click("gui-id"); who can me...? by.something by object. can send method this public void click(by by) { driver.findelement(by).click(); } and call this click(by.id("gui-id")); click(by.name("gui-name")); // etc

Get the private ip address at a specific ethernet port in PHP -

i have php coe running on server. want ip address of local system. question has been asked before - php how local ip of system when use of solutions mentioned in above post, can hostname, not ip address. e.g. on machine have eth0:10.0.2.15 eth1:192.168.1.115 when run following code: $localip = gethostbyname(gethostname()); i hostname - localvm . want 192.168.1.115 can private ip address? more can ip address @ specific port? you ip address of specific network port in linux like: function getinterfaceip($interface = 'eth0') { $interfacecommand = "/sbin/ifconfig " . $interface . " | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1 }'"; $output = exec($interfacecommand); return $output; } echo getinterfaceip('eth0'); note command syntax may differ os os. example works linux. php doesn't have built-in classes this. you may want add command - getting list of network interfaces...

android - How to Handle SSL certification validation in proper way? -

hello application live , using "https" protocol. google play team throws warning below. "your app(s) listed @ end of email use unsafe implementation of interface x509trustmanager. specifically, implementation ignores ssl certificate validation errors when establishing https connection remote host, thereby making app vulnerable man-in-the-middle attacks. attacker read transmitted data (such login credentials) , change data transmitted on https connection. if have more 20 affected apps in account, please check developer console full list. to handle ssl certificate validation, change code in checkservertrusted method of custom x509trustmanager interface raise either certificateexception or illegalargumentexception whenever certificate presented server not meet expectations. google play block publishing of new apps or updates containing unsafe implementation of interface x509trustmanager." in project using custom http client...

css - Change the width and height of a pseudo element with content -

i insert icon way .me-icon-supericon:before { content: "\67"; } and i'm trying make bigger. tried make (display:inline-block) doesn't work. any advice? if you're using custom font icon try font-size property...

jsf - oncomplete does not hide <p:dialog dynamic="true"> -

i have <p:dialog dynamic="true"> shown on start of <p:commandbutton> . <h:form id="form"> <p:commandbutton value="#{bundlecomunes.guardar}" actionlistener="#{savebb.save}" onstart="pf('savedialog').show()" update="@form" oncomplete="pf('savedialog').hide()" /> <p:dialog dynamic="true" widgetvar="savedialog"> guardando<br></br> <p:graphicimage value="/img/ajaxloadingbar.gif" /> </p:dialog> </h:form> it shows dialog, never hides on complete. if remove dynamic="true" , works. <h:form> <p:commandbutton ... update="@form" /> <p:dialog dynamic="true"> ... </p:dialog> </h:form> you're updating form dynamic dialog sitting in, causing corrupted because it's after update not same d...

how to use session in second page as a directory name in php -

<?php $videopath = 'video/$_session['username']'; $videoexts = array('webm'=>'video/webm','mp4'=>'video/mp4','mpeg'=>'video/mp4','ogv'=>'video/ogv'); $directory = "/video"; $phpfiles = glob($directory . "*.html"); if ($handle = opendir($videopath)) { while (false !== ($file = readdir($handle))) { $info =pathinfo($file); $ext = strtolower($info['extension']); $filename = basename($file,".$ext"); if (array_key_exists($ext, $videoexts)) { ?> i taking $_session['username'] log in page $_session['username'] = $username; i creating folder name mkdir("video/$username"); but code give error this parse error: syntax error, unexpected 'username' (t_string) in c:\xampp\htdocs\akash\vidsite\mychannel.php on line 38 please how use session $videopath = 'video/$_session[...

sql server - Query all items for the week in SQL -

i have query selects items given week , sets date start day of week. in cases query sets incorrect date value given item , have traced problem in either datediff or dateadd functions. the query select dateadd(week, datediff(week, 0, datetimevalue), 0) newdatetimevalue let's take date march 27 2016 example. datediff returns value of 6065 , dateadd value returns march 28 2016. for date march 26 2016, datediff returns 6064 , dateadd march 21, 2016. to me sounds firstdayofweek issue , sql server thinks sunday first day of week , giving different values sunday , saturday (march 27, 2016 sunday). i tried set first day of week by set datefirst 1 but didn't make difference , sql returned same results. so causes sql function behave , ideas how fix it? i found out datediff doesn't respect datefirst setting , assumes week starts on sunday. reason why sample case works works. question has suggested workaround: is possible set start of week t-sql datediff ...

javascript - phpmyadmin- mysqli::query(): Couldn't fetch Handler -

im trying load smartfoxserver page , white screen comes up: mysqli::query(): couldn't fetch handler location: c:\xampp\htdocs\classes\class.content.php (112) and dont know how fix it, here (112) referring too: public function dbase($type, $params = array()) { if (!$this->mysql->connection) $this->systemexit('no available mysqli connection', __line__, __file__); switch (strtoupper($type)) { case 'query': if ($query = parent::query($params[0])) { $this->mysql->totalquery++; return $query; } else please suggestions help. , please dont contradict me much. im beginner on site , website hosting server code.

sql server - SQL query pivot INSIDE a case statement erroring -

the below code looks should work, only 1 expression can specified in select list when subquery not introduced exists . think refering pivot of avg(testresults) on testrgstr_testname. i have table full of results tests @ various times of day. want take results sludge, dust , particle tests date range , average them on single row. this has led use of pivot. issue test names change depending on time of year james, frank others names, has led use of case statement allow different test names , hence different columns after pivot. apologies errors stripped down version of production code , can't test it. with testdata ( select testname, convert(decimal(10,2),result) testresult testreg resultdate between @pfromdate , @ptodate , (testrgstr_testname '%sludge%' or testrgstr_testname '%dust%' or testrgstr_testname '%particle%') ) select case when @pcamptype = 'james' ( select [jdtd james cutting slu...

ios - I need to display a page ,but use many interfaces -

i use tableview display ,but there many interfaces,i no idea when reload data.i have reloaded data each request far.but lead splashing screen。i have thanked using gcd,but works not well.i need r ,thanks. there code of application: -(void)loaddata{ if (!_imagearray||_imagearray.count > 0) { _imagearray = [nsmutablearray array]; } if (!_newsarray||_newsarray.count > 0) { _newsarray = [nsmutablearray array]; } if (!_articlearray||_articlearray.count > 0) { _articlearray = [nsmutablearray array]; } asisaferelease(_getmainpicrequest) asisaferelease(_newslistrequest) asisaferelease(_articlelistrequest) asisaferelease(getnewscountreq) asisaferelease(getresoucecountreq) asisaferelease(getarticelcountreq) asisaferelease(getactivecountreq) //the first request nsmutabledictionary * getmainpic = [nsmutabledictionary dictionary]; _getmainpicrequest = [httprequsetfactory getrequestkeys:getmainpic suburl:sub_url_getmainpic usercommon:ye...

r - How can I improve the Makevars file for a Rcpp (RcppEigen) package? -

i have r package moved mcmc algorithm containing matrix algebra c++ using rcppeigen package dramatically improved speed. however, r cmd check gives following note on linux ( thanks r-forge ): * checking installed package size ... note installed size 6.6mb sub-directories of 1mb or more: libs 6.1mb this warning not driven incredible size of c++ code ( which around 150 lines ), appears on linux, inability correctly configure makevars file. (i have never used make or makefile before). when submitting package cran , brian ripley wrote regarding note makes me expect makevars problem: "it comes debugging symbols." my makevars standard rcpp makevars (given below) produced rcpp.package.skeleton . my questions: how can configure makevars in way reduces size of compiled library on linux (i.e., rid of note )? what resources on how magic of makevars rcpp ? (i didn't find in gallery , r extension manual on this incomprehensible me) my ...

solrj - How can I sort solr result bases on dynamic fields -

thanks giving time. i need sort result on basis of dynamic field. how can ? when sorting on minimum value of of dynamic attribute. it's not giving correct result because query &sort=min(a_160018,a_chandigarh1) of document having both field a_160018 , a_chandigarh1 while document having no field , having 1 either a_160018 or a_chandigarh1 result doc . could me , how can sort type of dynamic field. if not know if field exist, can set default value in case not exists. try use def function, returns default vlaue if field not exist. //in part of query, have put default value high in order put result on bottom of list &sort=min(def(a_160018,9000000),def(a_chandigarh1,9000000)) extract of solr def doc def(field|function,defaultvalue) returns value of field "field", or if field not exist, returns defaultvalue specified. example use: def(rating,5) def() function here return rating, or if no rating specified in doc, returns 5 ...

php - Upload image to Google Drive for OCR -

i'm trying upload image google drive optical character recognition (ocr). here codes: require_once('vendor/autoload.php'); // initialize google client $client_email = 'xxxxxx@yyyyy.iam.gserviceaccount.com'; $private_key = file_get_contents('key.p12'); $scopes = array( 'https://www.googleapis.com/auth/drive.file' ); $credentials = new google_auth_assertioncredentials( $client_email, $scopes, $private_key ); $client = new google_client(); $client->setassertioncredentials($credentials); if ($client->getauth()->isaccesstokenexpired()) { $client->getauth()->refreshtokenwithassertion(); } // initialize google drive service $service = new google_service_drive($client); // upload file $file = new google_service_drive_drivefile(); $file->setname('test image ocr'); $file->setdescription('test image ocr'); $file->setmimetype('image/jpeg'); try { $data = file_get_contents($filename); ...

Plugin does not recognize Python host in Neovim although Python works just fine within -

i use neovim on arch linux python-neovim , python3-neovim installed python support. until last update of python-clients neovim worked well. particular use unite plugin needs python support. after new version of python clients neovim installed python support seemed have broken. echo g:loaded_python_provider returns 1 , unite throws following exception: function <snr>51_call_unite..unite#start..unite#start#standard..unite#init#_current_unite..remote#define#commandbootstrap..remote#host#require..<snr>56_requirepythonhost, line 15 vim(if):channel closed client error detected while processing function <snr>51_call_unite..unite#start..unite#start#standard..unite#init#_current_unite..remote#define#commandbo...

object - How to find a nearest higher number from a specific set of numbers :javascript -

this question exact duplicate of: how find same or nearest higher number specific set of numbers :javascript 1 answer i have set of numbers & requirements find same or nearest higher number specific variable set/object of numbers var person = { a:107, b:112, c:117, d:127, e:132, f:140, g:117, h:127, i:132, j:132, k:140, l:147, m:117, n:127, o:132 }; i need find nearest higher number vaiable x eg1- if x = 116; then nearest higher number x number set 117, repeat @ c, g, m need find out c, g, m programatically javascript eg2- x= 127 then same number x number set repeat @ d,h,n need find out d,h,n programatically javascript thanks you can use reduce find lowest difference , collect keys value. if lower difference found, keys array replaced new set of lower keys, e.g. fun...

php - Is there any way to make a pdf which cannot be converted to word? -

we have system generating pdf files. can convert files using online pdf word converter. there option available in yii or php stop this? to prevent pdf been converted word may: set password required view pdf - once password shared - can removed convert pdf images , convert these images pdf (using imagemagick , ghostscript ) - recoverable using ocr. write code damages so-called cmap ( /tounicode dictionary) inside generated pdf copied text not match text displayed viewer - still recoverable using ocr. use handwritten font text drawn image . these images saved jpeg , these jpeg files converted final pdf - not recoverable using ocr can recovered using hwr use vector drawing commands draw own letters line line, letters not recognized pdf readers text - still recoverable using human eye. finally , may skip generating pdfs instead print physical document, make hard cover , send physical post customers , suppose lazy enough not remove cover , scan document page page o...

vba - Get value from another sheet -

i'm having trouble trying make code work: private sub worksheet_change(byval target range) static zeroflag boolean dim keycells range set keycells = range("b29") on error resume next set keycells = application.union(keycells, keycells.precedents) on error goto 0 if not application.intersect(target, keycells) nothing if (range("b29").value <= 0) xor zeroflag msgbox iif(zeroflag, "not zero", "zero") zeroflag = not (zeroflag) end if end if end sub the thing is, alert shows when change values sheet "b29" need alert show when alter values other sheets too. for example: "b29" cell located on sheet , result of a1-a2, a2 getting value cell a1 @ b sheet alert showing if alter cell a2 sheet , not a1 b sheet. what can make work? when first started work on code looked , work when altered value diferents sheets private sub worksheet_calculate() if range("b29").value ...

vba - Excel Macro: Inserting a column and copying the formula into it from the adjacent column -

i trying insert column sheet , copying formulas adjacent column right. the place insert column being read work sheet itself. e.g column s (column 19). so need insert new column @ column "s" , copy formulas "old" column s, column t. i using following code giving me 1004 error. sub insert_rows_loop() dim currentsheet object 'msgbox "ghj" & sheet16.range("h2").value sheet2.cells(1, sheet16.range("h2").value).entirecolumn.select selection.copy selection.insert shift:=xltoleft application.cutcopymode = false sheet2.cells(1, sheet16.range("g2").value).entirecolumn.select selection.copy selection.insert shift:=xltoleft application.cutcopymode = false sheet2.cells(1, sheet16.range("f2").value).entirecolumn.select selection.copy selection.insert shift:=xltoleft application.cutcopymode = false end sub the code ...

javascript - Google map parameter autocompleter to show suggestion after x letters -

is there google maps api parameter autocompleter, in can show in case cities after writing first 3 letters of city in input field. let's write new and api suggest me new york... but if write ne the api shall suggest me nothing i read through api page not find suitable. i believe not attainable using available parameter options in making http requests google place autocomplete api . what recommend implement event listener text field check how many characters entered if exceeds amount, in case “3”, proceed making http request places api. document.getelementbyid('myinput').addeventlistener("keyup", function(){ /* code implementation here */ }, false);

r - Lag doesn't see the effects of mutate on previous rows -

i seem have stumbled upon mutate/lag/ifelse behaviour cannot explain. have following (simplified) dataframe: test <- data.frame(type = c("start", "end", "start", "start", "start", "start", "end"), stringsasfactors = false) > test type 1 start 2 end 3 start 4 start 5 start 6 start 7 start 8 end i modify column type in order have sequence of alternating start , end pairs (note in test dataframe sequences of start possible, end never repeated): > desired type 1 start 2 end 3 start 4 end 5 start 6 end 7 start 8 end i thought achieve goal following code: test %>% mutate(type = ifelse( type == "start" & dplyr::lag(type, n=1, default="end") == "start" & dplyr::lead(type, n=1, default="end") == "start", "end" , type)) the code should detect...

asp.net mvc - How to remove %22 from urls in angularjs -

i working in mvc 4 , using angularjs client side scripting.i made edit method posts id of object mvc controller.when click on edit . url generates http://localhost:59568/newsletter/getnewsletterdataang?id=%2256d6ac05afb241256469194b%22 but should be http://localhost:59568/newsletter/getnewsletterdataang?id=56d6ac05afb241256469194b because of %22 in front , end throwing 500 error. please suggest me how remove url to complete comment above i'll let know other thing how send , data using angular js. if want pass json object server it's better in post using $http service builtin angular in example below: $http.post(url, jsonobject){...}; by doing so, send json object body of request , in asp.net-mvc model binder can bind json object class in c# code. in case there no need, said in comments, json.stringfy method call when doing get request.

css - angular bootstrap dropdown to open on left -

i have used angular bootstrap dropdown link . problem dropdown opens on right side. how can make open on left? here markup , js used given link. markup: <div ng-controller="dropdownctrl"> <!-- single button keyboard nav --> <div class="btn-group" uib-dropdown keyboard-nav> <button id="simple-btn-keyboard-nav" type="button" class="btn btn-primary" uib-dropdown-toggle> dropdown keyboard navigation <span class="caret"></span> </button> <ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav"> <li role="menuitem"><a href="#">action</a></li> <li role="menuitem"><a href="#">another action</a></li> <li role="menuitem"><a href="#">something else here</a></li> ...

Opencl atomic function performance -

i understand atomic functions in opencl slow down program significantly. true if there racing when writing operation memory. i curious if there is_not racing, happen if still use atomic function when updating memory? according understand, give slow down anyway since threads forced executed 1 after one. right this?

c++ - How to find COM dlls of all applications -

i'm trying write code migration app, can migrate apps old pc new pc. part of job locate , restore com apps。 for now, question is: 1.given app, how find relevant com dll? 2.how find apps' com dlls? i'm new com, please answer detailed possible:) any idea appreciated! in advance! there 2 ways open dll: linking them directly, , opening them manually. can list of dlls of first type using tool dependency walker ( http://www.dependencywalker.com/ ). careful use right version; 32-bit version not play 64-bit applications , vice versa. a list of dlls of second type, unfortunately, cannot extracted automatically.

c++ - Cannot receive data from PC to Android via Sockets -

i have pc set server , android phone client. have verified server sending data using telnet command in windows. phone can connect server, not receiving/displaying data. i use code send data in pc - char msg[32] = "message"; int sent = send(new_socket, msg, strlen(msg), 0); and use code receive data in android - public void onclickconnect(view view) { serverip = textip.gettext().tostring(); new connecttask().execute(""); } public class connecttask extends asynctask<string, string, tcpclient> { @override protected tcpclient doinbackground(string... message) { mtcpclient = new tcpclient(serverip, new tcpclient.onmessagereceived() { @override public void messagereceived(string message) { log.i("debug","input message: " + message); } }); mtcpclient.run(); return null; } } --- tcpclient.java --- public class tcpclient { privat...

c - Buffer Overflow -

i trying create buffer overflow. there 3 variables in function -- int, , 2 arrays. 2 arrays both length of 14 chars. int initialized 0 in function, trying change 1. run program terminal , put in input assign second array. therefore, when run program, doing this: ./a.out 11111111111111111111111111111 this 29 1's. overflows 2 arrays making them both 1's, , want put 29th "1" int, reason gets converted decimal number "49." how able put "1" int using buffer overflow without converting? i not able put decimal version of 1 because unprintable character in ascii. the ascii value of character 1 0x31 , 49 in decimal. on right track. what doing invokes undefined behavior anyway, expected behavior form of undefined behavior. to try , change integer 1 , can run ./a.out 1111111111111111111111111111^a where ^a obtained pressing control , a keys, shell's line editor interpret command move cursor beginning of line... can...

How do I stop excel updating cell references upon insertion of new data -

i have spreadsheet takes in parameters update every day. inserted separate worksheet holds inserted data. use data take average of latest 5 entries smooth out day day variation: e.g. =((b1*(100-(average(data!g$ 2 :g$ 6 ))))/(343.805764)) when insert new data line, formula updates to: =((b1*(100-(average(data!g$ 3 :g$ 7 ))))/(343.805764)) how can prevent update? if need "fix" range - regardless of default behaviour of excel change row-numbers if insert new rows - try working hard-coded ranges using index =((b1*(100-(average(index(data!g:g,2):index(data!g:g,6)))))/(343.805764))

DB2: Can not delete rows from empty table after it was referenced in foreign key -

there empty table called address . i perform delete address , ok. there empty called addressmapping . now add foreign key constraint addressmapping references address . alter table addressmapping add constraint fk_addressmapping_adress_id foreign key (address_id) references address when perform delete address following error occurs: [55019][-7008] [sql7008] address in my_schema not valid operation both mentioned tables still empty. if remove constraint delete statement terminates again properly. why error occur? , how can fix it? described problem occurs because tables not journaled. adding journaling tables should solve problem.

ajax - Ajaxical redirect using query-string parameters -

redirecting using following partial response (inside servlet filter). attempt redirect target resource, when user logs in. private void redirect(httpservletrequest request, httpservletresponse response, string redirecturl) throws ioexception { if ("partial/ajax".equals(request.getheader("faces-request"))) { response.setcontenttype("text/xml"); response.setcharacterencoding("utf-8"); response.getwriter() .append("<?xml version=\"1.0\" encoding=\"utf-8\"?>") .printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", redirecturl); } else { response.sendredirect(response.encoderedirecturl(redirecturl)); } } request / response headers : general request url:https://localhost:8443/contextroot/utility/login request method:post status code:302 found remo...