Posts

Showing posts from July, 2011

cakephp - Add data to store in cakephp3 controller -

i using cakephp-3.0 have problem in version of cakephp 2.x can add data in controller , don't need send view. example: public function add() { $this->request->data['user']['id']=$this->auth->user('id');//and save id $this->request->data['user']['date']=$date('y-m-d h:m:s');// , save date if ($this->request->is('post')) { if ($this->users->save($user)) { $this->flash->success('the user has been saved.'); return $this->redirect(['action' => 'index']); } else { $this->flash->error('the user not saved. please, try again.'); } } $this->set(compact('user')); $this->set('_serialize', ['user']); } up here, add data received, receive information , data added id , date example. example. , if save information, information sa

c# - How Array.Sort sort a class that contains strings and doubles? -

in code i'm looking through writer goes: individual[] candidates = new individual[tournsize]; (int = 0; < tournsize; ++i) candidates[i] = population[indexes[i]]; array.sort(candidates); which property sort if class contains: string s; , double d. specified in documentation, https://msdn.microsoft.com/en-us/library/6tf1f0bc(v=vs.110).aspx , each element must support icomparable , in case result sorted definitions, , if element doesn't support interface result undefined.

html - Inconsistent element rendering and spacing -

i started creating simple concept javascript game based around tiles, when positioning tiles, found problem display. http://i.gyazo.com/8328507c64b4254a6271172892ca3f92.png in picture, couple of columns dragged around 0.5px , 1px, , highly undesirable. i have tested in chrome, mozilla firefox , internet explorer , have trouble aligning tiles: chrome has trouble vertically, firefox , ie horizontally. the css code both container , tiles (there 200 in container) following: #container { position:absolute; width:100%; height:100%; } .tile { width:5%; padding-bottom:5%; display:inline-block; margin-right:-4px; margin-bottom:-4px; position:relative; background-size:100% auto; background-repeat:no-repeat; } edit: html code, request: <div id="container"> <div class="tile tile_0_0"></div> <div class="tile tile_1_0"></div> <div class="tile tile_2_0">

ios - How to use runAction syntax correctly for the following -

i'm trying following //increase spaceship frequency self.runaction(skaction.repeatactionforever(skaction.waitforduration(1), completion: { difficulty -= 0.01 println("difficulty increased") })) basically need skaction.waitforduration(1) completion run forever tried wrap around runaction i following error: "extra argument 'completion' in call" if want use spritekit , use action sequence: self.runaction(skaction.repeatactionforever(skaction.sequence([skaction.waitforduration(1), skaction.runblock({ difficulty -= 0.01; println("difficulty increased"); })]))); but, should using nstimer .

How do I store & access a Twitter Fabric login session (iOS/Swift)? -

i'm able log in twitter through app using twitter fabric code: let loginbutton = twtrloginbutton(logincompletion: { (session: twtrsession!, error: nserror!) in // play twitter session if (session != nil) { println("signed in \(session.username)"); self.twusernamelabel.text = "logged in @" + session.username } else { println("error: \(error.localizeddescription)"); } }) when click login button, prompts me approve login , logs me in, or knows approved login , logs me in. works charm , took of ten minutes set up. amazing. i have email-based login access app. i'd store user's logged in twitter account in same database, when user logs in email, know twitter (if have logged in before) , don't need log in again. reason email login because twitter important feature in app, not total requirement. the issue have no idea how access session

spring - How can I use "+" in query string -

i'm using spring ibatis in project. i want use "+" character in query. <select id="test.testquery" remapresults="true" parameterclass="common.util.parameter" resultclass="common.util.parameter"> select + b + c table </select> this test query. when using query, error occured : caused by: java.sql.sqlexception: jdbc-8015:missing right parenthesis. select b c table "+" disappeared. how can use "+" ? i don't know spring, no 1 else has responded i'll chime in: the '+' converted space when passed in url - looks happening you. guess spring has kind encoding function convert plain text query 1 can passed in url. standard url converting replaces + %2b try that. if there spring encoding function best because bound run other characters lost/changed when passed along. i found this, don't know if relevant: http://docs.spring.io/spring/docs/current/javado

My iOS app and WatchKit app are entirely Swift. Do I need to change "Embedded Content Contains Swift"? -

currently, set no targets: ios app target, watchkit extension , watchkit app. based on post : if use swift in iphone app, sure set "embedded content contains swift" build setting no frameworks , extensions , yes iphone app target. i don't understand app. have change anything? have read document "embedded content contains swift". think setting apps built both objective-c , swift. correct? by way, in linked frameworks , libraries of ios app target, have: iad, storekit , watchkit. watchkit extension , app don't link anything. use xcode 6.3. thanks help. you need set embedded content contains swift flag if adding library or framework contains swift code, irrespective of base-project's language (e.g., swift or objective-c). more info here: https://developer.apple.com/library/ios/qa/qa1881/_index.html for situation, don't have set flag yes , not linking external swift libraries.

jquery - How to use javascript variable out of the scope? -

this question has answer here: how return response asynchronous call? 24 answers i using $.get functionality json data action method. out of $.get() function javascript variable getting default value. code like: var data = 0; $(document).ready(function () { var url = "/controller/action"; $.get(url, null, function (data) { data = json.stringify(data); console.log(data); }); console.log(data); }); output display like: [{"name":"jatin","address":"surat","colorscheme":"#1696d3"},{"name":"jatin","address":"surat","colorscheme":"#1696d3"},{"name":"jatin","address":"

memory leaks - Swift / SpriteKit - Can't break strong reference cycle -

i completed spritekit game without having knowledge of strong reference cycles. i'm not having crashes or obvious problems, using instruments can see objects being retained between each level (skscene should dealloced between levels). here general pieces of game: gameconfig static struct i have globally accessible static struct references viewcontroller. access viewcontroller using struct on app. assign gameconfig.viewcontroller = self inside of viewcontroller's viewdidload gameviewcontroller in here reference skscene, , skview such var skview: myview! weak var scene: skscene! basescene this base skscene class. property of class gets reference class itself let indicators: indicators = indicators() killscene subclass of basescene in basescene subclass, have many custom subclasses contained in arrays. these custom subclasses reference scene, scene not referencing them directly. has reference container array. example: var radarblips: [radarbli

R double dot special identifiers -

can point doc double dot special identifiers? below context described. example how produce double dot: l <- list() f <- function(x, y, z){ l <<- c(l, list(match.call())) x[y][z] } invisible(lapply(list(1:2,3:4), f, c(true,true), c(true,false))) l # [[1]] # fun(x = x[[i]], y = ..1, z = ..2) # # [[2]] # fun(x = x[[i]], y = ..1, z = ..2) i've found them mentioned in r-lang without explanation. assume points index of argument passed in ... read more it. i trying use sys.call , later in post-processing use match.call on captured call in above example ends losing lapply ... arguments, , in example function primitive generic end error ... used in situation not exist . match.call used directly in function without going sys.call , later match.call seems way catch info arguments or avoid error in such cases. prefer understand more deeply, without going r source. ps. match.call updated in r 3.2.0. codes above produced on r 3.2.0.

Multiline String Literal in C# -

is there easy way create multiline string literal in c#? here's have now: string query = "select foo, bar" + " table" + " id = 42"; i know php has <<<block block; does c# have similar? you can use @ symbol in front of string form verbatim string literal : string query = @"select foo, bar table id = 42"; you do not have escape special characters when use method, except double quotes shown in jon skeet's answer.

jquery - Check form for similar value before submit -

is there anyway check if similar value exist in input box ex: <form> user 1 <input name="user1" value="bla1"> <input name="pass1" value="ple1"> <input name="email1" value="foo1@yy.cc"> user 2 <input name="user2" value="bla2"> <input name="pass2" value="ple1"> <input name="email2" value="foo2@yy.cc"> user 3 <input name="user3" value="bla1"> <input name="pass3" value="pla3"> <input name="email3" value="foo2@yy.cc"> <button type="submit"> </form> the verification trigger when form submitted, alert user , add class both input similar value. input fields starts @ blank , user should input values. fields should compared type user,pass, , email i've put wee jsfiddle you. basically

c++ - Kinect depth pixel -

i working on kinect project using ms kinect sdk1.7. when trying sample code bridging opencv. not understanding code of calculation // convert depth info intensity display byte b = 255 - static_cast(256 * realdepth / 0x0fff); and how can pixels mat depth distance? i'm not familiar kinect, line i'm assuming realdepth depth measured device inside kinect, in si unit (since 0x0fff 4096 i'm assuming mm). line there // convert depth info intensity display byte b = 255 - static_cast(256 * realdepth / 0x0fff); then converts depth value in mm range (0 - 255) can displayed on monitor screen. you don't need depth 'back', can use realdepth directly

scala deal with string and do accumulative -

i have variable: val list= rows.sortby(- _._2).map{case (user , list) => list}.take(20).mkstring("::") the result println(list) should be: 60::58::51::48::47::47::45::45::43::43::42::42::42::41::41::41::40::40::40::39 and have deal these numbers (like histogram concept) if set break 10, should divide max number (60) 10 , make 6 buckets: the scope between 0~ 10 (0<x<=10) have 0 numbers match the scope between 10~ 20 (10<x<=20) have 0 numbers match the scope between 20~ 30 (20<x<=30) have 0 numbers match the scope between 30~ 40 (30<x<=40) have 4 numbers match the scope between 40~ 50 (40<x<=50) have 13 numbers match the scope between 50~ 60 (50<x<=60) have 3 numbers match and have save 2 variables x , y : x: 0~10::10~20::20~30::30~40::40~50::50~60 y: 0::0::0::4::13::3 how can this? val actuallist = list.split("::").map(_.toint).tolist val ste

caching - nginx non buffered cache -

i have uwsgi application in production serves intermittent data on 1-2 seconds. the buffering set off in nginx serve data available. now wan cache in nginx or varnish looks not possible f buffer off! pointers on appreciated this couldn't done in nginx, unable cache streamed content. varnish version 4 has streaming options https://www.varnish-software.com/blog/http-streaming-varnish

Python - is this loop correct? -

def add(num1, num2): return num1 + num2 def sub(num1, num2): return num1 - num2 def multi(num1, num2): return num1 * num2 def div(num1, num2): return num1 / num2 print("\t\t\tcalculator app") def main(): operation = input("\nwhat want do: (+, -, *, /)? ") if(operation != "+" , operation != "-" , operation != "*" , operation != "/"): #invalid operation print("you have entered invalid key") else: var1 = int(input("please number : ")) var2 = int(input("please enter number : ")) if(operation == "+"): print("answer is: ", add(var1, var2)) elif(operation == "-"): print("answer is: ", sub(var1, var2)) elif(operation == "*"): print("answer is: ", multi(var1, var2)) else: print("answer is: ", div(var1,v

Cordova geolocation.getCurrentPosition Works in Monaca iPhone Debugger But Not With Built iOS App -

navigator.geolocation.getcurrentposition cordova api method works monaca debugger/ app emulator installed on iphone, freezes in built ios version on same phone. i added following config.xml didn't fix problem. <feature name="geolocation"> <param name="ios-package" value="cdvlocation" /> </feature> i tried reproduce problem. unfortunately posted less information. set new cordova project: cordova create geolocationtest com.example.com geolocationtest cd geolocationtest cordova platform add ios cordova plugin add cordova-plugin-geolocation cordova build then moved folder , edited index.html. added code: document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { console.log("navigator.geolocation works well"); } after added example geolocation-plugin documentation: // onsuccess callback // method accepts position object, contains // current gps c

jQuery plugin not working after upgrade -

i have jquery version 1.10.2. before upgraded version, using jquery version 1.4 or 1.8. had upgrade because need many of newest jquery plugins. have problem, my jquery edit attributes doesn't work after upgrading 1.10.2 . here's code: <script type="text/javascript"> $(document).ready(function(){ $("#ekerabat").click(function(){ $("#kerja1").attr("disabled",true); $("#kerja2").attr("disabled",true); $("#kerja3").attr("disabled",true); $("#kerja4").attr("disabled",true); $("#hubungankerabat").attr("disabled",true); $("#namakerabat").attr("disabled",true); $("#statuskerabat").attr("disabled",true); $("#noindukerabat").attr("disabled",true); $("#unitkerabat").attr("disabled",true); }); $(&q

c# - Using Scroll Bar to Shift Text in a Label -

i have label contains string larger label. have created label no text made represent scroll bar, , have set label moves on x axis mouse follows: private point mousedownlocation; private void move(object sender, mouseeventargs e) { if (e.button == system.windows.forms.mousebuttons.left) { mousedownlocation = e.location; } } private void movex(object sender, mouseeventargs e) { if (e.button == system.windows.forms.mousebuttons.left) { if (e.x + scrollbar.left - mousedownlocation.x > 34 && e.x + scrollbar.left - mousedownlocation.x + scrollbar.width < button1.location.x - 10) { scrollbar.left = e.x + scrollbar.left - mousedownlocation.x; } } } the reason have done merely synthetic purposes. problem cannot find way shift text within label amount scroll bar has shifted looks scrolling through text in label. ke

ios - UINavigationBarItem custom - how to get the corner of tabcontroller? -

Image
i want ask how can icon of navigationtabbaritem left corner (left:0) , right corner (right:0). my code : _custombtn = [[uibutton alloc] initwithframe:cgrectmake(0, 0, 44, 44)]; _custombtn.backgroundcolor = [uicolor redcolor]; [_custombtn setbackgroundimage:[uiimage imagenamed:@"ic_msg.png"]forstate:uicontrolstatenormal]; [_custombtn addtarget:self action:@selector(viewbn:) forcontrolevents:uicontroleventtouchupinside]; self.csbtn = [[uibarbuttonitem alloc]initwithcustomview:_custombtn]; uibutton *abutton = [uibutton buttonwithtype:uibuttontyperoundedrect]; abutton.frame = cgrectmake(0.0, 0.0, 44, 44); uibarbuttonitem *abarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:abutton]; [abutton addtarget:self action:@selector(rightbarbuttonaction:) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *spacefix = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemfixedspace target:nil action:null]; spacefix.width = -10

python - How to add a title to Seaborn Facet Plot -

Image
how add title seaborne plot? let's give title 'i title'. tips = sns.load_dataset("tips") g = sns.facetgrid(tips, col="sex", row="smoker", margin_titles=true) g.map(sns.plt.scatter, "total_bill", "tip") after lines: plt.subplots_adjust(top=0.9) g.fig.suptitle('this title, bet') # can figure plt.gcf() if add suptitle without adjusting axis, seaborn facet titles overlap it. (with different data):

ssis - what are the minimum permissions required to restore a SQL Server database, add a user and grant it db_reader -

i've got control-m process takes backup of s sql database , restores using ssis. i need add db user , grant db_reader access. user has sql authenticated login. i have granted control-m dbcreator rights restore database can't think of specific permissions can grant allow create db user. what's best way without granting sysadmin. thanks martin you shouldn't need additional permissions beyond dbcreator . when restore database, should automatically have db_owner rights database. db_owner allow create user , attach pre-existing server login.

android - Get Current Position of ViewPager -

Image
in program, showing gridview , when user tap on of grid item showing viewpager here want know, how can show current position of total position, see in image gallery for example: show current position of viewpager total of grid items in textview 3 of 11 this trying get: mainactivity.java: gridview public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // set title gridview settitle("gridview"); // view grid_view.xml setcontentview(r.layout.grid_view); // set images imageadapter.java gridview gridview gridview = (gridview) findviewbyid(r.id.gridview); gridview.setadapter(new imageadapter(this)); // listening gridview item click gridview.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position, long id) {

MATLAB: How do I copy files with a specific extension to a folder one directory above it? -

i trying copy specific files 1 folder folder 1 directory above it. want of folders have @ once. here's file structure: 201415continuousfordropteqc/stationa/201411/ path has 25 folders labeled 5 through 30 (representing days). in each of these 25 folders there 3 folders named 'dat', 'raw', 'rinex'. want files ending in .14o raw folder (there many other file types in folder well) copied rinex folder. i'm hoping can find way repeat every day in 201411 folder. last part isn't critical since think can type path manually , run script copy , pastes files want. i hope clear. i'm new-ish matlab. thank in advance help! tiffany you can using dir command. check link . can use twice. first 25 folders , files within folder. days = dir('201415continuousfordropteqc/stationa/201411/'); k=3:numel(days) %notice 3 files = dir([days(k).name '/raw/*.14o']); n=1:numel(files) copyfile([days(k).name '/raw/' files

c - In MAKE file : error showing no such file or directory -

i have simple makefile. when run make following error: gcc -i -o server server.o comfunc.o gcc: error: comfunc.o: no such file or directory make: *** [server] error 1 my makefile: cc=gcc cflags=-i aim = server heads = ../common/common.h objs = comfunc.o mobj = server.o miscs = server.cfg srcs = ${objs:.o=.c} ${mobj:.o=.c} #targets all: $(aim) server:server.o $(cc) $(ldflags) $(cflags) -o server server.o $(objs) $(libs) #dependency $(objs):../common/common.h comfunc.o: ../common/common.h #--end of makefile-- add $(objs) , $(mobj) dependency server make sure implicit makefile rules executed produces corresponding .o s refer makefile below cc=gcc cflags=-i aim = server heads = ../common/common.h objs = comfunc.o mobj = server.o miscs = server.cfg srcs = ${objs:.o=.c} ${mobj:.o=.c} #targets all: $(aim) server:server.o $(objs) $(mobj) $(cc) $(ldflags) $(cflags) -o server server.o $(objs) $(libs) #dependency $(objs):../

cordova - getting error to setup ngcordova firsttime -

i using below code: <html> <head> <!-- customize policy fit own app's needs. more guidance, see: https://github.com/apache/cordova-plugin-whitelist/blob/master/readme.md#content-security-policy notes: * gap: required on ios (when using uiwebview) , needed js->native communication * https://ssl.gstatic.com required on android , needed talkback function * disables use of inline scripts in order mitigate risk of xss vulnerabilities. change this: * enable inline js: add 'unsafe-inline' default-src --> <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"&g

machine learning - Could not compile cuda_convnet error on pylearn2 -

im trying compile cnn pylearn2 on windows server 2012. when network includes maxoutconvc01b fails compile , gives error message, runtimeerror: ('the following error happened while compiling node', (gpucontiguous.0), '\n', 'could not compile cuda_convnet') please resolve issue appriciated. i had problem because theano , pylearn2 distributions weren't latest builds. update both latest development versions.

Do a loop with letters in R -

i want loop letter..i have matrix(named 'a') , want have column names.. k<-arrayind(2,dim(a)) colnames(a)[k[,1]] colnames(a)[k[,2]] colnames(a)[k[,3]] . . . colnames(a)[k[,n]] i guess loop that aa<-list() (i in 1:n) { aa[[i]]<-colnames(a)[k[,i]] } but don't results. think loop ok have change else the aa<-list() and replace "list" else.. suppose have matrix mat , looks this: mat <- matrix(1:4, ncol = 2, dimnames = list(letters[1:2], letters[1:2])) you can inspect structure this: str(mat) # int [1:2, 1:2] 1 2 3 4 # - attr(*, "dimnames")=list of 2 # ..$ : chr [1:2] "a" "b" # ..$ : chr [1:2] "a" "b" and column names using this: colnames(mat) # [1] "a" "b"

Java regex matches nothing -

string string = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<request>\n" + " <item>\n" + " <type>c0401</type>\n" + " <invdate>20150301</invdate>\n" + " <no>pk1000000</no>\n" + " </item>\n" + " <item>\n" + " <type>c0401</type>\n" + " <invdate>20150301</invdate>\n" + " <no>pk1000002</no>\n" + " </item>\n" + "</request>"; pattern pattern = pattern.compile("(<item>)(.*)(</item>)"); matcher matcher = pattern.matcher(string); list<string> listmatches = new arraylist<string>(); while(matcher.find()) {

android - java.lang.runtimeexception unable to start activity componentinfo -

i having error in code java.lang.runtimeexception unable start activity componentinfo package estimatewall.example.com.estimatewall; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class mainactivity extends actionbaractivity { edittext inputtxt; edittext inputtxt1; textview settext; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); inputtxt = (edittext) findviewbyid(r.id.edittext); // store edittext in variable int val = integer.parseint(inputtxt.gettext().tostring()); inputtxt1 = (edittext) findviewbyid(r.id.edittext2); // store edittext in variable int val1 = integer.parseint(inputtxt

php - error_reporting(0) not affecting error display on page: -

error_reporting(0) not affecting error display on page: i checking website on localhost server (xampp) , want hide errors visitors of website. however, have tried add custom message visitors won't able actual error , instead logged error error.log file on server, if don't want either of 2 ? to set error_reporting(0) / ini_set('display_errors',0); on script won't working me , anyhow reporting error error log code : ini_set('display_errors',0); error_reporting(0); $query = "select * user1 uname = '34'"; //user1 not exist, wrote error mysql_query($query) or die(errorhandler($query,mysql_error())); function errorhandler($query,$error){ $pesan = htmlspecialchars("failed query: ". $query ."<br>".$error ); error_log($pesan,3,"error.log"); // log error error.log file return "page not exists, try other."; // user see message, no matter error } please do

Android EditText gradient shadow -

Image
i want shadow must have gradient shadow shown in image, zoom image see actual gradient effect 2nd image show effect in zoom all can see picture - should use [layer-list drawable 9-patch shadow] every [state drawable] of edittext.

Reactjs event handler not triggered for element in a container which prevent event bubbling -

i'm using react map library, use react render elements in container provided map library. the problem container prevent event bubbling, checkout reactjs source code found event emitter listen on html document , depend on event bubbling dispatch event. how can make onclick handler work? addeventlistener manually don't think elegant way. <body> <container preventbubbling> <reactelement onclick={this.handleclick}/> </container> </body> as said, react depends on event bubbling instead of attaching event handlers directly dom node want events for. integral part of react, , not can avoid without manually attaching event handlers in componentdidmount . , manually removing them in componentwillunmount . what's reason cancelling bubbling in map library? i'd try remove cancellation , see if works.

asp.net - accessing control/Checkbox in editform -

i have problem accessing checkbox in editform-template, nested in grid. <editformsettings editformtype="template" editcolumn-uniquename="insertform"> <formtemplate> <table> <tr> <td>add : </td> <td> <asp:checkbox runat="server" id="addcb" /> </td> </tr> <tr> </table> </formtemplate> </editformsettings> the editformtemplate s

Java array reading loop never ends? -

hi new programming , today writing code 1 java array task , in beginning tried test have done , in first loop (the array reading ) program not stop read numbers enter number (n) length. please ? import java.util.scanner; public class readtwoelementsforarrayandsum { public static void main(string[] args) { // todo auto-generated method stub scanner in = new scanner(system.in); system.out.println("please enter n element:"); int n = in.nextint(); system.out.print("please enter k element, k < n: "); int k = in.nextint(); int[] arrayn = new int[n]; system.out.print("please enter n numbers array: "); for(int = 0; < arrayn.length; i++) { arrayn[i] = in.nextint(); } boolean changed = false; { int temp = 0; for( int = 0; < (arrayn.length-1); i++) { if(arrayn[i] > arrayn[i+1]){

ios - Filter an array based on empty value in Swift -

i trying filter array of dictionaries. below code sample of scenario looking for let names = [ [ "firstname":"chris","middlename":"alex"], ["firstname":"matt","middlename":""], ["firstname":"john","middlename":"luke"], ["firstname":"mary","middlename":"john"], ] the final result should array whom there middle name. this did trick names.filter { if let middlename = $0["middlename"] { return !middlename.isempty } return false }

html - Image container over a link -

so, have links automatically generated. for specific page don't want users click link (only see there). without modifying code, thinking of putting div container on high z-index users cannot click it. should embed 1 pixel image background repeat positioned on top of link or there better way of achieving this? thanks you can disable pointer events using css, actually. example, if add class or can identify <a> element in way, use css: a.disabled { pointer-events: none; cursor: default; } browse support pointer-events can seen here . credit this stackoverflow answer .

android - Request location updates not updating while driving -

i have written function requesting location updates: private void requestlocations() { locationlistener = new locationupdater(); lm = (locationmanager) getsystemservice(context.location_service); if (!lm.isproviderenabled(locationmanager.gps_provider)) { lm.requestlocationupdates(locationmanager.network_provider,0, 100, locationlistener); } else { lm.requestlocationupdates(locationmanager.gps_provider, 0, 100, locationlistener); lm.requestlocationupdates(locationmanager.network_provider,0, 100, locationlistener); } } i calling function in onstart() of service have made foreground service. in locationupdater have implemented locationlistener . in on location changed toasting lat/lang. working fine if @ walking speed. while driving not accurate , fast walking speed. though not toasting location if @ speed of more 50 km/h , stop again starts working , toast new location . wanted make i

c# - Regex expression error -

currently dont want below string passed regex refer mtf#y2015-19555 regex (.)\\1{2,} image1 the photo attached appeared impossible passed regex, program happened string matched regex, want know happened it image2 i think problem is, regex-pattern differently seen regex-tester , .net framework. when using pattern in code, have keep in mind, string checked escape characters. while regex-tester gets (.)\\1{2,} , .net framework regex gets (.)\1{2,} because "\\" becomes \ . fix changing pattern string pattern = "(.)\\\\1{2,}"; or disable escape characters using string pattern = @"(.)\\1{2,}"; . you can see difference considering pattern \w . regex.match("\w", myteststring); this cause compiler error because "\w" contains unknown escape sequence (the string evaluated @ development time). fix error, i'm adding @ in front of string , compiler satisfied. regex.match(@"\w", myteststring); i

c++ - How to change arm version in arm-linux-gnueabi-gcc for cross compile -

i want cross-compile in eclipse board armv7l . got armv7l via, uname -i . installed arm cross compiler toolchain, using below commands. $ sudo apt-get install emdebian-archive-keyring $ sudo apt-get install libc6-armel-cross libc6-dev-armel-cross $ sudo apt-get install binutils-arm-linux-gnueabi $ sudo apt-get install gcc-arm-linux-gnueabi $ sudo apt-get install g++-arm-linux-gnueabi $ sudo apt-get install u-boot-tools $ sudo apt-get install libncurses5-dev i think have give option target board version. first time tried put arm-linux-gnueabi-g++ in c/c++ build->settings->gcc c++ compiler , gcc c++ linker .(eclipse project properties) next put -march=armv7 in miscellaneous but not working. checked executable file readelf -a , shows tag_cpu_name: "7-a" tag_cpu_arch: v7 tag_cpu_arch_profile: application tag_arm_isa_use: yes tag_thumb_isa_use: thumb-2 tag_fp_arch: vfpv3-d16 tag_abi_pcs_wchar_t: 4 tag_abi_fp_denormal: needed tag_abi_

html - Background video with 100% width and fixed height -

i need run video in background. requirements video have run on 100% width , 600px height/max-height. here tried do. https://jsfiddle.net/yydkd5t4/1/ html <video autoplay loop muted id="video-bg"> <source src="http://demosthenes.info/assets/videos/polina.mp4" type="video/mp4"> </video> css #video-bg { position: fixed; right: 0; bottom: 0; width: auto; min-width: 100%; height: auto; min-height: 100%; z-index: -100; background: transparent url(video-bg.jpg) no-repeat; background-size: cover; } video {display: block;} the issue facing when try fix height scale down width. solution problem highly appreciated. after understanding trying achieve... you need add parent div video. else maintain aspect-ratio , can't achieve want. #video-bg { position: relative; width: auto; min-width: 100%; height: auto; background: transparent url(video-bg.jpg) no-repeat; background-size: cover; } video {

r - Popups not working with leaflet & shiny -

i having trouble getting popups work in shiny app using leaflet package. application uses shinydashboard package well. copied code superzip example. example works fine locally, not within app. below of server.r file. any clue cause problem? thanks! library(shiny) library(leaflet) function(input, output, session) { mapp <- createleafletmap(session, "map") # filter dataset visit_data_f <- reactive({ s <- as.posixct(input$period[1], format = "%y-%m-%d") e <- as.posixct(input$period[2], format = "%y-%m-%d") hour(s) <- 23; minute(s) <- 59; second(s) <- 59; hour(e) <- 23; minute(e) <- 59; second(e) <- 59; d <- filter(visit_data, started_on >= s, started_on <= e) if (input$district != "tous") { d <- filter(d, district == input$district) } d }) geo_data <- reactive({ data <- visit_data_f() data$site

cluster computing - code flow of slurm gpu allocation -

does 1 know code flow how gpus allocated in slurm? have gone through , found cuda_visible_devices environment variable not updated in code. how done in code? my goal add new hardware support using environment variable allocation. take @ gpu gres plugin. there code modifies cuda_visible_devices environment variable. file path is: src/plugins/gres/gpu/gres_gpu.c

code coverage - Visual studio Tools available for standalone download? -

for doing code coverage using visual studio tools, available download separately? don't need visual studio ide development, need tools instrument dlls , capture code coverage. use how to: install stand-alone profiler , download analyzing profiling data vsperfcmd cab source guidance. i hope support question.

javascript - How to pass json string to webmethod c# ASP.NET -

im trying stringify javascript object , pass string parameter webmethod in code behind. can't work internal server error of 500 , stacktrace says value missing parameter. here javascript code: var json = json.stringify(javascriptobject); // "{"foretagsnamn":"avector","bgfarg":"000000","textcolor":"fafafa","footerfarg":"ffffff","footercolor":"000000","footerlinkcolor":"050505","featuredbordercolor":"","hoverfarg":"12ebeb","rutfarg":"0d0d0d","selectedrutfarg":"","rutcolor":"ffffff","lankcolor":"","delamedsig":"1","personalsida":"0","startpagetitle":"","startpagedescription":"","googlemaps":"<iframe width=\"425\" height=\"35

jsf 2 - Primefaces ColumnToggler does'nt work with pagination -

Image
i've got datatable along sort, filter , columntoggler. firstly, when select , unselect column in same page fine. can see, first column has disappeared my problem here when go next page pagination tool , if want unselect column, displays column header , not rows can see below : initial hidden column displayed we've got gap. last column right empty , first 1 take value second column. this datatable structure : <p:datatable id="datatable" var="mon" value="#{x.resultquery}" first="#{datatablecontroller.first}" resizablecolumns="true" rows="20" paginator="true" paginatortemplate="{currentpagereport} {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}" rowsperpagetemplate="30,40,50"

sql server - Why Len Function Can Use Index? -

i have table 145000 rows. , have not index on it. when run below sql. found table scan on execute plan expected. generate 6 rows , 3481 logic read. set statistics io on select columna table len(columna)<>5 then add clustered index on columna , run sql.i found cluster index scan on execute plan. generate 6 rows , 3511 logic read. can understand greater logic read b-tree nodes read. but confuse me use non-clustered index instead of clustered index on columna , run sql. found index scan on execute plan. generate 6 rows , need 417 logic read!. i don't think len() function can take advantage of index. why non-clustered index on columna makes less logic read(9 times)? the len function can't make "use" of index, index, containing only column, occupy far less space, in entirety, base table does. it's more efficient scan index scan base table. scanning base table loading of other columns in table though they're not needed satisfy query

powershell - New-PSSession : Relative URIs are not supported in the creation of > remote sessions -

i found useful script uploading photos on exchange server: : first error: new-pssession : relative uris not supported in creation of remote sessions. @ line:110 char:15 + $session = new-pssession -configurationname microsoft.exchange -connectionuri ... + + categoryinfo : invalidargument: (mail-pero.appl.campari.priv:uri) [new-pssession], notsupportedexception + fullyqualifiederrorid : createremoterunspacefailed,microsoft.powershell.commands.newpssessioncommand second error: the term 'get-mailbox' not recognized name of cmdlet powersheel gui the script meant exchange2010, make sure have it, not newer, not lower. otherwise have update script. it's hardcoded use 2010 libraries. also, error said, don't use relative urls. for urls, use https://yourexchangeuri.com

How to schedule a java program to run daily in Windows? -

i have written java program retrieves google data till present date using google analytic api , export csv file. want program run daily data in csv file date. how can achieve this? you can use windows task scheduler ( see tutorial ) start program; java, want create batch file run java program, use scheduler run batch file. you can use executable jar . you may need specify start directory - see this thread .

javascript - Get authorized url of NetSuite -

i need access sales order in netsuite sfdc login. have code gets sales order number. problem need generate url redirect sales order in netsuite sales force. requires url ' https://system.na1.netsuite.com ' via suitescript . 'na1' in url stands noth america , changes in url according country. hence passing email id, password actual login address ' https://system.netsuite.com/pages/customerlogin.jsp ' need authorized url. nlapiresolveurl(type, identifier, id, displaymode) creates url on-the-fly later part of url. any idea or solution please? expanding on answer posted @egrubaugh360, base domain, here example. function credentials(){ this.email = "netsuiteemail@example.com"; this.account = "1234567"; this.role = "25"; this.password = "secretpassword"; } //setting url var url = "https://rest.netsuite.com/rest/roles"; //calling credent

c# - Select interval linq -

is there way linq select numbers shortcut criteria. this: have numbers 1 10000 . criteria (4012..4190|4229) , meaning take numbers between 4012 4190 , number 4229 : static int[] test(string criteria) { // criteria 4012..4190|4229 // select numbers lab criteria met int[] lab = enumerable.range(0, 10000).toarray(); return lab; } if criteria string , need way parse it, func<int, bool , it's not linq specific. in end you'll need this: func<int, bool> predicate = parse(criteria); return lab.where(predicate).toarray(); where basic implementation of parse might follows: public static func<int, bool> parse(string criteria) { var alternatives = criteria .split('|') .select<string, func<int, bool>>( token => { if (token.contains("..")) { var between = token.split(new[] {"..&q

laravel - button redirecting to wrong path -

i using link button in blade view. code follows: <a href="conclusion" class='btn btn-default btn-sm'>end case</a> the url of page on link button is: http://localhost/cases/137/responses/30 the result of button should http://localhost/cases/137/responses/30/conclusion but redirecting http://localhost/cases/137/responses/conclusion my laravel route definition is: get('/cases/{id}/responses/{respid}/conclusion', 'homecontroller@conclusion'); what wrong it? how can it? the save way generate urls use laravels helper functions. way don't have problem relative urls generates full url. in case action() appropriate: <a href="{{ action('homecontroller@conclusion', [$id, $respid]) }}" class='btn btn-default btn-sm'>end case</a> alternatively can give route name: get('/cases/{id}/responses/{respid}/conclusion', [ 'as' => 'conclusion', &

c# - Linq group by select -

i have following linq expression , need add 2 extrastring fields (newfieldwhat , newfieldby) record-object in result-list. string-value either first or last, no difference. how can achieve that? list<record> groupedtable = (from t in recordtable group t new {t.groupby1} grp select new record{ groupby1 = grp.key.groupby1, attribute1 = grp.sum(t => t.attribute1), newfieldwhat = ? newfieldby = ? }).orderby(a => a.groupby1).tolist(); this comment makes clearer: newfieldwhat = grp.first(t => t.newfieldwhat) gives me: "cannot convert 'string' 'bool'. newfieldwhat string" i think want: newfieldwhat = grp.first().newfieldwhat or, if want of group: newfieldwhat = string.join(",", grp.selec

html - Is it possible to re-size a div on window re-size without using JavaScript? -

i need set size of div, in case #panel-container , when viewport reach size of 450px in height. basically #panel-container should shrink user make smaller browser window leaving div visible within viewport. i know if possible achieve effect without using js , using css. aware of css media queries need re-sizing happening while user re-size window. i can use latest browsers , html5 , css3 features. ideas welcome. http://jsbin.com/jefibidizo/1/ window.app = { start: function() {} }; body { background-color: darkslateblue; } #header { position: fixed; top: 0; left: 0; width: 100%; height: 50px; background-color: dimgray; } #panel-wrapper { position: fixed; top: 50px; left: 0; height: 100%; background-color: moccasin; } #panel-container { width: 200px; height: 400px; overflow: auto; } <!doctype html> <html lang="en"> <head> <meta charset="utf-8&q