Posts

Showing posts from February, 2013

haskell - Typeclass for (what seems to be) a contravariant functor implementing function inversion -

lets have following import control.category (category, (.), id) data invertible b = invertible (a -> b) (b -> a) instance category invertible id = invertible prelude.id prelude.id (invertible f f') . (invertible g g') = invertible (f prelude.. g) (g' prelude.. f') invert (invertible x y) = invertible y x note following true: invert (g . f) == invert f . invert g this structure seems similar contravariant functor (wikipedia) , follows same axiom: f(g . f) = f(f) . f(g) in case, f invert . i looked @ data.functor.contravariant.contramap , has function of type: (a -> b) -> f b -> f but didn't know how'd i'd implement in situation. example, can't work out sensible choice f , , in situation, there's no function a -> b , invert . however, invert nevertheless fits mathematical axiom of contravariant functor, i'm thinking can fit existing class, can't find 1 , how it. or pointers appreciated. ...

java - How to get the subtraction result of two EditText in third EditText for Android? -

i'm new android programming. while making program looking program auto fill subtraction result of 2 edittext widgets in third edittext , without button. please me find solution. int firstvalue=firsttext.gettext.tostring(); int secondvalue=secondtext.gettext.tostring(); int answer=firstvalue - secondvalue; thirdvalue.settext(answer); hope works. if problem occour tell me

button - RippleView effect on view appears late android -

i using com.andexert.library.rippleview library here's a link its working not expected . ripple effect appears late i.e; when click on textview activity gets launched , ripple effect appears on textview of previous activity. also shows error " cannot resolve method setonripplecompletelistener() " xml file <com.andexert.library.rippleview android:id="@+id/ripple_view" android:layout_width="match_parent" android:layout_height="wrap_content" rv_centered="true" android:padding="0dp" android:layout_alignparentbottom="true"> <com.techmorphosis.utils.textviewcustomfont android:id="@+id/txt_lets_go" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolor="@color/white_text" android:background="@drawable/purple_button_bg" ...

android - Robolectric 3.0 testing Vibrator service -

i in process of migrating test cases latest robolectric 3.0. test viberator service in app, earlier used org.robolectric.shadows.shadowvibrator but not able test it, using custom shadow class. even robolectric wesite not updated , shows use robolectric.shadowof_() not exist. this link of website, not updated version. kindly guide. following code custom implementation:-- the custom class:-- @implements(vibrator.class) public class shadowvibrator { private boolean vibrating; private boolean cancelled; private long milliseconds; private long[] pattern; private int repeat; @implementation public void vibrate(long milliseconds) { vibrating = true; this.milliseconds = milliseconds; } @implementation public void vibrate(long[] pattern, int repeat) { vibrating = true; this.pattern = pattern; this.repeat = repeat; } @implementation public void cancel() { cancelled = true; ...

ios - Parse Local DataStore not showing pinned data -

i have tried make sure recommended steps followed in implementing parse local data store either pinning seems not working or querying pinned objects not working. have tried multiple options. below code view controller , have enabled datastore etc in app delegate file (using base parse starter project). please advise me problem. output in console - able fetch data parse server either not able pin or retrieve or else.. success 8888 optional([]) push notifications not supported in ios simulator. success 7777 optional([<restaurant: 0x7f98ca521f60, objectid: 0rrzncndje, localid: (null)> { name = time; }]) thanks help! import foundation import parse import parseui import uikit import foundation class restaurantadmin: viewcontroller { func getdatafromlocaldatastore() { var username = pfuser.currentuser()?.username var messages2: [anyobject]! var query2: pfquery = pfquery(classname: "restaurant") query2.fromlocaldatastore()...

ios - Watch OS2 NSTimer problems -

i'm working on app need start timer (using nstimer) when watch activated. timer asks information iphone (about every 1 seconds , maximum 5 seconds). i'm using start timer timer = [nstimer scheduledtimerwithtimeinterval:2 target:self selector:@selector(myfunction) userinfo:nil repeats:no]; in "myfunction" function, restart timer next time. - (void) myfunction { //here update label text // [...] [timer invalidate]; timer = nil; counter++; if(counter<5) { timer = [nstimer scheduledtimerwithtimeinterval:2 target:self selector:@selector(myfunction) userinfo:nil repeats:no]; } } my problem in simulator works fine in real watch (watch-os2 gm) timer doesn't start or starts 1 time , after seems freeze! see because update label in watch @ every elapsed period shows counter , i'm sure initialized in "will activate" function. don't understand why. same issue? i having similar , equally frustrating issue ...

select query in mysql to select the data before 15 minutes in php -

Image
i have table: i want select data res_time within past 15 minutes. using: select * test res_time >= date_sub(now(), interval 15 minute). select * `test` res_time between timestamp(date_sub(now(), interval 15 minute)) , timestamp(now()). if using php can this $beforetime = date("y-m-d h:i:s",strtotime("-15 minutes")); $query = "select * test res_time >= '$beforetime' " ; if want pure sql solution follow other mentioned solutions. cheers !!!

jquery - undefined value for empty database record -

what best solution undefined values being returned database when column empty. there way having if (!(databasevalue == 'undefined') || !(databasevalue == null)) { console.log(databasevalue) } else { console.log('value empty') } this ok if few values can empty if multiple values can empty check each value if undefined or not show result update $.ajax({ type: 'post', url: 'php', datatype: "json", data: { id: "id" }, success: function (data) { //check data undefined or not }, error: function (data) { console.log(data); } }); is there collective checking see data response undefined or need check each have if condition check if data empty or not you need use && operator instead of || , undefined should not in quotes if (!(databasevalue == undefined) && !(databasevalue == null)) { console.log(databasevalue) } else { ...

java - Need suggestion on Parser Design Strategy -

i need suggestion on parser design strategy consider type1, type2, type3 3 different csv files different formats parsed parser1, parser2, parser3 respectively. in future evolve parse info other sources dbs. there new parsers come. best way design parser? factory / abstract factory candidate? benefits , examples helpful? type1 - parser1 type2 - parser2 type3 - parser3 i have put down code, looking valuable suggestions. interface parser<t>{ public list<t> parse (string s); } //where t - data model class parser1csv implements parser<model1>{ //implement //s-csv file public list<model1> parse (string s){ } } class parser1db implements parser<model1>{ //implement //s- connection string public list<model1> parse (string s){ } } class parser2csv implements parser<model2>{ //implement //s-csv file public list<model2> parse (string s){ } } //same way other pars...

ios - AFHTTPSessionManager posting video swift -

i trying upload video in background using afnetworking > afhttpsessionmanager post method. want conitune uploading if app suspended. error while executing code, logs no error, , points in code. tried every solution available on other posts regarding scenario, couldn't working. plesae check code below , suggest me solution or link me somewhere make work { let urlstring = baseurl + weblinks.post let appid = nsbundle.mainbundle().bundleidentifier let config = nsurlsessionconfiguration.backgroundsessionconfigurationwithidentifier(appid!)// crashes //let config = nsurlsessionconfiguration.defaultsessionconfiguration()//doesnt work in background config.allowscellularaccess = true config.timeoutintervalforrequest = nstimeinterval(999) config.timeoutintervalforresource = nstimeinterval(999) let manager = afhttpsessionmanager(baseurl: nsurl(string: urlstring), sessionconfiguration: config) manager.responseserializer.acceptablecontenttypes = n...

sequelize.js - How can I update an attribute in a through table? -

in sequelize.js, how can update attribute in through table 1-n or n-m relationships? tried find documentation couldn't find any. if user belongs many projects, , project has enrolled column can do project.adduser(user, { enrolled: new date() }); this should work if relation betwene user , project set, in case join table updated. the docs @ end of this section .

java - Why doesn't my code write to a text file? -

i want know why code doesn't write text file, jvm doesn't throw exceptions... public class alterdata { data[] information; file informationfile = new file("/users/ramansb/documents/javafiles/information.txt"); filewriter fw; public void populatedata(){ information = new data[3]; information[0] = new data("big chuckzino", "custom house", 18); information[1] = new data("rodger penrose", "14 winston lane", 19); information[2] = new data("jermaine cole", "32 forest hill drive", 30); } public void writetofile(data[] rawdata){ try{ fw = new filewriter(informationfile); bufferedwriter bw = new bufferedwriter(fw); for(data people : rawdata){ bw.write(people.getname()+ ", "); bw.write(people.getaddress() + ", "); bw.write(people.getage() +", |"); ...

javascript - Extract ip address from a string using regex -

var r = "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"; //http://www.regular-expressions.info/examples.html var = "http://www.example.com/landing.aspx?referrer=10.11.12.13"; var t = a.match(r); //expecting ip address result gets null the above code extract ip address string. fails so. kindly advice fails. you have defined r string, initialize regular expression. var r = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; var r = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/; //http://www.regular-expressions.info/examples.html var = "http://www.example.com/landing.aspx?referrer=10.11.12.13"; var t = a.match(r); alert(t[0])

ios8 - Capturing image programatically in swift 2.0 -

i new in swift 2.0. want capture image programmatically , save it.means when camera show image capture automatically within 3 second without pressing button. finlly solution ... http://jamesonquave.com/blog/taking-control-of-the-iphone-camera-in-ios-8-with-swift-part-1/

javascript - Dojo: set default TextBox for typing -

one cursor set on search field when page loads. code: <input class="search-input" data-dojo-type="dijit/form/textbox" data-dojo-attach-point="searchnode" data-dojo-attach-event="keyup: searchkeyupevent" data-dojo-props=" focused: true, placeholder: 'search'" /> on page load textbox widget has focus frame, cursor not there.. is bug? how 1 make sure cursor @ search widget? edit: re-phrase question: how 1 set textbox, when page loads , user starts typing appear in textbox default? focused documented read-only property in _focusmixin ; setting won't think does. to focus widget, need reference js , call focus method. given you've defined attach point , attach event, i'll assume widget part of widget's template, in case should able focus in templated widget's startup method (though depending on how page/app loads, there may better time this): startup: functi...

C# read XML with DTD verification -

i'm trying read xml file dtd verification no mather how seems program doesn't read dtd file. have concentrated problem small xml file , small dtd file: test.xml - located @ c:\test.xml <?xml version="1.0"?> <!doctype product system "test.dtd"> <product productid="123"> <productname>rugby jersey</productname> </product> test.dtd - located @ c:\test.dtd <!element product (productname)> <!attlist product productid cdata #required> <!element productname (#pcdata)> my c# program looks this namespace xml_to_csv_converter { public partial class form1 : form { public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { readxmlwithdtd(); } public void readxmlwithdtd() { // set validation settings. xmlreadersettings settings = new...

javascript - Issue with subscriptions on multiple instances of a template -

here scenario. have template contains #each loop , renders instance of particular template, setting data context on each template per docs. <template name = 'live'> <div class = 'row'> {{#each runways}} <div class = 'col-md-2'> {{> runway_panel}} </div> {{/each}} </div> </template> and helper backing it: template.live.helpers({ runways: function(){ return runway_data.find(); } }); this works, issue follows. each live_event_log instance has template level subscription subscribes publication takes _id parameter of data context, so: template.runway_panel.oncreated(function(){ var instance = this; instance.autorun(function(){ var subscription = instance.subscribe('runway_status', this.data._id); }); instance.status = function(){ return runway_status.find(); } }); this publication: meteor.publish('runway_statu...

Laravel 5 Eloquent with MongoDB - get array of column names from document -

this becoming frustrating beyond imagination. i need column names table using eloquent orm in laravel 5 combined mongodb. have found examples, none of them working me made sql specifically. tried this , this without success, idea? thanks! it best use raw() method in case , use native mongocollection methods find() iterate on collection , keys in documents array: // returns array of field names collection of user models. $keys = db::collection('users')->raw(function($collection) { $cursor = $collection->find(); $array = iterator_to_array($cursor); $fields = array(); foreach ($array $k=>$v) { foreach ($v $a=>$b) { $fields[] = $a; } } return array_values(array_unique($fields)); });

javascript - Use of $(document).ready() function -

what disadvantages of defining (not declaration) functions in $(document).ready() while developing large web application of javascript/jquery have number of ajax calls end services. for example: when add ajax calls in document.ready , calls going download large number of data while page loading disadvantages experience doing ?? thanks since saying functions defined , not declared , inside .ready call assume code this: var fn; // declaration $(document).ready(function () { fn = function () { // definition // }; }); the main disadvantage cannot call functions before dom tree ready. if try call them earlier error.

html - Input textboxs are moving when clicked -

i working on project. can access page here here small bit error happens <div class="col-sm-6 responsive-table"> <table> <caption>page template</caption> <tr > <td class='leftcol'>easy</td> <td ><input ng-model='page.easy' ng-model='wordpress' min=0 type='number' class='form-control numberinput' ></td> </tr> <tr > <td >medium</td> <td ><input ng-model='page.medium' type='number' min=0 class='form-control numberinput'></td> </tr> <tr > <td class='leftcol'>hard</td> <td ><...

javascript - Issue with Responsive DataTables And Bootstrap Tabs -

i want use datatables , responsive extension inside bootstrap tabs. have working separately. $(document).ready(function() { $('#example').datatable( { responsive: true } ); $('#exampleintab').datatable( { responsive: true } ); } ); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $($.fn.datatable.tables(true)).datatable() .columns.adjust() .responsive.recalc(); }); you can see issue here cause there multiple issues code: bootstrap library included before jquery library api method responsive.recalc() available in datatables.responsive.js since 1.0.1 , you're including version 1.0.0 . event handler should attached once dom available. solution include bootstrap library after jquery library include responsive extension version 1.0.1 or later use code below: $(document).ready(function () { $('#example').datatable({ responsive:...

python - no module named HelloTemplate Import Error -

i getting import error. says there no module named hellotemplate. there hellotemplate class have imported in urls.py file. "login" django app name. this views.py file. #from django.shortcuts import render django.http import httpresponse django.template.loader import get_template django.template import context django.shortcuts import render_to_response django.views.generic.base import templateview # create views here. def hello(request): name='zeeshan' html="<html><body> hi %s.</body></html>" %name return httpresponse(html) def hello_template(request): name='zeeshan' t=get_template('hello.html') html=t.render(context({'name':name})) return httpresponse(html) class hellotemplate (templateview): template_name="hello_class.html" def get_context_data(self, **kwargs): context=super(hellotemplate, self).get_context_data(**kwargs) ...

php - Instantiating objects for use in static accessors -

background i have 2 classes, , b, class full of static methods (behat/mink step definitions), using logic methods instance of class b. what want have class able use methods instance of b, have no constructor. class { // class needs instance of b, has no constructor const b_instance = new b(); //surely not? } class b { public function __construct() {} public function methodforuseinclassa() {...} } nuance right now, have extending b, unit testing purposes, instantiating b better solution. question how can facilitate this? there accepted best practice this? any tips appreciated! either try extend class extends b {} , you'll have access methods of b. or try one: class { //this class needs instance of b, has no constructor private static $instanceofb = null; // singleton returns same object while script running public static function getinstanceofb() { if( self::$instanceofb === null ) { self::$instan...

python - Failing to open localhost page -

i try install django in mac pro , finished installing when want run command : python manage.py runserver stack feedback: traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/usr/local/lib/python2.7/site-packages/django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() file "/usr/local/lib/python2.7/site-packages/django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/local/lib/python2.7/site-packages/django-1.8.4-py2.7.egg/django/core/management/base.py", line 393, in run_from_argv self.execute(*args, **cmd_options) file "/usr/local/lib/python2.7/site-packages/django-1.8.4-py2.7.egg/django/core/management/base.py", line 444, in execute output = self.handle(*args, **options) fil...

java - jOOQ and Caching? -

i considering moving hibernate jooq not sure if can without caching. hibernate has first- , second-level cache . know jooq have support reusing prepared statements . will have take care of caching on own if use jooq? query caching / result caching: i'm mentioning this, because kind of cache also possible hibernate , , might make sense under circumstances. in hibernate, query cache works closely second-level cache. in jooq, can implement query cache intercepts queries using jooq visitlistener api. there blog articles topic: hack simple jdbc resultset cache using jooq’s mockdataprovider caching in java jooq , redis there better support type of cache in future (not in jooq 3.7, yet), kind of cache belongs in sql api. note jdbc driver might support kind of cache - e.g. ojdbc does. first-level caching: the idea behind hibernate's first level cache doesn't make sense more sql-oriented api jooq. sql highly complex language works between persisted ent...

gradle - grails 2.5 - can the build scripts be modified? -

grails has out of box way produce wars. type "grails war" in project dir. question is, possible, , recommended, modify grails build scripts different, such build zip of source produced war, , give same name? i know done external tools such jenkins running on build server, out of our budget. to put way, grails designed have war build process modified? first, scripts included grails aren't meant modified, rather used own custom scripts. creating own build process, or gant scripts not gradle, quite easy grails create-script , outlined in documentation . it's not uncommon see projects have custom scripts such grails publish-build creates war, archives sources, sends out notices, etc.

jquery - Unable to get existing session in .net with Chrome & Firefox where as it is working IE 9 -

i unable existing session in .net web service using firefox , chrome, working in ie 9 or higher. case: using session.isnewsession property check weather session new or existing. property gives me false if session existing using internet explorer, in firefox , chrome giving me true. in web service don't have session variable stored in this, wanted check weather session new or existing. i calling web service using .ajax call. [scriptmethod(responseformat = responseformat.json), webmethod(enablesession = true)] public string getbusinesspartnerbykey(string cardcode, string dbname) { general.writelog("getting bp key : " + cardcode, "bp"); //if (general.company != null) //if (session["session"]!=null) if (!session.isnewsession) //here getting true in ie , false in firefox , chrome. { try { //do stuff } catch (sqlexception e1) ...

c - Unicode with MAX7219 -

Image
i'm trying implement asian symbols max7219 , using 8x8 led displays. i've had online , i've found libraries max7219 in ascii. wondering if there easy way of implementing using unicode library - assuming there one. i'd copy , paste " な " character code , print onto led displays. far, attempts have not been working. other option use binary/hex manually draw symbols prefer make easy user copy , paste character , prints onto leds. or have create own arduino library? any appreciated! many thanks. the problem unicode it's damn big (the first kana u+3041), , arduinos have not enough flash store characters required. my recommendation use 8-bit encoding maps characters need. suggest starting character set used hd44780ua00 , replacing characters make sense. since other libraries use set won't huge leap use them display.

Set Max and Min zoom on TouchEvent in Android -

i copied kind of code make imageview scrollable. example.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { imageview view = (imageview) v; view.setscaletype(imageview.scaletype.matrix); float scale; dumpevent(event); //handle touch events here... switch (event.getaction() & motionevent.action_mask) { case motionevent.action_down: //first finger down savedmatrix.set(matrix); start.set(event.getx(), event.gety()); log.d(tag, "mode=drag"); mode = drag; break; case motionevent.action_up://first finger lifted case motionevent.action_pointer_up: //second finger lifted mode = none; log.d(tag, "mode=none"); bre...

c# - I want to create a jquery for conversion of gold to amount and vice versa -

problem description : want create jquery method can convert gold weight amount multiplying gold rate f.e 50*2000=100000 , vice versa amount gold dividing gold rate f.e 100000/2000=50 amount=goldweight*goldrate; // top down approach goldweight=amount/goldrate; // bottom approach but @ same if textbox have values should convert gold if change amount , amount if change in gold value....please me in this.. this answer $(document).ready(function() { $('#txtgoldconverted').focusin(function() { var r = $('#txtamount').val(); var q = $('#txtgoldrate').val(); if (r != "" && q != "") { var p = r / q; var res = p.tofixed(3); var resround = (math.round(res * 100)) / 100; $('#txtgoldconverted').val(resround); } }); $('#txtgoldconverted').focusout(function() { var p = $('#txtgoldconverted').val(); var q = $('#txtgoldrate').val(); if (p...

java - HibernateException "Could not parse configuration: hibernate.cfg.xml" error while running a simple Hibernate Application -

log4j:warn no appenders found logger (org.hibernate.cfg.environment). log4j:warn please initialize log4j system properly. exception in thread "main" org.hibernate.hibernateexception: not parse configuration: hibernate.cfg.xml @ org.hibernate.cfg.configuration.doconfigure(configuration.java:1491) @ org.hibernate.cfg.configuration.configure(configuration.java:1425) @ com.javatpoint.mypackage.storedata.main(storedata.java:13) caused by: org.dom4j.documentexception: connection refused: connect nested exception: connection refused: connect @ org.dom4j.io.saxreader.read(saxreader.java:484) @ org.hibernate.cfg.configuration.doconfigure(configuration.java:1481) ... 2 more why hibernateexception occur? this caused because of referencing dtd on top of hibernate.cfg.xml not present in hibernate jar using. assuming not using hibernate version 2.0, check in hibernate.cfg.xml have on top: <!doctype hibernate-configuration public "...

javascript - how to set focus on fullpage.js slide/section again -

i having problem fullpage.js scrolling after opening overlay div , closing again. (via jquery, fadein , fadeout) the overlay div's code outside of <div id="fullpage">...</div> -stuff. how can set focus on fullpage content again, don't have click/touch on e.g. background again, "reactivate" scrolling ability?

android - Webview: How to zoom up to 100x? -

in webview have image in high resolution ( 9000x5000px ). there way zoom in in webview 100x ? i have used code, allows me zoom 10x: // enable zoom mywebview.getsettings().setbuiltinzoomcontrols(true); mywebview.getsettings().setsupportzoom(true); try this, might works you. // set activity's content view single webview test webview mwebview = new webview(this); setcontentview(mwebview); // retrieve zoommanager webview class<?> webviewclass = mwebview.getclass(); field mzoommanagerfield = webviewclass.getdeclaredfield("mzoommanager"); mzoommanagerfield.setaccessible(true); object mzoommanagerinstance = mzoommanagerfield.get(mwebview); // modify "default max zoom scale" value, controls upper limit // , set large; e.g. float.max_value class<?> zoommanagerclass = class.forname("android.webkit.zoommanager"); field mdefaultmaxzoomscalefield = zoommanagerclass.getdeclaredfield("mdefaultmaxzoomscale"); mdefaultmaxzooms...

html - Is there a correct order to declaring border-width and border-style? -

i'm looking on page border-width on w3schools , says that: note: declare border-style property before border-width property. element must have borders before can set width. i'm trying find reference corroborates statement. seems declaring border-width before border-style works fine. .demo { width: 100px; height: 100px; margin: 10px auto; } .ten-red-solid { border-width: 10px; border-color: red; border-style: solid; } .red { border-color: red; } .ten { border-width: 10px; } .solid { border-style: solid; } <div class="ten-red-solid demo"></div> <div class="ten red solid demo"></div> this isn't true. w3schools aren't official documentation source , therefore advice shouldn't taken seriously. w3schools optimized learning, testing, , training. examples might simplified improve reading , basic understanding. tutorials, references, , examples r...

knockout.js - knockout cant process click binding as not a function -

i struggling calling function knockout! var bankviewmodel = function () { self.addbank = function(){ return function(){ self.addshow(true); var bank = new observablebank('',"","","","","","","","","active"); self.newbank(bank); }; }; }; var bankviewmodelinstance = new bankviewmodel(); ko.applybindings(bankviewmodelinstance, document.getelementbyid("company-info-bank")); and in view have tried loads of variations of binding with:- <button id="demo-btn-addrow" class="btn btn-purple btn-labeled fa fa-plus" data-bind="click: addbank()">add new</button> tried $parent (undefined), $data - nothing etc. can tell me silly mistake making? thanks tough code works check here . couple of corrections/improvements : y...

java - Can I create a date time column headers with default value in sqlite3? -

Image
i have been trying create data time headers default value in sqlite, don't know if possible in sqlite, appreciated. trying achieve:

javascript - changing a value of a select based on the value chosen before -

i tried both on site , in others before asking nobody solves problem i have form select option <select name="stampa_front"> <option data-price="0">nessun colore</option> <option data-price="0.80" data-label="1 colore stampa fronte"> 1 colore </option> <option data-price="0.90" data-label="2 colore stampa fronte"> 2 colori </option> <option data-price="1.00" data-label="3 colore stampa fronte"> 3 colori </option> </select > <select name="stampa_retro"> <option data-price="0">nessun colore</option> <option data-price="0.80" data-label="1 colore stampa retro"> 1 colore </option> <option data-price="0.90" data-label="2 colore stampa retro"> 2 colori </option> <option data-price="1.00" data-label=...

swift - multiple UITableViewCells in multiple UITableViews -

i have few uitableviews each (rather complex) custom cells. of custom cells same however. example make things clear tableview1 has customcell1, customcell2 tableview2 has customcell3, customcell2 tableview3 has customcell1, customcell3 ... i can create classes customcells inheriting uitableviewcell. can control-drag labels/imageviews customcell1 tableview1 class create outlets. how create customcell1 in tableview3 , connect outlets ? i think best option extract cells in separate xibs, load xibs inside viewdidload() , register them each uitableview . so, after extracting cells, connect outlets each class particular cells, , use following: var nib1 = uinib(nibname: "customcell1", bundle:nil) tableview1.registernib(nib1, forcellreuseidentifier: "customcell1") and on, each cell , each tableview. after can dequeue these cells in cellforrowatindexpath method. here, can set values each ui element , reuse them on every tableview need.

sql - How to check whether index is being used or not in Oracle -

select * (select temp.*, rownum rnum (select entry_guid alertdevtest.entry upper(alert_name) = 'alertname' , user_guid = 'alertproductclienttest' , product_code = '-101' , status_code != 13) temp rownum <= 2500) rnum >= 0; select * (select temp.*, rownum rnum (select entry_guid alertdevtest.entry upper(alert_name) = 'alertname' , user_guid = 'alertproductclienttest' , product_code = '-101' , status_code != 13 , product_view in ( 'pview' )) temp rownum <= 2500) rnum >= 0; am running above queries , seeing performance degradation in second query compare first one. difference being additional ...

c# - Link Account to activity CRM -

i'm writing code pulls db , populates information activity, i'm able add fields db description , subject field, cant seem link account? here have tried; foreach (var phonenumber in phonenumbers) { var potentialmatches = _xrm.accountset.where(account => account.address1_telephone2.equals(phonenumbers)).tolist(); if (potentialmatches.count > 0) { var accountmatch = potentialmatches.first(); var actualcrmaccount = (account) _xrm.retrieve("account", accountmatch.id, new microsoft.xrm.sdk.query.columnset(true)); if (actualcrmaccount != null) { //is correct way? new activityparty() { partyid = new entityreference(account.entitylogicalname, actualcrmaccount.id) }; activityparties.add(new activityparty() {id = actualcrmaccount.id}); } } } //regardingobjectid not working //regardingobjectid = new entityreference(account.entitylogica...

c# - Why i can't return my method? -

i have enum contains languages english, french, spanish, german ... i have below method return combobox instance has enum datasource: public combobox updatecomboboxidioma() { comboidioma.datasource = enum.getvalues(typeof(idioms)); return comboidioma;//it return 6 languages } i assigning resulted combobox of method combobox in form, show languages this: combobox2 = classedefinicoes.updatecomboboxidioma(); but not show languages on form. what problem? in opinion not idea return combo control method. instead should values idioms enum , set datasource of combo - var combosource = enum.getvalues(typeof(idioms)); this.combobox2.datasource = combosource; or if prefer 1 liners :) this.combobox2.datasource = enum.getvalues(typeof(idioms));

objective c - iOS 9 constraint error -

this code: [self.collectionview settranslatesautoresizingmaskintoconstraints: no]; [self.view addconstraint:[nslayoutconstraint constraintwithitem:self.collectionview attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:self.toplayoutguide attribute:nslayoutattributetop multiplier:1.0f constant:1.0f]]; [self.view addconstraint:[nslayoutconstraint constraintwithitem:self.collectionview attribute:nslayoutattributebottom relatedby:nslayoutrelationequal toitem:self.bottomlayoutguide...

playframework 2.0 - Scala Type Mismatch issue when using import from different scope -

in project(play 2.4 slick 3.0), have setup: using mysql production , h2 unit testing(start feel horrible idea). that, have import slick.driver.jdbcprofile instead of specific driver (e.g. slick.driver.mysqldriver ) , import api._ in dao class, this: class somedao(val context: mycontext){ import context.profile.api._ import context.some_type def invoke(para: some_type) = { ... } // other dbio... } everything ok far, however, have service class requires dao, , type in context parameter: class myservice(val context: mycontext){ val somedao = new somedao(context) import somedao.context.some_type // works // import context.some_type // type mismatch! how avoid it??? def invokedaomethod(para: some_type) = somedao.invoke(para) // mismatch occurred // expect: myservice.this.somedao.context.some_type // actual: myservice.this.context.some_type } problem heppens when try import type exact same context instance, intuitively speaking, i'm using...

live connect sdk - Mobile screen mirroring and even injection -

Image
can use connect sdk mirror mobile screen (both ios , android) , event injection? aim stream mobile screen browser , injecting events based on user interaction (on browser). i don't want root/jailbreak. thanks for android devices know can. use vysor (beta) - google chrome extension mirrors android device pc/mac via usb. , can interact directly on mirrored screen on system , events replicated on physical device instantly. it connects , transitions super fast. small problem takes second display high resolution (a little blurry when moving fast no lags)

html - Apply css if element exists using CSS selector -

i have header in such way hide image , span's in pheader div if "banner" exists. there quick way using css selectors? below html code. <header> <div id="banner"> <!-- main content --> </div> <div class="pheader"> <div class="user-panel"> <div id="hey-user" class="d2c-user-panel"> <img src="../images/defaultheadshot_lg.png" class="userimg"> <!-- hide --> <span class="caret" id="down-arrow"></span> <span class="hey-user d2c-header-username"><b>hello</span> </div> </header> yes. #banner + .pheader img, #banner + .pheader span { display:none; } this selector applies if .pheader directly after #banner . you might find tutsplus article useful: the 30 css selectors must memorize ...

java - How do I avoid for my framework consumers to have to put the Spring @Conditional annotation? -

i have framework objects framework annotation have considered have @conditional spring annotation work. rather abstract spring , simplify api consumers. example, consumer has classes fooone , footwo have annotation bar - want fooone , footwo automatically considered have @conditional(baz.class) annotation. @bar("blahblah") @conditional(baz.class) // want implicit public class fooone { // stuff } @bar("blahblahblah") @conditional(baz.class) // want implicit public class footwo { // stuff } @retention(retentionpolicy.runtime) @inherited @configuration //@conditional(baz.class) - see second bullet below public @interface bar { // stuff } public class baz implements condition { @override public boolean matches(conditioncontext conditioncontext, annotatedtypemetadata annotatedtypemetadata) { map<string,object> barmetadata = annotatedtypemetadata.getannotationattributes("bar"); // stuff return som...

excel - Error "User-defined type not defined" -

i using below vba error "user-defined type not defined": option explicit dim cn adodb.connection function connect(server string, _ database string) boolean set cn = new adodb.connection on error resume next cn ' create connecting string .connectionstring = "provider=sqloledb.1;" & _ "integrated security=sspi;" & _ "server=" & server & ";" & _ "database=" & database & ";" ' open connection .open end ' check connection state if cn.state = 0 connect = false else connect = true end if end function function query(sql string) dim rs adodb.recordset dim field adodb.field dim col long ' open recordset / run query set rs = new adodb.recordset rs.open sql, cn, adopenst...

unity3d - Why I can't access my script variable from class? -

as topic says. can't access variable class made in same script. it's in same script, , variables(as see) public. ideas? tried googling "how access script variable class" didn't found anything. code: public var ludnosc = new array(); var humancount : int; public class human { public var id : byte; public var creaturetype = "human"; public var gender : boolean; // false = k, true = m //public var firstname : string; <- opcja wprowadzenia później //public var lastname : string; <- opcja wprowadzenia później public var age : byte; public var pregnant : boolean = false; function breed(partner) { if(this.age<16) { debug.log("woman id " + this.id + " young pregnant. must 16 or older."); } else { var success = random.range(0.0, makepregnantchance); debug.log("breed chance of partners ids [" + this.id + ", " + partner +...

How to force a delphi form to be in foreground in windows 10 tablet mode -

this setting: i have 2 views implemented within 2 different vcl forms. 1 of applied style make touch optimized metro app. forms can switched according application's setting. (show touch optimized view on/off) this works pretty good. override application.mainform , old form closes, new form appears (and takes focus). i want automated in windows 10. additional view mode offer option "auto detect": i listening windows message wm_settingchange . sent switching between desktop mode , tablet mode. then check registry value of hkey_current_user\software\microsoft\windows\currentversion\immersiveshell\tabletmode if it's 1 switch touch optimized view. and problem: the old form destroyed, new form pops , application.mainform references new form. buf afterwards start screen of tablet mode pops , shows on top of windows. new touch optimized form disappears behind screen , loses focus. behavior doesn't appear if set view fixed desktop view , switch windows...

php - MySql converts a floating value into integer when recording on a float field on DDBB -

Image
i have update query: update ws_users set us_credits='251181.5' us_id=2; the us_credits field, can see floating field default value of zero: every update query trying set floating value us_credits results on integer, example, query first typed results on 251182 record on field. if try make manual change record seen above, neither records floating value, integer ( 251184 in case): mysql permits nonstandard syntax: float(m,d) or real(m,d) or double precision(m,d). here, “(m,d)” means values can stored m digits in total, of d digits may after decimal point.for example, column defined float(7,4) -999.9999 when displayed. mysql performs rounding when storing values, if insert 999.00009 float(7,4) column, approximate result 999.0001. https://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html so need define column handing decimal points also.