Posts

Showing posts from April, 2010

php - Explode string with '/' and escape if it contains space around '/', like ' / ' -

how possible explode string using '/', if slash doesn't contain spaces before or after. i wish string "flat visors / fitted caps" treated string , "flat visors/fitted caps" explode using '/'. you can use preg_split negative look-behind , negative look-ahead: preg_split('/(?<!\s)\\/(?!\s)/', $str); if wish opposite, i.e. splitting when there space around , remove space, again preg_split , optional space: preg_split('/\s*\\/\s*/', $str);

javascript - Liferay iframe java script document unavaible -

i have project based on liferay-portal-6.2-ce-ga5. on page want have iframe dynamic height. right have iframe this: <iframe id="1231-iframe" nam="iframe-name" src="http://localhost:123/ca-clickabledummy/test.html" page content (on payara41) is: <!doctype html> <html> <head> <title>title</title> </head> <body> <div style="height: 600px;background-color: #3c763d"> sadas</div> </body> </html> but if want iframe content i`m receive bug: error: permission denied access property "document" no matter i`m doing jquery/js cannot access property, blocks me. can me ?

VS Code on Ubuntu - Can't see menu bar -

we installed vs code on ubuntu 14.04 lts. did installing rpm , adding path path. when start code works fine except there no menu bar. (so can't check version). i have tried toggling 'view: toggle menu bar' command in command palette (f1) doesn't help. hitting alt takes me ubuntu 'type command' window. how can fix please?

html - Make inner div width dynamic -

i want give remaining width .inner div. @ same time it's siblings (a & span tags) can of dynamic width. any idea? code below & @ https://jsfiddle.net/pge8rqw0/ .top {} .inner { border-bottom: 1px solid black; background-color: green; width: auto; float: left; width: 50px; } { float: left; } span { float: right; background-color: red; } <div class="top"> <a href="http://www.w3schools.com">visit w3schools.com!</a> <div class="inner"></div> <span>html good</span> </div> thanks solution using display: flex . .top { display: flex; } .inner { border-bottom: 1px solid yellow; background-color: green; min-width: 50px; flex: 1; } { background-color: #f5f5f5; } span { background-color: red; } <div class="top"> <a href="http://www.w3schools.com">visit w3schools.com!...

Php userprofile that show on the side when you log in -

Image
how code on php or called type of userprofile? i got on gmail. that place users avatar displayed. data shown there being pulled database, possibly users table. being shown gmail more of design end(in case php). php instance pull user's records instance username , image. how decide display upto you.

C# Equivalent code in delphi for memory mapped files -

i got code 1 of vendor read memory mapped file in c#, due limitations need develop code in delphi-7 language. code got written below. the tool reading analog input hardware module. can 1 me find equivalent code of c# in delphi? c# code below- memorymappedfile file = memorymappedfile.openexisting("my_shared_location"); memorymappedviewaccessor reader = file.createviewaccessor(); (int = 0; < 16; i++) { inputbyte[i + 1] = reader.readbyte(i); } i found equivalent class of memorymappedfile still unable code rest of part in delphi-7. memory mapped files feature provided windows different processes share memory. i don't have access delphi compiler test this, should set on right path. i'm making assumptions based on code sample provided: intend reading data, you'll read 16 bytes. if these invalid, you'll have changed code accordingly. hfile := openfilemapping(file_map_read, false, "my_shared_location"); win32check(hfile);...

sql - Count and take average of not null columns in a single row -

i want count , take average of not null columns in each row example, have table this name | | b | c | d | e | f | | | | | | | | umar | 2 |null| 3 | 5 | null| 4 | ali |null|null| 3 |null| 1 | 4 | ali |null|null| 3 |null| null| 4 | the result should name | | b | c | d | e | f | average | | | | | | | umar | 2 |null| 3 | 5 | null| 4 | 3.5 ali |null|null| 3 |null| 1 | 4 | 2.66 ali |null|null| 3 |null| null| 4 | 3.5 var query = x in table select new { countnotnull = (x.a ?? 0) + (x.b ?? 0) + (x.c ?? 0) + (x.d ?? 0) + (x.e ?? 0) + (x.f ?? 0) }; if don't want count calculate average(you've changed question): var query = x in table let notnullcolcount = (x.a == null ? 0 : 1) + (x.b == null ? 0 : 1) + (x.c == null ? 0 : 1) + (x.d == null ? 0 : 1) + (x.e == null ? 0 : 1) + (x.f == null ? 0 : 1) let no...

ruby on rails - Check if a sentence includes any words in an array -

splitdescription = work.workdescription.downcase.split(' ') keywords = ['teamwork', 'developed', 'enhanced', 'transformed', 'achieved','grew', 'introduced', 'project', 'awarded', 'planned','supervised','created','designed','discovered','evaluated','promoted','represented','completed', 'devised','liaised','controlled','researched','organised','achieved','managed','analysed','assessed','conducted', 'solved','responsible for','responsibilities'] splitdescription.select {|word| word.include?(keywords)}.each |word| new_score += 0.5 end i have splitdescription splits , store description. i want see if of keywords in splitdescription , each keyword in splitdescription new_score goes 0...

hibernate - Redundant column - one to one mapping with composite id -

this model @entity public class picture { @embeddedid private pictureid id; ... } @embeddable public class pictureid implements serializable { private static final long serialversionuid = -8285116986358642545l; @column(nullable = false, name = "gallery_id") private long galleryid; @column(nullable = false, name = "author_id") private long authorid; @column(nullable = false, name = "ordinal_number") private int ordinalnumber; ... } @entity public class gallery { @id @generatedvalue private long id; private string name; @onetoone @joincolumns({ @joincolumn(name = "redundant_gallery_id", referencedcolumnname = "gallery_id"), @joincolumn(name = "cover_author_id", referencedcolumnname = "author_id"), @joincolumn(name = "cover_ordinal_number", referencedcolumnname = "ordinal_number") }) ...

hiveql - HIVE: no column names in output -

this how typical looks i use putty running hive queries. query results have no column names. setting doesn't have obvious check-box "add column names", not me anyways... can please? thanks more details: issue description execute command once in hive session: set hive.cli.print.header=true; alternatively add command in .hiverc file in home directory. see reference: https://cwiki.apache.org/confluence/display/hive/languagemanual+cli#languagemanualcli-thehivercfile

java - How to optimize large Elasticsearch index? -

i using elasticsearch 1.3. , have large index called index_a . there more 2 billion docs in index_a , more 1.5tb. write , read operations both frequent. since amount huge, there many problems in cpu usages, memory, io, gc, etc. i want optimize index , here methods i'm thinking about: jvm optimize. using java8 now. elasticsearch configuration. did't find useful information until now. split large index multiple small indices 1 field in index. tested index 1 billion docs , index 100 million , find performance improved 10x. before? any suggestion? thanks.

c# - Blank row in DataGrid if date is equal to 0001-01-01 -

Image
i have form user fills in , default field called followupdate set 0001-01-01. error saying date in wrong format if leave field blank had set default. when form saved creates new line in datagrid , followup date shows 0001-01-01. if date set row blank. foreach (datagridcolumn col in dg.columns) { if (col.headertext == "follow date") { // set row blank } } how check if row contains 1/1/0001 , if don't display date? try if date minimize if(yourcolunm == datetime.minvalue) { yourcolum = null; }

how can I print a char array in c++ -

i working on simple hotel reservsation project couldn't print customer name , payment type after entering names'. here piece of code typed. cout << "please enter customer name: " << endl; cin >> customername1; cin.getline(customername1,100,'\n'); fflush(stdin); cout << "please enter payment type: " << endl; cin >> paymenttype; cin.getline(paymenttype,100,'\n'); fflush(stdin); cout << "how many days stay: " << endl; cin >> days; room_income = days * 30; count_room++ ; count_customer1++ ; customer_name1[single]= new char [strlen(customername1)+1]; strcpy(customer_name1[single],customername1); payment_type[single]= new char [strlen(paymenttype)+1]; strcpy(payment_type[single],paymenttype); cout << "room number : " << single << endl<< endl; cout << "customer name : "<< customer_name1 << endl ...

javascript - How to validate US zip code using jquery -

i using below code validating email address using jquery. i need validate zipcode using jquery only. how can using jquery library. this jquery code: $("#page1").on("pageinit", function() { $("form").validate({ rules: { email: { required: true }, password: { required: true } }, errorplacement: function(error, element) { error.insertafter(element.parent()); } }); }); this html , css: label.error { color: red; font-size: 16px; font-weight: normal; line-height: 1.4; margin-top: 0.5em; width: 100%; float: none; } @media screen , (orientation: portrait) { label.error { margin-left: 0; display: block; } } @media screen , (orientation: landscape) { label.error { display: inline-block; margin-left: 22%; } } em { color: red; font-weight: bold; padding-right: .25em; } </style> </head> <body> <div id=...

matrix - what is the efficient way of implementing CholeskySolve in eigen without using intermediate matrices or buffers? -

i tried follows l = l.triangularview<lower>(); x1 = (l*l.transpose()).llt().solve(y1); where l,y1 input matrices , x1 output matrix.output came expected,but in case l matrix changes after execution of first statement. don't want change l matrix. suggestions. you have llt factorization, apply l 's inverse twice: x = l.triangularview<lower>().solve(y); x = l.triangularview<lower>().transpose().solve(x); no temporary, performed in-place.

sql server - How to check for Publisher and Subscriber in transactional replication? -

in transactional replication, @ particular point of time how can check , confirm whether data @ publisher , subscriber same? don't want check latency/trace token - latency tell how subscriber behind publisher/distributor? you can data validation see how out of sync are. details on validating data can found in validate replicated data . you can use tablediff utility or sql data compare see how out of sync , generate t-sql script bring data convergence.

resources - How to copy directory using maven copy resoures plugin -

i have referred maven documentation here https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html understand including whatever files need. has mentioned including files. how can copy directories , files inside specific directory using maven resources plug-in? try without specifying includes , excludes picks directories , files inside resources directory. <resources> <resource> <directory>src/main/resources</directory> </resource> </resources>

css3 - CSS will-not-change -

there new css attribute, called will-change , using can define properties changed frequently, browser can optimize it. example: .element { will-change: transform, opacity; } but opposite? there suggestions or working drafts will-not-change ? using possible hint browser, that properties never change (constants), can optimizations on it? browsers optimize layout algorithms properties "will not change" default. will-change way opt properties in might change (despite "will" in property name might suggest) browsers can perform necessary optimizations beforehand when properties do change (from initial value, @ least). think of way: properties aren't listed in will-change have been optimized "will not change", or "whether change or not makes no meaningful difference in performance." for example, will-change declaration tells browser create composition layer .element elements, in event need transformed or alpha composit...

Combining c++ algorithm with c# GUI -

i have tracker algorithm implemented entirely in c++ (am working vs 2013 x64 on win7). to plot tracks on world map want design gui (in c#) exploits built in graphical library in c#, should figure map on , want send it, periodically, relevant list of tracks computed tracker. of course, want able debug c++ algorithm vs while plotting tracks. is there tutorial explains how correctly? possible? you can use outer c++ dll s in c# this: [dllimport("user32.dll")] public static extern intptr findwindow(string classname, string windowtitle); so can add reference dll , call c# code. i'm not sure if allow debug c++ code, guess check v. kravchenko comment , try enable debugging mentioned.

Update status of the test case in MTM using c# -

i have assigned create c# application update test case status in mtm. i tried below code , working fine. problem below code updating result if test case executed, not updating status of newly created test case(no history of run) using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using microsoft.teamfoundation.client; using microsoft.teamfoundation.workitemtracking.client; using microsoft.teamfoundation.testmanagement.client; using microsoft.teamfoundation.testmanagement.common; using system.io; namespace updatetfs { class program { static void main(string[] args) { //args[0] = testplanid; args[1] = testcaseid; args[2] = status; args[3] = configuration int test_plan = int32.parse(args[0]); int test_case = int32.parse(args[1]); int test_config = int32.parse(args[3]); int result_updated = 0; textwriter tw = new streamwrit...

javascript - MongoDB: Store array of models -

i have declared following models: banana var banana = new mongoose.schema({ src: { type: string, max: 1000, default: "yabadaba" }); user var user = new mongoose.schema({ name: string, bananas: [banana] }); and have problems inserting data user collection. here's code: var data = [{ name: "batman", bananas: [ new banana({src: "nananana"}), new banana({src: "nana"}) ] }, { name: "robin", bananas: [ new banana({src: "meh"}) ] }]; for(var i=0, arrlen=data.length; i<arrlen; i++){ var item = new user(data[i]); item.save(); } and throws error... casterror: cast array failed value "..." @ user.bananas. name: casterror, kind: 'array', value: [object], path: user.bananas, reason: [object] as did not need store bananas db, created workaround this. if necessary store bananas separ...

android - Realm exception "nested transaction not allowed" even though there are no nested transactions -

recently started android app project. , needed manage data structured possible. so select realm , tinker it. but faced error. don't know why error happens. the error nested transactions not allowed. use committransaction() after each begintransaction(). my code in below. public class curatorapplication extends application { private realm realm; @override public void oncreate() { super.oncreate(); log.e("debug", "application class create!!"); configurerealmdatabase(this); } private void configurerealmdatabase(context context){ realmconfiguration config = new realmconfiguration.builder(context) .name("curator.realm") .build(); realm.setdefaultconfiguration(config); } } i register realm @ application class described in here and tried transaction @ activity. shows error. :( package com.nolgong.curator.screen; import android.os.bundle; ...

java - Cascade persist creates duplicate rows? -

i'm creating database entity object order , , assign multiple entities of type bookingcode . problem: creates single order in db, fine. order has @onetoone orderdescription , occurs duplicate in database. @entity public class bookingcode { @id private long id; @manytoone(cascade = {cascadetype.merge, cascadetype.persist, cascadetype.refresh, cascadetype.detach}) private order order; } @entity public class order { @id private long id; private string ordername; @onetoone(mappedby = "order", cascade = cascadetype.all, orphanremoval = true) private orderdescription description; } @entity public class orderdescription { @id private long id; //for simplicity 1 text element; of course multiple fields in real life private string text; @onetoone private order order; } test: order order = new order(); order.setordername("test"); orderdescription d = new orderdescription("testdescr")...

c++ - ‘va_start’ used in function with fixed args va_start(ap, flags); -

this seemingly simple code snipets giving me error cant figure out: the error message is: ‘va_start’ used in function fixed args va_start(ap, flags); static inline int sgx_wrapper_open64(const char *pathname, int flags,unsigned int mode) { va_list ap; va_start(ap, flags); if (flags & o_creat) mode = va_arg(ap, mode_t); else mode = 0777; va_end(ap); int retval; ocall_open2(&retval, pathname, flags, mode); return retval; } that's because va_start (and other variadic helper "functions" ) can used in functions argument list ends in elipsis ... . if can, modify function like static inline int sgx_wrapper_open64(const char *pathname, int flags, ...) { va_list ap; va_start(ap, flags); mode_t mode; if (flags & o_creat) mode = va_arg(ap, mode_t); else mode = 0777; va_end(ap); int retval; ocall_open2(&retval, pathname, flags, mode); retu...

javascript - TypeError: $.url is not a function -

i having javascript file named _report_js.html.erb file under app/views/reports. when run application, getting error: typeerror: $.url not function this code: <script type="text/javascript"> if($.url().param('ig') == 'true') { alert("hi"); $('#icons').hide(); $('#photos').show(); end </script> $.url() is not part of jquery core. if want achieve similiar, maybe use var geturlparameter = function geturlparameter(sparam) { var spageurl = decodeuricomponent(window.location.search.substring(1)), surlvariables = spageurl.split('&'), sparametername, i; (i = 0; < surlvariables.length; i++) { sparametername = surlvariables[i].split('='); if (sparametername[0] === sparam) { return sparametername[1] === undefined ? true : sparametername[1]; } } }; to use it: var tech = geturlparame...

what is the difference between collection and array in php (propel)? -

collections , on-demand hydration advantage of using a collection instead of array propel can hydrate model objects on demand. using feature, you'll never fall short of memory when retrieving large number of results. available through setformatter() method of model queries, on-demand hydration easy trigger: <?php $authors = authorquery::create() ->limit(50000) ->setformatter(modelcriteria::format_on_demand) ->find(); foreach ($authors $author) { echo $author->getfirstname(); } 1) what meaning of "hydration" here? 2) what difference between collection , array? source : propel @1.6 1.hidration a means improve performance "filling" class/object row data when need it. instead of doing "select * sometable" large table, propel fire off "select id sometable" , inside loop, "select [colums] sometable id=[currentid]" , hence "on demand" 2. collection vs array array normal ...

javascript - How do I filter and structure this JSON? -

i have array of json objects known events, has fields eventid, eventname , importantly dateofevent. [{event1}, {event2}, {event3}]; i need iterate on array of events , filter out events on same day. obtain new object this. "days": [ { "date": "11-05-2015", "events": [ {"eventid": 1, ...}, {"eventid": 2, ...}, {"eventid": 3, ...}, {"eventid": 4, ...}, ] }, how can efficiently javascript or angular? you can create new object dates keys, , values arrays contain events. after have date => events map, convert array in structure want. assuming original data in variable called "events": var events = [{event 1}, {event 2}...]; var daysmap = {}; var days = []; events.map(function(event) { if (days[event.dateofevent] === undefined) { days[event.dateofevent] = []; ...

javascript - For jQgrid Subgrid,Service is not getting called through url attribute -

this code how trying include sub grid in jqgrid. var receiveddata = <% =groupbyagentjsondata %> jquery("#" + '<%=reportjqgrid.clientid%>').jqgrid({ data: receiveddata, datatype: "local", height: 270, width: "1130", colnames: ['client name', 'return batchid', 'report sent date', 'report type', 'attested count', 'status'], colmodel: [ { name: 'name', index: 'name', width: 20, stype: 'text', sortable: true }, { name: 'report_sent_id', index: 'report_sent_id', width: 20, sortable: true }, { name: 'report_sent_date', index: 'report_sent_date', width: 20, sortable: true }, { name: 'report_type', index: 'report_type', width: 20, sortable: true }, ...

file - How to copy artifacts present in artifactory to specific repository? -

i trying copy artifacts present in artifactory repository , used powershell code source artifactory path , destination repo path, i'm facing downloadfile error "2" arguments issue. $source = "artifactory/test/sample.zip"; $dest= "repo/infra/test/admin.zip"; $usr="---" $pwd="----" $webclient=new-object system.net.webclient $webclient.credentials=new-object system.net.networkcredentials($usr,$pwd) $webclient.downloadfile($src,$dest) error after running above code exception calling "downloadfile" 2 arguments " exception occurred during webclient request" please specify how resolve issue

javascript - destroy multiple charts on same page -

i creating project using angularjs. in project integrating charts using angularcharts.js.in project displaying 2 charts on same page. want destroy both charts when user change select filed on select box, unable that. here code: in js: $scope.$on('create', function(event, chart) { console.log(chart) $rootscope.checkgraph = chart; }); if($scope.allflows.length == 0) $scope.checkgraph.destory() } in html: <canvas id="line" class="chart chart-line" chart-data="databilling" chart-labels="labelsbilling" chart-colours="ocw.colours" chart-options="options" chart-legend="true" chart-click="onclick" height="150" width="400"> </canvas> <canvas id="line" class="chart chart-line" chart-options="options" chart-data="data" chart-labels="labels" chart-colours="ocw.colours" char...

sql - Executing mySQL queries in R with MonetDB -

i new sql , using monetdb load large file r studio. have loaded data db using monetdb, , execute r code below on data in database: my_selection <- db_data %>% group_by(id) %>% tally(. , sort = true) %>% top_n(100) %>% select(id) basically, want group data "id", tally , sort it, , select 100 largest elements in it. equivalent of in sql? i executing queries in following way in r: my_selection <- dbgetquery(connection,"select * my_table [insert rest of code here]") that's depends on dbms you're using , sql-server : select top 100 id,sum(yourothercolumn) sum_c yourtable group id order sum_c desc mysql : select id,sum(yourothercolumn) sum_c yourtable group id order sum_c desc limit 100 if it's else, tell me , i'll edit answer.

javascript - Do $http request from Angular Interceptor? -

i'm trying implement angular interceptor exceptions. 1 @ least. have token , when old enogh backend throws tokenalmostexpired exception . exception contains errorcode = 101 . in interceptor i'm checking code 101 , need send post request backend's /refresh endpoint refresh token. .factory('errorinjector',['$injector', function ($q, $injector) { var vm = this; var errorinjector = { 'response': function (response) { console.log(response); return response; }, 'responseerror': function (rejection) { if (json.stringify(rejection.data.errorcode) === json.stringify(101)) { vm.getrefreshtoken(); } return $q.reject(rejection); } }; return errorinjector; }]); and .config(['$httpprovider', function ($httpprovider) { $httpprovider.interceptors.push('errorinjector'); }]); $http but there...

django - Cannot compile less with attr() -

i've encountered error while compiling using gulp, tried count using html attribute data-list-count when saved file, gulp gave error potentially unhandled rejection [2] typeerror: cannot read property 'denominator' of undefined @ dimension.operate (/node_modules/less/lib/less/tree/dimension.js:87:58) @ operation.eval (/node_modules/less/lib/less/tree/operation.js:31:18) @ expression.eval (/node_modules/less/lib/less/tree/expression.js:31:37) @ expression.eval (/node_modules/less/lib/less/tree/expression.js:31:37) @ value.eval (/node_modules/less/lib/less/tree/value.js:18:30) @ rule.eval (/node_modules/less/lib/less/tree/rule.js:56:33) @ ruleset.eval (/node_modules/less/lib/less/tree/ruleset.js:149:50) @ ruleset.eval (/node_modules/less/lib/less/tree/ruleset.js:149:50) @ ruleset.eval (/node_modules/less/lib/less/tree/ruleset.js:149:50) @ ruleset.eval (/node_modules/less/lib/less/tree/ruleset.js:149:50) html(django) <ul data-list-count="4"> <li...

node.js - message AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool not a function in aws lambda -

i trying use aws cognito user pool in aws lambda function. saw in tutorial need include amazon-cognito-identity.min.js in code not sure how in node js. use npm install external modules don't think aws-cognito-identity exists yet module. i installed aws-sdk function awscognito.cognitoidentityserviceprovider.cognitouserpool not exist in sdk. by way, here's code in lambda: 'use strict'; var aws= require('aws-sdk'); aws.config.region = 'ap-northeast-1'; // region aws.config.credentials = new aws.cognitoidentitycredentials({ identitypoolid: 'ap-northeast-1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' // identity pool id here }); // need provide placeholder keys unless unauthorised user access enabled user pool //awscognito.config.update({accesskeyid: 'anything', secretaccesskey: 'anything'}) var pooldata = { userpoolid : 'us-east-1_xxxxxxxxx', clientid : 'xxxxxxxxxxxxxxxxxxxxxxxxx' }; var userpoo...

How to use specific datas from a CSV file to a JavaScript chart? -

so use specific datas out of huge csv file in order create several js charts different datas (from same csv file). i'm pretty new js, , created simple charts raw datas using google charts , d3. my csv contains on 20 columns , use 2 or 3 each charts. here csv looks like: volume;n° d'e;référence interne;date d'envoi de l'e;mois & année;etat de l'e;date de l'état;date de l'état;provenance;email de l'expéditeur;nom de l'expéditeur;prénom de l'expéditeur;entreprise expéditrice;groupe de l'expéditeur;email du destinataire;nom du destinataire;prénom du destinataire;type destinataire;entreprise du destinataire;notification sms;nombre de pièces-jointes;poids des pièces-jointes;produit;nombre de relances;satut notification sms;satut notification email; so question : how use specific column csv ? thanks in advance

How to get Active User information in MobileFirst 8 Java Adapters? -

i have defined userlogin security check extending userauthenticationsecuritycheck class . once user authenticated need set attributes when creating user in protected authenticateduser createuser() function in order use them later headers in java adapter. my problem i'm not able active user information adapter resource secured @oauthsecurity(scope = "userlogin") . have tried defining in securitycheck following function: public authenticateduser getuser() { return authorizationcontext.getactiveuser(); } and calling on way adapter: userlogin userlogin; logger.info("logging info message..."+userlogin.getuser().getid()); but returns null pointer exception. how suppose active user information java adapters? the adaptersecuritycontext class provides security context of adapter rest call. inside java adapter class, add following @ class level: @context adaptersecuritycontext securitycontext; you can current authenticateduser...

ios - Remove settings -

i'm making ios app, , want remove settings option when tap bottom bar (so close , exit remain). there way this, , how? thanks in advance! all required changes made inside sktnavigationmanager.m: you need remove "settings" option action sheet before: - (void)mapview:(skmapview *)mapview didtapatcoordinate:(cllocationcoordinate2d)coordinate { sktactionsheet *sheet = nil; if ([self currentnavigationstate] == sktnavigationstatecalculatingroute) { sheet = [sktactionsheet actionsheetwithbuttontitles:@[nslocalizedstring(ksktquitkey, nil)] cancelbuttontitle:nslocalizedstring(ksktcancelkey, nil)]; } else { sheet = [sktactionsheet actionsheetwithbuttontitles:@[nslocalizedstring(ksktsettingskey, nil), nslocalizedstring(ksktquitkey, nil)] cancelbuttontitle:nslocalizedstring(ksktcancelkey, nil)]; } sheet.delegate = self; _activeactionsheet = sheet; [sheet showinview:_mainview]; } after: - (void)mapview:(skmapview *)mapview didtapatcoordinate:(clloca...

letters - How to change a Hunspell affix file to allow numbers in words? -

ocr programs mistakenly recognize capital letter o 0 or vice versa. example, might recognize on 0ver or we11. i tried add rep 0 o rep 1 l to affix file, didn't work because numbers apparently considered word boundaries. (i had @ hunspell man page , can't figure out of numerous settings needs changed allow numbers in words.) from manpages: rep replacement table specifies modifications try first. first rep header of table , 1 or more rep data line following it. table, hunspell can suggest right forms typical spelling mistakes when incorrect form differs more 1 letter right form. search string supports regex boundary signs (^ , $). example possible english replacement table definition handle misspelled consonants: rep 5 rep f ph rep ph f rep tion$ shun rep ^cooccurr co-occu...

scala - ERROR when using SPARK : java.lang.NoClassDefFoundError: dispatch/Http -

when using spark-submit error happen: error executor: exception in task 0.0 in stage 137.0 (tid 35) java.lang.noclassdeffounderror: dispatch/http$ although have import lib (i'm using scala) : import dispatch._, defaults._ part of code : def publishtonsq(data: string) = { val topic = "post_similar_items_to_elasticsearch" val host = "192.168.100.160:4151" def myrequest = url(s"$host/pub?topic=$topic") def myrequestasjson = myrequest.setcontenttype("application/json", "utf-8") def mypostwithbody = myrequestasjson << data val response = http(mypostwithbody ok as.string) println(response) } this part of build.sbt : scalaversion := "2.10.5" librarydependencies += "org.apache.spark" %% "spark-core" % "1.6.1" librarydependencies += "org.apache.spark" %% "spark-mllib" % "1.6.1" librarydepe...

c# - Trigger an Event after x seconds, but also cancel it before it executes -

i'm developing web api (which works quite well). what's missing? here sample code of get action: public ienumerable<xxxx> get() { ienumerable<xxxx> yyyy = new list<xxxx>(); //get yyyy database timer = new timer(); timer.autoreset = true; timer.enabled = true; timer.interval = 5000; //miliseconds timer.elapsed += timer_elapsed; timer.start(); return yyyy; } void timer_elapsed(object sender, elapsedeventargs e) { //code executed when timer elapses... } so once request received, timer initialized , fire elapsed event @ interval of 5 seconds. on next subsequent request continues.... the expected behavior such that: initialize request -1 initialize timer -1 if request same client received within 5 seconds, timer must not fire elapsed event. if no request received same client within 5 seconds, timer should elapse , fire event. also timer has nothing client(s). here further business scenario re...

android - Switch from Activity to Fragment -

i have problem using fragments within activity. i'd step fragment activity , i'm close this. here activity: utils u; fragment fragment; framelayout framelayout; button btn; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btn = (button)findviewbyid(r.id.galleryid); framelayout = (framelayout)findviewbyid(r.id.fragmentcontainer); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { try { fragment = new galleryfragment(); utils.fragmentmanager(framelayout.getid(), fragment, mainactivity.this); } catch (exception e) { e.getstacktrace(); } } }); utils: public class utils { public static void fragmentmanager(integer contentid, fragment fragment, activity activity) { try { fragmentmanager fm = activity...

postgresql - How to turn off messages from c3p0 while using Clojure jdbc -

i using clojure jdbc , c3p0 connection pooling. before running query , startting of application prints out message follows console. jul 11, 2016 6:22:48 pm com.mchange.v2.log.mlog info: mlog clients using java 1.4+ standard logging. jul 11, 2016 6:22:48 pm com.mchange.v2.c3p0.c3p0registry info: initializing c3p0-0.9.5.2 [built 08-december-2015 22:06:04 -0800; debug? true; trace: 10] jul 11, 2016 6:22:48 pm com.mchange.v2.c3p0.impl.abstractpoolbackeddatasource info: initializing c3p0 pool... com.mchange.v2.c3p0.combopooleddatasource [ acquireincrement -> 3, acquireretryattempts -> 30, acquireretrydelay -> 1000, autocommitonclose -> false, automatictesttable -> null, breakafteracquirefailure -> false, checkouttimeout -> 0, connectioncustomizerclassname -> null, connectiontesterclassname -> com.mchange.v2.c3p0.impl.defaultconnectiontester, contextclassloadersource -> caller, datasourcename -> z8kflt9h1ohpn8xry5id4|663c9e7a, debugunreturnedconne...

python 2.7 - HTML download using tcp -

how can use tcp interact server , download html file computer? know first need preform 3 way handshake , send request. then? thank you html text written in packet's raw layer in scapy. in order save html file, write pkt[raw].load text file.

android - How to pass a bundle of a LinkedHashMap FROM Fragment back to its Activity -

i have expandable listview in activity containing questions in groups. answers answered in fragment when user choose question. i gather positions of child , group positions in linkedhashmap. how send map activity? thank you i think simplest way pass activity simple setter: inside activity: private linkedhashmap linkedhashmap; public void setlinkedhashmap(linkedhashmap linkedhashmap) { this.linkedhashmap = linkedhashmap; } inside method in fragment: myactivity myactivity = (myactivity) getactivity(); myactivity.setlinkedhashmap(linkedhashmap);

matlab - Same value must exist at least 3 times in a Matrix -

the matrix <1x500> consists of different values, want check if of values in matrix occurs @ least 3 times or more. if (val occurs 3 times or more) help appreciated! another option @kiw answer when need know values appear @ least 3 times is: uniqa=unique(a); counts=histcounts(a,[uniqa inf]); vals_that_are_bigger=uniqa(counts>=3); to check if of them bigger 3, just if any(counts>=3)

c# - Using a custom ListBoxItem definition in ListBox for performance analysis -

i trying analyze performance of code , better understand redraw behavior of wpf canvas using itemspanel inside listbox . end have defined custom class mylistboxitem derives listboxitem (see code below). unfortunately cannot figure out how use class inside listbox . tried binding list of mylistboxitem instances listbox.items in xaml items="{binding path=listboxitemslist}" , error 'items' property read-only , cannot set markup. is there way achieve this? or perhaps there other alternative achieve doing? (i.e. analysis of redraw-behavior) definition of mylistboxitem : public class mylistboxitem : listboxitem { public mylistboxitem(objectviewmodel vm) { this.datacontext = vm; } size? arrangeresult; protected override size measureoverride(size constraint) { var vm = (this.datacontext objectviewmodel); if (vm != null) { debug.writeline("for objectviewmodel " + vm.name + ...

c - scan-build make does not detect any bugs -

i have simple .c file, obvious bugs inside it. #include <stdio.h> struct s { int x; }; void f(struct s s){ } void test() { struct s s; f(s); // warn } int test2(int x){ return 5/(x-x); // warn } int main(){ test(); test2(532); printf("hej\r\r"); } i trying use clang's static code analyzer tool (scan-build) detect errors. when run tool directly on files, example using following command: scan-build g++ -o 1 1.c i intended output, including warning compiler mentions division 0. scan-build: using '/usr/lib/llvm-3.8/bin/clang' static analysis 1.c: in function ‘int test2(int)’: 1.c:16:11: warning: division 0 [-wdiv-by-zero] return 5/(x-x); ^ 1.c:16:11: warning: division 0 return 5/(x-x); ~^~~~~~ 1 warning generated. scan-build: 1 bug found. scan-build: run 'scan-view /tmp/scan-build-2016-07-11-152043-3028-1' examine bug reports. now, trying put command simple makefile. content...

ionic2 - Ionic 2 using custom css -

Image
i building ionic2 app (actually learning), , trying apply custom css component, not successful. my app folder structure following: my app.core.css: @import "../pages/start/start"; @import "../pages/farmlist/farmlist"; @import "../pages/slider/slider"; @import "../pages/farm/farm"; my slider.component.ts <ion-slides #myslider [options]="myslideoptions" id="myslides"> <ion-slide > <div padding> <h1>welcome swarms app</h1> <p>here can view, manage , manipulate data</p> </div> </ion-slide> <ion-slide> <h1>slide 2</h1> </ion-slide> <ion-slide> <h1>slide 3</h1> <button (click)="gotohome()">start</button> </ion-slide> </ion-slides> i trying add properties in slider.scss has no effect. how can apply styles it? also, created folder '...

asp.net - C# accessing network disk -

i trying access network disk, c#, i've tried doing this: if (!directory.exists(path)) //with \\server\path or if (!(new fileinfo(path).exist)) //with \\server\path both tell me not exist. i must say, running asp.net site , trying reach there, don't know if matters? the thing trying dll needs path root directory of it's contents need specify path, path located in disk s disk s not logical disk, it's network disk. we start iis website administrator of whole domain prevent not having privileges. server\\path\path\path doesn't correct unc pathname me. \\server\path\path\path should correct. secondly, user account under iis process runs needs have appropriate permissions network location in question. identity used determined application pool it's in, or if app uses impersonation identifying client user. either way should careful grant permissions absolutely required app, , no more.

mongodb - Mongo distinct query returns several records one of which is "". But find null fails to find it -

i ran distinct query on collection. query syntax: db.collection.distinct("dict.field") i got set of results - 1 of "" (null). i tried find record had null value field in question: db.collection.find({"dict.field": null}) to surprise, no record found. no indexes set on collection other _id. the field in question dictionary. what missing? you should db.collection.find({"dict.field": ""}) instead. null , string ("") considered different datatypes. https://docs.mongodb.com/manual/reference/bson-types/

python - Reading string incorrectly from row field using Pypxlib -

heres code similar example given here ( pypxlib on github ) from pypxlib import table table = table(file) try: row in table: print(row['ident']) finally: table.close() for around half of table reads field correctly, other half gives me wierd output. ~rackc\sgr2\cmp2\sla ~rackc\sgr2\cmp2\run ~rackc\sgr2\cmp2\unl1 ~rackc\sgr2\cmp2\cycles subcool outlet temp rack b subcool outlet temp rack b03 fans rack view (name below) ~eepr #1 rack b\percent open valve 3 [~tf:refriglib\tsildata_refrig_lib~][~p:3~]~eepr #1 rack b\[~strhistrefriglib_cstpercentopenvlv~] subcool outlet temp rack d d02 fans rack view (name below) ~eepr #1 rack d\percent open valve 3 [~tf:refriglib\tsildata_refrig_lib~][~p:3~]~eepr #1 rack d\[~strhistrefriglib_cstpercentopenvlv~] warm fluid temp warm fluid 3 way valve % (name below) ~eepr #1 rack a\effect setpt valve 1 [~tf:refriglib\tsildata_refrig_lib~][~p:1~]~eepr #1 rack a\[~strhistrefriglib_csteffectsetptvlv~] anyone have idea on...

javascript - Get UTC Offset from date with different timezone -

im struggling date issues , love help. want offset utc timezone name. getting date server in format: "july 11, 2016::11:09:43 idt" (time zone in case idt- can other timezone). want able offset idt (in case) utc. there way figure out? thanks! livnat:) if examine list of time zone abbreviations , corresponding offsets, such the list on wikipedia or the list on timeanddate.com , may able find idt abbreviation israel daylight time, , equal utc+3. however, upon further examination you'll find there many abbreviations ambiguous. example: cst of: central standard time (utc-6) china standard time (utc+8) cuba standard time (utc-5) bst of: british summer time (utc+1) bangladesh standard time (utc+6) bougainville standard time (utc+11) ... , many others. you'll find 2 lists mentioned not identical. that's because in general, time zone abbreviations convention , not standard . therefore, if have abbreviation, , want cover time ...

sql - C# deadlock information -

is there way report on microsoft sql server deadlock information in c#? have c# program running queries, updates, etc... gets deadlock error error message not particularly helpful in diagnosing problem: transaction (process id 347) deadlocked on lock resources process , has been chosen deadlock victim. rerun transaction. right have track down dba go search through sql logs deadlock graph. wondering if there way @ information programatically? the details of deadlock not returned client. in later versions of sql server, 1 method deadlock details programmatically querying system_health extended event session sample query below, can tweak specific situation. note method requires view server state permissions. --get deadlock_report ring_buffer target select xed.value('@timestamp', 'datetime') creation_date, xed.query('.') extend_event ( select cast([target_data] xml) target_data sys.dm_xe_session_targets xt inne...

java - FileNotFoundException when accessing a resource file after deploy to tomcat -

i got 2 maven projects: a jar resource file accessed code a war has restful service uses jar when jar unit tests run, able access resource file. after deploying tomcat, access resource file fails filenotfoundexception i tried both these lines same results: file file = new file(getclass().getclassloader().getresource("file.xml").getfile()); and file file = new file(getclass().getresource("/file.xml").getfile()); when debugging, found value of file following: file:/usr/share/tomcat8/webapps/root/web-inf/lib/com.projectgroup.projectname-1.0-snapshot.jar!/file.xml i've opened jar @ location , found file there. idea why happening. try use getresourceasstream() insteed of resource.getfile() another way xml file loaded in classpath using spring framework below: pathmatchingresourcepatternresolver resolver = new pathmatchingresourcepatternresolver(); resolver.getresources("classpath*:your/package/**/file.xml");