Posts

Showing posts from March, 2010

java - How to make a list of JLabel's act as a button group? -

Image
as can see in picture characters selected want differently. want act radio button, example when click 1 character other characters should deselected. you can use if statement disable or make rest of labels invisible 1 of them selected.

c - SSH execute commands remotely -

i trying ssh remote server , execute simple command. using libssh library , following code, ssh_key pkey; ssh_session session; ssh_channel channel; int rc = ssh_pki_import_privkey_file(pc_private_key_file, null, null, null, &pkey); char buffer[1024]; unsigned int nbytes; printf("session...\n"); session = ssh_new(); if (session == null) exit(-1); ssh_options_set(session, ssh_options_host, pc_host); ssh_options_set(session, ssh_options_user, pc_user); ssh_options_set(session, ssh_options_port, &pc_port); ssh_options_set(session, ssh_options_log_verbosity, &pc_verbosity); printf("connecting...\n"); rc = ssh_connect(session); if (rc != ssh_ok) error(session); printf("channel...\n"); channel = ssh_channel_new(session); if (channel == null) exit(-1); printf("opening...\n"); rc = ssh_channel_open_session(channel); if (rc != ssh_ok) error(session); printf("executing remote command...\n"); rc = ssh_channel_request_exec(ch

Load data into extended Bootstrap table with colspan -

excuse me, using this make table. 1 table header have property, colspan="6" . however, how can load data table? note. table structure is: <tr> <th colspan="6" class="col-xs-4" data-field="status" data-sortable="true">status</th> </tr> note. way load data bootstrap table is: $("#table").bootstraptable({data: data}); bootstrap-table not support rowspan , colspan header temporarily. more info : https://github.com/wenzhixin/bootstrap-table/issues/182 alternatively, can try below solution $('#table').bootstraptable({ columns: [{ field: 'id', title: 'item id' }, { field: 'name', title: 'item name' }, { field: 'price', title: 'item price' }, { field: 'color', title: 'item color' }, { f

angular - Error occuring while reading json file in angular2 -

i trying read config.json file in angular2 service below- load() { return new promise((resolve, reject) => { this.http.get('./config.json') .map(res => res.json()) .subscribe((env_data) => { console.log('env_data: ' + env_data); this._env = env_data; }); } this contains list of key , value pairs of application configuration settings. structure of config.json file this- { "env": "development" } but, on calling load method of angular2 service, receiving below error- core.umd.js:3462 exception: unexpected token < in json @ position 0errorhandler.handleerror @ core.umd.js:3462next @ core.umd.js:6924schedulerfn @ core.umd.js:6172safesubscriber.__tryorunsub @ subscriber.ts:238safesubscriber.next @ subscriber.ts:190subscriber._next @ subscriber.ts:135subscriber.next @ subscriber.ts:95subject.next @ subject.ts:61eventemitter.emit @ core.umd.js:6164

php - Call to a member function lists() on null in laravel 5.3 -

in laravel 5.3, trying edit registered users in users page (admin/users) , assign roles , permissions them. used codes laravel 5.2 pdf book. anytime click on user edit it. brings below error fatalthrowableerror in userscontroller.php line 26: call member function lists() on null. public function edit($id) { $user = user::whereid($id)->firstorfail(); $roles = role::all(); $selectedroles = $user->roles->lists('id')->toarray(); return view('backend.users.edit', compact('user', 'roles', 'selectedroles')); } the lists() function has been discontinued since laravel 5.3. should use pluck instead. $selectedroles = $user->roles->pluck('id'); regarding error: must not having roles particular user, hence error.

javascript - Passing a value to bundled React JS file? -

i wonder if possible pass argument react entry point. my entry point looks this: module.exports = { entry: "./js/components/application.js", output: { path: "./dist", filename: "bundle.js" }, // ... } my application.js: import react 'react'; import reactdom 'react-dom'; import anothercomponent './anothercomponent'; reactdom.render(<anothercomponent />, document.getelementbyid('content')); not bundle application webpack , include bundle in application. application provides div id "content": <body> <div id="content"></div> <script src="bundle.js" /> </body> i know can <script src="bundle.js" myargument="somevalue" /> but how can value passing react component anothercomponent property? what about <script id="bundle" src="bundle.js" myargumen

python - UUID Field in django behave weired at mysql -

i have django model looks following class cdrbybusinessflowid(models.model): id = models.uuidfield(primary_key=true, default=uuid.uuid4, editable=false) cc_id = models.integerfield() business_flow_id = models.charfield(max_length=255, blank=true) status = models.charfield(max_length=10, blank=true) i have created model model api response following { "status": "pending", "business_flow_id": "13630f30-bfed-4e8d-bdbd-263d0da75175", "id": "3c337f4c-3236-4117-b519-c57fbcc001f8", "cc_id": "1610" } but unfortunately id doesn't exist in database. the value modified other value 1f604e31a4054d1e998b97433cc661a5 . thanks

excel - "File Format Is Not Valid" error while trying to export xlsx file from data table -

excel gives me error: excel cannot open file .xlsx because file format or file extension not valid . here code: response.appendheader("content-type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") response.appendheader("content-disposition", "attachment; filename=excel.xlsx") response.contentencoding = encoding.unicode response.binarywrite(encoding.unicode.getpreamble) response.write(x.tostring) response.end() i believe should this. private sub datatabletoexcel(byval dttemp datatable) dim _excel new microsoft.office.interop.excel.application dim wbook microsoft.office.interop.excel.workbook dim wsheet microsoft.office.interop.excel.worksheet wbook = _excel.workbooks.add() wsheet = wbook.activesheet() dim dt system.data.datatable = dttemp dim dc system.data.datacolumn dim dr system.data.datarow

typescript - Property 'ChildBrowser' does not exist on type -

migrate hybrid mobile project js typescript , got error in console during compilation error ts2339: property 'childbrowser' not exist on type '{ pushnotification: pushnotification; } this code window.plugins.childbrowser.showwebpage(text, { showlocationbar: true, showaddress: true, shownavigationbar: true }); } but webstorm doesn't highlight error in row. i created own d.ts file, contains code (bellow) , include file ts file interface window { plugins: plugins; pushnotification: pushnotification; } interface pushnotification{ emailcomposer: emailcomposer; childbrowser: childbrowser; socialsharing: socialsharing; } interface childbrowser{ showwebpage: any; } interface socialsharing { } interface emailcomposer{ showemailcomposerwithcallback(fu: any, ... fu2: any[]): any; } interface plugins { emailcomposer: emailcomposer; childbrowser: childbrowser; socialsharing: socialsharing; }

r - Finding the K closest points of a vector to a separate point in Rstudio -

say have vector x consisting of points such (1,4,5,6,3,2,5,7,8,44,3,7) , need want find k=2 points of closest 6.4 meaning 6 , 7 there function in , if not best way in r? to make function then, fun1 <- function(vec, val, k){ vec[order(abs(vec-val))][seq_len(k)] } fun1(x, 6.4, 2) #[1] 6 7 fun1(x, 6.4, 3) #[1] 6 7 7 fun1(x, 5, 4) #[1] 5 5 4 6 to unique values add unique , fun1 <- function(vec, val, k){ unique(vec[order(abs(vec-val))])[seq_len(k)] } fun1(x, 6.4, 3) #[1] 6 7 5

java - Drawing program: Keep getting errors and I can't figure out why -

i having trouble figuring out wrong code can give me pointers? error message getting : error:(122, 74) java: incompatible types: java.awt.point cannot converted double error:(119, 74) java: incompatible types: java.awt.point cannot converted double error:(112, 23) java: cannot find symbol symbol: method draw(java.awt.graphics) location: variable drawcircle of type javafx.scene.shape.circle import javafx.scene.shape.circle; import javax.swing.*; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.mouseevent; import java.awt.event.mousemotionlistener; import java.util.arraylist; import java.util.iterator; /** * michael vanklompenberg * date: 11/5/2016. * cis 117 java programming 1 * description: */ public class drawingprogram { public static void main(string[] args) { drawingframe f = new drawingframe(); f.settitle("drawing program"); f.setsize(462, 312); f.setlo

opc ua - Is OPC server allowed to use source timestamp in its logic? -

or put in other words -- source timestamp used client reporting purposes? the case wonder -- client writes variable source timestamp set. , later client b writes same variable source timestamp older 1 client (for whatever reason). now -- server allowed reject write b because both source timestamps not null , clear chronological order broken, or server not allowed such thing (i.e. server has accept newer writes come)? you can this, camille said you'll find support writing other value in own custom server. there's no statuscode make clear clients why write failed, supplement returned statuscode information in diagnosticinfo , assuming client requested one.

r - calculate daily averages for 3d array -

is possible perform daily averaging on 3d array in r? for example: i have 3d array of data points on lat/lon grid 2 days. lat <- 50:51 lon <- 2:3 time <- as.posixct(c('2009-01-01 12:00','2009-01-01 15:00','2009-01-01 17:00','2009-01-02 12:00', '2009-01-02 16:00')) j <- array(c(1:6, 11:16, 21:26), c(2,2,5)) dim(j) [1] 2 2 5 where first dimension refers latitude, second refers longitude, , third refers time (i.e. data @ each lat/lon through time). how calculate daily averages of these values , return daily averaged 3d array? the return array should have dimensions of dim(j) [1] 2 2 2 where time dimensions correspond to: new_time <- as.posixct(c('2009-01-01','2009-01-02)) is possible? without taking account different days, can perform 3d averaging with: apply(j, c(1,2), mean) but i'm unsure on how perform averaging on selected days. any appreciated.

javascript - How to fill array inm loop JS? -

i have following array: var pageviews = [ [1, randvalue()], [2, randvalue()], [3, randvalue()], ]; this array filled staticly. how can fill in loop? i tried: $.each(data, function(k, v) { pageviews.push([num, v["value"]]); }) but gives me different result please try: var data = {a:"hii", b:"bbye"}, // dummy data pageviews = []; $.each(data, function(key,val){ var temp = []; temp.push(key,val) pageviews.push(temp); }); //output, pageviews = [["a","hii"],["b","bbye"]] if want index number define separate counter variable as: var data = {a:"hii", b:"bbye"}, // dummy data pageviews = [], counter = 1; $.each(data, function(key,val){ var temp = []; temp.push(counter++,val) pageviews.push(temp); }); //output, pageviews = [[1,"hii"],[2,"bbye"]]

android - The 'destination' param cannot be set to your own account. Stripe -

i create manage account . , create test account send payment it. want payment managed account application fee it. , send remaining of payment test account . stripe.apikey = "sk_test_..."; map<string, object> chargeparams = new hashmap<string, object>(); chargeparams.put("amount", 1000); chargeparams.put("currency", "usd"); chargeparams.put("source", {token}); chargeparams.put("destination", {connected_stripe_account_id}); charge.create(chargeparams); but exception "the 'destination' param cannot set own account". dont know make mistake. you should not creating charges directly android app. the part of payment flow takes place directly in mobile app collection , tokenization of customer's payment information, through use of stripe's android sdk . done publishable api key. all other operations require use of secret api key, should never embedded or shared in way mobi

css - AspNet Set Focus() works but :focus style's not apply -

when value insert in textbox focus specific button on page. wrote this: private sub calcolaimporto() handles txtqnt.textchanged try //some code btnadd.focus() catch ex exception m_writelogeventi(methodinfo.getcurrentmethod().name, "si è verificato un errore:", ex.tostring(), loglivello.errore,,, true) end try end sub in fact onfocus because if press enter instruction of button stars. this scss rule &.action { background-color: $verde; text-transform: uppercase; &:hover { background-color: lighten($verde,10%); } &:focus { -webkit-box-shadow: 0 0 9px 0 $verde; box-shadow: 0 0 9px 0 $verde; background-color: lighten($verde,10%) !important; } } however style defined in css (: focus) not applied. why? make clear user button focused do try these code: button:focus { background: pink; }

css - CSS3 Marquee Effect -

i'm creating marquee effect css3 animation. here codes. html tag: <div id="caption"> quick brown fox jumps on lazy dog. quick brown fox jumps on lazy dog. quick brown fox jumps on lazy dog. </div> css: #caption { position: fixed; bottom: 0; left: 0; font-size: 20px; line-height: 30px; height:30px; width: 100%; white-space: nowrap; -moz-animation: caption 50s linear 0s infinite; -webkit-animation: caption 50s linear 0s infinite; } @-moz-keyframes caption { 0% { margin-left:120%; } 100% { margin-left:-4200px; } } @-webkit-keyframes caption { 0% { margin-left:120%; } 100% { margin-left:-4200px; } } now can basic marquee effect, codes not wise enough. i wonder if there way avoid using specific values margin-left:-4200px; , can adapt text in length. also, doesn't perform smoothly in firefox , safari, performs in chrome. here similar demo: http://jsfiddle.net/jonathansampson/xxuxd/ , uses text-i

java - Encoding/Decoding using ESAPI -

i trying prevent crlf injection(in url having few user inputs) , trying encode user input present in url. know can use input-validation if use esapi encoder, have corresponding decoder? if has is? if not can done perform same encoding , decoding? as alluded to, task input validation. esapi encoders output encoding. there no corresponding decoders because decoding process (to render safe html) done via end user's browsers.

gulp-image-optimization build gives error -

my node , npm vesrions below node v6.9.1 npm v3.10.9 my code 'use strict'; const gulp = require('gulp'); const imageop = require('gulp-image-optimization'); let dir = { srcimages: 'public/wps/source/images', build: 'public/wps/build/' }; const config = { src: dir.srcimages + '/**/*', dest: dir.build + 'images/' }; gulp.task('img-prod', function (cb) { gulp.src(config.src).pipe(imageop({ optimizationlevel: 5, progressive: true, interlaced: true })).pipe(gulp.dest(config.dest)).on('end', cb).on('error', cb); }); when gulp build throws error internal/child_process.js:289 var err = this._handle.spawn(options); ^ typeerror: bad argument @ typeerror (native) @ childprocess.spawn (internal/child_process.js:289:26) @ exports.spawn (child_process.js:380:9) @ imagemin._optimizejpeg (/us

Keep Android service aware, not awake -

i have service (for detecting incoming , outgoing calls) user can start , stop in application; service can start when device restarted. now i'm running on situation service not "awake" when device asleep; , when call received service not yet awake handle incoming call. my question how make service aware of condition without keeping wakelock it? if wakelock way solve this, should best implementation it? add in manifest: <uses-permission android:name="android.permission.wake_lock"/> now in service: powermanager powermanager; powermanager.wakelock wakelock; @override public void oncreate() { super.oncreate(); powermanager = (powermanager) getsystemservice(power_service); wakelock = powermanager.newwakelock(powermanager.partial_wake_lock, "notify"); } now, @override public int onstartcommand(intent intent, int flags, int startid) { wakelock.acquire(); handleservice(inte

Shall I keep excel workbook connection open in C# or open a new one every time I need to add a new row? -

i have implemented download utility downloads files in background thread.now, want implement functionality export download results each file excel sheet. using microsoft.office.interop.excel library purpose.so, create excel workbook, , entries in it.my issue whether open workbook @ start of download process, , close workbook when process finished or shall create new excel connection every time want entry? please, note downloads can take lot of time. something bear in mind interop usage creating excel.exe process in background , using dcom manipulate running process. typically, means when open file first time , excel not running, take time load. therefore suggest keeping file open in background if going doing incremental updates. also remember interops hardcoded version of office targetting , require office installed function. personally, use 3rd party libraries excel manipulation more performant interop assemblies , don't have hard-dependency of needing office

android - Get random numbers again and again if answer given by user is wrong -

i developing simple dialog box has 2 textviews 1 edittext , 1 submit button. want put random numbers in 2 textviews , multiply them. user has give correct answer finish application. if failed again next random numbers generated , on until user gives right answer. i have manage work when user gives wrong answer unable generate next 2 random numbers , on. code dialog box is: final textview t1 = (textview)dialog1.findviewbyid(r.id.textview2); final textview t2= (textview)dialog1.findviewbyid(r.id.textview); final edittext edittext = (edittext) dialog1.findviewbyid(r.id.edit1); textview submit = (textview)dialog1.findviewbyid(r.id.submit); final int number = (new random().nextint(100)); final int number1 = (new random().nextint(100)); t1.settext(string.valueof(number)); t2.settext(string.valueof(number1)); submit.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string = edittext.gettext().tostring(); if (integer.pars

scroll - Search bar should be fixed while scrolling down -

actually, in page search bar present search something. whenever i'm scrolling down should fixed , whenever i'm doing scrolling down should go default state. attached screenshot easy reference. enter image description here

wxpython frame crashes on closing in 64 bit version of python 2.7 but is fine in 32 bit -

i building gui application run database using wxpython 3 python 2.7. when run application 32bit python runs without problem. however, when looked run same code in 64bit works application crashes out during closing frame. occurs both have intercepted close event or not. is there special 64 bit version needs done avoid instability?

python - Django: How to write a clean method for a field that allows mutiple file uploads? -

i have form uploading images. if follow django's standard cleaning specific field attribute of form , clean method typically like: class uploadimagesform(forms.form): image = forms.filefield() def clean_image(self): file = self.cleaned_data['image'] if file: if file._size > 15*1024*1024: raise forms.validationerror("image file large ( > 15mb ).") return file else: raise forms.validationerror("could not read uploaded file.") however, i'm using form allows multiple images uploaded @ once, through same widget (ie, user can shift+click select several files on file browser) . whenever need access files in view or in handler, use request.files.getlist('images') in loop. how hell write clean method field?? i'm lost. here's form looks like. class uploadimagesform(forms.form): images = forms.filefield(widget=forms.clearablefileinput(at

vba - activating a MailMerge from excel -

i still quite new vba, best come on own. used macro recorder in word vba code mailmerge excel spreadsheet, , tied key binding ("^%o"). use sendkeys excel activate mailmerge. here relevant excel code open word , activate mailmerge. need find "dear" , insert field recipients name excel. ^f through {right} sendkeys. again better way make happen, new know how yet. have excel sendkeys word "^%o" activating mailmerge. have sleeps there slow down code hoping find messing up. ' open word doc. run macro import mailing list / send emails. set wordapp = createobject("word.application") wordapp.documents.open filename:="path word doc" wordapp.visible = true sleep 10000 appactivate "word doc" sleep 500 sendkeys "^f", true sleep 500 sendkeys "dear", true sleep 500 sendkeys "~", true sleep 500 sendkeys "{escape}", true sleep 500 sendkeys "{right}", true sleep 500 sendkeys "{

qt - Installing Shiboken (PySide) with MinGW-w64 -

config: windows 10 x64; python 3.4; qt 4.8.7; mingw-w64. added path environment variable. checking gcc --version return built mingw-w64 project . i'm trying install shiboken using pip command pip install --global-option="--make-spec=mingw" shiboken , compile error: c:\users\***\appdata\local\temp\pip-build-rkadq90f\shiboken\sources\shiboken\libshiboken\basewrapper.cpp: in function 'py_hash_t shiboken::object::hash(pyobject*)': c:\users\***\appdata\local\temp\pip-build-rkadq90f\shiboken\sources\shiboken\libshiboken\basewrapper.cpp:773:45: error: cast 'pyobject* {aka _object*}' 'py_hash_t {aka int}' loses precision [-fpermissive] return reinterpret_cast<py_hash_t>(pyobj); ^ error: error compiling shiboken i same error when shiboken compile inside pyside package: c:\users\***\appdata\local\temp\pip-build-nni84yht\pyside\sources\shiboken\libshiboken\basewrapper.cpp: in function 'py_hash_t s

python - Separate tuple from a nested list into a separate list -

i need separate tuple based on value nested dictionary below , put in list. want separate tuple values 'bb' original_list= [[('aa','1'),('bb','2')],[('cc','3'),('bb','4')],[('dd','5'),('dd','6')]] i need 2 lists below, final_list= [[('aa','1')],[('cc','3')],[('dd','5'),('dd','6')]] deleted_list = [[('bb','2')],[('bb','4')]] i used following recursive code, def remove_items(lst, item): r = [] in lst: if isinstance(i, list): r.append(remove_items(i, item)) elif item not in i: r.append(i) return r it produce result list after deleting value. there way list deleted values? >>> def remove_items(lst, item): ... r = [] ... d = [] ... in lst: ... if isinstance(i, list): ... r_tmp

Find pseudo elements in protractor -

Image
i new protractor. working on clicking on download icon pseudo element. how element? please me. use ng-click : $('[ng-click="bulkimp.downloadbulkexportfile(item,false)]').click();

javascript - Modified file (.js, .css) not update changes -

using visual studio 2015 working fine problem is, if modify javascript or css file changes not build (shown). these files linked .aspx file own folder. please me it files cached. load page , hit ctrl , f5 together, should force reload of resources. if that's not working, make sure in properties of files, set content copy them on build.

object - how to order triangles when exporting obj -

i'm trying export mesh obj unity , found 2 script way export triangles quite different , understand reason each 1 of them: first: foreach(vector3 lv in m.vertices) { vector3 wv = mf.transform.transformpoint(lv); //this sort of ugly - inverting x-component since we're in //a different coordinate system "everyone" "used to". sb.append(string.format("v {0} {1} {2}\n",-wv.x,wv.y,wv.z)); } foreach(vector3 lv in m.normals) { vector3 wv = mf.transform.transformdirection(lv); sb.append} (int i=0;i<triangles.length;i+=3) { //because inverted x-component, needed alter triangle winding. sb.append(string.format("f {1}/{1}/{1} {0}/{0}/{0} {2}/{2}/{2}\n", triangles[i]+1 + vertexoffset, triangles[i+1]+1 + normaloffset, triangles[i+2]+1 + uvoffset)); }

c# - Cyrillic symbols in HttpClient POST request for upload filename -

in 1 of .net applications i've go method uploads file site via httpclient . here implementation using (var clienthandler = new httpclienthandler { cookiecontainer = cookiecontainer, usedefaultcredentials = true }) { using (var client = new httpclient(clienthandler)) { client.baseaddress = requestaddress; client.defaultrequestheaders.accept.clear(); using (var content = new multipartformdatacontent()) { var streamcontent = new streamcontent(new memorystream(filedata)); streamcontent.headers.contentdisposition = contentdispositionheadervalue.parse("form-data"); streamcontent.headers.contentdisposition.parameters.add(new namevalueheadervalue("name", "contentfile")); streamcontent.headers.contentdisposition.parameters.add(new na

actionscript 3 - Looking for a way to stop ALL movieclips -

i have project lot of symbols each playing @ times. command stop symbols playing without having add mc.stop(); every single one. i have tried generic stop(); doesnt work know anyway this? you have search of existing child's of container, check if that's movieclip stop time-line for example call movieclipstopall(this) following function function movieclipstopchilds(container:displayobjectcontainer):void { (var i:uint = 0; < container.numchildren; i++) if (container.getchildat(i) movieclip) (container.getchildat(i) movieclip).stop(); } edit: following function stop inner child movieclips function movieclipstopall(container:displayobjectcontainer):void { (var i:uint = 0; < container.numchildren; i++) if (container.getchildat(i) movieclip) { (container.getchildat(i) movieclip).stop(); movieclipstopall(container.getchildat(i)); } }

How to display item in multiple column with ArrayAdapter in Android -

i have item list view consist image,text , button.i trying display item in 2 column , multiple rows.i using custom adapter achieve unfortunately item come in single column only.please see wireframe more clarity question. wireframe layout you should use recyclerview gridlayourmanager . final int rowscount = 2; gridlayoutmanager manager = new gridlayoutmanager(getcontext(), rowscount, gridlayoutmanager.vertical, false); recyclewview.setlayoutmanager(manager); here recycleview docs

javascript - AJAX-Request: Access-Control-Allow-Header doesn't allow X-CSRFToken -

Image
i've got little question on ajax-request. in code want access php-script 'grabs' content via ajax-call. can see jquery-code below: <div id="ajaxcontent"></div> <script type='text/javascript' src='http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script> <script> jquery(document).ready(function($){ $.ajax({ url: "http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/contentgrabber/contentgrabber.php", type: 'get', data: "page_id=73&ajax=1", crossdomain: true, success: function(data){ $("#ajaxcontent").html(data); } }); }); </script> the url works fine, clicking onto, show's me stuff want load. problem is, following 2 errors: somehow server doesn't seem allow kind of x-csrftoken. unfortunatelly have no great experience kind of requests, think more has change

objective c - Change highlight color of NSTableView selected row -

how change nstable selected row background color? here answer , uitable view . for now,what see can change selected hilight style : mytable.selectionhighlightstyle = nstableviewselectionhighlightstyle.regular; but here 3 options; none = -1l, regular, sourcelist i have tried following solution : patientlistdelegate.selectionchanged += (o, e) => { var r = patienttableview.selectedrow; var v = patienttableview.getrowview (r, false); v.emphasized = false; }; it works , if minimize , open application again , still shows blue color i found answer in objective-c change selection color on view-based nstableview here c# implementation: inside delegate : public override nstablerowview coregetrowview (nstableview tableview, nint row) { var rowview = tableview.makeview ("row", this); if (rowview == null) {

Get search engine results in multiple filetypes -

i want search engines results in multiple content types, example want google result filetypes mp3 , wav , ogg my_keyword , 1 type can type following phrase in google search box *my_keyword* filetype:mp3 this work correctly don't know how can multiple filetypes i tried *my_keyword* filetype:mp3,ogg *my_keyword* filetype:(mp3 | ogg) *my_keyword* filetype:mp3 | ogg *my_keyword* filetype:mp3 or oggg but failed. in google can use filetype:mp3 or filetype:ogg

elm - Json.Decode.Pipeline trouble with optional -

i'm having trouble decoding optional fields json string. trying decode "plannings" , planning can of 2 types, normal planning, or flex planning. if normal planning, have planning_id , if flex planning, have flexplanning_id . in record in store plannings, both planningid , fiexplanningid of type maybe int . type alias planning = { time : string , planningid : maybe int , groupid : int , groupname : string , flex : bool , flexplanningid : maybe int , employeetimeslotid : maybe int , employeeid : int } and here decoder use: planningdecoder : decoder planning planningdecoder = decode planning |> required "time" string |> optional "planning_id" (nullable int) nothing |> required "group_id" int |> required "group_name" string |> required "flex" bool |> optional "employee_timeslot_id" (nullable int) noth

android - Cannot add View To the relative Layout -

i making activity takes int position activity class formula have formula, variables , title , want create activity taking formula , setting title , making edit text views variables user add values them , return result dialogue problem views add programitically not displayed, plz help public class displayfomula extends appcompatactivity { @targetapi(build.version_codes.jelly_bean_mr1) @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_display_fomula); db db = new db(this); bundle = getintent().getextras(); int pos = extra.getint("id"); final formula form = db.getformula(pos); relativelayout layout=new relativelayout(this); textview tw1 =(textview) findviewbyid(r.id.textview11); tw1.settext(form.title); final string[] var = form.var; int i=0; final edittext[] ed = new edittext[50]; for(;i<var.length;i++){ relativelayout.layout

c - YouCompleteMe(YCM) doesnt suggest any formats (C11) -

Image
i'm trying setup ycm utilize autocompletion in c. followed instruction described in manaul.(:help youcompleteme) doen't show autocompletion list me. part of flags in ycm_extra_conf.py , debug info below. (ps, post current status when open c file , type pri (it should suggests printf or etc...) thanks :) '-std=c11', '-x', 'c' '-isystem', '../boostparts', '-isystem', '/system/library/frameworks/python.framework/headers', '-isystem', '../llvm/include', '-isystem', '../llvm/tools/clang/include', '-i', '.', '-i', './clangcompleter', '-isystem', './tests/gmock/gtest', '-isystem', './tests/gmock/gtest/include', '-isystem', './tests/gmock', '-isystem', './tests/gmock/include', #c default header '-isystem', '/usr/lib/gcc/x86_64-li

c# - Change URL on ChannelFactory? -

i using channelfactory when connecting client service using wcf : new channelfactory<t>(endpointconfigurationname); this load settings config file alot in case. need change url before using channel, how done? not find url on channelfactory? provide endpointaddress while creating channel suspect reset settings configfile? im using channelfactory avoid generating new proxy every change , able set credentials. edit : this how did solved for(int = 0; < clientsection.endpoints.count; i++) { if(clientsection.endpoints[i].name == endpointconfigurationname) { var endpointaddress = new endpointaddress(clientsection.endpoints[i].address.tostring()); var nethttpbinding = new nethttpbinding(clientsection.endpoints[i].bindingconfiguration); var serviceendpoint = new serviceendpoint(contractdescription.getcontract(typeof(t)), nethttpbinding, endpointaddress); var channelfactory = new channelfactory<t

Loop interruption when warning is encountered with TryCatch in R -

i use trycatch handle warnings , errors in order write log file , secure code. write log correctly cat when trycatch returns success or error problem loop execution stopped when warning encountered. whitout trycatch loop not interrupted warning() not clear me what's happening here because warning should not beaks loop. breaking loop when "warnings()" appear in r loop not interrupted : >list <- c(1:10) for(i in list){ warning(i)} warning: 1 warning: 2 warning: 3 warning: 4 warning: 5 warning: 6 warning: 7 warning: 8 warning: 9 warning: 10 > loop interrupted : >trycatch( { list <- c(1:10) for(i in list){ warning(i) } }, error=function(cond) { message("error: ", cond) }, warning=function(cond) { message("warning: ", cond) } ) warning: simplewarning in dotrycatch(return(expr), name, parentenv, handler): 1 > thank you,

arrays - protractor, JavaScript Comparison: Cannot read property 'forEach' of undefined -

var operation= require('./1.js'); var expectedresults = require('./range.js'); describe("range test", function() { operation.min.foreach(function(elt, i) { expectedresults.timedialmoderateinversemin.foreach(function(elt1, i) { it('trip unit styles: ' + elt1, function() { var result= min.filter(function(i) { if(elt1===elt) { return true; } else { return false; } }) expect(result.tostring()).tocontain(elt) }) }) }) }) here trying compare 2 different arrays 2 different pages. there 2 files 1.js , range.js 1.js performs operations on application , stores data array min[]. range.js contains expected results needs compared min[] 1.js successfull execution of tc

excel - Is it possible to delete and recreate a table object in VBA without de-referencing the formulas in the workbook? -

i have table object in sheet used many formulas in workbook. the table object created in vba routine. the issue formulas refering table broken if table re-created in vba routine. possible avoid this. for example =sumifs(output_dump[value],output_dump[assetclass],"ml") gets broken when table deleted , recreated same name during vba routine =sumifs(#ref!,#ref!,"ml") is there way of locking formulas in sheet or preventing them updating during vba routine? just insert rows in table , references of updated encompass new data rows range option explicit sub main() dim tbl listobject set tbl = worksheets("table").listobjects("output_dump") '<--| change "table" actual worksheet name tbl.databodyrange.rows(2) '<-- reference data 2nd row .insert '<-- insert row -> you'll have new empty row between data row 1 , 2 .offset(-1).cells(1, 1) = "ml" '&l

SQLite foreign key mismatch error -

why getting sqlite " foreign key mismatch " error when executing script below? delete rlsconfig importer_config_id=2 , program_mode_config_id=1 here main table definition: create table [rlsconfig] ( "rlsconfig_id" integer primary key autoincrement not null, "importer_config_id" integer not null, "program_mode_config_id" integer not null, "l2_channel_config_id" integer not null, "rls_fixed_width" integer not null , foreign key ([importer_config_id]) references [importerconfig]([importer_config_id]), foreign key ([program_mode_config_id]) references [importerconfig]([importer_config_id]), foreign key ([importer_config_id]) references [importerconfig]([program_mode_config_id]), foreign key ([program_mode_config_id]) references [importerconfig]([program_mode_config_

jquery - Conditional "step" for JQueryUI Slider -

i want give conditional steps jquery ui slider. if current selected value below 1951, take steps of 10 else take step of 1. want because limitation of dataset, have data 1900,1910 till 1950 , 1951,1952 on every year... how can change based on year value? there way? below current code $( function() { $( "#slider-vertical" ).slider({ orientation: "vertical", range: "min", min: 1900, max: 2015, step: 1, slide: function( event, ui ) { $( "#selected_year" ).val( ui.value ); } }); $( "#selected_year" ).val( $( "#slider-vertical" ).slider( "value" ) ); } ); try modify step value of slider in change event handler: $( "#slider" ).slider({ //... change: function( event, ui ) { var step = $(this).slid

php - CakePHP join tables in find query -

i have workposition model. linked in database orders belongsto relationship. so, need find specific workpositions bz conditions related orders model. so, when use example suck kind of find: $workpositions = $this->workposition->find('all', array( 'conditions' => array( 'order.type' => 'n' ) )); cakephp understand order.id notation. when i'm trying use joins tables: $workpositions = $this->workposition->find('all', array( 'conditions' => array( 'order.type' => 'n' ) 'joins' => array( array('table' => 'ordergroups_orders', 'alias' => 'ordergroupsorder', 'type' => 'inner', 'conditions&

ruby on rails - ahoy_meta gem don't work -

can please me how create event ahoy_gem , how visits tracked. follow documentation provided gem developer, can't me how use it. please me. firstly check if track visits, head rails console , run visit.any? if returns true tracking visits! if doesn't track visits, can add code below application_controller.rb : after_action :ahoy_track protected def ahoy_track ahoy.track_visit end now track visits. in order track events have 2 options: track events in server side. track events in client side using js. to track in server side should use the: ahoy.track "event name", properties: { one: "val", two: "val" } this create record in db event named "event name" properties one: "val", two: "val" to track events in client side using js: ahoy.track("event name", {one: "val"}); tracking in js won't create records in db, a post request sent /ahoy/events with (from

java - getting null in servlet . Sending data from android retrofit model -

servlet code : response.setcontenttype("application/json"); gson gson = new gson(); requestobject requestobject = gson.fromjson(request.getreader(), requestobject.class); list<locationaddress> locationaddresslist = requestobject.getresponselocationaddresslist(); system.out.println( " list size after json parsing " +locationaddresslist.size()); android code : @headers("content-type: application/json") @post("/rt-tracking/requestresponse") call<list<latlng>> getfeed(@body requestobject body ); call in service : call<list<latlng>> call = locationinterface.getfeed(new requestobject(responselocationaddresses)); call.enqueue(new callback<list<latlng>>() { @override public void onresponse(call<list<latlng>> call, retrofit2.response<list<latlng>> response) { if (response.body() != null) { list<latlng> latlnglist = response.body();

c# - Return value of SHLoadIndirectString is an errorcode -

hi i've been trying name of metro app acquired appmanifest.xml of respective app. came know shloadindirectstring used purpose. on checking functionality manually, couldn't result resource. code snippet goes below. #include <iostream> using namespace std; #include <shlwapi.h> int main(){ lpwstr output = l""; lpwstr input = l"@{microsoft.bingmaps_2.1.3230.2048_x64__8wekyb3d8bbwe?ms-resource://microsoft.bingmaps/resources/appdisplayname}"; int result = shloadindirectstring(input, output, sizeof(output), null ); cout<<output; return 0; } the return value "result" negative value(changes if changing input string respective app). please guide me on mistake. thanks. got right answer. #include <iostream> using namespace std; #include <shlwapi.h> int main() { pwstr output = (pwstr) malloc(sizeof(wchar)*256); pcwstr input = l"@{c:\\program files\\windowsapps\\microsoft.bingm

java - How does ArrayBlockingQueue avoid shuffling array elements? -

scenario: producer fills array up, capacity new int[10], before consumer gets chance consume any. producer sees array full , blocks. then consumer comes along , removes int[0], , signals producer array has empty slot fill. my producer wakes up, , tries add new element array. considering int[0] free, , implementing fifo, arrayblockingqueue shuffle remaining 9 elements left, filling 0-8 indexes , leave int[9] free producer? i've looked @ implementation don't see array copy functionality, no copying of array elements performed, because arrayblockingqueue uses array circular buffer. maintaining 2 indexes, takeindex , putindex , , wraps them around when reach end of array. after operation adds or takes element calls private "increment" method called inc , wraps index around end: final int inc(int i) { return (++i == items.length)? 0 : i; } here example of how method used: private void insert(e x) { items[putindex] = x; putindex = in

matplotlib - How can I set the number of ticks in Julia using Pyplot? -

i struggling 'translate' instructions find python use of pyplot in julia. must simple question, know how set number of ticks in plot in julia using pyplot? if have x = [1,2,3,4,5] y = [1,3,6,8,11] you can pyplot.plot(x,y) which draws plot and do pyplot.xticks([1,3,5]) for tics @ 1,3 , 5 on x-axis pyplot.yticks([1,6,11]) for tics @ 1,6 , 11 on y-axis tic spacing if want fx 4 tics , want evenly spaced , dont mind floats, can collect(linspace(x[1], x[end], 4). if need tics integers , want 4 tics, can do collect(x[1]:div(x[end],4):x[end]) edit maybe wont belong here atleast you'll see it... whenever you're looking method that's supposed in module x can find these methods typing in repl x. + tab key to clarify, if want search module method suspect starts x, xticts, in repl (terminal/shell) do pyplot.x and press tab twice , you'll see julia> pyplot.x xkcd xlabel xlim xscale xticks and if you're n

php - How to get path to curent node with simplexml? -

i need path node in simplexml oject? domdocument->getnodepath() foreach ($xml->xpath('.//tag-defs') $tagdef) { $path = $tagdef->*getnodepath()* //i need reciev path "/*/*[3]/*[1]" } p.s. can't use domdocument!

c++ - Type trait to identify types that can be read/written in binary form -

is there type trait (or concept) identify types following safe? template <typename t> std::enable_if_t<std::some_type_trait<t>::value> write(std::ostream &os,const t &x) { os.write(reinterpret_cast<const char *>(&x),sizeof(t)); } template <typename t> std::enable_if_t<std::some_type_trait<t>::value> read(std::istream &is,t &x) { is.read(reinterpret_cast<char *>(&x),sizeof(t)); } i’m thinking of classes containing pod excluding pointers (but not arrays). standardlayouttype s without pointers. neither want constrain objects trivialtype nor triviallycopyable . sorry if i’m inaccurate. know little of data representation. given 1 st parameter of s , read method: extracts characters , stores them successive locations of character array first element pointed s so real question is: if have initialized object writing string of bytes it's address, valid? this concept of value represen

mysql : json type : construction of a groupby query -

i need group json elements across db rows the query using : select json_extract(m.content,'$.m.tags[*].wrd') word, count(*) count m group word order count desc the result ["#utmp", "#seasiders"] 5 ["embeddedurl", "#imdb", "#nowwatching"] 4 ["youtube", "embeddedurl"] 4 ["#seasiders", "embeddedurl"] 4 i need individual word / tokens : ["thanks"] 3 ["seriously"] 2 ["#doh"] 2

Removing a listener class doesn't stop a sound event associated Jquery Javascript -

i'm playing sound when hovering on image (this working fine already) , want include button turn off if desired. unfortunately haven't been able make work. my current code goes like: for creating sound //a bunch of code generate audio ends on var mouseoversound = createsoundbite('mysound.mp3') for triggering it $(".play").mouseover(function() { mouseoversound.play(); }); the listener element <%= image_tag "image.png", class:'logo-image play' %> i thought simplest solution disabling remove class 'listening' event (i.e. '.play') in element listener, tired: $(".sound").click(function(){ $(".logo-image").removeclass("play"); }); //.sound class of button that's intended block it. although latter script remove class 'play' sound keeps playing every time hover on image. missing? shouldn't sound stop playing? do see other solution this?