Posts

Showing posts from May, 2014

c++ - How to fix race condition for condition variable wait/notify -

answer question wrong has chance deadlock. condition variable - wait/notify race condition i found no solution solving race condition or dead lock issue. imagine have 2 threads. goal follows. first condition: thread 1 waits thread 2 notifies second condition: thread 2 notifies thread 1 should not wait , continue normal execution. how can implemented correctly without having queue notifies? because want part of code run fast possible , use boolean value instead of adding item queue. there 2 threads, use of queue seems overkill me. pseudo code when there race condition: thread 1: lock(x); if(!signaled) { unlock(x); // ******** // still small gap, how avoid? cv.wait(); // forget spurious wakeup sake of simplicity signaled = false; } else // ******** unlock(x); thread 2: lock(x); signaled = true; cv.notify(); unlock(x); now if remove 2 lines commented ******** race condition solved , chance of deadlock introduced thread1 waits while owning lock , t...

jquery - detecting mobile browser without user agent sniffing -

which approach more reliable detect mobile browser? ua sniffing jquery's width() as understand ua sniffing not reliable. i need change html page according width of mobile device viewing page. can't media queries alone. you can use mobile detect js library this. take note of warning: // warning: // these javascript-based device detection features may work // newest generation of smartphones, such iphone, // android , palm webos devices. // these device detection features may not work older smartphones // had poor support javascript, including // older blackberry, palmos, , windows mobile devices. // additionally, because javascript support extremely poor among // 'feature phones', these features may not work @ on such devices. // better results, consider using server-based version of code, // such java, aps.net, php, or ruby.

.net assembly - C#: Resolving multiple assemblies using the AssemblyResolve function -

i'm attempting make single exe app. end, have 2 dlls tagged embedded resouces in app. can use appdomain.currentdomain.assemblyresolve += new resolveeventhandler(myresolve) method return assembly when event fires. the difficulty i'm running methods within application reference multiple assemblies. when use above event handler load , return assembly, application looks method in wrong assembly file, , "type load exception". therefore, how can load assemblies application looks in proper places methods might use? kind regards. code sample: dll resolution: appdomain.currentdomain.assemblyresolve += new resolveeventhandler(resolvedll) static assembly resolvedll(object sender, resolveeventargs args) { using (var stream = assembly.getexecutingassembly().getmanifestresourcestream("myapplication.resources.mydll1.dll")) { byte[] assemblydata = new byte[stream.length]; stream.read(...

inno setup - Run post install file replace before creating service -

i have configured below script ask user ip address part of install wizard, address gets written config file application reference know communicate with. currently, service created before configuration file updated ( run section happens before curstep = sspostinstall ), default value has been read file before updated. means further manual service restart required application communicate. i understand possible have run section happen after sspostinstall . i have read article inno setup: how run code procedure in run section or before run section? suggests can use beforeinstall: parameter part of run command perform curstepchanged procedure first. however, leads error of required function or procedure 'curstepchanged' found not compatible prototype. i tried moving run line , command above curstepchanged section (to match article mentioned closely possible), still returned same error. can offer guidance going wrong configuration? [code] var primaryser...

Run Angular app inside web worker without ejecting from CLI -

i have heavy javascript code in application , bogging down ui, making feel less 60fps (janky). i want take advantage of using web worker without losing comfort of angular-cli (i don't want run ng eject ). ideally, whole app run inside web worker. is possible? preconditions: angular 2 or 4 angular-cli v.1.0+ no ejecting angular-cli i'm assuming saw this: angular cli generated app web workers and this: https://medium.com/@enriqueoriol/angular-with-web-workers-step-by-step-dc11d5872135 but didn't ejecting? i don't know of way currently. there issue add here: https://github.com/angular/angular-cli/issues/2305 so disappointing answer question may "no".

security - When is it acceptable to use self-sign cert in production? -

self signed cert looked down test-only certificate. per understating, using production fine if used right reason. trying provide guidelines customers use what. e.g.: authentication : not ok use self-signed brower not trust "self" issuer. so, service-to-service or service-to-client authentication not ok use self-signed. unless there pre thumbprint/cn whitelisting process before verifying. lot of people these, e.g. azure upload management cert public key, used authenticate api. signing : no ok, there no trust issuer. unless there pre thumbprint whitelisting process before verifying. unless there pre thumbprint/cn whitelisting process before verifying. encryption : ok use self-signed there no chain trust required. in case of attack, mim cert not decrypt, no other impact. i thoughts/recommendations/guidelines community ensure recommendations in right direction. thanks. authentication: not ok use self-signed brower not trust "self" issuer. ok...

javascript - quoting individual characters(words) in a string on java script -

learner here, bear me if question seems absurd. trying quote characters in string , not string itself, how go doing that? mean is; given: var str = "i wondered scattered brained computer remain sane" and want : var output read = ""i" "wonder" "what" "a" "scattered" "brained" "computer" "does" "to" "remain" "sane"" what think best action take? you can reach desired solution string#replace , wrap each single word in quotation marks " . const str = 'i wondered scattered brained computer remain sane'; let res = str.replace(/\w+/g, '"$&"'); console.log(res);

spring mvc - Input an enum value in a form as hidden using thymeleaf -

i fill form input hidden using value of enum: enum: public enum tipoendereco { residencial, comercial } summarizing html code, i've tried use form input this: <input type="hidden" th:field="*{endereco[0].tipoendereco}" th:value="residencial"/> but unfortunately, field being recorded null. others fields don't use enum in way, being recorded normal. i've used enum fill option, directly input type hidden isn't working. i'm using thymeleaf.

javascript bind callback to any function -

i bind or chain callback/function function. there similar question (without valid answer): jquery , bind callback function but, me not want limited jquery realm. looking broader answer, wonder if it's possible vanilla javascript or library other jquery. example: // function don't want or can't edit it's body var thirdpartyobject = { dosomething: function(args) { // lot of code console.log('doing stuff: ' + args); } }; // function var easycallback = function() { // processing stuff console.log('doing more stuff'); } // bind magiclibrary.bind(thirdpartyobject.dosomething, easycallback); // run thirdpartyobject.dosomething(1); thirdpartyobject.dosomething(10); when run "code", following output represents behaviour i'm looking for: doing stuff: 1 doing more stuff doing stuff: 10 doing more stuff is possible? edit : bind conceptual term, maybe think chain , trigger or term. but import...

No longer able to get watched history of youtube user using Youtube API? -

all related questions , answers use playlist id returned in contentdetails.relatedplaylists.watchhistory returned youtube.channels.list endpoint. value seems set "hl" . i'm using oauth token authenticate request. there way list of watched videoes authenticated user? noticed list of watched videos no longer appears on user's youtube home page, recommended videoes. sol or there new way access watch history?

ios - How to get a provisioning profile for free with Xcode 8.3.3? -

how provisioning profile free xcode 8.3.3? using xcode 8.3.3, require paying apple developer fee? have seen free methods of acquiring provisioning profile, require xcode 7. (i plan on paying fee share apps on appstore, i'd latest possible year-long developer certificate won't wasted.) below xcode 7 provisioning profile tutorial reference. features used free provisioning profile in xcode 7 not available in 8.3.3. https://livecode.com/how-to-create-a-free-ios-development-provisioning-profile/

python - Use methods of parent class A from parent class B -

i have class a: class a(object): def pprint(x): print(x) then have class b: class b(object): def pprint(x): x += 1 # find way call a.pprint(x) then have child class: class child(b, a): pass which should used: child = child() child.pprint(1) >>> 2 i can make changes b not a. cannot refer directly in b. b never instantiated directly, via children class. after explanation - need not super() need sibling_super() find next class in multiple inheritance chain. can poll python's mro that, example: class a(object): def pprint(self, x): # make valid, assuming valid in real code print(x) class b(object): @staticmethod def sibling_super(cls, instance): mro = instance.__class__.mro() return mro[mro.index(cls) + 1] def pprint(self, x): x += 1 self.sibling_super(b, self).pprint(self, x) class child(b, a): pass child = child() child.pprint(1) # 2

c# - fill a DataSet in Visual Studio 2015 Express (Windows Forms Application)? -

i want know if there easy way this. have created simple windows form application dataset , created table (games) inside few columns (id,title,description,developer,year). then created listbox object reference dataset , selected column show (games.title). there few labels next listbox show values of other columns. now want know if can fill dataset inside visual studio without coding - if edit access database in ms access... currently fill dataset following code @ start of application: datarow crnewline = dataset1.tables["games"].newrow(); crnewline["title"] = "the title of game"; crnewline["description"] = "this description. farewell."; crnewline["developer"] = "warner interactive entertainment ltd."; crnewline["year"] = "1996"; dataset1.tables["games"].rows.add(crnewline); but code intense if want add 200 rows in table... , don't want use external source sql database or...

c++ - How to play sound when timer reaches zero? -

i trying make timer , have play sound @ end. have made timer , works fine sound won't play. have far: int main() { //cout << "this timer. still in making seconds work properly." << endl; //sleep(7000); //system("cls"); int input; cout << "enter time: "; cin >> input; cout << endl << "begin." << endl; system("cls"); while (input != 0) { input--; cout << input << " seconds" << endl; sleep(200); system("cls"); if (input == 0) { playsound(text("c:\\users\\id student\\downloads\\never_gonna_hit_those_notes.wav"), null, snd_filename | snd_async); } } } as others have mentioned, snd_async flag culprit, need remove it. i suggest restructure code move playsound() outside of loop. there no point in checking input 0 multiple times i...

Is it possible to set a message after the permission requests when installing apk(Android)? -

is possible set message after permission requests when installing apk (android)? just right after permission dialog showed, , user selects if allows yes/no, , after show custom message? possible that? before application installed. is possible set message after permission requests when installing apk(android)? no. welcome show message if , when user chooses run app.

html - Add CSS to any <div> in Joomla -

Image
i have .bg class. want in specific div, can not access through modules. pic shows module-connections, , blue-color marked "needed div": so, can jump right source code of connected classes, used in other structures in template. any ideas? love you, michael. i can't read sreenshot, can use this: div.outerdiv > div {values .bg}

python - Optimizing pandas computation -

i have 22 million rows of house property sale data in database table called sale_transactions. performing job read information table, perform calculations, , use results create entries new table. process looks this: for index, row in zipcodes.iterrows(): # ~100k zipcodes sql_string = """select * sale_transactions zipcode = '{zipcode}' """ sql_query = sql_string.format(zipcode=row['zipcode']) df = pd.read_sql(sql_query, _engine) area_stat = create_area_stats(df) # function calculations area_stat.save() # saves django model at moment each iteration of loop takes 20 seconds on macbook pro (16gb ram), means code going take weeks finish. expensive part read_sql line. how can optimize this? can't read whole sale_transactions table memory, 5 gb, hence using sql query each time capture relevant rows clause. most answers optimizing pandas talk reading chunking, in case need perform on data combined, sinc...

c# - MonoGame Maximize window event -

i have been having trouble trying implement event using monogame , c#. when window resized call event: this.window.clientsizechanged += new eventhandler<eventargs>(window_clientsizechanged); void window_clientsizechanged(object sender, eventargs e) { int width = window.clientbounds.width; int height = window.clientbounds.height; if (width > 0 && height > 0) { graphics.preferredbackbufferwidth = width; graphics.preferredbackbufferheight = height; graphics.applychanges(); } } this fine , resizes window correctly , updates width/height. not triggered in event window resized via user clicking maximize/minimize button on window frame. after spending time looking solutions suggestion implement maximize event here : form form = (form)control.fromhandle(window.handle); form.windowstate = formwindowstate.maximized; howeve...

Hive array(struct()) to JSON -

in attempt fix hive/json team, blocked getting following work correctly. given: hive table create table bob( createdt bigint, profile array<struct<user_id:string,empno:int>> ) [{"user_id":"sally","empno":5}], [{"user_id":"billy","empno":6}], [{"user_id":"fred","empno":7}], the goal following: { "createdt": "123456789", "users": [ { "user_id": "sally", "empno": 5, }, { "user_id": "billy", "empno": 6, }, { "user_id": "fred", "empno": 7, } ] } i using brickhouse udf , have far: create temporary function to_json 'brickhouse.udf.json.tojsonudf'; create temporary function from_json 'brickhouse.udf.json.fromjsonudf'; create temporary function collect...

reactjs - Converting arrow function to React.Component with children -

i making blog in gatsby.js , have problem converting const templatewrapper = ({children}) => ( <div> <helmet title="my website" meta={[ { name: 'description', content: 'a brief history of myself' }, { name: 'keywords', content: 'myself, cv' }, ]} /> <header /> <div> {children()} </div> <footer/> </div>) to normal function. tried creating react.component class seems not children. aim make loading screen bar , thats why want convert it. tried this class wrapper extends react.component { constructor(props){ super(props); this.state = { loading: true }; } componentdidmount(){ settimeout(() => this.setstate({ loading: false }), 2500); } render(){ const { loading } = this.state; if(loading){ return <loader/> } return( <templatewrapper/> ); } } and exported wrapper.. doesnt ...

c# - How to display database image (bytes[]) in mvc WebGrid -

i'm trying display byte[] image database in .net mvc webgrid column. i`m doing following steps (ef model - articulos) [key] public int id_art { get; set; } public int id_pro { get; set; } [stringlength(1)] public string tipo_pro { get; set; } [required] [stringlength(50)] public string nombre_pro { get; set; } [required] [stringlength(100)] public string descripcion_pro { get; set; } public byte[] imagen_pro { get; set; } [required] public decimal? precio_pro { get; set; } public int? estatus_pro { get; set; } (controller) public list<articulos> cargararticulos(string search, string sort, string sortdir, int skip, int pagesize, out int totalrecord) { using (dbmodel db = new dbmodel()) { var v = (from in db.articulos a.tipo_pro.contains(search) || a.nombre_pro.contains(search) || ...

visual c++ - Why No Set-Cookie Header from Yahoo finance (VC++) -

i try cookie , crumb yahoo finance , use cookie/crumb download yahoo historical stock quote. every time try, cannot cookie because there no set-cookie in response header. here code: cinternetsession mysession ("mozilla/5.0 (windows nt 5.1) chrome/49.0.2623.112", 1, pre_config_internet_access, null, null, 0); dword dwhttprequestflags = internet_flag_existing_connect | internet_flag_no_auto_redirect | internet_flag_secure | internet_flag_ignore_cert_cn_invalid | internet_flag_ignore_cert_date_invalid; cstring szheaders = _t("user-agent: mozilla/5.0 (windows nt 5.1) chrome/49.0.2623.112"); internet_port nport = internet_default_https_port; chttpconnection* pserver = null; chttpfile* pfile = null; tchar sz [1025]; cstring strservername = "finance.yahoo.com"; pserver = mysession.gethttpconnection(strservername, nport); try { pfile = pserve...

What's the accepted way to write Java methods where return value may be invalid? -

i come c programming background. want understand what's best way write java api value being returned, may invalid. i have class implementing binary search tree. has method, getrootvalue() returns root's value. c code- boolean getrootvalue(int *answer) { if (root != null) { *answer = value; return true; } else { return false; } } on user's end, like- if (getrootvalue(&answer)) { //process valid answer } the user calling function check return, , consider answer valid if return value true . java skeleton code- package algorithm; class bst { node root; class node { int value; node left; node right } //getrootvalue() } user's end- package user; import algorithm.bst; ... //bst.getrootvalue(); in java, correct way (considering root known bst , not user)? should send special class object contains both boolean , answer? if so, should class defined? is there different...

node.js - Writing unit tests with jest for javascript minifier -

i'm new writing unit tests. need testing javascript minifier. i'm using jest test. jsminifier: const compressor = require('node-minify'); const dirsearch = require('directory-search'); const scrapeconfig = require('../scraper.config.js'); function jsoptimizer() { dirsearch(scrapeconfig.directory, '.js', (err, files) => { files.foreach(file => { compressor .minify({ compressor: 'uglifyjs', input: file, output: file, }) .catch(error => console.log(error)); }); }); } module.exports = jsoptimizer; how go testing 100% conceptual coverage? if can provide example, appreciated. so far have code(incomplete). trying load file variable , make sure minified file equal or less unminified code. const dirsearch = require('directory-search'); const fs = require('fs'); const scrapeconfig = require('../scraper.config.js'); const jsoptimi...

math - cosine similarity LSH and random hyperplane -

i read few solutions nearest neighbor search in high-dimensions using random hyperplane, still confused how buckets work. have 100 millions of document in form of 100-dimension vectors , 1 million queries. each query, need find nearest neighbor based on cosine similarity. brute force approach find cosine value of query 100 million documents , select the ones value close 1. struggling concept of random hyperplanes can put documents in buckets don't have calculate cosine value 100 million times each query. think in geometric way. imagine data points in high dimensional space. create random hyperplanes (just planes in higher dimension), reduction using imagination. these hyperplanes cut data (the points), creating partitions , points being positioned apart others (every point in partition; rough approximation). now buckets should populated according partitions formed hyperplanes. result, every bucket contains less points total size of pointset (because every part...

vb6 - Which is better for performance -

recently had write function compares combobox list of items record set database. after finishing work i'm wondering better performance. solution 1 foreach item in combobox1 foreach record in recordset if item.id = record["id"] foundincombo = true exit end if next record if foundincombo = false combobox1.removeitem(item) end if next item solution 2 foreach item in combobox1 foreach record in recordset if item.id = record["id"] foundincombo = true recordset.remove(record) exit end if next record if foundincombo = false combobox1.removeitem(item) end if next item this pseudo code of course, , know in modern languages there better ways this, in vb6 , i'm curious if overhead in removing of record record set offsets less amounts of iterations of entire loop. update: in case learning older language , working in legacy code limited ability change made test ...

python - Comparing a value from one dataframe with values from columns in another dataframe and getting the data from third column -

the title bit confusing i'll best explain problem here. have 2 pandas dataframes, , b: >> print id | value 1 | 250 2 | 150 3 | 350 4 | 550 5 | 450 >> print b low | high | class 100 | 200 | 'a' 200 | 300 | 'b' 300 | 500 | 'a' 500 | 600 | 'c' i want create new column called class in table contains class of value in accordance table b. here's result want: >> print id | value | class 1 | 250 | 'b' 2 | 150 | 'a' 3 | 350 | 'a' 4 | 550 | 'c' 5 | 450 | 'a' i have following code written sort of want: a['class'] = pd.series() in range(len(a)): val = a['value'][i] cl = (b['class'][ (b['low'] <= val) \ (b['high'] >= val) ].iat[0]) a['class'].set_value(i,cl) problem is, quick tables length of 10 or so, trying table size of 100,000+ both , b. there quicker way this, us...

how do I find related nodes given a node using Neography in neo4j? -

the documentation doesn't seem work expected. node #<neography::node>> node.outgoing #<neography::nodetraverser:0x007f5981427f20 i want nodes given relationship, it's unclear based on current documentation: https://github.com/maxdemarzi/neography that syntax builds traversal description until ready .each it: node.outgoing(:friends).depth(4).nodes.each |node| puts node.map{|n| n.name }.join(' => friends => ') end

python - “`/bin/sh: apxs: command not found`” when installing `mod_wsgi` -

i got crazy error message " /bin/sh: apxs: command not found " when installing mod_wsgi . i researched ways may install httpd-devel " yum install httpd-devel " actually, got message " server version: apache/2.2.15 (unix) " " httpd -v " and version python2.7 mod_wsgi-4.5.15 . any suggestions?

python - Draw direction graph with overlaps that then splinter off -

working pandas , networkx try , understand/graph purchase flows. ultimate goal visualize purchase paths, overlap common paths, make common paths thicker line, , understand common purchase path. have approximately 20k sets of records. many of records share first few steps in common. integers below map particular skus such 0:"orange", 1:"apple", 2:"banana" , etc. each of observations in "column" in pandas dataframe called df . df['observations'] has bunch of records similar below. here example of of data: [4,3,5,6,9,17,11.........] [4,3,5,6,9,19,14,19......] [4,3,5,6,9,1,19,22,19....] [7,8,9,4,10,11,1.........] [7,8,9,1,11,10...........] all 3 of first few records share first few nodes/edges in path: 4,3,5,6,9, , "splinter" off different directions after that. separate, unconnected part of graph show 7,8,9 common path , splinter off different directions. i hoping generate sort of graph takes known starting point or in...

elasticsearch - c#: how to implement singleton pattern to return client that should be initialised just once in application life cycle? -

currently, initialising elastic search client. want initialise elasticclient once in our application , re-use avoid unnecessary initialisation every time make elastic search call. the code looks like: public sealed class elasticclientinstance { private static readonly elasticclientinstance _clientinstance = new elasticclientinstance(); private elasticclient _client; static elasticclientinstance () { } public static elasticclient getinstance() { return _clientinstance._client; } private elasticclientinstance() { try { uri[] nodes = configurationmanager.appsettings["elastichosturl"].split(';') .select(s => new uri("http://" + s)).toarray(); var connectionpool = new sniffingconnectionpool(nodes); var settings = new connectionsettings(...); //some code not mentioned here _client = new elasticclient(settings); ...

javascript - unable to forward to the error page when any exception is occured -

i working on springmvc , angular application. when ever exception occurs need forward error page, below scenario not forwarding error page instead redirecting page page blank , when checked browser console, below exception mentioned: failed load resource: server responded status of 404 () :8080/undefined instead of returning page , showing blank page, want forward error page. have exception handler class in exception, exception occurred handler class called , handles , forwards error page. js code: myapp.controller('mycontroller', function ($rootscope, $scope, $sce, myservice, $window) { $scope.getdata = function () { $scope.pdfname = {}; $scope.html = ''; myservice.getmydata($scope.id1).then( function (response) { $scope.myresponse = response; //check error if ($scope.myresponse .error) { $rootscope.showerror(500, $scope.myresponse .error); ...

redirect - Wix Support: Create a page with wild card url -

i have wix website. want create page custom url. briefly want url www.somedomain.com/books/* to redirect created wix page. way possible. url example: when ever user types url such as: www.somedomain.com/books/1 www.somedomain.com/books/2 www.somedomain.com/books/3 www.somedomain.com/books/4 www.somedomain.com/books/5 www.somedomain.com/books/6 then redirection should created page on wix url is: "www.somedomain.com/books" assuming meant have full control on www.somedomain.com/books/ , redirect using html. go head tag --> add code: <meta http-equiv="refresh" content="0; url=yourwixsitehere.com" /> if want make shorter, i'm not sure how

javascript - Create a factory function that returns an object with immutable state -

link codepen https://codepen.io/jaspercreel/pen/mvaodp basically, function this: const factory = (args) => { const state = { args } const methods = { getstate() => { return args; }, setstate(args) => { state.args = args; }, dostuffwithstate() => { let args = this.getstate(); function(args) { return args plus else; }(); } } return object.assign({}, methods); } the problem whenever call dostuffwithstate() changes state object. thought safe creating new variable returned state, learned when referencing object creating new reference. question this, how can create immutable state can referenced not changed (except helper functions) in factory function? my end goal create sorter factory function create object takes arrays , sorts , searches them in different ways. want able store default array in sorter can referenced return different sorting options not changed. advice? one...

excel vba - How to print array and values from new cycle to next rows -

this part of code working , have 1 problem. have array values (masyvas) , started new loop find other values using masyvas(i,1) values , after need new values printed in masyvas(i,2) , need group them. need this: 991988 gaz.duon.sk"giros"gaiv.g.1,5l 5_petØflat1,5 palink 117388 silp.gaz.nat.min.v"tiche'1,5l 5_petØflat1,5 palink rimi lietuva ŠiauliŲ tara 111388 gaz.nat.min.v"tiche" 1,5l pet 5_petØflat1,5 palink aibĖs logistika aibĖs logistika rimi lietuva ŠiauliŲ tara how looks marked 1 goes wrong data sheet array values here part of code have problem prints new values next masyvas(i,2) not below need. lastrow2 = sheets("lapas").cells(rows.count, 1).end(xlup).row rub = lastrow2 cub = 3 redim masyvas(1 rub, 1 cub) = 1 rub j = 1 cub masyvas(i, j) = sheets("lapas").cells(i, j).value 'array gets values filtered data in akcijos sheet ...

Changes to code in Visual Studio 2015 is not executed -

even when comment out code crash program, still executes. understand last successful build being executed. i have seen many posts problem one . many of them solution delete "bin" , "obj" sub-folders. don't know find these files. tried reinstalling visual studio 2015 still cannot execute changes code. i have tried clean / rebuild code error . image of subfolder they within solution folder, example windowsapplication1. when create new project, asked location on hard drive. use search if else fails

swift - Map view getting shrunk in Dynamic table view cell -

Image
in swift ios app, have tableview in viewcontroller 2 prototype cells. 1 cell has 2 text boxes (cell) , other cell has 1 uiview (mapview in mapcell) in have display google map view location markers. have set leading,trailling , top , bottom constraints things in cell. also, included following dynamic cells. chatmessagestableview.rowheight = uitableviewautomaticdimension chatmessagestableview.estimatedrowheight = 100 first cell gets dynamic height depending upon content size, mapcell shrunken, tried lot of things , nothing helping, please suggest can more. here related code , tableview cell image. let cell = tableview.dequeuereusablecell(withidentifier: "mapcell", for: indexpath) as! tableviewcell googlemapview.frame = cgrect(x: 0, y: 0, width: 400, height: 300) let camera = gmscameraposition.camera(withlatitude:self.triplocation.latitude, longitude: self.triplocation.longitude, zoom: 15) googlemapview.animate(to: camera) cell.mapview.addsubview(googlemapview) ce...

c# - How to get checked checkbox value which is created dynamically in button click event -

i having checkboxes created dynamically in page_load event , put in panel. foreach (datarow dr in column_ds.rows) { column_checkbox = new checkbox(); column_checkbox.text = (string)dr["column_name"]; columnpanel1.controls.add(column_checkbox); } now want checked check box values in btn_click event. ideas? tried, columnpanel1.findcontrol("column_checkbox"); and checkbox cb=(checkbox)findcontrol("column_checkbox"); if (column_checkbox.checked) { } { string name = column_checkbox.text; } on click event of button, can implement below logic. protected void btn_click(object sender, eventargs e) { foreach(var row in columnpanel1.rows) { var tempchkbx= row.controls[0] checkbox; if(tempchkbx.ischecked) { //write code } } }

c# - How to get DropSource from DoDragDrop API Hooking -

i hooked dodragdrop api explorer , getting dragged files path idataobject working dropsource path. can dropsource path dodragdrop , possibilities hooking or follow other way. below code dragged files idataobject. public class main : easyhook.ientrypoint { dragdrop_console.remotemon interface; public localhook dragdrophook; public main(remotehooking.icontext incontext, string inchannelname) { try { interface = remotehooking.ipcconnectclient<dragdrop_console.remotemon>(inchannelname); } catch (argumentexception ex) { interface.errorhandle(ex); } } public void run(remotehooking.icontext incontext, string inchannelname) { try { dragdrophook = localhook.create(localhook.getprocaddress("ole32.dll", "dodragdrop"), new dragdropdelegate(dodragdrophook), this); dragdrophook.threadacl.setexclusiveacl(new int32[] { 0 }...

sql server - SQL- Current quarter data has to be truncated and reloaded but the previous quarter should remain untouched -

say there 2 quarters q1, q2, q3, q4 q1 20160331 , q2 20160630. need write query load table in such way every time load table, need delete given quarter records , reload them given quarter records. once move q1 q2 should not touch q1 records , q2 records should truncated , reloaded. @usedate variable has current given quarter date quarterkey has quarter date records loaded. stg has current given quarter data. stg truncate reload. fact should delete current quarter date , reload it. if exists (select * sys.objects object_id = object_id(n'[dbo].[fact]') , type in (n'u') , (select count(*) [dbo].[fact]) >0) begin delete [dbo].[fact] (select max(quarterkey) [fact] ) = @usedate end insert [dbo].[fact] select * stg (select max(quarterkey) [stg] ) = @usedate with query when i’m loading q2, q1 data getting deleted. it’s minor fix think i’m unable fix it. can please me. if @usedate has values 20160331 need extract quarter , delete records fac...

java - Serialize nested object as String with Jackson -

i have simple dto has nested object, like: public class { public string field; public b b; public static class b { public string stringfield; public int intfield; } } when serialize jackson, like: { "field": "foo", "b": { "stringfield": "bar", "intfield": 42 } } but due weird api of external system i'm integrating with, need following: { "field": "foo", "b": "{\"stringfield\":\"bar\",\"intfield\":42}" } and should work on deserialization, incoming data looks same way. can done jackson?

elasticsearch - Elastic Search "Did you mean" for auto correction of words implementation not working with rails -

i trying implement full search text engine rails app using elastic search document class. should have auto correction misspelled words. this document.rb require 'elasticsearch/model' class document < applicationrecord include elasticsearch::model include elasticsearch::model::callbacks belongs_to :user document.import force: true def self.search(query) __elasticsearch__.search( { query: { multi_match: { query: query, fields: ['name^10', 'service'] } } } ) end settings index: { "number_of_shards": 1, analysis: { analyzer: { string_lowercase: { tokenizer: 'keyword', filter: %w(lowercase ascii_folding) }, did_you_mean: { filter: ['lowercase'], char_filter: ['html_strip'], type: 'custom', tokenzier: 'standard'}, autocomplete: {filter: ["lowercase", ...

angular - I am building & linking my angular2 library to my main project, inside the libraries build folder node_modules in comming -

i have created angular2 component library , linking library main project. when build library, creating build folder, execute npm-link inside build folder, creating node_modules folder packages inside build folder(which should not happen). now when link library main project, getting error, error because of repetation of node_modules twice. (node_modules of main project & node_modules library problem. think there should 1 node_modules of main project.) here steps following link library main project. inside library "npm run build:clean" "npm run build:link" go inside build folder , run "npm link" (at point node_modules created) inside project npm link @nw/ui-vdp ng serve --proxy-config proxy.config.test.json --aot my libraries package.json is "scripts": { "build:ngc": "ngc -p src/tsconfig-ngc.json -w", "build": "npm run build:ngc && npm run copyassets", ...

How can I edit environment variables for my weblogic12c server? -

the weblogic scripts, i.e., startweblogic.sh, stopweblogic.sh, etc not working command line. doesn't throw error,it doesn't start/stop server. think there might issue environment variables. please let me know if there's way can resolved.

VBA with multiple while conditions -

Image
i need modify code have correct values in column j . colored better understanding, rows have same values columns a d in column j want have correct values follows: - if row 6 = row 7 j6 = 2 - if row 8 = row 9 = row 10 j8 = 3 - , on my code not enough, because don't want have red values in column j dim tw worksheet: set tw = thisworkbook.worksheets("stack") dim row integer row = tw.range("b" & rows.count).end(xlup).row lin = 2 until lin = row + 1 nr = 1 while (tw.cells(lin, 1) = tw.cells(lin + nr, 1) , tw.cells(lin, 2) = tw.cells(lin + nr, 2) , tw.cells(lin, 3) = tw.cells(lin + nr, 3) , tw.cells(lin, 4) = tw.cells(lin + nr, 4)) nr = nr + 1 wend if nr = 1 else tw.cells(lin, 10) = nr end if lin = lin + 1 loop

Can I follow users through Facebook Graph API? -

i want follow users through facebook graph api.there no documentation available. that not possible via api – because abused much, , have app developers subscribing user follow people without user being aware of it. for web, there social plugin available, user can actively trigger subscription: https://developers.facebook.com/docs/plugins/follow-button/

javascript - Connecting images with lines -

i tried make match 2 pairs lines quiz. have couple of images on left, , couple of images on right, , need connect lines when click on pair of images. should work combinantion, if click example on image 1 on left , image 3 on right, should connected line. if click again on image 1 on right, , image 2 on left, previous line should deleted, , new 1 between 2 images need made. html snippet: function linedistance(x, y, x0, y0){ return math.sqrt((x -= x0) * x + (y -= y0) * y); }; function drawline(a, b, line) { var pointa = $(a ).offset(); var pointb = $(b).offset(); var pointacenterx = $(a).width() / 2; var pointacentery = $(a).height() / 2; var pointbcenterx = $(b).width() / 2; var pointbcentery = $(b).height() / 2; var angle = math.atan2(pointb.top - pointa.top, pointb.left - pointa.left) * 180 / math.pi; var distance = linedistance(pointa.left, pointa.top, pointb.left, pointb.top); // set angle $(line).css('transform', 'rotate...

c# - ContentPresenter steals resources? -

Image
in simple view want display 2 buttons, have contents images, provided via resources in style.xaml loaded in app.xaml. <bitmapimage x:key="addicon" urisource="pack://application:,,,/wpftestbench;component/images/plus.png"></bitmapimage> <bitmapimage x:key="removeicon" urisource="pack://application:,,,/wpftestbench;component/images/minus.png"></bitmapimage> <style x:key="addbuttonwithiconstyle" targettype="{x:type button}"> <setter property="content"> <setter.value> <image source="{dynamicresource addicon}" stretch="none" verticalalignment="center" horizontalalignment="center"/> </setter.value> </setter> </style> <style x:key="removebuttonwithiconstyle" targettype="{x:type button}"> <setter property="content"> <setter.value...

Ionic framework, build app on ionic serve auto forward to google search hotlinking -

when build app in browser commandline "ionic serve", app forward google search hotlinking. when build app android "apk" sometime it's failed try build blank project. if error still appears, need check installation , dependencies. check guide of how can install necessary dependencies development. http://ionicframework.com/docs/v1/guide/installation.html

mongodb - MongoChef not showing the MongoD collections -

Image
i new mongodb , mongochef , connecting mongodb server not local , setup on remote server(for not require vpn or visual network) using mongochef client. when pass ip in mongochef's new connection tab, "test connection" button return "ok" status follows: but in main window of mongochef not showing collection or database. here screen shot: i tried connecting server terminal , connecting well. can ping , telnet server well. i not getting problem? the problem authentication, needed edit connection , add authentication parameters viz username, password , database name specified in following screenshot making above changes solved issue me. still, not sure why previous connections giving test ok status.

spark streaming org.apache.hadoop.metrics2.MetricsException: Metrics source ZooKeeper,sub=ZOOKEEPER already exists! after spark-submit -

i creating spark-streaming application reads , write hbase application executes fine in eclipse while executing spark-submit gives exception: spark-submit --master local[*] --class userprofile --name realtimeuserprofiling realtimeuserprofiling.jar error executor.executor: exception in task 3.0 in stage 400.0 (tid 215) java.io.ioexception: java.lang.reflect.invocationtargetexception @ org.apache.hadoop.hbase.client.connectionfactory.createconnection(connectionfactory.java:221) @ org.apache.hadoop.hbase.client.connectionfactory.createconnection(connectionfactory.java:114) @ hbaseutils.getconnection(hbaseutils.java:55) @ hbaseutils.<init>(hbaseutils.java:42) @ userprofile$4.call(userprofile.java:129) @ userprofile$4.call(userprofile.java:1) @ org.apache.spark.streaming.api.java.javadstreamlike$$anonfun$fn$4$1.apply(javadstreamlike.scala:205) @ org.apache.spark.streaming.api.java.javadstreamlike$$anonfun$fn$4$1.apply(javadstreamlike.scala...

ruby on rails - Multi sidekiq processes for one application -

i have rails project using sidekiq. in project, want have multiple sidekiq processes. example, 1 normal sidekiq process (allow many concurrent workers) , 1 synchronous sidekiq process (allow 1 worker). here setting: here normal sidekiq process: --- :logfile: ./log/sidekiq.log :queues: - [important, 4] - [default, 2] - [low, 1] here synchronous sidekiq process: --- :logfile: ./log/sidekiq.log :queues: - long_running i start 2 sidekiq processes using following commands: bundle exec sidekiq -c config/sidekiq.yml -c 4 bundle exec sidekiq -c config/sidekiq_synchronous.yml -c 1 finally here sidekiq configuration in rails: sidekiq.configure_server |config| config.redis = { url: env['redis_url'] } config.on(:startup) scheduled_set = sidekiq::scheduledset.new end end sidekiq.configure_client |config| config.redis = { url: env['redis_url'] } end sidekiq.default_worker_options = { retry: false } it looks sidekiq use sidek...

ios - Firebase RTM multiple chat rooms with React Native -

i working on project create multiple chat rooms using react native , firebase. when comes react native, firebase's documentation rather sparse , doesnt have many implementation examples. i have chat works 1 on 1 chat, taken this example. how add functionality add/remove private chat rooms add/remove users to? have tried using firechat api, unfortunately not work react-native. here have far: import firebase 'firebase'; class messagebackend { uid='' messagesref = null; constructor(){ firebase.initializeapp({ apikey: '0000', authdomain: '0000.firebaseapp.com', databaseurl: 'https://0000.firebaseio.com/', storagebucket: '0000.appspot.com', }); firebase.auth().onauthstatechanged((user) => { if (user) { this.setuid(user.uid); }else{ firebase.auth().signinanonymously().catch((error => { alert(error.message); })) } }) } ...

Cassandra and read latency -

i installed cassandra https://bitnami.com/stack/cassandra on cloud machine. cloned machine 2 machines. 1 running cassandra server (1 node cassandra cluster) , other acting client , issuing queries first 1 (server). i used ycsb - https://github.com/brianfrankcooper/ycsb perform benchmark. observed read latency on server low few microseconds (around 50/100 99th percentile , max) observed using "nodetool cfhistograms <'db'> <'table'>" , "nodetool cfstats <'db'>" - data coming cache i.e. sstables in cache. but end-to-end latency observed client (other node) ycsb benchmark tests high - average latency = 2000 us. wonder why end-to-end latency high 2000 opposed 100 (on server). network latencies low around 200 (as seen using ping). want cassandra server respond quickly/instantly possible. can help? so start cfhistograms measures local read latency time pull off of memtables merge sstables. not include coordinatio...

android - Rxjava Filtering the duplicate item in List -

i using rxjava , retrofit in app.here's setup of app.when app launched app make 2 request 1 database , other network api (using retrofit) , both request return observable<list<article>> . did merged 2 observable. problem network return articles present in database. how filter out duplicate item list. here's code. return observable.merge(datasource.getarticles(source), remotesource.getarticles(source)) .distinct(); so tried distinct operator it's not filtering articles out.here's output looks form db. article1 article2 article3 article4 output network article7 articke8 article3 article4 what want distinct list of article assuming article has proper equals implementation, you collect them set: datasource.getarticles(source) .mergewith(remotesource.getarticles(source)) .collect(hashset::new, (set, list) -> set.addall(list)) or unroll each list , apply distinct followed tolist : datasource.getarticles(...

No data is uploaded, but job status is DONE in bigquery load job using java -

i trying upload csv file, in right format. if try upload 3 rows of data, works, large file says socket-timeout exception our job done. dataset in other location. bigquery bigquery = googleconnector.getbigquery(); tableschema schema = new tableschema(); list<tablefieldschema> tablefieldschema = gettablefieldschema("mostrecentobservation"); schema.setfields(tablefieldschema); table table = new table(); table.setschema(schema); tablereference tableref = new tablereference(); tableref.setdatasetid("metromallseu"); tableref.setprojectid(projectid); tableref.settableid("mostrecentobstest"); table.settablereference(tableref); filecontent content = new filecontent("application/octet-stream", new file(filenametoload)); job job = new job(); jobconfiguration config = new jobconfiguration(); jobconfigurationload configload = new jobconfigurationload(); configload.setsc...