Posts

Showing posts from June, 2013

How can I send a batch job to PBS using a function in Shell? -

i can submit job pbs using both approaches of non-interactive batch jobs and/or interactive batch jobs. however, need use pbs commands in function. in other world need structure this: #!/bin/sh pbs_setup () { #pbs -l $1 #pbs -n $2 #pbs -q normal #pbs -a $user #pbs -m ae #pbs -m $user"@gmail.com" #pbs -q normal #pbs -l nodes=1:ppn=8 #pbs } pbs_setup "walltime=6:00:00" "step3"; echo " " echo "job started echo " " echo "job ended when submitting job not working. in fact final goal separating commands of job main body of code. when hpc changed edit shell file included function instead of editing shells. appreciate if...

mysql - PHP script which utilizes an SQL query returning false even though DB is updated -

i'm having trouble simple php script that's part of user registration system. upon entering user information in registration form, invoke following php: if ($db->isuserexisted($email)) { // user existed - error response $response["error"] = true; $response["error_msg"] = "user existed"; echo json_encode($response); } else { // store user $user = $db->storeuser($name, $email, $password); if ($user != false) { // user stored $response["error"] = false; $response["userid"] = $user["unique_id"]; $response["user"]["name"] = $user["name"]; $response["user"]["email"] = $user["email"]; $response["user"]["created_at"] = $user["created_at"]; ...

Google Maps API V3 Omnibox -

i attempting use google maps api v3 part of our system rebuild , want maps , feel standard google maps. have no issue displaying map want utilise standard google maps omnibox. i can find individual controls cannot find complete omnibox. given individual controls interact each other hoping use standard google maps omnibox make page standard google map. is available or need create 1 myself using individual controls? i don't think provide omnibox. still, think closest thing this: the places search box in places library. it nothing <input type="text"> , take advantages of places autocomplete api .

php - codeigniter: inserting value from array 1 to array 2? -

i have array this array 1 array(3) { [0]=> string(2) "47" [1]=> string(2) "48" [2]=> string(2) "49" } i have plan giving array name, array name number array 2 array(3) { [0]=> object(stdclass)#18 (2) { ["address"]=> string(9) "address 1" ["price"]=> string(16) "120000" } [1]=> object(stdclass)#21 (2) { ["address"]=> string(9) "address 2" ["price"]=> string(16) "150000" } [2]=> object(stdclass)#20 (2) { ["address"]=> string(9) "address 3" ["price"]=> string(16) "180000" } } i want inserting array 1 array 2 same array key i want insert array 1 data array 2 accordance key array . i expecting joined both of arrays , became joined array this array(3) { [0]=> object(stdclass)#18 (2) { ["address"]=> str...

javascript - json return array of objects , how to assign values to angular $scope varialbes? -

Image
i have 2 textbox name , description 2 separate error lables them. post create method returns error in json in array of objects , want filter messages , check if propertyname name show errormessage name textbox. <textarea id="txtdescription" ng-model="description" class="form-control"></textarea> <label ng-repeat="myerror in errors (want apply filter here propertyname 'description')" ng-model="description" ng-show="descriptionalert">{{myerror.errormessage}}</label> <textarea id="txtname" ng-model="name" class="form-control"></textarea> <label ng-repeat="myerror in errors (want apply filter here propertyname 'name')" ng-model="description" ng-show="descriptionalert">{{myerror.errormessage}}</label> .error(function (responsetext, status, error) { ...

winapi - CryptAcquireContext -- unresolved external -

i'm linking third-party library (poco c++) , getting following unresolved symbol errors linker. appears unable find "cryptacquirecontextw", "cryptreleasecontext", , "cryptgenrandom". according microsoft information here , these functions linkable using "advapi32.lib". i've added linker inputs symbols remain unresolved. 1>pocofoundationclr.lib(randomstream.obj) : error lnk2019: unresolved external symbol __imp__cryptacquirecontextw@20 referenced in function "public: virtual int __thiscall poco::randombuf::readfromdevice(char *,__int64)" (?readfromdevice@randombuf@poco@@uaehpad_j@z) 1>pocofoundationclr.lib(randomstream.obj) : error lnk2019: unresolved external symbol __imp__cryptreleasecontext@8 referenced in function "public: virtual int __thiscall poco::randombuf::readfromdevice(char *,__int64)" (?readfromdevice@randombuf@poco@@uaehpad_j@z) 1>pocofoundationclr.lib(randomstream.obj) : error lnk2019:...

javafx webengine - How to reload a page in DukeScript -

dukescript quite clever in way handle changes model code hot-swapped @ runtime, see example here . 1 thing doesn't seem handle @ runtime though changes html layout. given runs in webview, kind of browse, nice able reload page without having stop , restart app. so, i've tried adding "reload" button, can't find easy way after initialization: browserbuilder .newbrowser() .loadpage("pages/index.html") .loadclass(main.class). invoke("onpageload", args). showandwait(); showandwait() it's supposed do, doesn't return until browser closed. there doesn't seem way act on underlying instance of webview , thread. ha ha, simple effective solution: <a href="index.html">reload</a> note: toni epple says netbeans detect change, no reload needed.

python - Why is the urllib library not printing collected data? -

import urllib import re symbolslist = ["aapl", "spy", "goog","nflx"] symbol in symbolslist: url = "http://finance.yahoo.com/q?s=%s& ql=1"%(symbol) htmlfile = urllib.urlopen(url) htmltext = htmlfile.read() regex = <span id="yfs_184_%s">(.+?)</span> %(symbol.lower()) pattern = re.compile(regex) price = re.findall(pattern, htmltext) print price just trying extract stock data yahoo finance. syntax correct, prints blank square brackets instead of stock data in it. if knows problem i'd appreciate help. the span id has l84 , not 184 , fix , works. also, may want rid of space in url, , put single quotes around regex pattern regex = '<span id="yfs_l84_%s">(.+?)</span>' % symbol.lower() edit: can price (and more) yahoo in csv, , transfer far less data, example aapl: http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=snl1d1t1c...

c# - Deployed WCF Silverlight application returns 404 Error -

i have silverlight 5 web application host in iis 8. can run application fine in vs 2013 on deploying windows 2012 server running iis 8, app fails run. fiddler gives me following: description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. my web.config file shown below: <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <sectiongroup name="system.servicemodel"> <section name="domainservices" type="system.servicemodel.domainservices.hosting.domainservicessection, system.servicemodel.domainservices.hosting, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" allowdefinition="machinetoapplication" requirepermission="false" /> </sectiongroup> </configsections> <appsettings>...

firewall - NT_STATUS_ACCESS_DENIED Error in Samba share -

so, tried set public smb share samba on centos 7. now, have set up, , have headache. but, sweet victory. i'm posting here y'all don't need waste time. it's easy, need know hoops need jump through. i'll edit samba wiki. the first problem wouldn't connect @ all, except locally: remote connection (my linux desktop): ------- [root@my-desktop ~]# smbclient //sambaserver/publicdocs -n error connecting 192.168.100.97 (no route host) connection cgybkp01 failed (error nt_status_host_unreachable) on windows 8, using windows explorer, after typing "\\sambaserver" address bar, progress bar wait, wait, wait, time out. error message was: remote connection (my windows 8 desktop): windows cannot access \\sambaserver check spelling of name. otherwise, there might problem network. try identify , resolve network problems, click diagnose. this ended being problem firewalld. unblock samba, needed add line /etc/firewalld/zones/public.xml : <service name=...

ios - Does dispatch_group_wait allow cutting in line? -

this question grand central dispatch, , dispatch_group_wait() in particular. assume dispatch_group called group 10 tasks in waiting performed. elsewhere have task needs wait tasks in group finish before executes. make happen, use dispatch_group_wait(group, dispatch_time_forever) . to distinguish tasks in group i'll call lonelytask . if task gets added group while lonelytask waiting, gets executed first, lonelytask or task added group ? in other words, tasks added group while task waiting execute "cut in line" ahead of waiting task, or order in called maintained? i have searched documentation, haven't been able find answer question... group +/- counter (semaphore) fires each time reaches zero. unaware of tasks, because dispatch_group_async() wrapper enter()s group before task submission , enqueues new block call task's block , leave() group. that's all. groups may used without queues asynchronous retain-counters or sml that. so...

opencv - Reprojection matrix Q from Projection matrices P_left and P_right -

the reprojection matrix q (4 x 4) , disparity value (i.e pixel shift) typically needed generate point cloud coplanar stereo image pairs, as such. coplanar planes allow disparity search on same epipolar line. how can matrix q obtained or alternative route 3d reconstruction if individual projection matrices p (4 x 3) given ?

android - RecyclerView with LinearLayoutManager with header view that doesn't recycle -

i want listview style recyclerview header on top, , don't want header view recycled, ever. i'm totally new recyclerview , linearlayoutmanager think want shouldn't difficult extending linearlayoutmanager . additional info in case needed, think above enough: i have recyclerview header view @ position 0. part easy enough answers. view gets recycled, causing lots of issues edittext views in header (trying keep focus, restore focus, keep caret visible, not weird things auto-correct feature, keep typing while edittext technically gone/recycled, etc). simple solution not have view recycled, think possible custom layout manager, have no idea begin. i can't place header view above list, because want scroll list (it's tall fixed @ top of screen time). layoutmanager has layoutmanager#ignoreview(view) interface according documentation, flags view not scrapped or recycled. looks need here edit google devs commented ( here ) flag serving ot...

php - Query is not returning expected results -

i have table keep customers. , keep sales. when save keep selling customer id, , when show in list, show customer id the problem is, when looking sale not leave me alone of logged client shows me records $query = "select * ventas idusuario = $_session[k_username] union select * reparaciones marca '%" . $name . "%' or modelo '%" . $name ."%'" ; and this $query="select * ventas idusuario = $_session[k_username] marca '%" . $name . "%' or modelo '%" . $name ."%'"; but none of them works welcome so. i highly recommend research on sql injection , prepared statements . address question without accounting security vulnerabilities way have setup. your query strings not valid, try this: $query = "select * ventas idusuario = '". $_session['k_username'] ."' union select * repa...

ios - Passing UIImage from iPhone to Apple Watch results in nil response in watch -

Image
my watch needs request image containing app. in watch's controller, have: - (void)getorglogo { nsstring *host = mfainfo[@"host"]; nsdictionary *getorglogorequest = @{@"request":@"getorglogo", @"host":host}; [myinterfacecontroller openparentapplication:getorglogorequest reply:^(nsdictionary *replyinfo, nserror *error) { if (error) { ... } else if (replyinfo == nil) { // getting block!!! } else { uiimage *orglogo = replyinfo[@"orglogo"]; if (orglogo != nil) { [self.orglogoimageview setimage:orglogo]; } } }]; } in main app, send request server image, pass image watch: - (void)application:(uiapplication *)application handlewatchkitextensionrequest:(nsdictionary *)userinfo reply:(void (^)(nsdictionary *))reply { ... if ([[userinfo objectforkey:@"request"] isequaltostring:@"getorglogo...

windows phone 8 - Error APPX1706: creating winrt dll with xaml -

i built winrt(windows phone 8.1) dll page.xaml , app.xaml files. next, add reference winmd in wp8.1 application project. and following error: error appx1706: .winmd file 'project.winmd' contains type '?a0x32772d97.project_xamltypeinfo.xamlmetadataprovider' outside root namespace 'project'. make sure public types appear under common root namespace matches output file name. a winmd library regular library (dll) metadata information. these metadata information allow used different languages. can example, create winmd library in c# , use c++ or js application. since winmd library can used different languages, conforming windows runtime rules. your specific problem 1 of rules winmd files states classes must belong same root namespace. means if have following code: a.cs namespace foo { class { ... } } b.cs namespace foo.sub { class b { ... } } c.cs namespace bar { class c { ... } } d.cs namespace bar.sub { class d { ... } } the winmd link...

r - Simultaneous order, row-filter and column-select with data.table -

i trying multiple steps in 1 line in r select value data.table (dt) multiple criteria. for example: set.seed(123) dt <- data.table(id = rep(letters[1:2],2), time = rnorm(4), value = rnorm(4)*100) # id time value # 1: -0.56047565 12.92877 # 2: b -0.23017749 171.50650 # 3: 1.55870831 46.09162 # 4: b 0.07050839 -126.50612 # want select last (maximum time) value id == "a" # pseudo data.table code looks dt[order(time) & id == "a" & .n, value] # [1] 12.92877 46.09162 instead of getting 2 values want last value (which has higher time-value). if step-by-step works: dt <- dt[order(time) & id == "a"] dt[.n, value] # [1] 46.09162 bonus: how can order data.table without copying data.table: ie dt <- dt[order(time)] without <- . similar := -operator such in dt[, new_val := value*2] creates new variable without copying whole data.table. thank you, idea appreciated! ...

jquery - Find next sibling of the same element type -

this question has answer here: how select next matching element? 2 answers here form: <form> <input type="text" name="name" id="name"> <label>phone number *</label> <input type="number" name="phone" id="phone"> <label>email address *</label> <input type="email" name="email" id="email"> <h3>event</h3> <label>event type *</label> <input type="text" name="type" id="type"> <input type="text" name="address" id="address"> <input type="date" name="date" id="date"> </form> i have variable initialized first input element: var cur_input; i want loop through form elements, assig...

Create a Dynamic Query in Spring -

i have been using standard jpa implementation while , had no problems creating dynamic queries resulting algorithms search users in database. however, moving spring framework (an older version - 3.2, unfortunately) , cannot figure out how create dynamic query in spring. with javax.persistance.entitymanager , call createquery , give string work with. however, have found in spring can use following code define query in annotation. @repository @suppresswarnings("unused") public interface personrepository extends jparepository<person, long>, crudrepository<person, long> { @override list<person> findall(sort sort); @override list<person> findall(); @query("select p person p order p.lname asc, p.fname asc, p.mname asc") list<person> findallsort(); @query("select p person p upper(p.username) = upper(?1)") person findpersonbyusername(string username); } here simplest dynamic query exa...

C++ Previously allocated Array not reachable outside of class -

so working on table class in c++ worked fine far , acessing class calling [ ]-operator main function seems return wrong value array despite allocating first. the first call ( see line //first comment) returns correct value of 1 , while second call main func (see //second comment) returns arbitrary value despite having same memory adress , leading conclusion array(s) not correctly allocated (?) .output listed below: sumofallrows: 6 array:[1,2,3,4,5,6] first element of table: 1 first element of n=1-th row: 2 first element of n=2-th row: 4 created table 3 rows , size of 6 in internal representation! here @ n=1 0059f800,1 here @ n=2 0059f800,-858993460 template < typename t> class table{ public: int i, j; int numberofrows_; int sumofallrows = 0; int* lengthofrows_; ...

python - Indexing a numpy array with another array containing out of bounds values -

given following data array: d=np.array([10,11,12,13,14]) and indexing array: i=np.array([0, 2, 3, 6]) what way of indexing d i ( d[i] ) instead of index out of bounds error 6 , get: np.array([10, 12, 13]) maybe use i[i < d.size]] elements less length of d : print(d[i[i < d.size]]) [10 12 13]

c++ - VisualGDB Embedded Project Error -

i using visualgdb build emedded project using visual studioncommunity 2013. chose stm32f4xxxx device type. getting below error while doing, clean, build or rebuild error 6 error msb3073: command ""\visualgdb.exe" /rebuild "c:\mywork\experiments\embedded\embeddedproject1\embeddedproject2\embeddedproject2.vcxproj" "/solution:c:\mywork\experiments\embedded\embeddedproject1\embeddedproject1.sln" "/config:debug" "/platform:arm"" exited code 9009. c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v120\microsoft.makefile.targets 43 5 embeddedproject2 i had same error , problem had not beginning of path in makefile (i had ".../nameofthelib" , replace "c:/documents/...allmypath/nameofthelib" ) , works , can send project ssh.

linux - apache2 not loading php codes -

this index.php file worked fine until recently. server running ubuntu 15.04 i have tried complete reinstalling php5 , apache2 package. my index.php: http://gyazo.com/26fe168e7bf0695233f61d7d1eb29b47 instead of running include_once code totally ignores it... what view source website shows: http://gyazo.com/09606d26de4fd9002eb3265def95f52c help?? :( update: works fine in dreamweaver supposed to. think serverside problem. have not altered cause screw >.> error log pastebin.com/uzckuxyh html works fine self. php echo works. php_includes causing problems when add / file location (php include_once("/filename.php")) decides to: gyazo.com/9b530bc9383ab9be534b41e639920f0f doesnt show or run php codes. i assume if make simple "hello world" php page output empty, right? <?php echo "hello world!"; ?> does error message appears? has server ever printed phpinfo() , example? you try restart apache following command: s...

How to use JavaScript to Alter CSS for Multiple Elements -

i trying use javascript change background color of element after being selected, , make sure 1 element @ time has particular background color. once user selects on different element previous element selected replaced different background color. able toggle individual elements selecting on each element. need able select on element , apply new background color, have javascript change background color of active element different color (one less click). what trying similar modern navbars or list items 1 element @ time “active” , has background color different other elements in same div, row, etc. notes work utilizing bootstrap , have no desire use jquery particular project. css: <!doctype html> <html lang="en"> <head> <style> h4 { border: 1px solid black; border-radius: 8px; padding: 10px 2px 10px 2px; margin: 20px 20px 0px 20px; background-c...

Android - create a schema for my app that will open from a webpage link -

i'm trying create schema myapp://somthing/anotherthing if webpage or other app link schema open app. i've added androidmanifest.xml main activity: <activity android:name="com.example.mainactivity" android:label="@string/title_activity_main" android:configchanges="orientation" android:screenorientation="portrait" android:theme="@android:style/theme.light.notitlebar" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> <category android:name="android.intent.category.default" /> <data android:scheme="myapp" /> </intent-filter> </activity> but when click link in webpage that's linking myapp://somthing/anotherthing gives me page not found type of...

javascript - How do I force an html5 embedded video to finish playing? -

some background: web object in articulate presenter '13 course, loaded instance of mooodle lms. the 'web object' html file wrote, relevant part of written so: <video width="720" height="406" controls src="http://download.atsmedia.com/lms/pge/coub-sale.mp4" type="video/mp4"> <p>if reading this, because browser not support html5 video element.</p> </video> i've been avoiding javascript want keep cross-platform & cross-browser friendly possible. i'm looking simplest solution. if has additional info relating articulate presenter '13 (or moodle), i'm ears - goal there force video finish before learner can advance next slide. the goal there force video finish before learner can advance next slide. not using javascript in case like expecting pizza delivered without ordering 1 (and javascript not cross-platform issue). the way video element can tell browser env...

python - generate sequence by indices / one-hot encoding -

i have sequence s = [4,3,1,0,5] , num_classes = 6 , want generate numpy matrix m of shape (len(s), num_classes) m[i,j] = 1 if s[i] == j else 0 . is there such function in numpy, can pass s , num_classes ? this called 1-of-k or one-hot encoding. timeit results: def b(): m = np.zeros((len(s), num_classes)) m[np.arange(len(s)), s] = 1 return m in [57]: timeit.timeit(lambda: b(), number=1000) out[57]: 0.012787103652954102 in [61]: timeit.timeit(lambda: (np.array(s)[:,none]==np.arange(num_classes))+0, number=1000) out[61]: 0.018411874771118164 since want single 1 per row, can fancy-index using arange(len(s)) along first axis, , using s along second: s = [4,3,1,0,5] n = len(s) k = 6 m = np.zeros((n, k)) m[np.arange(n), s] = 1 m => array([[ 0., 0., 0., 0., 1., 0.], [ 0., 0., 0., 1., 0., 0.], [ 0., 1., 0., 0., 0., 0.], [ 1., 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0., 1.]]) m.nonzero() =...

javascript - jQuery - How to check if input contains only cyrillic letters -

i don't know how can check if input specific id contains cyrillic letters in it. i want simple jquery function check input cyrillic letters , when there cyrillic letters give alert everything cool :d , when there not cyrillic letters give alert we've got problem houston! . this simple example of want function. can please me out ? thanks in advance! you can use regexp like: /[а-яА-Я]/ here example: var str1 = "Привет"; var str2 = "hello"; var patt = /[а-яА-Я]/g; console.log( patt.test(str1) ); // log true console.log( patt.test(str2) ); // log false read regular expressions

javascript - Create a filtered power set in reverse order -

i'm not sure if need has name, it's pretty close power set. here's desire: input:[1,2,3,4] output: [1,2,3,4] [1,2,3] [1,2,4] [1,3,4] [1,2] [1,3] [1,4] this differs power set in 3 ways: all subsets include first value ( 1 ) the minimum size of subset 2 the order goes longest shortest my current solution create power set, filter out values don't start first value, , reverse sort. slow i'm looking better solution. from longest shortest, run test on each subset until find set returns true. makes me wonder if use generator don't have create values @ once (nice have, not necessary since max size ~25 members, or ~33mm sets). any appreciated! generating power set done using bit masks. consider set a = {1, 2, 3, 4} . define 4 element boolean vector , denote i . now, define b = { a[i] | i[i] = true } . there 2 things notice: b subset of a . by iterating on possible values of i can generate subsets a integer number's bits can used...

adobe - AEM pathfield appending values without changing -

Image
i have path field widget in aem error page handling. i have added @ base page implementation , when try , select path, see there "," appended path. if clear field , save, see old path still exists. if add new path, see new path appended old path saperated comma. fig 1: intially error pages coming good. fig 2: after clicking ok , checking properties again (note "," being appended) fig 3: after adding new path (again path appended after ",") has faced same issue. tried different forums wasn't able answers. same configuration working fine on local creating problem when push same code server. updated - dialog.xml - here i'm defining tab the error pages path field displayed <?xml version="1.0" encoding="utf-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primarytype="cq:dialog" height="400" stateful="false...

wpf - Issues with MouseDoubleClick command on TreeViewItem using AttachedProperties -

i trying attach command , commandparameter property treeviewitem can route mouse double click event command in viewmodel. appears double click event never fired. mousedoubleclick: namespace visualinspectionconsole.commands { public class mousedoubleclick { public static dependencyproperty commandproperty = dependencyproperty.registerattached( "command", typeof(icommand), typeof(mousedoubleclick), new uipropertymetadata(commandchanged)); public static dependencyproperty commandparameterproperty = dependencyproperty.registerattached( "commandparameter", typeof(object), typeof(mousedoubleclick), new uipropertymetadata(null)); public static void setcommand(dependencyobject target, icommand value) { target.setvalue(commandproperty, value); } ...

google spreadsheet - Is there a way to place two images within a single cell? -

Image
i can use like: =image("http://emojidictionary.emojifoundation.com/img/emoji43.jpg",1) to show sun single image. know can use '&' concatenate strings (like =c8&", "&d9 ) or use join or few other methods. i'd (and note doesn't work): =image("http://emojidictionary.emojifoundation.com/img/emoji43.jpg",1)&" + "&image("http://emojidictionary.emojifoundation.com/img/emoji444.jpg",1) to show sun '+' , sunglasses in same cell. is possible or cell restricted single image? at time it's not possible set 2 images in same cell concatenating result of 2 image functions, adding emojis directly in cell: you copy emojis web application includes feature insert them or copy them web page http://emojipedia.org/ .

python - Case-insensitive language-to-iso code? -

is there way simplify following: >>> pycountry.languages.get(name='english') traceback (most recent call last): file "<stdin>", line 1, in <module> file "/library/python/2.7/site-packages/pycountry/db.py", line 114, in return self.indices[field][value] keyerror: 'english' >>> pycountry.languages.get(name='english') traceback (most recent call last): file "<stdin>", line 1, in <module> file "/library/python/2.7/site-packages/pycountry/db.py", line 114, in return self.indices[field][value] keyerror: 'english' >>> pycountry.languages.get(name='english') <pycountry.db.language object @ 0x1096374d0> in above, 'english' item doesn't result in exception.

Selecting element (Polymer 1.0) -

i working on migrating polymer 1.0 here template: <template> <div class="scroll"> <div class="content"> <content></content> </div> <div class="bar bary"></div> </div> </template> the content gets filled text in main html file. i need scroll height of div. used do: height = $(this.shadowroot).find('.content')[0].scrollheight; but isn't working anymore: uncaught typeerror: cannot read property 'scrollheight' of undefined i tried adding id div, , selecting so: height = this.$.content.scrollheight; but giving me value of 0, though there lots of text in content. i calling code ready function. am selecting element correctly? <content> not contain component's contents, rather provides insertion point contents, siblings <content> element. elements inserted given <content> node,...

Ruby 2.2.2 ri documentation -

i'm starting learn ruby, installed ruby 2.2.2 via macports. understand ri documentation not install default, want generate it. read few questions/answers on , came this: gem install rdoc-data rdoc-data --install and told: your ruby version 2.2.2 not supported, 1.8.7, 1.9.2, 1.9.3, 2.0.0 how ri documentation 2.2.2? there method? if using version 2.0 or latest, , use ruby installer windows following: in command prompt , while in ruby installation folder, sufficient type gem install rdoc-data in command prompt. results generating rdocs in folder named doc in ruby installation folder. instead of browsing online check api or documentations, can conveniently open files in doc folder. know kind of against teaching of books , tutorials ruby, keep in mind generated api in hard-drive , not have use ri in command prompt. can have api open entire time while coding.

android - Can I rely on LogCat for sure -

i wordering if can trust logcat. question is: can rely on chronology of logcat? 100% sequentially? the logcat includes timestamp each message. should rely on if need things in temporal order.

c# - XML version-specific deserialization -

so, have base project , several modified version of it. baseproject contains class baseclass , namespace baseproject.someclasses{ public abstract class baseclass{ //... } } while each of versions contain several inheritors of baseclass - f.e. projectone : namespace baseproject.versionone.someclasses{ public class inheritorclass : baseclass{ //some logic here... } } and projecttwo : namespace baseproject.versiontwo.someclasses{ public class inheritorclass : baseclass{ //some different logic here... } } the thing differs name of namespace. base project loads each of assemblies during runtime , gets of inherited types. need create xml file, should contain both of inheritors' instances , pointers class instance should deserialized into: ... <baseclass xsi:type="inheritorclass"> <!-- versionone --> <propone></propone> <proptwo></proptwo> <propthree></propthree>...

simulink - Mathematical modelling in Matlab -

i new matlab , need perform simple task. have input function u(t)=2t-1 , output function y(t)=(-4/45)e^3t+ (1/5)e^(-2t)-1/3t-1/9 i have find corresponding behavior model, defined via transfer function , simulate behavior model in matlab/simulink. not sure approach should use. have done far transferred input , output function in s-domain , calculated transfer function. mean simulate behavior model in matlab? can please me? beginner. thank much! if you've done laplace transform , calculated transfer function in s-domain, think means applying transfer function arbitrary transient input , calculating response. the transfer function based on response due unit step function. if have input other unit step function (e.g. sinusoid), you'd calculate response follows: transform arbitrary input function s-space. multiply transfer function response in s-space. transform response in s-space time domain. this how laplace transforms work.

Ruby ActiveRecord: How to connect two rooms with an exit -

i making small text-adventure, , want use activerecord object relational mapping. what i'm having trouble with, understanding how connect 2 rooms using exit. following facts given: a room can have multiple exits an exit can in different directions (it has 'direction' field). also, might have other parameters such 'locked', etc. want add later. an exit connects 2 rooms. however, stuck: what have far class room < activerecord::base has_many :exits has_many :neighbours, through: :exits end class exit < activerecord::base belongs_to :room, dependent: :destroy belongs_to :room_dest, foreign_key: "room_dest_id", class_name: "room", dependent: :destroy end but incomplete. room.neighbours , example, not working @ all. what baffles me how make exits work two-ways: if add exit on 1 room, won't in room.exits list in other room. what works is: (given exit connecting room1 , room2 ) room1.first.exits.fir...

Laravel 5 required_if validation for radio buttons -

the laravel required_if validation doesn't seem work when have radio buttons. i have following rules: 'method' => 'required|in:email,url', 'email' => 'required_if:method,email'|'email', 'url' => 'required_if:method,url'|'url', in form have following: {!! form::radio('method', 'email', true ) !!} {!! form::radio('method', 'url', false ) !!} {!! form::text('email', null, ['maxlength' => '255', 'class' => 'form-control']) !!} {!! form::text('url', null, ['maxlength' => '1000', 'class' => 'form-control']) !!} but validation doesn't seem fire? my mistake - added apostrophes following: 'email' => 'required_if:method,email'|'email', 'url' => 'required_if:method,url'|'url', should be: 'email' => ...

How can I use lookbehind in a C# Regex in order to remove line breaks? -

i have text file repetitve structure header , detail records such as stopservice:: 697::12::test::20::a@yahoo.com::20 main rd::alcatraz::ca::1200::please send me information a@gmail.com::0:::: i want remove line break between header , detail record process them single record, detail record can contain line breaks need remove line breaks follow directly :: sign. i'm not pro when using regular expressions searched , tried use approach doesn't work: string text = file.readalltext(path); regex.replace(text, @"(?<=(:))(?!\1):\n", string.empty); file.writealltext(path, text); i tried this: regex.replace(text, @"(?<=::)\n", string.empty); any idea how can use regex look-behind in case? output should this: stopservice::697::12::test::20::a@yahoo.com::20 main rd::alcatraz::ca::1200::please send me information a@gmail.com::0:::: non-regex way read file line line. check first line , if equal stopservice:: not add newline ( ...

ipython notebook - Jupyter: how to make simple illustrations -

i learning use jupyter/ipython notebook electronic notebook. need simple illustrations go along calculations, e.g. arrows represent vector quantities. that's kind of illustration tikz used if in latex. having tried tikz magic extension , failed, wonder if there's more native (python) way this. don't see matplotlib right tool sort of thing (correct me if i'm wrong). if think tikz magic indeed way go , should try work, so. thanks. tikz (prefered solution) if you're familiar tikz respective magic best option. use it, clone this repo .ipython/extensions directory , load extension shown in example notebook %load_ext tikzmagic . tried ipython 3.1 , works fine. of course have have pdflatex available. matplotlib if want draw simple arrows matplotlib can used , is, of course, more pythonic tikz. simple example based on this example like import matplotlib.pyplot plt %matplotlib inline plt.axis('off') plt.arrow(0, 0, 0.5, 0.5, head_width=0.0...

php - USort Multi Index Array - Doesn't Return Correctly -

i'm having trouble phps usort() function. have multi-indexed array looks this: array ( [0] => array ( [0] => array ( [title] => c [more_fields] => '...' ) [1] => array ( [title] => [more_fields] => '...' ) [2] => array ( [title] => b [more_fields] => '...' ) [3] => array ( [title] => xz [more_fields] => '...' ) ) ) i'm trying loop through array , sort each index title index. here's code without of test inputs: foreach( $my_arr $arr ) { if( count( $arr ) > 1 ) { usort( $arr, function( $a, $b ) { return strcasecmp(...

In C#, what is the simplest way to calculate "trend" given a current and previous status? -

i have variable show rag status (red, amber, green) on project var previousstatus = "r" var currentstatus = "a" and trying calculate "trend" sometihng like var trend = calculatetrend(previous, current) i trying find more elegant solution than if (prev == current) return "stable"; if (prev == "r" && (current == "g" ||current == "a")) return "improving"; if (prev == "g" && (current == "r" ||current == "a")) return "declining"; if (prev == "a" && current == "g") return "improving"; if (prev == "a" && current == "r") return "declining"; any suggestion on "cleaner" solution. create enum integer value each status. public enum status { ...

java - Border with rounded corners -

here have small piece of code getting rectangular box using awt.but want border should rounded corner.can please suggest me? int width = 150; int height = 50; bufferedimage bufferedimage = new bufferedimage(width, height, bufferedimage.type_int_rgb); graphics2d g2d = bufferedimage.creategraphics(); font font = new font("georgia", font.bold, 18); g2d.setfont(font); renderinghints rh = new renderinghints( renderinghints.key_antialiasing, renderinghints.value_antialias_on); rh.put(renderinghints.key_rendering, renderinghints.value_render_quality); g2d.setrenderinghints(rh); gradientpaint gp = new gradientpaint(0, 0, color.decode("#24777d"), 0, height / 2, color.decode("#008080"), true); g2d.setpaint(gp); g2d.fillrect(0, 0, width, height); g2d.setcolor(new color(255, 255, ...

python - Why is S == S[::-1] faster than looping? -

why pythonic way of checking if string, s , palindrome -- s == s[::-1] -- faster following implementation? i = 0 j = len(s) - 1 while < j: if s[i] != s[j]: return false += 1 j -= 1 return true because python code compiled bytecode, interpreted. that's going lot slower creating new reversed string in c code, comparing string string more c code. note both algorithms o(n) complexity; python code executes @ 1/2 n iterations, , string reversal version makes @ 2 n iterations, asymptotically speaking doesn't make difference. since both algorithms o(n) linear approaches, matters constant cost, how time each iteration takes. fixed cost vastly lower s == s[::-1] .

r - data.table assignment by reference within function -

this question has answer here: using data.table package inside own package 2 answers i have (big-ish) data.table . , want same thing many of columns. say, dt <- data.table( ltr = letters[1:5] ) func <- function( dt ){ cols <- colnames( dt ) # columns apply op dt[ , (cols) := lapply( .sd, toupper ), .sdcols = cols ] return( dt ) } the function func converts characters upper case columns. try func( dt ) i error error in `:=`((cols), lapply(.sd, toupper)) : check is.data.table(dt) == true. otherwise, := , `:=`(...) defined use in j, once , in particular ways. see help(":="). i'm still not sure causes error , have read help(":=") , faqs , other (so) sources. help? note: should have given more details context. func function written in package. makes difference the short answer make sure package data.ta...