Posts

Showing posts from June, 2015

Typecasting to 'int' in Python generating wrong result -

i tried performing following typecast operation in python 3.3 int( 10**23 / 10 ) output: 10000000000000000000000 and after increasing power 1 or further int( 10**24 / 10 ) output: 99999999999999991611392 int( 10**25 / 10 ) output: 999999999999999983222784 why happening? although simple typecasting like int( 10**24 ) output: 1000000000000000000000000 is not affecting values. you doing floating-point division / operator. 10**24/10 happens have inexact integer representation. if need integer result, divide //. >>> type(10**24/10) <class 'float'> >>> type(10**24//10) <class 'int'>

google cast - Chromecast returns receiver_unavailable -

i want use own custom receiver along chrome sender. when try set connection chrome.cast.requestsession returns {code: "receiver_unavailable", description: null, details: null} the receiver app available @ provided url chromecast developer console. app has not been published yet, if not wrong, not need published during developing process. i waited more 6 hours make sure receiver url propagated device mentioned on developers pages. , resetted chromecast. i don't know missing. check chromecast serial number, either take photo , zoom in read way (hard distinguish o 0, etc) or use developer console show or listen serial number on chromecast itself reboot chromecast if problem still persists, please contact our support getting further help. p.s. please update title receiver_unavaliable rather sender_unavailable

javascript - How to fetch and insert user's phone number in text field on visit -

goal: when user view page, mobile device, automatically insert phone number in input field, make easier convert him in lead. of course there privacy policy etc. it promo page, can 10% discount on burger king if you'll leave phone number. when it's typed-in it's lot easier think. so, can automatically insert mobile user's phone number in text field? if can, language have use. thanks lot. manifest <uses-permission android:name="android.permission.read_phone_state"/> activity telephonymanager tmgr = (telephonymanager)mappcontext.getsystemservice(context.telephony_service); string mphonenumber = tmgr.getline1number();

javascript - Styling a ID that is generated GUID -

i'm looking style specific jqueryui dialog centers itself. problem id changes because it's generated guid in controller. how select id that's changing can center it? this in controller viewbag.uniqueid = guid.newguid().tostring(); this in cshtml <div class="__helpitemarea" id='@string.format("div{0}", viewbag.uniqueid)' style='@(viewbag.windowwidth==null ? "" : string.format("width:{0}px;",viewbag.windowwidth)) @(viewbag.windowheight==null ? "" : string.format("height:{0}px;",viewbag.windowheight)) '> as can see, generates guid div id, there's no way can select specific div style it. suggestions? since div id's dynamically generated , they're guid 's , don't want use class since it's being used on other elements well. i'd suggest use jquery data attributes. so let's assume have data attribute data-item='helparea' on div s

wpf - How to get TextBox's line from mouse position? -

i have textbox has many lines of text, it's being update this: public void updatemessagebox(textbox textbox, string text) { textbox.selectionstart = 0; textbox.selectionlength = 0; textbox.selectedtext = string.format("{0:hh:mm:ss }", datetime.now) + text + "\n"; textbox.scrolltohome(); } now need text line on mouse middle button clicked right away, not selecting line via left click first. private void textbox_previewmousedown(object sender, mousebuttoneventargs e) { if (e.changedbutton == mousebutton.middle && e.buttonstate == mousebuttonstate.pressed) { e.mousedevice.getposition(textbox) //what next? } } how can textbox line , it's text mouse position? xaml <grid x:name="layoutroot"> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="auto" /&g

wcf - Create and bind SSL certificate in WIX setup project -

how can create ssl certificate , bind certificate wcf rest service hosted windows service in wix setup installer? i got 2 options on mind : 1. harvest certificate heat , custom action bind wcf 2.add certificate custom action project resources embedded file , write selected directory custom action , bind wcf

Jenkins presend script modification -

iam trying modify default presend script of jenkins project, need send different email message success , failure. right default content has success message content output of batch file , works champ when job failed, iam getting same message doesn't make sense.. pls advice how fix presend script send correct message based on condition.

javascript - Google Proximity Api 403 Unauthorized error -

when try make post request google proximity api have error: { "error": { "code": 403, "message": "unauthorized.", "status": "permission_denied" } } i use service account make request authorization: bearer + token know if google proximity api support oauth2 service account? thank you!! basically need enable api on google console project , create credentials using sha1 of debug.key. if you're using google oauth playground have configure settings changing oauth flow client side. next click on use own oauth credentials , copy browser client id created oauth google console. should authorize work. source from google developer

Compare 2 SQL server database from inside a vb.net program -

i'm using vb.net 2013 , sql server 2008r2 , , smo. i have 2 sql server databases ( backup files .bak ). i need find differences between database1 , database2 ( structure , relationships ) , after apply these changes on database2 in order database have same structure , relationship database1. how can ? thank ! are trying write program this? if not easiest way restore databases onto sql server , use visual studio 2012 has sql scheme , sql data comparisons or alternative piece of software. this not place type of question.

angularjs - Angular directive calls function passed by isolated scope (ngclickfunction:'&') works fine but browser gives: Uncaught SyntaxError: Unexpected token } -

i have created button directive want reuse along site. daniboomerangdirectives.directive('button', function() { return { restrict: 'ea', scope: { ngclickfunction: '&' }, template: function (elem, attrs) { ... if (attrs.onclick == 'function') { link = '<a id="button-link" href="" ng-click="ngclickfunction()">' + linkcontent + '</a>'; } ... return '<div id="button-wrapper"><div id="button">' + link + '</div></div>'; } }; }); the idea ng-click function passed 1 uses button directive, , button directive calls function passed parent via ngclickfunction: '&' when user clicks in <a> element of button .directive('daniboomerangintro', function($timeout, $rootscope, $compile) { return { restrict: 'a', templateurl: 'views/intro.ht

algorithm - Tangents range for all pairs of points in a box -

Image
suppose have box lot of points. need able calculate min , max angles lines go through possible pairs of points. can in o(n^2) times enumerating every point others. there faster algorithm? taking idea of dual plane proposed evgeny kluev, , comment finding left-most intersection point, i'll try give equivalent direct solution without dual space. the solution simple: sort points (x, y) lexicographically. draw line through each 2 adjacent points in sorted order. can proved minimal angle achieved 1 of these lines. in order maximal angle, need sort (x, -y) lexicographically, , check adjacent pairs of points. let's prove idea min angle. consider 2 points a , b yield minimal possible angle. among such points can choose pair minimal difference of x coordinates. suppose have same y . if there no other point between them, adjacent. if there points between them, @ least 1 of them adjacent a in our order, , of them yield same angle. suppose there exists point p

c# - Not able to refresh WPF Combobox inside datagrid -

Image
i new in wpf , need bind combobox inside datagrid based on button click outside datagrid. means every time when click on button combobox inside datagrid should refresh. i able bind source column combobox not getting refreshed when click on apply button changing source file shown in above image. xaml code did is <grid name="grdmappedtables" margin="0,109,466,28" background="lightgray"> <grid.resources> <objectdataprovider x:key="sourcedataprovider" objecttype="{x:type local:sourcetable}" methodname="fillsourcetablecol" ></objectdataprovider> </grid.resources> <datagrid name="dgmappedtables" renderoptions.cleartypehint="enabled" textoptions.textformattingmode="display" canuseraddrows="false" selectionunit="fullrow" style="{dynamicresource azuredatagrid}" gridlinesvisi

android - Is there anyway to set custom icon for FloatingActionMenu on close and open? -

i have used floatingactionmenu in project github library link here . can't customize icons of floating action menu on open , close. you can listen click , maintain boolean boolean is_expanded; now on first click set is_expanded = !is_expanded; and if(is_expanded){ fab.setbackgrounddrawable(drawable_expanded); }else{ fab.setbackgrounddrawable(drawable_collapsed); }

html - CSS active not returning normal state -

does know why button not return normal state on click? click activates active style not go after. button, .button { display : inline-block; cursor : pointer; width : 200px; border-style : solid; border-width : 1px; border-radius : 50px; padding : 10px 18px; box-shadow : 0 1px 4px rgba(0,0,0,.6); font-size : 9.5pt; font-weight : bold; color : #fff; text-shadow : 0 1px 3px rgba(0,0,0,.4); font-family : sans-serif; text-decoration : none; } .button:active { padding: 8px 13px 6px; font-weight:normal; } button.green, .button.green { border-color: #8fc800; background: #8fc800; background: -moz-linear-gradient(top, #8fc800 0%, #438c00 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#8fc800), color-stop(100%,#438c00)); background: -webkit-linear-gradient(top, #8fc800 0%,#438c00 100%); background: -o-linear-

Print a double(> than 17 digits) value without E notaion in Java -

i have requirement of printing 22 digit number, when print it, jvm using e notation. have tried bigdecimal class, printf(), string.format(), didn't succeed. accurate till 17 digits, 18th digit data manipulated. example: original number : 2333333333333333333333 output: 2333333333333333456252 here fragment of code. hope helps double[] n = new double[t]; for(int i=0;i<t;i++){ n[i] = double.parsedouble(scn.next()); } if(........){ system.out.println(new bigdecimal(n[i]).toplainstring()); system.out.printf("%.0f ", n[i]); } you're passing in double constructor of bigdecimal causing precision lost. use system.out.println(new bigdecimal(scn.next()).toplainstring());

jar - How can I use two versions of the same library in the same project in Java? -

this question has answer here: java, classpath, classloading => multiple versions of same jar/project 4 answers let's i'm using xmlsec-1.5.8.jar 1 part of application (it has used this). then let's i'm adding new feature application , new feature requires use of xmlsec-2.0.5.jar. i don't want replace xmlsec's usage old code because don't want re-test code has been working (much of code of don't know how works because created before arrived @ company). is there way in java use xmlsec-1.5.8.jar classes in 1 part of project , use xmlsec-2.0.5.jar in part? you need class loaders. it's pretty tricky, here's explanation you. java, classpath, classloading => multiple versions of same jar/project you'll have unload old jar, load new jar, run whatever new function are, unload newer jar , reload older jar.

javascript - Print function is rendered before angular loads values? -

Image
i need values on first 1 image when call print function on second pictures.i tried angular.element(document).ready(function(){ $window.print }); and tried use ng-binding , ng-cloak results on second image i have page have button: i have controller have: $scope.printfunction = function () { localstorage.setitem("payouttime", $scope.testpayouttime); localstorage.setitem("payoutamount", $scope.testpayoutamount); localstorage.setitem("pin", $scope.testticketpin); $window.open("/print"); } and when view open have controller on view: $scope.ticketpin = localstorage.getitem("pin"); $scope.payouttime = localstorage.getitem("payouttime"); localstorage.payoutamount = localstorage.getitem("payoutamount"); $window.print(); how can render variables before print function? there in lies problem. it’s rat race: whatever happens ther

Reading Avro into spark using spark-avro -

i'm not being able read spark files using spark-avro library. here steps took: got jar from: http://mvnrepository.com/artifact/com.databricks/spark-avro_2.10/0.1 invoked spark-shell using spark-shell --jars avro/spark-avro_2.10-0.1.jar executed commands given in git readme: import com.databricks.spark.avro._ import org.apache.spark.sql.sqlcontext val sqlcontext = new sqlcontext(sc) val episodes = sqlcontext.avrofile("episodes.avro") the action sqlcontext.avrofile("episodes.avro") fails following error: scala> val episodes = sqlcontext.avrofile("episodes.avro") java.lang.incompatibleclasschangeerror: class com.databricks.spark.avro.avrorelation has interface org.apache.spark.sql.sources.tablescan super class @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:760) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclass

phpmailer - PHP mailer error: Message body empty -

i had (until yesterday) working form in website. form asks questions , sends customized email depending on answers. working ok, stopped working. here error status: message not sent.mailer error: message body empty i´ve changed nothing these months. maybe server upgrade? php version upgrade? wordpress upgrade? find attached php code, maybe find wrong "new standard" or version of php... require_once("phpmailer/class.phpmailer.php"); // recuperación de las variables del formulario $duracion = $_post['duracion']; $idiomas = $_post['idiomas']; $provincias = $_post['provincias']; $zonas = $_post['zonas']; $nombre = $_post['nombre']; $empresa = $_post['empresa']; $telefono = $_post['telefono']; $email = $_post['email']; $mail = new phpmailer(); $mail->issmtp(); // telling class use smtp $mail->host = "localhost"; // smtp server $mail->smtpauth = true; // enable smtp authent

python - statsmodels ARIMA.fit: Hide output -

it seems whenever run arima.fit() , stdout kalman filter: ## -- end pasted text -- running l-bfgs-b code * * * machine precision = 2.220d-16 n = 1 m = 12 problem unconstrained. @ x0 0 variables @ bounds @ iterate 0 f= 5.60459d-01 |proj g|= 2.22045d-08 * * * tit = total number of iterations tnf = total number of function evaluations tnint = total number of segments explored during cauchy searches skip = number of bfgs updates skipped nact = number of active bounds @ final generalized cauchy point projg = norm of final projected gradient f = final function value * * * n tit tnf tnint skip nact projg f 1 1 3 1 0 0 0.000d+00 5.605d-01 f = 0.560459405131994 convergence: norm_of_projected_gradient_<=_pgtol cauchy time 0.000e+00 seconds. subspace minimization time 0.000e+00 seconds. line search time 0.

creating custom keyboard layout for textarea with javascript and jquery -

i want create keyboard site have keyboard(virtual buttons) textarea.this project devide 2 part: the first part typing virtual keyboard on site created buttons , javascript ended , works fine. the second part typing real keyboard our custom language layuot on textarea. want catch entered keys , checking shift or capslock state in code add appropriate character(that exist in custom layout) textarea. if want make more simple,i want user keys in qwerty english keyboard , change other characters , add textarea custom keybaord layout. have 3 event on keys working in javascript , jquery , onkeypress , onkeydown , onkeyup . problem of onkeyup can't control textarea when user holds key , can't use it. problem onpressed , onkeydown defualt operation! add qwerty english chars textarea after code , can't find way disabling operation. example have text "abc" in textarea , cursor place between b , c,the user want type x(suppose in custom keyboard on g key place)

c# - DeflateStream advancing underlying stream to end -

i'm trying read out git objects git pack file, following format pack files laid out here . once hit compressed data i'm running issues. i'm trying use system.io.compression.deflatestream decompress zlib compressed objects. ignore zlib headers skipping on first 2 bytes. these 2 bytes first object anyway 789c. trouble starts. 1) know size of decompressed objects. read method documentation on deflatestream states "reads number of decompressed bytes specified byte array." want, see people setting count size of compressed data, 1 of doing wrong. 2) data i'm getting correct, think (human-readable data looks right), it's advancing underlying stream give way end! example ask 187 decompressed bytes , reads remaining 212 bytes way end of stream. in whole stream 228 bytes , position of stream @ end of deflate read 187 bytes 228. can't seek backwards, don't know end of compressed data is, , not streams use seekable. expected behavior consume whole st

swift2 - Swift 2.0: Protocol extensions: Two protocols with the same function signature compile error -

given 2 protocols , extensions: protocol firstdelegate { func somefunc() } protocol seconddelegate { func somefunc() } extension firstdelegate { func somefunc() { print("first delegate") } } extension seconddelegate { func somefunc() { print("second delegate") } } and trying conform both of them: class someclass: firstdelegate, seconddelegate {} i receive compile-time error: type 'someclass' not conform protocol 'firstdelegate' exchanging firstdelegate , seconddelegate : class someclass: seconddelegate, firstdelegate {} produces reverse: type 'someclass' not conform protocol 'seconddelegate' removing 1 of extensions resolves problem. ditto providing implementation somefunc() inside someclass . this protocol extension functionality rather new me. information in apple's official 'swift programming guide (prerelease)' scarce @ moment. did violate

android - Creating a button with an icon in the middle -

Image
i'm trying replicate of , comment button in image: http://i.imgur.com/parhgu6.png i understand how create shape, i'm not sure how add image icon in middle of button (and "like" text). here's shape layout have far: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/gray"/> <size android:width="40dp" android:height="24dp"/> </shape> </item> </layer-list> for button, how add drawable heart icon have next text "like". , comment button, how add drawable comment icon have , center in button? this simple <imagebutton android:layout_width="wrap_cont

sql - Query to Count values from different columns -

i looking query can work in access gives me total count of users completed requirements. know can group column, "tricky" part need group in 1 column if user completed of requirements columns b,c or d. in other words, data: user company b c d e john abc 1 1 bob abc 1 1 1 1 reggie abc 1 1 1 alex bca 1 mary bca 1 1 jane cba 1 1 1 1 and end result i'm looking: company e f(b or c or d) abc 2 3 2 bca 2 0 1 cba 1 0 1 you can use nz (coalesce in sql) make null values 0 can "normal" work -- adding them in example: select sum(nz(b,0)+nz(c,0)+nz(d,0)) f or looking @ logic select sum(iif(nz(b,0)+nz(c,0)+nz(d,0) > 0,1,0) ) f (nb, case when end used instead if iif in sql)

ios - Can any one tell me why i am getting Bad authentication error while executing this code(Swift)? -

i using fabric sdk add twitter login button in app....... add authentication header in url still showing bad authentication error while executing. suggest me how add header in url in swift. let twitter = twitter.sharedinstance() let oauthsigning = twtroauthsigning(authconfig:twitter.authconfig, authsession:twitter.session()) let authheaders = oauthsigning.oauthechoheaderstoverifycredentials() let request = nsmutableurlrequest(url: nsurl(string: "https://api.twitter.com/1.1/search/tweets.json?q=himan_dhawan")!) request.allhttpheaderfields = authheaders println(request) var session = nsurlsession.sharedsession() let task = session.datataskwithrequest(request, completionhandler: {data, response, error -> void in if((error) != nil) { println(error.localizeddescription) } var strdata = nsstring(data: data, encoding: nsasciistringencoding) println(strdata) }) task.resume() it

ios - Comparing Two NSDates with specific constraints -

i working accomplish within 3 statements, check compares 2 times (stored nsdates) , executes code based on difference between 2 respectively. checks wishing implement ( < 3min ), ( > 3min < 3hrs ), , ( > 3hrs ). below recent attempt. suggestions appreciated, thank you! nsdateformatter* df = [[nsdateformatter alloc] init]; [df setlocale:[[nslocale alloc] initwithlocaleidentifier:@"en_us"]]; [df settimezone:[nstimezone systemtimezone]]; [df setdateformat:@""]; [df setdateformat:@"hh:mm mm-dd-yyyy"]; nsdate* newdate = [df datefromstring:[df stringfromdate:[[_radios objectatindex:indexpath.row] attributeforkey:@"date_time_edt"]]]; nstimeinterval interval = [newdate timeintervalsincenow]; if(interval < 3 * 60) { img.image = [uiimage imagenamed:@"tire_green.png"]; nslog(@"%@", newdate); nslog(@"%f", interval); } else if(interval > 3 * 60 && interval < 3 * 60 * 60) { im

python - Pycharm doesn't show error information for `PyQt5` program (e.g. `TypeError`) -

Image
in pycharm 4.5.2, if had error in pyqt5 slots, when slots called, pycharm shows process finished exit code 1 , not , why error happends. doesn't happen when error in __init__ . makes difficult debug. how fix this? this widget generated qt designer for example, if wrote button.settext('a'+1) when clicked on button: # -*- coding: utf-8 -*- import sys pyqt5 import qt test import ui_form application = qt.qapplication(sys.argv) class mywidget(qt.qwidget): def __init__(self): super(mywidget, self).__init__() self.main = ui_form() self.main.setupui(self) # self.main.pushbutton.settext('a'+1) # prints `typeerror: can't convert 'int' object str implicitly ` self.show() self.main.pushbutton.clicked.connect(self.show_error) def show_error(self): self.main.pushbutton.settext('a'+1) # print "process finished exit code 1" when clicked on button, , cra

java - How to use the legacy Apache HTTP client on Android Marshmallow? -

Image
background on android marshmallow, google has removed support of apache http client (link here ) because doesn't have performance compared alternatives. this might cause many apps crashing on android marshmallow. the problem google allows still use api, not built in one, adding line gradle file: uselibrary 'org.apache.http.legacy' so, did: dependencies { classpath 'com.android.tools.build:gradle:1.3.0' } and: android { compilesdkversion 'android-mnc' buildtoolsversion "23.0.0 rc3" uselibrary 'org.apache.http.legacy' defaultconfig { applicationid "com.example.user.androidmtest" minsdkversion 'mnc' targetsdkversion 'mnc' versioncode 1 versionname "1.0" } when tried it, compiled fine (no errors being shown, , run proof-of-concept app, doesn't have special code), when tried using of classes know part of old api (like

NoClassDefFoundError: android.support.v7.app.ActionBarActivity -

i keep getting java.lang.noclassdeffounderror: android.support.v7.app.actionbaractivitydelegate error last 2 days , going hate android, it keeps going this. hopeless. adding goseamless api , error after superoncreate method on line of code super.oncreate(savedinstancestate); setcontentview(r.layout.activity_splash_screen); it gives error below while trying set contentview . if dont add , app builds without problem. this stack trace 07-27 15:10:18.130 814-814/com.fourspan.ekmobi i/system.out﹕ debugger has settled (1365) 07-27 15:10:18.180 814-814/com.fourspan.ekmobi v/hwpolicyfactory﹕ : success allimpl object , return.... 07-27 15:10:18.210 814-814/com.fourspan.ekmobi v/hwwidgetfactory﹕ : successes allimpl object , return.... 07-27 15:10:19.450 814-814/com.fourspan.ekmobi d/dalvikvm﹕ threadid=1: still suspended after undo (sc=1 dc=1) 07-27 15:10:31.590 814-814/com.fourspan.ekmobi e/dalvikvm﹕ not find class 'android.support.v7.app.action

How do I add multiple subtotals in tableau? -

my report has following structure id , currency, subdepartment, unit , revenue, salary i wanted print subtotals of revenue , salary following combinations (id, currency, subdepartment) (id, currency, ) the row has discrete dimensions hence default grandtotal/subtotal option not working . is thr alternate calculate subtotals , display beneath each grouping.? if you're hoping see in single worksheet, sounds job lod (level-of-detail) functions . i'm not sure how want visualize it, here's how make table. create calculated fields: revenue total (id, currency) { fixed [id], [currency] : sum([revenue]) } salary total (id, currency) { fixed [id], [currency] : sum([salary]) } we can create table (for example) subtotals , totals placing following pills in rows shelf, in order: [id] [currency] sum([revenue total (id, currency)]) (make discrete) sum([salary total (id, currency)]) (make discrete) [subdepartment] sum([revenue]) (make discrete

Eclipse RCP key binding -

is there ways disable active context associated key binding. <context id="com.context" name="%com.context.name"> </context> in plugin can use icontextservice activate , deactivate contexts. however can deactivate context activated since need access activation context during context activation.

c++ - Vector containing class objects throwing errors in main method -

i'm making vector of type student , class have written, in main method shown below: int main() { ifstream prefile("file.csv"); string l; vector<student> students; while(getline(prefile, l)) { istringstream ss(l); string token; string * linearr = new string[12]; int temp = 0; while(getline(ss, token, ',')) { linearr[temp] = token; temp++; } student s(linearr[0], linearr[1]); (int = 2; < 12; i++) { s.addscore(atoi(linearr[i].c_str())); } students.push_back(s); delete [] linearr; } sort(students.begin(), students.end(), comparestudents); (int = 0; < students.size(); i++) { students.at(i).print();; } prefile.close(); return 0; } the main method supposed read file.csv , create vector of students each have first name, last name, , 10 scores. here student class reference: cla

linux - Curl command without using cache -

is there way tell curl command not use server's side cache? e.g; have curl command: curl -v www.example.com how can ask curl send fresh request not use cache? note : looking executable command in terminal. i know older question, wanted post answer users same question: curl -h 'cache-control: no-cache' http://www.example.com this curl command servers in header request return non-cached data web server.

How to make drag drop receiving images from web browser in Java Swing? -

Image
i trying receive images web browser via drag , drop, failing: package tests; import javax.swing.*; import java.awt.*; import java.awt.datatransfer.dataflavor; public class jdragdroptest extends jframe { public jdragdroptest() throws headlessexception { super("dragdroptest"); setlayout(new borderlayout()); add(new jscrollpane(new jtextarea() {{ settransferhandler(new transferhandler() { @override public boolean canimport(transfersupport support) { return true; } @override public boolean importdata(transfersupport support) { int i=0; append("flavors:\n"); for( dataflavor flavor : support.getdataflavors() ) { append(string.valueof(i+1) + "): " + flavor.tostring() + "\n"); i++;

c++ - Polymorphism and casting through struct with pointers -

full disclaimer first: have not compiled example code, nor real code (well, @ least deployed). still wrapping head around problem. in mind, have class structure: a super base class use store instances base in same container , few "facet" classes use multiple inheritance encapsulate common behaviour. class facet_a; class facet_b; class facet_c; struct facet_converter { facet_a * facet_a; facet_b * facet_b; facet_c * facet_c; }; class super_base { public: virtual ~super_base() {} virtual facet_converter convert()=0; virtual const facet_converter convert()const=0; //notice const... }; class facet_a { private: int value_a; public: virtual ~facet_a() {} facet_a():value_a(0) {} void set_value_a(int v) {value_a=v;} int get_value_a() const {return value_a;} }; class facet_b { private: float value_b; public: facet_b():value_b(0) {} virtual ~facet_b() {} void set_value_b(float v) {value_

sql server - SQL Optimize Group By Query -

i have table here following fields: id, name, kind. date data: id name kind date 1 thomas 1 2015-01-01 2 thomas 1 2015-01-01 3 thomas 2 2014-01-01 4 kevin 2 2014-01-01 5 kevin 2 2014-01-01 5 kevin 2 2014-01-01 5 kevin 2 2014-01-01 6 sasha 1 2014-01-01 i have sql statement this: select name,kind,count(*) recordcount mytable group kind, name i want know how many records there name , kind. expected results: name kind count thomas 1 2 thomas 2 1 kevin 2 2 sasha 1 4 the problem is big table, more 50 million records. also i'd know result within last hour, last day, last week , on, need add where clause this: select name,kind,count(*) recordcount mytable date > '2015-26-07' group kind, name i use t-sql sql server management studio. of relevant columns have

ios8 - iOS - Share data(and updates of data) between a specific group of devices using the same app -

for simple example, if app can display photos , takes new photo, other people have same app, in same group(if possible group way) has been created beforehand, update of new photo - (the list of photos change , app handle accordingly) (and updated via push notification or other automatic 'update'). useful editing photo , updating , others update. i wondering options available (ios 8+ solution now) to: have download app , "invite" others have downloaded app part of group - have receive additions or updates app in way have described. really not want have know else's e-mail address this. looking option. sharing data between group members (and solution might depend on #1, not sure). i have read on here solutions nsuserdefaults or key-chain grouping since talking images here , depending on #1 there might other better solutions.

plaintext - PHP code as plain text -

is there way output php code plain text? have php code stored in mysqli database, want fetch php code , display in div. don 't want php code executed. or there way use file_put_contents() fill file php code? again; don 't want php code executed. either want php code displayed plain text or put in file plain text. for example have code stored in database: <doctype> <html> <head> <title>test</title> </head> <body> <?php $array = array('test1', 'test2'); foreach($array $val) print($val); print('works!'); ?> </body> </html> but when print code entire php code won't visible. or there way put php code database file using file_put_contents if code stored in database, have echo in div. run query, string, echo. won't executed. need run through htmlentities things < , & , quotes show on page correctly.

delphi XE3: how to send/get JSON data, jquery like? -

i jquery developer. see delphi has libraries superobject json parsing. my question : closest way (the quickest) send/get json in jquery ajax ($.getjson, $.get, $.post) ? i need application communicate webserver (sending , getting objects) regards you're conflating 2 separate topics. first how transfer data on web, , second how deal data once have them. to send , receive network commands, can try 1 of several free libraries available, indy , ics , or synapse . once have data, can process like. if have json-formatted data, can use superobject or other json library. if fetched xml, can use xml library. other kind of data might load. the networking libraries , data-processing libraries tend separate things in delphi ecosystem.

Import CSV files into HSQLDB -

i trying convert set of csv files hsqldb database. first attempt fire databasemanagerswing , execute following code: * *dsv_col_splitter = ; \mq /home/michael/workspaces/rds-surveyor/lt/it/names.dat commit; which gets rejected error message: java.sql.sqlsyntaxerrorexception: unexpected token: * in order @ least response hsqldb, tried removing first line, gives different error: java.sql.sqlsyntaxerrorexception: unexpected token: i came across sqltool, , after overcoming various pitfalls (you need sqltool jar, hsqldb jar of same version in same path or somewhere in classpath) ran full code here. first line got processed expected, \mq command fails similar error: severe cause: sqlsyntaxerrorexception: unknown token: the file trying import looks (first few lines shown): cid;lid;nid;name;ncomment 25;1;165;europa; 25;1;167;italia; 25;1;169;abruzzo; 25;1;171;chieti; 25;1;173;passo di lanciano; 25;1;175;valico castiglione messer marino; 25;1;177;valico della forchetta

c# - How do I get the name of the network that the phone is connected to? -

i want name of wifi network windows phone connected to. think has microsoft.phone.net.networkinformation can't figure out how it. devicenetworkinformation.cellularmobileoperator source: https://msdn.microsoft.com/en-us/library/windows/apps/hh202875(v=vs.105).aspx next time, google search (literally on first page of results).

c# - Linq to SQL Domain Entity Property Comparison Using Expressions -

i trying create linq sql expressions generically allow same properties compared on 2 different domain entity records. general idea define properties on entities need compared, compare each of these properties 1 one check equality/inequality. identifying properties need compared creating expressions on domain entities: public class compareentityproperty<tentity> tentity : ientity { public expression<func<tentity, object>> entitypropertyexpression { get; set; } public expression<func<tentity, tentity, bool>> compare { { var expression = entitypropertyexpression; return (entitya, entityb) => object.equals(expression.invoke(entitya), expression.invoke(entityb)); } } } then set generic entity, set such: public class foo : ientity { public long? bar { get; set; } } i set using: public class foocompare { public ienumerable<compareentityproperty<foo>> comparelis